/* Tot Up. Warm paper and ink, with one glowing object on it: the LED board.
   Every colour is a role token. Light is the default; dark follows the phone
   unless data-theme says otherwise. The accent is red biro: it marks, it never fills. */

:root {
  color-scheme: light;
  --paper: #FAF6EE;
  --surface: #FFFDF8;
  --ink: #1A2233;
  --ink-2: #4A5263;
  --hairline: #E3D8C6;
  --edge: #8C8170;
  --accent: #C2491A;
  --biro: var(--accent);
  --ink-press: color-mix(in srgb, var(--ink) 85%, var(--paper));
  --tint: color-mix(in srgb, var(--ink) 6%, transparent);
  --press: color-mix(in srgb, var(--ink) 8%, var(--surface));
  --board: #12161D;
  --bezel: #34363E;
  --board-warm: #2A2110;
  --led: #FFB547;
  --led-hot: #FFE3A3;
  --led-glow: rgba(255, 181, 71, .45);
  --board-text: #D8D2C6;
  --board-off: #7A8396;
  --card-face: #FFFAF0;
  --card-ink: #1A1A1A;
  --card-made: #FFF1D6;
  --sel: var(--ink);
  --bar-dim: rgba(216, 210, 198, .14);
  --lift: 0 8px 16px rgba(0, 0, 0, .18);
  --scrim: rgba(18, 22, 29, .52);
  --font: 'Atkinson Hyperlegible Next', 'Atkinson Fallback', 'Atkinson Fallback Android', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #15161A; --surface: #1F2026; --ink: #EEEAE2; --ink-2: #B5B0A6; --hairline: #2A2B31; --edge: #7D786F;
    --accent: #FF8A4C; --biro: var(--accent);
    --ink-press: color-mix(in srgb, var(--ink) 85%, var(--paper));
    --tint: color-mix(in srgb, var(--ink) 6%, transparent);
    --press: color-mix(in srgb, var(--ink) 12%, var(--surface));
    --board: #0A0C10; --card-face: #E9E2D3; --card-made: #F3DDB0; --sel: var(--ink);
    --lift: 0 8px 18px rgba(0, 0, 0, .45); --scrim: rgba(0, 0, 0, .62);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #15161A; --surface: #1F2026; --ink: #EEEAE2; --ink-2: #B5B0A6; --hairline: #2A2B31; --edge: #7D786F;
  --accent: #FF8A4C; --biro: var(--accent);
  --ink-press: color-mix(in srgb, var(--ink) 85%, var(--paper));
  --tint: color-mix(in srgb, var(--ink) 6%, transparent);
  --press: color-mix(in srgb, var(--ink) 12%, var(--surface));
  --board: #0A0C10; --card-face: #E9E2D3; --card-made: #F3DDB0; --sel: var(--ink);
  --lift: 0 8px 18px rgba(0, 0, 0, .45); --scrim: rgba(0, 0, 0, .62);
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--paper); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--paper); color: var(--ink);
  font: 500 1.125rem/1.45 var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
  /* Quick taps between the cards mustn't zoom the page (pinch still does). */
  touch-action: manipulation;
}
body.locked { overflow: hidden; }
h1, h2, h3, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
button:disabled { cursor: default; }
a { color: inherit; }
[hidden] { display: none !important; }
.num { font-variant-numeric: lining-nums proportional-nums; }
.tab { font-variant-numeric: lining-nums tabular-nums; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.soft { color: var(--ink-2); font-size: 1rem; text-wrap: pretty; }
.small { font-size: 1rem; font-weight: 600; }
.soft.small { font-weight: 500; }
.pad { padding: 24px 0; }
.x { font-size: 1.12em; line-height: 0; }
svg.i { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
/* The column-sum mark from the sprite (#m-sum). The outer svg has no viewBox, so it is sized here. */
.mark-sum { display: block; aspect-ratio: 188.7 / 194.1; color: var(--ink); overflow: visible; }

/* Focus: red biro, keyboard only (amber on the LED board). */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--biro); outline-offset: 3px; }
.led :focus-visible { outline-color: var(--led); }

/* Fixed cells for ticking figures, so the clock does not shuffle sideways. */
.d { display: inline-block; width: .64em; text-align: center; }
.c { display: inline-block; width: .3em; text-align: center; translate: 0 -.06em; }

#app {
  display: flow-root; container: app / inline-size; max-width: 30rem; margin: 0 auto;
  /* From the home screen (viewport-fit=cover) the status bar sits over the top. */
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.view { animation: fade 120ms ease-out backwards; }

/* ---------- header ---------- */

.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 56px; }
.top-l, .top-r { display: flex; align-items: center; min-width: 0; }
.top-r { margin-right: -8px; }
.wordmark { padding: 0; margin-left: -2px; min-height: 44px; display: flex; align-items: center; color: var(--ink); }
.wordmark svg { display: block; height: 26px; width: auto; }
.nav-btn { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; font-size: 1rem; font-weight: 600; color: var(--ink); white-space: nowrap; }
.nav-btn svg.i { width: 22px; height: 22px; }
.nav-btn:active { background: var(--tint); }
.back-btn { margin-left: -8px; margin-right: 4px; gap: 2px; padding-left: 2px; }
.back-btn svg.i { width: 24px; height: 24px; stroke-width: 2.4; }
.icon-btn { width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center; color: var(--ink); }
.icon-btn svg.i { width: 26px; height: 26px; stroke-width: 2; }
.icon-btn:active { background: var(--tint); }

.round-head { min-height: 44px; margin: 6px 0 4px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rh-l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rh-title { font-weight: 500; font-size: 1rem; line-height: 1.15; color: var(--ink-2); min-width: 0; }
.rh-title b, .rh-name { white-space: nowrap; }
.rh-title b { font-weight: 700; color: var(--ink); }
.rh-score { font-weight: 700; font-size: 1.125rem; white-space: nowrap; }
.pips { display: inline-flex; gap: 4px; flex: none; }
.pips .gl { --g: 24px; }
.gl-now { box-shadow: inset 0 0 0 2px var(--ink); }

/* ---------- buttons: ruled ink boxes ---------- */

.btn {
  position: relative; display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; min-height: 52px;
  padding: 12px 20px; border-radius: 0; font-size: 1.125rem; font-weight: 700; line-height: 1.2; letter-spacing: .005em; text-align: left;
  text-decoration: none; transition: translate 80ms ease-out, background-color 80ms;
}
.btn svg.i { width: 1.2em; height: 1.2em; }
/* Primary: an ink box, ruled off twice underneath like the answer to a sum. */
.btn.primary { min-height: 56px; margin-bottom: 14px; background: var(--ink); color: var(--paper); }
.btn.primary::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -12px; height: 8px; pointer-events: none;
  background: linear-gradient(var(--ink), var(--ink)) 0 0 / 100% 2px no-repeat,
              linear-gradient(var(--ink), var(--ink)) 4px 6px / calc(100% - 10px) 2px no-repeat;
}
/* Pressed: drops 2px, the face lightens, and the two rules close into one 4px rule. */
.btn.primary:active { translate: 0 2px; background: var(--ink-press); }
.btn.primary:active::after { bottom: -10px; height: 4px; background: linear-gradient(var(--ink), var(--ink)) 0 0 / 100% 4px no-repeat; }
/* Today's puzzle number in a margin column behind a red margin rule. */
.btn.has-stub { padding-top: 0; padding-bottom: 0; padding-right: 0; align-items: stretch; }
.btn.has-stub .lbl { align-self: center; padding: 12px 0; }
.btn .lbl { flex: 1; }
.btn .stub {
  align-self: stretch; display: flex; align-items: center; justify-content: center; min-width: 72px; padding: 0 12px;
  border-left: 2px solid var(--biro); font-size: 1.125rem; font-weight: 700; white-space: nowrap;
}
/* Secondary: square ink-ruled box on surface. */
.btn.outline { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--edge); min-height: 48px; }
.btn.outline:active, .btn.ghost:active { translate: 0 2px; background: var(--press); }
/* Ink: Lock in, Save, Nudge. */
.btn.ink { background: var(--ink); color: var(--paper); }
.btn.ink:active { translate: 0 2px; background: var(--ink-press); }
/* Quiet: ink text with a biro underline. */
.btn.text {
  width: auto; min-height: 44px; padding: 8px 4px; color: var(--ink); font-weight: 700;
  text-decoration: underline 2px var(--biro); text-underline-offset: 5px; text-decoration-skip-ink: none;
}
.btn.text:active { text-decoration-thickness: 4px; }
.btn.text.done { cursor: default; }
.btn.text.done:active { text-decoration-thickness: 2px; }
.whole { white-space: nowrap; }
.btn.text[data-act="leave"] { color: var(--ink-2); text-decoration-color: var(--edge); }
.btn.text.armed { background: var(--ink); color: var(--paper); text-decoration: none; padding: 8px 12px; }
.btn.sm { min-height: 44px; font-size: 1rem; width: auto; padding: 8px 14px; }
.link {
  min-height: 44px; padding: 0 4px; color: var(--ink); font-weight: 600;
  text-decoration: underline 2px var(--biro); text-underline-offset: 4px; text-decoration-skip-ink: none;
}
.link:active { text-decoration-thickness: 4px; }
/* Disabled: the box pencilled in dashes. */
.btn:disabled { background: transparent; color: var(--ink-2); box-shadow: none; outline: 2px dashed var(--edge); outline-offset: -2px; translate: none; }
.btn.primary:disabled::after { display: none; }
/* Armed (a second tap is needed): the colours invert. */
.btn.ink.armed { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn.ghost.armed { background: var(--ink); color: var(--paper); box-shadow: none; }
.btn:disabled:focus-visible { outline: 3px solid var(--biro); outline-offset: 3px; }

/* Dark: cream fill is for number cards only, so commands become cream-ruled boxes. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.primary:not(:disabled), :root:not([data-theme="light"]) .btn.ink:not(:disabled):not(.armed) {
    background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink);
  }
  :root:not([data-theme="light"]) .btn.primary:not(:disabled):active, :root:not([data-theme="light"]) .btn.ink:not(:disabled):not(.armed):active {
    background: color-mix(in srgb, var(--ink) 12%, var(--surface));
  }
  :root:not([data-theme="light"]) .btn.ink.armed { background: var(--ink); color: var(--paper); box-shadow: none; }
  :root:not([data-theme="light"]) .btn.outline:not(:disabled) { background: transparent; box-shadow: inset 0 0 0 2px var(--edge); }
}
:root[data-theme="dark"] .btn.primary:not(:disabled), :root[data-theme="dark"] .btn.ink:not(:disabled):not(.armed) {
  background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink);
}
:root[data-theme="dark"] .btn.primary:not(:disabled):active, :root[data-theme="dark"] .btn.ink:not(:disabled):not(.armed):active {
  background: color-mix(in srgb, var(--ink) 12%, var(--surface));
}
:root[data-theme="dark"] .btn.ink.armed { background: var(--ink); color: var(--paper); box-shadow: none; }
:root[data-theme="dark"] .btn.outline:not(:disabled) { background: transparent; box-shadow: inset 0 0 0 2px var(--edge); }

/* ---------- the LED board ---------- */

.led {
  position: relative; border-radius: 20px; color: var(--board-text);
  background-color: var(--board);
  background-image: radial-gradient(circle at center, rgba(255, 255, 255, .04) 0 .9px, transparent 1.2px);
  background-size: 3px 3px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, .5), 0 0 0 1px var(--bezel);
  /* Focus and selection on the board are amber: ink would vanish into it. */
  --sel: var(--led);
}
.led-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.led-label { font-size: 1rem; font-weight: 600; letter-spacing: .005em; text-transform: none; color: var(--board-text); line-height: 1.2; }
.led-digits, .led-target, .cd, .mini-target, .sp-score .num, .try-target, .hb-no { font-weight: 700; color: var(--led); }
.led-target, .try-target, .cd { text-shadow: 0 0 1px rgba(255, 181, 71, .6), 0 0 12px rgba(255, 181, 71, .28); }
.mini-target, .sp-score .num, .hb-no { text-shadow: none; }

.loading-mark { height: 96px; width: 93.3px; margin: 28px 0 20px; }
.loading-board { height: 96px; padding: 16px; display: flex; align-items: center; justify-content: center; }
.led-dots { display: flex; justify-content: center; gap: 14px; }
.led-dots i { width: 14px; height: 14px; border-radius: 999px; background: var(--led); box-shadow: 0 0 14px var(--led-glow); animation: dots 1.2s ease-in-out infinite; }
.led-dots i:nth-child(2) { animation-delay: .2s; } .led-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dots { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.loading-msg { text-align: left; color: var(--ink-2); margin-top: 16px; font-size: 1rem; }
.loading-msg .btn { margin-top: 16px; }

/* ---------- play screen ---------- */

.led.play { padding: 12px 16px 26px; min-height: 184px; display: flex; flex-direction: column; transition: background-color 200ms; }
.led-secs { font-size: 1.75rem; font-weight: 700; color: var(--board-text); line-height: 1; min-width: 3.4ch; text-align: right; transition: color 200ms; }
.led-target {
  font-size: min(4.5rem, 28cqi); line-height: 1; text-align: center; margin: 2px 0 6px; min-height: 1em; letter-spacing: .015em;
  display: flex; justify-content: center; transition: color 200ms;
}
.led-target .count { font-size: 1em; animation: count-in 450ms ease-out both; }
@keyframes count-in { from { opacity: 0; scale: 1.35; } 30% { opacity: 1; scale: 1; } 85% { opacity: 1; } to { opacity: .2; } }
.led-target .ready-word { font-size: .6em; align-self: center; }
.bang-word, .try-bang, .ready-word { text-transform: uppercase; letter-spacing: .06em; }
.odo { display: inline-block; height: 1em; overflow: hidden; }
.odo-s { display: flex; flex-direction: column; }
.odo-s b { display: block; height: 1em; line-height: 1; font-weight: 700; }
.roll .odo-s { transform: translateY(calc(var(--n) * -1em)); transition: transform var(--t) cubic-bezier(.15, .7, .25, 1); }
.led-target.pulse { animation: glow 200ms ease-out; }
@keyframes glow { 50% { text-shadow: 0 0 30px var(--led-glow), 0 0 12px var(--led-glow); } }
.led-target.near { animation: near 300ms ease-out; }
@keyframes near { 50% { color: var(--led-hot); text-shadow: 0 0 30px var(--led-glow), 0 0 14px var(--led-glow); } }

.led-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; min-height: 30px; }
.closest { font-size: 1.125rem; font-weight: 600; color: var(--board-text); }
.closest b { font-weight: 700; color: var(--board-text); }
.worth { font-size: 1rem; font-weight: 600; color: var(--board-text); white-space: nowrap; }
.worth.on { color: var(--led); }
.bang-word { display: inline-flex; align-items: center; gap: 8px; font-size: 1.375rem; font-weight: 700; line-height: 1; color: var(--led-hot); }
.bang-word svg.i { width: 26px; height: 26px; }
/* Bang on: the target's centre dot pops. Custom properties reach into the sprite's <use> copy. */
svg.pop { --dot-anim: dot-pop 300ms ease-out both; }
@keyframes dot-pop { 0% { scale: 0; } 60% { scale: 1.25; } 100% { scale: 1; } }

.timebar { position: absolute; left: 16px; right: 16px; bottom: 11px; height: 8px; border-radius: 999px; background: var(--bar-dim); overflow: hidden; transition: height 200ms, bottom 200ms; }
.timebar i { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--led); transform-origin: left center; }
.led.play.low .timebar { height: 12px; bottom: 9px; }
.led.play.low .led-secs { color: var(--led); }
.led.play.bang { animation: warm 200ms ease-in-out 2; }
.led.play.bang .led-target { color: var(--led-hot); text-shadow: 0 0 24px var(--led-glow), 0 0 8px var(--led-glow); }
@keyframes warm { 50% { background-color: var(--board-warm); } }

.tape {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; width: 100%;
  height: 52px; margin: 8px 0; padding: 0 8px; text-align: center; line-height: 1.2; color: var(--ink);
}
.tape .t-old { font-size: 1.125rem; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.tape .t-new { font-size: 1.375rem; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tape.pending .t-new { color: var(--ink); }
.tape.hint .t-new, .tape.coach .t-new, .tape.warn .t-new { white-space: normal; line-height: 1.15; text-wrap: balance; }
.tape.hint .t-new { font-size: 1.125rem; color: var(--ink-2); font-weight: 500; }
.tape.coach .t-new { font-size: 1.125rem; font-weight: 700; color: var(--ink); }
.tape.warn .t-new { font-size: 1.125rem; font-weight: 700; color: var(--ink); }
.tape:active { background: var(--tint); }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.card {
  position: relative; height: 80px; border-radius: 6px; display: grid; place-items: center;
  background: var(--card-face); color: var(--card-ink); border: 1.5px solid var(--edge);
  box-shadow: 0 2.5px 0 var(--edge);
  font-size: 2.25rem; font-weight: 800; line-height: 1;
  rotate: var(--tilt, 0deg);
  transition: translate 120ms var(--ease-out), rotate 120ms var(--ease-out), box-shadow 120ms var(--ease-out), background-color 150ms;
}
.card:not(:disabled):active { translate: 0 2px; box-shadow: 0 1px 0 var(--edge); transition-duration: 80ms; }
.card.sel {
  rotate: 0deg; translate: 0 -4px; outline: 3px solid var(--sel); outline-offset: 2px;
  box-shadow: 0 2.5px 0 var(--edge), var(--lift);
}
/* A made card shows a second card peeking out behind it: made from two. */
.card.made { background: var(--card-made); box-shadow: 0 2.5px 0 var(--edge), 5px -5px 0 -1.5px var(--card-made), 5px -5px 0 0 var(--edge); }
.card.made.sel { box-shadow: 0 2.5px 0 var(--edge), 5px -5px 0 -1.5px var(--card-made), 5px -5px 0 0 var(--edge), var(--lift); }
/* A used card keeps its face, at 40%, with a hand strike through it. */
.card.used { background: var(--card-face); border-style: solid; box-shadow: none; rotate: 0deg; }
.card.used .v { opacity: .4; }
.card.used::after { content: ''; position: absolute; left: 22%; right: 22%; top: 50%; height: 3px; border-radius: 2px; background: var(--card-ink); rotate: -16deg; opacity: .75; }
.card.slot { background: transparent; border: 1.5px dashed var(--hairline); box-shadow: none; rotate: 0deg; }
.card .hit-ck { display: none; position: absolute; top: 5px; right: 5px; width: 20px; height: 20px; stroke-width: 2.2; color: var(--card-ink); }
.card.hit .hit-ck { display: block; }
.card.pop { animation: pop 160ms ease-out; }
@keyframes pop { from { scale: .96; } to { scale: 1; } }
.card.shake { animation: shake 150ms linear; }
@keyframes shake { 25% { translate: -4px 0; } 75% { translate: 4px 0; } }
.card.flash, .op.flash { animation: oflash 300ms steps(1); }
@keyframes oflash { 0% { outline: 2px solid var(--ink); outline-offset: 2px; } }
.card.deal { animation: deal 180ms var(--ease-out) backwards; animation-delay: calc(var(--k, 0) * 60ms); }
@keyframes deal { from { translate: 0 16px; opacity: 0; rotate: 0deg; } }
.card .v { pointer-events: none; }
.guide { outline: 3px solid var(--sel) !important; outline-offset: 3px; animation: guide 1.2s ease-in-out infinite; }
.led .guide { outline-color: var(--led) !important; }
@keyframes guide { 50% { outline-color: transparent; } }

/* Operator keys: square ruled boxes with drawn signs. A chosen sign latches down. */
.ops { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 12px; }
.op {
  height: 64px; border-radius: 0; background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink);
  display: grid; place-items: center; transition: translate 80ms ease-out, background-color 80ms;
}
.op svg.i { width: 28px; height: 28px; stroke-width: 3; }
.op:not(:disabled):active { translate: 0 2px; background: var(--press); }
.op.sel, .op.sel:not(:disabled):active { background: var(--ink); color: var(--paper); translate: 0 2px; }
.op:disabled { background: transparent; color: var(--ink-2); box-shadow: none; outline: 2px dashed var(--edge); outline-offset: -2px; }
.led .op { background: transparent; color: var(--board-text); box-shadow: inset 0 0 0 2px var(--board-text); }
.led .op:not(:disabled):active { background: rgba(216, 210, 198, .12); }
.led .op.sel { background: var(--led); color: var(--board); box-shadow: none; }

.actions { display: grid; grid-template-columns: 1fr 1.15fr 1.5fr; gap: 8px; margin-top: 24px; }
.actions .btn { min-height: 48px; font-size: 1rem; padding: 6px 10px; line-height: 1.1; }
.actions .btn.ghost { justify-content: center; text-align: center; padding: 6px 4px; }
/* The Lock-in total key: a label and the running total in its own column. */
.lock { justify-content: space-between; padding: 6px 0 6px 14px; }
.actions .btn.lock { padding: 6px 0 6px 12px; }
.lock .lbl { flex: 1; white-space: nowrap; }
.actions .btn.lock.armed { padding: 6px 8px; justify-content: center; text-align: center; }
.lock .tot {
  align-self: stretch; display: flex; align-items: center; padding: 0 10px; margin: -6px 0; font-size: 1.125rem;
  border-left: 2px solid color-mix(in srgb, currentColor 40%, transparent);
}

/* ---------- between rounds ---------- */

.led.mini { margin-top: 4px; padding: 14px 16px; min-height: 120px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mini-l { display: flex; flex-direction: column; gap: 6px; }
.mini-target { font-size: 2.5rem; line-height: 1; }
.mini-r { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.mini-you { font-size: 1.125rem; font-weight: 600; color: var(--board-text); }
.mini-you b { font-weight: 700; }
.hero, .headline { font-size: 1.75rem; font-weight: 700; line-height: 1.12; letter-spacing: -.012em; text-wrap: balance; }
.headline { margin: 20px 0 10px; }
.receipt { border-top: 2px dashed var(--hairline); border-bottom: 2px dashed var(--hairline); padding: 8px 0; }
.rl { display: flex; align-items: baseline; gap: 8px; min-height: 36px; padding: 4px 0; font-size: 1.125rem; }
.rl i { flex: 1; min-width: 12px; border-bottom: 1.5px dotted var(--edge); transform: translateY(-.3em); }
.rl b { font-weight: 700; font-variant-numeric: lining-nums tabular-nums; }
.rl.total { font-size: 1.375rem; font-weight: 700; }
.receipt hr { border: 0; border-top: 2px solid var(--ink); margin: 6px 0; }
.miss { font-size: 1.125rem; font-weight: 600; padding: 6px 0; }
.way { margin-top: 18px; }
.sec-h, .way h3, .claim-h { font-size: 1.25rem; font-weight: 700; line-height: 1.25; text-wrap: balance; }
/* Working, aligned on "=". */
.steps { display: grid; grid-template-columns: auto auto auto; justify-content: start; column-gap: .35em; margin-top: 6px; }
.steps li { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; font-size: 1.125rem; font-weight: 500; line-height: 1.5; }
.steps .ex { text-align: right; font-weight: 500; }
.steps .eq { color: var(--ink-2); }
.steps b { text-align: right; font-weight: 700; }
.steps.big li { font-size: 1.375rem; padding: 4px 0; border-bottom: 1px solid var(--hairline); }
.next-up { margin: 18px 0 14px; font-size: 1rem; color: var(--ink-2); text-wrap: pretty; }
.next-up b { color: var(--ink); }
#v-between .btn.primary { margin-top: 8px; }

/* ---------- round marks and result chips ---------- */

.glyphs { display: inline-flex; gap: 4px; vertical-align: middle; flex: none; }
.gl {
  --g: 28px; width: var(--g); height: var(--g); display: inline-grid; place-items: center; flex: none; border-radius: 0;
  font-size: 1rem; font-weight: 700; line-height: 1; font-style: normal; color: var(--ink);
}
.gl-bang { background: var(--ink); color: var(--paper); }
.gl-bang svg.i { width: 20px; height: 20px; vertical-align: 0; }
.pips .gl-bang svg.i { width: 18px; height: 18px; }
.gl-n { box-shadow: inset 0 0 0 1.5px var(--ink); }
.gl-n.d2 { font-size: 1rem; letter-spacing: 0; }
.gl-far { box-shadow: inset 0 0 0 1.5px var(--edge); }
.gl-far::after { content: ''; width: 10px; height: 2px; border-radius: 1px; background: var(--ink-2); }
.gl-todo { outline: 1.5px dotted var(--edge); outline-offset: -1.5px; }
.rcard .gl-bang { background: var(--card-ink); color: var(--card-face); }
.rcard .gl-n, .rcard .gl-far { box-shadow: inset 0 0 0 1.5px var(--card-ink); color: var(--card-ink); }
.rcard .gl-far::after { background: var(--card-ink); }

.res {
  display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 2px 8px; border-radius: 0;
  font-size: 1rem; font-weight: 600; line-height: 1.2; white-space: nowrap; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink);
}
.res.bang { background: var(--ink); color: var(--paper); box-shadow: none; }
.res.bang svg.i { width: 18px; height: 18px; }
.res.far { color: var(--ink-2); box-shadow: none; outline: 1.5px dashed var(--edge); outline-offset: -1.5px; }

/* ---------- home ---------- */

.dateline { font-size: 1rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink-2); margin-top: 10px; }
.hero { margin-top: 4px; }
.sub { color: var(--ink-2); margin-top: 6px; text-wrap: pretty; }
.sub.lede { font-size: 1rem; margin-top: 12px; }
.meta { text-align: left; font-size: 1rem; color: var(--ink-2); margin-top: 8px; text-wrap: pretty; }
.social { font-size: 1rem; font-weight: 600; color: var(--ink-2); margin-top: 10px; text-align: left; text-wrap: pretty; }
.recap { font-size: 1rem; color: var(--ink-2); margin-top: 4px; }
.recap-k { font-weight: 700; color: var(--ink); }
.foot { text-align: left; margin-top: 20px; }
.foot .link { color: var(--ink-2); font-weight: 600; font-size: 1rem; text-decoration: underline 1px currentColor; }

.banner { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 4px 4px 4px 12px; border: 2px solid var(--hairline); border-radius: 0; font-size: 1rem; }
.banner p { flex: 1; }
.banner.plain { padding: 12px; }
.banner.stack { flex-direction: column; align-items: stretch; gap: 4px; }
.banner .acts { display: flex; flex-wrap: wrap; gap: 4px 16px; }

.home-board { margin-top: 14px; padding: 14px 14px 16px; }
.hb-no { font-size: 1.75rem; line-height: 1; }
.cd { font-size: min(3.5rem, 16.5cqi); line-height: 1; text-align: center; margin: 10px 0 14px; letter-spacing: 0; }
.cd.mid { font-size: min(2.5rem, 14cqi); margin: 8px 0 12px; }
.home-board.done .cd { margin-bottom: 6px; }
.rcards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.rcard {
  position: relative; min-height: 88px; padding: 12px 8px 10px; border-radius: 6px; overflow: hidden;
  background: var(--card-face); color: var(--card-ink); border: 1.5px solid var(--edge); box-shadow: 0 2.5px 0 var(--edge);
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
}
.rc-name { font-size: 1rem; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.rc-chip { align-self: flex-start; display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 0; font-size: 1rem; font-weight: 600; line-height: 1.2; }
.rc-chip.next { background: var(--card-ink); color: var(--card-face); }
.rc-range { font-size: 1rem; font-weight: 600; line-height: 1.2; color: #4A4A4A; }
.rc-res { display: flex; align-items: center; gap: 6px; }
.rc-res b { font-size: 1.125rem; font-weight: 700; }

/* Done for today: the day as a column sum. */
.sum { margin-top: 14px; }
.sum-r { display: grid; grid-template-columns: 1fr auto 3.5ch; align-items: center; gap: 10px; min-height: 44px; font-size: 1.125rem; }
.sum-r b { text-align: right; font-weight: 700; }
.sum-t {
  position: relative; display: grid; grid-template-columns: 1fr auto 28px; align-items: center; gap: 8px; margin-top: 18px;
  font-size: 1.375rem; font-weight: 700;
}
.sum-t::before {
  content: ''; position: absolute; left: 0; right: 0; top: -12px; height: 8px;
  background: linear-gradient(var(--ink), var(--ink)) 0 0 / 100% 2px no-repeat,
              linear-gradient(var(--ink), var(--ink)) 4px 6px / calc(100% - 10px) 2px no-repeat;
}
.sum-t b { text-align: right; }
.sum-t svg.i { width: 26px; height: 26px; stroke-width: 2.4; }
.done-rank { display: block; margin: 12px 0 14px; font-size: 1rem; font-weight: 600; color: var(--ink-2); }
.done-rank:empty { margin: 0 0 14px; }

.streak { margin-top: 16px; padding-top: 2px; }
.sk-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sk-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tally { display: inline-grid; place-items: center; color: var(--ink); flex: none; }
.tally svg.i { width: 30px; height: 30px; display: block; }
.tally.dim { color: var(--edge); --strike-op: 0; }
.sk-n { font-size: 2.5rem; font-weight: 700; line-height: 1; }
.sk-l { font-size: 1rem; line-height: 1.2; }
.sk-best-big { font-size: 1.25rem; font-weight: 700; }
.sk-side { text-align: right; flex: none; }
.sk-best { font-size: 1rem; font-weight: 600; color: var(--ink-2); }
.rests { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 2px; }
.rests-l { font-size: 1rem; font-weight: 500; color: var(--ink-2); line-height: 1.2; }
.week { display: flex; gap: 8px; margin-top: 12px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 28px; }
.wd-l { font-size: 1rem; font-weight: 600; color: var(--ink-2); line-height: 1; }
.wd .dot { width: 26px; height: 26px; border-radius: 0; display: grid; place-items: center; font-size: 1rem; font-weight: 700; line-height: 1; color: var(--ink); }
.wd .dot svg.i { width: 22px; height: 22px; }
.wd.played .dot { box-shadow: inset 0 0 0 1.5px var(--ink); }
.wd.today .dot { box-shadow: inset 0 0 0 2px var(--ink); }
.wd.today .wd-l { color: var(--ink); font-weight: 700; }
.wd.missed .dot { box-shadow: inset 0 0 0 1.5px var(--edge); }
.wd.rest .dot { box-shadow: inset 0 0 0 1.5px var(--ink); }
.wd.future .dot { outline: 1.5px dashed var(--edge); outline-offset: -1.5px; }
.wd.off .dot { outline: 1.5px dotted var(--edge); outline-offset: -1.5px; }
.goal { margin-top: 10px; }
.goal-t { font-size: 1rem; color: var(--ink-2); margin-top: 10px; text-wrap: pretty; }
.goal .goal-t { margin-top: 0; }
.goal-t + .goal-t, .goal-t + .rests-l, .rests-l + .goal-t { margin-top: 4px; }
.goal-t b { color: var(--ink); }

.strip { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; }
.strip p { font-size: 1rem; font-weight: 600; color: var(--ink-2); line-height: 1.3; text-wrap: pretty; }
.faces { display: inline-flex; flex: none; }
.faces .face { margin-left: -6px; box-shadow: 0 0 0 2px var(--paper); font-size: 1rem; }
.faces .face:first-child { margin-left: 0; }
.faces.lg .face { margin-left: -4px; }
.face {
  width: 36px; height: 36px; border-radius: 999px; display: inline-grid; place-items: center; flex: none;
  font-size: 1rem; font-weight: 700; letter-spacing: 0; border: 2px solid var(--edge); color: var(--ink); background: var(--paper);
}
.face.played { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.face.xl { width: 44px; height: 44px; font-size: 1rem; }
.cc .faces .face { box-shadow: 0 0 0 2px var(--surface); }
#h-play { margin-top: 16px; }
.btn.primary + .byline { margin-top: 24px; }
.btn.primary + .meta, .btn.primary + p { margin-top: 12px; }
.strip + #h-play { margin-top: 0; }
.btn.primary + .btn { margin-top: 0; }

/* challenge card */
.cc { margin-top: 12px; padding: 14px; border-radius: 0; background: var(--surface); border: 2px solid var(--hairline); }
.cc-top { display: flex; align-items: center; gap: 12px; }
.cc-body { min-width: 0; }
.cc-h { font-size: 1.125rem; font-weight: 700; line-height: 1.25; text-wrap: pretty; }
.cc-res { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; font-size: 1rem; color: var(--ink-2); }
.cc-in { font-weight: 700; font-size: 1rem; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.cc-group { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.cc-group p { font-size: 1rem; color: var(--ink-2); }
.cc > .cc-h + .cc-group { margin-top: 10px; }

/* try one */
.tryone { margin-top: 16px; padding: 14px 14px 12px; display: flex; flex-direction: column; align-items: center; }
.tryone .led-label { align-self: flex-start; }
.try-target { font-size: 3.5rem; line-height: 1; margin: 2px 0 12px; min-height: 1em; display: flex; align-items: center; }
.try-bang { font-size: 2rem; color: var(--led-hot); }
.tryone.bang { animation: warm 200ms ease-in-out 2; }
.try-row { display: flex; align-items: center; gap: 10px; }
.try-sp { width: 6px; }
.card.sm { width: 72px; height: 64px; font-size: 2rem; }
.op.sm { width: 56px; height: 56px; }
.op.sm svg.i { width: 24px; height: 24px; }
.try-cap { margin-top: 12px; font-size: 1rem; color: var(--board-text); text-align: center; min-height: 2.9em; display: flex; align-items: center; }
.try-link { display: block; margin: 12px auto 0; }

/* ---------- results ---------- */

.score-panel { margin-top: 10px; padding: 12px 16px 16px; }
.sp-time { font-size: 1rem; color: var(--board-text); font-weight: 600; }
.sp-score { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin-top: 2px; }
.sp-score .num { font-size: min(4.5rem, 21cqi); line-height: 1; min-width: 3.3ch; text-align: right; }
.sp-pts { font-size: 1.375rem; font-weight: 700; color: var(--board-text); }
.sp-glyphs { display: flex; justify-content: center; margin-top: 8px; }
.r-head { font-size: 1.375rem; font-weight: 700; line-height: 1.2; margin-top: 12px; text-wrap: balance; }
.r-sub { font-size: 1.125rem; color: var(--ink-2); margin-top: 4px; text-wrap: pretty; }
.r-line { display: block; }
.r-ms { display: flex; align-items: center; gap: 8px; margin-top: 2px; color: var(--ink); font-weight: 600; }
.ms-tally { display: inline-grid; place-items: center; flex: none; color: var(--ink); }
.ms-tally svg.i { width: 26px; height: 26px; display: block; }
/* The milestone draws the tally's biro strike. */
.ms-tally.go { --strike-dash: 20; --strike-anim: strike 400ms ease-out both; }
@keyframes strike { from { stroke-dashoffset: 20; } to { stroke-dashoffset: 0; } }
.joined { margin-top: 8px; font-size: 1rem; font-weight: 600; color: var(--ink-2); }
.bubble {
  position: relative; margin: 12px 0 14px; padding: 10px 14px; border-radius: 16px 16px 4px 16px; background: var(--surface);
  border: 2px solid var(--hairline); font-size: 1rem; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere;
}
.bubble::before, .bubble::after { content: ''; position: absolute; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.bubble::before { right: -2px; bottom: -14px; width: 20px; height: 14px; background: var(--hairline); }
.bubble::after { right: 0; bottom: -10.4px; width: 15px; height: 10.5px; background: var(--surface); }
.bubble-url { font-size: 1rem; font-weight: 500; color: var(--ink-2); margin-top: 2px; }
.share-row { display: flex; justify-content: flex-start; gap: 16px; margin-top: 2px; }
.r-next { text-align: left; font-size: 1rem; font-weight: 600; color: var(--ink-2); margin-top: 4px; }
.r-next b { color: var(--ink); font-weight: 700; }

.claim { margin-top: 18px; padding: 16px 0 6px; border-top: 1px solid var(--hairline); }
.claim-h { margin-bottom: 10px; }
.claim-row { display: flex; gap: 8px; }
.claim-row input, #lg-name, .field {
  flex: 1; min-width: 0; height: 56px; padding: 0 14px; border-radius: 0; border: 2px solid var(--edge);
  background: var(--surface); color: var(--ink); font-size: 1.125rem; font-weight: 500;
}
.claim-row input::placeholder, #lg-name::placeholder, .field::placeholder { color: var(--ink-2); opacity: 1; }
#lg-name { width: 100%; margin: 6px 0 12px; }
.field { display: block; width: 100%; margin-top: 6px; }
.claim-row input:focus-visible, #lg-name:focus-visible, .field:focus-visible { outline: 3px solid var(--biro); outline-offset: 1px; }
.claim-row .btn { width: auto; min-height: 56px; padding: 0 20px; margin: 0; }
.claim-help { font-size: 1rem; color: var(--ink-2); margin-top: 8px; text-wrap: pretty; }
.claim .btn.text { margin: 4px 0 0; color: var(--ink-2); }
.claim-err { font-size: 1rem; margin-top: 8px; }
.claimed { position: relative; padding-left: 32px; font-size: 1.125rem; text-wrap: pretty; }
.claimed svg.i { position: absolute; left: 0; top: .1em; width: 24px; height: 24px; }

.sec { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--hairline); }
.sec:empty { display: none; }
.sec-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 12px; }
.sec-row .btn.text { flex: none; white-space: nowrap; }
.sec .soft { margin-top: 4px; }
.sec > .btn { margin-top: 12px; }

.league { margin-top: 8px; }
.lrow { display: grid; grid-template-columns: 22px 36px 1fr auto auto; align-items: center; gap: 10px; min-height: 56px; border-bottom: 1px solid var(--hairline); padding: 0 6px; }
.lrow:last-child { border-bottom: 0; }
.lrk { font-weight: 700; color: var(--ink-2); font-size: 1rem; text-align: center; font-variant-numeric: lining-nums tabular-nums; }
.lname { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; }
.lname b { min-width: 0; max-width: 100%; font-size: 1.125rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.lsc { font-size: 1.125rem; font-weight: 700; min-width: 2.6em; text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.lsc.todo { font-size: 1rem; font-weight: 500; color: var(--ink-2); }
.you { flex: none; font-size: 1rem; font-weight: 600; color: var(--ink-2); }
b.anon, .anon { color: var(--ink-2); font-weight: 600; }
.add-name { min-height: 0; padding: 0; font-size: 1rem; flex: 0 1 auto; min-width: 0; text-align: left; }
.lrow.me, .brow.me { background: var(--tint); box-shadow: inset 4px 0 0 var(--ink); }
.league-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
.league-foot p { flex: 1 1 100%; font-size: 1rem; color: var(--ink-2); font-weight: 600; }
.league-foot .btn.ink { flex: 1; }

.dist { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; height: 168px; margin-top: 14px; }
.db { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.db i { display: block; width: 100%; border-radius: 0; background: var(--edge); }
.db.mine i { background: var(--ink); }
.db-you { font-size: 1rem; font-weight: 700; color: var(--ink); line-height: 1.3; }
.db-l { font-size: 1rem; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.db.mine .db-l { color: var(--ink); font-weight: 700; }
.bang-rate { margin-top: 12px; }

.r-boost { display: flex; align-items: center; gap: 6px; font-size: 1rem; font-weight: 500; color: var(--ink-2); margin: -6px 0 10px; }
.r-boost .i { color: var(--accent, var(--ink)); }
.crack-r { padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.crack-r:last-child { border-bottom: 0; }
.crack-h { display: flex; align-items: center; gap: 6px 10px; font-size: 1.125rem; }
/* The round's name wraps inside its span, so the points never drop to their own line. */
.crack-h > span { flex: 1 1 auto; min-width: 0; }
.crack-pts { margin-left: auto; font-weight: 700; font-variant-numeric: lining-nums tabular-nums; }
.crack-sub { font-size: 1rem; color: var(--ink-2); margin: 4px 0 2px; text-wrap: pretty; }
.tomorrow .home-board { margin-top: 0; }
.tomorrow .btn { margin-top: 14px; }

/* ---------- leaderboards ---------- */

/* Tabs wrap rather than scroll, so a league tab is never hidden off the edge. */
.tabs-wrap { margin: 4px 0 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 6px; }
.pill { flex: none; min-height: 44px; padding: 0 16px; border-radius: 0; box-shadow: inset 0 0 0 2px var(--edge); font-size: 1rem; font-weight: 600; white-space: nowrap; }
.pill.on { background: var(--ink); color: var(--paper); box-shadow: none; font-weight: 700; }
.period { display: flex; gap: 20px; margin: 8px 0 4px; }
.period button { min-height: 44px; font-size: 1.125rem; font-weight: 600; color: var(--ink-2); border-bottom: 3px solid transparent; padding: 0 2px; }
.period button.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 700; }
.bd-body { min-height: 50vh; }
.bd-head { margin: 12px 0 6px; }
.lead { font-size: 1.125rem; margin: 14px 0 6px; text-wrap: pretty; }
.blist { margin-top: 4px; }
.brow { border-bottom: 1px solid var(--hairline); }
.brow:not(.town) { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px; min-height: 56px; padding: 6px 6px; }
.trow { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 6px; text-align: left; }
.trow:active { background: var(--tint); }
.rk { display: grid; place-items: center; font-weight: 700; font-size: 1.125rem; color: var(--ink-2); font-variant-numeric: lining-nums tabular-nums; }
.podium .rk span { width: 32px; height: 32px; border-radius: 999px; border: 2px solid var(--ink); display: grid; place-items: center; color: var(--ink); }
.brow:not(.podium) .rk span { min-width: 32px; text-align: center; }
.who { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.nm { display: flex; align-items: center; flex-wrap: wrap; gap: 0 6px; min-width: 0; }
.nm b { font-size: 1.125rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rsub { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 500; color: var(--ink-2); min-width: 0; }
.rsub span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.sc b { font-size: 1.125rem; font-weight: 700; font-variant-numeric: lining-nums tabular-nums; }
.avg { font-size: 1rem; font-weight: 500; color: var(--ink-2); }
.gap { font-size: 1rem; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.sep { display: flex; justify-content: center; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--hairline); }
.sep i { width: 5px; height: 5px; border-radius: 999px; background: var(--edge); }
.blist + .btn.text { margin: 8px 0 0; }
.invite { padding: 18px 0 4px; }
.invite .btn { margin-top: 14px; }
.wk { margin: 14px 0 4px; padding-bottom: 14px; border-bottom: 1px solid var(--hairline); }
.wk-h { font-size: 1.125rem; text-wrap: pretty; }
.wk-h b { font-weight: 700; }
.wk .week { margin: 10px 0 8px; }
.how { margin-top: 16px; }
.how summary {
  min-height: 44px; display: flex; align-items: center; color: var(--ink); font-weight: 600; font-size: 1rem; cursor: pointer; list-style: none;
  text-decoration: underline 2px var(--biro); text-underline-offset: 4px;
}
.how summary::-webkit-details-marker { display: none; }

/* ---------- sheets and toasts ---------- */

.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; animation: fade 250ms ease-out; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: relative; width: 100%; max-width: 30rem; max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); color: var(--ink); border-radius: 12px 12px 0 0;
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom)); animation: slide 250ms var(--ease-out);
}
.sheet:focus { outline: none; }
@keyframes slide { from { translate: 0 40px; opacity: .6; } }
.sheet-x { position: absolute; top: 10px; right: 10px; }
.sheet-h { font-size: 1.375rem; font-weight: 700; line-height: 1.2; margin-right: 44px; margin-bottom: 12px; text-wrap: balance; }
.sheet .btn { margin-top: 16px; }
.sheet .btn.primary + .btn { margin-top: 0; }
.sheet .soft { margin-top: 10px; }
.sheet .soft.small { font-size: 1rem; font-weight: 500; }
.rules { counter-reset: r; display: flex; flex-direction: column; gap: 12px; }
.rules li { counter-increment: r; position: relative; padding-left: 2rem; font-size: 1.125rem; }
.rules li::before {
  content: counter(r); position: absolute; left: 0; top: 0; width: 1.25rem; text-align: right; font-size: 1.125rem; font-weight: 700;
  color: var(--ink-2); background: none; border-radius: 0; line-height: inherit; display: block;
}
.example { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0 4px; }
.card.xs { min-width: 2.34em; height: 2em; padding: 0 .25em; font-size: 1.5rem; display: inline-grid; }
.ex-op { display: inline-grid; place-items: center; font-size: 1.75rem; font-weight: 700; line-height: 1; }
.ex-op svg.i { width: 24px; height: 24px; stroke-width: 3; }
/* The first game's intro: an example round playing itself. */
.sheet { container: sheet / inline-size; }
.demo { max-width: 18rem; margin: 14px auto 0; }
.demo-board { padding: 8px 12px 10px; border-radius: 16px; }
.demo-board .led-secs { font-size: 1.125rem; min-width: 0; }
.demo-target { justify-content: center; font-size: 2.5rem; margin: 2px 0 0; }
.demo-target.pulse { animation: glow 200ms ease-out; }
.demo-board.bang { animation: warm 200ms ease-in-out 2; }
.demo-board.bang .demo-target { color: var(--led-hot); text-shadow: 0 0 24px var(--led-glow), 0 0 8px var(--led-glow); }
.demo-tape { height: 48px; margin: 4px 0; padding: 0; }
.demo-tape .t-old { font-size: 1rem; }
.demo-tape .t-new { font-size: 1.125rem; }
.demo-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.demo-cards .card { height: 44px; font-size: 1.5rem; }
.demo-cards .card.sel { translate: 0 -2px; outline-width: 2px; }
.demo-res { min-height: 32px; margin-top: 10px; display: flex; justify-content: center; }
.demo-note { margin-top: 12px; }
#demo-again { min-height: 0; padding: 10px 4px; margin: -10px 0; }
.intro-foot { box-shadow: 0 -10px 12px var(--surface); position: sticky; bottom: calc(-24px - env(safe-area-inset-bottom)); margin: 8px -20px calc(-24px - env(safe-area-inset-bottom)); padding: 0 20px calc(16px + env(safe-area-inset-bottom)); background: var(--surface); }
@media (max-height: 680px) {
  .demo-cards .card { height: 38px; font-size: 1.25rem; }
  .demo-target { font-size: 2rem; }
}

.scoring { margin-top: 16px; padding: 8px 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.scoring .rl { min-height: 32px; }
.scoring .rl > span { flex: none; }
.scoring .rl b { text-align: right; text-wrap: balance; }
.byline { display: flex; align-items: center; gap: 12px; margin-top: 18px; font-size: 1rem; font-weight: 600; color: var(--ink-2); }
.byline .mark-sum { height: 40px; width: 38.9px; flex: none; }
/* The help byline's mark: drawn from a file when the span is empty, so the sprite version can replace it. */
.byline-mark:empty { display: block; flex: none; width: 38.9px; height: 40px; background: url(/mark-sum.svg) no-repeat center / contain; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .byline-mark:empty { background-image: url(/mark-sum-dark.svg); } }
:root[data-theme="dark"] .byline-mark:empty { background-image: url(/mark-sum-dark.svg); }
.set { padding: 14px 0; border-top: 1px solid var(--hairline); }
.set:first-of-type { border-top: 0; padding-top: 4px; }
.set-h { display: block; font-size: 1.125rem; font-weight: 700; margin-bottom: 8px; }
.set .btn { margin-top: 8px; }
.segctl { display: grid; grid-template-columns: 1.5fr 1fr 1fr; box-shadow: inset 0 0 0 2px var(--edge); border-radius: 0; padding: 4px; gap: 4px; }
.segctl button { min-height: 44px; border-radius: 0; font-weight: 600; font-size: 1rem; line-height: 1.15; padding: 4px; }
.segctl button.on { background: var(--ink); color: var(--paper); font-weight: 700; }
.segctl.two { grid-template-columns: 1fr 1fr; }
.set-leagues li { display: flex; align-items: center; gap: 4px; min-height: 52px; border-bottom: 1px solid var(--hairline); }
.set-leagues li > span { flex: 1; display: flex; flex-direction: column; }
.set-leagues .btn { margin-top: 0; }
/* A full-size touch target that doesn't open up the line it sits in. */
.you .link { min-height: 0; padding: 10px 4px; margin: -10px 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); translate: -50% 0; z-index: 60;
  display: flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100vw - 32px);
  padding: 12px 16px; border-radius: 0; background: var(--ink); color: var(--paper); font-size: 1rem; font-weight: 600;
  box-shadow: var(--lift); animation: fade 200ms ease-out;
}

/* ---------- small screens, big text ---------- */

@media (max-width: 360px) {
  .led-target, .sp-score .num { font-size: 4.25rem; }
  .card { height: 72px; }
  .op { height: 60px; }
  .rcards { gap: 8px; }
  .lrow { grid-template-columns: 18px 36px 1fr auto auto; gap: 6px; padding: 0 4px; }
  .lsc { min-width: 2em; }
  .pill { padding: 0 12px; }
  .tabs { gap: 6px; }
}
/* 'of 3' goes first on phones, so 'Brain-burner' and the score both fit. */
@media (max-width: 420px) { .rh-of { display: none; } }
@media (max-height: 650px) {
  .card { height: 72px; }
  .op { height: 60px; }
  .actions { margin-top: 18px; }
  .score-panel { margin-top: 6px; }
  .r-head { margin-top: 10px; }
  .bubble { margin-top: 10px; }
}
/* Large text. The query is in em on #app, so it reacts to the phone's text
   size as well as the screen: at 100% a 360px phone keeps three columns of
   cards; from about 125% text (or under ~300px) cards drop to two columns
   and wide rows stack, so nothing scrolls sideways at 200%. */
@container app (max-width: 17em) {
  /* Keep the round short enough to work, with the target and clock pinned. */
  #g-board { position: sticky; top: 0; z-index: 3; }
  .led.play { min-height: 0; padding: 8px 12px 22px; }
  .led-target { font-size: min(4.5rem, 20cqi); margin: 0 0 4px; }
  .led-secs { font-size: min(1.75rem, 9cqi); }
  .top { height: auto; min-height: 56px; flex-wrap: wrap; }
  .rh-l { flex-wrap: wrap; row-gap: 4px; }
  .rh-title { flex: 1 1 100%; }
  .tape { height: auto; min-height: 52px; }
  .face { width: 2.5em; height: 2.5em; }
  .face.xl { width: 2.75em; height: 2.75em; }
  .strip, .faces { flex-wrap: wrap; row-gap: 4px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .card { height: auto; min-height: 1.35em; padding: 6px 2px; font-size: min(2.25rem, 13cqi); }
  .op { height: auto; min-height: 64px; }
  .actions { grid-template-columns: 1fr 1fr; }
  .actions .btn.ink { grid-column: 1 / -1; }
  .rcards { grid-template-columns: 1fr; }
  .rcard { min-height: 0; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .try-row { flex-wrap: wrap; justify-content: center; }
  .sk-top { flex-wrap: wrap; }
  .sk-side { text-align: left; }
  .rests { justify-content: flex-start; }
  .week { flex-wrap: wrap; }
  .sum-r { grid-template-columns: 1fr auto; row-gap: 4px; padding: 4px 0; }
  .sum-r .res { grid-column: 1; grid-row: 2; justify-self: start; }
  .sum-r b { grid-column: 2; grid-row: 1 / span 2; }
  .res { white-space: normal; }
  .lrow { grid-template-columns: auto auto 1fr; padding: 6px; }
  .lrow .glyphs { grid-column: 3; }
  .lrow .lsc { grid-column: 3; text-align: left; }
  .brow:not(.town), .trow { grid-template-columns: auto 1fr; }
  .brow .sc, .trow .sc { grid-column: 2; align-items: flex-start; }
  .mini { flex-wrap: wrap; }
  .mini-r { align-items: flex-start; }
  .db-l { font-size: 1rem; }
  .db:nth-child(even):not(.mine) .db-l { visibility: hidden; max-width: 100%; overflow: hidden; }
  .dist { gap: 3px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .db:first-child { align-items: flex-start; }
  .db:last-child { align-items: flex-end; }
  .sp-score { flex-wrap: wrap; }
  .sp-score .num { min-width: 0; }
  .crack-h { flex-wrap: wrap; }
  .claim-row { flex-wrap: wrap; }
  .claim-row .btn { width: 100%; }
  .steps { grid-template-columns: auto auto 1fr; }
  .btn .stub { min-width: 0; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .view { animation: fade 100ms ease-out backwards !important; animation-duration: 100ms !important; }
  .scrim, .sheet { animation: fade 100ms ease-out !important; animation-duration: 100ms !important; }
  .card.flash, .op.flash { animation: oflash 300ms steps(1) !important; animation-duration: 300ms !important; }
  .led.play.bang .led-target { animation: near 300ms ease-out !important; animation-duration: 300ms !important; }
  .guide { animation: none !important; }
  .led-dots i { animation: none !important; opacity: .8; }
  .led.play.bang, .tryone.bang, .demo-board.bang { animation: none !important; background-color: var(--board-warm); }
  svg.pop { --dot-anim: none; }
  .ms-tally.go { --strike-anim: none; --strike-dash: none; }
}
/* The arcade: a way out of its rounds, its name in the round header, its place on home. */
.rh-x { flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin: -10px -12px -10px 4px; border: 0; background: none; color: var(--ink); cursor: pointer; }
.rh-x .i { width: 22px; height: 22px; }
.rh-arc { font-weight: 700; color: var(--ink); }
.h-arcade { margin-top: 28px; }
