/* Labels stay inside the painted inset even when the font or viewport changes. */
.side-rail button,.garage-tabs button{grid-template-columns:minmax(0,1fr);white-space:normal;min-height:0}
.side-rail button span,.garage-tabs button span{width:100%;min-width:0;max-width:100%;padding:.06em 1px .12em;overflow-wrap:anywhere;hyphens:auto;text-align:center}
.garage-tabs button{font-size:clamp(9px,1.42cqw,21px)}
.side-rail button{font-size:clamp(9px,1.49cqw,23px)}
.nameplate strong{min-width:0;width:100%;white-space:normal;overflow-wrap:break-word}
.performance span{white-space:normal;overflow-wrap:break-word}
.performance b{white-space:nowrap}
.wallet-action b{width:4.25em;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.wallet-action img{flex:none}
#launch{touch-action:manipulation}
.wheel-arrow,.wheel-arrow:active{translate:none;transform:translate(-50%,-50%)}
.wheel-arrow img{pointer-events:none;transition:scale .1s ease}
.wheel-arrow:active img{scale:.91}
.wheel-arrow.prev:active img{scale:-.91 .91}
.only-wheel{top:14%}
#game:not([data-state=ready]) .garage-only{display:none!important}
#game:not([data-state=ready]) .workshop-top .brand{width:clamp(60px,9.5cqw,147px)}
#game:not([data-state=ready]) .wallet-action{min-height:36px;cursor:default;padding-inline:.6cqw;opacity:1;filter:none}
#game:not([data-state=ready]) .wallet-action .plus{display:none}
.launch-scene{position:absolute;inset:0;pointer-events:none}
.stage-sign{position:absolute;left:50%;top:10%;transform:translateX(-50%);display:grid;gap:clamp(3px,.3cqw,5px);max-width:min(90%,630px);min-width:35%;padding-inline:.45cqw;text-align:center;--edge:clamp(7px,1.08cqw,17px)}
.stage-sign span{font-size:clamp(9px,1.02cqw,15px);letter-spacing:.1em;font-weight:950;color:var(--honey)}
.stage-sign h2{margin:0;font-size:clamp(16px,3.25cqw,47px);font-weight:1000;line-height:1.02}
.stage-sign p{margin:0;font-size:clamp(11px,1.37cqw,20px);font-weight:850;color:#ffe4c1}
#game:is([data-state=staged],[data-state=charge]) .controls{position:absolute;inset:auto max(1.25%,env(safe-area-inset-right)) max(1.3%,env(safe-area-inset-bottom)) max(1.25%,env(safe-area-inset-left));padding:0;background:none}
#stageControls{display:grid;grid-template-columns:clamp(81px,16%,212px) minmax(0,1fr) clamp(142px,27%,413px);gap:clamp(5px,1.35cqw,20px);align-items:center}
#backGarage{justify-self:start;max-width:100%;width:100%;font-size:clamp(11px,1.6cqw,23px);padding:0;--edge:clamp(6px,1.02cqw,16px);gap:.5cqw}
#backGarage img{width:clamp(14px,2.64cqw,36px);height:clamp(14px,2.64cqw,36px);object-fit:contain}
#backGarage span{overflow-wrap:break-word}
#stageControls .rpm{position:static;width:100%;max-width:580px;margin:0 auto;min-width:0;--edge:clamp(5px,.88cqw,13px)}
#stageControls #hint{display:block;font-size:clamp(10px,1.12cqw,16px);line-height:1.24}
#stageControls .rpm-label{font-size:clamp(10px,1.15cqw,17px)}
#stageControls .meter{height:clamp(9px,1.17cqw,17px)}
[data-state=charge] #stageControls .rpm{filter:drop-shadow(0 0 8px #ffdb79)}
#ignite{width:100%;min-width:0;margin:0;height:clamp(53px,13cqw,140px);padding:7px 4px;display:grid;gap:3px;align-content:center;justify-items:center;background:transparent url("assets/ui-launchplate.webp") center / contain no-repeat;border:0;box-shadow:none;color:white;text-shadow:0 2px #5e270a,1px 0 #5e270a,-1px 0 #5e270a;font-weight:1000;text-transform:uppercase;font-size:clamp(15px,2.6cqw,37px);line-height:1;touch-action:none}
#ignite small{text-transform:none;font-size:clamp(10px,1.18cqw,16px);line-height:1.1}
#igniteText,#igniteHelp{text-align:center;overflow-wrap:break-word;min-width:0}
#game[data-state=depart] .controls{display:none}
#garageDialog .wheel-closed img{filter:grayscale(.85) brightness(.64)}
#garageDialog .tile{min-width:0;overflow-wrap:break-word}
#garageDialog .tile button{min-width:0;white-space:normal}
#garageDialog .wheel-state{display:block;color:#ffd581;font-size:clamp(10px,1.16vw,13px);line-height:1.13;font-weight:900;margin-top:3px}
#garageDialog .engine-link{grid-column:1/-1;justify-self:start}
@media (orientation:landscape) and (max-height:375px){
 .garage-tabs button{font-size:clamp(9px,1.82cqw,13px)}
 .side-rail button{font-size:clamp(9px,1.74cqw,13px)}
 .performance span{font-size:clamp(8px,1.4cqw,12px)}
 .performance b{font-size:clamp(10px,1.8cqw,18px)}
 .wallet-action b{width:3.6em}
 .stage-sign{top:15%}
}
@media (orientation:portrait){
 .side-rail button,.garage-tabs button{font-size:clamp(10px,3.44cqw,16px);min-height:44px}
 .wallet-action b{width:auto;flex:1}
 .performance span{font-size:clamp(8px,2.38cqw,12px)}
 .nameplate{width:max-content;max-width:75%}
 .stage-sign{top:4%;min-width:52%;width:max-content}
 .stage-sign h2{font-size:clamp(15px,5cqw,33px)}
 #game:is([data-state=staged],[data-state=charge]) .controls{position:relative;inset:auto;padding:8px 8px max(8px,env(safe-area-inset-bottom));background:#26190e}
 #stageControls{grid-template-columns:minmax(85px,.72fr) minmax(0,1.3fr);gap:6px}
 #stageControls .rpm{grid-column:1/-1;grid-row:1}
 #backGarage{grid-column:1;grid-row:2}
 #ignite{grid-column:2;grid-row:2;height:64px;font-size:20px}
}
@media (orientation:landscape) and (max-width:520px){
 .wallet-action b{width:3.05em}
 .wallet-action .plus{display:none}
 .workshop-top .wallet{gap:3px}
 .workshop-top .gear{min-width:34px;min-height:34px}
 .workshop-top .profile{max-width:26%}
 .performance{left:23%;width:60%}
}

/* Keep the launcher art unobstructed without moving the primary launch button. */
@media (orientation:landscape){
 #stageControls > :is(#backGarage,.rpm){align-self:end;margin-block-end:clamp(2px,.55cqw,9px)}
}
.steer button{display:flex;align-items:center;justify-content:flex-start;gap:clamp(3px,.7cqw,10px);min-height:44px}
.steer-arrow{color:#ffe38d;font-size:clamp(15px,2.4cqw,26px);line-height:1}
.steer-copy{display:grid;gap:2px;text-align:left}
.steer-copy small{font-size:clamp(10px,1.04cqw,13px);font-weight:600;color:#d9eee6;line-height:1.05}
@media (max-width:440px){
 #flightControls{gap:4px}
 .steer{gap:4px}
 .steer button{padding-inline:5px}
 #boost{padding-inline:7px;gap:3px}
}
/* Timing feedback is also conveyed by words, not just the meter color. */
#stageControls #hint{min-height:1.24em}
#rpmPanel[data-timing=ideal]{filter:drop-shadow(0 0 10px #8aff91)}
#rpmPanel[data-timing=ideal] #hint{color:#b7ffb4;font-weight:1000}
#rpmPanel[data-timing=ideal] #perfectZone{background:#b7ffb4aa}
#ignite[data-timing=ideal]{filter:drop-shadow(0 0 8px #a6ff9c)}
#flightLesson{display:block;width:max-content;max-width:min(85vw,470px);margin:6px auto 0;padding:5px 10px;border-radius:7px;border:1px solid #f7cf6a8c;background:#10282eee;color:#fff1bd;font-weight:850;font-size:clamp(11px,1.25cqw,16px);line-height:1.2;white-space:normal}
.flight-hud:has(#flightLesson:not([hidden])){max-width:88%}
.scene:has(#flightLesson:not([hidden])) .notice{top:49%}
#boost[data-cue=now]{outline:2px solid #ffed99;outline-offset:2px}
.result-launch{font-weight:900;color:#ffe0a3;padding:4px 7px;margin:0 0 8px;border-radius:8px;background:#091f25;font-size:clamp(12px,1.8vw,14px)}
.result-launch[data-perfect=yes]{color:#c9ffba;background:#28442f}
.result-goal{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px;text-align:left;margin:0 0 10px;padding:7px;border-radius:9px;background:#11292e;border:1px solid var(--line)}
.result-goal>img{width:clamp(28px,7vw,42px);height:clamp(28px,7vw,42px);object-fit:contain}
.result-goal-copy{display:grid;gap:3px;min-width:0}
.result-goal-copy strong,.result-goal-copy label{overflow-wrap:anywhere}
.result-goal-copy strong{font-size:clamp(13px,2vw,16px)}
.result-goal-copy label{font-size:12px;color:var(--muted)}
.result-goal progress{width:100%;height:7px;accent-color:var(--gold)}
#resultUnlock{font-size:12px;padding-inline:6px}
#resultEngine{display:grid;gap:2px;line-height:1.1;text-align:center}
#resultEngine small{font-size:10px;font-weight:650;color:var(--muted)}
.result-actions{flex-wrap:wrap}
@media(max-height:400px) and (orientation:landscape){
 #result .result-head img{display:none}
 #result{padding-block:10px}
 #result .result-head p{margin:4px 0}
 .result-launch,.result-stats,.result-goal{margin-bottom:6px}
}

/* Shared progression and result labels. */
.tree-rank,.tree-effect{display:block;font-size:12px;line-height:1.25}
.tree-rank{color:#b8d3c8;font-weight:700;margin-top:3px}
.tree-effect{color:#ffdc82;font-weight:800;margin-top:4px}
.result-route{color:#b9e4d3;font-weight:750;font-size:12px;margin:4px 0}
.result-bonuses{color:#ffe19d;font-size:12px;font-weight:800;margin:4px 0 8px}
.perk-intro{grid-column:1/-1;color:#c1d7d0;font-size:13px;margin:0}
#guardHud:not([hidden]){outline:1px solid #5bc7b3b0}

/* The talent tree has its own entrance in the workshop, outside the garage tabs. */
#prepControls .garage-tabs{grid-template-columns:repeat(5,minmax(0,1fr))}
.tree-entry{
 position:absolute;z-index:3;right:max(1.6%,env(safe-area-inset-right));top:68.5%;width:18%;height:10%;min-height:44px;
 --edge:clamp(6px,.75cqw,13px);display:flex;gap:clamp(3px,.62cqw,10px);padding:0;
 font-size:clamp(11px,1.65cqw,24px);line-height:1.04;text-align:left;font-weight:950;
}
.tree-entry img{width:clamp(20px,3.4cqw,51px);height:clamp(20px,3.4cqw,51px);flex:none;object-fit:contain}
.tree-entry:focus-visible{outline-offset:0}
@media (orientation:landscape) and (max-height:375px){
 .tree-entry{top:69%;height:11%}
}
@media (orientation:landscape) and (max-width:520px){
 .tree-entry{top:54%;width:21%}
}
@media (orientation:portrait){
 .tree-entry{top:auto;bottom:6px;right:7px;width:112px;height:44px;--edge:7px;font-size:12px}
 .tree-entry img{width:24px;height:24px}
 #prepControls .garage-tabs{grid-template-columns:repeat(6,minmax(0,1fr))}
 .garage-tabs>button{grid-column:span 2}
 .garage-tabs>button:nth-child(n+4){grid-column:span 3}
}

#resultBest,#engineBought{margin:1px 0 6px;font-size:13px;font-weight:800;line-height:1.2;color:#bde7c8}
#engineBought{color:#e9f9a9}
#result #again{order:-1;min-width:108px}
#result .result-stats{margin-bottom:4px}
@media(max-height:400px) and (orientation:landscape){
 #result{max-height:calc(100dvh - 14px)}
 #resultBest,#engineBought{margin-bottom:3px}
 #result .result-actions{gap:5px}
 #result .result-actions button{min-height:40px}
}

.result-summary{display:flex;align-items:center;justify-content:center;gap:10px;flex-wrap:wrap}
@media(max-height:400px) and (orientation:landscape){
 #result{width:min(592px,calc(100vw - 18px));padding:8px 10px}
 #result .result-head h2{font-size:22px;margin:0}
 #result .result-head p{font-size:13px;line-height:1.15;margin:2px 0}
 #result .result-route{margin:2px 0;font-size:11px}
 #resultLaunch{padding-block:2px;margin-bottom:4px;font-size:12px}
 #result .result-stats div{padding:4px;gap:0}
 #result .result-stats b{font-size:17px}
 #result .result-stats span{font-size:11px}
 #result .result-bonuses{margin:3px 0 5px}
 #resultGoal{padding:4px 6px;margin-bottom:5px}
 #resultGoal>img{width:29px;height:29px}
 #resultGoal .result-goal-copy{grid-template-columns:auto minmax(0,1fr);align-items:center;gap:2px 5px}
 #resultGoal .result-goal-copy .eyebrow{display:none}
 #resultGoal .result-goal-copy strong{font-size:12px}
 #resultGoal .result-goal-copy label{font-size:11px}
 #resultGoal progress{grid-column:1/-1;height:5px}
 #result .result-actions button{font-size:12px;padding-inline:8px;min-height:44px}
}
