/* ChessGrade — Steam site. Layout: one long page of 17 scenes over a fixed 3D board; a 12-column, 1320px grid;
   fixed HUD on top, the evaluation bar on the right edge. The look is the game's Premium appearance (one dark world);
   S12 swaps these tokens for the other five appearances while the visitor is in it. */
:root {
  color-scheme: dark;
  --bg-000: #111010; --bg-100: #1b1a18; --bg-200: #24211d; --bg-300: #2e2a25;
  --line: #3a332a; --line-strong: #5c5244;
  --ink: #f3efe8; --ink-muted: #b4ada1; --ink-dim: #928b7f;
  --gold: #e2ad3f; --gold-deep: #a67d22; --gold-soft: #2f2616; --on-gold: #17130c;
  --board-light: #f0d9b5; --board-dark: #b58863;
  --green: #55c987; --red: #ec6f5b; --orange: #f08a4b; --yellow: #f2d46b; --cyan: #6ea8f5; --on-signal: #111010;
  --shadow: 0 10px 30px -12px #000; --shadow-press: 0 6px 16px -8px #000;
  --r-panel: 14px; --r-btn: 10px; --r-chip: 999px; --b1: 1px; --b2: 2px;
  --font-display: "Oswald", "Arial Narrow", sans-serif;
  --font-ui: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --margin: 48px; --gutter: 24px; --maxw: 1320px; --hud: 64px;
  --step: 100ms;
}
/* the other five appearances (game web/css/tokens.css + themes.css) — only inside S12 */
:root[data-ap="arcade"] { --bg-000:#0c0a08; --bg-100:#16130f; --bg-200:#201b15; --bg-300:#2c251c; --line:#4a3d2c; --line-strong:#8a7352; --ink:#f6eedc; --ink-muted:#c2b291; --ink-dim:#9a8a6c; --gold:#ffb81c; --gold-deep:#a86f00; --gold-soft:#3a2c10; --on-gold:#1a1204; --board-light:#efd9b4; --board-dark:#b58863; --cyan:#38d9e8; --green:#5fd36e; --red:#ff5a52; --orange:#ff8c2a; --yellow:#f4e56a; --on-signal:#0c0a08; --shadow:4px 4px 0 0 #000; --shadow-press:2px 2px 0 0 #000; --r-panel:0px; --r-btn:4px; --r-chip:2px; --b1:2px; --b2:3px; --font-display:"Pixelify Sans","Chakra Petch",system-ui,sans-serif; --font-ui:"Chakra Petch",system-ui,sans-serif; }
:root[data-ap="clube"] { color-scheme: light; --bg-000:#f4efe3; --bg-100:#fbf8f1; --bg-200:#ece5d4; --bg-300:#ddd3bb; --line:#cdbf9f; --line-strong:#a89a78; --ink:#1d2620; --ink-muted:#4f5a4e; --ink-dim:#667260; --gold:#1f5a3d; --gold-deep:#123a27; --gold-soft:#dfe9dc; --on-gold:#fbf8f1; --board-light:#eee6cf; --board-dark:#6f8e5e; --cyan:#2b5a86; --green:#2b7044; --red:#a3302a; --orange:#a8531a; --yellow:#8a6d0a; --on-signal:#fbf8f1; --shadow:none; --shadow-press:none; --r-panel:6px; --r-btn:4px; --r-chip:3px; --b1:1px; --b2:2px; --font-display:"Playfair Display",Georgia,serif; --font-ui:"Source Serif 4",Georgia,serif; }
:root[data-ap="suico"] { color-scheme: light; --bg-000:#ffffff; --bg-100:#ffffff; --bg-200:#f1f1f1; --bg-300:#e2e2e2; --line:#0a0a0a; --line-strong:#0a0a0a; --ink:#0a0a0a; --ink-muted:#4d4d4d; --ink-dim:#666666; --gold:#c81d14; --gold-deep:#8f130d; --gold-soft:#fbe3e1; --on-gold:#ffffff; --board-light:#f2f2f2; --board-dark:#a3a3a3; --cyan:#1d4ed8; --green:#0b7a3e; --red:#c81d14; --orange:#b45309; --yellow:#8a6a06; --on-signal:#ffffff; --shadow:none; --shadow-press:none; --r-panel:0px; --r-btn:0px; --r-chip:0px; --b1:1px; --b2:2px; --font-display:"Inter Tight","Helvetica Neue",Arial,sans-serif; --font-ui:"Inter Tight","Helvetica Neue",Arial,sans-serif; }
:root[data-ap="neon"] { --bg-000:#060a08; --bg-100:#0c1410; --bg-200:#12201a; --bg-300:#1b3027; --line:#24463a; --line-strong:#3c7a62; --ink:#d6ffe8; --ink-muted:#86b39c; --ink-dim:#6c9c84; --gold:#39ff88; --gold-deep:#1f9e55; --gold-soft:#0f2a1c; --on-gold:#03130a; --board-light:#2d5a48; --board-dark:#14301f; --cyan:#4fdcff; --green:#5dffa3; --red:#ff5c7a; --orange:#ffa14f; --yellow:#f4ec6a; --on-signal:#03130a; --shadow:0 0 0 1px rgba(57,255,136,.08),0 0 24px -10px #39ff88; --shadow-press:0 0 18px -4px #39ff88; --r-panel:2px; --r-btn:2px; --r-chip:2px; --b1:1px; --b2:2px; --font-display:"JetBrains Mono",ui-monospace,monospace; --font-ui:"JetBrains Mono",ui-monospace,monospace; }
:root[data-ap="ludico"] { color-scheme: light; --bg-000:#fff6ea; --bg-100:#ffffff; --bg-200:#fff0d6; --bg-300:#f8e3bf; --line:#f0d6b0; --line-strong:#d9b883; --ink:#2b1d3a; --ink-muted:#6e6080; --ink-dim:#7d6f8f; --gold:#c2410c; --gold-deep:#8f2f07; --gold-soft:#ffe3cc; --on-gold:#ffffff; --board-light:#ffe7c2; --board-dark:#f4a462; --cyan:#2563eb; --green:#15803d; --red:#d4263c; --orange:#b45309; --yellow:#a16207; --on-signal:#ffffff; --shadow:0 4px 0 #e8c79a; --shadow-press:0 2px 0 #e8c79a; --r-panel:20px; --r-btn:14px; --r-chip:10px; --b1:2px; --b2:3px; --font-display:"Fredoka","Nunito",system-ui,sans-serif; --font-ui:"Nunito",system-ui,sans-serif; }

html { scroll-behavior: auto; }
body { margin: 0; background: var(--bg-000); color: var(--ink); font: 400 16px/24px var(--font-ui); -webkit-font-smoothing: antialiased; overflow-x: hidden; transition: background-color var(--step) steps(2); }
html:not([data-lang="pt"]) [data-l="pt"], html:not([data-lang="en"]) [data-l="en"], html:not([data-lang="es"]) [data-l="es"], html:not([data-lang="fr"]) [data-l="fr"], html:not([data-lang="de"]) [data-l="de"] { display: none !important; }
img { max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- layers */
#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; display: block; }
#bgpat { position: fixed; inset: -10%; z-index: 0; pointer-events: none; background-image: linear-gradient(45deg, rgba(181,136,99,.035) 25%, transparent 25%, transparent 75%, rgba(181,136,99,.035) 75%), linear-gradient(45deg, rgba(181,136,99,.035) 25%, transparent 25%, transparent 75%, rgba(181,136,99,.035) 75%); background-size: 160px 160px; background-position: 0 0, 80px 80px; }
#veil { position: fixed; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(ellipse 80% 70% at 50% 60%, transparent 0%, color-mix(in srgb, var(--bg-000) 55%, transparent) 70%, var(--bg-000) 100%); opacity: 0; transition: opacity .5s; }
body.hero #veil { opacity: 1; }
#stage { transition: opacity .2s linear; }
main { position: relative; z-index: 1; }

/* ---------- type */
.kicker { font: 600 13px/16px var(--font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin: 0; }
.h1 { font: 700 64px/68px var(--font-display); text-transform: uppercase; margin: 0; text-wrap: balance; max-width: 18ch; }
.h2 { font: 600 28px/32px var(--font-display); text-transform: uppercase; margin: 0; }
.lead { font: 400 20px/30px var(--font-ui); margin: 0; max-width: 52ch; }
.body { font: 400 16px/24px var(--font-ui); color: var(--ink-muted); margin: 0; max-width: 60ch; }
.label { font: 600 13px/16px var(--font-ui); letter-spacing: .08em; text-transform: uppercase; }
.micro { font: 500 13px/18px var(--font-ui); color: var(--ink-dim); margin: 0; }
.score { font: 700 48px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.dxl { font: 700 120px/1 var(--font-display); text-transform: uppercase; margin: 0; }

/* ---------- grid */
.wrap { width: 100%; max-width: calc(var(--maxw) + 2 * var(--margin)); margin: 0 auto; padding-inline: var(--margin); box-sizing: border-box; }
.g12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); row-gap: 32px; align-items: center; }
.c1-5 { grid-column: 1 / 6; } .c1-6 { grid-column: 1 / 7; } .c1-4 { grid-column: 1 / 5; } .c5-12 { grid-column: 5 / 13; } .c6-12 { grid-column: 6 / 13; }
.c7-12 { grid-column: 7 / 13; } .c1-12 { grid-column: 1 / 13; } .c6-9 { grid-column: 6 / 10; } .c10-12 { grid-column: 10 / 13; } .c1-3 { grid-column: 1 / 4; } .c4-9 { grid-column: 4 / 10; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* ---------- scenes */
.scene { position: relative; min-height: var(--len, 100vh); }
.scene > .in { padding-block: calc(var(--hud) + 56px) 72px; }
.scene:not(.pinned):not(.full) > .in { min-height: var(--len); box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; }
.scene:not(.pinned):not(.full) > .in > .wrap { width: 100%; }
.stack > .seg { align-self: flex-start; }
.scene.pinned > .in { position: sticky; top: 0; height: 100vh; box-sizing: border-box; padding-block: calc(var(--hud) + 32px) 32px; overflow: hidden; display: flex; align-items: center; }
.scene.pinned > .in > .wrap { width: 100%; }
.dock-room { padding-right: 0; }


/* ---------- HUD */
#hud { position: fixed; z-index: 30; left: 0; right: 0; top: 0; height: var(--hud); padding: env(safe-area-inset-top, 0px) var(--margin) 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; background: color-mix(in srgb, var(--bg-000) 88%, transparent); border-bottom: 1px solid var(--line); box-sizing: content-box; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { height: 44px; width: auto; }
.wordmark { font: 700 24px/1 var(--font-display); letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; }
.wordmark b, .wm b { color: var(--gold); font-weight: inherit; }
.hud-c { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; min-width: 0; }
.hud-c .kicker { font-size: 12px; line-height: 14px; }
.hud-c .h2 { font-size: 22px; line-height: 26px; white-space: nowrap; }
.hud-r { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.langs { display: flex; height: 40px; border: var(--b2) solid var(--line-strong); border-radius: var(--r-btn); overflow: hidden; box-sizing: border-box; }
.langs button { border: 0; background: transparent; color: var(--ink-muted); padding: 0 12px; font: 600 13px/1 var(--font-ui); letter-spacing: .08em; cursor: pointer; }
.langs button[aria-pressed="true"] { background: var(--gold-soft); color: var(--gold); }
.hud-r .hud-move { display: none; }

/* ---------- buttons, chips, panels, tiles */
.btn { height: 40px; padding: 0 18px; border-radius: var(--r-btn); display: inline-flex; align-items: center; justify-content: center; gap: 10px; box-sizing: border-box; cursor: pointer; white-space: nowrap; text-decoration: none; font: 600 13px/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; transition: transform var(--step) steps(2), box-shadow var(--step) steps(2); }
.btn:hover { transform: translateY(2px); box-shadow: var(--shadow-press); }
.btn:active { transform: translateY(2px); filter: brightness(.9); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-p { background: var(--gold); color: var(--on-gold); border: 0; font-weight: 700; box-shadow: var(--shadow); }
.btn-s { background: transparent; color: var(--ink); border: var(--b2) solid var(--line-strong); }
.btn-g { background: transparent; color: var(--ink-muted); border: 0; }
.btn-g:hover { color: var(--ink); box-shadow: none; }
.btn-d { background: transparent; color: var(--red); border: var(--b2) solid var(--red); }
.btn-lg { height: 56px; padding: 0 28px; font-size: 15px; }
.btn-icon { width: 40px; padding: 0; }
.steam-logo { width: 22px; height: 22px; flex: none; border: 2px dashed currentColor; border-radius: 50%; box-sizing: border-box; opacity: .8; }
.count { font: 700 13px/1 var(--font-display); padding: 3px 7px; border-radius: 6px; background: var(--bg-300); color: var(--ink); }
.chip { height: 32px; padding: 0 12px; border-radius: var(--r-chip); border: 1px solid var(--line-strong); display: inline-flex; align-items: center; gap: 6px; box-sizing: border-box; font: 600 16px/1 var(--font-display); font-variant-numeric: tabular-nums; color: var(--ink); background: var(--bg-100); white-space: nowrap; }
.chip.t { font: 600 13px/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; }
.chip img { width: 20px; height: 20px; }
.chip.gold { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.chip.ok { background: var(--green); border-color: var(--green); color: var(--on-signal); }
.panel { background: var(--bg-100); border: var(--b1) solid var(--line); border-radius: var(--r-panel); box-shadow: var(--shadow); overflow: hidden; min-width: 0; }
.panel.feat { background: var(--gold-soft); border-color: var(--gold); }
.ph { min-height: 44px; padding: 0 20px; background: var(--bg-200); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.feat > .ph { background: color-mix(in srgb, var(--gold) 12%, transparent); }
.pt { margin: 0; font: 600 18px/1.1 var(--font-display); text-transform: uppercase; display: flex; align-items: center; gap: 10px; }
.pt img { width: 22px; height: 22px; }
.pb { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.tile { background: var(--bg-100); border: var(--b1) solid var(--line); border-radius: var(--r-panel); box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.tile .ib { width: 48px; height: 48px; border-radius: var(--r-btn); border: 1px solid var(--line-strong); background: var(--bg-000); display: grid; place-items: center; }
.tile .ib img { width: 24px; height: 24px; }
.tile h3 { margin: 0; font: 600 22px/26px var(--font-display); text-transform: uppercase; }
.tile p { margin: 0; color: var(--ink-muted); font-size: 15px; line-height: 22px; }
.tile .tf { display: flex; justify-content: space-between; border-top: 1px dashed var(--line); padding-top: 10px; margin-top: auto; }
.g2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.g3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.g4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.glyph { font: 700 1em/1 var(--font-display); }
.q-ex { color: var(--green); } .q-good { color: var(--green); } .q-in { color: var(--yellow); } .q-mi { color: var(--orange); } .q-bl { color: var(--red); }
.tag { display: inline-grid; place-items: center; min-width: 30px; height: 22px; border-radius: 6px; font: 700 13px/1 var(--font-display); color: var(--on-signal); padding: 0 4px; box-sizing: border-box; }
.tag.ex { background: var(--green); } .tag.gd { background: var(--bg-300); color: var(--ink); border: 1px solid var(--line-strong); } .tag.in { background: var(--yellow); } .tag.mi { background: var(--orange); } .tag.bl { background: var(--red); } .tag.br { background: var(--cyan); }

/* ---------- 2D board */
.board { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 22px; gap: 4px 6px; width: 100%; max-width: 560px; }
.board.nocoord { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.board .ranks { display: grid; grid-template-rows: repeat(8, minmax(0, 1fr)); align-items: center; font: 500 13px/1 var(--font-ui); color: var(--ink-dim); }
.board .files { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); text-align: center; font: 500 13px/22px var(--font-ui); color: var(--ink-dim); grid-column: 2; }
.board .sqs { position: relative; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); aspect-ratio: 1; box-shadow: var(--shadow); user-select: none; touch-action: none; }
.sq { position: relative; border: 0; padding: 0; margin: 0; background: var(--board-light); display: grid; place-items: center; cursor: pointer; min-width: 0; min-height: 0; }
.sq.d { background: var(--board-dark); }
.sq img { width: 90%; height: 90%; pointer-events: none; transition: transform 200ms cubic-bezier(.2,.8,.2,1), filter 200ms; }
.sq:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--gold); z-index: 2; }
.sq.hover::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 2px var(--gold); pointer-events: none; }
.sq.sel { box-shadow: inset 0 0 0 100px color-mix(in srgb, var(--gold) 35%, transparent); }
.sq.sel img { transform: translateY(-6%); filter: drop-shadow(0 8px 6px rgba(0,0,0,.5)); }
.sq.last { box-shadow: inset 0 0 0 100px color-mix(in srgb, var(--gold) 26%, transparent); }
.sq.ring::before { content: ""; position: absolute; inset: 6%; border-radius: 50%; border: 3px solid var(--gold); pointer-events: none; }
.sq .dot { position: absolute; width: 28%; height: 28%; border-radius: 50%; background: rgba(20,20,20,.32); pointer-events: none; }
.sq .cap { position: absolute; inset: 5%; border-radius: 50%; border: 6px solid rgba(20,20,20,.32); pointer-events: none; }
.sq.flash { animation: flash 240ms step-end 1; }
.sq.ok { box-shadow: inset 0 0 0 100px color-mix(in srgb, var(--green) 85%, transparent); }
.sq.ok::after { content: "✓"; font: 700 22px/1 var(--font-display); color: var(--on-signal); position: absolute; }
@keyframes flash { 0%, 50% { box-shadow: inset 0 0 0 100px rgba(236,111,91,.8); } 25%, 75% { box-shadow: none; } }
.arrows { position: absolute; inset: 0; pointer-events: none; }
.mini { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); aspect-ratio: 1; width: 100%; }
.mini > i { background: var(--board-light); display: grid; place-items: center; min-width: 0; min-height: 0; }
.mini > i.d { background: var(--board-dark); }
.mini > i img { width: 92%; height: 92%; }

/* ---------- evaluation bar, dock, move list */
#eval { position: fixed; z-index: 25; right: 24px; top: calc(var(--hud) + 24px); bottom: 24px; width: 14px; border: 1px solid var(--line-strong); background: var(--bg-000); box-sizing: border-box; cursor: pointer; padding: 0; transition: opacity .4s; }
#eval .w { position: absolute; left: 0; right: 0; bottom: 0; height: 50%; background: var(--ink); transition: height 400ms cubic-bezier(.3,.7,.2,1); }
#eval .mid { position: absolute; left: -4px; right: -4px; top: 50%; height: 1px; background: var(--ink-dim); }
#evalchip { position: fixed; z-index: 26; right: 44px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--ink); color: var(--bg-000); display: grid; place-items: center; font: 700 13px/1 var(--font-display); font-variant-numeric: tabular-nums; transition: top 400ms cubic-bezier(.3,.7,.2,1); pointer-events: none; }
#phase { position: fixed; z-index: 25; right: 42px; top: calc(var(--hud) + 24px); bottom: 24px; width: 4px; background: var(--bg-300); pointer-events: none; }
#phase .seg { position: absolute; left: 0; right: 0; }
#phase .mk { position: absolute; right: 8px; height: 20px; padding: 0 5px; border-radius: 4px; color: var(--on-signal); display: grid; place-items: center; font: 700 13px/1 var(--font-display); transform: translateY(-50%); }
#dock { position: fixed; z-index: 24; right: 60px; bottom: 72px; width: 200px; height: 200px; border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); cursor: pointer; background: transparent; padding: 0; transition: opacity .5s; }
#movechip { position: fixed; z-index: 25; right: 60px; bottom: 24px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg-100); display: flex; align-items: center; gap: 8px; color: var(--ink); cursor: pointer; font: 600 16px/1 var(--font-display); font-variant-numeric: tabular-nums; }
#movechip .n { color: var(--ink-dim); }
body.stage #dock { opacity: 0; pointer-events: none; }
body.noeval #eval, body.noeval #phase, body.noeval #evalchip { opacity: 0; }

.sheet { position: fixed; z-index: 40; top: 0; right: 0; bottom: 0; width: 400px; max-width: 100vw; background: var(--bg-100); border-left: 1px solid var(--line); box-shadow: -20px 0 60px -20px #000; transform: translateX(105%); transition: transform 300ms cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; }
.sheet.open { transform: none; }
.sheet .ph { min-height: 56px; }
.moves { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.mrow { text-align: left; border: 0; border-left: 3px solid transparent; border-radius: 6px; background: transparent; color: var(--ink-dim); padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.mrow.seen { color: var(--ink); }
.mrow.cur { background: var(--gold-soft); border-left-color: var(--gold); color: var(--ink); }
.mrow .l { display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1fr); font: 500 16px/22px var(--font-display); font-variant-numeric: tabular-nums; }
.mrow .s { font: 500 13px/16px var(--font-ui); color: var(--ink-dim); padding-left: 34px; }
.scrim { position: fixed; inset: 0; z-index: 39; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .3s; }
.scrim.on { opacity: 1; pointer-events: auto; }

/* ---------- XP and toasts */
#toast { position: fixed; z-index: 45; left: 24px; bottom: 24px; width: 340px; max-width: calc(100vw - 48px); display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 14px; align-items: center; padding: 14px 18px; box-sizing: border-box; transform: translateY(140%); transition: transform .3s steps(2); }
#toast.on { transform: none; }
#toast:not(.on) { visibility: hidden; transition: transform .3s steps(2), visibility 0s .3s; }
#toast img { width: 48px; height: 48px; }
.coin { position: fixed; z-index: 50; width: 28px; height: 28px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3c4, #e2ad3f 45%, #a67d22); box-shadow: 0 0 0 2px #7a5a17 inset; pointer-events: none; }

/* ---------- transitions */
#flip { position: fixed; inset: 0; z-index: 60; pointer-events: none; display: grid; perspective: 1200px; }
#flip i { background: var(--bg-000); transform: rotateY(90deg); transform-style: preserve-3d; box-shadow: inset 0 0 0 1px var(--line); }
#flip.a i { transform: rotateY(0deg); background: var(--bg-300); transition: transform 300ms steps(2), background 300ms steps(2); }
#flip.b i { transform: rotateY(-90deg); background: var(--bg-000); transition: transform 300ms steps(2); }

/* ---------- prelude */
#prelude { position: fixed; inset: 0; z-index: 80; display: grid; place-items: end center; padding-bottom: 12vh; background: radial-gradient(ellipse 50% 40% at 50% 45%, rgba(226,173,63,.08), transparent 70%); transition: opacity .6s; pointer-events: none; }
#prelude .ct { font: 500 14px/1 var(--font-display); color: var(--ink-dim); letter-spacing: .06em; font-variant-numeric: tabular-nums; }
#prelude.done { opacity: 0; }
#prelude2d { display: none; width: min(60vw, 320px); }

/* ---------- act cards */
.act { min-height: 60vh; display: grid; place-items: center; text-align: center; }
.act .in { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-block: 64px; }
.act .dxl { color: var(--gold); }


/* ---------- S01 */
#s1 .in { min-height: 100vh; display: flex; align-items: center; box-sizing: border-box; padding-block: var(--hud) 0; }
.wm { font: 700 clamp(72px, 8.4vw, 168px)/0.9 var(--font-display); letter-spacing: .005em; margin: 0; text-transform: uppercase; }
.emblem-wrap { position: relative; display: grid; place-items: center; perspective: 1000px; height: min(70vh, 760px); }
.emblem-wrap .rim { position: absolute; inset: -6% -10%; border-radius: 50%; background: radial-gradient(circle at var(--lx, 62%) var(--ly, 40%), rgba(226,173,63,.38), rgba(226,173,63,.08) 40%, transparent 66%); pointer-events: none; }
.emblem { position: relative; height: 100%; width: auto; transform: rotateY(var(--ry, 0deg)) rotateX(var(--rx, 0deg)); transition: transform 120ms; filter: drop-shadow(0 30px 40px rgba(0,0,0,.6)); cursor: pointer; border: 0; background: none; padding: 0; }
.emblem img { height: 100%; width: auto; display: block; }
.emblem.hop { animation: hop 900ms cubic-bezier(.4,0,.2,1); }
@keyframes hop { 0% { translate: 0 0; } 33% { translate: 0 -18%; } 66% { translate: 9% -18%; } 100% { translate: 0 0; } }
.scrollchip { position: absolute; left: 50%; bottom: 32px; transform: translateX(-50%); height: 36px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-strong); background: color-mix(in srgb, var(--bg-100) 90%, transparent); display: flex; align-items: center; gap: 10px; }
.blink { width: 10px; height: 10px; background: var(--gold); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- S02 save file */
.slab-wrap { perspective: 1400px; height: 420px; display: grid; place-items: center; }
.slab { position: relative; width: 300px; height: 190px; transform-style: preserve-3d; transform: rotateX(56deg) rotateZ(-28deg); transition: transform .6s; }
.layer { position: absolute; inset: 0; border-radius: 10px; background: linear-gradient(135deg, #2c2420, #120e0b); border: 2px solid #a67d22; box-shadow: 0 0 0 1px #000 inset; transform: translateZ(calc(var(--i) * 6px)); transition: transform .6s cubic-bezier(.2,.8,.2,1); display: flex; align-items: center; justify-content: center; }
.layer span { font: 600 13px/1 var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); opacity: 0; transition: opacity .3s; transform: rotateZ(28deg); }
.layer.top { background: linear-gradient(135deg, #3a302a, #15100c); }
.layer.top img { width: 90px; transform: rotateZ(28deg); opacity: .9; }
.layer.top b { position: absolute; bottom: 12px; font: 600 13px/1 var(--font-display); color: var(--gold); letter-spacing: .08em; transform: none; }
.slab.open .layer { transform: translateZ(calc(var(--i) * 62px)); }
.slab.open .layer span { opacity: 1; }
.layer.key { background: #2e2a25; border-color: #5c5244; }
.slab.open .layer.key { transform: translateZ(80px) translateX(250px); }
.onrow { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.onrow:last-child { border-bottom: 0; }
.onrow img { width: 24px; height: 24px; }
.sw { width: 44px; height: 24px; border-radius: 999px; background: var(--bg-300); border: 1px solid var(--line-strong); position: relative; }
.sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-dim); }
.onrow:hover .sw { animation: shake 240ms steps(2) 1; }
@keyframes shake { 25% { translate: 3px 0; } 50% { translate: -3px 0; } 75% { translate: 2px 0; } }

/* ---------- S03 */
.pstrip { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 12px; background: var(--bg-100); border: 1px solid var(--line); border-radius: 10px; }
.yourmove { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 6px; background: var(--gold); color: var(--on-gold); font: 700 12px/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; }
.yourmove::before { content: ""; width: 8px; height: 8px; background: var(--on-gold); animation: blink 1s steps(2) infinite; }
.slots { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.slot { aspect-ratio: 1; display: grid; place-items: center; background: var(--bg-300); border: 1px solid var(--line); border-radius: 4px; font: 700 12px/1 var(--font-display); color: var(--ink-muted); }
.slot.cur { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); animation: blinkb 1s steps(2) infinite; }
.slot.hit { background: var(--green); color: var(--on-signal); border-color: var(--green); }
@keyframes blinkb { 50% { border-color: var(--line-strong); } }
.bar { height: 8px; border-radius: 999px; background: var(--bg-300); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--gold); width: 0; transition: width .4s steps(4); }
.prev3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 10px; background: var(--bg-000); }
.prev3 > div { padding: 10px 6px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.prev3 > div + div { border-left: 1px solid var(--line); }
.prev3 b { font: 700 22px/1 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pz-msg { min-height: 40px; }
.solved { color: var(--green); }
#goalTitle.solved { font-size: 28px !important; }
#cloud { width: 100%; height: 360px; display: block; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; }
.s3b { margin-top: 12vh; }

/* ---------- S04 wheel */
.wheel-wrap { position: relative; width: min(100%, 460px); aspect-ratio: 1; margin: 0 auto; }
.wheel-wrap svg { width: 100%; height: 100%; display: block; }
.wheel { transition: transform 2.4s cubic-bezier(.12,.8,.18,1); transform-origin: 50% 50%; }
.pointer { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 24px solid var(--ink); filter: drop-shadow(0 2px 2px #000); }
.themerow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.themerow i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-right: 8px; }
.themerow .btn { height: 32px; padding: 0 10px; }
.drawn { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 200px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- S05 */
.hpin { overflow: hidden; }
.htrack { display: flex; width: 200%; flex: none; transition: transform .1s linear; }
.htrack > div { width: 50%; flex: none; }
.ring { position: relative; height: 230px; perspective: 1100px; margin-top: 8px; }
.ring .rot { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; transform: rotateX(-20deg) rotateY(var(--ang, 0deg)); }
.ring .rot > div { position: absolute; width: 96px; left: -48px; top: -48px; transform: rotateY(calc(var(--i) * 45deg)) translateZ(170px); box-shadow: 0 10px 20px -8px #000; }
.wpt { width: 100%; border-collapse: collapse; font: 500 14px/1 var(--font-ui); font-variant-numeric: tabular-nums; }
.wpt th, .wpt td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.wpt th { font: 600 12px/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); }
.wpt td.c { color: var(--ink-dim); }
.wpt td.on { color: var(--ink); }
.tablebox { overflow-x: auto; }
.ladder { position: relative; height: 420px; }
.step { position: absolute; width: 150px; height: 44px; border-radius: var(--r-btn); background: linear-gradient(180deg, var(--bg-200), var(--bg-100)); border: 1px solid var(--line-strong); box-shadow: 0 10px 0 -2px var(--bg-300), 0 18px 30px -10px rgba(0,0,0,.5); display: flex; align-items: center; justify-content: space-between; padding: 0 14px; box-sizing: border-box; font: 700 22px/1 var(--font-display); color: var(--gold); transition: opacity .3s; }
.step .st { font: 700 18px/1 var(--font-display); }

/* ---------- S06 */
.qbig { font: 700 96px/1 var(--font-display); text-align: center; min-height: 96px; }
.timer { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 2px; height: 10px; }
.timer i { background: var(--bg-300); }
.timer i.on { background: var(--gold); }
.drills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.drills span { display: flex; align-items: center; gap: 8px; color: var(--ink-muted); font-size: 15px; }
.drills img { width: 20px; height: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field input { height: 52px; border-radius: var(--r-btn); border: var(--b2) solid var(--line-strong); background: var(--bg-000); padding: 0 16px; font: 500 20px/1 var(--font-display); letter-spacing: .02em; }
.parsed { display: flex; gap: 8px; flex-wrap: wrap; min-height: 32px; }
.parsed .chip.bad { border-color: var(--red); color: var(--red); }
.parsed .chip.neutral { color: var(--ink-muted); }
.lettermap { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.lettermap div { padding: 10px; border: 1px solid var(--line); border-radius: 10px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.lettermap b { font: 700 28px/1 var(--font-display); }
.seg { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-100); flex-wrap: wrap; }
.seg button { height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--ink-muted); font: 600 13px/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { border-color: var(--gold); background: var(--gold-soft); color: var(--gold); }

/* ---------- S07 */
#move-7 { overflow: hidden; }
.wall { position: absolute; inset: 0; overflow: hidden; display: flex; flex-wrap: wrap; align-content: center; gap: 4px 22px; padding: 80px 40px; font-family: var(--font-display); text-transform: uppercase; color: color-mix(in srgb, var(--ink-dim) 11%, transparent); line-height: 1.05; pointer-events: auto; }
.wall.lit { color: var(--ink); clip-path: inset(var(--t, -999px) var(--r, -999px) var(--b, -999px) var(--l, -999px)); pointer-events: none; }
.wall span { cursor: default; }
.s7c { position: relative; z-index: 2; }
.quiz { max-width: 560px; margin: 0 auto; }
.peek { position: fixed; z-index: 35; width: 180px; padding: 10px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }

/* ---------- S08 card */
.card3d { perspective: 1400px; width: min(100%, 420px); aspect-ratio: 3 / 4; margin: 0 auto; position: relative; }
.fan { position: absolute; inset: 0; border-radius: var(--r-panel); background: var(--bg-200); border: 1px solid var(--line); }
.cardi { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2,.8,.2,1); cursor: pointer; }
.cardi.flip { transform: rotateY(180deg); }
.cardi.nod-1 { transform: rotateZ(-3deg); } .cardi.nod-2 { transform: rotateZ(-1deg); } .cardi.nod-3 { transform: rotateZ(1deg); } .cardi.nod-4 { transform: rotateZ(3deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; padding: 18px; display: flex; flex-direction: column; gap: 10px; box-sizing: border-box; overflow: hidden; }
.face.back { transform: rotateY(180deg); }
.blk { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-muted); }
.wave { flex: 1; height: 22px; background: repeating-linear-gradient(90deg, var(--gold) 0 2px, transparent 2px 5px); mask: linear-gradient(90deg, #000, #000); opacity: .6; clip-path: polygon(0 40%, 5% 10%, 10% 60%, 15% 20%, 20% 70%, 25% 30%, 30% 50%, 35% 0, 40% 80%, 45% 20%, 50% 60%, 55% 30%, 60% 90%, 65% 40%, 70% 10%, 75% 70%, 80% 30%, 85% 60%, 90% 20%, 95% 50%, 100% 40%, 100% 60%, 95% 80%, 90% 90%, 85% 70%, 80% 100%, 75% 80%, 70% 90%, 65% 70%, 60% 100%, 55% 80%, 50% 90%, 45% 70%, 40% 100%, 35% 70%, 30% 80%, 25% 100%, 20% 90%, 15% 80%, 10% 100%, 5% 70%, 0 60%); }
.gradebtn { width: 100%; justify-content: space-between; }

/* ---------- S09 pedestals */
.peds { position: relative; height: 450px; overflow: hidden; }
.pedtrack { position: absolute; left: 0; bottom: 0; display: flex; align-items: flex-end; gap: 36px; padding: 0 40vw 0 8vw; transition: transform .2s; }
.ped { position: relative; width: 120px; display: flex; flex-direction: column; align-items: center; cursor: pointer; border: 0; background: none; padding: 0; color: var(--ink); transition: opacity .3s; }
.ped img { width: 92px; filter: drop-shadow(0 12px 10px rgba(0,0,0,.6)) brightness(.9); }
.ped .col { width: 100px; background: linear-gradient(90deg, var(--bg-100), var(--bg-300) 45%, var(--bg-200) 75%, var(--bg-100)); border-top: 3px solid var(--line-strong); box-shadow: 0 30px 50px -20px rgba(0,0,0,.6); }
.ped .plate { margin-top: -40px; width: 90px; padding: 4px 0; text-align: center; background: linear-gradient(135deg, #c99a3e, #a67d22 50%, #7a5a17); color: #2a1d08; font: 700 13px/1.1 var(--font-display); border-radius: 3px; position: relative; }
.peds.focus .ped { opacity: .4; } .peds.focus .ped.on { opacity: 1; }
.ped.on::before { content: ""; position: absolute; left: 50%; bottom: 0; translate: -50% 0; width: 260px; height: 640px; background: linear-gradient(180deg, rgba(242,207,122,.18), rgba(242,207,122,0)); clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%); pointer-events: none; }
.cube { width: 110px; height: 110px; background: #050505; box-shadow: inset 0 0 0 1px #222; }
.ped.machine.on .cube { box-shadow: inset 0 0 0 2px var(--red); }
.blackout { position: fixed; inset: 0; z-index: 20; background: #000; opacity: 0; pointer-events: none; transition: opacity .2s; display: grid; place-items: center; }
.blackout.on { opacity: .92; }
.blackout p { color: var(--red); font: 700 48px/1 var(--font-display); text-transform: uppercase; }
.botcard { max-width: 520px; }

/* ---------- S10 */
.ribbon { width: 100%; height: 220px; display: block; overflow: visible; }
.cards10 { display: flex; gap: 12px; flex-wrap: wrap; min-height: 170px; align-items: flex-start; }
.c10 { width: 150px; padding: 10px; display: flex; flex-direction: column; gap: 8px; animation: rise .5s steps(3); }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
#net { width: 100%; height: 280px; display: block; }

/* ---------- S11 */
.rep { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; align-items: start; width: 100%; }
.navb { display: flex; gap: 8px; align-items: center; }
.navb .btn { width: 40px; padding: 0; }
.grade { width: 88px; height: 88px; border-radius: var(--r-panel); border: 2px solid var(--gold); background: var(--gold-soft); display: grid; place-items: center; font: 700 60px/1 var(--font-display); color: var(--gold); box-shadow: 4px 4px 0 #000; flex: none; }
.grade.stamp { animation: stamp .24s steps(2); }
@keyframes stamp { from { transform: scale(1.6); opacity: 0; } to { transform: none; opacity: 1; } }
.versus { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-000); }
.versus > div { padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.versus > div:last-child { text-align: right; }
.versus b { font: 700 28px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.mlist { display: flex; flex-direction: column; max-height: 200px; overflow-y: auto; font: 500 15px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.mlist div { display: grid; grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr); padding: 7px 8px; border-left: 3px solid transparent; }
.mlist div.cur { background: var(--gold-soft); border-left-color: var(--gold); border-radius: 4px; }
.qrow { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; height: 32px; border-bottom: 1px solid var(--line); }
.qrow.zero { color: var(--ink-dim); } .qrow.zero .tag { opacity: .5; }
.qrow b { font: 700 20px/1 var(--font-display); }
#comp { width: 100%; height: 420px; display: block; }
.typed { font: 400 17px/27px var(--font-ui); min-height: 220px; white-space: pre-wrap; }
.beat { display: none; } .beat.on { display: flex; }
.pbar { display: flex; flex-direction: column; gap: 6px; }
.pbar div { display: grid; grid-template-columns: 26px minmax(0, 1fr) 30px; gap: 8px; align-items: center; font-size: 13px; }
.pbar img { width: 24px; height: 24px; }
.pbar .bar > i { background: var(--red); }
.pbar .hot img { filter: drop-shadow(0 0 6px var(--gold)); }

/* ---------- S12 */
.ap-squares { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); max-width: 720px; margin: 0 auto; position: relative; }
.ap-squares button { aspect-ratio: 1.6; border: 0; cursor: pointer; display: grid; place-items: end center; padding: 8px; color: #1b1a18; font: 600 12px/1.1 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; background: var(--board-light); }
.ap-squares button:nth-child(even) { background: var(--board-dark); color: #111; }
.ap-squares button[aria-pressed="true"] { box-shadow: inset 0 0 0 3px var(--gold); }
.ap-knight { position: absolute; top: -34px; width: 40px; height: 40px; transition: left .3s steps(2); pointer-events: none; }
.showcase { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }

/* ---------- S13 */
#egchart { width: 100%; height: 240px; display: block; cursor: pointer; }
.endings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.endings figure { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.endings figcaption { font-size: 13px; color: var(--ink-muted); }

/* ---------- S14 */
.term { background: var(--bg-000); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 18px 20px; font: 400 14px/22px var(--font-mono); color: var(--ink-muted); height: 360px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; box-shadow: var(--shadow); }
.term .g { color: var(--gold); } .term .w { color: var(--ink); }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper input { width: 80px; height: 44px; text-align: center; border-radius: var(--r-btn); border: var(--b2) solid var(--line-strong); background: var(--bg-000); font: 700 22px/1 var(--font-display); }
.stepper .btn { width: 44px; height: 44px; padding: 0; font-size: 20px; }
.engrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); align-items: center; }
.engrow .bar { grid-column: 1 / -1; }

/* ---------- S15 */
.hdr15 { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 20px; flex-wrap: wrap; }
.tiles15 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tiles15 .tile { transition: transform .6s cubic-bezier(.2,.8,.2,1), opacity .6s; }
.leag { display: flex; flex-direction: column-reverse; gap: 3px; }
.leag div { display: flex; justify-content: space-between; padding: 4px 8px; border-radius: 4px; font: 600 13px/1.2 var(--font-ui); color: var(--ink-dim); background: var(--bg-000); }
.leag div.on { background: var(--gold-soft); color: var(--gold); }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.days span { aspect-ratio: 1; display: grid; place-items: center; border-radius: 4px; background: var(--bg-300); font: 700 12px/1 var(--font-display); color: var(--ink-dim); }
.days span.on { background: var(--orange); color: var(--on-signal); }
.quest { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; font-size: 14px; }
.quest .bar { grid-column: 1 / -1; height: 6px; }
.shelf { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 3px; }
.shelf button { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-000); padding: 2px; cursor: help; display: grid; place-items: center; }
.shelf button img { width: 80%; opacity: .2; filter: grayscale(1); }
.shelf button.got img { opacity: 1; filter: none; }
.cal { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 3px; }
.cal i { aspect-ratio: 1; border-radius: 2px; background: var(--bg-300); }
.cal i.l1 { background: color-mix(in srgb, var(--gold) 35%, var(--bg-300)); } .cal i.l2 { background: color-mix(in srgb, var(--gold) 65%, var(--bg-300)); } .cal i.l3 { background: var(--gold); }
#slopes { width: 100%; height: 200px; display: block; }

/* ---------- S16 */
.hall { position: relative; }
.halltrack { display: flex; gap: 48px; padding: 0 30vw 0 4vw; will-change: transform; }
.frame { flex: none; width: 260px; display: flex; flex-direction: column; gap: 12px; border: 0; background: none; padding: 0; color: var(--ink); text-align: left; cursor: pointer; }
.frame .fr { padding: 14px; background: linear-gradient(135deg, #3a2a12, #1e150a); border: 2px solid #a67d22; box-shadow: 0 0 60px 0 rgba(226,173,63,.12), var(--shadow); }
.frame .plq { padding: 10px 12px; border-radius: 4px; background: linear-gradient(135deg, #c99a3e, #a67d22 50%, #7a5a17); color: #2a1d08; display: flex; flex-direction: column; gap: 2px; }
.frame .plq b { font: 700 15px/1.2 var(--font-display); text-transform: uppercase; }
.frame .plq span { font: 600 13px/1.3 var(--font-ui); }
.frame svg { height: 36px; width: 100%; opacity: 0; transition: opacity .2s steps(2); }
.frame:hover svg, .frame:focus-visible svg { opacity: 1; }
.classics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.replay { width: 760px; }
.replay .pb { overflow-y: auto; }

/* ---------- S17 */
#move-17 .mate { min-height: 70vh; display: grid; place-items: center; text-align: center; }
.report { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 24px; align-items: center; }
.report .grade { width: 120px; height: 120px; font-size: 72px; }
.ach { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ach img { width: 22px; height: 22px; }
.steam { text-align: center; align-items: center; }
.badge-slot { height: 48px; padding: 0 18px; border: 1px dashed var(--line-strong); border-radius: 6px; display: inline-flex; align-items: center; gap: 10px; color: var(--ink-dim); font-size: 13px; }
.req { display: grid; grid-template-columns: 140px minmax(0, 1fr) minmax(0, 1fr); }
.req > div { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.req > div:nth-child(3n+1) { color: var(--ink-dim); }
footer { border-top: 1px solid var(--line); padding-block: 32px 48px; }
footer a { color: var(--ink-muted); }
#mbar { display: none; }

/* ---------- runtime states set by app.js */
html.pre main, html.pre #hud, html.pre #eval, html.pre #phase, html.pre #evalchip, html.pre #dock, html.pre #movechip { opacity: 0; pointer-events: none; }
main, #hud { transition: opacity .6s; }
.mini { position: relative; }
.mini svg.ar { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.board.live .sq:hover::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 2px var(--gold); pointer-events: none; }
.ghost { position: fixed; z-index: 70; left: 0; top: 0; pointer-events: none; filter: drop-shadow(0 10px 8px rgba(0,0,0,.5)); }
:root[data-ap="neon"] .sq img, :root[data-ap="neon"] .mini img, :root[data-ap="neon"] .ap-knight { filter: sepia(1) hue-rotate(80deg) saturate(4) brightness(.95); }
:root[data-ap="arcade"] .sq img, :root[data-ap="arcade"] .mini img, :root[data-ap="arcade"] .ap-knight { image-rendering: pixelated; }
#xpchip.bump, .lettermap.jump b { animation: bump 240ms steps(2); }
@keyframes bump { 50% { transform: translateY(-4px) scale(1.08); } }
.tiles15 .tile.out { opacity: 0; transform: translateY(-40px) scale(.94); pointer-events: none; }
.cardi.away { transform: translate(30px, 10px) rotate(6deg) scale(.96); opacity: 0; transition: transform .3s steps(3), opacity .3s steps(3); }
.mlist { position: relative; }
.c10 .mini, .drawn .mini, .peek .mini { width: 100%; }
body.no3d #dock { background: var(--bg-100); overflow: hidden; }
#dock .mini { width: 100%; height: 100%; }
body.in12 #veil { opacity: 0 !important; }
.quiz [aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.ladder .step .st { min-width: 18px; text-align: right; }
.hud-move { font: 600 14px/1 var(--font-display); cursor: pointer; }
#prelude[hidden] { display: none; }
.pz-msg { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.gradebtn { height: 52px; }
.wall span { white-space: nowrap; }
#anChart text { font-family: var(--font-display); }
.replay .board { margin: 0 auto; }

#wpTimes { text-transform: none; letter-spacing: .02em; font: 600 15px/1.5 var(--font-display); }
.c10 { box-sizing: border-box; }
.stack > .chip { align-self: flex-start; }
.ped img { filter: drop-shadow(0 0 1px rgba(242,207,122,.55)) drop-shadow(0 12px 10px rgba(0,0,0,.6)); }
.ped.on img { filter: drop-shadow(0 0 2px #f2cf7a) drop-shadow(0 0 14px rgba(242,207,122,.45)) brightness(1.5); }
.endings .mini { width: min(100%, 150px); }
.endings figure { align-items: flex-start; }
.scene.pinned > .in { padding-block: calc(var(--hud) + 16px) 16px; }
#move-11 .mlist { max-height: 136px; }
#move-11 .pb { padding: 12px 18px; }
#move-11 .qrow { height: 27px; }
#anGrade { width: 72px; height: 72px; font-size: 48px; }
@media (max-height: 980px) { #move-11 .wrap > .row > p.body { display: none; } }

/* ---------- second pass: appearance picker, chapters, numbers, drills, cards, museum */
.appick { position: relative; }
.apdot { display: block; width: 20px; height: 20px; border-radius: 50%; box-shadow: 0 0 0 1px var(--line-strong); flex: none; }
.appop { position: absolute; right: 0; top: 50px; width: 230px; padding: 8px; display: flex; flex-direction: column; gap: 2px; z-index: 40; }
.appop button { display: flex; gap: 12px; align-items: center; border: 0; background: transparent; color: var(--ink); padding: 9px 10px; border-radius: var(--r-btn); cursor: pointer; font: 500 14px/1.2 var(--font-ui); text-align: left; }
.appop button:hover { background: var(--bg-200); }
.appop button[aria-checked="true"] { background: var(--gold-soft); color: var(--gold); }
.aprow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.aprow .label { color: var(--ink-dim); }
.apdots { display: flex; gap: 8px; }
.apdots .apdot { width: 26px; height: 26px; border: 0; padding: 0; cursor: pointer; }
.apdots .apdot[aria-pressed="true"] { outline: 2px solid var(--gold); outline-offset: 3px; }
.act { min-height: 72vh; position: relative; overflow: hidden; border-block: 1px solid var(--line); background: radial-gradient(ellipse 55% 65% at 50% 50%, color-mix(in srgb, var(--gold) 9%, transparent), transparent 70%); }
.act::before { content: ""; position: absolute; inset: 0; background-image: conic-gradient(var(--board-dark) 25%, transparent 0 50%, var(--board-dark) 0 75%, transparent 0); background-size: 96px 96px; opacity: .06; -webkit-mask: radial-gradient(ellipse at center, #000, transparent 72%); mask: radial-gradient(ellipse at center, #000, transparent 72%); pointer-events: none; }
.act .in { position: relative; gap: 20px; padding-block: 96px; }
.act-ic { width: 72px; height: 72px; display: grid; place-items: center; border: var(--b2) solid var(--gold); border-radius: var(--r-panel); background: var(--gold-soft); box-shadow: var(--shadow); }
.act-ic img { width: 36px; height: 36px; }
.act-t { font: 700 clamp(44px, 7vw, 104px)/0.95 var(--font-display); text-transform: uppercase; margin: 0; text-wrap: balance; }
.act .lead { color: var(--ink-muted); max-width: 46ch; }
.act-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 920px; }
.achip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: var(--r-chip); background: var(--bg-100); color: var(--ink); font: 600 13px/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; opacity: 0; transform: translateY(12px); transition: opacity .3s steps(2), transform .3s steps(2); transition-delay: calc(var(--k) * 90ms); }
.achip img { width: 20px; height: 20px; }
.act.shown .achip, html.rm .achip { opacity: 1; transform: none; }
.onrow { grid-template-columns: 40px minmax(0, 1fr); padding: 14px 0; }
.ont { font: 600 17px/1.3 var(--font-ui); color: var(--ink); }
.onrow .body { margin-top: 4px; }
.saveline { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0; color: var(--ink-muted); font-size: 16px; }
.saveline .chip { font: 600 14px/1 var(--font-mono); }
.nums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.numt { background: var(--bg-100); border: var(--b1) solid var(--line); border-radius: var(--r-panel); box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.numt img { width: 28px; height: 28px; }
.numt .score { font-size: clamp(30px, 3.2vw, 46px); color: var(--ink); white-space: nowrap; }
.numt .label { color: var(--ink-dim); }
.s3b { margin-top: 8vh; }
.atkq { margin: 0; font: 600 18px/1.3 var(--font-ui); text-align: center; }
.sq.found::before { content: "✓"; position: absolute; inset: 0; display: grid; place-items: start end; padding: 3% 6%; font: 700 16px/1 var(--font-display); color: var(--on-signal); box-shadow: inset 0 0 0 100px color-mix(in srgb, var(--green) 60%, transparent); pointer-events: none; z-index: 1; }
.drills span.on { color: var(--gold); font-weight: 600; }
.trail { position: absolute; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.tcard { position: absolute; width: 160px; padding: 8px; box-sizing: border-box; background: var(--bg-100); border: 1px solid var(--line-strong); border-radius: var(--r-btn); box-shadow: 0 16px 30px -12px rgba(0,0,0,.7); display: flex; flex-direction: column; gap: 4px; transform: rotate(var(--rot)); animation: tcard 2.6s cubic-bezier(.2,.8,.2,1) forwards; }
.tcard b { font: 600 13px/1.2 var(--font-display); text-transform: uppercase; }
.tcard .mini { width: 100%; }
@keyframes tcard { 0% { opacity: 0; transform: translateY(14px) rotate(var(--rot)) scale(.92); } 12% { opacity: 1; transform: rotate(var(--rot)); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-18px) rotate(var(--rot)); } }
.wall span.hot { color: var(--ink); }
.cards10 { position: relative; height: 340px; min-height: 0; display: block; }
.c10 { position: absolute; top: 0; left: calc(var(--j) * 140px); width: 230px; padding: 12px; box-sizing: border-box; background: var(--bg-100); border: var(--b1) solid var(--line-strong); border-radius: var(--r-panel); box-shadow: 0 18px 40px -16px rgba(0,0,0,.8), var(--shadow); display: flex; flex-direction: column; gap: 10px; transform: rotate(calc((var(--j) - var(--n) + 1) * 3deg)); transform-origin: bottom left; animation: none; }
.c10.rise { animation: rise .5s cubic-bezier(.2,.8,.2,1); }
.c10h { display: flex; align-items: center; gap: 8px; font: 600 13px/1 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; }
.c10f { display: flex; justify-content: space-between; gap: 8px; font: 500 12px/1.3 var(--font-ui); color: var(--ink-dim); }
.c10 .mini { width: 100%; }
#net { height: 300px; }
.endings { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.ecard { margin: 0; display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--bg-100); border: 1px solid var(--line); border-radius: var(--r-panel); box-shadow: var(--shadow); }
.endings .ecard .mini { width: 100%; }
.ecard figcaption { display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.ecard figcaption b { font: 600 18px/1.1 var(--font-display); text-transform: uppercase; color: var(--ink); }
.moment { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.moment .mk { width: 24px; height: 24px; display: grid; place-items: center; background: var(--red); color: var(--on-signal); font: 700 13px/1 var(--font-display); border-radius: 4px; }
.moment b { font: 600 18px/1.2 var(--font-display); }
.moment .micro { display: block; }
.ev { font: 600 15px/1 var(--font-display); white-space: nowrap; }
.hall { position: relative; }
.hall-pin { position: sticky; top: 0; height: 100vh; box-sizing: border-box; padding-top: var(--hud); display: flex; flex-direction: column; justify-content: center; gap: 28px; overflow: hidden; }
.halltrack { padding: 0 64px 0 var(--margin); transition: none; }
.hallbar { margin-inline: var(--margin); max-width: 600px; height: 4px; background: var(--bg-300); }
.hallbar i { display: block; height: 100%; width: 0; background: var(--gold); }
.peds { transition: background-color .2s; }
.peds.dark { background: #000; }
.peds.dark .ped:not(.machine) { opacity: .06; }
.endemblem { height: 120px; width: auto; }

/* ---------- third pass: the wheel turns as an HTML box; the AI scene */
.wheel-rot { position: absolute; inset: 0; transition: transform 2.4s cubic-bezier(.12,.8,.18,1); }
.wheel-rot svg { width: 100%; height: 100%; display: block; }
.hub { position: absolute; left: 50%; top: 50%; width: 24%; height: 24%; translate: -50% -50%; border-radius: 50%; background: var(--bg-100); border: 1px solid var(--line-strong); box-shadow: var(--shadow); }
.wheel-wrap .pointer { z-index: 2; }
.drawn { position: static; translate: none; width: min(100%, 260px); }
.fake { height: 44px; display: flex; align-items: center; padding: 0 12px; border: var(--b2) solid var(--line-strong); border-radius: var(--r-btn); background: var(--bg-000); color: var(--ink-muted); font-size: 15px; }
.fake.mono { font-family: var(--font-mono); letter-spacing: .1em; }
.aiList { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; color: var(--ink-muted); }
.aiList li::marker { color: var(--gold); }
#aiText { min-height: 180px; }

/* ---------- fourth pass */

.wheel-rot { cursor: pointer; }
.aitext { max-height: 440px; overflow-y: auto; gap: 0; font: 400 15px/24px var(--font-ui); color: var(--ink); }
.aitext h4 { margin: 18px 0 6px; font: 600 18px/1.2 var(--font-display); text-transform: uppercase; color: var(--gold); }
.aitext h4:first-child { margin-top: 0; }
.aitext p { margin: 0 0 10px; }
.aitext ul { margin: 0 0 10px; padding-left: 20px; }
.aitext li { margin-bottom: 4px; }
.aitext hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; width: 100%; }
.aitext strong { color: var(--ink); }

/* ---------- reduced motion: no pins, no blinking, no flips */
html.rm .scene.pinned > .in { position: relative; height: auto; }
html.rm .scene { min-height: 0 !important; } html.rm .scene > .in { min-height: 0 !important; }
html.rm .blink, html.rm .yourmove::before, html.rm .slot.cur { animation: none; }
html.rm * { transition-duration: 0s !important; }
html.rm .beat { display: flex; }
html.rm .hall { height: auto !important; } html.rm .hall-pin { position: static; height: auto; padding-block: 24px; } html.rm .halltrack { overflow-x: auto; padding-bottom: 16px; } html.rm .hallbar { display: none; }
html.rm .htrack { width: 100%; flex-direction: column; transform: none !important; } html.rm .htrack > div { width: 100%; }
html.rm .hpin { overflow: visible; }

/* ---------- smaller screens */
@media (max-width: 1180px) { .wordmark { display: none; } .h1 { font-size: 52px; line-height: 56px; } }
@media (max-width: 1023px) {
  .scene.pinned > .in { position: relative; height: auto; }
  .scene { min-height: 0 !important; } .scene > .in { min-height: 0 !important; }
  #dock { display: none; }
  .g12 > [class*="c"] { grid-column: 1 / -1; }
  .rep, .showcase { grid-template-columns: minmax(0, 1fr); }
  .htrack { width: 100%; flex-direction: column; transform: none !important; } .htrack > div { width: 100%; }
  .hpin { overflow: visible; }
  .beat { display: flex; }
  .hall { height: auto !important; } .hall-pin { position: static; height: auto; padding-block: 16px; } .halltrack { overflow-x: auto; padding: 0 16px 16px; transform: none !important; } .hallbar { display: none; }
  .nums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .endings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  :root { --margin: 16px; --hud: 56px; }
  #hud { grid-template-columns: auto minmax(0, 1fr) auto; padding-inline: 12px; }
  .hud-c { display: none; }
  .hud-r .hud-move { display: inline-flex; }
  #hud .btn-d, #hud .btn-p, #snd { display: none; }
  #eval { top: auto; bottom: auto; top: calc(var(--hud) + env(safe-area-inset-top, 0px)); left: 0; right: 0; width: auto; height: 4px; border: 0; }
  #eval .w { top: 0; bottom: 0; height: auto !important; width: var(--evw, 50%); }
  #eval .mid, #phase, #evalchip, #movechip { display: none; }
  .wm { font-size: clamp(44px, 15vw, 72px); } .h1 { font-size: 40px; line-height: 44px; } .lead { font-size: 17px; line-height: 26px; } .score { font-size: 32px; } .dxl { font-size: 56px; } .h2 { font-size: 22px; line-height: 26px; }
  .g2, .g3, .g4, .tiles15, .classics, .endings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles15 { grid-template-columns: minmax(0, 1fr); }
  .emblem-wrap { height: 52vh; }
  #s1 .in { min-height: 0; padding-block: calc(var(--hud) + 24px) 80px; }
  .scrollchip { display: none; }
  .scene > .in { padding-block: calc(var(--hud) + 32px) 48px; }
  .sheet { top: auto; left: 0; width: auto; height: 78vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; transform: translateY(105%); }
  #mbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); background: color-mix(in srgb, var(--bg-000) 92%, transparent); border-top: 1px solid var(--line); }
  body.cta-gone #mbar { display: block; }
  #mbar .btn { width: 100%; height: 48px; }
  .shelf { grid-template-columns: repeat(5, minmax(0, 1fr)); max-height: 260px; overflow-y: auto; }
  .req { grid-template-columns: 90px minmax(0, 1fr) minmax(0, 1fr); font-size: 14px; }
  .peds { height: 440px; }
  .lettermap { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; } .lettermap b { font-size: 20px; }
  .wall { font-size: 70% !important; opacity: .55; }
  .s7c .g2 { grid-template-columns: minmax(0, 1fr); }
  .replay { width: auto; }
  .c10 { left: calc(var(--j) * 64px); width: 210px; }
  .act { min-height: 0; } .act .in { padding-block: 64px; }
  .aprow .micro { display: none; }
  #move-11 .g2 { grid-template-columns: minmax(0, 1fr); }
  .slab-wrap { height: 320px; } .slab { width: 230px; height: 146px; }
  .slab.open .layer { transform: translateZ(calc(var(--i) * 30px)); } .slab.open .layer.key { transform: translateZ(40px) translateX(120px); }
  .layer span { font-size: 12px; }
}

/* round 6 */
.slot.miss { background: var(--red); color: var(--on-signal); border-color: var(--red); }
.cq { margin: 0; font: 600 18px/24px var(--font-ui); }
.cflip { margin: auto 0 0; }
.cardi.instant { transition: none !important; }
.cardi.flip.away { transform: rotateY(180deg) translate(-30px, 10px) rotate(-6deg) scale(.96); opacity: 0; transition: transform .3s steps(3), opacity .3s steps(3); }
.cardi.arrive { animation: cardin .3s steps(3); }
@keyframes cardin { from { transform: translate(-24px, 12px) rotate(-4deg); opacity: 0; } }
html.rm .cardi.arrive { animation: none; }
.gradebtn:disabled { opacity: .45; cursor: default; }
.wm { white-space: nowrap; }
.hero .emblem-wrap { height: auto; width: 100%; }
.hero .emblem { height: auto; width: 100%; display: grid; place-items: center; }
.hero .emblem img { width: auto; height: auto; max-width: 100%; max-height: min(64vh, 700px); }
@media (max-width: 767px) { .hero .emblem img { max-height: 46vh; } }
.aipair { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; align-items: start; }
.aipair .board { max-width: min(100%, 64vh); }
.aipair .aitext { max-height: min(64vh, 600px); }
@media (max-width: 1023px) { .aipair { grid-template-columns: minmax(0, 1fr); } .aipair .aitext { max-height: 480px; } }
.mvlink { display: inline; padding: 0 3px; margin: 0 -3px; border: 0; border-radius: var(--r-chip); background: none; font: inherit; font-weight: 700; color: var(--gold); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; cursor: pointer; text-align: left; }
.mvlink:hover, .mvlink.on { background: var(--gold-soft); }
.mvlink:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
@media (max-width: 767px) { .emblem-wrap .rim { inset: -6% 0; } }
.card3d { width: min(calc(100% - 28px), 420px); }
@media (max-width: 767px) { .card3d { width: calc(100% - 64px); } }
#gradeBtns { position: relative; z-index: 1; }
.steam a:not(.btn) { color: var(--gold); }
.langbtn { gap: 6px; padding: 0 12px; min-width: 64px; font: 600 13px/1 var(--font-ui); letter-spacing: .08em; }
.langpop { width: 190px; }
.langpop b { width: 26px; font: 700 12px/1 var(--font-ui); letter-spacing: .06em; color: var(--ink-dim); }
.langpop button[aria-checked="true"] b { color: var(--gold); }

/* ---------- responsive pass: any width, any height, mouse or touch, five languages */
main { overflow-x: clip; }
main :is(h1, h2, h3, h4, b, strong, .label, .kicker, .pt, .lead, .body, .micro) { overflow-wrap: break-word; hyphens: manual; -webkit-hyphens: manual; }
.wm, .wordmark, .num, .score { hyphens: none; -webkit-hyphens: none; overflow-wrap: normal; }
.h1 { font-size: clamp(30px, 5.4vw + 11px, 64px); line-height: 1.06; }
.act-t { font-size: clamp(26px, 6.4vw + 6px, 104px); overflow-wrap: break-word; hyphens: manual; -webkit-hyphens: manual; max-width: 100%; }
.g12 > *, .g2 > *, .g3 > *, .g4 > *, .row > *, .stack > * { min-width: 0; }
.ph { flex-wrap: wrap; row-gap: 6px; padding-block: 6px; }
.btn-lg { max-width: 100%; height: auto; min-height: 56px; padding-block: 10px; white-space: normal; text-align: center; line-height: 1.25; }
.botcard, .tile, .ecard, .panel { overflow-wrap: break-word; }
.stepper .btn { flex: none; }
.stepper input { min-width: 0; flex: 1 1 64px; max-width: 96px; }
/* hero: the visible height on phones, not the one behind the browser bars */
.hero { min-height: 100vh; min-height: 100svh; }
.scene.pinned > .in { height: 100vh; height: 100svh; }
/* a pinned scene whose content is taller than the window plays as a normal, scrolling scene (set by app.js) */
.scene.pinned.unpin { min-height: 0 !important; }
.scene.pinned.unpin > .in { position: relative; height: auto; overflow: visible; padding-block: calc(var(--hud) + 48px) 64px; }
.scene.unpin .beat { display: flex; }
.scene.unpin .htrack { width: 100%; flex-direction: column; transform: none !important; gap: 72px; }
.scene.unpin .htrack > div { width: 100%; }
.scene.unpin .hpin { overflow: visible; }
/* touch: no hover tricks, bigger targets */
@media (hover: none) {
  .btn:hover { transform: none; box-shadow: var(--shadow); }
  .btn-g:hover { box-shadow: none; }
  .hint-mouse { display: none; }
}
@media (hover: hover) { .hint-touch { display: none; } }
@media (pointer: coarse) {
  .apdots { gap: 10px; }
  .apdots .apdot { width: 32px; height: 32px; }
  .langpop button, .appop button { padding-block: 12px; }
  .navb .btn { width: 44px; height: 44px; }
}
@media (pointer: coarse) and (max-width: 1279px) { .shelf { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; } }
/* big screens: a little more room, never wider lines */
@media (min-width: 1800px) { :root { --maxw: 1480px; --margin: 64px; } }
@media (min-width: 2400px) { :root { --maxw: 1640px; } body { font-size: 17px; } }
/* small phones */
@media (max-width: 560px) {
  .req { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .req > div:first-child { display: none; }
  .req > div:nth-child(3n+1) { grid-column: 1 / -1; padding-bottom: 0; border-bottom: 0; color: var(--gold); font: 600 12px/16px var(--font-ui); letter-spacing: .08em; text-transform: uppercase; }
  #move-14 .g2 { grid-template-columns: minmax(0, 1fr); }
  .langbtn { min-width: 0; padding: 0 10px; }
  .cards10 { margin-inline: 16px; }
  .hud-r { gap: 6px; }
}
@media (max-width: 380px) {
  :root { --margin: 14px; }
  .aprow { flex-wrap: wrap; }
  .g2:not(#move-14 .g2) { grid-template-columns: minmax(0, 1fr); }
}
/* short windows: phones on their side and small laptops */
@media (max-height: 520px) and (orientation: landscape) {
  :root { --hud: 52px; }
  .hud-c { display: none; }
  .scene > .in, .scene:not(.pinned):not(.full) > .in { min-height: 0; padding-block: calc(var(--hud) + 24px) 40px; }
  .scene { min-height: 0 !important; }
  .act { min-height: 0; } .act .in { padding-block: 48px; }
  .hero .emblem img { max-height: 70svh; }
  .h1 { font-size: clamp(28px, 3.4vw + 8px, 44px); }
  .act-t { font-size: clamp(30px, 5vw, 64px); }
  .board, .aipair .board { max-width: min(100%, 78svh); margin-inline: auto; }
  .scrollchip { display: none; }
}
@media (max-width: 640px) {
  .ap-squares { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 40px; }
  .ap-squares button { aspect-ratio: 2; }
}
@media (max-height: 520px) and (orientation: landscape) and (min-width: 640px) {
  .hero .g12 > .c1-6 { grid-column: 1 / 8; }
  .hero .g12 > .c7-12 { grid-column: 8 / 13; }
  .hero .emblem img { max-height: 62svh; }
}
