/* Kiltorcan Driver Profiles — 1:1 with design/Main.dc.html and design/Leaderboard.dc.html.
   Values below are copied from the design; only content is swapped for real data. */
:root {
  --bg: #0B0B0D;
  --panel: #16161A;
  --hero: #141418;
  --chip: #232328;
  --line: #2B2B30;
  --nav: #111114;
  --watermark: #1F1F25;
  --bar: #34343B;
  --stripe: #4A4A52;
  --text: #F5F5F5;
  --muted: #B5B5BC;
  --dim: #6E6E76;
  --accent: #E10A1E;
  --accent-text: #EA5462; /* accent mixed 30% with white */
  --good: #3BD47A;
  --purple: #B57BFF;
  --purple-text: #C9A0FF;
  --silver: #C9CDD3;
  --bronze: #B98A5E;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: 'Titillium Web', 'Arial Narrow', sans-serif; -webkit-font-smoothing: antialiased; }
a { color: #FF5A66; }
a:hover { color: #FF8A93; }
button { font-family: inherit; }
.tab { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.app { max-width: 390px; margin: 0 auto; min-height: 100vh; padding-bottom: 100px; position: relative; overflow-x: hidden; background: var(--bg); }

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 8px; min-height: 68px; }
.wordmark { font-weight: 900; font-style: italic; font-size: 20px; letter-spacing: 1px; color: var(--text); text-decoration: none; }
.wordmark:hover { color: var(--text); }
.wordmark span { color: var(--accent-text); }
.wordmark img { display: block; height: 34px; width: auto; }
.icon-btn {
  width: 44px; height: 44px; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  display: flex; align-items: center; justify-content: center; cursor: pointer; transform: skewX(-12deg);
}
.icon-btn:hover { color: var(--text); }
.icon-btn svg { transform: skewX(12deg); }

/* Section heading with skewed accent tick */
.heading { display: flex; align-items: center; gap: 10px; }
.heading::before { content: ''; width: 6px; height: 22px; background: var(--accent); transform: skewX(-14deg); display: inline-block; }
.heading h2 { margin: 0; font-weight: 700; font-size: 15px; letter-spacing: 3px; }
.label { font-size: 12px; font-weight: 700; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; }
.slash { position: absolute; left: 0; top: 0; width: 150px; height: 100%; background: var(--accent); transform: skewX(-14deg); transform-origin: top left; opacity: 0.12; }

/* ---------- Profile ---------- */
.hero { position: relative; margin: 8px 0 0; height: 210px; background: var(--hero); border-top: 4px solid var(--accent); overflow: hidden; }
.hero-number { position: absolute; right: -10px; top: -28px; font-weight: 900; font-style: italic; font-size: 230px; line-height: 1; color: var(--watermark); letter-spacing: -8px; white-space: nowrap; user-select: none; }
.hero-number.n3 { font-size: 170px; top: 0; }
.hero-number.n4 { font-size: 130px; top: 30px; letter-spacing: -6px; }
.hero-number.n5 { font-size: 104px; top: 50px; letter-spacing: -4px; }
.hero-body { position: relative; padding: 22px 20px 0; display: flex; flex-direction: column; gap: 2px; }
.hero-tags { display: flex; align-items: center; gap: 10px; }
.chip-red { background: var(--accent); color: #FFFFFF; font-weight: 900; font-style: italic; font-size: 22px; padding: 0 10px; line-height: 32px; transform: skewX(-12deg); display: inline-block; }
.hero-code { font-weight: 700; font-size: 15px; letter-spacing: 3px; color: var(--muted); }
.first { margin-top: 12px; font-weight: 400; font-size: 26px; line-height: 1; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.last { margin: 0; font-weight: 900; font-size: 44px; line-height: 0.95; text-transform: uppercase; letter-spacing: -0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.last.long { font-size: 34px; line-height: 1.1; }
.hero-meta { margin-top: 10px; display: flex; gap: 14px; font-size: 14px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; white-space: nowrap; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; background: var(--bg); margin: 2px 0 0; }
.stat { background: var(--panel); padding: 14px 20px; min-width: 0; }
.stat .value { font-weight: 900; font-style: italic; font-size: 40px; line-height: 1.1; white-space: nowrap; }
.stat .value.small { font-size: 30px; line-height: 1.47; }
.stat .value.accent { color: var(--accent-text); }

.section { margin: 26px 20px 0; display: flex; flex-direction: column; gap: 10px; }
.section.first-section { margin-top: 20px; }

.pb { display: flex; align-items: baseline; justify-content: space-between; }
.pb-time { font-weight: 900; font-style: italic; font-size: 66px; line-height: 1; letter-spacing: -1px; }
.pb-delta { font-weight: 700; font-size: 16px; color: var(--good); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.tile { background: var(--panel); border-top: 4px solid var(--stripe); padding: 8px 10px; min-width: 0; }
.tile.green { border-top-color: var(--good); }
.tile.purple { border-top-color: var(--purple); }
.tile .v { font-weight: 700; font-size: 20px; white-space: nowrap; }
.tile.green .v { color: var(--good); }
.tile.purple .v { color: var(--purple-text); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--muted); font-weight: 600; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; display: inline-block; }

.bars { height: 130px; display: flex; align-items: flex-end; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.bar { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bar-label { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.bar-track { height: 100%; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.bar-fill { width: 100%; transform: skewX(-8deg); transform-origin: bottom; background: var(--bar); }
/* Pace bars grow one by one, oldest visit first; the label pops in as its bar lands. */
@media (prefers-reduced-motion: no-preference) {
  /* Bars wait flat until the chart scrolls into view (driver.js adds .in-view), then grow. */
  .bars:not(.in-view) .bar-fill { transform: skewX(-8deg) scaleY(0); }
  .bars:not(.in-view) .bar-label { opacity: 0; }
  .bars.in-view .bar-fill { animation: bar-grow 0.55s cubic-bezier(.2,.8,.3,1.05) both; animation-delay: calc(0.1s + var(--i, 0) * 0.09s); }
  .bars.in-view .bar-label { animation: fade-in 0.3s ease-out both; animation-delay: calc(0.4s + var(--i, 0) * 0.09s); }
}
@keyframes bar-grow { from { transform: skewX(-8deg) scaleY(0); } to { transform: skewX(-8deg) scaleY(1); } }
.bar.last .bar-fill { background: var(--accent); }

.results { display: flex; flex-direction: column; gap: 4px; }
.result { display: flex; align-items: center; gap: 12px; background: var(--panel); min-height: 56px; padding: 0 14px 0 0; }
.result-pos { width: 52px; align-self: stretch; display: flex; align-items: center; justify-content: center; font-weight: 900; font-style: italic; font-size: 22px; background: var(--chip); color: var(--text); flex: none; }
.result-pos.p1 { background: var(--accent); color: #FFFFFF; }
.result-main { flex: 1; min-width: 0; }
.result-title { font-weight: 700; font-size: 15px; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-time { font-weight: 700; font-size: 18px; }

.row-head { display: flex; justify-content: space-between; align-items: center; }

/* Racing badges: number-plate tiles with a chequered band, tier-coloured number circle, kerb stripe. */
.badge-count { font-size: 12px; font-weight: 600; letter-spacing: 1px; color: var(--muted); background: none; border: 0; padding: 8px 0 8px 8px; font-family: inherit; }
button.badge-count { cursor: pointer; color: var(--text); }
.badges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.badges[hidden] { display: none; }
.badge { position: relative; background: var(--panel); padding: 0 0 10px; text-align: center; overflow: hidden; clip-path: polygon(8% 0, 100% 0, 92% 100%, 0 100%); min-width: 0; }
.badge-chk { height: 8px; background: repeating-conic-gradient(#F5F5F5 0 25%, #0B0B0D 0 50%) 0 0 / 10px 10px; }
.badge-kerb { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: repeating-linear-gradient(90deg, #E10A1E 0 10px, #F5F5F5 10px 20px); }
.badge-num { margin: 8px auto 5px; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--tier); color: var(--tier-ink); border: 3px solid var(--bg); box-shadow: 0 0 0 2px var(--tier-ring, var(--tier)); }
.badge-num svg { width: 21px; height: 21px; }
.badge-name { font-weight: 900; font-style: italic; font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; line-height: 1.1; padding: 0 8px; }
.badge-detail { font-size: 11px; color: var(--muted); margin: 3px 6px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-rarity { display: inline-block; margin: 1px auto 4px; padding: 1px 7px; font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--tier-label, var(--tier)); background: #0B0B0D; transform: skewX(-10deg); white-space: nowrap; }
/* Lighter label shades so red and bronze stay readable on black. */
.tier-elite { --tier-label: var(--accent-text); }
.tier-bronze { --tier-label: #D08A4E; }
.badge.is-locked .badge-rarity { color: var(--dim); }
.badge.is-locked .badge-chk, .badge.is-locked .badge-kerb { opacity: 0.25; }
.badge.is-locked .badge-num { background: var(--chip); color: var(--dim); box-shadow: 0 0 0 2px var(--line); }
.badge.is-locked .badge-name { color: var(--dim); }
.locked-grid { margin-top: 4px; }
.tier-bronze { --tier: #A0602A; --tier-ring: #D08A4E; --tier-ink: #FFFFFF; }
.tier-silver { --tier: #C9CDD3; --tier-ink: #16161A; }
.tier-gold { --tier: #F2C14E; --tier-ink: #16161A; }
.tier-elite { --tier: #E10A1E; --tier-ink: #FFFFFF; }
.tier-progress { --tier: #3BD47A; --tier-ink: #0B0B0D; }
.tier-special { --tier: #B57BFF; --tier-ink: #FFFFFF; }
.next-up { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.next-row { display: flex; align-items: center; gap: 12px; background: var(--panel); padding: 10px 12px; }
.next-icon { width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--chip); color: var(--tier); transform: skewX(-10deg); }
.next-icon svg { width: 19px; height: 19px; transform: skewX(10deg); }
.next-main { flex: 1; min-width: 0; }
.next-name { font-weight: 700; font-size: 13px; letter-spacing: 0.5px; text-transform: uppercase; }
.next-bar { height: 6px; background: var(--chip); margin-top: 6px; overflow: hidden; }
.next-bar div { height: 100%; background: var(--accent); transform: skewX(-12deg); transform-origin: left; }
.next-text { font-weight: 700; font-size: 13px; color: var(--muted); white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
  .badges:not(.in-view) .badge { opacity: 0; }
  .badges.in-view .badge { animation: badge-pop 0.4s cubic-bezier(.2,.9,.3,1.3) both; animation-delay: calc(var(--i, 0) * 60ms); }
}
@keyframes badge-pop { from { opacity: 0; transform: scale(0.7) translateY(10px); } to { opacity: 1; transform: none; } }
.btn-small { min-height: 44px; padding: 0 14px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-family: inherit; font-weight: 700; font-size: 13px; letter-spacing: 1px; cursor: pointer; }
.share-card { background: var(--panel); padding: 14px; font-size: 14px; line-height: 1.35; color: var(--muted); }
.share-card b { color: var(--text); }

.cta { margin: 26px 20px 0; }
.cta-hint { margin: 0 0 12px; font-size: 15px; line-height: 1.35; color: var(--muted); }
.cta-hint b { color: var(--text); }

/* Progress chart: dots per visit, PB as a stepped line (faster = higher). */
.pg { border-bottom: 1px solid var(--line); }
.pg svg { display: block; width: 100%; height: auto; overflow: visible; }
.pg-grid { stroke: var(--line); stroke-dasharray: 3 4; }
.pg-line { fill: none; stroke: var(--good); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.pg-dot { fill: var(--stripe); }
.pg-dot.pb { fill: var(--good); }
.pg-dot.off { fill: none; stroke: var(--stripe); stroke-width: 1.5; }
.pg-gain { font-weight: 700; font-size: 15px; color: var(--good); }
.pg-axis { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12px; color: var(--dim); }
.pg-key { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.pg-key i { width: 14px; height: 3px; background: var(--good); }
@media (prefers-reduced-motion: no-preference) {
  .pg:not(.in-view) .pg-line { stroke-dasharray: 1; stroke-dashoffset: 1; }
  .pg:not(.in-view) .pg-dot { opacity: 0; }
  .pg.in-view .pg-line { stroke-dasharray: 1; animation: pg-draw 1.4s ease-out both; }
  .pg.in-view .pg-dot { animation: fade-in 0.3s ease-out both; animation-delay: min(calc(var(--i, 0) * 18ms), 1.2s); }
}
@keyframes pg-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.cta a { display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 0 22px; background: var(--accent); color: #FFFFFF; text-decoration: none; font-weight: 900; font-style: italic; font-size: 22px; letter-spacing: 1px; transform: skewX(-8deg); }

/* Bottom nav (fixed on real pages; the design pins it to the bottom of the frame) */
.nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 390px; height: 76px; background: var(--nav); border-top: 2px solid var(--accent); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); z-index: 10; }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 700; letter-spacing: 1px; }
.nav a[aria-current='page'] { color: var(--accent-text); }

/* ---------- Standings ---------- */
.band { position: relative; margin-top: 8px; background: var(--hero); border-top: 4px solid var(--accent); padding: 18px 20px 16px; overflow: hidden; }
.band .label { position: relative; font-size: 13px; letter-spacing: 3px; }
.band h1 { position: relative; margin: 2px 0 0; font-weight: 900; font-style: italic; font-size: 46px; line-height: 1; letter-spacing: -0.5px; }
.tabs { display: flex; gap: 6px; padding: 14px 20px 0; }
#tabs { gap: 5px; }
#tabs a { padding: 0 10px; }
.live-note { margin: 10px 20px 0; font-size: 13px; color: var(--muted); }
.tabs a { min-height: 44px; padding: 0 14px; display: flex; align-items: center; font-weight: 700; font-size: 13px; letter-spacing: 1px; text-decoration: none; transform: skewX(-10deg); background: var(--panel); color: #D8D8DD; border: 1px solid var(--line); white-space: nowrap; }
.tabs a[aria-current='true'] { background: var(--accent); color: #FFFFFF; border-color: var(--accent); }
.fastest { margin: 14px 20px 0; display: flex; align-items: stretch; background: var(--panel); min-height: 56px; text-decoration: none; color: var(--text); }
.fastest:hover { color: var(--text); }
.fastest::before { content: ''; width: 8px; background: var(--accent); flex: none; }
.fastest-main { flex: 1; min-width: 0; padding: 8px 14px; display: flex; flex-direction: column; justify-content: center; }
.fastest-main .label { color: var(--accent-text); }
.fastest-name { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fastest-time { display: flex; align-items: center; padding-right: 14px; font-weight: 900; font-style: italic; font-size: 24px; color: var(--accent-text); }
.tower-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 20px 6px; }
.toggle { display: flex; border: 1px solid var(--line); }
.toggle button { min-height: 36px; padding: 0 12px; font-weight: 700; font-size: 12px; letter-spacing: 1px; border: 0; cursor: pointer; background: var(--panel); color: var(--muted); }
.toggle button[aria-pressed='true'] { background: var(--text); color: var(--bg); }
.tower { margin: 0 20px; display: flex; flex-direction: column; gap: 2px; }
.tower-gap { height: 22px; display: flex; align-items: center; justify-content: center; color: var(--dim); font-weight: 900; letter-spacing: 4px; }
.trow { display: flex; align-items: center; gap: 10px; min-height: 48px; background: var(--panel); color: var(--text); text-decoration: none; }
.trow:hover { color: var(--text); background: #1C1C21; }
.trow-pos { width: 40px; align-self: stretch; display: flex; align-items: center; justify-content: center; font-weight: 900; font-style: italic; font-size: 20px; background: var(--chip); flex: none; }
.trow-stripe { width: 4px; height: 26px; background: var(--stripe); flex: none; }
.trow-code { width: 48px; font-weight: 900; font-size: 17px; letter-spacing: 1px; flex: none; }
.trow-name { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.trow-value { font-weight: 700; font-size: 17px; padding-right: 12px; }
.trow.me, .trow.me:hover { background: #FFFFFF; color: var(--bg); }
.trow.me .trow-pos { background: var(--accent); color: #FFFFFF; }
.trow.me .trow-name { color: #3A3A40; }
.tip { margin: 16px 20px 0; display: flex; align-items: center; gap: 10px; background: var(--panel); padding: 12px 14px; font-size: 14px; line-height: 1.35; color: var(--text); text-decoration: none; }
.tip:hover { color: var(--text); }
.tip svg { flex: none; }
.more-wrap { margin: 10px 20px 0; }
.more-wrap .btn-small { width: 100%; }

/* ---------- Title screen (home) ---------- */
.title-hero { height: auto; min-height: 250px; }
.title-hero .hero-number { color: var(--watermark); }
.title-hero .first { font-size: 30px; margin-top: 16px; }
.title-hero .last { font-size: 48px; white-space: normal; }
.title-lead { margin: 12px 0 22px; font-size: 16px; line-height: 1.35; color: var(--muted); max-width: 300px; }
.stat-sub { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-small.full { display: flex; align-items: center; justify-content: center; text-decoration: none; margin-top: 6px; }
.btn-small.full:hover { color: var(--text); }

/* ---------- Splash (start screen) ---------- */
.splash-body { background: #000; }
.splash { position: relative; isolation: isolate; background: var(--bg); max-width: 480px; margin: 0 auto; height: 100vh; height: 100svh; min-height: 560px; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; color: var(--text); }
/* The photo fills the top ~2/3 so the karts sit above the text block. */
.splash-photo { position: absolute; left: 0; top: 0; width: 100%; height: 68%; object-fit: cover; object-position: 50% 92%; transform-origin: 50% 85%; transform: scale(1.08); }
/* Full height so the zooming photo never peeks out below the fade. */
.splash-shade { position: absolute; inset: 0; background:
  linear-gradient(180deg, rgba(11,11,13,0.85) 0%, rgba(11,11,13,0.25) 14%, rgba(11,11,13,0) 25%, rgba(11,11,13,0) 49%, #0B0B0D 64%, #0B0B0D 100%); }
/* Side padding leaves room for the sound button so it never touches the logo. */
.splash-top { position: relative; padding: max(28px, env(safe-area-inset-top)) 76px 0; border-top: 4px solid var(--accent); }
.splash-sound { position: absolute; right: 16px; top: max(20px, env(safe-area-inset-top)); width: 40px; height: 40px; background: rgba(22,22,26,0.7); }
.splash-sound .snd-on, .splash-sound[aria-pressed='true'] .snd-off { display: none; }
.splash-sound[aria-pressed='true'] .snd-on { display: block; }
.splash-sound[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); }
.splash-logo { display: block; width: 100%; max-width: 270px; height: auto; margin: 0 auto; filter: drop-shadow(0 2px 10px rgba(0,0,0,0.5)); }
.splash-bottom { position: relative; padding: 0 24px max(32px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 2px; animation: splash-up 0.8s 0.2s ease-out both; }
.splash-tags { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
/* Sits over the photo, so it gets its own dark plate (grey text alone vanished into the karts). */
.splash-tags .hero-code { background: rgba(11,11,13,0.88); color: var(--text); padding: 0 12px; line-height: 32px; transform: skewX(-12deg); }
.splash-first, .splash-title { text-shadow: 0 2px 14px rgba(0,0,0,0.65); }
.splash-first { font-size: 30px; line-height: 1; text-transform: uppercase; }
.splash-title { margin: 0; font-weight: 900; font-style: italic; font-size: 52px; line-height: 0.95; text-transform: uppercase; letter-spacing: -0.5px; }
.splash-facts { margin: 12px 0 22px; font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0.5px; }
.splash-go { display: flex; align-items: center; justify-content: space-between; min-height: 62px; padding: 0 24px; background: var(--accent); color: #FFFFFF; text-decoration: none; font-weight: 900; font-style: italic; font-size: 24px; letter-spacing: 1px; transform: skewX(-8deg); }
.splash-go:hover { color: #FFFFFF; background: #F01428; }
.splash-go svg { transition: transform 0.2s; }
.splash-go:hover svg { transform: translateX(4px); }
.splash-link { margin-top: 14px; text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.splash-link:hover { color: var(--text); }
/* Camera tracking the karts: quick settle, then a slow sideways pan back and forth. */
@media (prefers-reduced-motion: no-preference) {
  .splash-photo { animation: splash-zoom 1.4s ease-out both, splash-pan 12s ease-in-out 1.4s infinite alternate; }
}
@keyframes splash-zoom { from { transform: scale(1.2) translateX(0); } to { transform: scale(1.08) translateX(2.5%); } }
@keyframes splash-pan { from { transform: scale(1.08) translateX(2.5%); } to { transform: scale(1.08) translateX(-2.5%); } }
@keyframes splash-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .splash-photo, .splash-bottom { animation: none; } }

/* ---------- Motion (all of it switched off for prefers-reduced-motion) ---------- */
.track-loader { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 20px; }
.track-base, .track-run { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.track-base { stroke: #2B2B30; stroke-width: 5; }
.track-run { stroke: var(--accent); stroke-width: 5; stroke-dasharray: 14 86; animation: lap-run 1.6s linear infinite; filter: drop-shadow(0 0 4px rgba(225,10,30,0.7)); }
@keyframes lap-run { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -100; } }

/* Start lights (splash): five reds light up one by one, then all go out and the button rolls in. */
.lights { display: flex; justify-content: center; gap: 10px; margin: 0 0 16px; }
.lights span { width: 46px; height: 22px; border-radius: 4px; background: #16161A; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.lights span::after { content: ''; width: 14px; height: 14px; border-radius: 50%; background: #2A0A0E; }

@media (prefers-reduced-motion: no-preference) {
  .lights span::after { animation: light-on var(--d) linear var(--s) forwards; }
  .lights { animation: lights-dim 0.4s ease-out 1.75s forwards; }
  .splash-go { opacity: 0; animation: go-in 0.35s cubic-bezier(.2,.9,.3,1.2) 1.65s forwards; }
  .splash-link { opacity: 0; animation: fade-in 0.4s ease-out 1.9s forwards; }

  .tower.enter .trow { animation: row-in 0.38s cubic-bezier(.2,.8,.3,1) both; animation-delay: calc(var(--i, 0) * 45ms); }
  .trow-value.flip { animation: flip 0.32s ease-out both; animation-delay: calc(var(--i, 0) * 25ms); }
  .stat, .tile { animation: fade-in 0.4s ease-out both; }
}
@media (prefers-reduced-motion: reduce) {
  .lights { display: none; }
  .track-run { animation: none; stroke-dasharray: none; }
}
@keyframes light-on {
  0%, 99% { background: #FF1E2E; box-shadow: 0 0 10px 2px rgba(255,30,46,0.8); }
  100% { background: #2A0A0E; box-shadow: none; }
}
@keyframes lights-dim { to { opacity: 0.35; } }
@keyframes go-in { from { opacity: 0; transform: skewX(-8deg) translateY(14px) scale(0.96); } to { opacity: 1; transform: skewX(-8deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes row-in { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes flip { from { transform: rotateX(90deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Kiltorcan Wrapped (story slides) ---------- */
.wr-body { background: #000; }
.wr { position: relative; max-width: 480px; margin: 0 auto; height: 100vh; height: 100svh; min-height: 600px; overflow: hidden; background: var(--bg); color: var(--text); border-top: 4px solid var(--accent); }
.wr-progress { position: absolute; left: 12px; right: 12px; top: max(10px, env(safe-area-inset-top)); z-index: 5; display: flex; gap: 4px; }
.wr-progress i { flex: 1; height: 4px; background: rgba(245,245,245,0.25); overflow: hidden; }
.wr-progress i b { display: block; height: 100%; width: 0; background: var(--text); }
.wr-progress i.done b { width: 100%; }
.wr-progress i.now b { animation: wr-fill var(--slide-ms, 5500ms) linear forwards; }
@keyframes wr-fill { from { width: 0; } to { width: 100%; } }
.wr-close { position: absolute; right: 10px; top: max(22px, calc(env(safe-area-inset-top) + 14px)); z-index: 6; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 34px; line-height: 1; color: var(--text); text-decoration: none; }
.wr-close:hover { color: var(--text); }
.wr-slides { position: absolute; inset: 0; }
.wr-slide { position: absolute; inset: 0; padding: 96px 28px 40px; display: flex; flex-direction: column; justify-content: center; gap: 14px; opacity: 0; pointer-events: none; }
.wr-slide.on { opacity: 1; pointer-events: auto; }
/* Stat slides get the track around them: a skewed colour band behind, a kerb along the bottom. */
.wr-slide:not(.wr-intro):not(.wr-card)::before { content: ''; position: absolute; left: -30%; top: 0; width: 75%; height: 100%; background: var(--wr-band, var(--accent)); opacity: 0.13; transform: skewX(-14deg); transform-origin: top left; pointer-events: none; }
.wr-slide:not(.wr-intro):not(.wr-card)::after { content: ''; position: absolute; left: -20px; right: -20px; bottom: 34px; height: 18px; background: repeating-linear-gradient(90deg, #E10A1E 0 36px, #F5F5F5 36px 72px); transform: skewX(-14deg); pointer-events: none; }
.wr-slide > * { position: relative; }
.wr-slide > .wr-photo, .wr-slide > .wr-shade, .wr-slide > .wr-logo { position: absolute; }
.wr-best { --wr-band: #B57BFF; }
.wr-faster { --wr-band: #3BD47A; }
.wr-day { --wr-band: #F2C14E; }
.wr-badge { --wr-band: #C9CDD3; }
.wr-tap { position: absolute; top: 70px; bottom: 0; z-index: 4; background: none; border: 0; cursor: pointer; }
.wr-prev { left: 0; width: 30%; }
.wr-next { right: 0; width: 70%; }
.wr-card-on .wr-tap { display: none; }
/* Photo on the top two thirds so the karts sit above the name, as on the start screen. */
.wr-photo { position: absolute; left: 0; top: 0; width: 100%; height: 68%; object-fit: cover; object-position: 50% 92%; }
.wr-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,11,13,0.8) 0%, rgba(11,11,13,0.1) 22%, rgba(11,11,13,0) 45%, #0B0B0D 66%, #0B0B0D 100%); }
.wr-logo { position: absolute; left: 28px; top: 70px; width: 62%; max-width: 280px; }
.wr-bottom { position: relative; margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.wr-tags { display: flex; gap: 8px; margin-bottom: 8px; }
.wr-plate { background: rgba(11,11,13,0.88); padding: 0 12px; line-height: 32px; font-weight: 700; letter-spacing: 3px; transform: skewX(-12deg); }
.wr-first { font-size: 30px; text-transform: uppercase; line-height: 1; }
.wr-last { font-weight: 900; font-size: 58px; line-height: 0.95; text-transform: uppercase; letter-spacing: -0.5px; overflow-wrap: anywhere; }
.wr-sub { margin-top: 10px; font-size: 17px; color: var(--muted); font-weight: 600; }
.wr-label { font-size: 14px; font-weight: 700; letter-spacing: 4px; color: var(--muted); }
.wr-giant { font-weight: 900; font-style: italic; font-size: 132px; line-height: 0.95; letter-spacing: -3px; }
.wr-time { font-weight: 900; font-style: italic; font-size: 84px; line-height: 1; letter-spacing: -2px; }
.wr-green { color: var(--good); }
.wr-line { font-size: 22px; line-height: 1.3; font-weight: 600; }
.wr-stat { display: flex; align-items: baseline; gap: 10px; background: var(--panel); padding: 14px 16px; font-size: 16px; color: var(--muted); font-weight: 600; }
.wr-stat b { font-weight: 900; font-style: italic; font-size: 30px; color: var(--text); }
.wr-badge { width: 70%; max-width: 260px; margin: 6px 0; }
.wr-badge .badge-num { width: 76px; height: 76px; }
.wr-badge .badge-num svg { width: 40px; height: 40px; }
.wr-badge .badge-name { font-size: 20px; }
.wr-card { width: auto; height: min(58svh, 520px); max-width: 100%; align-self: center; box-shadow: 0 0 0 2px var(--line); }
.wr-actions { display: flex; flex-direction: column; gap: 10px; }
.wr-share { display: flex; align-items: center; justify-content: center; min-height: 58px; width: 100%; border: 0; cursor: pointer; background: var(--accent); color: #fff; font-family: inherit; font-weight: 900; font-style: italic; font-size: 22px; letter-spacing: 1px; transform: skewX(-8deg); }
.wr-row { display: flex; gap: 6px; }
.wr-row .btn-small { flex: 1; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.wr-row .btn-small:hover { color: var(--text); }
@media (prefers-reduced-motion: no-preference) {
  .wr-slide.on .in { animation: wr-in 0.5s cubic-bezier(.2,.8,.3,1) both; animation-delay: calc(var(--d, 0) * 110ms + 80ms); }
  .wr-slide.on .wr-photo { animation: splash-zoom 1.4s ease-out both; }
}
@keyframes wr-in { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.wr-slide.on .wr-badge.in { transform-origin: center; }

/* Profile: link to the driver's Wrapped */
.wr-banner { display: flex; align-items: center; gap: 12px; background: var(--accent); color: #fff; text-decoration: none; padding: 14px 18px; font-weight: 900; font-style: italic; font-size: 18px; letter-spacing: 1px; transform: skewX(-8deg); }
.wr-banner:hover { color: #fff; }
.wr-banner small { font-style: normal; font-weight: 600; font-size: 13px; letter-spacing: 0.5px; opacity: 0.9; display: block; }
.wr-banner svg { margin-left: auto; flex: none; }

/* ---------- Search overlay (magnifier in the top bar) ---------- */
.search-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(11,11,13,0.82); backdrop-filter: blur(6px); }
.search-overlay[hidden] { display: none; }
.search-panel { max-width: 390px; margin: 0 auto; height: 100%; background: var(--bg); border-top: 4px solid var(--accent); padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.search-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.search-hits { margin: 0; }
@media (prefers-reduced-motion: no-preference) {
  .search-overlay:not([hidden]) .search-panel { animation: panel-in 0.25s cubic-bezier(.2,.8,.3,1); }
}
@keyframes panel-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }

/* ---------- Search ---------- */
.search { margin: 18px 20px 0; display: flex; flex-direction: column; gap: 8px; }
.search input { width: 100%; min-height: 52px; padding: 0 16px; background: var(--panel); color: var(--text); border: 1px solid var(--line); font: inherit; font-size: 18px; font-weight: 600; border-radius: 0; }
.search input:focus { outline: none; border-color: var(--text); }

.notice { margin: 24px 20px; color: var(--muted); font-size: 16px; }
.skeleton { background: var(--panel); height: 48px; margin: 4px 20px; }

/* ---------- Group race (/group) ---------- */
.band h1.long { font-size: 34px; line-height: 1.05; }
.gr-kinds button { min-height: 44px; padding: 0 14px; font-family: inherit; font-weight: 700; font-size: 13px; letter-spacing: 1px; transform: skewX(-10deg); background: var(--panel); color: #D8D8DD; border: 1px solid var(--line); cursor: pointer; white-space: nowrap; }
.gr-kinds button[aria-pressed='true'] { background: var(--accent); color: #FFFFFF; border-color: var(--accent); }
.gr-lead { margin: 14px 20px 0; font-size: 15px; line-height: 1.35; color: var(--muted); }
.gr-hint { margin: 0; font-size: 13px; color: var(--muted); }
.gr-day { display: flex; gap: 6px; }
.gr-day .btn-small { width: 48px; font-size: 22px; padding: 0; }
.gr-day .btn-small:disabled { opacity: 0.35; cursor: default; }
.gr-day input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; background: var(--panel); color: var(--text); border: 1px solid var(--line); font: inherit; font-size: 17px; font-weight: 700; border-radius: 0; color-scheme: dark; }
.gr-daylabel { letter-spacing: 1.5px; }
.gr-sessions { display: flex; flex-direction: column; gap: 4px; }
.gr-sess { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px 0 0; background: var(--panel); border: 0; border-left: 4px solid var(--stripe); color: var(--text); font-family: inherit; text-align: left; cursor: pointer; }
.gr-sess.some { border-left-color: var(--accent-text); }
.gr-sess.on { border-left-color: var(--accent); background: #FFFFFF; color: var(--bg); }
.gr-sess-time { width: 62px; align-self: stretch; display: flex; align-items: center; justify-content: center; font-weight: 900; font-style: italic; font-size: 17px; background: var(--chip); color: var(--text); flex: none; }
.gr-sess.on .gr-sess-time { background: var(--accent); color: #FFFFFF; }
.gr-sess-name { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr-sess-n { font-weight: 700; font-size: 14px; color: var(--muted); }
.gr-sess.on .gr-sess-n { color: #3A3A40; }
.gr-drivers { margin: 0; }
.gr-pick { cursor: pointer; position: relative; }
.gr-check { position: absolute; opacity: 0; width: 1px; height: 1px; }
.gr-pick:focus-within { outline: 2px solid var(--text); outline-offset: -2px; }
.gr-tick { font-style: normal; font-size: 18px; }
.gr-pick.on, .gr-pick.on:hover { background: #FFFFFF; color: var(--bg); }
.gr-pick.on .gr-tick { background: var(--accent); color: #FFFFFF; }
.gr-pick.on .trow-name, .gr-pick.on .gr-sub { color: #3A3A40; }
.gr-sub { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app.gr-picking { padding-bottom: 170px; }
.gr-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 76px; width: 100%; max-width: 390px; display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--nav); border-top: 1px solid var(--line); z-index: 9; }
.gr-count { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); }
.gr-count b { font-weight: 900; font-style: italic; font-size: 22px; color: var(--text); }
.gr-go { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 18px; background: var(--accent); color: #FFFFFF; border: 0; font-family: inherit; font-weight: 900; font-style: italic; font-size: 17px; letter-spacing: 1px; transform: skewX(-8deg); cursor: pointer; }
.gr-go:disabled { background: var(--chip); color: var(--dim); cursor: default; }
.gr-facts { display: flex; flex-direction: column; }
.gr-facts .tip { margin-top: 6px; }
.gr-facts .tip:first-child { margin-top: 16px; }
.gr-links { display: flex; gap: 6px; }
.gr-links .btn-small { flex: 1; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.gr-links .btn-small:hover { color: var(--text); }

/* ---------- Management dashboard (/admin) ---------- */
.ad { max-width: 1080px; margin: 0 auto; padding: 0 20px 48px; }
.ad-top { display: flex; align-items: center; gap: 14px; padding: 18px 0 10px; border-bottom: 4px solid var(--accent); }
.ad-top img { height: 32px; width: auto; }
.ad-tag { background: var(--chip); padding: 2px 10px; font-weight: 700; font-size: 12px; letter-spacing: 2px; transform: skewX(-10deg); }
.ad-login { max-width: 360px; margin: 48px auto 0; }
.ad-login .gr-go { margin-top: 8px; justify-content: center; }
.ad-error { margin: 0; color: var(--accent-text); font-weight: 700; }
.ad-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 22px; }
.ad-head h1 { margin: 2px 0 0; font-weight: 900; font-style: italic; font-size: 36px; line-height: 1; }
.ad-select { min-height: 44px; padding: 0 12px; background: var(--panel); color: var(--text); border: 1px solid var(--line); font: inherit; font-weight: 700; font-size: 15px; color-scheme: dark; }
.ad-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 4px; margin-top: 16px; }
.ad-kpi { background: var(--panel); border-top: 4px solid var(--stripe); padding: 12px 16px; color: var(--text); text-decoration: none; min-width: 0; }
.ad-kpi:first-child { border-top-color: var(--accent); }
a.ad-kpi { border-top-color: var(--accent); }
a.ad-kpi:hover { color: var(--text); background: #1C1C21; }
.ad-kpi-v { font-weight: 900; font-style: italic; font-size: 38px; line-height: 1.1; white-space: nowrap; }
.ad-kpi-s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-panel { background: var(--panel); padding: 16px 18px 14px; margin-top: 4px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ad-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 4px; }
.ad-grid .ad-panel { margin-top: 4px; }
.ad-note { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.ad-legend { margin-top: -4px; }
.ad-cols { display: flex; align-items: stretch; gap: 6px; height: 190px; }
.ad-weeks { height: 230px; }
.ad-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; outline: none; }
.ad-col:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.ad-col-v { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.ad-col.now .ad-col-v, .ad-col:hover .ad-col-v { color: var(--text); }
.ad-col-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.ad-stack { width: 100%; display: flex; flex-direction: column; gap: 2px; border-radius: 4px 4px 0 0; overflow: hidden; }
.ad-stack div { min-height: 0; }
.ad-col:not(.now) .ad-stack { opacity: 0.72; }
.ad-col:hover .ad-stack { opacity: 1; }
.ad-bar { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.ad-col.early .ad-bar { background: repeating-linear-gradient(135deg, #4A4A52 0 4px, transparent 4px 8px); min-height: 100%; opacity: 0.5; }
.ad-col-l { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.ad-hbars { display: flex; flex-direction: column; gap: 6px; }
.ad-hbar { display: grid; grid-template-columns: 120px 1fr 120px; align-items: center; gap: 10px; outline: none; }
.ad-hbar:focus-visible { outline: 2px solid var(--text); }
.ad-hbar-l { font-size: 13px; font-weight: 700; }
.ad-hbar-track { height: 18px; background: var(--chip); }
.ad-hbar-track div { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.ad-hbar-v { font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; }
.ad-return { display: flex; flex-direction: column; gap: 12px; }
.ad-big { display: flex; align-items: baseline; gap: 12px; }
.ad-big-v { font-weight: 900; font-style: italic; font-size: 46px; line-height: 1; color: var(--text); min-width: 140px; }
.ad-big-l { font-size: 15px; color: var(--muted); }
.ad-foot { margin: 16px 0 0; font-size: 12px; color: var(--dim); line-height: 1.5; }
.ad-tip { position: absolute; transform: translate(-50%, -100%); background: #F5F5F5; color: #0B0B0D; font-size: 13px; font-weight: 600; padding: 6px 10px; max-width: 240px; pointer-events: none; z-index: 60; }
.ad-tip[hidden] { display: none; }
@media (max-width: 560px) {
  .ad-head h1 { font-size: 28px; }
  .ad-cols { gap: 3px; }
  .ad-col-l { font-size: 9px; }
  .ad-col-v { font-size: 10px; }
  .ad-big-v { font-size: 36px; min-width: 110px; }
}

.ad-yoy { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; }
.ad-yoy-v { font-weight: 900; font-style: italic; font-size: 46px; line-height: 1; }
.ad-yoy-v.up { color: var(--good); }
.ad-yoy-v.down { color: var(--accent-text); }
.ad-big-l b { color: var(--text); }
.ad-col.early-soft .ad-bar { opacity: 0.45; }


/* Track staff tag next to a name (standings, search, group race, profile). */
.staff-tag { display: inline-block; margin-left: 8px; padding: 0 6px; font-size: 10px; font-weight: 700; font-style: normal; letter-spacing: 1px; line-height: 16px; vertical-align: 2px; color: #0B0B0D; background: var(--silver); transform: skewX(-10deg); white-space: nowrap; }
.hero-tags .staff-tag { margin-left: 0; font-size: 12px; line-height: 22px; }
.trow.me .staff-tag { background: #3A3A40; color: #FFFFFF; }

/* Weather: wet-track dots on the progress chart, best dry vs best wet lap. */
.pg-dot.wet { fill: #4DA3FF; }
.pg-wet-key { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; font-weight: 400; }
.pg-wet-key i { width: 8px; height: 8px; border-radius: 50%; background: #4DA3FF; }
.wd-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.wd { background: var(--panel); border-left: 4px solid #F2C14E; padding: 8px 12px; min-width: 0; }
.wd.wet { border-left-color: #4DA3FF; }
.wd-v { font-weight: 900; font-style: italic; font-size: 24px; line-height: 1.15; }
.wd-s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-wd { background: var(--bg); padding: 12px 16px; }
.ad-wd-v { display: flex; gap: 16px; font-weight: 900; font-style: italic; font-size: 30px; line-height: 1.2; }
.ad-wd-v .dry { color: #F2C14E; }
.ad-wd-v .wet { color: #4DA3FF; }

/* ---------- Me vs mate (/vs) ---------- */
.vs-me { margin: 14px 20px 0; background: var(--panel); border-left: 6px solid var(--accent); padding: 10px 14px; display: grid; grid-template-columns: 1fr auto; align-items: center; }
.vs-me .label { grid-column: 1 / -1; }
.vs-me-name { font-weight: 700; font-size: 18px; }
.vs-me-pb { font-weight: 900; font-style: italic; font-size: 22px; }
.vs-head { margin: 14px 20px 0; display: grid; grid-template-columns: 1fr 34px 1fr; align-items: stretch; gap: 0; }
.vs-card { background: var(--panel); padding: 12px 12px 10px; color: var(--text); text-decoration: none; min-width: 0; position: relative; overflow: hidden; }
.vs-card:hover { color: var(--text); background: #1C1C21; }
.vs-card.a { border-top: 5px solid var(--accent); }
.vs-card.b { border-top: 5px solid var(--silver); text-align: right; }
.vs-card .staff-tag { margin: 4px 0 0; }
.vs-code { font-weight: 900; font-size: 30px; line-height: 1; letter-spacing: 1px; }
.vs-card.a .vs-code { color: var(--accent-text); }
.vs-first { margin-top: 8px; font-size: 14px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.vs-last { font-weight: 900; font-size: 20px; line-height: 1.05; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vs-pb { margin-top: 8px; font-weight: 900; font-style: italic; font-size: 26px; line-height: 1; }
.vs-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.vs-mid { display: flex; align-items: center; justify-content: center; font-weight: 900; font-style: italic; font-size: 16px; color: var(--bg); background: var(--text); transform: skewX(-10deg); margin: 34px 2px; }
.vs-score { margin: 4px 20px 0; background: var(--hero); padding: 12px 14px; text-align: center; }
.vs-score-v { display: flex; justify-content: center; align-items: baseline; gap: 14px; font-weight: 900; font-style: italic; font-size: 64px; line-height: 1; margin-top: 6px; }
.vs-score-v span { color: var(--dim); }
.vs-score-v .a.lead { color: var(--accent-text); }
.vs-score-v .b.lead { color: var(--silver); }
.vs-score-v i { color: var(--dim); font-size: 40px; }
.vs-none { margin: 4px 20px 0; background: var(--hero); padding: 14px; font-size: 15px; color: var(--muted); text-align: center; }
.vs-rows { display: flex; flex-direction: column; gap: 2px; }
.vs-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 44px; background: var(--panel); padding: 0 12px; gap: 8px; }
.vs-l { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); text-align: center; }
.vs-v { font-weight: 700; font-size: 17px; color: var(--muted); }
.vs-v.b { text-align: right; }
.vs-v.win { color: var(--text); font-weight: 900; }
.vs-v.a.win { color: var(--accent-text); }
.vs-days { display: flex; flex-direction: column; gap: 2px; }
.vs-day { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; min-height: 48px; background: var(--panel); padding: 0 12px; }
.vs-day-mid { text-align: center; font-size: 12px; color: var(--muted); line-height: 1.3; }
.vs-day-mid div:first-child { color: var(--text); font-weight: 700; }
.vs-day-t { font-weight: 700; font-size: 16px; color: var(--muted); }
.vs-day-t.b { text-align: right; }
.vs-day-t.win { color: var(--text); font-weight: 900; }
.vs-day-t.a.win { color: var(--accent-text); }

/* Weather icons: sun (dry, clear), cloud (dry, cloudy), rain (wet track). */
.wx { display: inline-flex; vertical-align: -3px; }
.wx svg { display: block; }
.wx.sun { color: #F2C14E; }
.wx.cloud { color: var(--muted); }
.wx.rain { color: #4DA3FF; }
.wx-bit { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.wx-bit .wx { vertical-align: 0; }
.wd-l { display: flex; align-items: center; gap: 6px; }

/* Top bar buttons */
.topbar-btns { display: flex; gap: 8px; }
.nav a { font-size: 11px; white-space: nowrap; }

/* ---------- Side menu (drawer, slides in from the right) ---------- */
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer[hidden] { display: none; }
.drawer-shade { position: absolute; inset: 0; background: rgba(11,11,13,0.7); backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.25s ease; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(86vw, 360px); background: var(--bg); border-left: 4px solid var(--accent);
  display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 22px; overflow-y: auto; overflow-x: hidden;
  transform: translateX(100%); transition: transform 0.28s cubic-bezier(.2,.8,.3,1); box-shadow: -20px 0 40px rgba(0,0,0,0.5); }
.drawer.open .drawer-shade { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
.drawer-slash { position: absolute; right: -60px; top: 0; width: 180px; height: 100%; background: var(--accent); opacity: 0.07; transform: skewX(-14deg); pointer-events: none; }
.drawer-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.drawer-head img { width: 190px; height: auto; display: block; }
.drawer-nav { position: relative; display: flex; flex-direction: column; gap: 4px; }
.drawer-item, .drawer-call { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 8px 12px; background: var(--panel); color: var(--text); text-decoration: none; position: relative; }
.drawer-item:hover, .drawer-item:focus-visible, .drawer-call:hover { color: var(--text); background: #1C1C21; outline: none; }
.drawer-item[aria-current='page']::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.drawer-ico { width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--chip); color: var(--accent-text); transform: skewX(-10deg); }
.drawer-ico svg { transform: skewX(10deg); }
.drawer-item[aria-current='page'] .drawer-ico { background: var(--accent); color: #FFFFFF; }
.drawer-text { display: flex; flex-direction: column; min-width: 0; }
.drawer-title { font-weight: 900; font-style: italic; font-size: 19px; text-transform: uppercase; letter-spacing: 0.5px; line-height: 1.1; }
.drawer-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-book { position: relative; display: flex; align-items: center; justify-content: space-between; min-height: 56px; margin: 10px 4px 0; padding: 0 20px; background: var(--accent); color: #FFFFFF; text-decoration: none; font-weight: 900; font-style: italic; font-size: 19px; letter-spacing: 1px; transform: skewX(-8deg); }
.drawer-book:hover { color: #FFFFFF; background: #C00818; }
.drawer-contact { position: relative; margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; gap: 6px; }
.drawer-call { border-left: 4px solid var(--good); }
.drawer-call .drawer-ico { color: var(--good); }
.drawer-links { display: flex; gap: 4px; }
.drawer-links a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; background: var(--panel); color: var(--text); text-decoration: none; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-links a:hover { color: var(--text); background: #1C1C21; }
.drawer-links svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.drawer-address { font-size: 12px; color: var(--dim); }
@media (prefers-reduced-motion: no-preference) {
  .drawer.open .drawer-item, .drawer.open .drawer-book, .drawer.open .drawer-contact { animation: drawer-in 0.35s cubic-bezier(.2,.8,.3,1) both; animation-delay: calc(0.08s + var(--i, 0) * 40ms); }
}
@media (prefers-reduced-motion: reduce) {
  .drawer-panel, .drawer-shade { transition: none; }
}
@keyframes drawer-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.drawer.open .drawer-book { animation-name: drawer-in-book; }
@keyframes drawer-in-book { from { opacity: 0; transform: translateX(24px) skewX(-8deg); } to { opacity: 1; transform: skewX(-8deg); } }

/* Menu button: "speed lines" (longest on top, red in the middle); they even out on hover and
   turn into a cross while the menu is open. */
.hb { position: relative; padding: 0; }
.hb span { position: absolute; left: 10px; height: 3px; background: var(--text); transition: transform 0.28s cubic-bezier(.2,.8,.3,1), width 0.28s cubic-bezier(.2,.8,.3,1), opacity 0.2s; }
.hb span:nth-child(1) { top: 13px; width: 24px; }
.hb span:nth-child(2) { top: 20px; width: 17px; background: var(--accent); }
.hb span:nth-child(3) { top: 27px; width: 10px; }
.hb:hover span, .hb:focus-visible span { width: 24px; }
.hb.x span:nth-child(1) { width: 24px; transform: translateY(7px) rotate(45deg); }
.hb.x span:nth-child(2) { opacity: 0; transform: translateX(10px); }
.hb.x span:nth-child(3) { width: 24px; transform: translateY(-7px) rotate(-45deg); }
@media (prefers-reduced-motion: reduce) { .hb span { transition: none; } }

/* ---------- Hall of fame (/records) ---------- */
.rec-now { position: relative; display: block; margin: 14px 20px 0; padding: 14px 16px 16px; background: var(--panel); border-left: 8px solid var(--accent); color: var(--text); text-decoration: none; overflow: hidden; }
.rec-now:hover { color: var(--text); background: #1C1C21; }
.rec-now .label { color: var(--accent-text); }
.rec-now-time { font-weight: 900; font-style: italic; font-size: 64px; line-height: 1; letter-spacing: -1px; color: var(--accent-text); margin-top: 4px; }
.rec-now-name { margin-top: 8px; font-weight: 900; font-size: 22px; text-transform: uppercase; }
.rec-now-sub { font-size: 14px; color: var(--muted); }
.rec-line { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.rec-step { position: relative; }
.rec-step::before { content: ''; position: absolute; left: -21px; top: 22px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--stripe); }
.rec-step.now::before { background: var(--accent); border-color: var(--accent); }
.rec-step a { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 12px; background: var(--panel); color: var(--text); text-decoration: none; }
.rec-step a:hover { color: var(--text); background: #1C1C21; }
.rec-step-time { width: 92px; flex: none; font-weight: 900; font-style: italic; font-size: 20px; }
.rec-step.now .rec-step-time { color: var(--accent-text); }
.rec-step-main { flex: 1; min-width: 0; }
.rec-step-name, .rec-month-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-step-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-months { display: flex; flex-direction: column; gap: 2px; }
.rec-month { display: flex; align-items: center; gap: 12px; min-height: 52px; background: var(--panel); color: var(--text); text-decoration: none; padding-right: 12px; }
.rec-month:hover { color: var(--text); background: #1C1C21; }
.rec-month-l { width: 56px; align-self: stretch; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--chip); line-height: 1.1; }
.rec-month-l b { font-weight: 900; font-style: italic; font-size: 16px; }
.rec-month-l span { font-size: 11px; color: var(--muted); }
.rec-month-main { flex: 1; min-width: 0; }
.rec-month-time { font-weight: 700; font-size: 17px; }

/* Claim profile (on the driver profile) */
.claim-open { width: calc(100% - 40px); border: 0; font: inherit; text-align: left; cursor: pointer; }
.claim { margin: 6px 20px 0; background: var(--hero); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.claim[hidden] { display: none; }
.claim-text { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.4; }
.claim-pick { width: 100%; border: 0; font: inherit; text-align: left; cursor: pointer; }
.claim-done { margin: 0; font-size: 14px; font-weight: 700; color: var(--good); }
.claim-done[hidden] { display: none; }

.ad-dups { display: flex; flex-direction: column; gap: 6px; }
.ad-dup { background: var(--bg); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.ad-dup.done { opacity: 0.55; }
.ad-dup-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ad-dup-kind { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; padding: 1px 8px; background: var(--chip); color: var(--muted); transform: skewX(-10deg); }
.ad-dup-kind.claim { background: var(--accent); color: #FFFFFF; }
.ad-dup-warn { font-size: 12px; font-weight: 700; color: #F2C14E; }
.ad-dup-pair { display: grid; grid-template-columns: 1fr 24px 1fr; align-items: center; gap: 6px; }
.ad-dup-side { background: var(--panel); padding: 8px 10px; color: var(--text); text-decoration: none; min-width: 0; }
.ad-dup-side:hover { color: var(--text); background: #1C1C21; }
.ad-dup-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-dup-arrow { text-align: center; font-weight: 900; color: var(--muted); }
.ad-dup-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ad-dup-join { min-height: 40px; font-size: 15px; }
.ad-dup-status { font-size: 13px; font-weight: 700; color: var(--good); }

/* ---------- Gift a rematch (profile) + challenge page (/challenge/:id) ---------- */
.ch-send { width: 100%; justify-content: space-between; }
.ch-voucher { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 8px 12px; background: var(--panel); border-left: 4px solid #F2C14E; color: var(--text); text-decoration: none; }
.ch-voucher:hover { color: var(--text); background: #1C1C21; }
.ch-voucher .drawer-ico { color: #F2C14E; }
.ch-card { position: relative; margin: 14px 20px 0; padding: 18px 16px 16px; background: var(--hero); border-top: 4px solid var(--accent); text-align: center; overflow: hidden; }
.ch-q { font-weight: 700; font-size: 20px; color: var(--muted); }
.ch-time { font-weight: 900; font-style: italic; font-size: 70px; line-height: 1; letter-spacing: -2px; margin-top: 6px; }
.ch-who { margin-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text); text-decoration: none; font-weight: 900; font-size: 20px; text-transform: uppercase; }
.ch-who:hover { color: var(--text); }
.ch-who-sub { font-weight: 400; font-size: 13px; text-transform: none; color: var(--muted); }
.ch-alt { margin: 12px 20px 0; display: flex; flex-direction: column; gap: 6px; }

/* ---------- Laptop / wide screens (960 px and up). Phones keep the design as it is. ---------- */
.topnav { display: none; }
@media (min-width: 960px) {
  .app { max-width: 920px; padding-bottom: 48px; }
  .app.app-wide { max-width: 1180px; }
  .nav { display: none; }
  .topbar { gap: 24px; padding: 18px 28px 10px; }
  .topnav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
  .topnav a { padding: 8px 10px; color: var(--muted); text-decoration: none; font-weight: 700; font-size: 14px; letter-spacing: 0.5px; text-transform: uppercase; white-space: nowrap; border-bottom: 2px solid transparent; }
  .topnav a:hover { color: var(--text); }
  .topnav a[aria-current='page'] { color: var(--text); border-bottom-color: var(--accent); }
  .topnav a.topnav-book { margin-left: 8px; padding: 8px 18px; background: var(--accent); color: #FFFFFF; font-style: italic; font-weight: 900; transform: skewX(-10deg); border: 0; }
  .topnav a.topnav-book:hover { background: #C00818; }
  .topbar-btns .hb { display: none; }
  .gr-bar { bottom: 0; max-width: 1180px; }
  .app.gr-picking { padding-bottom: 100px; }
  /* Two columns: profile and standings arrange themselves (driver.js / standings.js). */
  .cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; align-items: start; padding: 0 8px; }
  .cols > div { min-width: 0; }
  .cols.side { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .trow-day { display: block !important; }
}
.trow-day { display: none; font-size: 13px; color: var(--dim); white-space: nowrap; padding-right: 4px; }

/* Google review ask after a new PB or a first visit */
.review-ask { margin-top: 22px; background: linear-gradient(100deg, rgba(59,212,122,0.16), var(--panel) 60%); border-left: 4px solid var(--good); padding: 16px 18px 18px; }
.review-stars { margin-bottom: -4px; color: #F2C14E; font-size: 20px; letter-spacing: 3px; line-height: 1; }
.review-title { font-weight: 900; font-style: italic; font-size: 22px; letter-spacing: 1px; }
.review-text { margin: 0 0 4px; font-size: 15px; line-height: 1.4; color: var(--muted); }
.review-text b { color: var(--good); }
.review-btn { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 18px; background: #F5F5F5; color: #0B0B0D; text-decoration: none; font-weight: 900; font-style: italic; font-size: 17px; letter-spacing: 1px; transform: skewX(-8deg); }
.review-btn:hover { color: #0B0B0D; background: #FFFFFF; }

/* Dashboard: ready-made social posts */
.ad-posts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.ad-post { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ad-post-t { font-weight: 900; font-style: italic; font-size: 20px; letter-spacing: 1px; }
.ad-post img { width: 100%; height: auto; display: block; box-shadow: 0 0 0 1px var(--line); }
.ad-post-btns { display: flex; gap: 6px; }
.ad-post-btns .btn-small { flex: 1; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.ad-caption { width: 100%; resize: vertical; background: var(--bg); color: var(--muted); border: 1px solid var(--line); padding: 10px 12px; font: 600 13px/1.45 inherit; font-family: inherit; }
