/* Remember the Game! page. Loads instead of styles.css (whose .wrap / .btn would clash with the game's), so the
   site's colour tokens are repeated here, plus the game's own (score bug slab, vidiprinter). Header: /site.css. */
:root {
  --paper: #f2f4ef; --ink: #16211b; --muted: #56645b; --rule: #b9c3bb; --rule-soft: #dfe5df;
  --sel: #1d7548; --sel-fill: #cbe3d4; --on-sel: #f4fbf6; --pin: #e0a100; --on-pin: #1d1600;
  --good: #14603a; --warn: #7a5600; --miss: #2b3630; --bad: #a3321f; --card: #fbfcf9;
  --brand: #145c37; --brand-deep: #0e4428; --chalk: #f3f6ef;
  --slab: #16211b; --ticker: #0e2a1b; --tick-hi: #f2c230; --tick-ok: #3fbd78; --tick-bad: #f08a78;
  --f-display: "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", sans-serif;
  --f-body: "Barlow", "Segoe UI", system-ui, sans-serif;
  --f-ticker: "VT323", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1712; --ink: #e5ede7; --muted: #9aab9f; --rule: #3a4a40; --rule-soft: #223029;
    --sel: #3fbd78; --sel-fill: #1c3d2a; --on-sel: #06180d; --pin: #f2c230; --on-pin: #1d1600;
    --good: #7fdca6; --warn: #f2cf6b; --miss: #56645b; --bad: #f08a78; --card: #141f18;
    --brand: #13573a; --brand-deep: #0b3a23; --slab: #070d09; --ticker: #08180f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1712; --ink: #e5ede7; --muted: #9aab9f; --rule: #3a4a40; --rule-soft: #223029;
  --sel: #3fbd78; --sel-fill: #1c3d2a; --on-sel: #06180d; --pin: #f2c230; --on-pin: #1d1600;
  --good: #7fdca6; --warn: #f2cf6b; --miss: #56645b; --bad: #f08a78; --card: #141f18;
  --brand: #13573a; --brand-deep: #0b3a23; --slab: #070d09; --ticker: #08180f; color-scheme: dark;
}

/* The game's title strip under the site header: name, today's date, the game menu */
.gbar { flex: none; border-bottom: 1px solid var(--rule); background: var(--card); }
.gbar .wrap { display: flex; align-items: center; gap: 10px; min-height: 52px; }
.gbar h1 { margin: 0; font: 800 1.55rem/1 var(--f-display); text-transform: uppercase; letter-spacing: 0.01em; white-space: nowrap; }
.gbar h1 .bang { color: var(--pin); }
.gbar-date { margin-left: auto; font: 700 0.72rem/1 var(--f-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.game-menu-btn { flex: none; width: 44px; height: 44px; margin-right: -8px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer; }
.game-menu-btn:hover { background: var(--rule-soft); }
.game-menu-btn:focus-visible { outline: 3px solid var(--pin); outline-offset: 0; }
@media (max-width: 380px) { .gbar h1 { font-size: 1.3rem; } }

[hidden] { display: none !important; }
* { box-sizing: border-box; }
/* One screen, always: the page is a fixed-height column; nothing below the fold. */
html { height: 100%; box-sizing: border-box; }
body { margin: 0; height: 100%; display: flex; flex-direction: column; overflow: hidden; background: var(--paper); color: var(--ink); font: 400 16px/1.4 var(--f-body); -webkit-text-size-adjust: 100%; }
.bar { flex: none; }
.wrap {
  max-width: 552px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.app {
  flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column;
  gap: clamp(8px, 1.6dvh, 14px); padding-block: clamp(8px, 1.6dvh, 14px) calc(clamp(10px, 2dvh, 18px) + env(safe-area-inset-bottom, 0px));
  overflow-y: auto; /* last resort on very short screens only */
}


/* Menu dialog ------------------------------------------------------------ */
.mn {
  width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 8px;
  background: var(--card); color: var(--ink); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  overflow: auto;
}
.mn::backdrop { background: rgba(8, 18, 12, 0.55); }
.mn-head {
  position: sticky; top: 0; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  padding: 6px; background: var(--brand); color: var(--chalk); border-bottom: 3px solid var(--pin);
}
.mn-head h2 { margin: 0; text-align: center; font: 800 1.45rem/1 var(--f-display); text-transform: uppercase; letter-spacing: 0.02em; }
.mn-icon { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; }
.mn-icon:focus-visible, .mn-list button:focus-visible, .mn-cta:focus-visible { outline: 3px solid var(--pin); outline-offset: -3px; }
.mn-body { padding: 14px 16px 16px; display: grid; gap: 12px; font-size: 0.97rem; line-height: 1.5; }
.mn-body p { margin: 0; }
.mn-list { display: grid; }
.mn-list button {
  display: flex; justify-content: space-between; align-items: center; min-height: 56px; padding: 0 4px;
  border: 0; border-bottom: 1px solid var(--rule); background: transparent; color: var(--ink); cursor: pointer;
  font: 800 1.35rem/1 var(--f-display); text-transform: uppercase; letter-spacing: 0.02em; text-align: left;
}
.mn-list button:active { background: var(--rule-soft); }
.mn-toggle { font: 700 0.85rem/1 var(--f-body); letter-spacing: 0.08em; padding: 6px 12px; border-radius: 999px; background: var(--rule-soft); color: var(--muted); }
[data-sound][aria-pressed="true"] .mn-toggle { background: var(--sel); color: var(--on-sel); }
.mn-steps { margin: 0; padding-left: 1.3em; display: grid; gap: 8px; }
.mn-steps li::marker { font-weight: 700; color: var(--good); }
.mn-key { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 10px 0; border-block: 1px solid var(--rule); font-size: 0.9rem; }
.mn-key span { display: flex; align-items: center; gap: 8px; }
.mn-key .tile { flex: none; width: 20px; height: 20px; border-radius: 4px; }
.mn-foot { color: var(--muted); font-size: 0.88rem; }
.mn-stats { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mn-stats div { display: grid; gap: 2px; padding-top: 6px; border-top: 3px solid var(--ink); text-align: center; }
.mn-stats dt { order: 2; font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.mn-stats dd { margin: 0; font: 800 1.9rem/1 var(--f-display); font-variant-numeric: tabular-nums; }
.mn-links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 4px 0 0; font-size: 0.92rem; }
.mn-links a, .mn-body p a { color: var(--good); font-weight: 600; }
.mn-links a { display: inline-flex; align-items: center; min-height: 36px; }
.mn-days { display: grid; }
.mn-day {
  display: grid; grid-template-columns: 4.2em 1fr auto; align-items: center; gap: 8px; min-height: 52px;
  border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; font-variant-numeric: tabular-nums;
}
.mn-day:active { background: var(--rule-soft); }
.mn-day:focus-visible { outline: 3px solid var(--pin); outline-offset: -3px; }
.mn-day-no { font: 800 1.1rem/1 var(--f-display); color: var(--muted); }
.mn-day-date { font: 800 1.2rem/1 var(--f-display); text-transform: uppercase; }
.mn-day-status { display: flex; align-items: center; gap: 8px; font: 800 1.2rem/1 var(--f-display); }
.mn-tiles { display: flex; gap: 3px; }
.mn-tiles .tile { width: 12px; height: 12px; border-radius: 2px; }
.mn-tiles .tile-exact::after { width: 5px; height: 5px; border-width: 1.5px; }
.mn-muted { font: 600 0.85rem var(--f-body); color: var(--muted); }
.mn-play { font: 800 0.95rem/1 var(--f-display); letter-spacing: 0.06em; text-transform: uppercase; padding: 6px 10px; border-radius: 4px; background: var(--brand); color: var(--chalk); }
/* Practice round: unmistakably not a real day. */
.is-practice .sc { position: relative; border: 2px dashed var(--pin); }
.is-practice .sc::before {
  content: "Practice round"; position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  padding: 3px 10px; border-radius: 4px; background: var(--pin); color: var(--on-pin);
  font: 800 0.8rem/1 var(--f-body); letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap;
}
.is-practice .bug-no, .is-practice .bug-total { background: var(--pin); color: var(--on-pin); }
.is-practice .bug .tiles { display: none; }
.pop .pop-head { grid-template-columns: 1fr; padding: 14px 16px; }
.pop-actions { display: grid; gap: 8px; padding: 0 16px 16px; }
.pop-actions .mn-cta { width: 100%; margin: 0; }
.pop-secondary {
  min-height: 44px; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font: 600 0.95rem var(--f-body); text-decoration: underline; text-underline-offset: 3px;
}
.pop-secondary:focus-visible { outline: 3px solid var(--pin); outline-offset: 2px; border-radius: 4px; }
.mn-cta {
  display: block; width: calc(100% - 32px); margin: 0 16px 16px; min-height: 52px; border: 0; border-radius: 6px; cursor: pointer;
  background: var(--brand); color: var(--chalk); box-shadow: inset 0 -4px 0 var(--brand-deep);
  font: 800 1.3rem/1 var(--f-display); letter-spacing: 0.1em; text-transform: uppercase;
}
.mn-cta:active { transform: scale(0.98); }


/* Score bug: the live state. Round and this round's multiplier read at a glance. */
.bug {
  flex: none; display: flex; height: clamp(44px, 6.6dvh, 52px); border-radius: 6px; overflow: hidden;
  font: 700 1rem/1 var(--f-body); font-variant-numeric: tabular-nums; color: var(--chalk);
}
.bug-no {
  background: var(--brand); display: grid; place-items: center; padding: 0 10px; white-space: nowrap;
  font: 800 1.15rem/1 var(--f-display); letter-spacing: 0.02em;
}
.bug-mid { background: var(--slab); flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 10px; white-space: nowrap; }
.bug-round { font: 800 1.25rem/1 var(--f-display); letter-spacing: 0.02em; text-transform: uppercase; }
.bug-round b { font-weight: 800; }
.bug-mult {
  padding: 4px 6px; border-radius: 4px; background: var(--pin); color: var(--on-pin);
  font: 800 1.05rem/1 var(--f-display); letter-spacing: 0.02em;
}
.bug .tiles { margin-left: auto; gap: 3px; }
.bug .tile { width: 10px; height: 10px; border-radius: 2px; }
.bug .tile-exact::after { width: 4px; height: 4px; border-width: 1.5px; }
.bug .tile-empty { border: 0; background: #33433a; }
.bug .tile-black { background: #6b7a70; }
.bug-total {
  background: var(--pin); color: var(--on-pin); display: grid; place-content: center; justify-items: center; min-width: 62px; padding: 0 10px;
  font: 800 1.7rem/0.9 var(--f-display);
}
.bug-total small { font: 700 0.6rem/1 var(--f-body); letter-spacing: 0.12em; text-transform: uppercase; }

.lock {
  flex: none; margin-top: auto; min-height: clamp(48px, 7.5dvh, 58px); border: 0; border-radius: 6px; cursor: pointer;
  background: var(--brand); color: var(--chalk);
  font: 800 1.45rem/1 var(--f-display); letter-spacing: 0.12em; text-transform: uppercase;
  box-shadow: inset 0 -4px 0 var(--brand-deep);
  transition: transform 0.1s;
}
.lock:active { transform: scale(0.98); }
.lock:focus-visible, .btn:focus-visible { outline: 3px solid var(--pin); outline-offset: 3px; }

/* Reveal: vidiprinter, then verdict ------------------------------------- */
.reveal { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: clamp(6px, 1.2dvh, 10px); }
.reveal .btn { margin-top: auto; }
.ticker {
  flex: none; margin: 0; min-height: calc(3 * 1.15em + 20px); padding: 9px 12px; border-radius: 6px;
  background: var(--ticker); color: var(--chalk); border: 1px solid var(--rule);
  font: 400 clamp(1.1rem, 3dvh, 1.3rem)/1.15 var(--f-ticker); letter-spacing: 0.02em; text-transform: uppercase; overflow-wrap: anywhere;
}
.ticker .tk-line { display: block; min-height: 1.15em; }
.ticker .tk-hi { color: var(--tick-hi); }
.ticker .tk-ok { color: var(--tick-ok); }
.ticker .tk-warn { color: var(--tick-hi); }
.ticker .tk-bad { color: var(--tick-bad); }
.ticker .cursor { display: inline-block; width: 0.5em; height: 0.9em; margin-left: 2px; vertical-align: -0.08em; background: var(--tick-ok); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.reveal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-top: 4px; }
.reveal-head.is-waiting { visibility: hidden; }
.verdict { display: block; font: 800 clamp(1.7rem, 4.6dvh, 2.1rem)/1 var(--f-display); text-transform: uppercase; letter-spacing: 0.02em; }
.verdict.t-exact, .verdict.t-green { color: var(--good); }
.verdict.t-yellow { color: var(--warn); }
.verdict.t-black { color: var(--bad); }
.verdict-line { margin: 4px 0 0; font-weight: 600; color: var(--muted); }
.gain { display: grid; justify-items: end; gap: 2px; }
.gain-num { font: 800 2.6rem/1 var(--f-display); font-variant-numeric: tabular-nums; }
.gain-mult { font: 700 0.85rem/1 var(--f-body); color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1em; }
.btn {
  min-height: clamp(46px, 7dvh, 52px); border-radius: 6px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  font: 700 1.05rem var(--f-body); cursor: pointer;
}
.note { font-size: 0.86rem; color: var(--muted); border-left: 3px solid var(--pin); padding: 4px 0 4px 10px; margin: 0; }
.note strong { color: var(--ink); }
.note a { color: var(--good); font-weight: 600; }
.empty { display: grid; gap: 10px; padding: 18px 0; border-bottom: 1px solid var(--rule); }
.empty h1 { margin: 0; font: 800 2rem/1 var(--f-display); text-transform: uppercase; text-wrap: balance; }
.empty p { margin: 0; color: var(--muted); max-width: 40ch; }
.testing { flex: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.testing p { grid-column: 1 / -1; margin: 0; font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.testing-row { display: contents; }
.testing .btn { margin: 0; min-height: 44px; border-width: 1px; display: grid; place-items: center; text-decoration: none; font-size: 0.9rem; padding: 0 6px; text-align: center; }
.btn:active, .ft-share:active, .lock:active { transform: scale(0.98); }
.loading { color: var(--muted); padding: 24px 0; margin: 0; }
/* Phones: Lock in / Next sit at the bottom, under the thumb. Wider screens: straight after the content. */
@media (min-width: 600px) { .lock, .reveal .btn { margin-top: 4px; } }
@media (prefers-reduced-motion: reduce) { .lock { transition: none; } .ticker .cursor { animation: none; } }
