:root {
  color-scheme: light;
  --paper: oklch(97.6% 0.012 78); --paper-2: oklch(94% 0.02 74); --paper-3: oklch(89.5% 0.03 70);
  --ink: oklch(27% 0.035 48); --ink-2: oklch(41% 0.035 48); --muted: oklch(52% 0.03 52);
  --rule: oklch(88% 0.025 68);
  --accent: oklch(75% 0.14 58); --accent-2: oklch(70% 0.15 52); --accent-soft: oklch(92.5% 0.05 72); --accent-ink: oklch(33% 0.08 50);
  --hot: oklch(53% 0.18 33); --hot-2: oklch(47% 0.17 32);
  --font: "Fredoka", system-ui, sans-serif;
  --radius: 18px; --pill: 999px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px;
  --t-sm: 0.875rem; --t-md: 1rem; --t-lg: 1.2rem; --t-xl: 1.5rem; --t-2xl: 2.1rem; --t-3xl: 3rem;
  --dur: 140ms; --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --page: 30rem;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { margin: 0; min-height: 100dvh; background: var(--paper); color: var(--ink); font: 400 var(--t-md)/1.5 var(--font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: clip; transition: background-color 220ms linear; }
body.is-boom { background: var(--hot); }
h1, h2, h3, p, ol, ul, fieldset { margin: 0; }
h1, h2 { font-weight: 700; line-height: 1.02; letter-spacing: -0.01em; text-wrap: balance; overflow-wrap: break-word; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
[hidden] { display: none !important; }
.noscript { padding: var(--s-5); }

.page { max-width: var(--page); margin-inline: auto; padding: calc(var(--s-6) + var(--safe-t)) calc(var(--s-4) + var(--safe-r)) calc(var(--s-7) + var(--safe-b)) calc(var(--s-4) + var(--safe-l)); }
.page--stage { min-height: 100dvh; display: flex; flex-direction: column; gap: var(--s-4); padding-top: calc(var(--s-3) + var(--safe-t)); padding-bottom: calc(var(--s-5) + var(--safe-b)); }

.masthead h1 { font-size: var(--t-3xl); }
.masthead h1::after { content: ""; display: inline-block; width: 0.2em; height: 0.2em; margin-left: 0.08em; border-radius: 50%; background: var(--accent-2); }
.lead { margin-top: var(--s-2); color: var(--ink-2); font-size: var(--t-lg); line-height: 1.35; max-width: 34ch; text-wrap: pretty; }

.block { border: 0; padding: 0; min-width: 0; margin-top: var(--s-6); }
.label { display: block; padding: 0; margin-bottom: var(--s-2); font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); }
.label .opt { font-weight: 400; color: var(--muted); }
.note { font-size: var(--t-sm); color: var(--muted); text-wrap: pretty; }
.note:not(:empty) { margin-top: var(--s-2); }
.error { margin-top: var(--s-5); color: var(--hot); font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 48px; padding: var(--s-2) var(--s-5); border: 0; border-radius: var(--pill); background: var(--paper-2); color: var(--ink); font-weight: 600; font-size: var(--t-md); cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; transition: background-color var(--dur) linear, transform var(--dur) var(--ease); }
.btn:hover { background: var(--paper-3); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--ink-2); }
.btn--quiet { background: transparent; box-shadow: inset 0 0 0 1.5px var(--rule); }
.btn--quiet:hover { background: var(--paper-2); }
.btn--wide { width: 100%; }
.btn--big { min-height: 60px; font-size: var(--t-lg); }
.btn--fire { min-height: 84px; margin-top: auto; background: var(--accent); color: var(--ink); font-size: var(--t-xl); -webkit-touch-callout: none; }
.btn--fire:hover { background: var(--accent-2); }
.btn--fire:active { transform: scale(0.97); }
.link { background: none; border: 0; min-height: 44px; padding: var(--s-2) 0; font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 0.25em; cursor: pointer; }
.link:hover { color: var(--ink); }

.players { list-style: none; padding: 0; display: grid; gap: var(--s-2); counter-reset: p; }
.players:not(:empty) { margin-bottom: var(--s-2); }
.player { display: flex; align-items: center; gap: var(--s-2); counter-increment: p; }
.player::before { content: counter(p); width: 1.6em; flex: none; text-align: right; font-size: var(--t-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.player input { flex: 1; min-width: 0; min-height: 48px; padding: var(--s-2) var(--s-4); border: 0; border-radius: var(--pill); background: var(--paper-2); font-size: var(--t-md); }
.player input:hover { background: var(--paper-3); }
.player input:focus { background: var(--paper); box-shadow: inset 0 0 0 2px var(--accent); outline: none; }
.player input::placeholder { color: var(--muted); }
.remove { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.remove:hover { background: var(--paper-2); color: var(--ink); }

.segments { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--s-1); padding: var(--s-1); border-radius: var(--pill); background: var(--paper-2); }
.segments button { min-height: 44px; padding: var(--s-1) var(--s-2); border: 0; border-radius: var(--pill); background: transparent; font-weight: 600; cursor: pointer; touch-action: manipulation; transition: background-color var(--dur) linear; }
.segments button:hover { background: var(--paper-3); }
.segments button[aria-pressed="true"] { background: var(--paper); box-shadow: 0 1px 3px oklch(27% 0.035 48 / 0.16); }

.toggles { margin: var(--s-5) 0; }
.toggle { display: flex; align-items: center; gap: var(--s-3); min-height: 48px; cursor: pointer; }
.toggle input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--ink); }

.scores { list-style: none; padding: 0; display: grid; gap: 2px; }
.scores li { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); min-height: 40px; padding: var(--s-2) var(--s-3); border-radius: 10px; background: var(--paper-2); font-variant-numeric: tabular-nums; }
.scores li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.scores li b { font-weight: 700; }
.scores li.top { background: var(--accent-soft); }
.scores li .plus { font-size: var(--t-sm); font-weight: 600; color: var(--hot); margin-right: var(--s-2); }
#scores-block .link { margin-top: var(--s-2); }
.rules { padding-left: 1.3em; display: grid; gap: var(--s-1); color: var(--ink-2); }
.rules li::marker { color: var(--accent-2); font-weight: 700; }
.foot { margin-top: var(--s-6); font-size: var(--t-sm); color: var(--muted); }

/* play */
.topline { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); min-height: 44px; }
.topline #pause { margin-right: auto; }
.prompt { flex: 1; min-height: 300px; max-height: 560px; display: grid; place-items: center; padding: var(--s-5); border-radius: var(--radius); background: var(--paper-2); text-align: center; }
.prompt > div { display: grid; justify-items: center; gap: var(--s-3); width: 100%; }
.prompt.pop .prompt__live { animation: pop 200ms var(--ease) both; }
.prompt__title { font-size: var(--t-2xl); font-weight: 700; line-height: 1.05; }
.prompt__sub { max-width: 28ch; color: var(--ink-2); text-wrap: pretty; }
.prompt__cat { font-size: var(--t-2xl); font-weight: 600; line-height: 1.12; letter-spacing: -0.01em; text-wrap: balance; overflow-wrap: break-word; max-width: 14ch; }
.prompt__with { font-size: var(--t-sm); font-weight: 500; color: var(--muted); margin-top: var(--s-2); }
.prompt__letter { width: 7.5rem; height: 7.5rem; display: grid; place-items: center; border-radius: 50%; background: var(--paper); box-shadow: inset 0 0 0 3px var(--accent); color: var(--ink); font-size: 4.6rem; font-weight: 700; line-height: 1; }
.prompt__letter.any { width: auto; height: auto; padding: var(--s-2) var(--s-5); border-radius: var(--pill); font-size: var(--t-lg); font-weight: 600; }
.spud { margin-bottom: var(--s-1); }

/* boom */
#boom { color: var(--paper); }
.boom__head { margin-top: var(--s-6); text-align: center; animation: thump 520ms var(--ease) both; }
.boom__word { font-size: clamp(4.5rem, 26vw, 7.5rem); line-height: 0.9; letter-spacing: -0.02em; }
.boom__word::after { content: ""; display: inline-block; width: 0.16em; height: 0.16em; margin-left: 0.06em; border-radius: 50%; background: var(--accent); }
.boom__line { margin: var(--s-3) auto 0; max-width: 24ch; font-size: var(--t-lg); line-height: 1.3; font-weight: 500; text-wrap: balance; }
.boom__meta { margin-top: var(--s-2); font-size: var(--t-sm); color: oklch(92% 0.04 40); }
.boom__body { flex: 1; display: flex; flex-direction: column; gap: var(--s-5); margin-top: var(--s-3); }
#boom .label { color: oklch(93% 0.035 40); }
.picks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
.pick { min-height: 56px; padding: var(--s-2) var(--s-3); border: 0; border-radius: var(--radius); background: oklch(100% 0 0 / 0.14); color: var(--paper); font-size: var(--t-lg); font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; cursor: pointer; touch-action: manipulation; transition: background-color var(--dur) linear; }
.pick:hover { background: oklch(100% 0 0 / 0.22); }
.pick[aria-pressed="true"] { background: var(--paper); color: var(--hot-2); }
#boom .scores li { background: oklch(100% 0 0 / 0.12); }
#boom .scores li.top { background: oklch(100% 0 0 / 0.24); }
#boom .scores li .plus { color: var(--accent-soft); }
.stack { display: grid; gap: var(--s-2); margin-top: auto; padding-top: var(--s-3); }
.btn--light { background: var(--paper); color: var(--ink); }
.btn--light:hover { background: var(--paper-2); }
.btn--ghost { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 1.5px oklch(100% 0 0 / 0.45); }
.btn--ghost:hover { background: oklch(100% 0 0 / 0.12); }
#boom :focus-visible { outline-color: var(--paper); }

@keyframes pop { from { opacity: 0.3; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes thump { 0% { transform: scale(0.7); opacity: 0; } 60% { transform: scale(1.06); opacity: 1; } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 22.5rem) { :root { --t-3xl: 2.6rem; --t-2xl: 1.85rem; } .prompt__letter { width: 6.5rem; height: 6.5rem; font-size: 4rem; } }
@media (max-height: 640px) { .prompt { min-height: 240px; } .prompt__letter { width: 5.5rem; height: 5.5rem; font-size: 3.4rem; } .spud { width: 64px; height: 64px; } }

/* back to games.el.zone, on the home screen only */
.back-home { display: inline-flex; align-items: center; gap: 2px; align-self: flex-start; min-height: 44px; margin: -12px 0 4px -6px; padding: 0 10px 0 4px; border-radius: 999px; color: inherit; opacity: 0.6; font-size: 0.875rem; font-weight: 600; line-height: 1; text-decoration: none; transition: opacity 140ms linear; }
.back-home:hover, .back-home:focus-visible { opacity: 1; }
.back-home svg { flex: none; }
