/* Race Marshal - night race-control theme.
   Saira Condensed (display), Barlow (text), JetBrains Mono (timing). */

:root {
  color-scheme: dark;
  --bg: #07090d;
  --bg-2: #0a0e14;
  --panel: #0e131b;
  --panel-2: #131a24;
  --panel-3: #18212d;
  --line: #1c2531;
  --line-2: #273242;
  --ink: #eef2f7;
  --ink-2: #aeb8c6;
  --ink-3: #6f7b8c;
  --amber: #ffc21a;
  --amber-2: #ffd75e;
  --amber-ink: #191100;
  --good: #2fd27a;
  --pb: #2fd27a;
  --slow: #fab219;
  --bad: #f0484d;
  --purple: #b57cff;
  --cyan: #5ce1ff;
  --font-display: "Saira Condensed", "Arial Narrow", sans-serif;
  --font-body: "Barlow", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1320px;
  --skew: -10deg;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--font-body);
  font-feature-settings: "tnum" 0;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
/* Atmosphere: a faint aeronautical-chart graticule and a sodium glow on the horizon. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(255, 194, 26, .07), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, rgba(57, 135, 229, .07), transparent 60%),
    linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px) 0 0 / 96px 96px,
    linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px) 0 0 / 96px 96px,
    var(--bg);
}
a { color: inherit; text-decoration-color: rgba(255, 255, 255, .25); text-underline-offset: 3px; }
a:hover { color: var(--amber-2); }
code { font-family: var(--font-mono); font-size: .9em; background: var(--panel-2); padding: 1px 6px; border-radius: 4px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.strong { font-weight: 700; color: var(--ink); }
.nowrap { white-space: nowrap; }
.bad { color: var(--bad); font-style: normal; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--amber); color: var(--amber-ink); padding: 6px 12px; z-index: 99; }
.skip:focus { left: 8px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 var(--gutter);
  height: 60px;
  background: rgba(7, 9, 13, .82);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 30px; height: 30px; }
.brand-word { font: 800 italic 22px/1 var(--font-display); text-transform: uppercase; letter-spacing: .02em; }
.brand-word b { color: var(--amber); font-weight: 800; margin-left: 2px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  font: 600 15px/1 var(--font-display);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); }
.nav a.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -11px;
  height: 3px;
  background: var(--amber);
  transform: skewX(var(--skew));
}
.nav-live .live-dot { background: var(--ink-3); box-shadow: none; animation: none; }
.nav-live.has-rooms .live-dot { background: var(--bad); animation: pulse 1.4s infinite; }
.hub-status { display: flex; align-items: center; gap: 7px; font: 500 12px/1 var(--font-mono); color: var(--ink-3); flex: none; }
.hub-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.hub-status.ok .dot { background: var(--good); box-shadow: 0 0 0 3px rgba(47, 210, 122, .15); }
.hub-status.down .dot { background: var(--bad); }
.hub-status.down { color: var(--bad); }
.checker {
  height: 6px;
  background: repeating-conic-gradient(#e9edf2 0 25%, #0b0e13 0 50%) 0 0 / 12px 12px;
  opacity: .14;
}

.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 0 rgba(240, 72, 77, .6); animation: pulse 1.4s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(240, 72, 77, .55); } 70% { box-shadow: 0 0 0 9px rgba(240, 72, 77, 0); } 100% { box-shadow: 0 0 0 0 rgba(240, 72, 77, 0); } }

main { flex: 1; outline: none; }
.stage, .replay, .panel { scroll-margin-top: 120px; }
main:focus, main:focus-visible { outline: none; }
.foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 22px var(--gutter) 28px;
  color: var(--ink-3);
  font-size: 13px;
  border-top: 1px solid var(--line);
  margin-top: 56px;
}

/* ---------- page scaffolding ---------- */
.page { max-width: var(--maxw); margin: 0 auto; padding: 28px var(--gutter) 0; }
.page-head { margin: 8px 0 26px; max-width: 760px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font: 600 13px/1 var(--font-display);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--amber);
}
.page-title {
  margin: 0;
  font: 800 italic clamp(40px, 6.4vw, 76px)/.92 var(--font-display);
  text-transform: uppercase;
  letter-spacing: -.005em;
  overflow-wrap: anywhere;
}
.page-sub { margin: 12px 0 0; color: var(--ink-2); font-size: 16px; max-width: 64ch; }
.crumbs { display: flex; gap: 8px; align-items: center; font: 600 13px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--amber); }

.rise { animation: rise .6s var(--ease) both; animation-delay: calc(var(--d, 0) * 80ms); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rise, .flash { animation: none !important; } .live-dot { animation: none; } }

/* ---------- buttons, chips, controls ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--ink);
  font: 600 14px/1 var(--font-display);
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.btn-primary:hover { background: var(--amber-2); border-color: var(--amber-2); color: var(--amber-ink); }
.btn-ghost { background: transparent; }
.btn-small { height: 32px; padding: 0 13px; font-size: 13px; }
.btn-tiny { height: 26px; padding: 0 10px; font-size: 12px; letter-spacing: .08em; }
.btn-tiny.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-vs.on { background: var(--amber); color: var(--amber-ink); border-color: var(--amber); }

.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  font: 700 12px/1 var(--font-display);
  letter-spacing: .12em;
  text-transform: uppercase;
  border-radius: 3px;
  transform: skewX(var(--skew));
  white-space: nowrap;
}
.chip-tt { background: var(--ink); color: var(--bg); }
.chip-low { background: transparent; color: var(--cyan); box-shadow: inset 0 0 0 1.5px var(--cyan); }
.chip-plain { background: var(--panel-3); color: var(--ink-2); }
.tag {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 6px;
  border-radius: 3px;
  font: 600 11px/1 var(--font-mono);
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: var(--panel-3);
  vertical-align: middle;
  white-space: nowrap;
}
.tag-ok { color: var(--good); background: rgba(47, 210, 122, .1); }
.tag-bad { color: var(--bad); background: rgba(240, 72, 77, .12); }
.tag-old { color: var(--slow); background: rgba(250, 178, 25, .1); text-transform: none; }
.tag-rec { color: var(--purple); background: rgba(181, 124, 255, .13); }

.pilot { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--c, var(--ink-3)); transform: skewX(var(--skew)); flex: none; }
.pos {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 22px;
  padding: 0 6px;
  font: 700 13px/1 var(--font-mono);
  background: var(--panel-3);
  color: var(--ink);
  transform: skewX(var(--skew));
}
.p1 .pos, .pos.p1 { background: var(--amber); color: var(--amber-ink); }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 999px; }
.seg button {
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font: 600 13px/1 var(--font-display);
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--ink); color: var(--bg); }
.seg-small button { height: 26px; padding: 0 9px; font-size: 12px; }
.seg-dark { background: rgba(7, 9, 13, .78); backdrop-filter: blur(8px); border-color: rgba(255, 255, 255, .1); }

.select { display: inline-flex; align-items: center; gap: 8px; font: 600 12px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.select select {
  height: 36px;
  max-width: 100%;
  padding: 0 32px 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--panel-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23aeb8c6' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--ink);
  font: 500 14px/1 var(--font-body);
  letter-spacing: 0;
  text-transform: none;
  appearance: none;
  cursor: pointer;
}
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-bottom: 22px; }
.filters-inline { margin: 0; gap: 10px 14px; }
.filters-count { margin-left: auto; font: 500 13px/1 var(--font-mono); color: var(--ink-3); }

/* ---------- states ---------- */
.state { display: grid; justify-items: center; gap: 8px; padding: 34px 20px; text-align: center; color: var(--ink-2); }
.state-loading { display: flex; justify-content: center; align-items: center; gap: 10px; color: var(--ink-3); font-size: 14px; padding: 26px 16px; }
.state-title { font: 700 20px/1.1 var(--font-display); letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
.state-body { max-width: 46ch; font-size: 14px; color: var(--ink-2); }
.state-icon { width: 46px; height: 46px; color: var(--ink-3); }
.state-icon svg { width: 100%; height: 100%; }
.state-error { border: 1px solid rgba(240, 72, 77, .3); background: rgba(240, 72, 77, .05); border-radius: var(--radius); }
.state-error .state-title { color: var(--bad); }
.state-error.small { padding: 8px 12px; font-size: 13px; display: block; margin-bottom: 10px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line-2); border-top-color: var(--amber); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- panels & tables ---------- */
.panel { background: linear-gradient(180deg, var(--panel), rgba(14, 19, 27, .86)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 20px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; font: 700 italic 24px/1 var(--font-display); text-transform: uppercase; letter-spacing: .02em; }
.panel-note, .more { font: 600 12px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); text-decoration: none; }
.more:hover { color: var(--amber); }
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font: 600 11.5px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); padding: 8px 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.table td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover td { background: rgba(255, 255, 255, .02); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .act { text-align: right; white-space: nowrap; }
.table a { text-decoration: none; }
.table a:hover { text-decoration: underline; }
.table.compact td { padding: 7px 6px; }
.runs tr.sel-a td { background: rgba(255, 255, 255, .04); }
.runs tr.sel-a td:first-child { box-shadow: inset 3px 0 0 var(--ink); }
.runs tr.sel-b td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.board-mode { margin: 14px 0 6px; font: 700 13px/1 var(--font-display); letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); }
.board-mode:first-child { margin-top: 0; }

/* ---------- home ---------- */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) var(--gutter) 36px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 40px;
  align-items: end;
}
.hero-title {
  margin: 0;
  font: 900 italic clamp(52px, 9vw, 124px)/.86 var(--font-display);
  text-transform: uppercase;
  letter-spacing: -.01em;
}
.hero-title em { font-style: italic; color: transparent; -webkit-text-stroke: 1.6px var(--amber); }
.lede { margin: 20px 0 0; max-width: 54ch; font-size: 17px; color: var(--ink-2); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.hero-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.hero-stats .state { grid-column: 1 / -1; background: var(--panel); }
.hero-stats.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 22px; max-width: 720px; }
.stat { background: var(--panel); padding: 18px 20px 16px; position: relative; }
.stat-v { font: 800 italic clamp(38px, 5vw, 58px)/1 var(--font-display); letter-spacing: -.01em; }
.stat-l { margin-top: 6px; font: 600 12px/1 var(--font-display); letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); }
.stat:first-child::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 16px; width: 3px; background: var(--amber); }
.compact .stat-v { font-size: clamp(30px, 4vw, 42px); }

.home-grid { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.panel-wide { grid-column: 1 / -1; }
.badge-live { display: inline-flex; align-items: center; gap: 7px; font: 700 12px/1 var(--font-mono); color: var(--bad); letter-spacing: .1em; }

.tower { list-style: none; margin: 0; padding: 0; counter-reset: tower; }
.tower-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px minmax(0, 120px) 96px;
  align-items: center;
  gap: 14px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  animation: rise .5s var(--ease) both;
  animation-delay: calc(var(--i) * 50ms + 200ms);
}
.tower-row:last-child { border-bottom: 0; }
.tower-course { font: 700 18px/1.1 var(--font-display); text-transform: uppercase; letter-spacing: .02em; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tower-time { font-weight: 700; font-size: 15px; min-width: 9ch; text-align: right; }

.room-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.room-mini a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); text-decoration: none; }
.room-mini a:hover { border-color: var(--line-2); color: inherit; }
.room-code { font-size: 20px; font-weight: 700; letter-spacing: .12em; color: var(--ink); }
.room-info { display: grid; min-width: 0; }
.room-info b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-info small { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phase { font: 700 11.5px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); padding: 5px 8px; border-radius: 3px; background: var(--panel-3); white-space: nowrap; }
.phase.is-live { color: #fff; background: var(--bad); }
.phase-starting.is-live, .phase-countdown.is-live { background: var(--amber); color: var(--amber-ink); }

.feed { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 28px; }
.feed-item { display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed-icon { width: 22px; height: 22px; color: var(--ink-3); grid-row: span 2; margin-top: 1px; }
.feed-icon svg { width: 100%; height: 100%; }
.feed-record .feed-icon { color: var(--purple); }
.feed-course .feed-icon { color: var(--cyan); }
.feed-text { font-weight: 500; }
.feed-text a { text-decoration: none; }
.feed-meta { font-size: 12.5px; color: var(--ink-3); }

/* ---------- courses ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.card { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; transition: border-color .2s, transform .25s var(--ease), box-shadow .25s; }
.card:hover { color: inherit; border-color: var(--line-2); transform: translateY(-3px); box-shadow: 0 18px 40px -20px rgba(0, 0, 0, .8); }
.card:hover .card-title { color: var(--amber); }
.mini { position: relative; height: 176px; overflow: hidden; background: #0b1017; }
.mini::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7, 9, 13, .05) 40%, rgba(14, 19, 27, .9)); pointer-events: none; }
.mm-tiles { position: absolute; inset: 0; filter: saturate(.75) brightness(.8) contrast(1.05); }
.mm-tiles img { position: absolute; max-width: none; }
.mm-svg { position: absolute; inset: 0; z-index: 1; }
.mm-shadow { fill: none; stroke: rgba(0, 0, 0, .6); stroke-width: 6; stroke-linejoin: round; stroke-linecap: round; }
.mm-path { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.mm-corridor { fill: none; stroke: var(--cyan); stroke-opacity: .2; stroke-linejoin: round; stroke-linecap: round; }
.mm-gate { fill: #fff; stroke: #000; stroke-width: 1; }
.mm-start { fill: var(--amber); stroke: #000; stroke-width: 1.5; }
.mm-finish { fill: var(--amber); stroke: #000; stroke-width: 1.5; }
.mini-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-size: 13px; }
.mini-empty .state { padding: 0; }
.card-body { padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-author { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-title { margin: 0; font: 800 italic 28px/1 var(--font-display); text-transform: uppercase; transition: color .2s; overflow-wrap: anywhere; }
.card-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; }
.card-meta dt { font: 600 11px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.card-meta dd { margin: 4px 0 0; font-weight: 600; white-space: nowrap; }
.card-record { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--panel-2); border-radius: var(--radius-sm); border-left: 3px solid var(--amber); }
.card-record svg { width: 18px; height: 18px; color: var(--amber); flex: none; }
.card-record span { flex: 1; min-width: 0; }
.card-record b { font-size: 15px; }
.card-record-none { border-left-color: var(--line-2); color: var(--ink-3); font-size: 13.5px; }
.card-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: auto; font-size: 12.5px; color: var(--ink-3); }

/* ---------- course detail ---------- */
.course-head { margin-bottom: 18px; }
.ch-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: end; }
.ch-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.specs { display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 18px 0 0; }
.specs dt { font: 600 11px/1 var(--font-display); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.specs dd { margin: 5px 0 0; font-weight: 600; font-size: 15px; }
.ch-record {
  min-width: 250px;
  padding: 16px 20px 18px;
  background: linear-gradient(135deg, rgba(255, 194, 26, .12), rgba(255, 194, 26, .02) 60%), var(--panel);
  border: 1px solid rgba(255, 194, 26, .3);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  justify-items: start;
}
.ch-record-label { display: flex; align-items: center; gap: 7px; font: 700 12px/1 var(--font-display); letter-spacing: .2em; text-transform: uppercase; color: var(--amber); }
.ch-record-label svg { width: 16px; height: 16px; }
.ch-record-time { font-size: 34px; font-weight: 700; line-height: 1; }
.ch-record-none { color: var(--ink-2); font-size: 14px; }
.downloads { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.rules { margin-left: auto; font-size: 13px; color: var(--ink-3); max-width: 60ch; }

.stage { position: relative; height: min(66vh, 660px); min-height: 380px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #0a0e14; }
.map { position: absolute; inset: 0; }
.map-wait { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; }
.map-tools { position: absolute; top: 12px; right: 12px; z-index: 5; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: calc(100% - 70px); }
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 999px;
  background: rgba(7, 9, 13, .78);
  backdrop-filter: blur(8px);
  color: var(--ink);
  font: 600 13px/1 var(--font-display);
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
}
.tool-btn svg { width: 16px; height: 16px; }
.tool-btn:hover { border-color: rgba(255, 255, 255, .3); }
.tool-btn.on { background: var(--amber); color: var(--amber-ink); border-color: var(--amber); }
.exag { display: inline-flex; align-items: center; gap: 10px; height: 38px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 999px; background: rgba(7, 9, 13, .78); backdrop-filter: blur(8px); font: 600 12px/1 var(--font-display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.exag b { color: var(--ink); font-family: var(--font-mono); letter-spacing: 0; }
.exag input { width: 96px; accent-color: var(--amber); }
.map-legend { position: absolute; left: 12px; bottom: 34px; z-index: 4; display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 12px; border-radius: var(--radius-sm); background: rgba(7, 9, 13, .74); backdrop-filter: blur(8px); font-size: 12px; color: var(--ink-2); max-width: calc(100% - 24px); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { display: inline-block; width: 18px; height: 3px; background: #fff; }
.map-legend .lg-gate { width: 4px; height: 12px; background: none; border: 2px solid #eceff6; border-width: 0 2px; width: 12px; }
.map-legend .lg-fin { width: 12px; height: 12px; border: 2.5px solid var(--amber); background: none; }
.map-legend .lg-corr { height: 10px; background: rgba(92, 225, 255, .25); border-top: 1px dashed var(--cyan); border-bottom: 1px dashed var(--cyan); }
.map-legend .lg-clean { width: 12px; height: 12px; border: 2.5px solid var(--good); background: none; }
.map-legend .lg-miss { width: 12px; height: 12px; border: 2.5px solid var(--bad); background: none; }

.hud { position: absolute; top: 12px; left: 56px; z-index: 4; display: flex; flex-wrap: wrap; gap: 8px; max-width: min(560px, calc(100% - 300px)); pointer-events: none; }
.hud-card { min-width: 200px; padding: 10px 12px 10px 14px; background: rgba(7, 9, 13, .82); backdrop-filter: blur(10px); border-radius: var(--radius-sm); border-left: 3px solid var(--c); box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .8); }
.hud-who { font: 700 13px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.hud-time { font-size: 30px; font-weight: 700; line-height: 1.1; margin: 4px 0 6px; }
.hud-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; }
.hud-grid span { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.hud-grid b { white-space: nowrap; }
.hud-grid small { font: 600 11px/1.6 var(--font-display); letter-spacing: .14em; color: var(--ink-3); }
.hud-grid em { font-style: normal; }
.hud-split { display: flex; gap: 8px; align-items: center; margin-top: 7px; padding-top: 7px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 13px; }
.hud-split span { color: var(--ink-2); flex: 1; }
.hud-split.miss span { color: var(--bad); }
.hud-gap { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; background: rgba(7, 9, 13, .82); backdrop-filter: blur(10px); border-radius: var(--radius-sm); font: 600 13px/1 var(--font-display); letter-spacing: .08em; text-transform: uppercase; }
.hud-gap b { font-size: 15px; letter-spacing: 0; }
.gap-who { display: inline-block; width: 10px; height: 10px; background: var(--c); transform: skewX(var(--skew)); margin-right: 6px; vertical-align: 0; }

.delta { font: 700 12.5px/1 var(--font-mono); padding: 2px 5px; border-radius: 3px; white-space: nowrap; }
.d-pb { color: var(--pb); background: rgba(47, 210, 122, .1); }
.d-slow { color: var(--slow); background: rgba(250, 178, 25, .1); }
.d-miss { color: #fff; background: var(--bad); }

.replay { margin-top: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; }
.rp-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.rp-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; min-width: 0; }
.rp-title h2 { margin: 0; font: 700 italic 24px/1 var(--font-display); text-transform: uppercase; }
.rp-title .pilot { margin-right: 2px; }
.rp-pick { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rp-pick select { width: 300px; }
.rp-pick .sw { margin-right: 2px; }
.rp-warn { margin-top: 12px; padding: 10px 14px; border-radius: var(--radius-sm); background: rgba(250, 178, 25, .08); border: 1px solid rgba(250, 178, 25, .25); color: var(--ink-2); font-size: 14px; }
.rp-warn b { color: var(--slow); }
.transport { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.play { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--amber); color: var(--amber-ink); display: grid; place-items: center; cursor: pointer; flex: none; box-shadow: 0 0 0 4px rgba(255, 194, 26, .14); }
.play svg { width: 22px; height: 22px; }
.play:hover { background: var(--amber-2); }
.transport .tool-btn { background: var(--panel-2); backdrop-filter: none; padding: 0 11px; }
.scrub { position: relative; flex: 1; min-width: 180px; height: 38px; display: flex; align-items: center; }
.scrub input {
  width: 100%;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--ink) var(--p, 0%), var(--line-2) var(--p, 0%));
  cursor: pointer;
}
.scrub input::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--ink); }
.scrub input::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--bg); }
.scrub-ticks { position: absolute; left: 8px; right: 8px; top: 0; bottom: 0; pointer-events: none; }
.tick { position: absolute; top: 4px; width: 2px; height: 8px; margin-left: -1px; background: var(--c); border-radius: 1px; }
.tick-b { top: auto; bottom: 4px; }
.tick.miss { background: var(--bad); height: 10px; }
.tick.fin { width: 3px; height: 10px; }
.rp-time { font-size: 15px; min-width: 15ch; text-align: right; color: var(--ink-2); }
.splits { margin-top: 14px; }
.splits-table td, .splits-table th { padding: 7px 8px; }
.split.pending td { opacity: .32; }
.split.flash td { animation: flash 1.1s var(--ease); }
@keyframes flash { 0% { background: rgba(255, 194, 26, .28); } 100% { background: transparent; } }
.legend-line { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 10px 0 0; }

.course-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; margin: 18px 0; }
#runs { margin-top: 0; }

/* profile charts */
.profile { position: relative; margin-bottom: 14px; }
.profile-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; margin-bottom: 4px; font-size: 12.5px; }
.profile-label { font: 600 12px/1.4 var(--font-display); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); }
.profile-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--ink-2); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg i { display: inline-block; width: 16px; height: 2px; background: var(--c); }
.lg .lg-area { height: 8px; background: color-mix(in srgb, var(--c) 40%, transparent); border-top: 1.5px solid var(--c); }
.lg .lg-dash { background: repeating-linear-gradient(90deg, var(--c) 0 4px, transparent 4px 7px); }
.profile-body { position: relative; }
.profile-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.ax-grid { stroke: #1d2530; stroke-width: 1; }
.ax-base { stroke: #2c3644; stroke-width: 1; }
.ax-tick { fill: var(--ink-3); font: 500 10.5px var(--font-mono); }
.ax-empty { fill: var(--ink-3); font: 500 13px var(--font-body); }
.xhair { stroke: var(--ink-2); stroke-width: 1; }
.profile-tip { position: absolute; top: 4px; z-index: 3; min-width: 150px; padding: 8px 10px; background: rgba(7, 9, 13, .94); border: 1px solid var(--line-2); border-radius: var(--radius-sm); font-size: 12.5px; pointer-events: none; box-shadow: 0 10px 24px -10px #000; }
.tip-x { font: 600 11px/1 var(--font-mono); color: var(--ink-3); margin-bottom: 6px; }
.tip-row { display: flex; align-items: center; gap: 7px; }
.tip-row i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.tip-row span { flex: 1; color: var(--ink-2); }
.tip-row b { font-family: var(--font-mono); font-weight: 600; }

/* deck.gl tooltip */
.deck-tip { background: rgba(7, 9, 13, .94) !important; color: var(--ink) !important; border: 1px solid var(--line-2); border-radius: 6px; font: 500 12.5px/1.4 var(--font-body) !important; padding: 7px 10px !important; }

/* MapLibre chrome on the dark theme */
.maplibregl-ctrl-group { background: rgba(7, 9, 13, .82) !important; border: 1px solid rgba(255, 255, 255, .1); box-shadow: none !important; backdrop-filter: blur(8px); }
.maplibregl-ctrl-group button + button { border-top-color: rgba(255, 255, 255, .1) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) brightness(1.4); }
.maplibregl-ctrl-attrib { background: rgba(7, 9, 13, .7) !important; color: var(--ink-3); font-size: 11px; }
.maplibregl-ctrl-attrib a { color: var(--ink-2) !important; }
.maplibregl-ctrl-attrib-button { filter: invert(1); }
.maplibregl-ctrl-scale { background: rgba(7, 9, 13, .6) !important; color: var(--ink-2) !important; border-color: var(--ink-2) !important; font-size: 10px; }
.maplibregl-cooperative-gesture-screen { font-family: var(--font-body); }

/* ---------- leaderboards ---------- */
.h2h-wrap { display: grid; gap: 14px; margin-bottom: 22px; }
.h2h-below { margin-top: 22px; }
.h2h { padding: 20px 24px 22px; border-radius: var(--radius); border: 1px solid var(--line); background:
  radial-gradient(600px 200px at 0% 50%, color-mix(in srgb, var(--p1c, #3987e5) 12%, transparent), transparent),
  var(--panel); }
.h2h-label { display: flex; align-items: center; gap: 10px; font: 700 12px/1 var(--font-display); letter-spacing: .2em; text-transform: uppercase; color: var(--amber); margin-bottom: 14px; }
.h2h-label svg { width: 18px; height: 18px; }
.h2h-label .muted { letter-spacing: .08em; margin-left: auto; }
.h2h-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: center; }
.h2h-side { border-left: 4px solid var(--c); padding-left: 16px; min-width: 0; }
.h2h-right { border-left: 0; border-right: 4px solid var(--c); padding: 0 16px 0 0; text-align: right; }
.h2h-name { display: block; font: 800 italic clamp(24px, 3.6vw, 40px)/1 var(--font-display); text-transform: uppercase; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h2h-wins { font-size: clamp(44px, 7vw, 84px); font-weight: 700; line-height: 1; margin-top: 4px; }
.h2h-mid { text-align: center; }
.h2h-verdict { font: 700 18px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; margin-bottom: 10px; }
.h2h-bar { display: flex; height: 14px; gap: 2px; transform: skewX(var(--skew)); }
.h2h-bar span { background: var(--c); min-width: 3px; }
.h2h-bar span:first-child { border-radius: 4px 0 0 4px; }
.h2h-bar span:last-child { border-radius: 0 4px 4px 0; }
.h2h-sub { margin-top: 8px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.board-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 12px; min-width: 0; }
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.board-title { font: 800 italic 24px/1.05 var(--font-display); text-transform: uppercase; text-decoration: none; overflow-wrap: anywhere; }
.board-empty { margin: 4px 0 10px; }

/* ---------- pilots ---------- */
.pilot-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pilot-card { position: relative; display: grid; gap: 14px; padding: 20px 22px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; overflow: hidden; transition: transform .25s var(--ease), border-color .2s; }
.pilot-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--c); }
.pilot-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(var(--c), transparent 70%); opacity: .14; }
.pilot-card:hover { transform: translateY(-3px); border-color: var(--line-2); color: inherit; }
.pc-name { font: 800 italic 36px/1 var(--font-display); text-transform: uppercase; overflow-wrap: anywhere; }
.pc-records { display: flex; align-items: baseline; gap: 8px; }
.pc-records .mono { font-size: 28px; font-weight: 700; color: var(--amber); }
.pc-records small { font: 600 12px/1 var(--font-display); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.pc-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; }
.pc-stats dt { font: 600 10.5px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.pc-stats dd { margin: 4px 0 0; font-weight: 600; white-space: nowrap; }
.pilot-head { padding-left: 18px; border-left: 6px solid var(--c); margin-bottom: 24px; }
.pilot-title { color: var(--ink); }
.pilot-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 18px; }
.rec-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rec-list a { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 11px 14px; background: var(--panel-2); border-radius: var(--radius-sm); border-left: 3px solid var(--amber); text-decoration: none; }
.rec-list svg { width: 18px; height: 18px; color: var(--amber); }
.rec-course { font: 700 17px/1.1 var(--font-display); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- live ---------- */
.live-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.room-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.room-card { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 14px 16px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); font: inherit; cursor: pointer; }
.room-card:hover { border-color: var(--line-2); }
.room-card.on { border-color: var(--amber); box-shadow: inset 3px 0 0 var(--amber); }
.room-course { grid-column: 1 / -1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-pilots { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 13px; color: var(--ink-2); }
.room-board { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.rb-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.rb-code { font-size: 40px; font-weight: 700; letter-spacing: .14em; line-height: 1; }
.rb-course { margin-top: 6px; font-weight: 600; }
.rb-course a { text-decoration: none; }
.rb-foot { margin-top: 10px; }
.countdown { display: grid; justify-items: end; gap: 2px; min-width: 180px; }
.countdown small { font: 700 12px/1 var(--font-display); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); }
.countdown b { font: 800 italic 44px/1 var(--font-display); letter-spacing: .01em; }
.countdown b.mono { font: 700 40px/1 var(--font-mono); }
.countdown.armed b { color: var(--amber); }
.countdown.final b { color: var(--bad); animation: blink 1s steps(2) infinite; }
.countdown.racing b { color: var(--good); }
@keyframes blink { 50% { opacity: .55; } }
.lane { display: inline-grid; place-items: center; width: 24px; height: 22px; background: var(--panel-3); font-weight: 700; transform: skewX(var(--skew)); }
.stage-live { height: min(58vh, 560px); min-height: 340px; }

/* ---------- polish pass: live race control, share, ranks, hints ---------- */
.phase-racing.is-live { background: var(--bad); color: #fff; }
.phase-results { background: rgba(47, 210, 122, .14); color: var(--good); }
.phase-closed { background: transparent; color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line-2); }
.room-card.is-closed { opacity: .62; }
.room-card.is-closed.on { opacity: 1; }
.room-board.is-closed { border-style: dashed; }
.rb-closed { margin: 0 0 8px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--panel-2); color: var(--ink-2); font-size: 13.5px; }
.rb-id { min-width: 0; }
.rb-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.countdown { min-height: 62px; align-content: center; }
.countdown .winner { color: var(--ink); border-bottom: 3px solid var(--c, var(--amber)); padding-bottom: 2px; }
.countdown.results small, .countdown.closed small { color: var(--good); }
.countdown > span { font-size: 13px; }
.prog-cell { min-width: 120px; white-space: nowrap; }
.prog { display: inline-block; vertical-align: middle; width: 72px; height: 6px; margin-right: 8px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.prog i { display: block; width: var(--f, 0%); height: 100%; background: var(--c, var(--ink)); transition: width .9s linear; }
.live-table td { white-space: nowrap; }
.btn-share.is-done { border-color: var(--good); color: var(--good); }
.btn-share svg { width: 15px; height: 15px; }
.pilot-actions { margin-top: 14px; }
.pos-word { min-width: 0; font-size: 12px; letter-spacing: .02em; text-transform: uppercase; }
.start-links { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.start-links a { font: 600 12px/1 var(--font-display); letter-spacing: .12em; text-transform: uppercase; color: var(--amber); text-decoration: none; padding: 4px 0; }
.start-links a:hover { text-decoration: underline; }
.runs-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.kbd-hint { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-3); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.kbd-hint kbd { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; background: var(--panel-2); color: var(--ink-2); font: 600 11px/1 var(--font-mono); }
.kbd-hint kbd + kbd { margin-left: -2px; }
@media (hover: none), (pointer: coarse) { .kbd-hint { display: none; } }
.mini-wrap { position: relative; }
.mini-rec { position: absolute; left: 12px; bottom: 10px; z-index: 2; display: grid; gap: 2px; padding: 8px 12px; border-radius: var(--radius-sm); background: rgba(7, 9, 13, .86); backdrop-filter: blur(6px); border-left: 3px solid var(--amber); opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .25s var(--ease); pointer-events: none; max-width: calc(100% - 24px); }
.mini-rec small { font: 700 11px/1 var(--font-display); letter-spacing: .18em; text-transform: uppercase; color: var(--amber); }
.mini-rec b { font-size: 20px; line-height: 1.1; }
.mini-rec span { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-rec-none { border-left-color: var(--line-2); }
.mini-rec-none small { color: var(--ink-2); }
.card:hover .mini-rec, .card:focus-visible .mini-rec { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .mini-rec { transition: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .course-grid { grid-template-columns: minmax(0, 1fr); }
  .feed { grid-template-columns: minmax(0, 1fr); }
  .hud { max-width: calc(100% - 70px); top: 60px; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .ch-main { grid-template-columns: minmax(0, 1fr); }
  .ch-record { min-width: 0; }
  .pilot-grid { grid-template-columns: minmax(0, 1fr); }
  .live-grid { grid-template-columns: minmax(0, 1fr); }
  .rules { margin-left: 0; flex-basis: 100%; }
}
@media (max-width: 700px) {
  body { font-size: 14.5px; }
  .topbar { flex-wrap: wrap; height: auto; padding-top: 10px; gap: 6px 16px; }
  .nav { order: 3; flex-basis: 100%; margin: 0 calc(-1 * var(--gutter)); padding: 0 calc(var(--gutter) - 12px); }
  .nav { justify-content: space-between; gap: 0; }
  .nav a { padding: 10px 7px 12px; font-size: 13.5px; letter-spacing: .05em; gap: 5px; }
  .nav a.active::after { left: 7px; right: 7px; }
  .nav a.active::after { bottom: 0; }
  .hub-status { margin-left: auto; }
  .hero-stats.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 14px 16px; }
  .hide-sm { display: none; }
  .stage { height: 62vh; min-height: 340px; border-radius: 0; margin: 0 calc(-1 * var(--gutter)); border-left: 0; border-right: 0; }
  .map-tools { top: auto; bottom: 10px; right: 10px; left: 10px; max-width: none; justify-content: flex-start; }
  .map-tools .tool-btn span { display: none; }
  .map-legend { display: none; }
  .hud { top: 8px; left: 50px; right: 8px; max-width: none; gap: 6px; flex-wrap: nowrap; }
  .hud-card { min-width: 0; flex: 1; padding: 6px 8px 6px 10px; }
  .hud-time { font-size: 20px; margin: 2px 0 3px; }
  .hud-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .hud-grid span { font-size: 11.5px; white-space: nowrap; }
  .hud-grid span:nth-child(2) { display: none; }
  .hud-grid small { font-size: 9.5px; }
  .hud-split { display: none; }
  .hud-gap { position: absolute; top: calc(100% + 6px); right: 0; padding: 6px 9px; font-size: 11.5px; }
  .rp-pick, .rp-pick label { width: 100%; }
  .rp-pick select { width: 100%; flex: 1; min-width: 0; }
  .transport { gap: 10px; }
  .scrub { order: 5; flex-basis: 100%; }
  .rp-time { margin-left: auto; min-width: 0; }
  .card-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .h2h { padding: 16px; }
  .h2h-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .h2h-mid { grid-column: 1 / -1; grid-row: 2; }
  .boards { grid-template-columns: minmax(0, 1fr); }
  .tower-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tower-mode { display: none; }
  .tower-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tower-pilot { grid-column: 1; grid-row: 2; }
  .tower-time { grid-row: 1 / span 2; grid-column: 2; }
  .filters-count { margin-left: 0; }
  .countdown { justify-items: start; }
  .rb-code { font-size: 32px; }
  .pc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* phones: one scrollable tool row under the map's attribution/scale; a compact HUD */
@media (max-width: 700px) {
  .map-tools { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .map-tools::-webkit-scrollbar { display: none; }
  .map-tools > * { flex: none; }
  .map-tools .seg button { padding: 0 11px; }
  .exag { padding: 0 10px; gap: 6px; }
  .exag span { font-size: 0; }
  .exag span b { font-size: 12px; }
  .exag input { width: 64px; }
  .tool-btn { width: 40px; justify-content: center; padding: 0; }
  .transport .tool-btn { width: auto; padding: 0 11px; }
  .stage .maplibregl-ctrl-bottom-left, .stage .maplibregl-ctrl-bottom-right { bottom: 54px; }
  .stage-live .maplibregl-ctrl-bottom-left, .stage-live .maplibregl-ctrl-bottom-right { bottom: 54px; }
  .hud-card { padding: 5px 8px 6px 9px; }
  .hud-who { font-size: 11px; letter-spacing: .1em; }
  .hud-time { font-size: 18px; margin: 1px 0 2px; }
  .hud-grid { grid-template-columns: repeat(3, auto); justify-content: space-between; gap: 0 6px; }
  .hud-grid span { flex-direction: column; justify-content: flex-start; gap: 0; font-size: 10.5px; }
  .hud-grid small { font-size: 9px; line-height: 1.3; }
  .hud-gap { top: calc(100% + 4px); font-size: 11px; padding: 5px 8px; }
  .hud-gap b { font-size: 12.5px; }
  .live-table th, .live-table td { padding-left: 6px; padding-right: 6px; }
  .prog-cell { min-width: 0; }
  .prog { display: none; }
  .live-table .tag-host { display: none; }
  .rb-head { align-items: flex-start; }
  .countdown { min-width: 0; min-height: 0; }
  .countdown b.mono { font-size: 32px; }
  .countdown b { font-size: 34px; }
  .runs-foot .btn { width: 100%; justify-content: center; }
  .hud-grid .u, .x-long { display: none; }
  .seg-small button { height: 34px; padding: 0 11px; }
  .maplibregl-ctrl-group button { width: 36px; height: 36px; }
  .btn-tiny { height: 32px; padding: 0 12px; }
  .table .act .btn-tiny + .btn-tiny { margin-left: 4px; }
  #t-dim, #lt-dim { order: 0; }
  #t-follow { order: 1; }
  #t-fit, #lt-fit { order: 2; }
  #t-base { order: 3; }
  #t-exag { order: 4; }
}
.hud-grid i { font-style: normal; }
