*{box-sizing:border-box}body{margin:0;background:#080e14;color:#e2e9e9;font:16px "Trebuchet MS",sans-serif}canvas{position:fixed;inset:0;width:100%;height:100%}header,footer{position:fixed;left:0;right:0;padding:19px 24px;background:#0b131cf5;display:flex;justify-content:space-between;gap:20px;z-index:2}header{top:0;border-bottom:1px solid #33424b;align-items:center}header>b{letter-spacing:3px;font-size:19px;white-space:nowrap}header small{letter-spacing:1px}footer{bottom:0;font:12px monospace;color:#acbcc3;border-top:1px solid #243944}small,.mono,.fine{font:12px monospace;color:#a1b5bd;letter-spacing:.5px}#overlay{position:fixed;inset:85px 5vw 120px;display:flex;align-items:center;pointer-events:none;gap:20px}section{pointer-events:auto;background:#101c26f5;border:1px solid #41515a;padding:32px;max-width:760px;max-height:100%;overflow:auto;box-shadow:0 20px 80px #0008}section.title{background:linear-gradient(90deg,#101c26f5,#101c26dc);max-width:580px;border-top:3px solid #b8e577;padding:38px}h1{font-size:clamp(40px,5.5vw,76px);letter-spacing:-3px;line-height:.92;margin:26px 0;color:#e4ebdf}h2{font-size:clamp(24px,3vw,34px);letter-spacing:-1px;margin:16px 0}h3{font-size:26px;margin:10px 0}p{color:#b7c7cd;line-height:1.5}.lead{font-size:22px;color:#e2e9e9}.fine{line-height:1.6}button{background:#b8e577;color:#0c1713;border:1px solid #c5f395;padding:14px 20px;cursor:pointer;font:700 16px "Trebuchet MS",sans-serif;margin:6px 6px 6px 0;min-height:48px;text-align:left}button:hover{background:#d6ff9e}button.secondary{background:#172b37;border-color:#52656d;color:#dfe9e5}button.secondary:hover{background:#28404b}button:focus-visible,input:focus-visible{outline:3px solid #e5f9bd;outline-offset:3px}output{font:12px monospace;display:flex;gap:20px;align-items:center;flex-wrap:wrap}output b{color:#cce796;font-weight:400}output span{white-space:nowrap}.hangar{max-width:950px}article{display:inline-block;width:49%;padding-right:25px;vertical-align:top;border-bottom:1px solid #334952;padding-bottom:12px}.settings{border-top:1px solid #40505a;padding-top:14px;margin-top:15px;display:flex;gap:18px;flex-wrap:wrap}.settings label{font:13px monospace;display:flex;align-items:center;gap:8px;min-height:32px}.settings input{accent-color:#b8e577}.upgrades{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.upgrades button{margin:0;display:flex;flex-direction:column;gap:7px;padding:14px}.upgrades span{font-size:13px;line-height:1.4;color:#b7c9cc;font-weight:400}.refit{max-width:850px;width:100%}dl{display:grid;grid-template-columns:1fr 1fr;gap:10px;font:14px monospace}dt{color:#a6b9c2}dd{margin:0;color:#cee5b0}.warning{pointer-events:auto;position:fixed;bottom:45px;right:20px;max-width:400px;background:#4b3020;border:1px solid #e7ad76;padding:16px;font-size:13px;z-index:5}.warning button{font-size:12px;padding:8px;min-height:36px}@media(max-width:900px){header{padding:12px 16px;align-items:flex-start}header>b{font-size:14px}header>b small{display:block;margin-top:5px;font-size:9px}output{gap:10px;font-size:11px;max-width:55%}#overlay{inset:90px 3vw 110px}section{padding:22px}footer{font-size:10px;padding:14px}article{width:100%}}@media(max-width:550px){.upgrades{grid-template-columns:1fr}output{max-width:62%;gap:5px;font-size:10px}section.title{padding:23px}header{padding:10px}h1{font-size:46px}#overlay{bottom:95px}footer{font-size:9px}.settings{gap:8px}}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto}}
/* Native browser zoom remains available everywhere except held flight surfaces. */
#touch-controls{display:none;position:fixed;inset:0;z-index:3;pointer-events:none}
.touch-device #touch-controls:not([hidden]){display:block}
#touch-controls [data-command],#touch-pause{pointer-events:auto;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
#touch-stick{position:absolute;left:max(24px,env(safe-area-inset-left));bottom:max(24px,env(safe-area-inset-bottom));width:156px;height:156px;border:2px solid #9db8ad;border-radius:50%;background:#101c26c9}
#touch-stick span{position:absolute;left:50%;top:50%;width:58px;height:58px;border-radius:50%;background:#b8e577aa;transform:translate(calc(-50% + var(--stick-x,0px)),calc(-50% + var(--stick-y,0px)))}
#touch-stick b{position:absolute;bottom:12px;width:100%;text-align:center;font:12px monospace}
.touch-actions{position:absolute;right:max(24px,env(safe-area-inset-right));bottom:max(24px,env(safe-area-inset-bottom));display:grid;gap:10px}
.touch-actions button{margin:0;min-width:152px;min-height:64px;text-align:center;background:#172b37eb;color:#e4ebdf}
.touch-actions button.held{background:#b8e577;color:#0c1713}
#touch-pause{position:absolute;right:max(24px,env(safe-area-inset-right));top:145px;min-height:52px;margin:0;background:#172b37eb;color:#e4ebdf}
.touch-device footer{display:none}
.touch-device #overlay{inset:max(100px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));z-index:4}
.touch-device header{padding:calc(12px + env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) 12px max(16px,env(safe-area-inset-left));flex-wrap:wrap;gap:8px}
.touch-device output{gap:8px 18px}
@media(max-width:700px){header{flex-wrap:wrap;gap:6px;padding:10px 12px}header>b{font-size:15px}output{gap:6px 12px}#overlay{inset:110px 12px 60px}section,section.title{padding:20px;max-width:100%;width:100%}.hangar article{width:100%;padding-right:0}.upgrades{grid-template-columns:1fr}section button{max-width:100%;overflow-wrap:anywhere}.touch-device #overlay{top:120px}#touch-stick{width:136px;height:136px;left:max(12px,env(safe-area-inset-left))}.touch-actions{right:max(12px,env(safe-area-inset-right))}.touch-actions button{min-width:136px}#touch-pause{top:145px}}
@media(max-height:600px) and (orientation:landscape){.touch-device #overlay{top:85px}#touch-stick{width:120px;height:120px}.touch-actions button{min-height:52px}#touch-pause{top:90px}}

/* Combat HUD: grouped readouts (survival | cargo score | systems | mission). */
header #hud{gap:6px 14px;flex:1 1 auto;justify-content:flex-end;max-width:none;min-width:0}
.hud-group{display:grid;grid-template-columns:auto;gap:1px;min-width:86px;padding:2px 0 2px 8px;border-left:2px solid #33424b;font:12px monospace}
.hud-group .hud-label{font:10px monospace;letter-spacing:.6px;color:#8fa5ad;white-space:nowrap}
.hud-group b{font:700 14px monospace;color:#dce8d8;white-space:nowrap}
.hud-group b small{font-size:11px}
.hud-group .meter{display:block;height:3px;background:#22343d;overflow:hidden}
.hud-group .meter i{display:block;height:100%;background:#9fcf7a}
.hud-hull{border-left-color:#7fae78}.hud-hull .meter i{background:#7fae78}
.hud-xp{border-left-color:#8fb7a8}.hud-xp .meter i{background:#6fb9a0}
.hud-cargo{border-left-color:#d9ad60;min-width:70px}.hud-cargo b{color:#e8c078}
.hud-boost{border-left-color:#6bacc1}.hud-boost .meter i{background:#6bacc1}.hud-boost.active b{color:#bfe3ea}
.hud-mission{border-left-color:#52656d}
.hud-hull.low{border-left-color:#b5605a}.hud-hull.low b,.hud-hull.low .hud-label{color:#e0a39c}.hud-hull.low .meter i{background:#b5605a}
.pressure-status{flex-basis:100%;text-align:right;color:#e6b69b;font:11px monospace}
@media(prefers-reduced-motion:no-preference){.hud-hull.low.pulse{animation:hull-low 1.6s ease-in-out infinite}}
@keyframes hull-low{50%{background:#b5605a26}}
@media(max-width:700px){header #hud{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px 8px;flex-basis:100%;max-width:100%}.hud-group{min-width:0;padding-left:6px}.hud-group .hud-label{overflow:hidden;text-overflow:ellipsis}.hud-group b{font-size:13px}.pressure-status{grid-column:1/-1;text-align:left}header>b small{display:none}}
@media(min-width:2400px){header{padding:28px 38px;gap:30px}header>b{font-size:28px}.hud-group{min-width:128px;padding-left:14px;gap:3px}.hud-group .hud-label{font-size:14px}.hud-group b{font-size:20px}.hud-group b small{font-size:15px}.hud-group .meter{height:5px}.pressure-status{font-size:15px}footer{font-size:17px;padding:22px 38px}#overlay{inset:120px 5vw 145px}#flight-tip{font-size:18px;width:480px}}

/* Help never captures steering; only its dismiss button accepts input. */
#flight-tip{position:fixed;right:24px;bottom:110px;width:370px;max-width:calc(100vw - 32px);z-index:2;background:#101c26ed;border:1px solid #52656d;padding:10px 12px;pointer-events:none;display:flex;align-items:center;gap:12px}
#flight-tip[hidden]{display:none}
#flight-tip p{font-size:14px;line-height:1.35;margin:0}
#flight-tip button{pointer-events:auto;font-size:13px;min-width:78px;min-height:48px;margin:0;padding:8px}
.touch-device #flight-tip{bottom:190px;right:16px}
@media(max-height:600px) and (orientation:landscape){.touch-device #flight-tip{left:170px;right:190px;bottom:16px;width:auto;max-width:none}}

/* Selected recovery route: one actionable line, never an extra modal. */
#route-status{position:fixed;left:24px;top:calc(var(--header-bottom,80px) + 73px);z-index:2;max-width:calc(100vw - 48px);margin:0;padding:6px 10px;min-height:32px;background:#111f27ef;border:1px solid #527073;color:#b7dfd4;font:11px monospace;white-space:normal}
#route-status[hidden]{display:none}
.upgrade-category{color:#cce796!important;letter-spacing:1px;font-size:10px!important}.upgrade-result{border-top:1px solid #36515a;padding-top:8px;color:#dce8d8!important}
section.title .lead{color:#cde6ce}section.title{border-top-color:#86cec7}
@media(max-width:700px){#route-status{left:12px;max-width:calc(100vw - 110px);font-size:10px}}
@media(min-width:2400px){#route-status{font-size:16px;min-height:40px}}

@media(max-height:600px) and (orientation:landscape){#route-status{top:auto;bottom:8px;left:170px;max-width:calc(100vw - 360px);font-size:10px;padding:4px;min-height:28px}}

.refuge{width:min(1100px,100%)}.refuge-map{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin:24px 0}.refuge-map .facility{width:auto;padding:18px;background:#10222b;border:1px solid #354e58;display:flex;flex-direction:column}.refuge-map .facility.built{border-color:#85bca3}.facility h3{font-size:24px}.facility-rank{color:#cce796;font:12px monospace}.facility button{margin-top:auto}.refuge-cargo{padding:12px 16px;border-left:3px solid #e8c078;background:#18252b;color:#e8c078}button:disabled{opacity:.5;cursor:default}@media(max-width:850px){.refuge-map{grid-template-columns:1fr}}

section.refuge{max-width:1100px}.refuge h2{margin:10px 0}.refuge p{font-size:14px;margin:8px 0}.refuge-map{margin:16px 0}.refuge-map .facility{padding:16px}.facility h3{font-size:22px}.facility .facility-rank{font-size:12px}.facility .fine{font-size:12px}.refuge .facility button{font-size:14px;padding:10px;margin-top:12px}
