/* Final mobile pass: flat grey panels, crisp pixel art, clear touch feedback. */
:root{--panel:#252a30;--panel-edge:#818892;--muted-text:#c0c6ce;--touch-size:44px;--visual-height:100dvh;--visual-top:0px;color-scheme:dark}
html{scrollbar-gutter:stable}body{-webkit-tap-highlight-color:transparent}button,a{-webkit-touch-callout:none}button{touch-action:manipulation;transition:background-color .12s,border-color .12s,filter .12s}button:not(:disabled):active{filter:brightness(1.2)}#grid button{transition:none;filter:none!important}button:disabled{cursor:default}img{image-rendering:pixelated}h2,h3{overflow-wrap:anywhere}
#game>header{background:#34383e;border-bottom:2px solid #858b94}#screw-counter{font-variant-numeric:tabular-nums;white-space:nowrap;border-radius:5px;border-color:#8a929d}#inventory{background:#252a30;border-top:2px solid #818892}#slots{scroll-padding-inline:8px;overscroll-behavior-x:contain}.slot{border-radius:4px;box-shadow:inset 0 1px #717986,0 2px #0c1015}.slot.selected{background:#48515e;border-color:#e4e9ef;outline:1px solid #e4e9ef;outline-offset:1px}.amount{font-variant-numeric:tabular-nums;min-width:18px;text-align:center;border-radius:2px}
#menu{padding:32px 20px calc(32px + env(safe-area-inset-bottom));gap:24px}#start{min-height:52px;border-radius:5px;border:2px solid #afb6c1;background:#353c46;min-width:180px}#start:not(:disabled):hover{background:#495461}#start:disabled{cursor:progress}#menu h1{max-width:100%}
dialog{background:#252a30;border:2px solid #8d949e;border-radius:8px;padding:16px;max-height:calc(var(--visual-height) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));overflow-y:auto;overscroll-behavior:contain;box-shadow:0 6px 0 #0d1117,0 20px 50px #000a;scroll-padding:12px}dialog::backdrop{background:#080b10c7}body:has(dialog[open]){overflow:hidden}dialog>.dialog-head{position:sticky;top:-16px;z-index:2;background:#252a30}dialog{scroll-padding-top:76px}
.dialog-head{border-bottom:1px solid #59616c;padding-bottom:12px;gap:10px}.dialog-head h2{line-height:1.6;letter-spacing:1px}.dialog-head button[id^="close-"],#close-password{min-width:44px;min-height:44px;border-radius:5px;padding:6px;background:#3b424c;border:2px solid #a0a8b4;box-shadow:inset 0 1px #77818e}#download-apk{min-width:44px;min-height:44px;border-radius:5px}
.ship-note,.connection-note{color:var(--muted-text);line-height:1.8}.form-error{color:#ffd0c8;line-height:1.8}.checkbox-label{padding-block:6px;min-height:44px;cursor:pointer}.checkbox-label input{width:24px;height:24px;flex:none}#auth-form input,#server-form input:not([type="checkbox"]),#server-form select,#ship-save-name,#screw-password{background:#13181f;border:1px solid #7b8797;border-radius:4px;min-height:44px;box-shadow:none;padding:10px}#auth-form input:focus,#server-form input:focus,#server-form select:focus,#ship-save-name:focus,#screw-password:focus{outline:2px solid #c8d5e4;outline-offset:2px}#auth-choice button,#auth-submit,#save-server,#reload-cloud,#cancel-queue{min-height:46px}#auth-notice{margin-top:0}.auth-choice{gap:10px}
#server-list,#server-status,.server-top{width:min(760px,calc(100% - 24px))}#servers{padding-bottom:calc(24px + env(safe-area-inset-bottom))}#servers header{gap:10px;background:#34383e;border-bottom:2px solid #858b94}#servers-title{line-height:1.5}.server-top{gap:8px}.server-top button{min-height:44px}.server-card{border:1px solid #738092;border-radius:5px;background:#252d38;padding:14px;gap:12px}.server-details{min-width:0;flex:1}.server-card h3{color:#f0f3f7;margin-bottom:8px}.server-card p{color:#c2cad5}.server-actions button{min-height:44px;min-width:64px}.server-actions button:first-child{background:#4a596b;border-color:#a4b3c6}.server-actions button:disabled{background:#303944}
#launch-checklist{background:#252a30;color:#dce2eb;border:2px solid #858e9c}.checklist-head h2{font-size:11px}#toggle-checklist{min-width:36px;min-height:36px}.checklist-item{color:#c1cad6}.checklist-item[data-ready="true"]{color:#c0dfa9}#tool-panel{background:#252a30;border:2px solid #8b94a1}.paint-label,#paint-panel h2{color:#d4dce8!important;line-height:1.5}#paint-back,#pipette-tool{min-height:38px;border-radius:4px}#paint-brightness{height:36px;padding:0;box-shadow:none;background:transparent;touch-action:pan-x}#recent-colours button{min-width:32px;min-height:32px;border-radius:3px}#paint-current{border-radius:4px}#paint-wheel{image-rendering:auto}
#ship-saves-dialog,#ship-load-dialog{max-height:calc(var(--visual-height) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}#saved-ships{max-height:38dvh;overscroll-behavior:contain}.ship-save-form{gap:8px;align-items:stretch}.ship-save-form button,.saved-ship button,.ship-load-actions button{min-height:44px}.saved-ship{border-color:#57616d;gap:8px}.saved-ship span{line-height:1.6}.ship-load-actions{position:sticky;bottom:-16px;background:#252a30;padding:12px 0;margin-top:12px}.ship-material{gap:8px;line-height:1.6}#ship-load-funds{color:#c4cedb}
#crafting-dialog{max-height:calc(var(--visual-height) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));height:min(720px,calc(var(--visual-height) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));border-radius:7px;border-color:#8d98a7;background:#252a30}#craft-selected{border-radius:5px;background:#303944}.craft-selected-portrait{background:#222a35}#craft-selected-name{color:#f0f4f9}.craft-selected-materials{background:#242d37}#craft-selected-cost .craft-ingredient{border-radius:4px}.craft-ingredient.missing{color:#ffd0c8!important}#craft-selected-button{min-height:44px;border-radius:5px}.craft-selector{border-radius:5px}.craft-selector.selected{outline:0;border-color:#d3e2f2;box-shadow:inset 0 0 0 1px #a8bfd8,0 3px 0 #0d131b}#crafting-status{line-height:1.7;min-height:20px;color:#c5e3ac}#crafting-recipes{border-radius:5px;scrollbar-gutter:stable}#craft-selected-description{color:#d1d8e2}
#area-dialog{width:min(560px,calc(100vw - 24px))}.area-options{gap:10px}.area-options button{border-radius:5px;background:#303a47;border:2px solid #8593a5;min-height:100px}.area-options button:active{background:#4a5b70}.area-options button span{font-size:13px;line-height:1.5}#guide-dialog{scroll-padding-top:80px}#guide-dialog .dialog-head{top:-16px;background:#252a30;z-index:2}#guide-content{line-height:1.85;color:#d5dce6}.guide-card{border-radius:4px;border:1px solid #788596;background:#303944}.guide-card:hover{background:#414e5e}.guide-section-head{gap:10px}
#flight-joystick{background:#252c36da;border-color:#99a5b5;box-shadow:inset 0 0 0 8px #11182055,0 2px 10px #0005}.joystick-thumb{background:#65758b;border-color:#e0e8f4;box-shadow:0 2px 5px #0007}.resource{background:#252c36d9;border:1px solid #8794a6;border-radius:4px}.meter-label{color:#e7edf6;font-variant-numeric:tabular-nums}.meter{border-color:#8393a7;border-radius:2px}.meter-fill{transition:width .15s linear}#drone-toggle,#give-up,#flight-menu{border-radius:4px;background:#323d4c;border-color:#a6b6cb;min-height:44px}#online-hud{right:max(12px,env(safe-area-inset-right));top:max(12px,env(safe-area-inset-top));max-width:45vw;color:#e9eff9}
body:has(#flight:not([hidden])) .star-field,.ground-active .star-field,body:has(#servers:not([hidden])) .star-field{animation-play-state:paused}
@media(pointer:coarse),(max-width:600px){
 button:not(#grid button),#download-apk{min-height:44px}input:not([type="checkbox"]):not([type="range"]),select,textarea{font-size:16px!important}#game>header{min-height:64px;height:auto;padding:max(8px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) 8px max(10px,env(safe-area-inset-left));gap:8px}.builder-actions{gap:6px;flex-wrap:wrap}.builder-actions button{padding:8px 10px;font-size:11px;min-height:44px}#screw-counter{min-height:42px;font-size:12px;padding-inline:7px;gap:3px}#screw-counter img{width:23px;height:23px}
 #game{padding-bottom:calc(122px + env(safe-area-inset-bottom))}#game>#grid-wrap,#game:has(#tool-panel.paint-open:not([hidden]))>#grid-wrap{width:min(560px,calc(100vw - 28px),max(240px,calc(100dvh - 372px - env(safe-area-inset-bottom))));margin:12px auto 10px}#game>#launch-row{margin:8px auto 16px}#launch{min-height:48px;min-width:164px;font-size:16px;padding:10px 28px}
 #inventory{height:calc(118px + env(safe-area-inset-bottom));padding:8px max(10px,env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left))}#inventory h2{font-size:11px;line-height:1.5;margin-bottom:4px}.slot{width:60px;height:60px;flex-basis:60px;padding:5px}.amount{font-size:11px}#slots{gap:8px;padding:3px 3px 7px}
 #game>#block-tools{flex-direction:row;justify-content:center;align-items:center;gap:8px;margin:4px auto}#game #editor-tools{gap:6px}#game #editor-tools button{width:44px;height:44px;padding:8px}#game #toggle-tools{width:44px;height:44px;padding:6px;min-height:44px}#game:has(#tool-panel.paint-open:not([hidden]))>#block-tools{flex-direction:column;gap:6px}#game #paint-back,#game #pipette-tool{min-height:44px;font-size:10px}#game #paint-wheel{max-width:160px}#game #recent-colours{max-height:96px;gap:5px}#game #recent-colours button{width:44px;height:44px;min-height:44px}#game .paint-label,#game #paint-panel h2{font-size:10px}
 #launch-checklist{width:min(340px,calc(100% - 20px));margin:8px 10px 0!important;padding:8px 10px}#toggle-checklist{min-width:44px;min-height:44px}.checklist-item{font-size:10px!important;line-height:1.6}.checklist-head h2{font-size:11px}#checklist-items{gap:10px}
 dialog{width:min(620px,calc(100vw - 20px));padding:14px;max-height:calc(var(--visual-height) - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}.dialog-head h2{font-size:14px}.ship-note,.connection-note{font-size:11px}.server-card{padding:12px}.server-card h3{font-size:13px}.server-card p{font-size:10px}.server-actions{gap:6px}.server-actions button{font-size:11px;min-width:70px}.server-top span{font-size:11px;overflow-wrap:anywhere}.server-top button{font-size:10px}#servers header{padding:max(8px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) 8px max(10px,env(safe-area-inset-left));gap:8px;flex-wrap:wrap}#servers-title{font-size:14px;flex:1}#servers header button{font-size:11px;padding:8px 10px}.server-details{min-width:0}
 #ship-saves-dialog,#ship-load-dialog{max-height:calc(var(--visual-height) - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}.ship-save-form{flex-wrap:wrap}.ship-save-form input{flex:1 1 160px}.ship-save-form button{flex:0 0 auto}.saved-ship{font-size:11px;flex-wrap:wrap}.saved-ship span{flex:1 1 100px}.saved-ship button{font-size:10px;padding:7px 9px}.ship-load-actions{bottom:-14px;flex-wrap:wrap}.ship-load-actions button{flex:1;font-size:11px}
 #crafting-dialog{width:calc(100vw - 16px);height:calc(var(--visual-height) - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));max-height:calc(var(--visual-height) - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));gap:10px;padding:10px}#craft-selected-description{font-size:10px;max-height:96px;line-height:1.6}#craft-selected-name{font-size:14px;line-height:1.5}#craft-selected-cost .craft-ingredient{font-size:10px}#crafting-recipes{grid-template-columns:repeat(auto-fill,minmax(62px,1fr));gap:8px;padding:8px}.craft-selector{padding:7px}#craft-selected-image{max-height:126px}#craft-selected-owned{font-size:10px}#craft-selected-button{font-size:12px}#crafting-status{font-size:10px}
 .area-options{grid-template-columns:repeat(2,minmax(0,1fr))}.area-options button img{max-width:90px;max-height:90px}.guide-block-list{gap:8px}.guide-card{font-size:11px;padding:10px}.guide-block-list .guide-card{min-height:84px}#guide-content{font-size:11px}.guide-icons img{width:40px;height:40px}#guide-dialog .dialog-head{top:-14px}
 #flight-meters{bottom:max(12px,env(safe-area-inset-bottom));left:max(10px,env(safe-area-inset-left));width:min(620px,calc(100vw - 142px - env(safe-area-inset-left) - env(safe-area-inset-right)));gap:6px;transform:none}#flight-joystick{width:108px;height:108px;right:max(10px,env(safe-area-inset-right));bottom:max(12px,env(safe-area-inset-bottom))}.resource{padding:6px}.meter-label{font-size:9px;line-height:1.5}.meter-label span:last-child{font-size:10px}.meter{height:17px}#minimap{left:max(10px,env(safe-area-inset-left));top:max(10px,env(safe-area-inset-top));width:112px;height:112px}#flight-menu{left:max(10px,env(safe-area-inset-left));top:calc(max(10px,env(safe-area-inset-top)) + 120px);width:112px;font-size:12px}#drone-toggle{bottom:calc(max(12px,env(safe-area-inset-bottom)) + 120px);padding:8px 18px;font-size:12px}#give-up{font-size:12px;top:max(10px,env(safe-area-inset-top));padding:8px 12px}
 .keyboard-open dialog[open]{position:fixed;top:calc(var(--visual-top) + 8px);bottom:auto;margin:0 auto;max-height:calc(var(--visual-height) - 16px);height:auto}
}
@media(pointer:coarse) and (orientation:landscape) and (max-height:600px){
 #game{grid-template-columns:minmax(0,1fr) minmax(220px,32vw);grid-template-rows:64px auto auto auto 1fr}#game>header{grid-row:1}#game>#grid-wrap{grid-column:1;grid-row:2/6;width:min(max(160px,calc(100dvh - 198px - env(safe-area-inset-bottom))),calc(65vw - 24px));margin:10px auto}#game>#block-tools{grid-column:2;grid-row:3;flex-direction:column;margin:4px 10px 4px 0}#game>#launch-row{grid-column:2;grid-row:4;margin:6px 10px 14px 0}#launch-checklist{grid-column:2;grid-row:2;width:calc(100% - 20px)}#checklist-items{display:block}.checklist-item{font-size:10px!important}#game:has(#tool-panel.paint-open:not([hidden]))>#grid-wrap{width:min(360px,calc(100vw - 28px));margin:12px auto}
 #minimap{width:96px;height:96px}#flight-menu{width:96px;top:calc(max(10px,env(safe-area-inset-top)) + 104px)}#flight-joystick{width:100px;height:100px}#flight-meters{width:min(520px,calc(100vw - 138px - env(safe-area-inset-left) - env(safe-area-inset-right)))}#drone-toggle{bottom:calc(max(12px,env(safe-area-inset-bottom)) + 112px)}
}
@media(max-width:340px){.builder-actions{gap:4px}.builder-actions button{font-size:10px;padding:7px 8px}#screw-counter{font-size:11px;padding-inline:5px}.server-card{flex-wrap:wrap}.server-actions{flex-direction:row;width:100%}.server-actions button{flex:1}#crafting-recipes{grid-template-columns:repeat(auto-fill,minmax(58px,1fr))}#craft-selected{grid-template-columns:78px minmax(0,1fr)}#give-up{top:calc(max(10px,env(safe-area-inset-top)) + 50px)}#online-hud{font-size:8px;max-width:43vw}.ship-save-form button{width:100%}}
@media(prefers-reduced-motion:reduce){button,.craft-selector,.meter-fill{transition:none}.star-field{animation:none}}

/* Resource warnings remain static and legible without flashing. */
.meter.resource-low{border-color:#d4b17c}.meter.resource-empty{border-color:#c77f79}.meter.resource-empty::after{content:'';display:block;height:100%;background:#be766c22}

#builder-feedback{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(160px + env(safe-area-inset-bottom));z-index:30;margin:0;padding:10px 14px;max-width:calc(100vw - 24px);width:max-content;background:#1c2229ed;border:1px solid #a0acbb;border-radius:5px;color:#edf2f8;font-size:10px;line-height:1.7;pointer-events:none;text-align:center}#builder-feedback[hidden]{display:none}
@media(pointer:coarse),(max-width:600px){#builder-feedback{bottom:calc(126px + env(safe-area-inset-bottom));max-width:calc(100vw - 24px)}.craft-ingredient{min-height:32px}#crafting-status:empty{min-height:0}#tool-panel button:focus-visible,.slot:focus-visible{outline:2px solid #e2eaf4;outline-offset:2px}}

#launch-checklist[hidden]{display:none!important}
