#track { background: #a7cfcb; }
.daily-race-hud { position:absolute; z-index:3; top:82px; right:12px; width:min(330px,calc(100% - 24px)); display:grid; grid-template-columns:auto minmax(0,1fr); gap:16px; padding:8px 12px; border:1px solid #325346; border-radius:8px; background:#10241eeb; color:#f7fbf9; pointer-events:none; }
.daily-race-hud > div { min-width:0; display:flex; flex-direction:column; gap:4px; }
.daily-race-hud > div > span { color:#9ec4b4; font-size:9px; font-weight:800; }
.daily-race-hud strong { display:flex; gap:8px; font-size:12px; font-variant-numeric:tabular-nums; white-space:nowrap; }
.daily-race-leader strong { justify-content:flex-end; }
.daily-race-leader > span { text-align:right; }
#daily-race-name { overflow:hidden; text-overflow:ellipsis; }
#daily-race-time { flex-shrink:0; color:#70efb9; }
.daily-race-hud[data-stale="true"] { border-color:#92734a; }
.spectating .daily-race-hud { display:none; }
@media(max-width:650px) {
 .daily-race-hud { top:70px; left:8px; right:8px; width:auto; padding:7px 9px; gap:10px; }
 body:not(.spectating) .verification-state { top:122px; }
 body:not(.spectating) .game-shell .notice { top:158px; }
 body:not(.spectating) .game-shell .sector-time { top:196px; }
}
@media (pointer:coarse) and (orientation:landscape), (max-width:900px) and (max-height:500px) and (orientation:landscape) {
 .daily-race-hud { top:calc(76px + env(safe-area-inset-top)); left:auto; right:max(12px,env(safe-area-inset-right)); width:330px; }
 body:not(.spectating) .verification-state { top:126px; }
}
#track.sauna-view { cursor: grab; }
#track.sauna-view.looking { cursor: grabbing; }
#track.sauna-view.steam-target:not(.looking) { cursor: pointer; }
/* Keep simultaneous steering and pedal touches from becoming browser gestures. */
.app { touch-action: none; }
body { overscroll-behavior: none; }
dialog { touch-action: pan-y pinch-zoom; }
.controls { position: relative; flex-wrap: wrap; }
.wheel-controls { flex: 0 0 100%; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.wheel-controls button { min-height: 44px; padding: 6px 12px; border: 1px solid #566f65; border-radius: 8px; background: #10251f; color: #e9fff2; font: 700 12px sans-serif; touch-action: manipulation; }
.wheel-controls button[aria-pressed="true"] { border-color: #55df92; background: #21613f; }
.wheel-controls button:focus-visible { outline: 2px solid #eac958; outline-offset: 3px; }
#cockpit { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.notice { z-index: 5; }
.start-lights { position:absolute; z-index:6; top:25%; left:50%; transform:translateX(-50%); padding:14px 22px 12px; border:1px solid #62736a; border-radius:14px; background:linear-gradient(#202925f5,#0b100ef5); box-shadow:0 12px 36px #0009; text-align:center; pointer-events:none; }
.start-lights[hidden] { display:none; }
.start-lights-row { display:flex; gap:12px; }
.start-lights-row span { width:clamp(34px,6vw,54px); aspect-ratio:1; border:3px solid #090d0b; border-radius:50%; background:#30211f; box-shadow:inset 0 3px 7px #000b; }
.start-lights strong { display:block; margin-top:10px; color:#f3f8f5; font-size:12px; letter-spacing:.15em; text-transform:uppercase; }
.start-lights[data-phase="red"] span { animation:start-red .15s ease-out both; }
.start-lights[data-phase="red"] span:nth-child(2) { animation-delay:.4s; }
.start-lights[data-phase="red"] span:nth-child(3) { animation-delay:.8s; }
.start-lights[data-phase="green"] span { background:#22ef9a; box-shadow:0 0 18px #13e78a99,inset 0 2px 5px #d6ffdd99; }
.start-lights[data-phase="green"] strong { color:#65ffb6; }
@keyframes start-red { from { background:#30211f; } to { background:#ff493e; box-shadow:0 0 18px #ff3b3299,inset 0 2px 5px #ffd0bf99; } }
@media(prefers-reduced-motion:reduce) { .start-lights[data-phase="red"] span { animation-duration:0s; } }
.sector-time { position:absolute; z-index:5; top:112px; left:50%; transform:translateX(-50%); padding:7px 12px; border:1px solid #566f65; border-radius:8px; background:#10221dee; color:#fff; font:700 12px sans-serif; white-space:nowrap; pointer-events:none; }
.sector-time[hidden] { display:none; }
.sector-time.faster { color:#8df3c2; }
.sector-time.slower { color:#ffb3a8; }
#restart-button { flex-shrink: 0; min-width: 44px; min-height: 44px; touch-action: manipulation; }
#leaderboard-button { flex-shrink:0; min-width:44px; min-height:44px; margin-left:0; }
#settings-dialog .dialog-head { position:sticky; top:-26px; z-index:1; align-items:center; margin-top:-26px; padding:16px 0; background:#0d2119; border-bottom:1px solid #355347; }
#settings-dialog .dialog-head h2 { margin:0; font-size:clamp(24px, 6vw, 34px); }
#settings-dialog .close { display:flex; align-items:center; gap:8px; flex-shrink:0; min-height:44px; padding:10px 12px; font-size:13px; line-height:1.2; touch-action:manipulation; }
#settings-dialog .close span { display:inline; margin:0; font-size:24px; line-height:1; }
.leaderboard-panel { margin-top:16px; }
.leaderboard-panel h2 { margin-top:0; }
.leaderboard-panel input { display:block; width:100%; margin:8px 0; padding:10px; border:1px solid #355347; border-radius:8px; background:#10221d; color:#fff; font:inherit; }
.leaderboard-panel p { font-size:12px; line-height:1.5; }
.leaderboard-panel button { min-height:44px; padding:8px 12px; border:1px solid #355347; border-radius:8px; background:#10221d; color:#fff; }
.leaderboard-panel li { padding:6px 0; }
@media(max-width:440px) { .topbar-title { display:none; } }
.telemetry { position: absolute; z-index: 2; right: 16px; bottom: 46px; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; color: #fff; text-shadow: 0 2px 6px #000; }
.telemetry strong { font: 800 25px/1 'Barlow Condensed', Impact, sans-serif; }
.telemetry span { color: #8df3c2; font-size: 10px; font-weight: 800; letter-spacing: .1em; }
@media (max-width: 650px) {
  .game-shell { aspect-ratio: 4 / 5; }
  .telemetry { right: 10px; bottom: 34px; }
  .telemetry strong { font-size: 20px; }
  .telemetry span { font-size: 8px; }
}
.sauna-actions { position:absolute; z-index:3; left:12px; bottom:46px; display:flex; flex-wrap:wrap; align-items:center; gap:8px; max-width:65%; }
.sauna-actions span { flex-basis:100%; font-size:12px; color:#fff; text-shadow:0 2px 4px #000; }
.sauna-actions button { padding:10px 12px; border:1px solid #b89465; border-radius:8px; background:#382719ee; color:#fff; font-weight:700; }
.sauna-actions button:disabled { opacity:.55; cursor:default; }
.sauna-actions [hidden] { display:none; }
.sauna-dialogue { position:absolute; z-index:3; top:76px; left:50%; transform:translateX(-50%); max-width:min(650px,85%); padding:10px 16px; border-radius:10px; background:#21180feb; color:#fff3df; font-size:14px; line-height:1.4; text-align:center; pointer-events:none; }
.sauna-dialogue[hidden] { display:none; }
.sauna-actions button[aria-pressed="true"] { background:#665032; }
@media(max-width:650px) { .sauna-dialogue { top:58px; font-size:12px; padding:8px 12px; } }
@media(max-width:650px) { .sauna-actions { bottom:34px; max-width:60%; gap:4px; } .sauna-actions span { font-size:10px; } .sauna-actions button { padding:8px; font-size:11px; } }

/* Landscape phones use the whole viewport for driving, with thumb controls overlaid. */
@media (pointer:coarse) and (orientation:landscape), (max-width:900px) and (max-height:500px) and (orientation:landscape) {
  .app { position:relative; width:100%; max-width:none; height:100dvh; padding:0; gap:0; }
  .help, .game-footer, .telemetry,
  .sauna-dialogue, .wheel-controls { display:none; }
  .topbar { display:flex; position:absolute; z-index:6; top:max(8px,env(safe-area-inset-top)); right:max(12px,env(safe-area-inset-right)); height:auto; pointer-events:none; }
  .topbar > :not(#restart-button):not(#leaderboard-button):not(#sound-button) { display:none; }
  #sound-button { pointer-events:auto; margin:0; background:#10221dee; }
  #leaderboard-button { pointer-events:auto; background:#10221dee; }
  #restart-button { pointer-events:auto; margin:0; background:#10221dee; }
  #restart-button span { display:inline; }
  .hud { left:max(12px,env(safe-area-inset-left)); right:auto; top:max(8px,env(safe-area-inset-top)); width:calc(100% - 294px - env(safe-area-inset-left) - env(safe-area-inset-right)); max-width:360px; border:1px solid #325346; border-radius:8px; }
  .hud-item:not(.wide) { display:none; }
  .hud-item.wide { flex:1; min-width:0; padding:6px 10px; }
  .hud-item strong { font-size:20px; }
  .notice { display:block; top:calc(104px + env(safe-area-inset-top)); width:max-content; max-width:80%; white-space:normal; }
  .sector-time { top:calc(64px + env(safe-area-inset-top)); }
  .game-shell { position:absolute; inset:0; width:100%; height:100%; min-height:0; border:0; border-radius:0; box-shadow:none; }
  .controls { position:absolute; z-index:4; left:0; right:0; bottom:0; margin:0; padding:0 max(12px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left)); height:96px; flex-wrap:nowrap; align-items:stretch; justify-content:space-between; pointer-events:none; }
  .steering { display:flex; flex:0 1 220px; min-width:0; max-width:40%; gap:10px; pointer-events:none; }
  .steering .control { pointer-events:auto; flex:1; min-width:0; height:100%; min-height:0; background:#15392bcc; box-shadow:none; }
  .steering .control.active { background:#235844; }
  .pedals { flex:0 1 220px; max-width:34%; gap:10px; pointer-events:none; }
  .pedals .control { pointer-events:auto; min-height:0; height:100%; background:#48231eb3; box-shadow:none; }
  .pedals .gas { background:#087c57b3; }
  .pedals .brake.active { background:#713328; }
  .pedals .gas.active { background:#05a772; }
}

@media (pointer:coarse) and (orientation:landscape), (max-width:900px) and (max-height:500px) and (orientation:landscape) {
  .sauna-actions { display:flex; left:max(12px,env(safe-area-inset-left)); right:max(12px,env(safe-area-inset-right)); bottom:calc(106px + env(safe-area-inset-bottom)); max-width:none; justify-content:center; gap:6px; }
  .sauna-actions span, #sauna-sound { display:none; }
  .sauna-actions button { min-height:44px; padding:8px 12px; font-size:12px; }
}

/* Competition entry: standings and the driver form. */
#settings-dialog { width:min(780px,calc(100% - 32px)); max-height:92dvh; padding:28px; border:1px solid #34564e; border-radius:22px; background:radial-gradient(ellipse at 50% 0%,#19352d 0%,#0b1916 58%); box-shadow:0 32px 100px #000c; }
#settings-dialog [hidden] { display:none; }
#settings-dialog::backdrop { background:#020807d9; backdrop-filter:blur(8px); }
#settings-dialog .dialog-head { position:static; margin:0; padding:0; background:none; border:0; align-items:center; justify-content:space-between; }
#settings-dialog .dialog-head h2 { margin:7px 0 0; font-size:clamp(32px,5vw,46px); line-height:1.05; letter-spacing:.01em; }
.race-eyebrow { margin:0; color:#63cda7; font-size:10px; font-weight:800; letter-spacing:.18em; }
#settings-dialog .close { background:#10251e; border-color:#35574c; }
.leaderboard-panel { margin-top:0; }
.leaderboard-entry-grid { display:grid; grid-template-columns:minmax(0,1.15fr) minmax(0,1fr); gap:24px; border-top:1px solid #304a3f; padding-top:20px; }
.standings-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.standings-heading h3 { margin:0; color:#9fbeb0; font-size:11px; letter-spacing:.18em; }
.leaderboard-panel #leaderboard-refresh { width:32px; height:32px; min-height:32px; padding:0; background:none; color:#a9cbbb; font-size:22px; border:0; border-radius:7px; }
#leaderboard-list { margin:8px 0 0; padding:0 0 0 26px; max-height:248px; overflow:auto; scrollbar-width:thin; scrollbar-color:#355b49 transparent; }
#leaderboard-list li { padding:8px 7px; border-bottom:1px solid #233d31; font-size:13px; font-variant-numeric:tabular-nums; }
#leaderboard-list li::marker { color:#769989; font-weight:700; }
#leaderboard-list li:first-child { color:#f5ce72; font-weight:800; }
.leaderboard-start-form { align-self:start; margin:0; padding:20px; border:1px solid #35584a; border-radius:14px; background:#16342666; }
.leaderboard-start-form .race-eyebrow { margin:0; font-size:9px; }
.leaderboard-start-form h3 { margin:8px 0 20px; font-size:23px; color:#f2fff7; }
.leaderboard-start-form label { color:#aec9bb; font-size:12px; font-weight:700; }
.leaderboard-panel input { margin:7px 0 12px; min-height:46px; width:100%; box-sizing:border-box; border-color:#4a7662; background:#081a13; font-size:16px; }
.leaderboard-panel input:focus { outline:2px solid #63d6a3; outline-offset:2px; }
.leaderboard-panel .leaderboard-start { display:flex; align-items:center; justify-content:space-between; width:100%; min-height:48px; padding:12px 16px; background:#78e4ac; color:#082115; border:0; border-radius:9px; font-weight:900; }
.leaderboard-panel .leaderboard-start:hover { background:#9cefc2; }
.leaderboard-start span { font-size:22px; }
#leaderboard-status { margin:12px 0 0; color:#9cb9aa; font-size:12px; line-height:1.5; }
#leaderboard-status:empty { display:none; }
@media(max-width:600px) {
  #settings-dialog { width:calc(100% - 20px); padding:20px 16px; border-radius:16px; }
  #settings-dialog .dialog-head h2 { font-size:32px; }
  #settings-dialog .close { padding:8px; font-size:11px; }
  .race-eyebrow { font-size:8px; letter-spacing:.12em; }
  .leaderboard-entry-grid { grid-template-columns:1fr; gap:18px; }
  .leaderboard-start-form { grid-row:1; padding:16px; }
  .leaderboard-start-form h3 { margin-bottom:14px; }
}

/* Skinnarila Grand Prix: timing-board typography and chequered race identity. */
/* A faint chequered texture fades into the entry panel behind its content. */
#settings-dialog { border-radius:6px; border-top:3px solid #78e4ac; background:linear-gradient(115deg,#14231f 15%,#080f10cc 60%,#080f10 90%),repeating-conic-gradient(#c4d9cf30 0% 25%,transparent 0% 50%) top right/64px 64px,linear-gradient(135deg,#14231f,#080f10 65%); }
#settings-dialog .dialog-head { align-items:flex-start; }
.race-heading { position:relative; flex:1; }
#settings-dialog .dialog-head h2 { margin:0 0 14px; font:900 italic clamp(38px,6vw,62px)/.9 'Barlow Condensed',Impact,sans-serif; letter-spacing:.025em; }
.race-heading .race-eyebrow { font-size:10px; line-height:1.5; }
.leaderboard-start-form { border-radius:3px; background:#101e19; padding:18px; }
.leaderboard-start-form h3 { margin:0 0 16px; text-transform:uppercase; font-size:15px; letter-spacing:.12em; }
.leaderboard-panel .leaderboard-start, .leaderboard-panel input { border-radius:3px; }
.leaderboard-panel .leaderboard-start { text-transform:uppercase; letter-spacing:.06em; font-size:13px; }
.record-celebration { position:absolute; inset:0; z-index:8; pointer-events:none; overflow:hidden; }
.record-banner { position:absolute; top:22%; left:50%; transform:translateX(-50%); padding:14px 24px; border-left:4px solid #c3a3ff; background:#120d22ed; color:#fff; text-align:center; white-space:nowrap; animation:record-arrive .25s ease-out; }
.record-banner strong { display:block; font:800 italic clamp(18px,4vw,30px)/1.1 'Barlow Condensed',Impact,sans-serif; letter-spacing:.08em; }
.record-banner span { display:block; margin-top:7px; color:#d9c5ff; font:700 22px monospace; }
.champagne { position:absolute; bottom:12%; width:70px; height:158px; }
.champagne-left { left:3%; transform:rotate(25deg); }
.champagne-right { right:3%; transform:scaleX(-1) rotate(25deg); }
.champagne svg { position:relative; z-index:1; width:100%; height:100%; }
.champagne-cork { animation:cork-pop .65s ease-out forwards; }
.champagne i { position:absolute; left:50%; top:9%; width:5px; height:9px; border-radius:50%; background:#f8ebbb; opacity:0; animation:champagne-spray 1.1s ease-out var(--delay) 2; }
@keyframes champagne-spray { 10% { opacity:.95; } 100% { transform:translate(var(--x),var(--y)) scale(.2); opacity:0; } }
@keyframes cork-pop { to { transform:translate(35px,-170px) rotate(100deg); opacity:0; } }
@keyframes record-arrive { from { opacity:0; margin-top:8px; } to { opacity:1; margin-top:0; } }
@media(max-width:600px) {
  #settings-dialog { border-radius:4px; }
  #settings-dialog .dialog-head h2 { font-size:39px; }
  .race-heading .race-eyebrow { font-size:8px; letter-spacing:.1em; }
  .champagne { width:48px; height:108px; bottom:24%; }
  .record-banner { padding:12px 16px; }
}
@media(prefers-reduced-motion:reduce) {
  .record-banner { animation:none; }
  .champagne i, .champagne-cork { animation:none; }
}

/* Let the startup language controls sit at the upper right, including on phones. */
#settings-dialog .dialog-head{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start}
#settings-dialog .race-heading{min-width:0}
#settings-dialog .dialog-actions{margin-left:auto}
@media(max-width:600px){
  #settings-dialog .race-heading{padding-right:0}
  #settings-dialog .dialog-head h2{font-size:clamp(26px,6.5vw,39px)}
  #settings-dialog .dialog-head{gap:8px}
  #settings-dialog .close{max-width:110px}
}

.analytics-settings { margin: 12px 0; padding: 10px; border: 1px solid #53615b; border-radius: 8px; font-size: 13px; line-height: 1.45; }
.analytics-settings label { display: flex; align-items: flex-start; gap: 8px; }
.analytics-settings input[type=checkbox] { width: 18px; min-width: 18px; height: 18px; margin: 2px 0; }
.analytics-settings details { margin: 8px 0; }
.analytics-settings button { font-size: 12px; padding: 6px 10px; }

/* Startup: the driver form and both complete top tens share one viewport. */
#settings-dialog {
  width:min(1080px,calc(100% - 24px));
  max-width:calc(100% - 16px);
  max-height:calc(100dvh - 24px);
  padding:18px;
}
#settings-dialog .dialog-head { gap:12px; }
#settings-dialog .dialog-head h2 { font-size:38px; margin:0 0 6px; }
#settings-dialog .dialog-actions { gap:6px; }
.leaderboard-entry-grid {
  grid-template-columns:minmax(0,1fr) minmax(260px,1.05fr);
  gap:16px;
  margin-top:14px;
  padding-top:14px;
  align-items:start;
}
.leaderboard-entry-grid > * { min-width:0; }
.leaderboard-entry-grid h3 { margin:0 0 8px; font-size:14px; }
.leaderboard-entry-grid p { margin:6px 0; font-size:11px; line-height:1.35; }
#verification-status:empty { display:none; }
#verified-list, #leaderboard-list {
  margin:6px 0 0;
  padding-left:0;
  max-height:none;
  overflow:visible;
  color:#bbd3c7;
  font-size:12px;
  line-height:1.4;
  list-style:none;
  counter-reset:standing;
}
#verified-list li, #leaderboard-list li {
  display:grid;
  grid-template-columns:18px minmax(0,1fr) auto;
  align-items:baseline;
  counter-increment:standing;
  padding:4px 0;
  border-bottom:1px solid #233d31;
  font-size:12px;
  font-variant-numeric:tabular-nums;
  overflow-wrap:anywhere;
}
#verified-list li::before, #leaderboard-list li::before { content:counter(standing) "."; color:#769989; }
#verified-list li { grid-template-columns:22px minmax(0,1fr) auto; }
#verified-list li:nth-child(-n+3)::before { font-size:14px; line-height:1; }
#verified-list li:nth-child(1)::before { content:"🥇"; content:"🥇" / "1."; }
#verified-list li:nth-child(2)::before { content:"🥈"; content:"🥈" / "2."; }
#verified-list li:nth-child(3)::before { content:"🥉"; content:"🥉" / "3."; }
#verified-list li:first-child { color:#ffd76a; font-weight:800; }
.standing-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.standing-time { white-space:pre; }
.leaderboard-start-form { padding:12px; }
.leaderboard-start-form h3 { margin-bottom:8px; }
.leaderboard-start-form .analytics-settings { min-width:0; margin:8px 0; padding:8px; }
.leaderboard-start-form .analytics-settings label { font-size:11px; line-height:1.4; }
.leaderboard-start-form input[type=checkbox] { min-height:18px; flex-shrink:0; }
.leaderboard-start-form .analytics-settings details { margin:6px 0 0; }
.analytics-settings summary { cursor:pointer; padding:4px 0; }
.leaderboard-start-form #leaderboard-name { min-height:44px; margin:5px 0 8px; padding:8px; }
.leaderboard-start-form #leaderboard-password { min-height:44px; margin:5px 0 4px; padding:8px; }
.leaderboard-start-form .leaderboard-password-hint { margin:0 0 8px; color:#8fae9f; }
.leaderboard-start-form .leaderboard-create-step { margin:-4px 0 8px; color:#78e4ac; font-size:12px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; }
.leaderboard-start-form .leaderboard-series { margin:4px 0 12px; padding:0; border:0; min-width:0; }
.leaderboard-start-form .leaderboard-series[hidden] { display:none; }
.leaderboard-series legend { padding:0; margin-bottom:4px; color:#fff; font-size:16px; font-weight:700; }
.leaderboard-series .leaderboard-series-name { margin:0 0 10px; color:#8fae9f; font-size:13px; }
.leaderboard-series-options { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.leaderboard-start-form .leaderboard-series-option { position:relative; display:grid; justify-items:center; gap:8px; padding:14px 10px; border:2px solid #35584a; border-radius:8px; background:#0b1a14; color:#cfe3d8; text-align:center; cursor:pointer; font-size:13px; font-weight:400; }
.leaderboard-series-option:hover { border-color:#5fa985; }
.leaderboard-series-option input[type=radio] { position:absolute; opacity:0; width:1px; height:1px; min-height:0; margin:0; padding:0; border:0; pointer-events:none; }
.leaderboard-series-option:has(input:checked) { border-color:#78e4ac; background:#163628; color:#fff; box-shadow:0 0 0 1px #78e4ac inset; }
.leaderboard-series-option:has(input:focus-visible) { outline:2px solid #63d6a3; outline-offset:2px; }
.leaderboard-series-icon { width:64px; height:64px; color:#78e4ac; }
.leaderboard-series-option:has(input:checked) .leaderboard-series-icon { color:#c7f779; }
.leaderboard-series-option strong { display:block; font-size:15px; color:#fff; }
.leaderboard-series-option small { display:block; margin-top:2px; color:#a9c4b6; font-size:12px; line-height:1.35; }
.leaderboard-series .leaderboard-series-note { margin:10px 0 0; color:#8fae9f; font-size:12px; }
@media (max-width:360px) { .leaderboard-series-options { grid-template-columns:1fr; } }
.series-tabs { display:flex; gap:6px; margin:4px 0 8px; }
.series-tabs button { flex:1; min-height:36px; padding:6px 10px; border:1px solid #35584a; background:#10241b; color:#cfe3d8; font:inherit; font-weight:700; cursor:pointer; }
.series-tabs button[aria-pressed="true"] { background:#1d3d2e; border-color:#78e4ac; color:#fff; }
.leaderboard-start-form .leaderboard-logout { display:block; min-height:0; margin:-2px 0 8px; padding:0; border:0; background:none; color:#9cefc2; font-size:12px; text-decoration:underline; cursor:pointer; }
.leaderboard-start-form .leaderboard-start #leaderboard-start-label { font-size:inherit; }
.leaderboard-start-form .leaderboard-start:disabled { opacity:.6; cursor:wait; }
.leaderboard-choices { display:grid; gap:10px; margin-top:10px; }
.leaderboard-panel .leaderboard-choice { width:100%; padding:12px; text-align:left; font:inherit; font-weight:700; cursor:pointer; }
.leaderboard-panel .leaderboard-choice:hover { background:#1d3d2e; border-color:#78e4ac; }
.leaderboard-panel .leaderboard-back { margin-top:14px; padding:4px 0; border:0; background:none; color:#9cefc2; text-decoration:underline; cursor:pointer; }
#leaderboard-account-title { margin:8px 0; font-size:18px; }
.leaderboard-options { margin:18px 0 12px; border-top:1px solid #35584a; padding-top:12px; }
.leaderboard-options > summary { cursor:pointer; color:#aec9bb; font-size:12px; }
.leaderboard-choices, #leaderboard-account-fields, .leaderboard-options { grid-column:1 / -1; min-width:0; }
.leaderboard-start-form .leaderboard-start { min-height:44px; padding:8px 12px; }

@media(max-width:760px) {
  #settings-dialog { padding:12px; }
  #settings-dialog .dialog-head h2 { font-size:28px; }
  #settings-dialog .race-eyebrow { font-size:8px; }
  .leaderboard-entry-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-top:10px; padding-top:10px; }
  .leaderboard-start-form { grid-column:1 / -1; grid-row:1; }
  .leaderboard-entry-grid h3 { font-size:12px; margin-bottom:5px; }
  #verified-list, #leaderboard-list { font-size:11px; }
  #verified-list li, #leaderboard-list li { padding:2px 0; font-size:11px; }
  .leaderboard-standings > p { display:none; }
  .leaderboard-start-form { padding:8px; }
  .leaderboard-start-form h3 { display:none; }
  .leaderboard-start-form .analytics-settings { padding:6px; margin:6px 0; }
  .leaderboard-start-form .analytics-settings label { font-size:10px; line-height:1.3; }
  #verification-status { font-size:10px; line-height:1.2; }
}

@media(max-height:700px) and (min-width:761px) {
  #settings-dialog .dialog-head h2 { font-size:30px; }
  .leaderboard-entry-grid { margin-top:10px; padding-top:10px; }
  #verified-list li, #leaderboard-list li { padding:2px 0; }
}

@media(max-width:760px) and (max-height:700px) and (orientation:portrait) {
  #settings-dialog { padding:8px; }
  #settings-dialog .dialog-head h2 { font-size:24px; }
  .leaderboard-entry-grid { gap:8px; margin-top:8px; padding-top:8px; }
  .leaderboard-start-form { display:grid; grid-template-columns:auto minmax(0,1fr); align-items:center; column-gap:8px; }
  .leaderboard-start-form > label { font-size:11px; }
  .leaderboard-start-form #leaderboard-name, .leaderboard-start-form #leaderboard-password { margin:0; }
  .leaderboard-start-form > fieldset, .leaderboard-start-form > button, .leaderboard-start-form > .leaderboard-password-hint, #leaderboard-status { grid-column:1 / -1; }
  .leaderboard-start-form .analytics-settings details { margin-top:3px; }
  .analytics-settings summary { font-size:11px; padding:2px 0; }
  #verified-list li, #leaderboard-list li { padding:1px 0; line-height:1.25; }
}

@media(max-width:760px) and (orientation:landscape) {
  #settings-dialog { width:calc(100% - 16px); max-height:calc(100dvh - 16px); padding:10px; }
  .leaderboard-entry-grid { grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(230px,1.3fr); gap:10px; }
  .leaderboard-start-form { grid-column:3; grid-row:1; }
}

@media(max-height:500px) and (orientation:landscape) {
  #settings-dialog .dialog-head h2 { font-size:26px; }
  #settings-dialog .dialog-head h2 br { display:none; }
  #settings-dialog .race-eyebrow { font-size:8px; }
  .leaderboard-start-form { padding:8px; }
  .leaderboard-start-form h3, .leaderboard-standings > p { display:none; }
  .leaderboard-start-form .analytics-settings { padding:6px; margin:6px 0; }
  .leaderboard-start-form .analytics-settings label { font-size:10px; line-height:1.3; }
  #verified-list li, #leaderboard-list li { padding:1px 0; font-size:11px; }
}


#verified-list .replay-link{font-size:.72rem;color:#d1ef85;text-decoration:underline;margin-left:auto;white-space:nowrap;padding:8px}#verified-list li{flex-wrap:wrap}
.championship{margin-top:18px;text-align:left}
.championship-controls{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.championship-controls input,.championship-controls button{font:inherit;padding:8px;min-height:42px;max-width:100%}
.championship-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:20px}
.championship-grid ol{padding:0;list-style:none}
.championship-grid li{display:flex;justify-content:space-between;gap:12px;padding:5px 0;border-bottom:1px solid #ffffff20}
.championship-grid li span:last-child{white-space:nowrap}
.championship-personal{white-space:pre-line;line-height:1.6}
.championship details p{font-size:.85rem;line-height:1.6}

/* Startup hierarchy: driving first, standings second, daily competition below. */
#settings-dialog {
  width:min(1040px,calc(100% - 32px)); padding:28px;
  border:1px solid #34564e; border-top:3px solid #78e4ac; border-radius:16px;
  background:radial-gradient(ellipse at 0 0,#1c3b30 0,transparent 60%),#0b1613;
  color-scheme:dark; scrollbar-color:#416455 #0b1613;
}
#settings-dialog .dialog-head { padding-bottom:22px; align-items:center; }
#settings-dialog .dialog-head h2 { font-size:clamp(32px,4.5vw,48px); line-height:.95; margin:0 0 10px; }
#settings-dialog .race-eyebrow { margin:0; font-size:10px; letter-spacing:.18em; }
#settings-dialog .leaderboard-entry-grid { grid-template-columns:minmax(0,1.1fr) minmax(0,1fr); gap:20px; margin:0; padding:22px 0 0; }
#settings-dialog .leaderboard-start-form,
#settings-dialog .verified-standings { padding:22px; border:1px solid #304c40; border-radius:12px; background:#10221c; margin:0; }
#settings-dialog .leaderboard-start-form { display:block; grid-column:auto; grid-row:auto; border-color:#4b8066; background:linear-gradient(145deg,#1c3b2e,#10221c); }
#settings-dialog .leaderboard-entry-grid h3 { display:block; margin:0 0 16px; font-size:14px; letter-spacing:.1em; }
#settings-dialog .leaderboard-entry-grid p { font-size:12px; line-height:1.6; color:#aac3b6; }
#settings-dialog .leaderboard-start { min-height:52px; border-radius:8px; font-size:13px; letter-spacing:.03em; }
#settings-dialog .leaderboard-choices { grid-template-columns:1fr 1fr; gap:10px; }
#settings-dialog .leaderboard-choice { text-align:center; min-height:48px; padding:10px; font-size:13px; border-radius:8px; }
#settings-dialog .leaderboard-options { margin:18px 0 0; }
#settings-dialog #leaderboard-status:empty { display:none; }
#settings-dialog .series-tabs { gap:4px; padding:4px; border:1px solid #2e493d; border-radius:9px; background:#091710; margin:0 0 14px; }
#settings-dialog .series-tabs button { min-height:36px; border-color:transparent; border-radius:6px; font-size:13px; background:transparent; }
#settings-dialog .series-tabs button[aria-pressed="true"] { background:#274b39; border-color:#54866a; }
#settings-dialog #verified-list { padding-top:8px; font-size:13px; }
#settings-dialog #verified-list li { padding:8px 0; }
#settings-dialog .championship { margin-top:22px; padding-top:22px; border-top:1px solid #304c40; }
#settings-dialog .championship > h3 { margin:0 0 6px; font-size:22px; }
#settings-dialog .championship > p { color:#aac3b6; font-size:12px; line-height:1.6; margin:8px 0 14px; }
#settings-dialog .championship > .series-tabs { width:min(300px,100%); }
#settings-dialog .championship-controls { display:grid; grid-template-columns:auto minmax(145px,190px) auto auto; justify-content:start; gap:8px; }
#settings-dialog .championship-controls label { margin:0 6px 0 0; font-size:12px; color:#aac3b6; }
#settings-dialog .championship-controls input { width:100%; margin:0; }
#settings-dialog .championship-controls button { width:auto; margin:0; font-size:12px; }
#settings-dialog #championship-clock { color:#8ce6b5; font-variant-numeric:tabular-nums; }
#settings-dialog .championship-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin:18px 0; }
#settings-dialog .championship-grid > section { min-width:0; padding:16px; background:#10221c; border:1px solid #2c453a; border-radius:10px; }
#settings-dialog .championship-grid h4 { margin:0 0 14px; font-size:14px; }
#settings-dialog .championship-grid p { color:#9eb8aa; font-size:12px; line-height:1.5; }
#settings-dialog .championship > details { color:#aac3b6; font-size:12px; }
#settings-dialog summary { cursor:pointer; }
@media(max-width:600px) {
  #settings-dialog { width:calc(100% - 16px); padding:18px; border-radius:12px; }
  #settings-dialog .dialog-head { gap:10px; padding-bottom:18px; }
  #settings-dialog .dialog-head h2 { font-size:30px; }
  #settings-dialog .race-eyebrow { font-size:8px; letter-spacing:.1em; }
  #settings-dialog .language-switcher { gap:3px; }
  #settings-dialog .language-switcher button { min-width:36px; min-height:40px; padding:4px; }
  #settings-dialog .language-switcher svg { width:25px; }
  #settings-dialog .leaderboard-entry-grid { grid-template-columns:1fr; gap:14px; padding-top:18px; }
  #settings-dialog .leaderboard-start-form,#settings-dialog .verified-standings { padding:16px; }
  #settings-dialog .championship-controls { grid-template-columns:1fr 1fr; }
  #settings-dialog .championship-controls label { grid-column:1 / -1; }
  #settings-dialog .championship-controls input { grid-column:1 / -1; }
  #settings-dialog .championship-grid { grid-template-columns:1fr; }
}

/* Active drivers are visible alongside entry, with one-click viewing. */
#settings-dialog .leaderboard-start-form { grid-column:1; grid-row:1 / 3; }
#settings-dialog .active-drivers { grid-column:2; grid-row:1; padding:22px; min-width:0; }
#settings-dialog .verified-standings { grid-column:2; grid-row:2; }
.active-drivers-note,#active-drivers-status { font-size:12px; line-height:1.6; color:#aac3b6; }
#active-drivers-list { list-style:none; padding:0; margin:14px 0 0; }
#active-drivers-list a { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:14px 12px; margin-top:8px; border:1px solid #416b56; border-radius:9px; background:#183b2c; color:#eafff1; text-decoration:none; min-height:48px; }
#active-drivers-list a:hover,#active-drivers-list a:focus-visible { background:#28543d; outline:2px solid #78e4ac; outline-offset:2px; }
#active-drivers-list strong { overflow-wrap:anywhere; min-width:0; }
.active-driver-badge { color:#78e4ac; font-size:10px; letter-spacing:.12em; flex-shrink:0; }
#settings-dialog.spectating .leaderboard-entry-grid,#settings-dialog.spectating > .championship,#settings-dialog.spectating > .dialog-head { display:none; }
#spectate-view { display:grid; grid-template-columns:minmax(0,1fr) 230px; min-height:100%; }
#spectate-game { min-width:0; }
#spectate-sidebar { padding:18px 14px; border-left:1px solid #304c40; background:#10221c; }
#settings-dialog #spectate-sidebar .active-drivers { padding:0; margin-top:22px; }
#spectate-sidebar .active-drivers-note { display:none; }
#spectate-sidebar #active-drivers-list a { font-size:13px; padding:12px 10px; }
#active-drivers-list a[aria-current="true"] { background:#28543d; border-color:#78e4ac; box-shadow:inset 3px 0 #78e4ac; }
body #settings-dialog.spectating { width:calc(100% - 24px); max-width:calc(100% - 24px); height:calc(100dvh - 24px); max-height:calc(100dvh - 24px); margin:12px; padding:0; }
body.chat-open #settings-dialog.spectating { width:calc(100% - 316px); max-width:calc(100% - 316px); margin-left:304px; }
.spectating #spectate-game .app { width:100%; max-width:none; margin:0; padding:12px; height:auto; min-height:0; display:block; }
.spectating .app .topbar { height:62px; gap:8px; position:relative; inset:auto; pointer-events:auto; }
.spectating .app .topbar-title,.spectating #restart-button,.spectating #leaderboard-button,.spectating .app > .controls,.spectating .help,.spectating .sauna-actions,.spectating .sauna-dialogue { display:none; }
.spectating .game-shell { position:relative; inset:auto; height:calc(100dvh - 114px); min-height:300px; aspect-ratio:auto!important; width:100%; border:1px solid #315447; border-radius:16px; }
.spectating .hud { display:flex; position:absolute; top:0; left:0; right:0; width:auto; max-width:none; border-radius:0; }
.spectating .hud-item { display:flex; min-width:0; padding:10px; }
.spectating .hud-item.wide { flex:1; }
.spectating .hud-item strong { font-size:24px; }
.spectating .telemetry,.spectating .game-footer { display:flex; }
#spectate-label,#spectate-connection { position:absolute; z-index:6; left:12px; max-width:calc(100% - 24px); padding:8px 12px; border:1px solid #416b56; border-radius:8px; background:#091912e8; color:#effff5; font:600 12px/1.4 Inter,Arial,sans-serif; overflow-wrap:anywhere; pointer-events:none; }
#spectate-label { top:70px; margin:0; }
#spectate-connection { top:110px; margin:0; color:#ffdca3; }
#spectate-back { padding:10px 14px; border:1px solid #54866a; border-radius:8px; background:#1b3c2b; color:#effff5; cursor:pointer; }
@media(max-width:600px) {
 #settings-dialog .leaderboard-start-form,#settings-dialog .active-drivers,#settings-dialog .verified-standings { grid-column:auto; grid-row:auto; }
 #settings-dialog .active-drivers { padding:16px; }
 #settings-dialog .active-drivers { order:-1; }
}
@media(max-width:900px) {
 body.spectate-menu-open.chat-open #settings-dialog { width:calc(100% - 16px); max-width:calc(100% - 16px); margin:8px auto; max-height:calc(100dvh - 248px); }
 body.spectate-menu-open .chat-panel { top:auto; left:0; right:0; bottom:0; width:100%; height:230px; max-height:230px; padding:10px; gap:6px; }
 body.spectate-menu-open .chat-panel .hint,body.spectate-menu-open .chat-presence { display:none; }
 body.spectate-menu-open .chat-panel .chat-heading h2 { font-size:20px; }
 body.spectate-menu-open.chat-open #settings-dialog.spectating { width:calc(100% - 16px); max-width:calc(100% - 16px); margin:8px; height:calc(100dvh - 248px); max-height:calc(100dvh - 248px); }
 #spectate-view { grid-template-columns:minmax(0,1fr) 190px; }
 .spectating .game-shell { height:calc(100dvh - 340px); min-height:280px; }
 .spectating .hud-item { padding:8px 6px; }
 .spectating .hud-item strong { font-size:20px; }
 .spectating .app .language-switcher { display:none; }
}
@media(max-width:650px) {
 #spectate-view { grid-template-columns:minmax(0,1fr); }
 #spectate-sidebar { border-left:0; border-top:1px solid #304c40; }
 .spectating .game-shell { height:calc(100dvh - 340px); min-height:300px; }
 .spectating .app .logo { width:106px; }
 .spectating .hud-item strong { font-size:20px; }
 .spectating #active-drivers-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
 .spectating #active-drivers-list li { min-width:0; }
}
