/* Ultimate Tracker – one stylesheet for the public pages and the tracker.
   Light by default: high contrast for bright sunlight at the sideline. */

:root {
  --bg: #f3f1ea;
  --panel: #ffffff;
  --ink: #101418;
  --muted: #5b6168;
  --line: #d8d3c6;
  --us: #0a6a4e;
  --us-soft: #dff1ea;
  --them: #b4380f;
  --them-soft: #fbe6dc;
  --accent: #1d47c9;
  --pull: #f2b200;
  --turn: #c4261d;
  --def: #157a3a;
  --goal: #1d47c9;
  --player: #14243b;
  --holder: #f2b200;
  --radius: 14px;
  --g-M: #2f6fd6; --g-M-ink: #fff;
  --g-F: #c2378f; --g-F-ink: #fff;
  --g-X: #6b7280; --g-X-ink: #fff;
  --c-us: #00875f;
  --c-them: #c2410c;
  --c-grid: #e6e2d8;
  --shadow: 0 1px 0 rgba(0,0,0,.05), 0 2px 10px rgba(16,20,24,.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1215;
    --panel: #181c21;
    --ink: #eef0f2;
    --muted: #9aa2ab;
    --line: #2c333b;
    --us: #3fc394;
    --us-soft: #13302a;
    --them: #ff8a5c;
    --them-soft: #3a2018;
    --accent: #7c9cff;
    --goal: #3b63e0;
    --player: #24364f;
    --c-us: #22a676;
    --c-them: #e0622e;
    --c-grid: #2a3038;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  min-height: 100dvh;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.error { color: var(--turn); min-height: 1.2em; margin: 4px 0; }
.note { background: var(--them-soft); border-radius: 10px; padding: 8px 12px; margin: 8px 0; font-size: .92rem; }
.hint { color: var(--muted); font-size: .78rem; margin: 8px 0 0; }

/* ---------- layout ---------- */
.page { max-width: 720px; margin: 0 auto; padding: 16px 16px 48px; }
.page.narrow { max-width: 440px; }
.page.wide { max-width: 1040px; }
.row { display: flex; gap: 10px; align-items: center; margin: 12px 0; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.section-title { font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 0 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 12px; font-size: 1.05rem; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.topbar-title { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-dot { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff 0 18%, var(--us) 19%); flex: none; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 16px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--panel); color: var(--ink);
  font-weight: 600; text-decoration: none; text-align: center;
  touch-action: manipulation; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.danger { background: var(--turn); border-color: var(--turn); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--turn); }
.btn.ghost { background: transparent; }
.btn.def { background: var(--def); border-color: var(--def); color: #fff; }
.btn.big { min-height: 56px; font-size: 1.05rem; }
.btn.huge { min-height: 64px; font-size: 1.2rem; }
.btn.small { min-height: 34px; padding: 4px 10px; font-size: .9rem; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink);
  font-size: 1.5rem; line-height: 1; text-decoration: none;
}
.icon-btn.danger { color: var(--turn); font-size: 1rem; }
.link { background: none; border: 0; color: var(--accent); padding: 8px 6px; font-weight: 600; text-decoration: none; }

.field { display: grid; gap: 4px; margin: 0 0 12px; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--muted); }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 8px 10px;
  border: 2px solid var(--line); border-radius: 10px; background: var(--panel);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  flex: 1 1 auto; min-height: 44px; padding: 6px 12px; border-radius: 10px;
  border: 2px solid var(--line); background: var(--panel); font-weight: 600;
}
.seg button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg.big button { min-height: 56px; font-size: 1.05rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.chips button {
  min-height: 48px; padding: 6px 14px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--panel); font-weight: 600;
}
.chips button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chips.big button { flex: 1; min-height: 60px; border-radius: 12px; font-size: 1.05rem; }

/* ---------- sheets (popups) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(10,12,14,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: min(100%, 560px); max-height: 92dvh; overflow: auto;
  background: var(--bg); border-radius: 18px 18px 0 0;
  padding: 8px 16px max(16px, env(safe-area-inset-bottom));
  animation: up .14s ease-out;
}
@keyframes up { from { transform: translateY(24px); } }
.sheet-head { display: flex; align-items: center; gap: 8px; }
.sheet-head h2 { flex: 1; font-size: 1.15rem; margin: 10px 0; }
.big-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 8px 0 14px; }
.big-choices.players-pick { grid-template-columns: repeat(2, 1fr); }
.goal-preview { font-size: 1.1rem; font-weight: 700; text-align: center; margin: 14px 0; }
.menu { display: grid; gap: 8px; padding-bottom: 8px; }

#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); }
.toast.warn { background: var(--turn); color: #fff; }

/* ---------- scoreboard & report ---------- */
.scoreboard {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; text-align: center; box-shadow: var(--shadow);
}
.sb-meta { display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; min-height: 1.4em; }
.sb-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 6px 0; }
.sb-team { font-weight: 700; font-size: clamp(1rem, 3.6vw, 1.35rem); overflow-wrap: anywhere; }
.sb-team.us { color: var(--us); text-align: right; }
.sb-team.them { color: var(--them); text-align: left; }
.sb-num { font-size: clamp(2.4rem, 11vw, 3.6rem); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.sb-sub { color: var(--muted); font-size: .88rem; }
.sb-state { color: var(--ink); font-weight: 600; margin-top: 4px; }
.badge { display: inline-block; line-height: 1.4; align-self: center; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 800; letter-spacing: .04em; background: var(--line); color: var(--ink); }
.badge.live { background: var(--turn); color: #fff; animation: blink 1.6s infinite; }
.badge.win { background: var(--us); color: #fff; }
.badge.loss { background: var(--them); color: #fff; }
@keyframes blink { 50% { opacity: .55; } }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.tile-v { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile-l { font-size: .85rem; font-weight: 600; }
.tile-h { font-size: .78rem; color: var(--muted); }

.table-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table.stats { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .92rem; }
table.stats th, table.stats td { padding: 7px 6px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.stats th { font-size: .78rem; color: var(--muted); cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--panel); }
table.stats th.sorted { color: var(--ink); text-decoration: underline; }
table.stats .name { text-align: left; position: sticky; left: 0; background: var(--panel); font-weight: 600; }
table.stats td.zero { color: var(--muted); opacity: .6; }
.num { display: inline-block; min-width: 2.1em; color: var(--muted); font-weight: 500; }

ol.points { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.point { border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.point.us { border-left-color: var(--us); }
.point.them { border-left-color: var(--them); }
.pt-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pt-no { font-weight: 800; }
.pt-od { font-size: .75rem; font-weight: 800; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
.pt-res { font-weight: 600; }
.pt-tag { font-size: .72rem; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: var(--line); }
.pt-tag.break { background: var(--pull); color: #111; }
.pt-score { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.pt-goal { font-size: .9rem; }
.pt-line { font-size: .8rem; color: var(--muted); }

ol.log { list-style: none; margin: 0; padding: 0; font-size: .93rem; }
.ev { display: grid; grid-template-columns: 4.2em 1fr; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.ev[tabindex] { cursor: pointer; }
.ev-t { color: var(--muted); font-variant-numeric: tabular-nums; }
.ev-goal { font-weight: 800; color: var(--us); }
.ev-goal.them { color: var(--them); }
.ev-turnover, .ev-out_of_bounds { color: var(--turn); }
.ev-turnover.them { color: var(--def); }
.ev-defensive_block { color: var(--def); font-weight: 700; }
.ev-line, .ev-halftime, .ev-game_end { font-weight: 700; background: color-mix(in srgb, var(--line) 35%, transparent); }
.ev-pickup { color: var(--muted); }

/* ---------- public list ---------- */
.hero { padding: 28px 16px 8px; max-width: 720px; margin: 0 auto; }
.hero h1 { margin: 0; font-size: clamp(1.6rem, 6vw, 2.2rem); letter-spacing: -.01em; }
.hero p { margin: 6px 0 0; color: var(--muted); }
.game-list { display: grid; gap: 10px; }
.game-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow);
}
.gc-top { display: flex; gap: 8px; align-items: center; font-size: .85rem; }
.gc-main { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 1.1rem; font-weight: 700; margin-top: 4px; }
.gc-main strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.gc-sub { font-size: .82rem; color: var(--muted); }
.chip { font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--line); }
.chip.live { background: var(--turn); color: #fff; }
.chip.completed { background: var(--ink); color: var(--bg); }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 14px 0 4px; border-bottom: 2px solid var(--line); }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }

/* ---------- tracker: setup ---------- */
.roster { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.roster li { display: grid; grid-template-columns: 3.6em 1fr 4.2em 40px; gap: 6px; align-items: center; }
.roster li.muted { display: block; }
.roster-add { display: grid; grid-template-columns: 3.6em 1fr 4.2em auto; gap: 6px; }
.num-in { text-align: center; padding: 8px 4px; }
.copy-roster { margin-top: 10px; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 16px 0 max(8px, env(safe-area-inset-bottom)); margin: 0; }

/* ---------- tracker: line selection ---------- */
.line-count { font-size: 1.1rem; margin: 12px 0 8px; }
.line-count .ok { color: var(--us); }
.line-count .over { color: var(--turn); }
.line-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.pick {
  display: flex; align-items: center; gap: 8px; min-height: 58px; padding: 6px 10px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--panel); text-align: left; font-weight: 700;
  touch-action: manipulation;
}
.pick { min-width: 0; }
.pick-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-num { flex: none; min-width: 2em; font-size: 1.1rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pick.g-F { border-left: 8px solid var(--g-F); }
.pick.g-M { border-left: 8px solid var(--g-M); }
.pick.g-X { border-left: 8px solid var(--g-X); }
.pick.on.g-F { background: var(--g-F); border-color: var(--g-F); color: var(--g-F-ink); }
.pick.on.g-M { background: var(--g-M); border-color: var(--g-M); color: var(--g-M-ink); }
.pick.on.g-X { background: var(--g-X); border-color: var(--g-X); color: var(--g-X-ink); }
.pick.on { box-shadow: inset 0 0 0 3px rgba(0,0,0,.25); }
.pick.on .pick-num { color: inherit; opacity: .75; }
.pick.on::after { content: "✓"; flex: none; font-weight: 900; }
.pick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 6px 0 12px; }
.gtag { font-weight: 800; padding: 0 6px; border-radius: 6px; }
.gtag.g-F { background: var(--g-F); color: var(--g-F-ink); }
.gtag.g-M { background: var(--g-M); color: var(--g-M-ink); }
.ratio { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; margin: 0 0 10px; border-radius: 10px; background: var(--panel); border: 2px solid var(--line); font-size: .95rem; }
.ratio.off { border-color: var(--pull); background: color-mix(in srgb, var(--pull) 18%, var(--panel)); }
.ratio .abba { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--bg); font-weight: 800; }
.ratio .warn { color: var(--turn); }
.ratio .ok { color: var(--us); }
.roster li.g-F .num-in { border-left: 6px solid var(--g-F); }
.roster li.g-M .num-in { border-left: 6px solid var(--g-M); }
.roster li.g-X .num-in { border-left: 6px solid var(--g-X); }
.color-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.color-row input[type=color] { width: 56px; min-height: 44px; padding: 2px; }
.color-row .pick { flex: 1; pointer-events: none; min-height: 48px; }
.check { display: flex; align-items: center; gap: 10px; margin: 8px 0 12px; font-weight: 600; }
.check input { width: 22px; min-height: 22px; }
.pt-gender { font-size: .8rem; }
.pt-gender.off { color: var(--turn); font-weight: 700; }
.secondary-actions .btn { flex: 1 1 auto; }

/* ---------- tracker: live ---------- */
.live-screen { max-width: 560px; margin: 0 auto; padding: 0 10px max(16px, env(safe-area-inset-bottom)); }
.live-head { display: flex; align-items: center; gap: 6px; padding-top: max(6px, env(safe-area-inset-top)); }
.live-score { flex: 1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.ls-team { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.ls-team:first-child { text-align: right; color: var(--us); }
.ls-team:last-child { color: var(--them); }
.ls-num { font-size: 2.1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.live-state {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; border-radius: 12px; margin: 4px 0 8px; font-size: .95rem;
  background: var(--panel); border: 2px solid var(--line);
}
.live-state strong { flex: 1; }
.live-state.o { background: var(--us-soft); border-color: var(--us); }
.live-state.d { background: var(--them-soft); border-color: var(--them); }
.armed { background: var(--pull); color: #111; font-weight: 800; text-align: center; border-radius: 10px; padding: 6px; margin-bottom: 8px; }

.players { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(2, auto); gap: 6px; }
.player-gap { border: 2px dashed var(--line); border-radius: 12px; min-height: 78px; opacity: .6; }
.player {
  min-width: 0; min-height: 78px; border: 3px solid transparent; border-radius: 12px;
  background: var(--player); color: #fff; font-weight: 800;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 6px 4px; text-align: center;
  touch-action: manipulation; user-select: none; -webkit-tap-highlight-color: transparent;
}
.player:active:not(:disabled) { filter: brightness(1.3); }
.player .p-num { font-size: .8rem; opacity: .75; font-variant-numeric: tabular-nums; line-height: 1.1; }
.player .p-name { display: block; max-width: 100%; font-size: 1.02rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player.holder { background: var(--holder); color: #111; border-color: #111; }
.player.prev { border-color: var(--holder); }
.player:disabled { opacity: .38; cursor: default; }
.gender-live .player.g-F { box-shadow: inset 0 6px 0 var(--g-F); }
.gender-live .player.g-M { box-shadow: inset 0 6px 0 var(--g-M); }
.gender-live .player.g-X { box-shadow: inset 0 6px 0 var(--g-X); }

/* who has the disc */
.poss { border-radius: 14px; padding: 8px 12px; margin: 4px 0 8px; color: #fff; }
.poss.us { background: var(--us); }
.poss.them { background: var(--them); }
.poss.pull { background: var(--pull); color: #111; }
.poss-main { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }
.poss-main .disc { width: 20px; height: 20px; border-radius: 50%; background: currentColor; box-shadow: inset 0 0 0 4px rgba(0,0,0,.25); flex: none; }
.poss-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .92rem; font-weight: 600; opacity: .95; }
.poss-sub > :first-child { flex: 1; }
.poss .sync { color: inherit; }
.poss .sync .dot { box-shadow: 0 0 0 2px rgba(255,255,255,.7); }
.ls-team.has::before { content: "●"; margin-right: 4px; }
.ls-team:last-child.has::before { content: ""; margin: 0; }
.ls-team:last-child.has::after { content: " ●"; }
.callahan { background: var(--pull); color: #111; font-weight: 800; padding: 8px 10px; border-radius: 10px; }
.callahan.them { background: var(--them-soft); color: var(--ink); font-weight: 600; }

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.act {
  min-height: 60px; border: 0; border-radius: 14px; font-weight: 800; font-size: 1rem; letter-spacing: .02em;
  color: #fff; touch-action: manipulation; user-select: none; -webkit-tap-highlight-color: transparent;
}
.act:active:not(:disabled) { filter: brightness(1.2); }
.act:disabled { opacity: .35; cursor: default; }
.act.pull { background: var(--pull); color: #111; }
.act.pull.pulse { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--pull) 40%, transparent); } }
.act.turn { background: var(--turn); }
.act.def { background: var(--def); }
.act.minor { background: var(--panel); color: var(--ink); border: 2px solid var(--line); }
.act.brk.on { background: var(--pull); color: #111; border-color: #111; }
.act.goal { grid-column: 1 / -1; background: var(--goal); font-size: 1.4rem; min-height: 72px; }
.act.undo { background: var(--panel); color: var(--ink); border: 2px solid var(--ink); }
.live-foot { display: flex; justify-content: space-around; flex-wrap: wrap; margin: 6px 0; }
.recent { margin-top: 6px; }
.recent h3 { font-size: .95rem; margin: 8px 0 4px; }

.sync { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; font-size: .8rem; font-weight: 700; color: var(--muted); padding: 4px; white-space: nowrap; }
.sync .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--us); }
.sync.busy .dot { background: var(--pull); }
.sync.off .dot, .sync.err .dot { background: var(--turn); }
.sync.off, .sync.err { color: var(--turn); }

.members { list-style: none; padding: 0; margin: 0 0 8px; }
.members li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.invite-box { display: grid; gap: 8px; }

@media (max-height: 700px) {
  .player, .player-gap { min-height: 64px; }
  .act { min-height: 52px; }
  .act.goal { min-height: 58px; }
}

/* ---------- opponent pass button ---------- */
.opp-pass {
  width: 100%; min-height: 162px; border: 0; border-radius: 14px;
  background: var(--them); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  touch-action: manipulation; user-select: none; -webkit-tap-highlight-color: transparent;
}
.opp-pass:active { filter: brightness(1.2); transform: scale(.99); }
.op-big { font-size: 1.6rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.op-sub { font-size: .95rem; font-weight: 600; opacity: .9; }
.ratio-mark {
  display: inline-grid; place-items: center; width: 26px; height: 26px; margin-left: 10px; border-radius: 50%;
  background: var(--turn); color: #fff; font-size: 1rem; font-weight: 900; line-height: 1;
}

/* ---------- charts ---------- */
.chart-card h3 { margin-bottom: 2px; }
.chart-sub { margin: 0 0 8px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--c-grid); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 20px; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.us { stroke: var(--c-us); }
.chart .line.them { stroke: var(--c-them); }
.chart .dot { stroke: var(--panel); stroke-width: 2; }
.chart .dot.us, .chart .bar.us { fill: var(--c-us); }
.chart .dot.them, .chart .bar.them { fill: var(--c-them); }
.chart .hit { fill: transparent; cursor: default; outline: none; }
.chart .hit:hover, .chart .hit:focus { fill: color-mix(in srgb, var(--ink) 6%, transparent); }
.x-title { text-align: center; font-size: .78rem; color: var(--muted); margin-top: -4px; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.key.us { background: var(--c-us); }
.key.them { background: var(--c-them); }
.chart-tip {
  position: absolute; z-index: 70; transform: translate(-50%, -100%); max-width: min(320px, 90vw);
  background: var(--ink); color: var(--bg); font-size: .85rem; font-weight: 600; padding: 6px 10px; border-radius: 8px; pointer-events: none;
}
.hbars { display: grid; gap: 6px; }
.hbar-row { display: grid; grid-template-columns: minmax(70px, 30%) 1fr 2.5em; align-items: center; gap: 8px; font-size: .9rem; outline: none; }
.hbar-row:hover, .hbar-row:focus { background: color-mix(in srgb, var(--ink) 5%, transparent); border-radius: 6px; }
.hbar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 14px; }
.hbar { display: block; height: 14px; border-radius: 0 4px 4px 0; background: var(--c-us); min-width: 2px; }
.hbar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

.line-groups { display: grid; gap: 6px; }
.group-head { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 700; color: var(--muted); margin-top: 8px; }
.key.g-F { background: var(--g-F); }
.key.g-M { background: var(--g-M); }
.key.g-X { background: var(--g-X); }
.btn.debug { border-style: dashed; border-color: var(--pull); margin-bottom: 8px; }

/* ---------- player table gender + grouping ---------- */
table.stats td.name { border-left: 5px solid var(--g-X); }
table.stats td.name.g-F { border-left-color: var(--g-F); }
table.stats td.name.g-M { border-left-color: var(--g-M); }
table.stats .group-row td { text-align: left; font-weight: 800; font-size: .85rem; background: var(--bg); color: var(--muted); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-head h3 { margin: 0; }

/* ---------- team comparison ---------- */
.cmp-head { display: flex; justify-content: space-between; font-weight: 800; margin-bottom: 6px; }
.cmp-team { display: inline-flex; align-items: center; gap: 6px; }
.cmp { display: grid; gap: 2px; }
.cmp-row { display: grid; grid-template-columns: 3.4em 1fr 1fr 3.4em; grid-template-areas: "label label label label" "va ta tb vb"; align-items: center; column-gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.cmp-label { grid-area: label; text-align: center; font-size: .82rem; font-weight: 700; color: var(--muted); }
.cmp-val { font-variant-numeric: tabular-nums; font-size: 1rem; }
.cmp-val.us { grid-area: va; text-align: left; }
.cmp-val.them { grid-area: vb; text-align: right; }
.cmp-val.win { font-weight: 800; }
.cmp-track { height: 12px; display: flex; }
.cmp-track.us { grid-area: ta; justify-content: flex-end; }
.cmp-track.them { grid-area: tb; justify-content: flex-start; }
.cmp-bar { display: block; height: 12px; min-width: 2px; }
.cmp-bar.us { background: var(--c-us); border-radius: 4px 0 0 4px; }
.cmp-bar.them { background: var(--c-them); border-radius: 0 4px 4px 0; }
