/* Knockhill Hot Lap on rd-motorsport.co.uk. The live circuit fills the screen; a timing-tower HUD pins to the
   corners, and the menus are navy sheets laid over the track. RDM branding overrides are at the end. */
@font-face{font-family:"Archivo";font-style:normal;font-display:swap;font-weight:100 900;font-stretch:62% 125%;
  src:url("/assets/fonts/archivo-wdth.woff2") format("woff2-variations"),url("/assets/fonts/archivo-wdth.woff2") format("woff2");}
/* the same file pinned to Archivo's Condensed width (75%), for numbers, labels and canvas text */
@font-face{font-family:"RDM Narrow";font-style:normal;font-display:swap;font-weight:100 900;font-stretch:75%;
  src:url("/assets/fonts/archivo-wdth.woff2") format("woff2-variations"),url("/assets/fonts/archivo-wdth.woff2") format("woff2");}
:root {
  /* RD Motorsport palette: deep navy, M blue, M red (see /assets/site.css) */
  --slate: #0c0e26;
  --panel: rgba(12, 14, 38, 0.84);
  --panel-solid: #141737;
  --line: rgba(216, 220, 232, 0.16);
  --ink: #f3f4fa;
  --mute: #a3a8c3;
  --saltire: #00ADEE;
  --saltire-ink: #0b0d29;
  --navy: #2E3191;
  --m-blue: #00ADEE;
  --m-red: #EC1C24;
  --pb: #3fd07a;
  --ob: #b97cf3;
  --slow: #f2c53d;
  --bad: #EC1C24;
  --f-display: "RDM Narrow", "Arial Narrow", system-ui, sans-serif;
  --f-wide: "Archivo", system-ui, sans-serif;
  --f-body: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }
body { margin: 0; background: var(--slate); color: var(--ink); font-family: var(--f-body); font-size: 15px; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#world { position: fixed; inset: 0; display: block; touch-action: none; background: var(--slate); }
#world3d { position: fixed; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
#ui {
  position: fixed; inset: 0; pointer-events: none;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: max(14px, env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-bottom, 0px));
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--saltire); outline-offset: 2px; }
.num { font-family: var(--f-display); font-variant-numeric: tabular-nums; }

/* ---------- HUD ---------- */
#hud { position: relative; height: 100%; }
.tower {
  position: absolute; top: 0; left: 0; width: 15.5rem; background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 0.6rem 0.75rem 0.7rem; display: grid; gap: 0.35rem; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.tower-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-width: 0; }
.lapno { font-family: var(--f-display); font-weight: 700; font-size: 0.95rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); white-space: nowrap; }
.chip { font-family: var(--f-display); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.12rem 0.45rem; border-radius: 3px; background: var(--saltire); color: var(--saltire-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chip.bad { background: var(--bad); color: #1d0503; }
.laptime { font-family: var(--f-display); font-weight: 800;  font-size: 2.6rem; line-height: 0.95; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.laptime.dead { color: var(--mute); text-decoration: line-through; text-decoration-thickness: 2px; }
.secs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.sec { border-radius: 3px; background: rgba(255,255,255,0.06); padding: 0.18rem 0.35rem 0.22rem; display: grid; }
.sec b { font-family: var(--f-display); font-weight: 700; font-size: 0.68rem; letter-spacing: 0.1em; color: var(--mute); }
.sec span { font-family: var(--f-display); font-weight: 700; font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.sec.live span { color: var(--mute); }
.sec.pb { background: var(--pb); } .sec.pb b, .sec.pb span { color: #052611; }
.sec.ob { background: var(--ob); } .sec.ob b, .sec.ob span { color: #1d0634; }
.sec.slow { background: var(--slow); } .sec.slow b, .sec.slow span { color: #2b2002; }
.sec.dead span { color: var(--mute); text-decoration: line-through; }
.pair { display: flex; justify-content: space-between; gap: 0.75rem; font-size: 0.85rem; color: var(--mute); }
.pair span b { font-family: var(--f-display); font-weight: 700; font-size: 1.05rem; color: var(--ink); font-variant-numeric: tabular-nums; margin-left: 0.3rem; }

.deltabox { position: absolute; top: 0; left: 50%; transform: translateX(-50%); display: grid; justify-items: center; gap: 0.1rem; }
.delta { font-family: var(--f-display); font-weight: 800;  font-size: 2.3rem; line-height: 1; font-variant-numeric: tabular-nums; padding: 0.15rem 0.6rem 0.2rem; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); min-width: 7.2rem; text-align: center; }
.delta.ahead { background: var(--pb); color: #052611; border-color: transparent; }
.delta.behind { background: var(--bad); color: #250604; border-color: transparent; }
.delta.none { font-size: 1rem; font-style: normal; font-weight: 600; color: var(--mute); padding: 0.45rem 0.7rem; }
.deltalbl { font-family: var(--f-display); font-weight: 600; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--mute); text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.callout { position: absolute; top: 5.1rem; left: 50%; transform: translateX(-50%); font-family: var(--f-display); font-weight: 800;  font-size: 1.35rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink); text-shadow: 0 2px 6px rgba(0,0,0,.7); white-space: nowrap; display: flex; align-items: center; gap: 0.4rem; }
.callout small { font-style: normal; font-weight: 600; font-size: 0.85rem; color: var(--mute); letter-spacing: 0.08em; }

.topright { position: absolute; top: 0; right: 0; display: grid; justify-items: end; gap: 8px; }
.iconbtn { pointer-events: auto; width: 2.6rem; height: 2.6rem; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer; }
.iconbtn svg { width: 1.1rem; height: 1.1rem; fill: var(--ink); }
#mini { width: 150px; height: 112px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); display: block; }

.speedo { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); display: flex; align-items: baseline; gap: 0.4rem; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 0.25rem 0.8rem 0.35rem; }
.speedo .mph { font-family: var(--f-display); font-weight: 800;  font-size: 2.4rem; line-height: 1; font-variant-numeric: tabular-nums; min-width: 3.2rem; text-align: right; }
.speedo small { font-family: var(--f-display); font-weight: 600; font-size: 0.8rem; letter-spacing: 0.12em; color: var(--mute); text-transform: uppercase; }
.speedo .gear { font-family: var(--f-display); font-weight: 800; font-size: 1.5rem; margin-left: 0.4rem; padding-left: 0.6rem; border-left: 1px solid var(--line); }
.revs { position: absolute; left: 0.8rem; right: 0.8rem; bottom: 0.18rem; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.08); overflow: hidden; }
.revs i { display: block; height: 100%; width: 0; background: var(--saltire); }
.revs i.hot { background: var(--bad); }

.banner { position: absolute; top: 28%; left: 50%; transform: translateX(-50%); text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.7rem 1.4rem 0.8rem; display: grid; gap: 0.15rem; min-width: 14rem; }
.banner .bt { font-family: var(--f-display); font-weight: 800;  font-size: 3rem; line-height: 1; font-variant-numeric: tabular-nums; }
.banner .bs { font-family: var(--f-display); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.06em; text-transform: uppercase; }
.banner .bm { font-size: 0.9rem; color: var(--mute); }
.banner.pb .bs { color: var(--pb); } .banner.bad .bs { color: var(--bad); } .banner.slow .bs { color: var(--slow); }
@media (prefers-reduced-motion: no-preference) { .banner:not([hidden]) { animation: pop 0.35s cubic-bezier(.2,1.4,.4,1); } }
@keyframes pop { from { transform: translate(-50%, 8px) scale(0.94); opacity: 0; } to { transform: translate(-50%, 0) scale(1); opacity: 1; } }
.toast { position: absolute; bottom: 4.4rem; left: 50%; transform: translateX(-50%); background: var(--panel-solid); border: 1px solid var(--line); border-radius: 6px; padding: 0.45rem 0.8rem; font-size: 0.9rem; white-space: nowrap; }


/* ---------- telemetry strip ---------- */
.telem { position: absolute; bottom: 0; left: 50%; transform: translateX(calc(-50% + 11.5rem)); display: flex; align-items: flex-end; gap: 0.55rem; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 0.4rem 0.55rem; height: 2.9rem; }
.pedals { display: flex; gap: 3px; height: 100%; }
.pedals .bar { width: 7px; height: 100%; background: rgba(255,255,255,0.08); border-radius: 2px; position: relative; overflow: hidden; }
.pedals .bar i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; }
.pedals .thr { background: var(--pb); } .pedals .brk { background: var(--bad); }
.gm { position: relative; width: 2.6rem; height: 2.6rem; }
.gm .ring { position: absolute; inset: 0; border: 1px solid rgba(255,255,255,0.22); border-radius: 50%; }
.gm .ring.inner { inset: 25%; border-color: rgba(255,255,255,0.14); }
.gm .cross { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,0.12); }
.gm .cross::after { content: ""; position: absolute; top: 50%; left: -1.3rem; width: 2.6rem; height: 1px; background: rgba(255,255,255,0.12); }
.gm b { position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--saltire); box-shadow: 0 0 6px rgba(0,173,238,0.8); }
.car4 { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 9px; padding: 2px 4px; }
.car4 .t { width: 6px; height: 11px; border-radius: 2px; background: rgba(255,255,255,0.22); }
.car4 .t.edge { box-shadow: 0 0 5px rgba(242,197,61,0.9); } .car4 .t.slide { box-shadow: 0 0 7px rgba(255,93,80,1); } .car4 .t.lock { background: #fff !important; box-shadow: 0 0 6px #fff; }
.wheel { width: 2.4rem; height: 2.4rem; color: #c9d1d6; } .wheel svg { width: 100%; height: 100%; display: block; transition: transform 0.05s linear; }
.tcol { display: grid; gap: 1px; min-width: 3.4rem; font-family: var(--f-display); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.05; }
.tcol .grade { color: var(--ink); }
.tcol .aids { color: var(--slow); min-height: 0.8rem; }
.tcol .dmgtag { color: var(--bad); }
.shifts { display: grid; gap: 0.4rem; }
.tbtn.shift { width: 2.9rem; height: 2.9rem; border-radius: 8px; font-size: 1rem; }
body:not(.manual) .shifts { display: none; }
@media (max-width: 640px) {
  .telem { display: none; }
}

/* ---------- touch controls ---------- */
#touch { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; pointer-events: none; }
#touch .grp { display: flex; gap: 0.7rem; align-items: flex-end; }
.tbtn { pointer-events: auto; touch-action: none; border: 1px solid rgba(255,255,255,0.22); background: rgba(12,14,38,0.55); border-radius: 50%; width: 4.6rem; height: 4.6rem; display: grid; place-items: center; font-family: var(--f-display); font-weight: 800; font-size: 0.9rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); -webkit-user-select: none; user-select: none; }
.tbtn svg { width: 1.6rem; height: 1.6rem; fill: var(--ink); }
.tbtn.pedal { border-radius: 10px; width: 4.4rem; height: 5.4rem; }
.tbtn.gas { height: 6.6rem; background: rgba(0,173,238,0.35); border-color: rgba(0,173,238,0.7); }
.tbtn.on { background: rgba(243,244,250,0.32); }
.steer { pointer-events: auto; touch-action: none; position: relative; width: 12rem; height: 4.6rem; border-radius: 2.3rem; border: 1px solid rgba(255,255,255,0.22); background: rgba(12,14,38,0.55); display: flex; align-items: center; justify-content: space-between; padding: 0 1rem; box-sizing: border-box; -webkit-user-select: none; user-select: none; }
.steer svg { width: 1.3rem; height: 1.3rem; fill: rgba(243,244,250,0.55); }
.steer .knob { position: absolute; left: 50%; top: 50%; width: 3.6rem; height: 3.6rem; margin: -1.8rem 0 0 -1.8rem; border-radius: 50%; background: rgba(243,244,250,0.3); border: 2px solid rgba(243,244,250,0.75); box-sizing: border-box; pointer-events: none; }
.steer.on .knob { background: rgba(243,244,250,0.7); }
@media (prefers-reduced-motion: no-preference) { .steer:not(.on) .knob { transition: transform 0.12s ease-out; } }
.tbtn.gas.on { background: rgba(0,173,238,0.75); }
body.touch .speedo { bottom: 7.4rem; }
body.touch .toast { bottom: 12rem; }

/* ---------- sheets (title / pause) ---------- */
.sheet { position: absolute; inset: 0; pointer-events: auto; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: linear-gradient(90deg, rgba(12,14,38,0.94) 0%, rgba(12,14,38,0.78) 48%, rgba(12,14,38,0.25) 100%);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: max(20px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-bottom, 0px)); }
.sheet-in { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-start; max-width: 62rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem 1.3rem 1.35rem; display: grid; gap: 1rem; min-width: 0; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.card.main { flex: 1 1 26rem; max-width: 33rem; }
.card.side { flex: 1 1 19rem; max-width: 24rem; }
.eyebrow { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--saltire); }
h1 { margin: 0; font-family: var(--f-display); font-weight: 800;  font-size: clamp(3.4rem, 9vw, 5.4rem); line-height: 0.82; letter-spacing: -0.01em; text-transform: uppercase; text-wrap: balance; }
h1 span { display: block; color: var(--saltire); }
h2 { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--mute); }
.facts { margin: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; font-family: var(--f-display); font-weight: 600; font-size: 1rem; letter-spacing: 0.04em; color: var(--ink); }
.facts span + span::before { content: "·"; margin-right: 0.9rem; color: var(--mute); }
.facts.sub { font-size: 0.85rem; color: var(--mute); margin-top: -0.5rem; }
#map { width: 100%; aspect-ratio: 1.55; max-width: 100%; display: block; }
.go-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; }
.primary { font-family: var(--f-display); font-weight: 800;  font-size: 1.5rem; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.55rem 2.2rem 0.6rem; border-radius: 6px; border: 0; background: var(--saltire); color: var(--saltire-ink); cursor: pointer; }
.primary:hover { filter: brightness(1.08); }
.ghostbtn { font-family: var(--f-display); font-weight: 700; font-size: 1rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.5rem 1rem; border-radius: 6px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.ghostbtn:hover { background: rgba(255,255,255,0.06); }
.keys { margin: 0; font-size: 0.85rem; color: var(--mute); line-height: 1.5; }
kbd { font-family: var(--f-display); font-weight: 700; font-size: 0.8rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; padding: 0 0.3rem; color: var(--ink); }
.opts { display: grid; gap: 0.6rem; }
.opt { display: grid; grid-template-columns: 7.6rem 1fr; align-items: center; gap: 0.75rem; }
.opt > span { font-family: var(--f-display); font-weight: 600; font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { cursor: pointer; padding: 0.28rem 0.7rem; border-radius: 4px; border: 1px solid var(--line); font-size: 0.88rem; }
.seg input:checked + label { background: var(--ink); color: var(--slate); border-color: var(--ink); font-weight: 600; }
.seg input:focus-visible + label { outline: 2px solid var(--saltire); outline-offset: 2px; }
.swatch { width: 1.6rem; height: 1.6rem; padding: 0 !important; border-radius: 50% !important; }
.seg input:checked + .swatch { box-shadow: 0 0 0 2px var(--slate), 0 0 0 4px var(--ink); }

.pbbig { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.pbbig .t { font-family: var(--f-display); font-weight: 800;  font-size: 2.6rem; line-height: 1; font-variant-numeric: tabular-nums; }
.pbbig .m { font-size: 0.85rem; color: var(--mute); }
.minis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.minis div { background: rgba(255,255,255,0.05); border-radius: 4px; padding: 0.3rem 0.45rem; display: grid; }
.minis b { font-family: var(--f-display); font-weight: 600; font-size: 0.7rem; letter-spacing: 0.1em; color: var(--mute); }
.minis span { font-family: var(--f-display); font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.medals { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.medals li { display: grid; grid-template-columns: 1rem 1fr auto; align-items: center; gap: 0.6rem; padding: 0.3rem 0.5rem; border-radius: 4px; background: rgba(255,255,255,0.04); font-family: var(--f-display); font-weight: 600; font-size: 1.02rem; letter-spacing: 0.03em; }
.medals li i { width: 0.8rem; height: 0.8rem; border-radius: 50%; border: 2px solid currentColor; }
.medals li.got i { background: currentColor; }
.medals li .num { font-weight: 700; }
.medals li:not(.got) { color: var(--mute); }
.m-plat { color: #9fe4ef; } .m-gold { color: #e9c45a; } .m-silver { color: #c9d1d6; } .m-bronze { color: #d29563; }
.medals li.got.m-plat, .medals li.got.m-gold, .medals li.got.m-silver, .medals li.got.m-bronze { color: inherit; }
.medals li.m-plat i { color: #9fe4ef; } .medals li.m-gold i { color: #e9c45a; } .medals li.m-silver i { color: #c9d1d6; } .medals li.m-bronze i { color: #d29563; }
.note { margin: 0; font-size: 0.88rem; color: var(--mute); line-height: 1.45; }
.board { display: grid; gap: 3px; }
.brow { display: grid; grid-template-columns: 1.6rem 1.6rem minmax(0, 1fr) auto auto; align-items: center; gap: 0.5rem; padding: 0.3rem 0.4rem; border-radius: 4px; background: rgba(255,255,255,0.04); }
.brow.me { background: rgba(0,173,238,0.18); }
.brow .pos { font-family: var(--f-display); font-weight: 800; font-size: 1.05rem; text-align: center; color: var(--mute); }
.brow img { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: block; }
.brow .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.brow .tm { font-family: var(--f-display); font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; text-align: right; }
.brow .tm small { display: block; font-size: 0.75rem; color: var(--mute); font-weight: 600; }
.brow button { font-family: var(--f-display); font-weight: 700; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid var(--line); background: transparent; border-radius: 3px; padding: 0.2rem 0.4rem; cursor: pointer; }
.brow button[aria-pressed="true"] { background: var(--ink); color: var(--slate); }
.laps { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.laps th { font-family: var(--f-display); font-weight: 600; font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); text-align: right; padding: 0.2rem 0.3rem; }
.laps th:first-child, .laps td:first-child { text-align: left; }
.laps td { font-family: var(--f-display); font-weight: 600; font-size: 1rem; text-align: right; padding: 0.22rem 0.3rem; border-top: 1px solid var(--line); }
.laps td.pb { color: var(--pb); } .laps td.dead { color: var(--mute); text-decoration: line-through; }
.tablewrap { overflow-x: auto; }
.trace { display: grid; gap: 0.45rem; }
.tracecv { width: 100%; height: 210px; display: block; touch-action: pan-y; cursor: crosshair; }
.legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.85rem; color: var(--mute); }
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend i { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.btnrow { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.pause-title { margin: 0; font-family: var(--f-display); font-weight: 800;  font-size: 3rem; line-height: 0.9; text-transform: uppercase; }

@media (max-width: 640px) {
  .tower { width: 11.6rem; padding: 0.45rem 0.55rem 0.5rem; gap: 0.25rem; }
  .laptime { font-size: 1.85rem; }
  .sec span { font-size: 0.86rem; }
  .sec { padding: 0.12rem 0.25rem 0.16rem; }
  .pair { font-size: 0.75rem; flex-direction: column; gap: 0; }
  .pair span b { font-size: 0.92rem; }
  .delta { font-size: 1.45rem; min-width: 4.8rem; padding: 0.12rem 0.4rem; }
  .delta.none { font-size: 0.78rem; padding: 0.3rem 0.4rem; }
  .deltabox { left: auto; right: 3.3rem; transform: none; justify-items: end; }
  .deltalbl { font-size: 0.65rem; }
  .callout { top: auto; bottom: 12.4rem; font-size: 1.1rem; }
  body:not(.touch) .callout { bottom: 5rem; }
  #mini { width: 104px; height: 80px; }
  .topright { gap: 6px; }
  .iconbtn { width: 2.3rem; height: 2.3rem; }
  .speedo .mph { font-size: 1.9rem; }
  .banner { top: 34%; min-width: 0; width: max-content; max-width: calc(100% - 8px); padding: 0.55rem 1rem 0.65rem; }
  .banner .bt { font-size: 2.2rem; }
  .sheet { background: rgba(12,14,38,0.9); }
  .card { padding: 1rem; }
  .opt { grid-template-columns: 1fr; gap: 0.35rem; }
  .tbtn { width: 4.2rem; height: 4.2rem; }
  .steer { width: 10.4rem; height: 4.4rem; padding: 0 0.8rem; }
  .steer .knob { width: 3.3rem; height: 3.3rem; margin: -1.65rem 0 0 -1.65rem; }
  .tbtn.pedal { width: 4rem; height: 5rem; }
  .tbtn.gas { height: 6.2rem; }
}
/* ---------- race mode ---------- */
.racebox { display: grid; gap: 0.6rem; padding: 0.85rem 0.9rem 0.95rem; border-radius: 8px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); }
.racebox .rhead { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.racebox h2 { color: var(--ink); }
.primary.race { background: var(--ink); color: var(--slate); }
.standings { display: grid; gap: 2px; margin-top: 0.1rem; }
.srow { display: grid; grid-template-columns: 1.1rem 0.55rem minmax(0, 1fr) auto; align-items: center; gap: 0.4rem; padding: 0.1rem 0.3rem; border-radius: 3px; font-family: var(--f-display); font-weight: 600; font-size: 0.95rem; }
.srow.me { background: rgba(0,173,238,0.28); }
.seg.tight { gap: 3px; } .seg.tight label { padding: 0.28rem 0.42rem; min-width: 1.15rem; text-align: center; }
.srow.gapr { padding: 0 0.3rem; line-height: 0.6; } .srow.gapr .p { font-size: 0.8rem; }
.srow .p { font-weight: 800; color: var(--mute); text-align: center; }
.srow.me .p { color: var(--ink); }
.srow i { width: 0.55rem; height: 0.55rem; border-radius: 2px; }
.srow .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow .g { font-variant-numeric: tabular-nums; color: var(--mute); font-size: 0.88rem; }
body.racing .secs, body.racing .pair { display: none; }
.delta.pos { font-size: 2.6rem; background: var(--ink); color: var(--slate); border-color: transparent; min-width: 5rem; }
.lights { position: absolute; top: 24%; left: 50%; transform: translateX(-50%); display: flex; gap: 0.7rem; padding: 0.7rem 0.9rem; border-radius: 10px; background: rgba(6,7,22,0.88); border: 1px solid var(--line); }
.lights i { width: 2.6rem; height: 2.6rem; border-radius: 50%; background: #2a1514; box-shadow: inset 0 0 0 3px #110908; }
.lights i.on { background: #ff3326; box-shadow: 0 0 18px rgba(255,51,38,0.85), inset 0 0 0 3px #7a130d; }
.lights.go i { background: #2fd36b; box-shadow: 0 0 18px rgba(47,211,107,0.85), inset 0 0 0 3px #0c5a2a; }
.restable { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.restable th { font-family: var(--f-display); font-weight: 600; font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); text-align: right; padding: 0.25rem 0.35rem; }
.restable th:nth-child(-n+2), .restable td:nth-child(-n+2) { text-align: left; }
.restable td { font-family: var(--f-display); font-weight: 600; font-size: 1.05rem; text-align: right; padding: 0.35rem; border-top: 1px solid var(--line); white-space: nowrap; }
.restable td:first-child { font-weight: 800; width: 2rem; }
.restable tr.me td { background: rgba(0,173,238,0.2); }
.restable .dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 2px; margin-right: 0.45rem; vertical-align: 0.05rem; }
.resbig { margin: 0; font-family: var(--f-display); font-weight: 800;  font-size: clamp(3rem, 10vw, 4.6rem); line-height: 0.85; text-transform: uppercase; }
.resbig small { display: block; font-size: 1.1rem; font-style: normal; font-weight: 600; letter-spacing: 0.1em; color: var(--mute); margin-top: 0.5rem; }
@media (max-width: 640px) {
  .lights i { width: 1.9rem; height: 1.9rem; } .lights { gap: 0.45rem; padding: 0.5rem 0.6rem; }
  .delta.pos { font-size: 1.7rem; min-width: 3.4rem; }
  .srow { font-size: 0.8rem; grid-template-columns: 0.9rem 0.45rem minmax(0, 1fr) auto; gap: 0.3rem; }
  .srow .g { font-size: 0.75rem; }
  body.racing .deltalbl { display: none; }
  .restable td { font-size: 0.92rem; padding: 0.3rem 0.2rem; }
  .restable th { padding: 0.2rem; font-size: 0.68rem; }
  .restable .dot { margin-right: 0.3rem; }
  .resbig small { font-size: 0.85rem; letter-spacing: 0.06em; line-height: 1.3; }
}

/* ---------- RD Motorsport branding ---------- */
/* M stripe across the top of the timing tower and the menu cards */
.tower, .card { position: relative; }
.tower::before, .card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px;
  background: linear-gradient(90deg, var(--m-blue) 0 33.34%, var(--navy) 33.34% 66.67%, var(--m-red) 66.67% 100%); }
.tower { padding-top: calc(0.6rem + 4px); }
.card { padding-top: calc(1.25rem + 4px); }
.revs i { background: linear-gradient(90deg, var(--m-blue), var(--navy) 65%, var(--m-red)); }
.revs i.hot { background: var(--m-red); }
/* square-edged panels, like the main site */
.tower, .delta, .iconbtn, #mini, .speedo, .banner, .toast, .telem, .card, .racebox, .lights, .seg label:not(.swatch),
.namebox input, .minis div, .medals li, .brow, .sec, .chip { border-radius: 0; }
/* headline type: expanded and heavy, as on the site */
h1, .pause-title, .resbig { font-family: var(--f-wide); font-stretch: 118%; }
h1 { font-size: clamp(2.5rem, 7.4vw, 4.1rem); line-height: 0.9; letter-spacing: -0.015em; }
.resbig small { font-family: var(--f-display); font-stretch: normal; }
.eyebrow, .primary, .ghostbtn, .brandlinks a { font-family: var(--f-wide); font-stretch: 112%; }
.eyebrow { letter-spacing: 0.12em; }
/* facts as a plain spaced row: no separator dots to strand at the start of a wrapped line */
.facts { font-size: 0.97rem; gap: 0.2rem 1rem; }
.facts span + span::before { content: none; }
.laptime, .delta, .banner .bt, .pbbig .t, .speedo .mph { letter-spacing: -0.02em; }
/* RDM's slanted buttons */
.primary, .ghostbtn { position: relative; isolation: isolate; border: 0; background: none; border-radius: 0; text-decoration: none; display: inline-block; }
.primary { color: var(--saltire-ink); font-size: 1.2rem; letter-spacing: 0.02em; padding: 0.7rem 2rem; }
.primary::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--saltire); transform: skewX(-14deg); transition: filter 0.15s; }
.primary:hover { filter: none; }
.primary:hover::before { filter: brightness(1.1); }
.primary.race { background: none; color: var(--slate); }
.primary.race::before { background: var(--ink); }
.primary.small { font-size: 1rem; padding: 0.55rem 1.35rem; }
.ghostbtn { color: var(--ink); padding: 0.55rem 1.1rem; }
.ghostbtn::before { content: ""; position: absolute; inset: 0; z-index: -1; box-shadow: inset 0 0 0 2px rgba(243,244,250,0.5); transform: skewX(-14deg); }
.ghostbtn:hover { background: none; }
.ghostbtn:hover::before { background: rgba(255,255,255,0.08); }
.btnrow { gap: 0.75rem 1.1rem; padding-left: 0.3rem; }
/* brand bar on the menu */
.brandbar { flex: 1 1 100%; max-width: 58.25rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem 1.25rem; }
.brand { display: block; }
.brand img { display: block; height: 1.7rem; width: auto; }
.brandlinks { display: flex; align-items: center; gap: 1.2rem; }
.brandlinks a { font-weight: 700; font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); text-decoration: none; }
.brandlinks a:hover { color: var(--saltire); }
.brandlinks a.cta { position: relative; isolation: isolate; color: var(--saltire-ink); padding: 0.45rem 1.05rem; }
.brandlinks a.cta::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--saltire); transform: skewX(-14deg); }
.brandlinks a.cta:hover { color: var(--saltire-ink); }
.rdm-blurb { margin: -0.3rem 0 0; font-size: 0.95rem; line-height: 1.5; color: var(--mute); }
.rdm-blurb b { color: var(--ink); font-weight: 600; }
.rdm-cta { display: grid; gap: 0.65rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.rdm-cta h2 { color: var(--ink); }
.rdm-cta .btnrow { align-items: center; }
/* car 85 swatch: navy with a gold stripe */
.swatch-rdm { background: linear-gradient(135deg, #161a4d 0 42%, #e3a53a 42% 58%, #161a4d 58% 100%); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35); }
/* leaderboard name box */
.namebox { margin-top: -0.35rem; }
.namebox .ghostbtn { font-size: 0.9rem; padding: 0.45rem 1rem; }
#boardNameNote { margin-top: -0.45rem; }
#boardNameNote a { color: var(--saltire); }
@media (max-width: 640px) {
  .facts { gap: 0.15rem 0.85rem; }
  .brand img { height: 1.35rem; }
  .brandlinks { gap: 0.9rem; }
  .brandlinks a { font-size: 0.75rem; }
  .primary { font-size: 1.05rem; padding: 0.6rem 1.5rem; }
}

/* ---------- speedo with touch controls ---------- */
/* touch screens with room between the steering bar and the pedals (phones on their side, tablets): the speedo sits on
   the bottom edge in that gap, like a dash display, instead of floating up over the road */
@media (min-width: 600px) { body.touch .speedo { bottom: 0; } }
/* a phone on its side is short: a slimmer speedo, so it covers less of the car in the chase cams */
@media (min-width: 600px) and (max-height: 500px) {
  body.touch .speedo { padding: 0.15rem 0.7rem 0.3rem; }
  body.touch .speedo .mph { font-size: 2rem; min-width: 2.7rem; }
  body.touch .speedo .gear { font-size: 1.3rem; }
}
/* the telemetry strip only fits beside it, clear of the pedals, on a big screen */
@media (max-width: 1099px) { body.touch .telem { display: none; } }

/* a real lap on the board (Rob's): nothing to race, so a red label where the Ghost button goes */
.brow.real { background: rgba(236,28,36,0.16); }
.brow .realtag { font-family: var(--f-display); font-weight: 700; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; color: #fff; background: var(--m-red); padding: 0.2rem 0.4rem; }
