/* Gauntlet: same bones as dev-cockpit (tokens, dark nav, cards, pills), tuned for phones at the court. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e2e5ea;
  --text: #1c2026;
  --muted: #626a77;
  --accent: #3b5bdb;
  --accent-soft: #e7ecfd;
  --ok: #237a36;
  --ok-soft: #e3f5e7;
  --warn: #a15300;
  --warn-soft: #fff1dc;
  --err: #c92a2a;
  --err-soft: #fde8e8;
  --run: #1864ab;
  --run-soft: #e2f0fd;
  --gold: #b7791f;
  --gold-soft: #fdf3dc;
  --accent-fill: #3b5bdb;
  --err-fill: #c92a2a;
  --ok-fill: #2b8a3e;
  --on-fill: #ffffff;
  --nav-bg: #1d2128;
  --nav-text: #c7ccd4;
  --nav-active: #ffffff;
  --radius: 8px;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121418; --surface: #1a1d23; --surface-2: #22262e; --border: #2d323b; --text: #e3e6eb; --muted: #99a1ae;
    --accent: #7c96f5; --accent-soft: #252d4a; --ok: #69c77f; --ok-soft: #1c3223; --warn: #f0a44b; --warn-soft: #3a2a14;
    --err: #f07272; --err-soft: #3d1d1f; --run: #5aa9f0; --run-soft: #192c40; --gold: #f0c35a; --gold-soft: #3a3017;
    --accent-fill: #3d5bd9; --err-fill: #c53030; --ok-fill: #2f9e44; --nav-bg: #0d0f12; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121418; --surface: #1a1d23; --surface-2: #22262e; --border: #2d323b; --text: #e3e6eb; --muted: #99a1ae;
  --accent: #7c96f5; --accent-soft: #252d4a; --ok: #69c77f; --ok-soft: #1c3223; --warn: #f0a44b; --warn-soft: #3a2a14;
  --err: #f07272; --err-soft: #3d1d1f; --run: #5aa9f0; --run-soft: #192c40; --gold: #f0c35a; --gold-soft: #3a3017;
  --accent-fill: #3d5bd9; --err-fill: #c53030; --ok-fill: #2f9e44; --nav-bg: #0d0f12; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text);
  display: flex; min-height: 100vh; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 650; }
h2 { font-size: 16px; margin: 0 0 10px; font-weight: 650; }
h3 { font-size: 14px; margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* nav */
.nav { width: 200px; flex: none; background: var(--nav-bg); color: var(--nav-text); display: flex; flex-direction: column;
  padding: 16px 10px; position: sticky; top: 0; height: 100vh; }
.brand { color: var(--nav-active); font-weight: 750; font-size: 17px; padding: 4px 10px 16px; display: flex; gap: 8px; align-items: center; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.brand-mark { color: #f0c35a; font-size: 18px; }
.nav nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav nav a { color: var(--nav-text); padding: 8px 10px; border-radius: 6px; display: flex; gap: 8px; align-items: center; }
.nav nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.nav nav a.active { background: rgba(255,255,255,.1); color: var(--nav-active); }
.nav-sep { height: 1px; background: rgba(255,255,255,.08); margin: 8px 6px; }
.ico { width: 18px; text-align: center; display: inline-block; }
.nav-foot { font-size: 12px; padding: 8px 10px 0; opacity: .75; display: flex; flex-direction: column; gap: 6px; }
.nav-foot a, .nav-foot button { color: var(--nav-text); }
.linkish { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--accent); }
.nav-toggle, .nav-backdrop { display: none; }

main { flex: 1; min-width: 0; padding: 24px 28px 64px; max-width: 1400px; margin: 0 auto; }
.page-head { margin-bottom: 18px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }

/* cards & grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }

/* pills */
.pill { display: inline-block; font-size: 11.5px; line-height: 18px; padding: 0 7px; border-radius: 9px; background: var(--surface-2); color: var(--muted); font-weight: 500; vertical-align: 1px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad, .pill.error { background: var(--err-soft); color: var(--err); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info, .pill.running, .pill.live { background: var(--run-soft); color: var(--run); }
.pill.gold { background: var(--gold-soft); color: var(--gold); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.live::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 5px; vertical-align: 1px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .pill.live::before { animation: none; } }
.form-line { display: inline-flex; gap: 3px; }
.form-line span { width: 18px; height: 18px; border-radius: 4px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.form-line .W { background: var(--ok-soft); color: var(--ok); }
.form-line .L { background: var(--err-soft); color: var(--err); }
.form-line .D { background: var(--surface-2); color: var(--muted); }

/* notices */
.notice { padding: 9px 12px; border-radius: 6px; margin-bottom: 12px; background: var(--run-soft); color: var(--run); border: 1px solid transparent; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.error { background: var(--err-soft); color: var(--err); }
.flashes { position: sticky; top: 8px; z-index: 30; }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
table.grid th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--border); padding: 6px 8px; white-space: nowrap; }
table.grid td { border-bottom: 1px solid var(--border); padding: 7px 8px; vertical-align: middle; }
table.grid tr:last-child td { border-bottom: none; }
table.grid th.num, table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tr.dim td { opacity: .55; }
table.grid tr.me td { background: var(--accent-soft); }
table.grid td.rank { width: 36px; color: var(--muted); font-variant-numeric: tabular-nums; }
.medal { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.medal.p1 { background: #f0c35a; color: #3a2a00; }
.medal.p2 { background: #c9ced6; color: #2a2f36; }
.medal.p3 { background: #d9a178; color: #3a1f0a; }
table.kv { border-collapse: collapse; font-size: 13px; }
table.kv th { text-align: left; color: var(--muted); font-weight: 500; padding: 3px 14px 3px 0; vertical-align: top; white-space: nowrap; }
table.kv td { padding: 3px 0; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

/* forms */
.form { display: flex; flex-direction: column; gap: 14px; max-width: 720px; }
.field label, .field > .label { display: block; font-weight: 550; margin-bottom: 4px; }
.field-check label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); max-width: 100%; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=date], .field input[type=datetime-local], .field select, .field textarea { width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { min-height: 76px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.fields-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.actions { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; }
.btn { font: inherit; font-weight: 600; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); padding: 8px 16px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; line-height: 1.3; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-fill); }
.btn-ok { background: var(--ok-fill); border-color: var(--ok-fill); color: var(--on-fill); }
.btn-danger { background: var(--err-fill); border-color: var(--err-fill); color: var(--on-fill); }
.btn-primary:hover, .btn-danger:hover, .btn-ok:hover { border-color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-ghost { background: transparent; }
.btn[disabled] { opacity: .55; cursor: default; }
form.inline { display: inline; }

/* choice cards (format picker) */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.choice { position: relative; display: block; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; background: var(--surface); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice .t { font-weight: 650; display: block; }
.choice .d { font-size: 12.5px; color: var(--muted); display: block; margin-top: 2px; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; max-height: 320px; overflow-y: auto; padding: 2px; }
.pick label { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; background: var(--surface); font-weight: 500; min-height: 38px; }
.pick label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pick-filter { margin-bottom: 8px; width: 100%; }
.opt-group[hidden] { display: none; }
.court-row { flex-wrap: nowrap; }
.court-row input { flex: 1; min-width: 0; }

/* matches */
.matches { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.match { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 10px 12px; min-width: 0; }
.match.done { background: var(--surface); }
.match.live { border-color: var(--run); box-shadow: 0 0 0 1px var(--run); }
.match.pending { opacity: .7; }
.match.bye { opacity: .55; }
.match-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.match-side { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.match-side .who { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.match-side.win .who { font-weight: 650; }
.match-side.lose .who { color: var(--muted); }
.match-side .sc { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; font-size: 15px; }
.match-side .sets { display: inline-flex; gap: 6px; font-variant-numeric: tabular-nums; }
.match-side .sets span { min-width: 16px; text-align: center; }
.match-side .sets span.w { font-weight: 700; }
.match-foot { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.match details > summary { list-style: none; display: inline-flex; }
.match details > summary::-webkit-details-marker { display: none; }
.score-form { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.score-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.score-row .who { overflow-wrap: anywhere; font-size: 13px; }
.score-in { width: 64px; text-align: center; font-size: 16px; font-weight: 650; padding: 8px 4px; }
.sets-in { display: inline-flex; gap: 4px; }
.sets-in input { width: 44px; text-align: center; padding: 7px 2px; font-size: 15px; font-weight: 600; }
.outcome-btns { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; }
.err-inline { color: var(--err); font-size: 12.5px; }
.sitout { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.round { margin-bottom: 18px; }
.round-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 8px; }
.round-head h3 { font-size: 14px; }

/* now playing */
.now { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.court-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent-fill); }

/* bracket */
.bracket { display: flex; gap: 18px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.bracket-col { display: flex; flex-direction: column; min-width: 220px; flex: 0 0 220px; }
.bracket-col h4 { margin: 0 0 8px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.bracket-col .col-body { display: flex; flex-direction: column; justify-content: space-around; gap: 10px; flex: 1; }
.bracket .match { padding: 8px 10px; }
.podium { display: flex; gap: 10px; flex-wrap: wrap; }
.podium .place { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius); background: var(--surface-2); font-weight: 600; }
.podium .place.p1 { background: var(--gold-soft); color: var(--gold); }

/* live scorer */
.live-wrap { max-width: 640px; margin: 0 auto; }
.scoreboard { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sb-side { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface); text-align: center; position: relative; }
.sb-side.turn { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.sb-name { font-weight: 650; overflow-wrap: anywhere; }
.sb-big { font-size: 48px; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; margin: 6px 0; }
.sb-sub { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.sb-tap { display: block; width: 100%; border: 0; border-radius: 12px; padding: 22px 8px; font: inherit; font-size: 20px; font-weight: 700; color: var(--on-fill); background: var(--accent-fill); cursor: pointer; touch-action: manipulation; }
.sb-tap:active { transform: scale(.98); }
.sb-tap.alt { background: #7048e8; }
.sb-minus { margin-top: 6px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.keypad button { font: inherit; font-size: 22px; font-weight: 650; padding: 16px 0; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; touch-action: manipulation; }
.keypad button:active { background: var(--surface-2); }
.keypad .k-ok { background: var(--ok-fill); color: var(--on-fill); border-color: var(--ok-fill); }
.keypad .k-del { background: var(--surface-2); }
.quick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 8px; }
.quick button { font: inherit; font-weight: 600; padding: 9px 0; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
.visit-display { font-size: 34px; font-weight: 750; text-align: center; min-height: 52px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.hint-out { text-align: center; color: var(--ok); font-weight: 650; min-height: 22px; }
.visits { display: flex; flex-wrap: wrap; gap: 4px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.visits span { padding: 2px 6px; border-radius: 4px; background: var(--surface-2); }
.visits span.bust { background: var(--err-soft); color: var(--err); text-decoration: line-through; }
.visits span.s1 { background: var(--accent-soft); }
.tennis-points { font-size: 40px; font-weight: 750; }
.sets-line { display: inline-flex; gap: 8px; justify-content: center; font-variant-numeric: tabular-nums; }

/* sparkline */
svg.spark { width: 100%; max-width: 240px; height: 44px; display: block; }
svg.spark polyline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.stat { display: flex; flex-direction: column; }
.stat .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .l { font-size: 12px; color: var(--muted); }
.stats { display: flex; gap: 22px; flex-wrap: wrap; }

/* login */
.login { max-width: 380px; margin: 8vh auto; }
.login .brand-big { font-size: 28px; font-weight: 800; margin-bottom: 4px; display: flex; gap: 10px; align-items: center; }
.btn-google { width: 100%; justify-content: center; background: var(--surface); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

body.bare { display: block; }
body.bare main { max-width: 1100px; }
.public-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }

.share { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.share input { flex: 1; min-width: 200px; font-family: var(--mono); font-size: 12px; }

@media (max-width: 760px) {
  body { flex-direction: column; }
  .nav { width: auto; height: 52px; position: sticky; top: 0; z-index: 40; padding: 0 12px; flex-direction: row; align-items: center; gap: 8px; }
  .brand { padding: 4px 6px; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; font: inherit; font-size: 20px;
    color: var(--nav-active); background: transparent; border: 1px solid rgba(255,255,255,.15); border-radius: 6px; cursor: pointer; margin-left: auto; }
  .nav nav, .nav-foot { display: none; }
  body.nav-open .nav nav { display: flex; position: fixed; top: 52px; left: 0; bottom: 0; width: min(300px, 86vw); z-index: 60; overflow-y: auto;
    background: var(--nav-bg); padding: 8px 10px 24px; box-shadow: 4px 0 24px rgba(0,0,0,.35); }
  body.nav-open .nav-foot { display: flex; position: fixed; left: 0; bottom: 0; width: min(300px, 86vw); z-index: 61; background: var(--nav-bg); padding: 10px 20px 16px; }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 52px 0 0 0; z-index: 55; background: rgba(0,0,0,.4); }
  main { padding: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .matches, .now { grid-template-columns: 1fr; }
  h1 { font-size: 20px; }
  .sb-big { font-size: 40px; }
  table.grid .hide-sm { display: none; }
}
