/* Keep controls outside the moving world. */
#boost{touch-action:none;-webkit-touch-callout:none}
.tools .boost.power-active,.tools .boost.power-active:hover{background:#94e5b1;border-color:#438969;color:#173d38;box-shadow:inset 0 0 0 2px #d5ffe3}
html,body{background:var(--ink)}
#game{display:grid;grid-template-rows:auto minmax(0,1fr) auto;height:100dvh}
.topbar{position:static;min-height:0;gap:10px;padding-top:calc(24px + var(--safe-top,env(safe-area-inset-top,0px)));padding-bottom:2px;background:var(--ink);box-shadow:none}
.brand{gap:8px}.brand-mark{flex-shrink:0;width:34px;height:34px;font-size:25px}.brand-mark span{top:-3px;font-size:15px}
.brand>div{min-width:0;padding:0;overflow:visible}
.brand b{font-family:system-ui,sans-serif;font-size:12px;line-height:20px;letter-spacing:0}
.wallet{min-height:44px;padding:6px 10px;font-size:18px}.topbar .icon-button{width:44px;height:44px;flex-shrink:0}
.quest{position:static;width:100%;max-width:none;min-height:55px;margin:0;padding:7px 18px;border:0;border-bottom:1px solid #426355;border-radius:0;background:#dce9d8;box-shadow:none}
.quest-icon{font-size:25px}.quest div>span{margin-top:2px}.quest button{flex-shrink:0}
.brand .brand-meta{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;font-size:12px;line-height:16px;margin-top:0}
#buildLabel{font-size:10px;line-height:1.2;color:#c4dcb7;white-space:nowrap;letter-spacing:0}
#playfield{position:relative;min-height:0;overflow:hidden;background:#85b979}
#world{position:absolute;inset:0;height:100%;width:100%}
.display-report{white-space:pre-wrap;overflow-wrap:anywhere;font:12px/1.6 ui-monospace,monospace;color:#d5e8dd}
/* Dialogs need their own safe-area bounds; the game header cannot protect them. */
dialog{position:fixed;inset:calc(12px + var(--safe-top,env(safe-area-inset-top,0px))) 12px calc(12px + var(--safe-bottom,env(safe-area-inset-bottom,0px)));margin:auto;max-height:calc(100dvh - 24px - var(--safe-top,env(safe-area-inset-top,0px)) - var(--safe-bottom,env(safe-area-inset-bottom,0px)))}
.panel-head{position:sticky;top:0;z-index:1;background:#20373a;border-bottom:1px solid #ffffff15;margin-bottom:14px}
.panel-head>div{min-width:0}.panel-head h1{font-size:22px;line-height:1.25;overflow-wrap:anywhere}
.panel-head .close{width:44px;height:44px}
dialog[data-mode="map"]{width:min(760px,calc(100% - 12px));left:6px;right:6px;max-width:calc(100% - 12px)}
dialog[data-mode="map"] .panel-body{padding:0 8px 16px}
dialog[data-mode="map"] .panel-head{padding:14px 16px;margin-bottom:8px}
.atlas-stage{position:relative;overflow:hidden;border:1px solid #8aac9a55;border-radius:8px;background:#19393c}
.atlas-stage .map-canvas{width:100%;aspect-ratio:600/760;height:auto;border:0;border-radius:0;touch-action:none;cursor:grab}
.atlas-stage .map-canvas:active{cursor:grabbing}
.atlas-tools{display:flex;align-items:center;gap:4px;padding:5px 6px;background:#19393c;border-bottom:1px solid #8aac9a33}
.atlas-tools button{width:44px;height:44px;border-radius:6px;background:#20373a;color:#eff7e9;border:1px solid #a4cfb970;font-size:25px;line-height:1}
.atlas-tools button:disabled{opacity:1;color:#79958a;background:#243e3e}
.atlas-tools .atlas-go{background:#94e5b1;color:#173d48;border-color:#c5f5d4;font-size:28px}
dialog[data-mode="trail"] .celebration{height:auto;aspect-ratio:5/2}
.atlas-zoom{flex:1;margin-left:6px;font-size:12px;color:#e0f0da;pointer-events:none}
.atlas-status{margin:0;color:var(--gold);font-size:12px;line-height:1.5}.atlas-status:not(:empty){margin:8px 4px}
.console{position:static;transform:none;width:100%;max-width:none;border-radius:0;padding-top:6px;padding-bottom:calc(4px + max(0px,var(--safe-bottom,env(safe-area-inset-bottom,0px)) - 20px));background:var(--ink);box-shadow:none}
.console .tools{max-width:530px;margin:auto}.health-row{max-width:530px;margin:0 auto 4px}
.console .tools{grid-template-columns:repeat(4,minmax(0,1fr));max-width:440px;gap:8px}
.region-progress{display:flex!important;gap:3px;margin-top:4px!important;align-items:center;min-height:10px}.region-progress i{display:block;width:7px;height:9px;border-radius:2px;border:1px solid #9dbab2;background:#38524f;flex-shrink:0}.region-progress i.filled{background:#ffd35c;border-color:#ffe9a1}
.region-progress[hidden]{display:none!important}
dialog[data-mode="workshop"][data-details="false"] .extra-details{display:none}
.workshop-info{font-size:23px;flex-shrink:0;margin-left:auto;width:44px;height:44px}.panel-head .workshop-info+.close{margin-left:0}
.other-destinations{border-top:1px solid #ffffff24;margin-top:14px;padding-top:8px}.other-destinations>summary{cursor:pointer;padding:12px 4px;min-height:44px;color:#bdd8cf;font-size:13px;font-weight:700}.current-destination{width:100%;margin-bottom:10px;min-height:54px}.current-destination>span{font-size:28px}.current-destination em{font-size:27px}
.boss-hud{top:10px;left:12px;right:12px;max-width:360px}
.toast{top:10px}.toast.boss-active{top:78px}
.interact{bottom:14px;padding:11px 18px;min-height:48px}
.announcement{top:25%;font-size:22px}
.health-row.critical .health-heart{animation:warning-pulse 1s ease-in-out infinite}
.health-row.critical>b{color:#ffba9f}
.map-key{flex-wrap:wrap;gap:8px 14px}
.map-key .bot-player-key{display:inline-flex;align-items:center;gap:3px;color:#d8efe1}.bot-player-key canvas{width:30px;height:30px}
.region-row.active-region{border:2px solid #ffe17b;background:#d5ac3b1c}.region-row.active-region>span{color:#ffe17b}
.map-key .player-key{display:inline-flex;align-items:center;gap:5px;color:#c4d5c9}
.player-key::before{content:"";width:12px;height:12px;border:3px solid #173d68;border-radius:50%;background:#65ef86;outline:1px solid #f4fff8}
.station-row{border-color:#77c6a250}.station-row span{color:#a9efd0}
.workshop-row{border-color:#e5c56a80}.workshop-row>span{font-size:30px;color:#ffe292}
.return-row{border-color:#c998f4}.return-row>span{color:#deb5ff}
.tabs button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-height:78px;padding:7px 2px;border-radius:6px 6px 0 0}
.tabs button canvas{width:55px;height:45px;pointer-events:none}
.tabs button small{font-size:10px;pointer-events:none}
.tabs button.active{background:#91dec91a}
.item button{width:44px;min-width:44px;height:48px;min-height:48px;padding:2px;font-size:27px}
.lock-icon{display:inline-block;position:relative;width:17px;height:15px;border-radius:2px;background:currentColor;margin-top:7px}
.lock-icon::before{content:"";position:absolute;left:3px;top:-9px;width:11px;height:12px;border:3px solid currentColor;border-radius:8px 8px 0 0}
.item.locked canvas,.item.unaffordable:not(.equipped) canvas{filter:grayscale(1);opacity:.4}
.item.locked h3,.item.unaffordable:not(.equipped) h3{color:#9aadaa}
.pictorial-action{display:flex;align-items:center;justify-content:center;gap:12px;min-height:62px}
.pictorial-action>span{font-size:30px;line-height:1}
.pictorial-action>small{font-size:12px}
@keyframes warning-pulse{50%{opacity:.45;transform:scale(1.2)}}
@media(min-width:900px){.quest{padding-left:28px}.console{padding-bottom:10px}.tools button{min-height:48px}.tools .boost{min-height:52px}}
@media(max-width:380px){.quest{padding-left:10px;padding-right:10px}.quest b{font-size:12px}.quest div>span{font-size:10px}.health-row>span:last-child{max-width:105px;min-width:0}}
@media(prefers-reduced-motion:reduce){.health-row.critical .health-heart{animation:none}}
.management-link{display:block;width:100%;margin-top:18px;padding:14px 8px;border-top:1px solid #ffffff24;background:transparent;color:#b9cec7;font-size:13px;text-align:left;min-height:48px}
.management-heading{font-size:15px;margin:0 0 10px}.backup-details{margin:0 0 18px;padding:0 0 14px;border-bottom:1px solid #ffffff24}.backup-details h2{font-size:20px;color:#c6f2d7;margin:0 0 6px}.backup-details>p{font-size:13px;color:#c0d4ce;margin:6px 0}.backup-details dl{margin:14px 0}.backup-details dl>div{display:flex;justify-content:space-between;gap:12px;padding:7px 0;font-size:13px}.backup-details dt{color:#acc4bc}.backup-details dd{margin:0;text-align:right;font-weight:700}.backup-details .backup-date{color:#9eb8b1;font-size:12px;line-height:1.5}.backup-empty{color:#b5c8c0;font-size:13px;line-height:1.6;margin:0 0 18px}
.danger{width:100%;min-height:54px;background:#b64047;color:#fff5ee;border:1px solid #ee8d88;border-bottom:4px solid #752b36;border-radius:7px;padding:13px 16px;font-weight:800;font-size:14px}.restart-warning{border-left:4px solid #ef8a7e;background:#71323d33;padding:14px;margin:0 0 16px}.restart-warning b{color:#ffb5a7;font-size:16px}.restart-warning p{font-size:14px;color:#e1cfcb;line-height:1.6;margin:10px 0 0}.management-status{color:#ffc1ad;font-size:13px;line-height:1.6}.management-status:empty{display:none}
.hold-restart{position:relative;overflow:hidden;isolation:isolate;touch-action:none;-webkit-touch-callout:none;min-height:70px}.hold-restart::before{content:"";position:absolute;inset:0 auto 0 0;width:var(--hold,0%);background:#702a38;z-index:-1}.hold-restart small{display:block;font-size:12px;margin-top:4px;font-weight:500}.hold-restart:active:not(:disabled){transform:none}
