:root {
  color-scheme: light;
  --paper: oklch(98% 0.007 30); --paper-2: oklch(94.6% 0.014 25); --paper-3: oklch(91% 0.02 25);
  --card: oklch(99.6% 0.003 30);
  --ink: oklch(26% 0.03 10); --ink-2: oklch(41% 0.03 10); --muted: oklch(53% 0.025 15);
  --rule: oklch(88.5% 0.02 20);
  --accent: oklch(64% 0.15 8); --accent-soft: oklch(94.2% 0.035 8); --accent-ink: oklch(42% 0.13 8);
  --group: oklch(94% 0.035 295); --group-line: oklch(70% 0.11 295); --group-ink: oklch(40% 0.11 295);
  --font: "Nunito", 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.25rem; --t-xl: 1.6rem; --t-q: 1.85rem; --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; }
h1, h2, p, ol, ul { margin: 0; }
h1, h2 { font-weight: 900; line-height: 1.02; letter-spacing: -0.02em; 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-5) + 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.06em; border-radius: 50%; background: var(--accent); }
.lead { margin-top: var(--s-2); color: var(--ink-2); font-size: var(--t-lg); line-height: 1.35; 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: 700; color: var(--ink-2); }
.note { font-size: var(--t-sm); color: var(--muted); text-wrap: pretty; }
.foot { margin-top: var(--s-6); display: grid; gap: var(--s-2); font-size: var(--t-sm); color: var(--muted); text-wrap: pretty; }
.quiet-line { color: var(--ink-2); font-weight: 700; }

.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: 700; 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), opacity var(--dur) linear; }
@media (hover: hover) { .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); }
@media (hover: hover) { .btn--primary:hover { background: var(--ink-2); } }
.btn--sip { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1.5px var(--accent); }
@media (hover: hover) { .btn--sip:hover { background: oklch(91% 0.05 8); } }
.btn--quiet { background: transparent; box-shadow: inset 0 0 0 1.5px var(--rule); }
@media (hover: hover) { .btn--quiet:hover { background: var(--paper-2); } }
.btn--quiet.is-armed { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent-ink); }
.btn--wide { width: 100%; }
.btn--big { min-height: 64px; font-size: var(--t-lg); }
.link { background: none; border: 0; min-height: 44px; padding: var(--s-2) 0; font-size: var(--t-sm); font-weight: 700; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 0.25em; cursor: pointer; touch-action: manipulation; }
@media (hover: hover) { .link:hover { color: var(--ink); } }
.link--center { justify-self: center; padding-inline: var(--s-4); }

.stack { display: grid; gap: var(--s-2); }
.stack--home { margin-top: var(--s-6); }

/* players */
.players { list-style: none; padding: 0; display: grid; gap: var(--s-2); margin-bottom: var(--s-2); counter-reset: p; }
.player { display: flex; align-items: center; gap: var(--s-2); counter-increment: p; }
.player::before { content: counter(p); width: 1.4em; 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); }
@media (hover: hover) { .player input:hover { background: var(--paper-3); } }
.player input:focus { background: var(--card); 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; }
@media (hover: hover) { .remove:hover { background: var(--paper-2); color: var(--ink); } }
.remove:disabled { visibility: hidden; }
#players-note:empty { display: none; }
#players-note { margin-top: var(--s-2); }

/* packs */
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-2); }
.chip { min-height: 44px; padding: var(--s-1) var(--s-4); border: 0; border-radius: var(--pill); background: var(--paper-2); font-size: var(--t-sm); font-weight: 700; cursor: pointer; touch-action: manipulation; transition: background-color var(--dur) linear; }
@media (hover: hover) { .chip:hover { background: var(--paper-3); } }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1.5px var(--accent); }

/* turn */
.topline { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 44px; margin-top: calc(var(--s-3) * -1); }
.step { flex: 1; font-size: var(--t-sm); color: var(--muted); font-variant-numeric: tabular-nums; text-align: center; }
.kicker { font-size: var(--t-sm); font-weight: 700; color: var(--ink-2); margin-top: var(--s-1); }
.name { font-size: var(--t-3xl); margin-top: calc(var(--s-3) * -1); overflow-wrap: anywhere; }
.name--small { font-size: var(--t-xl); margin-top: calc(var(--s-2) * -1); }

.card { flex: 1; display: flex; flex-direction: column; gap: var(--s-3); min-height: 16rem; padding: var(--s-5); border-radius: var(--radius); background: var(--card); box-shadow: inset 0 0 0 1.5px var(--rule), 0 14px 30px -22px oklch(30% 0.05 10 / 0.5); }
.card.is-new { animation: card-in 260ms var(--ease); }
@keyframes card-in { from { opacity: 0; transform: translateY(10px) scale(0.985); } }
.card__pack { align-self: flex-start; padding: 2px var(--s-3); border-radius: var(--pill); background: var(--paper-2); font-size: var(--t-sm); font-weight: 700; color: var(--ink-2); }
.card__q { flex: 1; display: flex; align-items: center; font-size: var(--t-q); font-weight: 900; line-height: 1.18; letter-spacing: -0.012em; text-wrap: balance; overflow-wrap: break-word; }
.card__how { font-size: var(--t-md); font-weight: 700; color: var(--ink-2); text-wrap: pretty; }
.card__how:empty { display: none; }
.sips { display: flex; align-items: center; gap: var(--s-2); font-size: var(--t-md); font-weight: 700; color: var(--accent-ink); }
.sips .dots { display: inline-flex; gap: 5px; }
.sips .dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--accent); }
.sips .dot.on { background: var(--accent); }

.card.is-group { background: var(--group); box-shadow: inset 0 0 0 1.5px var(--group-line), 0 14px 30px -22px oklch(30% 0.05 295 / 0.5); }
.card.is-group .card__pack { background: oklch(100% 0 0 / 0.6); color: var(--group-ink); }
.card.is-group .card__how { color: var(--group-ink); }

.picks { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.pick { min-height: 44px; padding: var(--s-1) var(--s-4); border: 0; border-radius: var(--pill); background: oklch(100% 0 0 / 0.7); color: var(--group-ink); font-size: var(--t-md); font-weight: 700; cursor: pointer; touch-action: manipulation; overflow-wrap: anywhere; max-width: 100%; }
@media (hover: hover) { .pick:hover { background: oklch(100% 0 0 / 0.95); } }
.pick[aria-pressed="true"] { background: var(--group-ink); color: var(--paper); }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.pair .btn { padding-inline: var(--s-3); }

/* scores */
.ranking { list-style: none; padding: 0; display: grid; gap: var(--s-2); }
.ranking li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--s-1) var(--s-3); padding: var(--s-3) var(--s-4); border-radius: 14px; background: var(--paper-2); }
.ranking li.top { background: var(--accent-soft); }
.ranking .who { font-weight: 900; font-size: var(--t-lg); line-height: 1.2; overflow-wrap: anywhere; min-width: 0; }
.ranking .nums { display: flex; gap: var(--s-3); font-variant-numeric: tabular-nums; font-size: var(--t-sm); color: var(--ink-2); white-space: nowrap; }
.ranking .nums b { font-size: var(--t-lg); font-weight: 900; color: var(--ink); }
.ranking .nums .drank b { color: var(--accent-ink); }
.ranking .bar { grid-column: 1 / -1; display: flex; height: 8px; border-radius: var(--pill); overflow: hidden; background: oklch(100% 0 0 / 0.6); }
.ranking .bar span { display: block; height: 100%; }
.ranking .bar .a { background: var(--ink-2); }
.ranking .bar .d { background: var(--accent); }
.ranking .sub { grid-column: 1 / -1; font-size: var(--t-sm); color: var(--muted); }
#scores .stack { margin-top: auto; padding-top: var(--s-3); }
#sc-note:empty { display: none; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 22.6rem) { :root { --t-3xl: 2.5rem; --t-q: 1.6rem; } .card { padding: var(--s-4); } }
@media (min-height: 760px) { :root { --t-q: 2.2rem; } }
@media (max-width: 22.6rem) and (min-height: 760px) { :root { --t-q: 1.85rem; } }

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