/* PITWALL components. Every value comes from tokens.css; see /design/ for each one rendered.
 * Markup helpers that produce these classes live in js/ui/components.js. */

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ink-0); color: var(--text);
  font: var(--fw-regular) var(--fs-14)/var(--lh-body) var(--font);
  font-variant-numeric: tabular-nums;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.label { font-size: var(--fs-12); font-weight: var(--fw-bold); letter-spacing: var(--label-track); text-transform: uppercase; color: var(--text-2); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }

/* wordmark: the only place the brand red lives */
.wordmark { font-weight: var(--fw-black); font-style: italic; font-size: var(--fs-20); letter-spacing: .06em; color: var(--text); text-decoration: none; white-space: nowrap; }
.wordmark b { color: var(--brand); font-weight: var(--fw-black); }

/* glass panel: anything that floats over the 3D view */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-radius: var(--r-4); box-shadow: var(--shadow-glass); border: 1px solid var(--glass-edge);
}

/* icons (inline SVG, 24-unit grid, stroke) */
.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* team tick: the small bar of team colour beside a name */
.tick { display: inline-block; width: 3px; height: 14px; border-radius: 1px; background: var(--team); flex: none; }
.tick--lg { width: 4px; height: 20px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: 40px; padding: 0 var(--s-4); border-radius: var(--r-3);
  border: 1px solid var(--line-3); background: var(--ink-2); color: var(--text);
  font-size: var(--fs-14); font-weight: var(--fw-semi); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), filter var(--t-fast);
}
.btn:hover { background: var(--ink-3); }
.btn:active { filter: brightness(.92); }
.btn:disabled { opacity: .5; cursor: default; }
.btn--primary { background: var(--text); color: var(--on-light); border-color: var(--text); }
.btn--primary:hover { background: #ffffff; }
.btn--team { background: var(--team); border-color: var(--team); color: var(--team-ink, #fff); }
.btn--team:hover { background: var(--team); filter: brightness(1.08); }
.btn--ghost { background: none; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--hover); color: var(--text); }
.btn--sm { height: 32px; padding: 0 var(--s-3); font-size: var(--fs-13); }
.btn--icon { width: 28px; height: 28px; padding: 0; border: 0; background: none; color: var(--text-2); border-radius: var(--r-2); }
.btn--icon:hover { background: var(--hover); color: var(--text); }
.btn--block { width: 100%; }

/* segmented control (tower modes, camera picker, tabs inside glass) */
.seg { display: inline-flex; background: rgba(255, 255, 255, .06); border-radius: var(--r-2); padding: 2px; gap: 2px; }
.seg button, .seg a {
  border: 0; background: none; color: var(--text-2); cursor: pointer; text-decoration: none;
  font-size: var(--fs-12); font-weight: var(--fw-bold); letter-spacing: .06em; padding: 2px var(--s-2); border-radius: 3px;
  transition: background var(--t-fast), color var(--t-fast);
}
.seg button:hover, .seg a:hover { color: var(--text); }
.seg .on, .seg [aria-pressed="true"], .seg [aria-selected="true"] { background: var(--text); color: var(--on-light); }

/* pill bar (camera picker, glass nav) */
.pills { display: flex; gap: 2px; padding: var(--s-1); align-items: center; }
.pills > * {
  font-size: var(--fs-13); font-weight: var(--fw-semi); color: var(--text-2); padding: var(--s-1) 10px; border-radius: var(--r-2);
  background: none; border: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}
.pills > *:hover { color: var(--text); }
.pills > .on, .pills > [aria-current="page"], .pills > [aria-pressed="true"] { color: var(--text); background: var(--on); }

/* underline tabs (page sections) */
.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--ink-3); overflow-x: auto; scrollbar-width: none; }
.tabs > * {
  padding: 10px 14px; font-size: var(--fs-14); font-weight: var(--fw-semi); color: var(--text-2); text-decoration: none; white-space: nowrap;
  border: 0; border-bottom: 2px solid transparent; background: none; cursor: pointer;
}
.tabs > *:hover { color: var(--text); }
.tabs > .on, .tabs > [aria-selected="true"], .tabs > [aria-current="page"] { color: var(--text); border-bottom-color: var(--text); }

/* ---------------------------------------------------------------- chips */
.chip {
  display: inline-flex; align-items: center; gap: var(--s-1); height: 20px; padding: 0 6px; border-radius: var(--r-2);
  font-size: var(--fs-12); font-weight: var(--fw-bold); letter-spacing: .06em; white-space: nowrap; line-height: 1;
  background: var(--ink-3); color: var(--text);
}
.chip--lg { height: 24px; padding: 0 var(--s-2); }
.chip--drs { background: var(--good); color: var(--good-ink); }
.chip--good { background: var(--good); color: var(--good-ink); }
.chip--sc { background: var(--caution); color: var(--caution-ink); }
.chip--live { background: var(--alert); color: var(--alert-ink); }
.chip--live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pw-pulse 1.6s infinite; }
.chip--fastest { background: var(--fastest); color: var(--fastest-ink); }
.chip--pit { background: rgba(255, 255, 255, .12); color: var(--text-2); }
.chip--rain { background: var(--info); color: var(--info-ink); }
.chip--ghost { background: var(--on); color: var(--text-2); }
.chip--v1 { background: var(--on); color: var(--text-3); }
.chip--alert { background: var(--alert); color: var(--alert-ink); }
.chip--team { background: var(--team); color: var(--team-ink, var(--on-light)); }
@keyframes pw-pulse { 50% { opacity: .35; } }

/* status dot */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line-3); flex: none; }
.dot--good { background: var(--good); }
.dot--caution { background: var(--caution); }
.dot--alert { background: var(--alert); }
.dot--on { background: var(--text); }
.flag { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--good); flex: none; }
.flag--sc { background: var(--caution); }
.flag--red { background: var(--alert); }
.flag--chequered { background: conic-gradient(#fff 0 25%, #111 0 50%, #fff 0 75%, #111 0) 0 0 / 5px 5px; }

/* ---------------------------------------------------------------- tyre */
.tyre {
  --tc: var(--tyre-medium);
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--tc); color: var(--tc);
  display: inline-grid; place-items: center; font-size: 9px; font-weight: var(--fw-black); line-height: 1; flex: none;
}
.tyre--S { --tc: var(--tyre-soft); }
.tyre--M { --tc: var(--tyre-medium); }
.tyre--H { --tc: var(--tyre-hard); }
.tyre--I { --tc: var(--tyre-inter); }
.tyre--W { --tc: var(--tyre-wet); }
.tyre--lg { width: 28px; height: 28px; border-width: 3px; font-size: var(--fs-13); }
.tyre--md { width: 18px; height: 18px; font-size: 10px; }

/* ---------------------------------------------------------------- meters */
.meter { display: block; height: 6px; border-radius: 3px; background: var(--hair-2); overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: var(--text); border-radius: inherit; transition: width var(--t-med) linear; }
.meter--thin { height: 4px; border-radius: 2px; }
.meter--team > i { background: var(--team); }

/* battery bar (tower, battle, card) */
.bat { display: block; height: 4px; border-radius: 2px; background: var(--hair-2); overflow: hidden; }
.bat > i { display: block; height: 100%; background: var(--text); border-radius: 2px; transition: width var(--t-med) linear; }
.bat--deploy > i { background: var(--team); box-shadow: 0 0 8px var(--team); }
.v1tag { font-size: 10px; font-weight: var(--fw-bold); color: var(--text-3); letter-spacing: .04em; text-align: center; }

/* DRS dot */
.drsdot { width: 6px; height: 6px; border-radius: 50%; }
.drsdot--avail { box-shadow: inset 0 0 0 1.5px var(--good); }
.drsdot--on { background: var(--good); box-shadow: 0 0 6px var(--good); }

/* setup pips: one per level, 0-10 */
.pips { display: flex; gap: 2px; }
.pips > i { flex: 1; height: 6px; border-radius: 1px; background: var(--hair-2); }
.pips > i.on { background: var(--text); }

/* pedals */
.pedals { display: flex; gap: var(--s-1); height: 44px; }
.pedals > span { width: 8px; border-radius: var(--r-1); background: var(--hair-2); display: flex; align-items: flex-end; overflow: hidden; }
.pedals > span > i { display: block; width: 100%; background: var(--good); }
.pedals > span + span > i { background: var(--alert); }

/* ---------------------------------------------------------------- timing tower */
.tower { padding-bottom: var(--s-1); width: 272px; overflow: hidden; }
.tower__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); height: 36px; padding: 0 6px 0 var(--s-3); border-bottom: 1px solid var(--hair); }
.tower__head--sc { background: var(--caution); color: var(--caution-ink); border-radius: var(--r-3) var(--r-3) 0 0; font-weight: var(--fw-black); font-size: var(--fs-12); letter-spacing: .1em; }
.tower__list { position: relative; }
.tower__foot { display: flex; justify-content: space-between; padding: var(--s-1) var(--s-3) 0; font-size: var(--fs-12); color: var(--text-3); }

.trow {
  --team: var(--text);
  display: grid; grid-template-columns: 24px 3px minmax(0, 1fr) 52px 16px 24px 6px; align-items: center; column-gap: var(--s-2);
  height: 24px; padding: 0 10px 0 var(--s-1); font-size: var(--fs-14); position: relative; cursor: pointer;
  transition: background var(--t-fast);
}
.tower__list .trow { position: absolute; left: 0; right: 0; top: 0; transition: transform var(--t-med) var(--ease-out), background var(--t-fast); }
.tower__slot.is-moving { z-index: 2; }
.tower__slot.is-moving .trow { background: var(--glass-strong); }   /* a row sliding past another covers it (no ghosted text) */
.tower__slot.is-moving.is-up { z-index: 3; }
.trow:hover { background: var(--hover); }
.trow__p { text-align: center; font-weight: var(--fw-bold); }
.trow__n { font-weight: var(--fw-bold); letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow__n em { font-style: normal; font-weight: var(--fw-regular); color: var(--text-2); margin-left: 3px; }
.trow__g { text-align: right; white-space: nowrap; }
.trow__g .chip { height: 16px; padding: 0 5px; border-radius: 3px; }
.trow--own { background: var(--wash); }
.trow--sel, .trow--sel:hover { background: color-mix(in srgb, var(--team) 22%, transparent); box-shadow: inset 2px 0 0 var(--team); }
.trow--battle::before { content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 2px; background: var(--text); border-radius: 1px; }
.trow--sel.trow--battle::before { background: var(--text); }
.trow--out { color: var(--text-3); }
.trow--out .trow__n em { color: var(--text-3); }
.trow--up { animation: pw-up 1.6s var(--ease-out); }
.trow--down { animation: pw-down 1.6s var(--ease-out); }
@keyframes pw-up { 0%, 30% { box-shadow: inset 3px 0 0 var(--good); background: rgba(52, 210, 123, .16); } }
@keyframes pw-down { 0%, 30% { box-shadow: inset 3px 0 0 var(--alert); background: rgba(255, 77, 79, .12); } }
.trow--fastest .trow__g { color: var(--fastest); }
/* the tower collapsed to a strip: position, tick and three-letter name only */
.tower--collapsed { width: 132px; }
.tower--collapsed .trow { grid-template-columns: 24px 3px minmax(0, 1fr) 6px; }
.tower--collapsed .trow__g, .tower--collapsed .tyre, .tower--collapsed .bat, .tower--collapsed .v1tag { display: none; }
/* team rows under the cars */
.trow--team { cursor: default; grid-template-columns: 24px 3px minmax(0, 1fr) auto; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--ink-1); border: 1px solid var(--ink-3); border-radius: var(--r-4); min-width: 0; }
.card--raised { background: var(--ink-2); border-color: transparent; }
.card--pad { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
.card--pad-sm { padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.card__h { margin: 0; font-size: var(--fs-16); font-weight: var(--fw-bold); padding: 14px var(--s-4); border-bottom: 1px solid var(--ink-3); display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); }
.card__h small { font-size: var(--fs-13); font-weight: var(--fw-regular); color: var(--text-2); }
.card__foot { display: flex; gap: var(--s-4); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--ink-3); font-size: var(--fs-12); color: var(--text-3); flex-wrap: wrap; }
.card--on { border-color: var(--text); box-shadow: 0 0 0 1px var(--text) inset; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: var(--fs-24); font-weight: var(--fw-bold); line-height: var(--lh-tight); }
.stat small { font-size: var(--fs-12); color: var(--text-2); }

/* key/value line with a meter (car card) */
.kv { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: var(--fs-13); }
.kv__k { font-size: var(--fs-12); font-weight: var(--fw-bold); letter-spacing: var(--label-track); color: var(--text-2); }
.kv__v { font-weight: var(--fw-semi); white-space: nowrap; display: inline-flex; align-items: center; gap: var(--s-1); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { font-size: var(--fs-12); font-weight: var(--fw-bold); letter-spacing: var(--label-track); color: var(--text-3); text-align: right; padding: 10px var(--s-3); white-space: nowrap; }
.tbl td { text-align: right; padding: 0 var(--s-3); height: 52px; border-top: 1px solid var(--ink-3); white-space: nowrap; }
.tbl--compact td { height: 40px; }
.tbl .l { text-align: left; }
.tbl .c { text-align: center; }
.tbl td.pos { width: 40px; text-align: center; font-weight: var(--fw-bold); font-size: var(--fs-16); }
.tbl tr.own { background: var(--wash); }
.tbl tr[data-href] { cursor: pointer; }
.tbl tr[data-href]:hover { background: var(--hover); }
.tbl .big { font-size: var(--fs-20); font-weight: var(--fw-bold); }
.tbl .team { display: flex; align-items: center; gap: 10px; }
.tbl .team .tick { width: 4px; height: 22px; }
.tbl .team b { font-size: var(--fs-16); }
.tbl .team small { display: block; font-size: var(--fs-12); color: var(--text-3); margin-top: -2px; }

/* last-five finishes */
.form { display: inline-flex; gap: 3px; }
.form > span { width: 26px; height: 22px; border-radius: var(--r-2); display: grid; place-items: center; font-size: var(--fs-12); font-weight: var(--fw-bold); background: var(--ink-3); color: var(--text-2); }
.form > .win { background: var(--text); color: var(--on-light); }
.form > .pod { box-shadow: inset 0 0 0 1.5px var(--text); color: var(--text); background: transparent; }
.form > .dnf { color: var(--alert); }

/* ---------------------------------------------------------------- sparkline (SVG from components.js) */
.spark { display: block; overflow: visible; }
.spark__base { stroke: var(--ink-3); stroke-width: 1; }
.spark__mid { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 4; }
.spark__area { fill: var(--team); fill-opacity: .14; }
.spark__line { fill: none; stroke: var(--team); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark__dot { fill: var(--team); }

/* ---------------------------------------------------------------- countdown + start lights */
.countdown { font-size: var(--fs-48); font-weight: var(--fw-bold); line-height: 1; letter-spacing: .01em; }
.countdown small { font-size: var(--fs-16); font-weight: var(--fw-semi); color: var(--text-2); margin-left: 6px; letter-spacing: 0; }
.lights { display: flex; gap: 6px; }
.lights > i { width: 20px; height: 20px; border-radius: 50%; background: var(--line-2); transition: background var(--t-fast), box-shadow var(--t-fast); }
.lights > i.on { background: var(--alert); box-shadow: 0 0 10px var(--alert); }
.lights--lg > i { width: 32px; height: 32px; }

/* timeline of a race slot (next-race card) */
.timeline { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-2) var(--s-3); font-size: var(--fs-14); align-items: center; }
.timeline .t { color: var(--text-2); text-align: right; }
.timeline .past { color: var(--text-3); }

/* ---------------------------------------------------------------- banner (server events) */
.banner { display: flex; align-items: stretch; height: 44px; overflow: hidden; border-radius: var(--r-3); max-width: min(760px, calc(100vw - 32px)); }
.banner.glass { background: var(--glass-strong); }
.banner__k { display: flex; align-items: center; padding: 0 14px; font-size: var(--fs-13); font-weight: var(--fw-black); letter-spacing: .1em; color: var(--on-light); background: var(--bk, var(--neutral-chip)); white-space: nowrap; }
.banner__t { display: flex; align-items: center; gap: 10px; padding: 0 18px; font-size: var(--fs-16); font-weight: var(--fw-semi); white-space: nowrap; overflow: hidden; min-width: 0; }
.banner__t b { font-weight: var(--fw-bold); }
.banner__msg { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.banner__t .muted { font-weight: var(--fw-regular); font-size: var(--fs-14); }
.banner--team { --bk: var(--team); }
.banner--sc { --bk: var(--caution); }
.banner--sc .banner__k { color: var(--caution-ink); }
.banner--rain { --bk: var(--info); }
.banner--rain .banner__k { color: var(--info-ink); }
.banner--fastest { --bk: var(--fastest); }
.banner--fastest .banner__k { color: var(--fastest-ink); }
.banner--alert { --bk: var(--alert); }
.banner--alert .banner__k { color: var(--alert-ink); }
.banner--flag { --bk: var(--text); }
.banner.is-in { animation: pw-banner-in var(--t-slow) var(--ease-out) both; }
.banner.is-out { animation: pw-banner-out var(--t-med) var(--ease-in) both; }
@keyframes pw-banner-in { from { opacity: 0; transform: translateY(-10px); clip-path: inset(0 100% 0 0); } to { opacity: 1; transform: none; clip-path: inset(0 0 0 0); } }
@keyframes pw-banner-out { to { opacity: 0; transform: translateY(-6px); } }
.banner--sm { height: 36px; }
.banner--sm .banner__k { font-size: var(--fs-12); padding: 0 var(--s-3); }
.banner--sm .banner__t { font-size: var(--fs-14); padding: 0 14px; }

/* ---------------------------------------------------------------- toast */
.toasts { position: fixed; z-index: var(--z-toast); left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; flex-direction: column; gap: var(--s-2); align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--ink-2); border: 1px solid var(--line-2); border-radius: var(--r-3); font-size: var(--fs-14); box-shadow: var(--shadow-glass); pointer-events: auto; animation: pw-banner-in var(--t-slow) var(--ease-out) both; }
.toast .dot { background: var(--good); }
.toast--bad .dot { background: var(--alert); }
.toast.is-out { animation: pw-banner-out var(--t-med) var(--ease-in) both; }

/* ---------------------------------------------------------------- modal */
.scrim { position: fixed; inset: 0; z-index: var(--z-modal); background: rgba(5, 6, 9, .66); display: grid; place-items: center; padding: var(--s-4); animation: pw-fade var(--t-med) var(--ease-out) both; }
@keyframes pw-fade { from { opacity: 0; } }
.modal {
  background: var(--ink-1); border: 1px solid var(--line-2); border-radius: var(--r-4); box-shadow: var(--shadow-modal);
  padding: var(--s-5); display: flex; flex-direction: column; gap: 14px; width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  animation: pw-pop var(--t-med) var(--ease-out) both;
}
@keyframes pw-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal--wide { width: min(1040px, 100%); }
.modal__h { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); }
.modal__h h2 { margin: 0; font-size: var(--fs-20); font-weight: var(--fw-bold); }
.modal__actions { display: flex; gap: var(--s-2); justify-content: flex-end; flex-wrap: wrap; }

/* form fields */
.field { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-13); color: var(--text-2); }
.input { height: 40px; padding: 0 var(--s-3); border-radius: var(--r-3); border: 1px solid var(--line-2); background: var(--ink-2); color: var(--text); font-size: var(--fs-14); }
.input:focus { outline: none; border-color: var(--text-2); }
.err { color: var(--alert); font-size: var(--fs-13); }

/* setup slider (0-10 levels, team-coloured fill) */
.slider { display: grid; grid-template-columns: 96px minmax(0, 1fr) 28px; align-items: center; gap: var(--s-3); font-size: var(--fs-13); }
.slider b { text-align: right; font-size: var(--fs-14); }
.slider input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 16px; background: none; margin: 0; cursor: pointer; }
.slider input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--team) var(--fill, 50%), var(--line-2) var(--fill, 50%)); }
.slider input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--team) var(--fill, 50%), var(--line-2) var(--fill, 50%)); }
.slider input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--text); margin-top: -6px; border: 0; }
.slider input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--text); border: 0; }

/* ---------------------------------------------------------------- bottom sheet (mobile) */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sheet);
  background: var(--ink-1); border-radius: var(--r-5) var(--r-5) 0 0; box-shadow: var(--shadow-sheet);
  padding: var(--s-2) 0 env(safe-area-inset-bottom, 0px); display: flex; flex-direction: column;
  transition: transform var(--t-med) var(--ease-out); touch-action: none;
}
.sheet__handle { width: 36px; height: 4px; border-radius: 2px; background: var(--line-3); margin: 0 auto 10px; border: 0; padding: 0; cursor: grab; flex: none; }
.sheet__tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--ink-2); border-radius: var(--r-3); padding: 3px; margin: 0 var(--s-4) var(--s-2); flex: none; }
.sheet__tabs button { height: 38px; border: 0; border-radius: var(--r-3); background: none; color: var(--text-2); font-size: var(--fs-14); font-weight: var(--fw-semi); cursor: pointer; }
.sheet__tabs .on { background: var(--line-2); color: var(--text); }
.sheet__body { overflow-y: auto; min-height: 0; flex: 1; touch-action: pan-y; }

/* ---------------------------------------------------------------- empty and loading states */
.empty { padding: var(--s-8) var(--s-4); text-align: center; color: var(--text-2); }
.skeleton { background: linear-gradient(90deg, var(--ink-2), var(--ink-3), var(--ink-2)); background-size: 200% 100%; animation: pw-shimmer 1.4s linear infinite; border-radius: var(--r-2); }
@keyframes pw-shimmer { to { background-position: -200% 0; } }
.sample { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); font-weight: var(--fw-bold); letter-spacing: .06em; color: var(--caution); text-transform: uppercase; }
.sample::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--caution); }

/* track outline (schedule cards, race pages) */
.trackmap { display: grid; place-items: center; background: var(--ink-2); border-radius: var(--r-3); height: 100px; }
.trackmap svg { width: 160px; height: 100px; }
.trackmap path { fill: none; stroke: var(--text); stroke-width: 3; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.trackmap--hidden { background: repeating-linear-gradient(135deg, var(--ink-2) 0 10px, #12161e 10px 20px); color: var(--text-3); font-size: var(--fs-13); text-align: center; padding: 0 var(--s-3); }

/* livery window: the 3D turntable */
.liv__view { position: relative; height: clamp(200px, 38vw, 380px); border-radius: var(--r-3); border: 1px solid var(--line-2); overflow: hidden;
  background: radial-gradient(ellipse at 50% 70%, var(--ink-3), var(--ink-2) 72%); display: grid; place-items: center; }
.liv__view canvas { position: absolute; inset: 0; }

/* bets window */

/* next-race card: the revealed track */
.nextrace__trk { display: grid; grid-template-columns: 96px 1fr; gap: var(--s-3); align-items: center; }
.nextrace__trk .trackmap { margin: 0; }
.nextrace__trk .trackmap { height: 64px; }
.nextrace__trk .trackmap svg { width: 96px; height: 60px; }
