/* Flight surfaces never invoke iOS text selection; mission editors stay editable. */
@media (pointer:coarse),(max-width:700px){
 body{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;overscroll-behavior:none}
 input,textarea,select,[contenteditable="true"]{-webkit-user-select:text;user-select:text;-webkit-touch-callout:default}
 button{-webkit-tap-highlight-color:transparent;touch-action:manipulation}
 body #mission,body.colony #mission{top:calc(var(--deck-height) + 10px);bottom:auto;left:8px;width:174px;max-width:46vw;padding:9px;border-radius:10px;max-height:none}
 body #mission #sector{font-size:9px;line-height:1.2;letter-spacing:.06em;white-space:nowrap;padding-top:4px}
 body #all-missions{position:static;float:right;margin:-2px -2px 8px 4px;padding:7px 8px;font-size:11px;min-height:32px;pointer-events:auto}
 body #mission-list{clear:both;gap:0;margin:8px 0 0}
 body #mission-list>li{display:none!important;min-height:0;padding:0}
 body #mission-list>li.mobile-visible-mission,body #mission-list>li.mission-empty{display:flex!important}
 body #mission-list .mission-icon{display:none!important}
 body #mission-list .mission-copy{font-size:13px!important;line-height:1.35!important}
 body #mission-list .mission-copy small{font-size:9px!important;letter-spacing:.06em}
 body #mission-list button{min-height:32px;padding:6px 8px;font-size:11px;max-width:100%}
 body:not(.colony) #flight-status{left:auto;right:max(8px,env(safe-area-inset-right));bottom:calc(166px + env(safe-area-inset-bottom));width:clamp(112px,33vw,144px);min-width:0;padding:7px 8px;grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);gap:2px 7px;border-radius:9px}
 body:not(.colony) #flight-status>.eyebrow{font-size:7px;letter-spacing:.09em}
 body:not(.colony) #flight-status .speed{gap:3px;margin:0;align-items:baseline}
 body:not(.colony) #flight-status .speed strong{font-size:19px;line-height:1.1}
 body:not(.colony) #flight-status .speed span{font-size:8px}
 body #flight-status #karma-hud{padding:0 6px 0 0;gap:3px}
 body #flight-status #karma-hud strong{font-size:14px}
 body #flight-status #karma-hud span{font-size:7px;letter-spacing:0}
 body #flight-status #save-status,body #flight-status #fuel-status{display:none}
 body:not(.colony) #touch-controls{display:flex;position:fixed;left:max(8px,env(safe-area-inset-left));right:max(8px,env(safe-area-inset-right));bottom:calc(12px + env(safe-area-inset-bottom));width:auto;gap:20px;justify-content:space-between;align-items:center;z-index:40;pointer-events:none}
 body #touch-controls .touch-direction{display:grid;grid-template-columns:repeat(3,44px);grid-template-rows:repeat(3,44px);gap:0;max-width:none;pointer-events:none;background:#09243566;border:1px solid #699fa544;border-radius:20px}
 body #touch-controls .touch-direction button{width:44px;height:44px;margin:0;padding:0;border:0;border-radius:12px;font-size:24px;line-height:1;pointer-events:auto}
 .touch-direction [data-key="ArrowUp"]{grid-column:2;grid-row:1}.touch-direction [data-key="ArrowLeft"]{grid-column:1;grid-row:2}.touch-direction [data-key="ArrowDown"]{grid-column:2;grid-row:3}.touch-direction [data-key="ArrowRight"]{grid-column:3;grid-row:2}
 .touch-direction>span{grid-column:2;grid-row:2;display:grid;place-items:center;color:#8ab8c6;font-size:22px;pointer-events:none}
 body #touch-controls .touch-throttle{display:flex;flex-direction:column;gap:10px;pointer-events:none;align-items:center}
 body #touch-controls .touch-throttle button{width:58px;height:58px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;padding:0;border:1px solid #93dbea88;border-radius:16px;background:#102f3edb;pointer-events:auto}
 .touch-throttle b{font-size:21px;line-height:1}.touch-throttle small{font-size:8px;line-height:1}
 body #touch-controls button{touch-action:none;-webkit-touch-callout:none;user-select:none;-webkit-user-select:none;color:#b8eaff;box-shadow:inset 0 1px 0 #d3faff16}
 body #touch-controls button.held,body #touch-controls button:active{background:#2c718d;color:white;border-color:#b1f5ff}
 body.colony #touch-controls,body.cultural-visit #touch-controls,body.planet-shelter #touch-controls{display:none!important}
 body #right-flight-info{right:8px;width:176px;max-width:44vw;gap:6px}
 body #mission-navigation{padding:7px;border-radius:10px}body #mission-navigation button{padding:5px;font-size:12px;gap:4px}body #mission-navigation button small{font-size:10px;line-height:1.3;max-width:62%}
 body .mission-direction{gap:5px;padding:5px 2px}body .mission-direction>span{font-size:20px}body .mission-direction>small{font-size:11px;line-height:1.35}
 body #right-flight-info #drone-delivery{grid-template-columns:38px 1fr;padding:7px;gap:5px}body #drone-delivery-canvas{width:38px!important;height:42px!important}
 body #right-flight-info #event-hud{padding:7px;gap:4px;grid-template-columns:32px 1fr}body #right-flight-info #event-hud .event-radar{width:30px;height:30px;border-width:2px}
 body #right-flight-info #pursuit-canvas{max-height:85px;width:100%;object-fit:contain}
 body #story-beacon,body #distress-beacon,body #saved-world-beacon{font-size:11px;padding:8px;max-width:145px;line-height:1.3}
 body #home-planet{max-width:44vw;padding:6px}body #home-planet-name{font-size:13px}
 dialog#modal{max-width:calc(100vw - 16px);max-height:calc(100dvh - 20px);padding:14px;overflow:auto}
 dialog#modal h2{font-size:23px}dialog#modal p{font-size:14px}.player-missions article{padding:11px;gap:9px}.player-missions h3{font-size:14px}.player-missions .mission-accept{font-size:13px;padding:9px;margin-top:5px}
}
@media(max-width:700px){
 :root{--deck-height:78px}
 body>header.compact-deck{grid-template-columns:70px minmax(0,1fr) 60px;grid-template-rows:30px 38px;gap:1px 2px;padding:4px 6px 5px!important}
 body>header.compact-deck .brand{grid-column:1;grid-row:1;height:26px;align-items:start;padding:4px 0 0;min-width:0}.compact-deck .brand strong{font-size:12px;letter-spacing:2px}.compact-deck .brand small{display:none}
 body>header.compact-deck .deck-clock{grid-column:2;grid-row:1;justify-self:stretch;justify-content:flex-end;min-width:0;padding:0;border:0;gap:6px}body>header.compact-deck .deck-clock>.clock-symbol{display:none}body .compact-deck #time{font-size:12px!important}
 body>header.compact-deck .header-actions{grid-column:3;grid-row:1;height:30px;gap:5px}body>header.compact-deck .header-actions #session-menu{height:30px!important;width:30px!important}body>header.compact-deck .header-actions #notifications{height:28px;width:25px;min-width:25px}
 body>header.compact-deck .hud-wallet{grid-column:1/-1;grid-row:2;height:38px!important}body>header.compact-deck #cargo{height:38px!important}body>header.compact-deck #cargo .cargo-main{height:38px!important;padding:1px 3px 5px!important;gap:4px}
 body>header.compact-deck #cargo .resource-reflection,body>header.compact-deck #cargo .resource-art{width:24px!important;height:32px!important}body>header.compact-deck #cargo .cargo-copy strong{font-size:14px!important}body>header.compact-deck #cargo .cargo-copy small{font-size:7px;letter-spacing:0}body>header.compact-deck #cargo .reserve-track{left:31px!important;right:4px!important}
}
@media(pointer:coarse) and (orientation:landscape) and (max-height:550px){
 body #mission{top:calc(var(--deck-height) + 5px);width:195px;max-width:28vw}body #mission-list .mission-route{display:none}body #right-flight-info{max-width:29vw}
}

@media(pointer:coarse),(max-width:700px){
 body:not([data-mobile-mission="rescue"]) #distress-beacon{display:none!important}
 body:not([data-mobile-mission="capsule"]):not([data-mobile-mission="culture"]) #story-beacon{display:none!important}
}

/* One compact flight card: mission first, then exactly one contextual panel. */
@media(pointer:coarse),(max-width:700px){
 html,body{touch-action:manipulation;overscroll-behavior:none}
 body.mobile-flight-layout #space,body.mobile-flight-layout #touch-controls{touch-action:none}
 body.mobile-flight-layout #mission{touch-action:pan-y}
 body.mobile-flight-layout #mission{width:210px;max-width:58vw;padding:9px;display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:5px}
 body.mobile-flight-layout #sector{grid-column:1;grid-row:1;white-space:normal;align-self:center;font-size:9px;padding:0}
 body.mobile-flight-layout #all-missions{grid-column:2;grid-row:1;float:none;margin:0;padding:5px;min-height:30px;font-size:10px}
 body.mobile-flight-layout #mission-list{grid-column:1/-1;margin:6px 0 0}
 body.mobile-flight-layout #right-flight-info{position:static!important;inset:auto!important;grid-column:1/-1;clear:both;width:100%;max-width:none;gap:0;margin-top:7px}
 body.mobile-flight-layout #right-flight-info>[id]:not(.mobile-panel-selected){display:none!important}
 body.mobile-flight-layout #right-flight-info>aside,body.mobile-flight-layout #right-flight-info>#toast{padding:7px 0 0;border:0;border-top:1px solid #77b9c744;border-radius:0;background:transparent;box-shadow:none}
 body.mobile-flight-layout #right-flight-info #mission-navigation{max-width:none}
 body.mobile-flight-layout #mission-navigation button{width:auto;padding:5px 7px;min-height:30px;margin:0;font-size:12px;gap:5px}
 body.mobile-flight-layout #mission-navigation button small{display:none}
 body.mobile-flight-layout .mission-direction{padding:6px 0 0;gap:7px}
 body.mobile-flight-layout .mission-direction>small{font-size:11px;line-height:1.35}
 body.mobile-objective-visible #mission-list .mobile-visible-mission .mission-accept,body.mobile-objective-visible #mission-list .mobile-visible-mission [data-story-objective]{display:none}
 body.mobile-flight-layout #event-hud{display:flex;flex-direction:column;gap:4px}
 body.mobile-flight-layout #event-hud .event-radar,body.mobile-flight-layout #event-hud>.eyebrow{display:none}
 body.mobile-flight-layout #event-hud #event-title{font-size:12px;padding-right:30px}
 body.mobile-flight-layout #event-hud #radar-detection,body.mobile-flight-layout #event-hud #event-progress{font-size:11px}
 body.mobile-flight-layout #event-hud .event-controls{margin-top:2px}
 body.mobile-flight-layout #event-hud .event-controls button{font-size:11px;min-height:30px;padding:5px!important}
 body.mobile-flight-layout #event-guidance{position:static;transform:none;max-width:none;width:100%;padding:5px 0 0;border:0;background:none;gap:6px}
 body.mobile-flight-layout #event-guidance strong,body.mobile-flight-layout #event-guidance small{font-size:11px}
 body.mobile-flight-layout #event-arrow{font-size:20px;width:20px}
 body.mobile-flight-layout #pursuit-camera,body.mobile-flight-layout #drone-delivery-canvas{display:none}
 body.mobile-flight-layout #right-flight-info #drone-delivery{display:block}
 body.mobile-flight-layout #drone-delivery h3,body.mobile-flight-layout #drone-flight strong{font-size:12px;margin:3px 0}
 body.mobile-flight-layout #drone-delivery p,body.mobile-flight-layout #drone-flight small{font-size:11px;line-height:1.35;margin:4px 0}
 body.mobile-flight-layout #mission-reward-toast .reward-items{display:flex;gap:6px}
 body.mobile-flight-layout #mission-reward-toast .reward-item{padding:6px;border:0;background:none;min-width:0}
 body.mobile-flight-layout #mission-reward-toast svg{width:20px;height:20px}
 body.mobile-flight-layout #mission-reward-toast strong{font-size:12px}
 body.mobile-flight-layout #mission-reward-toast small{font-size:10px}
 body.mobile-flight-layout #right-flight-info #distress-panel{max-height:35dvh;overflow:auto;pointer-events:auto;touch-action:pan-y;padding-right:3px}
 body.mobile-flight-layout #distress-panel .rescue-portrait{display:none}
 body.mobile-flight-layout #distress-panel h2{font-size:15px;margin:6px 25px 6px 0}
 body.mobile-flight-layout #distress-panel h3{font-size:12px;margin:6px 0}
 body.mobile-flight-layout #distress-panel p,body.mobile-flight-layout #distress-panel .eyebrow{font-size:11px;line-height:1.35;margin:5px 0}
 body.mobile-flight-layout #distress-panel .rescue-cost{padding:5px}
 body.mobile-flight-layout #distress-panel button:not(.panel-close){padding:7px;font-size:11px;min-height:30px;margin-top:4px}
 body.mobile-flight-layout #distress-panel .reward-items{gap:6px;margin:6px 0}
 body.mobile-flight-layout #distress-panel .reward-item{padding:6px;min-width:0}
 body.mobile-flight-layout #distress-panel .reward-item strong{font-size:14px}
 body.mobile-flight-layout #distress-panel .reward-item small{font-size:10px}
 body.mobile-flight-layout #distress-panel .reward-symbol svg{width:20px;height:20px}
 body.mobile-flight-layout #home-planet,body.mobile-flight-layout #refuge-guidance{display:none!important}
 body.mobile-flight-layout #distress-beacon,body.mobile-flight-layout #story-beacon,body.mobile-flight-layout #saved-world-beacon{font-size:0!important;width:28px;min-width:0;height:28px;max-width:28px;padding:0;border-radius:50%}
 body.mobile-flight-layout #distress-beacon::after,body.mobile-flight-layout #story-beacon::after,body.mobile-flight-layout #saved-world-beacon::after{content:'◇';font-size:20px;line-height:26px}
 body.mobile-flight-layout:has(dialog[open]) #mission,body.mobile-flight-layout:has(dialog[open]) #touch-controls{visibility:hidden}
 input,textarea,select,[contenteditable="true"]{touch-action:manipulation;font-size:16px!important}
}
@media(pointer:coarse) and (orientation:landscape) and (max-height:550px){
 body:not(.colony) #flight-status{right:80px;bottom:10px}
 body.mobile-flight-layout #mission{max-width:38vw}
}

/* A small level readout sits immediately before the day on touch screens. */
@media(pointer:coarse),(max-width:700px){
 body>header.compact-deck #xp-hud{position:static;inset:auto;transform:none;flex:0 0 40px;width:40px;min-width:0;min-height:28px;height:28px;margin:0;padding:5px 2px 3px;border:0;border-radius:4px;background:transparent;box-shadow:none;text-align:center;line-height:1}
 body>header.compact-deck #xp-hud span{display:block;font:500 8px/1.2 Arial,sans-serif;letter-spacing:.02em;white-space:nowrap}
 body>header.compact-deck #xp-hud progress{width:32px;height:2px;margin:4px auto 0}
 body>header.compact-deck #xp-hud small{display:none}
 body>header.compact-deck .deck-clock{gap:6px}
}
@media(pointer:coarse) and (min-width:701px){
 body>header.compact-deck{grid-template-columns:100px minmax(0,1fr) 238px 60px}
 body>header.compact-deck .deck-clock>.clock-symbol{display:none}
 body .compact-deck #time{font-size:14px!important}
}
