:root {
  color-scheme: light;
  --paper: oklch(97.6% 0.012 80); --paper-2: oklch(94% 0.017 80); --paper-3: oklch(90% 0.023 80);
  --ink: oklch(27% 0.035 235); --ink-2: oklch(40% 0.035 235); --muted: oklch(51% 0.03 235);
  --rule: oklch(87% 0.022 80);
  --accent: oklch(60% 0.1 195); --accent-soft: oklch(92% 0.04 195); --accent-ink: oklch(32% 0.07 200);
  --target: oklch(67% 0.16 38); --band-1: oklch(91% 0.055 50); --band-2: oklch(83% 0.095 44); --target-ink: oklch(38% 0.12 35);
  --green: oklch(52% 0.12 160); --red: oklch(56% 0.18 28);
  --font: "Outfit", 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-2xl: 2.4rem; --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; }
h1, h2, p, ol, ul, fieldset { margin: 0; }
h1, h2 { font-weight: 800; 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-3) + var(--safe-t)); padding-bottom: calc(var(--s-5) + var(--safe-b)); }

.masthead h1 { font-size: var(--t-3xl); }
.mark { display: block; margin-top: var(--s-2); color: var(--ink); }
.mark__dot { fill: var(--target); }
.lead { margin-top: var(--s-3); color: var(--ink-2); font-size: var(--t-lg); line-height: 1.35; max-width: 30ch; 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; letter-spacing: 0; color: var(--ink-2); }
.opt { font-weight: 400; color: var(--muted); margin-left: var(--s-1); }
.note { font-size: var(--t-sm); color: var(--muted); text-wrap: pretty; }
.block > .note { margin-top: var(--s-2); }
.mode-note { min-height: 2.6em; }
.center { text-align: center; }
.center-self { align-self: center; }
.error { margin-top: var(--s-5); color: var(--red); 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; 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); }
.page--stage > .btn--big { margin-top: auto; }
.start { margin-top: var(--s-6); }
.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); }

.carry { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-5); padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4); border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-ink); }
.carry p { display: grid; font-size: var(--t-sm); line-height: 1.3; min-width: 0; }
.carry b { font-size: var(--t-md); }
.carry .btn { flex: none; }

.players { list-style: none; padding: 0; display: grid; gap: var(--s-2); margin-bottom: var(--s-2); counter-reset: p; }
.players:empty { display: none; }
.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, .team__name { 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, .team__name:hover { background: var(--paper-3); }
.player input:focus, .team__name:focus { background: var(--paper); box-shadow: inset 0 0 0 2px var(--accent); outline: none; }
.player input::placeholder, .team__name::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); }

.teams { display: grid; gap: var(--s-3); }
.team { display: grid; gap: var(--s-2); padding: var(--s-3); border-radius: var(--radius); box-shadow: inset 0 0 0 1.5px var(--rule); }
.team .players { margin-bottom: 0; }
.team__name { width: 100%; font-weight: 800; font-size: var(--t-lg); background: transparent; padding-inline: var(--s-2); }
.teams > .note { margin-top: 0; }

.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 235 / 0.14); }

.howto { margin-top: var(--s-6); border-radius: var(--radius); background: var(--paper-2); }
.howto summary { display: flex; align-items: center; min-height: 48px; padding: 0 var(--s-4); font-weight: 600; cursor: pointer; list-style: none; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary::after { content: "+"; margin-left: auto; font-size: var(--t-lg); color: var(--muted); }
.howto[open] summary::after { content: "−"; }
.rules { padding: 0 var(--s-4) var(--s-4) calc(var(--s-4) + 1.2em); display: grid; gap: var(--s-2); color: var(--ink-2); line-height: 1.4; }
.rules li::marker { color: var(--accent); font-weight: 800; }
.foot { margin-top: var(--s-5); font-size: var(--t-sm); color: var(--muted); }

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

.pair { display: grid; grid-template-columns: minmax(0, 1fr) 1.25rem minmax(0, 1fr); align-items: center; gap: var(--s-2); padding: var(--s-4); border-radius: var(--radius); background: var(--paper-2); font-size: var(--t-lg); font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; }
.pair span { overflow-wrap: break-word; hyphens: auto; }
.pair span:last-child { text-align: right; }
.pair i { height: 4px; border-radius: 2px; background: var(--rule); }

.card { position: relative; flex: 1; min-height: 220px; max-height: 360px; display: grid; place-items: center; padding: var(--s-5) var(--s-4); border: 0; border-radius: calc(var(--radius) + 6px); background: var(--ink); color: var(--paper); text-align: center; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: transform var(--dur) var(--ease); }
.card:active, .card.open { transform: scale(0.985); }
.card__cover { display: grid; justify-items: center; gap: var(--s-3); font-weight: 600; color: oklch(86% 0.02 235); }
.card__cover svg { color: var(--target); }
.card__face { display: grid; justify-items: stretch; gap: var(--s-4); width: 100%; }
.card__tag { font-size: var(--t-sm); font-weight: 600; color: var(--band-2); }
.card__sub { font-size: var(--t-sm); color: oklch(82% 0.02 235); text-wrap: pretty; }
.mini { display: grid; gap: var(--s-2); }
.mini__track { position: relative; display: block; height: 44px; border-radius: 12px; background: oklch(36% 0.035 235); overflow: hidden; }
.mini__ends { display: flex; justify-content: space-between; gap: var(--s-3); font-size: var(--t-sm); font-weight: 600; color: var(--paper); line-height: 1.2; }
.mini__ends span { max-width: 48%; text-align: left; }
.mini__ends span:last-child { text-align: right; }

/* the scale */
.scale { display: grid; gap: var(--s-2); margin-top: var(--s-4); }
.scale__rail { position: relative; height: 72px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.scale__track { position: absolute; inset: 14px 0 0; border-radius: 14px; overflow: hidden; background:
  repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), oklch(27% 0.035 235 / 0.1) calc(10% - 1px) 10%) 0 0 / calc(100% + 1px) 100%,
  linear-gradient(90deg, oklch(92% 0.035 225), oklch(95% 0.012 120) 50%, oklch(92% 0.045 60)); box-shadow: inset 0 0 0 1.5px oklch(27% 0.035 235 / 0.08); }
.scale__track::after { content: ""; position: absolute; left: 50%; top: 22%; bottom: 22%; width: 2px; margin-left: -1px; border-radius: 1px; background: oklch(27% 0.035 235 / 0.22); }
.scale__ends { display: flex; justify-content: space-between; gap: var(--s-4); font-size: var(--t-lg); font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; }
.scale__ends span { max-width: 48%; overflow-wrap: break-word; }
.scale__ends span:last-child { text-align: right; }
.hint { margin-top: var(--s-2); }

.marker { position: absolute; top: 0; bottom: -6px; left: 50%; width: 48px; margin-left: -24px; display: grid; justify-items: center; outline: none; cursor: grab; z-index: 2; }
.marker::before { content: ""; position: absolute; top: 18px; bottom: 0; width: 4px; margin-left: -2px; left: 50%; border-radius: 2px; background: var(--ink); }
.marker__head { position: relative; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 4px var(--paper), 0 2px 6px oklch(27% 0.035 235 / 0.25); transition: transform var(--dur) var(--ease); }
.marker__head::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--accent-soft); }
.marker:focus-visible .marker__head { box-shadow: 0 0 0 4px var(--paper), 0 0 0 6px var(--accent); }
.scale__rail.dragging .marker { cursor: grabbing; }
.scale__rail.dragging .marker__head { transform: scale(1.12); }
.marker--still { cursor: default; }
.scale__rail:has(.marker--still) { cursor: default; }

/* reveal bands */
.bands { position: absolute; inset: 0; }
.band { position: absolute; top: 0; bottom: 0; transform-origin: 50% 50%; animation: grow 520ms var(--ease) both; }
.band--2 { background: var(--band-1); }
.band--3 { background: var(--band-2); animation-delay: 80ms; }
.band--4 { background: var(--target); animation-delay: 160ms; }
.scale--reveal .scale__rail { height: 94px; }
.scale--reveal .scale__track { bottom: 22px; }
.scale--reveal .marker { bottom: 18px; }
.nums { position: absolute; left: 0; right: 0; bottom: 0; height: 18px; }
.band-num { position: absolute; bottom: 0; transform: translateX(-50%); font-size: 0.8125rem; font-weight: 800; line-height: 18px; color: var(--target-ink); font-variant-numeric: tabular-nums; animation: fade 400ms 360ms both; }
.band-num--4 { color: var(--target); }
.pin { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--paper); opacity: 0.85; animation: fade 400ms 300ms both; }

.outcome { font-size: var(--t-lg); font-weight: 600; line-height: 1.35; padding: var(--s-4) var(--s-5); border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-ink); text-wrap: pretty; }
.outcome.miss { background: var(--paper-2); color: var(--ink-2); }
.outcome.win { background: var(--band-1); color: var(--target-ink); }

.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
.calls { margin-top: auto; }

.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: 44px; padding: var(--s-2) var(--s-4); border-radius: 12px; background: var(--paper-2); font-variant-numeric: tabular-nums; }
.scores li > span:first-child { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.scores li b { font-weight: 800; }
.scores li.top { background: var(--accent-soft); }
.scores .plus { font-size: var(--t-sm); font-weight: 600; color: var(--green); margin-right: var(--s-2); }

.log { list-style: none; padding: 0; display: grid; gap: 2px; }
.log li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s-3); min-height: 40px; padding: var(--s-2) var(--s-4); border-radius: 12px; background: var(--paper-2); font-size: var(--t-sm); }
.log li span { color: var(--ink-2); overflow-wrap: anywhere; }
.log li small { display: block; color: var(--muted); font-size: 0.75rem; }
.log li b { font-weight: 800; font-variant-numeric: tabular-nums; }
.log li.p4 b { color: var(--target-ink); }
.stack { display: grid; gap: var(--s-2); margin-top: auto; padding-top: var(--s-3); }

@keyframes grow { from { transform: scaleX(0); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
@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: 2rem; } .pair, .scale__ends { font-size: 1.1rem; } }
@media (min-height: 760px) { .scale__rail { height: 84px; } .scale--reveal .scale__rail { height: 106px; } }

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