/* KC Neural Racing (mobile). Broadcast-style chrome; system font for text, Barlow Condensed for display. */
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/BarlowCondensed-8.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: italic; font-weight: 800; font-display: swap; src: url(fonts/BarlowCondensed-5.woff2) format('woff2'); }

:root {
  color-scheme: light;
  --font-display: "Barlow Condensed", "Arial Narrow", -apple-system, system-ui, sans-serif;
  --font-body: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;

  --surface-0: #efeee9; --surface-1: #ffffff; --surface-2: #f4f3ef; --surface-3: #e9e7e1; --border: #e1dfd8;
  --text-primary: #101114; --text-secondary: #4d4f55; --text-muted: #6f7178;
  --grid: #ecebe6; --axis: #c9c7c0;
  --shadow: 0 1px 2px rgba(20, 20, 30, .06), 0 0 0 1px rgba(20, 20, 30, .05);
  --carbon: #111317; --carbon-2: #1b1e24; --carbon-3: #272b33; --carbon-line: #2e333c; --carbon-text: #f4f4f2; --carbon-muted: #9aa0aa;
  --brand: #e5322d; --brand-2: #ff5a3c;
  --series-1: #2a78d6; --series-2: #eb6834; --accent: #2a78d6;
  --good: #0f9d58; --warning: #f2a516; --critical: #d63a3a;
  --neg: #2a78d6; --pos: #e34948; --neutral: #e6e5e1;
  --map-bg: #eceae4; --map-building: #d8d5cc; --map-park: #d3e5c8; --map-water: #bcd6ec; --map-street: #f8f7f4;
  --map-road: #ffffff; --map-curb: #8d8b84; --map-center: #d9d7d0; --ray-wall: #6f6e69; --ray-car: #d03b3b;
  --tabbar-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #0a0c0f; --surface-1: #13161b; --surface-2: #1b1f26; --surface-3: #242932; --border: #262b33;
    --text-primary: #eef0f3; --text-secondary: #b6bcc5; --text-muted: #8a919b;
    --grid: #1f242b; --axis: #3a414b;
    --shadow: 0 0 0 1px #20252d;
    --carbon: #07080a; --carbon-2: #121418; --carbon-3: #1d2026; --carbon-line: #252931;
    --series-1: #3f8cea; --series-2: #f0763f; --accent: #3f8cea;
    --neg: #3f8cea; --pos: #e66767; --neutral: #343a43; --good: #2fbf71;
    --map-bg: #12151a; --map-building: #242931; --map-park: #15241a; --map-water: #132235;
    --map-street: #1d2128; --map-road: #383d46; --map-curb: #8a909a; --map-center: #4b515b;
    --ray-wall: #b9bec6; --ray-car: #ff6b6b;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #0a0c0f; --surface-1: #13161b; --surface-2: #1b1f26; --surface-3: #242932; --border: #262b33;
  --text-primary: #eef0f3; --text-secondary: #b6bcc5; --text-muted: #8a919b;
  --grid: #1f242b; --axis: #3a414b;
  --shadow: 0 0 0 1px #20252d;
  --carbon: #07080a; --carbon-2: #121418; --carbon-3: #1d2026; --carbon-line: #252931;
  --series-1: #3f8cea; --series-2: #f0763f; --accent: #3f8cea;
  --neg: #3f8cea; --pos: #e66767; --neutral: #343a43; --good: #2fbf71;
  --map-bg: #12151a; --map-building: #242931; --map-park: #15241a; --map-water: #132235;
  --map-street: #1d2128; --map-road: #383d46; --map-curb: #8a909a; --map-center: #4b515b;
  --ray-wall: #b9bec6; --ray-car: #ff6b6b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--surface-0); color: var(--text-primary);
  font: 15px/1.45 var(--font-body); -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b));
  overscroll-behavior-y: none;
}
h1, h2, h3 { font-family: var(--font-display); text-transform: uppercase; }
h1 { font-size: 21px; margin: 0; font-weight: 800; font-style: italic; letter-spacing: .01em; line-height: 1; white-space: nowrap; }
h2 { font-size: 19px; margin: 0; font-weight: 700; letter-spacing: .02em; line-height: 1.15; }
h3 { font-size: 15px; margin: 0; font-weight: 700; letter-spacing: .04em; }
.sub { color: var(--text-muted); font-size: 13px; font-weight: 400; margin: 3px 0 0; text-transform: none; letter-spacing: 0; font-family: var(--font-body); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
button { font-family: inherit; }

/* ---------------------------------------------------------- header (always dark) */
.top {
  position: sticky; top: 0; z-index: 10; background: var(--carbon); color: var(--carbon-text);
  padding-top: var(--safe-t);
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px 4px; }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.logo { display: inline-grid; place-items: center; width: 34px; height: 25px; color: #fff; background: var(--brand); transform: skewX(-14deg); border-radius: 3px; flex: none; }
.logo svg { transform: skewX(14deg); }
.brand h1 .b1 { color: var(--brand-2); }
.run {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  font: 700 15px/1 var(--font-display); text-transform: uppercase; letter-spacing: .06em;
  background: var(--brand); color: #fff; border: 0; border-radius: 20px; padding: 9px 16px 9px 13px; min-height: 38px; cursor: pointer;
}
.run:active { transform: scale(.97); }
.run:disabled { background: var(--carbon-3); color: var(--carbon-muted); }
.run .i-pause { display: none; }
.run.on { background: var(--carbon-3); color: var(--carbon-text); box-shadow: inset 0 0 0 1px var(--carbon-line); }
.run.on .i-pause { display: block; }
.run.on .i-play { display: none; }
.statusbar { display: flex; align-items: center; gap: 8px; padding: 2px 16px 9px; color: var(--carbon-muted); font-size: 13px; min-height: 26px; }
#statusText { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.statusbar .live {
  display: none; font: 800 11px/1 var(--font-display); font-style: italic; letter-spacing: .1em; text-transform: uppercase;
  background: var(--brand); color: #fff; padding: 3px 6px 2px; border-radius: 2px; flex: none;
}
.statusbar.running .live { display: inline-block; animation: livepulse 2s ease-in-out infinite; }
.statusbar.running .dot { display: none; }
.statusbar.running #statusText { color: var(--carbon-text); }
.statusbar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--carbon-muted); flex: none; }
.statusbar.error .dot { background: var(--critical); }
@keyframes livepulse { 50% { opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .statusbar.running .live { animation: none; } }
.genbar { height: 3px; background: var(--carbon-2); }
.genbar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .25s linear; }

/* ---------------------------------------------------------- bottom tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--carbon) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--carbon-line); padding-bottom: var(--safe-b);
}
.tab {
  height: var(--tabbar-h); border: 0; background: none; color: var(--carbon-muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font: 700 11.5px/1 var(--font-display); text-transform: uppercase; letter-spacing: .07em; position: relative;
}
.tab svg { width: 23px; height: 23px; }
.tab.active { color: var(--carbon-text); }
.tab.active::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; background: var(--brand); transform: skewX(-20deg); }

/* ---------------------------------------------------------- layout */
main { padding: 12px 12px 20px; max-width: 760px; margin: 0 auto; }
.tabpage { display: none; }
.tabpage.active { display: block; }
.error { margin: 10px 12px 0; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--critical); color: var(--critical); background: var(--surface-1); white-space: pre-wrap; font-size: 13px; }
.card { background: var(--surface-1); box-shadow: var(--shadow); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.card > .card-head h2, .section-head h2, .explain > h2, #tab-settings .card > h2 { display: flex; align-items: center; gap: 9px; }
.card > .card-head h2::before, .section-head h2::before, .explain > h2::before, #tab-settings .card > h2::before {
  content: ""; width: 5px; height: 16px; background: var(--brand); transform: skewX(-14deg); flex: none;
}
.section-head { margin: 4px 2px 12px; }
.note { font-size: 13px; color: var(--text-secondary); margin: 10px 0 0; }

.btn {
  font: 700 14px/1 var(--font-display); text-transform: uppercase; letter-spacing: .06em;
  padding: 10px 14px; border-radius: 8px; cursor: pointer; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-primary); min-height: 40px;
}
.btn.small { padding: 8px 11px; min-height: 36px; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.btn:disabled { opacity: .5; }
.btn.danger { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 45%, var(--border)); background: transparent; margin-top: 12px; }

.tno {
  --tc: #888; --tt: #fff;
  display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 4px;
  background: var(--tc); color: var(--tt); border-radius: 3px; flex: none;
  font: italic 800 13px/1 var(--font-display);
}
.tno.big { min-width: 42px; height: 38px; font-size: 24px; border-radius: 5px; transform: skewX(-8deg); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }
.sw.neg { background: var(--neg); } .sw.zero { background: var(--neutral); } .sw.pos { background: var(--pos); }
.badge {
  font: 700 10.5px/1 var(--font-display); text-transform: uppercase; letter-spacing: .08em;
  padding: 3px 5px 2px; border-radius: 2px; background: var(--surface-3); color: var(--text-secondary); white-space: nowrap;
}
.badge.brand { background: var(--brand); color: #fff; }
.empty-note { color: var(--text-muted); font-size: 13px; padding: 8px 0; }

/* ---------------------------------------------------------- segmented */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; max-width: 100%; }
.seg.scroll { overflow-x: auto; scrollbar-width: none; }
.seg.scroll::-webkit-scrollbar { display: none; }
.seg.wide { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; margin-top: 10px; }
.seg button {
  font: 700 14px/1 var(--font-display); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
  border: 0; background: none; color: var(--text-muted); padding: 9px 12px; border-radius: 7px; cursor: pointer; min-height: 36px;
}
.seg button.on { background: var(--carbon); color: var(--carbon-text); }
.seg.small button { font-size: 12.5px; padding: 6px 9px; min-height: 30px; }

/* ---------------------------------------------------------- hero */
.hero { background: var(--carbon); color: var(--carbon-text); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.hero-gen { display: flex; gap: 16px; align-items: center; padding: 14px 16px; background: var(--carbon-2); }
.hero-gen .k, .hstat .k { font: 700 12px/1.1 var(--font-display); letter-spacing: .12em; text-transform: uppercase; color: var(--carbon-muted); }
.hero-gen .v { font: italic 800 54px/0.9 var(--font-display); margin-top: 4px; }
.hero-gen .n { font-size: 12px; color: var(--carbon-muted); margin-top: 5px; }
.hero-gen .now { display: flex; gap: 10px; align-items: center; padding-left: 14px; border-left: 1px solid var(--carbon-line); min-width: 0; }
.hero-gen .now svg { width: 54px; height: 54px; flex: none; }
.hero-gen .now svg path { fill: none; stroke: var(--brand-2); stroke-width: 6; stroke-linejoin: round; }
.hero-gen .now .t { font: 700 18px/1.05 var(--font-display); text-transform: uppercase; letter-spacing: .02em; }
.hero-gen .now .p { font-size: 12px; color: var(--carbon-muted); margin-top: 3px; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; }
.hstat { padding: 12px 16px; border-top: 1px solid var(--carbon-line); min-width: 0; }
.hstat:nth-child(even) { border-left: 1px solid var(--carbon-line); }
.hstat.wide { grid-column: 1 / -1; }
.hstat .v { font: 800 30px/1 var(--font-display); margin-top: 6px; font-variant-numeric: tabular-nums; }
.hstat .v small { font-size: 16px; font-weight: 700; color: var(--carbon-muted); margin-left: 2px; }
.hstat .n { font-size: 12px; color: var(--carbon-muted); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hstat.test .k { color: var(--brand-2); }
.hstat.link { cursor: pointer; }
.hstat.link:active { background: var(--carbon-2); }
.hstat .meter { height: 4px; background: var(--carbon-3); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.hstat .meter i { display: block; height: 100%; background: var(--brand); border-radius: 2px; }

/* ---------------------------------------------------------- charts */
#metricSub { margin: 10px 0 8px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 10px; }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .line { width: 18px; height: 2px; border-radius: 1px; display: inline-block; }
.legend .line.dashed { background: none !important; border-top: 2px dashed var(--series-2); height: 0; }
.multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.mini-top { grid-column: 1 / -1; display: grid; gap: 10px; }
.mini { border-radius: 9px; padding: 11px 11px 4px; background: var(--surface-2); position: relative; overflow: hidden; border-top: 3px solid var(--surface-3); }
.mini > * { position: relative; }
.mini .ghost { position: absolute; right: -6px; top: 4px; width: 100px; height: 100px; opacity: .55; pointer-events: none; }
.mini .ghost path { fill: none; stroke: var(--surface-3); stroke-width: 7; stroke-linejoin: round; }
.mini .t { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.mini .name { font: 700 16px/1.1 var(--font-display); text-transform: uppercase; letter-spacing: .03em; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mini .meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.mini .last { text-align: right; flex: none; }
.mini .last b { font: 800 21px/1 var(--font-display); font-variant-numeric: tabular-nums; display: block; }
.mini .last span { font-size: 11px; color: var(--text-muted); }
.mini.now { border-top-color: var(--brand); }
.mini.holdout { background: var(--carbon); color: var(--carbon-text); border-top-color: var(--brand-2); }
.mini.holdout .meta, .mini.holdout .last span { color: var(--carbon-muted); }
.mini.holdout .ghost path { stroke: var(--carbon-3); }
.mini.avg { border-top-color: var(--series-1); }
.mini svg.chart { display: block; width: 100%; height: 112px; overflow: visible; margin-top: 6px; }
.mini svg.chart text { font-family: var(--font-mono); }
.mini .empty { height: 112px; display: grid; place-items: center; color: var(--text-muted); font-size: 12.5px; margin-top: 6px; }
.tooltip {
  position: fixed; z-index: 20; pointer-events: none; background: var(--carbon); color: var(--carbon-text);
  border-radius: 8px; padding: 9px 11px; font-size: 12.5px; box-shadow: 0 6px 20px rgba(0,0,0,.3); min-width: 170px; max-width: calc(100vw - 16px);
}
.tooltip .row { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.tooltip .row span:first-child { color: var(--carbon-muted); display: inline-flex; align-items: center; gap: 5px; }
.tooltip .h { font: 700 14px/1.2 var(--font-display); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
.tooltip .click { margin-top: 6px; padding-top: 5px; border-top: 1px solid var(--carbon-line); color: var(--brand-2); font: 700 12.5px/1.2 var(--font-display); text-transform: uppercase; letter-spacing: .05em; }

/* ---------------------------------------------------------- milestones */
.milestones { list-style: none; margin: 0; padding: 0; }
.milestones li { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.milestones li:last-child { border-bottom: 0; }
.milestones li.empty-note, .milestones li.ms-divider { display: block; }
.milestones .g { font: italic 800 14px/1 var(--font-display); text-transform: uppercase; background: var(--surface-2); padding: 6px 4px 5px; border-radius: 3px; text-align: center; }
.milestones .txt { font-weight: 600; font-size: 14px; }
.milestones .txt .sub { font-weight: 400; font-size: 12.5px; }
.milestones .who { color: var(--text-secondary); font-size: 12.5px; display: flex; gap: 7px; align-items: center; margin-top: 4px; font-weight: 400; flex-wrap: wrap; }
.milestones .watch { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--text-primary); cursor: pointer; font-size: 12px; }
.milestones .watch:active { background: var(--carbon); color: var(--carbon-text); }
.milestones li.todo .g { font-size: 12px; color: var(--text-muted); background: transparent; border: 1px dashed var(--axis); }
.milestones li.todo .txt { color: var(--text-muted); font-weight: 500; }
.milestones .tag { font: 700 10.5px/1 var(--font-display); text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); background: var(--surface-3); padding: 3px 5px; border-radius: 3px; margin-left: 4px; vertical-align: 1px; }
.milestones li.ms-divider { padding: 16px 0 6px; font: 700 12px/1 var(--font-display); text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.ms-count { color: var(--text-muted); font-size: 13px; }

/* ---------------------------------------------------------- watch */
.watch-pick { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.watch-pick select { flex: 1; min-width: 0; }
select {
  font: 500 15px var(--font-body); padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface-1); color: var(--text-primary); min-height: 40px;
}
.check { font-size: 13px; color: var(--text-secondary); display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.check input { accent-color: var(--brand); width: 18px; height: 18px; }
.viewer { padding: 12px; }
.race-id { display: flex; gap: 11px; align-items: center; min-width: 0; margin-bottom: 10px; }
.race-id > div { min-width: 0; }
.race-id h2 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gen-tag { font: italic 800 18px/1 var(--font-display); text-transform: uppercase; white-space: nowrap; background: var(--brand); color: #fff; padding: 7px 10px 6px; border-radius: 3px; transform: skewX(-10deg); flex: none; }
.gen-tag.test { background: var(--carbon); }
.canvas-wrap { position: relative; border-radius: 9px; overflow: hidden; margin: 0 -2px; }
#raceCanvas { display: block; width: 100%; height: min(62vh, 115vw, 560px); background: var(--map-bg); touch-action: none; }
.cam { position: absolute; left: 8px; top: 8px; background: color-mix(in srgb, var(--surface-1) 88%, transparent); box-shadow: var(--shadow); }
.ticker { position: absolute; left: 8px; bottom: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; pointer-events: none; }
.ticker div { background: rgba(12, 14, 18, .88); color: #f4f4f2; border-radius: 3px; padding: 4px 9px 4px 0; font-size: 12.5px; display: flex; gap: 7px; align-items: center; overflow: hidden; }
.ticker div .bar { width: 4px; align-self: stretch; background: var(--tc); }
.ticker div b { font: italic 800 13px/1 var(--font-display); }
.transport { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.btn.play { width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 50%; background: var(--carbon); color: var(--carbon-text); border: 0; font-size: 14px; display: grid; place-items: center; flex: none; }
.transport input[type=range] { flex: 1; min-width: 0; accent-color: var(--brand); height: 28px; }
#timeLabel { font-size: 13px; min-width: 46px; text-align: right; }
.transport select { min-height: 36px; padding: 6px; font-size: 14px; }
.hint { font-size: 12px; color: var(--text-muted); margin: 8px 0 0; }

/* timing tower, as a two-column grid under the map */
.standings { list-style: none; margin: 10px 0 0; padding: 4px 0; display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: column; grid-template-rows: repeat(5, auto); background: var(--carbon); border-radius: 9px; color: #f4f4f2; }
.standings:empty { display: none; }
.standings li { display: grid; grid-template-columns: 16px 4px minmax(0, 1fr) auto; gap: 6px; align-items: center; padding: 0 8px; height: 30px; cursor: pointer; font: 700 14px/1 var(--font-display); }
.standings li.sel { background: rgba(255,255,255,.14); }
.standings li .pos { text-align: right; color: #c9cdd3; font-weight: 800; }
.standings li .bar { width: 4px; height: 16px; background: var(--tc); border-radius: 1px; }
.standings li .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: .02em; }
.standings li .nm b { font-style: italic; font-weight: 800; margin-right: 4px; color: var(--tc); filter: brightness(1.25); }
.standings li .val { font: 500 11px/1 var(--font-mono); color: #d9dce0; text-align: right; }
.standings li .flag { font: 800 10.5px/1 var(--font-display); letter-spacing: .05em; padding: 3px 4px 2px; border-radius: 2px; }
.standings li .flag.fin { background: #f4f4f2; color: #111; }
.standings li .flag.out { background: var(--critical); color: #fff; }
.standings li .flag.dnf { background: #4b5159; color: #fff; }
.standings li .flag.stall { background: var(--warning); color: #111; }
.standings li.gone { color: #8b9098; }

.inspector { padding: 0 14px 6px; overflow: hidden; }
.insp-head { display: flex; gap: 11px; align-items: center; margin: 0 -14px 4px; padding: 12px 14px 10px; border-top: 5px solid var(--tc, var(--carbon)); }
.insp-head h2 { font-size: 20px; line-height: 1.05; }
.insp-head .sub { display: block; font-size: 12px; }
.video-note { font-size: 12.5px; color: var(--text-secondary); margin: 0 0 8px; }
.video-note.err { color: var(--critical); }
details.panel { border-top: 1px solid var(--grid); }
details.panel summary {
  list-style: none; cursor: pointer; padding: 12px 0; font: 700 15px/1.2 var(--font-display); text-transform: uppercase; letter-spacing: .04em;
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
details.panel summary::-webkit-details-marker { display: none; }
details.panel summary::after { content: "+"; margin-left: auto; font: 400 20px/1 var(--font-body); color: var(--text-muted); }
details.panel[open] summary::after { content: "–"; }
details.panel summary .sub { font-size: 12px; }
.inspector canvas { display: block; width: 100%; margin-bottom: 10px; }
.c-gauges { height: 150px; }
.c-sensors { height: 240px; }
.c-nn { height: 440px; }
.nn-key { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); margin: -4px 0 12px; }
.nn-key span { display: inline-flex; gap: 5px; align-items: center; }

/* ---------------------------------------------------------- teams */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 12px; }
.team { background: var(--surface-1); box-shadow: var(--shadow); border-radius: 12px; overflow: hidden; border-top: 5px solid var(--tc); }
.team-top { display: flex; gap: 11px; align-items: center; padding: 12px 14px 8px; }
.team-top .rank { text-align: right; }
.team-top .rank b { font: italic 800 28px/1 var(--font-display); display: block; }
.team-top .rank span { font: 700 10.5px/1 var(--font-display); color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.team-top h3 { font-size: 20px; line-height: 1.05; }
.team-top .arch { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.team .net { display: block; width: 100%; height: 70px; background: var(--surface-2); padding: 3px 0; }
.team .stats { display: grid; grid-template-columns: repeat(5, 1fr); padding: 10px 14px 2px; gap: 6px; }
.team .stats .k { font: 700 11px/1 var(--font-display); text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.team .stats .v { font: 800 19px/1.1 var(--font-display); font-variant-numeric: tabular-nums; margin-top: 3px; white-space: nowrap; }
.team .distbar { height: 5px; background: var(--surface-2); margin: 6px 14px 0; border-radius: 3px; overflow: hidden; }
.team .distbar i { display: block; height: 100%; background: var(--tc); border-radius: 3px; }
.team .settings { padding: 10px 14px 12px; font-size: 12.5px; color: var(--text-secondary); display: grid; gap: 3px; }
.team .settings div { display: flex; justify-content: space-between; gap: 10px; }
.team .settings span:first-child { color: var(--text-muted); flex: none; }
.team .settings span:last-child { text-align: right; }
.rule { border-left: 3px solid var(--brand); padding: 2px 0 2px 12px; margin-top: 14px; }
.rule-k { font: 700 15px/1.1 var(--font-display); text-transform: uppercase; letter-spacing: .05em; }
.rule p { margin: 5px 0 0; font-size: 13.5px; color: var(--text-secondary); }

/* ---------------------------------------------------------- settings */
.switch-row { display: flex; gap: 14px; align-items: center; justify-content: space-between; cursor: pointer; }
.switch-row > span { display: flex; flex-direction: column; }
.switch-row b { font: 700 16px/1.2 var(--font-display); text-transform: uppercase; letter-spacing: .03em; }
.switch-row input {
  appearance: none; -webkit-appearance: none; flex: none; width: 50px; height: 30px; border-radius: 15px;
  background: var(--surface-3); position: relative; cursor: pointer; transition: background .15s; margin: 0;
}
.switch-row input::after { content: ""; position: absolute; left: 2px; top: 2px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch-row input:checked { background: var(--good); }
.switch-row input:checked::after { transform: translateX(20px); }
.danger-zone h2::before { background: var(--critical) !important; }

@media (min-width: 700px) {
  main { padding: 16px 20px 24px; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .hstat:nth-child(even) { border-left: 0; }
  .hstat:not(:nth-child(3n + 1)) { border-left: 1px solid var(--carbon-line); }
  .hstat.wide { grid-column: auto; }
}
@media (max-width: 360px) {
  h1 { font-size: 18px; }
  .hero-gen .v { font-size: 44px; }
  .standings { grid-template-columns: 1fr; grid-auto-flow: row; grid-template-rows: none; }
}
