body {
  margin: 0;
  font-family: Arial;
  background: #0d0d0d;
  color: white;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Top tab bar */
.tabbar {
  display: flex;
  background: #141414;
  border-bottom: 1px solid #2a2a2a;                                                                                                    
  justify-content: center;
}

.tab {
  padding: 12px 20px;
  background: none;
  border: none;
  color: gray;
  cursor: pointer;
}

.tab:hover {
  background: #1f1f1f;
  color: white;
}

.tab.active {
  background: #2a2a2a;
  color: white;
  border-bottom: 2px solid white;
}

/* Stats */
.box-row {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
  justify-content: center;
}

.box-row .box {
  margin-bottom: 0;
}

.box {
  display: inline-block;
  background: #1f1f1f;
  border: 1px solid #333;
  padding: 8px 16px;
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 14px;
  color: #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.box span {
  color: white;
  font-weight: bold;
}


.race-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
  width: 100%;
}

.race-label {
  font-size: 13px;
  color: #aaa;
  letter-spacing: 1px;
}

#race-picker {
  background: #1a1a1a;
  border: 1px solid #444;
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
}

#race-picker:focus {
  outline: none;
  border-color: #666;
}

#class-picker,
#super-picker,
#sub-picker {
  background: #1a1a1a;
  border: 1px solid #444;
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
}

#class-picker:focus,
#super-picker:focus,
#sub-picker:focus {
  outline: none;
  border-color: #666;
}

#class-picker:disabled,
#super-picker:disabled,
#sub-picker:disabled,
#covenant-picker:disabled,
#covenant-rank:disabled {
  opacity: 0.4;
  cursor: default;
}

.class-cost-note {
  font-size: 11px;
  color: #666;
  text-align: center;
  margin-top: -8px;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.covenant-cost-note {
  margin-top: 2px;
}

.stat-base {
  order: 5;
  width: 28px;
  font-size: 11px;
  color: #4caf8a;
  text-align: left;
}

.stat-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: fit-content;
  margin: 0 auto;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-name {
  width: 50px;
  font-size: 13px;
  color: #aaa;
  letter-spacing: 1px;
}

.stat-btn {
  width: 28px;
  height: 28px;
  background: #2a2a2a;
  border: 1px solid #444;
  color: white;
  cursor: pointer;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1;
}

.stat-btn:hover {
  background: #3a3a3a;
}

.stat-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* Content */
.content {
  flex: 1;
  padding: 8px 20px;
  overflow-y: auto;
  display: flex;                                                                                                         
  justify-content: center;   
}

.panel {
  display: none;
}

.panel.active {
  display: flex;
  justify-content: center;
  width: 100%;
}

.stats-columns {
  display: flex;
  gap: 48px;
  align-items: flex-start;
}

.stats-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 400px;
}

.stats-left h2 {
  text-align: center;
  width: 100%;
}

#Lvl {
  width: 48px;
  text-align: center;
  font-size: 14px;
  font-weight: bold;
  background: #111;
  border: 1px solid #555;
  border-radius: 6px;
  color: white;
  padding: 4px 6px;
  margin-left: 6px;
  -moz-appearance: textfield;
  transition: border-color 0.15s;
}

#Lvl:hover {
  border-color: #888;
}

#Lvl:focus {
  outline: none;
  border-color: #aaa;
}

#Lvl::-webkit-outer-spin-button,
#Lvl::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

#Gold {
  font-size: 14px;
  font-weight: bold;
  color: #f0c040;
  margin-left: 4px;
}

.stat-val {
  width: 50px;
  text-align: center;
  font-size: 16px;
  background: #1a1a1a;
  border: 1px solid #444;
  color: white;
  border-radius: 4px;
  padding: 2px 4px;
  -moz-appearance: textfield;
}

.stat-val::-webkit-outer-spin-button,
.stat-val::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.stat-percent {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 8px;
  width: 100%;
}

.percent-item {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 32px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 0 10px;
  min-width: 52px;
}

.percent-val {
  font-size: 9px;
  font-weight: bold;
  color: white;
  line-height: 1;
  margin-bottom: 3px;
}

.percent-label {
  font-size: 12px;
  color: #555;
  letter-spacing: 1px;
  line-height: 1;
}


.marks-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
  width: 180px;
}

.marks-section h2 {
  margin: 0 0 6px 0;
  text-align: center;
}

.mark-picker {
  background: #1a1a1a;
  border: 1px solid #444;
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
}

.mark-picker:focus {
  outline: none;
  border-color: #666;
}

.enchant-info-section {
  margin-bottom: 24px;
  border-bottom: 1px solid #2a2a2a;
  padding-bottom: 16px;
}

.enchant-info-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

#enchant-picker {
  background: #1a1a1a;
  border: 1px solid #444;
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
}

#enchant-picker:focus {
  outline: none;
  border-color: #666;
}

#artifact-picker {
  background: #1a1a1a;
  border: 1px solid #444;
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
}

#artifact-picker:focus {
  outline: none;
  border-color: #666;
}

.enchant-desc {
  font-size: 11px;
  color: #888;
  line-height: 1.5;
  max-width: 480px;
}

.shards-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.shard-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 160px;
}

.shard-slot .wpick-wrap {
  flex: 1;
  min-width: 0;
}

.shard-label {
  font-size: 11px;
  color: #888;
  width: 20px;
  flex-shrink: 0;
  text-align: right;
}

.shard-picker {
  background: #1a1a1a;
  border: 1px solid #444;
  color: white;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  width: 100%;
}

.shard-picker:focus {
  outline: none;
  border-color: #666;
}

/* Soul Tree */
.soul-tree-columns {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  padding: 20px;
  width: 100%;
  box-sizing: border-box;
}

.soul-tree-path {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.soul-path-title {
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #aaa;
  border-bottom: 1px solid #2a2a2a;
  padding-bottom: 6px;
  margin: 0 0 6px;
}

.soul-node {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.soul-node-active {
  border-color: #3a3060;
}

.soul-node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.soul-node-name {
  font-size: 12px;
  font-weight: bold;
  color: white;
}

.soul-rank-ctrl {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.soul-btn {
  width: 20px;
  height: 20px;
  background: #2a2a2a;
  border: 1px solid #444;
  color: white;
  cursor: pointer;
  border-radius: 3px;
  font-size: 13px;
  line-height: 1;
  padding: 0;
}

.soul-btn:hover { background: #3a3a3a; }

.soul-rank-val {
  font-size: 11px;
  color: #a99dff;
  min-width: 36px;
  text-align: center;
}

.soul-node-desc {
  font-size: 11px;
  color: #aaa;
  line-height: 1.4;
}

.soul-node-footer {
  font-size: 10px;
  color: #555;
}

.soul-next-cost { color: #666; }

.soul-maxed {
  color: #f0c040;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.enchant-name {
  font-size: 13px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 4px;
}

.enchant-level {
  font-size: 10px;
  font-weight: bold;
  color: #f0c040;
  letter-spacing: 0.5px;
}

.gear-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: 4px;
}

.gear-section h2 {
  margin: 0 0 6px 0;
  text-align: center;
}

.gear-sub-header {
  margin: 4px 0 1px 0;
  border-top: 1px solid #2a2a2a;
  padding-top: 4px;
}

.gear-slot {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gear-label {
  font-size: 12px;
  color: #aaa;
  letter-spacing: 1px;
}

.gear-picker,
.weapon-picker,
.armour-picker,
.covenant-picker {
  background: #1a1a1a;
  border: 1px solid #444;
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  min-width: 160px;
}

.gear-picker:focus,
.weapon-picker:focus,
.armour-picker:focus,
.covenant-picker:focus {
  outline: none;
  border-color: #666;
}

.covenant-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.covenant-row .covenant-picker {
  flex: 1;
}

.covenant-rank-input {
  width: 45px;
  min-width: 45px;
  background: #1a1a1a;
  border: 1px solid #444;
  color: #ccc;
  border-radius: 4px;
  padding: 4px 0 4px 4px;
  font-size: 13px;
}

.covenant-rank-input:focus {
  outline: none;
  border-color: #666;
}

/* Custom weapon dropdown */
.wpick-wrap {
  position: relative;
  min-width: 160px;
}

.wpick-display {
  background: #1a1a1a;
  border: 1px solid #444;
  color: #ccc;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.wpick-display:hover {
  border-color: #666;
  color: white;
}

.wpick-panel {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 200;
  background: #1a1a1a;
  border: 1px solid #555;
  border-radius: 4px;
  overflow: hidden;
}

.wpick-search {
  display: block;
  width: 100%;
  box-sizing: border-box;
  background: #111;
  border: none;
  border-bottom: 1px solid #333;
  color: white;
  padding: 6px 10px;
  font-size: 12px;
  outline: none;
}

.wpick-list {
  max-height: 160px;
  overflow-y: auto;
}

.wpick-group {
  padding: 5px 10px 2px;
  font-size: 10px;
  color: #555;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.wpick-item {
  padding: 5px 12px;
  font-size: 13px;
  color: #bbb;
  cursor: pointer;
}

.wpick-item:hover {
  background: #2a2a2a;
  color: white;
}

.wpick-item.wpick-selected {
  background: #333;
  color: white;
}

.wpick-item.wpick-disabled {
  color: #444;
  cursor: not-allowed;
}

/* Moves panel */
.moves-container {
  width: 100%;
  max-width: 1100px;
}

.moves-placeholder {
  color: #555;
  text-align: center;
  margin-top: 40px;
}

.moves-empty {
  color: #444;
  font-size: 12px;
  margin: 4px 0 8px;
}

.moves-columns {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 32px;
}

.moves-col {
  flex: 1;
  min-width: 0;
}

.moves-entity-label {
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #555;
  margin-bottom: 2px;
}

.moves-race-title {
  text-align: center;
  margin: 0 0 8px;
  font-size: 15px;
}

.moves-section-title {
  color: #aaa;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 1px solid #2a2a2a;
  padding-bottom: 4px;
  margin: 18px 0 8px;
}

.moves-super-section {
  border-top: 1px solid #2a2a2a;
  padding-top: 20px;
  margin-bottom: 32px;
}

.moves-combined-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  border-top: 2px solid #333;
  padding-top: 20px;
}

.moves-combined-section {
  min-width: 0;
}

.moves-combined-title {
  font-size: 15px;
  color: #aaa;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0 0 12px;
}

.move-learn-header {
  font-size: 11px;
  color: #666;
  margin: 10px 0 4px;
  letter-spacing: 0.5px;
}

.move-learn-level {
  color: #444;
}

.move-card {
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.move-card.active-move {
  border-color: #3a3060;
}

.move-card.passive {
  border-color: #1e3a2e;
}

.move-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.move-badge {
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}

.active-badge {
  background: #2e2455;
  color: #a99dff;
}

.passive-badge {
  background: #1a3328;
  color: #5ecfa0;
}

.move-level {
  font-size: 11px;
  color: #555;
}

.move-name {
  font-size: 13px;
  font-weight: bold;
  color: white;
}

.move-quote {
  font-size: 11px;
  color: #666;
  font-style: italic;
}

.move-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.move-stat {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 3px;
  padding: 2px 7px;
  font-size: 10px;
  color: #bbb;
}

.move-desc {
  font-size: 11px;
  color: #aaa;
  line-height: 1.5;
}

.move-image {
  width: 100%;
  max-width: 260px;
  border-radius: 4px;
  margin-top: 2px;
  border: 1px solid #2a2a2a;
  align-self: flex-start;
}

/* ===================== MASTERY TREE ===================== */

.mastery-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  width: 100%;
}

.mastery-stats-bar {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
}

.mastery-tracker-box {
  background: #1f1f1f;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  color: #aaa;
}

.mastery-tracker-box b {
  color: white;
}

.mastery-reset-btn {
  background: #2a2a2a;
  border: 1px solid #555;
  color: #aaa;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.mastery-reset-btn:hover {
  background: #3a3a3a;
  color: white;
}

.mastery-tree-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative;
}

.mastery-lines-svg {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 0;
}

/* Trunk */
.mastery-trunk {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-bottom: 18px;
}

/* Branches row */
.mastery-branches {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.mastery-locked-msg {
  color: #666;
  font-size: 14px;
  padding: 48px 0;
  text-align: center;
}

.mastery-passive-card {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 8px;
}

.mastery-passive-name {
  font-weight: bold;
  color: #c9a227;
  font-size: 14px;
  margin-bottom: 4px;
}

.mastery-passive-desc {
  color: #bbb;
  font-size: 13px;
  line-height: 1.5;
}

.mastery-branch-label {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 6px;
  text-align: center;
}

/* Individual branch column */
.mastery-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative;
}

/* Each row of nodes within a branch */
.mastery-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  position: relative;
}

.mn-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 0;
  position: relative;
  z-index: 1;
}

/* Give the mastery node's wrap enough room so the rotated diamond doesn't clip */
.mn-wrap:has(.mn-type-mastery) {
  padding: 6px;
}

/* Base node styles */
.mn-node {
  border: 2px solid #555;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  user-select: none;
}

/* Regular node — oval */
.mn-type-node {
  width: 38px;
  height: 24px;
  border-radius: 50%;
}

/* Breakthrough — small square */
.mn-type-breakthrough {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  border-width: 2px;
  border-style: double;
}

/* Mastery — large rotated diamond */
.mn-type-mastery {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  transform: rotate(45deg);
  border-width: 2px;
}

/* Locked state */
.mn-locked {
  opacity: 0.35;
}

/* Can't deactivate (has children active) */
.mn-child-locked.mn-active {
  opacity: 0.8;
}

/* === Shared / trunk === */
.mn-shared                    { border-color: #666; background: #1e1e1e; }
.mn-shared.mn-active          { border-color: #ccc; background: #383838; box-shadow: 0 0 8px #88888855; }
.mn-shared:hover:not(.mn-locked) { background: #2a2a2a; }

/* === Red branch === */
.mn-red                        { border-color: #772222; background: #180808; }
.mn-red.mn-active              { border-color: #ff4444; background: #3a0d0d; box-shadow: 0 0 8px #ff222255; }
.mn-red:hover:not(.mn-locked):not(.mn-child-locked)  { background: #220e0e; }

/* === Green branch === */
.mn-green                      { border-color: #226622; background: #081508; }
.mn-green.mn-active            { border-color: #44cc44; background: #0d3a0d; box-shadow: 0 0 8px #22cc2255; }
.mn-green:hover:not(.mn-locked):not(.mn-child-locked) { background: #0e220e; }

/* === Blue branch === */
.mn-blue                       { border-color: #224488; background: #08081a; }
.mn-blue.mn-active             { border-color: #4488ff; background: #0d1840; box-shadow: 0 0 8px #2255ff55; }
.mn-blue:hover:not(.mn-locked):not(.mn-child-locked)  { background: #0e0e2a; }

/* Keep diamond rotation correct for colored variants */
.mn-type-mastery.mn-red.mn-active    { box-shadow: 0 0 12px #ff222288; }
.mn-type-mastery.mn-green.mn-active  { box-shadow: 0 0 12px #22cc2288; }
.mn-type-mastery.mn-blue.mn-active   { box-shadow: 0 0 12px #2255ff88; }