/* Shared spacing contract. Layout boxes share rails; artwork may extend inside reserved space. */
:root{--space-1:4px;--space-2:8px;--space-3:12px;--space-4:16px;--space-6:24px;--screen-gutter:16px;--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px)}
@media(max-width:350px){:root{--screen-gutter:12px}}
.toy-gui .home-screen.world-home{height:100dvh;min-height:0;max-height:none;max-width:500px;display:grid;grid-template-rows:auto minmax(0,1fr) auto;padding:0;overflow:hidden;background:#132e48}
.world-home:before{display:none}.world-header{padding:calc(var(--safe-top) + 12px) var(--screen-gutter) 8px;background:linear-gradient(#17324e,#1c3c57);z-index:3;box-shadow:0 4px 12px #081c3855}
.toy-gui .world-home .home-top{gap:8px}.toy-gui .world-home .home-wallet{gap:8px}.toy-gui .world-home .life-pill,.toy-gui .world-home .wallet-coins{min-height:48px;height:48px;border-width:2px;border-bottom-width:4px;border-radius:12px}
.world-region-bar{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:8px;text-align:center}
.world-region-bar h1{font-size:20px;line-height:24px;margin:0;color:#fff0bb;text-shadow:0 2px #142942}.world-region-bar small{display:block;font-size:11px;color:#c5d6df;letter-spacing:2px;margin-top:4px}
.toy-gui .world-region-bar button{min-width:48px;min-height:48px;width:48px;height:48px;background:#234b67;border:1px solid #709aac;border-bottom:3px solid #10304d;color:#f9df9e;box-shadow:inset 0 1px #a4c5d655,0 2px #0c243c;font-size:27px}
.world-map-viewport{position:relative;min-height:0;overflow:hidden}.world-map-viewport:after{content:'';position:absolute;inset:auto 0 0;height:36px;background:linear-gradient(transparent,#112c47aa);pointer-events:none}
#world-scroll{height:100%;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:none;touch-action:pan-y}#world-scroll::-webkit-scrollbar{display:none}
#world-canvas{position:relative;isolation:isolate;background:#143c58}
.world-scenery{position:absolute;left:0;right:0;z-index:-1;pointer-events:none;background:url('art/world-route-v9.png') center/100% 100%;mask-image:linear-gradient(transparent,#000 12%,#000 88%,transparent)}
.world-path{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none;filter:drop-shadow(0 2px 2px #0c254b)}
.world-path path{fill:none;stroke-linecap:round;stroke-width:9px}.world-path .path-ahead{stroke:#bedde0;stroke-opacity:.65;stroke-dasharray:2 15}.world-path .path-travelled{stroke:#efc66e;stroke-dasharray:2 13}
.toy-gui .world-home .world-node{position:absolute;transform:translate(-50%,-50%);width:64px;height:56px;min-height:56px;min-width:64px;display:grid;place-items:center;padding:0;border:0;background:none;box-shadow:none;text-shadow:none;isolation:isolate;transition:none;cursor:default;overflow:visible}
.node-disc{position:absolute;inset:5px 0 0;border-radius:50%;background:linear-gradient(#60819a,#365772);border:3px solid #a2c7ce;border-bottom:7px solid #1a405e;box-shadow:inset 0 3px #effff044,0 4px #112b48,0 6px 8px #07193066;z-index:-1}
.node-number{color:#d7e9ef;font-size:21px;font-weight:950;line-height:1;text-shadow:0 2px #243d55;margin-top:3px;font-variant-numeric:tabular-nums}
.world-node[data-state='future'] .node-disc{background:linear-gradient(#668698,#3c5e74);border-color:#a4c2cc;border-bottom-color:#29495f}.world-node[data-state='future'] .node-number{color:#eef5ed}
.world-node[data-state='complete'] .node-disc{background:linear-gradient(#f8d176,#bc8d43);border-color:#ffe5a1;border-bottom-color:#875a2f}.world-node[data-state='complete'] .node-number{color:#633e25;text-shadow:0 1px #ffe7b1}
.node-medal{position:absolute;right:-5px;top:-2px;width:26px;height:30px;background:url('art/route-medal.svg') center/contain no-repeat;filter:drop-shadow(0 2px 1px #39233788);pointer-events:none}
.toy-gui .world-home button.world-node[data-state='current']{cursor:pointer;width:72px;height:62px;filter:none;outline:none}
.world-node[data-state='current'] .node-disc{background:linear-gradient(#ffe996,#f6bd55);border:3px solid #fff7bf;border-bottom:8px solid #a4692b;box-shadow:inset 0 3px #fffad1,0 4px #523b29,0 0 0 5px #fff4a744,0 0 24px #ffe88d88}
.world-node[data-state='current'] .node-number{font-size:24px;color:#654121;text-shadow:0 1px #fff5ca}
.toy-gui .world-home .world-node:active{transform:translate(-50%,-50%);background:none;box-shadow:none}.world-node:active .node-disc{filter:brightness(1.12)}.toy-gui .world-home .world-node:focus-visible{outline:3px solid #fff;outline-offset:6px;border-radius:50%}
.world-ship{position:absolute;transform:translateX(-50%);width:90px;height:62px;pointer-events:none;z-index:2}.map-mothership{position:absolute;inset:0;background:url('art/motherships-v4.png') 100% 0%/300% 200%;filter:drop-shadow(0 4px 4px #092c4766);animation:map-float 2.6s ease-in-out infinite}.map-worker{position:absolute;right:-10px;bottom:0;width:24px;height:29px;background:url('art/worker-v4.png') center/contain no-repeat;filter:drop-shadow(0 2px 1px #102c4888)}
@keyframes map-float{50%{transform:translateY(-4px)}}
.toy-gui #world-locate{position:absolute;right:var(--screen-gutter);bottom:16px;width:48px;height:48px;z-index:4;background:#244960;border:2px solid #b5d6d6;border-bottom:4px solid #12324a;box-shadow:0 3px #0d223d;font-size:30px;color:#fff1b0}
.world-departure{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px var(--screen-gutter) calc(var(--safe-bottom) + 20px);border-top:2px solid #9c997b;background:linear-gradient(#213e56,#152d48);z-index:3;box-shadow:0 -3px 12px #0a243e55}
.destination{display:flex;gap:8px;align-items:center;min-width:0}.destination strong{display:block;color:#fff2c2;font-size:18px;white-space:nowrap}.destination small{display:block;color:#c2d8dd;font-size:12px;margin-top:4px;max-width:110px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#world-preview{display:grid;flex:none;gap:0;width:44px;height:44px;padding:4px;background:#203047;border:1px solid #6f8d99;border-radius:7px}#world-preview i{border-radius:0;min-width:0;min-height:0}
.toy-gui .world-home #start-btn{width:auto;min-width:142px;flex:none;height:56px;min-height:56px;display:flex;align-items:center;justify-content:center;gap:12px;padding:6px 12px;font-size:20px;border-radius:14px!important}
.toy-gui .world-home #start-btn .entry-cost{gap:3px;padding-left:8px;font-size:17px}.world-home .entry-cost img{width:24px;height:24px}
/* Play layout uses one rail and a separate, reserved worker corridor. */
.toy-gui .game-shell{height:100dvh;min-height:0;padding:calc(var(--safe-top) + 12px) var(--screen-gutter) calc(var(--safe-bottom) + 16px)}
.toy-gui .game-shell .game-top{height:56px;min-height:56px;margin:0 0 16px;gap:12px}
.toy-gui .level-badge{height:56px;min-width:0;max-width:210px;margin:0 auto;padding:0 12px 4px;display:flex;flex-direction:column;justify-content:center}.toy-gui .game-top h2{font-size:22px;line-height:25px}.toy-gui .hud-lives{margin:0;height:18px;font-size:13px}.toy-gui .hud-lives img{width:20px;height:20px}
.toy-gui .game-shell .board-panel{margin:0;padding:8px;border-radius:18px;min-height:0;flex:1;border-width:3px;border-bottom-width:6px}
.toy-gui .picture-heading{padding:0;margin:0 0 8px;min-height:24px;line-height:24px;font-size:14px}
.toy-gui #difficulty-badge[data-grade='0'],.toy-gui #difficulty-badge[data-grade='1']{display:none}
.toy-gui .game-shell .board-stage{flex:1;min-height:0}
.toy-gui .game-shell .progress-track{margin:12px 0 0;min-height:8px;height:8px;border-width:1px}
.toy-gui .game-shell .flight-corridor{height:28px;min-height:28px}.toy-gui .flight-corridor>span{display:none}
.toy-gui .game-shell .slots{height:68px;min-height:68px;margin:0 0 16px;gap:8px}.toy-gui .game-shell .slot{max-height:none;min-height:0}
.toy-gui .game-shell .queues{height:144px;min-height:144px;margin:0;padding:8px 8px 12px;gap:12px;border-radius:16px}
.toy-gui .game-shell .queue button.unit{height:64px;min-height:48px;max-width:none}
.toy-gui .game-shell .queue .unit:not(button){height:42px;max-height:42px;max-width:60px;width:76%;margin-top:8px;border:0;background:none;border-radius:0}
.toy-gui .game-shell .queue .unit:not(button) .drone-art{inset:-2px -8%;width:auto;height:auto}
.toy-gui .game-shell .queue .unit:not(button) .unit-count{left:50%;right:auto;bottom:0;transform:translateX(-50%);height:23px;line-height:21px;min-width:26px;font-size:17px;border-radius:6px}
.toy-gui .game-shell .tools-deck{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;min-height:0;margin-top:16px;padding:0 0 6px}
.toy-gui .tools-deck .booster-bar,.toy-gui .tools-deck .game-actions{display:contents}
.toy-gui .tools-deck :is(.queue-preview,.booster-bar button,.game-actions #restart-btn){display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:72px;min-height:72px;margin:0;padding:2px 0;gap:0;border-radius:12px}
.toy-gui .tools-deck .gui-item-art,.toy-gui .tools-deck .booster-bar button>span.gui-item-art{width:32px;height:32px}
.toy-gui .tools-deck :is(button b,.button-label){font-size:12px!important;line-height:16px;letter-spacing:-.4px}
.toy-gui .tools-deck .booster-bar button small{font-size:11px;line-height:14px;min-width:0;padding:0 4px;background:none}
.toy-gui .tools-deck .game-actions .ui-icon{width:27px;height:27px;margin:3px 0}
.tutorial-cue{flex:none;padding:4px 8px;margin:0 0 8px;line-height:18px;background:#fff5cf;color:#62452a;border:1px solid #cda567;border-radius:8px;font-size:12px;font-weight:700;text-align:center}
.board-panel[data-tutorial='true'] .picture-heading{display:none}
.coach-choice:after{content:'';position:absolute;inset:0;border:2px solid #fff7a4;border-radius:14px;pointer-events:none;animation:coach-pulse 1s ease-in-out infinite}
@keyframes coach-pulse{50%{box-shadow:0 0 0 5px #fff1a144;opacity:.5}}
.failed-run .slots{filter:drop-shadow(0 0 5px #ff806b)}
/* Dialog spacing includes the visible extrusion beneath each button. */
.toy-gui dialog{width:calc(100% - var(--screen-gutter)*2);max-width:400px;max-height:calc(100dvh - var(--safe-top) - var(--safe-bottom) - 32px);padding:16px;border-width:4px;border-bottom-width:6px;border-radius:20px;overflow:auto}
.toy-gui dialog[open]{display:flex;flex-direction:column;gap:16px}
.toy-gui dialog :is(.dialog-heading,.gui-title){position:static;flex:none;min-height:104px;margin:0;padding:44px 8px 16px;gap:0;background-size:100% 100%}
.toy-gui dialog :is(.dialog-heading,.gui-title) h2,.toy-gui #result-title,.toy-gui #confirm-title,.toy-gui #help-dialog .dialog-heading h2{font-size:20px;line-height:24px;letter-spacing:-.7px;margin:0;white-space:nowrap}
.toy-gui dialog .dialog-heading .gui-close{top:12px;right:12px;width:48px;height:48px;min-width:48px;min-height:48px;border-radius:12px!important}
.toy-gui dialog :is(p,.toggle,.account-card,.legal-link,.version){margin:0}
.toy-gui dialog p{font-size:14px;line-height:1.6}
.toy-gui dialog :is(.primary,.secondary,#result-action,#result-home,#confirm-action,#confirm-cancel,#life-refill,#life-start){min-height:52px;margin:0;font-size:17px}
.toy-gui dialog .toggle{padding:8px 12px;min-height:56px;flex:none;font-size:15px}
.toy-gui .account-card{padding:16px}.toy-gui .account-card p{margin:8px 0 16px;font-size:14px}
.toy-gui .legal-link{padding:8px 0;color:#644327;font-size:13px}.toy-gui .version{font-size:11px}
.toy-gui .result-card{display:flex;flex-direction:column;gap:16px;width:100%}
.toy-gui .result-mascot{width:88px;height:88px;margin:0 auto}
.toy-gui .gui-award{width:104px;height:104px;margin:0 auto}
.toy-gui .gui-item-hero{width:80px;height:80px;margin:0 auto}
.toy-gui #result-text{font-size:16px;line-height:24px;padding:12px;margin:0;white-space:normal}
.result-rewards{display:flex;align-items:center;justify-content:center;gap:16px}.reward-chip{display:flex;align-items:center;gap:8px;padding:8px 16px;border:2px solid #c79d5f;border-radius:12px;background:#fff0c4;color:#634126;font-size:23px}.reward-chip img,.reward-coin{width:32px;height:32px;display:block}.reward-coin{background:url('art/gui-items-v8.png') 100% 100%/300% 200%}
.toy-gui #confirm-text{margin:0;padding:12px;font-size:14px}.toy-gui #lives-dialog .life-hero{width:80px;height:80px;margin:0 auto}.toy-gui #life-dialog-count{font-size:32px}.toy-gui #life-dialog-timer{font-size:16px;margin:0;padding:8px}.toy-gui dialog .life-rules{font-size:14px}
.toy-gui #queue-dialog{max-width:500px}.toy-gui #queue-plan{margin:0;gap:8px}.toy-gui #queue-plan h3{margin:0 0 12px;padding:6px;font-size:12px}.toy-gui .plan-ship{margin-bottom:8px;padding:6px 2px;gap:4px;font-size:12px}
.help-tabs{display:flex;gap:8px}.toy-gui #help-dialog .help-tabs button{flex:1;min-width:0;min-height:48px;padding:4px;font-size:13px;background:#af8a55;color:#fff6d7;border:2px solid #f8dc9c;border-bottom:4px solid #805e3b;text-shadow:0 1px #6b4b32;box-shadow:0 2px #7c5636}
.toy-gui #help-dialog .help-tabs button[aria-pressed='true']{background:#568d4e;border-bottom-color:#315c35}
.help-page{min-height:170px}.toy-gui #help-dialog ol{padding-left:22px;margin:12px 0 0;font-size:14px;line-height:1.7}.toy-gui #help-dialog li{padding-bottom:8px}.toy-gui #help-dialog .help-page p{font-size:14px;line-height:1.8;margin:8px 0}
.help-demo{position:relative;height:80px;background:#234359;border:2px solid #a58b5a;border-radius:12px;overflow:hidden}.demo-ship{position:absolute;left:16px;top:12px;width:66px;height:54px;background:url('art/motherships-v4.png') 100% 0%/300% 200%}.demo-worker{position:absolute;left:85px;top:20px;width:32px;height:38px;background:url('art/worker-v4.png') center/contain no-repeat;animation:demo-trip 2.6s ease-in-out infinite}.demo-cargo{position:absolute;right:22px;top:27px;width:24px;height:24px;background:#ffcf50;border:3px solid #fff0a2;border-bottom-color:#b97c31;border-radius:4px}
@keyframes demo-trip{50%{left:calc(100% - 66px)}}
.obstacle-demo{display:flex;justify-content:center;gap:24px;padding:20px}.demo-ice,.demo-key{padding:12px;border:3px solid #faf9da;border-bottom:5px solid #648da3;border-radius:12px;background:#acd8ec;color:#24536e;font-weight:900}.demo-key{background:#edd28a;color:#624924;border-bottom-color:#a78442}
@media(max-height:740px){
 .toy-gui .game-shell{padding-top:calc(var(--safe-top) + 8px);padding-bottom:calc(var(--safe-bottom) + 12px)}
 .toy-gui .game-shell .game-top{height:48px;min-height:48px;margin-bottom:8px;gap:8px}.toy-gui .level-badge{height:48px}.toy-gui .game-top h2{font-size:20px;line-height:22px}.toy-gui .hud-lives{height:16px;font-size:12px}.toy-gui .hud-lives img{width:18px;height:18px}
 .toy-gui .game-shell .progress-track{margin-top:8px}.toy-gui .game-shell .flight-corridor{height:20px;min-height:20px}.toy-gui .game-shell .slots{height:48px;min-height:48px;margin-bottom:12px}
 .toy-gui .game-shell .queues{height:100px;min-height:100px;padding:6px 8px 4px;gap:8px}.toy-gui .game-shell .queue button.unit{height:48px;min-height:48px}
 .toy-gui .game-shell .queue .unit:not(button){height:24px;max-height:24px;width:100%;max-width:none;margin-top:8px;border:1px solid #ba9a66;border-radius:6px;background:#20354d}
 .toy-gui .game-shell .queue .unit:not(button) .drone-art{inset:0 auto 0 0;width:30px;height:24px}.toy-gui .game-shell .queue .unit:not(button) .unit-count{left:auto;right:1px;bottom:1px;transform:none;min-width:20px;height:19px;line-height:17px;font-size:13px;padding:0 2px;border-radius:4px;box-shadow:none}
 .toy-gui .game-shell .tools-deck{margin-top:12px}.toy-gui .tools-deck :is(.queue-preview,.booster-bar button,.game-actions #restart-btn){height:64px;min-height:64px}.toy-gui .tools-deck .gui-item-art,.toy-gui .tools-deck .booster-bar button>span.gui-item-art{width:28px;height:28px}.toy-gui .tools-deck :is(button b,.button-label){font-size:11px!important;line-height:14px}.toy-gui .tools-deck .booster-bar button small{font-size:11px;line-height:12px}
 .toy-gui dialog :is(.dialog-heading,.gui-title){min-height:88px;padding:36px 4px 12px}.toy-gui dialog :is(.dialog-heading,.gui-title) h2,.toy-gui #result-title,.toy-gui #confirm-title{font-size:17px;line-height:22px}.toy-gui .gui-award,.toy-gui .result-mascot{width:72px;height:72px}
 .world-header{padding-top:calc(var(--safe-top) + 8px)}.world-departure{padding-top:12px;padding-bottom:calc(var(--safe-bottom) + 16px)}
}
@media(max-width:350px){.world-home #world-preview{display:none}.toy-gui .world-home #start-btn{min-width:140px}.toy-gui .world-home .home-wallet{gap:8px}.world-region-bar h1{font-size:18px}.toy-gui dialog :is(.dialog-heading,.gui-title) h2,.toy-gui #result-title,.toy-gui #confirm-title,.toy-gui #help-dialog .dialog-heading h2{font-size:16px;letter-spacing:-.5px}.toy-gui dialog{padding:16px}.toy-gui .dialog-heading .gui-close{right:12px}}
@media(prefers-reduced-motion:reduce){.map-mothership,.demo-worker,.coach-choice:after{animation:none}}
.reduced .map-mothership,.reduced .demo-worker,.reduced .coach-choice:after{animation:none}
