/* Gran Pearlismo — in-race layer (FESTIVAL PRO, same system as ui.css).
   Broadcast-clean: white italic numerals with a soft shadow, no boxes around data, Pearl Pink only for "you"
   (your row, your boost, the selected item). Data lives in the corners; the centre belongs to the road. */

#app { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }

/* ---------- screen effects ---------- */
#tags, .fx { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#tags { z-index: 2; }
.kemo { position: absolute; left: 0; top: 0; padding: 7px 13px; background: var(--white); color: var(--ink, #111); font: 800 italic 15px/1 var(--disp); border-radius: 14px 14px 14px 3px; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); white-space: nowrap; transform-origin: 50% 100%; animation: kemoIn .25s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes kemoIn { from { opacity: 0; margin-top: 10px; } }
.tag { position: absolute; left: 0; top: 0; font: 700 condensed 12px/1 var(--disp); text-transform: uppercase; color: var(--white); background: rgba(8, 9, 12, .72); padding: 4px 8px 3px; white-space: nowrap; will-change: transform; }
.fx { z-index: 3; }
#fx-pee { opacity: 0; transition: opacity .5s; background: radial-gradient(ellipse at center, rgba(255, 210, 63, 0) 35%, rgba(255, 200, 30, .55) 100%); }
#fx-pee.show { opacity: 1; transition: opacity .08s; }
/* driving through fart gas: real smoke puffs (img/fx/gas_*, tools/build-screen-fx.py) roll in round the edges of the
   view and drift, with only a faint haze at the rim; the road ahead stays clear */
#fx-stink { opacity: 0; transition: opacity .7s; overflow: hidden; background: radial-gradient(ellipse at 50% 50%, rgba(150, 140, 60, 0) 45%, rgba(130, 120, 50, .28) 100%); }
#fx-stink.show { opacity: 1; transition: opacity .12s; }
#fx-stink .gas { position: absolute; width: 52vmax; height: 52vmax; margin: -26vmax 0 0 -26vmax; opacity: .78; animation: gasDrift 2.6s ease-in-out infinite alternate; }
#fx-stink.show .gas { animation-play-state: running; }
@keyframes gasDrift { from { transform: translate(var(--dx, 0), 0) rotate(0deg) scale(.92); } to { transform: translate(0, var(--dy, 0)) rotate(var(--r, 25deg)) scale(1.08); } }
#fx-gold { opacity: 0; transition: opacity .3s; box-shadow: inset 0 0 90px 20px rgba(255, 198, 26, .6); }
#fx-gold.show { opacity: 1; animation: goldPulse .5s ease-in-out infinite alternate; }
@keyframes goldPulse { from { box-shadow: inset 0 0 70px 14px rgba(255, 198, 26, .45); } to { box-shadow: inset 0 0 120px 30px rgba(255, 230, 120, .7); } }
#fx-speed { opacity: 0; transition: opacity .25s; background: repeating-conic-gradient(from 0deg at 50% 55%, rgba(255, 255, 255, 0) 0deg 3.2deg, rgba(255, 255, 255, .24) 3.2deg 3.5deg); -webkit-mask-image: radial-gradient(ellipse at 50% 55%, transparent 38%, #000 80%); mask-image: radial-gradient(ellipse at 50% 55%, transparent 38%, #000 80%); }
#fx-speed.show { opacity: 1; animation: speedSpin .16s linear infinite; }
@keyframes speedSpin { from { transform: rotate(0deg) scale(1.15); } to { transform: rotate(2deg) scale(1.18); } }
/* Poopy Pants on your screen: mud splats (img/fx/splat_*) slap on, then slide down slowly as they fade. No CSS filter:
   a drop-shadow on eight large animated images is costly to composite over the 3D on high-DPI screens */
.splat { position: absolute; opacity: 0; transform: rotate(var(--r, 0deg)) scale(1.35); transition: opacity .08s, transform .12s cubic-bezier(.2, .9, .3, 1.2); will-change: transform, opacity; }
.splat.show { opacity: .94; transform: rotate(var(--r, 0deg)) scale(1); }
.splat.slide { transform: translateY(var(--slide, 40px)) rotate(var(--r, 0deg)) scale(1); transition: transform 3s ease-in; }
.blob { position: absolute; border-radius: 47% 53% 42% 58% / 55% 45% 55% 45%; background: radial-gradient(circle at 38% 36%, #d4f08a 0 12%, #9ccc4a 30%, #6f9e26 62%, #557d18 100%); opacity: 0; transform: scale(.6); transition: opacity 1.2s ease-in, transform .2s; }
.blob::after { content: ''; position: absolute; left: 30%; top: 70%; width: 22%; height: 60%; border-radius: 0 0 50% 50%; background: inherit; }
.blob.brown { background: radial-gradient(circle at 38% 36%, #a87442 0 10%, #7a4a22 34%, #5a3416 68%, #3e2410 100%); }
.blob.show { opacity: .82; transform: scale(1); transition: opacity .1s, transform .15s; }
#fx-flash { opacity: 0; transition: opacity .9s; background: radial-gradient(ellipse at center, rgba(255, 255, 255, .9) 0%, rgba(200, 220, 255, .75) 100%); }
#fx-flash.show { opacity: 1; transition: opacity .05s; }
body::before, body::after { content: ''; position: fixed; left: 0; right: 0; height: 0; background: #000; z-index: 5; transition: height .7s var(--x); pointer-events: none; }
body::before { top: 0; } body::after { bottom: 0; }
body.intro::before, body.intro::after { height: 9vh; }

/* ---------- start sequence: event title card ---------- */
#intro { position: fixed; z-index: 6; left: 0; right: 0; bottom: calc(9vh / var(--z)); padding: 90px calc(6vw / var(--z)) 32px; pointer-events: none; display: grid; justify-items: start; gap: 10px; background: linear-gradient(0deg, rgba(8, 9, 12, .7), rgba(8, 9, 12, 0)); }
#intro .eyebrow { margin: 0; animation: wipeIn .5s .3s var(--x) both; }
#intro-haz { display: block; order: -1; margin: 0; font: 700 condensed 15px/1 var(--disp); text-transform: uppercase; color: var(--white); background: var(--pink); padding: 7px 12px; transform: none; animation: wipeIn .5s var(--x) both; }
#intro-haz:empty { display: none; }
#intro-name { margin: 0; font: 800 condensed clamp(40px, calc(6.4vw / var(--z)), 108px)/.86 var(--disp); text-transform: uppercase; letter-spacing: 0; color: var(--white); text-shadow: 0 2px 3px rgba(0, 0, 0, .5), 0 8px 40px rgba(0, 0, 0, .45); animation: letterIn .7s .1s var(--x) both; }
#intro-blurb { margin: 4px 0 0; max-width: 560px; font: 500 16px/1.5 var(--body); color: var(--w2); text-shadow: 0 2px 10px rgba(0, 0, 0, .7); animation: fadeIn .6s .45s both; }
#intro-driver { position: fixed; right: calc(6vw / var(--z)); bottom: calc(calc(9vh / var(--z)) + 36px); font: 800 condensed clamp(26px, calc(3.4vw / var(--z)), 54px)/.88 var(--disp); text-transform: uppercase; letter-spacing: 0; color: var(--white); text-align: right; opacity: 0; transform: translateX(80px); transition: opacity .3s, transform .5s var(--x); text-shadow: 0 6px 30px rgba(0, 0, 0, .5); }
#intro-driver::before { content: 'Your driver'; display: block; width: max-content; margin: 0 0 10px auto; font: 700 condensed 14px/1 var(--disp); color: var(--white); background: var(--pink); padding: 6px 10px; transform: none; }
#intro-stats { margin: 0; font: 700 condensed 15px/1 var(--disp); text-transform: uppercase; letter-spacing: .04em; color: var(--white); opacity: 0; transform: translateX(-30px); transition: opacity .3s, transform .45s var(--x); text-shadow: 0 2px 10px rgba(0, 0, 0, .7); }
#intro > * { transition: opacity .3s, transform .45s var(--x); }
#intro[data-shot="2"] #intro-stats, #intro[data-shot="3"] #intro-stats { opacity: 1; transform: none; }
#intro[data-shot="2"] #intro-blurb, #intro[data-shot="3"] #intro-blurb { animation: cineOut .3s forwards; }
#intro[data-shot="4"] #intro-driver { opacity: 1; transform: none; }
#intro[data-shot="4"] > :not(#intro-driver):not(.skip) { animation: cineOut .3s var(--x-in) forwards; }
/* the dip to black between two intro shots (opacity set every frame from the intro clock) */
#dip { position: fixed; inset: 0; z-index: 5; background: #000; opacity: 0; pointer-events: none; }
#intro .skip { position: fixed; right: 24px; top: calc(calc(9vh / var(--z)) + 18px); margin: 0; font: 600 13px/1 var(--body); color: var(--w2); background: rgba(8, 9, 12, .62); padding: 7px 10px; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
body.intro #hud > *:not(#banner):not(#lights) { opacity: 0; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 4; pointer-events: none; color: var(--white); font-family: var(--disp); --edge: clamp(16px, calc(2.2vw / var(--z)), 34px); --sh: 0 2px 0 rgba(0, 0, 0, .35), 0 4px 22px rgba(0, 0, 0, .45); }
#hud > * { transition: opacity .4s; }
#hud::before { content: ''; position: absolute; left: 0; top: 0; width: calc(40vw / var(--z)); height: calc(60vh / var(--z)); background: radial-gradient(ellipse at 0 0, rgba(8, 9, 12, .5), rgba(8, 9, 12, 0) 65%); pointer-events: none; }
#hud::after { content: ''; position: absolute; right: 0; bottom: 0; width: calc(40vw / var(--z)); height: calc(40vh / var(--z)); background: radial-gradient(ellipse at 100% 100%, rgba(8, 9, 12, .5), rgba(8, 9, 12, 0) 65%); pointer-events: none; }
.hud-left { position: absolute; left: calc(env(safe-area-inset-left, 0px) + var(--edge)); top: calc(env(safe-area-inset-top, 0px) + var(--edge)); display: grid; justify-items: start; gap: 0; z-index: 1; }
#hud-cup { margin-bottom: 8px; font: 700 condensed 13px/1 var(--disp); text-transform: uppercase; color: var(--w2); }
#hud-cup:empty { display: none; }
#hud-pos { display: flex; align-items: flex-start; font: italic 800 condensed 84px/.8 var(--disp); letter-spacing: 0; text-shadow: var(--sh); }
#hud-pos sup { font-size: 34px; line-height: 1; margin: 4px 0 0 4px; color: var(--pink); letter-spacing: 0; }
#hud-pos.up { animation: posUp .5s var(--x); } #hud-pos.down { animation: posDown .5s var(--x); }
@keyframes posUp { 0% { transform: translateY(18px); color: var(--gain); } 100% { transform: none; } }
@keyframes posDown { 0% { transform: translateY(-18px); color: var(--loss); } 100% { transform: none; } }
#hud-lap { margin-top: 14px; font: 800 condensed 17px/1 var(--disp); text-transform: uppercase; text-shadow: var(--sh); }
#hud-time { margin-top: 6px; font: 700 condensed 20px/1 var(--disp); color: var(--w2); font-variant-numeric: tabular-nums; text-shadow: var(--sh); }
#hud-ghost { margin-top: 4px; font: 700 condensed 16px/1 var(--disp); color: var(--cyan); font-variant-numeric: tabular-nums; }
#hud-ghost small { font: 700 condensed 12px/1 var(--disp); text-transform: uppercase; margin-right: 6px; color: var(--w3); }
body.tt #hud-pos, body.tt #standings { display: none; }
#standings { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 2px; min-width: 210px; }
#standings li { display: grid; grid-template-columns: 26px 20px 1fr; align-items: center; gap: 8px; height: 25px; padding: 0 10px 0 0; background: rgba(8, 9, 12, .8);   /* name tags pass under the list: keep it readable */ font: 700 condensed 10.5px/1 var(--disp); text-transform: uppercase; }
#standings li b { align-self: stretch; display: grid; place-items: center; font: 800 condensed 14px/1 var(--disp); background: rgba(255, 255, 255, .1); }
#standings li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#standings li.me { background: var(--pink); }
/* final-lap intervals to the kart ahead and behind */
#hud-gap { display: grid; gap: 2px; margin-top: 8px; min-width: 210px; }
#hud-gap[hidden] { display: none; }
#hud-gap p { margin: 0; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; height: 24px; padding-right: 10px; background: rgba(8, 9, 12, .7); font: 700 condensed 11px/1 var(--disp); text-transform: uppercase; animation: fadeIn .2s; }
#hud-gap b { align-self: stretch; display: grid; place-items: center; font-style: italic; background: rgba(255, 255, 255, .1); }
#hud-gap span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hud-gap em { font: 700 13px/1 var(--body); font-style: normal; font-variant-numeric: tabular-nums; }
#hud-gap .ah em { color: #ffd23f; } #hud-gap .bh em { color: #7cf29a; }
#hud-gap p.close { box-shadow: inset 3px 0 0 var(--pink); animation: gapPulse .6s ease-in-out infinite alternate; }
@keyframes gapPulse { from { background: rgba(8, 9, 12, .7); } to { background: rgba(255, 31, 109, .42); } }
.vh-short #standings li:nth-child(n+9):not(.me) { display: none; } .vh-short #standings li { height: 22px; }   /* a short layout (app.js fitZoom) */
#standings li.me b { background: rgba(0, 0, 0, .18); }
#standings li .av, .av { width: 20px; height: 20px; display: block; border-radius: 2px; background-size: cover; background-position: center 20%; border: 0 !important; box-shadow: inset 0 -2px 0 var(--pc, transparent); }
.hud-right { position: absolute; right: calc(env(safe-area-inset-right, 0px) + var(--edge)); top: calc(env(safe-area-inset-top, 0px) + var(--edge)); display: grid; justify-items: end; gap: 8px; z-index: 1; }
.itembox { position: relative; width: 124px; height: 124px; display: grid; place-items: center; transform: none;
  background: radial-gradient(circle at 50% 56%, rgba(255, 255, 255, .2), rgba(255, 255, 255, 0) 60%), linear-gradient(160deg, rgba(34, 36, 46, .82), rgba(6, 7, 10, .86));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .28), 6px 6px 0 rgba(0, 0, 0, .35); }
.itembox::before { content: ''; position: absolute; inset: 9px; border: 2px dashed rgba(255, 255, 255, .16); pointer-events: none; }
.itembox .ico { width: 96px; height: 96px; transform: none; }
.itembox .ico.shot { width: 112px; height: 112px; object-fit: contain; }
.itembox b { position: absolute; right: -10px; bottom: -10px; background: var(--pink); color: var(--white); font: 800 condensed 20px/1 var(--disp); padding: 5px 8px; box-shadow: 3px 3px 0 rgba(0, 0, 0, .35); }
/* the roulette: the icons blur past with a shake, a light sweeps across the glass */
.itembox.rolling { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .7), 6px 6px 0 rgba(0, 0, 0, .35); }
.itembox.rolling::before { border: 0; inset: 0; background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .22) 48%, transparent 66%); background-size: 260% 100%; animation: itemSweep .45s linear infinite; }
.itembox.rolling .ico { filter: blur(1.4px) brightness(1.1); animation: itemRoll .07s steps(2) infinite; }
@keyframes itemSweep { from { background-position: 130% 0; } to { background-position: -130% 0; } }
@keyframes itemRoll { 0% { translate: 0 -5px; } 100% { translate: 0 5px; } }
/* it lands: a punch in, a white flash, then the slot holds it with a white rim and the pink block behind */
.itembox.ready { box-shadow: inset 0 0 0 3px var(--white), 6px 6px 0 var(--pink); animation: itemReady .42s var(--x); }
.itembox.ready::before { border: 0; }
@keyframes itemReady { 0% { transform: scale(1.32); filter: brightness(2.4); } 55% { transform: scale(.94); filter: brightness(1.2); } 100% { transform: none; filter: none; } }
/* Feastables: the window left, under the icon */
.itembox.feast::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 9px; height: 7px; background: linear-gradient(90deg, var(--white) calc(var(--f, 1) * 100%), rgba(255, 255, 255, .18) 0); }
.flyicon { position: fixed; left: 0; top: 0; width: 60px; height: 60px; z-index: 7; pointer-events: none; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .45)); }
.flyicon .ico { width: 100%; height: 100%; display: block; }
#hud-item-name { margin-top: 4px; font: 800 condensed 14px/1 var(--disp); text-transform: uppercase; color: var(--white); text-shadow: var(--sh); padding-right: 2px; }
/* what the item does: a tip under the held item, a card when it is used, bars for effects still running, HIT! */
#hud-item-tip { max-width: 260px; margin-top: 2px; padding: 5px 9px; background: rgba(8, 9, 12, .62); font: 600 13px/1.25 var(--body); color: rgba(255, 255, 255, .92); text-align: right; text-wrap: balance; }
#hud-item-tip:empty, #hud-fx:empty { display: none; }
#hud-fx { display: grid; gap: 6px; justify-items: end; margin-top: 4px; }
.fxchip { position: relative; display: flex; align-items: center; gap: 8px; padding: 5px 12px 9px 6px; background: rgba(8, 9, 12, .78); transform: none; overflow: hidden; }
.fxchip > * { transform: none; }
.fxchip .ic { width: 30px; height: 30px; flex: none; } .fxchip .ico { width: 100%; height: 100%; display: block; }
.fxchip b { font: 800 condensed 13px/1 var(--disp); text-transform: uppercase; color: var(--white); }
.fxchip em { font: 600 12px/1 var(--body); font-style: normal; color: rgba(255, 255, 255, .78); }
.fxchip i { position: absolute; left: 0; bottom: 0; height: 4px; width: calc(var(--f, 1) * 100%); background: var(--pink); transform: none; transition: width .1s linear; }
#item-call { box-sizing: border-box; display: flex; align-items: center; gap: 12px; width: 400px; margin-top: 6px; padding: 10px 18px 10px 10px; background: var(--pink); color: var(--white); box-shadow: 5px 5px 0 rgba(0, 0, 0, .35); transform: none; opacity: 0; pointer-events: none; }
#item-call:empty { display: none; }
#item-call > * { transform: none; }
#item-call .ic { width: 54px; height: 54px; flex: none; } #item-call .ico { width: 100%; height: 100%; display: block; }
#item-call div { display: grid; gap: 5px; min-width: 0; text-align: left; }
#item-call b { font: italic 800 condensed 21px/1 var(--disp); text-transform: uppercase; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#item-call small { font: 600 14px/1.25 var(--body); text-wrap: balance; }
#item-call.show { animation: callIn 3.4s var(--x) forwards; }
@keyframes callIn { 0% { opacity: 0; transform: translateX(46px); } 7% { opacity: 1; transform: translateX(0); } 86% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-10px); } }
#hitconf { position: absolute; left: 50%; top: 22%; display: grid; justify-items: center; gap: 8px; opacity: 0; pointer-events: none; transform: translateX(-50%); z-index: 2; }
#hitconf b { font: italic 800 condensed clamp(46px, calc(5.6vw / var(--z)), 80px)/.9 var(--disp); letter-spacing: 0; color: var(--white); background: var(--pink); padding: 8px 22px 2px; transform: none; box-shadow: 6px 6px 0 rgba(0, 0, 0, .35); }
#hitconf small { font: 700 condensed 14px/1 var(--disp); text-transform: uppercase; color: var(--white); background: rgba(8, 9, 12, .78); padding: 7px 14px 6px; }
#hitconf.show { animation: hitIn 1.9s var(--x) forwards; }
@keyframes hitIn { 0% { opacity: 0; transform: translateX(-50%) scale(1.9); } 9% { opacity: 1; transform: translateX(-50%) scale(1); } 82% { opacity: 1; transform: translateX(-50%); } 100% { opacity: 0; transform: translateX(-50%) translateY(-12px); } }
@media (max-width: 1240px) { #hitconf { top: 37%; } }  /* narrow: below the use card on the right, not across it */
@media (max-width: 760px) { #hud-item-tip { max-width: 170px; font-size: 11px; } #item-call { width: 260px; } #item-call .ic { width: 40px; height: 40px; } #item-call b { font-size: 16px; } #item-call small { font-size: 12px; } .fxchip b { font-size: 11px; } .fxchip em { display: none; } }
/* first-person bodycam (game.js bodycamHud): a blinking REC mark, the time and the camera number under the item slot */
#bodycam { margin-top: 10px; display: grid; justify-items: end; gap: 4px; font: 700 13px/1.1 ui-monospace, 'Cascadia Mono', Consolas, monospace; letter-spacing: .05em; color: #fff; text-shadow: 0 0 1px #000, 0 0 2px #000, 0 1px 2px #000, 0 0 10px rgba(0, 0, 0, .5); font-variant-numeric: tabular-nums; }
#bodycam[hidden] { display: none; }
#bodycam .bc-rec { display: flex; align-items: center; gap: 6px; font-size: 14px; }
#bodycam .bc-rec i { width: 9px; height: 9px; border-radius: 50%; background: #ff2b2b; box-shadow: 0 0 6px rgba(255, 43, 43, .75); animation: bcBlink 1s steps(1) infinite; }
#bodycam .bc-id { color: rgba(255, 255, 255, .82); font-size: 12px; }
@keyframes bcBlink { 50% { opacity: .3; } }
body.touch-mode #bodycam { display: none; }
#nug-hud { position: absolute; left: calc(env(safe-area-inset-left, 0px) + var(--edge)); bottom: calc(env(safe-area-inset-bottom, 0px) + var(--edge) + 178px); display: flex; align-items: center; gap: 6px; font: 800 condensed 22px/1 var(--disp); text-shadow: var(--sh); z-index: 1; }
#nug-hud svg { width: 24px; height: 24px; }
#nug-hud.max { color: var(--gold); }
#nug-hud.pop { animation: itemReady .35s var(--x); }
body.tt #nug-hud { display: none; }
#minimap { position: absolute; left: calc(env(safe-area-inset-left, 0px) + var(--edge)); bottom: calc(env(safe-area-inset-bottom, 0px) + var(--edge)); width: 200px; height: 164px; z-index: 1; }
/* speed: big italic numerals, the unit, and a slanted segmented bar for the drift charge */
#speedo { position: absolute; right: calc(env(safe-area-inset-right, 0px) + var(--edge)); bottom: calc(env(safe-area-inset-bottom, 0px) + var(--edge)); display: grid; justify-items: end; z-index: 1; --charge: 0; --tier: #a3a8b5; }
#speedo b { font: italic 800 condensed 78px/.8 var(--disp); letter-spacing: 0; font-variant-numeric: tabular-nums; text-shadow: var(--sh); transition: color .15s; }
#speedo span { margin-top: 6px; font: 800 condensed 15px/1 var(--disp); color: var(--w2); text-shadow: var(--sh); }
#speedo i { display: block; width: 220px; height: 10px; margin-top: 10px; position: relative; transform: none; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .22) 0 calc(10% - 3px), transparent calc(10% - 3px) 10%); }
#speedo i::before { content: ''; position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--charge)); background: var(--tier); transition: transform .08s linear, background .15s; -webkit-mask: repeating-linear-gradient(90deg, #000 0 calc(10% - 3px), transparent calc(10% - 3px) 10%); mask: repeating-linear-gradient(90deg, #000 0 calc(10% - 3px), transparent calc(10% - 3px) 10%); }
#speedo.boost b { color: var(--pink); }
#speedo.boost i::before { transform: scaleX(1); background: var(--pink); animation: boostBar .2s linear infinite; }
@keyframes boostBar { 50% { opacity: .6; } }
#lapbar { position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + var(--edge) + 6px); width: min(calc(32vw / var(--z)), 400px); height: 5px; transform: translateX(-50%); background: rgba(255, 255, 255, .22); }
#lapbar::before { content: ''; position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--p, 0)); background: var(--white); }
#lapbar::after { content: ''; position: absolute; inset: -4px 0; background: repeating-linear-gradient(90deg, transparent 0 calc(25% - 2px), rgba(8, 9, 12, .9) calc(25% - 2px) 25%); }
/* incoming item: what is chasing you, from which side, how far */
#hud-warn { position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + var(--edge) + 118px); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 8px; background: rgba(8, 9, 12, .62); box-shadow: inset 0 0 0 2px var(--loss); }
#hud-warn[hidden] { display: none; }
#hud-warn .ico { width: 40px; height: 40px; display: block; transform: none; }
#hud-warn-arr { width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 14px solid var(--loss); }
#hud-warn-d { font: 800 condensed 18px/1 var(--disp); color: var(--white); transform: none; min-width: 70px; }
#hud-warn.lock { background: var(--loss); animation: blink .3s steps(2) infinite; }
#hud-warn.lock #hud-warn-arr { border-bottom-color: var(--white); }
#feed { position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + var(--edge) + 26px); transform: translateX(-50%); display: grid; justify-items: center; gap: 4px; width: min(calc(90vw / var(--z)), 560px); }
.feed-line { font: 700 condensed 13px/1 var(--disp); text-transform: uppercase; padding: 8px 14px 7px; background: rgba(8, 9, 12, .72); animation: feedIn .4s var(--x); transition: opacity .4s, transform .4s; }
.feed-line.you { background: var(--pink); }
.feed-line.out { opacity: 0; transform: translateY(-10px); }
@keyframes feedIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
/* the big call: countdown, GO, final lap, finish */
#banner { position: absolute; left: 0; right: 0; top: 32%; text-align: center; font: italic 800 condensed clamp(110px, calc(15vw / var(--z)), 220px)/.84 var(--disp); letter-spacing: 0; text-transform: uppercase; color: var(--white); opacity: 0; text-shadow: 0 10px 50px rgba(0, 0, 0, .45); }
#banner.show { animation: bannerIn .65s var(--x) forwards; }
#banner.small { font-size: clamp(60px, calc(8.4vw / var(--z)), 130px); }
#banner[data-kind="go"] { color: var(--pink); }
#banner[data-kind="count"].show { animation: countIn .65s var(--x) forwards; }
@keyframes bannerIn { 0% { opacity: 0; transform: translateX(-120px); } 40% { opacity: 1; transform: none; } 100% { opacity: 1; } }
@keyframes countIn { 0% { opacity: 0; transform: scale(1.6); } 30% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateX(60px); } }
#lights { position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + var(--edge) + 18px);   /* up by the lap bar: at 12% it hid the gantry itself */ transform: translateX(-50%); display: flex; gap: 12px; padding: 12px 16px; background: rgba(8, 9, 12, .85); animation: fadeIn .2s; }
#lights i { width: 28px; height: 28px; border-radius: 50%; background: #2c1214; transition: background .06s, box-shadow .06s; }
#lights[data-n="1"] i:nth-child(-n+1), #lights[data-n="2"] i:nth-child(-n+2), #lights[data-n="3"] i:nth-child(-n+3), #lights[data-n="4"] i:nth-child(-n+4), #lights[data-n="5"] i { background: radial-gradient(circle at 40% 35%, #ff8a70 0 12%, #ff2a1a 45%, #c40d00 100%); box-shadow: 0 0 22px rgba(255, 42, 26, .95), 0 0 46px rgba(255, 42, 26, .45); }
/* lights out: every lamp dark at once, the housing edge flashes */
#lights[data-n="go"] { box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); transition: box-shadow .5s; }
#lights[data-n="go"] i { background: #1a0b0c; box-shadow: none; }
#lapflash { position: absolute; left: 50%; top: 21%; transform: translateX(-50%); padding: 12px 22px 10px; font: 800 condensed 28px/1 var(--disp); white-space: pre; text-transform: uppercase; background: rgba(8, 9, 12, .82); opacity: 0; transition: opacity .3s; font-variant-numeric: tabular-nums; }
#lapflash.show { opacity: 1; animation: feedIn .4s var(--x); }
#lapflash .ahead { color: var(--gain); } #lapflash .behind { color: var(--loss); }
#wrongway { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); padding: 14px 28px 12px; font: 800 condensed 32px/1 var(--disp); text-transform: uppercase; background: var(--loss); animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .4; } }
#drift-hint { position: absolute; left: 50%; bottom: 17%; transform: translateX(-50%); font: italic 800 condensed 28px/1 var(--disp); text-transform: uppercase; opacity: 0; transition: opacity .15s; text-shadow: var(--sh); }
#coach { position: absolute; left: 50%; top: 21%; transform: translate(-50%, -12px); max-width: min(calc(92vw / var(--z)), 620px); padding: 12px 18px; background: rgba(8, 9, 12, .78); border-left: 4px solid var(--pink); color: var(--white); font: 600 16px/1.4 var(--body); text-align: left; opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; }
#coach.show { opacity: 1; transform: translate(-50%, 0); }
#coach kbd { display: inline-block; min-width: 1.6em; padding: 1px 6px; margin: 0 1px; border-radius: 3px; background: rgba(255, 255, 255, .16); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .35); font: 700 13px/1.5 var(--body); text-align: center; }
body.cine #coach { display: none; }
/* the driving lesson (js/race/tutorial.js): a slim bar at the top with the step pips and Skip, and one card under
   it. Below the item slot's height on the right, clear of the road ahead; buttons only take the pointer */
#tut { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); width: min(calc(94vw / var(--z)), 560px); z-index: 5; pointer-events: none; transition: opacity .25s, top .4s var(--x); }
#tut.low { top: calc(env(safe-area-inset-top, 0px) + clamp(16px, calc(2.2vw / var(--z)), 34px) + 84px); }   /* (#hud's --edge is not set out here) */   /* under the start lights during the countdown */
#tut.hide { opacity: 0; }
#tut .tut-bar { display: flex; align-items: center; gap: 12px; padding: 7px 8px 7px 14px; background: rgb(10, 11, 14); border-left: 4px solid var(--pink); border-radius: 0 6px 0 0; }
#tut .tut-kick { padding: 0; font: 800 condensed 11px/1 var(--disp); letter-spacing: .26em; text-transform: uppercase; color: var(--pink-2); }
#tut .tut-pips { display: flex; gap: 5px; flex: 1; }
#tut .tut-pips i { width: 22px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .42); transition: background .3s; }
#tut .tut-pips i.on { background: var(--white); }
#tut .tut-pips i.done { background: var(--gain); }
#tut .tut-pips i.soft { background: #ffb547; }
#tut .tut-skip { pointer-events: auto; padding: 7px 14px; border-radius: 999px; background: rgba(8, 9, 12, .7); border: 1px solid rgba(255, 255, 255, .35); font: 800 condensed 11px/1 var(--disp); letter-spacing: .14em; text-transform: uppercase; color: var(--white); }
#tut .tut-skip:hover, #tut .tut-skip:focus-visible { background: var(--white); color: var(--ink); }
#tut .tut-card { padding: 12px 18px 14px; background: rgb(10, 11, 14); border-top: 1px solid rgba(255, 255, 255, .08); border-left: 4px solid var(--pink); border-radius: 0 0 6px 0; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
#tut .tut-card.in { animation: tutIn .38s var(--x) both; }
#tut .tut-card.ok { border-left-color: var(--gain); }
#tut .tut-card.soft { border-left-color: #ffb547; }
#tut .tut-card.soft .tut-title { color: #ffb547; }
#tut .tut-card.soft .tut-prog i { background: #ffb547; }
#tut .tut-n { font: 700 condensed 10px/1 var(--disp); letter-spacing: .22em; text-transform: uppercase; color: var(--w3); margin-bottom: 6px; }
#tut .tut-title { display: flex; align-items: center; gap: 9px; font: 800 italic condensed 22px/1.05 var(--disp); text-transform: uppercase; letter-spacing: 0; }
#tut .tut-card.ok .tut-title { color: var(--gain); animation: tutPop .4s var(--x); }
#tut .tut-check { width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--gain) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='%230b0c10' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat; }
#tut .tut-text { margin-top: 7px; font: 600 15px/1.45 var(--body); color: var(--w2); }
#tut .tut-text b { color: var(--white); }
#tut .tut-text b.o { color: #ff9f1c; }
#tut kbd { display: inline-block; min-width: 1.7em; padding: 1px 6px; margin: 0 1px; border-radius: 3px; background: rgba(255, 255, 255, .16); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .35); font: 700 13px/1.5 var(--body); color: var(--white); text-align: center; }
#tut .tut-prog { margin-top: 10px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .14); overflow: hidden; }
#tut .tut-prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--gain)); transition: width .3s var(--x); }
#tut .tut-hint { margin-top: 8px; font: 500 13px/1.4 var(--body); color: var(--w3); }
#tut .tut-hint:empty { display: none; }
#tut .tut-card.end { padding: 18px 22px 18px; border-left-color: var(--gain); pointer-events: auto; }
#tut .tut-card.end .tut-title { font-size: 28px; }
#tut .tut-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
#tut .tut-chip { padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, .1); font: 700 12px/1 var(--body); color: var(--w2); }
#tut .tut-chip.yes { background: rgba(46, 224, 126, .18); color: var(--gain); }
#tut .tut-chip.part { background: rgba(255, 181, 71, .16); color: #ffb547; }
#tut .tut-actions { display: flex; gap: 10px; margin-top: 14px; }
@keyframes tutIn { from { opacity: 0; transform: translateY(-8px); } }
@keyframes tutPop { 0% { transform: scale(.92); } 60% { transform: scale(1.04); } }
body.tut #hud-pos, body.tut #hud-lap, body.tut #hud-time, body.tut #hud-gap, body.tut #standings, body.tut #lapbar, body.tut #hud-cup { display: none; }
body.paused #tut { display: none; }
/* the race feed (Rocket start!, hits) drops below the lesson card instead of hiding behind it */
body.tut #feed { top: calc(var(--tut-b, 200px) + 16px); }   /* --tut-b: the card's bottom edge, kept by tutorial.js */
@media (max-width: 700px) { #tut { top: 8px; } #tut .tut-title { font-size: 18px; } #tut .tut-text { font-size: 14px; } #tut .tut-pips i { width: 14px; } }
#drift-hint.blue, #drift-hint.orange, #drift-hint.purple, #drift-hint.trick { opacity: 1; }
#drift-hint.blue { color: var(--cyan); } #drift-hint.orange { color: #ff8a1a; } #drift-hint.purple { color: #c47bff; } #drift-hint.trick { color: var(--white); }
#pause-btn { position: absolute; right: 22px; bottom: 210px; display: none; pointer-events: auto; }
body.touch-mode #pause-btn { display: inline-flex; top: calc(env(safe-area-inset-top, 0px) + 130px); bottom: auto; }
/* the camera chip: the key that switches the view, a camera icon and the view now on. Centred above the speedo and
   made of the dial's smoked glass, so it reads as part of the instrument (it was a menu's outlined ghost button in
   capitals, which the owner found cheap). While it nudges, the key pulses pink. Top right on touch, without a key. */
#cam-btn { position: absolute; right: calc(env(safe-area-inset-right, 0px) + var(--edge) + 110px); translate: 50% 0; bottom: calc(env(safe-area-inset-bottom, 0px) + var(--edge) + 230px); height: 30px; gap: 7px; padding: 0 13px 0 5px; pointer-events: auto; z-index: 1; border-radius: 15px; font: 600 12.5px/1 var(--body); text-transform: none; letter-spacing: 0; color: rgba(255, 255, 255, .88); background: radial-gradient(circle at 50% 0, rgba(46, 50, 60, .5), rgba(8, 9, 12, .72)); -webkit-backdrop-filter: blur(8px) brightness(.7); backdrop-filter: blur(8px) brightness(.7); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 0 0 1px rgba(255, 255, 255, .12), 0 6px 14px rgba(0, 0, 0, .35); }
#cam-btn:hover { background: radial-gradient(circle at 50% 0, rgba(70, 75, 88, .55), rgba(14, 15, 20, .76)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 0 0 1px rgba(255, 255, 255, .3), 0 6px 14px rgba(0, 0, 0, .35); }
#cam-btn .ico { order: 2; width: 15px; height: 15px; flex: none; opacity: .7; }
#cam-btn kbd { order: 1; display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .42); font: 700 11px/1 var(--body); color: var(--white); text-transform: none; letter-spacing: 0; }
#cam-btn span { order: 3; }
#cam-btn kbd:empty { display: none; }
#cam-btn.nudge kbd { animation: camNudge 1.5s ease-in-out infinite; }
#cam-btn.pop { animation: camPop .35s var(--x); }
@keyframes camNudge { 0%, 100% { background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .42); } 50% { background: var(--pink); box-shadow: inset 0 0 0 1px var(--pink-2); } }
@keyframes camPop { 0% { transform: scale(1.14); filter: brightness(1.8); } 100% { transform: none; filter: none; } }
body.touch-mode #cam-btn { top: calc(env(safe-area-inset-top, 0px) + 176px); bottom: auto; right: 22px; translate: none; padding: 0 13px 0 11px; }
.pause-cam .label { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font: 700 condensed 13px/1 var(--disp); text-transform: uppercase; color: var(--w2); }
.pause-cam kbd { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 3px; background: rgba(255, 255, 255, .16); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .35); font: 700 12px/1 var(--body); color: var(--white); }
.pause-cam kbd:empty { display: none; }

/* ---------- pause ---------- */
#pause { position: fixed; inset: 0; z-index: 20; display: grid; align-items: center; justify-items: start; padding: 0 calc(8vw / var(--z)); background: linear-gradient(90deg, rgba(8, 9, 12, .92), rgba(8, 9, 12, .55) 60%, rgba(8, 9, 12, .3)); animation: fadeIn .2s; }
#pause .card { width: min(420px, calc(calc(100vw / var(--z)) - 32px)); display: grid; gap: 14px; animation: tileIn .45s var(--x); }
#pause .card-title { margin: 0; font: 800 condensed clamp(52px, calc(6vw / var(--z)), 88px)/.84 var(--disp); text-transform: uppercase; letter-spacing: 0; }
#pause .actions { display: grid; gap: 4px; margin-top: 16px; }
#pause .actions .btn { justify-content: flex-start; height: 54px; font-size: 18px; }
#pause .fine { margin: 0; }
#pause:not([hidden]) { grid-template-columns: minmax(0, 420px) minmax(0, 380px); justify-content: space-between; column-gap: calc(6vw / var(--z)); }
.pause-side { display: grid; gap: 14px; align-content: center; padding: 26px 28px; background: rgba(12, 13, 17, .82); border-radius: 4px; box-shadow: 0 24px 60px rgba(0, 0, 0, .45); animation: tileIn .45s .05s var(--x) both; }
.pause-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin-bottom: 8px; }
.pause-stats div { display: grid; gap: 4px; padding-bottom: 8px; border-bottom: 2px solid var(--w5); }
.pause-stats span { font: 700 condensed 12px/1 var(--disp); text-transform: uppercase; color: var(--w3); }
.pause-stats b { font: 800 condensed 26px/1 var(--disp); font-variant-numeric: tabular-nums; }
.pause-stats b small { font: 600 13px/1 var(--body); color: var(--w2); margin-left: 6px; }
.pause-set { display: grid; gap: 12px; }
.pause-set .sld { display: grid; grid-template-columns: 1fr 52px; align-items: center; gap: 4px 12px; }
.pause-set .sld .label { grid-column: 1 / -1; font: 700 condensed 13px/1 var(--disp); text-transform: uppercase; color: var(--w2); }
.pause-set .sld b { font: 700 15px/1 var(--body); text-align: right; }
.pause-set input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; }
.pause-set input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--w5); }
.pause-set input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: var(--pink); }
.pause-view { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.pause-view button { height: 40px; white-space: nowrap; font: 700 condensed 13px/1 var(--disp); text-transform: uppercase; color: var(--w2); background: var(--tile-2, #1c1e25); border-radius: 2px; }
.pause-view button[aria-pressed="true"] { background: var(--pink); color: #fff; }
/* paused: the race HUD and name tags step back so the menu reads on its own */
body.paused #hud > *, body.paused #tags { opacity: 0 !important; transition: opacity .2s; }
@media (max-width: 860px) { #pause:not([hidden]) { grid-template-columns: 1fr; } .pause-side { display: none; } }

/* ---------- touch ---------- */
#touch {
  position: fixed;
  inset: auto max(12px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  z-index: 6;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  pointer-events: none;
}
.touch-steer, .touch-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.touch-steer { width: 44%; max-width: 192px; }
.touch-actions { width: 42%; max-width: 170px; }
.tbtn { min-width: 0; height: clamp(46px, 13vw, 62px); border-radius: 16px; border: 0; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7); background: rgba(8, 9, 12, .65); font: 700 condensed 14px var(--disp); text-transform: uppercase; color: var(--white); display: grid; place-items: center; pointer-events: auto; touch-action: none; user-select: none; -webkit-touch-callout: none; padding: 0; }
.tbtn.on { background: var(--pink); box-shadow: none; }
.touch-steer .tbtn { height: clamp(62px, 19vw, 86px); font: 700 25px/1 system-ui, sans-serif; }
body.paused #touch { display: none; }
body.touch-mode #minimap, body.touch-mode #speedo, body.touch-mode #nug-hud { display: none; }
body.touch-mode #drift-hint { bottom: 30%; }

@media (max-width: 760px) {
  #standings { display: none; }
  #hud-pos { font-size: 70px; } #hud-pos sup { font-size: 24px; }
  .itembox { width: 84px; height: 84px; } .itembox .ico { width: 64px; height: 64px; } .itembox .ico.shot { width: 76px; height: 76px; } .itembox b { font-size: 16px; }
  #minimap { width: 140px; height: 118px; }
  #speedo b { font-size: 60px; } #speedo i { width: 140px; }
  #nug-hud { bottom: 150px; }
  #lapbar { display: none; }
  #intro-driver { display: none; }
  #lights i { width: 22px; height: 22px; }
}
#err { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 99; background: var(--loss); color: #fff; padding: 12px 16px; font: 600 14px var(--body); }

/* ---------- race direction: broadcast graphics (race/director.js) ---------- */
#cine { position: fixed; inset: 0; z-index: 7; pointer-events: none; display: none; color: var(--white); font-family: var(--disp); }
body.cine #cine { display: block; }
body.cine::before, body.cine::after { height: 6.5vh; }
body.cine #hud > * { opacity: 0 !important; }
body.cine #tags, body.cine #touch { display: none !important; }
.cine-fade { position: absolute; inset: 0; background: #000; opacity: 0; }
.cine-fade.go { animation: cineDip .34s ease-out; }
.cine-fade.white { background: #fff; }
.cine-fade.white.go { animation: cineFlash .38s ease-out; }
@keyframes cineDip { 0% { opacity: .9; } 100% { opacity: 0; } }
@keyframes cineFlash { 0% { opacity: .5; } 100% { opacity: 0; } }
#cine.replay::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 180px rgba(0, 0, 0, .55); }
.cine-bug { position: absolute; right: calc(3vw / var(--z)); top: calc(calc(6.5vh / var(--z)) + 18px); display: flex; align-items: center; gap: 9px; font: 800 condensed 14px/1 var(--disp); letter-spacing: .14em; text-transform: uppercase; }
.cine-bug i { width: 10px; height: 10px; border-radius: 50%; background: #ff2f4f; box-shadow: 0 0 12px #ff2f4f; animation: cineBlink 1.4s steps(2) infinite; }
.cine-bug b { background: rgba(8, 9, 12, .78); padding: 7px 11px 6px; transform: none; }
#cine.replay .cine-bug i { border-radius: 2px; background: var(--gold); box-shadow: 0 0 12px var(--gold); animation: none; }
#cine.replay .cine-bug b { background: var(--pink); }
@keyframes cineBlink { 50% { opacity: .25; } }
.cine-tower { position: absolute; left: calc(2.2vw / var(--z)); top: calc(calc(6.5vh / var(--z)) + 16px); width: 300px; padding: 9px 0 7px; background: linear-gradient(90deg, rgba(8, 9, 12, .86), rgba(8, 9, 12, .7)); border-left: 4px solid var(--pink); animation: cineTower .5s var(--x) both; }
@keyframes cineTower { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
.ct-head { padding: 0 12px 8px; font: 800 condensed 13px/1.15 var(--disp); text-transform: uppercase; }
.ct-head span { display: block; margin-top: 3px; font: 600 11px/1.3 var(--body); color: var(--w3); text-transform: none; letter-spacing: .02em; }
.ct-row { display: grid; grid-template-columns: 24px 5px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 4px 12px; font: 700 condensed 13px/1.15 var(--disp); text-transform: uppercase; }
.ct-row b { text-align: right; font-style: italic; }
.ct-row i { height: 15px; border-radius: 1px; }
.ct-row span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ct-row em { font: 600 12px/1 var(--body); font-style: normal; font-variant-numeric: tabular-nums; color: var(--w3); }
.ct-row.fin em { color: var(--white); }
.cine-tower { transition: opacity .3s, transform .4s var(--x); }
#cine.big-on .cine-tower { animation: cineOut .3s var(--x-in) forwards; }
@keyframes cineOut { to { opacity: 0; transform: translateX(-30px); } }
.ct-row.gap { margin-top: 5px; }
@media (max-height: 640px) { .ct-row { padding: 2px 12px; font-size: 12px; } .ct-head { padding-bottom: 5px; } }
.ct-row.me { background: linear-gradient(90deg, rgba(255, 31, 109, .45), rgba(255, 31, 109, 0)); }
.cine-lower { position: absolute; left: calc(6vw / var(--z)); bottom: calc(calc(6.5vh / var(--z)) + 30px); display: grid; justify-items: start; gap: 6px; opacity: 0; transform: translateX(-40px); transition: opacity .3s, transform .5s var(--x); }
.cine-lower.show { opacity: 1; transform: none; }
.cine-lower small { font: 700 condensed 13px/1 var(--disp); text-transform: uppercase; background: var(--pink); padding: 6px 11px; transform: none; }
.cine-lower small:empty, .cine-lower span:empty { display: none; }
.cine-lower strong { font: 800 condensed clamp(26px, calc(3.1vw / var(--z)), 48px)/.95 var(--disp); text-transform: uppercase; letter-spacing: 0; text-shadow: 0 4px 26px rgba(0, 0, 0, .65); }
.cine-lower span { font: 600 16px/1.3 var(--body); color: var(--w2); text-shadow: 0 2px 10px rgba(0, 0, 0, .7); font-variant-numeric: tabular-nums; }
.cine-big { position: absolute; left: 0; right: 0; top: calc(calc(6.5vh / var(--z)) + 2.5%); display: grid; justify-items: center; gap: 10px; text-align: center; opacity: 0; }
.cine-big.show { animation: cineBig 3.4s var(--x) forwards; }
.cine-big small { font: 800 condensed 17px/1 var(--disp); text-transform: uppercase; letter-spacing: .08em; background: var(--pink); padding: 8px 14px; transform: none; }
.cine-big strong { font: italic 800 condensed clamp(52px, calc(7.4vw / var(--z)), 132px)/.86 var(--disp); text-transform: uppercase; letter-spacing: 0; text-shadow: 0 10px 60px rgba(0, 0, 0, .55); }
/* the photo finish's margin keeps its unit lower case (0.025 s) */
.cine-big[data-kind="photo"] strong { text-transform: none; }
.cine-big span { font: 700 condensed 17px/1.2 var(--disp); color: var(--w2); text-shadow: 0 2px 12px rgba(0, 0, 0, .7); font-variant-numeric: tabular-nums; }
.cine-big[data-kind="win"] strong { color: #ffc61a; filter: drop-shadow(0 6px 30px rgba(0, 0, 0, .5)); }
.cine-big[data-kind="photo"] small { background: var(--gold); color: #101218; }
/* the finish: a big place figure over the name, medal-coloured on the podium, and a soft shade behind the card so the
   lettering holds over a bright sky or a wing */
.cine-big::before { content: ''; position: absolute; left: 50%; top: 50%; width: min(1100px, calc(96vw / var(--z))); height: 150%; transform: translate(-50%, -50%); background: radial-gradient(closest-side, rgba(6, 7, 10, .55), rgba(6, 7, 10, 0)); z-index: -1; pointer-events: none; }
.cine-big b { order: -1; font: italic 900 condensed clamp(70px, calc(11vw / var(--z)), 190px)/.8 var(--disp); text-transform: uppercase; letter-spacing: 0; color: #fff; text-shadow: 0 10px 50px rgba(0, 0, 0, .5); margin-bottom: -.06em; }
.cine-big b:empty { display: none; }
.cine-big[data-kind="win"] b { color: #ffc61a; filter: drop-shadow(0 8px 34px rgba(0, 0, 0, .5)); text-shadow: none; }
.cine-big[data-kind="pod2"] b { color: #e6eaf0; filter: drop-shadow(0 8px 34px rgba(0, 0, 0, .5)); text-shadow: none; }
.cine-big[data-kind="pod3"] b { color: #e39a5e; filter: drop-shadow(0 8px 34px rgba(0, 0, 0, .5)); text-shadow: none; }
.cine-big[data-kind^="pod"] small { background: #e8ecf2; color: #101218; }
.cine-big:has(b:not(:empty)) strong { font-size: clamp(36px, calc(4.6vw / var(--z)), 80px); }
.cine-big[data-kind="reel"] strong { font-size: clamp(44px, calc(6vw / var(--z)), 96px); }
@keyframes cineBig { 0% { opacity: 0; transform: scale(1.12); } 9% { opacity: 1; transform: none; } 84% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-14px); } }
/* with the results up the race keeps playing in the middle; the tower and captions give way to the results card */
body.cine:not(.in-race):not(.peek) .cine-tower, body.cine:not(.in-race):not(.peek) .cine-lower, body.cine:not(.in-race):not(.peek) .cine-big { display: none; }
body.cine .shell[data-screen="results"] .scrim { background: linear-gradient(90deg, rgba(8, 9, 12, .78) 0%, rgba(8, 9, 12, .3) 34%, rgba(8, 9, 12, 0) 48%, rgba(8, 9, 12, 0) 64%, rgba(8, 9, 12, .5) 100%), linear-gradient(0deg, rgba(8, 9, 12, .55), rgba(8, 9, 12, 0) 30%); }
@media (min-width: 1100px) {
  body.cine .shell[data-screen="results"] .results { grid-template-columns: minmax(0, 560px) minmax(0, 1fr) 400px; }
  body.cine .shell[data-screen="results"] .res-side { grid-column: 3; }
}
body.cine .shell[data-screen="results"] .res-side { background: rgba(14, 15, 20, .66); backdrop-filter: blur(10px); }
body.cine.peek #ui .shell { opacity: 0; pointer-events: none; transition: opacity .35s; }
body.cine.peek #cine::before { content: 'Click or press any key to return to the results'; position: absolute; left: 0; right: 0; bottom: calc(calc(6.5vh / var(--z)) + 8px); text-align: center; font: 700 15px/1 var(--body); color: var(--w2); text-shadow: 0 2px 8px rgba(0, 0, 0, .8); }
@media (max-width: 760px) { .cine-tower { width: 210px; } .ct-row { font-size: 11px; padding: 3px 9px; } .cine-big strong { font-size: 54px; } }
/* the browser window lost the keyboard during a race (another window was clicked): a click on the game gives it back */
#focus-hint { position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 60; padding: 14px 26px; background: rgba(10, 11, 14, .86); color: #fff; font: 800 22px/1 var(--disp, system-ui); letter-spacing: .02em; text-transform: uppercase; border-left: 6px solid #ff1f6d; cursor: pointer; pointer-events: auto; }
#focus-hint[hidden] { display: none; }
/* an empty item slot: a dim frame, no words */
.itembox.empty { opacity: .5; }
/* the finish card: the place figure in its medal colour, the name white under it, the kicker a white plate (gold
   figure, gold plate and gold name together read as one gold smear) */
.cine-big[data-kind="win"] strong { color: var(--white); }
.cine-big[data-kind="win"] small { background: var(--white); color: #101218; }
.cine-big span { font-size: 18px; color: rgba(255, 255, 255, .86); }
/* pause: a chosen camera is white like every chosen option (pink is the Resume action); labels 13 px at 62% white */
.pause-view button[aria-pressed="true"] { background: var(--white); color: var(--ink); }
.pause-stats span { font-size: 13.5px; letter-spacing: .04em; color: rgba(255, 255, 255, .62); }
/* the intro card: the place and date as a plain line over the name (two stacked colour plates were busy, pink is
   for the selection), the blurb at full contrast over a left-side shade like F1's hub, "Your driver" a white plate */
#intro::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(90deg, rgba(8, 9, 12, .8) 0%, rgba(8, 9, 12, .45) 38%, rgba(8, 9, 12, 0) 62%); -webkit-mask-image: linear-gradient(0deg, #000 55%, transparent); mask-image: linear-gradient(0deg, #000 55%, transparent); }
#intro-haz { background: none; padding: 0; font: 700 condensed 17px/1 var(--disp); letter-spacing: .03em; text-shadow: 0 2px 10px rgba(0, 0, 0, .6); }
#intro-blurb { color: rgba(255, 255, 255, .9); }
#intro-driver::before { background: var(--white); color: #101218; }
/* ---------- the HUD after the reference frame (19 Nov 2026) ----------
   F1 and GT7 put every figure that can land on sky on a dark plate; FH5 keeps a real shade under the corner block.
   Pink marks only you (your row, your feed line); timers and chosen options are white; no coloured side bars. */
#hud::before { width: calc(46vw / var(--z)); height: calc(70vh / var(--z)); background: radial-gradient(ellipse at 0 0, rgba(8, 9, 12, .62), rgba(8, 9, 12, .3) 42%, rgba(8, 9, 12, 0) 70%); }
#hud-pos sup { color: var(--white); }
#hud-cup { height: 24px; display: inline-flex; align-items: center; padding: 0 9px; background: var(--gold); color: var(--ink); font: 700 condensed 14px/1 var(--disp); letter-spacing: .03em; }
#hud-lap, #hud-time { padding: 5px 9px 4px; background: rgba(10, 11, 15, .82); text-shadow: none; }
#hud-lap { margin-top: 12px; font-size: 18px; }
#hud-time { margin-top: 2px; color: var(--white); }
#standings { min-width: 236px; margin-top: 10px; }
#standings li { height: 27px; font-size: 14px; letter-spacing: .02em; background: rgba(10, 11, 15, .93); }
#standings li b { font-size: 15px; }
#hud-item-name { justify-self: end; width: max-content; padding: 5px 8px 4px; background: rgba(10, 11, 15, .82); text-shadow: none; }
#hud-item-name:empty { display: none; }
/* the Turd Rocket's sight: who it locks on to now, or that nothing is in it */
#hud-item-name em { font-style: normal; margin-left: 6px; }
#hud-item-name em.lock { color: #ff5a4a; }
#hud-item-name em.nolock { color: rgba(255, 255, 255, .45); }
.fxchip i { background: var(--white); }
.fxchip b { font-size: 14px; }
.fxchip em { font-size: 13px; }
#coach { border-left: 0; background: rgba(10, 11, 15, .9); }
#focus-hint { border-left: 0; font-stretch: 75%; }
@keyframes camNudge { 0%, 100% { box-shadow: inset 0 0 0 2px var(--w4); } 50% { box-shadow: inset 0 0 0 2px var(--white); background: rgba(255, 255, 255, .18); } }
.pause-set input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 0; background: rgba(255, 255, 255, .22); }
.pause-set input[type=range]::-webkit-slider-thumb { width: 14px; height: 22px; margin-top: -9px; border-radius: 0; background: var(--white); }
.pause-set .sld .label { font-size: 14px; color: rgba(255, 255, 255, .62); }
/* the driving lesson: one dark plate, a gold kicker plate, upright title; done is green and "try again" amber in the
   title only (the coloured left bars went) */
#tut .tut-bar, #tut .tut-card { border-left: 0; border-radius: 0; }
#tut .tut-kick { height: 22px; display: inline-flex; align-items: center; padding: 0 8px; background: var(--gold); color: var(--ink); font: 700 condensed 14px/1 var(--disp); letter-spacing: .03em; }
#tut .tut-skip { border-radius: 0; border: 0; background: rgba(255, 255, 255, .14); font: 700 condensed 14px/1 var(--disp); letter-spacing: .03em; }
#tut .tut-n { font-size: 13px; letter-spacing: .04em; color: rgba(255, 255, 255, .62); }
#tut .tut-title { font-style: normal; font-size: 24px; }
#tut .tut-pips i, #tut .tut-prog, #tut .tut-prog i { border-radius: 0; }
#tut kbd { border-radius: 0; box-shadow: none; }
/* name tags grow with the HUD (--z), anchored at their bottom centre over the kart */
.tag { transform-origin: 50% 100%; font-size: 13px; }
#intro .skip { font-size: 14px; color: rgba(255, 255, 255, .85); text-shadow: 0 1px 3px rgba(0, 0, 0, .9), 0 0 14px rgba(0, 0, 0, .6); }
.cine-big span { text-shadow: 0 1px 3px rgba(0, 0, 0, .9), 0 0 18px rgba(0, 0, 0, .7); }
/* results over the replay: the rewards panel solid like the menus (it was frosted glass over the moving cars) */
body.cine .shell[data-screen="results"] .res-side { background: #101117; -webkit-backdrop-filter: none; backdrop-filter: none; }
/* the item slot: a white rim when it lands and a white count plate (the pink offset block was decoration) */
.itembox.ready { box-shadow: inset 0 0 0 3px var(--white), 0 8px 24px rgba(0, 0, 0, .45); }
.itembox b { background: var(--white); color: var(--ink); box-shadow: 0 4px 12px rgba(0, 0, 0, .4); }
/* the slot itself: one flat dark plate with a thin rim (no gradient, no offset block, no dashed placeholder) */
.itembox { background: rgba(10, 11, 15, .84); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .28); }
.itembox::before { display: none; }
.pause-set input[type=range]::-webkit-slider-thumb { border: 0; box-shadow: none; outline: 0; }
.pause-set input[type=range]:focus { outline: none; }
.pause-set input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--white); }
/* ---------- the HUD in FH5's grammar (19 Nov 2026, owner: "the race screen still looks AI") ----------
   FH5 hud-01: the position is a tall condensed figure in medium italic with a small label beside it, no plate; the
   time is a thin row, label left and value right; the speed is three light italic figures with the unused zeros
   dimmed, under a thin tick arc. Heavy black italics, the menu's gold plate, the lap ruler across the top and the
   item explanation are gone from the race. */
#hud-cup { height: auto; padding: 0; margin-bottom: 8px; background: none; color: rgba(255, 255, 255, .88); font: 600 15px/1 var(--disp); letter-spacing: .02em; text-shadow: var(--sh); }
#hud-pos { align-items: baseline; gap: 0; font: italic 600 92px/.78 var(--tight); letter-spacing: 0; text-shadow: 0 2px 14px rgba(0, 0, 0, .45); }
#hud-pos small { font-size: 46px; color: rgba(255, 255, 255, .78); margin-left: 3px; }
#hud-pos::after { content: 'Position'; align-self: flex-start; margin: 6px 0 0 10px; font: 600 17px/1 var(--disp); font-style: normal; text-transform: uppercase; letter-spacing: .03em; }
#hud-lap, #hud-time { display: flex; justify-content: space-between; align-items: center; gap: 22px; box-sizing: border-box; min-width: 176px; height: 25px; padding: 0 10px; background: rgba(10, 11, 15, .62); color: var(--white); font: 600 14px/1 var(--disp); text-transform: uppercase; letter-spacing: .03em; text-shadow: none; }
#hud-lap { margin-top: 14px; }
#hud-time { margin-top: 3px; }
#hud-lap span, #hud-time span { color: rgba(255, 255, 255, .7); }
#hud-lap b, #hud-time b { font: italic 600 19px/1 var(--tight); letter-spacing: .01em; font-variant-numeric: tabular-nums; }
#hud-lap b small { font-size: .8em; color: rgba(255, 255, 255, .7); }
#hud-lap.final { background: #c5342b; }
#hud-lap.final span, #hud-lap.final b small { color: var(--white); }
#standings li { font: 600 14px/1 var(--disp); letter-spacing: .02em; }
#standings li b { font: italic 600 16px/1 var(--tight); }
#lapbar, #hud-item-tip { display: none; }
#hud-item-name { font: 600 15px/1 var(--disp); letter-spacing: .02em; }
.itembox b { font: italic 600 20px/1 var(--tight); }
#hud-pos::after { margin-left: 6px; }
#hud-lap, #hud-time { background: rgba(10, 11, 15, .8); }
.itembox.empty { opacity: 1; background: rgba(10, 11, 15, .5); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .34); }
.cine-bug { letter-spacing: .04em; }
.cine-big span { padding: 5px 12px; background: rgba(10, 11, 15, .72); font-size: 20px; }
#tut .tut-kick, #tut .tut-n { letter-spacing: .03em; }
/* ---------- the speedometer dial (SVG, game.js buildGauge) ----------
   v5: an instrument, not a flat widget. Weight comes from depth and detail rather than thick fills: a smoked-glass
   face that blurs the road behind it with a soft top light and an inner shadow, a slim machined bezel, a printed
   scale in three tick weights with the passed ticks lit, a thin redline, a red needle (the owner's pick), and the speed in big
   condensed italic figures with the unused zeros dimmed. 330 px at 1080p. */
#speedo { width: 220px; height: 220px; display: block; }
#speedo::after { content: none; }
#speedo::before { content: ''; position: absolute; inset: 3px; border-radius: 50%; -webkit-backdrop-filter: blur(9px) saturate(1.1) brightness(.6); backdrop-filter: blur(9px) saturate(1.1) brightness(.6); background: radial-gradient(circle at 50% 28%, rgba(46, 50, 60, .38), rgba(12, 13, 17, .62) 60%, rgba(4, 5, 7, .84) 100%); box-shadow: 0 12px 28px rgba(0, 0, 0, .45), inset 0 1.5px 0 rgba(255, 255, 255, .14), inset 0 -16px 30px rgba(0, 0, 0, .5); transition: box-shadow .2s; }
#speedo.boost::before { box-shadow: 0 12px 28px rgba(0, 0, 0, .45), inset 0 1.5px 0 rgba(255, 255, 255, .14), inset 0 -16px 30px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .35), 0 0 26px rgba(255, 255, 255, .28); }
#speedo .gauge { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.gauge circle { fill: none; }
.gauge .g-bezel { stroke-width: 3.6; }
.gauge .g-seat { stroke: rgba(0, 0, 0, .7); stroke-width: 1; }
.gauge .g-red { stroke: #d81f36; stroke-width: 2.4; }
.gauge .g-cut { stroke: #fff; stroke-width: 16; }
.gauge .g-ticks line { stroke: rgba(255, 255, 255, .36); stroke-linecap: butt; }
.gauge .g-ticks line.mj { stroke-width: 2; }
.gauge .g-ticks line.md { stroke-width: 1.25; }
.gauge .g-ticks line.mn { stroke-width: .85; }
.gauge .g-ticks line.rd { stroke: rgba(230, 40, 62, .7); }
.gauge .g-ticks.hot { filter: drop-shadow(0 0 2px rgba(255, 255, 255, .55)); }
.gauge .g-ticks.hot line { stroke: #fff; }
.gauge .g-ticks.hot line.rd { stroke: #ff5367; }
.gauge .g-nums text { font: italic 600 12.5px var(--disp); fill: rgba(255, 255, 255, .8); text-anchor: middle; dominant-baseline: central; }
.gauge .g-nums text.rd { fill: #ff5a6c; }
.gauge .g-dseg, .gauge .g-dfill { fill: none; stroke-width: 3.4; }
.gauge .g-dseg { stroke: rgba(255, 255, 255, .13); }
.gauge .g-needle { filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, .7)); }
.gauge .g-needle path { fill: #f0263c; }
#speedo b { position: absolute; left: 0; right: 0; top: 74px; bottom: auto; transform: none; z-index: 1; text-align: center; font: italic 700 68px/1 var(--disp); font-variant-numeric: tabular-nums; letter-spacing: -.005em; color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
#speedo b em { font-style: inherit; color: rgba(255, 255, 255, .17); text-shadow: none; }
#speedo.boost b { color: #fff; }
#speedo span { position: absolute; left: 0; right: 0; top: 143px; z-index: 1; margin: 0; text-align: center; font: 600 10.5px/1 var(--body); letter-spacing: .24em; padding-left: .24em; text-transform: none; color: rgba(255, 255, 255, .55); text-shadow: none; }
#speedo i { display: none; }
