/* 2.0 race experience: edge information, six visible actions and quick entry. */
.activity-picker{display:grid;grid-template-columns:1fr 1fr 1.25fr;gap:6px;margin:8px 0}.activity-picker button{min-height:44px;border:1px solid #173c3440;border-radius:7px;background:#f9f6eb;color:#173c34;font-family:inherit;font-weight:700;font-size:12px;line-height:1.2;padding:7px;cursor:pointer}.activity-picker button[aria-pressed="true"]{background:#173c34;color:#fff5db;border-color:#173c34}.activity-description{font-size:12px;line-height:1.5;margin:6px 0 14px;color:#3a594e}.home-screen .hero-description{margin-bottom:10px}.home-screen .arsenal-overview{display:none}.home-screen .destination-caption{opacity:.7}.home-setup-summary{margin:0 0 7px;font-size:11px;line-height:1.4;color:#284f42;font-weight:650}.home-shortcuts{display:grid;grid-template-columns:1.15fr 1fr 1fr;gap:6px;margin-bottom:8px}.home-shortcut{appearance:none;width:auto;min-width:0;height:44px;min-height:44px;padding:6px;border:1px solid #173c3438;border-radius:6px;background:#f5f2e5;color:#173c34;font-family:inherit;font-weight:700;font-size:12px;line-height:1.2;cursor:pointer}.home-shortcut:hover,.home-shortcut:focus-visible{background:#dfebdc}.home-shortcut .home-variant-name{display:none}.home-screen .hero-actions{display:grid;gap:8px}.home-screen .hero-actions .secondary-row{display:block}.home-screen .hero-actions #free-btn{width:100%}.home-screen .hero-actions .garage-entry{margin:0}.home-screen .hero-actions .friends-entry{margin:0}.home-start{padding-top:8px!important}.home-start>.button{height:48px!important;min-height:48px!important}.home-app-options{margin:10px 0;font-size:12px;border-top:1px solid #173c3430;padding-top:8px}.home-app-options>summary{min-height:40px;display:flex;align-items:center;cursor:pointer;font-weight:700}.home-app-options>summary:after{content:'+';margin-left:auto;padding:0 10px}.home-app-options[open]>summary:after{content:'−'}.home-screen .rival-description{font-size:11px;line-height:1.45}.home-screen .race-format select{min-height:44px}.activity-muted{opacity:.6}.passport-entry{display:grid;grid-template-columns:1fr;gap:2px;margin:14px 0 8px}.passport-entry .button{min-height:44px}.passport-entry .text-button{min-height:40px;text-align:left}.next-objective{font-size:12px;line-height:1.5;color:#315344;margin:10px 0}.first-drive-button{border:1px solid #8f6c36;border-radius:7px;padding:10px 12px;min-height:44px;background:#f1dfad;color:#3c391d;font-family:inherit;font-weight:700;font-size:12px;line-height:1.35;cursor:pointer;width:100%;margin:6px 0}.first-drive-button[hidden]{display:none}.hero-copy .map-option{min-height:94px!important}.home-screen .map-options{gap:7px}.home-screen .map-option svg{height:22px;margin:1px 0 4px}.home-screen .map-option strong{font-size:12px}.home-screen .map-option>span{font-size:10px}.home-screen .map-option .map-difficulty{font-size:8px}.home-screen .route-count{font-size:9px}.home-screen .first-drive-note,.home-screen .expedition-footer{display:none}.home-screen h1{font-size:clamp(32px,4.5vw,64px);line-height:.98;margin-bottom:12px}.home-screen .circuit-character{font-size:11px;line-height:1.45;margin-bottom:8px}
.assist-settings,.dock-settings{margin:20px 0;padding:14px 0 0;border:0;border-top:1px solid #173c3430}.assist-settings legend,.dock-settings legend{font-weight:750;font-size:16px;padding:0 8px 0 0}.assist-settings>.setting-detail,.dock-settings>.setting-detail{font-size:12px;line-height:1.5;margin:4px 0 8px}.settings-dialog .setting-row select{max-width:52%;min-height:44px;font-size:12px}.settings-dialog .setting-row{gap:16px}.dock-settings #reset-dock-btn{min-height:44px}.settings-dialog input:disabled,.settings-dialog select:disabled{opacity:.55}.settings-dialog:has(#drift-toggle-setting:disabled) .assist-settings:after{content:'Timed and shared race rules are fixed for this run. Return home to change assists.';display:block;font-size:12px;line-height:1.5;color:#704d24;margin:10px 0}
body{--dock-width:252px;--dock-button:64px;--dock-lift:0px}body[data-dock-size="compact"]{--dock-width:234px;--dock-button:58px}body[data-dock-size="large"]{--dock-width:276px;--dock-button:72px}body[data-dock-height="raised"]{--dock-lift:34px}body.touch #race-hud #race-actions{width:min(var(--dock-width),calc(100vw - 24px - var(--safe-left) - var(--safe-right)));grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;left:auto;right:calc(var(--drive-edge) + var(--safe-right));bottom:calc(var(--drive-bottom) + 100px + var(--safe-bottom) + var(--dock-lift))}body.touch #race-hud #race-actions .race-action{height:var(--dock-button);min-height:var(--dock-button);padding:4px 3px;gap:2px;border-radius:10px}body.touch #race-hud #race-actions .race-action>.kk-icon{width:16px;height:16px;align-self:center;margin:0}body.touch #race-hud #race-actions .race-action strong{font-size:11px;line-height:12px;min-height:12px}body.touch #race-hud #race-actions .race-action small{font-size:10px;line-height:11px;min-height:22px}body.touch #race-hud #race-actions .race-action .race-action-copy{gap:1px}body.touch #race-hud #race-actions .race-action kbd{display:none}body.touch:is([data-touch-layout="lefty"],[data-touch-layout="buttons-lefty"]):not([data-dock-side="right"]) #race-hud #race-actions,body.touch[data-dock-side="left"] #race-hud #race-actions{left:calc(var(--drive-edge) + var(--safe-left));right:auto}body.touch[data-dock-side="right"] #race-hud #race-actions{left:auto;right:calc(var(--drive-edge) + var(--safe-right))}.pedal.latched{outline:3px solid #fff1b0;outline-offset:2px}.assist-state{position:absolute;right:calc(14px + var(--safe-right));bottom:calc(5px + var(--safe-bottom));font-size:9px;letter-spacing:.4px;color:#fff8df;background:#173c34e8;border-radius:4px;padding:3px 6px;pointer-events:none}.assist-state[hidden]{display:none}.race-tools-toggle{position:absolute;top:calc(88px + var(--safe-top));right:calc(232px + var(--safe-right));min-width:56px;height:44px;padding:7px;border:1px solid #b4cab2;border-radius:9px;color:#fff8e5;background:#173c34ed;font-family:inherit;font-weight:700;font-size:11px;line-height:1.2;pointer-events:auto;z-index:22}.race-hud .race-tools{display:none!important}.race-tools-open .race-hud .race-tools{display:flex!important;top:calc(138px + var(--safe-top));right:calc(232px + var(--safe-right));padding:6px;background:#173c34f5;border:1px solid #9fb89d;border-radius:10px;z-index:25}.race-tools-open .race-tools-toggle{background:#f7f4e9;color:#173c34}.race-paused .race-tools-toggle{visibility:hidden}.race-guidance{position:absolute;left:calc(24px + var(--safe-left));top:calc(158px + var(--safe-top));width:205px;padding:9px 11px;display:grid;gap:3px;border-left:3px solid #dbbd77;border-radius:0 8px 8px 0;background:#153c33ef;color:#fff7df;pointer-events:none;z-index:14}.race-guidance strong{font-size:12px;line-height:1.3}.race-guidance span{font-size:11px;line-height:1.4;color:#e6efdc}.race-guidance[data-kind="attack"]{border-color:#ffb68b;background:#583523f5}.race-guidance[data-kind="warning"]{border-color:#efce72}.race-guidance[hidden],.timed-hud[hidden],.school-goal[hidden]{display:none}.race-hud:has(.race-guidance:not([hidden])) .impact-feedback{top:calc(240px + var(--safe-top))}.timed-hud{position:absolute;left:calc(24px + var(--safe-left));top:calc(88px + var(--safe-top));display:grid;gap:3px;max-width:240px;padding:8px 11px;border-radius:8px;background:#173c34ec;color:#fff7df;font-size:11px;pointer-events:none}.timed-hud strong{font-size:13px}.timed-hud [data-valid="false"]{color:#ffb997}.school-goal{position:absolute;top:calc(90px + var(--safe-top));left:calc(24px + var(--safe-left));width:220px;display:grid;gap:3px;padding:8px 10px;border:1px solid #d7bd79;border-radius:8px;background:#173c34ed;color:#f8efd8;pointer-events:none}.school-goal strong{font-size:12px}.school-goal span{font-size:11px;line-height:1.4}.school-goal[data-complete="true"]{border-color:#8ad7b8}.race-paused .school-goal,.race-paused .race-guidance,.race-paused .timed-hud{visibility:hidden}.finish-pending{top:calc(85px + var(--safe-top));left:calc(24px + var(--safe-left));transform:none;width:min(345px,calc(100vw - 32px));text-align:left;padding:12px 14px;pointer-events:auto}.finish-pending strong{font-size:16px}.finish-pending span{font-size:12px;margin-top:6px}.finish-pending .pending-actions{display:flex;gap:7px;margin-top:10px;flex-wrap:wrap}.pending-actions button{border:1px solid #c0cfac;border-radius:6px;background:#e8e3c9;color:#173c34;min-height:44px;padding:7px 9px;font-family:inherit;font-weight:700;font-size:11px;line-height:1.3;cursor:pointer}.pending-actions button:disabled{opacity:.6}.finish-pending #spectator-label{display:block;margin-top:7px;color:#e1e7d0;font-size:11px}.result-progression{border:1px solid #173c3430;border-radius:10px;background:#e9ecd966;padding:14px 16px;margin:16px 0}.result-progression h2{font-size:22px;margin:0 0 7px}.result-progression p{font-size:13px;line-height:1.5}.result-sectors{display:grid;gap:6px;padding-left:20px;font-size:12px;line-height:1.5}.result-actions #next-circuit-btn{min-height:44px}.result-actions [hidden],.pending-actions [hidden]{display:none!important}.passport-dialog,.challenge-dialog{width:min(680px,calc(100vw - 28px));max-height:calc(var(--game-height,100dvh) - 32px);padding:24px;border:1px solid #173c3455;border-radius:16px;background:#f7f4e9;color:#173c34;overflow-y:auto}.passport-dialog::backdrop,.challenge-dialog::backdrop{background:#102d26aa}.passport-dialog .dialog-heading,.challenge-dialog .dialog-heading{display:flex;justify-content:space-between;gap:20px}.passport-dialog .icon-button,.challenge-dialog .icon-button{min-width:44px;height:44px;font-size:28px}.passport-dialog h2,.challenge-dialog h2{font-size:32px;margin:0 0 8px}.passport-dialog h3{font-size:17px;margin:22px 0 10px}.passport-dialog p,.challenge-dialog p{font-size:13px;line-height:1.6}.passport-note{color:#52685a}.passport-circuits{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.passport-circuit{display:grid;gap:5px;padding:12px;border:1px solid #173c3430;border-radius:8px}.passport-circuit strong{font-size:14px}.passport-circuit span{font-size:12px;text-transform:capitalize}.passport-circuit small{font-size:11px;line-height:1.5}.challenge-dialog .button{min-height:44px;margin:7px 7px 7px 0}.challenge-code-label{display:block;font-size:13px;font-weight:700;margin:18px 0 6px}.challenge-dialog input{width:100%;min-height:44px;border:1px solid #80977f;border-radius:6px;padding:10px;background:#fffdf7;color:#173c34;font-size:13px}.mastery-paints{margin:16px 0;border-top:1px solid #173c3430;padding-top:12px}.mastery-paints h3{font-size:15px;margin:0 0 5px}.mastery-paints p{font-size:11px;line-height:1.5}.mastery-paint-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin-top:9px}.mastery-paint{display:grid;grid-template-columns:18px 1fr;gap:4px 8px;text-align:left;align-items:center;min-height:58px;padding:7px;border:1px solid #173c3440;border-radius:7px;background:#fffaf0;color:#173c34;cursor:pointer}.mastery-paint .paint-chip{grid-row:span 2;width:18px;height:32px;border-radius:5px;background:var(--paint)}.mastery-paint strong{font-size:11px;line-height:1.3}.mastery-paint small{font-size:10px;line-height:1.35}.mastery-paint:disabled{background:#e3e6dc;color:#556254;cursor:default}.mastery-paint.selected{border-color:#173c34;box-shadow:inset 0 0 0 1px #173c34}.school-practice-tools span{line-height:1.4}.drift-meter[data-tier="1"] .drift-track{box-shadow:0 0 0 1px #e3ca7c}.drift-meter[data-tier="2"] .drift-track{box-shadow:0 0 0 2px #e8ae55}.drift-meter[data-tier="3"] .drift-track{box-shadow:0 0 0 2px #e88c55}.drift-track{background-image:linear-gradient(90deg,transparent 27%,#173c34 27% 28%,transparent 28% 57%,#173c34 57% 58%,transparent 58% 89%,#173c34 89% 90%,transparent 90%)}
@media(pointer:coarse),(max-width:700px){.race-tools-toggle{top:calc(66px + var(--safe-top));right:calc(12px + var(--safe-right))}.race-tools-open .race-hud .race-tools{top:calc(114px + var(--safe-top));right:calc(12px + var(--safe-right))}.race-guidance{left:calc(12px + var(--safe-left));top:calc(116px + var(--safe-top));width:min(170px,46vw);padding:7px 8px}.race-guidance strong{font-size:11px}.race-guidance span{font-size:10px}.race-hud:has(.race-guidance:not([hidden])) .impact-feedback{top:calc(198px + var(--safe-top))}.timed-hud,.school-goal{left:calc(12px + var(--safe-left));top:calc(116px + var(--safe-top));width:min(210px,56vw);padding:7px 8px}.race-hud:has(.school-goal:not([hidden])) .race-guidance{top:calc(244px + var(--safe-top))}.home-screen .destination-caption{display:none}.home-screen h1{font-size:40px}.hero-copy .map-option{min-height:84px!important}.home-screen .map-option svg{height:17px}.home-screen .map-option strong{font-size:11px}.home-screen .map-option>span{font-size:9px}.home-setup-summary{font-size:10px}.home-shortcut{font-size:11px}.home-start .race-button-note{font-size:9px}.home-start>.button{padding:0 12px!important}.home-shortcuts{margin-bottom:6px}.home-screen .home-scroll{padding-bottom:8px}.passport-circuits{grid-template-columns:1fr}.passport-dialog,.challenge-dialog{padding:18px}.settings-dialog .setting-row{flex-wrap:wrap}.settings-dialog .setting-row select{max-width:100%}.settings-dialog .setting-row>span{flex:1 1 160px}.settings-dialog .setting-row>select{flex:1 1 130px}.settings-dialog .setting-row>input{flex:none}}
@media(orientation:landscape) and (max-height:600px){.home-screen h1{font-size:32px}.home-screen .hero-copy{width:min(460px,50vw)}.home-screen .hero-description{font-size:12px}.home-screen .map-options{grid-template-columns:repeat(3,minmax(0,1fr))}.hero-copy .map-option{min-height:74px!important}.home-screen .map-option svg{height:14px}.home-start{padding-top:5px!important}.home-setup-summary{font-size:10px;margin-bottom:4px}.home-shortcuts{gap:5px;margin-bottom:5px}.home-shortcut{height:44px;font-size:11px}.home-start>.button{height:44px!important;min-height:44px!important}.race-tools-toggle{top:calc(8px + var(--safe-top));right:calc(64px + var(--safe-right))}.race-tools-open .race-hud .race-tools{top:calc(60px + var(--safe-top));right:calc(64px + var(--safe-right))}body.touch #race-hud #race-actions{bottom:calc(var(--drive-bottom) + 90px + var(--safe-bottom) + min(var(--dock-lift),12px))}.race-guidance{top:calc(115px + var(--safe-top));width:min(170px,22vw)}.race-hud:has(.race-guidance:not([hidden])) .impact-feedback{top:calc(204px + var(--safe-top))}.school-goal,.timed-hud{top:calc(98px + var(--safe-top));width:min(200px,25vw)}.school-goal span{font-size:10px;line-height:1.3}.race-hud:has(.school-goal:not([hidden])) .race-guidance{top:calc(206px + var(--safe-top))}.finish-pending{top:calc(70px + var(--safe-top));width:295px}.finish-pending span{font-size:11px}.finish-pending .pending-actions{margin-top:7px}.school-goal~.impact-feedback{max-width:170px}}
@media(max-width:350px){.home-screen h1{font-size:34px}.activity-picker button{font-size:10px}.home-shortcut{font-size:10px}.home-setup-summary{font-size:10px}.home-start .race-button-note{display:none}.home-screen .map-options{gap:5px}.home-screen .map-option strong{font-size:10px}.home-screen .map-option>span{font-size:8px}.race-guidance{width:148px}.race-guidance strong{font-size:10px}.mastery-paint-grid{grid-template-columns:1fr}}
@media(orientation:landscape) and (max-height:350px){body{--dock-button:54px}body[data-dock-size="large"]{--dock-button:58px}body.touch #race-hud #race-actions{bottom:calc(var(--drive-bottom) + 84px + var(--safe-bottom));gap:5px}body.touch #race-hud #race-actions .race-action>.kk-icon{display:none}body.touch #race-hud #race-actions .race-action strong{min-height:14px}.school-goal{top:calc(75px + var(--safe-top))}.school-goal span{max-height:39px;overflow:hidden}}

.race-hud:has(.race-guidance:not([hidden])) .school-goal{display:none}

.first-drive-button small{display:block;margin-top:3px;font-size:10px;font-weight:500;line-height:1.35}
body.touch .race-tools-toggle{right:calc(62px + var(--safe-right));top:calc(64px + var(--safe-top))}
body.touch.race-tools-open .race-hud .race-tools{right:calc(62px + var(--safe-right));top:calc(114px + var(--safe-top))}
@media(orientation:landscape) and (max-height:600px){body.touch .race-tools-toggle{right:calc(120px + var(--safe-right));top:calc(8px + var(--safe-top))}body.touch.race-tools-open .race-hud .race-tools{right:calc(120px + var(--safe-right));top:calc(60px + var(--safe-top))}.home-screen .home-scroll>.eyebrow,.home-screen .hero-description,.home-screen .activity-description{display:none}.home-screen h1{font-size:28px;margin:0 0 7px}.home-screen .map-option svg{display:none}.home-screen .map-option .map-difficulty{display:none}.hero-copy .map-option{min-height:46px!important;padding:6px}.home-screen .collection-heading{margin-bottom:5px}.first-drive-button{margin:0 0 6px;padding:6px 10px;font-size:11px}.first-drive-button small{font-size:9px}}
@media(orientation:portrait) and (max-height:700px){body[data-dock-height="raised"]{--dock-lift:0px}body[data-dock-size="large"]{--dock-button:64px}}

body:not(.touch) #race-hud #race-actions{width:min(calc(var(--dock-width)*2 + 60px),calc(100vw - 48px));grid-template-columns:repeat(6,minmax(0,1fr));bottom:calc(24px + var(--safe-bottom) + var(--dock-lift))}body:not(.touch) #race-hud #race-actions .race-action{height:calc(var(--dock-button) + 18px);min-height:calc(var(--dock-button) + 18px)}body:not(.touch)[data-dock-side="left"] #race-hud #race-actions{left:calc(24px + var(--safe-left));right:auto}
@media(max-width:700px){body:not(.touch) #race-hud #race-actions{width:min(var(--dock-width),calc(100vw - 24px));grid-template-columns:repeat(3,minmax(0,1fr));right:12px;bottom:calc(14px + var(--safe-bottom) + var(--dock-lift))}body:not(.touch) #race-hud #race-actions .race-action{height:var(--dock-button);min-height:var(--dock-button)}body:not(.touch)[data-dock-side="left"] #race-hud #race-actions{left:12px}}

body:is([data-activity="timeattack"],[data-activity="challenge"]) .lap-timing{display:none}body.touch:is([data-activity="timeattack"],[data-activity="challenge"]) .race-top{grid-template-columns:minmax(100px,132px) 80px minmax(44px,1fr)}
/* Keep assist state above the pedals; safe-area space below them is too small. */
body.touch .assist-state{left:calc(108px + var(--safe-left));right:auto;top:calc(64px + var(--safe-top));bottom:auto;width:min(150px,calc(100vw - 230px));min-height:44px;padding:5px 6px;align-items:center;justify-content:center;text-align:center;line-height:1.35;white-space:normal;z-index:15}body.touch .assist-state:not([hidden]){display:flex}


/* Action feedback lives on the controls, keeping the racing line clear. */
#race-actions .race-action[data-state="cooldown"]{border-color:#a2af9b;box-shadow:inset 0 -4px 0 #173c3420}
#race-actions #breaker-btn[data-state="ready"][data-aim="locked"]{border-color:#8ce3b6;box-shadow:0 0 0 2px #236b4a70,inset 0 0 16px #b3e0b530}
#race-actions .race-action[data-feedback="pressed"]{border-color:#fff5c7;box-shadow:0 0 0 3px #edcb77b3,inset 0 0 18px #f4dfb060}
#race-actions .race-action[data-feedback="hit"]{background:#bddfc0;color:#153c2b;border-color:#e6ffca;box-shadow:0 0 0 2px #a9e4a4a0}
#race-actions .race-action[data-feedback="miss"],#race-actions .race-action[data-feedback="waiting"]{border-color:#d6bb86;box-shadow:inset 0 0 10px #f5deaa40}
#race-actions .race-action[data-feedback="hit"] small{color:#153c2b}
.race-preparation-dialog{width:min(440px,calc(100vw - 32px));padding:28px;border:1px solid #b6bfa7;border-radius:18px;background:#f3f2e7;color:#18392c;box-shadow:0 20px 80px #102e2580}
.race-preparation-dialog::backdrop{background:#173c3470}
.race-preparation-dialog h2{margin:8px 0 14px;font-size:26px;line-height:1.2}
.race-preparation-dialog p[role="status"]{min-height:44px;line-height:1.5}
.race-preparation-dialog .button{min-height:44px}

/* Timed summaries and action outcomes share the edge in separate flow rows.
   Wrapped status text reserves its real height. Hazard guidance keeps its
   existing priority layout; School does not use this timed-only stack. */
#race-hud:has(>.timed-hud:not([hidden])):not(:has(>.race-guidance:not([hidden]))){display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto auto;align-content:start;row-gap:8px}
#race-hud:has(>.timed-hud:not([hidden])):not(:has(>.race-guidance:not([hidden])))>.race-top{grid-row:1}
#race-hud:has(>.timed-hud:not([hidden])):not(:has(>.race-guidance:not([hidden])))>.timed-hud{position:static;grid-row:2;justify-self:start}
#race-hud:has(>.timed-hud:not([hidden])):not(:has(>.race-guidance:not([hidden])))>.impact-feedback{position:static;grid-row:3;justify-self:start}
body.touch #race-hud:has(>.timed-hud:not([hidden])):not(:has(>.race-guidance:not([hidden])))>.timed-hud{margin-top:52px}
body.touch:is([data-touch-layout="lefty"],[data-touch-layout="buttons-lefty"]) #race-hud:has(>.timed-hud:not([hidden])):not(:has(>.race-guidance:not([hidden])))>.impact-feedback{justify-self:end}
@media(orientation:landscape) and (max-height:600px){body.touch #race-hud:has(>.timed-hud:not([hidden])):not(:has(>.race-guidance:not([hidden])))>.timed-hud{margin-top:34px}}

/* Mobile driving: one reachable action dock, independent thumb stations and
   a clear choice of acceleration style. Camera clearance is measured from
   these visible controls rather than inferred from an orientation preset. */
.mobile-controls,.settings-footer,.pedal-assist-note{display:none}
body.touch .mobile-controls{display:block;min-width:0}
.mobile-control-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
.mobile-control-options button{
 min-height:50px;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
 padding:7px 6px;border:1px solid #8fa58b;border-radius:9px;background:#f8f7ed;color:#244b3b;
 text-align:center;font:inherit;line-height:1.2;touch-action:manipulation;
}
.mobile-control-options button strong{font-size:12px;line-height:1.2}
.mobile-control-options button>span{font-size:10px;line-height:1.3;font-weight:400}
.mobile-control-options button[aria-pressed="true"]{border-color:#173c34;background:#173c34;color:#fff7dc;box-shadow:inset 0 0 0 1px #173c34}
.mobile-control-options button:focus-visible{outline:3px solid #ad6d36;outline-offset:2px}
.mobile-control-options button:disabled{opacity:.65;cursor:default}
.mobile-control-status{margin:5px 0 0;font-size:11px;line-height:1.35;color:#3c594b;overflow-wrap:anywhere}
.mobile-control-status:empty{display:none}
.home-start .mobile-controls{margin:0 0 8px}
.settings-mobile-controls{padding:0 0 18px;margin:0 0 18px;border-bottom:1px solid #173c3424}
.settings-mobile-controls h3{font-size:16px;line-height:1.3;margin:0 0 10px}
.settings-mobile-controls .mobile-control-options button{min-height:64px}
.settings-mobile-controls .mobile-control-options button strong{font-size:14px}
.settings-mobile-controls .mobile-control-options button>span{font-size:12px;line-height:1.4}
.settings-mobile-controls .mobile-control-status{font-size:12px;margin-top:8px;line-height:1.5}

body.touch{
 --drive-width:calc(var(--game-width,100vw) - var(--safe-left) - var(--safe-right) - var(--drive-edge) - var(--drive-edge));
 --drive-steering:clamp(128px,calc(var(--drive-width)*.48),184px);
 --drive-pedal:clamp(56px,calc(var(--drive-width)*.21),68px);
 --drive-throttle:clamp(60px,calc(var(--drive-width)*.235),76px);
 --drive-height:84px;--wheel-size:112px;--dock-driving-height:var(--drive-height);--dock-width:264px;--dock-button:56px;
}
body.touch[data-controls="manual"]:not(:is([data-touch-layout="buttons"],[data-touch-layout="buttons-lefty"])){--dock-driving-height:var(--wheel-size)}
body.touch[data-dock-size="compact"]{--dock-width:246px;--dock-button:52px}
body.touch[data-dock-size="large"]{--dock-width:288px;--dock-button:64px}
body.touch #race-hud #race-actions{
 width:min(var(--dock-width),var(--drive-width));grid-template-columns:.9fr 1.2fr 1fr;gap:6px;
 bottom:calc(var(--drive-bottom) + var(--dock-driving-height) + 10px + var(--safe-bottom) + var(--dock-lift));
}
body.touch #race-hud #race-actions .race-action{
 display:grid;grid-template-columns:14px minmax(0,1fr);grid-template-rows:14px minmax(22px,auto);
 align-content:center;align-items:center;column-gap:4px;row-gap:3px;padding:5px;
 height:var(--dock-button);min-height:var(--dock-button);border-radius:11px;
}
body.touch #race-hud #race-actions .race-action>.kk-icon{display:block;grid-column:1;grid-row:1;width:14px;height:14px;margin:0;align-self:center;justify-self:center}
body.touch #race-hud #race-actions .race-action .race-action-copy{display:contents}
body.touch #race-hud #race-actions .race-action strong{grid-column:2;grid-row:1;justify-content:center;min-height:0;font-size:11px;line-height:13px;white-space:nowrap;letter-spacing:0}
body.touch #race-hud #race-actions .race-action small{grid-column:1/-1;grid-row:2;min-height:22px;font-size:10px;line-height:11px;align-self:center}
body.touch .steer-button{height:var(--drive-height);min-height:44px}
body.touch .simple-steering,body.touch[data-controls="pedals"] .simple-steering{height:var(--drive-height)}
body.touch .drive-action{height:var(--drive-height)}
body.touch .pedal,body.touch:is([data-touch-layout="buttons"],[data-touch-layout="buttons-lefty"]) .pedal{height:calc(var(--drive-height) - 8px)}
body.touch .throttle-pedal,body.touch:is([data-touch-layout="buttons"],[data-touch-layout="buttons-lefty"]) .throttle-pedal{height:var(--drive-height)}
body.touch[data-controls="pedals"][data-auto-throttle="on"] #throttle-btn{display:none}
body.touch[data-controls="pedals"][data-auto-throttle="on"] #brake-btn{
 width:clamp(100px,calc(var(--drive-width)*.35),132px);height:var(--drive-height);gap:4px;
 background:#e8eddc;border-color:#eef4df;
}
body.touch[data-controls="pedals"][data-auto-throttle="on"] .pedal-assist-note{display:block;max-width:100%;font-size:10px;line-height:12px;font-weight:400;white-space:normal;color:#365747}
body.touch .drift-meter{left:auto;right:calc(var(--drive-edge) + var(--safe-right));bottom:calc(var(--drive-bottom) + var(--drive-height) + 4px + var(--safe-bottom));width:calc(var(--drive-pedal) + var(--drive-throttle) + 8px)}
body.touch:is([data-touch-layout="lefty"],[data-touch-layout="buttons-lefty"]) .drift-meter{left:calc(var(--drive-edge) + var(--safe-left));right:auto}
body.touch[data-controls="pedals"][data-auto-throttle="on"] .drift-meter{width:clamp(100px,calc(var(--drive-width)*.35),132px)}
body.touch .steer-button:focus-visible,body.touch .pedal:focus-visible{outline:3px solid #fff2b7;outline-offset:3px}
body.touch .race-action:focus-visible{outline-offset:2px}

/* Safe edges apply to menus as well as the race. The visual viewport height
   follows browser bars and the keyboard; no full-screen or rotation gate. */
body.touch dialog{
 max-width:calc(var(--game-width,100vw) - 16px - var(--safe-left) - var(--safe-right));
 max-height:calc(var(--game-height,100dvh) - 16px - var(--safe-top) - var(--safe-bottom));
 inset:var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);margin:auto;
 overscroll-behavior:contain;scroll-padding-block:12px;
}
body.touch dialog :is(button,input,select,summary,a){scroll-margin-block:12px}
body.touch dialog :is(input[type="text"],select){font-size:16px}
body.touch .settings-dialog[open]{
 display:flex;flex-direction:column;height:min(780px,calc(var(--game-height,100dvh) - 16px - var(--safe-top) - var(--safe-bottom)));
 padding:0;overflow:hidden;
}
body.touch .settings-dialog>.dialog-heading{flex:none;padding:16px 18px;margin:0;border-bottom:1px solid #173c3424}
body.touch .settings-dialog>.dialog-heading h2{font-size:27px;line-height:1.2}
body.touch .settings-dialog .settings-content{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:18px;scroll-padding-block:12px}
body.touch .settings-dialog .settings-footer{display:flex;flex:none;padding:10px 18px;border-top:1px solid #173c3424;background:#f7f4e9}
body.touch .settings-footer>.button{width:100%;min-height:48px;height:auto;padding:12px 18px;justify-content:center;font-size:14px}
body.touch .settings-dialog .control-option{padding:13px;gap:10px}
body.touch .settings-dialog .control-option p{font-size:12px;line-height:1.55}
body.touch .settings-dialog .setting-row{min-height:54px}
body.touch .settings-dialog .setting-detail{font-size:12px;line-height:1.45}
body.touch .settings-dialog .settings-grid{margin-top:18px}
body.touch .settings-dialog .sound-check{padding-bottom:4px}
body.touch .driving-school-dialog{height:min(790px,calc(var(--game-height,100dvh) - 16px - var(--safe-top) - var(--safe-bottom)));padding:0}
body.touch .school-lesson{scroll-padding-block:12px}
body.touch .school-footer .button{min-height:46px}

@media(orientation:portrait) and (max-width:700px){
 body.touch .topbar{padding:calc(10px + var(--safe-top)) calc(12px + var(--safe-right)) 8px calc(12px + var(--safe-left))}
 body.touch .home-screen{padding:calc(70px + var(--safe-top)) calc(12px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(12px + var(--safe-left))}
 body.touch .home-screen .hero-copy{width:100%}
 body.touch .home-scroll{padding-right:4px;padding-bottom:14px;scroll-padding-block:12px}
 body.touch .home-scroll>.eyebrow{display:none}
 body.touch .home-screen h1{font-size:clamp(30px,8.5vw,38px);letter-spacing:-1.3px;line-height:1.08;margin:0 0 8px}
 body.touch .home-screen h1 br{display:none}
 body.touch .home-screen .hero-description{font-size:12px;line-height:1.4;margin:0 0 10px}
 body.touch .home-screen .activity-picker{margin:6px 0}
 body.touch .home-screen .activity-description{font-size:11px;line-height:1.4;margin:5px 0 10px}
 body.touch .home-screen .map-options{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
 body.touch .hero-copy .map-option{min-height:78px!important;padding:7px 4px}
 body.touch .home-screen .map-option svg{height:16px;margin:0 0 3px}
 body.touch .home-screen .map-option strong{font-size:11px;line-height:1.3}
 body.touch .home-screen .map-option>span{font-size:10px;line-height:1.25;margin-top:3px}
 body.touch .home-screen .map-option .map-difficulty{font-size:9px;line-height:1.2;margin-top:4px;padding:2px 4px}
 body.touch .home-screen .collection-heading{margin-bottom:7px}
 body.touch .home-screen .circuit-character{font-size:11px;margin:7px 0 10px}
 body.touch .home-start{padding:8px 4px 0 0!important;border-top:1px solid #173c3424;background:#f7f4e9}
 body.touch .home-start>.button{height:52px!important;min-height:52px!important;font-size:14px}
 body.touch .home-start .home-setup-summary{font-size:11px;line-height:1.35;margin-bottom:6px}
 body.touch .home-shortcuts{gap:6px;margin-bottom:7px}
 body.touch .home-shortcut{font-size:11px}
 body.touch .home-start .mobile-control-status{min-height:15px}
 body.touch .garage-screen{padding-left:calc(12px + var(--safe-left));padding-right:calc(12px + var(--safe-right))}
 body.touch .garage-screen .garage-copy{height:57%;max-height:calc(var(--game-height,100dvh) - 180px - var(--safe-top) - var(--safe-bottom))}
 body.touch .garage-start{padding-right:4px}
 body.touch .garage-start>.button{min-height:48px}
 body.touch .school-footer{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;padding:10px 14px}
 body.touch .school-page-actions{display:grid;grid-template-columns:1fr 1fr;grid-column:1/-1;gap:7px}
 body.touch .school-footer .school-progress{grid-column:1/-1;font-size:10px}
 body.touch .school-footer #school-practice,body.touch .school-footer #school-return{grid-column:1/-1}
 body.touch .school-footer .button{font-size:12px;min-height:44px;padding:9px 12px}
 body.touch .school-footer>.primary{min-height:48px;justify-content:center;font-size:13px}
}
@media(orientation:portrait) and (max-height:700px){
 body.touch[data-dock-height="raised"]{--dock-lift:0px}
 body.touch .home-start .home-setup-summary{font-size:10px}
 body.touch .mobile-control-options button{min-height:46px;padding-block:6px}
 body.touch .home-start .mobile-control-status{font-size:10px;line-height:1.3}
 body.touch .school-header{padding:10px 14px}
 body.touch .school-header p:not(.eyebrow){display:none}
 body.touch .school-figure img{max-height:110px}
}
@media(orientation:landscape) and (max-height:600px){
 body.touch{--drive-height:80px;--race-info-left:calc(var(--drive-edge) + var(--safe-left));--race-info-right:auto;--race-info-align:start}
 body.touch:is([data-dock-side="left"],[data-touch-layout="lefty"]:not([data-dock-side="right"]),[data-touch-layout="buttons-lefty"]:not([data-dock-side="right"])){--race-info-left:auto;--race-info-right:calc(var(--drive-edge) + var(--safe-right));--race-info-align:end}
 body.touch #race-hud>:is(.timed-hud,.race-guidance,.school-goal,.impact-feedback){left:var(--race-info-left);right:var(--race-info-right)}
 body.touch[data-screen="race"] #race-hud:has(>.timed-hud:not([hidden])):not(:has(>.race-guidance:not([hidden])))>:is(.timed-hud,.impact-feedback){justify-self:var(--race-info-align)}
 body.touch #race-hud:has(>.race-guidance:not([hidden]))>.timed-hud{display:none}
 body.touch .assist-state:not([hidden]){display:none}
 body.touch #race-hud #race-actions{bottom:calc(var(--drive-bottom) + var(--dock-driving-height) + 10px + var(--safe-bottom) + min(var(--dock-lift),12px))}
 body.touch .home-screen{padding:calc(64px + var(--safe-top)) calc(16px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(16px + var(--safe-left))}
 body.touch .home-screen .hero-copy{display:grid;grid-template-columns:minmax(0,1fr) minmax(190px,.74fr);gap:20px;width:min(940px,100%);height:100%;min-height:0}
 body.touch .home-scroll{height:100%;min-height:0;padding-right:5px;padding-top:0}
 body.touch .home-start{align-self:end;min-width:0;padding:8px 0 0!important;background:transparent}
 body.touch .home-start .home-setup-summary{font-size:10px;line-height:1.3;margin-bottom:5px}
 body.touch .home-shortcuts{grid-template-columns:1.1fr 1fr 1fr;gap:5px;margin-bottom:6px}
 body.touch .home-shortcut{font-size:10px;padding:5px 3px}
 body.touch .home-start .mobile-controls{margin-bottom:6px}
 body.touch .home-start .mobile-control-options button{min-height:44px;padding:5px;font-size:11px}
 body.touch .home-start .mobile-control-options button>span{display:none}
 body.touch .home-start .mobile-control-status{font-size:10px;line-height:1.3;margin-top:4px}
 body.touch .home-start>.button{height:46px!important;min-height:46px!important}
 body.touch .home-screen .map-options{grid-template-columns:repeat(3,minmax(0,1fr))}
 body.touch .home-screen .map-option strong{font-size:11px;line-height:1.25}
 body.touch .home-screen .map-option>span{font-size:10px;line-height:1.25}
 body.touch .settings-dialog>.dialog-heading{padding:9px 16px;align-items:center}
 body.touch .settings-dialog>.dialog-heading .eyebrow{display:none}
 body.touch .settings-dialog>.dialog-heading h2{font-size:24px}
 body.touch .settings-dialog .settings-content{padding:14px 16px}
 body.touch .settings-dialog .settings-footer{padding:7px 16px}
 body.touch .settings-footer>.button{min-height:44px;padding:9px 16px}
 body.touch .school-footer{padding:7px 12px;gap:8px}
 body.touch .school-footer .school-progress{max-width:90px;font-size:10px}
 body.touch .school-footer .button{min-height:44px;font-size:11px;padding:8px 10px}
}
@media(orientation:landscape) and (max-width:740px){
 body.touch #race-hud #race-actions{width:min(var(--dock-width),max(196px,34vw),var(--drive-width));grid-template-columns:.8fr 1.1fr 1.1fr}
 body.touch #race-hud #race-actions .race-action{grid-template-columns:minmax(0,1fr);padding-inline:3px;column-gap:0}
 body.touch #race-hud #race-actions .race-action>.kk-icon{display:none}
 body.touch #race-hud #race-actions .race-action strong{grid-column:1;font-size:10px}
 body.touch .home-screen .hero-copy{gap:14px}
 body.touch .home-screen .map-options{grid-template-columns:repeat(2,minmax(0,1fr))}
 body.touch .home-screen .route-count,body.touch .home-screen .map-option>i{display:none}
 body.touch .home-start .race-button-note{display:none}
}
@media(orientation:portrait) and (max-width:350px){body.touch .home-screen .map-option strong{font-size:10px;overflow-wrap:normal}}
@media(orientation:landscape) and (max-height:350px){
 body.touch{--drive-height:72px;--wheel-size:90px;--dock-button:52px}
 body.touch[data-dock-size="compact"]{--dock-button:50px}
 body.touch[data-dock-size="large"]{--dock-button:56px}
 body.touch .home-start .mobile-control-options button strong{font-size:11px}
 body.touch .school-header{padding:6px 12px}
 body.touch .school-header .eyebrow{display:none}
 body.touch .school-header h2{font-size:22px}
 body.touch .school-footer .school-progress{max-width:72px;font-size:9px}
 body.touch #race-hud>.timed-hud{gap:1px;padding:5px 7px;font-size:10px;line-height:12px}
 body.touch #race-hud>.timed-hud strong{font-size:12px;line-height:14px}
 body.touch #race-hud:has(>.race-guidance:not([hidden]))>.impact-feedback{display:none}
 body.touch:is([data-activity="timeattack"],[data-activity="challenge"]) .speed-card{left:calc(236px + var(--safe-left));right:auto;top:calc(8px + var(--safe-top));height:48px;padding-top:9px}
 body.touch #race-hud:has(>.timed-hud:not([hidden])):not(:has(>.race-guidance:not([hidden])))>.timed-hud{margin-top:0}
}
@media(orientation:landscape) and (max-height:350px) and (max-width:650px){body.touch:is([data-activity="timeattack"],[data-activity="challenge"]) .speed-card{left:calc(210px + var(--safe-left))}}
