/* ============ QWEN SURVIVORS — styles ============ */
:root {
  --bg: #05070f;
  --panel: rgba(10, 14, 26, 0.84);
  --line: rgba(120, 150, 200, 0.25);
  --text: #e8ecf8;
  --dim: #93a0bd;
  --accent: #5eead4;
  --accent2: #f5c66b;
  --danger: #ff5d73;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  user-select: none; -webkit-user-select: none;
  overscroll-behavior: none;
}

#game {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
}

.hidden { display: none !important; }
.dim { color: var(--dim); }

/* ============ damage flash ============ */
#hurt-flash {
  position: fixed; inset: 0; z-index: 15; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(214, 28, 52, 0.42) 100%);
  opacity: 0; transition: opacity 0.18s ease-out;
}
#hurt-flash.on { opacity: 1; transition: opacity 0.04s; }

/* ============ HUD ============ */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }

#hud-left {
  position: absolute; top: calc(10px + var(--safe-t));
  left: calc(12px + var(--safe-l));
  display: flex; flex-direction: column; gap: 5px;
}
.bar {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: 6px;
  background: rgba(4, 8, 16, 0.72);
}
.bar.hp-bar { width: clamp(140px, 24vw, 250px); height: 20px; }
.bar.hp-bar.low #hp-fill { animation: hpLow 0.6s infinite alternate; }
@keyframes hpLow { to { filter: brightness(1.9); } }
.bar.xp-bar { width: clamp(110px, 18vw, 200px); height: 10px; border-radius: 5px; }
.bar-fill {
  position: absolute; inset: 0;
  transform-origin: 0 50%;
  will-change: transform;
}
/* 11.8 — HP fill themed per seat-0/seat char (--char* set in hud.js, D62 channel);
   fallback = original red-orange. .hp-bar .bar-fill (NOT #hp-fill) so the co-op
   seat panels' fills get a background too (11.7 left them unstyled). */
.hp-bar .bar-fill { background: var(--char-grad, linear-gradient(90deg, #e6455f, #ff8f6b)); box-shadow: 0 0 10px var(--char-inset, rgba(255, 90, 110, 0.5)) inset; }
/* 23.3 — over-health (Phoenix Heart): bonus segment behind the HP fill + gold bar
   frame while any over-health pool exists (paired HUD work with Phase 19). */
.hp-bar .oh-fill { background: linear-gradient(90deg, rgba(255, 214, 120, 0.85), rgba(255, 170, 60, 0.6)); }
.bar.hp-bar.over { border-color: #ffd75e; box-shadow: 0 0 8px rgba(255, 215, 94, 0.5); }
#xp-fill { background: linear-gradient(90deg, #14b8a6, #6ee7b7); }
.bar-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; letter-spacing: 0.04em;
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
}
#hud-row { display: flex; align-items: center; gap: 8px; }
#lvl-badge {
  min-width: 46px; height: 22px; line-height: 20px; text-align: center;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel);
  font-size: 11px; font-weight: 800; color: var(--accent2);
  padding: 0 4px;
}

/* 19.1 equipment row — always-visible loadout chips (icon + level), beneath the XP bar.
   Wraps so cap-5 weapons + synergies + passives never overflow; number badge is high-
   contrast on a solid pill so it stays legible over any world tile. */
#equip-row {
  display: flex; flex-wrap: wrap; gap: 4px;
  max-width: clamp(160px, 30vw, 280px);
}
.equip-chip {
  position: relative; width: 34px; height: 34px; border-radius: 7px;
  background: var(--panel); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
.equip-icon { width: 34px; height: 34px; display: block; image-rendering: auto; }
.equip-lvl {
  position: absolute; right: -3px; bottom: -3px;
  min-width: 15px; height: 15px; line-height: 15px; padding: 0 3px;
  border-radius: 8px; text-align: center;
  background: #0b1220; border: 1px solid var(--accent2);
  font-size: 10px; font-weight: 800; color: #ffe9b0;
}

#hud-top {
  position: absolute; top: calc(8px + var(--safe-t));
  left: 50%; transform: translateX(-50%);
  text-align: center;
}
#timer {
  font-size: clamp(20px, 4.4vmin, 32px);
  font-weight: 800; line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(94, 234, 212, 0.45), 0 2px 3px #000;
}
#score {
  font-size: clamp(12px, 2.2vmin, 16px);
  font-weight: 700; color: var(--accent2);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px #000;
}
/* 14.1: in-run projected Soulshard award (rides #hud-top under the score) */
#hud-shards {
  margin-top: 2px;
  font-size: clamp(11px, 2vmin, 15px);
  font-weight: 700; color: var(--accent2);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px #000;
  opacity: 0.9;
}

#hud-right {
  position: absolute; top: calc(10px + var(--safe-t));
  right: calc(12px + var(--safe-r));
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
#minimap-frame {
  width: clamp(137.5px, 25vmin, 237.5px);
  aspect-ratio: 4200 / 3200;
  border: 1px solid var(--line); border-radius: 8px;
  background: rgba(4, 8, 16, 0.72);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
#minimap { width: 100%; height: 100%; display: block; }
#hud-buttons { display: flex; gap: 6px; pointer-events: auto; }
.hud-btn {
  width: 72px; height: 72px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); color: var(--text);
  font-size: 13px; font-weight: 800; letter-spacing: 0.06em;
  cursor: pointer;
}
.hud-btn:active { transform: scale(0.94); }
/* dash status for ALL environments (the touch ring lives on #btn-dash); same --cd conic sweep */
#btn-dash-hud {
  display: grid; place-items: center;
  color: var(--char, var(--accent));
  border: 2px solid var(--char-line, rgba(94, 234, 212, 0.65));
  background:
    radial-gradient(circle, var(--char-soft, rgba(94, 234, 212, 0.16)) 0 58%, transparent 60%),
    conic-gradient(rgba(2, 8, 16, 0.72) calc(var(--cd, 0) * 1turn), transparent 0),
    var(--panel);
}

/* 11.7 — co-op corner panels (seats 1–3; #hud-left is always seat 0). Display-only;
   display:none until the seat is occupied (visible count = player count). */
.seat-panel {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: clamp(140px, 24vw, 250px);
  pointer-events: none;
}
.seat-panel.off { display: none; }
#hud-seat-1 { top: calc(96px + var(--safe-t)); right: calc(12px + var(--safe-r)); }
#hud-seat-2 { bottom: calc(16px + var(--safe-b)); left: calc(12px + var(--safe-l)); }
#hud-seat-3 { bottom: calc(16px + var(--safe-b)); right: calc(12px + var(--safe-r)); }
.seat-face { width: 44px; height: auto; image-rendering: pixelated; }
.seat-name {
  font-size: 11px; font-weight: 800; letter-spacing: 0.06em;
  text-shadow: 0 1px 2px #000;
}
.seat-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.seat-lvl {
  min-width: 46px; height: 22px; line-height: 20px; text-align: center;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel);
  font-size: 11px; font-weight: 800; color: var(--accent2);
  padding: 0 4px;
}
.seat-dash {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--char-line, rgba(94, 234, 212, 0.65));
  background:
    radial-gradient(circle, var(--char-soft, rgba(94, 234, 212, 0.16)) 0 58%, transparent 60%),
    conic-gradient(rgba(2, 8, 16, 0.72) calc(var(--cd, 0) * 1turn), transparent 0);
}
/* 19.3 co-op seat panels: compact equipment chips (smaller than the seat-0 row). */
.seat-equip { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; max-width: 100%; }
.seat-equip .equip-chip, .seat-equip .equip-icon { width: 24px; height: 24px; }
.seat-equip .equip-lvl { min-width: 13px; height: 13px; line-height: 13px; font-size: 9px; }
/* 11.7 + 11.9 — co-op: minimap moves to bottom-center at ~66% of the solo size (it
   would collide with the seat-1 TR panel at 2P); PAUSE relocates beside it (req 6a);
   the DASH button stays top-right with the seat panels (local input, 11.7);
   mute stays in Pause-menu Settings (13.8/D72 — no mute move). */
#hud.coop {
  --coop-mm: clamp(91px, 16.5vmin, 157px);
}
#hud.coop #minimap-frame {
  position: fixed; top: auto; bottom: calc(16px + var(--safe-b));
  left: 50%; transform: translateX(-50%);
  width: var(--coop-mm);
}
#hud.coop #btn-pause {
  position: fixed;
  bottom: calc(16px + var(--safe-b));
  left: calc(50% - var(--coop-mm) / 2 - 80px);
  transform: translateX(-100%);
}
/* 11.12 — co-op corner layout on small screens (mobile parity): at narrow widths the
   BL/BR seat panels (140px min) would overlap the co-op bottom-center minimap + PAUSE
   cluster (all anchored bottom:16px) — lift the bottom seat panels above the cluster
   (clears the 91px-min minimap, which is 69px tall, with margin; display-only panels,
   no touch targets moved — the ≥72 px PAUSE/DASH targets are untouched). */
@media (max-width: 520px) {
  #hud.coop #hud-seat-2, #hud.coop #hud-seat-3 { bottom: calc(112px + var(--safe-b)); }
}

/* ============ touch UI (shown only when body.touch is set by main.js) ============ */
#touch-ui { position: fixed; inset: 0; z-index: 20; pointer-events: none; display: none; }
body.touch #touch-ui { display: block; }
/* 22.10: hud.js sets #touch-ui[hidden] outside run states — dash/joy must not
   bleed through the translucent menu screens (rule 6 targets apply in-run only). */
body.touch #touch-ui[hidden] { display: none; }
#joy-base {
  position: absolute; width: 128px; height: 128px;
  margin: -64px 0 0 -64px; border-radius: 50%;
  border: 2px solid rgba(232, 236, 248, 0.28);
  background: rgba(232, 236, 248, 0.05);
  display: none;
}
#joy-knob {
  position: absolute; left: 50%; top: 50%;
  width: 58px; height: 58px; margin: -29px 0 0 -29px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.55), rgba(148, 163, 184, 0.22));
  border: 1px solid rgba(255, 255, 255, 0.4);
  will-change: transform;
}
#btn-dash {
  pointer-events: auto;
  position: absolute;
  right: calc(18px + var(--safe-r));
  bottom: calc(20px + var(--safe-b));
  width: 92px; height: 92px; border-radius: 50%;
  border: 2px solid var(--char-line, rgba(94, 234, 212, 0.65));
  color: var(--char, var(--accent));
  font-size: 13px; font-weight: 800; letter-spacing: 0.1em;
  background:
    radial-gradient(circle, var(--char-soft, rgba(94, 234, 212, 0.16)) 0 58%, transparent 60%),
    conic-gradient(rgba(2, 8, 16, 0.72) calc(var(--cd, 0) * 1turn), transparent 0);
  cursor: pointer;
}
#btn-dash:active { transform: scale(0.93); }

/* ============ screens ============ */
.screen {
  position: fixed; inset: 0; z-index: 30;
  /* 22.9: 'safe center' — plain center + overflow:auto made the top of tall menus
     (level cards) unreachable; safe centering keeps centering but top-aligns
     (scrollable) when content exceeds the viewport. */
  display: flex; align-items: safe center; justify-content: center;
  padding: 20px;
  padding: calc(20px + var(--safe-t)) calc(20px + var(--safe-l)) calc(20px + var(--safe-b)) calc(20px + var(--safe-r));
  background: linear-gradient(180deg, rgba(5, 7, 15, 0.38), rgba(5, 7, 15, 0.72));
  overflow: auto;
}
.menu-box {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 34px 44px;
  text-align: center;
}
.title {
  margin: 0;
  font-size: clamp(46px, 12.5vmin, 108px);
  line-height: 0.94; font-weight: 900; letter-spacing: 0.05em;
  background: linear-gradient(180deg, #f6f9ff 25%, #a9bcdd 62%, #55709c);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(94, 234, 212, 0.28)) drop-shadow(0 3px 3px rgba(0, 0, 0, 0.6));
}
.subtitle {
  margin: 0;
  color: var(--dim);
  font-size: clamp(10px, 2vmin, 14px);
  letter-spacing: 0.4em; text-transform: uppercase;
}

.coop-status {
  margin: -8px 0 0;
  min-height: 1.2em;
  color: var(--dim);
  font-size: clamp(11px, 2vmin, 14px);
}
.screen-title {
  margin: 0 0 6px;
  font-size: clamp(22px, 5vmin, 38px);
  font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 0 18px rgba(94, 234, 212, 0.35);
}

.menu-buttons { display: flex; flex-direction: column; gap: 12px; width: min(78vw, 320px); }
.menu-row { flex-direction: row; justify-content: center; width: auto; }

/* ============ level select (13.7) ============ */
.level-select { display: flex; flex-direction: column; gap: 10px; width: min(78vw, 320px); }
.lv-card {
  display: flex; align-items: center; gap: 12px;
  min-height: 72px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: linear-gradient(180deg, rgba(24, 32, 52, 0.9), rgba(13, 18, 32, 0.9));
  color: var(--text); text-align: left; cursor: pointer;
  transition: border-color 0.12s ease, transform 0.08s ease;
}
.lv-card:hover { border-color: var(--accent); }
.lv-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lv-card.sel {
  border-color: rgba(94, 234, 212, 0.8);
  box-shadow: 0 0 20px rgba(94, 234, 212, 0.18), inset 0 0 16px rgba(94, 234, 212, 0.06);
}
.lv-card.locked { cursor: not-allowed; border-style: dashed; color: var(--dim); }
.lv-card.locked:hover { border-color: var(--line); }
.lv-chip { width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--line); flex-shrink: 0; }
.lv-card.locked .lv-chip { filter: saturate(0.4) brightness(0.8); }
.lv-card h3 { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: 0.03em; }
.lv-line { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.lv-req { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--danger); }
.lv-pips { display: flex; gap: 4px; }
@keyframes lv-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.lv-card.shake { animation: lv-shake 0.32s ease; }

/* ============ duration select (17.2) ============ */
.duration-select { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: min(86vw, 420px); }
.dur-chip {
  /* 22.11: user ruling 2026-09-07 — duration chips half-height (still comfortably tappable);
     width keeps the 72 px floor from rule 6. */
  flex: 1 1 72px; min-width: 72px; min-height: 40px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 12px;
  background: linear-gradient(180deg, rgba(30, 40, 64, 0.92), rgba(15, 21, 38, 0.92));
  color: var(--text); font-family: inherit; font-size: 15px; font-weight: 800; letter-spacing: 0.03em;
  cursor: pointer; transition: border-color 0.12s ease, transform 0.08s ease;
}
.dur-chip:hover { border-color: var(--accent); }
.dur-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dur-chip.sel {
  border-color: rgba(94, 234, 212, 0.8);
  box-shadow: 0 0 20px rgba(94, 234, 212, 0.18), inset 0 0 16px rgba(94, 234, 212, 0.06);
}

.btn {
  min-height: 72px; padding: 0 22px;
  border: 1px solid var(--line); border-radius: 12px;
  background: linear-gradient(180deg, rgba(30, 40, 64, 0.92), rgba(15, 21, 38, 0.92));
  color: var(--text);
  font-size: 17px; font-weight: 700; letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.12s ease;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(0.985); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary {
  border-color: rgba(94, 234, 212, 0.75);
  background: linear-gradient(180deg, rgba(18, 48, 52, 0.94), rgba(9, 28, 34, 0.94));
  box-shadow: 0 0 26px rgba(94, 234, 212, 0.22), inset 0 0 20px rgba(94, 234, 212, 0.07);
}
.btn-small { min-height: 72px; font-size: 15px; }

.controls-hint { font-size: 12px; color: var(--dim); line-height: 1.8; }
.touch-only { display: none; }
body.touch .touch-only { display: block; }
body.touch .kbd-only { display: none; }

.panel-box {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  min-width: min(88vw, 400px);
  padding: 28px 34px;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--panel);
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
}

/* ============ character select (11.6.2) ============ */
.select-box { min-width: min(94vw, 480px); }
.char-shards {
  font-size: 18px; font-weight: 800; color: var(--accent2);
  font-variant-numeric: tabular-nums;
}
.char-list { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.char-card {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center;
  min-height: 72px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: linear-gradient(180deg, rgba(24, 32, 52, 0.9), rgba(13, 18, 32, 0.9));
  color: var(--text); text-align: left; cursor: pointer;
  transition: border-color 0.12s ease, transform 0.08s ease;
}
.char-card:hover { border-color: var(--accent); }
.char-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.char-card.sel {
  border-color: rgba(94, 234, 212, 0.8);
  box-shadow: 0 0 20px rgba(94, 234, 212, 0.18), inset 0 0 16px rgba(94, 234, 212, 0.06);
}
.char-card canvas { width: 64px; height: 74px; image-rendering: pixelated; }
.char-card .char-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.char-card .char-info h3 { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: 0.03em; }
.char-card .char-stats { font-size: 12.5px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.char-card .char-weapon { font-size: 11.5px; font-weight: 700; color: var(--accent2); }
.char-card .char-desc { margin: 0; font-size: 11.5px; line-height: 1.4; color: var(--dim); }
.char-card .char-line { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; }
.char-card .char-req { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--danger); }
.char-card.locked { cursor: not-allowed; border-style: dashed; color: var(--dim); }
.char-card.locked:hover { border-color: var(--line); }
.char-card.locked canvas { filter: saturate(0.3) brightness(0.7); }
.char-card.taken { cursor: not-allowed; border-style: dashed; }
.char-card.taken canvas { filter: grayscale(0.9) brightness(0.6); }
.char-card.taken .char-info { opacity: 0.55; }
.char-card.shake { animation: lv-shake 0.32s ease; }

/* high scores */
#scores-list {
  list-style: none; margin: 0; padding: 0; width: 100%;
  display: flex; flex-direction: column; gap: 6px;
  counter-reset: sc;
  max-height: 46vh; overflow: auto;
}
#scores-list li {
  display: grid; grid-template-columns: 26px 1fr auto auto;
  gap: 10px; align-items: baseline;
  padding: 8px 12px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 13px; text-align: left;
}
#scores-list li::before {
  counter-increment: sc; content: counter(sc);
  color: var(--dim); text-align: center; font-weight: 700;
}
.sc-score { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent2); }
.sc-meta { color: var(--dim); font-size: 11px; font-variant-numeric: tabular-nums; }
#scores-list li.empty { display: block; text-align: center; color: var(--dim); }
#scores-list li.empty::before { content: none; }

/* upgrades (meta progression) */
#meta-shards {
  font-size: clamp(34px, 6vmin, 48px);
  font-weight: 900;
  color: var(--accent2);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(245, 198, 107, 0.35);
  line-height: 1;
}
#meta-list {
  display: flex; flex-direction: column; gap: 10px;
  width: 100%;
  max-height: 46vh; overflow-y: auto;
  padding: 2px;
}
.meta-row {
  display: grid; grid-template-columns: 72px 1fr auto;
  gap: 12px; align-items: center;
  padding: 10px;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  text-align: left;
}
.meta-row canvas { width: 72px; height: 72px; }
.meta-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.meta-info h3 { margin: 0; font-size: 14px; font-weight: 800; }
.meta-info p { margin: 0; font-size: 11.5px; line-height: 1.4; color: var(--dim); }
.meta-info p.meta-effect { font-size: 11.5px; font-weight: 700; color: var(--text); }
.meta-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pips { display: flex; gap: 4px; }
.pip { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.15); }
.pip.on { background: var(--accent); }
.meta-cost { font-size: 12px; font-weight: 800; color: var(--accent2); font-variant-numeric: tabular-nums; }
.meta-row .btn { min-width: 72px; }

/* Pause-menu Settings (13.8) — view zoom + mute, ≥72 px rows (mobile parity) */
.settings-title {
  margin: 6px 0 0; font-size: 12px; font-weight: 800;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim);
}
.settings { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 72px; padding: 10px 16px;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text); font: inherit; cursor: pointer; text-align: left;
}
.set-row:active { transform: scale(0.98); }
.set-row .set-label { font-size: 14px; font-weight: 700; }
.set-row .set-val { font-size: 13px; font-weight: 800; color: var(--dim); }
.set-row.on .set-val, .set-row.muted .set-val { color: var(--accent2); }
.meta-row .btn[disabled] { opacity: 0.45; cursor: default; transform: none; }

/* level up cards (26.2 overhaul: kind accent language weapon=teal · passive=amber · synergy=violet) */
#screen-levelup { flex-direction: column; gap: 22px; background: rgba(5, 7, 15, 0.6); }
.levelup-title {
  font-size: clamp(22px, 5vmin, 42px); font-weight: 900;
  letter-spacing: 0.22em; color: var(--accent2);
  text-shadow: 0 0 22px rgba(245, 198, 107, 0.5), 0 2px 4px #000;
}
.cards { display: flex; gap: clamp(10px, 2vmin, 22px); flex-wrap: wrap; justify-content: center; }
.card {
  --k: var(--accent); --k-glow: rgba(94, 234, 212, 0.35); --k-soft: rgba(94, 234, 212, 0.16);
  position: relative;
  width: clamp(132px, 25vw, 190px);
  padding: 18px 12px 14px;
  border: 1px solid var(--line); border-radius: 14px;
  background:
    linear-gradient(180deg, var(--k-soft), rgba(0, 0, 0, 0)),
    linear-gradient(180deg, rgba(24, 32, 56, 0.97), rgba(10, 14, 28, 0.97));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.15s ease;
  animation: card-deal 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}
.card.weapon { --k: #5eead4; --k-glow: rgba(94, 234, 212, 0.4); --k-soft: rgba(94, 234, 212, 0.10); border-color: var(--k); }
.card.passive { --k: var(--accent2); --k-glow: rgba(245, 198, 107, 0.4); --k-soft: rgba(245, 198, 107, 0.10); border-color: var(--k); }
.card.synergy { --k: #be8cff; --k-glow: rgba(190, 140, 255, 0.45); --k-soft: rgba(190, 140, 255, 0.12); border-color: var(--k); }
.card:hover, .card:focus-visible {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--k);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5), 0 0 22px var(--k-glow);
}
.card:active { transform: translateY(0) scale(0.98); }
@keyframes card-deal {
  from { opacity: 0; transform: translateY(26px) rotate(calc(var(--i, 0) * 1.5deg - 1.5deg)) scale(0.92); }
  to { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) { .card { animation: none; } }
.card.new .card-badge { display: inline-block; }
.card-badge {
  display: none; position: absolute; top: -8px; right: 10px;
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.12em;
  color: #1a1206; background: var(--accent2);
  border-radius: 4px; padding: 3px 7px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.card.synergy .card-badge { color: #14071f; background: linear-gradient(180deg, #d9b8ff, #a06ee8); box-shadow: 0 0 12px rgba(190, 140, 255, 0.6); }
/* icon plaque (26.2): framed inset around the 72px category-plated icon */
.card-plaque {
  padding: 5px; border-radius: 13px;
  border: 1px solid var(--k); background: rgba(4, 7, 14, 0.6);
  box-shadow: inset 0 0 12px var(--k-soft), 0 0 10px var(--k-glow);
}
.card canvas { width: 72px; height: 72px; display: block; border-radius: 9px; }
.card h3 { margin: 0; font-size: 14px; font-weight: 800; text-align: center; color: var(--text); text-shadow: 0 0 10px var(--k-glow); }
.card-pips { display: flex; gap: 4px; min-height: 8px; }
.card-pips .pip { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.6); }
.card-pips .pip.on { background: var(--k); box-shadow: 0 0 6px var(--k-glow); }
.card p { margin: 0; font-size: 11.5px; line-height: 1.45; color: var(--dim); text-align: center; }
.card p.card-effect {
  font-size: 12px; font-weight: 700; color: var(--text);
  border-top: 1px solid var(--k-soft); border-bottom: 1px solid var(--k-soft);
  padding: 5px 2px; width: 100%;
  background: linear-gradient(90deg, transparent, var(--k-soft), transparent);
}
.card p.card-desc { font-size: 10.5px; }
.card-key {
  font-size: 10px; color: var(--dim); border: 1px solid var(--line); border-radius: 4px; padding: 1px 7px;
  position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%);
  background: #0b0f1e;
}

/* level-up action toolbar (18.3, D84): SKIP / RE-ROLL / BANISH — soul-blue, ≥72 px targets */
.lv-actions { display: flex; gap: clamp(10px, 2vmin, 20px); justify-content: center; flex-wrap: wrap; }
.lv-actions[hidden] { display: none; }
.lv-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 96px; min-height: 72px; padding: 8px 14px 6px;
  border: 1px solid rgba(120, 180, 255, 0.45); border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(96, 165, 250, 0.12), rgba(0, 0, 0, 0)),
    linear-gradient(180deg, rgba(20, 30, 56, 0.95), rgba(8, 12, 26, 0.95));
  color: var(--text);
  font-weight: 800; letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.lv-btn canvas { width: 40px; height: 40px; display: block; }
.lv-btn .lv-btn-name { font-size: 12px; }
.lv-btn .lv-btn-count { font-size: 11px; color: #9cc3ff; font-variant-numeric: tabular-nums; }
.lv-btn:hover { border-color: #9cc3ff; transform: translateY(-1px); box-shadow: 0 0 14px rgba(96, 165, 250, 0.35); }
.lv-btn:active { transform: translateY(1px) scale(0.985); }
.lv-btn:focus-visible { outline: 2px solid #9cc3ff; outline-offset: 2px; }
.lv-btn[disabled] { opacity: 0.4; cursor: default; transform: none; box-shadow: none; }
.lv-btn.armed { border-color: var(--danger); box-shadow: 0 0 16px rgba(255, 93, 115, 0.5); }
.lv-btn.armed .lv-btn-count { color: var(--danger); }
/* banish armed: cards read as banish targets */
.cards.banishable .card { border-color: var(--danger); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 16px rgba(255, 93, 115, 0.35); cursor: crosshair; }

/* meta shop section divider (18.2) */
.meta-section {
  margin-top: 14px; padding: 6px 2px;
  border-top: 1px solid var(--line);
  font-size: 12px; font-weight: 900; letter-spacing: 0.18em; text-transform: uppercase;
  color: #9cc3ff;
}
.meta-uses { font-size: 12px; font-weight: 700; color: #9cc3ff; font-variant-numeric: tabular-nums; }

/* game over */
.go-box { min-width: min(88vw, 420px); }
#go-stats {
  display: grid; grid-template-columns: auto auto; gap: 7px 22px;
  margin: 0; font-size: 14px; text-align: left;
}
#go-stats dt { color: var(--dim); }
#go-stats dd { margin: 0; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.new-record { color: var(--accent2); font-weight: 800; letter-spacing: 0.16em; animation: pulse 0.9s infinite alternate; }
@keyframes pulse { to { opacity: 0.45; } }

/* banner */
#banner {
  position: fixed; top: 16%; left: 0; right: 0; z-index: 25;
  text-align: center;
  font-size: clamp(26px, 7vmin, 64px);
  font-weight: 900; letter-spacing: 0.12em;
  color: #fff;
  text-shadow: 0 0 26px rgba(94, 234, 212, 0.6), 0 3px 6px #000;
  pointer-events: none;
}
#banner.show { animation: bannerIn 2.6s ease forwards; }
@keyframes bannerIn {
  0% { opacity: 0; transform: scale(0.7); }
  12% { opacity: 1; transform: scale(1.06); }
  24% { transform: scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.03); }
}

/* small landscape phones */
@media (max-height: 420px) {
  .title { font-size: clamp(34px, 11vmin, 64px); }
  .menu-box { gap: 10px; padding: 16px; }
  #minimap-frame { width: 115px; }
}
