/* Current UI sizing lives here, after the historical theme layers.
   Bounded fluid sizes enlarge laptop UI without shrinking phone text to fit. */
:root{
 --edge:clamp(14px,2.4vw,40px);
 --body-size:clamp(1.375rem,1rem + .75vw,1.75rem);
 --label-size:clamp(1rem,.8rem + .4vw,1.25rem);
 --rail-width:clamp(140px,13vw,200px);
 --home-figure-width:clamp(120px,12vw,180px);
}
body{font-size:var(--body-size);line-height:1.3}
.header,.playing .header{padding:clamp(14px,2.2vh,24px) var(--edge);grid-template-columns:1fr 1fr;min-height:0;gap:12px}
.header .top-back{grid-column:1;min-height:48px;font-size:clamp(20px,1.5vw,25px);padding-inline:8px 13px}
.header .settings-trigger{grid-column:2;width:clamp(48px,3.7vw,56px);height:clamp(48px,3.7vw,56px)}
body:not(.playing) #lobby{padding:0 var(--edge) clamp(24px,4vh,48px);max-width:1120px;min-height:0}
.hero-copy h1{font-size:clamp(2rem,4.8vw,4.25rem);margin:6px 0 14px;line-height:1.35}
.hero-copy .game-tagline{font-size:clamp(23px,2vw,30px);line-height:1.25}
.hero-copy p.quick-rules{font-size:clamp(17px,1.35vw,21px);margin-top:15px;line-height:1.4}
.home-orbit{width:clamp(150px,14vw,220px);height:30px;margin-top:calc(var(--home-figure-width) * .625 + 24px);margin-bottom:24px}
.home-planet{width:100%;height:26px;left:0;top:0}
.home-chameleon{width:var(--home-figure-width);height:calc(var(--home-figure-width) * .625);top:auto;bottom:calc(100% - 2px);left:50%;transform:translateX(-50%)}
.launch-actions>.button{font-size:clamp(11px,.9vw,14px);min-width:clamp(240px,22vw,320px);min-height:56px;padding:18px 24px;line-height:1.5}
.custom-mission-open{font-size:clamp(19px,1.5vw,24px);min-height:44px;padding:8px 14px}
.challenge-section{max-width:1000px;margin-top:clamp(22px,3vh,38px)}
.challenge-caption{font-size:clamp(15px,1.2vw,18px);line-height:1.2;letter-spacing:.5px}
.challenge-caption .icon-button{width:46px;height:46px;min-width:46px}
#challenges{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-top:12px}
.challenge{font-size:clamp(21px,1.7vw,26px);min-height:58px;padding:12px 15px;line-height:1.1;gap:10px;justify-content:center;min-width:0;max-width:100%}
.challenge span{min-width:0;overflow-wrap:anywhere}
.challenge .arrow{flex:0 0 auto}
footer{font-size:clamp(16px,1.3vw,20px);padding:20px var(--edge) 28px}
.game-scene{--platform-width:clamp(156px,14vw,216px);--planet-size:var(--platform-width);--destination-size:var(--platform-width)}
.game-scene .astronaut{width:calc(var(--platform-width) * .68);height:calc(var(--platform-width) * .425)}
.game-scene .world-label{width:max-content;max-width:min(390px,42vw);padding:12px 16px;gap:8px}
.world-label b,.game-scene .world-label b{font-size:clamp(27px,2.3vw,34px);line-height:1.08}
.world-caption,.world-current .world-caption,.world-destination .world-caption{font-size:clamp(16px,1.35vw,20px);line-height:1.15}
.destination-beacon{top:clamp(96px,14vh,138px);right:var(--edge);max-width:clamp(200px,19vw,280px);padding:12px 16px}
.destination-beacon b{font-size:clamp(24px,2vw,30px);line-height:1.1}
.destination-beacon span:not(.beacon-planet){font-size:var(--label-size)}
.trajectory-rail{right:var(--edge);width:var(--rail-width);max-width:none}
.trajectory-blocks{gap:12px}
.trajectory-block{padding:11px 13px;gap:6px}
.trajectory-block b{font-size:clamp(21px,1.65vw,26px);line-height:1.1}
.trajectory-step{font-size:clamp(14px,1.1vw,17px)}
.playing .flight-console{width:min(760px,calc(100vw - var(--edge) * 2));position:relative;left:auto;right:auto;transform:none;margin-inline:auto;padding:18px 22px 13px}
.flight-console form>label{font-size:clamp(20px,1.6vw,25px);line-height:1.1;margin-bottom:11px}
.search-field input,.flight-console .search-field input,dialog .search-field input{font-size:clamp(24px,1.9vw,29px);min-height:58px;line-height:1.1;padding:12px 15px}
.input-star{font-size:25px;top:15px}
.input-star+input,.flight-console .input-star+input{padding-left:42px}
.move-input-row{gap:12px}
.move-input-row>.button{font-size:clamp(10px,.83vw,13px);min-height:58px;padding:12px 20px;line-height:1.5;gap:12px}
.move-input-row>.button:disabled{font-family:var(--mono);font-size:22px;max-width:none}
.flight-info{flex-wrap:wrap;gap:14px;margin-top:8px;min-height:36px}
.flight-info,.flight-info .text-button{font-size:clamp(19px,1.5vw,24px);line-height:1.1}
.flight-info .text-button{min-height:36px;padding:6px 4px}
#move-status{font-size:clamp(20px,1.6vw,25px);line-height:1.15;max-height:72px;overflow-y:auto}
.suggestions button{font-size:clamp(23px,1.8vw,28px);min-height:48px;padding:12px 14px;line-height:1.1}
.suggestions::before{font-size:var(--label-size);line-height:1.2}
dialog{width:min(600px,calc(100vw - 32px));max-height:calc(var(--view-height,100dvh) - 32px);overflow-y:auto;padding:clamp(20px,2vw,30px)}
dialog h2{font-size:clamp(15px,1.25vw,19px);line-height:1.6}
dialog p,.rule strong,.semantic-matches li{font-size:var(--body-size);line-height:1.3}
dialog label,.dialog-heading .eyebrow,.semantic-matches small{font-size:var(--label-size);line-height:1.2}
dialog .button{font-size:11px;min-height:52px}
.settings-dialog{width:min(320px,calc(100vw - 32px));padding:20px;top:calc(var(--view-top,0px) + 88px);right:var(--edge)}
.settings-dialog h2{font-size:26px}
.settings-options button{font-size:25px;min-height:52px}
.win-card h2{font-size:clamp(18px,1.7vw,26px);line-height:1.5}
.win-card>p:not(.eyebrow),#win-rarity{font-size:var(--body-size);line-height:1.25}
.win-actions{flex-wrap:wrap;gap:16px}
.win-actions>.button{font-size:11px;min-height:50px;line-height:1.5}
.win-actions>.text-button{font-size:23px;min-height:44px}
@media(max-width:1000px) and (min-width:768px){#challenges{grid-template-columns:repeat(2,minmax(0,1fr))}.game-scene .world-label{max-width:310px}.playing .flight-console{width:min(680px,calc(100vw - 36px))}}
@media(max-width:767px){
 :root{--edge:14px;--rail-width:clamp(64px,18vw,84px);--home-figure-width:clamp(104px,28vw,132px);--body-size:1.375rem;--label-size:1rem}
 .header,.playing .header{padding:calc(10px + env(safe-area-inset-top)) var(--edge) 8px}
 .header .top-back,.header .settings-trigger{min-height:44px;height:44px}.header .settings-trigger{width:44px}
 .hero-copy h1{font-size:clamp(30px,7.6vw,46px);letter-spacing:-1px;margin-top:4px}
 .hero-copy .game-tagline{font-size:clamp(21px,5.3vw,26px)}
 .hero-copy p.quick-rules{font-size:16px;line-height:1.4;margin-top:12px}
 .home-orbit{margin-top:calc(var(--home-figure-width) * .625 + 22px);margin-bottom:22px;width:150px}
 .launch-actions>.button{font-size:11px;min-height:52px;min-width:240px;padding:16px 20px}
 .challenge-section{margin-top:20px}.challenge-caption{font-size:14px;letter-spacing:0}
 #challenges{grid-template-columns:1fr;gap:11px;margin-top:10px}
 .challenge,.challenge:last-child{display:flex;font-size:22px;min-height:52px;padding:12px;gap:12px}
 .game-scene{--platform-width:clamp(112px,31vw,142px)}
 .playing .orbit-camera{left:0;right:calc(var(--rail-width) + var(--edge) * 2);width:auto}
 .game-scene .world-label{max-width:calc(100vw - var(--rail-width) - var(--edge) * 3 - 12px);padding:9px 11px;gap:6px;min-width:0}
 .game-scene .world-label b{font-size:24px;line-height:1.1;-webkit-line-clamp:3}
 .world-caption,.world-current .world-caption,.world-destination .world-caption{font-size:14px}
 .destination-beacon{top:calc(78px + env(safe-area-inset-top));left:var(--edge);right:calc(var(--rail-width) + var(--edge) * 2);max-width:none;padding:9px 11px;gap:0}
 .destination-beacon .destination-flag{display:none}
 .destination-beacon b{font-size:23px}.destination-beacon span:not(.beacon-planet){font-size:14px}
 .trajectory-rail{right:var(--edge)}.trajectory-blocks{gap:8px}
 .trajectory-block{padding:8px 6px;gap:5px}.trajectory-block b{font-size:17px;line-height:1.1}.trajectory-step{font-size:12px}
 .playing .flight-console{width:calc(100vw - var(--edge) * 2);padding:12px 12px 8px;max-width:none}
 .flight-console form>label{font-size:20px;margin-bottom:9px}
 .move-input-row{gap:9px}
 .flight-console .search-field input,dialog .search-field input{font-size:23px;min-height:52px;padding-block:12px}
 .move-input-row>.button{font-size:0;min-width:52px;min-height:52px;padding:10px 12px;gap:0}
 .move-input-row>.button>span{font-size:28px;line-height:1}
 .move-input-row>.button:disabled{font-size:18px;line-height:1.05;max-width:88px}
 .input-star{font-size:23px;top:14px}
 .flight-info{gap:8px 12px;min-height:32px;margin-top:5px}.flight-info,.flight-info .text-button{font-size:18px}
 .flight-info .text-button{padding:5px 2px;min-height:32px}
 #move-status{font-size:20px;line-height:1.15;max-height:64px}
 .suggestions{max-height:min(250px,40dvh)}.suggestions button{font-size:23px;min-height:48px}
 dialog{padding:20px}dialog .button{font-size:10px}.settings-dialog{top:calc(var(--view-top,0px) + 68px + env(safe-area-inset-top));right:var(--edge);padding:18px}.settings-options button{font-size:23px;min-height:50px}
 .win-card h2{font-size:17px}.win-card>p:not(.eyebrow),#win-rarity{font-size:22px}.win-actions>.button{font-size:9px}.win-actions>.text-button{font-size:21px}
 footer{font-size:16px;padding:20px 14px 26px}
}
@media(max-height:600px){
 .game-scene{--platform-width:120px}
 .playing .flight-console{padding:10px 14px 7px}
 .flight-console form>label{margin-bottom:7px}
 .flight-console .search-field input,.move-input-row>.button{min-height:48px}
 .destination-beacon{top:78px;padding:8px 10px}
 .home-orbit{margin-top:calc(var(--home-figure-width) * .625 + 16px)}
}
body[data-keyboard-open=true] .game-scene,body[data-tight-scene=true] .game-scene{--platform-width:82px;--planet-size:var(--platform-width)}
body[data-keyboard-open=true] .game-scene .astronaut,body[data-tight-scene=true] .game-scene .astronaut{width:56px;height:35px}
body[data-keyboard-open=true] .destination-beacon{top:calc(66px + env(safe-area-inset-top));padding:6px 9px}
body[data-keyboard-open=true] .destination-beacon b{font-size:20px}
body[data-keyboard-open=true] .flight-console{padding:8px 10px 6px}
body[data-keyboard-open=true] .flight-console .search-field input,body[data-keyboard-open=true] .move-input-row>.button{min-height:48px}
@media(max-width:350px){:root{--edge:10px}.game-scene .world-label b{font-size:22px}.flight-info,.flight-info .text-button{font-size:17px}}

/* With the keyboard open, use the now-empty middle of the top navigation. */
body[data-keyboard-open=true] .destination-beacon,body[data-compact-viewport=true] .destination-beacon{top:calc(12px + env(safe-area-inset-top));left:98px;right:72px;max-width:none;padding:6px 9px}
body[data-keyboard-open=true] .destination-beacon>div>span,body[data-compact-viewport=true] .destination-beacon>div>span{display:none}
body[data-keyboard-open=true] .destination-beacon b,body[data-compact-viewport=true] .destination-beacon b{font-size:20px;line-height:1.05;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}

/* Direct help/audio controls replace the settings menu. */
.header-actions{grid-column:2;grid-row:1;justify-self:end;display:flex;gap:10px;align-items:center}
.header-actions .icon-button{display:grid;place-items:center;width:clamp(44px,3.7vw,54px);height:clamp(44px,3.7vw,54px);padding:9px;color:#f1f3dc;background:#18352f;border-color:#91ab88;font:28px/1 var(--mono)}
.header-actions svg{width:25px;height:25px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:square;stroke-linejoin:miter;overflow:visible}
#hero-play{text-transform:none}
.suggestions::before{display:none;content:none}
.rail-heading{display:block;border:0;background:#18352f;color:#e1ebd4;min-height:36px;padding:6px 9px;font:17px/1 var(--mono);margin:0 0 7px;cursor:pointer}
@media(max-width:767px){.header-actions{gap:8px}.header-actions .icon-button{width:44px;height:44px}.rail-heading{font-size:14px;padding:7px 2px;min-height:32px}.destination-beacon{right:var(--edge)}}
body[data-keyboard-open=true] .destination-beacon,body[data-compact-viewport=true] .destination-beacon{right:124px}
/* Keep the blocks themselves centered; the detail shortcut sits above them. */
.trajectory-rail .rail-heading{position:absolute;left:0;bottom:100%;margin-bottom:7px}
/* A small, centered route indicator leaves the playfield its full width. */
:root{--rail-width:44px}
.trajectory-rail{width:44px;max-width:44px}
.trajectory-blocks{gap:2px;padding:3px 0;align-items:center;scrollbar-width:none;max-height:clamp(48px,calc(var(--view-height,100dvh) - var(--console-base-height,180px) * 2 - 56px),calc(var(--view-height,100dvh) - 160px))}
.trajectory-blocks::-webkit-scrollbar{display:none}
.trajectory-node{list-style:none;flex:0 0 44px;width:44px;height:44px;margin:0;padding:0}
.route-square{display:block;position:relative;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border:0;background:transparent;box-shadow:none;cursor:pointer}
.route-square::before{content:'';position:absolute;width:20px;height:20px;left:12px;top:12px;background:var(--skin);border:2px solid var(--skin-light);box-shadow:inset -3px -3px var(--skin-shade),2px 2px #18352f;transition:transform .18s ease,background-color .4s ease}
.route-square[aria-current=step]::before{box-shadow:inset -3px -3px var(--skin-shade),0 0 0 3px #18352f,0 0 0 4px var(--skin-light)}
.route-square:hover::before,.route-square:focus-visible::before{transform:scale(1.15)}
.route-tooltip{position:fixed;z-index:40;width:max-content;max-width:min(280px,calc(100vw - 100px));padding:10px 13px;border:2px solid #a9c797;background:#18352f;box-shadow:3px 3px #102b2666;color:#f1f3dc;font:23px/1.15 var(--mono);overflow-wrap:anywhere;pointer-events:none}
.playing .orbit-camera{left:0;right:0;width:100%}
.game-scene .world-label{max-width:min(350px,calc(100vw - 128px))}
.playing .flight-console{width:min(680px,calc(100vw - var(--edge) * 2))}
@media(max-width:900px){
 .header,.playing .header{padding:calc(10px + env(safe-area-inset-top)) var(--edge) 8px}
 .header .top-back{min-height:44px;height:44px;font-size:20px}
 .header-actions .icon-button{width:44px;height:44px}
 .game-scene{--platform-width:136px}
 .game-scene .astronaut{width:calc(var(--platform-width) * .68);height:calc(var(--platform-width) * .425)}
 .destination-beacon{left:50%;right:auto;transform:translateX(-50%);top:calc(78px + env(safe-area-inset-top));width:max-content;max-width:min(340px,calc(100vw - 100px));padding:9px 13px;gap:0}
 .destination-beacon .destination-flag{display:none}
 .destination-beacon b{font-size:23px;line-height:1.1}
 .destination-beacon span:not(.beacon-planet){font-size:14px}
 .game-scene .world-label{padding:9px 12px;gap:5px}
 .game-scene .world-label b{font-size:25px;line-height:1.1;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
 .world-caption,.world-current .world-caption{font-size:14px}
 .playing .flight-console{width:min(620px,calc(100vw - var(--edge) * 2));padding:12px 14px 8px}
 .flight-console form>label{font-size:19px;margin-bottom:8px}
 .flight-console .search-field input{font-size:23px;min-height:50px}
 .move-input-row{gap:9px}
 .move-input-row>.button{font-size:10px;min-height:50px;min-width:0;padding:10px 14px;line-height:1.3;gap:8px}
 .move-input-row>.button>span{font-size:24px}
 .move-input-row>.button:disabled{font-size:19px}
 .flight-info,.flight-info .text-button{font-size:18px}
 .flight-info{gap:8px 12px;margin-top:4px;min-height:32px}
 .flight-info .text-button{min-height:32px;padding:4px 2px}
 .trajectory-rail{right:var(--edge)}
}
@media(max-width:600px){
 .game-scene{--platform-width:118px}
 .move-input-row>.button{font-size:0;min-width:50px;padding:10px 12px;gap:0}
 .move-input-row>.button:disabled{font-size:17px;max-width:82px}
 .move-input-row>.button>span{font-size:27px}
 .game-scene .world-label b{font-size:23px}
 .route-tooltip{font-size:21px}
 .playing .flight-console{padding:11px 11px 7px}
}
body[data-keyboard-open=true] .game-scene,body[data-tight-scene=true] .game-scene{--platform-width:82px}
body[data-keyboard-open=true] .destination-beacon,body[data-compact-viewport=true] .destination-beacon{left:98px;right:124px;transform:none;width:auto;max-width:none;top:calc(12px + env(safe-area-inset-top));padding:6px 9px}
@media(prefers-reduced-motion:reduce){.route-square::before{transition:none}}
.route-square[aria-current=step]{animation:route-square-arrive .25s ease-out}
.route-tooltip{animation:route-tooltip-in .14s ease-out}
@keyframes route-square-arrive{from{opacity:0;transform:scale(.7)}to{opacity:1;transform:scale(1)}}
@keyframes route-tooltip-in{from{opacity:0;translate:4px 0}to{opacity:1;translate:0 0}}
/* Tiny neutral route marks; incoming rarity is revealed in colored tooltip text. */
.trajectory-blocks{gap:0}
.route-square::before{width:8px;height:8px;left:18px;top:18px;background:#d1decb;border:1px solid #eef4e2;box-shadow:1px 1px #18352f}
.route-square[aria-current=step]::before{background:#d1decb;box-shadow:0 0 0 3px #18352f,0 0 0 4px #d1decb}
.route-tooltip b{display:block;font:inherit;font-size:23px;line-height:1.15}
.route-tooltip small{display:block;margin-top:5px;font-size:18px;line-height:1.2}
.level-clock{font-variant-numeric:tabular-nums;font-size:25px;color:#f1f3dc}
#timer[data-urgent=true]{color:#ffb5a5}
.timeout-ground{position:absolute;left:0;right:0;top:64%;bottom:0;z-index:2;pointer-events:none;background:linear-gradient(#a4bd85 0 5px,#75624b 5px 15px,#344c3e 15px 100%);border-top:3px solid #d0dfa4}
.is-failing .astronaut,.has-thudded .astronaut{z-index:8}
.has-thudded .world{opacity:.15}
.playing:has(.is-failing) .flight-console{opacity:0;pointer-events:none}
.thud-dust{position:absolute;top:-10px;left:calc(50% - 35px);width:70px;height:12px;background:#d0bf83;opacity:0}
.has-thudded .thud-dust{animation:thud-dust .5s ease-out both}
@keyframes thud-dust{from{opacity:.8;transform:scale(.3)}to{opacity:0;transform:scale(3,1.5)}}
.timeout-card{text-align:center;padding:5px 0}
.timeout-card h2{font-size:clamp(19px,2vw,28px);line-height:1.4;margin:4px 0 10px}
.timeout-card p{font:23px/1.2 var(--mono);margin:0 0 15px;color:#e1ebd4}
.timeout-card .button{min-height:48px;font-size:11px;line-height:1.4;padding:12px 18px}
@media(hover:hover) and (pointer:fine){
 .trajectory-node{flex-basis:24px;height:24px}
 .route-square{height:24px;min-height:24px}
 .route-square::before{top:8px}
}
.thud-word{position:absolute;left:50%;top:-70px;transform:translateX(-50%);font:clamp(20px,2.4vw,34px)/1.2 var(--display);color:#fff0b4;text-shadow:3px 3px #17392e;opacity:0}
.has-thudded .thud-word{animation:thud-word .75s ease-out both}
@keyframes thud-word{0%{opacity:1;translate:0 8px;scale:.65}25%{opacity:1;translate:0 -12px;scale:1.12}70%{opacity:1}100%{opacity:0;translate:0 -25px;scale:1}}
.credits-link{font:18px/1.2 var(--mono);min-height:44px;padding:8px 12px;text-decoration:underline;text-underline-offset:3px}
#credits-dialog a{color:#d9ecc3;text-decoration:underline;text-underline-offset:3px}

/* Keep the difficulty beside each route without shrinking its topic names. */
#challenges .challenge{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:clamp(8px,1vw,14px);text-align:left}
.challenge-route{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:4px 8px;min-width:0}
#challenges .challenge-difficulty{font-family:var(--mono);font-size:clamp(16px,1.3vw,20px);line-height:1.1;white-space:nowrap;padding:4px 6px;border:1px solid currentColor;background:#102c25;overflow-wrap:normal}
.challenge-difficulty[data-difficulty="easy"]{color:#c4e6a1}
.challenge-difficulty[data-difficulty="medium"]{color:#ffe19a}
.challenge-difficulty[data-difficulty="hard"]{color:#ffb5a4}
.challenge-difficulty[data-difficulty="impossible"]{color:#edbbff}
