:root {
  color-scheme: light;
  --paper: oklch(97.8% 0.008 20); --paper-2: oklch(94.4% 0.014 20); --paper-3: oklch(90.5% 0.02 20);
  --ink: oklch(24% 0.03 330); --ink-2: oklch(40% 0.03 330); --muted: oklch(52% 0.025 330);
  --rule: oklch(88% 0.02 20);
  --accent: oklch(66% 0.17 5); --accent-soft: oklch(93% 0.04 5); --accent-ink: oklch(42% 0.14 5);
  --dot-2: oklch(76% 0.12 230); --dot-3: oklch(84% 0.13 95);
  --night: oklch(19% 0.025 300); --night-2: oklch(25% 0.03 300); --glow-ink: oklch(94% 0.01 300); --glow-muted: oklch(72% 0.03 300);
  --font: "Sora", 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.6rem; --t-2xl: 2.1rem; --t-3xl: 3.2rem;
  --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; }
body.playing { background: var(--night); overflow: hidden; overscroll-behavior: none; position: fixed; inset: 0; }
h1, h2, p, ul { margin: 0; }
h1, h2 { font-weight: 800; line-height: 1.02; letter-spacing: -0.03em; text-wrap: balance; overflow-wrap: break-word; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
[hidden] { display: none !important; }
.noscript { padding: var(--s-5); }

/* ---- home ---- */
.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)); }
.dots { display: flex; margin-bottom: var(--s-4); }
.dots span { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--paper); }
.dots span + span { margin-left: -10px; }
.dots span:nth-child(2) { background: var(--dot-2); }
.dots span:nth-child(3) { background: var(--dot-3); }
.masthead h1 { font-size: var(--t-3xl); }
.lead { margin-top: var(--s-3); color: var(--ink-2); font-size: var(--t-lg); line-height: 1.4; max-width: 30ch; text-wrap: pretty; }

.block { margin-top: var(--s-6); }
.label { display: block; margin-bottom: var(--s-2); font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); letter-spacing: 0; }
.quiet { margin-top: var(--s-3); text-align: center; font-size: var(--t-sm); color: var(--muted); }
.foot { margin-top: var(--s-6); font-size: var(--t-sm); color: var(--muted); text-wrap: pretty; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: var(--pill); background: var(--paper-2); }
.seg button { min-height: 48px; padding: var(--s-1) var(--s-2); border: 0; border-radius: var(--pill); background: transparent; font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); cursor: pointer; touch-action: manipulation; transition: background-color var(--dur) linear, color var(--dur) linear; }
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px oklch(30% 0.03 330 / 0.12), inset 0 0 0 1.5px var(--accent); }

.panel { margin-top: var(--s-3); padding: var(--s-4) var(--s-5); border-radius: var(--radius); background: var(--paper-2); color: var(--ink-2); text-wrap: pretty; min-height: 4.6em; }

.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; transition: background-color var(--dur) linear, transform var(--dur) var(--ease), opacity var(--dur) linear; }
.btn:hover { background: var(--paper-3); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--ink-2); }
.btn--wide { width: 100%; }
.btn--big { min-height: 60px; font-size: var(--t-lg); }
.block .btn--big { margin-top: var(--s-4); }
.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; }

/* ---- play: the whole screen takes fingers. No scrolling, zooming, selecting or callouts here. ---- */
.stage { position: fixed; inset: 0; overflow: hidden; background: radial-gradient(120% 80% at 50% 45%, var(--night-2), var(--night) 70%); color: var(--glow-ink); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; cursor: crosshair; }
.stage * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#field { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage__top { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: calc(var(--s-1) + var(--safe-t)) calc(var(--s-4) + var(--safe-r)) 0 calc(var(--s-4) + var(--safe-l)); pointer-events: none; }
.stage__top .link { pointer-events: auto; color: var(--glow-ink); text-decoration-color: currentColor; padding-inline: var(--s-2); margin-left: calc(var(--s-2) * -1); }
.step { font-size: var(--t-sm); color: var(--glow-muted); text-align: right; }
.stage__hint { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; justify-items: center; gap: var(--s-3); padding: var(--s-5); text-align: center; pointer-events: none; transition: opacity 200ms linear; }
.stage__word { font-size: var(--t-2xl); font-weight: 800; line-height: 1.05; letter-spacing: -0.03em; max-width: 12ch; text-wrap: balance; }
.stage__sub { font-size: var(--t-md); color: var(--glow-muted); max-width: 24ch; text-wrap: balance; }
.stage[data-state="hold"] .stage__hint, .stage[data-state="gather"] .stage__hint { opacity: 0.55; }
.stage__foot { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 0 var(--s-5) calc(var(--s-5) + var(--safe-b)); text-align: center; font-size: var(--t-sm); color: var(--glow-muted); pointer-events: none; }
.stage__foot:empty { display: none; }
.stage__bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: var(--s-1); padding: 0 var(--s-4) calc(var(--s-4) + var(--safe-b)); pointer-events: none; }
.stage__bar > * { pointer-events: auto; }
.stage__bar .link { color: var(--glow-muted); text-decoration-color: currentColor; padding-inline: var(--s-3); }
.stage__bar:not([hidden]) ~ .stage__foot, .stage__bar:not([hidden]) + .stage__foot { display: none; }
.btn--glow { min-width: 12rem; background: var(--glow-ink); color: var(--night); }
.btn--glow:hover { background: oklch(100% 0 0); }

.result { position: absolute; left: 50%; z-index: 2; width: min(22rem, calc(100% - 2 * var(--s-4))); transform: translateX(-50%); padding: var(--s-4) var(--s-5) var(--s-5); border-radius: var(--radius); background: var(--paper); color: var(--ink); box-shadow: 0 12px 40px oklch(10% 0.02 300 / 0.5); text-align: center; pointer-events: none; animation: pop 320ms var(--ease) both; }
.result.at-top { top: calc(var(--s-7) + var(--safe-t)); }
.result.at-bottom { bottom: calc(var(--s-7) + var(--s-4) + var(--safe-b)); }
.result.at-bottom.with-bar { bottom: calc(150px + var(--safe-b)); }
.result__kicker:empty { display: none; }
.result__kicker { font-size: var(--t-sm); font-weight: 600; color: var(--accent-ink); }
.result__text { margin-top: var(--s-1); font-size: var(--t-xl); font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; overflow-wrap: break-word; }
.result__note { margin-top: var(--s-2); color: var(--ink-2); text-wrap: pretty; }
.result__note:empty { display: none; }
.teams { list-style: none; padding: 0; margin-top: var(--s-3); display: grid; gap: var(--s-2); text-align: left; }
.teams li { display: flex; align-items: center; gap: var(--s-3); min-height: 44px; padding: var(--s-1) var(--s-4); border-radius: 12px; background: var(--paper-2); font-weight: 600; }
.teams li b { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.swatch { width: 22px; height: 22px; flex: none; border-radius: 50%; }
.swatch--a { background: #ff5f87; }
.swatch--b { background: transparent; box-shadow: inset 0 0 0 6px #3fb6f0; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 12px) scale(0.96); } to { opacity: 1; transform: translateX(-50%); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 22.5rem) { :root { --t-3xl: 2.7rem; --t-2xl: 1.8rem; --t-xl: 1.4rem; } .seg button { font-size: 0.8rem; } }

/* 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; }
