/* CHOOMDECK — palette + rules.
   This started as a CHOOMDEX-styled sim: a CP2077-yellow page with dark
   text, panels dark. It is now CHOOMDECK, whose identity is near-black, and
   every screen renders inside its own dark shell — `.sim-header`, the one
   component built for the yellow page, is no longer used anywhere.

   The yellow only ever surfaced as a flash on refresh, before the app
   painted, which read as loading CHOOMDEX by mistake. So the page ink is
   flipped: black page, light text. --on-bg keeps its name and its job (text
   that sits directly on the page) and simply changed colour with it. */

:root {
  --bg: #030405;
  --on-bg: #E8EAEB;
  --on-bg-2: #747B80;
  --surface: #12171f;
  --surface-2: #1a212b;
  --surface-3: #232c39;
  --line: #2a3648;
  --ink: #d8e2ef;
  --ink-2: #8fa3bd;
  --ink-3: #5a6b84;
  --cyan: #22d3ee;
  --cyan-dim: #0e7490;
  --yellow: #fcee0a;
  --magenta: #ff2a6d;
  --green: #34d399;
  --red: #f87171;
  --violet: #a78bfa;
  --blue: #60a5fa;
  --mono: "Chivo Mono", "Cascadia Code", Consolas, monospace;
  --sans: "Segoe UI", system-ui, sans-serif;
  --display: "Genos", "Segoe UI", sans-serif;
  --grid-size: 4px;
  --grid-line: 2px;
  /* scanlines were dark ink for the yellow page; on black they need to be
     light to exist at all, and very faint so they don't compete */
  --grid-ink: rgba(255,229,0,.022);
  --cut: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
:root { color-scheme: dark; }

* { box-sizing: border-box; }
html { overflow-x: hidden; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  overflow-x: clip;
  color: var(--on-bg);
  font-family: var(--sans);
  /* scanlines painted into the background — gradient on purpose (Samsung
     Internet inverts flat colours but leaves background images alone) */
  background:
    repeating-linear-gradient(0deg,
      var(--grid-ink) 0 var(--grid-line), transparent var(--grid-line) var(--grid-size)),
    linear-gradient(var(--bg), var(--bg));
  background-color: var(--bg);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- shared chrome ---------- */
h1, h2, h3 { font-family: var(--display); letter-spacing: .03em; margin: 0; }
button, .btn {
  font-family: var(--mono);
  background: var(--surface-2); color: var(--cyan);
  border: 1px solid var(--cyan-dim);
  padding: 10px 16px; font-size: 13px;
  text-transform: uppercase; letter-spacing: .08em;
  cursor: pointer;
  clip-path: var(--cut);
  min-height: 44px;
}
button:hover { background: var(--cyan-dim); color: #06121a; }
button:disabled { opacity: .35; cursor: default; }
button:disabled:hover { background: var(--surface-2); color: var(--cyan); }
button.warn   { color: var(--yellow);  border-color: #8a8206; }
button.warn:hover { background: #8a8206; color: #06121a; }
button.danger { color: var(--magenta); border-color: #8a1d44; }
button.danger:hover { background: #8a1d44; color: var(--ink); }
button.ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
input, select, textarea {
  font-family: var(--mono); font-size: 14px;
  background: var(--surface-3); color: var(--ink);
  border: 1px solid var(--line); padding: 10px 12px;
  min-height: 44px;
}
input:focus, select:focus { outline: 1px solid var(--cyan-dim); }

.hidden { display: none !important; }

#app { max-width: 1200px; margin: 0 auto; padding: 12px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }

/* boot */
/* Boot screen — CHOOMDECK's own black, not CHOOMDEX's yellow page.
   The first thing a refresh shows is this, and on the yellow --bg it read
   as loading the wrong site. html/body carry the black so there is no
   yellow flash before this panel paints; the shell and the game board set
   their own backgrounds once the app renders. */
html.booting, body.booting { background: #030405 !important; }
.boot-wrap { position: fixed; inset: 0; display: grid; place-items: center;
  background: #030405; z-index: 5; }
.boot-panel { max-width: 340px; text-align: center; padding: 30px 34px;
  background: #080A0B; border: 1px solid #1c2225;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px)); }
.boot-title { font-family: var(--display); font-size: 36px; letter-spacing: .02em;
  color: #FFE500; line-height: 1; }
.boot-title em { font-style: normal; color: #FF0878; }
.boot-sub { font-family: var(--mono); font-size: 11px; color: #747B80;
  text-transform: uppercase; letter-spacing: .24em; margin-top: 10px; }
.boot-bar { height: 2px; margin-top: 16px; background: #1c2225; overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 40%; background: #FFE500;
  animation: boot-scan 1.1s linear infinite; }
@keyframes boot-scan { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
@media (prefers-reduced-motion: reduce) { .boot-bar i { animation: none; width: 100%; } }

/* header on the yellow page */
.sim-header { display: flex; align-items: center; gap: 12px; padding: 6px 2px 14px; flex-wrap: wrap; }
.sim-header img { height: 40px; }
.sim-header .title { font-family: var(--display); font-size: 30px; line-height: 1; color: var(--on-bg); }
.sim-header .tag { font-family: var(--mono); font-size: 10px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--on-bg-2); }
.sim-header .spacer { flex: 1; }

/* panels (dark) */
.panel { background: var(--surface); border: 1px solid var(--line); color: var(--ink); padding: 16px; margin-bottom: 14px; }
.panel h2 { color: var(--yellow); font-size: 24px; margin-bottom: 8px; }
.panel .sub { color: var(--ink-2); font-size: 13px; }
.mono { font-family: var(--mono); }

/* hero (front page) */
.hero { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); margin-bottom: 14px; min-height: 320px; display: grid; align-items: end; }
.hero-marquee { position: absolute; inset: 0; overflow: hidden; opacity: .5; }
.hero-track { display: flex; gap: 10px; width: max-content; padding: 12px 0;
  animation: hero-drift 70s linear infinite; }
.hero-track img { width: 150px; aspect-ratio: 5/7; object-fit: cover; flex: none;
  border: 1px solid var(--line); filter: saturate(.9); }
@keyframes hero-drift { to { transform: translateX(-50%); } }
.hero-scrim { position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(18,23,31,.25) 0%, rgba(18,23,31,.82) 55%, rgba(13,17,23,.96) 100%); }
.hero-body { position: relative; padding: 26px 20px 20px; width: 100%; }
.hero-kicker { font-family: var(--mono); font-size: 10px; letter-spacing: .3em; color: var(--cyan); }
.hero-title { font-family: var(--display); font-size: clamp(44px, 9vw, 76px); line-height: .95;
  color: var(--ink); text-shadow: 0 2px 18px rgba(0,0,0,.6); }
.hero-title em { font-style: normal; color: var(--yellow); }
.hero-tag { font-family: var(--mono); font-size: 11px; letter-spacing: .22em; color: var(--magenta); margin-top: 4px; }
.hero-stats { display: flex; gap: 16px; flex-wrap: wrap; margin: 14px 0; font-family: var(--mono);
  font-size: 11px; color: var(--ink-2); }
.hero-stats b { color: var(--yellow); font-weight: 600; }
.hero-stats .hs-local b { color: var(--green); }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.menu-foot { font-size: 10px; color: var(--on-bg-2); letter-spacing: .06em; margin-top: 14px;
  text-transform: uppercase; }
@media (prefers-reduced-motion: reduce) { .hero-track { animation-duration: 400s; } }

/* menu */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.mode-tile.ac-cyan .mt-name { color: var(--cyan); }
.mode-tile.ac-magenta .mt-name { color: var(--magenta); }
.mode-tile.ac-green .mt-name { color: var(--green); }
.mode-tile.ac-violet .mt-name { color: var(--violet); }
.mode-tile.ac-yellow .mt-name { color: var(--yellow); }
.mode-tile { display: block; text-align: left; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); padding: 18px; cursor: pointer; clip-path: var(--cut); min-height: 110px; }
.mode-tile:hover { border-color: var(--magenta); background: var(--surface-2); color: var(--ink);
  box-shadow: 0 6px 24px rgba(255,42,109,.18); }
.mode-tile .mt-name { font-family: var(--display); font-size: 26px; color: var(--cyan); }
.mode-tile:hover .mt-name { color: var(--magenta); }
.mode-tile .mt-desc { font-size: 12px; color: var(--ink-2); margin-top: 6px; font-family: var(--mono); }

/* chips (from choomdex) */
.chip { font-family: var(--mono); font-size: 10px; padding: 1px 6px; display: inline-block;
  border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.chip.cost { color: var(--yellow); border-color: #713f12; }
.chip.pwr  { color: var(--magenta); border-color: #8a1d44; }
.chip.ram  { color: var(--cyan); border-color: var(--cyan-dim); }
.chip.t-legend { color: var(--yellow); border-color: #713f12; }
.chip.t-unit { color: var(--ink); }
.chip.t-gear { color: var(--green); border-color: #14532d; }
.chip.t-program { color: var(--violet); border-color: #4c1d95; }
.fac { font-family: var(--mono); font-size: 10px; color: var(--ink-2); }
.fac::before { content: "\25CF"; margin-right: 3px; }
.fac.f-red::before { color: var(--red); }
.fac.f-blue::before { color: var(--blue); }
.fac.f-green::before { color: var(--green); }
.fac.f-yellow::before { color: var(--yellow); }

/* deck manager */
.deck-list { display: grid; gap: 10px; }
.deck-row { display: flex; align-items: center; gap: 10px; background: var(--surface-2);
  border: 1px solid var(--line); padding: 10px 12px; flex-wrap: wrap; }
.deck-row .d-name { font-family: var(--display); font-size: 20px; color: var(--ink); flex: 1 1 160px; }
.deck-row .d-meta { font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.deck-row.selected { border-color: var(--yellow); }
.deck-row.starter-row { border-left: 3px solid var(--violet); }
.deck-row.starter-row .d-name { display: flex; align-items: center; gap: 6px; }
.legal-ok { color: var(--green); } .legal-bad { color: var(--magenta); } .legal-pre { color: var(--yellow); }
.import-row { display: flex; gap: 8px; flex-wrap: wrap; }
.import-row input { flex: 1 1 220px; }

/* builder */
.builder-wrap { display: grid; grid-template-columns: 1fr 320px; gap: 14px; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-row select, .filter-row input { min-height: 40px; padding: 6px 10px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.tcg-card { background: var(--surface-2); border: 1px solid var(--line); padding: 6px; cursor: pointer;
  transition: transform .12s ease; position: relative; }
.tcg-card:hover { transform: translateY(-4px); border-color: var(--magenta);
  box-shadow: 0 6px 24px rgba(255,42,109,.18); }
.tcg-card img { width: 100%; aspect-ratio: 5/7; object-fit: cover; display: block; background: #0a0e16; }
.tcg-card .c-name { font-size: 11px; font-family: var(--mono); color: var(--ink);
  margin: 5px 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcg-card .c-qty { position: absolute; top: 10px; right: 10px; background: var(--yellow); color: #0d1117;
  font-family: var(--mono); font-weight: 600; font-size: 13px; padding: 1px 8px; }
.decklist-panel { background: var(--surface); border: 1px solid var(--line); padding: 12px;
  align-self: start; position: sticky; top: 10px; }
.dl-row { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px;
  color: var(--ink); padding: 3px 0; border-bottom: 1px solid rgba(42,54,72,.5); }
.dl-row .q { color: var(--yellow); width: 24px; }
.dl-row .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.dl-row button { min-height: 28px; padding: 1px 8px; font-size: 12px; }
.dl-legend { color: var(--yellow); }
.problems { font-family: var(--mono); font-size: 11px; color: var(--magenta); margin-top: 8px; }
.problems .adv { color: var(--ink-2); }

/* deck valuation via CHOOMDEX — sold and ask are visually distinct, never blended */
.dl-price { font-family: var(--mono); font-size: 10px; white-space: nowrap; }
.dl-price.sold { color: var(--green); }
.dl-price.ask { color: var(--yellow); }
.dl-price.none { color: var(--ink-3); }
.market-box { font-family: var(--mono); font-size: 11px; color: var(--ink-2);
  border: 1px solid var(--line); border-left: 3px solid var(--green);
  padding: 8px 10px; margin-top: 10px; line-height: 1.6; }
.market-box .mb-line { color: var(--ink-3); letter-spacing: .14em; font-size: 9px; }
.market-box .sold { color: var(--green); }
.market-box .ask { color: var(--yellow); }
.market-box .none { color: var(--ink-3); }

/* ---------- game board ---------- */
/* The mat is David's Cyberpunk TCG HUD frame: a yellow border drawn around a
   near-black interior. It is STRETCHED (100% 100%), not cover-cropped — the
   frame is the whole point, so losing its edges to a crop would defeat it.
   No scrim: the interior is already #000210, and a scrim would grey the
   yellow. Padding keeps panels off the frame line. */
.board {
  background: url("/img/mat.webp") 0 0 / 100% 100% no-repeat, #000210;
  border: none;
  color: var(--ink);
  padding: 22px 20px;
  display: flex; flex-direction: column; gap: 6px;
  min-height: calc(100vh - 130px);
}

.opp-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: rgba(18,23,31,.85); border: 1px solid var(--line); padding: 6px 8px; }
.opp-strip .p-name { font-family: var(--display); font-size: 18px; color: var(--magenta); }
.player-strip .p-name { color: var(--cyan); }
.stat { font-family: var(--mono); font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.stat b { color: var(--ink); font-weight: 600; }
.stat.gigs b { color: var(--yellow); }
.stat.eddies b { color: var(--green); }

.gig-dice { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }

/* SVG dice (shapes drawn in dice.js) */
.die-svg { display: block; width: 34px; height: 38px; }
.die-svg .die-shape polygon, .die-svg .die-shape rect {
  fill: rgba(13,17,23,.88); stroke: var(--die-col); stroke-width: 5; stroke-linejoin: round; }
.die-svg .die-num { fill: var(--die-col); font-family: var(--mono); font-weight: 600; font-size: 38px; }
.die-svg .die-tag { fill: var(--ink-3); font-family: var(--mono); font-size: 13px; letter-spacing: .08em; }
/* interior facet edges + the DN label inside the die (reference icon style) */
.die-svg .die-facets { fill: none; stroke: var(--die-col); stroke-width: 2.2;
  opacity: .45; stroke-linejoin: round; }
.die-svg .die-name { fill: var(--die-col); font-family: var(--mono); font-weight: 600;
  font-size: 25px; letter-spacing: 1px; paint-order: stroke;
  stroke: rgba(8,11,17,.85); stroke-width: 4px; }
.die-wrap { display: inline-block; }
.die-wrap .die-svg { width: 30px; height: 34px; }
.die-hidden { visibility: hidden; }
.die-btn { padding: 4px 6px; min-height: 0; background: var(--surface-2); }
.die-btn .die-svg { width: 46px; height: 52px; }
.die-btn:hover { background: var(--surface-3); }
.die-fly { position: fixed; z-index: 95; pointer-events: none; transform-origin: top left;
  transition: transform .68s cubic-bezier(.3, .8, .3, 1), opacity .68s ease; }
.die-fly .die-svg { width: 100%; height: 100%; filter: drop-shadow(0 0 10px rgba(252,238,10,.5)); }

.legend-row { display: flex; gap: 6px; }
.legend-card { width: 54px; aspect-ratio: 5/7; border: 1px solid #8a8206; position: relative;
  background: url("/img/card-back.webp") center / cover no-repeat, #101826; cursor: pointer;
  transition: transform .12s ease; flex: none; }
.legend-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.legend-card.spent { transform: rotate(90deg) scale(.82); opacity: .55; }
.legend-card .lc-tag { position: absolute; bottom: 0; left: 0; right: 0; font-family: var(--mono);
  font-size: 8px; text-align: center; background: rgba(13,17,23,.85); color: var(--yellow);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 1px 2px; }

.field { display: flex; gap: 8px; overflow-x: auto; padding: 8px 4px; min-height: 128px;
  scrollbar-width: thin; align-items: flex-start; }
.field:empty::after { content: "NO UNITS FIELDED"; font-family: var(--mono); font-size: 10px;
  color: var(--ink-3); letter-spacing: .2em; align-self: center; margin: auto; }

.unit { width: 86px; flex: none; position: relative; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2);
  transition: transform .12s ease, opacity .12s ease; }
.unit img { width: 100%; aspect-ratio: 5/7; object-fit: cover; display: block; }
.unit .u-pwr { position: absolute; bottom: 2px; right: 2px; background: rgba(13,17,23,.9);
  color: var(--magenta); font-family: var(--mono); font-weight: 600; font-size: 13px; padding: 0 6px;
  border: 1px solid #8a1d44; }
.unit .u-name { position: absolute; top: 0; left: 0; right: 0; font-family: var(--mono); font-size: 8px;
  background: rgba(13,17,23,.85); color: var(--ink); padding: 1px 3px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.unit .u-badges { position: absolute; bottom: 2px; left: 2px; display: flex; gap: 2px; }
.unit .u-badge { font-family: var(--mono); font-size: 8px; padding: 0 4px; background: rgba(13,17,23,.9);
  border: 1px solid var(--line); color: var(--cyan); }
.unit.spent { transform: rotate(90deg) scale(.8); opacity: .6; margin: 0 10px; }
.unit.lag { border-style: dashed; border-color: var(--magenta); }
.unit.can-act { border-color: var(--cyan); box-shadow: 0 0 10px rgba(34,211,238,.25); }
.unit.targetable { border-color: var(--yellow); box-shadow: 0 0 14px rgba(252,238,10,.5); }
.unit.gosolo { outline: 1px dashed var(--yellow); outline-offset: 2px; }

.mid-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: rgba(18,23,31,.85); border: 1px solid var(--line); padding: 6px 8px; }
.phase-tag { font-family: var(--mono); font-size: 11px; color: var(--yellow);
  text-transform: uppercase; letter-spacing: .15em; }
.mid-bar .spacer { flex: 1; }
.mid-bar button { min-height: 38px; padding: 6px 12px; font-size: 12px; }

.log { font-family: var(--mono); font-size: 11px; color: var(--ink-2); background: rgba(13,17,23,.7);
  border: 1px solid var(--line); padding: 6px 8px; max-height: 92px; overflow-y: auto; }
.log .l-turn { color: var(--yellow); }
.log .l-hit { color: var(--magenta); }
.log .l-ai { color: var(--cyan); }
.log div { padding: 1px 0; }

/* AI learn-mode: pacing controls + latest reasoning callout */
.ai-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  background: rgba(18,23,31,.85); border: 1px solid var(--line); padding: 5px 8px; }
.ai-bar button { min-height: 34px; padding: 4px 10px; font-size: 11px; }
.ai-intent { font-family: var(--mono); font-size: 12px; color: var(--cyan);
  background: rgba(8,30,38,.9); border: 1px solid var(--cyan-dim); border-left: 3px solid var(--cyan);
  padding: 8px 10px; line-height: 1.45; }

.hand { display: flex; gap: 8px; overflow-x: auto; padding: 8px 4px calc(6px + env(safe-area-inset-bottom));
  background: rgba(18,23,31,.85); border: 1px solid var(--line); min-height: 140px; }
.hand .unit { width: 92px; }
.hand .unit.affordable { border-color: var(--cyan); }
.hand .unit.too-pricey { opacity: .65; }
.hand:empty::after { content: "HAND EMPTY"; font-family: var(--mono); font-size: 10px; color: var(--ink-3);
  letter-spacing: .2em; align-self: center; margin: auto; }
.hand .u-cost { position: absolute; top: 12px; left: 2px; background: rgba(13,17,23,.9);
  color: var(--yellow); font-family: var(--mono); font-weight: 600; font-size: 12px; padding: 0 5px;
  border: 1px solid #713f12; }

.zone-drawer { display: flex; gap: 8px; flex-wrap: wrap; }
.zone-pill { font-family: var(--mono); font-size: 11px; background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line); padding: 6px 10px; cursor: pointer; min-height: 34px; }
.zone-pill b { color: var(--ink); }

/* pass-device + banners */
.pass-screen { position: fixed; inset: 0; z-index: 60; background: var(--surface);
  display: grid; place-items: center; text-align: center; color: var(--ink); padding: 24px; }
.pass-screen .ps-name { font-family: var(--display); font-size: 44px; color: var(--yellow); }
.pass-screen .ps-sub { font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  letter-spacing: .15em; text-transform: uppercase; margin: 10px 0 24px; }

.banner { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 70;
  background: var(--surface-2); border: 1px solid var(--yellow); color: var(--yellow);
  font-family: var(--mono); font-size: 12px; padding: 10px 18px; max-width: 92vw; text-align: center; }

/* react window */
.react-bar { background: rgba(26,13,20,.95); border: 1px solid var(--magenta); padding: 8px;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.react-bar .r-msg { font-family: var(--mono); font-size: 12px; color: var(--magenta); flex: 1 1 200px; }

/* ---------- overlays ---------- */
.zoom { position: fixed; inset: 0; z-index: 90; background: rgba(5,8,13,.88);
  display: grid; place-items: center; padding: 16px; }
.zoom-inner { max-width: min(420px, 94vw); text-align: center; }
.zoom-inner img { width: 100%; max-height: 62vh; object-fit: contain; border: 1px solid var(--line); }
.zoom-text { font-family: var(--mono); font-size: 12px; color: var(--ink); text-align: left;
  background: var(--surface); border: 1px solid var(--line); padding: 10px 12px; margin-top: 8px;
  max-height: 22vh; overflow-y: auto; white-space: pre-wrap; }
.zoom-text .kw { color: var(--cyan); }
.zoom-close { margin-top: 10px; width: 100%; }

.sheet { position: fixed; inset: 0; z-index: 80; background: rgba(5,8,13,.6); }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; background: var(--surface);
  border-top: 2px solid var(--cyan-dim); color: var(--ink);
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); max-height: 72vh; overflow-y: auto; }
.sheet-head { font-family: var(--display); font-size: 24px; color: var(--yellow); margin-bottom: 4px; }
.sheet-body { font-family: var(--mono); font-size: 12px; color: var(--ink-2); margin-bottom: 12px; white-space: pre-wrap; }
.sheet-body .kw { color: var(--cyan); }
.sheet-actions { display: grid; gap: 8px; }
.sheet-actions button { width: 100%; }

/* zone browser rows */
.zb-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(42,54,72,.5); }
.zb-row img { width: 40px; aspect-ratio: 5/7; object-fit: cover; }
.zb-row .n { flex: 1; font-family: var(--mono); font-size: 12px; color: var(--ink); }
.zb-row button { min-height: 32px; padding: 2px 10px; font-size: 11px; }

/* setup screens */
.setup-grid { display: grid; gap: 12px; max-width: 560px; }
.setup-grid label { font-family: var(--mono); font-size: 11px; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: .12em; display: grid; gap: 4px; }
.die-choice { display: flex; gap: 8px; flex-wrap: wrap; }
.die-choice button { min-width: 56px; }

/* hover preview — a floating enlargement, NOT an overlay: nothing dims, the
   board stays fully visible, and it never appears on touch (see the
   hover:hover guard in ui.js). */
.hoverpv {
  position: fixed; z-index: 88; pointer-events: none;
  width: 300px; background: var(--surface); border: 1px solid var(--cyan-dim);
  box-shadow: 0 18px 50px rgba(0,0,0,.7), 0 0 26px rgba(34,211,238,.13);
  padding: 8px;
  opacity: 0; transition: opacity .1s ease;
}
.hoverpv.on { opacity: 1; }
.hoverpv img { width: 100%; aspect-ratio: 5/7; object-fit: contain; display: block;
  background: #0a0e16; }
.hoverpv-meta { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 7px; }
.hoverpv-text { font-family: var(--mono); font-size: 12px; line-height: 1.45;
  color: var(--ink); margin-top: 7px; white-space: pre-wrap; }
.hoverpv-text .kw { color: var(--cyan); }
.hoverpv-text .flav { color: var(--ink-3); font-style: italic; }
@media (max-width: 760px) { .hoverpv { display: none !important; } }

/* attack arrow overlay */
#atk-arrow { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none;
  z-index: 55; display: none; }
#atk-arrow.on { display: block; }
#atk-line { animation: atk-dash .6s linear infinite; filter: drop-shadow(0 0 6px rgba(255,42,109,.6)); }
@keyframes atk-dash { to { stroke-dashoffset: -13; } }

/* dice roll overlay */
.dice-roll { position: fixed; inset: 0; z-index: 85; background: rgba(5,8,13,.72);
  display: grid; place-items: center; }
.dice-box { text-align: center; }
.dice-who { font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: .2em; margin-bottom: 14px; }
.dice-cube { width: 150px; margin: 0 auto; }
.dice-cube .die-svg.big { width: 150px; height: 168px; }
.dice-cube.rolling { animation: dice-jitter .1s linear infinite; }
.dice-cube.settled { animation: dice-land .45s ease-out; }
.dice-cube.settled .die-svg { filter: drop-shadow(0 0 26px rgba(252,238,10,.45)); }
.dice-label { font-family: var(--mono); font-size: 13px; color: var(--yellow); margin-top: 14px;
  letter-spacing: .15em; text-transform: uppercase; min-height: 1.2em; }
@keyframes dice-jitter {
  0% { transform: rotate(-4deg) translate(-2px, 1px); }
  50% { transform: rotate(3deg) translate(2px, -2px) scale(1.04); }
  100% { transform: rotate(-2deg) translate(-1px, 2px); }
}
@keyframes dice-land {
  0% { transform: scale(1.5); }
  60% { transform: scale(.92); }
  100% { transform: scale(1); }
}

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  #app { padding: 8px; }
  .builder-wrap { grid-template-columns: 1fr; }
  .decklist-panel { position: static; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .sim-header .title { font-size: 24px; }
  .board { min-height: calc(100svh - 110px); padding: 13px 11px; }
  .unit { width: 74px; }
  .hand .unit { width: 84px; }
  .legend-card { width: 44px; }
  .field { min-height: 112px; }
  .opp-strip .p-name, .player-strip .p-name { font-size: 15px; }
  .mid-bar button { padding: 6px 9px; font-size: 11px; }
}
@media (pointer: coarse) {
  .tcg-card:hover, .unit:hover { transform: none; }
}
