/* Broadcast look: the race fills the window and the site is the on-air graphics package over it.
   --accent is set from each day's course colours by site.js. */
:root {
  --accent: #ffd400; --accent-ink: #0a0a0f;
  --ink: #f4f3ee; --dim: #a9abb8; --plate: rgba(9, 10, 16, 0.88); --solid: #0a0b11; --rule: rgba(255, 255, 255, 0.13);
  --live: #ff2d46; --gold: #ffcf33;
  --cond: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif; --text: 'Barlow', system-ui, sans-serif;
  --bar: 54px; --tape: 30px; --tabbar: 0px; --slant: 10px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: #05060a; color: var(--ink); font: 500 15px/1.45 var(--text); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.stage { position: fixed; inset: 0; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage .hud { pointer-events: none; }
.shade { position: fixed; inset: 0; pointer-events: none; background:
  linear-gradient(to bottom, rgba(5, 6, 10, 0.75), transparent 150px),
  linear-gradient(to top, rgba(5, 6, 10, 0.85), transparent 230px),
  linear-gradient(to right, rgba(5, 6, 10, 0.5), transparent 420px); }

/* ---- shared pieces ---- */
.cond, .key, .cta, .tabs button, .tabbar button, .cams, .slate, .clock, .tower, .ticker, .panel h2, .panel h3, .sheet th, .kicker, .tag, .presented { font-family: var(--cond); text-transform: uppercase; letter-spacing: 0.06em; }
.key { background: var(--plate); border: 1px solid var(--rule); padding: 7px 14px; font-weight: 600; font-size: 14px; }
.key:hover { border-color: var(--accent); color: var(--accent); }
.key.wide { display: block; width: 100%; padding: 10px; margin: 12px 0; }
.cta { display: inline-block; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 19px; padding: 11px 26px 11px 22px; text-decoration: none; text-align: center;
  clip-path: polygon(0 0, 100% 0, calc(100% - var(--slant)) 100%, 0 100%); transition: transform 0.12s; }
.cta:hover { transform: translateX(3px); }
.cta.alt { background: var(--ink); }
.cta:disabled { opacity: 0.6; }

/* ---- top bar ---- */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--bar); display: flex; align-items: stretch; gap: 2px; z-index: 6; }
.topbar > * { background: var(--plate); display: flex; align-items: center; }
.bug { gap: 10px; padding: 0 20px 0 16px; text-decoration: none; color: var(--ink); font: 800 19px var(--cond); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.bug i { width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 32% 30%, #fff 0 12%, var(--accent) 34%, #000 130%); }
.slate { gap: 12px; padding: 0 16px; white-space: nowrap; min-width: 0; }
.slate b { font-size: 19px; font-weight: 800; }
.slate span { color: var(--dim); font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.state { font-style: normal; font-weight: 800; font-size: 14px; padding: 2px 9px; background: #2a2c38; }
.state.live { background: var(--live); animation: pulse 1.3s infinite; }
@keyframes pulse { 50% { opacity: 0.6; } }
.tabs { flex: 1; justify-content: flex-end; padding: 0 6px; gap: 0; }
.tabs button { background: none; border: 0; height: 100%; padding: 0 14px; font-weight: 700; font-size: 16px; color: var(--dim); border-bottom: 3px solid transparent; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.clock { flex-direction: column; justify-content: center; align-items: flex-end; padding: 0 16px; line-height: 1.05; }
.clock small { font-size: 11px; color: var(--dim); font-weight: 600; }
.clock b { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.follow { padding: 0 20px; background: var(--accent); color: var(--accent-ink); font: 800 16px var(--cond); text-transform: uppercase; letter-spacing: 0.06em; text-decoration: none; }

/* ---- timing tower ---- */
.tower { position: fixed; left: 18px; top: calc(var(--bar) + 22px); width: 268px; z-index: 4; opacity: 0; transform: translateX(-20px); transition: opacity 0.3s, transform 0.3s; pointer-events: none; }
body[data-state=racing] .tower, body[data-state=done] .tower { opacity: 1; transform: none; pointer-events: auto; }
.tower header { display: flex; justify-content: space-between; align-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 14px; padding: 3px 10px; }
.tower header button { background: none; border: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; text-decoration: underline; padding: 0; }
.tower ol { position: relative; overflow: hidden; transition: height 0.25s; }
.tower.all ol { overflow-y: auto; max-height: calc(100dvh - var(--bar) - 230px); }
.tower li { position: absolute; left: 0; right: 0; top: 0; height: 30px; display: flex; align-items: center; gap: 7px; background: var(--plate); border-bottom: 1px solid var(--rule); padding-right: 9px; font-size: 17px; font-weight: 600; cursor: pointer; transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s; }
.tower li:hover { background: rgba(40, 42, 56, 0.95); }
.tower li.off { opacity: 0; pointer-events: none; }
.tower li b { width: 30px; align-self: stretch; display: grid; place-items: center; background: rgba(255, 255, 255, 0.1); font-weight: 800; font-variant-numeric: tabular-nums; flex: none; }
.tower li.followed b, .tower li.mine b { background: var(--accent); color: var(--accent-ink); }
.tower li.fin b { background: var(--ink); color: var(--accent-ink); }
.tower li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; letter-spacing: 0.01em; }
.tower li em { font-style: normal; color: var(--dim); font-size: 15px; font-variant-numeric: tabular-nums; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; display: inline-block; }
.flag { width: 20px; height: 15px; object-fit: cover; flex: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); }

/* ---- presented by ---- */
.presented { position: fixed; right: 18px; top: calc(var(--bar) + 22px); z-index: 3; text-align: right; display: grid; justify-items: end; gap: 3px; }
.presented small { background: var(--plate); padding: 2px 9px; font-size: 12px; font-weight: 600; color: var(--dim); }
.presented b { background: var(--ink); color: var(--accent-ink); padding: 3px 12px; font-size: 22px; font-weight: 800; }
.presented span { background: var(--plate); padding: 2px 9px; font-size: 13px; font-weight: 600; }

/* ---- opening title card ---- */
.opener { position: fixed; left: clamp(18px, 5vw, 80px); bottom: calc(var(--tape) + var(--tabbar) + 110px); z-index: 4; max-width: min(720px, 92vw); transition: opacity 0.35s, transform 0.35s; }
body:not([data-state=idle]):not([data-state=loading]) .opener { opacity: 0; transform: translateX(-30px); pointer-events: none; }
.kicker { display: inline-block; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 17px; padding: 2px 12px; }
.opener h1 { font: 800 clamp(54px, 10vw, 132px)/0.86 var(--cond); text-transform: uppercase; letter-spacing: -0.01em; margin: 10px 0 12px; text-shadow: 0 4px 30px rgba(0, 0, 0, 0.6); text-wrap: balance; }
.opener .line { font-size: clamp(16px, 1.6vw, 20px); max-width: 46ch; margin-bottom: 20px; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.8); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---- lower deck ---- */
.deck { position: fixed; left: 18px; right: 18px; bottom: calc(var(--tape) + var(--tabbar) + 12px); z-index: 5; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; }
.transport { display: flex; align-items: center; gap: 8px; flex: 1 1 360px; max-width: 560px; }
.transport output { font: 700 19px var(--cond); font-variant-numeric: tabular-nums; min-width: 62px; text-align: right; }
input[type=range] { flex: 1; min-width: 60px; accent-color: var(--accent); }
.cams { display: flex; align-items: stretch; background: var(--plate); border: 1px solid var(--rule); }
.cams span { display: grid; place-items: center; padding: 0 10px; font-size: 13px; font-weight: 700; color: var(--dim); border-right: 1px solid var(--rule); }
.cams button { background: none; border: 0; padding: 7px 13px; font: inherit; font-weight: 700; font-size: 15px; text-transform: inherit; letter-spacing: inherit; color: var(--dim); }
.cams button:hover { color: var(--ink); }
.cams button.on { background: var(--accent); color: var(--accent-ink); }

/* ---- ticker ---- */
.ticker { position: fixed; left: 0; right: 0; bottom: var(--tabbar); height: var(--tape); z-index: 6; display: flex; background: var(--solid); border-top: 1px solid var(--rule); font-size: 16px; font-weight: 600; }
.ticker > b { background: var(--accent); color: var(--accent-ink); padding: 0 14px; display: grid; place-items: center; font-weight: 800; white-space: nowrap; }
.tape { flex: 1; overflow: hidden; display: flex; align-items: center; }
.tape > div { display: flex; white-space: nowrap; animation: crawl 70s linear infinite; }
.tape span { padding: 0 22px; border-right: 1px solid var(--rule); }
.tape i { font-style: normal; color: var(--accent); margin-right: 8px; }
@keyframes crawl { to { transform: translateX(-50%); } }

/* ---- slide-in panel ---- */
.panel { position: fixed; top: var(--bar); right: 0; bottom: calc(var(--tape) + var(--tabbar)); width: min(480px, 100vw); z-index: 7; background: var(--plate); backdrop-filter: blur(14px); border-left: 3px solid var(--accent); display: flex; flex-direction: column; transform: translateX(105%); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.panel.open { transform: none; }
.panel > header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 12px; border-bottom: 1px solid var(--rule); }
.panel h2 { font-size: 34px; font-weight: 800; line-height: 1; }
.panel-body { flex: 1; overflow-y: auto; padding: 16px 18px 28px; }
.panel section { display: none; }
.panel section.on { display: block; }
.panel h3 { font-size: 15px; font-weight: 700; color: var(--dim); margin: 20px 0 8px; }
.lede { color: var(--dim); margin-bottom: 14px; }
.lede b { color: var(--ink); }
.note { color: var(--dim); font-size: 14px; margin-top: 10px; }
.tools { display: flex; gap: 8px; }
.tools > * { flex: 1; min-width: 0; }
.tools .key { flex: none; }
select, input[type=search], input:not([type]) { background: rgba(0, 0, 0, 0.45); border: 1px solid var(--rule); padding: 8px 10px; width: 100%; font-weight: 600; }
select option { background: #11121a; }
label { display: block; font: 700 13px var(--cond); text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); margin: 10px 0 4px; }

.sheet { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.sheet th { text-align: left; font-size: 12px; font-weight: 700; color: var(--dim); padding: 6px 8px; }
.sheet td { padding: 7px 8px; border-top: 1px solid var(--rule); white-space: nowrap; }
.sheet tbody tr { cursor: pointer; }
.sheet tbody tr:hover { background: rgba(255, 255, 255, 0.06); }
.sheet td:first-child { font: 800 17px var(--cond); width: 38px; }
.sheet tr.mine td:first-child { box-shadow: inset 3px 0 0 var(--accent); color: var(--accent); }
.sheet td:nth-child(n+3) { color: var(--dim); }
.who { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; min-width: 0; }
.tag { font-size: 11px; font-weight: 700; color: var(--gold); border: 1px solid currentColor; padding: 0 5px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: 700 14px var(--cond); text-transform: uppercase; letter-spacing: 0.06em; }
.link:hover { text-decoration: underline; }

.claim { display: flex; gap: 16px; align-items: center; }
.claim form { flex: 1; min-width: 0; }
.claim .cta { margin-top: 14px; }
.marble { width: 130px; height: 130px; flex: none; display: block; }
.marble.big { width: 220px; height: 220px; margin: 0 auto; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; margin: 12px 0 8px; }
.stats div { background: rgba(0, 0, 0, 0.4); padding: 8px 4px; text-align: center; font: 600 12px var(--cond); text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); }
.stats b { display: block; font-size: 28px; font-weight: 800; color: var(--ink); line-height: 1; }
.rows li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.rows li > span:first-child { flex: 1; }
.rows b { font: 800 18px var(--cond); }
.rows small, .rows em { color: var(--dim); font-style: normal; font-weight: 500; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: rgba(0, 0, 0, 0.4); border: 1px solid var(--rule); padding: 6px 12px; font-weight: 600; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.colors { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.colors label { display: flex; align-items: center; gap: 6px; margin: 0; }
input[type=color] { width: 36px; height: 36px; border: 1px solid var(--rule); padding: 0; background: none; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type=color]::-webkit-color-swatch { border: 0; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.buy { margin-top: 8px; border-top: 3px solid var(--accent); background: rgba(0, 0, 0, 0.4); padding: 16px; display: grid; gap: 12px; }
.price { color: var(--dim); }
.price b { font: 800 44px/1 var(--cond); color: var(--ink); margin-right: 8px; }
.buy ol { list-style: decimal; padding-left: 1.3em; color: var(--dim); font-size: 14px; }
.code { display: flex; gap: 8px; align-items: center; }
.code code { flex: 1; min-width: 0; font: 600 12px ui-monospace, Consolas, monospace; background: #000; padding: 9px; overflow-wrap: anywhere; user-select: all; }

.champs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.champ { display: flex; align-items: center; gap: 10px; background: rgba(0, 0, 0, 0.4); padding: 6px 10px; }
.champ b { font: 800 16px var(--cond); color: var(--gold); white-space: nowrap; }
.log li { border-top: 1px solid var(--rule); padding: 12px 0; display: grid; gap: 6px; }
.log .top { display: flex; align-items: baseline; gap: 10px; font: 600 14px var(--cond); text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); }
.log .top b { font-size: 22px; font-weight: 800; color: var(--ink); }
.log .top span { flex: 1; }
.log .win { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.log .win em { font-style: normal; color: var(--dim); font-variant-numeric: tabular-nums; }
.sps { display: flex; flex-wrap: wrap; gap: 5px; }
.sps a { text-decoration: none; }
.sp { font: 600 13px var(--cond); text-transform: uppercase; letter-spacing: 0.05em; padding: 1px 8px; border: 1px solid var(--rule); color: var(--dim); }
.sp.large { color: var(--ink); border-color: var(--ink); }
.sp.full { background: var(--ink); color: var(--accent-ink); border-color: var(--ink); }
.tiers { display: grid; gap: 2px; margin-bottom: 16px; }
.tier { display: grid; grid-template-columns: 86px 1fr; gap: 4px 14px; background: rgba(0, 0, 0, 0.4); padding: 14px; }
.tier b { font: 800 40px/1 var(--cond); grid-row: span 2; }
.tier h4 { margin: 0; font: 800 19px var(--cond); text-transform: uppercase; letter-spacing: 0.04em; }
.tier p { color: var(--dim); font-size: 14px; }

.tabbar { display: none; }

/* ---- phones: portrait stage, tower shrinks, sections move to a bottom tab bar and sheets ---- */
@media (max-width: 860px) {
  :root { --bar: 46px; --tabbar: 50px; --tape: 0px; }
  .tabs, .clock, .ticker, .bug span { display: none; }
  .bug { padding: 0 12px; }
  .slate { flex: 1; padding: 0 10px; gap: 8px; }
  .slate b, .slate span { font-size: 16px; }
  .follow { padding: 0 14px; }
  .tower { left: 8px; top: calc(var(--bar) + 10px); width: 190px; }
  .tower li { font-size: 15px; height: 26px; }
  .tower li b { width: 26px; }
  .tower li em { display: none; }
  .presented { right: 8px; top: calc(var(--bar) + 10px); }
  .presented b { font-size: 16px; }
  .presented span { display: none; }
  .deck { left: 8px; right: 8px; bottom: calc(var(--tabbar) + 8px); }
  .cams { width: 100%; }
  .cams span { display: none; }
  .cams button { flex: 1; padding: 9px 4px; font-size: 14px; }
  .opener { bottom: calc(var(--tabbar) + 118px); }
  .panel { top: auto; left: 0; width: 100%; height: 76dvh; border-left: 0; border-top: 3px solid var(--accent); transform: translateY(105%); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: var(--tabbar); z-index: 8; background: var(--solid); border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar button { flex: 1; background: none; border: 0; font: 700 14px var(--cond); text-transform: uppercase; letter-spacing: 0.04em; color: var(--dim); border-top: 3px solid transparent; }
  .tabbar button.on { color: var(--ink); border-top-color: var(--accent); }
  .panel { bottom: var(--tabbar); }
}
@media (prefers-reduced-motion: reduce) {
  .tape > div, .state.live { animation: none; }
  .tower li, .panel, .opener, .tower { transition: none; }
}

/* ---- icons and the lighter-on-words pass ---- */
.i { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }
.tabs button { display: flex; align-items: center; gap: 7px; }
.clock { flex-direction: row; align-items: center; gap: 8px; color: var(--dim); }
.clock b { color: var(--ink); }
.key.icon { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; flex: none; font-size: 17px; }
.key.wide { display: flex; align-items: center; justify-content: center; gap: 8px; }
.cta { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-bottom: 20px; font: 700 clamp(19px, 2vw, 26px) var(--cond); letter-spacing: 0.03em; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.8); font-variant-numeric: tabular-nums; }
.facts li { display: flex; align-items: center; gap: 8px; }
.facts .i { color: var(--accent); }
.tower header button { display: grid; text-decoration: none; }
.ticker > b { font-size: 17px; }
.find { align-items: center; margin-top: 8px; }
.find > .i { color: var(--dim); font-size: 18px; }
#heatNo { flex: 0 0 96px; background: rgba(0, 0, 0, 0.45); border: 1px solid var(--rule); padding: 8px 10px; font-weight: 600; }
.sheet { margin-top: 12px; }
.sheet td:last-child { width: 26px; color: var(--accent); text-align: right; }
.sheet tr.hit td { background: rgba(255, 255, 255, 0.1); }
.stagehead { display: flex; align-items: baseline; gap: 10px; margin-top: 14px; font: 800 24px var(--cond); text-transform: uppercase; letter-spacing: 0.04em; }
.stagehead small { font-size: 14px; font-weight: 600; color: var(--dim); }
.claim form { display: grid; gap: 8px; }
.claim .cta { margin-top: 4px; justify-self: start; }
.colors { margin: 14px 0; gap: 10px; }
.colors select { flex: 1; min-width: 120px; width: auto; }
.chips { margin-top: 10px; }
.price b { margin: 0; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; list-style: none !important; padding: 0 !important; }
.steps li { display: grid; justify-items: center; gap: 6px; text-align: center; background: rgba(255, 255, 255, 0.05); padding: 10px 4px; font: 600 12px var(--cond); text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); }
.steps .i { font-size: 22px; color: var(--ink); }
.fine { font-size: 12px; color: var(--dim); }
.day { border-top: 1px solid var(--rule); padding: 10px 0; }
.day h4 { margin: 0 0 6px; font: 700 14px var(--cond); text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); }
.runs li { display: flex; align-items: center; gap: 10px; padding: 3px 0; font-variant-numeric: tabular-nums; }
.runs span { flex: 1; font-weight: 600; }
.runs b { font: 800 18px var(--cond); }
.runs small, .runs em { color: var(--dim); font-style: normal; font-weight: 500; }
.runs .i { color: var(--accent); }
.runs .link { display: grid; font-size: 18px; }
.log .meta { display: flex; gap: 14px; color: var(--dim); font: 600 14px var(--cond); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.log .meta span { display: flex; align-items: center; gap: 5px; }
#lookupForm { margin-top: 18px; }
@media (max-width: 860px) {
  .tabbar button { display: grid; justify-items: center; align-content: center; gap: 2px; font-size: 11px; }
  .tabbar .i { font-size: 19px; }
}

[hidden] { display: none !important; }
