/* Turf — brutalist UI (white mode first, dark mode supported).
 * Fonts: Space Grotesk + JetBrains Mono (self-hosted, OFL-1.1).
 */
@font-face {
  font-family: 'Space Grotesk';
  src: url('fonts/space-grotesk.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fafafa;
  --paper: #ffffff;
  --ink: #0a0a0a;
  --line: #0a0a0a;
  --muted: #555555;
  --soft: #ececec;
  --soft-2: #dedede;
  --accent: #cafc03;
  --accent-ink: #0a0a0a;
  --blue: #0066ff;
  --red: #ff3333;
  --green: #00e05a;
  --yellow: #ffd400;
  --shadow: #0a0a0a;
  --bw: 3px;
  --sh: 4px;
  --sh-lg: 6px;
  --font: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  /* Browsers (e.g. DuckDuckGo on Android) can report system-bar insets inside a normal tab;
     only reserve them when Turf runs as an installed app. */
  --safe-top: 0px;
  --safe-bottom: 0px;
  --nav-h: 64px;
  color-scheme: light;
}
@media (display-mode: standalone), (display-mode: fullscreen) {
  :root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
  }
}
[data-theme='dark'] {
  --bg: #0a0a0a;
  --paper: #121212;
  --ink: #fafafa;
  --line: #fafafa;
  --muted: #a6a6a6;
  --soft: #1c1c1c;
  --soft-2: #2a2a2a;
  --shadow: #fafafa;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) and (pointer: fine) { body { cursor: crosshair; } a, button, summary, label { cursor: pointer; } }
::selection { background: var(--accent); color: var(--accent-ink); }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
code, .mono { font-family: var(--mono); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--ink); }

/* ------------------------------------------------------------ typography */
.kicker {
  margin: 0;
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.muted { color: var(--muted); }
.h1 { margin: 0; font-size: clamp(2rem, 9vw, 3.4rem); line-height: .95; letter-spacing: -.04em; text-transform: uppercase; }
.h2 { margin: 0; font-size: 1.15rem; letter-spacing: -.01em; text-transform: uppercase; }
.h3 { margin: 0; font-size: .95rem; text-transform: uppercase; letter-spacing: .02em; }
.hint { margin: 0; font-size: .85rem; color: var(--muted); }
.err { margin: 0; color: var(--red); font-weight: 700; font-size: .9rem; min-height: 0; }
.err:empty { display: none; }
.stroke { -webkit-text-stroke: 3px var(--ink); color: transparent; }
.wordmark {
  position: relative;
  margin: 0;
  display: inline-flex;
  align-items: flex-end;
  font-size: clamp(4.2rem, 24vw, 8rem);
  font-weight: 700;
  line-height: .8;
  letter-spacing: -.06em;
  text-transform: uppercase;
}
.wordmark .stroke { -webkit-text-stroke: clamp(2px, .7vw, 4px) var(--ink); }
.wordmark .tally {
  width: .5em;
  height: .62em;
  margin: 0 0 .06em .14em;
  background:
    linear-gradient(var(--ink), var(--ink)) 0 0 / .07em 100% no-repeat,
    linear-gradient(var(--ink), var(--ink)) .14em 0 / .07em 100% no-repeat,
    linear-gradient(var(--ink), var(--ink)) .28em 0 / .07em 100% no-repeat,
    linear-gradient(var(--ink), var(--ink)) .42em 0 / .07em 100% no-repeat;
  position: relative;
}
.wordmark .tally::after {
  content: '';
  position: absolute;
  left: -.08em;
  right: -.08em;
  top: 50%;
  height: .08em;
  background: var(--accent);
  border: 2px solid var(--ink);
  transform: rotate(-28deg);
}

/* ------------------------------------------------------------------ ticker */
.ticker {
  overflow: hidden;
  white-space: nowrap;
  border-block: var(--bw) solid var(--line);
  background: var(--accent);
  color: var(--accent-ink);
}
.ticker-track {
  display: inline-flex;
  gap: 1.1rem;
  padding: .45rem 0;
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  animation: marquee 38s linear infinite;
}
.ticker-track b { font-weight: 800; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ----------------------------------------------------------------- buttons */
.btn {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 48px;
  padding: .6rem 1.05rem;
  border: var(--bw) solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  font-size: .92rem;
  letter-spacing: .05em;
  line-height: 1.1;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: var(--sh) var(--sh) 0 var(--shadow);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform .05s ease-out, box-shadow .05s ease-out, background-color .12s;
}
.btn:active:not(:disabled), .btn.is-pressed {
  transform: translate(var(--sh), var(--sh));
  box-shadow: 0 0 0 var(--shadow);
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) { background: var(--accent); color: var(--accent-ink); }
  .btn-primary:hover:not(:disabled) { background: var(--ink); color: var(--bg); }
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-danger { background: var(--red); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-flat { box-shadow: none; }
.btn-flat:active:not(:disabled) { transform: none; background: var(--accent); color: var(--accent-ink); }
.btn-block { width: 100%; }
.btn-xl { min-height: 64px; font-size: 1.15rem; letter-spacing: .06em; }
.btn-sm { min-height: 38px; padding: .3rem .7rem; font-size: .76rem; box-shadow: 3px 3px 0 var(--shadow); }
.btn-sm:active:not(:disabled) { transform: translate(3px, 3px); }
.btn-icon { width: 48px; min-width: 48px; padding: 0; }
.btn-icon svg { width: 22px; height: 22px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-spin { display: none; width: 1em; height: 1em; }
.btn.is-busy .btn-spin { display: block; animation: spin .7s steps(4) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.theme-btn { gap: .45rem; }
.theme-dot {
  width: 14px; height: 14px;
  border: 2px solid var(--line);
  background: linear-gradient(135deg, var(--paper) 50%, var(--ink) 50%);
}

/* ------------------------------------------------------------------ inputs */
.field { display: grid; gap: .35rem; }
.label {
  display: block;
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: .55rem .75rem;
  border: var(--bw) solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 1rem;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--muted); opacity: .8; }
.input:focus { outline: none; box-shadow: var(--sh) var(--sh) 0 var(--accent); }
[data-theme='dark'] .input:focus { box-shadow: var(--sh) var(--sh) 0 var(--accent); }
input[type='number'] { -moz-appearance: textfield; }
input[type='number']::-webkit-inner-spin-button, input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.stack { display: grid; gap: .8rem; }
.stack-sm { display: grid; gap: .5rem; }
.row { display: flex; align-items: center; gap: .6rem; }
.row-wrap { display: flex; flex-wrap: wrap; gap: .5rem; }
.grow { flex: 1 1 auto; min-width: 0; }
.spacer { flex: 1; }

.card {
  background: var(--paper);
  border: var(--bw) solid var(--line);
  box-shadow: var(--sh-lg) var(--sh-lg) 0 var(--shadow);
  padding: 1rem;
}
.card-flat { box-shadow: none; }
.alert { border: var(--bw) solid var(--line); padding: .7rem .8rem; font-weight: 700; font-size: .9rem; }
.alert-err { background: var(--red); color: #fff; }
.alert-ok { background: var(--green); color: #0a0a0a; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  width: fit-content;
  margin: 0;
  padding: .14rem .4rem;
  border: 2px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .1em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-warn { background: var(--yellow); color: #0a0a0a; border-color: #0a0a0a; }
.badge-out { background: var(--red); color: #fff; }
.badge-ok { background: var(--green); color: #0a0a0a; border-color: #0a0a0a; }
.badge-ink { background: var(--ink); color: var(--bg); }
.badge-accent { background: var(--accent); color: var(--accent-ink); border-color: #0a0a0a; }

.divider { display: flex; align-items: center; gap: .6rem; margin: .2rem 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: var(--bw); background: var(--line); }
.divider span { font-family: var(--mono); font-size: .66rem; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }

.seg { display: flex; border: var(--bw) solid var(--line); background: var(--paper); }
.seg button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 46px;
  padding: .4rem .3rem;
  border: 0;
  border-right: var(--bw) solid var(--line);
  background: transparent;
  font-weight: 700;
  font-size: .74rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1.1;
  touch-action: manipulation;
}
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.seg button:disabled { opacity: .35; }

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 52px;
  padding: .5rem 0;
  border-bottom: 2px solid var(--soft-2);
}
.switch:last-child { border-bottom: 0; }
.switch .txt { min-width: 0; }
.switch .txt b { display: block; font-size: .92rem; text-transform: uppercase; letter-spacing: .02em; }
.switch .txt span { display: block; font-size: .8rem; color: var(--muted); }
.toggle {
  flex: 0 0 auto;
  position: relative;
  width: 64px;
  height: 34px;
  border: var(--bw) solid var(--line);
  background: var(--soft);
  padding: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: var(--ink);
  transition: transform .12s;
}
.toggle[aria-checked='true'] { background: var(--accent); }
.toggle[aria-checked='true']::after { transform: translateX(30px); background: #0a0a0a; }

.stepper { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; }
.stepper button {
  min-height: 48px;
  border: var(--bw) solid var(--line);
  background: var(--paper);
  font-family: var(--mono);
  font-weight: 800;
  font-size: 1.3rem;
  touch-action: manipulation;
}
.stepper button:active { background: var(--accent); color: var(--accent-ink); }
.stepper .input { border-left: 0; border-right: 0; text-align: center; font-weight: 800; font-size: 1.15rem; }

/* ----------------------------------------------------------------- avatars */
.av {
  --s: 44px;
  flex: 0 0 var(--s);
  width: var(--s);
  height: var(--s);
  display: grid;
  place-items: center;
  border: var(--bw) solid var(--line);
  background: var(--c, var(--accent));
  color: var(--cf, #0a0a0a);
  font-weight: 700;
  font-size: calc(var(--s) * .44);
  letter-spacing: -.04em;
  line-height: 1;
  text-transform: uppercase;
  user-select: none;
}
.av.sm { --s: 30px; border-width: 2px; }
.av.xs { --s: 24px; border-width: 2px; font-size: .62rem; }
.av.lg { --s: 64px; }
.av.short-3 { font-size: calc(var(--s) * .32); }
.av.short-2 { font-size: calc(var(--s) * .38); }
.av-stack { display: flex; }
.av-stack .av { margin-left: -6px; }
.av-stack .av:first-child { margin-left: 0; }

/* ------------------------------------------------------------------ layout */
.boot { min-height: 100dvh; display: grid; place-items: center; }
.screen {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 10px) 14px calc(var(--nav-h) + var(--safe-bottom) + 24px);
  display: grid;
  gap: 1.15rem;
  align-content: start;
}
.screen-head { display: flex; align-items: center; gap: .6rem; }
.screen-head .grow h1 { margin: 0; }
.section { display: grid; gap: .65rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; }
.section-head a { font-family: var(--mono); font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }

.home-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; }
.home-head .wordmark { font-size: clamp(4rem, 23vw, 7.2rem); }

.bottomnav {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: var(--bw) solid var(--line);
  background: var(--paper);
  padding-bottom: var(--safe-bottom);
}
.bottomnav a {
  min-height: var(--nav-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  border-right: 2px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--mono);
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  touch-action: manipulation;
}
.bottomnav a:last-child { border-right: 0; }
.bottomnav a.on { background: var(--accent); color: var(--accent-ink); }
.bottomnav svg { width: 22px; height: 22px; }
.bottomnav .plus { background: var(--ink); color: var(--bg); }
.bottomnav .plus.on { background: var(--accent); color: var(--accent-ink); }

/* ----------------------------------------------------------- game cards */
.gcards { display: grid; gap: .75rem; }
.gcard {
  display: grid;
  gap: .55rem;
  padding: .8rem;
  border: var(--bw) solid var(--line);
  background: var(--paper);
  box-shadow: var(--sh) var(--sh) 0 var(--shadow);
  text-decoration: none;
  color: inherit;
  touch-action: manipulation;
}
.gcard:active { transform: translate(var(--sh), var(--sh)); box-shadow: none; }
.gcard-top { display: flex; align-items: center; gap: .5rem; }
.gcard-top .name { font-weight: 700; text-transform: uppercase; font-size: 1.02rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcard-scores { display: flex; flex-wrap: wrap; gap: .4rem .7rem; }
.gscore { display: inline-flex; align-items: center; gap: .3rem; font-family: var(--mono); font-weight: 800; font-size: .92rem; }
.gscore.out { opacity: .45; text-decoration: line-through; }
.gscore.win { background: var(--accent); color: #0a0a0a; padding-right: .3rem; }
.emoji { font-size: 1.25rem; line-height: 1; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }
.live-dot { width: 10px; height: 10px; background: var(--red); border: 2px solid var(--line); animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: .15; } }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .3rem;
  min-height: 98px;
  padding: .7rem;
  border: var(--bw) solid var(--line);
  background: var(--paper);
  box-shadow: var(--sh) var(--sh) 0 var(--shadow);
  text-align: left;
  text-decoration: none;
  color: inherit;
  touch-action: manipulation;
}
.tile:active { transform: translate(var(--sh), var(--sh)); box-shadow: none; }
.tile .emoji { font-size: 1.7rem; }
.tile .t { font-weight: 700; font-size: .95rem; text-transform: uppercase; line-height: 1.05; }
.tile .s { font-family: var(--mono); font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tile.on { background: var(--accent); color: var(--accent-ink); }
.tile.on .s { color: #0a0a0a; }
.tile .del { position: absolute; top: 4px; right: 4px; }

.onboard { display: grid; gap: .7rem; }
.onboard ol { margin: 0; padding: 0; list-style: none; display: grid; gap: .5rem; counter-reset: step; }
.onboard li { display: flex; align-items: center; gap: .6rem; font-weight: 700; text-transform: uppercase; font-size: .9rem; counter-increment: step; }
.onboard li::before {
  content: counter(step);
  display: grid; place-items: center;
  width: 30px; height: 30px; flex: 0 0 30px;
  border: var(--bw) solid var(--line);
  background: var(--accent); color: #0a0a0a;
  font-family: var(--mono); font-weight: 800;
}

/* --------------------------------------------------------- player chips */
.pchips { display: flex; flex-wrap: wrap; gap: .55rem; }
.pchip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 48px;
  padding: .25rem .65rem .25rem .25rem;
  border: var(--bw) solid var(--line);
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--shadow);
  font-weight: 700;
  font-size: .86rem;
  text-transform: uppercase;
  touch-action: manipulation;
}
.pchip:active { transform: translate(3px, 3px); box-shadow: none; }
.pchip.on { background: var(--accent); color: var(--accent-ink); }
.pchip .seat { font-family: var(--mono); font-size: .72rem; font-weight: 800; padding: 0 .3rem; border: 2px solid currentColor; }
.pchip.add { border-style: dashed; box-shadow: none; }

.seat-list { display: grid; gap: .45rem; }
.seat-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .55rem; padding: .35rem; border: 2px solid var(--line); background: var(--paper); }
.seat-row .nm { font-weight: 700; text-transform: uppercase; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-row .ctrl { display: flex; gap: .3rem; }
.mini {
  min-width: 36px;
  height: 36px;
  border: 2px solid var(--line);
  background: var(--paper);
  font-family: var(--mono);
  font-weight: 800;
  font-size: .85rem;
  padding: 0 .35rem;
  touch-action: manipulation;
}
.mini.on { background: var(--accent); color: var(--accent-ink); }
.mini:active { background: var(--accent); color: var(--accent-ink); }

.rules-sum { font-family: var(--mono); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; line-height: 1.5; }
.quick-inputs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .45rem; }
.quick-inputs .input { text-align: center; font-weight: 800; }

.sticky-cta {
  position: sticky;
  bottom: calc(var(--nav-h) + var(--safe-bottom));
  z-index: 5;
  margin: 0 -14px;
  padding: 10px 14px 12px;
  background: var(--bg);
  border-top: var(--bw) solid var(--line);
}
.sticky-cta .btn:disabled { opacity: 1; background: var(--soft); color: var(--muted); box-shadow: none; }

/* ------------------------------------------------------------- game screen */
.game-body { background: var(--bg); }
.game {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 900px;
  margin: 0 auto;
}
.game-top {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(var(--safe-top) + 6px) 8px 6px;
  border-bottom: var(--bw) solid var(--line);
  background: var(--paper);
}
.game-top .btn-sm { min-height: 40px; }
.game-title { flex: 1; min-width: 0; }
.game-title h1 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: 1.05rem;
  line-height: 1.05;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-title .potje { flex: 0 0 auto; padding: .05rem .35rem; border: 2px solid var(--line); background: var(--ink); color: var(--bg); font-family: var(--mono); font-size: .66rem; letter-spacing: .06em; }
.game-title .kicker { margin-top: .15rem; font-size: .58rem; letter-spacing: .12em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync { width: 12px; height: 12px; flex: 0 0 12px; border: 2px solid var(--line); background: var(--green); }
.sync.busy { background: var(--yellow); animation: blink .8s steps(2) infinite; }
.sync.off { background: var(--red); animation: blink 1.4s steps(2) infinite; }

/* Rows share the free height: 2 players = huge, 6 players = still all on screen. */
.rows {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px 12px 8px;
}
.prow {
  flex: 1 1 0;
  min-height: 72px;
  max-height: 360px;
  position: relative;
  container: row / size;
  border: var(--bw) solid var(--line);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--shadow);
}
.prow.out { flex: 0 0 56px; min-height: 56px; background: var(--soft); box-shadow: none; border-style: dashed; }
.prow.gone .qs.one { max-width: 220px; justify-self: end; width: 100%; }
.prow.gone .q.rebuy { background: var(--paper); color: var(--ink); font-size: .78rem; }
.rows.done .prow { max-height: 140px; }

/* Default (short or wide rows): one line — icon · name+score · buttons. */
.pin {
  height: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) min(56%, 560px);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "av who qs" "av sc qs";
  align-items: center;
  column-gap: 8px;
  padding: 5px 8px;
}
.pin.noq { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr); grid-template-areas: "av who sc"; }
.av-btn { grid-area: av; position: relative; padding: 0; border: 0; background: none; touch-action: manipulation; }
.pin .av { --s: clamp(34px, 50cqh, 62px); }
.pin .who { grid-area: who; min-width: 0; display: flex; align-items: center; gap: 5px; overflow: hidden; }
.pin .nm {
  min-width: 0;
  font-weight: 700;
  font-size: clamp(.72rem, 15cqh, 1.05rem);
  letter-spacing: .02em;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pin .nm { flex: 0 1 auto; min-width: 2.6em; }
.pin .chips { display: flex; flex-wrap: nowrap; gap: 4px; flex: 0 1 auto; min-width: 0; overflow: hidden; }
.pin .long { display: none; }
.pin .sc { grid-area: sc; min-width: 0; display: flex; align-items: center; gap: 6px; overflow: hidden; }
.pin .who-chips { display: none; }
.pin .sc-chips { display: flex; }
.pin .sc-chips .state { letter-spacing: 0; padding: .1rem .25rem; }
.pin.noq .who-chips { display: flex; }
.pin.noq .sc-chips { display: none; }
.pin .total {
  display: inline-block;
  font-family: var(--mono);
  font-weight: 800;
  font-size: clamp(1.7rem, 54cqh, 4.4rem);
  line-height: .92;
  letter-spacing: -.06em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pin .total.bump { animation: bump .22s ease-out; }
@keyframes bump { 40% { transform: scale(1.18); } }
.pin .qs {
  grid-area: qs;
  display: grid;
  grid-template-columns: repeat(var(--nq), minmax(0, 1fr));
  gap: 6px;
  height: clamp(40px, calc(100cqh - 12px), 76px);
  align-self: center;
}
.pin .qs.one { grid-template-columns: 1fr; }
.q {
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0;
  border: var(--bw) solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 800;
  font-size: clamp(.95rem, 30cqh, 1.6rem);
  letter-spacing: -.03em;
  box-shadow: 3px 3px 0 var(--shadow);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.q:active, .q.hit { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--shadow); background: var(--accent); color: #0a0a0a; }
.q.neg { color: var(--red); }
.q.ask { background: var(--ink); color: var(--bg); }
.q.ask:active, .q.ask.hit { background: var(--accent); color: #0a0a0a; }
.q.rebuy { background: var(--accent); color: #0a0a0a; font-family: var(--font); text-transform: uppercase; font-size: .9rem; }

/* Tall rows on a phone: icon + name/state left, BIG score right, wide buttons below. */
@container row (min-height: 118px) and (max-width: 640px) {
  .pin {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: minmax(0, 1fr) clamp(50px, 36cqh, 104px);
    grid-template-areas: "av who sc" "qs qs qs";
    row-gap: 8px;
    padding: 8px 10px 10px;
  }
  .pin.noq { grid-template-rows: minmax(0, 1fr); grid-template-areas: "av who sc"; }
  .pin .av { --s: clamp(44px, 30cqh, 86px); }
  .pin .who { flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; }
  .pin .nm { font-size: clamp(1rem, 12cqh, 1.8rem); white-space: normal; overflow-wrap: anywhere; max-height: 2.3em; }
  .pin .chips { flex-wrap: wrap; overflow: visible; }
  .pin .who-chips { display: flex; }
  .pin .sc-chips { display: none; }
  .pin .sc { overflow: visible; }
  .pin .long { display: inline; }
  .pin .total { font-size: clamp(2.4rem, 40cqh, 7rem); }
  .pin .qs { height: 100%; }
  .q { font-size: clamp(1.15rem, 15cqh, 2.1rem); }
}

.state {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  padding: .14rem .38rem;
  border: 2px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 800;
  font-size: clamp(.6rem, 11cqh, 1.05rem);
  letter-spacing: .07em;
  line-height: 1.15;
  text-transform: uppercase;
  white-space: nowrap;
}
.state-warn { background: #0a0a0a; color: var(--yellow); border-color: #0a0a0a; }
.state-out { background: var(--red); color: #fff; border-color: #0a0a0a; }
.state-lead { background: var(--accent); color: #0a0a0a; border-color: #0a0a0a; }
.state.pend { background: var(--accent); color: #0a0a0a; border-color: #0a0a0a; touch-action: manipulation; }
.state.pend.neg { background: var(--red); color: #fff; }

.prow.lead .total { background: var(--accent); color: #0a0a0a; padding: 0 .08em; box-shadow: 3px 3px 0 #0a0a0a; }
.prow.warn { background: var(--yellow); color: #0a0a0a; border-color: #0a0a0a; }
.prow.warn .q { background: #fff; color: #0a0a0a; border-color: #0a0a0a; box-shadow: 3px 3px 0 #0a0a0a; }
.prow.warn .q.ask { background: #0a0a0a; color: #fff; }
.prow.dying { background: #ffd6d6; color: #0a0a0a; border-color: #0a0a0a; }
.prow.dying .total { color: #d10000; }
.prow.dying .q { background: #fff; color: #0a0a0a; border-color: #0a0a0a; box-shadow: 3px 3px 0 #0a0a0a; }
.prow.dying .q.ask { background: #0a0a0a; color: #fff; }
.prow.out .av { filter: grayscale(1); opacity: .6; }
.prow.out .nm { text-decoration: line-through; text-decoration-thickness: 2px; }
.prow.out .total { text-decoration: line-through; opacity: .55; }
.prow.won { background: var(--accent); color: #0a0a0a; border-color: #0a0a0a; }
.place {
  position: absolute;
  z-index: 1;
  top: -9px;
  left: -9px;
  min-width: 24px;
  height: 22px;
  padding: 0 .25rem;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-weight: 800;
  font-size: .7rem;
}

.game-actions {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 10px calc(10px + var(--safe-bottom));
  border-top: var(--bw) solid var(--line);
  background: var(--paper);
}
.game-actions.three { grid-template-columns: 58px minmax(0, 1fr) minmax(0, 1fr); }
.game-actions.with-stop { grid-template-columns: 58px minmax(0, 1fr) auto; }
.stop-btn { padding: 0 .85rem; font-size: .95rem; }
.game-actions .btn { min-height: 58px; }
.commit-btn { font-size: 1.05rem; }
.commit-btn.idle { background: var(--soft); color: var(--muted); box-shadow: none; }

.final-banner {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  padding: .55rem 12px;
  border-bottom: var(--bw) solid var(--line);
  background: var(--accent);
  color: #0a0a0a;
}
.final-banner .big { font-size: clamp(1.4rem, 7vw, 2.2rem); font-weight: 700; line-height: 1; letter-spacing: -.03em; text-transform: uppercase; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------- score sheet */
.sheet-table-wrap { overflow: auto; border: var(--bw) solid var(--line); background: var(--paper); max-height: 62vh; }
.sheet-table { border-collapse: separate; border-spacing: 0; width: 100%; font-family: var(--mono); font-size: .95rem; }
.sheet-table th, .sheet-table td {
  padding: 0;
  text-align: center;
  border-right: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.sheet-table tr > *:last-child { border-right: 0; }
.sheet-table thead th { position: sticky; top: 0; z-index: 2; background: var(--paper); padding: 6px 4px; }
.sheet-table thead th:first-child, .sheet-table tbody th, .sheet-table tfoot th { position: sticky; left: 0; z-index: 1; background: var(--paper); }
.sheet-table thead th:first-child { z-index: 3; }
.sheet-table .av { margin: 0 auto; }
.sheet-table tbody th, .sheet-table tfoot th { padding: 0 .5rem; font-size: .72rem; font-weight: 800; color: var(--muted); }
.sheet-table td button {
  width: 100%;
  min-width: 54px;
  min-height: 42px;
  border: 0;
  background: transparent;
  font-family: var(--mono);
  font-weight: 700;
  font-size: .95rem;
  touch-action: manipulation;
}
.sheet-table td button:active { background: var(--accent); color: #0a0a0a; }
.sheet-table td .sub { display: block; font-size: .62rem; color: var(--muted); line-height: 1; padding-bottom: 3px; }
.sheet-table tr.ev td, .sheet-table tr.ev th { background: var(--soft); }
.sheet-table tr.ignored td, .sheet-table tr.ignored th { opacity: .4; }
.sheet-table tr.pending td, .sheet-table tr.pending th { background: var(--accent); color: #0a0a0a; }
.sheet-table tfoot td, .sheet-table tfoot th { position: sticky; bottom: 0; background: var(--ink); color: var(--bg); font-weight: 800; font-size: 1.05rem; padding: 8px 4px; border-bottom: 0; }
.sheet-table tfoot th { color: var(--bg); }
.sheet-table td.dead { background: repeating-linear-gradient(-45deg, transparent 0 6px, var(--soft-2) 6px 8px); }

.chart { border: var(--bw) solid var(--line); background: var(--paper); padding: .6rem; }
.chart svg { width: 100%; height: auto; overflow: visible; }

/* -------------------------------------------------------------- leaderboard */
.chips { display: flex; gap: .45rem; overflow-x: auto; padding: 2px 4px 8px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 40px;
  padding: .25rem .7rem;
  border: var(--bw) solid var(--line);
  background: var(--paper);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 3px 3px 0 var(--shadow);
  touch-action: manipulation;
}
.chip.on { background: var(--accent); color: var(--accent-ink); }
.chip:active { transform: translate(3px, 3px); box-shadow: none; }

.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: .5rem; }
.podium .spot { display: grid; justify-items: center; gap: .4rem; min-width: 0; }
.podium .spot .nm { font-weight: 700; font-size: .8rem; text-transform: uppercase; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .block {
  width: 100%;
  display: grid;
  place-items: center;
  align-content: start;
  gap: .1rem;
  padding-top: .5rem;
  border: var(--bw) solid var(--line);
  box-shadow: var(--sh) var(--sh) 0 var(--shadow);
  font-family: var(--mono);
}
.podium .block b { font-size: 2rem; line-height: 1; }
.podium .block span { font-size: .62rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.podium .p1 .block { height: 150px; background: var(--accent); color: #0a0a0a; }
.podium .p2 .block { height: 112px; background: var(--paper); }
.podium .p3 .block { height: 84px; background: var(--soft); }
.podium .empty .block { opacity: .35; box-shadow: none; border-style: dashed; }

.lb { display: grid; border: var(--bw) solid var(--line); background: var(--paper); box-shadow: var(--sh-lg) var(--sh-lg) 0 var(--shadow); }
.lb-row {
  display: grid;
  grid-template-columns: 2.1rem auto minmax(0, 1fr) repeat(3, 3.1rem);
  align-items: center;
  gap: .5rem;
  min-height: 56px;
  padding: .35rem .55rem;
  border-bottom: 2px solid var(--line);
  background: transparent;
  border-left: 0; border-right: 0; border-top: 0;
  width: 100%;
  text-align: left;
  touch-action: manipulation;
}
.lb-row:last-child { border-bottom: 0; }
.lb-row:active { background: var(--accent); color: #0a0a0a; }
.lb-row.head { min-height: 34px; background: var(--ink); color: var(--bg); font-family: var(--mono); font-size: .6rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.lb-row .rk { font-family: var(--mono); font-weight: 800; font-size: 1.05rem; }
.lb-row .nm { font-weight: 700; text-transform: uppercase; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .nm small { display: block; font-family: var(--mono); font-size: .62rem; font-weight: 700; color: var(--muted); letter-spacing: .06em; }
.lb-row .num { font-family: var(--mono); font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.lb-row.head .num { text-align: right; }
.lb-row .num.big { font-size: 1.15rem; }

.awards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.award { display: grid; gap: .25rem; padding: .7rem; border: var(--bw) solid var(--line); background: var(--paper); box-shadow: var(--sh) var(--sh) 0 var(--shadow); }
.award .emoji { font-size: 1.6rem; }
.award .t { font-family: var(--mono); font-size: .62rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.award .who { font-weight: 700; text-transform: uppercase; font-size: 1rem; line-height: 1.05; }
.award .v { font-family: var(--mono); font-size: .78rem; font-weight: 700; }

.statgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: var(--bw) solid var(--line); background: var(--paper); }
.statgrid .s { padding: .55rem .5rem; border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); display: grid; gap: .1rem; }
.statgrid .s:nth-child(3n) { border-right: 0; }
.statgrid .s b { font-family: var(--mono); font-size: 1.3rem; line-height: 1; }
.statgrid .s span { font-family: var(--mono); font-size: .58rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* ------------------------------------------------------------- lists */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.list-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem;
  border: var(--bw) solid var(--line);
  background: var(--paper);
  flex-wrap: wrap;
}
.list-row strong { text-transform: uppercase; }
.list-row .hint { display: block; }
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.plist { display: grid; gap: .6rem; }
.prow-lite {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .7rem;
  padding: .5rem;
  border: var(--bw) solid var(--line);
  background: var(--paper);
  box-shadow: var(--sh) var(--sh) 0 var(--shadow);
  text-align: left;
  width: 100%;
  touch-action: manipulation;
}
.prow-lite:active { transform: translate(var(--sh), var(--sh)); box-shadow: none; }
.prow-lite .nm { font-weight: 700; text-transform: uppercase; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow-lite .meta { font-family: var(--mono); font-size: .7rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.prow-lite.archived { opacity: .55; box-shadow: none; border-style: dashed; }

.hist-day { font-family: var(--mono); font-size: .68rem; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; padding: .2rem 0; border-bottom: var(--bw) solid var(--line); }
.hitem {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .65rem;
  padding: .6rem;
  border: var(--bw) solid var(--line);
  border-top: 0;
  background: var(--paper);
  text-decoration: none;
  color: inherit;
}
.hitem:active { background: var(--accent); color: #0a0a0a; }
.hitem .t { font-weight: 700; text-transform: uppercase; font-size: .95rem; }
.hitem .m { font-family: var(--mono); font-size: .68rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.hitem:active .m { color: #0a0a0a; }
.hgroup { display: grid; }

.empty-state { padding: 1.2rem 1rem; border: var(--bw) dashed var(--line); text-align: center; display: grid; gap: .6rem; justify-items: center; }
.empty-state .big { font-size: 2.6rem; }
.empty-state p { margin: 0; font-weight: 700; text-transform: uppercase; font-size: .9rem; }

.swatches { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .45rem; }
.swatch { aspect-ratio: 1; border: var(--bw) solid var(--line); background: var(--c); padding: 0; touch-action: manipulation; }
.swatch.on { outline: var(--bw) solid var(--line); outline-offset: 3px; box-shadow: inset 0 0 0 4px var(--paper); }

/* ------------------------------------------------------------ sheets */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(10, 10, 10, .55); animation: fade .12s ease-out; }
[data-theme='dark'] .backdrop { background: rgba(0, 0, 0, .72); }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed;
  z-index: 51;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 94dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
  border-top: var(--bw) solid var(--line);
  padding: 14px 14px calc(14px + var(--safe-bottom));
  display: grid;
  gap: .8rem;
  animation: sheet-up .16s ease-out;
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 640px) {
  .sheet {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    width: min(560px, calc(100vw - 32px));
    transform: translate(-50%, -50%);
    border: var(--bw) solid var(--line);
    box-shadow: 10px 10px 0 var(--shadow);
    animation: none;
  }
}
.sheet-head { display: flex; align-items: center; gap: .6rem; }
.sheet-head .grow b { display: block; font-size: 1.05rem; text-transform: uppercase; }
.sheet-head .grow span { font-family: var(--mono); font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.menu-list { display: grid; gap: .5rem; }
.menu-list .btn { justify-content: flex-start; }

.kp-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  min-height: 78px;
  padding: .3rem .8rem;
  border: var(--bw) solid var(--line);
  background: var(--bg);
}
.kp-display .mode { font-family: var(--mono); font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.kp-display .val { font-family: var(--mono); font-weight: 800; font-size: clamp(2.4rem, 13vw, 3.4rem); line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.kp-display .val.neg { color: var(--red); }
.kp-preview { font-family: var(--mono); font-size: .8rem; font-weight: 700; text-transform: uppercase; }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.key {
  height: 62px;
  border: var(--bw) solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 800;
  font-size: 1.55rem;
  box-shadow: 3px 3px 0 var(--shadow);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.key:active { transform: translate(3px, 3px); box-shadow: none; background: var(--accent); color: #0a0a0a; }
.key.alt { background: var(--soft); font-size: 1.2rem; }
.kp-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.kp-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 10px; }

/* ----------------------------------------------------------- toasts */
.toast-wrap {
  position: fixed;
  z-index: 70;
  left: 12px;
  right: 12px;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 14px);
  display: grid;
  gap: .5rem;
  pointer-events: none;
  max-width: 560px;
  margin: 0 auto;
}
body.in-game .toast-wrap { bottom: calc(82px + var(--safe-bottom)); }
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: .6rem;
  min-height: 50px;
  padding: .45rem .5rem .45rem .8rem;
  border: var(--bw) solid var(--line);
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  box-shadow: var(--sh) var(--sh) 0 var(--accent);
  animation: toast-in .14s ease-out;
}
[data-theme='dark'] .toast { background: var(--accent); color: #0a0a0a; border-color: var(--accent); box-shadow: var(--sh) var(--sh) 0 #fafafa; }
.toast.err { background: var(--red); color: #fff; }
.toast .grow { line-height: 1.25; }
.toast button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 .6rem;
  border: 2px solid currentColor;
  background: transparent;
  color: inherit;
  font-family: var(--mono);
  font-weight: 800;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

/* ----------------------------------------------------------- winner */
.winner {
  position: fixed;
  z-index: 60;
  inset: 0;
  overflow-y: auto;
  background: var(--accent);
  color: #0a0a0a;
  padding: calc(var(--safe-top) + 18px) 18px calc(var(--safe-bottom) + 18px);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: fade .2s ease-out;
}
.winner .kicker { color: #0a0a0a; }
.winner .who { font-size: clamp(3.2rem, 17vw, 7.5rem); font-weight: 700; line-height: .82; letter-spacing: -.06em; text-transform: uppercase; overflow-wrap: anywhere; }
.winner .wint { font-size: clamp(3.2rem, 17vw, 7.5rem); font-weight: 700; line-height: .82; letter-spacing: -.06em; -webkit-text-stroke: 3px #0a0a0a; color: transparent; text-transform: uppercase; }
.winner .rank { display: grid; gap: .4rem; }
.winner .rank-row { display: grid; grid-template-columns: 2.2rem auto minmax(0, 1fr) auto; align-items: center; gap: .6rem; padding: .45rem .55rem; border: var(--bw) solid #0a0a0a; background: #fff; color: #0a0a0a; font-weight: 700; text-transform: uppercase; }
.winner .rank-row .p { font-family: var(--mono); font-weight: 800; }
.winner .rank-row .v { font-family: var(--mono); font-weight: 800; font-size: 1.15rem; }
.winner .rank-row:first-child { background: #0a0a0a; color: var(--accent); }
.winner .btn { border-color: #0a0a0a; box-shadow: var(--sh) var(--sh) 0 #0a0a0a; }
.winner .btn-dark { background: #0a0a0a; color: var(--accent); }
.winner .btn:not(.btn-dark) { background: #fff; color: #0a0a0a; }
.winner .actions { display: grid; gap: .7rem; margin-top: auto; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 61; }
.confetti i { position: absolute; top: -24px; width: 14px; height: 14px; border: 2px solid #0a0a0a; animation: drop linear forwards; }
@keyframes drop { to { transform: translateY(110vh) rotate(540deg); } }

/* ----------------------------------------------------------- auth pages */
.auth-body, .sub-body { min-height: 100dvh; }
.auth { width: 100%; max-width: 520px; margin: 0 auto; padding: calc(var(--safe-top) + 12px) 14px calc(var(--safe-bottom) + 40px); display: grid; gap: 1.1rem; }
.auth-top, .sub-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.auth-hero { display: grid; gap: .6rem; padding-top: .4rem; }
.auth .ticker { margin: 0 -14px; }
.auth-card { display: grid; gap: .85rem; }
.more-login { border: var(--bw) solid var(--line); }
.more-login summary {
  list-style: none;
  padding: .7rem .8rem;
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.more-login summary::-webkit-details-marker { display: none; }
.more-login summary::after { content: '+'; float: right; font-family: var(--mono); font-weight: 800; }
.more-login[open] summary::after { content: '−'; }
.more-login form { padding: 0 .8rem .8rem; }
.sub { width: 100%; max-width: 720px; margin: 0 auto; padding: calc(var(--safe-top) + 12px) 14px calc(var(--safe-bottom) + 40px); display: grid; gap: 1.1rem; }
.sub-hero { display: grid; gap: .4rem; }
.secret { display: block; padding: .6rem; border: 2px solid var(--line); background: var(--bg); font-size: .85rem; word-break: break-all; user-select: all; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.stat { border: 2px solid var(--line); padding: .55rem; display: grid; gap: .1rem; }
.stat b { font-family: var(--mono); font-size: 1.1rem; }
.stat span { font-family: var(--mono); font-size: .6rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 2px solid var(--line); }
.table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.table th, .table td { padding: .5rem; text-align: left; border-bottom: 2px solid var(--soft-2); white-space: nowrap; }
.table th { font-family: var(--mono); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; background: var(--ink); color: var(--bg); }
.key-row code { font-size: .78rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
  .ticker-track { animation: none; }
}
