/* Tapit Daily. Same Bold Utility system as site.css (ink outlines, hard offset shadows, cobalt),
   with three speed colours for the Keyprint. Light only, like the rest of the site. */

:root {
  --fast: #1E9E5A; --fast-tint: #E4F5EC; --fast-text: #145F38;
  --steady: #E7A400; --steady-tint: #FFF4D6; --steady-text: #7A5600;
  --slow: #D7372B; --slow-tint: #FCE5E3; --slow-text: #8E1F17;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Browser surfaces that would otherwise keep their defaults. */
html { scrollbar-color: var(--ink) var(--panel); }
::selection { background: var(--accent); color: var(--on-accent); }
input { caret-color: var(--accent); }
input::placeholder { color: var(--muted); opacity: 1; }
.rounds-table, .headline, .logbook, .placement-rank { font-variant-numeric: tabular-nums; }

.wordmark { min-height: 44px; }
/* Badges, theme and sound live in the nav on every screen; theme and badges step aside during a run. */
.topbar-tools { position: relative; display: flex; align-items: center; gap: 10px; margin-left: auto; }
.topbar-tools .sound-icon { position: static; }
.daily-page:has(.round:not([hidden]), .between:not([hidden])) :is(#badge-toggle, .settings-theme) { display: none; }

/* Settings (bottom left) and How to play (bottom right) float in the corners above the footer. Their
   panels open upwards from the button; on a phone they're sheets like the rest. */
.corner { position: fixed; z-index: 15; bottom: calc(var(--footer-h, 40px) + 14px); }
.corner.is-left { left: var(--gutter); }
.corner.is-right { right: var(--gutter); }
.corner .sound-icon { position: static; box-shadow: 3px 3px 0 var(--ink); }
.corner:has(.badge-panel:not([hidden])) { z-index: 30; }
body.pack-long-page .corner { bottom: 14px; }
/* A phone's keyboard covers the bottom of the screen during a round, so the corners step aside. On a
   narrow screen the other screens run edge to edge under them, so there they show on the start only. */
body[data-device="touch"]:has(.round:not([hidden])) .corner { display: none; }
@media (max-width: 600px) {
  .daily-page:not(:has(.start:not([hidden]), .missing:not([hidden]))) .corner { display: none; }
}
@media (min-width: 601px) {
  .corner .badge-panel { top: auto; bottom: calc(100% + 12px); max-height: calc(100svh - 190px); }
  .corner.is-left .badge-panel { right: auto; left: 0; }
}
.game { position: relative; padding-top: 40px; padding-bottom: 72px; min-height: calc(100svh - 65px - 40px); }
.game-screen { max-width: 760px; margin-inline: auto; }

/* Backdrops. Behind the start screen, the Keywall (js/game/keywall.js) draws on its own layer; behind
   the rounds, a near-plain paper from Codex (design/backgrounds/codex/). Both fade as screens change. */
.daily-page { --start-paper: #FAF8F3; --bg-play: url("../img/bg/play-paper.webp"); }
.daily-page::after {
  /* Starts under the top bar; the rounds can scroll past one screen, so it runs to the bottom under the footer. */
  content: ""; position: fixed; inset: 66px 0 0; z-index: -1; pointer-events: none;
  background: var(--bg-play) center / cover no-repeat; opacity: 0; transition: opacity 600ms var(--ease-out);
}
.daily-page:has(.round:not([hidden]), .between:not([hidden]))::after { opacity: 1; }
/* Tall screens get the portrait paper, so the detail stays at the edges instead of cropping off. */
@media (max-aspect-ratio: 4/5) {
  .daily-page { --bg-play: url("../img/bg/play-paper-tall.webp"); }
  .daily-page::after { top: 60px; }
}
/* The footer sits on paper so a keycap in the backdrop never runs under its text. */
.daily-page .footer { background: var(--paper); }
.daily-page:has(.start:not([hidden])) .footer { background: var(--start-paper); }
[hidden] { display: none !important; }
/* site.css rules sections apart with a line; screens here replace each other instead. */
.game > .game-screen { border-top: 0; }
.button.big { min-height: 54px; padding: 14px 28px; font-size: 18px; }
.button.big.pro { box-shadow: 4px 4px 0 var(--ink); }
.button.big.pro:hover { box-shadow: 3px 3px 0 var(--ink); }
.button:disabled { opacity: 0.5; cursor: default; }

/* ---------- Tappy ---------- */
/* Two stacked copies of the mascot: a pose change swaps the hidden one and crossfades, so poses
   ease over --pose-ms instead of snapping. */
.tappy { position: relative; display: inline-block; flex-shrink: 0; width: 52px; aspect-ratio: 1; pointer-events: none; }
.tappy.big { width: 88px; }
.tappy svg {
  position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible;
  opacity: 0; transform: translateY(5px) scale(0.94); transform-origin: 50% 90%;
  transition: opacity var(--pose-ms, 400ms) var(--ease-out), transform var(--pose-ms, 400ms) var(--ease-out);
}
.tappy svg.is-shown { opacity: 1; transform: none; }

.tappy-line { display: flex; align-items: center; gap: 20px; }
.bubble {
  position: relative; padding: 12px 16px; max-width: 34ch; border: var(--rule) solid var(--ink); border-radius: 12px;
  background: var(--paper); box-shadow: 3px 3px 0 var(--ink);
  font-weight: 700; font-size: 17px; line-height: 1.3; text-wrap: pretty;
}
.bubble::before {
  content: ""; position: absolute; left: -8px; top: 50%; width: 14px; height: 14px; background: var(--paper);
  border-left: var(--rule) solid var(--ink); border-bottom: var(--rule) solid var(--ink); transform: translateY(-50%) rotate(45deg);
}
.bubble:empty { display: none; }

/* ---------- Start ---------- */
/* One screen, no scroll: TAPIT IL as keycaps, the day's name, the story's title and cast, a spacebar to begin, one line of fine print. */
.game:has(.start:not([hidden])) { padding-bottom: 24px; min-height: 0; }
.game-screen.start:not([hidden]) {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  /* The top bar, the slim footer and the game's padding: the start screen fills the rest exactly. */
  min-height: calc(100svh - 170px);
}
.daily-title { margin-top: 0; font-size: clamp(34px, 6vw, 60px); line-height: 1.02; text-wrap: balance; }
.game-rules { margin-top: 14px; font-size: 19px; color: var(--body); max-width: 56ch; }
.wordmark-row { position: relative; display: flex; align-items: flex-end; gap: 20px; margin-top: 64px; }
.wordmark-keys { display: flex; gap: 12px; margin: 0; --cap: clamp(52px, 8vw, 112px); }
.wordmark-cap {
  display: grid; place-items: center; width: var(--cap); height: calc(var(--cap) * 1.12);
  border: var(--rule) solid var(--ink); border-radius: calc(var(--cap) * 0.14); background: var(--paper);
  box-shadow: 6px 6px 0 var(--ink);
  font-weight: 800; font-stretch: 125%; font-size: calc(var(--cap) * 0.55); line-height: 1; color: var(--ink);
  /* T-A-P-I-T typed out one key at a time: each key goes down, lights cobalt, hops back up,
     then the word rests for about three seconds before it's typed again. */
  animation: cap-press 4.4s linear calc(var(--i, 0) * 180ms + 400ms) infinite both;
}
.wordmark-cap:nth-child(2) { --i: 1; }
.wordmark-cap:nth-child(3) { --i: 2; }
.wordmark-cap:nth-child(4) { --i: 3; }
.wordmark-cap:nth-child(5) { --i: 4; }
/* One 4.4s cycle; 1% is 44ms. The press, hop and settle take the first ~700ms. */
@keyframes cap-press {
  0% { transform: none; box-shadow: 6px 6px 0 var(--ink); background: var(--paper); color: var(--ink); animation-timing-function: cubic-bezier(0.4, 0, 1, 1); }
  3%, 6.5% { transform: translate(6px, 6px); box-shadow: 0 0 0 var(--ink); background: var(--accent); color: var(--on-accent); }
  6.5% { animation-timing-function: var(--ease-out); }
  10% { transform: translate(-1px, -9px); box-shadow: 7px 15px 0 var(--ink); background: var(--accent); color: var(--on-accent); animation-timing-function: ease-in-out; }
  13% { transform: translate(0, 1px); box-shadow: 6px 5px 0 var(--ink); }
  16%, 100% { transform: none; box-shadow: 6px 6px 0 var(--ink); background: var(--paper); color: var(--ink); }
}
/* Tappy stands on the right, lifted clear of the keys; IL sits under him, its foot level with the keys' (the two lifts cancel). */
.start-tappy {
  --lift: 34px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; flex-shrink: 0;
  align-self: stretch; transform: translateY(calc(-1 * var(--lift)));
}
.start-tappy .tappy.big { width: 100px; }
.bubble.above { position: absolute; right: 0; bottom: calc(100% + 4px); width: max-content; max-width: 320px; font-size: 16px; text-align: left; }
.bubble.above::before { left: auto; right: 28px; top: auto; bottom: -8px; transform: rotate(-45deg); border-left: 0; border-bottom: var(--rule) solid var(--ink); border-right: var(--rule) solid var(--ink); }
.start-tappy .bubble.above::before { right: 42px; }
.wordmark-sub { margin: 0; transform: translateY(var(--lift)); font-weight: 800; font-stretch: 125%; font-size: 30px; line-height: 0.8; letter-spacing: 0.2em; padding-left: 0.2em; color: var(--ink); }
/* "DAILY #3 ▪ At the market ▪ 3-day streak": the day leads, right under the wordmark. */
.start-day {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; margin-top: 24px;
  font-weight: 700; font-size: 17px; color: var(--ink);
}
.start-day-number { font-weight: 800; font-stretch: 125%; font-size: 15px; letter-spacing: 0.14em; text-transform: uppercase; }
.start-day > span + span::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 14px; vertical-align: 0.2em; border-radius: 2px; background: var(--accent);
}
.start-day > .start-day-streak::before { display: none; }
.start-day-streak { padding: 2px 10px 3px; border: var(--rule) solid var(--ink); border-radius: 999px; background: var(--accent-tint); font-size: 14px; }

/* The button is a spacebar. After the wordmark types T-A-P-I-T, it taps space too. */
.start-cta { margin-top: 26px; padding: 0; border: 0; background: none; font: inherit; color: var(--ink); cursor: pointer; }
.start-cta:focus-visible { outline: none; }
.cta-space {
  position: relative; display: grid; place-items: center; width: min(380px, calc(100vw - 2 * var(--gutter) - 8px)); height: 66px;
  border: var(--rule) solid var(--ink); border-radius: 14px; background: var(--paper); color: var(--ink); box-shadow: 6px 6px 0 var(--ink);
  font-weight: 800; font-size: 19px;
  transition: transform 90ms ease, box-shadow 90ms ease, background 90ms ease, color 90ms ease;
  animation: space-tap 4.4s linear 1.5s infinite both;
}
.cta-space-legend {
  position: absolute; left: 14px; bottom: 7px; font-weight: 800; font-stretch: 125%; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}
/* No space bar on a phone, so no legend. */
@media (hover: none) and (pointer: coarse) { .cta-space-legend { display: none; } }
.start-cta:hover .cta-space { background: var(--accent-tint); animation: none; }
.start-cta:active .cta-space { transform: translate(6px, 6px); box-shadow: 0 0 0 var(--ink); background: var(--accent); color: var(--on-accent); animation: none; }
.start-cta:active .cta-space-legend { color: var(--on-accent); }
.start-cta:focus-visible .cta-space { outline: 2.5px solid var(--accent); outline-offset: 5px; }
@keyframes space-tap {
  0%, 9%, 100% { transform: none; box-shadow: 6px 6px 0 var(--ink); }
  3%, 5% { transform: translate(4px, 4px); box-shadow: 2px 2px 0 var(--ink); }
}
.start-counts { margin-top: 16px; max-width: 92ch; font-weight: 500; font-size: 14px; color: var(--muted); text-wrap: balance; }
.start-counts:empty { display: none; }

/* The Keywall: fixed between the top bar and the footer, showing with the start screen. */
.start-wall {
  position: fixed; inset: 66px 0 40px; z-index: -1; overflow: hidden; pointer-events: none;
  background-color: var(--start-paper); opacity: 0; transition: opacity 600ms var(--ease-out);
}
.daily-page:has(.start:not([hidden])) .start-wall { opacity: 1; }
.start-wall canvas { display: block; }
/* Once the Daily is in, its result stands where the pitch was, so the screen reads as "done". */
.start-result {
  display: grid; justify-items: center; gap: 6px; min-width: 300px; margin-top: 14px; padding: 14px 28px 12px;
  border: var(--rule) solid var(--ink); border-radius: 14px; background: var(--paper); box-shadow: 5px 5px 0 var(--accent);
}
.start-result-score { font-weight: 800; font-stretch: 125%; font-size: clamp(36px, 5vw, 48px); line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.start-result-line { font-weight: 700; font-size: 16px; color: var(--body); }
.start-result-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 12px; margin-top: 12px; }
.start-result-open {
  min-height: 40px; padding: 8px 14px; border: var(--rule) solid var(--ink); border-radius: 9px; background: var(--paper); color: var(--ink);
  font: inherit; font-weight: 800; font-size: 14px; box-shadow: 3px 3px 0 var(--ink); cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease, background 80ms ease;
}
.start-result-open:hover { background: var(--accent-tint); }
.start-result-open:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
@media (prefers-reduced-motion: reduce) { .start-result-open { transition: none; } }
.start-result-next {
  width: 100%; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--hairline);
  font-weight: 600; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.start-result-next span { color: var(--ink); font-weight: 800; }
/* With the result card in, the spacebar sits a little closer, so the done screen still fits a laptop. */
.start-result:not([hidden]) ~ .start-cta { margin-top: 20px; }
/* Daily or practice: on the start result, in the round header, and the colour of a finished round. */
.run-chip { padding: 4px 9px; border: var(--rule) solid var(--ink); background: var(--paper); color: var(--ink); text-transform: uppercase; line-height: 1.2; }
.run-chip.is-daily { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.run-chip:empty { display: none; }
body[data-run="practice"] .round-progress li.is-done { background: var(--ink); }
body[data-run="practice"] .round-progress li.is-current { border-color: var(--ink); color: var(--ink); }
body[data-run="practice"] .round-stage:focus-within { outline-color: var(--ink); }
body[data-run="practice"] .kb.mini .kb-key.is-lit { background: var(--ink); }
.sound-icon {
  position: absolute; top: 4px; right: var(--gutter); display: grid; place-items: center; width: 44px; height: 44px;
  border: var(--rule) solid var(--ink); border-radius: 10px; background: var(--paper); cursor: pointer;
}
.sound-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sound-icon .icon-on { display: none; }
.sound-icon[data-on="true"] { background: var(--accent); }
.sound-icon[data-on="true"] svg { stroke: var(--on-accent); }
.sound-icon[data-on="true"] .icon-on { display: block; }
.sound-icon[data-on="true"] .icon-off { display: none; }
.sound-icon[hidden] { display: none; }
.sound-icon:hover { background: var(--accent-tint); }
.sound-icon[data-on="true"]:hover { background: var(--accent); }

/* ---------- Theme packs ---------- */
.pack-list { display: grid; gap: 4px; margin: 8px 0 4px; }
.pack-option {
  display: grid; grid-template-columns: 96px 1fr 22px; align-items: center; gap: 12px; min-height: 64px; padding: 6px; border: 0; border-radius: 10px;
  background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.pack-option:hover { background: var(--accent-tint); }
.pack-option img { display: block; width: 96px; height: 64px; object-fit: cover; border: var(--rule) solid var(--ink); border-radius: 8px; }
.pack-option strong { display: block; font-weight: 800; font-size: 17px; }
.pack-blurb { display: block; margin-top: 2px; font-size: 14px; line-height: 1.3; color: var(--body); }
.pack-option svg { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.pack-option[aria-checked="true"] { background: var(--accent-tint); box-shadow: inset 0 0 0 2px var(--accent); }
.pack-option[aria-checked="true"] svg { opacity: 1; }
.pack-option:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* Ink paints its own paper full-screen behind the rounds, so the Codex paper backdrop steps aside. */
.ink-stage { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.ink-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ink-quiet { transition: opacity 500ms var(--ease-out); }
body.pack-ink::after { opacity: 0 !important; }
/* Between rounds the bloom fills the page, so Tappy and the coach sit on a paper card above it. */
body.pack-ink .game-screen.between:not([hidden]) {
  width: fit-content; max-width: 100%; margin-top: 24px; padding: 28px 32px;
  border: var(--rule) solid var(--ink); border-radius: 16px; background: rgb(255 255 255 / 0.92); box-shadow: 6px 6px 0 var(--ink);
}

/* The Long Page: a full typewriter skin. The sheet and typewriter are a fixed stage behind
   the game; the round's own header and race stay on top of it, and the sentence card steps aside. */
.lp-stage {
  --lp-mono: "Courier New", ui-monospace, "SF Mono", monospace; --lp-cream: #FAF4E2; --lp-pencil: #6F6C5C; --lp-ribbon: #D6322B;
  --lp-fs: 18px; --lp-lh: 34px; --lp-cw: 10.8px; --lp-start: 100px; --lp-text-w: 540px; --lp-key: 26px; --lp-key-gap: 5px; --lp-knob: 40px; --lp-tappy: 76px;
  position: fixed; left: 0; top: 0; width: 100%; z-index: -1; overflow: hidden; pointer-events: none;
}
html:has(body.pack-long-page) { overflow: hidden; overscroll-behavior: none; }
body.pack-long-page::after { opacity: 0 !important; }
body.pack-long-page .footer { display: none; }
body.pack-long-page .game { padding: 0; min-height: 0; }
.lp-stage canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.lp-env { z-index: 0; }
.lp-fx { z-index: 3; }
.lp-clip {
  position: absolute; inset: 0; z-index: 1;
  mask-image: linear-gradient(to bottom, transparent var(--lp-clear, 0px), #000 calc(var(--lp-clear, 0px) + 36px));
}
.lp-world {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform;
  background-color: var(--lp-cream); box-shadow: 0 0 0 1.5px var(--ink), 6px 6px 0 var(--ink); transition: opacity 400ms var(--ease-out);
}
.lp-row { position: absolute; right: var(--lp-start); height: var(--lp-lh); font: var(--lp-fs)/var(--lp-lh) var(--lp-mono); white-space: pre; }
.lp-row.pending { visibility: hidden; }
.lp-row.head { right: auto; left: var(--lp-start); direction: ltr; }
.lp-c { display: inline-block; width: var(--lp-cw); text-align: center; color: var(--lp-pencil); }
.lp-row.head { font-weight: 700; }
.lp-row.head .lp-c { color: var(--ink); opacity: var(--o, 1); transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--r, 0deg)); }
.lp-c.in {
  color: var(--ink); font-weight: 700; text-shadow: 0 0 0.5px rgb(14 14 16 / 0.6);
  opacity: var(--o); transform: translate(var(--dx), var(--dy)) rotate(var(--r)); transition: color 120ms ease-out, opacity 120ms ease-out;
}
/* The Ticker's chaser: a ribbon-red underline through the letters it has passed, a bar at its
   leading edge, and the letter it caught struck through. */
.lp-c.chased { box-shadow: inset 0 -2px 0 var(--lp-ribbon); }
.lp-c.caught { color: var(--lp-ribbon); font-weight: 700; text-decoration: line-through; text-decoration-thickness: 2px; }
.lp-chaser { position: absolute; left: 0; top: 0; z-index: 2; width: 3px; height: calc(var(--lp-lh) * 0.82); border-radius: 2px; background: var(--lp-ribbon); will-change: transform; }
.lp-chaser[hidden] { display: none; }
.lp-c.wrong { color: var(--lp-ribbon); font-weight: 700; text-shadow: 0.6px 0.4px 0 var(--lp-ribbon); opacity: var(--o); transform: translate(var(--dx), var(--dy)) rotate(var(--r)); }
.lp-cursor {
  position: absolute; width: 2.5px; border-radius: 1px; background: var(--accent); z-index: 2;
  transition: transform 70ms ease-out; animation: lp-pulse 1.1s ease-in-out infinite;
}
.lp-cursor.carriage { transition-duration: 380ms; transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1); }
.lp-cursor::after { content: ""; position: absolute; left: -2px; right: -2px; bottom: -4px; height: 3px; border-radius: 2px; background: var(--lp-ribbon); opacity: 0; }
.lp-cursor.miss::after { animation: lp-miss 400ms ease-out; }
@keyframes lp-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes lp-miss { 0% { opacity: 1; transform: scaleX(2.6); } 100% { opacity: 0; transform: scaleX(1); } }
/* Each finished round's WPM, typed in the right margin beside its last row. */
.lp-wpm { position: absolute; height: var(--lp-lh); font: 700 12px/var(--lp-lh) var(--lp-mono); color: var(--ink); white-space: pre; }
/* The red marker: a ribbon-red tab on the paper's left edge, level with the line being typed. */
.lp-marker { position: absolute; left: 0; top: 0; z-index: 2; width: 0; height: 0; will-change: transform; transition: transform 260ms var(--ease-out); }
.lp-marker::before {
  content: ""; position: absolute; left: 7px; top: -8px; width: 16px; height: 16px; background: var(--lp-ribbon);
  clip-path: polygon(0 0, 62% 0, 100% 50%, 62% 100%, 0 100%); border-radius: 2px;
}
/* The typewriter, fixed at the bottom of the visible screen: the platen roller where the paper feeds in,
   a dark enamel body with a hint of ribbon, and rows of round ringed keys. */
.lp-machine { position: absolute; left: 0; right: 0; bottom: 0; height: var(--lp-machine-h, 200px); z-index: 4; }
.lp-platen {
  position: absolute; top: 0; left: 50%; width: var(--lp-bail-w, 900px); height: var(--lp-platen-h, 24px); transform: translateX(-50%);
  background: linear-gradient(to bottom, #4a4c55 0, #1b1c21 28%, var(--ink) 60%, #26272d 100%); border: 1.5px solid var(--ink); border-bottom: 0; border-radius: 12px 12px 0 0;
}
.lp-bail {
  position: absolute; top: -12px; left: 50%; width: var(--lp-bail-w, 900px); height: 10px; transform: translateX(-50%);
  background: var(--paper); border: 1.5px solid var(--ink); border-radius: 6px; box-shadow: 0 3px 0 var(--ink); z-index: 2;
}
.lp-knob {
  position: absolute; top: 50%; width: var(--lp-knob); height: var(--lp-knob); margin-top: calc(var(--lp-knob) / -2); border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, rgb(255 255 255 / 0.45) 0 14%, transparent 15%), repeating-conic-gradient(rgb(0 0 0 / 0.14) 0 8deg, transparent 8deg 24deg), var(--accent);
  border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
}
.lp-knob.left { left: calc(var(--lp-knob) / -1 - 8px); }
.lp-knob.right { right: calc(var(--lp-knob) / -1 - 8px); }
.lp-body {
  position: absolute; left: 0; right: 0; top: var(--lp-platen-h, 24px); bottom: 0; display: flex; align-items: flex-end; justify-content: center;
  background: linear-gradient(to bottom, #2c2d35 0, #1a1b20 40%, #0f1013 100%); border-top: 2px solid var(--ink);
  box-shadow: inset 0 2px 0 rgb(255 255 255 / 0.13), inset 0 -5px 0 var(--accent);
}
.lp-body::before { /* the ribbon: red over black, running behind the type bars */
  content: ""; position: absolute; left: 12%; right: 12%; top: 7px; height: 7px; border-radius: 4px; border: 1px solid #000;
  background: linear-gradient(to bottom, var(--lp-ribbon) 0 50%, #050506 50%);
}
.lp-keys { display: flex; flex-direction: column; align-items: center; gap: calc(var(--lp-key-gap) + 4px); padding-bottom: 12px; }
.lp-krow { display: flex; gap: calc(var(--lp-key-gap) + 8px); }
.lp-key {
  width: var(--lp-key); height: var(--lp-key); display: grid; place-items: center; border-radius: 50%; color: var(--ink);
  background: radial-gradient(circle at 36% 28%, #fff 0, var(--paper) 50%, #d9d3c0 100%);
  box-shadow: 0 0 0 2.5px #c9ccd3, 0 0 0 4px #000, 0 3px 0 4px #000; font: 700 11px/1 var(--lp-mono); text-transform: uppercase;
  transition: transform 90ms ease-out, box-shadow 90ms ease-out;
}
.lp-key.space { width: calc(var(--lp-key) * 5); height: calc(var(--lp-key) * 0.5); border-radius: 999px; }
.lp-key.down { transform: translateY(3px); box-shadow: 0 0 0 2.5px #c9ccd3, 0 0 0 4px #000, 0 0 0 4px #000; background: #d9d3c0; }
/* Tappy sits on the bail and bobs; the round screen's racers stay, the big Tappy is this one. */
.lp-tappy { position: absolute; z-index: 5; width: var(--lp-tappy); height: var(--lp-tappy); }
.lp-tappy .tappy { width: 100%; animation: lp-bob 2.8s ease-in-out infinite; }
@keyframes lp-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* The round's own header stays above the sheet, readable on its pieces of paper. */
body.pack-long-page .game-screen:not([hidden]) { position: fixed; left: 0; right: 0; top: calc(var(--lp-top, 0px) + 78px); z-index: 2; padding-inline: var(--gutter); }
body.pack-long-page .game-screen.round:not([hidden]) { display: block; min-height: 0; pointer-events: none; }
body.pack-long-page .game-screen.round .race-lane .racer, body.pack-long-page .round-input { pointer-events: auto; }
body.pack-long-page .game-screen.round > .label, body.pack-long-page .round-skill, body.pack-long-page .round-hint {
  width: fit-content; max-width: 100%; padding: 2px 8px; border-radius: 6px; background: var(--paper);
}
body.pack-long-page .game-screen.round > .label { margin-top: 10px; }
body.pack-long-page .round-stage { margin-top: 10px; padding: 0; min-height: 0; border: 0; border-radius: 0; box-shadow: none; background: none; }
body.pack-long-page .round-stage:focus-within { outline: 0; }
body.pack-long-page .race { margin: 0; padding: 10px 16px; border: var(--rule) solid var(--ink); border-radius: 12px; box-shadow: 4px 4px 0 var(--ink); background: var(--paper); }
body.pack-long-page .round-text { display: none; }
body.pack-long-page .round-hint { margin-top: 10px; text-align: left; }
/* Between rounds the sheet stays, dimmed, and the coach sits on a paper card above it. */
body.pack-long-page .game-screen.between:not([hidden]) {
  left: 50%; right: auto; width: fit-content; max-width: calc(100% - 2 * var(--gutter)); transform: translateX(-50%); padding: 28px 32px;
  /* This theme locks the page's scroll, so a tall beat (guide on, saved words) scrolls inside its card. */
  max-height: calc(100dvh - var(--lp-top, 0px) - 90px); overflow-y: auto;
  border: var(--rule) solid var(--ink); border-radius: 16px; background: rgb(255 255 255 / 0.92); box-shadow: 6px 6px 0 var(--ink);
}
body.pack-long-page:has(.between:not([hidden])) .lp-world { opacity: 0.45; }
body.pack-long-page:has(.between:not([hidden])) .lp-tappy { display: none; }
@media (max-width: 599px) {
  .lp-key { font-size: 10px; box-shadow: 0 0 0 2px #c9ccd3, 0 0 0 3.5px #000, 0 2px 0 3.5px #000; }
  .lp-key.down { box-shadow: 0 0 0 2px #c9ccd3, 0 0 0 3.5px #000; transform: translateY(2px); }
  .lp-wpm { font-size: 10px; }
  .lp-marker::before { left: 3px; width: 13px; height: 13px; top: -6.5px; }
  body.pack-long-page .topbar { display: none; }
  body.pack-long-page .game-screen:not([hidden]) { top: calc(var(--lp-top, 0px) + 10px); }
  body.pack-long-page .game-screen.between:not([hidden]) { max-height: calc(100dvh - var(--lp-top, 0px) - 20px); padding: 18px 16px; }
  body.pack-long-page .between .kb-key { width: 28px; }
  body.pack-long-page .race { padding: 6px 12px; }
  body.pack-long-page .round-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lp-tappy .tappy, .lp-cursor { animation: none; }
  .lp-marker { transition: none; }
  .lp-stage * { transition-duration: 0s !important; transition-delay: 0s !important; }
}

/* ---------- Badges ---------- */
.badge-icon[aria-expanded="true"] { background: var(--accent-tint); }
.badge-icon:focus-visible, .badge-panel-close:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.badge-panel {
  position: absolute; z-index: 5; top: calc(100% + 12px); right: 0; width: min(640px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100svh - 120px); overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 18px;
  border: var(--rule) solid var(--ink); border-radius: 14px; background: var(--paper); box-shadow: 4px 4px 0 var(--ink); text-align: left;
}
.badge-panel:focus { outline: none; }
.badge-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.badge-panel-title { font-size: 22px; line-height: 1.1; }
.badge-panel-title span { margin-left: 6px; font-size: 16px; color: var(--muted); font-weight: 700; }
.badge-panel-close {
  min-height: 44px; padding: 0 14px; border: var(--rule) solid var(--ink); border-radius: 10px; background: var(--paper);
  font: inherit; font-weight: 700; cursor: pointer;
}
.badge-panel-close:hover { background: var(--accent-tint); }

/* Settings: the theme, the keyboard guide, then key sounds and the wrong-key sound (mistake-sounds.js). */
.settings-panel { width: min(400px, calc(100vw - 2 * var(--gutter))); }
.settings-section + .settings-section { margin-top: 18px; padding-top: 2px; border-top: 1px solid var(--hairline); }
.sound-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; font-weight: 700; }
.mistake-sounds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0 10px; }
.mistake-sounds button {
  min-height: 44px; padding: 0 12px; border: var(--rule) solid var(--ink); border-radius: 10px; background: var(--paper);
  font: inherit; font-weight: 700; text-align: left; cursor: pointer;
}
.mistake-sounds button:hover { background: var(--accent-tint); }
.mistake-sounds button[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.sound-settings.is-off .mistake-sounds { opacity: .55; }
#guide-note { margin-top: 10px; }

/* How to play: the rules, then one line per round from ROUND_PLAN (game.js). */
.help-panel { width: min(520px, calc(100vw - 2 * var(--gutter))); }
.help-rules { margin: 10px 0 0; padding-left: 20px; }
.help-rules li { margin-top: 8px; line-height: 1.45; }
.help-rules li::marker { color: var(--accent); }
.help-rounds-title { margin-top: 18px; font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.help-rounds { display: grid; gap: 8px; margin: 8px 0 14px; padding: 0; list-style: none; counter-reset: help-round; }
.help-rounds li {
  display: grid; grid-template-columns: 30px 1fr; column-gap: 12px; align-items: start; padding: 8px 10px;
  border: var(--rule) solid var(--ink); border-radius: 10px; counter-increment: help-round;
}
.help-rounds li::before {
  content: counter(help-round); grid-row: span 2; display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 8px; background: var(--ink); color: var(--paper); font-weight: 800;
}
.help-rounds strong { line-height: 1.3; }
.help-rounds span { color: var(--muted); font-size: 14.5px; line-height: 1.35; }
/* How to play's rounds (game.js drawHelpRounds): each row opens a card that plays a short loop of its
   round (round-previews.js) on a small copy of the round's own card. The setup screen's steps keep the plain list. */
.round-rows > li { display: block; padding: 0; transition: box-shadow 200ms var(--ease-out); }
.round-rows > li::before { content: none; }
.round-rows > li:has([aria-expanded="true"]) { box-shadow: 3px 3px 0 var(--ink); }
.help-round {
  display: grid; grid-template-columns: 30px 1fr 12px; column-gap: 12px; align-items: start; width: 100%; padding: 8px 12px 8px 10px;
  border: 0; border-radius: 9px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.help-round:hover { background: var(--accent-tint); }
.help-round span { text-wrap: pretty; }
.help-round:focus-visible { outline: 2.5px solid var(--accent); outline-offset: -3px; }
.help-round::before {
  content: counter(help-round); grid-row: span 2; display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 8px; background: var(--ink); color: var(--paper); font-weight: 800; transition: background-color 200ms;
}
.help-round[aria-expanded="true"]::before { background: var(--accent); color: var(--on-accent); }
/* A drawn chevron: points down when shut, up when open. */
.help-round::after {
  content: ""; grid-column: 3; grid-row: 1 / span 2; align-self: center; width: 8px; height: 8px; margin-top: -4px;
  border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); rotate: 45deg; transition: rotate 200ms var(--ease-out), margin 200ms var(--ease-out);
}
.help-round[aria-expanded="true"]::after { rotate: 225deg; margin-top: 4px; }
.round-preview { padding: 2px 12px 12px; }
.round-preview[hidden] { display: none; }

/* The stage: the round card in miniature. Scoped under .round-rows so a theme that hides the game's own
   round text (the Long Page) leaves the previews alone. */
.round-rows .preview-stage {
  position: relative; padding: 12px 14px; border: var(--rule) solid var(--ink); border-radius: 10px; background: var(--paper);
}
.round-rows .preview-stage .round-text { display: block; margin: 0; font-size: 22px; line-height: 1.6; }
/* One slot under the sentence: the stuck hint while it's stuck, then the English, as the reveal will show it. */
.round-rows .preview-notes { display: grid; align-items: center; min-height: 28px; margin-top: 6px; }
.round-rows .preview-notes > * { grid-area: 1 / 1; margin: 0; }
.round-rows .preview-stage .round-hint {
  display: block; width: fit-content; height: 24px; padding: 0 8px; line-height: 24px; font-size: 13px; text-align: left; background: var(--warn-fill);
}
.round-rows .preview-english { font-weight: 700; font-size: 15px; line-height: 1.35; color: var(--ink); transition: opacity 300ms var(--ease-out); }
.round-rows .is-quiet { opacity: 0; }
.round-rows .preview-stage .osk { margin-top: 10px; }
/* Round 4: the Ticker's own speed readout and red line, smaller. */
.round-rows .is-ticker .ticker-speed { margin: 0 0 6px; font-size: 13px; }
.round-rows .is-ticker .ticker-speed b { font-size: 18px; }
.round-rows .preview-kept { min-height: 1.4em; margin: 6px 0 0; font-size: 14px; font-weight: 800; color: var(--slow-text); }
.round-rows .preview-talk { gap: 12px; margin-top: 12px; }
.round-rows .preview-talk .tappy { width: 44px; flex-shrink: 0; }
.round-rows .preview-talk .bubble { padding: 8px 12px; font-size: 15px; box-shadow: 2px 2px 0 var(--ink); }
/* No room for Tappy beside his line on the narrowest phones: the line stays, as a caption. */
@media (max-width: 359px) {
  .round-rows .preview-talk .tappy { display: none; }
  .round-rows .preview-talk .bubble::before { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .round-rows > li, .help-round::before, .help-round::after, .round-rows .preview-english { transition: none; }
}

.badge-family { margin-top: 16px; }
.badge-family-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.badge-family-count { font-weight: 700; letter-spacing: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.badge-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.badge-tile {
  --fam: var(--accent); --fam-tint: var(--accent-tint); --fam-ink: var(--on-accent);
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px 10px 10px;
  border: var(--rule) solid var(--ink); border-radius: 12px; background: var(--paper);
}
.badge-tile[data-family="habit"] { --fam: var(--fast); --fam-tint: var(--fast-tint); }
.badge-tile[data-family="placement"] { --fam: var(--steady); --fam-tint: var(--steady-tint); --fam-ink: var(--ink); }
.badge-tile[data-family="accuracy"] { --fam: var(--ink); --fam-tint: var(--panel); --fam-ink: var(--paper); }
.badge-tile[data-family="early"] { --fam: var(--slow); --fam-tint: var(--slow-tint); }
.badge-tile[data-family="keyprint"] { --fam: var(--accent-deep); --fam-tint: var(--accent-tint); }
.badge-key {
  flex-shrink: 0; display: grid; place-items: center; width: 48px; height: 48px;
  border: var(--rule) solid var(--ink); border-radius: 10px; background: var(--fam); box-shadow: 2px 2px 0 var(--ink);
}
.badge-key svg { width: 26px; height: 26px; fill: none; stroke: var(--fam-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.badge-tile[data-tier="1"] .badge-key, .badge-tile[data-tier="2"] .badge-key { background: var(--fam-tint); }
.badge-tile[data-tier="1"] .badge-key svg, .badge-tile[data-tier="2"] .badge-key svg { stroke: var(--ink); }
.badge-text { display: grid; gap: 2px; min-width: 0; }
.badge-name { font-weight: 800; font-size: 16px; line-height: 1.2; }
.badge-line { font-size: 13px; line-height: 1.35; color: var(--body); }
.badge-meta { font-size: 13px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.badge-pips { display: flex; gap: 4px; margin-top: 4px; }
.badge-pips i { width: 9px; height: 9px; border: 1.5px solid var(--ink); border-radius: 3px; background: var(--paper); }
.badge-pips i.on { background: var(--fam); }
/* Locked: outline only, dimmed. */
.badge-tile.is-locked { border-color: var(--quiet); background: none; }
.badge-tile.is-locked .badge-key { background: none; border-color: var(--quiet); box-shadow: none; }
.badge-tile.is-locked .badge-key svg { stroke: var(--quiet); }
.badge-tile.is-locked .badge-name { color: var(--muted); }
.badge-tile.is-locked .badge-line, .badge-tile.is-locked .badge-meta { color: var(--muted); }
.badge-tile.is-locked .badge-pips i { border-color: var(--quiet); background: none; }

/* The board: badges as keycaps, staggered like the Keyprint. Earned caps are solid in the family
   colour with the glyph; locked caps are blank outlines, so the gaps show what's left to earn. */
.badge-views { margin: 10px 0 14px; }
.badge-board { display: grid; gap: 8px; justify-content: center; padding: 16px 8px 10px; }
.badge-board-row { display: flex; gap: 8px; justify-content: center; }
.badge-board-row:nth-child(2) { padding-left: 22px; }
.badge-board-row:nth-child(3) { padding-left: 52px; }
.badge-board-row:nth-child(4) { padding-left: 0; }
.badge-cap {
  --fam: var(--accent); --fam-tint: var(--accent-tint); --fam-ink: var(--on-accent);
  display: grid; place-items: center; width: 50px; height: 50px; padding: 0; border: var(--rule) solid var(--ink); border-radius: 10px;
  background: var(--fam); color: var(--fam-ink); box-shadow: 3px 3px 0 var(--ink); cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.badge-cap[data-family="habit"] { --fam: var(--fast); --fam-tint: var(--fast-tint); }
.badge-cap[data-family="placement"] { --fam: var(--steady); --fam-tint: var(--steady-tint); --fam-ink: var(--ink); }
.badge-cap[data-family="accuracy"] { --fam: var(--ink); --fam-tint: var(--panel); --fam-ink: var(--paper); }
.badge-cap[data-family="early"] { --fam: var(--slow); --fam-tint: var(--slow-tint); }
.badge-cap[data-family="keyprint"] { --fam: var(--accent-deep); --fam-tint: var(--accent-tint); }
.badge-cap[data-tier="1"], .badge-cap[data-tier="2"] { background: var(--fam-tint); --fam-ink: var(--ink); }
.badge-cap svg { width: 26px; height: 26px; fill: none; stroke: var(--fam-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.badge-cap:hover, .badge-cap:focus-visible { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }
.badge-cap:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.badge-cap.is-locked { background: var(--paper); border-color: var(--quiet); box-shadow: 3px 3px 0 var(--quiet); }
.badge-cap.is-locked svg { stroke: var(--quiet); }
.badge-board-caption { min-height: 2.6em; margin-top: 6px; padding: 0 4px; text-align: center; font-size: 14px; font-weight: 600; color: var(--body); text-wrap: balance; }
@media (max-width: 600px) {
  .badge-board { gap: 6px; padding: 10px 0 6px; }
  .badge-board-row { gap: 5px; }
  .badge-board-row:nth-child(2) { padding-left: 16px; }
  .badge-board-row:nth-child(3) { padding-left: 36px; }
  .badge-cap { width: 30px; height: 36px; border-radius: 7px; box-shadow: 2px 2px 0 var(--ink); }
  .badge-cap.is-locked { box-shadow: 2px 2px 0 var(--quiet); }
  .badge-cap svg { width: 18px; height: 18px; }
}
@media (prefers-reduced-motion: reduce) { .badge-cap { transition: none; } }

/* The unlock beat, at the top of the stats page. */
.badge-beat {
  margin-top: 18px; padding: 22px 24px; border: var(--rule) solid var(--ink); border-radius: 16px; background: var(--accent-tint);
  box-shadow: 6px 6px 0 var(--ink); animation: beat-in 420ms var(--ease-out) both;
}
.badge-beat-title { font-size: clamp(24px, 4vw, 34px); line-height: 1.05; }
.badge-beat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 16px 0 0; padding: 0; list-style: none; }
.badge-beat .badge-tile { animation: badge-pop 520ms var(--ease-out) calc(var(--i, 0) * 110ms + 140ms) both; }
.badge-beat-tappy { margin-top: 18px; }
.badge-beat .button { margin-top: 18px; }
.badge-beat.is-settled .button { display: none; }
.placement.is-held, .stats-actions.is-held { visibility: hidden; }
@keyframes beat-in { from { opacity: 0; transform: translateY(-10px); } }
@keyframes badge-pop { from { opacity: 0; transform: translateY(16px) scale(0.92); } }

@media (max-width: 600px) {
  .badge-panel {
    position: fixed; z-index: 20; top: auto; right: 0; bottom: 0; left: 0; width: auto; max-height: 78svh; padding: 14px var(--gutter) 24px;
    border-width: var(--rule) 0 0; border-radius: 16px 16px 0 0; box-shadow: 0 0 0 100vmax rgb(14 14 16 / 0.4);
  }
  .badge-grid { grid-template-columns: 1fr; }
  .badge-beat { padding: 18px 16px; }
}

/* ---------- Round ---------- */
.game-screen.round { max-width: 860px; }
.game-screen.round:not([hidden]) { display: flex; flex-direction: column; justify-content: center; min-height: calc(100svh - 300px); }
.round-head { display: flex; align-items: center; gap: 20px; }
.round-progress { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; }
.round-progress li {
  display: grid; place-items: center; width: 34px; height: 34px; border: var(--rule) solid var(--ink); border-radius: 8px;
  background: var(--paper); font-weight: 800; font-size: 14px; color: var(--muted);
}
.round-progress li.is-done { background: var(--accent); border-color: var(--ink); color: var(--on-accent); box-shadow: 2px 2px 0 var(--ink); }
.round-progress li.is-current { border-color: var(--accent); border-width: 2.5px; color: var(--accent); }
.round-stage .label, .game-screen.round > .label { margin-top: 18px; }
.round-skill { margin-top: 4px; color: var(--muted); font-weight: 600; }
.round-stage {
  position: relative; margin-top: 24px; padding: 28px 36px 40px; min-height: 280px;
  border: var(--rule) solid var(--ink); border-radius: 14px; box-shadow: 5px 5px 0 var(--ink); background: var(--paper);
}
.round-stage:focus-within { outline: 2.5px solid var(--accent); outline-offset: 4px; }
/* The race above the sentence: you and today's typical typist (a grey ghost), moved by script. */
.race { display: grid; gap: 6px; margin-bottom: 26px; }
.race-lane { display: flex; align-items: center; gap: 12px; }
.race-label { width: 4.6em; flex-shrink: 0; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.race-track { position: relative; flex: 1; height: 26px; border-bottom: var(--rule) solid var(--ink); }
.racer { position: absolute; bottom: 2px; left: calc(var(--p, 0) * (100% - 26px)); width: 26px; height: 26px; }
.racer svg { display: block; width: 100%; height: 100%; overflow: visible; }
.racer .tappy { width: 100%; }
.race-lane:not(.is-ghost) .racer { transition: left 140ms var(--ease-out); }
.race-lane.is-ghost .racer { opacity: 0.45; filter: grayscale(1); }
.race-lane.is-ghost .race-track { border-bottom-color: var(--quiet); border-bottom-style: dashed; }
.race-lane[hidden] { display: none; }
.round-text { font-size: clamp(22px, 3vw, 38px); line-height: 1.55; font-weight: 600; color: var(--muted); overflow-wrap: anywhere; }
.round-text .done { color: var(--accent); }
/* Round 4, the Slow Ticker: a red line crosses the sentence at a rising speed (game.js, ticker.js). */
.race[hidden], .round-text[hidden] { display: none; }
.ticker-speed { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ticker-speed b { font-size: 26px; transition: color 300ms; }
.ticker-speed.is-bumped b { color: var(--call); }
.ticker-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--panel); overflow: hidden; }
.ticker-bar > span { display: block; width: 0; height: 100%; background: var(--accent); transition: width 300ms var(--ease-out); }
/* On a theme that types the Ticker onto its own page (the Long Page), the speed readout gets its own card. */
body.pack-long-page .ticker-speed {
  margin: 0; padding: 10px 16px; border: var(--rule) solid var(--ink); border-radius: 12px; box-shadow: 4px 4px 0 var(--ink); background: var(--paper);
}
/* With the race hidden the stage has no height, so the 3, 2, 1 had no card behind it and spilled over the
   speed readout. Lay the count-in over the speed card instead (its height, borders included). */
body.pack-long-page[data-round="ticker-page"] .round-stage { z-index: 1; }
body.pack-long-page[data-round="ticker-page"] .count-in { bottom: auto; height: 61px; border-radius: 12px; font-size: 2.5rem; }
.round-text .current { color: var(--ink); background: var(--accent-tint); box-shadow: inset 0 -3px 0 var(--accent); }
.round-text .wrong { color: var(--slow-text); }
.round-text .missed { color: var(--slow-text); text-decoration: line-through; text-decoration-thickness: 2px; }
/* Round 3, the group chat (story-rounds.js): earlier sentences sit above as sent messages, the one you're
   typing is your next message, and on the last key it goes up and one of the cast answers. */
.chat[hidden], .ending-pick[hidden] { display: none; }
.chat-head { margin: 0 0 10px; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.chat-log { display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; }
.chat-msg {
  max-width: 85%; padding: 8px 14px; border: var(--rule) solid var(--ink); border-radius: 16px;
  font-size: 17px; line-height: 1.45; overflow-wrap: anywhere;
}
/* Right to left, so your messages sit on the left and the cast's on the right, as in a Hebrew chat app. */
.chat-msg.is-mine { align-self: flex-start; border-bottom-left-radius: 4px; background: var(--accent-tint); direction: rtl; }
.chat-msg.is-mine.is-old { opacity: 0.7; font-size: 15px; }
.chat-msg.is-theirs { align-self: flex-end; border-bottom-right-radius: 4px; background: var(--paper); box-shadow: 2px 2px 0 var(--ink); }
.chat-msg.is-new { animation: chat-in 320ms var(--ease-out) both; }
.chat-name { display: block; font-size: 12px; font-weight: 800; color: var(--accent); }
.chat-said { display: block; font-size: 20px; font-weight: 700; }
.chat-msg small { display: block; color: var(--muted); font-size: 12px; }
.chat-dots {
  display: block; width: 36px; height: 10px; margin: 6px 0 2px;
  background: radial-gradient(circle, var(--muted) 45%, transparent 50%) 0 50% / 12px 10px repeat-x;
  animation: chat-typing 1s ease-in-out infinite;
}
@keyframes chat-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } }
@keyframes chat-typing { 50% { opacity: 0.35; } }
body[data-twist="chat"] .round-text {
  width: fit-content; max-width: 100%; margin-right: auto; padding: 10px 16px; border: var(--rule) dashed var(--ink);
  border-radius: 18px 18px 18px 4px; background: var(--paper);
  transition: transform 450ms var(--ease-out), opacity 450ms var(--ease-out);
}
body[data-twist="chat"] .round-text.is-sent { transform: translateY(-24px); opacity: 0; }
body[data-twist="chat"] .round-text:empty { display: none; }
/* Round 5, Pick the ending: the real last line and a silly one, as two cards above the stage's input. */
.ending-pick { position: relative; z-index: 2; }
.ending-ask { margin: 0 0 12px; font-weight: 800; font-size: 18px; }
.ending-options { display: grid; gap: 12px; }
.ending-option {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; padding: 12px 16px; text-align: right;
  border: var(--rule) solid var(--ink); border-radius: 12px; background: var(--paper); box-shadow: 3px 3px 0 var(--ink);
  font: inherit; color: var(--ink); cursor: pointer; transition: transform 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}
.ending-option:hover { background: var(--accent-tint); }
.ending-option:active { transform: translate(3px, 3px); box-shadow: none; }
.ending-key {
  grid-row: span 2; display: grid; place-items: center; width: 30px; height: 30px; border: var(--rule) solid var(--ink);
  border-radius: 8px; font-weight: 800;
}
.ending-he { font-size: clamp(18px, 2.4vw, 26px); font-weight: 700; }
.ending-en { color: var(--muted); font-size: 14px; text-align: left; direction: ltr; }
/* Covers the stage so a tap anywhere focuses it and opens a phone's keyboard; invisible on top. */
.round-input {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0;
  font-size: 16px; /* stops iOS zooming in on focus */ caret-color: transparent; cursor: text;
}
/* The hint keeps one fixed-height slot whatever it says, so a hint appearing never moves the
   (vertically centred) round screen under the typist. */
.round-hint {
  box-sizing: border-box; width: fit-content; max-width: 100%; height: 28px; margin: 14px auto 0; padding: 0 10px;
  border-radius: 7px; line-height: 28px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity 300ms var(--ease-out), background-color 200ms;
}
.round-hint.is-quiet { opacity: 0; }
/* Why the cursor won't move (hint.js), e.g. "Capital letter: hold Shift and press T". */
.round-hint.is-stuck { background: var(--warn-fill); color: var(--warn-text); font-size: 14px; font-weight: 700; }

/* ---------- Keyboards (between rounds and the Keyprint) ---------- */
.kb { display: grid; gap: 6px; justify-content: center; }
.kb-row { display: flex; gap: 6px; justify-content: center; }
/* Five rows: numbers, then the three letter rows stepping right as on a real board, then Space. */
.kb-row:nth-child(2) { padding-left: 22px; }
.kb-row:nth-child(3) { padding-left: 40px; }
.kb-row:nth-child(4) { padding-left: 68px; }
.kb-key {
  display: grid; place-items: center; width: 44px; height: 44px; border: var(--rule) solid var(--ink); border-radius: 8px;
  font-weight: 800; font-size: 15px; background: var(--paper); box-shadow: 2px 2px 0 var(--ink);
}
.kb-key.is-space { width: 296px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
/* A key with a shifted character shows both, the shifted one small on top. */
.kb-key.is-pair { grid-template-rows: auto auto; align-content: center; gap: 1px; line-height: 1; }
.kb-key.is-pair i { font-style: normal; font-size: 10px; font-weight: 700; opacity: 0.75; }
.kb-key.is-pair b { font-size: 14px; }
/* Between rounds: the three letter rows and the space bar (the Israeli layout has no number row to hide). */
.kb.mini .kb-row:nth-child(2) { padding-left: 14px; }
.kb.mini .kb-row:nth-child(3) { padding-left: 30px; }
.kb.mini .kb-latin { display: none; }
.kb.mini .kb-key.is-space { width: 170px; font-size: 9px; }
.kb.mini .kb-key:is([data-key=";"], [data-key="'"], [data-key=","], [data-key="."], [data-key="/"]) { display: none; }
.kb.mini .kb-key { color: var(--muted); border-color: var(--quiet); box-shadow: none; transition: background 300ms ease, color 300ms ease, border-color 300ms ease; transition-delay: calc(var(--key) * 18ms); }
.kb.mini .kb-key.is-lit { background: var(--accent); color: var(--on-accent); border-color: var(--ink); }
.kb-key.is-green { background: var(--fast-tint); border-color: var(--fast); color: var(--fast-text); }
.kb-key.is-amber { background: var(--steady-tint); border-color: var(--steady); color: var(--steady-text); }
.kb-key.is-red { background: var(--slow-tint); border-color: var(--slow); color: var(--slow-text); }
.kb-key.is-grey { background: var(--panel); border-color: var(--quiet); color: var(--muted); box-shadow: none; }
/* Top to bottom: Tappy and the round, the day's track (desktop), the stats line, the sentence and its
   meaning, the keys typed so far, then a card for the next round with its button. Enter and Space press it too. */
.between { display: grid; justify-items: center; gap: 20px; padding-top: 24px; }
.between-row { display: flex; align-items: center; gap: 20px; max-width: 640px; }
.between-talk { display: grid; gap: 14px; justify-items: start; }
.between-talk .bubble { max-width: 44ch; }
.between-line { font-weight: 800; font-stretch: 125%; font-size: clamp(24px, 4vw, 34px); line-height: 1.1; }
.between-track { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; }
.between-track:empty, .between-stats:empty, .between-next-words:has(.between-next-name:empty) { display: none; }
.between-step { display: grid; gap: 2px; justify-items: center; min-width: 92px; padding: 8px 10px; border: var(--rule) dashed var(--quiet); border-radius: 10px; color: var(--muted); }
.between-step.is-done { border-style: solid; border-color: var(--ink); color: var(--ink); background: var(--paper); }
.between-step.is-now { border: var(--rule) solid var(--ink); background: var(--accent); color: var(--on-accent); box-shadow: 3px 3px 0 var(--ink); }
.between-step span { font-size: 12px; font-weight: 700; white-space: nowrap; }
.between-step b { font-size: 20px; font-weight: 800; font-stretch: 125%; font-variant-numeric: tabular-nums; }
.between-stats { margin: -8px 0 0; font-size: 15px; font-weight: 700; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.between .kb { margin-top: 4px; }
.between-next { display: flex; align-items: center; justify-content: space-between; gap: 24px; width: min(560px, 100%); margin-top: 8px; padding: 16px 16px 16px 20px; border: var(--rule) solid var(--ink); border-radius: 14px; background: var(--paper); box-shadow: 4px 4px 0 var(--ink); }
.between-next-words { display: grid; gap: 4px; }
.between-next-words p { margin: 0; }
.between-next-name { font-size: 20px; font-weight: 800; font-stretch: 125%; color: var(--accent); }
.between-next-rule { font-size: 15px; color: var(--muted); }
.between-next .button { flex: none; }
/* The last reveal and the drill's beat have no next-round words: the card steps back to just the button. */
.between-next:has(.between-next-name:empty) { justify-content: center; width: auto; padding: 0; border: 0; background: none; box-shadow: none; }
@media (max-width: 600px) {
  .between-track { display: none; }
  .between-stats { font-size: 13px; }
  .between-next { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px; }
  .between-next .button { width: 100%; }
}

/* ---------- Missing day ---------- */
.missing .tappy-line { margin-bottom: 28px; }

/* ---------- Stats ---------- */
.stats-title #stats-title { color: var(--ink); }
.stats-title { font-size: clamp(22px, 3.4vw, 30px); line-height: 1.1; letter-spacing: -0.01em; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.practice-chip { background: var(--ink); color: var(--paper); align-self: center; }
.placement { margin-top: 18px; padding: 28px 24px 22px; border: var(--rule) solid var(--ink); border-radius: 16px; box-shadow: 6px 6px 0 var(--accent); }
.placement-rank { font-weight: 800; font-stretch: 125%; font-size: clamp(52px, 11vw, 104px); line-height: 0.95; letter-spacing: -0.03em; }
.placement-of { margin-top: 10px; font-size: 20px; font-weight: 700; }
.placement.is-unavailable .placement-of { margin-top: 0; font-weight: 800; font-stretch: 125%; font-size: clamp(24px, 4vw, 34px); line-height: 1.1; }
.placement-top { margin-top: 8px; display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 800; }
.placement-top:empty { display: none; }
.placement-curve { display: block; width: 100%; height: auto; margin-top: 18px; overflow: visible; }
.placement-curve .curve-area { fill: var(--accent-tint); }
.placement-curve .curve-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 2000; stroke-dashoffset: 0; animation: draw-curve 1.2s ease-out 0.4s both; }
.placement-curve .curve-axis { stroke: var(--ink); stroke-width: 1.5; }
.placement-curve .curve-marker line { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 4 4; }
.placement-curve .curve-marker circle { fill: var(--accent); stroke: var(--ink); stroke-width: 2; }
.placement-curve .curve-marker { animation: drop-marker 500ms cubic-bezier(.3, 1.4, .5, 1) 1.4s both; }
.curve-wrap { position: relative; margin-top: 18px; padding-top: 24px; }
.curve-wrap .placement-curve { margin-top: 0; }
.curve-you { position: absolute; top: 0; font-weight: 800; font-size: 13px; letter-spacing: 0.08em; line-height: 1; animation: fade-in 400ms ease-out 1.5s both; }
.curve-captions { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.placement-note { margin-top: 12px; font-size: 14px; }
.placement-note:empty { display: none; }
.placement-tappy { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--hairline); }
@keyframes draw-curve { from { stroke-dashoffset: 2000; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes drop-marker { from { transform: translateY(-24px); opacity: 0; } }

.headline-wrap { position: relative; margin-top: 28px; }
.headline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: var(--rule) solid var(--ink); border-radius: 12px; overflow: hidden; }
.headline > div { position: relative; padding: 14px 16px; }
.headline > div + div { border-left: 1px solid var(--hairline); }
.headline > div.is-score { background: var(--accent-tint); }
.headline dt { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.headline dd { margin: 4px 0 0; font-weight: 800; font-stretch: 125%; font-size: 26px; line-height: 1.1; overflow-wrap: anywhere; }
/* ---------- Rhythm and the pace chart ---------- */
.rhythm-headline { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 480px; }
.rhythm-headline dd { overflow-wrap: normal; hyphens: none; font-size: 20px; }
.pace { margin-top: 18px; }
.pace-plot { padding-top: 22px; }
.pace-bar { fill: var(--accent-tint); stroke: var(--accent); stroke-width: 1; }
.pace-bar.has-slip { fill: var(--slow-tint); stroke: var(--slow); }
.pace-slip { fill: var(--slow); }
.pace-line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.pace-divider { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; }
.pace-rounds { position: absolute; top: 0; left: 0; right: 0; height: 20px; }
.pace-rounds span {
  position: absolute; top: 0; min-width: 18px; padding: 1px 5px; border: var(--rule) solid var(--ink); border-radius: 5px; background: var(--paper);
  font-size: 11px; font-weight: 800; line-height: 1.2; text-align: center;
}
.pace-scale { position: absolute; top: 24px; right: 0; font-size: 11px; font-weight: 700; color: var(--muted); }
.pace-plot .progress-callout { top: 26px; } /* under the round numbers, so hovering never hides them */
.pace-legend i.is-bar { width: 12px; height: 12px; border-radius: 3px; border: 1.5px solid var(--accent); background: var(--accent-tint); }
.pace-legend i.is-line { width: 16px; height: 0; border-radius: 0; border: 0; border-top: 2px solid var(--ink); background: none; }
.pace-legend i.is-slip { width: 10px; height: 10px; border: 0; background: var(--slow); }
.score-note { margin-top: 12px; font-size: 14px; line-height: 1.5; color: var(--muted); text-wrap: pretty; }
.score-note:empty { display: none; }
.new-best {
  display: inline-block; margin-left: 8px; padding: 2px 7px; vertical-align: 0.4em; border-radius: 6px; background: var(--ink); color: var(--paper);
  font-weight: 800; font-stretch: 125%; font-size: 11px; letter-spacing: 0.08em; line-height: 1.3;
}
.burst-key {
  position: absolute; z-index: 3; width: 14px; height: 14px; border: var(--rule) solid var(--ink); border-radius: 4px;
  background: var(--accent); pointer-events: none;
}
.burst-key.paper { background: var(--paper); }

.keepsake-card { display: grid; gap: 16px; justify-items: start; margin: 0; }
.keepsake-art { width: 100%; }
.keepsake-art canvas { display: block; width: 100%; height: auto; border: 1px solid var(--hairline); border-radius: 4px; box-shadow: 6px 6px 0 var(--ink); }

.stats-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 28px; }
.retain { flex-basis: 100%; display: flex; align-items: center; gap: 8px; font-weight: 700; }
.retain svg { width: 24px; height: 24px; flex-shrink: 0; }
.retain [data-next-daily] { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--accent); }
#share-button { min-width: 220px; }
.share-status { flex-basis: 100%; white-space: pre-line; }
.share-status:empty { display: none; }

.stats-block { margin-top: 52px; }
.stats-heading { font-size: 26px; line-height: 1; margin-bottom: 18px; }
.narrator { margin-bottom: 20px; gap: 14px; }
.narrator .tappy { width: 56px; }
.narrator h2.bubble { margin: 0; font-stretch: 100%; }
.stats-block .headline-wrap { margin-top: 0; }
.stats-block .keyprint { margin-top: 26px; }
.stats-block .rounds-table { margin-top: 26px; }
.keyprint-legend { display: flex; flex-wrap: nowrap; justify-content: center; gap: 6px 16px; margin-top: 16px; font-size: 13px; color: var(--body); }
.keyprint-legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; border: var(--rule) solid; }
.swatch.is-green { background: var(--fast-tint); border-color: var(--fast); }
.swatch.is-amber { background: var(--steady-tint); border-color: var(--steady); }
.swatch.is-red { background: var(--slow-tint); border-color: var(--slow); }
.swatch.is-grey { background: var(--panel); border-color: var(--quiet); }

.fix-three { margin: 0; padding: 0; list-style: none; border-top: var(--rule) solid var(--ink); }
.fix-three li { display: grid; grid-template-columns: auto 1fr; gap: 2px 16px; align-items: start; padding: 14px 4px; border-bottom: 1px solid var(--hairline); }
.fix-three .fix-label { grid-row: span 2; min-width: 56px; padding: 8px 10px; text-align: center; border: var(--rule) solid var(--slow); border-radius: 8px; background: var(--slow-tint); color: var(--slow-text); font-weight: 800; font-size: 18px; }
.fix-three .fix-numbers { font-weight: 700; }
.fix-three .fix-tip { color: var(--body); font-size: 15px; }
.fix-three:empty { display: none; }
.fix-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 18px; }
.fix-actions .fineprint { flex: 1 1 260px; }
/* The drill's end: the three lines against the run they came from. */
.drill-end .stats-title { margin-bottom: 18px; }
.drill-tappy { margin-bottom: 22px; }
.drill-results { margin: 0; padding: 0; list-style: none; border-top: var(--rule) solid var(--ink); }
.drill-results li { display: grid; grid-template-columns: auto 1fr; gap: 2px 16px; align-items: start; padding: 14px 4px; border-bottom: 1px solid var(--hairline); }
.drill-results .fix-label { grid-row: span 2; min-width: 56px; padding: 8px 10px; text-align: center; border: var(--rule) solid var(--ink); border-radius: 8px; background: var(--accent-tint); font-weight: 800; font-size: 18px; }
.drill-results .fix-numbers { font-weight: 700; }
.drill-results .fix-tip { color: var(--body); font-size: 15px; }
body[data-run="drill"] .round-progress li.is-done { background: var(--ink); }
body[data-run="drill"] .round-progress li.is-current { border-color: var(--ink); color: var(--ink); }
body[data-run="drill"] .round-stage:focus-within { outline-color: var(--ink); }
body[data-run="drill"] .kb.mini, body[data-guide="off"] .kb.mini { display: none; }

/* Word review's results: each word's dictionary form, its meaning, and when it comes back. A slip wears the slow colours. */
.word-review-results .fix-label { min-width: 88px; font-size: 22px; font-weight: 700; line-height: 1.3; }
.word-review-results .is-slip .fix-label { border-color: var(--slow); background: var(--slow-tint); color: var(--slow-text); }

/* Under the start screen's fine print: word review and past stories, quieter than the spacebar. */
.start-more { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 12px; margin-top: 18px; }
.start-more[hidden], .start-more [hidden] { display: none; }

/* Past stories: one row per story, the whole row a button. */
.story-list { margin: 0; padding: 0; list-style: none; border-top: var(--rule) solid var(--ink); }
.story-row {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 4px 16px; width: 100%; min-height: 64px;
  padding: 12px 4px; border: 0; border-bottom: 1px solid var(--hairline); background: none; color: var(--ink);
  font: inherit; text-align: left; cursor: pointer; transition: background 80ms ease;
}
.story-row:hover { background: var(--accent-tint); }
.story-row:focus-visible { outline: 2.5px solid var(--accent); outline-offset: -2px; }
.story-number {
  min-width: 52px; padding: 6px 8px; text-align: center; border: var(--rule) solid var(--ink); border-radius: 8px;
  font-weight: 800; font-variant-numeric: tabular-nums;
}
.story-titles { display: grid; gap: 0; min-width: 0; }
.story-he { justify-self: start; font-size: 20px; font-weight: 700; line-height: 1.3; }
.story-en { font-weight: 600; font-size: 15px; color: var(--body); }
.story-yours { font-size: 14px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.story-go {
  padding: 8px 14px; border: var(--rule) solid var(--ink); border-radius: 9px; background: var(--paper);
  font-weight: 800; font-size: 14px; box-shadow: 3px 3px 0 var(--ink);
}
.story-row:active .story-go { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
@media (max-width: 600px) {
  .story-row { grid-template-columns: auto 1fr auto; }
  .story-yours { grid-column: 2; grid-row: 2; }
  .story-number, .story-go { grid-row: span 2; }
}
@media (prefers-reduced-motion: reduce) { .story-row { transition: none; } }

.rounds-table { width: 100%; border-collapse: collapse; }
.rounds-table th, .rounds-table td { padding: 11px 8px; text-align: left; border-bottom: 1px solid var(--hairline); }
.rounds-table th { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); border-bottom: var(--rule) solid var(--ink); }
.rounds-table td:not(:first-child), .rounds-table th:not(:first-child) { text-align: right; }

.logbook { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.logbook dt { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.logbook dd { margin: 2px 0 0; font-weight: 800; font-size: 24px; }
.logbook .is-streak dd { color: var(--accent); }
/* ---------- Progress chart ---------- */
.progress { margin-top: 20px; }
.progress-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
.progress-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.progress-chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 4px 12px; border: var(--rule) solid var(--ink); border-radius: 999px;
  background: var(--paper); color: var(--ink); font-size: 14px; font-weight: 700; cursor: pointer;
}
.progress-chip[aria-pressed="false"] { color: var(--muted); border-color: var(--quiet); }
.progress-chip[aria-pressed="false"] .progress-swatch { opacity: 0.35; }
.progress-swatch { display: inline-block; width: 14px; height: 0; border-top: 3px solid var(--accent); }
.progress-swatch.is-rhythm { border-top-color: var(--call); }
.progress-plot { position: relative; }
.progress-svg { display: block; width: 100%; height: auto; overflow: visible; }
.progress-svg.progress-lanes { touch-action: pan-y; }
.progress-grid { stroke: var(--hairline); stroke-width: 1; }
.progress-axis { stroke: var(--ink); stroke-width: 1.5; }
.progress-tick, .progress-lane-title, .progress-end-label, .progress-best-label { font-family: inherit; font-size: 12px; }
.progress-tick { fill: var(--muted); font-weight: 600; }
.progress-lane-title { fill: var(--body); font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.progress-end-label, .progress-best-label { font-weight: 800; paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }
.progress-end-label { fill: var(--ink); }
.progress-best { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 5; }
.progress-best-label { fill: var(--accent); letter-spacing: 0.04em; }
.progress-line, .progress-line-accuracy, .progress-line-rhythm { fill: none; stroke-width: 2; stroke-linejoin: round; }
.progress-line { stroke: var(--ink); }
.progress-line-accuracy { stroke: var(--accent); }
.progress-line-rhythm { stroke: var(--call); }
.progress-dot { fill: var(--ink); stroke: var(--paper); stroke-width: 1.5; }
.progress-dot.is-today { fill: var(--accent); }
.progress-dot-accuracy { fill: var(--accent); stroke: var(--paper); stroke-width: 1.5; }
.progress-square-rhythm { fill: var(--call); stroke: var(--paper); stroke-width: 1.5; }
.progress-practice { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.progress-guide { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.6; }
.progress-guide[hidden] { display: none; }
.progress-callout {
  position: absolute; top: -8px; z-index: 2; padding: 4px 8px; border: var(--rule) solid var(--ink); border-radius: 6px; background: var(--paper);
  box-shadow: 2px 2px 0 var(--ink); font-size: 12.5px; font-weight: 700; white-space: nowrap; pointer-events: none;
}
.progress-callout.is-lanes { top: -4px; padding: 6px 10px; border-radius: 8px; line-height: 1.4; }
.progress-callout.is-lanes span { display: block; font-weight: 600; color: var(--body); }
.progress-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 13px; color: var(--body); }
.progress-legend li { display: inline-flex; align-items: center; gap: 6px; }
.progress-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--ink); }
.progress-legend i.is-practice { background: var(--paper); }
.progress-legend i.is-today { background: var(--accent); }
.progress-legend i.is-best { width: 16px; height: 0; border-radius: 0; border: 0; border-top: 2px dashed var(--accent); background: none; }
.progress-empty { margin-top: 12px; font-size: 14px; color: var(--muted); }
.progress-panel .logbook { margin-top: 12px; }
.progress-save { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--hairline); display: grid; gap: 10px; }
.progress-save .fineprint:empty { display: none; }

.daily-footer .footer-base::before { display: none; }
.daily-footer .footer-base { padding-top: 10px; padding-bottom: 10px; font-size: 12.5px; }

@media (max-width: 600px) {
  :root { --gutter: 20px; }
  .game { padding-top: 24px; min-height: calc(100svh - 59px - 40px); }
  .tappy.big { width: 72px; }
  .tappy-line { gap: 14px; }
  .wordmark-row { gap: 8px; margin-top: 96px; }
  .start-wall { top: 60px; }
  /* The start screen spells TAPIT IL already, so the nav keeps just the icon there. */
  .daily-page:has(.start:not([hidden])) .wordmark span { display: none; }
  .wordmark-sub { font-size: 20px; }
  .start-day { margin-top: 20px; font-size: 15px; gap: 6px 10px; }
  .start-day > span + span::before { margin-right: 10px; }
  .start-cta { margin-top: 26px; }
  .cta-space { height: 62px; }
  .start-result { min-width: 0; width: 100%; }
  /* The Settings and How to play corners sit level with the fine print's last lines, so it stays between them. */
  .start-counts { max-width: calc(100% - 2 * 64px); }
  .start-tappy { --lift: 26px; }
  .game-screen.start:not([hidden]) { min-height: calc(100svh - 148px); }
  .wordmark-keys { gap: 6px; --cap: min(64px, calc((100vw - 2 * var(--gutter) - 92px) / 5)); }
  .wordmark-cap { box-shadow: 4px 4px 0 var(--ink); }
  .start-tappy .tappy.big { width: 62px; }
  .start-tappy .bubble.above::before { right: 24px; }
  .topbar-tools { gap: 6px; }
  .footer-promise { display: none; }
  .bubble.above { max-width: 250px; font-size: 15px; }
  .keyprint-legend { gap: 6px 12px; font-size: 12px; }
  .race-label { width: 4.2em; }
  .sound-icon { top: 0; }
  .pack-option { grid-template-columns: 72px 1fr 22px; }
  .pack-option img { width: 72px; height: 48px; }
  body.pack-ink .game-screen.between:not([hidden]) { width: 100%; padding: 18px 10px; gap: 24px; }
  body.pack-ink .between .kb-key { width: 28px; }
  body.pack-ink .between-row { gap: 12px; }
  .between-line { font-size: 22px; }
  .between { gap: 22px; padding-top: 20px; }
  .reveal { padding: 20px 18px 22px; box-shadow: 4px 4px 0 var(--ink); }
  .reveal-english { font-size: 1.3rem; }
  .reveal-words li { min-width: 84px; padding: 6px 12px 8px; }
  .bubble { font-size: 16px; padding: 10px 14px; }
  .headline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .headline > div:nth-child(odd) { border-left: 0; }
  .headline > div:nth-child(n + 3) { border-top: 1px solid var(--hairline); }
  .headline dd { font-size: 22px; }
  .logbook { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kb-key { width: 25px; height: 36px; font-size: 12px; border-radius: 5px; }
  .kb-key.is-space { width: 170px; font-size: 9px; }
  .kb-key.is-pair i { font-size: 8px; }
  .kb-key.is-pair b { font-size: 11px; }
  .kb, .kb-row { gap: 3px; }
  .kb-row:nth-child(2) { padding-left: 14px; }
  .kb-row:nth-child(3) { padding-left: 26px; }
  .kb-row:nth-child(4) { padding-left: 44px; }
  .kb.mini .kb-key { width: 30px; height: 40px; font-size: 13px; }
  .kb.mini .kb-row:nth-child(2) { padding-left: 8px; }
  .kb.mini .kb-row:nth-child(3) { padding-left: 16px; }
  .kb.mini .kb-key.is-space { width: 150px; }
  .round-stage { padding: 22px 18px; min-height: 200px; }
  .game-screen.round:not([hidden]) { justify-content: flex-start; min-height: 0; }
  .round-progress li { width: 30px; height: 30px; }
  .placement { padding: 22px 16px 16px; }
  .button.big { width: 100%; }
  .stats-actions .button { flex: 1 1 calc(50% - 8px); }
  .stats-actions .button.big { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .placement-curve .curve-line, .placement-curve .curve-marker, .curve-you { animation: none; }
  .badge-beat, .badge-beat .badge-tile { animation: none; }
  .kb.mini .kb-key { transition: none; transition-delay: 0s; }
  .tappy svg { transition: none; }
  .wordmark-cap, .cta-space { animation: none; }
  .cta-space { transition: none; }
  .racer { transition: none !important; }
  .button { transition: none; }
}

/* ---------- Tapit IL: Hebrew, the learner's screens ---------- */
/* Hebrew: right to left, a face with Hebrew letters, big enough to read at 390px. */
[lang="he"] { font-family: "Arial Hebrew", "Noto Sans Hebrew", "Segoe UI", Arial, sans-serif; }
.round-text, .reveal-hebrew { direction: rtl; text-align: right; font-size: clamp(1.5rem, 5vw, 2.25rem); line-height: 1.6; }
.round-text .current { box-shadow: inset -3px 0 0 var(--accent), inset 0 -3px 0 var(--accent); } /* the cursor sits on the letter's right edge, moving left */
.count-in { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; pointer-events: none; font-size: 4rem; font-weight: 800; font-stretch: 125%; background: color-mix(in srgb, var(--paper) 85%, transparent); border-radius: inherit; }
.count-in[hidden], .ticker-line[hidden], .hint-pill[hidden], .ticker-speed[hidden], .osk[hidden] { display: none; }

/* The ghost race runs right to left, with the sentence. Tappy faces the way he runs. */
.race-track { transform: scaleX(-1); }

/* The Slow Ticker: a red line moving right to left through the sentence. */
.ticker-line { position: absolute; width: 3px; background: var(--slow); border-radius: 2px; pointer-events: none; }

.hint-pill { display: inline-block; margin-top: 14px; padding: .3rem .8rem; border-radius: 999px; background: var(--warn-fill); color: var(--warn-text); font-weight: 700; font-size: 14px; }

/* The start screen's story: its Hebrew title, then the cast. The English title is in the day line above. */
.start-story { margin-top: 14px; text-align: center; color: var(--body); }
.start-title { font-size: clamp(1.75rem, 6vw, 2.5rem); line-height: 1.25; font-weight: 700; color: var(--ink); }
.start-cast { margin-top: 4px; font-size: 15px; color: var(--muted); }

/* The on-screen keyboard guide: a compact strip, about half the height of full keycaps so the sentence stays in view. Physical left-to-right order, Hebrew only; the stuck-key hint names the Latin key. */
.osk { direction: ltr; display: grid; gap: .15rem; margin-top: 1rem; user-select: none; }
.osk-row { display: flex; gap: .15rem; justify-content: center; }
.osk-key {
  position: relative; flex: 0 1 2rem; height: 1.35rem; display: grid; place-items: center;
  border: var(--rule) solid var(--ink); border-radius: 5px; background: var(--paper); box-shadow: 1px 1px 0 var(--ink); font-weight: 800;
}
.osk-key.is-wide { flex-basis: 2.8rem; font-size: .6rem; }
.osk-key.is-space { flex-basis: 11rem; }
.osk-main { font-size: .85rem; line-height: 1; }
.osk-key.is-next { background: var(--accent); border-color: var(--ink); color: var(--on-accent); }
.osk-key.is-hit { animation: osk-flash .18s var(--ease-out); }
.osk-key.is-miss { animation: osk-miss .25s var(--ease-out); }
@keyframes osk-flash { from { background: var(--fast-tint); } }
@keyframes osk-miss { from { background: var(--slow); color: #fff; } }

/* The reveal, inside the between beat. */
/* The reveal: one card, the sentence you typed and what it means at nearly the same size, so the
   English reads as half of the moment rather than a caption. New words sit under it as small cards. */
.reveal {
  width: min(720px, 100%); padding: 26px 32px 28px; text-align: center;
  border: var(--rule) solid var(--ink); border-radius: 16px; background: var(--paper); box-shadow: 6px 6px 0 var(--ink);
}
.reveal[hidden] { display: none; }
.reveal-hebrew { text-align: center; color: var(--ink); font-weight: 600; }
/* The speaker sits inline at the sentence's end (its left, reading right to left), on the last line. */
.listen {
  display: inline-grid; place-items: center; width: 44px; height: 44px; margin-inline-start: 12px; padding: 0; vertical-align: middle;
  border: var(--rule) solid var(--ink); border-radius: 50%; background: var(--paper); color: var(--ink); cursor: pointer;
}
.listen[hidden] { display: none; }
.listen svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.listen:hover { background: var(--accent-tint); }
.listen:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.listen[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.listen[aria-pressed="true"] .listen-wave { animation: listen-wave 1.1s ease-in-out infinite; }
.listen[aria-pressed="true"] .listen-wave.is-far { animation-delay: .18s; }
@keyframes listen-wave { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .listen[aria-pressed="true"] .listen-wave { animation: none; } }
.reveal-english {
  margin: 14px auto 0; padding-top: 16px; max-width: 30ch; border-top: 1px solid var(--hairline);
  font-weight: 700; font-size: clamp(1.4rem, 3.4vw, 1.9rem); line-height: 1.25; color: var(--ink); text-wrap: balance;
}
.reveal-saved { margin-top: 20px; }
.reveal-saved-note { margin-top: 12px; font-size: 14px; font-weight: 600; color: var(--muted); }
.reveal-words { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0; padding: 0; list-style: none; }
.reveal-words[hidden] { display: none; }
.reveal-words li {
  display: grid; justify-items: center; gap: 2px; min-width: 96px; padding: 8px 16px 10px;
  border: var(--rule) solid var(--ink); border-radius: 10px; background: var(--accent-tint); animation: word-card-in 280ms var(--ease-out);
}
@keyframes word-card-in { from { opacity: 0; transform: translateY(6px); } }
/* A word in a sentence the player can tap to save. Saved, an underline draws in from the word's
   start (its right edge, in Hebrew). */
.tap-word {
  margin: 0; padding: 0; border: 0; border-radius: 4px; font: inherit; color: inherit; cursor: pointer;
  background: linear-gradient(var(--accent), var(--accent)) right 0 bottom .12em / 0% 3px no-repeat;
  transition: background-size 340ms var(--ease-out), color 200ms var(--ease-out), background-color 160ms ease-out;
}
.tap-word[aria-pressed="true"] { background-size: 100% 3px; color: var(--accent-deep); }
.tap-word:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .tap-word:hover { background-color: var(--accent-tint); } }
.saved-today { justify-content: flex-start; }
.saved-today + .fineprint { margin-top: 12px; }
.reveal-word-he { font-weight: 700; font-size: 1.35rem; line-height: 1.3; color: var(--ink); }
.reveal-word-en { font-size: 14px; font-weight: 600; color: var(--body); }
/* Ink and the Long Page already put the whole beat on a paper card, so the reveal drops its own frame. */
body:is(.pack-ink, .pack-long-page) .reveal { padding: 4px 0 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.story { margin: 0; padding: 0; list-style: none; }
.story li { margin-bottom: .8rem; }
.story [lang="he"] { display: block; font-size: 1.25rem; line-height: 1.6; }
.story .story-en { color: var(--body); }

/* My words, as a book: a page per story, its title between the arrows, a card per word. */
@media (min-width: 601px) { .words-panel { width: min(680px, calc(100vw - 2 * var(--gutter))); } }
.book-nav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 12px; margin: 10px 0 18px; padding-bottom: 16px; border-bottom: var(--rule) solid var(--ink); }
.book-head { display: grid; justify-items: center; gap: 2px; text-align: center; }
.book-title { font-size: 30px; line-height: 1.2; }
.book-title-en { font-weight: 700; color: var(--body); }
.book-story { margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.book-turn {
  display: grid; place-items: center; width: 44px; height: 44px; border: var(--rule) solid var(--ink); border-radius: 10px;
  background: var(--paper); box-shadow: 3px 3px 0 var(--ink); cursor: pointer;
}
.book-turn svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.book-turn:hover:not(:disabled) { background: var(--accent-tint); }
.book-turn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.book-turn:disabled { opacity: .3; box-shadow: none; cursor: default; }
.book-turn:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.book-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin: 0; padding: 0 3px 3px 0; list-style: none; }
.book-card {
  display: grid; align-content: start; justify-items: center; gap: 2px; padding: 14px 14px 12px; text-align: center;
  border: var(--rule) solid var(--ink); border-radius: 12px; background: var(--paper); box-shadow: 3px 3px 0 var(--ink);
}
.book-he { font-size: 1.75rem; font-weight: 700; line-height: 1.25; color: var(--ink); }
.book-en { font-weight: 700; font-size: 15px; color: var(--body); text-wrap: balance; }
.book-from { align-self: end; width: 100%; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--hairline); font-size: 14px; line-height: 1.55; color: var(--muted); text-wrap: pretty; }
.book-from mark { background: none; color: var(--ink); font-weight: 700; text-decoration: underline 2px var(--accent); text-underline-offset: .3em; }
.book-cards.is-turning-older { animation: book-turn-older 300ms var(--ease-out); }
.book-cards.is-turning-newer { animation: book-turn-newer 300ms var(--ease-out); }
@keyframes book-turn-older { from { opacity: 0; transform: translateX(-20px); } }
@keyframes book-turn-newer { from { opacity: 0; transform: translateX(20px); } }
.book-empty { display: grid; justify-items: center; gap: 12px; padding: 18px 8px 8px; text-align: center; }
.book-empty svg { width: 72px; height: 72px; }
.book-empty p { max-width: 34ch; font-weight: 600; color: var(--body); }
@media (max-width: 600px) {
  .book-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .book-card { padding: 12px 10px 10px; }
  .book-he { font-size: 1.5rem; }
  .book-title { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .tap-word, .reveal-words li, .book-cards { transition: none; animation: none !important; }
}
.keyprint, .kb { direction: ltr; }
.setup .help-rounds-title { margin-top: 18px; }
.setup .button { margin-top: 24px; }

/* 390px: no sideways scroll. The keyboard shrinks with the screen. */
@media (max-width: 480px) {
  /* Keys share the row and shrink evenly. */
  .osk-key, .osk-key.is-wide { flex: 1 1 0; min-width: 0; max-width: 2rem; }
  .osk-key.is-wide { flex-grow: 1.6; max-width: 2.8rem; font-size: .5rem; }
  .osk-key.is-space { flex: 0 1 60%; max-width: none; }
  .rhythm-headline dd { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .osk-key.is-hit, .osk-key.is-miss { animation: none; }
}
.kb-key { position: relative; }
.kb-latin { position: absolute; top: .1rem; left: .2rem; font-size: .55rem; opacity: .55; }

/* The welcome and level check (level-check.js): Tappy says what this is and how a day goes, asks
   two questions, then a sentence is typed with no guide, and the level comes back as a card. */
.level-step { max-width: 680px; }
.level-dots { display: flex; gap: 6px; margin: 0 0 22px; padding: 0; list-style: none; }
.level-dots li { width: 22px; height: 6px; border-radius: 999px; background: var(--hairline); transition: background-color 300ms var(--ease-out), width 300ms var(--ease-out); }
.level-dots li.is-done { background: var(--ink); }
.level-dots li.is-current { width: 40px; background: var(--accent); }

/* Tappy large, talking: the welcome and the result. */
.level-hero { display: flex; align-items: center; gap: 22px; margin-bottom: 18px; }
.level-tappy { width: 116px; }
.level-hero .bubble { font-size: 19px; font-weight: 800; }
.level-hello .level-tappy { animation: level-bob 3.2s ease-in-out infinite; }
@keyframes level-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.level-demo { margin-top: 22px; max-width: 560px; }
.level-demo .preview-stage { box-shadow: 4px 4px 0 var(--ink); }
.level-demo .preview-stage .round-text { font-size: 26px; }
.level-demo .preview-talk { display: none; } /* Tappy's already talking above */
.level-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin-top: 28px; }

/* How a day goes: five tiles, each with a small mark for what its keyboard does. */
.level-track { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 20px 0 0; padding: 0; list-style: none; }
.level-track li {
  display: grid; grid-template-rows: auto auto auto 1fr; gap: 6px; padding: 12px 12px 14px;
  border: var(--rule) solid var(--ink); border-radius: 12px; background: var(--paper); box-shadow: 3px 3px 0 var(--ink);
}
.level-track-number {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--ink); color: var(--paper); font-weight: 800; font-size: 14px;
}
.level-track strong { line-height: 1.2; }
.level-track-skill { font-size: 13.5px; line-height: 1.35; color: var(--muted); }
/* The mark: three keys. Lit: the middle one glows. Unlit: outlines. Hidden or none: faint. Ticker: a red line through them. */
.level-track-mark { position: relative; display: flex; gap: 4px; }
.level-track-mark i { width: 14px; height: 14px; border: 2px solid var(--ink); border-radius: 4px; background: var(--paper); }
.level-track li[data-guide="lit"] .level-track-mark i:nth-child(2) { background: var(--accent); }
.level-track li[data-guide="hidden"] .level-track-mark { opacity: .3; }
/* A phone has no guide to fade, so its plain sentences show just their names. */
.level-track li[data-guide="none"] .level-track-mark, .level-track li[data-guide="none"] .level-track-skill { display: none; }
.level-track li[data-guide="ticker"] .level-track-mark::after { content: ""; position: absolute; left: 25px; top: -4px; width: 3px; height: 22px; border-radius: 2px; background: var(--slow); }
.level-track li[data-guide="lit"] { background: var(--accent-tint); }
.level-facts { margin: 22px 0 0; padding-left: 20px; max-width: 60ch; color: var(--body); }
.level-facts li { margin-top: 8px; line-height: 1.45; }
.level-facts li::marker { color: var(--accent); }

/* The questions. Tappy's line answers each pick, so the bubble keeps a steady height. */
.level-talk { min-height: 3.2em; display: flex; align-items: center; }
.level-question { margin-top: 24px; }
.level-question-title { margin: 0 0 10px; font-size: 22px; font-weight: 800; line-height: 1.2; }
.level-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 480px; }
.level-options button {
  min-height: 52px; padding: 12px; border: var(--rule) solid var(--ink); border-radius: 12px; background: var(--paper); box-shadow: 3px 3px 0 var(--ink);
  font: inherit; font-weight: 800; font-size: 17px; color: var(--ink); cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, transform 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}
.level-options button:hover { background: var(--accent-tint); }
.level-options button[aria-checked="true"] { background: var(--accent); color: var(--on-accent); transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.level-options button:focus-visible, .level-quiet:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; }
.level-fair { margin-top: 18px; max-width: 46ch; }
.level-quiet {
  min-height: 44px; padding: 0 2px; border: 0; background: none; font: inherit; font-weight: 700; color: var(--body);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; cursor: pointer;
}
.level-quiet:hover { color: var(--ink); }
.level-quiet:disabled { opacity: .5; cursor: default; }

/* The sentence, on a card like the round's. */
.level-stage {
  position: relative; margin-top: 22px; padding: 22px 30px 26px;
  border: var(--rule) solid var(--ink); border-radius: 14px; background: var(--paper); box-shadow: 5px 5px 0 var(--ink);
}
.level-stage:focus-within { outline: 2.5px solid var(--accent); outline-offset: 4px; }
.level-sentence { margin: 8px 0 0; direction: rtl; text-align: right; font-size: clamp(30px, 5vw, 46px); line-height: 1.5; font-weight: 600; color: var(--muted); overflow-wrap: anywhere; }
.level-sentence .done { color: var(--accent); }
.level-sentence .current { color: var(--ink); background: var(--accent-tint); box-shadow: inset -3px 0 0 var(--accent), inset 0 -3px 0 var(--accent); }
.level-sentence .wrong { color: var(--slow-text); }
.level-sentence .flourish { display: inline-block; color: var(--accent); opacity: 0; transform: scale(.4) rotate(-12deg); transition: opacity 260ms var(--ease-out), transform 420ms cubic-bezier(.34, 1.56, .64, 1); }
.level-sentence .flourish.is-in { opacity: 1; transform: none; }
.level-english { margin: 4px 0 0; font-weight: 700; color: var(--body); }
.level-hint { min-height: 1.5em; margin-top: 14px; font-weight: 700; color: var(--body); }
.level-hint.is-stuck { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--warn-fill); color: var(--warn-text); }
.level-type .level-quiet { display: block; margin-top: 6px; }

/* The result: a card with Tappy, the level, the sentence's numbers and the three things it sets. */
.level-card {
  padding: 24px 28px 26px; border: var(--rule) solid var(--ink); border-radius: 18px; background: var(--paper); box-shadow: 6px 6px 0 var(--accent);
}
.level-card .daily-title { margin-top: 2px; }
.level-typed { margin-top: 6px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--body); }
.level-perks { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 20px 0 0; padding: 0; list-style: none; }
.level-perks li {
  display: grid; gap: 4px; align-content: start; padding: 12px 14px; border: var(--rule) solid var(--ink); border-radius: 12px; background: var(--accent-tint);
}
.level-perk-title { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.level-perks strong { font-size: 24px; font-weight: 800; font-stretch: 125%; line-height: 1.1; color: var(--ink); }
.level-perk-note { font-size: 13.5px; color: var(--body); }
.level-perk-dots { display: flex; gap: 4px; }
.level-perk-dots i { width: 14px; height: 14px; border: 2px solid var(--ink); border-radius: 4px; background: var(--paper); }
.level-perk-dots i.is-lit { background: var(--accent); }
.level-note { margin-top: 14px; max-width: 56ch; }
#level-settings-name { font-weight: 700; }
#level-settings-note { margin-top: 6px; }

@media (max-width: 600px) {
  .level-track { grid-template-columns: 1fr; gap: 8px; }
  .level-track li { grid-template-columns: 28px 1fr auto; grid-template-rows: auto auto; column-gap: 12px; row-gap: 2px; padding: 10px 12px; }
  .level-track-number { grid-row: span 2; }
  .level-track-mark { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
  .level-track strong { grid-column: 2; grid-row: 1; }
  .level-track-skill { grid-column: 2; grid-row: 2; }
  .level-track li[data-guide="none"] { grid-template-rows: auto; align-items: center; }
  .level-track li[data-guide="none"] .level-track-number { grid-row: auto; }
  .level-tappy { width: 80px; }
  .level-hero { gap: 14px; }
  .level-hero .bubble { font-size: 17px; }
  .level-stage { padding: 18px 18px 20px; }
  .level-card { padding: 18px 18px 20px; }
  .level-options button { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .level-hello .level-tappy { animation: none; }
  .level-dots li, .level-options button, .level-sentence .flourish { transition: none; }
}

/* The welcome sits in the middle of the page, like a card game's opening, not a form down the left. */
.game-screen.level { text-align: center; }
.level-step { margin-inline: auto; }
.level-dots { justify-content: center; }
.level .tappy-line, .level-hero { justify-content: center; text-align: left; }
.level .game-rules, .level-fair, .level-note { margin-inline: auto; }
.level-actions { justify-content: center; }
.level-demo { margin-inline: auto; text-align: left; }
.level-track li { text-align: left; }
.level-stage { text-align: center; }
.level-sentence { text-align: center; }
.level-type .level-quiet { margin-inline: auto; }

/* The questions: each on its own card; the second waits, faded, until the first is answered. */
.level-question {
  margin: 22px auto 0; max-width: 620px; padding: 18px 20px 20px;
  border: var(--rule) solid var(--ink); border-radius: 16px; background: var(--paper); box-shadow: 5px 5px 0 var(--ink);
  transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out);
}
.level-question.is-waiting { opacity: .45; transform: translateY(4px); }
.level-question .label { margin: 0 0 4px; }
.level-options { max-width: none; margin-inline: auto; }
.level-options button { display: grid; align-content: center; gap: 4px; min-height: 84px; }
.level-options button strong { font-size: 18px; }
.level-options button span { font-size: 13.5px; font-weight: 600; line-height: 1.3; color: var(--muted); transition: color 120ms ease; }
.level-options button[aria-checked="true"] span { color: var(--on-accent); opacity: .9; }

/* How a day goes: the three points as small cards, not a bullet list. */
.level-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: none; margin: 18px 0 0; padding: 0; list-style: none; }
.level-facts li {
  display: grid; gap: 4px; align-content: start; margin: 0; padding: 12px 14px; text-align: left;
  border-radius: 12px; background: var(--accent-tint); font-size: 14.5px; line-height: 1.4;
}
.level-facts strong { color: var(--ink); font-size: 16px; }

.level-card { text-align: center; }
.level-perks li { text-align: left; }
@media (max-width: 600px) {
  .level-facts { grid-template-columns: 1fr; }
  .level-question { padding: 14px 12px 14px; }
  .level-options { gap: 8px; }
  .level-options button { min-height: 92px; padding: 10px 6px; }
  .level-options button strong { font-size: 16px; }
  .level-options button span { font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .level-question { transition: none; }
}
.level-demo .preview-stage .round-text { text-align: center; }
