/* Futbrain styles. Tokens match docs/design/design.md. */
:root {
  --ease: cubic-bezier(.23, 1, .32, 1);
  --bg: #F3F5F2;
  --surface: #FFFFFF;
  --text: #0F1A14;
  --muted: #56655C;
  --border: #DCE3DD;
  --mine: #0866B3;
  --mine-soft: #E3EFFA;
  --opp: #E69F00;
  --opp-edge: #5A3E00;
  --best: #007F5F;
  --good: #9A7B00;
  --miss: #C04F00;
  --pitch: #4D8B5B;
  --stripe: #478453;
  --lines: rgba(255, 255, 255, .75);
  --ballring: #FFE14D;
  --shadow: 0 -8px 30px rgba(15, 26, 20, .14);
  --on-accent: #FFFFFF;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1210; --surface: #151D19; --text: #ECF2EE; --muted: #93A39A; --border: #26322C;
    --mine: #4AA8F0; --mine-soft: #11304A; --opp: #F0B13A; --opp-edge: #2A1C00;
    --best: #22C39A; --good: #F0D64A; --miss: #FF8A4C;
    --pitch: #1E3A2A; --stripe: #21402E; --lines: rgba(255, 255, 255, .45);
    --shadow: 0 -8px 30px rgba(0, 0, 0, .5);
    --on-accent: #0C1210;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C1210; --surface: #151D19; --text: #ECF2EE; --muted: #93A39A; --border: #26322C;
  --mine: #4AA8F0; --mine-soft: #11304A; --opp: #F0B13A; --opp-edge: #2A1C00;
  --best: #22C39A; --good: #F0D64A; --miss: #FF8A4C;
  --pitch: #1E3A2A; --stripe: #21402E; --lines: rgba(255, 255, 255, .45);
  --shadow: 0 -8px 30px rgba(0, 0, 0, .5);
  --on-accent: #0C1210;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.stage { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; }
.phone {
  position: relative; width: 100%; max-width: 420px; flex: 1;
  display: flex; flex-direction: column; overflow: hidden; background: var(--bg);
}
@media (min-width: 520px) {
  .phone {
    flex: none; height: min(860px, calc(100dvh - 32px)); margin: 16px 0;
    border-radius: 36px; border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
  }
}
.game { display: flex; flex-direction: column; flex: 1; min-height: 0; }


/* ---------- Top bar ---------- */
.top { display: flex; align-items: center; gap: 12px; padding: 10px calc(16px + env(safe-area-inset-right)) 4px calc(16px + env(safe-area-inset-left)); padding-top: calc(10px + env(safe-area-inset-top)); }
.icon-btn {
  width: 48px; height: 48px; margin-left: -12px; border: 0; background: none;
  display: grid; place-items: center; border-radius: 999px; color: var(--muted);
  transition: transform 150ms var(--ease);
}
.icon-btn:active { transform: scale(.97); }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.progress { flex: 1; display: flex; gap: 6px; }
.progress span { flex: 1; height: 6px; border-radius: 3px; background: var(--border); transition: background-color 250ms var(--ease); }
.progress span.done { background: var(--mine); }
.stat { display: flex; align-items: center; gap: 4px; font: 700 20px/1 "Barlow Condensed", sans-serif; }
.stat .ico { width: 18px; height: 18px; }
.flame { color: var(--opp); }
.zap { color: var(--mine); }

/* Exercise-type banner: tells you at a glance what kind of decision this is */
.exercise { display: flex; align-items: center; gap: 12px; margin: 4px 16px 0; }
.ex-icon {
  flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--mine); color: var(--on-accent);
}
.ex-icon .ico { width: 24px; height: 24px; }
.ex-text { display: flex; flex-direction: column; min-width: 0; }
.ex-type { font: 700 24px/1 "Barlow Condensed", sans-serif; letter-spacing: .6px; text-transform: uppercase; }
.ex-meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dots { letter-spacing: 1px; color: var(--mine); }

/* Legend on the pitch */
.legend {  /* a slim row under the pitch, so it never covers players or options */
  display: flex; gap: 12px; align-items: center; justify-content: center;
  padding: 6px 16px 0; color: var(--muted); font-size: 12px;
}
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { display: inline-block; width: 10px; height: 10px; }
.lg-mine { background: var(--mine); border: 1.5px solid #fff; border-radius: 50%; }
.lg-opp { background: var(--opp); transform: rotate(45deg) scale(.85); }
.lg-ball { background: #fff; border-radius: 50%; box-shadow: 0 0 0 2px var(--ballring); }

/* ---------- Pitch ---------- */
.pitch-wrap { flex: 1 1 auto; min-height: 200px; position: relative; }
.pitch-wrap > svg {
  position: absolute; inset: 10px 16px 0; width: calc(100% - 32px); height: calc(100% - 10px);
  border-radius: var(--r-m); display: block; touch-action: manipulation;
}
.grass { fill: var(--pitch); }
.stripe { fill: var(--stripe); }
.lines { stroke: var(--lines); fill: none; stroke-width: .3; }
.lines .spot { fill: var(--lines); stroke: none; }
.tok-mine { fill: var(--mine); stroke: #fff; stroke-width: .55; }
.tok-ring { fill: rgba(0, 0, 0, .55); } /* dark ring under every player so it pops on bright grass */
.tok-opp { fill: var(--opp); stroke: var(--opp-edge); stroke-width: .45; }
.halo { fill: #fff; opacity: .22; animation: pulse 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 50% { opacity: .38; transform: scale(1.15); } }
.me-tag { font: 700 2.3px "Barlow Condensed", sans-serif; fill: #fff; text-anchor: middle; paint-order: stroke; stroke: rgba(0, 0, 0, .55); stroke-width: .5px; }
.ball { fill: #fff; stroke: #111; stroke-width: .25; }
.ball-patch { fill: #111; }
.ball-ring { fill: none; stroke: var(--ballring); stroke-width: .5; transform-box: fill-box; transform-origin: center; animation: ring 1.4s ease-in-out infinite; }
@keyframes ring { 50% { transform: scale(1.25); opacity: .55; } }
.arrow.shot { stroke-width: .7; }
.lane { stroke: #fff; stroke-width: .25; opacity: .45; }
.arrow { stroke: #fff; stroke-width: .45; fill: none; stroke-linecap: round; }
.arrow-head { fill: #fff; }
.arrow.run { stroke-dasharray: 1.2 .9; }
.hint { opacity: .5; }
.replay { animation: fadein 250ms var(--ease) both; }
@keyframes fadein { from { opacity: 0; } }
.badge circle.face { fill: #fff; stroke: #0F1A14; stroke-width: .3; }
.badge text { font: 700 2.5px Inter, sans-serif; fill: #0F1A14; text-anchor: middle; dominant-baseline: central; }
.badge { transition: opacity 200ms var(--ease); }
.badge.is-best circle.face { fill: var(--best); stroke: #fff; }
.badge.is-good circle.face { fill: var(--good); stroke: #fff; }
.badge.is-miss circle.face { fill: var(--miss); stroke: #fff; }
.badge.is-best text, .badge.is-miss text { fill: var(--on-accent); }
.badge.dim { opacity: .4; }
.hit { fill: transparent; cursor: pointer; }

/* ---------- Question + options ---------- */
.question { margin: 0; padding: 12px 16px 4px; font-size: 18px; line-height: 1.35; font-weight: 600; text-wrap: pretty; }
.options {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
}
.opt {
  min-height: 60px; display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  text-align: left; font-size: 15px; font-weight: 500; line-height: 1.25;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-m);
  transition: transform 150ms var(--ease), border-color 200ms var(--ease), opacity 200ms var(--ease);
}
.opt:active { transform: scale(.97); }
@media (hover: hover) { .opt:not(:disabled):hover { border-color: var(--mine); } }
.opt:focus-visible, .primary:focus-visible, .icon-btn:focus-visible { outline: 3px solid var(--mine); outline-offset: 2px; }
.letter {
  flex: none; width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; background: var(--text); color: var(--bg);
}
.opt:disabled { cursor: default; }
.opt.dim { opacity: .5; }
.opt.is-best { border-color: var(--best); }
.opt.is-best .letter { background: var(--best); color: var(--on-accent); }
.opt.is-good { border-color: var(--good); }
.opt.is-good .letter { background: var(--good); color: #111; }
.opt.is-miss { border-color: var(--miss); border-style: dashed; border-width: 2.5px; }
.opt.is-miss .letter { background: var(--miss); color: var(--on-accent); }

/* ---------- Reveal sheet ---------- */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 50%; overflow-y: auto;
  background: var(--surface); border-radius: var(--r-l) var(--r-l) 0 0; box-shadow: var(--shadow);
  padding: 20px 16px 0; transform: translateY(105%); visibility: hidden;
  transition: transform 250ms var(--ease), visibility 0s linear 250ms;
}
.sheet:not(.open) { pointer-events: none; } /* no taps while it slides away */
.sheet.open { transform: none; visibility: visible; transition: transform 250ms var(--ease); }
.sheet.open > * { animation: rise 250ms var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms + 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); filter: blur(2px); } }
.sheet-head { display: flex; align-items: center; gap: 10px; }
.res-icon { flex: none; width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; color: var(--on-accent); }
.res-icon .ico { width: 20px; height: 20px; stroke-width: 3; }
.res-icon.best { background: var(--best); }
.res-icon.good { background: var(--good); color: #111; }
.res-icon.miss { background: var(--miss); }
.sheet h2 { margin: 0; font: 700 24px/1.1 "Barlow Condensed", sans-serif; }
.xp-pill { margin-left: auto; padding: 4px 10px; border-radius: 999px; background: var(--mine-soft); color: var(--mine); font: 700 18px/1.2 "Barlow Condensed", sans-serif; white-space: nowrap; }
.why { margin: 12px 0 8px; }
.others summary {
  min-height: 48px; display: flex; align-items: center; font-weight: 600; color: var(--mine); cursor: pointer; list-style: none;
}
.others summary::-webkit-details-marker { display: none; }
.others summary::after { content: "+"; margin-left: auto; font-size: 20px; }
.others[open] summary::after { content: "–"; }
.others ul { list-style: none; margin: 0; padding: 0; }
.others li { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 15px; }
.others li .letter { width: 24px; height: 24px; font-size: 12px; }
.tip {
  display: flex; gap: 10px; margin: 8px 0 0; padding: 12px; border-radius: 12px;
  background: var(--mine-soft); color: var(--text);
}
.tip .ico { flex: none; color: var(--mine); margin-top: 2px; }
.tip p { margin: 2px 0 0; font-size: 15px; }
.sheet-foot { position: sticky; bottom: 0; background: var(--surface); padding: 12px 0 calc(16px + env(safe-area-inset-bottom)); }
.primary {
  width: 100%; height: 54px; border: 0; border-radius: var(--r-m); background: var(--mine); color: var(--on-accent);
  font: 700 21px/1 "Barlow Condensed", sans-serif; letter-spacing: .5px; text-transform: uppercase;
  transition: transform 150ms var(--ease);
}
.primary:active { transform: scale(.97); }

/* ---------- Results ---------- */
.results { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); text-align: center; }
.results:not([hidden]) > * { animation: rise 250ms var(--ease) both; }
.results > :nth-child(2) { animation-delay: 40ms; } .results > :nth-child(3) { animation-delay: 80ms; }
.results > :nth-child(4) { animation-delay: 120ms; } .results > :nth-child(5) { animation-delay: 160ms; }
.results > :nth-child(6) { animation-delay: 200ms; }
.logo svg { width: 64px; height: 64px; }
.results h1 { margin: 8px 0 0; font: 700 30px/1.1 "Barlow Condensed", sans-serif; }
.big { margin: 0; font: 700 64px/1 "Barlow Condensed", sans-serif; color: var(--mine); }
.r-cards { display: flex; gap: 8px; width: 100%; margin: 12px 0; }
.r-card { flex: 1; padding: 14px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.r-card span { font-size: 13px; color: var(--muted); }
.r-card b { font: 700 28px/1.1 "Barlow Condensed", sans-serif; }
.muted { color: var(--muted); margin: 0 0 16px; }
.secondary {
  width: 100%; height: 50px; border-radius: var(--r-m); border: 1.5px solid var(--border); background: var(--surface);
  font: 700 19px/1 "Barlow Condensed", sans-serif; letter-spacing: .5px; text-transform: uppercase;
  transition: transform 150ms var(--ease);
}
.secondary:active { transform: scale(.97); }

/* ---------- Leaderboard (mock) ---------- */
.board { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.board-title { margin: 0; font: 700 26px/1 "Barlow Condensed", sans-serif; }
.tabs { display: flex; gap: 4px; margin: 8px 16px 0; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-m); }
.tabs button { flex: 1; min-height: 44px; border: 0; border-radius: 10px; background: none; font-size: 14px; font-weight: 600; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--mine); color: var(--on-accent); }
.filters { display: flex; gap: 6px; margin: 10px 16px 0; }
.filters button { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 14px; }
.filters button[aria-pressed="true"] { border-color: var(--mine); color: var(--mine); font-weight: 600; }
.division { margin: 14px 16px 4px; display: flex; justify-content: space-between; align-items: baseline; }
.division b { font: 700 22px/1 "Barlow Condensed", sans-serif; }
.division span { font-size: 13px; color: var(--muted); }
.rows { list-style: none; margin: 0 16px; padding: 0; }
.rows li { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 12px; border-radius: 12px; animation: rise 250ms var(--ease) both; }
.rows li + li { margin-top: 2px; }
.rows .rank { width: 26px; font: 700 20px/1 "Barlow Condensed", sans-serif; color: var(--muted); text-align: right; }
.rows .flag { font-size: 20px; }
.rows .name { flex: 1; font-weight: 500; }
.rows .pts { font: 700 20px/1 "Barlow Condensed", sans-serif; }
.rows li.me { background: var(--mine-soft); outline: 2px solid var(--mine); }
.rows li.me .name { font-weight: 700; }
.rows li.zone { min-height: 28px; justify-content: center; font-size: 12px; font-weight: 600; color: var(--best); letter-spacing: .4px; text-transform: uppercase; animation: none; }
.rows li.zone.down { color: var(--miss); }
.rows li.gap { min-height: 24px; justify-content: center; color: var(--muted); animation: none; }
.demo-note { margin: 12px 16px 0; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- Contrarreloj (rush) ---------- */
.rush { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.rush-play { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.rush-top { display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 2px calc(16px + env(safe-area-inset-left)); }
.clock {
  flex: 1; text-align: center; font: 700 34px/1 "Barlow Condensed", sans-serif; font-variant-numeric: tabular-nums;
  transition: color 200ms var(--ease);
}
.clock.low { color: var(--miss); }
.rscore { display: flex; align-items: center; gap: 2px; min-width: 56px; justify-content: flex-end; color: var(--best); }
.rscore b { font: 700 30px/1 "Barlow Condensed", sans-serif; }
.rscore .ico { width: 20px; height: 20px; stroke-width: 3; }
.cards { display: flex; gap: 5px; min-width: 56px; }
.card { display: inline-block; width: 14px; height: 20px; border-radius: 3px; }
.card.empty { border: 1.5px dashed var(--border); }
.card.yellow { background: #F2C200; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.card.red { background: #D93A1E; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.pop { animation: pop 300ms var(--ease); }
@keyframes pop { 40% { transform: scale(1.25); } }

.combo { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 2px 16px 6px; font-size: 12px; color: var(--muted); }
.pips { display: flex; gap: 4px; }
.pips i { width: 18px; height: 6px; border-radius: 3px; background: var(--border); transition: background-color 150ms var(--ease); }
.pips i.on { background: var(--opp); }
.combo-label { min-width: 70px; font-weight: 600; }

.options.stack { grid-template-columns: 1fr; gap: 6px; }
.options.stack .opt { min-height: 52px; }

.toast {
  position: absolute; left: 28px; right: 28px; bottom: 10px; padding: 12px 14px; border-radius: var(--r-m);
  background: var(--surface); color: var(--text); box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
  display: flex; flex-direction: column; gap: 4px; font-size: 15px;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}
.toast.show { opacity: 1; transform: none; pointer-events: auto; }
.toast b { font: 700 20px/1.1 "Barlow Condensed", sans-serif; }
.toast em { font-style: normal; font-size: 13px; color: var(--mine); font-weight: 600; margin-top: 2px; }
.toast.yellow { border-left: 6px solid #F2C200; cursor: pointer; }
.toast.red { border-left: 6px solid #D93A1E; cursor: pointer; }
.toast.bonus { left: auto; right: 28px; top: 12px; bottom: auto; padding: 8px 14px; background: var(--best); color: var(--on-accent); }

.rush-screen {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); text-align: center;
}
.rush-screen:not([hidden]) > * { animation: rise 250ms var(--ease) both; flex-shrink: 0; }
.rush-screen > :nth-child(2) { animation-delay: 40ms; } .rush-screen > :nth-child(3) { animation-delay: 80ms; }
.rush-screen > :nth-child(4) { animation-delay: 120ms; } .rush-screen > :nth-child(5) { animation-delay: 160ms; }
.rush-screen > :nth-child(n+6) { animation-delay: 200ms; }
.rush-screen h1 { margin: 4px 0 0; font: 700 36px/1 "Barlow Condensed", sans-serif; text-transform: uppercase; letter-spacing: .5px; }
.rush-screen .muted { margin: 0; }
.rush-badge { width: 72px; height: 72px; border-radius: 20px; background: var(--mine); color: var(--on-accent); display: grid; place-items: center; margin-top: 12px; }
.rush-badge .ico { width: 40px; height: 40px; }
.rules { list-style: none; margin: 8px 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.rules li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--border); font-size: 15px; }
.rules .ico { flex: none; color: var(--mine); }
.rules .card { flex: none; margin: 0 4px; }
.best-line { margin: 4px 0 8px; color: var(--muted); }
/* Intro: the start button lives at the bottom, in the thumb zone, and never falls off small screens */
.intro-foot {
  margin-top: auto; position: sticky; bottom: calc(-24px - env(safe-area-inset-bottom)); width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 0 calc(24px + env(safe-area-inset-bottom)); background: var(--bg);
}
.intro-foot .demo-note { margin: 0; }
.best-line b { color: var(--text); font: 700 22px/1 "Barlow Condensed", sans-serif; }

.rush-count { flex: 1; display: grid; place-items: center; }
.rush-count span { font: 700 120px/1 "Barlow Condensed", sans-serif; color: var(--mine); animation: count 600ms var(--ease) both; }
.rush-count span.go { color: var(--best); font-size: 96px; }
@keyframes count { from { opacity: 0; transform: scale(1.6); } 70% { opacity: 1; transform: scale(1); } to { opacity: .2; } }

.rush-end .big { margin: 4px 0 0; }
.big-label { margin: -4px 0 0; color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: .6px; }
.record { margin: 4px 0; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.record .ico { color: #F2C200; }
.record.new { color: var(--best); font: 700 24px/1 "Barlow Condensed", sans-serif; text-transform: uppercase; }
.record.near { color: var(--opp); font: 700 22px/1.1 "Barlow Condensed", sans-serif; }
.squares { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; max-width: 280px; }
.sq { width: 16px; height: 16px; border-radius: 4px; }
.sq.ok { background: var(--mine); }
.sq.no { background: var(--opp); }
.rush-end .r-cards { margin: 6px 0; }
.rush-end h2 { align-self: flex-start; margin: 16px 0 0; font: 700 22px/1 "Barlow Condensed", sans-serif; }
.review { list-style: none; margin: 0; padding: 0; width: 100%; text-align: left; display: flex; flex-direction: column; gap: 8px; }
.review li { padding: 12px 14px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.review .ans { color: var(--best); font-weight: 600; }
.review p { margin: 0; color: var(--muted); }
.review li.clean { text-align: center; font-weight: 600; }

.rprogress { min-width: 0; font: 700 18px/1 "Barlow Condensed", sans-serif; color: var(--muted); }
.rprogress:empty { display: none; }
.rush-top .clock[hidden] + .rprogress { flex: 1; text-align: center; font-size: 30px; color: var(--text); }
.rush-screen .back { position: absolute; left: 12px; top: 10px; margin: 0; }
.rush-screen { position: relative; }
.friend-banner { margin: 4px 0; padding: 10px 14px; border-radius: 12px; background: var(--mine-soft); }
.toast.plain { border-left: 6px solid var(--muted); cursor: pointer; }

/* ---------- Home: mode cards ---------- */
.home { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.home-top { display: flex; align-items: center; justify-content: space-between; padding: calc(14px + env(safe-area-inset-top)) 20px 6px; }
.wordmark { display: flex; align-items: center; gap: 10px; font: 700 30px/1 "Barlow Condensed", sans-serif; letter-spacing: 2px; }
.wordmark svg { width: 36px; height: 36px; }
.carousel {
  flex: 1; min-height: 0; display: flex; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; padding: 12px 9%; scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.mode-card {
  position: relative; flex: 0 0 82%; scroll-snap-align: center; border-radius: var(--r-l); overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; padding: 22px; color: #fff;
  background: repeating-linear-gradient(180deg, var(--c1) 0 34px, var(--c2) 34px 68px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .25); cursor: pointer;
  transform: scale(.94); opacity: .7;
  transition: transform 250ms var(--ease), opacity 250ms var(--ease);
}
.mode-card[aria-selected="true"] { transform: none; opacity: 1; }
.mode-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; } /* light of each look */
.mode-card > * { position: relative; z-index: 1; }
.mode-art { position: absolute !important; inset: 0; z-index: 0 !important; }
.mc-circle { position: absolute; left: 50%; top: 34%; width: 46%; aspect-ratio: 1; transform: translate(-50%, -50%); border: 2px solid rgba(255, 255, 255, .35); border-radius: 50%; }
.mc-line { position: absolute; left: 0; right: 0; top: 34%; border-top: 2px solid rgba(255, 255, 255, .35); }
.mode-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, rgba(0, 0, 0, .55)); z-index: 0; }
.mode-icon { width: 52px; height: 52px; border-radius: var(--r-m); display: grid; place-items: center; background: rgba(0, 0, 0, .28); }
.mode-icon .ico { width: 28px; height: 28px; }
.mode-card h2 { margin: 6px 0 0; font: 700 clamp(26px, 9vw, 34px)/.95 "Barlow Condensed", sans-serif; text-transform: uppercase; letter-spacing: .5px; text-shadow: 0 2px 10px rgba(0, 0, 0, .3); }
.mode-card p { margin: 0; font-size: 15px; line-height: 1.35; opacity: .95; }
.mode-status { align-self: flex-start; margin-top: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(0, 0, 0, .35); font-size: 13px; font-weight: 600; }
.mode-status b { font: 700 16px/1 "Barlow Condensed", sans-serif; }
.mode-dots { display: flex; justify-content: center; gap: 6px; padding: 4px 0 8px; }
.mode-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--border); transition: background-color 200ms var(--ease), width 200ms var(--ease); }
.mode-dots i.on { width: 20px; border-radius: 4px; background: var(--mine); }
.home-bottom { display: flex; flex-direction: column; gap: 8px; padding: 4px 16px calc(16px + env(safe-area-inset-bottom)); }
.primary.play { height: 62px; font-size: 26px; letter-spacing: 1px; }
#homeBoard { display: flex; align-items: center; justify-content: center; gap: 6px; }
#homeBoard .ico { width: 20px; height: 20px; }

/* ---------- Looks: each mode is played on its own pitch ---------- */
.phone[data-look="night"] { --pitch: #16341F; --stripe: #1A3B25; --lines: rgba(255, 255, 255, .6); }
.phone[data-look="sunset"] { --pitch: #5B7F3F; --stripe: #55783A; --lines: rgba(255, 255, 255, .75); }
.phone[data-look="rain"] { --pitch: #3A5F4A; --stripe: #365A45; --lines: rgba(255, 255, 255, .6); }
.phone[data-look="street"] { --pitch: #3E9E52; --stripe: #3A9550; --lines: rgba(255, 255, 255, .85); }
.pitch-wrap::after { content: ""; position: absolute; inset: 10px 16px 0; border-radius: var(--r-m); pointer-events: none; }
.phone[data-look="night"] .pitch-wrap::after, .mode-card[data-look="night"]::after {
  background: radial-gradient(ellipse 55% 40% at 8% 0%, rgba(255, 252, 220, .22), transparent),
              radial-gradient(ellipse 55% 40% at 92% 0%, rgba(255, 252, 220, .22), transparent);
}
/* sunset glow only on the home card: during play it washed out the players */
.mode-card[data-look="sunset"]::after {
  background: linear-gradient(180deg, rgba(255, 140, 60, .32), rgba(255, 200, 120, .06) 60%, transparent);
}
.phone[data-look="rain"] .pitch-wrap::after, .mode-card[data-look="rain"]::after {
  background: repeating-linear-gradient(105deg, rgba(255, 255, 255, .08) 0 1px, transparent 1px 10px);
  background-size: 200% 200%; animation: rain 1.2s linear infinite;
}
@keyframes rain { to { background-position: -40px 120px; } }
.phone[data-look="street"] .pitch-wrap::after, .mode-card[data-look="street"]::after {
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .05) 0 2px, transparent 2px 6px); /* synthetic turf */
}
.toast { z-index: 2; }
.guard { pointer-events: none; } /* end screen ignores taps for a moment */
/* Sunset: darker edges so orange players and the yellow ball ring stand out on the warm grass */
.phone[data-look="sunset"] .tok-opp { stroke: #2A1C00; stroke-width: .5; }
.phone[data-look="sunset"] .ball-ring { stroke: #fff; }
.toast.yellow em, .toast.red em, .toast.plain em { font-size: 14px; }

/* ---------- Home extras, settings, records ---------- */
.home-actions { display: flex; align-items: center; gap: 4px; }
.home-actions .icon-btn { margin: 0 -12px 0 0; }
.pos-chip {
  align-self: flex-start; display: flex; align-items: center; gap: 4px; margin: 2px 20px 0;
  min-height: 44px; padding: 0 10px 0 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-size: 14px; font-weight: 600;
  transition: transform 150ms var(--ease);
}
.pos-chip .ico { width: 18px; height: 18px; color: var(--muted); }
.pos-chip:active { transform: scale(.97); }
.overlay {
  position: absolute; inset: 0; z-index: 30; display: flex; align-items: flex-end;
  background: rgba(8, 14, 11, .45); animation: fade 200ms var(--ease);
}
.panel {
  width: 100%; max-height: 92%; overflow-y: auto; padding: 22px 20px calc(18px + env(safe-area-inset-bottom));
  background: var(--surface); border-radius: var(--r-l) var(--r-l) 0 0; box-shadow: var(--shadow);
  animation: rise 250ms var(--ease);
}
.panel h2 { margin: 0 0 6px; font: 700 28px/1.05 "Barlow Condensed", sans-serif; }
.panel h3 { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.pos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pos-grid button, .seg button {
  min-height: 46px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg); font-size: 15px; font-weight: 500; text-align: left;
  transition: transform 150ms var(--ease);
}
.pos-grid button:active, .seg button:active { transform: scale(.97); }
.pos-grid button[aria-pressed="true"], .seg button[aria-pressed="true"] {
  border-color: var(--mine); background: var(--mine-soft); color: var(--text); font-weight: 700;
}
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; text-align: center; }
.panel .about { margin: 18px 0 0; font-size: 13px; color: var(--muted); }
.panel .primary { margin-top: 18px; width: 100%; }
.pos-line { margin: 0; font-size: 14px; color: var(--muted); text-align: center; }
.rows .rank .ico { width: 22px; height: 22px; color: var(--mine); }
@keyframes fade { from { opacity: 0; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mode-card:focus-visible, .pos-chip:focus-visible, button:focus-visible { outline: 3px solid var(--mine); outline-offset: 2px; }
.results, .rush-end { -webkit-user-select: none; user-select: none; }
.update {
  position: absolute; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 40;
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; border-radius: var(--r-m);
  background: var(--text); color: var(--bg); font-size: 14px; animation: rise 250ms var(--ease);
}
.update span { flex: 1; }
.update button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--mine); color: var(--on-accent); font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ================= Futbrain's own look: stadium scoreboard, referee's cards, chalk board ================= */
:root {
  --r-s: 6px; --r-m: 12px; --r-l: 20px;
  --led-bg: #0B110E; --led-num: #FFD25E; --led-label: #9FB2A6;
  --card-y: #F2C200; --card-r: #D93A1E; --card-w: #F4F1E8;
  --flame: #A65F00;
  --paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .35 0 0 0 -.12'/%3E%3C/filter%3E%3Crect width='90' height='90' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --flame: #F0B13A; } }
:root[data-theme="dark"] { --flame: #F0B13A; }
.flame { color: var(--flame); }

/* The scoreboard: dark strip, faint LED dots, amber digits */
.led {
  background-color: var(--led-bg); color: var(--led-label);
  background-image: radial-gradient(rgba(255, 255, 255, .07) .9px, transparent 1.1px); background-size: 4px 4px;
  border-radius: var(--r-m);
}
.led-num {
  display: inline-block; font: 700 1em/1 "Barlow Condensed", sans-serif; color: var(--led-num);
  font-variant-numeric: tabular-nums; letter-spacing: .02em; text-shadow: 0 0 14px rgba(255, 210, 94, .3);
}
.flip { animation: flip 150ms var(--ease); }
@keyframes flip { from { transform: translateY(-35%); opacity: 0; } }
.score-strip { display: flex; align-items: flex-end; width: 100%; padding: 16px 18px 14px; }
.score-strip > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.score-strip > div:first-child { flex: 1; }
.score-strip > div:first-child .led-num { font-size: 56px; }
.sq.half { background: var(--good); }
.results .squares { justify-content: flex-start; max-width: none; }
.score-strip .led-side { margin-left: 16px; padding-left: 16px; border-left: 1px solid rgba(255, 255, 255, .12); align-items: flex-end; }
.score-strip .led-side .led-num { font-size: 30px; }
.score-strip span, .board-line span { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.board-line { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 10px 16px; }
.board-line .led-num { font-size: 32px; }

/* Referee's cards: real proportions, a little paper grain, never perfectly straight */
.ref-card {
  flex: none; display: inline-grid; place-items: center; width: 40px; height: 56px; border-radius: 5px;
  background: var(--paper), var(--card-y); transform: rotate(-6deg);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .28), inset 0 0 0 1px rgba(0, 0, 0, .08);
}
.ref-card.red { background: var(--paper), var(--card-r); }
.ref-card.white { background: var(--paper), var(--card-w); color: #1B1B1B; }
.ref-card.white b { font: 700 24px/1 "Barlow Condensed", sans-serif; }
.dealt-row { display: flex; gap: 14px; padding: 6px 4px 4px; }
.dealt-row .ref-card { width: 46px; height: 64px; }
.dealt-row .ref-card:nth-child(2n) { transform: rotate(5deg); }
.dealt { animation: deal 320ms var(--ease) both; animation-delay: calc(var(--n, 0) * 90ms + 120ms); }
@keyframes deal { from { opacity: 0; translate: -26px -16px; rotate: -18deg; } }
.mini-card { display: inline-block; width: 10px; height: 14px; border-radius: 2px; margin: 0 1px; vertical-align: -2px; transform: rotate(-6deg); }
.mini-card.yellow { background: var(--card-y); } .mini-card.red { background: var(--card-r); }

/* Chalk board: lines and option markers look drawn by a coach */
.arrow, .lane { stroke: rgba(255, 255, 255, .92); }
.arrow-head { fill: rgba(255, 255, 255, .92); }
.badge circle.face { fill: rgba(16, 26, 21, .86); stroke: rgba(255, 255, 255, .9); stroke-width: .35; }
.badge text { font: 700 2.7px "Barlow Condensed", sans-serif; fill: #fff; }
.badge.is-best text, .badge.is-miss text { fill: var(--on-accent); }
.badge.is-good text { fill: #111; }
.sc { transform: scale(var(--k, 1)); }
.pitch-wrap { --pitch-x: 16px; --pitch-top: 10px; --pitch-center: 0; }
.pitch-wrap::after { inset: auto; left: var(--pl, 16px); top: var(--pt, 10px); width: var(--pw, 0); height: var(--ph, 0); }
/* Mode illustrations: the game's own pieces, crisp (the chalk is only for the pitch) */
.sketch .a-mine { fill: var(--mine); stroke: #fff; stroke-width: 2; }
.sketch .a-halo { fill: #fff; opacity: .22; }
.sketch .a-opp { fill: var(--opp); stroke: #2A1C00; stroke-width: 1.6; stroke-linejoin: round; }
.sketch .a-ball { fill: #fff; stroke: #111; stroke-width: 1; }
.sketch .a-ring { fill: none; stroke: var(--ballring); stroke-width: 1.6; }
.sketch .a-lane, .sketch .a-line { fill: none; stroke: rgba(255, 255, 255, .9); stroke-width: 2.4; stroke-linecap: round; }
.sketch .a-line { stroke: rgba(255, 255, 255, .45); stroke-width: 3; }
.sketch .a-head { fill: rgba(255, 255, 255, .9); }
.sketch .a-dial { fill: rgba(0, 0, 0, .18); stroke: rgba(255, 255, 255, .35); stroke-width: 2; }
.sketch .a-time { fill: none; stroke: var(--led-num); stroke-width: 5; stroke-linecap: round; }
.sketch .a-tick { fill: none; stroke: rgba(255, 255, 255, .7); stroke-width: 2; stroke-linecap: round; }
.sketch .a-sq-ok { fill: var(--mine); stroke: rgba(255, 255, 255, .6); stroke-width: 1; }
.sketch .a-sq-no { fill: var(--opp); stroke: rgba(255, 255, 255, .6); stroke-width: 1; }
.sketch .a-card { fill: var(--card-r); stroke: rgba(0, 0, 0, .15); stroke-width: 1; }
.sketch .a-vs { font: 700 15px "Barlow Condensed", sans-serif; fill: #fff; text-anchor: middle; letter-spacing: .05em; }

/* Category bar: pick one, only that kind of play comes up */
.cats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 4px 16px 0; }
.cats button {
  min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid var(--border); border-radius: var(--r-m); background: var(--surface); color: var(--muted);
  font-size: 13px; font-weight: 600; transition: transform 150ms var(--ease), background-color 150ms ease, color 150ms ease;
}
.cats button .ico { width: 20px; height: 20px; }
.cats button:active { transform: scale(.97); }
.cats button[aria-checked="true"] { background: var(--mine); border-color: var(--mine); color: var(--on-accent); }

/* Home cards: the sketch on top, the words on one baseline at the bottom */
.mode-card { border-radius: var(--r-l); }
.mode-card .mode-art { position: relative !important; inset: auto; flex: 1 1 0; min-height: 0; }   /* the sketch takes the space above the words, never under them */
.mode-art .sketch { position: absolute; left: 8%; top: 4%; width: 84%; height: 92%; }
.mode-text { display: flex; flex-direction: column; gap: 6px; }
.mode-status { padding: 8px 0 0; margin-top: 4px; border-radius: 0; background: none; border-top: 1px solid rgba(255, 255, 255, .25); font-weight: 500; opacity: .9; }
.mc-play { display: none; }
.mode-dots i { transition: background-color 200ms var(--ease), transform 200ms var(--ease); }
.mode-dots i.on { width: 7px; border-radius: 50%; transform: scaleX(2.6); }
.today { display: none; }
.link {
  min-height: 44px; padding: 0 12px; border: 0; background: none; color: var(--text);
  font-size: 15px; font-weight: 600; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 4px;
  transition: text-decoration-color 150ms ease;
}
@media (hover: hover) { .link:hover { text-decoration-color: currentColor; } }
#homeBoard { min-height: 44px; }

/* Answer sheet: one line of verdict, the reason, a quiet tip */
.res-icon { width: 28px; height: 28px; }
.res-icon .ico { width: 16px; height: 16px; }
.sheet h2 { font-size: 26px; }
.xp-pill { padding: 0; background: none; color: var(--muted); font: 600 15px/1 Inter, system-ui, sans-serif; }
.tip { display: block; margin: 12px 0 0; padding: 0 0 0 12px; border-radius: 0; background: none; border-left: 2px solid var(--border); }
.tip > svg { display: none; }
.tip > div { display: block; }
.tip b, .tip p { display: inline; font-size: 15px; }
.tip p { margin: 0; color: var(--muted); }
.sheet-foot { margin: 0 -16px; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet { border-radius: var(--r-l) var(--r-l) 0 0; }
.opt { border-radius: var(--r-m); }
.primary, .secondary { border-radius: var(--r-m); }

/* Results and end screens: a match report, read from the left */
.results, .rush-end { align-items: stretch; justify-content: flex-start; text-align: left; gap: 12px; }
.results { padding-top: calc(40px + env(safe-area-inset-top)); }
.kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.results h1, .rush-end h1 { margin: 0; font: 700 40px/1 "Barlow Condensed", sans-serif; text-transform: none; letter-spacing: 0; }
.note:empty { display: none; }
.actions { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.links { display: flex; justify-content: center; gap: 4px; }
.rush-end .squares { justify-content: flex-start; max-width: none; }
.rush-end .record { align-self: flex-start; }

/* Mode intros: title, one rule strip, the mode's sketch, the record on the scoreboard */
#rushIntro { align-items: stretch; text-align: left; }
.intro-main { display: flex; flex-direction: column; gap: 8px; padding-top: 40px; }
#rushIntro h1 { margin: 0; font-size: 44px; text-transform: none; letter-spacing: 0; }
.lede { margin: 0; color: var(--muted); font-size: 16px; }
.strip { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; row-gap: 6px; font-size: 15px; }
.strip li { white-space: nowrap; }
.strip li + li::before { content: "·"; margin: 0 9px; color: var(--muted); }
.strip b { font: 700 19px/1 "Barlow Condensed", sans-serif; }
.intro-art {
  position: relative; flex: 1 1 120px; min-height: 110px; margin: 10px 0 0; border-radius: var(--r-l); overflow: hidden;
  background: repeating-linear-gradient(180deg, var(--c1) 0 22px, var(--c2) 22px 44px);
}
.intro-art .sketch { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); }
.intro-foot { align-items: stretch; }
.best-line, .pos-line { text-align: left; margin: 0; }

/* Contrarreloj HUD = the stadium scoreboard */
.rush-top { margin: calc(8px + env(safe-area-inset-top)) 12px 0; padding: 4px 10px 4px 4px; }
.rush-top.led .icon-btn { margin-left: 0; color: var(--led-label); }
.rush-top .clock { color: var(--led-num); text-shadow: 0 0 14px rgba(255, 210, 94, .3); }
.rush-top .clock.low { color: #FF7A45; }
.rush-top .rscore { color: var(--led-num); }
.rush-top .rprogress { color: var(--led-label); }
.rush-top .card.empty { border-color: rgba(255, 255, 255, .25); }
.rush-top .card.yellow { background: var(--paper), var(--card-y); }
.rush-top .card.red { background: var(--paper), var(--card-r); }
.toast { flex-direction: row; align-items: flex-start; gap: 14px; border-radius: var(--r-m); }
.toast > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.toast .ref-card { margin: 2px 0 0 2px; }
.toast.yellow, .toast.red, .toast.plain { border-left: 0; }
.toast.show { transition: opacity 200ms var(--ease), transform 200ms var(--ease); }
.toast:not(.show) { transition: opacity 150ms ease, transform 150ms ease; }

.rush-top { position: relative; }
.bonus-flash {
  position: absolute; left: 50%; top: 100%; translate: -50% 4px; z-index: 3; padding: 3px 10px; border-radius: 999px;
  background: var(--best); color: var(--on-accent); font: 700 16px/1.1 "Barlow Condensed", sans-serif;
  animation: bonus 1200ms var(--ease) both; pointer-events: none;
}
@keyframes bonus { from { opacity: 0; translate: -50% -4px; } 15% { opacity: 1; translate: -50% 4px; } 80% { opacity: 1; } to { opacity: 0; } }
.flash {
  position: absolute; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 40; translate: -50% 0;
  padding: 10px 16px; border-radius: var(--r-m); background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600;
  animation: rise 200ms var(--ease) both; white-space: nowrap;
}
/* secondary numbers on the scoreboard are white; only the main score is amber (amber = your result) */
.score-strip .led-side .led-num { color: #E6EEE9; text-shadow: none; }
/* the score line wraps on small phones instead of overlapping */
.score-strip { flex-wrap: wrap; row-gap: 12px; }
@media (max-width: 420px) {
  .score-strip > div:first-child { flex: 1 1 100%; }
  .score-strip > div:first-child + .led-side { margin-left: 0; padding-left: 0; border-left: 0; }
  .score-strip .led-side { align-items: flex-start; flex: 1 1 auto; }
}

/* which way we attack: always up, said once on every pitch */
.attack {
  position: absolute; left: calc(var(--pl, 16px) + 8px); top: calc(var(--pt, 10px) + 8px); z-index: 1; pointer-events: none;
  padding: 3px 8px; border-radius: var(--r-s); background: rgba(0, 0, 0, .35); color: #fff;
  font: 700 12px/1.2 "Barlow Condensed", sans-serif; letter-spacing: .06em; text-transform: uppercase;
}

/* Countdown over the frozen first play */
.rush { position: relative; }
.rush-count { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 55%, transparent); }
.rush-count span { font: 700 140px/1 "Barlow Condensed", sans-serif; color: var(--text); animation: count 200ms var(--ease) both; }
.rush-count span.go { color: var(--best); font-size: 110px; }
@keyframes count { from { opacity: 0; transform: scale(.9); } }

/* Records: scoreboard rows, plus the last 7 days */
.rows li.led { min-height: 56px; padding: 0 16px; margin-top: 6px; border-radius: var(--r-m); }
.rows li.led .name { color: var(--led-label); font-weight: 500; }
.rows .led-num { font-size: 26px; }
.week { display: flex; gap: 4px; margin-right: 12px; }
.week i { width: 10px; height: 10px; border-radius: 2px; background: rgba(255, 255, 255, .12); }
.week i.on { background: var(--led-num); }

/* ---------- Phone sizes (kept at the end so they win over the rules above) ---------- */
/* On a real phone the app is exactly one screen tall: each screen fits or scrolls inside itself,
   so bottom buttons (Jugar, ¡Empezar!) stay in the thumb zone instead of below the fold. */
@media (max-width: 519px) {
  .stage { height: 100dvh; }
  .phone { min-height: 0; }
  .game, .results { overflow-y: auto; }
}
/* Short phones (iPhone SE size): tighter spacing so all 4 options fit without scrolling */
@media (max-height: 640px) {
  .top { padding-top: 4px; }
  .pitch-wrap { min-height: 150px; }
  .legend { padding-top: 4px; }
  .question { font-size: 16px; padding-top: 6px; }
  .options { padding-top: 6px; gap: 6px; }
  .opt { min-height: 50px; font-size: 14px; }
  .ex-icon { width: 38px; height: 38px; }
  .ex-type { font-size: 21px; }
  .options.stack .opt { min-height: 48px; }
  .mode-card > .mode-text > p { display: none; }   /* short phones: the sketch needs the room more than the tagline */
}

/* ---------- Computer (wide screens): the pitch on the left, the decision on the right ----------
   Same screens and the same code as the phone; only the layout changes. Kept last so it wins. */
@media (min-width: 960px) {
  .stage { align-items: stretch; }
  .phone { max-width: none; flex: 1; height: 100dvh; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .home, .game, .rush, .results, .board { width: 100%; max-width: 1280px; margin: 0 auto; }

  /* Home: all modes side by side; one click plays */
  .home-top { padding: 28px 40px 4px; }
  .cats { margin: 8px 40px 0; max-width: 560px; }
  .carousel {
    flex: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px;
    padding: 24px 40px 8px; overflow: visible; scroll-snap-type: none;
  }
  .mode-card { flex: none; height: 380px; transform: none; opacity: 1; padding: 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
  .mode-text { min-height: 150px; justify-content: flex-end; }
  .mode-card h2 { font-size: clamp(20px, 1.9vw, 28px); overflow-wrap: anywhere; text-wrap: balance; }
  .mode-card p { font-size: 14px; }
  .mc-play { display: block; margin-top: 2px; font: 700 15px/1 "Barlow Condensed", sans-serif; letter-spacing: .06em; text-transform: uppercase; opacity: 0; transition: opacity 150ms ease; }
  .mode-card:focus-visible .mc-play { opacity: 1; }
  .mode-dots, .primary.play { display: none; }
  .today { display: grid; grid-template-columns: 1fr 1fr; margin: 16px 40px 0; padding: 0; }
  .today > div { display: flex; align-items: center; gap: 14px; padding: 16px 20px; }
  .today > div + div { border-left: 1px solid rgba(255, 255, 255, .1); }
  .today span { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
  .today .led-num { margin-left: auto; font-size: 34px; }
  .today em { font-style: normal; color: var(--led-label); font-size: 14px; min-width: 64px; text-align: right; }
  .home-bottom { flex-direction: row; justify-content: center; padding: 12px 40px 32px; }

  /* the pitch keeps phone-sized players and sits centred in its column */
  .pitch-wrap { --pitch-x: 0px; --pitch-top: 8px; --pitch-center: 1; }

  /* Entrenamiento */
  .game {
    display: grid; column-gap: 48px; padding: 0 40px 28px;
    grid-template-columns: minmax(0, 1.2fr) minmax(400px, 1fr);
    grid-template-rows: auto auto auto 1fr auto;
  }
  .game > .top { grid-column: 1 / -1; padding: 18px 0 10px; }
  .game > .pitch-wrap { grid-column: 1; grid-row: 2 / 5; min-height: 0; }
  .game > .legend { grid-column: 1; grid-row: 5; padding-top: 10px; }
  .game > .exercise { grid-column: 2; grid-row: 2; margin: 10px 0 0; }
  .game > .question { grid-column: 2; grid-row: 3; padding: 20px 0 14px; font-size: 26px; line-height: 1.25; }
  .game > .options { grid-column: 2; grid-row: 4; grid-template-columns: 1fr; align-content: start; padding: 0; }
  .opt { min-height: 56px; font-size: 16px; }
  .letter { border-radius: var(--r-s); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .3); }   /* a key you can press */
  .game > .sheet {   /* the answer opens in the right column; the pitch stays in view */
    grid-column: 2; grid-row: 2 / 6; position: relative; left: auto; right: auto; bottom: auto; max-height: none;
    border-radius: var(--r-l); box-shadow: none; border: 1px solid var(--border); margin-top: 10px; padding: 24px 24px 0;
    transform: translateX(16px); opacity: 0;
    transition: transform 250ms var(--ease), opacity 200ms var(--ease), visibility 0s linear 250ms;
  }
  .game > .sheet.open { transform: none; opacity: 1; transition: transform 250ms var(--ease), opacity 200ms var(--ease); }
  .game > .sheet .sheet-foot { margin: 0 -24px; padding: 12px 24px 24px; }

  /* Quick modes: the scoreboard sits over the decision column */
  .rush-play {
    display: grid; column-gap: 48px; padding: 0 40px 28px;
    grid-template-columns: minmax(0, 1.2fr) minmax(400px, 1fr);
    grid-template-rows: auto auto auto auto 1fr;
  }
  .rush-play > .rush-top { grid-column: 2; grid-row: 1; margin: 24px 0 0; }
  .rush-play > .pitch-wrap { grid-column: 1; grid-row: 1 / 6; min-height: 0; padding-top: 16px; }
  .rush-play > .combo { grid-column: 2; grid-row: 2; justify-content: flex-start; padding: 12px 0 0; }
  .rush-play > .exercise { grid-column: 2; grid-row: 3; margin: 12px 0 0; }
  .rush-play > .question { grid-column: 2; grid-row: 4; padding: 18px 0 12px; font-size: 26px; line-height: 1.25; }
  .rush-play > .options { grid-column: 2; grid-row: 5; align-content: start; padding: 0; }
  .rush-screen { width: 100%; max-width: 600px; margin: 0 auto; }

  /* Mode intros: words left, the mode's sketch right */
  #rushIntro { max-width: 1040px; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr; column-gap: 48px; align-content: center; padding: 48px 40px; }
  #rushIntro .intro-main { grid-column: 1; grid-row: 1; padding-top: 0; }
  #rushIntro .intro-foot { grid-column: 1; grid-row: 2; position: static; margin-top: 24px; padding: 0; align-self: start; }
  #rushIntro .intro-art { grid-column: 2; grid-row: 1 / 3; min-height: 420px; margin: 0; }
  #rushIntro h1 { font-size: 56px; }

  /* Results, records and settings */
  .results { max-width: 560px; justify-content: center; }
  .board { max-width: 640px; padding-top: 16px; }
  .overlay { align-items: center; justify-content: center; }
  .panel { width: 520px; max-height: 86%; border-radius: var(--r-l); }
}
@media (min-width: 960px) and (hover: hover) {
  .mode-card { transition: transform 200ms var(--ease), box-shadow 200ms var(--ease); }
  .mode-card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(0, 0, 0, .28); }
  .mode-card:hover .mc-play { opacity: 1; }
}
