:root {
  --bg: #f4f5f7; --panel: #ffffff; --text: #16181d; --muted: #646b78; --line: #dfe2e8;
  --accent: #e8590c; --accent-text: #ffffff; --ok: #2b8a3e; --warn: #b7791f; --bad: #c92a2a;
  --chip: #eef0f4; --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1115; --panel: #181b21; --text: #e9ecf1; --muted: #9aa2b1; --line: #2a2f38;
          --chip: #232730; --ok: #51cf66; --warn: #fcc419; --bad: #ff6b6b; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 16px; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .brand { font-weight: 700; } .topbar .brand span { color: var(--accent); }
.topbar .brand a.home { color: inherit; text-decoration: none; } .topbar .brand a.home:hover { opacity: .8; }
.spacer { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { min-width: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 10px; min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button, .btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--chip); color: var(--text);
  border-radius: 8px; padding: 9px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
button.small { padding: 4px 9px; font-size: .85rem; }
.muted { color: var(--muted); } .ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; background: var(--chip); font-size: .8rem; font-weight: 600; }
.pill.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); }
.pill.warn { background: color-mix(in srgb, var(--warn) 22%, transparent); }
.pill.bad { background: color-mix(in srgb, var(--bad) 18%, transparent); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }
tr.voided td { text-decoration: line-through; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: none; border-bottom: 3px solid transparent; border-radius: 0; color: var(--muted); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.hidden { display: none !important; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; z-index: 50; max-width: 90vw; }
.big-clock { font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.stat { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.vision-stage { position: relative; background: #111; border-radius: 10px; overflow: hidden; }
.vision-stage video { width: 100%; height: auto; display: block; background: #111; max-height: 520px; }
.vision-stage canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.vision-readout { position: absolute; left: 10px; right: 10px; bottom: 10px; background: color-mix(in srgb, #000 68%, transparent);
  color: #fff; border-radius: 8px; padding: 8px 12px; font-size: 1.25rem; font-weight: 700; }
.vision-readout.ok { color: #8ce99a; }
.vision-readout.warn { color: #ffd43b; }

.progress-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.progress-tile {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}
.progress-tile .stat { line-height: 1.1; margin-bottom: 2px; }
.progress-tile.tone-ok .stat { color: var(--ok); }
.progress-tile.tone-accent .stat { color: var(--accent); }
.progress-tile.tone-warn .stat { color: var(--warn); }
.progress-tile.tone-bad .stat { color: var(--bad); }

.progress-stations { display: flex; flex-direction: column; gap: 10px; }
.progress-stations-head {
  font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: -2px;
}
.progress-finish-bar {
  height: 6px; border-radius: 99px; background: var(--chip); overflow: hidden; margin-bottom: 4px;
}
.progress-finish-fill {
  height: 100%; border-radius: 99px; background: var(--ok); transition: width .35s ease;
}
.progress-station-top {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  margin-bottom: 4px; font-size: .9rem;
}
.progress-bar {
  height: 8px; border-radius: 99px; background: var(--chip); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 99px; background: var(--accent); transition: width .35s ease;
}

.winners-subtabs { margin-bottom: 12px; }
.winners-table td b { font-weight: 600; }
