/* Scale the playfield with both screen dimensions, with readable lower bounds. */
:root{
 --route-hit:clamp(44px,5vmin,56px);
 --route-step:var(--route-hit);
 --route-mark:clamp(8px,1.25vmin,14px);
 --route-goal:calc(var(--route-mark) + 2px);
 --route-gap:clamp(32px,5vmin,56px);
 --rail-width:var(--route-hit);
 --ui-space:clamp(8px,1.4vmin,18px);
}
.score-hud{display:grid;grid-template-columns:repeat(2,minmax(0,auto));column-gap:clamp(12px,2.5vmin,30px);row-gap:clamp(5px,.9vmin,12px);padding:var(--ui-space) clamp(12px,2vmin,24px);max-width:calc(100vw - 240px)}
.score-hud #flight-info{grid-column:1 / -1;grid-row:1;display:flex;justify-content:center;min-height:0;margin:0;line-height:1}
.score-hud #flight-info[hidden]{display:none}
.score-hud .level-clock{font-family:var(--mono);font-size:clamp(18px,calc(14px + 1vmin),28px);line-height:1;color:#f1f3dc;letter-spacing:.06em}
.score-hud .score-stat{justify-content:center;gap:clamp(5px,.9vmin,12px)}
.score-hud .score-label{font-size:clamp(11px,calc(8px + .7vmin),19px)}
.score-hud #score-value,.score-hud #hop-value{font-size:clamp(16px,calc(10px + 1.5vmin),32px)}
.score-feedback{font-size:clamp(16px,calc(12px + 1vmin),26px);padding:var(--ui-space)}

.trajectory-rail{width:var(--route-hit);max-width:var(--route-hit)}
.trajectory-rail .trajectory-blocks{min-height:var(--route-step);max-height:calc(var(--route-height) - var(--route-step) - var(--route-gap))}
.trajectory-node{width:var(--route-hit);height:var(--route-step);flex-basis:var(--route-step)}
.route-square,#destination-square{width:var(--route-hit);min-width:var(--route-hit);height:var(--route-step);min-height:var(--route-step)}
#destination-square{flex-basis:var(--route-step)}
.route-square::before,.route-square.route-destination::before{width:var(--route-mark);height:var(--route-mark);left:calc((var(--route-hit) - var(--route-mark)) / 2);top:calc((var(--route-step) - var(--route-mark)) / 2)}
.route-square.route-destination::before{width:var(--route-goal);height:var(--route-goal);left:calc((var(--route-hit) - var(--route-goal)) / 2);top:calc((var(--route-step) - var(--route-goal)) / 2)}
.route-gap{height:var(--route-gap);flex-basis:var(--route-gap);gap:clamp(4px,.7vmin,8px)}
.route-gap i{width:clamp(2px,.3vmin,3px);height:clamp(2px,.3vmin,3px)}
.route-tooltip{box-sizing:border-box;max-width:min(clamp(220px,30vw,420px),calc(100vw - var(--route-hit) - var(--edge) * 2 - 16px));padding:clamp(8px,1.4vmin,16px) clamp(10px,1.7vmin,22px);font-size:clamp(18px,calc(14px + 1vmin),30px)}
.route-tooltip b{font-size:inherit}
.route-tooltip small{font-size:clamp(14px,calc(10px + .9vmin),23px);margin-top:clamp(4px,.7vmin,8px)}

body .game-scene{--platform-width:clamp(110px,calc(60px + 15vmin),240px)}
.playing .orbit-camera{top:calc(var(--scene-offset,0px) + var(--planet-size) * .47 + var(--rider-height) * .5 - 4px)}
body .game-scene .world-label b{font-size:clamp(23px,calc(17px + 1.8vmin),42px)}
.playing .flight-console{top:calc(-1 * clamp(24px,6dvh,64px));background:#18352fcc;backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);width:min(clamp(620px,54vw,940px),calc(100vw - var(--edge) * 2));padding:var(--ui-space) clamp(12px,2vmin,26px)}
.flight-console form>label{font-size:clamp(18px,calc(13px + 1.3vmin),28px);margin-bottom:clamp(6px,1.2vmin,14px)}
.flight-console .search-field input{font-size:clamp(21px,calc(15px + 1.5vmin),32px);min-height:clamp(48px,7vmin,68px)}
.suggestions button{font-size:clamp(21px,calc(15px + 1.5vmin),32px);padding:clamp(10px,1.6vmin,18px)}
.move-input-row>.button{min-height:clamp(48px,7vmin,68px)}
@media(hover:hover) and (pointer:fine){:root{--route-step:clamp(24px,3.5vmin,38px)}}
@media(max-width:600px){
 .score-hud{top:calc(64px + env(safe-area-inset-top));max-width:calc(100vw - 32px);padding:6px 12px;column-gap:16px}
 .score-hud .score-stat{flex-direction:row;align-items:baseline}
}
@media(max-height:520px){
 .score-hud{top:max(6px,env(safe-area-inset-top));padding:4px 10px;row-gap:3px}
 .score-hud .level-clock{font-size:16px}
 .score-hud .score-stat{flex-direction:row;align-items:baseline}
 .score-hud .score-label{font-size:10px}
 .score-hud #score-value,.score-hud #hop-value{font-size:14px}
 body .game-scene .world-label b{font-size:20px;-webkit-line-clamp:1}

}
body[data-keyboard-open=true] .score-hud{top:calc(var(--view-top,0px) + 8px + env(safe-area-inset-top))}
body[data-keyboard-open=true] .game-scene,body[data-tight-scene=true] .game-scene{--platform-width:82px}

/* Keep field text crisp while the scenery shows faintly through the input. */
.flight-console .search-field input{background:#102923a6;color:#f1f3dc}
@media(max-height:520px){.playing .flight-console{top:-16px}}
body[data-keyboard-open=true] .flight-console{top:-8px}

/* The mission stays in one viewport; only lists and dialogs scroll. */
html:has(body.playing){overflow:hidden;overscroll-behavior:none}
body.playing{position:fixed;inset:0;height:100dvh;overflow:hidden;overscroll-behavior:none}
body.playing #game{position:absolute;inset:0;height:100dvh;min-height:0;padding:0;touch-action:auto}
body.playing .flight-console{position:absolute;top:auto;bottom:calc(100dvh - var(--view-top,0px) - var(--view-height,100dvh) + clamp(24px,6dvh,64px) + max(12px,env(safe-area-inset-bottom)));left:50%;right:auto;transform:translateX(-50%);margin:0}
body.playing .flight-console:has(#win:not([hidden])) .console-base{max-height:calc(var(--view-height,100dvh) - 160px);overflow-y:auto;overscroll-behavior:contain}
@media(max-height:520px){body.playing .flight-console{bottom:calc(100dvh - var(--view-top,0px) - var(--view-height,100dvh) + max(16px,env(safe-area-inset-bottom)))}}
body.playing[data-keyboard-open=true] .flight-console{bottom:calc(100dvh - var(--view-top,0px) - var(--view-height,100dvh) + 8px)}
