:root{color-scheme:dark;--red:#f33f34;--paper:#eeeae3;--muted:#a2a7ab}*{box-sizing:border-box}body{margin:0;background:#101317;color:var(--paper);font-family:Arial,Helvetica,sans-serif}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;cursor:pointer;color:inherit;border:0}button:focus-visible,a:focus-visible{outline:2px solid #ffc875;outline-offset:4px}button:disabled{opacity:.5;cursor:wait}.hidden{display:none!important}header{height:82px;display:flex;align-items:center;justify-content:space-between;margin:0 5%;border-bottom:1px solid #ffffff20;font-size:10px;letter-spacing:2px}.brand{color:inherit;text-decoration:none;font-size:11px;display:flex;align-items:center;gap:15px}.brand b{font-size:30px;font-style:italic;letter-spacing:-5px;color:var(--red)}.sound{background:transparent;font-size:10px;letter-spacing:1px;padding:12px}.sound span{color:#ffb084;margin-left:7px}#garage{overflow:hidden;min-height:100vh;background:radial-gradient(ellipse at 70% 45%,#3b2927,transparent 60%)}.hero{height:570px;position:relative;padding:50px 5%;max-width:1600px;margin:auto}.hero-copy{position:relative;z-index:2;width:38%}.eyebrow{font-size:10px;letter-spacing:2px;color:#a2a8ad}h1{font-size:clamp(55px,6.3vw,90px);line-height:.93;letter-spacing:-4px;margin:26px 0}h1 em{color:var(--red)}.hero-copy p{font-size:14px;line-height:1.6;color:#bab8b7}.primary{background:var(--red);padding:18px 27px;font-size:12px;font-weight:bold;letter-spacing:1px;border-radius:3px;margin-top:12px}.primary:hover{background:#ff5c50}.hero-car{position:absolute;right:-1%;width:67%;top:55px;filter:drop-shadow(0 20px 18px #0009)}#loadStatus{font-size:10px;color:#8e979d;letter-spacing:.8px;margin-top:14px}.control-guide{display:flex;margin:20px 5% 0;border-top:1px solid #ffffff25;border-bottom:1px solid #ffffff25;padding:26px 0;gap:30px;justify-content:space-between}.control-guide>div{flex:1;padding:0 12px}.control-guide>div+div{border-left:1px solid #ffffff25}.control-guide strong{display:block;font-size:11px;margin:13px 0 7px;letter-spacing:1px}.control-guide span{font-size:11px;color:#a4aaae}kbd{display:inline-block;border:1px solid #ffffff50;border-bottom-width:3px;padding:7px 10px;border-radius:4px;font-family:inherit;font-size:11px;margin-right:5px}footer{margin:24px 5%;display:flex;justify-content:space-between;font-size:8px;letter-spacing:1.5px;color:#7f898e}#race{position:fixed;inset:0;background:#99b6c7;overflow:hidden}#road{width:100%;height:100%;display:block;outline:none}.shade{position:absolute;inset:0;pointer-events:none;background:linear-gradient(#0005,transparent 22%,transparent 68%,#0009)}.race-top{position:absolute;left:3%;right:3%;top:25px;display:flex;justify-content:space-between;align-items:start}.wordmark{font-size:32px;font-weight:900;font-style:italic;display:flex;gap:15px}.wordmark span{font-size:8px;line-height:1.6;letter-spacing:1.8px;font-style:normal;margin-top:5px}.route{background:#121923d9;border:1px solid #ffffff25;border-radius:6px;padding:14px 23px;min-width:250px;text-align:center}.route>span{font-size:9px;letter-spacing:2px;color:#f3be77}.route strong{display:block;margin:8px 0 12px;font-size:27px;font-variant-numeric:tabular-nums}.route small{font-size:11px;font-weight:400;color:#b9c1c6}.progress{height:3px;background:#ffffff20}.progress>div{height:100%;background:var(--red);width:0}.actions{display:flex;gap:8px}.actions>button{background:#111924d9;border:1px solid #ffffff25;border-radius:5px;height:44px;min-width:44px}#pause{font-size:21px}#notice{position:absolute;top:23%;left:50%;transform:translateX(-50%);background:#111922a0;border:1px solid #ffffff25;padding:12px 22px;font-size:12px;letter-spacing:2px;white-space:nowrap;text-align:center;pointer-events:none}#notice:empty{display:none}#countdown{position:absolute;left:50%;top:40%;transform:translate(-50%,-50%);font-size:90px;font-style:italic;font-weight:900;text-shadow:0 8px 25px #0009}.driver-camera{position:absolute;left:3%;bottom:115px;width:185px;border:1px solid #ffffff50;border-radius:6px;overflow:hidden;background:#121923}.driver-camera>img{display:block;width:100%;height:113px;object-fit:cover;object-position:40% center}.driver-camera>span{display:block;padding:10px 12px;font-size:10px;letter-spacing:2px}.driver-camera small{float:right;font-size:7px;color:#e4ac7a}.instruments{position:absolute;bottom:115px;right:3%;width:320px;display:grid;grid-template-columns:1fr 110px;gap:0 18px;text-shadow:0 3px 12px #0006}.speed strong{font-size:88px;line-height:1;font-variant-numeric:tabular-nums;font-weight:400;font-style:italic;letter-spacing:-5px}.speed span{font-size:10px;display:block;letter-spacing:2px;color:#cfdbdf;margin:6px 0 0 8px}.gear{border-left:1px solid #ffffff35;padding-left:22px;text-align:center}.gear small{font-size:8px;letter-spacing:1px;color:#d6d2c8}.gear strong{display:block;font-size:64px;color:#ffd195;line-height:1.2}.gear>span{display:block;font-size:8px;letter-spacing:1px;color:#e8bf89}.tach{grid-column:span 2;margin-top:15px}.rpm-label{display:flex;justify-content:space-between;font-size:9px;letter-spacing:1.5px;margin-bottom:9px}.rpm-track{height:5px;background:#ffffff30}.rpm-track>div{height:100%;width:12%;background:linear-gradient(90deg,#dfddd2 60%,#f7b45f 82%,#f33f34)}.control-dock{position:absolute;left:3%;right:3%;bottom:22px;height:66px;border:1px solid #ffffff30;border-radius:7px;background:#121923ea;display:flex;align-items:center;gap:25px;padding:12px 20px}.control-dock>div{display:flex;align-items:center;gap:4px}.control-dock span{font-size:9px;letter-spacing:1px;color:#cbd0d3;margin-left:6px}.control-dock kbd{font-size:10px}.control-dock .active kbd{background:#f14434;border-color:#ffab8a}.control-dock .minor{margin-left:auto;gap:16px}.minor span{font-size:8px}.minor #timer{color:#f4d4a0;font-size:12px;font-variant-numeric:tabular-nums}#overlay{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:#060c14bd;z-index:10}#dialog{width:440px;max-height:95vh;overflow:auto;background:#151c24;border:1px solid #ffffff25;border-radius:10px;padding:34px;text-align:center;box-shadow:0 25px 80px #0008}#dialog h2{font-size:35px;font-style:italic;letter-spacing:-1px;margin:18px 0}#dialog p{font-size:13px;line-height:1.7;color:#bbc2c7}#dialog button{display:block;width:100%;margin-top:12px}.secondary{padding:14px;background:transparent;border:1px solid #ffffff35;border-radius:4px;font-size:11px;letter-spacing:1px}.result-photo{width:100%;max-height:180px;object-fit:contain}.result-time{font-size:40px;font-variant-numeric:tabular-nums;margin:15px 0}#rendererError{position:absolute;inset:25%;padding:35px;background:#151c24;border:1px solid var(--red);z-index:9;line-height:1.7}
@media(max-width:1000px){.control-dock{gap:12px;padding:10px}.control-dock .minor{gap:6px}.control-dock span{font-size:8px;letter-spacing:0}.instruments{width:260px;grid-template-columns:1fr 90px}.speed strong{font-size:72px}.driver-camera{width:150px}.driver-camera>img{height:92px}.hero{height:540px}.hero-car{top:130px}.control-guide{gap:8px}}
@media(max-height:650px){.driver-camera,.instruments{bottom:100px}.driver-camera{width:140px}.driver-camera>img{height:80px}.speed strong{font-size:65px}.gear strong{font-size:47px}.race-top{top:15px}.route{padding:9px 20px}.route strong{font-size:22px;margin:6px 0}#notice{top:25%}.control-dock{bottom:15px;height:60px}}
.gear-ladder{display:flex;gap:5px;margin:8px 0}.gear-step{padding:3px 9px;border:1px solid #ffffff20;color:#ffffff60;font-size:12px}.gear-step.selected{background:#ef4637;color:white;border-color:#ef4637;box-shadow:0 0 14px #ef463750}.condition{position:absolute;left:32px;bottom:175px;width:160px;color:#dfe6e9;font-size:10px;letter-spacing:1px}.condition span{display:flex;justify-content:space-between}.condition>div{height:3px;background:#ffffff20;margin:9px 0}.condition i{display:block;width:100%;height:100%;background:#a7dbbb;transition:width .3s}.condition small{font-size:8px;color:#a4b2ba}.instruments{min-width:350px}
.condition{left:3%;bottom:285px;width:185px;background:#121923d9;border:1px solid #ffffff25;border-radius:5px;padding:12px}@media(max-height:650px){.condition{bottom:235px;width:140px;padding:8px;font-size:8px}}
.condition .flip-count{margin:12px 0 8px;color:#ffd195}.condition{bottom:285px}.condition small{letter-spacing:.6px}

/* Route selection and race-start signal */
.route-select{padding:36px 6vw 24px;border-top:1px solid #ffffff18}.route-heading h2{font-size:32px;margin:9px 0}.route-heading p,#saveNote{color:#a5afb4;font-size:14px}.route-options{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin:24px 0 16px}.route-card{position:relative;text-align:left;padding:26px;background:linear-gradient(130deg,#20292a,#141a20);color:#e8eeea;border:1px solid #ffffff25;border-radius:10px;cursor:pointer;font-family:inherit}.route-card[data-route=italy]{background:linear-gradient(130deg,#30372a,#1a201c)}.route-card.selected{border-color:#ff4b3e;box-shadow:inset 0 0 0 1px #ff4b3e}.route-card small{display:block;letter-spacing:2px;color:#d6ae8a;font-size:11px}.route-card strong{display:block;font-size:28px;margin:12px 0}.route-card p{font-size:14px;color:#b5bfbc}.route-card b{display:block;font-size:20px;color:#a7e4ce;margin-top:20px}.route-card span:not(.route-icon){display:block;font-size:12px;margin-top:6px;color:#b4c0bb}.route-icon{position:absolute;right:25px;top:22px;font-size:45px;color:#ffffff30}.route-card:focus-visible{outline:3px solid white;outline-offset:4px}
#countdown{position:absolute;left:50%;top:45%;transform:translate(-50%,-50%);font-size:clamp(140px,23vw,300px);font-weight:950;font-style:italic;line-height:1;text-shadow:0 6px 0 #141920,0 0 90px #000c;color:#fff;z-index:8;pointer-events:none;letter-spacing:-.055em}#countdown.start-signal{font-size:clamp(100px,19vw,240px);color:#b0ffb7;animation:startPulse .8s ease-out forwards}@keyframes startPulse{0%{opacity:1;transform:translate(-50%,-50%) scale(.9)}70%{opacity:1}100%{opacity:0;transform:translate(-50%,-50%) scale(1.07)}}.ghost-status{position:absolute;top:145px;left:50%;transform:translateX(-50%);padding:9px 16px;border-radius:5px;background:#13262acc;color:#9debf2;font-size:12px;letter-spacing:1px;white-space:nowrap}.record-banner{color:#a8efc2;font-weight:800;font-size:18px}.result-record{color:#b6dce0;font-size:17px}.route-top{font-size:11px}

/* Shared flow prevents warning/ghost overlap at any desktop height or zoom. */
.race-top{display:grid;grid-template-columns:1fr minmax(250px,52vw) 1fr;gap:10px}.actions{justify-self:end}.race-guidance{display:flex;flex-direction:column;align-items:center;gap:9px;min-width:0;pointer-events:none}.race-guidance .route{max-width:100%;min-width:min(250px,100%)}.race-guidance #ghostStatus,.race-guidance #notice{position:static;transform:none;max-width:100%;white-space:normal;margin:0;line-height:1.35;text-align:center}.race-guidance #notice{padding:9px 15px;font-size:11px;letter-spacing:1px}.race-guidance #ghostStatus{padding:7px 12px;font-size:11px}.gear{padding:5px 10px;border-radius:7px;transition:background .15s,box-shadow .15s}.gear.shifting{background:#391e14e6;box-shadow:0 0 22px #ffb66c88}.gear>span{font-size:16px;font-weight:800;letter-spacing:0;min-height:22px;white-space:nowrap}.gear #upshifts{display:block;font-size:9px;margin-top:7px;white-space:nowrap}.instruments{grid-template-columns:1fr 145px}.gear.shifting strong{color:white}.gear-ladder{justify-content:space-between}.gear-step{flex:1;text-align:center}
@media(max-height:650px){.race-guidance{gap:6px}.race-guidance #ghostStatus,.race-guidance #notice{font-size:10px;padding:5px 10px}.race-guidance .route{padding:8px 16px}.gear>span{font-size:14px}}

/* Three scenic route choices, with consistent crop and readable metadata. */
.route-options{grid-template-columns:repeat(3,minmax(0,1fr));align-items:stretch}.route-card{overflow:hidden;padding:0 24px 25px}.route-photo{display:block;width:calc(100% + 48px);height:190px;object-fit:cover;margin:0 -24px 22px}.route-card small{font-size:10px;line-height:1.6}.route-card strong{font-size:25px}.route-card p{min-height:50px;line-height:1.6}.art-note{font-size:11px;color:#8d989b}.route-card[data-route=mountain]{background:linear-gradient(130deg,#27323c,#161d25)}
@media(max-width:1000px){.route-options{gap:12px}.route-card{padding:0 18px 22px}.route-photo{width:calc(100% + 36px);margin:0 -18px 18px;height:160px}.route-card strong{font-size:22px}}
@media(max-width:700px){.route-options{grid-template-columns:1fr}.route-card p{min-height:0}}
#countdown.arrest-signal{font-size:clamp(35px,5vw,72px);top:34%;letter-spacing:.03em;color:#bcdcff;text-align:center;white-space:nowrap}

.story-link{background:transparent;border:1px solid #ffffff35;border-radius:4px;padding:10px 16px;font-size:10px;letter-spacing:1px}.story-route{width:calc(100% + 68px);height:175px;object-fit:cover;margin:-34px -34px 24px}.story-portrait{width:100%;height:185px;object-fit:contain;margin:14px 0 0}#dialog:has(.story-route),#dialog:has(.story-portrait){width:610px;max-width:94vw;text-align:left}#dialog:has(.story-route) h2,#dialog:has(.story-portrait) h2{font-size:32px}.story-difficulty{color:#ffbf7d!important;text-transform:uppercase;letter-spacing:2px;font-size:10px!important}.story-goals{padding-left:21px;color:#d3dcde;font-size:13px;line-height:1.6}.story-goals li{padding:4px 0 4px 5px}.story-controls{border-top:1px solid #ffffff20;padding-top:16px}.rear-view{position:absolute;right:3%;top:90px;width:clamp(180px,18vw,260px);border:2px solid #81969f;border-radius:8px;overflow:hidden;background:transparent;pointer-events:none;box-shadow:0 5px 18px #0007}.rear-window{height:88px;background:transparent}.rear-view strong{display:block;background:#101e2de8;padding:7px 4px;text-align:center;color:#bce4ff;font-size:10px;letter-spacing:.7px}.rear-view::before{content:'REAR VIEW';position:absolute;top:6px;left:8px;font-size:8px;letter-spacing:1px;color:white;text-shadow:0 1px 4px #000}.rear-view::after{content:'';position:absolute;inset:0 0 27px;box-shadow:inset 0 0 15px #0007;border-radius:6px;pointer-events:none}@media(max-height:700px){.story-route{height:120px}.story-portrait{height:130px}#dialog:has(.story-route),#dialog:has(.story-portrait){padding:24px}.story-route{width:calc(100% + 48px);margin:-24px -24px 18px}.rear-window{height:70px}.rear-view{top:75px}}

.racer-intro-photo{margin:18px 0 24px;border:1px solid #ffffff26;border-radius:8px;overflow:hidden;background:#12191b}.racer-intro-photo .story-portrait{display:block;width:100%;height:auto;aspect-ratio:1672/941;object-fit:contain;margin:0}.racer-intro-photo figcaption{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 16px;color:#f1ece2;font-size:12px;letter-spacing:2px}.racer-intro-photo figcaption span{font-size:8px;color:#e7ac78;letter-spacing:1px}#dialog:has(.racer-intro-photo){width:720px}#dialog:has(.racer-intro-photo) h2{font-size:30px}@media(max-height:800px){#dialog:has(.racer-intro-photo){width:620px}.racer-intro-photo .story-portrait{max-height:230px;object-fit:contain}.racer-intro-photo{margin:12px 0 16px}}

/* Revision 14: readable stories and a separate grand-prix event. */
.route-options{grid-template-columns:repeat(2,minmax(0,1fr));gap:24px;max-width:1440px;margin:28px auto}.route-photo{height:245px}.route-card strong{font-size:29px}.route-card p{font-size:17px}.route-card small{font-size:12px}.route-card[data-route=avengers]{background:linear-gradient(130deg,#243d55,#17232d)}
#dialog:has(.story-route),#dialog:has(.story-portrait){width:760px;max-height:94vh;padding:32px;overflow:auto}#dialog:has(.story-route) h2,#dialog:has(.story-portrait) h2{font-size:36px;line-height:1.1}#dialog:has(.story-route) p,#dialog:has(.story-portrait) p{font-size:19px;line-height:1.65}#dialog .story-difficulty{font-size:15px!important;line-height:1.5}#dialog .story-goals{font-size:18px;line-height:1.65;padding-left:25px}#dialog .story-goals li{padding:7px 0 7px 5px}#dialog .story-controls{font-size:17px}#dialog .eyebrow{font-size:13px}.story-route{height:210px;width:calc(100% + 64px);margin:-32px -32px 24px}.racer-intro-photo .story-portrait{max-height:280px;object-fit:contain}.racer-intro-photo figcaption{font-size:15px}.racer-intro-photo figcaption span{font-size:10px}#dialog .primary,#dialog .secondary{font-size:14px;min-height:48px}
.condition{width:220px;font-size:12px;padding:14px;bottom:285px}.condition .damage-heading{font-size:13px;color:#ffce95}.condition .damage-heading b{font-size:17px;color:#fff}.condition .health-heading{margin-top:15px;font-size:10px;color:#c3cdcf}.condition small{font-size:9px}.condition .damage-segments{display:flex;height:13px;gap:4px;background:none;margin:10px 0 7px}.condition .damage-segments i{flex:1;width:auto;background:#ffffff19;border:1px solid #ffffff22;overflow:hidden;border-radius:2px}.condition .damage-segments em{display:block;width:0;height:100%;background:linear-gradient(90deg,#edab62,#f05743);transition:width .15s}
.leaderboard{position:absolute;right:3%;top:100px;width:240px;border:1px solid #ffffff35;border-radius:8px;overflow:hidden;background:#0b1d2de8;color:#f1f0e9;pointer-events:none}.leaderboard header{padding:12px 14px;display:flex;align-items:center;justify-content:space-between;background:#213d50}.leaderboard header b{font-size:10px;letter-spacing:1px}.leaderboard header strong{font-size:25px}.leaderboard #standings>div{display:flex;align-items:center;gap:9px;padding:5px 14px;font-size:12px;min-height:28px}.leaderboard #standings b{width:14px}.leaderboard #standings i{width:4px;height:16px}.leaderboard #standings small{margin-left:auto;color:#ace1bb}.leaderboard .is-player{background:#a12f2dcf;color:white;font-weight:800}.leaderboard footer{display:block;border-top:1px solid #ffffff26;padding:9px 14px;color:#f0c67d;font-size:12px;letter-spacing:2px}
body.podium-mode #race .race-top,body.podium-mode #race .leaderboard,body.podium-mode #race .instruments,body.podium-mode #race .condition,body.podium-mode #race .driver-camera,body.podium-mode #race .control-dock,body.podium-mode #race #countdown{display:none}body.podium-mode #overlay{background:linear-gradient(transparent 48%,#06111cbb 85%);backdrop-filter:none;align-items:flex-end;padding:18px;pointer-events:none}body.podium-mode #dialog{width:min(850px,95vw);max-height:40vh;overflow:auto;background:#0a1c2eee;border-color:#d8b67170;padding:18px 26px;pointer-events:auto}body.podium-mode #dialog h2{font-size:30px;margin:5px 0}body.podium-mode #dialog p{font-size:15px;margin:8px 0;line-height:1.4}.podium-classification{display:flex;gap:12px;padding:0;margin:12px 0;list-style:none}.podium-classification li{display:flex;gap:8px;align-items:center;background:#ffffff0b;padding:9px 12px;border-radius:4px;flex:1}.podium-classification b{color:#e6c885;font-size:24px}.podium-classification span{font-size:13px;white-space:nowrap}.podium-classification small{font-size:11px;color:#afc2cd;margin-left:auto}.podium-classification .player-result{background:#a9362d70}.podium-actions{display:flex;justify-content:center;gap:14px}.podium-actions button{margin:0!important;flex:1;max-width:350px}.podium-caption{color:#c8d2d7}.podium-summary{color:#f0d8ab}
@media(max-height:750px){.condition{bottom:250px;padding:10px;width:195px}.condition .health-heading{margin-top:10px}.leaderboard{top:88px;width:205px}.leaderboard #standings>div{min-height:22px;padding:3px 10px;font-size:11px}.leaderboard header{padding:7px 10px}.racer-intro-photo .story-portrait{max-height:220px}.story-route{height:170px}body.podium-mode #dialog{max-height:44vh;padding:10px 20px}body.podium-mode #dialog h2{font-size:25px}.podium-classification{margin:8px 0}}
@media(max-width:800px){.route-options{grid-template-columns:1fr}.leaderboard{width:180px}.route-photo{height:220px}}
.leaderboard header{height:auto;margin:0;border-bottom:0}.leaderboard footer{margin:0}@media(max-height:750px){.leaderboard #standings>div:nth-child(n+4):not(.is-player){display:none}}

/* Revision 15: thumb controls and a compact, safe-area-aware race HUD. */
.touch-controls,#rotateHint{display:none}
#road,.touch-controls{touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.touch-layout #garage>header{height:auto;min-height:64px;gap:10px;flex-wrap:wrap;padding:12px 0;letter-spacing:1px}
.touch-layout #garage>header>span{font-size:9px}
.touch-layout .hero{height:390px;padding-top:28px}
.touch-layout .hero-copy{width:55%}
.touch-layout h1{font-size:54px;letter-spacing:-3px;margin:18px 0}
.touch-layout .hero-car{width:63%;top:90px;right:-8%}
.touch-layout .hero-copy p{font-size:14px}
.touch-layout .control-guide{display:none}
.touch-layout .route-select{padding-top:22px}
.touch-layout .route-heading h2{font-size:28px}
.touch-layout .route-photo{height:180px}
.touch-layout footer{line-height:1.6;gap:15px}
.touch-layout #dialog{max-width:94vw;max-height:calc(100dvh - 24px);padding:22px}
.touch-layout #dialog:has(.story-route),.touch-layout #dialog:has(.story-portrait){padding:22px;max-height:calc(100dvh - 24px)}
.touch-layout #dialog:has(.story-route) h2,.touch-layout #dialog:has(.story-portrait) h2{font-size:27px}
.touch-layout #dialog p,.touch-layout #dialog:has(.story-route) p,.touch-layout #dialog:has(.story-portrait) p{font-size:16px;line-height:1.5}
.touch-layout #dialog .story-goals{font-size:16px;line-height:1.5}
.touch-layout .story-route{width:calc(100% + 44px);margin:-22px -22px 18px;height:140px}
.touch-layout .racer-intro-photo figcaption span{display:none}
.touch-layout .route-options{gap:16px}
.touch-layout #race{height:100dvh}
.touch-layout .driver-camera,.touch-layout .tach,.touch-layout #upshifts,.touch-layout #shift,.touch-layout .control-dock>div:not(.minor),.touch-layout .control-dock .minor>span:not(#timer){display:none}
.touch-layout .control-dock{left:50%;right:auto;transform:translateX(-50%);bottom:max(8px,env(safe-area-inset-bottom));height:24px;padding:4px 10px;border:0;background:#101923b3}
.touch-layout .control-dock .minor{margin:0}
.touch-layout .race-top{left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right));top:max(8px,env(safe-area-inset-top));grid-template-columns:125px minmax(150px,1fr) 100px;gap:8px}
.touch-layout .wordmark{font-size:24px;gap:6px}
.touch-layout .wordmark span{font-size:7px;letter-spacing:.5px}
.touch-layout .race-guidance{gap:3px;max-width:340px;justify-self:center}
.touch-layout .race-guidance .route{min-width:0;width:100%;padding:5px 12px;border-radius:4px}
.touch-layout .route>span{font-size:9px;letter-spacing:.3px}
.touch-layout .route strong{font-size:17px;margin:3px 0 5px}
.touch-layout .race-guidance #ghostStatus{font-size:9px;padding:4px 8px;letter-spacing:0}
.touch-layout .race-guidance #notice{font-size:9px;padding:4px 7px;letter-spacing:0}
.touch-layout .actions{gap:6px}
.touch-layout .actions>button{min-width:44px;height:44px;padding:8px}
.touch-layout .actions .sound span{display:none}
.touch-layout .condition{left:max(12px,env(safe-area-inset-left));top:55px;bottom:auto;width:140px;padding:8px;font-size:9px}
.touch-layout .condition .damage-heading{font-size:9px;gap:4px}
.touch-layout .condition .damage-heading b{font-size:13px;white-space:nowrap}
.touch-layout .condition .damage-segments{gap:2px;height:8px;margin:6px 0}
.touch-layout .condition .health-heading,.touch-layout .condition .health-heading+div,.touch-layout .condition>small{display:none}
.touch-layout .condition .flip-count{margin:4px 0 0;font-size:9px}
.touch-layout .leaderboard{top:58px;right:max(12px,env(safe-area-inset-right));width:133px;border-radius:5px}
.touch-layout .leaderboard header{min-height:0;height:auto;margin:0;padding:5px 7px;font-size:8px;gap:5px}
.touch-layout .leaderboard header b{font-size:8px;letter-spacing:0}
.touch-layout .leaderboard header strong{font-size:19px}
.touch-layout .leaderboard #standings>div{font-size:10px;min-height:18px;padding:2px 6px;gap:4px}
.touch-layout .leaderboard #standings>div:nth-child(n+4):not(.is-player){display:none}
.touch-layout .leaderboard #standings i{height:10px}
.touch-layout .leaderboard footer{padding:4px 7px;font-size:10px;letter-spacing:1px;margin:0}
.touch-layout .rear-view{top:58px;right:max(12px,env(safe-area-inset-right));width:132px}
.touch-layout .rear-window{height:50px}
.touch-layout .rear-view strong{font-size:8px;padding:4px}
.touch-layout .instruments{left:50%;right:auto;transform:translateX(-50%);bottom:max(34px,calc(env(safe-area-inset-bottom) + 26px));width:140px;min-width:0;grid-template-columns:80px 48px;gap:8px;background:#1019239e;border-radius:8px;padding:8px}
.touch-layout .speed strong{font-size:42px;letter-spacing:-2px}
.touch-layout .speed span{font-size:8px;margin:3px 0}
.touch-layout .gear{padding:0 0 0 6px;border-radius:0}
.touch-layout .gear strong{font-size:33px;line-height:1.1}
.touch-layout .gear small{font-size:7px;letter-spacing:0}
.touch-layout #countdown{font-size:clamp(90px,22vh,150px);top:49%}
.touch-layout #countdown.start-signal{font-size:clamp(72px,20vh,120px)}
.touch-layout #countdown.arrest-signal{font-size:35px;top:47%}
.touch-layout.drive-active .touch-controls{display:flex;position:absolute;left:max(14px,env(safe-area-inset-left));right:max(14px,env(safe-area-inset-right));bottom:max(16px,env(safe-area-inset-bottom));justify-content:space-between;pointer-events:none;z-index:8}
.touch-steering,.touch-pedals{display:flex;align-items:end;gap:12px;pointer-events:auto}
.touch-controls button{height:66px;min-width:66px;border-radius:15px;background:#101e2bd9;border:2px solid #ffffff60;color:#fff;font-size:25px;font-weight:bold;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;box-shadow:0 3px 14px #0005}
.touch-pedals button{font-size:11px;letter-spacing:.5px;width:80px}
.touch-pedals [data-drive=throttle]{height:82px;width:100px;background:#a42b22e8;border-color:#ffb3a4}
.touch-controls button.active{background:#f14a37;border-color:#fff;box-shadow:0 0 0 4px #ffd29880,0 0 20px #ffcc8c80;transform:translateY(2px)}
.touch-controls [data-drive=brake].active{background:#2676a2}
.touch-layout.portrait-drive #race:not(.hidden) #rotateHint{position:fixed;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;padding:30px;text-align:center;background:#101923fa;z-index:15}
#rotateHint strong{font-size:25px;line-height:1.2}#rotateHint span{font-size:16px;color:#c2ccd3}
.touch-layout.portrait-drive:has(#race:not(.hidden)) #overlay{visibility:hidden}
.touch-layout.podium-mode #dialog{max-height:52dvh;padding:12px 18px}
.touch-layout.podium-mode .podium-classification{gap:5px}
.touch-layout.podium-mode .podium-classification li{padding:5px;gap:5px}
.touch-layout.podium-mode .podium-classification small{display:none}
.touch-layout.podium-mode .podium-classification span{font-size:11px}
@media(max-height:360px){.touch-controls button{height:56px;min-width:56px}.touch-pedals [data-drive=throttle]{height:68px}.touch-layout .leaderboard #standings{display:none}.touch-layout .race-guidance #notice{max-width:230px}.touch-layout .instruments{bottom:27px}}
@media(max-width:600px){.touch-layout .hero{height:530px}.touch-layout .hero-copy{width:85%}.touch-layout .hero-car{width:95%;top:285px;right:-4%}.touch-layout .route-options{grid-template-columns:1fr}.touch-layout .brand{font-size:10px;gap:10px}.touch-layout .story-link{padding:10px}.touch-layout .route-card strong{font-size:25px}}

/* Revision 16: phone information stays at the top, never over the player car. */
.mobile-hud{display:none}
.touch-layout #race .wordmark,.touch-layout #race .race-guidance,
.touch-layout #race .instruments,.touch-layout #race .condition,
.touch-layout #race .control-dock,.touch-layout #race .leaderboard{display:none}
.touch-layout #race .race-top{display:contents}
.touch-layout #race .actions{position:absolute;top:max(8px,env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right));z-index:8}
.touch-layout #race .mobile-hud{position:absolute;display:flex;align-items:center;gap:14px;left:max(12px,env(safe-area-inset-left));right:calc(max(12px,env(safe-area-inset-right)) + 106px);top:max(8px,env(safe-area-inset-top));height:36px;padding:0 10px;background:#0b1723ad;border:1px solid #ffffff24;border-radius:6px;font-size:10px;color:#f2f5f7;font-variant-numeric:tabular-nums;pointer-events:none;white-space:nowrap;z-index:7}
.mobile-hud>span{flex-shrink:0}
.mobile-hud b{font-size:12px}
.mobile-hud .mobile-speed b{font-size:22px;font-weight:600}
#mobileGuidance{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;color:#ffd3a0;text-align:right;font-size:10px}
.touch-layout.podium-mode #race .mobile-hud{display:none}
@media(max-width:740px){.touch-layout #race .mobile-hud{gap:9px;padding:0 7px;font-size:9px}.mobile-hud b{font-size:11px}#mobileGuidance{display:none}}
@media(max-height:340px){.touch-layout #race .mobile-hud{height:32px}.touch-layout #race .actions>button{height:44px}.touch-layout .rear-view{top:57px}.touch-layout .touch-controls{bottom:max(10px,env(safe-area-inset-bottom))}}

/* Graphics interruptions stop play and use their own modal, including in portrait. */
#graphicsRecovery{position:fixed;inset:0;z-index:30;background:#060c14d9;display:flex;align-items:center;justify-content:center;padding:12px}
.graphics-card{width:min(440px,100%);max-height:100%;overflow:auto;padding:22px;background:#151c24;border:1px solid #ffffff35;border-radius:10px;text-align:center}
.graphics-card h2{margin:0 0 12px;font-size:24px}.graphics-card p{font-size:14px;line-height:1.5;color:#d2d8dd;margin:10px 0}
.graphics-card button{min-height:44px;margin:8px 4px 0}.graphics-card small{display:block;margin-top:12px;font-size:11px;line-height:1.4;color:#bbc2c7}
.graphics-card button:disabled{opacity:.4;cursor:wait}
@media(max-height:340px){.graphics-card{width:min(520px,100%);padding:14px}.graphics-card h2{font-size:20px;margin-bottom:6px}.graphics-card p{margin:6px 0}.graphics-card small{margin-top:8px}}

/* Revision 18: transparent speedometer directly above Auto Gear. */
.instruments{width:310px;min-width:0;grid-template-columns:1fr 170px;pointer-events:none}
.instruments .gear{grid-column:2;border:0;padding:0;text-align:center}
.instruments .gear.shifting{background:transparent;box-shadow:none}
.instruments .gear.shifting>strong{text-shadow:0 0 16px #ffb66c}
.speedometer{display:block;width:170px;height:auto;overflow:visible;background:transparent;filter:drop-shadow(0 1px 2px #000) drop-shadow(0 0 3px #000a);font-variant-numeric:tabular-nums}
.speedometer .dial-track,.speedometer .dial-arc{fill:none;stroke-width:4;stroke-linecap:round}
.speedometer .dial-track{stroke:#eeeae378}
.speedometer .dial-arc{stroke:#ff493e}
.speedometer .dial-marks line{stroke:#fff9f0}
.speedometer text{fill:#fff9f0;text-anchor:middle}
.speedometer .dial-marks text{font-size:19px}
.speedometer #speedNeedle path{fill:#ff493e}
.speedometer #speedNeedle circle{fill:#fff9f0}
.speedometer .dial-value{font-size:58px;font-weight:500;font-style:italic}
.speedometer .dial-unit{font-size:20px;letter-spacing:2px}
@media(max-height:900px){body:not(.touch-layout) .instruments{grid-template-columns:1fr 150px}body:not(.touch-layout) .speedometer{width:150px}body:not(.touch-layout) .gear strong{font-size:40px}body:not(.touch-layout) .tach{margin-top:8px}}
/* Keep all eight standings readable above the new dial at intermediate heights. */
@media(min-height:751px) and (max-height:900px){body:not(.touch-layout) .leaderboard header{padding:7px 10px}body:not(.touch-layout) .leaderboard #standings>div{min-height:20px;padding:3px 10px;font-size:11px}body:not(.touch-layout) .leaderboard footer{padding:6px 10px}}
@media(max-height:650px){body:not(.touch-layout) .instruments{grid-template-columns:1fr 130px}body:not(.touch-layout) .speedometer{width:130px}body:not(.touch-layout) .gear strong{font-size:32px}body:not(.touch-layout) .gear #upshifts{margin-top:3px}body:not(.touch-layout) .gear-ladder{margin:4px 0}}
.touch-layout #race .instruments{display:block;left:auto;right:max(18px,env(safe-area-inset-right));bottom:max(108px,calc(env(safe-area-inset-bottom) + 100px));transform:none;width:126px;min-width:0;padding:0;background:transparent;border:0;border-radius:0;z-index:7}
.touch-layout #race .instruments .gear{padding:0;background:transparent;box-shadow:none;border:0}
.touch-layout #race .instruments .gear>small,.touch-layout #race .instruments .gear>strong,.touch-layout #race .instruments .gear>span{display:none}
.touch-layout #race .speedometer{width:100%}
.touch-layout #race .speedometer .dial-marks text{font-size:24px}
.touch-layout #race .speedometer .dial-value{font-size:65px}
.touch-layout #race .speedometer .dial-unit{font-size:25px}
.touch-layout.podium-mode #race .instruments{display:none}
@media(max-height:360px){.touch-layout #race .instruments{bottom:max(96px,calc(env(safe-area-inset-bottom) + 80px));width:126px}}
@media(max-height:270px){.touch-layout #race .instruments{width:104px}}

/* Revision 19: medium story type, compact introduction, two new adventures. */
#dialog:has(.story-route),#dialog:has(.story-portrait){width:680px;padding:24px}
#dialog:has(.story-route) h2,#dialog:has(.story-portrait) h2{font-size:28px;line-height:1.15;margin:12px 0}
#dialog:has(.story-route) p,#dialog:has(.story-portrait) p,#dialog .story-goals{font-size:16px;line-height:1.5}
#dialog .story-difficulty{font-size:13px!important}#dialog .story-controls{font-size:14px}#dialog .story-goals li{padding:4px 0}
#dialog .eyebrow{font-size:10px}.story-route{width:calc(100% + 48px);margin:-24px -24px 18px;height:170px}
.racer-intro-photo{margin:12px 0}.racer-intro-photo .story-portrait{max-height:170px}.racer-intro-photo figcaption{padding:8px 12px;font-size:11px}
#dialog:has(.racer-intro-photo) .primary,#dialog:has(.racer-intro-photo) .secondary{min-height:42px;padding:12px;font-size:12px;margin-top:8px}
.route-options{grid-template-columns:repeat(3,minmax(0,1fr))}.maze-card{text-decoration:none;display:block;color:inherit}
.lava-status{position:absolute;left:3%;top:105px;padding:10px 14px;background:#271a15db;border:1px solid #ffb56288;border-radius:5px;color:#ffd58a;font-size:13px;letter-spacing:1px;pointer-events:none}
.touch-layout .lava-status{display:none}
.touch-layout #dialog:has(.story-route) h2,.touch-layout #dialog:has(.story-portrait) h2{font-size:23px}
.touch-layout #dialog:has(.story-route) p,.touch-layout #dialog:has(.story-portrait) p,.touch-layout #dialog .story-goals{font-size:15px;line-height:1.45}
@media(max-width:900px){.route-options{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:540px){.route-options{grid-template-columns:1fr}#dialog:has(.racer-intro-photo){padding:18px}.racer-intro-photo .story-portrait{max-height:140px}}
@media(max-height:520px) and (min-width:600px){
 #dialog:has(.racer-intro-photo){display:grid;grid-template-columns:165px 1fr 1fr;gap:8px 14px;width:680px;padding:16px;text-align:left;max-height:calc(100dvh - 20px)}
 #dialog:has(.racer-intro-photo)>.eyebrow{grid-column:1/-1}
 #dialog:has(.racer-intro-photo)>.racer-intro-photo{grid-column:1;grid-row:2/5;margin:0;align-self:start}
 #dialog:has(.racer-intro-photo)>h2{grid-column:2/4;font-size:21px;margin:0}
 #dialog:has(.racer-intro-photo)>p{grid-column:2/4;font-size:14px;line-height:1.4;margin:0}
 #dialog:has(.racer-intro-photo)>button{width:100%;font-size:10px;letter-spacing:.5px;margin:0;padding:9px;min-height:38px}
 #dialog:has(.racer-intro-photo)>#enterStory{grid-column:2}#dialog:has(.racer-intro-photo)>#skipStory{grid-column:3}
 .racer-intro-photo figcaption{font-size:9px;padding:7px}.racer-intro-photo figcaption span{display:none}
}
@media(max-height:520px) and (min-width:600px){
 .touch-layout #dialog:has(.racer-intro-photo)>h2{font-size:21px}
 .touch-layout #dialog:has(.racer-intro-photo)>p{font-size:14px;line-height:1.4}
}

/* Decorative artwork never intercepts route or icon taps. */
button,a{touch-action:manipulation}.hero-car,.route-photo,.sound span{pointer-events:none}.route-card{isolation:isolate}.route-card:active,.story-link:active{filter:brightness(1.2)}
body.arrest-mode .driver-camera,body.arrest-mode .instruments,body.arrest-mode .condition,body.arrest-mode .control-dock,body.arrest-mode .rear-view,body.arrest-mode .mobile-hud,body.arrest-mode .touch-controls,body.arrest-mode .race-guidance{display:none!important}

.route-card[data-route=volcano] .route-photo{object-position:50% 66%}
