/* Tablet input changes presentation only; simulation and save rules stay shared. */
html{height:100%;overscroll-behavior:none}#game{touch-action:none}
.touch-enabled{--tablet-top:max(12px,env(safe-area-inset-top));--tablet-bottom:max(14px,env(safe-area-inset-bottom));-webkit-tap-highlight-color:transparent}
.touch-enabled button,.touch-enabled a,.touch-enabled label{touch-action:manipulation}
.touch-enabled .touch-controls button,.touch-enabled .touch-stick{touch-action:none}
.touch-enabled button:not(.build-cell),.touch-enabled select,.touch-enabled input:not([type=checkbox]):not([type=range]){min-height:44px}
.touch-enabled input[type=checkbox]{width:22px;height:22px;flex-shrink:0}
.touch-enabled input[type=text],.touch-enabled input[type=search],.touch-enabled input[type=number],.touch-enabled select,.touch-enabled textarea{font-size:16px}
.touch-enabled .game-header{top:var(--tablet-top);left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right));gap:10px;align-items:start}
.touch-enabled .game-header h2{font-size:22px;max-width:300px}
.touch-enabled .game-header .eyebrow{font-size:8px;letter-spacing:1px}
.touch-enabled .header-controls{gap:6px;margin-right:92px}
.touch-enabled .hud-button{min-width:44px;padding:9px 12px;font-size:12px}
.touch-enabled .hud-button kbd{display:none}
.touch-enabled .feedback-button{top:var(--tablet-top);right:max(12px,env(safe-area-inset-right));padding:10px 12px;font-size:12px}
.touch-enabled .testing-badge{position:fixed;bottom:auto;top:65px;left:50%;right:auto;transform:translateX(-50%);padding:4px 8px;max-width:none;font-size:8px;pointer-events:none}
.touch-enabled .objective-card{top:100px;left:12px;width:185px;padding:12px}
.touch-enabled .objective-card .eyebrow{font-size:8px}
.touch-enabled .objective-line{font-size:11px;line-height:1.5;margin:8px 0}
.touch-enabled .objective-card .small{font-size:10px}
.touch-enabled .map-card{top:100px;right:12px;width:166px}
.touch-enabled .map-heading{font-size:9px;padding:10px;pointer-events:auto}
.touch-enabled .map-card.expanded{width:min(600px,calc(100vw - 24px));max-height:calc(100dvh - 280px);overflow:auto;pointer-events:auto}
.touch-enabled .map-card.expanded #minimap{max-height:calc(100dvh - 360px);object-fit:contain}
.touch-enabled .map-legend{font-size:8px}
.touch-enabled .dashboard{bottom:calc(var(--tablet-bottom) + 150px);min-width:0;width:min(410px,calc(100vw - 360px));padding:10px 12px;gap:12px;box-shadow:none}
.touch-enabled .drive-readout,.touch-enabled .controls-compact{display:none}
.touch-enabled .gauges{flex:1;width:auto;min-width:140px;gap:5px}
.touch-enabled .gauge>div{font-size:9px}
.touch-enabled .gauge meter{margin-top:3px}
.touch-enabled .salvage-readout{min-width:62px;padding-left:10px}
.touch-enabled .salvage-readout strong{font-size:25px}
.touch-enabled .salvage-readout .small{font-size:9px}
.touch-enabled .interact-prompt{bottom:calc(var(--tablet-bottom) + 248px);max-width:min(470px,65vw);white-space:normal;font-size:12px;padding:9px 13px;pointer-events:none}
.touch-enabled .thermal-warning{display:block;bottom:calc(var(--tablet-bottom) + 242px);right:12px;width:180px;max-width:180px;font-size:10px;pointer-events:none}
.touch-enabled .thermal-warning[hidden]{display:none!important}
.touch-enabled .trap-notice{left:12px;bottom:calc(var(--tablet-bottom) + 225px);width:190px;padding:10px}
.touch-enabled .trap-notice p{font-size:10px}
.touch-enabled .quest-notice{top:300px;right:12px;width:185px;padding:10px}
.touch-enabled .quest-notice strong{font-size:18px}
.touch-enabled .quest-notice p{font-size:11px}
.touch-enabled .quest-notice span{font:12px/18px var(--font)}
.touch-enabled .quest-notice small{font-size:10px}
@media(max-height:850px){.touch-enabled:has(.thermal-warning:not([hidden])) .quest-notice{display:none}}
.touch-enabled .boss-notice{top:100px;width:min(320px,calc(100vw - 390px));padding:10px}
.touch-enabled .boss-notice strong{font-size:20px}
.touch-enabled .boss-notice span{font:11px/16px var(--font)}
@media (min-width:760px) and (max-height:850px) and (orientation:landscape){
 .touch-enabled .boss-notice[data-kind=forge]{top:64px;padding:6px 10px}
 .touch-enabled .boss-notice[data-kind=forge] strong{font-size:16px;line-height:19px}
 .touch-enabled .boss-notice[data-kind=forge] span{margin:3px 0;line-height:14px}
 .touch-enabled .boss-notice[data-kind=forge] progress{display:block;margin:4px 0}
 .touch-enabled .boss-notice[data-kind=forge] small{font-size:10px;line-height:1.2;margin-top:3px}
}
.touch-enabled .tutorial-card{left:12px;bottom:calc(var(--tablet-bottom) + 240px);width:300px;padding:12px 15px}
.touch-enabled .tutorial-card h3{font-size:21px}
.touch-enabled .tutorial-card p{font-size:12px}
.touch-enabled .tutorial-card .text-button{font-size:11px;padding:6px}
.touch-enabled .save-indicator{bottom:4px;right:12px;font-size:9px}
.touch-enabled #toasts{top:100px;width:min(420px,60vw)}
.touch-enabled.boss-encounter[data-ui-mode=play] #toasts{top:248px}
.touch-enabled .modal-backdrop{padding:calc(var(--tablet-top) + 56px) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));backdrop-filter:blur(4px)}
.touch-enabled .modal{max-height:calc(100dvh - 88px);padding:20px;width:min(900px,100%);overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.touch-enabled .modal.wide{width:min(1160px,100%)}
.touch-enabled .modal-header h2{font-size:31px}
.touch-enabled .modal-header p{font-size:13px}
.touch-enabled .close-button{width:44px;height:44px}
.touch-enabled .modal-footer{flex-wrap:wrap;gap:10px;background:#14262c;padding-bottom:6px}
.touch-enabled .modal-footer p{font-size:11px}
.touch-enabled .modal-footer button{font-size:13px}
.touch-enabled #modal:has(#workshop-body){display:flex;flex-direction:column;overflow:hidden}
.touch-enabled #modal:has(#workshop-body) .modal-header{flex-shrink:0}
.touch-enabled #workshop-body{overflow:auto;min-height:0;overscroll-behavior:contain}
.touch-enabled #workshop-body .modal-footer{position:sticky;bottom:0;z-index:6;padding:12px 0 4px;margin-bottom:0;box-shadow:0 -7px 12px #14262c}
.touch-enabled .catalogue-filters{gap:10px}
.touch-enabled .catalogue-filters label{min-height:44px;font-size:12px}
.touch-enabled .catalogue-filters input[type=search]{width:220px;max-width:100%}
.touch-enabled .catalogue-filters>span{font-size:11px;display:block}
.touch-enabled .workshop-layout{grid-template-columns:165px minmax(0,1fr);gap:14px}
.touch-enabled .parts-list{max-height:min(480px,55dvh);padding-right:5px;touch-action:pan-y}
.touch-enabled .part-button{padding:8px;gap:7px;min-height:56px}
.touch-enabled .part-button canvas{width:32px;height:32px;flex-shrink:0}
.touch-enabled .part-button span{font-size:12px}
.touch-enabled .part-button small{font-size:10px}
.touch-enabled .construction{overflow:visible}
.touch-enabled .build-viewport{overflow:auto;max-height:min(430px,max(200px,calc(100dvh - 500px)));border:1px solid #5a786b;border-radius:4px;touch-action:pan-x pan-y;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.touch-enabled .build-grid{width:660px;min-width:660px;max-width:none;aspect-ratio:15/13;margin:0;border:0}
.touch-enabled .build-cell{width:44px;height:44px;min-height:44px;touch-action:none}
.touch-enabled .build-axis{min-width:660px;padding:0 8px;font-size:10px}
.touch-enabled .build-tools{font-size:12px;gap:12px}
.touch-enabled .body-plan-tools{gap:8px}
.touch-enabled .build-tool{font-size:13px;padding:10px 16px}
.touch-enabled .build-tools label{min-height:44px}
.touch-enabled .build-tools>span{display:none}
.touch-enabled .build-pan-hint{display:block;font-size:11px;color:#bbd0b9;margin:8px 0}
.touch-enabled .build-info{grid-column:1/-1;max-height:250px;overflow:auto;padding:16px}
.touch-enabled .build-info p{font-size:13px}
.touch-enabled .build-info dl{display:grid;font-size:12px}
.touch-enabled .build-stats{display:block;font-size:12px}
.touch-enabled .blueprint-notice{font-size:12px}
.touch-enabled .pause-settings{flex-wrap:wrap;font-size:13px;gap:18px}
.touch-enabled .pause-settings select{background:#203a3b;border:1px solid #648473;color:var(--cream);padding:8px;border-radius:4px}
.touch-enabled .briefing-stats{flex-wrap:wrap;gap:14px}
.touch-enabled .branch-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.touch-enabled .branch-card p,.touch-enabled .quest-task p{font-size:12px}
.touch-enabled summary{padding:12px 0;min-height:44px}
.touch-enabled .reward-chips span{font-size:11px}
.touch-enabled .journal-toolbar{flex-wrap:wrap}
.touch-enabled .current-tasks{grid-template-columns:1fr}
.touch-enabled .lab-section label{font-size:13px;min-height:44px}
.touch-enabled .lab-section .row{flex-wrap:wrap}
.touch-enabled .lab-section button{font-size:12px}
.touch-enabled .feedback-dialog{max-height:calc(100dvh - 32px);padding:22px;overscroll-behavior:contain}
.touch-enabled .feedback-dialog label{font-size:14px}
.touch-enabled .home-header{padding-right:95px}
.touch-enabled .home-footer button{font-size:13px}
@media(orientation:portrait){
 .touch-enabled .home{padding:0 6vw}
 .touch-enabled .home-header{min-height:82px}
 .touch-enabled .home-header .edition,.touch-enabled .fine{display:none}
 .touch-enabled .home-main{grid-template-columns:1fr;gap:12px;padding:25px 0}
 .touch-enabled .hero-copy h1{font-size:clamp(62px,10vw,90px)}
 .touch-enabled .machine-exhibit{display:none}
 .touch-enabled .home-actions .primary,.touch-enabled .home-actions .secondary{width:min(100%,380px)}
 .touch-enabled .home-footer{flex-wrap:wrap;gap:20px;padding:20px 0}
 .touch-enabled .game-header h2{font-size:20px;max-width:230px}
 .touch-enabled .header-controls{gap:4px}
 .touch-enabled .hud-button{min-width:44px;padding:9px;font-size:11px}
 .touch-enabled .game-header .eyebrow{font-size:7px;max-width:230px}
 .touch-enabled .dashboard{bottom:calc(var(--tablet-bottom) + 190px);width:min(400px,70vw)}
 .touch-enabled .interact-prompt{bottom:calc(var(--tablet-bottom) + 285px)}
 .touch-enabled .thermal-warning{bottom:calc(var(--tablet-bottom) + 290px);max-width:170px}
 .touch-enabled .trap-notice{bottom:calc(var(--tablet-bottom) + 290px);width:180px}
 .touch-enabled .tutorial-card{bottom:calc(var(--tablet-bottom) + 305px);width:300px}
 .touch-enabled .map-card.expanded{max-height:calc(100dvh - 360px)}
 .touch-enabled .map-card.expanded #minimap{max-height:calc(100dvh - 440px)}
 .touch-enabled .workshop-layout{grid-template-columns:150px minmax(0,1fr)}
 .touch-enabled .guide-grid,.touch-enabled .lab-grid{grid-template-columns:1fr}
 .touch-enabled .difficulty-grid{grid-template-columns:1fr}
 .touch-enabled .difficulty-card{min-height:0}
}
@media(max-width:650px){
 .touch-enabled .game-header{flex-direction:column;gap:5px}
 .touch-enabled .game-header h2{max-width:calc(100vw - 115px)}
 .touch-enabled .header-controls{margin-right:0}
 .touch-enabled .header-controls .hud-button{min-width:44px}
 .touch-enabled .objective-card,.touch-enabled .map-card{top:125px}
 .touch-enabled .objective-card{width:160px}
 .touch-enabled .map-card{width:130px}
 .touch-enabled .quest-notice{display:none!important}
 .touch-enabled .boss-notice{top:132px;width:calc(100vw - 32px)}
 .touch-enabled.boss-encounter .objective-card{display:none}
 .touch-enabled .branch-grid{grid-template-columns:1fr}
 .touch-enabled .catalogue-filters input[type=search]{width:100%}
 .touch-enabled .workshop-layout{grid-template-columns:110px minmax(0,1fr);gap:8px}
 .touch-enabled .part-button{flex-direction:column;align-items:start;padding:6px}
 .touch-enabled .part-button span{font-size:11px}
}

/* Leave room for the larger thumb circles in split view and short windows. */
@media(max-width:620px) and (min-height:541px){
 .touch-enabled .dashboard{top:109px;bottom:auto;width:calc(100vw - 24px)}
 .touch-enabled .objective-card,.touch-enabled .map-card{top:166px}
 .touch-enabled .interact-prompt{bottom:calc(var(--tablet-bottom) + 458px);max-width:calc(100vw - 24px)}
 .touch-enabled .tutorial-card{bottom:calc(var(--tablet-bottom) + 458px);width:calc(100vw - 24px);max-height:180px;overflow:auto;pointer-events:auto}
 .touch-enabled:has(.tutorial-card:not([hidden])) .objective-card,
 .touch-enabled:has(.tutorial-card:not([hidden])) .map-card:not(.expanded){display:none}
}
@media(max-height:540px) and (min-width:621px){
 .touch-enabled .dashboard{top:72px;bottom:auto}
 .touch-enabled .interact-prompt{top:122px;bottom:auto}
 .touch-enabled .objective-card{top:74px;padding:8px 10px}
 .touch-enabled .objective-card .eyebrow{font-size:7px;letter-spacing:.7px}
 .touch-enabled .objective-line{font-size:9px;line-height:1.2;margin:3px 0}
 .touch-enabled .objective-card .small{display:none}
 .touch-enabled .map-card{top:84px}
 .touch-enabled .map-heading{min-height:44px;display:flex;align-items:center;justify-content:space-between}
 .touch-enabled .map-card:not(.expanded) #minimap,
 .touch-enabled .map-card:not(.expanded) .map-legend{display:none}
 .touch-enabled .map-card.expanded{top:64px;max-height:110px}
 .touch-enabled .map-card.expanded #minimap{max-height:64px}
 .touch-enabled .tutorial-card{left:210px;right:200px;top:72px;bottom:auto;width:auto;max-height:166px;overflow:auto;pointer-events:auto}
 .touch-enabled:has(.tutorial-card:not([hidden])) .dashboard{display:none}
}

@media(max-width:620px), (max-height:540px){
 .touch-enabled .dashboard{padding:6px 10px;gap:10px;min-height:0}
 .touch-enabled .gauges{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;min-width:0}
 .touch-enabled .gauge>div{font-size:8px;gap:4px}
 .touch-enabled .gauge meter{height:4px}
 .touch-enabled .salvage-readout{padding-left:8px;min-width:48px}
 .touch-enabled .salvage-readout strong{font-size:18px;line-height:1.1}
 .touch-enabled .salvage-readout .micro{font-size:7px}
.touch-enabled .salvage-readout .small{display:none}
}

/* Keep a usable plan viewport beneath the always-visible budget on phones. */
@media(max-width:650px){
 .touch-enabled #modal:has(#workshop-body) .modal-header h2{font-size:24px}
 .touch-enabled .workshop-header .eyebrow{font-size:9px}
 .touch-enabled .workshop-header p:not(.eyebrow){display:none}
 .touch-enabled #workshop-body .modal-footer p{display:none}
 .touch-enabled #workshop-body .modal-footer button{width:100%}
 .touch-enabled #workshop-body .catalogue-filters>span{display:none}
}

.touch-enabled #workshop-body.pan-mode .build-cell{touch-action:pan-x pan-y}

/* The title's live rover stays visible in portrait, below the play buttons. */
@media(orientation:portrait){
 .touch-enabled .home-main{gap:0;padding:18px 0}
 .touch-enabled .hero-copy h1{font-size:clamp(52px,8vw,70px);margin:18px 0}
 .touch-enabled .home-actions{margin-top:22px}
 .touch-enabled .machine-exhibit{display:block;width:min(100%,360px);margin:0 auto}
 .touch-enabled .machine-exhibit .exhibit-top,.touch-enabled .machine-exhibit .exhibit-bottom{display:none}
}
