/* memtry v3 — the lab notebook, sharpened.
   Paper, ink, one vermilion signal. Space Grotesk display, Space Mono numerals.
   Fonts self-hosted. Every interactive cell is a real button. */

/* ---------- self-hosted fonts ---------- */
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/space-grotesk-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/space-grotesk-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/space-grotesk-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/space-grotesk-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/space-grotesk-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/space-grotesk-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Space Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/space-mono-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Space Mono"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/space-mono-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Space Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/space-mono-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Space Mono"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/space-mono-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------- tokens ---------- */
:root {
  --paper: #f4f1ea;
  --paper-2: #efe9dd;
  --card: #f8f5ef;
  --ink: #1c1a17;
  --ink-2: #524c43;
  --ink-3: #6b665c;           /* 5.06:1 on paper */
  --line: rgba(28, 26, 23, 0.14);
  --line-2: rgba(28, 26, 23, 0.30);
  --dot: rgba(28, 26, 23, 0.16);
  --vermilion: #df3b26;
  --vermilion-deep: #c3311a;
  --vermilion-wash: rgba(223, 59, 38, 0.10);
  --disp: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --mono: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;
  --shadow: 0 2px 0 var(--line), 0 10px 26px rgba(28, 26, 23, 0.09);
  font-size: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { scrollbar-color: rgba(28, 26, 23, 0.25) var(--paper); scrollbar-width: thin; scroll-behavior: smooth; }
body {
  font-family: var(--disp);
  background: var(--paper);
  color: var(--ink);
  overflow-x: hidden;
  min-height: 100dvh;
  touch-action: manipulation;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
::selection { background: var(--vermilion); color: var(--paper); }
::-webkit-scrollbar { width: 11px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: rgba(28, 26, 23, 0.2); border-radius: 999px; border: 3px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: rgba(28, 26, 23, 0.32); }
button { font-family: inherit; color: inherit; }
a { color: var(--ink); text-decoration-color: rgba(223, 59, 38, 0.5); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--vermilion); }
:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 2px; border-radius: 6px; }
.mono, .num { font-family: var(--mono); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- graph-paper backdrop ---------- */
#bg { position: fixed; inset: 0; z-index: -2; background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 1.15px, transparent 1.3px);
  background-size: 23px 23px; background-position: center; }
#bg::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, transparent 27px, rgba(223, 59, 38, 0.16) 27px, rgba(223, 59, 38, 0.16) 28px, transparent 28px),
    radial-gradient(120% 80% at 50% 0%, transparent 60%, rgba(28, 26, 23, 0.05) 100%); }
#bg::after { content: ""; position: absolute; inset: 0; opacity: 0.5; pointer-events: none; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E"); }

/* ---------- site chrome ---------- */
.wrap { max-width: 680px; margin: 0 auto; padding: 0 18px 0 40px; }
@media (max-width: 380px) {
  .wrap { padding: 0 14px 0 34px; }
  .today-chip .tc-label { display: none; }        /* chip collapses to its dot on tiny screens */
  .today-chip { padding: 0 13px; }
  .site-head { gap: 8px; }
}

.site-head { display: flex; align-items: center; gap: 12px; padding: 14px 0 10px; }
.site-head .home {
  display: inline-flex; align-items: center; gap: 9px; text-decoration: none;
  font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; min-height: 44px;
}
.site-head .home img { width: 30px; height: 30px; }
.site-head .spacer { flex: 1; }
.today-chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 15px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--card);
  text-decoration: none; font-weight: 600; font-size: 0.82rem; color: var(--ink);
}
.today-chip .dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--vermilion); }
.today-chip.done .dot-live { background: var(--ink); }
@media (hover: hover) { .today-chip:hover { border-color: var(--ink); } }

.crumbs { font-size: 0.74rem; color: var(--ink-3); font-family: var(--mono); padding: 8px 0 2px; margin-bottom: 8px; }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs .sep { margin: 0 6px; color: var(--line-2); }

.site-foot { margin-top: 56px; padding: 26px 0 40px; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--ink-3); }
.site-foot .cols { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-bottom: 18px; }
.site-foot a { color: var(--ink-2); }
.site-foot .fine { font-size: 0.72rem; line-height: 1.7; }
.site-foot .fine a { color: var(--ink-3); }

/* ---------- headings + the marker ---------- */
h1, h2, h3 { letter-spacing: -0.015em; line-height: 1.2; }
h1 { font-size: 1.9rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 700; margin: 34px 0 10px; }
h3 { font-size: 1.02rem; font-weight: 600; margin: 22px 0 8px; }
.underlined { position: relative; display: inline-block; }
.marker { position: absolute; left: -4px; right: -4px; bottom: -9px; height: 14px; pointer-events: none; }
.marker svg { display: block; width: 100%; height: 100%; overflow: visible; }
.marker path { stroke-dasharray: 250; stroke-dashoffset: 250; animation: draw 0.72s cubic-bezier(0.65, 0, 0.35, 1) 0.14s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- prose (editorial + game copy) ---------- */
.prose { color: var(--ink-2); font-size: 0.95rem; max-width: 58ch; }
.prose p { margin: 0 0 14px; }
.prose strong { color: var(--ink); }
.prose ol, .prose ul { margin: 0 0 14px 20px; }
.prose li { margin-bottom: 7px; }
.prose .src { font-size: 0.78rem; color: var(--ink-3); font-family: var(--mono); }
.lede { color: var(--ink-2); font-size: 1.02rem; max-width: 56ch; margin-top: 14px; }

/* ---------- play area ---------- */
/* the hidden attribute is law — no class may resurrect a hidden element */
[hidden] { display: none !important; }

/* ---------- the play sheet — a worksheet, not a box ---------- */
.play { margin: 26px 0 8px; padding: 14px 16px 24px; border: 1px solid var(--line-2);
  border-radius: var(--r-lg); background: #faf7f1 url("../paper.jpg") center / cover no-repeat; position: relative;
  box-shadow: 0 1px 0 var(--line), 0 14px 34px rgba(28, 26, 23, 0.07);
  display: flex; flex-direction: column; align-items: center; min-height: 320px;
  transition: min-height 0.25s ease; }
.play::before { /* inset hairline: the worksheet frame */
  content: ""; position: absolute; inset: 7px; border: 1px solid var(--line);
  border-radius: calc(var(--r-lg) - 6px); pointer-events: none; opacity: 0.6; }
.play[data-state="idle"] { min-height: 230px; }
/* the lab rail: what this is + what state it is in */
.play-rail { width: 100%; display: flex; align-items: baseline; gap: 10px;
  padding: 4px 6px 10px; margin-bottom: 14px; border-bottom: 1px dashed var(--line-2);
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-3); position: relative; z-index: 1; }
.play-rail .rail-name { color: var(--ink-2); font-weight: 700; }
.play-rail .rail-state { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.play-rail .rail-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.play[data-state="playing"] .rail-dot { background: var(--vermilion); }
.play[data-state="result"] .rail-dot { background: var(--ink); }
/* engine mounts here; must stretch and center */
#play-mount { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; }
#play-mount .stage { flex: 1; }
/* intro meta line under the start button */
.intro-meta { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-3); letter-spacing: 0.04em; }
.intro-meta b { color: var(--ink-2); }
/* content swap: every new stage child rises in */
.stage > * { animation: swapin 0.2s ease both; }
@keyframes swapin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* boards deal in with a whisper of stagger (delays set per cell by the engine) */
.board .tile { animation: tilein 0.16s ease both; }
@keyframes tilein { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
/* daily play area nests in the daily card; sheet chrome comes from the card itself */
#daily-play { margin: 14px 0 0; min-height: 300px; border: none; background: transparent;
  box-shadow: none; padding: 0; }
#daily-play::before { display: none; }
@media (max-width: 480px) {
  .play { padding: 12px 10px 20px; margin-left: -6px; margin-right: -6px; }
}
.play .hud { display: flex; justify-content: center; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.pill { background: var(--paper); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 12px;
  font-size: 0.74rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500; }
.pill b { color: var(--ink); font-weight: 700; letter-spacing: 0; font-family: var(--mono); }
.pill.alert { border-color: var(--vermilion); }
.pill.alert b { color: var(--vermilion); }
.stage { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
/* Containment law: nothing inside a play area may exceed its container. Game widgets
   size themselves with vw minimums, which ignore the box they live in; this caps them all. */
.stage > *, .play .board, .simon, .melody-row, .keypad, .word-card, .choice-row, .chips,
.swatch-grid, .swatch-big, .cup-track, .dot-field, .link-rows, .tbar, .stroop-grid,
.digit-view, .typed, .challenge { max-width: 100%; }
.prompt { text-align: center; color: var(--ink-2); font-size: 0.94rem; min-height: 1.4em; padding: 0 8px; font-weight: 500; }
.prompt.big { font-size: 1.12rem; color: var(--ink); font-weight: 600; }
.countdown { font-family: var(--mono); font-size: 4rem; font-weight: 700; animation: pop 0.5s ease; }
@keyframes pop { from { transform: scale(1.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* buttons */
.btn { border: 1px solid var(--vermilion-deep); border-radius: var(--r-md); cursor: pointer;
  font-weight: 700; font-size: 1rem; padding: 14px 30px; min-height: 48px; color: #fff;
  background: var(--vermilion); transition: transform 0.14s ease, background 0.14s ease; }
.btn:active { transform: scale(0.97); }
@media (hover: hover) { .btn:hover { background: var(--vermilion-deep); } }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
@media (hover: hover) { .btn.ghost:hover { background: transparent; border-color: var(--ink); } }
.btn.wide { width: min(320px, 92%); }
.btn.yes { background: var(--ink); border-color: var(--ink); color: var(--paper); }
@media (hover: hover) { .btn.yes:hover { background: #000; } }
.btn.no { background: var(--vermilion); border-color: var(--vermilion-deep); color: #fff; }
.btn:disabled { opacity: 0.4; pointer-events: none; }

/* boards: every cell is a real <button> */
.board { display: grid; gap: 10px; width: min(92vw, 420px); touch-action: manipulation; }
.tile { appearance: none; aspect-ratio: 1; border-radius: var(--r-sm);
  background: var(--card); border: 1px solid var(--line-2);
  display: grid; place-items: center; cursor: pointer; position: relative; padding: 0;
  font-family: var(--mono); font-weight: 700; font-size: 1rem; color: var(--ink);
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.12s ease, opacity 0.2s ease;
  user-select: none; -webkit-user-select: none; }
.tile:active { transform: scale(0.95); }
@media (hover: hover) { .tile:hover { border-color: var(--ink); } }
.tile.lit { background: var(--vermilion); border-color: var(--vermilion-deep); color: var(--paper);
  box-shadow: 0 0 0 3px var(--vermilion-wash); }
.tile.good { background: var(--ink); border-color: var(--ink); color: var(--paper); animation: stamp 0.22s ease; }
.tile.bad { background: transparent; border-color: var(--vermilion); border-width: 2px; animation: shake 0.3s; }
.tile.bad::after { content: ""; position: absolute; inset: 0; border-radius: inherit; opacity: 0.5;
  background: linear-gradient(135deg, transparent 45%, var(--vermilion) 46%, var(--vermilion) 54%, transparent 55%); }
.tile.ghosted { opacity: 0.24; pointer-events: none; }
@keyframes shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
@keyframes stamp { 0% { transform: scale(1.12); } 100% { transform: scale(1); } }
.glyph { font-size: 1.6rem; line-height: 1; }

/* pairs cards */
.pcard { appearance: none; background: none; border: none; padding: 0; perspective: 700px; aspect-ratio: 1; cursor: pointer; }
.pcard .inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.4s cubic-bezier(0.4, 0.2, 0.2, 1); }
.pcard.flipped .inner { transform: rotateY(180deg); }
.pcard .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: var(--r-sm); display: grid; place-items: center; border: 1px solid var(--line-2); }
.pcard .front { background: var(--card);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px); background-size: 11px 11px; }
.pcard .back { background: var(--paper); transform: rotateY(180deg); font-size: 1.7rem; }
.pcard.matched .back { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }

/* simon pads */
.simon { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: min(84vw, 340px); }
.pad { appearance: none; position: relative; aspect-ratio: 1; border-radius: var(--r-md); cursor: pointer;
  border: 1px solid var(--line-2); background: var(--card); padding: 0;
  transition: background 0.1s ease, transform 0.1s ease, border-color 0.1s ease; }
.pad::after { content: ""; position: absolute; inset: 30%; border-radius: 50%; border: 1.5px solid var(--line-2); }
.pad:active { transform: scale(0.96); }
.pad.on { background: var(--vermilion); border-color: var(--vermilion-deep); transform: scale(1.03); }
.pad.on::after { border-color: rgba(244, 241, 234, 0.7); }

/* digits + keypad */
.digit-view { font-family: var(--mono); font-size: 2.7rem; font-weight: 700; letter-spacing: 0.12em;
  min-height: 1.3em; text-align: center; max-width: 94vw; overflow-wrap: anywhere; line-height: 1.25; }
.typed { font-family: var(--mono); font-size: 1.7rem; letter-spacing: 0.18em; min-height: 1.3em;
  max-width: 94vw; overflow-wrap: anywhere; text-align: center; line-height: 1.3; font-weight: 700; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(78vw, 300px); }
.key { appearance: none; aspect-ratio: 1.35; min-height: 48px; border-radius: var(--r-sm);
  font-family: var(--mono); font-size: 1.3rem; font-weight: 700;
  background: var(--card); border: 1px solid var(--line-2); color: var(--ink); cursor: pointer; }
.key:active { transform: scale(0.95); background: var(--paper-2); }
.key.fn { font-size: 1rem; color: var(--ink-3); font-family: var(--disp); }
@media (hover: hover) { .key:hover { border-color: var(--ink); } }

/* word cards, chips, choices */
.word-card { font-size: 2rem; font-weight: 700; text-align: center;
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  padding: 40px 20px; width: min(88vw, 380px); box-shadow: 0 1px 0 var(--line); }
.choice-row { display: flex; gap: 12px; width: min(88vw, 380px); }
.choice-row .btn { flex: 1; padding: 15px 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: min(90vw, 420px); }
.chip { background: var(--card); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 9px 16px; font-weight: 600; font-size: 1.02rem; }

/* melody */
.melody-row { display: flex; gap: 8px; width: min(92vw, 420px); }
.mkey { appearance: none; flex: 1; aspect-ratio: 0.62; border-radius: 10px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line-2); padding: 0 0 10px;
  display: flex; align-items: flex-end; justify-content: center;
  font-family: var(--mono); font-weight: 700; color: var(--ink-3); font-size: 0.85rem; transition: all 0.1s ease; }
.mkey:active { transform: scale(0.96); }
.mkey.on { background: var(--vermilion); color: var(--paper); border-color: var(--vermilion-deep); }

/* hue */
.swatch-big { width: min(56vw, 220px); aspect-ratio: 1.6; border-radius: var(--r-md); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.swatch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: min(80vw, 340px); }
.swatch { appearance: none; aspect-ratio: 1.6; border-radius: var(--r-md); border: 1px solid var(--line-2); cursor: pointer; transition: transform 0.12s ease; padding: 0; }
.swatch:active { transform: scale(0.96); }
@media (hover: hover) { .swatch:hover { border-color: var(--ink); } }

/* stroop */
.stroop-word { font-size: 2.6rem; font-weight: 700; min-height: 1.3em; }
.stroop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: min(84vw, 360px); }
.stroop-btn { appearance: none; padding: 15px 0; min-height: 52px; border-radius: var(--r-md);
  border: 1px solid var(--line-2); cursor: pointer; font-weight: 700; font-size: 1rem;
  color: var(--ink); background: var(--card); }
.stroop-btn:active { transform: scale(0.96); }
@media (hover: hover) { .stroop-btn:hover { border-color: var(--ink); } }
.stroop-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; vertical-align: -1px; }

/* shells */
.cup-track { position: relative; width: min(92vw, 420px); height: 110px; }
.cup { appearance: none; position: absolute; top: 10px; width: 76px; height: 90px; cursor: pointer; z-index: 2; padding: 0;
  border-radius: 8px 8px 14px 14px; background: var(--card); border: 1px solid var(--line-2);
  transition: left 0.38s cubic-bezier(0.5, 0, 0.5, 1), transform 0.2s ease; }
.cup::after { content: ""; position: absolute; top: 8px; left: 10px; right: 10px; height: 1px; background: var(--line-2); }
.cup.lift { transform: translateY(-42px); }
.ball { position: absolute; bottom: 12px; z-index: 1; width: 26px; height: 26px; border-radius: 50%;
  background: var(--vermilion); box-shadow: 0 0 0 3px var(--vermilion-wash);
  transition: left 0.38s cubic-bezier(0.5, 0, 0.5, 1); }

/* dots + links */
.dot-field { position: relative; width: min(84vw, 340px); aspect-ratio: 1; }
.dot-field .fdot { position: absolute; border-radius: 50%; background: var(--ink); }
.link-rows { display: flex; flex-direction: column; gap: 10px; width: min(84vw, 340px); }
.link-row { display: flex; align-items: center; justify-content: center; gap: 16px;
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 12px; }
.link-row .sep { color: var(--vermilion); font-weight: 700; }

/* timer */
.tbar { width: min(88vw, 380px); height: 5px; border-radius: 999px; background: var(--line); overflow: hidden; }
.tbar .fill { height: 100%; border-radius: 999px; background: var(--vermilion); transition: width 0.1s linear; }

/* ---------- results ---------- */
.result { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.result .halo { width: 140px; height: 140px; border-radius: 50%; display: grid; place-items: center; position: relative; border: 1px solid var(--line-2); }
.result .halo::before { content: ""; position: absolute; inset: 8px; border-radius: 50%;
  border: 1.5px solid rgba(223, 59, 38, 0.4); animation: halo-pulse 2.4s ease-out infinite; }
@keyframes halo-pulse { 0% { transform: scale(0.82); opacity: 0; } 35% { opacity: 1; } 100% { transform: scale(1.16); opacity: 0; } }
.result .score-big { font-family: var(--mono); font-size: 3rem; font-weight: 700; color: var(--vermilion); }
.result .score-under { position: relative; display: inline-block; }
.result .metric { color: var(--ink-3); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; font-family: var(--mono); }
.result .verdict { color: var(--ink-2); max-width: 320px; line-height: 1.55; font-weight: 500; }
.result .newbest { color: var(--vermilion); font-weight: 700; }
.spark { display: block; margin: 4px auto 0; }
.spark polyline { fill: none; stroke: var(--ink-2); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.spark .last { fill: var(--vermilion); }
.spark-cap { font-size: 0.68rem; color: var(--ink-3); font-family: var(--mono); }

/* challenge banner */
.challenge { width: min(92vw, 420px); margin-bottom: 14px; padding: 12px 16px; border-radius: var(--r-md);
  background: var(--vermilion-wash); border: 1px solid rgba(223, 59, 38, 0.4);
  font-size: 0.9rem; color: var(--ink); text-align: center; }
.challenge b { font-family: var(--mono); color: var(--vermilion); }

/* share modal */
.share-veil { position: fixed; inset: 0; z-index: 40; background: rgba(28, 26, 23, 0.45);
  display: grid; place-items: center; padding: 18px; }
.share-box { background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  padding: 18px; max-width: 400px; width: 100%; box-shadow: var(--shadow); text-align: center; }
.share-box canvas, .share-box img { width: 100%; height: auto; border-radius: var(--r-sm); border: 1px solid var(--line); }
.share-box .row { display: flex; gap: 10px; margin-top: 14px; }
.share-box .row .btn { flex: 1; padding: 12px 8px; font-size: 0.9rem; }

/* ---------- hub ---------- */
.hub-hero { text-align: center; padding: 34px 0 6px; }
.hub-hero .brand { position: relative; display: inline-block; font-weight: 700; font-size: 2.35rem; letter-spacing: -0.02em; line-height: 1.15; }
.hub-hero .brand .marker { bottom: -12px; height: 16px; } /* clear of the y descender — under, never through */
.hub-hero .tagline { color: var(--ink-2); font-size: 0.95rem; margin-top: 26px; font-weight: 500; }
.statline { display: flex; justify-content: center; margin: 22px 0 4px; }
.statline .cell { text-align: center; padding: 0 22px; }
.statline .cell + .cell { border-left: 1px solid var(--line); }
.statline .n { font-family: var(--mono); font-weight: 700; font-size: 1.3rem; }
.statline .l { font-size: 0.64rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.14em; margin-top: 3px; font-family: var(--mono); }

.daily-card { margin-top: 20px; padding: 16px; border-radius: var(--r-lg); background: var(--card);
  border: 1px solid var(--line-2); box-shadow: 0 1px 0 var(--line); position: relative; overflow: hidden; }
.daily-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--vermilion); }
.daily-card .dc-top { display: flex; align-items: center; gap: 12px; }
.daily-card .dc-info { flex: 1; padding-left: 6px; }
.daily-card .dc-title { font-weight: 700; font-size: 1rem; }
.daily-card .dc-sub { font-size: 0.74rem; color: var(--ink-3); margin-top: 3px; font-family: var(--mono); }
.daily-card .dc-date { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-3); }
.daily-card .btn { margin-top: 14px; width: 100%; }
/* today's three tests as score slots — a lab log line each */
.dc-tests { margin-top: 12px; border-top: 1px dashed var(--line-2); }
.dc-test { display: flex; align-items: center; gap: 10px; padding: 9px 2px;
  border-bottom: 1px dashed var(--line); font-size: 0.88rem; }
.dc-test .ti { font-family: var(--mono); font-size: 0.66rem; color: var(--ink-3); width: 20px; }
.dc-test .tn { flex: 1; font-weight: 600; }
.dc-test .ts { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-3); }
.dc-test.done .ts { color: var(--vermilion); font-weight: 700; }
.dc-test.done .ti { color: var(--vermilion); }

.fac-block { margin-top: 34px; }
.fac-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 10px; }
.fac-head h2 { margin: 0; font-size: 1.05rem; }
.fac-head .fc { font-family: var(--mono); font-size: 0.68rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.1em; }
.game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 700px) { .game-grid { grid-template-columns: repeat(3, 1fr); } }
.game-card { position: relative; display: block; background: var(--card); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); padding: 30px 15px 15px; text-decoration: none; color: var(--ink);
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.16s ease, box-shadow 0.16s ease;
  box-shadow: 0 1px 0 var(--line); }
.game-card:active { transform: scale(0.98); }
@media (hover: hover) { .game-card:hover { border-color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow); } }
.game-card .gidx { position: absolute; top: 12px; left: 14px; font-family: var(--mono); font-size: 0.7rem; font-weight: 700; color: var(--ink-3); }
.game-card .best { position: absolute; top: 11px; right: 12px; font-family: var(--mono); font-size: 0.68rem; font-weight: 700;
  color: var(--ink-2); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-2); }
.game-card .best.hot { color: var(--vermilion); border-color: rgba(223, 59, 38, 0.4); background: var(--vermilion-wash); }
.game-card .icon { width: 40px; height: 40px; margin-bottom: 10px; display: block; }
.game-card .name { display: block; font-weight: 600; font-size: 0.98rem; }
.game-card .cat { display: block; font-family: var(--mono); font-size: 0.62rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 4px; }

/* progress sparklines on hub */
.prog-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.prog-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-md); text-decoration: none; color: var(--ink); }
.prog-row .pname { flex: 1; font-size: 0.88rem; font-weight: 600; }
.prog-row .pbest { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-2); }

/* related games */
.related { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.related a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--card);
  text-decoration: none; font-weight: 600; font-size: 0.85rem; }
@media (hover: hover) { .related a:hover { border-color: var(--ink); } }

/* your record block on game pages */
.record { margin-top: 8px; padding: 14px 16px; border: 1px dashed var(--line-2); border-radius: var(--r-md);
  font-family: var(--mono); font-size: 0.82rem; color: var(--ink-2); display: none; }
.record.on { display: block; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .marker path { stroke-dashoffset: 0; }
  html { scroll-behavior: auto; }
}
