:root {
  --bg: rgba(14, 16, 20, 0.82);
  --bg2: rgba(255, 255, 255, 0.06);
  --fg: #f3f4f6;
  --muted: #9aa3ae;
  --accent: #e10600;
  --gold: #ffd400;
  --good: #31d07b;
  --bad: #ffb020;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1d2a1a; color: var(--fg); font: 14px/1.4 system-ui, -apple-system, 'Segoe UI', sans-serif; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------------- HUD ---------------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
/* top left: no box any more (like the minimap and the start lights): the text floats over the scene, kept readable
   on a bright sky and at night by a soft two-layer shadow; the lap time in the logo style (italic, heavy) */
:root { --hud-shadow: 0 1px 2px rgba(0,0,0,0.6), 0 2px 14px rgba(0,0,0,0.45); --hud-glass: rgba(14,17,22,0.38); }
/* HUD widgets (.hw): default places below; the HUD editor (hudeditor.js) can free a widget (.hw-free, inline position),
   resize it (zoom on .hw-in) or hide it (.hw-hide). Lap time / delta / sectors / ghost stack top left by default. */
#hud .hw { text-shadow: var(--hud-shadow); }
#hud .hw.hw-free { position: absolute; }
#hud .hw.hw-hide { display: none !important; }
.hud-stack { position: absolute; top: 16px; left: 18px; width: 300px; display: flex; flex-direction: column; }
#w-timer, #w-delta, #w-sectors, #w-ghost { width: 300px; }
#w-gauge { position: absolute; right: 16px; bottom: 16px; }
/* lap messages at the very top, the lap table right below them: both stay above the road and the car (the table used
   to sit at 27 % and covered the track just after the line); during the start lights the toast moves under them (below) */
#w-toast { position: absolute; top: clamp(10px, 2.2vh, 22px); left: 50%; transform: translateX(-50%); }
#w-laptable { position: absolute; top: clamp(58px, 8vh, 92px); left: 50%; transform: translateX(-50%); }
#w-lights { position: absolute; top: var(--sl-top); left: 50%; transform: translateX(-50%); }
#phase { font: 800 12px/1.2 system-ui; letter-spacing: 0.16em; color: #e9ecef; opacity: 0.85; }
#phase.timed { color: var(--gold); opacity: 1; }
#phase.done { color: var(--good); opacity: 1; }
#laptime { font: italic 900 50px/1.02 system-ui, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: 0.005em; color: #fff; margin-top: 1px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.35), 0 4px 18px rgba(0,0,0,0.5); }
#phase.out + #laptime { color: #e3e6ea; font-size: 38px; }
#lapsub { font-size: 12px; color: rgba(236,239,242,0.82); min-height: 16px; }
/* live delta under the lap time (hud.js updateDelta): big number + "vs best" + a bar from the centre line
   (green grows left = ahead, red grows right = behind; full at ±1 s) */
.delta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 2px 0 4px; }
.delta.off { display: none; }
#deltaVal { font: italic 800 30px/1.1 system-ui, sans-serif; font-variant-numeric: tabular-nums; min-width: 5.4ch;
  text-shadow: 0 1px 2px rgba(0,0,0,0.85), 0 0 12px rgba(0,0,0,0.55), 0 2px 18px rgba(0,0,0,0.4); }
.delta.ahead #deltaVal { color: #5fe39f; }
.delta.behind #deltaVal { color: #ff6b5b; }
.delta.held #deltaVal { opacity: 0.85; }
#deltaRef { font: 600 12px var(--mono); color: rgba(240,242,245,0.9); text-shadow: 0 1px 2px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.5); }
.delta-bar { position: relative; display: block; flex-basis: 100%; height: 5px; border-radius: 3px; background: rgba(10,12,16,0.4); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12); overflow: hidden; }
.delta-bar::before { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: rgba(255,255,255,0.55); z-index: 1; }
#deltaFill { position: absolute; top: 0; bottom: 0; width: 50%; transform: scaleX(0); transition: transform .12s linear; }
.delta.ahead #deltaFill { right: 50%; transform-origin: right; background: var(--sec-green); }
.delta.behind #deltaFill { left: 50%; transform-origin: left; background: #ff6b5b; }
@media (max-width: 760px) { #deltaVal { font-size: 22px; } }
/* sector tiles: flat, low-poly friendly. Colours = F1 logic (sectors.js) */
:root { --sec-purple: #a07ae6; --sec-green: #45c486; --sec-yellow: #f0c75a; --sec-ink: #15181c; }
.sectors { display: grid; grid-template-columns: repeat(3, minmax(92px, 1fr)); gap: 8px; margin-top: 10px; }
.sec { border-radius: 9px; padding: 7px 10px 8px; background: var(--hud-glass); border: 1px solid rgba(255,255,255,0.26); color: #eef0f2; backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.12); transition: background-color 0.2s, border-color 0.2s, color 0.2s; }
.sec i { display: block; font: 700 12px/1.2 system-ui; font-style: normal; letter-spacing: 0.08em; opacity: 0.7; }
.sec b { display: block; font: 700 21px/1.2 var(--mono); margin-top: 2px; letter-spacing: -0.02em; }
.sec.run { border-color: rgba(255,255,255,0.55); }
.sec.purple, .sec.green, .sec.yellow { color: var(--sec-ink); border-color: rgba(255,255,255,0.35); text-shadow: none; }
.sec.purple { background: var(--sec-purple); }
.sec.green { background: var(--sec-green); }
.sec.yellow { background: var(--sec-yellow); }
/* a sector with track limits: no colour, crossed-out time, a small "cut" tag (Peter, 2026-11-25) */
.sec.cut { border-color: rgba(255, 90, 80, 0.75); background: repeating-linear-gradient(135deg, rgba(255,70,60,0.22) 0 6px, rgba(255,70,60,0.08) 6px 12px), var(--hud-glass); }
.sec.cut b { text-decoration: line-through; text-decoration-color: rgba(255, 120, 110, 0.9); text-decoration-thickness: 2px; opacity: 0.8; }
.sec.cut i { white-space: nowrap; }
.sec.cut i::after { content: " · cut"; color: #ff8a82; letter-spacing: 0.02em; text-transform: none; font-weight: 700; }
.sec.pop { animation: sec-pop 0.25s ease-out; }
@keyframes sec-pop { from { transform: scale(1.08); } to { transform: scale(1); } }
.sectors.off { display: none; }
/* ghost badge under the tiles: ghost lap time + live gap (green ahead / red behind) */
.ghostbar { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; padding: 5px 10px; border-radius: 8px; background: var(--hud-glass); backdrop-filter: blur(6px); border: 1px dashed rgba(255,255,255,0.28); color: #eef0f2; }
.ghostbar.off { display: none; }
.ghostbar i { font: 700 12px/1.2 system-ui; font-style: normal; letter-spacing: 0.08em; opacity: 0.7; }
.ghostbar b { font: 700 15px/1.2 var(--mono); letter-spacing: -0.02em; }
#ghostgap { margin-left: auto; font-size: 19px; }
#ghostgap.ahead { color: var(--sec-green); }
#ghostgap.behind { color: #ff6b5b; }
/* lap table (hold Tab, and for a few seconds after every lap): laps of this run left (newest first, the running
   one on top, ★ = best, struck through = penalty), BEST / IDEAL / time left or lap x / 3 cards right */
/* Same light glass as the sector tiles / ghost bar / delta: see-through, blurred, thin bright rim, text with the HUD
   shadow (readable over sky and asphalt). Delta colours: faster #5fe39f, slower #ff6b5b, best = gold. */
:root { --lt-soft: rgba(236, 239, 242, 0.72); --lt-line: rgba(255, 255, 255, 0.10); --lt-fast: #5fe39f; --lt-slow: #ff6b5b; }
#laptable { position: relative; transform: translateY(-6px); background: var(--hud-glass); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.26); border-radius: 10px; padding: 9px 12px 8px; color: #eef0f2;
  box-shadow: 0 6px 18px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.12);
  opacity: 0; transition: opacity 0.18s, transform 0.18s; min-width: 560px; }
#laptable.show { opacity: 1; transform: none; }
.lt-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; font: 800 11px/1.2 system-ui; letter-spacing: 0.14em; text-transform: uppercase; color: var(--lt-soft); margin-bottom: 5px; }
.lt-head .lt-mode { color: var(--gold); }
.lt-body { display: flex; gap: 12px; align-items: flex-start; }
.lt-list { flex: 1; min-width: 0; }
#laptable table { width: 100%; border-collapse: collapse; font: 600 14px var(--mono); font-variant-numeric: tabular-nums; }
#laptable th { font: 600 11px var(--mono); color: var(--lt-soft); text-align: right; padding: 0 0 3px 12px; border-bottom: 1px solid var(--lt-line); }
#laptable th:first-child { text-align: left; padding-left: 0; }
#laptable td { text-align: right; padding: 3px 0 3px 12px; color: #eef0f2; white-space: nowrap; }
#laptable tr + tr td { border-top: 1px solid var(--lt-line); }
#laptable td.lbl { text-align: left; padding-left: 0; font: 600 12px var(--mono); color: var(--lt-soft); }
#laptable td.lbl b { margin-left: 3px; color: var(--gold); font-size: 11px; }
#laptable td.lap { font-weight: 800; }
#laptable td.gap { font: 700 12px var(--mono); min-width: 54px; color: var(--lt-soft); }
#laptable td.gap.ahead { color: var(--lt-fast); }
#laptable td.gap.behind { color: var(--lt-slow); }
#laptable td.sb { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; } /* best sector of the run (makes up the ideal lap) */
#laptable tr.best td { background: rgba(255, 212, 0, 0.10); }
#laptable tr.best td:first-child { border-radius: 6px 0 0 6px; }
#laptable tr.best td:last-child { border-radius: 0 6px 6px 0; }
#laptable tr.best td.lap, #laptable tr.best td.gap { color: var(--gold); }
/* invalid laps step back (greyed, thin strike) so the eye goes to the best one */
#laptable tr.bad td:not(.lbl):not(.gap) { text-decoration: line-through; text-decoration-color: rgba(236, 239, 242, 0.45); color: rgba(236, 239, 242, 0.5); }
#laptable tr.bad td.gap { color: rgba(255, 107, 91, 0.75); font-weight: 600; }
#laptable tr.run td { color: rgba(238, 240, 242, 0.85); }
#laptable tr.run td.lbl b { color: #fff; }
#laptable tr.run td.gap { font-style: italic; }
#laptable em { font-style: normal; font-size: 11px; color: rgba(255, 138, 122, 0.8); margin-left: 4px; text-decoration: none; display: inline-block; }
#laptable .purple { color: var(--sec-purple); }
#laptable .green { color: var(--sec-green); }
#laptable .yellow { color: var(--sec-yellow); }
#laptable .cut { color: rgba(255, 138, 122, 0.85); text-decoration: line-through; }
#laptable .none { color: var(--lt-soft); }
#laptable tr.bad td.purple, #laptable tr.bad td.green, #laptable tr.bad td.yellow { color: rgba(236, 239, 242, 0.5); }
.lt-more { margin-top: 4px; font: 600 11px var(--mono); color: var(--lt-soft); }
#laptable td.lt-empty { text-align: left; padding: 8px 0; color: var(--lt-soft); font: 600 12px system-ui; }
.lt-side { display: flex; flex-direction: column; gap: 6px; width: 124px; flex: none; }
.lt-card { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14); border-radius: 8px; padding: 6px 9px 7px; }
.lt-card i { display: block; font: 800 10px/1.2 system-ui; font-style: normal; letter-spacing: 0.14em; text-transform: uppercase; color: var(--lt-soft); }
.lt-card b { display: block; font: italic 800 22px/1.15 system-ui, sans-serif; font-variant-numeric: tabular-nums; color: #fff; }
.lt-card span { display: block; font: 600 11px var(--mono); color: var(--lt-soft); }
.lt-card.best { background: rgba(255, 212, 0, 0.10); border-color: rgba(255, 212, 0, 0.30); }
.lt-card.best b { color: var(--gold); }
/* mini box (own widget, in the top-left stack by default): last lap + gap to the session best, best lap — same glass */
.lapmini { margin-top: 8px; display: flex; gap: 14px; padding: 5px 10px; border-radius: 8px; background: var(--hud-glass); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.26); font: 700 15px/1.2 var(--mono); color: #eef0f2; font-variant-numeric: tabular-nums; }
.lapmini.off { display: none; }
.lapmini > div { display: flex; align-items: baseline; gap: 6px; }
.lapmini i { font: 800 10px system-ui; font-style: normal; letter-spacing: 0.14em; color: var(--lt-soft); }
.lapmini b.bad { color: rgba(236, 239, 242, 0.55); text-decoration: line-through; }
#lmGap { font-size: 12px; }
#lmGap.ahead { color: var(--lt-fast); }
#lmGap.behind { color: var(--lt-slow); }
#lmGap.top, #lmBest { color: var(--gold); }
#penalty { color: #ff7b6b; font: 700 12px var(--mono); min-height: 0; }
.hud-tr { position: absolute; top: 16px; right: 16px; background: transparent; padding: 4px; } /* minimap floats over the scene */
.hud-tr canvas { display: block; }


.gauge { background: var(--bg); border-radius: 12px; padding: 8px 14px 10px; width: 270px; }
.shiftlights { display: flex; gap: 5px; justify-content: center; margin-bottom: 5px; }
.sl { width: 12px; height: 12px; border-radius: 50%; background: #2a2d33; display: block; }
.sl.on:nth-child(-n+2) { background: #2bd96b; box-shadow: 0 0 8px #2bd96b; }
.sl.on:nth-child(n+3):nth-child(-n+4) { background: #ffcc00; box-shadow: 0 0 8px #ffcc00; }
.sl.on:nth-child(n+5) { background: #ff2d2d; box-shadow: 0 0 8px #ff2d2d; }
#rpmbar { height: 6px; background: #2a2d33; border-radius: 3px; overflow: hidden; }
#rpmfill { height: 100%; width: 100%; background: linear-gradient(90deg, #4fc3f7, #fff 70%, #ff3b30); transform-origin: left; transform: scaleX(0); }
#rpmfill.limit { background: #ff3b30; }
.gauge-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.spd { text-align: center; }
#speed { font: 800 44px/1 var(--mono); letter-spacing: -0.03em; }
.unit { font-size: 11px; color: var(--muted); letter-spacing: 0.1em; }
.gr { text-align: center; min-width: 54px; }
#gear { font: 800 38px/1 var(--mono); color: var(--gold); }
#assistflags { display: flex; gap: 4px; justify-content: center; font: 700 9px var(--mono); margin-top: 3px; }
#assistflags span { padding: 1px 4px; border-radius: 3px; background: #2a2d33; color: #8a9099; }
#assistflags span.on { background: var(--gold); color: #111; }
#assistflags span.off { text-decoration: line-through; opacity: 0.5; }
.pedals { display: flex; gap: 5px; height: 48px; }
.pedal { width: 9px; background: #2a2d33; border-radius: 3px; overflow: hidden; display: flex; align-items: flex-end; }
.pedal div { width: 100%; height: 100%; transform-origin: bottom; transform: scaleY(0); }
#thr { background: #2bd96b; }
#brk { background: #ff3b30; }

#toast { position: relative; transform: translateY(-10px); background: var(--bg); padding: 10px 18px; border-radius: 8px; font-weight: 700; letter-spacing: 0.04em; opacity: 0; transition: opacity 0.2s, transform 0.2s; white-space: nowrap; }
#toast.show { opacity: 1; transform: none; }
#toast.warn { background: rgba(190, 30, 20, 0.9); }
#toast.go { background: rgba(255, 212, 0, 0.95); color: #111; }

/* ---------------- overlays ---------------- */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 20px; overflow: auto; }
.overlay.dim { background: rgba(0, 0, 0, 0.55); }
#loading { background: #1d2a1a; font-weight: 700; letter-spacing: 0.1em; color: var(--muted); }
#modal { z-index: 10; }
.menu-wrap { display: flex; gap: 16px; align-items: stretch; flex-wrap: wrap; justify-content: center; max-width: 960px; }
.card { background: rgba(14, 16, 20, 0.9); border: 1px solid rgba(255,255,255,0.08); border-radius: 14px; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.45); backdrop-filter: blur(6px); }
.card.main { width: 460px; max-width: 100%; }
.card.board { width: 360px; max-width: 100%; display: flex; flex-direction: column; }
.small-card { width: 380px; max-width: 100%; display: flex; flex-direction: column; gap: 10px; }
.brand { font: 900 34px/1 system-ui; letter-spacing: 0.06em; font-style: italic; }
.brand span { color: var(--accent); margin-left: 4px; }
.brand.small { font-size: 22px; margin-bottom: 4px; }
.daynum { color: var(--muted); margin: 6px 0 16px; font-size: 13px; }
.offline { color: var(--bad); }
.challenge { display: flex; gap: 14px; align-items: center; background: var(--bg2); padding: 12px; border-radius: 10px; margin-bottom: 14px; }
.thumb { width: 96px; height: 96px; flex: none; }
.track-name { font-weight: 800; font-size: 16px; }
.car-name { font-weight: 700; margin-top: 8px; }
.car-lock { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,0.08); color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
/* car picker: ‹ name + blurb › with one dot per car (free roam / random track menus, pause menu) */
.car-pick { display: flex; align-items: center; gap: 8px; background: var(--bg2); border-radius: 10px; padding: 8px; margin: 0 0 12px; }
.car-pick .cp-arrow { flex: none; width: 36px; height: 52px; padding: 0; font-size: 24px; line-height: 1; }
.car-pick .cp-body { flex: 1; min-width: 0; text-align: center; }
.car-pick .car-name { margin-top: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.car-pick .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-dots { display: flex; justify-content: center; gap: 7px; margin-top: 7px; }
.cp-dots .cp-dot { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: none; background: rgba(255,255,255,0.25); }
.cp-dots .cp-dot:hover { background: rgba(255,255,255,0.5); }
.cp-dots .cp-dot.on { background: var(--accent); }
.physics-row .car-pick { margin: 6px 0 0; background: rgba(0,0,0,0.2); }
.meta { color: var(--muted); font-size: 12px; }
.rules { margin: 0 0 14px; padding-left: 20px; color: #d4d8dd; }
.rules li { margin: 3px 0; }
label.name { display: block; color: var(--muted); font-size: 12px; margin-bottom: 12px; }
label.name input { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font-size: 15px; border-radius: 8px; border: 1px solid #39404a; background: #111418; color: var(--fg); }
button { font: 700 14px system-ui; padding: 11px 16px; border-radius: 8px; border: 1px solid #3a414b; background: #232830; color: var(--fg); cursor: pointer; }
button:hover { background: #2c323b; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #ff1a10; }
#btnDaily { width: 100%; font-size: 16px; padding: 14px; letter-spacing: 0.04em; }
button.link { background: none; border: none; color: var(--muted); padding: 4px 0; text-decoration: underline; font-weight: 500; }
.menu-foot { display: flex; gap: 14px; align-items: center; margin-top: 14px; font-size: 12px; color: var(--muted); }
#countdown { margin-left: auto; font-family: var(--mono); }
.row-btns { display: flex; gap: 8px; }
.row-btns button { flex: 1; }
.result-mini { background: var(--bg2); border-radius: 10px; padding: 14px; text-align: center; margin-bottom: 12px; }
.result-mini .label { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.result-mini .big { font: 800 44px/1.1 var(--mono); color: var(--gold); }
.result-mini.dnf .big { color: #ff6b5b; }
.result-mini .secs { font: 12px var(--mono); color: #cfd3d8; margin-top: 2px; }
#menuRank, #resultRank { margin-top: 8px; font-size: 15px; }
.board-title { font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.lb { flex: 1; overflow: auto; max-height: 60vh; }
.lb table { width: 100%; border-collapse: collapse; font-size: 13px; }
.lb td { padding: 5px 4px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.lb td.r { width: 28px; color: var(--muted); font-family: var(--mono); }
.lb td.t, .lb td.g { font-family: var(--mono); text-align: right; white-space: nowrap; }
.lb td.g { color: var(--muted); font-size: 12px; }
/* ▶ watch that lap (Peter, 2026-11-26) */
.lb td.w { width: 30px; text-align: right; padding-right: 0; }
.lb-watch { width: 24px; height: 24px; padding: 0; margin: 0; border-radius: 6px; font-size: 10px; line-height: 1; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14); color: var(--fg); }
.lb-watch:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.lb tr:first-child td.t { color: var(--gold); }
.lb tr.you td { background: rgba(225, 6, 0, 0.18); }
.lb tr.sep td { text-align: center; color: var(--muted); border: none; }
.badge { font-size: 10px; background: #343a44; color: #cfd3d8; padding: 1px 5px; border-radius: 4px; margin-left: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12px; margin-top: 8px; }
.attrib { position: fixed; bottom: 6px; left: 0; right: 0; text-align: center; font-size: 10px; color: rgba(255,255,255,0.45); pointer-events: none; }
.opt { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.opt select { margin-left: auto; background: #111418; color: var(--fg); border: 1px solid #39404a; border-radius: 6px; padding: 5px; }
.opt .muted { font-size: 12px; }
.keys { width: 100%; border-collapse: collapse; font-size: 13px; }
.keys td { padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.keys td:last-child { text-align: right; }
kbd { display: inline-block; min-width: 22px; padding: 1px 6px; margin: 0 1px; border-radius: 4px; background: #2a2f37; border: 1px solid #444b55; font: 12px var(--mono); text-align: center; }
code { font-family: var(--mono); background: #2a2f37; padding: 1px 4px; border-radius: 3px; }

@media (max-width: 760px) {
  .gauge { width: 220px; } /* (the minimap is hidden on small screens by the HUD layout default, see hudeditor.js) */
}

.practice-btn { width: 100%; margin-top: 8px; background: transparent; }
.practice-btn span { color: var(--muted); font-weight: 500; font-size: 12px; }

/* ---------------- dev panel ---------------- */
#devpanel { position: fixed; top: 16px; right: 220px; width: 320px; max-height: calc(100vh - 32px); overflow: auto; background: rgba(12,14,18,0.92); border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 10px; font-size: 12px; z-index: 5; }
#devpanel canvas { display: block; margin: 6px auto 0; }
.dp-head { display: flex; gap: 8px; align-items: baseline; }
.dp-head2 { margin: 10px 0 4px; font-weight: 700; }
.dp-muted { color: var(--muted); font-weight: 400; font-size: 11px; }
.dp-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 8px; font: 11px var(--mono); margin-top: 4px; }
.dp-nums i { color: var(--muted); font-style: normal; margin-right: 4px; }
.dp-sliders label { display: grid; grid-template-columns: 118px 1fr 44px; align-items: center; gap: 6px; padding: 1px 0; }
.dp-sliders span { color: #cfd3d8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-sliders input { width: 100%; accent-color: var(--accent); }
.dp-sliders output { font: 11px var(--mono); text-align: right; color: var(--muted); }
.dp-sliders output.changed { color: var(--gold); }
.dp-btns { display: flex; gap: 6px; margin-top: 8px; }
.dp-btns button { flex: 1; padding: 6px; font-size: 12px; }
.dp-btns button.on { background: var(--accent); color: #fff; border-color: var(--accent); } /* dev panel → CAR → physics */

.dp-close { margin-left: auto; padding: 0 9px; font-size: 18px; line-height: 24px; background: #2a2f37; border-radius: 6px; }
.dp-tune { margin-top: 10px; }
.dp-tune summary { cursor: pointer; font-weight: 700; padding: 4px 0; }

.bias-row { background: var(--bg2); border-radius: 8px; padding: 8px 10px; }
.bias-head { display: flex; justify-content: space-between; font-weight: 700; font-size: 13px; }
.bias-head output { font-family: var(--mono); color: var(--gold); }
.bias-row input[type=range] { width: 100%; accent-color: var(--accent); margin: 6px 0 2px; }
.bias-scale { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }
/* pause menu: physics model switch */
.physics-row { background: var(--bg2); border-radius: 8px; padding: 8px 10px; }
.seg { display: flex; gap: 6px; margin-top: 6px; }
.seg button { flex: 1; margin: 0; padding: 8px 0; font-weight: 700; }
.seg button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.seg button:disabled { opacity: 0.45; cursor: not-allowed; }

/* daily menu: flying lap / out lap choice */
.start-mode { margin: 0 0 12px; }
.start-mode button { padding: 9px 0 8px; line-height: 1.25; }
.start-mode button span { display: block; font-weight: 500; font-size: 11px; opacity: 0.75; }
/* flying start: big 3-2-1-GO in the middle of the screen */
#startcount { display: none; } /* old big 3-2-1 number: replaced by the start lights, kept as a hidden text holder */

/* generated-track menu */
.card.gen { max-width: 420px; }
.gen .beta { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; background: #ffd600; color: #111; border-radius: 3px; padding: 1px 5px; margin-left: 4px; }
.gen-seed { display: flex; gap: 6px; align-items: center; margin: 10px 0 8px; }
.gen-seed label { display: flex; gap: 6px; align-items: center; flex: 1; font-size: 12px; opacity: .85; }
.gen-seed input { width: 100%; min-width: 0; font: inherit; font-size: 14px; padding: 6px 8px; }
.gen-seed button { padding: 6px 10px; }
#genPreview { width: min(100%, 34vh); margin-left: auto; margin-right: auto; aspect-ratio: 1; display: block; background: rgba(255,255,255,0.04); border-radius: 8px; margin-bottom: 8px; }
.gen-stats { line-height: 1.5; margin-bottom: 8px; }
.gen .start-mode { margin: 10px 0; }

/* ================= home screen + menus (Peter) =================
   TimeGuessr-style: the 3D scene keeps running behind a dark vignette, logo on top, big image cards that lift on hover. */
:root { --ease-out: cubic-bezier(.2, .8, .2, 1); --card-r: 16px; }
#menu { padding: 0; justify-content: flex-start; background: radial-gradient(ellipse at 50% 45%, rgba(8,10,14,0.35) 0%, rgba(8,10,14,0.78) 75%); }
#menu > .menu-wrap { margin: auto; padding: 20px; }
#menu > .menu-wrap.under-bar { padding-top: 88px; }

/* top bar: logo centred, round icon buttons right */
.topbar { position: sticky; top: 0; width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 18px 22px; z-index: 2; pointer-events: none; }
.topbar > * { pointer-events: auto; }
#menu > .topbar { position: fixed; left: 0; right: 0; }
.tb-side { display: flex; gap: 10px; }
.tb-side.right { justify-content: flex-end; }
.brand.logo { font-size: 42px; text-shadow: 0 4px 24px rgba(0,0,0,0.6); }
.icon-btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; display: inline-grid; place-items: center; background: rgba(18,21,26,0.72); border: 1px solid rgba(255,255,255,0.16); color: #e9ebee; backdrop-filter: blur(6px); transition: transform .18s var(--ease-out), background-color .18s, border-color .18s; }
.icon-btn:hover { background: rgba(40,45,54,0.9); border-color: rgba(255,255,255,0.4); transform: translateY(-2px); }
.icon-btn:active { transform: translateY(0) scale(.96); }
.icon-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.home { width: 100%; min-height: 100%; display: flex; flex-direction: column; align-items: center; }
.cards { flex: 1; width: 100%; max-width: 1180px; display: grid; grid-template-columns: 1fr 1.4fr; gap: 20px; align-items: center; padding: 24px 28px; }
.home.three .cards { grid-template-columns: 1fr 1.4fr 1fr; }
.home:not(.three) .cards { max-width: 900px; }

/* image card */
.mcard { position: relative; display: block; width: 100%; height: clamp(260px, 46vh, 420px); padding: 0; overflow: hidden; border-radius: var(--card-r); border: 1px solid rgba(255,255,255,0.12); background: #15181d; color: #fff; text-align: left; font: inherit; cursor: pointer;
  box-shadow: 0 12px 34px rgba(0,0,0,0.4); transition: transform .24s var(--ease-out), box-shadow .24s var(--ease-out), filter .24s, border-color .24s; outline: none; }
.mcard.hero { height: clamp(300px, 54vh, 480px); }
.mcard:hover { background: #15181d; }
.mc-img { position: absolute; inset: 0; background: var(--img, none) center 38% / cover no-repeat, linear-gradient(135deg, #2b3342 0%, #161a20 60%, #2a1616 100%); transform: scale(1.02); transition: transform .7s var(--ease-out); }
/* hover clip over the still (main.js bindCardClips): fades in while playing, dips near its loop point */
.mc-vid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 38%; opacity: 0; transform: scale(1.02); transition: opacity .35s ease, transform .7s var(--ease-out); pointer-events: none; }
.mcard.mc-playing .mc-vid { opacity: 1; }
.mcard.mc-playing.mc-dip .mc-vid { opacity: 0.35; transition-duration: .18s; }
.mcard:not(.locked):hover .mc-vid, .mcard:focus-visible .mc-vid { transform: scale(1.06); }
.mcard::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.35) 42%, rgba(0,0,0,0) 68%); pointer-events: none; }
.mc-text { position: absolute; left: 22px; right: 22px; bottom: 20px; z-index: 1; display: flex; flex-direction: column; gap: 4px; }
.mc-text b { font: italic 900 34px/1 system-ui, sans-serif; letter-spacing: 0.01em; text-shadow: 0 2px 12px rgba(0,0,0,0.5); }
.mcard.hero .mc-text b { font-size: 46px; }
.mc-text > span { font-size: 14px; color: #dde1e6; }
.mc-top { position: absolute; top: 16px; left: 18px; right: 18px; z-index: 1; display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.mc-kicker, .mc-count { background: rgba(10,12,16,0.68); backdrop-filter: blur(4px); padding: 5px 10px; border-radius: 999px; font-weight: 700; letter-spacing: 0.04em; }
.mc-kicker { color: #fff; }
.mc-count { color: #cfd3d8; font-family: var(--mono); font-weight: 500; }
.mc-cta, .mc-pill { align-self: flex-start; margin-top: 10px; padding: 9px 16px; border-radius: 999px; font-weight: 800; font-size: 14px; }
.mc-cta { background: var(--accent); color: #fff; box-shadow: 0 6px 20px rgba(225,6,0,0.45); transition: transform .2s var(--ease-out); }
.mc-pill.done { background: rgba(10,12,16,0.75); color: var(--gold); font-family: var(--mono); }
.mc-pill.dnf { background: rgba(10,12,16,0.75); color: #ff6b5b; }

/* hover / keyboard focus: lift, brighter edge, slow zoom; the other cards step back */
.mcard:not(.locked):hover, .mcard:not(.locked):focus-visible { transform: translateY(-6px) scale(1.03); box-shadow: 0 26px 60px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.85); border-color: transparent; }
.mcard.hero:not(.locked):hover, .mcard.hero:focus-visible { box-shadow: 0 26px 60px rgba(0,0,0,0.6), 0 0 0 2px var(--accent), 0 0 40px rgba(225,6,0,0.25); }
.mcard:not(.locked):hover .mc-img, .mcard:focus-visible .mc-img { transform: scale(1.1); }
.mcard.hero:hover .mc-cta { transform: translateX(4px); }
.mcard:not(.locked):active { transform: translateY(-2px) scale(1.01); transition-duration: .08s; }
.cards:has(.mcard:not(.locked):hover) .mcard:not(:hover), .cards:has(.mcard:focus-visible) .mcard:not(:focus-visible) { filter: brightness(0.62) saturate(0.85); }
.mcard.locked, .cards:has(.mcard:hover) .mcard.locked, .cards:has(.mcard:focus-visible) .mcard.locked { cursor: not-allowed; filter: grayscale(1) brightness(0.5); }
.mc-lock { position: absolute; top: 16px; right: 16px; z-index: 1; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(10,12,16,0.7); }
.mc-lock svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 1.8; }

.home-foot { display: flex; gap: 22px; justify-content: center; padding: 0 0 34px; }
.home-foot .link { font-size: 13px; color: #c3c8cf; }
.home-foot .link:hover { color: #fff; }

/* sheet: the panel over the home screen (daily / practice) */
.sheet-wrap { position: fixed; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(4,6,9,0.6); animation: fade-in .18s ease-out; overflow: auto; }
.sheet { position: relative; width: min(480px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: rgba(16,19,24,0.97); border: 1px solid rgba(255,255,255,0.1); border-radius: 18px; padding: 24px 26px; box-shadow: 0 30px 80px rgba(0,0,0,0.6); animation: sheet-in .26s var(--ease-out); }
.sheet.wide { width: min(900px, 100%); }
.sheet-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; }
.sheet-board { background: var(--bg2); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; min-height: 240px; }
.sheet-kicker { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin: 2px 0 12px; }
.sheet-label { font-weight: 700; font-size: 13px; margin: 16px 0 6px; }
.sheet-foot { margin-top: 12px; font: 12px var(--mono); text-align: center; }
.big-btn { width: 100%; font-size: 17px; padding: 15px; border-radius: 10px; transition: transform .16s var(--ease-out), box-shadow .16s; }
.big-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(225,6,0,0.4); }
.pick-grid { display: grid; gap: 10px; margin-top: 12px; }
.pick { display: flex; align-items: center; gap: 14px; text-align: left; padding: 12px; border-radius: 12px; background: var(--bg2); border: 1px solid rgba(255,255,255,0.1); transition: transform .18s var(--ease-out), border-color .18s, background-color .18s; }
.pick:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.09); }
.pick b { display: block; font-size: 16px; margin-bottom: 2px; }
.pick .meta { display: block; }
.pick .thumb { width: 72px; height: 72px; }
.pick-dice { width: 72px; height: 72px; flex: none; display: grid; place-items: center; font-size: 44px; color: var(--gold); }
.credits { margin: 0; padding-left: 18px; color: #cfd3d8; font-size: 12px; line-height: 1.5; max-height: 50vh; overflow: auto; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* settings overlay: tabs left, content right, changes apply at once */
.settings-card { width: min(680px, 100%); padding: 20px 22px 22px; animation: sheet-in .24s var(--ease-out); }
.set-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.set-body { display: grid; grid-template-columns: 150px 1fr; gap: 18px; min-height: 300px; }
.set-tabs { display: flex; flex-direction: column; gap: 4px; }
.set-tabs button { text-align: left; background: transparent; border: none; border-radius: 8px; padding: 10px 12px; color: var(--muted); font-weight: 700; }
.set-tabs button:hover { background: rgba(255,255,255,0.06); color: var(--fg); }
.set-tabs button.on { background: rgba(225,6,0,0.16); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.set-pane { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; border-radius: 10px; background: var(--bg2); }
.set-row.col { flex-direction: column; align-items: stretch; }
.set-label { font-weight: 700; font-size: 14px; }
.set-label em { display: block; font-style: normal; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 1px; }
.set-label output { font: 12px var(--mono); color: var(--gold); margin-left: 6px; }
.set-seg { margin: 0; flex: none; }
.set-seg button { flex: none; padding: 7px 11px; font-size: 13px; }
.set-row input[type=range] { width: 100%; accent-color: var(--accent); }
.set-pane .keys { margin-top: 2px; }
/* developer switch: its own strip under the tabs, visibly not part of the game's settings */
.set-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--bg2); }
.set-foot .dev-row { background: transparent; padding: 6px 12px; }
.set-foot .set-label { font-size: 13px; color: var(--muted); }
.set-foot .set-label em { font-size: 11px; }
/* toggle switch (a styled checkbox) */
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 44px; height: 26px; border-radius: 999px; background: #3a414b; position: relative; cursor: pointer; transition: background-color .18s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.4); transition: transform .2s var(--ease-out); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }
.switch:focus-visible, .set-tabs button:focus-visible, .pick:focus-visible, .icon-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

@media (max-width: 860px) {
  .cards, .home.three .cards, .home:not(.three) .cards { grid-template-columns: 1fr; max-width: 520px; padding: 12px 16px; }
  .mcard, .mcard.hero { height: 210px; }
  .mcard.hero { order: -1; height: 250px; }
  .mcard.hero .mc-text b { font-size: 38px; }
  .brand.logo { font-size: 28px; }
  .topbar { padding: 12px 14px; grid-template-columns: auto 1fr; }
  .topbar { grid-template-columns: auto 1fr auto; gap: 10px; }
  .topbar > .tb-side:first-child:empty { display: none; }
  .topbar .back-btn { padding: 0 10px; } .topbar .back-btn span { display: none; } /* arrow only on phones */
  .brand.logo { font-size: 24px; }
  .cards, .home.three .cards, .home:not(.three) .cards { flex: none; align-content: start; }
  .mc-top { flex-direction: column; align-items: flex-start; gap: 6px; }
  .mc-kicker, .mc-count { white-space: nowrap; font-size: 11px; }
  .icon-btn { width: 40px; height: 40px; }
  .sheet-grid { grid-template-columns: 1fr; }
  .set-body { grid-template-columns: 1fr; }
  .set-tabs { flex-direction: row; overflow-x: auto; }
  .set-tabs button { white-space: nowrap; }
  .set-row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .mc-vid { display: none; } .mcard, .mc-img, .sheet, .settings-card, .icon-btn, .pick { transition: none; animation: none; } }

/* 3D car preview (carpreview.js): canvas inside a .car-stage, turntable rendered with a transparent background */
.car-stage { position: relative; height: 190px; margin: 4px 0 8px; border-radius: 12px; overflow: hidden; cursor: grab; outline: none;
  background: radial-gradient(ellipse at 50% 70%, rgba(225,6,0,0.14) 0%, rgba(255,255,255,0.03) 45%, rgba(0,0,0,0) 72%); }
.car-stage:active { cursor: grabbing; }
.car-stage:focus-visible { box-shadow: inset 0 0 0 2px rgba(255,255,255,0.7); }
.car-stage .car-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.car-stage.none { display: none; }
.car-stage.loading::after { content: ""; position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.18); border-top-color: var(--accent); animation: car-spin .8s linear infinite; }
.car-stage.loading .car-canvas { opacity: 0.35; transition: opacity .2s; }
.car-stage .car-canvas { transition: opacity .25s; }
.daily-stage { height: 150px; margin: -4px 0 12px; }
@keyframes car-spin { to { transform: rotate(360deg); } }
@media (max-width: 860px) { .car-stage { height: 160px; } .daily-stage { height: 130px; } }
.sheet.still { animation: none; }

/* ← Back / ← Home pill: same place (top left) on every screen */
.back-btn { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px 0 11px; border-radius: 999px; flex: none;
  background: rgba(18,21,26,0.72); border: 1px solid rgba(255,255,255,0.16); color: #e9ebee; font: 700 14px system-ui; backdrop-filter: blur(6px);
  transition: background-color .18s, border-color .18s; }
.back-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s var(--ease-out); }
.back-btn:hover { background: rgba(40,45,54,0.9); border-color: rgba(255,255,255,0.4); }
.back-btn:hover svg { transform: translateX(-3px); }
.back-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sheet-head, .card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.card-head .brand.small { margin-bottom: 0; }
.load-fail { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; letter-spacing: 0; color: var(--fg); padding: 0 20px; }

/* ---------------- start lights (startlights.js) ----------------
   Only the lights, no box behind them: 2 × 4 LED lamps close together, a bit below the top edge. The lamp images are pre-drawn sprites (--sl-off / --sl-red / --sl-green);
   a lamp switches by fading a sprite layer in (80 ms), so nothing is redrawn per frame. */
#hud { --sl: clamp(30px, 3.3vw, 46px); --sl-top: 9vh; }
.startlights { position: relative; transform: translateY(-6px) scale(0.97);
  background: none; border: 0; box-shadow: none; padding: 0;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .25s, transform .25s cubic-bezier(.2,.8,.2,1), visibility 0s .25s; }
.startlights.show { opacity: 1; visibility: visible; transform: none; transition: opacity .25s, transform .25s cubic-bezier(.2,.8,.2,1); }
.startlights.fade { opacity: 0; transition: opacity .45s ease-in; }
.sl-grid { display: flex; gap: calc(var(--sl) * 0.2); }
.sl-col { display: flex; flex-direction: column; gap: calc(var(--sl) * 0.2); }
.sl-lamp { position: relative; display: block; width: var(--sl); height: var(--sl); border-radius: 50%;
  background: var(--sl-off) center / 125% no-repeat; }
.sl-lamp b { position: absolute; inset: -12.5%; background: center / 100% no-repeat; opacity: 0; transition: opacity 80ms ease-out; }
.sl-lamp .sl-red { background-image: var(--sl-red); }
.sl-lamp .sl-green { background-image: var(--sl-green); }
.sl-col.on .sl-red { opacity: 1; }
.startlights.go .sl-col .sl-lamp:last-child .sl-red { opacity: 0; }
.startlights.go .sl-green { opacity: 1; }
#hud.lights-on #w-toast:not(.hw-free) { top: calc(var(--sl-top) + var(--sl) * 2.2 + 26px); }  /* the start toast moves under the lights */
@media (max-width: 1000px) { #hud { --sl: clamp(24px, 6vw, 36px); --sl-top: max(196px, 25vh); } }

/* ---------------- HUD editor (hudeditor.js) ----------------
   Dashed frame per widget (drag = move, red dot = resize, 📌 pin, 👁 hide), snap guides, toolbar bottom centre. */
#hud.hud-edit .hw.hw-hide { display: block !important; opacity: 0.28; }
#hudEdit { position: fixed; inset: 0; z-index: 90; background: rgba(6,8,12,0.22); user-select: none; }
.he-bar { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 3; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  max-width: calc(100vw - 24px); padding: 8px 10px 8px 16px; border-radius: 14px; background: rgba(16,19,24,0.94); border: 1px solid rgba(255,255,255,0.12); box-shadow: 0 16px 40px rgba(0,0,0,0.5); }
.he-title { margin-right: 6px; min-width: 0; }
.he-title b { display: block; font: italic 900 17px/1.1 system-ui; }
.he-title span { font-size: 11px; color: var(--muted); }
.he-btn-txt { padding: 8px 14px; font-size: 13px; border-radius: 9px; }
.he-frame { position: absolute; box-sizing: border-box; border: 2px dashed rgba(255,255,255,0.75); border-radius: 8px; cursor: move; touch-action: none; outline: none;
  transition: border-color .15s, background-color .15s; }
.he-frame:hover { border-color: #fff; background: rgba(255,255,255,0.06); }
.he-frame.sel { border: 2px solid var(--accent); background: rgba(225,6,0,0.08); }
.he-frame.pinned { cursor: default; border-style: solid; border-color: rgba(255,212,0,0.85); }
.he-frame.off { border-color: rgba(255,255,255,0.35); }
.he-label { position: absolute; left: calc(100% + 6px); top: -2px; display: flex; align-items: center; gap: 2px; padding: 2px 3px 2px 8px; border-radius: 6px;
  background: rgba(16,19,24,0.94); color: #fff; font: 700 11px system-ui; letter-spacing: 0.04em; white-space: nowrap; }
.he-frame.lbl-left .he-label { left: auto; right: calc(100% + 6px); }
.he-frame.sel .he-label { background: var(--accent); }
.he-btn { padding: 1px 4px; font-size: 12px; line-height: 1.25; background: transparent; border: 0; border-radius: 4px; opacity: 0.45; }
.he-btn:hover { background: rgba(255,255,255,0.16); opacity: 1; }
.he-frame.pinned [data-a=pin], .he-frame.off [data-a=hide] { opacity: 1; background: rgba(255,255,255,0.18); }
.he-size { position: absolute; right: -8px; bottom: -8px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; cursor: nwse-resize;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5); }
.he-frame.pinned .he-size { display: none; }
.he-guides i { position: absolute; background: #ff3bd4; box-shadow: 0 0 6px rgba(255,59,212,0.8); pointer-events: none; }
.he-guides i.v { top: 0; bottom: 0; width: 1px; }
.he-guides i.h { left: 0; right: 0; height: 1px; }

/* ================= daily titles (Peter, titles.js) =================
   Badge tiers — day placements: top100 steel · top10 silver · podium gold · champion red-gold + crown;
   collection levels: bronze · silver · gold · enchanted (animated holographic shine + sparkle). */
.ttl { display: inline-flex; align-items: center; gap: 5px; margin-left: 8px; padding: 2px 8px 2px 7px; border-radius: 999px; vertical-align: middle;
  font: 800 11px/1.5 system-ui, sans-serif; letter-spacing: 0.04em; white-space: nowrap; border: 1px solid transparent; text-shadow: none; }
.ttl i { font-style: normal; font-size: 0.95em; }
.ttl-sm { font-size: 10px; padding: 1px 7px 1px 6px; margin-left: 6px; }
.ttl-lg { font-size: 14px; padding: 4px 12px 4px 10px; margin-left: 0; }
.ttl-top100 { background: rgba(110, 168, 255, 0.16); border-color: rgba(110, 168, 255, 0.45); color: #cfe2ff; }
.ttl-top10, .ttl-silver { background: linear-gradient(135deg, #f4f6f8, #b9c0c8 55%, #e9edf1); border-color: rgba(255,255,255,0.7); color: #1c2128; }
.ttl-podium, .ttl-gold { background: linear-gradient(135deg, #fff1a8, #ffcc3d 45%, #e6a400 75%, #ffe27a); border-color: rgba(255, 232, 140, 0.9); color: #3a2600; }
.ttl-bronze { background: linear-gradient(135deg, #f1c39a, #c27b48 55%, #e3a774); border-color: rgba(241, 195, 154, 0.8); color: #2e1604; }
.ttl-champion { background: linear-gradient(120deg, #e10600, #ff4d2e 40%, #ffcc3d 100%); border-color: rgba(255, 214, 110, 0.95); color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35); box-shadow: 0 0 12px rgba(255, 120, 40, 0.45); }
.ttl-champion i { color: #ffe27a; }
.ttl-enchanted { position: relative; overflow: hidden; color: #1b1030; border-color: rgba(255,255,255,0.85);
  background: linear-gradient(110deg, #7fd8ff 0%, #b58cff 22%, #ff8ad8 44%, #ffe07a 66%, #7fd8ff 88%, #b58cff 100%); background-size: 300% 100%;
  animation: ttl-holo 5s linear infinite; box-shadow: 0 0 10px rgba(181, 140, 255, 0.55), 0 0 22px rgba(127, 216, 255, 0.25); }
.ttl-enchanted::after { content: ""; position: absolute; inset: -40% auto -40% -30%; width: 30%; transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.85), transparent); animation: ttl-sweep 2.8s ease-in-out infinite; }
@keyframes ttl-holo { to { background-position: 300% 0; } }
@keyframes ttl-sweep { 0% { left: -40%; } 60%, 100% { left: 130%; } }
@media (prefers-reduced-motion: reduce) { .ttl-enchanted, .ttl-enchanted::after { animation: none; } }
/* Developer (Peter, 2026-11-26): electric blue, a moving sheen + a light sweep, a blue glow — only PoggiSan + Peter */
.ttl-dev { position: relative; overflow: hidden; color: #fff; border-color: rgba(150, 210, 255, 0.95); text-shadow: 0 1px 3px rgba(0, 20, 80, 0.55);
  background: linear-gradient(110deg, #0638d9 0%, #1677ff 25%, #5cc8ff 45%, #1677ff 60%, #0638d9 80%, #1677ff 100%); background-size: 260% 100%;
  animation: ttl-holo 3.2s linear infinite, ttl-devglow 2.4s ease-in-out infinite; }
.ttl-dev i { color: #fff36b; text-shadow: 0 0 6px rgba(255, 240, 120, 0.9); }
.ttl-dev::after { content: ""; position: absolute; inset: -40% auto -40% -30%; width: 28%; transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.95), transparent); animation: ttl-sweep 2.2s ease-in-out infinite; }
@keyframes ttl-devglow { 0%, 100% { box-shadow: 0 0 8px rgba(47, 139, 255, 0.6), 0 0 18px rgba(92, 200, 255, 0.25); }
  50% { box-shadow: 0 0 14px rgba(47, 139, 255, 0.95), 0 0 30px rgba(92, 200, 255, 0.5); } }
@media (prefers-reduced-motion: reduce) { .ttl-dev, .ttl-dev::after { animation: none; } }
.ttl-xl { font-size: 30px; padding: 8px 22px 8px 18px; margin-left: 0; gap: 10px; letter-spacing: 0.05em; }

/* ---- "NEW TITLE" reveal (titlereveal.js) ---- */
.trv { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; overflow: hidden; --trv-c: #6ea8ff; animation: trvIn .35s ease-out both; }
.trv.out { animation: trvOut .38s ease-in both; }
.trv-bg { position: absolute; inset: 0; background: radial-gradient(ellipse at center, color-mix(in srgb, var(--trv-c) 22%, #05070b) 0%, rgba(5,7,11,0.96) 55%, #020305 100%); backdrop-filter: blur(6px); }
.trv-rays { position: absolute; left: 50%; top: 50%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax; opacity: 0;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--trv-c) 30%, transparent) 0deg 6deg, transparent 6deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 0%, rgba(0,0,0,0.6) 18%, transparent 42%); mask: radial-gradient(circle, #000 0%, rgba(0,0,0,0.6) 18%, transparent 42%); }
.trv.go .trv-rays { animation: trvRays 1.1s .35s ease-out forwards, trvSpin 30s linear infinite; }
.trv-stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px; text-align: center; max-width: 92vw; }
.trv-kicker { font: 900 13px system-ui, sans-serif; letter-spacing: 0.5em; text-transform: uppercase; color: var(--trv-c); opacity: 0; text-shadow: 0 0 18px var(--trv-c); }
.trv-what { font: italic 900 clamp(26px, 5vw, 46px)/1 system-ui, sans-serif; text-transform: uppercase; color: #fff; opacity: 0; }
.trv-badge { position: relative; margin: 18px 0 8px; opacity: 0; }
.trv-badge .ttl { box-shadow: 0 0 40px color-mix(in srgb, var(--trv-c) 70%, transparent); }
.trv-flash { position: absolute; left: 50%; top: 50%; width: 520px; height: 520px; margin: -260px 0 0 -260px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, #fff 0%, color-mix(in srgb, var(--trv-c) 80%, #fff) 14%, transparent 58%); }
.trv-sparks { position: absolute; left: 50%; top: 50%; pointer-events: none; }
.trv-sparks i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; opacity: 0; transform: scale(var(--s));
  background: #fff; box-shadow: 0 0 10px var(--trv-c), 0 0 4px #fff; }
.trv-sub { font: 600 14px system-ui; color: rgba(236,239,242,0.75); opacity: 0; }
.trv-btns { display: flex; gap: 10px; margin-top: 10px; opacity: 0; }
.trv-btns button { min-width: 140px; padding: 12px 20px; border-radius: 12px; font: 800 15px system-ui; }
.trv .trv-btns .trv-wear { background: var(--trv-c); color: #050709; border: 0; box-shadow: 0 8px 26px color-mix(in srgb, var(--trv-c) 50%, transparent); }
.trv-count { font: 700 11px system-ui; letter-spacing: 0.2em; color: var(--muted); opacity: 0; }
.trv.go .trv-kicker { animation: trvKick .7s .1s cubic-bezier(.2,.8,.2,1) forwards; }
.trv.go .trv-what { animation: trvUp .55s .25s cubic-bezier(.2,.8,.2,1) forwards; }
.trv.go .trv-badge { animation: trvPop .75s .45s cubic-bezier(.2,1.6,.4,1) forwards; }
.trv.go .trv-flash { animation: trvFlash .9s .5s ease-out forwards; }
.trv.go .trv-sparks i { animation: trvSpark 1.1s calc(.5s + var(--dl)) cubic-bezier(.1,.7,.3,1) forwards; }
.trv.go .trv-sub { animation: trvUp .5s 1s ease-out forwards; }
.trv.go .trv-btns, .trv.go .trv-count { animation: trvUp .5s 1.2s ease-out forwards; }
@keyframes trvIn { from { opacity: 0; } }
@keyframes trvOut { to { opacity: 0; transform: scale(1.04); } }
@keyframes trvRays { to { opacity: 1; } }
@keyframes trvSpin { to { transform: rotate(360deg); } }
@keyframes trvKick { from { opacity: 0; letter-spacing: 1.4em; filter: blur(6px); } to { opacity: 1; letter-spacing: 0.5em; filter: none; } }
@keyframes trvUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes trvPop { 0% { opacity: 0; transform: scale(0.2) rotate(-8deg); filter: blur(10px) brightness(3); }
  60% { opacity: 1; filter: blur(0) brightness(1.6); } 100% { opacity: 1; transform: scale(1); filter: none; } }
@keyframes trvFlash { 0% { opacity: 0; transform: scale(0.3); } 25% { opacity: 1; } 100% { opacity: 0; transform: scale(1.4); } }
@keyframes trvSpark { 0% { opacity: 1; transform: translate(0, 0) scale(var(--s)); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.2); } }
@media (max-width: 560px) { .ttl-xl { font-size: 22px; } .trv-btns { flex-direction: column; width: 100%; } .trv-btns button { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .trv *, .trv { animation-duration: .01s !important; animation-delay: 0s !important; } }
.lb td.n .ttl { margin-left: 6px; }

/* trophy button: a gold dot for titles you haven't seen */
.tb-titles { position: relative; }
.tb-dot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px rgba(18,21,26,0.9), 0 0 10px rgba(255,212,0,0.8); }
.tb-dot.hidden { display: none; }

/* the Titles sheet */
.ttl-preview { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 12px; background: var(--bg2); margin-bottom: 4px; }
.ttl-prev-label { font: 800 10px system-ui; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.ttl-prev-row { display: flex; align-items: center; gap: 4px; font-size: 16px; }
.ttl-empty { padding: 18px 16px; border-radius: 12px; background: var(--bg2); color: #cfd3d8; line-height: 1.5; margin: 10px 0; }
.ttl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.ttl-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 7px; padding: 12px; border-radius: 12px; text-align: left;
  background: var(--bg2); border: 1px solid rgba(255,255,255,0.1); transition: transform .16s var(--ease-out), border-color .16s, background-color .16s; }
.ttl-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.09); }
.ttl-card.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 8px 24px rgba(255, 212, 0, 0.15); }
.ttl-sub { font: 600 12px var(--mono); color: var(--muted); }
.ttl-pips { display: flex; align-items: center; gap: 4px; }
.ttl-pips b { width: 14px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.16); }
.ttl-pips b.on { background: linear-gradient(90deg, #ffe07a, #b58cff); }
.ttl-pips em { font: 700 11px system-ui; font-style: normal; color: var(--muted); margin-left: 4px; }
.ttl-new { position: absolute; top: 10px; right: 10px; padding: 1px 6px; border-radius: 4px; background: var(--accent); color: #fff; font: 800 10px system-ui; letter-spacing: 0.08em;
  animation: ttl-new 1.6s ease-in-out infinite; }
@keyframes ttl-new { 50% { box-shadow: 0 0 12px rgba(225, 6, 0, 0.7); } }
.ttl-wear { font: 700 11px system-ui; color: var(--muted); }
.ttl-card.on .ttl-wear { color: var(--gold); }
.ttl-progs { display: flex; flex-direction: column; gap: 8px; }
.ttl-prog { display: grid; grid-template-columns: 150px 1fr auto; align-items: center; gap: 12px; font-size: 13px; }
.ttl-prog-name { font-weight: 700; white-space: nowrap; }
.ttl-prog-bar { position: relative; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.1); overflow: hidden; }
.ttl-prog-bar i { position: absolute; inset: 0; transform-origin: left; background: linear-gradient(90deg, var(--accent), #ff8a3d); border-radius: 3px; }
.ttl-prog-num { font: 600 12px var(--mono); color: #cfd3d8; white-space: nowrap; }
.ttl-prog-num em { font: 800 10px system-ui; font-style: normal; letter-spacing: 0.08em; text-transform: uppercase; margin-left: 6px; }
.ttl-lvl-bronze { color: #e3a774; } .ttl-lvl-silver { color: #d5dbe1; } .ttl-lvl-gold { color: #ffcc3d; }
.ttl-lvl-enchanted { background: linear-gradient(90deg, #7fd8ff, #b58cff, #ff8ad8); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (max-width: 860px) { .ttl-prog { grid-template-columns: 1fr auto; } .ttl-prog-bar { grid-column: 1 / -1; grid-row: 2; } }

/* ================= driver profiles (Peter, profile.js): click a leaderboard name =================
   Light HUD glass like the delta / Tab table: see-through, blurred, thin bright rim; calm spacing, few lines. */
.lb tr.lb-row[data-pid] { cursor: pointer; }
.lb tr.lb-row[data-pid]:hover td { background: rgba(255,255,255,0.06); }
.lb tr.lb-row.you[data-pid]:hover td { background: rgba(225, 6, 0, 0.26); }
.profile-card { width: min(420px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; gap: 14px; padding: 18px 20px 16px;
  background: rgba(16, 19, 24, 0.72); backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.10); animation: sheet-in .22s var(--ease-out); color: #eef0f2; }
.profile-card .card-head { margin-bottom: 0; }
.pf-head { display: flex; align-items: center; gap: 14px; }
.pf-avatar { width: 58px; height: 58px; flex: none; border-radius: 50%; display: grid; place-items: center; font: italic 900 27px system-ui; color: #fff;
  background: radial-gradient(circle at 30% 25%, #ff4d2e, #a5100a 70%); box-shadow: 0 0 0 2px rgba(255,255,255,0.18), 0 8px 22px rgba(225, 6, 0, 0.3); }
.pf-who { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.pf-who .ttl { margin-left: 0; }
.pf-name { font: italic 900 26px/1.05 system-ui, sans-serif; letter-spacing: 0.01em; text-shadow: var(--hud-shadow); }
.pf-you { font: 800 10px system-ui; font-style: normal; letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,0.14); vertical-align: middle; }
.pf-today { font: 600 12px var(--mono); color: rgba(236, 239, 242, 0.72); }
.pf-today b { color: #fff; }
/* stats: one quiet line instead of five boxes */
.pf-stats { display: flex; justify-content: space-between; gap: 8px; padding: 10px 2px 2px; border-top: 1px solid rgba(255,255,255,0.10); }
.pf-st { display: flex; flex-direction: column; align-items: center; flex: 1; font: 700 10px system-ui; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(236, 239, 242, 0.6); }
.pf-st b { font: italic 800 24px/1.1 system-ui, sans-serif; letter-spacing: 0; text-transform: none; color: #fff; font-variant-numeric: tabular-nums; }
.pf-streak { margin-top: -6px; text-align: center; font: 600 11px var(--mono); color: rgba(236, 239, 242, 0.55); }
/* sector times (today): small grid like the HUD sector tiles — purple = fastest of the day, gaps vs P1 green / red */
.pf-sectors { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 64px); align-items: baseline; row-gap: 5px; column-gap: 6px; padding: 9px 12px; border-radius: 10px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.10); }
.pf-sh { text-align: right; font: 800 10px system-ui; letter-spacing: 0.12em; color: rgba(236, 239, 242, 0.5); }
.pf-sn { font: 700 13px system-ui; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-sn.pf-ref { font: 600 11px system-ui; color: rgba(236, 239, 242, 0.6); }
.pf-sn.pf-ref span { color: #eef0f2; font-weight: 700; }
.pf-sectors b { text-align: right; font: 800 14px var(--mono); color: #fff; font-variant-numeric: tabular-nums; }
.pf-sectors b.purple { color: var(--sec-purple); }
.pf-sectors i { text-align: right; font: 700 12px var(--mono); font-style: normal; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .pf-sectors { grid-template-columns: minmax(0, 1fr) repeat(3, 54px); padding: 8px 10px; } .pf-sectors b { font-size: 13px; } }
.pf-sectors i.faster { color: var(--sec-green); } .pf-sectors i.slower { color: #ff6b5e; } .pf-sectors i.even { color: rgba(236, 239, 242, 0.5); }
/* ================= country flags (Peter, flags.js): next to names, the name-row button, the flag picker ================= */
.flag { display: inline-block; height: 0.82em; width: auto; aspect-ratio: 4 / 3; margin-right: 6px; vertical-align: -0.06em; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255,255,255,0.18); object-fit: cover; }
.lb td.n .flag { height: 11px; }
label.name .name-row { display: flex; gap: 8px; margin-top: 4px; }
label.name .name-row input { margin-top: 0; flex: 1; min-width: 0; }
.flag-btn { flex: none; width: 54px; padding: 0; display: grid; place-items: center; border-radius: 8px; border: 1px solid #39404a; background: #111418; cursor: pointer; transition: border-color .15s, transform .15s; }
.flag-btn .flag { height: 22px; margin: 0; border-radius: 3px; }
.flag-btn.empty { border-style: dashed; border-color: rgba(255,255,255,0.28); }
.flag-add { font: 800 20px/1 system-ui; color: rgba(236, 239, 242, 0.6); }
.flag-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
/* your own profile: the flag is a button (change it); others: just the flag */
.pf-name .flag { height: 0.72em; margin-right: 8px; vertical-align: 0.02em; }
.pf-flag { display: inline-flex; align-items: center; padding: 0; margin: 0 8px 0 0; background: none; border: none; vertical-align: 0.06em; cursor: pointer; }
.pf-flag .flag { height: 19px; margin: 0; transition: transform .15s; }
.pf-flag:hover .flag { transform: scale(1.12); }
.pf-flag.empty { padding: 2px 8px; border-radius: 999px; border: 1px dashed rgba(255,255,255,0.35); font: 700 11px system-ui; font-style: normal; color: rgba(236, 239, 242, 0.75); }
.pf-flag.empty:hover { background: rgba(255,255,255,0.08); color: #fff; }
/* the picker: hero with your flag, search, continent tabs, flag grid */
.flag-card { width: min(560px, 100%); max-height: calc(100vh - 40px); gap: 12px; padding: 18px 20px 16px;
  background: rgba(16, 19, 24, 0.78); backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.10); animation: sheet-in .22s var(--ease-out); color: #eef0f2; }
.flag-card .card-head { margin-bottom: 0; }
.fp-hero { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px;
  background: linear-gradient(120deg, rgba(225, 6, 0, 0.22), rgba(255,255,255,0.03) 70%); border: 1px solid rgba(255,255,255,0.12); }
.fp-big { flex: none; width: 72px; height: 54px; border-radius: 6px; object-fit: cover; box-shadow: 0 8px 20px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.25); }
.fp-none { display: grid; place-items: center; border: 1px dashed rgba(255,255,255,0.35); box-shadow: none; font: 900 26px system-ui; color: rgba(236, 239, 242, 0.5); }
.fp-name { font: italic 900 22px/1.1 system-ui, sans-serif; }
.fp-sub { margin-top: 3px; font: 500 12px system-ui; color: rgba(236, 239, 242, 0.6); }
.fp-search input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.16); background: rgba(0,0,0,0.35); color: #fff; font: 500 14px system-ui; outline: none; }
.fp-search input:focus { border-color: rgba(255,255,255,0.45); }
.fp-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: none; }
.fp-tabs::-webkit-scrollbar { display: none; }
.fp-tab { flex: none; padding: 5px 11px; border-radius: 999px; font: 700 12px system-ui; color: rgba(236, 239, 242, 0.75); background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); }
.fp-tab:hover { color: #fff; background: rgba(255,255,255,0.1); }
.fp-tab.on { background: #fff; border-color: #fff; color: #111; }
.fp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; min-height: 0; max-height: 46vh; overflow-y: auto; padding: 2px 4px 2px 2px; align-content: start; }
.fp-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 8px; border-radius: 10px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); color: #e6e9ec; cursor: pointer; transition: transform .12s, background .12s, border-color .12s; }
.fp-tile[hidden] { display: none; }
.fp-tile img { width: 56px; height: 42px; object-fit: cover; border-radius: 4px; box-shadow: 0 4px 10px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.14); }
.fp-tile span { font: 600 11px/1.2 system-ui; text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fp-tile:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.22); transform: translateY(-2px); }
.fp-tile.on { background: rgba(225, 6, 0, 0.2); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.fp-tile.on::after { content: '✓'; position: absolute; top: 5px; right: 6px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font: 900 10px system-ui; }
.fp-empty { grid-column: 1 / -1; padding: 18px; text-align: center; color: rgba(236, 239, 242, 0.55); font: 500 13px system-ui; }
.fp-clear { align-self: center; padding: 4px 10px; background: none; border: none; color: rgba(236, 239, 242, 0.55); font: 600 12px system-ui; }
.fp-clear:hover { color: #fff; text-decoration: underline; }
@media (max-width: 480px) { .fp-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); max-height: 50vh; } .fp-tile img { width: 48px; height: 36px; } .fp-name { font-size: 19px; } }
/* ================= Settings → Account (Peter, account.js) + the fixed name in the daily sheet ================= */
.acc { display: flex; flex-direction: column; gap: 6px; }
.acc-hero { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 12px; margin-bottom: 4px;
  background: linear-gradient(120deg, rgba(225, 6, 0, 0.22), rgba(255,255,255,0.03) 70%); border: 1px solid rgba(255,255,255,0.12); }
.acc-hero .pf-avatar { width: 52px; height: 52px; font-size: 24px; }
.acc-who { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; flex: 1; }
.acc-who .ttl { margin-left: 0; }
.acc-big { font: italic 900 22px/1.1 system-ui, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.acc-big .flag { height: 0.72em; margin-right: 8px; vertical-align: 0.02em; }
.acc-sub { font: 600 12px var(--mono); color: rgba(236, 239, 242, 0.6); }
.acc-pfbtn { flex: none; padding: 7px 12px; font-size: 13px; }
.acc-val { display: flex; align-items: center; gap: 10px; flex: none; }
.acc-val .flag { height: 16px; margin: 0; }
.acc-val .ttl { margin: 0; }
.acc-namev { font: italic 800 16px system-ui; }
.acc-cc { font-weight: 600; font-size: 13px; }
.acc-none { color: var(--muted); font-size: 13px; }
.acc-val button:disabled { opacity: 0.55; cursor: not-allowed; }
.acc-namebox { display: flex; gap: 8px; margin-top: 8px; }
.acc-namebox input { flex: 1; min-width: 0; padding: 9px 12px; font-size: 15px; border-radius: 8px; border: 1px solid #39404a; background: #111418; color: var(--fg); }
.acc-namebox input:focus { border-color: rgba(255,255,255,0.45); outline: none; }
.acc-err { margin-top: 6px; color: #ff6b5e; font-size: 12px; font-weight: 600; }
/* daily sheet: once you have an account name it's fixed here (Settings → Account changes it) */
.name-fixed { display: block; color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.name-fixed .name-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; padding: 6px 6px 6px 6px; border-radius: 8px; border: 1px solid #39404a; background: #111418; }
.name-fixed .flag-btn { height: 34px; border: none; background: rgba(255,255,255,0.05); }
.nf-name { flex: 1; min-width: 0; font: italic 800 17px system-ui; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nf-edit { flex: none; padding: 6px 10px; font-size: 12px; }
.nf-hint { display: block; margin-top: 5px; font-size: 11px; color: rgba(236, 239, 242, 0.5); }
/* unique names: the live check under the name fields (✓ free / ✗ taken) */
.name-check { display: block; margin-top: 6px; font-size: 11px; font-weight: 500; color: rgba(236, 239, 242, 0.5); }
.name-check.ok { color: var(--sec-green); font-weight: 600; }
.name-check.bad { color: #ff6b5e; font-weight: 600; }
.acc-namebox button:disabled { opacity: 0.45; cursor: not-allowed; }
/* transfer code (Account → Play on another device) */
.acc-xferbtns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.acc-code { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,0.35); border: 1px dashed rgba(255,255,255,0.3); }
.acc-code code { flex: 1; font: 800 20px var(--mono); letter-spacing: 0.12em; color: #fff; user-select: all; }
@media (max-width: 560px) { .acc-hero { flex-wrap: wrap; } .set-row .acc-val { flex-wrap: wrap; justify-content: flex-end; } }
.pf-sec { display: flex; flex-direction: column; gap: 8px; }
.pf-label { font: 800 10px system-ui; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(236, 239, 242, 0.6); }
.pf-label span { margin-left: 4px; color: rgba(236, 239, 242, 0.4); }
.pf-titles { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pf-titles .ttl { margin: 0; }
.pf-more { padding: 2px 9px; border-radius: 999px; background: transparent; border: 1px dashed rgba(255,255,255,0.3); color: rgba(236, 239, 242, 0.75); font: 700 11px system-ui; }
.pf-more:hover, .pf-more.open { background: rgba(255,255,255,0.08); color: #fff; }
/* fold-outs (titles "+ N more", recent dailies): height animates via grid rows */
.pf-fold { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s var(--ease-out), opacity .22s; opacity: 0; }
.pf-fold > div { overflow: hidden; min-height: 0; }
.pf-fold.open { grid-template-rows: 1fr; opacity: 1; }
.pf-toggle { display: flex; align-items: center; gap: 6px; width: 100%; padding: 9px 12px; border-radius: 10px; text-align: left;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12); font: 700 13px system-ui; color: #eef0f2; }
.pf-toggle span { font: 600 12px var(--mono); color: rgba(236, 239, 242, 0.5); }
.pf-toggle i { margin-left: auto; font-style: normal; font-size: 16px; transition: transform .2s var(--ease-out); color: rgba(236, 239, 242, 0.6); }
.pf-toggle.open i { transform: rotate(90deg); }
.pf-toggle:hover { background: rgba(255,255,255,0.09); }
.pf-recent { display: flex; flex-direction: column; padding: 0 4px; font-size: 13px; }
.pf-recent > div:first-child { margin-top: 4px; } /* (no padding on the folding box itself: closed means 0 px) */
.pf-recent > div { display: grid; grid-template-columns: 1fr 44px 52px 70px; align-items: baseline; padding: 5px 4px; }
.pf-recent > div + div { border-top: 1px solid rgba(255,255,255,0.06); }
.pf-recent b { font: 800 13px var(--mono); }
.pf-recent b.champion, .pf-recent b.podium { color: var(--gold); }
.pf-recent b.top10 { color: #e9edf1; } .pf-recent b.top100 { color: #9cc4ff; }
.pf-of { font: 600 11px var(--mono); color: rgba(236, 239, 242, 0.5); }
.pf-t { text-align: right; font-family: var(--mono); color: #cfd3d8; }
/* actions: one clear main button; when racing isn't possible it's calm grey and says why */
.pf-race { width: 100%; padding: 12px; border-radius: 10px; font: 800 15px system-ui; letter-spacing: 0.01em; }
.pf-race.on { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 8px 22px rgba(225, 6, 0, 0.35); }
.pf-race.on:hover { background: #ff1a10; }
.pf-race:disabled { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); color: rgba(236, 239, 242, 0.55); cursor: default; font-weight: 700; }
.pf-soon { display: flex; justify-content: center; gap: 18px; font: 600 11px system-ui; color: rgba(236, 239, 242, 0.4); }
@media (max-width: 860px) { .pf-name { font-size: 22px; } .pf-st b { font-size: 20px; } }

/* ================= results screen after the daily (Peter, resultscreen.js) =================
   Full screen over the replay of your counted lap: glass panels left (lap, place), right (board), bottom (curve);
   the middle stays open so the replay is the background. */
#results.rs-on { display: block; padding: 0; overflow-y: auto; pointer-events: auto;
  background: linear-gradient(to bottom, rgba(0,0,0,0.42), rgba(0,0,0,0) 22%, rgba(0,0,0,0) 58%, rgba(0,0,0,0.5)); }
.rs { min-height: 100%; display: grid; gap: 14px; padding: 16px 20px 20px;
  grid-template-columns: minmax(280px, 340px) 1fr minmax(300px, 360px);
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "top top top" "lap . board" "place curve board"; }
.rs-top { grid-area: top; display: flex; align-items: center; gap: 14px; }
.rs-title { font: italic 900 22px system-ui, sans-serif; letter-spacing: 0.02em; text-shadow: var(--hud-shadow); }
.rs-title span { color: var(--accent); }
.rs-title em { margin-left: 12px; font: 600 13px system-ui; font-style: normal; color: rgba(236, 239, 242, 0.75); }
.rs-tag { margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; font: 800 11px system-ui; letter-spacing: 0.14em;
  background: rgba(16, 19, 24, 0.6); border: 1px solid rgba(255,255,255,0.18); backdrop-filter: blur(8px); }
.rs-tag i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: rs-blink 1.6s infinite; }
@keyframes rs-blink { 50% { opacity: 0.25; } }
.rs-panel { padding: 14px 16px; border-radius: 14px; color: #eef0f2; min-width: 0;
  background: rgba(16, 19, 24, 0.66); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 18px 44px rgba(0,0,0,0.42), inset 0 1px 0 rgba(255,255,255,0.08); animation: rs-in .5s var(--ease-out) both; }
.rs-lap { grid-area: lap; align-self: start; }
.rs-place { grid-area: place; animation-delay: .12s; align-self: end; }
.rs-board { grid-area: board; animation-delay: .2s; display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 92px); position: sticky; top: 16px; }
.rs-board .lb { overflow-y: auto; min-height: 0; }
.rs-curve { grid-area: curve; animation-delay: .28s; align-self: end; }
@keyframes rs-in { from { opacity: 0; transform: translateY(14px); } }
.rs-k { font: 800 10px system-ui; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(236, 239, 242, 0.6); margin-bottom: 6px; }
.rs-wait { color: rgba(236, 239, 242, 0.55); font-size: 13px; }
.rs-time { font: italic 900 46px/1 var(--mono); letter-spacing: -0.01em; text-shadow: var(--hud-shadow); }
.rs-secs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.rs-sec { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 4px; border-radius: 8px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); }
.rs-sec span { font: 800 10px system-ui; letter-spacing: 0.12em; color: rgba(236, 239, 242, 0.55); }
.rs-sec b { font: 800 15px var(--mono); }
.rs-sec em { font: 600 10px var(--mono); font-style: normal; color: rgba(236, 239, 242, 0.55); }
.rs-sec.purple { background: rgba(160, 122, 230, 0.28); border-color: var(--sec-purple); }
.rs-sec.purple em { color: #d9c8ff; }
.rs-laps { margin-top: 12px; display: flex; flex-direction: column; }
.rs-lapr { display: grid; grid-template-columns: 1fr auto 52px; align-items: baseline; padding: 5px 2px; font-size: 13px; }
.rs-lapr + .rs-lapr { border-top: 1px solid rgba(255,255,255,0.07); }
.rs-lapr b { font: 700 14px var(--mono); color: #cfd3d8; }
.rs-lapr em { text-align: right; font: 600 11px var(--mono); font-style: normal; color: #ff6b5e; }
.rs-lapr.best b { color: #fff; }
.rs-lapr.best em { color: var(--sec-green); }
.rs-pen { margin-top: 8px; font: 600 12px var(--mono); color: rgba(236, 239, 242, 0.6); }
.rs-btns { display: flex; gap: 8px; margin-top: 14px; }
.rs-btns button { flex: 1; }
.rs-rank { display: flex; align-items: baseline; gap: 6px; }
.rs-rank b { font: italic 900 40px/1 system-ui, sans-serif; }
.rs-rank span { font: 700 16px var(--mono); color: rgba(236, 239, 242, 0.6); }
.rs-pct { margin-top: 6px; font: italic 900 30px/1 system-ui, sans-serif; letter-spacing: 0.01em; }
.rs-pct.hot { color: var(--gold); text-shadow: 0 0 18px rgba(255, 204, 0, 0.35); }
.rs-pct.p1 { color: var(--sec-purple); text-shadow: 0 0 18px rgba(160, 122, 230, 0.5); }
.rs-sub { margin-top: 4px; font-size: 13px; color: rgba(236, 239, 242, 0.75); }
.rs-gaps { margin-top: 8px; font: 600 12px var(--mono); color: rgba(236, 239, 242, 0.6); }
/* the curve */
.rs-svg { display: block; width: 100%; height: auto; max-height: 170px; overflow: visible; }
.rc-area { animation: rc-fade 1s .5s both; }
.rc-line { fill: none; stroke: rgba(255,255,255,0.85); stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 1; animation: rc-draw 1.2s .35s var(--ease-out) forwards; }
@keyframes rc-draw { to { stroke-dashoffset: 0; } }
@keyframes rc-fade { from { opacity: 0; } }
.rc-axis { stroke: rgba(255,255,255,0.2); stroke-width: 1; }
.rc-tick { fill: rgba(236, 239, 242, 0.5); font: 600 10px var(--mono); text-anchor: middle; }
.rc-p1 { stroke: var(--sec-purple); stroke-width: 1.5; }
.rc-med { stroke: rgba(255,255,255,0.4); stroke-width: 1; stroke-dasharray: 3 3; }
.rc-lab { font: 800 10px system-ui; text-anchor: middle; letter-spacing: 0.06em; }
.rc-lab.p1 { fill: #cdb8ff; }
.rc-lab.med { fill: rgba(236, 239, 242, 0.55); }
.rc-dot { fill: rgba(255,255,255,0.7); }
.rc-me { stroke: var(--accent); stroke-width: 2.5; filter: drop-shadow(0 0 6px rgba(225, 6, 0, 0.9)); animation: rc-fade .6s 1.2s both; }
.rc-me-dot { fill: #fff; stroke: var(--accent); stroke-width: 3; filter: drop-shadow(0 0 8px rgba(225, 6, 0, 0.9)); animation: rc-fade .6s 1.2s both; }
.rc-you { animation: rc-fade .6s 1.3s both; }
.rc-you rect { fill: var(--accent); }
.rc-you text { fill: #fff; font: 800 11px var(--mono); text-anchor: middle; }
.rs-legend { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11px; color: rgba(236, 239, 242, 0.55); }
.rs-legend span { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.rs-legend .l-beat { background: rgba(225, 6, 0, 0.55); }
.rs-legend .l-all { margin-left: 10px; background: rgba(255,255,255,0.25); }
/* multiplayer results (Peter, mpresults.js): same grid + panels — your race (lap), podium (place),
   classification (board), position chart (curve) */
.mpr .rs-board { max-height: none; }
.mpr-me { display: flex; align-items: center; gap: 16px; }
.mpr-pos { font: italic 900 52px/1 system-ui, sans-serif; text-shadow: var(--hud-shadow); }
.mpr-pos span { margin-left: 4px; font: 700 15px var(--mono); font-style: normal; color: rgba(236, 239, 242, 0.6); }
.mpr-pos.p1 { color: var(--gold); text-shadow: 0 0 22px rgba(255, 204, 0, 0.4); }
.mpr-me-r .rs-time { font-size: 30px; }
.mpr-grid { margin-top: 6px; font: 600 12px var(--mono); color: rgba(236, 239, 242, 0.7); }
.mpr-up { color: var(--sec-green); font-weight: 800; }
.mpr-down { color: #ff6b5e; font-weight: 800; }
.mpr-eq { color: rgba(236, 239, 242, 0.45); }
.rs-lapr.purple b { color: #d9c8ff; }
.rs-lapr.purple em { color: var(--sec-purple); }
.mpr-pod { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 8px; margin-top: 4px; }
.mpr-step { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.mpr-who { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; max-width: 100%; text-align: center; }
.mpr-who b { font: 800 14px system-ui; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.mpr-who span { font: 700 12px var(--mono); color: rgba(236, 239, 242, 0.7); }
.mpr-step.empty .mpr-who { color: rgba(236, 239, 242, 0.45); font-size: 12px; }
.mpr-block { width: 100%; display: grid; place-items: center; border-radius: 10px 10px 4px 4px; font: italic 900 26px system-ui, sans-serif;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14); }
.mpr-step.s1 .mpr-block { height: 74px; background: linear-gradient(to bottom, rgba(255, 204, 0, 0.45), rgba(255, 204, 0, 0.12)); border-color: var(--gold); color: #fff3b0; }
.mpr-step.s1 .mpr-who b { color: var(--gold); font-size: 16px; }
.mpr-step.s2 .mpr-block { height: 54px; }
.mpr-step.s3 .mpr-block { height: 40px; }
.mpr-step.me .mpr-who b { text-decoration: underline 2px var(--accent); text-underline-offset: 3px; }
.mpr-step.empty .mpr-block { opacity: 0.45; }
.mpr-flag { width: 18px; height: auto; border-radius: 2px; vertical-align: -2px; }
.mpr-tab { width: 100%; border-collapse: collapse; font-size: 13px; }
.mpr-tab th { font: 800 9px system-ui; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(236, 239, 242, 0.5); text-align: left; padding: 0 4px 6px; }
.mpr-tab td { padding: 7px 4px; border-top: 1px solid rgba(255,255,255,0.07); white-space: nowrap; }
.mpr-tab tr.me td { background: rgba(225, 6, 0, 0.16); }
.mpr-tab tr.me td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.mpr-tab tr.racing td, .mpr-tab tr.left td, .mpr-tab tr.dnf td { color: rgba(236, 239, 242, 0.55); }
.mpr-p { width: 22px; font: italic 900 15px system-ui; text-align: center; }
.mpr-n { display: flex; align-items: center; gap: 6px; max-width: 150px; overflow: hidden; }
.mpr-n span { overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.mpr-n i { flex: none; width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(10,12,16,0.9); }
.mpr-t, .mpr-b { font: 700 12px var(--mono); }
.mpr-tab tr.racing .mpr-t { font: 600 11px system-ui; font-style: italic; }
.mpr-b.purple { color: #d9c8ff; text-shadow: 0 0 10px rgba(160, 122, 230, 0.6); }
.mpr-m { text-align: right; font: 700 11px var(--mono); }
.mpr-status { margin-top: 10px; font: 600 12px var(--mono); color: rgba(236, 239, 242, 0.6); }
.mpr-svg { max-height: 240px; }
.mpr-line { fill: none; stroke-width: 2; opacity: 0.7; stroke-linejoin: round; }
.mpr-line.me { stroke-width: 4; opacity: 1; filter: drop-shadow(0 0 6px rgba(225, 6, 0, 0.8)); }
.mpr-pt { opacity: 0.85; }
.mpr-lab { font: 700 11px system-ui; }
.mpr-lab.me { font-weight: 900; }
.mpr-py { text-anchor: end; }
/* narrower: board under the lap panels; phone: one column, the replay stays visible at the top */
@media (max-width: 1100px) {
  .rs { grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr); grid-template-rows: auto; grid-template-areas: "top top" "lap place" "curve curve" "board board"; }
  .rs-place, .rs-curve { align-self: stretch; }
  .rs-board { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .rs { grid-template-columns: 1fr; grid-template-areas: "top" "." "lap" "place" "curve" "board"; grid-template-rows: auto 26vh; padding: 12px 12px 16px; gap: 10px; }
  .rs-title em { display: block; margin: 2px 0 0; }
  .rs-tag { display: none; }
  .rs-time { font-size: 38px; }
}

/* ================= campaign screen (Peter, main.js showCampaign) =================
   Two big cards: the track list left, the selected track right (map, numbers, you vs record, Drive, leaderboard). */
#menu > .menu-wrap.cmp { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr) minmax(300px, 360px); gap: 18px; align-items: stretch;
  width: min(1680px, 100%); max-width: none; }
/* the leaderboard column (Peter, 2026-11-26): like the daily results board — own card, full height, profile + ▶ */
.cmp-boardcard { display: flex; flex-direction: column; min-width: 0; }
.cmp-boardtitle { margin: 4px 0 12px; font: italic 900 24px/1.1 system-ui, sans-serif; }
.cmp-boardcard .cmp-board { flex: 1; max-height: none; overflow: auto; }
.cmp-boardcard .lb tr[data-pid] { cursor: pointer; }
.cmp-boardcard .lb tr[data-pid]:hover td { background: rgba(255,255,255,0.05); }
@media (max-width: 1360px) { /* not enough room for three: the board goes under the track card */
  #menu > .menu-wrap.cmp { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); align-items: start; }
  .cmp-boardcard { grid-column: 2; }
  .cmp-boardcard .cmp-board { max-height: 44vh; }
}
.cmp .card { width: auto; padding: 22px 24px; border-radius: 18px; background: rgba(14, 16, 20, 0.92); }
.cmp-kicker { font: 800 11px system-ui; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.cmp-kicker .beta { letter-spacing: 0.04em; text-transform: none; }
.cmp .cmp-styles { margin: 14px 0 8px; flex-wrap: wrap; }
.cmp .cmp-styles button { padding: 10px 0; border-radius: 10px; font-size: 14px; }
.cmp .cmp-styles button span { display: block; font-size: 10px; opacity: 0.6; letter-spacing: 0.04em; font-weight: 600; }
.cmp-blurb { color: var(--muted); font-size: 13px; line-height: 1.45; }
.cmp-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.cmp-track { position: relative; display: grid; grid-template-columns: 100px minmax(0, 1fr); align-items: center; gap: 14px; width: 100%; margin: 0; text-align: left;
  padding: 10px 14px 10px 10px; border-radius: 14px; background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.08); color: inherit; cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s var(--ease-out); }
.cmp-track:hover { background: rgba(255,255,255,0.07); transform: translateX(3px); }
.cmp-track.on { border-color: var(--accent); background: linear-gradient(90deg, rgba(225,6,0,0.22), rgba(225,6,0,0.06)); box-shadow: inset 3px 0 0 var(--accent); }
.cmp-track canvas { width: 100px; height: 66px; border-radius: 10px; background: rgba(0,0,0,0.28); }
.cmp-num { position: absolute; left: 14px; top: 8px; font: italic 900 11px var(--mono); color: rgba(255,255,255,0.55); pointer-events: none; }
.cmp-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cmp-info b { font: italic 900 19px system-ui, sans-serif; letter-spacing: 0.01em; white-space: nowrap; }
.cmp-info > span[data-meta] { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-times { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-top: 2px; font: 600 12px var(--mono); }
.cmp-times > span { white-space: nowrap; }
.cmp-times .you { color: var(--gold); font-weight: 800; }
.cmp-rec { color: var(--muted); font-size: 11.5px; }
.cmp-crown { color: var(--gold); font-weight: 800; }
.cmp-right { display: flex; flex-direction: column; min-width: 0; container-type: inline-size; }
.cmp-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.cmp-title { margin: 4px 0 0; font: italic 900 38px/1 system-ui, sans-serif; letter-spacing: 0.01em; }
.cmp-legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.cmp-legend i { width: 22px; height: 6px; border-radius: 3px; background: hsl(0, 78%, 56%); }
.cmp-legend i.mid { background: hsl(62, 78%, 56%); margin-left: -4px; }
.cmp-legend i.fast { background: hsl(125, 78%, 56%); margin-left: -4px; }
.cmp-detail { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(250px, 1fr); gap: 18px; margin-top: 16px; }
.menu-wrap.cmp .cmp-right .cmp-detail { flex: 1; } /* the map grows into the card's full height (three columns) */
.cmp-mapbox { position: relative; min-height: 300px; border-radius: 14px; background: radial-gradient(ellipse at 50% 45%, rgba(255,255,255,0.06), rgba(0,0,0,0.25) 75%); border: 1px solid rgba(255,255,255,0.07); }
.cmp-mapbox canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cmp-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cmp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cmp-stats div { padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.07); }
.cmp-stats b { display: block; font: italic 900 22px var(--mono); }
.cmp-stats span { font-size: 11px; color: var(--muted); }
.cmp-vsrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cmp-vsbox { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 212, 0, 0.07); border: 1px solid rgba(255, 212, 0, 0.25); min-width: 0; }
.cmp-vsbox.rec { background: rgba(160, 122, 230, 0.1); border-color: rgba(160, 122, 230, 0.35); }
.cmp-vsbox em { font: 800 10px system-ui; font-style: normal; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.cmp-vsbox b { font: 800 20px var(--mono); }
.cmp-vsbox b.you { color: var(--gold); }
.cmp-vsbox span { font-size: 12px; color: rgba(236, 239, 242, 0.75); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-vsbox span .flag { height: 11px; margin-right: 5px; vertical-align: -1px; }
.cmp-gap { margin-top: 8px; font: 700 12px var(--mono); color: rgba(236, 239, 242, 0.7); }
.cmp-gap.gold { color: var(--gold); }
.cmp-wait, .cmp-note { color: var(--muted); font-size: 12px; line-height: 1.45; }
.cmp-side .big-btn { margin-top: auto; font-size: 18px; padding: 16px; }
.cmp-boardhead { margin: 20px 0 8px; font: 800 11px system-ui; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.cmp-board { max-height: 34vh; }
.cmp-note b { color: var(--fg); }
/* a narrow detail card: map on top, numbers + Drive under it */
@container (max-width: 700px) {
  .cmp-detail { grid-template-columns: minmax(0, 1fr); }
  .cmp-mapbox { min-height: 0; aspect-ratio: 16 / 10; }
  .cmp-stats { grid-template-columns: repeat(4, 1fr); }
}
@container (max-width: 460px) { .cmp-stats { grid-template-columns: 1fr 1fr; } }
@media (max-width: 1000px) {
  #menu > .menu-wrap.cmp { grid-template-columns: minmax(0, 1fr); max-width: 640px; }
  .cmp-boardcard { grid-column: auto; }
  .cmp-detail { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .cmp .card { padding: 16px; }
  .cmp-track { grid-template-columns: 76px minmax(0, 1fr); gap: 12px; }
  .cmp-track canvas { width: 76px; height: 50px; }
  .cmp-title { font-size: 30px; }
  .cmp-legend { display: none; }
}

/* ================= daily sheet (Peter, main.js openDailySheet) — same look as the campaign screen =================
   Header (challenge, track, countdown); left: big map, numbers, today's board; right: the car, four step tiles, name, buttons. */
.sheet.dl-sheet { width: min(1180px, 100%); padding: 22px 26px 24px; }
.dl-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin: 6px 0 16px; }
.dl-count { padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); font: 600 12px var(--mono); color: rgba(236,239,242,0.8); white-space: nowrap; }
.dl-count:empty { display: none; }
.dl-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.dl-left, .dl-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.dl-map { min-height: 0; aspect-ratio: 16 / 10; }
.dl-legend { position: absolute; left: 12px; bottom: 10px; }
.dl-stats { grid-template-columns: repeat(4, 1fr); }
.dl-left .cmp-boardhead { margin: 6px 0 -6px; }
.dl-board { max-height: 26vh; min-height: 60px; }
.dl-car { position: relative; border-radius: 16px; padding: 4px 14px 14px; background: radial-gradient(ellipse at 50% 30%, rgba(255,255,255,0.07), rgba(0,0,0,0.2) 75%); border: 1px solid rgba(255,255,255,0.07); }
.dl-car .daily-stage { height: 190px; margin: 0; }
.dl-carname { display: flex; align-items: center; justify-content: center; gap: 10px; }
.dl-carname b { font: italic 900 22px system-ui, sans-serif; }
.dl-carblurb { text-align: center; color: var(--muted); font-size: 12px; margin-top: 3px; }
.dl-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; counter-reset: dl; }
.dl-steps li { position: relative; padding: 10px 12px 10px 40px; border-radius: 12px; background: rgba(255,255,255,0.045); border: 1px solid rgba(255,255,255,0.07); counter-increment: dl; }
.dl-steps li::before { content: counter(dl); position: absolute; left: 11px; top: 10px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font: italic 900 12px system-ui; }
.dl-steps b { display: block; font: 800 14px system-ui; margin-bottom: 2px; }
.dl-steps span { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.dl-right .name, .dl-right .name-fixed { margin: 0; }
.dl-btns { display: flex; flex-direction: column; gap: 8px; }
.dl-btns .big-btn { margin: 0; }
/* the race button (Peter, 2026-11-26): big, glowing, a shine sweeping over it — the one thing to click */
.dl-race { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; margin: 4px 0 0; padding: 20px 22px; overflow: hidden;
  border: 0; border-radius: 14px; color: #fff; text-align: left; cursor: pointer; background: linear-gradient(135deg, #ff2a1f, #c80500 60%, #8f0300);
  box-shadow: 0 10px 30px rgba(225, 6, 0, 0.45), inset 0 1px 0 rgba(255,255,255,0.25); animation: dlPulse 1.8s ease-in-out infinite; transition: transform .15s var(--ease-out); }
.dl-race:hover { transform: translateY(-2px) scale(1.015); background: linear-gradient(135deg, #ff3b30, #e00800 60%, #a00400); }
.dl-race:active { transform: scale(0.985); }
.dl-race::after { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%; background: linear-gradient(100deg, transparent, rgba(255,255,255,0.35), transparent); transform: skewX(-20deg); animation: dlShine 2.6s ease-in-out infinite; pointer-events: none; }
.dl-race-in { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dl-race b { font: italic 900 26px/1 system-ui, sans-serif; letter-spacing: 0.01em; text-transform: uppercase; text-shadow: 0 2px 10px rgba(0,0,0,0.3); }
.dl-race em { font: 600 12px system-ui; font-style: normal; color: rgba(255,255,255,0.82); }
.dl-race i { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,0.18); font-style: normal; font-size: 18px; }
@keyframes dlPulse { 0%, 100% { box-shadow: 0 10px 30px rgba(225,6,0,0.40), 0 0 0 0 rgba(255,60,40,0.55), inset 0 1px 0 rgba(255,255,255,0.25); }
  50% { box-shadow: 0 12px 36px rgba(225,6,0,0.60), 0 0 0 10px rgba(255,60,40,0), inset 0 1px 0 rgba(255,255,255,0.25); } }
@keyframes dlShine { 0% { left: -40%; } 55%, 100% { left: 130%; } }
@media (prefers-reduced-motion: reduce) { .dl-race, .dl-race::after { animation: none; } }
/* today's board, locked until you drove */
.dl-locked { position: relative; min-height: 150px; border-radius: 12px; overflow: hidden; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07); }
.dl-locked-rows { display: flex; flex-direction: column; gap: 9px; padding: 14px; filter: blur(3px); opacity: 0.55; }
.dl-locked-rows i { height: 14px; border-radius: 4px; background: linear-gradient(90deg, rgba(255,255,255,0.22) 0 40%, transparent 40% 70%, rgba(255,255,255,0.18) 70%); }
.dl-locked-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px; text-align: center; background: radial-gradient(ellipse at center, rgba(10,12,16,0.85), rgba(10,12,16,0.55)); }
.dl-locked-msg b { font: 800 15px system-ui; }
.dl-locked-msg span { font-size: 12.5px; color: var(--muted); max-width: 320px; }
/* "practice first?" before the daily */
.pp-card { width: 460px; gap: 12px; padding: 24px; }
.pp-kicker { font: 800 11px system-ui; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.pp-title { margin: -4px 0 0; font: italic 900 28px/1.1 system-ui, sans-serif; }
.pp-text { margin: 0 0 4px; color: rgba(236,239,242,0.8); font-size: 14px; line-height: 1.5; }
.pp-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; margin: 0; padding: 14px 16px; border-radius: 12px; text-align: left; }
.pp-opt span { display: flex; flex-direction: column; gap: 2px; }
.pp-opt b { font: 800 16px system-ui; }
.pp-opt em { font: 500 12px system-ui; font-style: normal; color: var(--muted); }
.pp-opt i { font-style: normal; font: 800 11px system-ui; letter-spacing: 0.08em; text-transform: uppercase; }
.pp-rec { background: linear-gradient(135deg, rgba(69,196,134,0.22), rgba(69,196,134,0.08)); border: 1px solid rgba(69,196,134,0.55); }
.pp-rec:hover, .pp-rec:focus-visible { background: linear-gradient(135deg, rgba(69,196,134,0.32), rgba(69,196,134,0.12)); }
.pp-rec i { padding: 4px 8px; border-radius: 999px; background: #45c486; color: #0b2a1a; }
.pp-back { align-self: center; }
.dl-pracdone { text-align: center; padding: 9px; border-radius: 10px; background: rgba(69, 196, 134, 0.1); border: 1px solid rgba(69, 196, 134, 0.3); color: #bfe9d2; font-size: 13px; }
.dl-right .result-mini, .dl-right .row-btns { margin: 0; }
@media (max-width: 900px) {
  .dl-grid { grid-template-columns: minmax(0, 1fr); }
  .dl-right { order: -1; }
  .dl-board { max-height: none; }
}
@media (max-width: 520px) {
  .sheet.dl-sheet { padding: 16px; }
  .dl-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .dl-stats { grid-template-columns: 1fr 1fr; }
  .dl-steps li { padding: 8px 9px 8px 34px; }
  .dl-steps li::before { left: 8px; top: 8px; width: 18px; height: 18px; font-size: 11px; }
  .dl-steps b { font-size: 13px; }
  .dl-steps span { font-size: 11px; }
  .dl-car .daily-stage { height: 150px; }
}

/* ================= titles sheet (Peter, titles.js) — pick a title: radio marks, WEARING ribbon, live preview ================= */
.sheet.ttl-sheet { width: min(1080px, 100%); padding: 22px 26px 24px; }
.ttl-head { margin: 6px 0 16px; }
.ttl-lead { margin-top: 6px; color: rgba(236,239,242,0.75); font-size: 14px; }
.ttl-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); gap: 22px; align-items: start; }
.ttl-side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 10px; }
.ttl-sec { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; font: 800 11px system-ui; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.ttl-main .ttl-sec:not(:first-child) { margin-top: 20px; }
.ttl-sec span { padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,0.08); color: #cfd3d8; letter-spacing: 0.04em; }
.ttl-sheet .ttl-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.ttl-sheet .ttl-card { padding: 14px 14px 12px; gap: 8px; min-height: 150px; cursor: pointer; }
.ttl-radio { position: relative; flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.4); transition: border-color .15s, background .15s; }
.ttl-card:not(.on):hover .ttl-radio { border-color: #fff; }
.ttl-card.on .ttl-radio { border-color: var(--gold); background: var(--gold); box-shadow: 0 0 10px rgba(255, 212, 0, 0.5); }
.ttl-card.on .ttl-radio::after { content: '✓'; position: absolute; inset: -2px; display: grid; place-items: center; color: #2a1d00; font: 900 10px system-ui; }
.ttl-sheet .ttl-new { position: static; display: inline-block; margin-left: 6px; vertical-align: 1px; }
.ttl-sheet .ttl-wear { margin-top: auto; align-self: stretch; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 7px 10px; border-radius: 8px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  font: 800 12px system-ui; color: #e3e6ea; transition: background .15s, border-color .15s, color .15s; }
.ttl-card:not(.on):hover .ttl-wear, .ttl-card:not(.on):focus-visible .ttl-wear { background: var(--accent); border-color: var(--accent); color: #fff; }
.ttl-sheet .ttl-card.on { background: linear-gradient(180deg, rgba(255, 212, 0, 0.12), rgba(255, 212, 0, 0.03)); }
.ttl-sheet .ttl-card.on .ttl-wear { background: rgba(255, 212, 0, 0.16); border-color: rgba(255, 212, 0, 0.5); color: var(--gold); }
.ttl-sheet .ttl-card.on:hover .ttl-wear { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.25); color: #e3e6ea; }
.ttl-sheet .ttl-preview { gap: 10px; padding: 14px; border-radius: 14px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); margin: 0; }
.ttl-sheet .ttl-prev-row { gap: 8px; padding: 10px 12px; border-radius: 10px; background: rgba(225, 6, 0, 0.16); box-shadow: inset 3px 0 0 var(--accent); font-size: 15px; min-width: 0; transition: box-shadow .15s, background .15s; }
.ttl-sheet .ttl-prev-row.previewing { background: rgba(255,255,255,0.08); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.45); }
.ttl-prev-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ttl-prev-row .flag { height: 12px; border-radius: 2px; }
.ttl-prev-row .ttl { margin-left: 2px; }
.ttl-prev-rank { width: 16px; font: 700 12px var(--mono); color: var(--muted); }
.ttl-prev-time { margin-left: auto; font: 700 12px var(--mono); color: rgba(255, 212, 0, 0.6); }
.ttl-none { font-size: 11px; color: var(--muted); font-style: italic; }
.ttl-prev-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.ttl-off { margin: 0; padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.ttl-sheet .ttl-prog { grid-template-columns: 1fr auto; gap: 4px 10px; }
.ttl-sheet .ttl-prog-bar { grid-column: 1 / -1; grid-row: 2; }
@media (max-width: 860px) {
  .ttl-layout { grid-template-columns: minmax(0, 1fr); }
  .ttl-side { display: contents; } /* phone order: preview, your titles, then what is next */
  .ttl-side .ttl-preview { order: -1; }
  .ttl-main { order: 1; }
  .ttl-side > .ttl-sec, .ttl-side > .ttl-progs { order: 2; }
  .ttl-side > .ttl-sec { margin: 8px 0 -12px; }
}
@media (max-width: 520px) {
  .sheet.ttl-sheet { padding: 16px; }
  .ttl-prev-time { display: none; }
  .ttl-sheet .ttl-wear { font-size: 11px; padding: 6px; gap: 6px; white-space: nowrap; }
  .ttl-radio { width: 14px; height: 14px; }
  .ttl-sheet .ttl-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .ttl-sheet .ttl-card { min-height: 0; padding: 12px 10px 10px; }
  .ttl-sheet .ttl-card .ttl-lg { font-size: 12px; padding: 3px 9px 3px 8px; }
}

/* ================= settings (Peter, main.js openSettings / account.js) — redesign 2026-11-21 =================
   Bigger card; sidebar with icon + one-line description per tab and developer mode at its foot; the pane has a big
   section title and its rows in titled groups (one rounded box, rows divided by thin lines). */
.settings-card { width: min(980px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 22px 26px 24px; border-radius: 18px; background: rgba(14, 16, 20, 0.95); }
.set-head { align-items: flex-end; gap: 16px; margin: 0 0 18px; }
.set-head .cmp-title { font-size: 34px; }
.set-body { grid-template-columns: 240px minmax(0, 1fr); gap: 24px; min-height: min(560px, calc(100vh - 170px)); } /* same size on every tab: no jumping */
.set-tabs { gap: 4px; }
.set-tabs button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; margin: 0; color: rgba(236,239,242,0.75); }
.set-tabs button i { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,0.05); }
.set-tabs button i svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.set-tabs button span { display: flex; flex-direction: column; min-width: 0; }
.set-tabs button b { font-size: 14px; color: inherit; }
.set-tabs button em { font-style: normal; font-weight: 500; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-tabs button:hover { background: rgba(255,255,255,0.05); color: #fff; }
.set-tabs button.on { background: linear-gradient(90deg, rgba(225,6,0,0.24), rgba(225,6,0,0.06)); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.set-tabs button.on i { background: var(--accent); color: #fff; }
.set-dev { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding: 12px; border-radius: 12px; border: 1px dashed rgba(255,255,255,0.12); cursor: pointer; }
.set-tabs { min-height: 100%; }
.set-dev .set-label { font-size: 12.5px; color: var(--muted); }
.set-dev .set-label em { font-size: 11px; }
.set-pane { gap: 18px; }
.set-group { display: flex; flex-direction: column; gap: 8px; }
.set-gh { font: 800 11px system-ui; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); padding-left: 2px; }
.set-gbox { border-radius: 14px; background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.08); overflow: hidden; }
.set-gbox > .set-row { border-radius: 0; background: transparent; padding: 14px 16px; }
.set-gbox > .set-row + .set-row { border-top: 1px solid rgba(255,255,255,0.07); }
.set-gbox > label.set-row { cursor: pointer; }
.set-gbox > label.set-row:hover { background: rgba(255,255,255,0.03); }
.set-label { font-size: 14.5px; }
.set-label em { font-size: 12.5px; margin-top: 2px; }
.set-note { color: var(--muted); font-size: 12px; line-height: 1.45; padding: 0 2px; }
.set-seg { background: rgba(0,0,0,0.3); padding: 3px; border-radius: 10px; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.set-seg button { border: none; background: transparent; border-radius: 8px; padding: 7px 12px; color: rgba(236,239,242,0.8); }
.set-seg button:hover { background: rgba(255,255,255,0.07); }
.set-seg button.on { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(225,6,0,0.35); }
.set-vol .set-label output { font-size: 13px; }
.set-vol input[type=range] { margin-top: 10px; height: 6px; }
.set-keys { padding: 6px 16px 12px; }
.set-keys .keys { width: 100%; }
.set-keys + .set-note, .set-keys .muted { margin-top: 8px; }
/* rebindable keys (Peter, 2026-11-26) */
.kb-gh { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kb-gh .link { font-size: 12px; padding: 0; text-transform: none; letter-spacing: 0; }
.kb-gh .link:disabled { opacity: 0.35; cursor: default; }
.kb-binds td { vertical-align: middle; }
.kb-cell { white-space: nowrap; }
.kb-slot { display: inline-flex; align-items: center; margin-left: 6px; border-radius: 7px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14); }
.kb-slot.empty { background: transparent; border-style: dashed; }
.kb-key { min-width: 46px; margin: 0; padding: 4px 10px; border: 0; background: none; color: inherit; font: 700 12px system-ui; cursor: pointer; box-shadow: none; }
.kb-slot.empty .kb-key { color: var(--muted); }
.kb-key:hover { color: #fff; background: none; }
.kb-key.wait { min-width: 96px; color: #ffcf4a; animation: kbBlink 1s ease-in-out infinite; }
.kb-x { margin: 0 2px 0 -4px; padding: 2px 6px; border: 0; background: none; color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer; box-shadow: none; }
.kb-x:hover { color: #ff6b5e; background: none; }
@keyframes kbBlink { 50% { opacity: 0.45; } }
.set-pane .acc-hero { padding: 18px; border-radius: 16px; }
.set-pane .acc-hero .pf-avatar { width: 60px; height: 60px; font-size: 28px; }
.set-pane .acc-big { font-size: 26px; }
@media (max-width: 760px) {
  .set-body { grid-template-columns: 1fr; gap: 16px; min-height: 0; }
  .set-tabs { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; min-height: 0; padding-bottom: 4px; }
  .set-tabs button { flex: none; padding: 8px 10px; gap: 8px; }
  .set-tabs button em { display: none; }
  .set-tabs button i { width: 28px; height: 28px; }
  .set-dev { order: 99; flex: none; min-width: 240px; margin: 0; }
  .set-gbox > label.set-row, .set-dev { flex-wrap: nowrap; } /* switches stay beside their label */
  .set-tabs { scrollbar-width: none; }
  .set-head .cmp-title { font-size: 28px; }
}
@media (max-width: 520px) {
  .settings-card { padding: 16px; }
  .set-gbox > .set-row { padding: 12px; }
  .set-seg { justify-content: flex-start; }
}

/* ---------- pause menu (redesign 2026-11-21, Peter): full screen over the blurred game — slanted menu left (slides in,
   one lit item), the run right (track, map with your car, times), a huge "PAUSED" behind */
#pause.pz-on { padding: 0; display: block; background: none; overflow: hidden; }
#pause.pz-on.hidden { display: none; }
.pz { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(340px, 460px) minmax(0, 520px); justify-content: space-between; align-items: center; gap: 40px; padding: 48px clamp(24px, 6vw, 96px); overflow: hidden auto;
  background: linear-gradient(100deg, rgba(8,9,12,0.92) 0%, rgba(8,9,12,0.78) 38%, rgba(8,9,12,0.45) 70%, rgba(8,9,12,0.6) 100%);
  backdrop-filter: blur(10px) saturate(1.15); -webkit-backdrop-filter: blur(10px) saturate(1.15); animation: pzFade .25s ease-out both; }
.pz::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--accent); box-shadow: 0 0 24px rgba(225,6,0,0.6); animation: pzBar .45s var(--ease-out) both; }
.pz-word { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.pz-word span { position: absolute; right: -2vw; bottom: -4vh; font: italic 900 clamp(120px, 19vw, 300px)/0.8 system-ui, sans-serif; letter-spacing: -0.02em; color: transparent;
  -webkit-text-stroke: 1.5px rgba(255,255,255,0.07); pointer-events: none; user-select: none; white-space: nowrap; animation: pzWord .7s var(--ease-out) both; }

/* the menu */
.pz-menu { position: relative; display: flex; flex-direction: column; gap: 6px; }
.pz-menu > * { animation: pzIn .38s var(--ease-out) both; animation-delay: calc(60ms + var(--i, 0) * 38ms); }
.pz-tag { display: flex; align-items: center; gap: 10px; font: italic 900 44px/1 system-ui, sans-serif; letter-spacing: 0.01em; margin-bottom: 14px; }
.pz-dot { width: 12px; height: 12px; border-radius: 3px; background: var(--accent); transform: skewX(-12deg); box-shadow: 0 0 14px rgba(225,6,0,0.8); animation: pzBlink 1.6s ease-in-out infinite; }
.pz-dot.warn { background: var(--gold); box-shadow: 0 0 14px rgba(255,190,40,0.7); }
.pz-item { position: relative; display: block; width: 100%; margin: 0; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; color: var(--fg); font: inherit; outline: none; }
.pz-item .pz-in { position: relative; display: flex; align-items: center; gap: 14px; padding: 13px 18px 13px 20px; border-radius: 4px; transform: skewX(-10deg); background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.06); transition: transform .18s var(--ease-out), background-color .18s, border-color .18s, box-shadow .18s; overflow: hidden; }
.pz-item .pz-in > * { transform: skewX(10deg); }
.pz-item .pz-in::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); transform: scaleY(0); transition: transform .2s var(--ease-out); }
.pz-item svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: 0.75; transition: opacity .18s; }
.pz-item svg .fill { fill: currentColor; stroke: none; }
.pz-lbl { flex: 1; min-width: 0; display: flex; flex-direction: column; font: 800 19px/1.15 system-ui, sans-serif; letter-spacing: 0.01em; }
.pz-lbl em { font: 500 12px system-ui; font-style: normal; color: var(--muted); margin-top: 2px; }
.pz-item kbd { flex: none; font-size: 11px; background: rgba(0,0,0,0.3); border-color: rgba(255,255,255,0.16); color: inherit; opacity: 0.6; }
.pz-item .switch { flex: none; }
/* the lit item: mouse over it or ↑ ↓ to it */
.pz-item:focus-within .pz-in, .pz-item:focus .pz-in { transform: skewX(-10deg) translateX(12px); background: rgba(255,255,255,0.11); border-color: rgba(255,255,255,0.2); box-shadow: 0 8px 28px rgba(0,0,0,0.35); }
.pz-item:focus-within .pz-in::before, .pz-item:focus .pz-in::before { transform: scaleY(1); }
.pz-item:focus-within svg, .pz-item:focus svg { opacity: 1; }
.pz-item:active .pz-in { transform: skewX(-10deg) translateX(16px) scale(0.985); transition-duration: .06s; }
.pz-item.primary .pz-in { background: var(--accent); border-color: var(--accent); padding-top: 17px; padding-bottom: 17px; }
.pz-item.primary .pz-lbl { font-size: 24px; font-style: italic; font-weight: 900; }
.pz-item.primary svg { opacity: 1; }
.pz-item.primary .pz-in::before { background: #fff; }
.pz-item.primary:focus .pz-in { background: #ff1a10; box-shadow: 0 10px 34px rgba(225,6,0,0.45); }
.pz-item.primary kbd { opacity: 0.85; }
.pz-item.pz-exit .pz-in { background: transparent; border-color: rgba(255,70,60,0.28); color: #ff8a82; }
.pz-item.pz-exit .pz-in::before { background: #ff5a50; }
.pz-item.pz-exit:focus .pz-in { background: rgba(255,40,30,0.14); border-color: rgba(255,70,60,0.6); color: #ffb0aa; }
.pz-sep { height: 1px; margin: 8px 0 6px; background: linear-gradient(90deg, rgba(255,255,255,0.14), transparent); }
.pz-keys { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 14px; font-size: 11.5px; color: var(--muted); }
.pz-keys kbd { margin: 0 3px 0 0; font-size: 10px; padding: 0 5px; min-width: 0; }
.pz-q { font: italic 900 30px/1.1 system-ui, sans-serif; margin-bottom: 6px; }
.pz-qtext { margin: 0 0 14px; max-width: 420px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.pz-qtext b { color: var(--fg); }

/* the run */
.pz-info { position: relative; display: flex; flex-direction: column; gap: 12px; animation: pzSide .5s var(--ease-out) .08s both; }
.pz-track { margin: -4px 0 0; font: italic 900 clamp(30px, 3.6vw, 48px)/1 system-ui, sans-serif; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pz-mapbox { position: relative; aspect-ratio: 16 / 10; border-radius: 16px; background: radial-gradient(ellipse at 50% 40%, rgba(255,255,255,0.06), rgba(0,0,0,0.25)); border: 1px solid rgba(255,255,255,0.08); overflow: hidden; }
.pz-mapbox canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pz-car { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.pz-car::before, .pz-car i { content: ""; position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-shadow: 0 0 12px rgba(0,0,0,0.6); }
.pz-car i { background: none; border: 2px solid #fff; animation: pzPing 1.6s ease-out infinite; }
.pz-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.pz-stats div { padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.07); min-width: 0; }
.pz-stats b { display: block; font: italic 900 20px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pz-stats span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.pz-stats .hi { background: linear-gradient(135deg, rgba(255,190,40,0.18), rgba(255,190,40,0.05)); border-color: rgba(255,190,40,0.35); }
.pz-stats .hi b { color: var(--gold); }
.pz-note { font-size: 13px; color: var(--muted); padding-left: 10px; border-left: 2px solid var(--gold); }

/* redraws while it's up (graphics switch, confirm ↔ menu): no entrance again */
.pz.still, .pz.still::before, .pz.still .pz-word span, .pz.still .pz-info { animation: none; }
.pz.still .pz-menu > * { animation-duration: .2s; animation-delay: calc(var(--i, 0) * 18ms); }

@keyframes pzFade { from { opacity: 0; backdrop-filter: blur(0); } }
@keyframes pzBar { from { transform: scaleY(0); } }
@keyframes pzWord { from { opacity: 0; transform: translateX(80px); } }
@keyframes pzIn { from { opacity: 0; transform: translateX(-40px); } }
@keyframes pzSide { from { opacity: 0; transform: translateX(40px); } }
@keyframes pzBlink { 50% { opacity: 0.35; } }
@keyframes pzPing { from { transform: scale(1); opacity: 0.9; } to { transform: scale(2.8); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pz, .pz *, .pz::before { animation: none !important; transition: none !important; } }

/* narrower: run on top (small), menu below; phones: no slant, no key hints */
@media (max-width: 900px) {
  .pz { grid-template-columns: 1fr; align-content: start; gap: 18px; padding: 24px 18px 28px; }
  .pz-info { order: -1; }
  .pz-mapbox { display: none; }
  .pz-track { font-size: 28px; }
  .pz-tag { font-size: 32px; margin-bottom: 8px; }
  .pz-stats { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
}
@media (max-width: 480px) {
  .pz-stats b { font-size: 16px; }
  .pz-item .pz-in, .pz-item:focus .pz-in, .pz-item:focus-within .pz-in { transform: none; }
  .pz-item .pz-in > * { transform: none; }
  .pz-lbl { font-size: 17px; }
  .pz-item.primary .pz-lbl { font-size: 21px; }
}
@media (pointer: coarse) { .pz-keys, .pz-item kbd { display: none; } }
