/* Voxlbuilder — styled after the Voxlblade in-game inventory */
:root {
  --sand: #c39b62;
  --sand-edge: #6a4a26;
  --sand-line: #2c1c0d;
  --inset: #6b5133;
  --inset-2: #5d4630;
  --stat-bg: #6e5d49;
  --ink: #fff;
  --muted: #d8c6a8;
  --green: #4dff6a;
  --yellow: #fff23a;
  --red: #ff3b3b;
  --orange: #ff9a3c;
  --blue: #6ab4ff;
  --pixel: "Press Start 2P", monospace;
  --body: "Pixelify Sans", "Trebuchet MS", sans-serif;
  --sand-tex: none;
  --dark-tex: none;
  --stat-tex: none;
}

* { box-sizing: border-box; }

html { background: #1a0705; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  /* banded "world" behind the inventory, like the game backdrop */
  background:
    linear-gradient(180deg, #170604 0%, #2c0a06 18%, #4c1307 34%, #7a2a0d 50%, #a8460f 56%, #b4521a 64%, #a64714 100%);
  background-attachment: fixed;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: #8fd3ff; }

.outline {
  text-shadow:
    -1px -1px 0 #000, 0 -1px 0 #000, 1px -1px 0 #000, 1px 0 0 #000,
    1px 1px 0 #000, 0 1px 0 #000, -1px 1px 0 #000, -1px 0 0 #000, 1px 2px 0 #000, 0 2px 0 #000;
}
/* large pixel text keeps the in-game thick outline */
.sec-title.outline, .pname.outline, .lv.outline, .slot-title.outline, .cv-head h3.outline, .big.outline,
.txtbtn.outline, .loadout.outline, .topbar .outline, .modal-head h3.outline, .grid-empty.outline {
  text-shadow:
    -2px -2px 0 #000, 0 -2px 0 #000, 2px -2px 0 #000, 2px 0 0 #000,
    2px 2px 0 #000, 0 2px 0 #000, -2px 2px 0 #000, -2px 0 0 #000;
}

.thin-outline {
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, 1px 1px 0 #000, -1px 1px 0 #000, 0 2px 0 #000;
}

/* ---------------------------------------------------------------- top bar */
.topbar { display: flex; justify-content: center; padding: 0 16px; }
.topbar-tab {
  display: flex; align-items: center; gap: 24px;
  width: min(760px, 100%);
  padding: 8px 22px 9px;
  background: #0b0d1c;
  border-radius: 0 0 14px 14px;
  font-family: var(--pixel);
  font-size: 13px;
  color: #a8b8ff;
}
.brand { color: #ffd84a; font-size: 11px; }
.topbar-title { flex: 1; text-align: center; letter-spacing: 1px; }
.topbar-count { color: #ffe6a8; }

/* ---------------------------------------------------------------- panels */
.panel {
  position: relative;
  border: 3px solid var(--sand-line);
  box-shadow: inset 0 0 0 2px var(--sand-edge), 0 6px 0 rgba(0, 0, 0, 0.35);
}
.sand { background: var(--sand) var(--sand-tex); background-size: 128px; image-rendering: pixelated; }
.dark {
  background: var(--inset) var(--dark-tex);
  background-size: 128px;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35), inset 0 4px 0 rgba(0, 0, 0, 0.25);
}

.inv {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px 52px;
  gap: 0 8px;
  max-width: 1240px;
  margin: 18px auto 0;
  padding: 0 16px;
  align-items: start;
}

.main-panel {
  padding: 14px 18px 16px;
  min-height: 640px;
  min-width: 0;
}
.view-inv {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
}
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- view tabs */
.view-tabs { flex: 1; display: flex; justify-content: center; gap: 6px; }
.vtab {
  background: none; border: 0; padding: 2px 8px;
  font-family: var(--pixel); font-size: 12px; color: #98a3e0; letter-spacing: 1px;
}
.vtab:hover { color: #a8b8ff; }
.vtab.active { color: #ffffff; text-decoration: underline; text-underline-offset: 5px; }
.char-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 8px; }
.badge-btn {
  border: 2px solid #1b1108; background: #5c4228; box-shadow: inset 0 0 0 2px #8a6a44;
  padding: 5px 7px; font-family: var(--pixel); font-size: 9.5px; color: #fff3dc;
}
.badge-btn:hover { color: #fff; filter: brightness(1.15); }

/* ---------------------------------------------------------------- character view */
.cv-grid, .tv-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.tv-grid { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
.cv-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cv-sec { min-width: 0; }
.cv-sec + .cv-sec { margin-top: 12px; }
.cv-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.cv-head h3 { margin: 0; font-family: var(--pixel); font-size: 13px; font-weight: normal; color: #fff; }
.cv-sub { font-family: var(--pixel); font-size: 10px; color: #95feff; }
.cv-head .mode-tabs { margin-left: auto; }
.mode-tabs.wrap { flex-wrap: wrap; margin-left: 0; margin-bottom: 8px; }
.mode-tab:disabled { opacity: 0.35; cursor: default; }
.cv-note { margin-top: 8px; font-size: 14px; color: #2c1c0d; background: #d9b97f66; padding: 6px 8px; }
.cv-note b { font-family: var(--pixel); font-size: 10px; font-weight: normal; }
.cv-warn { margin: 0 0 8px; padding: 6px 8px; background: #4a1a10cc; color: #ffd0b0; font-size: 14px; border: 2px solid #1a0704; }
.muted { color: #f0e4cc; font-size: 14px; }
.cv-note .muted, .tv-setup .muted { color: #24160a; }

.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.pick {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 3px 5px;
  border: 2px solid #1a1007; background: #4a3620; box-shadow: inset 0 0 0 2px #7a5c38; min-width: 0;
}
.pick img { width: 54px; height: 54px; object-fit: contain; }
.pick-none { width: 54px; height: 54px; display: grid; place-items: center; font-family: var(--pixel); font-size: 18px; color: #b8a07a; }
.pick-name { font-family: var(--body); font-size: 13.5px; font-weight: 600; line-height: 1.1; text-align: center; color: #f3e6cc; overflow-wrap: anywhere; }
.pick:hover { box-shadow: inset 0 0 0 2px #e6d3b1; }
.pick.on { background: #2f4020; box-shadow: inset 0 0 0 3px #6dff9a; }

.art-grid { display: flex; flex-wrap: wrap; gap: 4px; max-height: 210px; overflow-y: auto; padding: 6px; background: #6b5133 var(--dark-tex); background-size: 128px; box-shadow: inset 0 0 0 2px rgba(0,0,0,.35); }
.art { border: 2px solid #1a1007; background: #4a3620; box-shadow: inset 0 0 0 2px #7a5c38; color: #f3e6cc; padding: 5px 7px; font-size: 13px; }
.art:hover { box-shadow: inset 0 0 0 2px #e6d3b1; }
.art.on { background: #18394a; color: #95feff; box-shadow: inset 0 0 0 2px #95feff; }

.wpn-top { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.part-slot {
  width: 104px; padding: 5px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 2px solid #1a1007; background: #4e3a24 var(--dark-tex); background-size: 96px;
  box-shadow: inset 0 0 0 2px #7a5c38;
}
.part-slot.selected { outline: 3px solid #fff; outline-offset: 1px; }
.part-img { width: 64px; height: 64px; display: grid; place-items: center; }
.part-img img { width: 64px; height: 64px; object-fit: contain; }
.part-empty { font-family: var(--pixel); font-size: 22px; color: #b8a07a; }
.part-lab { font-family: var(--pixel); font-size: 10px; color: #c9a8ff; }
.part-name { font-size: 13.5px; font-weight: 600; color: #fff3dc; text-align: center; line-height: 1.1; }
.wpn-plus { align-self: center; font-family: var(--pixel); font-size: 16px; color: #fff; }
.wpn-sum { flex: 1; min-width: 150px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.ws-type { font-family: var(--pixel); font-size: 11px; color: #ffd84a; }
.ws-line { font-size: 14px; color: #f3e6cc; }
.toggle { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 14px; color: #2c1c0d; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: #4a8f3a; flex: none; }
.wpn-detail { padding: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.wd-h { font-family: var(--pixel); font-size: 10px; color: #fff; margin-bottom: 4px; }
.wpn-detail .muted { color: #e2d4b8; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-block; padding: 2px 6px; background: #0004; font-family: var(--body); font-size: 13.5px; font-weight: 600; line-height: 1.35; color: #f3e6cc; }
.tbar { display: flex; justify-content: space-between; font-family: var(--pixel); font-size: 10px; line-height: 1.8; }
.tbar .tval { color: #f3e6cc; }
.part-grid { max-height: 320px; min-height: 160px; }

/* ---------------------------------------------------------------- test view */
.tv-setup .cv-sec { padding-bottom: 10px; border-bottom: 2px dashed #8a6a4466; }
.tchips { display: flex; flex-wrap: wrap; gap: 3px 6px; }
.tchip { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 600; color: #fff3dc; background: #0005; padding: 1px 6px 1px 4px; white-space: nowrap; }
.tchip i { width: 8px; height: 8px; background: var(--tc); display: inline-block; box-shadow: 0 0 0 1px #000; }
.step.col { flex-direction: column; align-items: flex-start; gap: 3px; padding: 4px 0; }
.ename { font-family: var(--pixel); font-size: 10px; font-weight: normal; color: #ffd84a; }
.swing-list { margin-top: 6px; }
.swing-list .step { flex-direction: column; align-items: flex-start; gap: 2px; }
.bar-row { grid-template-columns: 70px 1fr 110px !important; }
.opt-row { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; margin: 5px 0; }
.opt-row .toggle { margin: 0; }
.opt-row .lab { font-size: 13px; color: #2c1c0d; }
.opt-row .num { width: 80px; }
.opt-row .muted, .perk-row .muted { color: #24160a; font-size: 14px; }
.perk-row { padding: 4px 6px; background: #d9b97f55; }
.perk-row .muted { flex-basis: 100%; padding-left: 26px; }
.sub-h { font-family: var(--pixel); font-size: 10px; color: #fff; margin: 8px 0 2px; }
.sort.mini { max-width: 220px; padding: 4px 6px; font-size: 13px; }
.sit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px 10px; }
.sit { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: #2c1c0d; }
.tv-setup .chips .chip { font-family: var(--body); font-size: 13.5px; text-shadow: none; color: #fff3dc; background: #3b2a17; }
.form-card { margin: 0 0 8px; padding: 8px 10px; background: #6b5133 var(--dark-tex); background-size: 128px; box-shadow: inset 0 0 0 2px rgba(0,0,0,.35); }
.form-card .muted { color: #efe3cc; margin-top: 4px; }
.swing-chips { margin-top: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; align-items: center; }
.form-grid label, .def { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: #2c1c0d; }
.form-grid > .muted { grid-column: 1 / -1; font-size: 14px; }
.num {
  width: 100%; min-width: 0; border: 2px solid #1a1007; background: #3b2a17; color: #fff;
  padding: 5px 7px; font-size: 14px; box-shadow: inset 0 0 0 2px #6b5133;
}
.dot-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.dot-row .toggle { margin: 0; min-width: 120px; }
.dot-row .lab { font-size: 13px; color: #2c1c0d; }
.dot-row .num { width: 80px; }
.def-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.def span { font-family: var(--pixel); font-size: 10px; }

.tv-results { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.res-card { background: #6e5d49 var(--stat-tex); background-size: 128px; padding: 10px 12px; box-shadow: inset 0 0 0 2px rgba(0,0,0,.35); border: 2px solid #2c1c0d; }
.res-title { font-family: var(--pixel); font-size: 11px; color: #fff; margin-bottom: 8px; line-height: 1.5; }
.res-title .muted { font-family: var(--body); font-size: 13px; text-shadow: none; }
.big-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 6px; }
.big-row > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.big-row .lab { font-family: var(--pixel); font-size: 9.5px; color: #fff3dc; }
.big { font-family: var(--pixel); font-size: 18px; color: #fff; }
.mid { font-family: var(--pixel); font-size: 12px; color: #fff; }
.bars { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.bar-row { display: grid; grid-template-columns: 70px 1fr 64px; gap: 8px; align-items: center; font-family: var(--pixel); font-size: 10px; }
.bar-row b { text-align: right; color: #fff; font-weight: normal; }
.bar { height: 10px; background: #0004; display: block; }
.bar span { display: block; height: 100%; }
.steps summary { cursor: pointer; font-family: var(--pixel); font-size: 10px; color: #ffd84a; margin-top: 8px; }
.step { display: flex; justify-content: space-between; gap: 8px; font-size: 14.5px; color: #fff3dc; border-bottom: 1px solid #0002; padding: 2px 0; }
.step b { font-weight: 600; color: #fff; text-align: right; }
.dot-card { display: grid; grid-template-columns: 70px auto; gap: 2px 10px; align-items: baseline; padding: 4px 0; font-family: var(--pixel); font-size: 10px; }
.dot-card .muted { grid-column: 1 / -1; font-family: var(--body); font-size: 14px; }
.chart { width: 100%; height: 150px; margin-top: 8px; background: #0002; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 14px; font-weight: 600; color: #fff3dc; }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 4px; vertical-align: -1px; }
.res-card .chips .chip { font-family: var(--body); font-size: 13.5px; }

/* ---------------------------------------------------------------- character column */
.char-col { display: flex; flex-direction: column; align-items: center; }
.who { text-align: center; margin-bottom: 8px; }
.pname {
  background: none; border: 0; padding: 2px 6px;
  font-family: var(--pixel); font-size: 14px; color: #6dff9a;
  max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pname:hover { color: #b5ffc8; }
.lv { font-family: var(--pixel); font-size: 13px; color: #fff36a; margin-top: 6px; }

.cross {
  display: grid;
  grid-template-columns: repeat(3, 98px);
  grid-template-rows: repeat(3, 98px);
  gap: 8px;
  margin: 6px 0 14px;
}
.cross .cell-head { grid-area: 1 / 2; }
.cross .cell-ring { grid-area: 2 / 1; }
.cross .cell-chest { grid-area: 2 / 2; }
.cross .cell-rune { grid-area: 2 / 3; }
.cross .cell-legs { grid-area: 3 / 2; }
.cell { position: relative; }

.slot {
  position: relative;
  display: block;
  width: 98px; height: 98px;
  padding: 0;
  border: 0;
  background: none;
}
.slot-inner {
  position: absolute; inset: 0;
  background: #56402a var(--dark-tex);
  background-size: 96px;
  box-shadow: inset 0 0 0 3px #1a1007, inset 0 0 0 6px #3a2814;
  display: grid; place-items: center;
  overflow: hidden;
}
.slot.enchanted .slot-inner { box-shadow: none; }
.slot-inner img { width: 76px; height: 76px; object-fit: contain; }
.slot .ghost { width: 46px; height: 46px; opacity: 0.35; }
.slot:hover .slot-inner { filter: brightness(1.12); }
.slot.selected { outline: 3px solid #fff; outline-offset: 3px; }

/* enchant frame overlays: single enchants use the wiki enchant image; double/triple enchants use the
   wiki DE/TE frame art with a gradient of the enchant colors painted through its mask */
.frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.mframe {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: center / 100% 100% no-repeat;
}
.mframe.de { background-image: var(--de-border); }
.mframe.te { background-image: var(--te-border); }
.mfill {
  position: absolute; inset: 0;
  -webkit-mask: center / 100% 100% no-repeat;
  mask: center / 100% 100% no-repeat;
}
.mframe.de .mfill { -webkit-mask-image: var(--de-mask); mask-image: var(--de-mask); }
.mframe.te .mfill { -webkit-mask-image: var(--te-mask); mask-image: var(--te-mask); }
.slot-lvl {
  position: absolute; left: 4px; top: 3px; z-index: 1;
  font-family: var(--pixel); font-size: 10px; color: #fff36a;
}

.inf-wrap { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.inf-label { font-family: var(--pixel); font-size: 9.5px; color: #d7b8ff; }
.inf-row { display: flex; gap: 6px; }
.inf-slot {
  position: relative;
  width: 40px; height: 40px; padding: 0;
  border: 2px solid #1a1007;
  background: #4a3620 var(--dark-tex);
  background-size: 64px;
  box-shadow: inset 0 0 0 2px #6a4f86;
  display: grid; place-items: center;
}
.inf-slot img { width: 32px; height: 32px; object-fit: contain; }
.inf-slot .ghost { width: 20px; height: 20px; opacity: 0.3; }
.inf-slot:hover { box-shadow: inset 0 0 0 2px #c9a8ff; }
.inf-slot.selected { outline: 2px solid #fff; outline-offset: 2px; }
.inf-lvl {
  position: absolute; left: 2px; top: 1px;
  font-family: var(--pixel); font-size: 9px; color: #fff36a;
}

.loadouts { display: flex; gap: 20px; margin: 14px 0 8px; }
.loadout {
  width: 40px; height: 40px;
  border: 2px solid #1b1108;
  background: #5c4228 var(--dark-tex);
  background-size: 64px;
  box-shadow: inset 0 0 0 2px #8a6a44;
  font-family: var(--pixel); font-size: 15px; color: var(--red);
}
.loadout.active { color: var(--green); box-shadow: inset 0 0 0 2px #d6ffd6; }
.loadout:hover { filter: brightness(1.15); }

.char-actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

.txtbtn {
  background: none; border: 0; padding: 4px 6px;
  font-family: var(--pixel); font-size: 13px; letter-spacing: 0.5px;
  transition: transform 0.08s;
}
.txtbtn:hover:not(:disabled) { transform: translateY(-2px); }
.txtbtn:disabled { opacity: 0.35; cursor: default; }
.txtbtn.green { color: var(--green); }
.txtbtn.yellow { color: var(--yellow); }
.txtbtn.red { color: var(--red); }
.txtbtn.blue { color: var(--blue); }
.txtbtn.small { font-size: 10px; }

/* ---------------------------------------------------------------- middle column */
.mid-col { display: flex; flex-direction: column; min-width: 0; }
.mid-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.slot-title { margin: 0; font-family: var(--pixel); font-size: 15px; font-weight: normal; color: #fff; }
.mode-tabs { display: flex; gap: 6px; margin-left: auto; }
.mode-tab {
  border: 2px solid #1b1108; background: #5c4228; padding: 6px 9px;
  font-family: var(--pixel); font-size: 10px; color: #f3e6cc;
  box-shadow: inset 0 0 0 2px #8a6a44;
}
.mode-tab.active { background: #2f2140; color: #d7b8ff; box-shadow: inset 0 0 0 2px #a06bff; }

.forge { padding: 10px 12px; display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 4px 12px; min-height: 112px; }
.forge-thumb {
  grid-row: span 3;
  width: 70px; height: 70px;
  background: #3c2914; box-shadow: inset 0 0 0 2px #1a1007;
  display: grid; place-items: center;
  font-family: var(--pixel); font-size: 9px; color: #e6d3b1; text-align: center;
}
.forge-thumb img { width: 62px; height: 62px; object-fit: contain; }
.forge-name { font-family: var(--pixel); font-size: 11px; line-height: 1.5; min-width: 0; overflow-wrap: anywhere; }
.forge-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--pixel); font-size: 10px; color: #f3e6cc; }
.forge-row .lab { width: 64px; }
.pips { display: flex; gap: 4px; }
.pip {
  width: 18px; height: 18px; padding: 0; border: 2px solid #1a1007;
  background: #3c2914; box-shadow: inset 0 0 0 2px #6b5133;
}
.pip.on { background: #ffd84a; box-shadow: inset 0 0 0 2px #fff6b0; }
.stepper {
  width: 22px; height: 22px; padding: 0; border: 2px solid #1a1007; background: #5c4228;
  font-family: var(--pixel); font-size: 10px; color: #fff;
}
.stepper:disabled { opacity: 0.35; cursor: default; }
.cost { color: #ffe6a8; }
.sockets { display: flex; gap: 8px; }
.socket {
  width: 40px; height: 40px; padding: 0;
  border: 2px solid #1a1007; background: #2a1d10;
  box-shadow: inset 0 0 0 2px #7a5c38;
  display: grid; place-items: center;
  font-family: var(--pixel); font-size: 14px; color: #b8a07a;
}
.socket { position: relative; }
.socket.filled { background: #3a2a18; box-shadow: none; }
.sock-lab { position: relative; z-index: 2; font-family: var(--pixel); font-size: 9.5px; }
.socket:hover:not(:disabled) { box-shadow: inset 0 0 0 2px #fff; }
.socket:disabled { opacity: 0.4; cursor: default; }
.forge-note { grid-column: 2; font-size: 13px; color: #e9dcc4; }

.filters { display: flex; gap: 6px; margin: 10px 0 8px; }
.search, .sort {
  min-width: 0;
  border: 2px solid #1a1007; background: #3b2a17; color: #fff;
  padding: 7px 9px; font-size: 14px;
  box-shadow: inset 0 0 0 2px #6b5133;
}
.search { flex: 1; }
.search::placeholder { color: #d6c29c; }
.sort { max-width: 170px; }
.favtoggle {
  width: 38px; border: 2px solid #1a1007; background: #3b2a17; color: #8a7a5a;
  box-shadow: inset 0 0 0 2px #6b5133; font-size: 18px;
}
.favtoggle[aria-pressed="true"] { color: var(--yellow); }

.grid {
  flex: 1;
  min-height: 260px;
  max-height: 430px;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  align-content: start;
  scrollbar-color: #3c2914 #5a4128;
}
.tile {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 5px 3px 6px;
  border: 2px solid #1a1007;
  background: #4a3620;
  box-shadow: inset 0 0 0 2px #7a5c38;
  min-width: 0;
}
.tile img { width: 60px; height: 60px; object-fit: contain; }
.tile .tname { font-size: 13px; font-weight: 600; line-height: 1.1; text-align: center; color: #f3e6cc; overflow-wrap: anywhere; }
.tile:hover { box-shadow: inset 0 0 0 2px #e6d3b1; }
.tile.selected { box-shadow: inset 0 0 0 3px #fff; background: #5d4428; }
.tile .badge {
  position: absolute; top: 3px; font-family: var(--pixel); font-size: 9.5px;
}
.tile .badge.fav { right: 4px; color: var(--yellow); font-size: 11px; }
.tile .badge.eq { left: 4px; color: var(--green); }
.tile .badge.val { left: 50%; transform: translateX(-50%); top: auto; bottom: 22px; font-size: 9.5px; padding: 2px 4px; background: #000c; }
.grid-empty { grid-column: 1 / -1; text-align: center; color: #e6d3b1; padding: 30px 0; font-family: var(--pixel); font-size: 10px; }

.actions { display: flex; justify-content: center; gap: 22px; margin-top: 10px; }

/* ---------------------------------------------------------------- right column */
.right-col { display: flex; flex-direction: column; gap: 0; }
.stat-panel {
  background: var(--stat-bg) var(--stat-tex);
  background-size: 128px;
  padding: 8px 4px 8px 8px;
  height: 450px;
}
.stat-scroll, .desc-scroll { height: 100%; overflow-y: auto; padding-right: 6px; scrollbar-color: #3a3024 #6e5d49; }
.desc-panel {
  margin-top: -3px;
  background: var(--sand) var(--sand-tex);
  background-size: 128px;
  padding: 10px;
  height: 260px;
}
.desc-scroll { background: #6e5d49 var(--stat-tex); background-size: 128px; padding: 10px; box-shadow: inset 0 0 0 2px rgba(0,0,0,.3); }

.sec-title {
  font-family: var(--pixel); font-size: 14px; text-align: center; margin: 10px 0 4px;
}
.sec-title.boosts { color: var(--orange); }
.sec-title.defenses { color: var(--blue); }
.sec-title.perks { color: #ffd84a; }
.sec-title.derived { color: #d7b8ff; }
.sec-title.build { color: #6dff9a; }
.rule { height: 3px; background: #cfc6b8; margin: 0 22px 8px; box-shadow: 0 2px 0 #0005; }
.stat-line {
  font-family: var(--pixel); font-size: 11px; line-height: 1.95; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.empty-note { text-align: center; color: #efe3cc; font-size: 14px; margin: 18px 10px; }

.perk-card { margin: 0 4px 10px; padding: 8px; background: rgba(0, 0, 0, 0.22); box-shadow: inset 0 0 0 2px rgba(0,0,0,.25); }
.perk-card .pn { font-family: var(--pixel); font-size: 10px; color: #ffd84a; line-height: 1.5; }
.perk-card .pd { font-size: 13.5px; color: #f2e8d6; margin-top: 4px; }
.perk-card .ps { font-size: 12px; color: #c9b99c; margin-top: 4px; }

.field { display: block; margin: 0 4px 12px; }
.field > span { display: block; font-family: var(--pixel); font-size: 10px; color: #f3e6cc; margin-bottom: 5px; }
.field input, .field textarea {
  width: 100%; border: 2px solid #1a1007; background: #3b2a17; color: #fff; padding: 7px 8px; font-size: 14px;
  box-shadow: inset 0 0 0 2px #6b5133;
}
.field textarea { min-height: 90px; resize: vertical; }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; margin: 6px 0 12px; }
.mini-stats { font-size: 13px; color: #efe3cc; margin: 0 4px 10px; line-height: 1.5; }

/* description panel */
.d-name { font-family: var(--pixel); font-size: 11px; line-height: 1.5; margin-bottom: 4px; }
.d-sub { font-size: 14px; color: #f0e4cc; margin-bottom: 6px; }
.d-desc { font-size: 14px; font-style: italic; color: #fff8e8; margin-bottom: 8px; }
.d-stat { font-family: var(--pixel); font-size: 10px; line-height: 1.9; }
.d-perk { margin-top: 6px; font-size: 13.5px; color: #f2e8d6; }
.d-perk b { font-family: var(--pixel); font-size: 10px; color: #ffd84a; font-weight: normal; }
.d-list { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: #efe3cc; }
.d-hint { color: #efe3cc; font-size: 14px; }

/* ---------------------------------------------------------------- side tabs */
.sidetabs { display: flex; flex-direction: column; gap: 6px; }
.sidetab {
  width: 48px; height: 48px; padding: 6px;
  border: 2px solid #1b1108;
  background: #8c6a40 var(--sand-tex);
  background-size: 96px;
  box-shadow: inset 0 0 0 2px #5a4128;
  display: grid; place-items: center;
}
.sidetab svg { width: 30px; height: 30px; }
.sidetab.active { background-color: #e0c48c; box-shadow: inset 0 0 0 2px #fff; }
.sidetab:hover { filter: brightness(1.12); }

/* ---------------------------------------------------------------- enchant modal */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 4, 2, 0.6);
  display: grid; place-items: center;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal-box { width: min(720px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; padding: 14px; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.modal-head h3 { margin: 0; flex: 1; font-family: var(--pixel); font-size: 12px; font-weight: normal; line-height: 1.5; }
.xbtn { background: #5c4228; border: 2px solid #1b1108; width: 34px; height: 34px; font-family: var(--pixel); font-size: 12px; color: var(--red); }
.ench-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-family: var(--pixel); font-size: 10px; text-align: center; color: #fff; margin-bottom: 6px; }
.ench-cols span:last-child { color: #d7b8ff; }
.ench-list { overflow-y: auto; padding: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ench {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 2px 8px; align-items: start;
  text-align: left; padding: 6px;
  border: 2px solid #1a1007; background: #4a3620; box-shadow: inset 0 0 0 2px #7a5c38;
}
.ench-prev {
  position: relative; grid-row: span 2; width: 44px; height: 44px;
  background: #3a2a18; display: grid; place-items: center;
}
.ench-prev > img:first-child { width: 34px; height: 34px; object-fit: contain; }
.ench .en { font-family: var(--pixel); font-size: 10.5px; line-height: 1.5; }
.ench .ee { font-size: 13.5px; color: #fff3dc; line-height: 1.3; }
.ench .esrc { font-size: 13px; color: #ffd9a3; }
.ench:hover:not(:disabled) { box-shadow: inset 0 0 0 2px #fff; }
.ench.current { box-shadow: inset 0 0 0 3px #6dff9a; }
.ench:disabled { opacity: 0.35; cursor: not-allowed; }
.modal-foot { display: flex; justify-content: center; margin-top: 10px; }

/* ---------------------------------------------------------------- toast & footer */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 30px);
  background: #0b0d1c; border: 2px solid #a8b8ff; padding: 10px 14px;
  font-family: var(--pixel); font-size: 10px; color: #fff; line-height: 1.6;
  opacity: 0; pointer-events: none; transition: 0.2s; z-index: 60;
  display: flex; gap: 12px; align-items: center; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { background: none; border: 0; color: var(--yellow); font-family: var(--pixel); font-size: 10px; padding: 0; }

.credits { text-align: center; font-size: 13px; color: #ffe6c8; padding: 26px 16px 30px; }
.credits a { color: #ffe08a; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .inv { grid-template-columns: minmax(0, 1fr) 52px; }
  .right-col { grid-column: 1; grid-row: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
  .desc-panel { margin-top: 0; height: 450px; }
  .sidetabs { grid-column: 2; grid-row: 1; }
}

@media (max-width: 820px) {
  .inv { grid-template-columns: minmax(0, 1fr); }
  .sidetabs { grid-column: 1; grid-row: 2; flex-direction: row; justify-content: flex-end; margin-top: 8px; }
  .right-col { grid-row: 3; grid-template-columns: 1fr; }
  .main-panel { min-height: 0; }
  .view-inv, .cv-grid, .tv-grid { grid-template-columns: minmax(0, 1fr); }
  .vtab { font-size: 10px; padding: 2px 4px; }
  .desc-panel { height: 260px; }
  .topbar-tab { gap: 10px; font-size: 10px; padding: 8px 12px; }
  .brand { font-size: 9px; }
}

@media (max-width: 420px) {
  .main-panel { padding: 12px 10px; }
  .cross { grid-template-columns: repeat(3, 88px); grid-template-rows: repeat(3, 88px); gap: 6px; }
  .slot { width: 88px; height: 88px; padding: 6px; }
  .slot-inner img { width: 68px; height: 68px; }
  .forge { grid-template-columns: 54px minmax(0, 1fr); padding: 8px; }
  .forge-thumb { width: 54px; height: 54px; }
  .forge-thumb img { width: 48px; height: 48px; }
  .forge-row .lab { width: auto; }
  .filters { flex-wrap: wrap; }
  .search { flex-basis: 100%; }
  .sort { flex: 1; max-width: none; }
  .ench-list { grid-template-columns: 1fr; }
  .ench-cols { display: none; }
  .def-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wpn-detail, .form-grid { grid-template-columns: 1fr; }
  .big { font-size: 14px; }
  .brand { display: none; }
  .actions { gap: 10px; }
  .txtbtn { font-size: 11px; }
}

/* ---------------------------------------------------------------- legibility: plates under dark text */
.tv-setup .cv-sec, .cv-col .cv-sec {
  background: rgba(255, 238, 200, 0.5);
  border: 2px solid rgba(44, 28, 13, 0.35);
  padding: 8px 10px 10px;
}
.toggle, .opt-row .lab, .dot-row .lab, .form-grid label, .def, .sit { color: #1e1206; font-weight: 600; }
.toggle span { font-size: 14.5px; }
.cv-note { background: rgba(255, 238, 200, 0.75); color: #1e1206; font-size: 14.5px; }

/* results column: let number blocks and type bars wrap instead of colliding */
.big-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important; gap: 10px 12px; }
.big { font-size: 16px; white-space: nowrap; }
.mid { white-space: nowrap; }
.bar-row { grid-template-columns: 64px minmax(40px, 1fr) max-content !important; }
.bar-row b { white-space: nowrap; }
@media (min-width: 821px) { .tv-grid { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); } }

/* ================================================================ READABILITY PASS
   Press Start 2P only renders crisply at multiples of 8px, so it is used at 16px for headings,
   big numbers and main buttons; all other text uses bold Pixelify Sans. Text sits on solid
   (untextured) panels: dark panels with light ink, light plates with dark ink. */
:root {
  --ink-panel: #241a11;   /* solid dark panel behind light text */
  --ink-panel-2: #33261a; /* inset lists / forge */
  --plate: #f3e3c1;       /* solid light plate behind dark text */
  --plate-ink: #1a1008;
  --plate-ink-2: #3a2610;
  --light-ink: #fff6e6;
  --light-ink-2: #eadcc2;
}

/* crisp pixel text: 16px only */
.sec-title, .slot-title, .cv-head h3, .pname, .lv, .big, .txtbtn, .loadout, .modal-head h3,
.grid-empty, .xbtn, .vtab, .topbar-count { font-family: var(--pixel); font-size: 16px !important; letter-spacing: 0; }
.txtbtn.small { font-family: var(--body); font-size: 15px !important; font-weight: 700; }
.brand { font-family: var(--body); font-size: 16px; font-weight: 700; letter-spacing: 1px; }

/* everything else: bold Pixelify Sans */
.stat-line, .d-name, .d-stat, .d-perk b, .tbar, .bar-row, .forge-row, .forge-name, .sub-h, .wd-h, .ename, .field > span,
.mode-tab, .chip, .tchip, .part-lab, .part-name, .inf-label, .badge-btn, .big-row .lab, .mid, .def span, .cv-sub, .cv-note b,
.ench .en, .ench-cols, .steps summary, .dot-card, .perk-card .pn, .tile .badge, .sock-lab, .forge-thumb, .slot-lvl, .inf-lvl,
.toast, .toast button, .res-title, .ws-type, .pick-name, .tile .tname {
  font-family: var(--body) !important; font-weight: 700; letter-spacing: 0.2px;
}
.stat-line { font-size: 16px; line-height: 1.6; }
.d-name { font-size: 17px; }
.d-stat, .d-perk b { font-size: 15px; line-height: 1.5; }
.tbar, .forge-row, .wd-h, .def span, .ench-cols, .chip, .tchip, .mode-tab { font-size: 14px; }
.bar-row { font-size: 14px; }
.forge-name, .cv-sub, .cv-note b, .ench .en, .perk-card .pn, .ename, .dot-card, .res-title, .ws-type { font-size: 16px; }
.sub-h, .steps summary, .field > span, .inf-label { font-size: 14px; text-transform: uppercase; letter-spacing: 0.6px; }
.mid { font-size: 18px; }
.big-row .lab { font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.part-lab, .badge-btn, .tile .badge, .sock-lab, .forge-thumb { font-size: 13px; }
.slot-lvl { font-size: 15px; }
.inf-lvl { font-size: 12px; }
.toast, .toast button { font-size: 15px; }
.pick-name { font-size: 14px; }
.tile .tname { font-size: 14px; }

/* outlines: thick only for 16px pixel text; body text gets a single crisp drop shadow */
.outline { text-shadow: 0 2px 0 #000, 1px 1px 0 #000, -1px 1px 0 #000; }

/* solid dark panels (no texture) behind light text */
.stat-panel, .desc-scroll, .res-card { background: var(--ink-panel) !important; }
.dark, .form-card, .art-grid, .ench-list { background: var(--ink-panel-2) !important; }
.desc-panel { background: var(--sand) var(--sand-tex); }
.muted { color: var(--light-ink-2); }
.res-card .muted, .desc-scroll .muted, .form-card .muted, .wpn-detail .muted { color: var(--light-ink-2); }
.step, .legend, .tchip, .d-desc, .d-perk, .d-list, .pd, .ee { color: var(--light-ink); }
.d-sub { color: var(--light-ink-2); }
.d-hint, .empty-note { color: var(--light-ink-2); font-size: 15px; }
.forge-row, .forge-row .lab { color: var(--light-ink); }

/* solid light plates behind dark text */
.tv-setup .cv-sec, .cv-col .cv-sec { background: var(--plate) !important; border: 2px solid #5a3d1e !important; box-shadow: inset 0 0 0 2px #fff8e8; }
.perk-row { background: #e6cf9f !important; }
.cv-note { background: #fff4dc !important; color: var(--plate-ink); }
.cv-sec .cv-head h3, .cv-sec .sub-h { color: var(--plate-ink) !important; text-shadow: none !important; }
.cv-sec .cv-sub { color: #0b4f63 !important; text-shadow: none !important; }
.toggle, .opt-row .lab, .dot-row .lab, .form-grid label, .def, .sit, .toggle span { color: var(--plate-ink) !important; }
.cv-note .muted, .tv-setup .muted, .opt-row .muted, .perk-row .muted { color: var(--plate-ink-2) !important; }
.tv-setup .form-card .muted { color: var(--light-ink-2) !important; }
.inf-label { color: #2a1636; text-shadow: none !important; }
.cv-sec .def span.outline { text-shadow: 0 1px 0 #000, 1px 0 0 #000, -1px 0 0 #000, 0 -1px 0 #000; }

/* layout fixes for the larger text */
.forge-row .lab { width: auto; min-width: 84px; }
.actions { flex-wrap: wrap; gap: 8px 22px; }
.def-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.mode-tabs { flex-wrap: wrap; }
.cv-head .mode-tabs { margin-left: auto; }
.part-slot { width: 112px; }
@media (max-width: 820px) {
  .vtab { font-family: var(--body) !important; font-size: 15px !important; font-weight: 700; }
  .brand { display: none; }
}
@media (max-width: 420px) {
  .txtbtn { font-size: 16px !important; }
  .sec-title, .slot-title, .cv-head h3 { font-size: 16px !important; }
}

.cv-note b { color: #0e5f26 !important; text-shadow: none !important; }

/* rotation table (Test tab) */
.rot-grid { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; margin: 8px 0; }
.rot-grid.count { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.rot-grid .toggle { margin: 0; min-width: 0; }
.rot-grid .toggle span { min-width: 0; }
.rot-name { display: block; font-style: normal; font-size: 13px; color: var(--plate-ink-2); overflow-wrap: break-word; }
@media (max-width: 420px) { .rot-grid .num { width: 56px; } .rot-grid { gap: 6px 8px; } }
.rot-grid .num { width: 68px; }
.rot-h { font-size: 13px; font-weight: 700; letter-spacing: 0.5px; color: var(--plate-ink-2); }
.rot-cd { display: flex; align-items: center; gap: 4px; justify-content: flex-end; font-size: 14.5px; font-weight: 600; color: var(--plate-ink); }
.run-line { margin: 4px 0 8px; font-size: 15px; font-weight: 700; color: #ffe9a8; }

/* weapon art frame (Character tab) */
.art-picks { max-height: 330px; overflow-y: auto; padding: 4px; }
.art-pick { gap: 2px; }
.art-pick img { width: 58px; height: 58px; }
.pick-sub { font-size: 12.5px; font-weight: 700; color: #ffe9a8; }
.pick.bad { box-shadow: inset 0 0 0 3px #ff6a6a; }
.art-card { margin-top: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.art-card-top { display: flex; gap: 10px; align-items: center; }
.art-card-top img { width: 64px; height: 64px; flex: none; }
.art-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 6px 10px; }
.art-stats > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.art-stats .lab { font-size: 12.5px; font-weight: 700; letter-spacing: 0.5px; color: var(--light-ink-2); }
.art-stats b { font-size: 20px; color: #fff3dc; }
.art-locked .step { align-items: center; gap: 8px; }
.art-locked .step img { width: 26px; height: 26px; vertical-align: middle; margin-right: 6px; }
.art-locked .step span:first-child { display: flex; align-items: center; min-width: 0; }
.rot-lab { font-size: 14.5px; font-weight: 600; color: var(--plate-ink); min-width: 0; overflow-wrap: break-word; }
.tim-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 8px; }
.tim-row { display: flex; flex-direction: column; gap: 4px; padding-bottom: 6px; border-bottom: 1px solid #c9ad80; }
.tim-in { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.tim-in label { display: flex; align-items: center; gap: 5px; font-size: 13.5px; font-weight: 700; color: var(--plate-ink); }
.tim-in .num { width: 64px; }
.tim-in .rot-cd { justify-content: flex-start; }
.num::placeholder { color: #d9c6a0; opacity: 1; }
.rot-move { display: flex; gap: 2px; }
.rot-move .mv { width: 24px; height: 24px; padding: 0; font-size: 11px; line-height: 1; color: #fff3dc; background: #4a3620; border: 2px solid #1a1007; box-shadow: inset 0 0 0 1px #7a5c38; cursor: pointer; }
.rot-move .mv:hover:not(:disabled) { background: #6b4d2b; }
.rot-move .mv:disabled { opacity: 0.3; cursor: default; }
.rot-hint { font-size: 13.5px; margin-bottom: 6px; }
.enemy-row { display: flex; align-items: center; gap: 8px; margin: 8px 0 6px; }
.enemy-row img { width: 40px; height: 40px; object-fit: contain; flex: none; }
.enemy-row select { flex: 1; min-width: 0; }
.atk-pick .mode-tab, .type-pick .mode-tab { font-size: 13px; }
.inc-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.inc-sum .mode-tab { margin-left: auto; }
.inc-more { margin-top: 6px; }
.inc-sum .chip { background: #2a1c10 !important; border-color: #1a1007; }
.cv-sec details.inc-more { background: transparent !important; box-shadow: none !important; padding: 0; }
.cv-sec .inc-more > summary { color: var(--plate-ink) !important; text-shadow: none !important; font-weight: 700; }
.rot-move { flex-direction: column; gap: 1px; }
.rot-move .mv { width: 22px; height: 15px; font-size: 9px; }
.rot-grid .num { width: 56px; }
.rot-grid .rot-cd .num { width: 50px; }
.rot-grid { gap: 6px 8px; }
.rot-grid { grid-template-columns: auto minmax(0, 1fr) !important; }
.rot-grid.count { grid-template-columns: auto minmax(0, 1fr) auto !important; }
.rot-name { overflow-wrap: normal; }
.rot-extra { grid-column: 2 / -1; display: flex; align-items: center; gap: 6px; margin-top: -2px; }
.rot-extra .lab { font-size: 13px; font-weight: 700; color: var(--plate-ink); }

/* ================================================================ compact Test tab */
@media (min-width: 821px) {
  /* setup and results scroll on their own, so changing a setting never scrolls the numbers away */
  .view-test .tv-grid { height: calc(100vh - 150px); min-height: 480px; align-items: stretch; }
  .view-test .tv-setup, .view-test .tv-results { height: 100%; overflow-y: auto; padding-right: 4px; scrollbar-color: #5a3d1e transparent; }
}
.tv-setup .cv-sec { padding: 6px 8px 8px; }
.tv-setup .cv-sec + .cv-sec { margin-top: 6px; }
.tv-setup .tsec .cv-head { margin-bottom: 0; flex-wrap: nowrap; }
.tv-setup .tsec.open .cv-head { margin-bottom: 6px; flex-wrap: wrap; }
.sec-toggle { display: flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; cursor: pointer; flex: none; }
.sec-toggle .caret { font-size: 13px; width: 12px; color: var(--plate-ink); }
.sec-toggle:hover h3 { text-decoration: underline; }
.sec-sum { flex: 1 1 0; min-width: 0; font-size: 13.5px; font-weight: 600; color: var(--plate-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.form-line { font-size: 13.5px; color: var(--plate-ink); margin: 6px 0; line-height: 1.3; }
.form-line .muted { color: var(--plate-ink-2) !important; }
.tv-setup .opt-row { margin: 4px 0; }
.tv-setup .form-grid { gap: 6px 10px; }
.sub-fold { margin-top: 6px; }
.cv-sec .sub-fold > summary { color: var(--plate-ink) !important; text-shadow: none !important; font-weight: 700; }
.cv-sec .sub-fold > summary .muted { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.cv-sec details.sub-fold { background: transparent !important; box-shadow: none !important; padding: 0; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; position: sticky; top: 0; z-index: 5; padding-bottom: 4px; background: var(--sand); }
.kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; padding: 6px 8px; text-align: left; cursor: pointer;
  background: var(--ink-panel); border: 2px solid #1a1007; box-shadow: inset 0 0 0 2px #4a3620; }
.kpi:hover { box-shadow: inset 0 0 0 2px #a8885a; }
.kpi.on { box-shadow: inset 0 0 0 3px #ffd84a; }
.kpi .lab { font-size: 12px; font-weight: 700; letter-spacing: 0.5px; color: var(--light-ink-2); }
.kpi b { font-family: var(--body); font-size: 21px; font-weight: 700; white-space: nowrap; line-height: 1.1; }
.kpi-sub { font-size: 12.5px; font-weight: 600; color: var(--light-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
@media (max-width: 820px) {
  /* one column: the numbers stay pinned to the bottom of the screen while you edit */
  .view-test:not([hidden]) .kpis { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 60; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: #1a1208; box-shadow: 0 -2px 0 #000; }
  .view-test:not([hidden]) { padding-bottom: 76px; }
  .kpi { padding: 4px 6px; }
  .kpi b { font-size: 17px; }
  .kpi-sub { display: none; }
}
.tv-setup .tsec:not(.open) .cv-head { overflow: hidden; }
.tv-setup .tsec .def-grid { margin-top: 2px; }
