/* 比个大小 — the studio's dark pixel app chrome (same palette, borders, notched
   panels, buttons, coin chip and sheets as 挖冷门 and the platform home) around a
   clean, legible comparison board. The board is drawn from --b-* tokens so a
   bought board look (core/themes.js) only swaps colours. The reference keeps its
   diagonal hatch and 参照 tag, the actual size its dashed outline and 实际 tag:
   colour is never the only cue. System fonts only. */

:root {
  --bg: #140d09;
  --bg2: #1c120c;
  --panel: rgba(23, 15, 10, 0.94);
  --panel-2: #241810;
  --line: #5a4330;
  --line-soft: rgba(244, 234, 213, 0.1);
  --shadow: #302013;
  --ink: #f4ead5;
  --ink-hi: #fff8e8;
  --ink-dim: #c2b293;
  --ink-faint: #8a7b64;
  --gold: #f4c04e;
  --gold-hi: #ffe08a;
  --gold-deep: #9c6a17;
  --teal: #6fe3c6;
  --heat: #ff7a3d;
  --font: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --notch: polygon(4px 0, calc(100% - 4px) 0, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px), 0 4px);
  --top-h: 52px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  /* Board look: 夜墨 (default). */
  --b-sheet: #1f1812;
  --b-grid: rgba(244, 234, 213, 0.075);
  --b-ground: #2a2018;
  --b-ground-line: #c2b293;
  --b-ticks: rgba(244, 234, 213, 0.32);
  --b-border: #4a3626;
  --b-ref: #4fd1b5;
  --b-ref-hatch: rgba(20, 13, 9, 0.42);
  --b-target: #ff6a3d;
  --b-target-deep: #b83a17;
  --b-actual-fill: rgba(244, 234, 213, 0.86);
  --b-actual-line: #140d09;
  --b-tag-ink: #140d09;
  --b-tool: rgba(23, 15, 10, 0.9);
  --b-tool-line: #5a4330;
  --b-tool-ink: #f4ead5;
  color-scheme: dark;
}
body[data-board="paper"] {
  --b-sheet: #f7f1e3; --b-grid: rgba(52, 86, 104, 0.12); --b-ground: #ebe3d2; --b-ground-line: #1d2126; --b-ticks: rgba(29, 33, 38, 0.45);
  --b-border: #c9b994; --b-ref: #1f5e66; --b-ref-hatch: rgba(251, 248, 241, 0.42); --b-target: #d43f2a; --b-target-deep: #9f2b1b;
  --b-actual-fill: rgba(255, 253, 246, 0.9); --b-actual-line: #1d2126; --b-tag-ink: #fbf8f1;
  --b-tool: rgba(251, 248, 241, 0.94); --b-tool-line: #c9b994; --b-tool-ink: #1d2126;
}
body[data-board="chalk"] {
  --b-sheet: #1d2b24; --b-grid: rgba(220, 240, 230, 0.09); --b-ground: #24352c; --b-ground-line: #e8f1ea; --b-ticks: rgba(232, 241, 234, 0.4);
  --b-border: #3d5a4b; --b-ref: #bfe8ff; --b-ref-hatch: rgba(29, 43, 36, 0.45); --b-target: #ffb36b; --b-target-deep: #b8662a;
  --b-actual-fill: rgba(250, 250, 240, 0.82); --b-actual-line: #1d2b24; --b-tag-ink: #1d2b24;
  --b-tool: rgba(29, 43, 36, 0.92); --b-tool-line: #3d5a4b; --b-tool-ink: #e8f1ea;
}
body[data-board="graph"] {
  --b-sheet: #eef5ec; --b-grid: rgba(45, 107, 79, 0.2); --b-ground: #dde9da; --b-ground-line: #1f3a2c; --b-ticks: rgba(31, 58, 44, 0.5);
  --b-border: #a9c4a8; --b-ref: #2d6b4f; --b-ref-hatch: rgba(238, 245, 236, 0.45); --b-target: #c2410c; --b-target-deep: #8a2d06;
  --b-actual-fill: rgba(255, 255, 250, 0.9); --b-actual-line: #1f3a2c; --b-tag-ink: #ffffff;
  --b-tool: rgba(238, 245, 236, 0.95); --b-tool-line: #a9c4a8; --b-tool-ink: #1f3a2c;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; color: var(--ink); font: 15px/1.5 var(--font);
  background: var(--bg);
  overflow-x: hidden; -webkit-tap-highlight-color: transparent;
  padding: 0 env(safe-area-inset-right) var(--safe-b) env(safe-area-inset-left);
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.num, [translate="no"] { font-variant-numeric: tabular-nums; }

/* ── top bar: bank left, own controls + shared menu right ───────────── */
.top {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) max(10px, calc(50vw - 520px)) 0;
  background: linear-gradient(var(--bg) 70%, rgba(20, 13, 9, 0));
}
.top-right { display: flex; align-items: center; gap: 6px; flex: none; }
.platform-nav { display: flex; align-items: center; gap: 6px; }
.platform-nav:empty { display: none; }
.bank { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sq {
  width: 36px; height: 34px; padding: 0; display: grid; place-items: center; flex: none;
  background: var(--panel); border: 2px solid var(--line); clip-path: var(--notch);
  font: 800 12px/1 var(--mono); letter-spacing: 0.04em; color: var(--ink);
}
.sq svg { width: 18px; height: 18px; }
.sq:active, .bank-btn:active, .coin-chip:active { transform: translateY(1px); }
.sq.is-on { color: var(--gold); }
.coin-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 8px; flex: none;
  font: 900 15px/1 var(--mono); color: var(--gold-hi); background: var(--panel); border: 2px solid var(--gold-deep); clip-path: var(--notch);
}
.coin-chip .coin-warn { font: 700 10px/1 var(--font); color: var(--heat); }
.bank-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 9px 0 7px; flex: none;
  font: 800 13px/1 var(--font); color: var(--ink); background: var(--panel); border: 2px solid var(--line); clip-path: var(--notch);
}
.bank-btn svg { width: 16px; height: 16px; color: var(--gold); flex: none; }
@media (max-width: 420px) {
  .bank-btn { width: 36px; padding: 0; justify-content: center; }
  .bank-btn .bank-lbl { display: none; }
}
.coin-ico, .coin-fly {
  display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #fff6c8 0 18%, #ffd54a 19% 58%, #c48322 59% 100%);
  box-shadow: 0 0 0 2px #3a2208, inset -2px -2px 0 rgba(120, 70, 10, 0.55);
}
.coin-ico.big { width: 22px; height: 22px; }
.coin-chip.bump { animation: coinBump 0.32s steps(3); }
@keyframes coinBump { 50% { transform: scale(1.16); } }
.coin-fly { position: fixed; z-index: 61; width: 18px; height: 18px; margin: -9px 0 0 -9px; pointer-events: none; }
.chip-plus { position: fixed; z-index: 61; pointer-events: none; font: 900 17px/1 var(--mono); color: var(--gold-hi); text-shadow: 0 2px 0 #000; animation: chipPlus 1.25s ease-out forwards; }
@keyframes chipPlus { from { transform: translateY(6px); opacity: 0; } 15% { transform: none; opacity: 1; } 70% { opacity: 1; } to { transform: translateY(-10px); opacity: 0; } }
.dev-banner {
  max-width: 1040px; margin: 0 auto 6px; padding: 5px 10px; font: 700 12px/1.4 var(--mono); color: #1d1108;
  background: repeating-linear-gradient(135deg, #f4c04e 0 10px, #e0a93a 10px 20px);
}

/* ── shared bits ─────────────────────────────────────────────────────── */
.app { max-width: 1040px; margin: 0 auto; padding: 0 12px 24px; }
.panel { background: var(--panel); border: 2px solid var(--line); clip-path: var(--notch); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  font: 800 15px/1.1 var(--font); letter-spacing: 0.12em; color: var(--gold); text-decoration: none;
  background: rgba(14, 9, 6, 0.92); border: 2px solid var(--gold); clip-path: var(--notch);
}
.btn:active { transform: translateY(1px); }
.btn.primary { color: #1d1108; background: var(--gold); border-color: #000; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.22), inset 0 2px 0 rgba(255, 255, 255, 0.35); }
.btn.ghost { color: var(--ink-dim); border-color: var(--line); letter-spacing: 0.04em; font-size: 13px; }
.btn.small { min-height: 34px; padding: 4px 12px; font-size: 13px; letter-spacing: 0.04em; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn svg { width: 15px; height: 15px; color: var(--gold); }
.link-btn { min-height: 40px; padding: 6px 4px; font: 700 13px/1.2 var(--font); color: var(--ink-dim); background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; display: inline-flex; align-items: center; }
.loading { text-align: center; color: var(--ink-dim); padding: 80px 0; font: 600 13px/1.5 var(--mono); letter-spacing: 0.1em; }
.panel-screen { display: grid; place-items: center; min-height: calc(100dvh - var(--top-h) - 40px); }
.msg-card { width: min(460px, 100%); padding: 22px 20px; text-align: center; display: grid; gap: 12px; }
.msg-card h2 { margin: 0; font: 900 20px/1.3 var(--font); color: var(--gold); }
.msg-card p { margin: 0; color: var(--ink-dim); }

/* ── game screen ─────────────────────────────────────────────────────── */
.game { display: flex; flex-direction: column; min-height: calc(100dvh - var(--top-h) - var(--safe-t) - var(--safe-b) - 8px); padding-bottom: 8px; }
.game-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 0 4px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink-hi); min-width: 0; }
.logo { width: 26px; height: 26px; flex: none; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.5)); }
.brand-name { font: 900 18px/1 var(--font); letter-spacing: 0.12em; white-space: nowrap; }
html:lang(en) .brand-name { letter-spacing: 0.02em; }
.hud { display: flex; align-items: center; gap: 8px; padding: 5px 10px; font: 800 12px/1 var(--mono); color: var(--ink-dim); letter-spacing: 0.06em; background: var(--panel); border: 2px solid var(--line); clip-path: var(--notch); white-space: nowrap; }
.hud b { color: var(--teal); font-weight: 900; }
.hud .hud-total b { color: var(--gold); }
.pips { display: flex; gap: 3px; }
.pip { width: 9px; height: 9px; background: #2a1f18; box-shadow: 0 0 0 1px #000, inset 0 0 0 1px rgba(255, 255, 255, 0.07); }
.pip.done { background: var(--pc, var(--ink-faint)); }
.pip.cur { background: var(--gold); animation: pip 0.9s steps(2) infinite; }
@keyframes pip { 50% { background: #7a5a1c; } }
.kicker { margin: 2px 0 6px; font: 700 11px/1.3 var(--mono); letter-spacing: 0.14em; color: var(--ink-faint); }
.kicker:empty { display: none; }
.demo-banner {
  margin: 0 0 8px; padding: 7px 10px; font: 700 12.5px/1.45 var(--font); color: var(--ink);
  background: rgba(255, 122, 61, 0.1); border: 2px dashed var(--heat);
}
.demo-banner b { color: var(--heat); letter-spacing: 0.08em; margin-right: 6px; }
.board-wrap { position: relative; flex: 1 1 300px; min-height: 230px; max-height: 76vh; }
.board-wrap > .board { position: absolute; inset: 0; }
.board-wrap.round-in > .board { animation: roundIn 0.34s cubic-bezier(.2, .8, .3, 1); }
@keyframes roundIn { from { opacity: 0; transform: translateX(14px); } }

.board {
  position: relative; width: 100%; overflow: hidden; background: var(--b-sheet);
  border: 2px solid var(--b-border); clip-path: var(--notch);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.board.is-interactive { touch-action: none; }
.board.is-dragging { cursor: grabbing; }
.board-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.grid-lines { stroke: var(--b-grid); stroke-width: 1; fill: none; shape-rendering: crispEdges; }
.ground-fill { fill: var(--b-ground); }
.ground-line { stroke: var(--b-ground-line); stroke-width: 2; }
.ground-ticks { stroke: var(--b-ticks); stroke-width: 1; shape-rendering: crispEdges; }
.hatch-bg { fill: none; }
.hatch-line { fill: var(--b-ref-hatch); }
.obj-ref { color: var(--b-ref); }
.obj-target { color: var(--b-target); }
.obj-target path, .obj-target rect, .obj-target circle, .obj-target ellipse, .obj-target polygon { stroke: var(--b-target-deep); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.obj-target.flash path, .obj-target.flash rect, .obj-target.flash circle, .obj-target.flash ellipse, .obj-target.flash polygon { animation: flash 380ms ease-out; }
@keyframes flash { 0% { stroke: #fff8e8; stroke-width: 6px; } 100% { stroke: var(--b-target-deep); stroke-width: 1px; } }
.is-actual { color: var(--b-actual-fill); }
.is-actual path, .is-actual rect, .is-actual circle, .is-actual ellipse, .is-actual polygon { stroke: var(--b-actual-line); stroke-width: 1.6px; stroke-dasharray: 5 3; vector-effect: non-scaling-stroke; }
.board-tools { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; z-index: 3; }
.tool {
  min-width: 40px; height: 40px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 800 13px/1 var(--font); color: var(--b-tool-ink); background: var(--b-tool); border: 2px solid var(--b-tool-line); clip-path: var(--notch);
}
.tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool-fit { position: absolute; right: 8px; bottom: 8px; z-index: 3; }
.tool-fit.is-wanted { border-color: var(--gold); color: var(--gold); animation: wanted 1.2s ease-in-out 2; }
@keyframes wanted { 50% { transform: scale(1.06); } }
.handle { position: absolute; left: 0; top: 0; width: 44px; height: 44px; border: 0; padding: 0; background: transparent; display: grid; place-items: center; cursor: nwse-resize; z-index: 2; touch-action: none; }
.handle::before { content: ""; position: absolute; width: 26px; height: 26px; border-radius: 50%; background: var(--b-sheet); border: 3px solid var(--b-target); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.35); transition: transform 120ms; }
.handle svg { position: relative; width: 16px; height: 16px; fill: none; stroke: var(--b-target); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.handle.is-clamped::before { border-style: dashed; }
.is-dragging .handle::before { transform: scale(1.15); }
.board-overlay { position: absolute; left: 8px; top: 8px; z-index: 3; pointer-events: none; max-width: calc(100% - 64px); }
.scorecard {
  min-width: 132px; padding: 8px 12px 9px; color: var(--ink); background: rgba(17, 11, 8, 0.94);
  border: 2px solid var(--gold-deep); clip-path: var(--notch); animation: cardPop 0.28s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes cardPop { from { transform: scale(0.85); opacity: 0; } }
.sc-score { margin: 0; line-height: 1; display: flex; align-items: baseline; gap: 4px; }
.sc-score b { font: 900 40px/1 var(--mono); letter-spacing: -0.02em; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.sc-score.tier-0 b { color: #ff9a85; }
.sc-score.tier-1 b { color: #ffb36b; }
.sc-score.tier-3 b { color: var(--teal); }
.sc-score.tier-4 b { color: var(--gold-hi); text-shadow: 0 0 14px rgba(255, 210, 110, 0.65); }
.sc-score span { font: 700 13px/1 var(--mono); color: var(--ink-dim); }
.sc-details { margin: 6px 0 0; font-size: 12.5px; line-height: 1.45; transition: opacity 240ms; }
.sc-details.is-pending { opacity: 0; }
.sc-details div { display: flex; gap: 6px; }
.sc-details dt { color: var(--ink-dim); }
.sc-details dd { margin: 0; font-weight: 800; }
.sc-off { color: var(--ink-dim); }

.under-board { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 8px; }
.labels { position: relative; flex: 1 1 auto; min-width: 0; }
.label-row { margin: 0 0 3px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 14px; }
.chip { font: 800 11px/18px var(--font); padding: 0 6px; flex: none; }
/* Legend swatches: the same fills as the board silhouettes (the board itself has no tags). */
.chip-ref { background: repeating-linear-gradient(45deg, transparent 0 4px, var(--b-ref-hatch) 4px 6px), var(--b-ref); color: var(--b-tag-ink); }
.chip-target { background: var(--b-target); color: var(--b-tag-ink); box-shadow: inset 0 0 0 1px var(--b-target-deep); }
.chip-actual { background: var(--b-actual-fill); color: var(--b-actual-line); outline: 1.5px dashed var(--b-actual-line); outline-offset: -1.5px; }
.name { border: 0; background: none; padding: 2px 0; min-height: 28px; font-weight: 800; text-align: left; cursor: pointer; text-decoration: underline dotted 1.5px; text-underline-offset: 4px; }
.is-ref .name { color: var(--teal); }
.is-target .name { color: #ff9a6b; }
.axis { color: var(--ink-faint); font-size: 12.5px; }
.describe {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 5; padding: 9px 12px; font-size: 13.5px; line-height: 1.5;
  color: var(--ink); background: #241810; border: 2px solid var(--gold-deep); clip-path: var(--notch); box-shadow: 0 10px 22px -12px rgba(0, 0, 0, 0.6);
}
.describe b { display: block; margin-bottom: 2px; color: var(--gold); }
.describe small { display: block; color: var(--ink-dim); margin-top: 4px; }
.lock { flex: 0 0 auto; min-width: 168px; min-height: 52px; font-size: 16px; }
.lock.is-next { color: #fff8e8; background: rgba(14, 9, 6, 0.94); border: 3px solid var(--heat); box-shadow: inset 0 0 0 2px #000; }
.lock.is-next.pulse { animation: nextIn 0.32s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes nextIn { from { transform: scale(0.94); opacity: 0.4; } }
.source-line { margin: 6px 0 0; min-height: 2.9em; color: var(--ink-faint); font-size: 12px; line-height: 1.45; }
.source-line a { color: var(--ink-dim); }
@media (max-width: 560px) {
  .under-board { flex-direction: column; align-items: stretch; gap: 6px; }
  .lock { width: 100%; }
}

/* ── results ─────────────────────────────────────────────────────────── */
.results { padding: 4px 0 28px; }
.res-grid { display: grid; gap: 0 28px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "a" "review" "b"; max-width: 560px; margin: 0 auto; }
@media (min-width: 900px) {
  .res-grid { max-width: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); grid-template-areas: "a review" "b review"; align-items: start; }
  .res-review { position: sticky; top: calc(var(--top-h) + 8px); }
}
.res-a { grid-area: a; }
.res-b { grid-area: b; }
.res-review { grid-area: review; }
.res-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font: 700 11px/1.3 var(--mono); letter-spacing: 0.12em; color: var(--ink-dim); }
.res-head .brand { gap: 6px; }
.res-head .brand .logo { width: 20px; height: 20px; }
.res-head .brand-name { font-size: 15px; color: var(--gold); letter-spacing: 0.18em; }
.res-tag { padding: 2px 6px; font: 800 10px/1.2 var(--mono); letter-spacing: 0.08em; color: #1d1108; background: var(--heat); }
.res-score { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; }
.res-score .big { font: 900 clamp(76px, 22vw, 112px)/0.9 var(--mono); color: var(--ink-hi); text-shadow: 0 4px 0 #000; font-variant-numeric: tabular-nums; }
.res-score .unit { font: 800 18px/1 var(--mono); color: var(--ink-dim); }
.res-bar { height: 8px; margin: 12px 0 0; background: #2a1f18; box-shadow: 0 0 0 2px #000; }
.res-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--heat), var(--gold)); }
.res-sub { margin: 10px 0 0; font: 14px/1.5 var(--font); color: var(--ink-dim); }
.res-reward { margin: 10px 0 0; padding: 8px 10px; font: 800 14px/1.35 var(--font); color: var(--gold-hi); text-align: center; background: rgba(36, 22, 8, 0.85); border: 2px solid var(--gold-deep); }
.res-reward.is-demo { color: var(--ink); border-color: var(--heat); border-style: dashed; background: rgba(255, 122, 61, 0.08); font-weight: 700; }
.res-block { margin-top: 22px; }
.res-block h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; font: 800 11px/1 var(--mono); letter-spacing: 0.2em; color: var(--ink-dim); }
.res-block h3 small { margin-left: auto; font-weight: 600; letter-spacing: 0.04em; color: var(--ink-faint); }
.data-tag { padding: 2px 5px; font: 800 9px/1 var(--mono); letter-spacing: 0.08em; color: #1d1108; background: var(--teal); }
.data-tag.is-small { background: var(--gold); }
svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { stroke: rgba(244, 234, 213, 0.35); stroke-width: 1; }
.chart .lbl { fill: var(--ink-faint); font: 600 9px var(--mono); }
.chart .curve { fill: none; stroke: var(--teal); stroke-width: 2; }
.chart .area { fill: rgba(111, 227, 198, 0.12); }
.chart .you { stroke: var(--heat); stroke-width: 2; }
.chart .you-dot { fill: var(--heat); stroke: #000; stroke-width: 1.5; }
.chart .you-lbl { fill: var(--heat); font: 800 10px var(--mono); }
.pct { margin: 8px 0 0; font: 800 15px/1.35 var(--mono); color: var(--ink-hi); text-align: center; }
.note-sm { margin: 6px 0 0; font: 11.5px/1.5 var(--font); color: var(--ink-faint); }
.empty-box { padding: 16px 12px; text-align: center; font: 700 13px/1.5 var(--font); color: var(--ink-dim); border: 2px dashed var(--line); }
.res-block.rank { margin-top: 14px; padding: 12px; background: rgba(8, 5, 4, 0.6); border: 1px solid var(--line); }
.rank-main { display: flex; align-items: center; gap: 12px; }
.rank-big { flex: none; padding: 3px; background: #000; border: 2px solid var(--gold); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.5); }
.rank-big.pop { animation: rankPop 0.5s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes rankPop { from { transform: scale(0.5) rotate(-8deg); opacity: 0; } }
.rank-ico { display: block; image-rendering: pixelated; }
.rank-txt { display: grid; gap: 3px; min-width: 0; }
.rank-txt small { font: 800 11px/1.2 var(--mono); letter-spacing: 0.12em; color: var(--ink-dim); }
.rank-txt b { font: 900 22px/1.15 var(--font); color: var(--gold); }
.rank-rng { font: 800 13px/1.2 var(--mono); color: var(--ink-hi); }
.rank-strip { display: flex; justify-content: space-between; gap: 4px; margin-top: 12px; }
.rank-step { position: relative; flex: 1 1 0; max-width: 40px; aspect-ratio: 1; padding: 2px; background: #000; border: 2px solid #2b2018; opacity: 0.45; }
.rank-step .rank-ico { width: 100%; height: 100%; }
.rank-step.past { opacity: 0.9; }
.rank-step.on { opacity: 1; border-color: var(--gold); transform: translateY(-3px); box-shadow: 0 3px 0 var(--gold-deep); }
.rank-step.on::after { content: ""; position: absolute; left: 50%; bottom: -10px; margin-left: -4px; border: 4px solid transparent; border-bottom: 0; border-top: 4px solid var(--gold); }
.rank-step.peek { opacity: 1; border-color: var(--teal); }
.rank-cap { min-height: 1.3em; margin: 10px 0 0; font: 12px/1.3 var(--font); color: var(--ink-dim); text-align: center; }

/* review: five round tabs + the comparison on a read-only board */
.res-review { margin-top: 18px; }
.round-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.round-tab {
  display: grid; gap: 4px; justify-items: center; padding: 7px 2px 8px; min-height: 58px; text-align: center;
  color: var(--ink-dim); background: var(--panel); border: 2px solid var(--line); clip-path: var(--notch);
}
.round-tab .rt-label { font: 800 10px/1 var(--mono); letter-spacing: 0.08em; }
.round-tab .rt-pts { font: 900 18px/1 var(--mono); color: var(--rc, var(--ink)); }
.round-tab .rt-bar { width: 80%; height: 4px; background: #2a1f18; }
.round-tab .rt-bar i { display: block; height: 100%; background: var(--rc, var(--ink-faint)); }
.round-tab[aria-selected="true"] { color: var(--ink-hi); background: #2a1c10; border-color: var(--gold); box-shadow: inset 0 -3px 0 var(--gold); }
#previewBoard { aspect-ratio: 4 / 3; margin-top: 10px; }
@media (min-width: 600px) { #previewBoard { aspect-ratio: 16 / 11; } }
.preview-caption { margin-top: 8px; display: grid; gap: 3px; font-size: 13px; }
.pc-names { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.pc-row { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.pc-ref { color: var(--teal); font-weight: 800; }
.pc-target { color: #ff9a6b; font-weight: 800; }
.pc-nums { color: var(--ink-dim); }
.pc-nums b { color: var(--ink-hi); }
.preview-caption a { color: var(--ink-faint); font-size: 12px; }
.preview-board-in { animation: roundIn 0.28s cubic-bezier(.2, .8, .3, 1); }

/* share, next step, quiet links */
.share-row { display: flex; gap: 10px; }
.share-row .btn { flex: 1; }
.share-box {
  margin: 10px 0 0; padding: 12px 14px; white-space: pre-wrap; word-break: break-all; user-select: text; -webkit-user-select: text;
  font: 14px/1.6 var(--mono); color: var(--ink-hi); background: rgba(8, 5, 4, 0.8); border: 2px dashed var(--line);
}
.status { min-height: 18px; margin: 8px 0 0; font: 12.5px/1.4 var(--font); color: var(--teal); }
.go-btn { display: flex; width: 100%; margin-top: 18px; min-height: 58px; font-size: 17px; letter-spacing: 0.14em; }
.res-next { margin: 10px 0 0; min-height: 1.4em; text-align: center; font: 800 14px/1.4 var(--mono); color: var(--ink-hi); letter-spacing: 0.02em; }
.tick { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.res-aux { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 16px; margin-top: 12px; }
.upload-note { margin: 12px 0 0; font: 12px/1.5 var(--font); color: var(--ink-faint); text-align: center; }

/* ── archive ─────────────────────────────────────────────────────────── */
.archive { max-width: 620px; margin: 0 auto; padding-top: 6px; }
.archive-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.archive h2 { margin: 6px 0 4px; font: 900 22px/1.2 var(--font); color: var(--gold); letter-spacing: 0.06em; }
.archive-balance { margin: 0; font: 800 14px/1 var(--mono); color: var(--gold-hi); white-space: nowrap; }
.archive-intro { margin: 0 0 12px; color: var(--ink-dim); font-size: 13.5px; }
.archive-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.archive-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; flex-wrap: wrap;
  background: var(--panel); border: 2px solid var(--line); clip-path: var(--notch);
}
.archive-list li.is-today { border-color: var(--gold-deep); }
.archive-list .ad-date { font: 800 15px/1.3 var(--mono); color: var(--ink-hi); }
.archive-list .ad-state { display: block; font-size: 12.5px; color: var(--ink-faint); }
.archive-list .ad-state.is-played { color: var(--teal); }
.archive-list .btn { min-height: 40px; font-size: 13.5px; letter-spacing: 0.04em; }
.archive-list .btn.is-confirming { color: #1d1108; background: var(--heat); border-color: #000; }
.archive-msg { min-height: 1.4em; font: 700 13.5px/1.4 var(--font); color: var(--heat); }
.archive-foot { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

/* ── tutorial modal ──────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; overflow-y: auto; padding: max(10px, var(--safe-t)) 10px max(10px, var(--safe-b)); background: rgba(8, 5, 3, 0.72); }
.modal-card {
  width: min(780px, 100%); max-height: 100%; overflow-y: auto; padding: 14px 16px 16px; color: var(--ink);
  background: #1b120b; border: 3px solid var(--line); clip-path: var(--notch); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8);
  animation: cardPop 0.26s ease-out;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-head h2 { margin: 0; font: 900 18px/1.3 var(--font); color: var(--gold); letter-spacing: 0.06em; }
.tut-intro { margin: 4px 0 10px; font-size: 13.5px; color: var(--ink-dim); }
.tut-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.tut-stages { display: flex; gap: 6px; flex-wrap: wrap; }
.tut-stage { min-height: 34px; padding: 0 10px; font: 800 12.5px/1 var(--font); color: var(--ink-dim); background: var(--panel); border: 2px solid var(--line); clip-path: var(--notch); }
.tut-stage[aria-selected="true"] { color: #1d1108; background: var(--gold); border-color: #000; }
.tut-play { display: flex; gap: 6px; }
.tut-body { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .tut-body { grid-template-columns: 1.3fr 1fr; align-items: center; } }
.tut-board-wrap { position: relative; }
#tutBoard { aspect-ratio: 4 / 3; max-height: 36vh; }
.tut-bubble { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 4; padding: 8px 10px; font-size: 13px; color: var(--ink); background: #241810; border: 2px solid var(--gold-deep); }
.tut-bubble b { color: var(--gold); }
.tut-bubble small { display: block; color: var(--ink-dim); }
.tut-cursor { position: absolute; left: 0; top: 0; z-index: 4; width: 22px; height: 22px; border-radius: 50%; pointer-events: none; background: rgba(244, 192, 78, 0.3); border: 2px solid var(--gold); transform: translate(-50%, -50%); }
.tut-step { margin: 0; font: 800 12px/1 var(--mono); letter-spacing: 0.14em; color: var(--heat); }
.tut-copy h3 { margin: 4px 0; font: 900 17px/1.3 var(--font); color: var(--ink-hi); }
.tut-copy p { margin: 0; font-size: 14px; color: var(--ink-dim); }
.tut-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.tut-note { margin: 0; font-size: 12px; color: var(--ink-faint); }
.tut-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

/* ── sheets, celebration, toasts ─────────────────────────────────────── */
.sheet { width: min(520px, 100vw); max-height: min(86dvh, 760px); margin: auto auto 0; padding: 0; color: var(--ink); background: #1b120b; border: 2px solid var(--line); border-bottom: 0; }
.sheet::backdrop { background: rgba(0, 0, 0, 0.6); }
.sheet-inner { display: flex; flex-direction: column; max-height: min(86dvh, 760px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font: 900 17px/1.2 var(--font); color: var(--gold); letter-spacing: 0.06em; }
.sheet-close { width: 40px; height: 40px; font: 800 16px/1 var(--mono); color: var(--ink-dim); background: none; border: 1px solid var(--line); }
.sheet-body { overflow-y: auto; padding: 12px 14px calc(var(--safe-b) + 16px); overscroll-behavior: contain; }
.sheet-body h3 { margin: 18px 0 8px; font: 800 11px/1 var(--mono); letter-spacing: 0.2em; color: var(--ink-dim); }
.sheet-lead { margin: 0 0 12px; padding: 10px 12px; background: rgba(8, 5, 4, 0.6); border: 1px solid var(--gold-deep); }
.lead-bal { display: flex; align-items: center; gap: 6px; margin: 0; font: 800 14px/1 var(--font); color: var(--ink); }
.lead-bal b { font: 900 24px/1 var(--mono); color: var(--gold-hi); }
.lead-txt { margin: 8px 0 0; font: 13px/1.45 var(--font); color: var(--ink-dim); }
.lead-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.stat { display: grid; gap: 4px; padding: 8px 4px; text-align: center; background: rgba(8, 5, 4, 0.6); border: 1px solid var(--line); }
.stat b { font: 800 20px/1 var(--mono); color: var(--ink-hi); }
.stat small { font: 11px/1.2 var(--font); color: var(--ink-faint); }
.ach-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ach-list li { display: grid; gap: 4px; padding: 8px 10px; border: 1px solid var(--line); color: var(--ink-faint); }
.ach-list li.on { color: var(--ink); border-color: var(--gold); }
.ach-top { display: flex; align-items: center; gap: 8px; }
.ach-top b { flex: 1; font: 800 14px/1.3 var(--font); }
.ach-coins { font: 800 12px/1 var(--mono); color: var(--gold-hi); }
.ach-list small { font: 12px/1.35 var(--font); }
.ach-list .done { color: var(--teal); }
.ach-list .bar { display: block; height: 6px; background: #2b2018; border: 1px solid var(--line); }
.ach-list .bar i { display: block; height: 100%; background: var(--teal); }
.earn-card { border: 1px solid var(--line); background: rgba(8, 5, 4, 0.45); }
.earn-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; padding: 8px 10px; border-bottom: 1px solid rgba(244, 234, 213, 0.08); }
.earn-row:last-child { border-bottom: 0; }
.earn-what { display: grid; gap: 2px; min-width: 0; }
.earn-what b { font: 700 14px/1.3 var(--font); }
.earn-what small { font: 12px/1.3 var(--font); color: var(--ink-faint); }
.earn-c { font: 900 14px/1.3 var(--mono); color: var(--gold-hi); white-space: nowrap; }
.shop { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.shop li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); }
.shop li.on { border-color: var(--teal); box-shadow: inset 3px 0 0 var(--teal); }
.theme-swatch svg { display: block; border: 2px solid #000; }
.shop .nm { font: 800 14px/1.3 var(--font); }
.shop .nm small { display: block; font: 12px/1.35 var(--font); color: var(--ink-faint); }
.shop .nm .price { color: var(--gold-hi); font-family: var(--mono); }
.shop .equipped { font: 800 12px/1 var(--mono); color: var(--teal); }
.toasts { position: fixed; z-index: 55; left: 10px; top: calc(var(--safe-t) + var(--top-h) - 4px); display: grid; gap: 6px; width: min(260px, calc(100vw - 20px)); pointer-events: none; }
.toast { display: grid; gap: 2px; padding: 8px 12px; color: var(--ink); background: rgba(24, 15, 9, 0.96); border: 2px solid var(--gold); clip-path: var(--notch); animation: toastIn 0.22s ease-out; }
.toast b { font: 800 13px/1.3 var(--font); color: var(--gold); }
.toast .toast-coins { font: 800 14px/1 var(--mono); color: var(--gold-hi); }
.toast.out { opacity: 0; transition: opacity 0.2s; }
@keyframes toastIn { from { transform: translateX(-12px); opacity: 0; } }
.celebrate { position: fixed; inset: 0; z-index: 56; display: grid; place-items: center; padding: 16px; pointer-events: none; }
.cel-card { width: min(320px, 100%); padding: 16px 18px 14px; text-align: center; color: var(--ink); background: rgba(27, 17, 9, 0.97); border: 3px solid var(--gold); clip-path: var(--notch); box-shadow: 0 0 0 3px #000, 0 10px 40px rgba(0, 0, 0, 0.6); }
.celebrate.in .cel-card { animation: celPop 0.42s cubic-bezier(.2, 1.5, .4, 1); }
.celebrate.out .cel-card { opacity: 0; transform: scale(0.94); transition: opacity 0.24s, transform 0.24s; }
@keyframes celPop { from { transform: scale(0.6); opacity: 0; } }
.cel-kicker { margin: 0; font: 800 12px/1 var(--mono); letter-spacing: 0.18em; color: var(--teal); }
.cel-total { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 10px 0 2px; font: 900 46px/1 var(--mono); color: var(--gold-hi); text-shadow: 0 3px 0 #000; }
.cel-total small { font: 800 16px/1 var(--font); color: var(--ink); text-shadow: none; }
.cel-head { margin: 4px 0 0; font: 800 16px/1.3 var(--font); color: var(--gold); }
.cel-lines { list-style: none; margin: 10px 0 0; padding: 0; border-top: 1px solid var(--line); }
.cel-lines li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 2px; font: 13px/1.3 var(--font); color: var(--ink-dim); border-bottom: 1px solid rgba(244, 234, 213, 0.08); }
.cel-lines b { font: 800 13px/1.3 var(--mono); color: var(--gold-hi); }
.cel-foot { margin: 10px 0 0; font: 12px/1.35 var(--font); color: var(--ink-faint); }
.toast-msg {
  position: fixed; left: 50%; bottom: max(18px, var(--safe-b)); z-index: 60; transform: translateX(-50%); max-width: calc(100vw - 32px);
  padding: 9px 16px; text-align: center; font: 800 14px/1.4 var(--font); color: var(--ink); background: rgba(24, 15, 9, 0.97); border: 2px solid var(--gold); clip-path: var(--notch);
}
.noscript { position: fixed; inset: auto 16px 40% 16px; text-align: center; color: #fff; }

/* DEV sound check */
.soundcheck h1 { font-size: 20px; }
.cue-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.soundcheck pre { background: var(--panel); border: 1px solid var(--line); padding: 10px; font-size: 12px; white-space: pre-wrap; }
.soundcheck .primary, .soundcheck .secondary { min-height: 40px; padding: 0 14px; color: var(--gold); background: var(--panel); border: 2px solid var(--gold); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* maker credit and inline links */
.maker { margin: 18px 0 0; text-align: center; font: 600 11px/1.4 var(--mono); letter-spacing: 0.12em; color: var(--ink-faint); }
.wordmark { color: var(--ink-dim); font-weight: 800; letter-spacing: 0.16em; }
.link-btn.inline { min-height: 0; padding: 0 0 0 8px; font-size: 12.5px; color: var(--gold); }

/* English is longer: calmer letter-spacing, one-line kicker */
.kicker { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html:lang(en) .kicker, html:lang(en) .res-block h3, html:lang(en) .sheet-body h3, html:lang(en) .hud { letter-spacing: 0.04em; }
html:lang(en) .btn, html:lang(en) .go-btn { letter-spacing: 0.04em; }
