/* Phone controls occupy reserved bands, independent of desktop reticle placement. */
#app[data-phase=brief] #toast,#app[data-phase=result] #toast,#app[data-phase=menu] #toast{display:none}
@media (any-pointer:coarse){
 #app.handheld button{-webkit-tap-highlight-color:transparent}
 #app.handheld .topbar{height:44px;min-height:44px;padding:0}
 #app.handheld .health-card #damage-notice{position:absolute;top:100%;left:50%;transform:translateX(-50%);white-space:nowrap}
 #app.handheld .goal-radar .hud-bearing{display:none}
 #app.handheld .goal-radar{inset:50% auto auto 50%;width:80px;height:80px;transform:translate(-50%,-50%)}
 #app.handheld .goal-radar .reticle-ticks{display:none}
 #app.handheld .goal-radar .hud-range{inset:70px auto auto 50%;transform:translateX(-50%);display:flex;flex-direction:row;gap:5px;white-space:nowrap}
 #app.handheld .goal-radar .hud-range strong{font-size:14px}
 #app.handheld .goal-radar .hud-range>span{display:none}
 #app.handheld .goal-radar .hud-flight{inset:94px auto auto 50%;transform:translateX(-50%);white-space:nowrap;font-size:12px}
 #app.handheld #toast{top:calc(var(--safe-top) + 98px);max-width:55%;font-size:12px;padding:7px 10px;line-height:1.5}
 #app.handheld #threat-banner{top:calc(var(--safe-top) + 52px);max-width:55%;font-size:12px}
 #app.handheld .inspect-heading{display:none}
 #app.handheld .inspect-actions{top:calc(var(--safe-top) + 56px);display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
 #app.handheld .inspect-actions .scene-action{justify-content:center;min-width:0;min-height:40px;padding:7px 5px;font-size:12px}
 #app.handheld .inspect-viewbar{bottom:var(--safe-bottom);left:var(--safe-left);right:var(--safe-right);height:58px;margin:0}
 #app.handheld[data-phase=inspect] .touch-joystick{bottom:calc(var(--safe-bottom) + 72px);width:96px;height:96px}
 #app.handheld[data-phase=inspect] .map-card:not(.expanded){bottom:calc(var(--safe-bottom) + 72px);top:auto}
 #app.handheld[data-phase=inspect] #tour-hint{top:46%;max-width:70%;padding:12px;font-size:13px}
}
@media (any-pointer:coarse) and (orientation:landscape){
 #app.handheld .screen{padding-top:calc(var(--safe-top) + 48px)}
 /* The nickname and next action get their own side column, never the roster's height. */
 #app.handheld #menu-screen .menu-shell{display:grid;grid-template-columns:minmax(0,1fr) clamp(170px,27vw,240px);grid-template-rows:auto minmax(0,1fr);height:100%;padding:10px 12px;gap:8px 16px}
 #app.handheld #menu-screen .menu-title,#app.handheld #menu-screen .load-status{display:none}
 #app.handheld #menu-screen .selection-title{grid-column:1/-1;grid-row:1;border:0;padding:0;font-size:13px;min-height:22px}
 #app.handheld #menu-screen .selection-layout{grid-column:1;grid-row:2;display:block;height:100%;overflow:auto;padding:2px;scrollbar-gutter:stable}
 #app.handheld #menu-screen .roster{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:max-content;height:auto;overflow:visible;gap:8px}
 #app.handheld #menu-screen .character-card{min-height:114px;padding:4px 0 7px}
 #app.handheld #menu-screen .character-card .roach-art{width:74px;max-width:100%;height:auto;aspect-ratio:1}
 #app.handheld #menu-screen .character-card strong{font-size:12px;line-height:18px;padding:0 3px;white-space:normal;text-align:center}
 #app.handheld #menu-screen .character-card small{font-size:11px;text-align:center;padding:0 2px}
 #app.handheld #menu-screen .selected-detail{display:block;border:0;border-top:1px solid var(--line);margin:14px 0 0;padding:12px 4px;overflow:visible}
 #app.handheld #menu-screen .menu-bottom{grid-column:2;grid-row:2;display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:14px;margin:0;padding:4px 0 4px 14px;border:0;border-left:1px solid var(--line);overflow:auto}
 #app.handheld #menu-screen .menu-bottom label{flex:none;min-width:0;font-size:13px}
 #app.handheld #menu-screen .menu-bottom input{width:100%;max-width:none;min-height:44px;font-size:16px}
 #app.handheld #menu-screen .menu-bottom .primary{width:100%;min-width:0;min-height:44px;padding:10px;font-size:13px;gap:5px}
 #app.handheld #menu-screen .menu-note{display:none}
 #app.handheld.keyboard-open #menu-screen .menu-shell{grid-template-rows:minmax(0,1fr)}
 #app.handheld.keyboard-open #menu-screen .selection-title{display:none}
 #app.handheld.keyboard-open #menu-screen .selection-layout,#app.handheld.keyboard-open #menu-screen .menu-bottom{grid-row:1}
 #app.handheld .health-card{width:clamp(170px,27vw,250px)}
 #app.handheld .run-extras{top:calc(var(--safe-top) + 48px);font-size:11px;gap:4px 8px;max-width:30%;background:#102419b8}
 #app.handheld .run-extras b{font-size:12px}
 #app.handheld .map-card:not(.expanded){top:calc(var(--safe-top) + 50px);bottom:auto;right:var(--safe-right);width:100px;padding:4px}
 #app.handheld .map-card:not(.expanded) canvas{display:none}
 #app.handheld .map-card:not(.expanded) .map-header{font-size:11px}
 #app.handheld .map-card:not(.expanded) .map-header button{width:32px;height:32px;font-size:23px}
 #app.handheld .abilities{height:108px;width:176px;bottom:var(--safe-bottom)}
 #app.handheld #jump-button{width:64px;height:64px;right:0;bottom:0}
 #app.handheld #pheromone-button{width:56px;height:56px;right:72px;bottom:0}
 #app.handheld #scare-button{width:44px;height:44px;right:0;bottom:66px}
 #app.handheld #camera-button{width:44px;height:44px;right:54px;bottom:66px}
 #app.handheld .touch-joystick{width:96px;height:96px}
 #app.handheld .goal-radar{top:44%}
 #app.handheld .inspect-actions{grid-template-columns:repeat(6,minmax(0,1fr))}
 #app.handheld .inspect-viewbar{left:calc(var(--safe-left) + 110px);right:calc(var(--safe-right) + 110px);height:50px;bottom:var(--safe-bottom)}
 #app.handheld[data-phase=inspect] .touch-joystick{bottom:var(--safe-bottom)}
 #app.handheld[data-phase=inspect] .map-card:not(.expanded){bottom:var(--safe-bottom);top:auto}
}
@media (any-pointer:coarse) and (orientation:portrait){
 #app.handheld .inspect-actions{left:var(--safe-left);right:var(--safe-right);max-width:none}
 #app.handheld .goal-radar{top:46%}
 #app.handheld .map-card:not(.expanded){top:calc(var(--safe-top) + 142px);width:100px}
 #app.handheld .map-card:not(.expanded) canvas{display:none}
 #app.handheld .inspect-viewbar button{font-size:11px;min-height:44px}
 #app.handheld .inspect-viewbar button small{display:none}
 #app.handheld .run-extras{max-width:calc(100% - 130px);font-size:11px}
 #app.handheld #menu-screen .menu-title{display:none}
 #app.handheld #menu-screen .menu-shell{grid-template-rows:auto minmax(0,1fr) auto auto}
}
/* Short landscape screens: reserve space for content, not stacked decoration. */
@media (orientation:landscape) and (max-height:600px){
 #app.handheld .screen .brief-shell{display:grid;grid-template-columns:88px minmax(0,1fr);grid-template-rows:26px minmax(0,1fr) 38px;gap:6px 12px;padding:10px 12px}
 #app.handheld .brief-shell .flow-heading{grid-column:1/-1;gap:6px}
 #app.handheld .brief-shell .flow-heading .eyebrow{display:none}
 #app.handheld .brief-shell .flow-heading h2{font-size:16px;line-height:1.3;margin:0}
 #app.handheld .brief-shell #brief-progress{font-size:13px}
 #app.handheld .brief-steps{grid-column:1;grid-row:2;display:flex;flex-direction:column;gap:4px;overflow:auto}
 #app.handheld .brief-steps button{min-height:0;height:32px;padding:4px;font-size:12px;flex:1 1 0;line-height:1.3;border:1px solid var(--line);border-radius:5px}
 #app.handheld .brief-viewport{grid-column:2;grid-row:2;border-left:1px solid var(--line);padding-left:12px;min-height:0}
 #app.handheld .brief-slide{padding:0 8px 6px 0;scrollbar-gutter:stable;overflow-y:scroll}
 #app.handheld .brief-slide h3{font-size:16px;line-height:1.4;margin:6px 0}
 #app.handheld .brief-slide p,#app.handheld .brief-slide .brief-small{font-size:13px;line-height:1.65;margin:6px 0}
 #app.handheld .brief-diagram{min-height:0;height:54px;padding:5px 8px;gap:8px}
 #app.handheld .diagram-unit{flex-direction:row;gap:6px}
 #app.handheld .diagram-unit strong{font-size:11px;line-height:1.4}
 #app.handheld .diagram-icon,#app.handheld .diagram-icon svg{width:28px;height:28px;flex-shrink:0}
 #app.handheld .diagram-unit>svg{width:60px;height:32px;flex-shrink:0}
 #app.handheld .brief-slide .key-grid{height:36px;flex-shrink:0}
 #app.handheld .key-grid kbd{width:14px;height:14px;font-size:9px;margin:1px}
 #app.handheld .key-grid>kbd{margin:0 auto 2px}
 #app.handheld .big-key{width:28px;height:28px;font-size:18px}
 #app.handheld .big-key .mobile-copy{font-size:11px;white-space:nowrap}
 #app.handheld .diagram-number{font-size:24px;line-height:28px}
 #app.handheld .rule-strip{margin-top:6px;padding-top:6px;gap:8px}
 #app.handheld .rule-strip b,#app.handheld .rule-strip>span{font-size:11px;line-height:1.5}
 #app.handheld .damage-chips{margin-top:6px;gap:5px}
 #app.handheld .damage-chips span{font-size:11px;padding:3px 6px}
 #app.handheld .brief-bottom{grid-column:1/-1;grid-row:3;padding:4px 0 0;gap:8px}
 #app.handheld .brief-bottom button{font-size:12px;min-height:32px;padding:5px 12px}
 #app.handheld .brief-footer-hint{display:block;font-size:11px}
 #app.handheld .brief-shell>.status-text:not(:empty){position:absolute;bottom:52px;right:30px;background:#172a1e;padding:6px;max-width:50%}
 #app.handheld #result-screen .result-shell{padding:10px 12px;gap:8px;grid-template-rows:minmax(0,1fr) auto}
 #app.handheld #result-screen .result-layout{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px}
 #app.handheld #result-screen .result-heading .eyebrow{display:none}
 #app.handheld #result-screen .result-heading h2{font-size:20px;line-height:1.3;margin:0 0 5px}
 #app.handheld #result-screen .result-heading p{font-size:12px;line-height:1.5;margin:4px 0}
 #app.handheld #result-screen .result-personal .result-stats{grid-template-columns:repeat(4,minmax(0,1fr));padding:8px 0;gap:6px}
 #app.handheld #result-screen .result-personal .result-stats>div{grid-column:auto}
 #app.handheld #result-screen .result-personal .result-stats strong,#app.handheld #result-screen .result-personal .result-stats>div:first-child strong{font-size:20px;line-height:1.3;letter-spacing:0;margin:4px 0}
 #app.handheld #result-screen .result-stats span{font-size:11px}
 #app.handheld #result-screen .result-stats strong{white-space:nowrap;overflow-wrap:normal}
 #app.handheld #result-screen .result-personal .personal-ranks{font-size:11px;padding-top:6px;gap:4px}
 #app.handheld #result-screen .result-ranking-heading{padding-bottom:5px}
 #app.handheld #result-screen .result-ranking-heading h3{font-size:16px}
 #app.handheld #result-screen .result-trophy{width:26px;height:26px}
 #app.handheld #result-screen .result-trophy svg{width:19px;height:19px}
 #app.handheld #result-screen .result-buttons{padding-top:6px;gap:8px}
 #app.handheld #result-screen .result-buttons button{min-height:36px;font-size:13px;padding:6px}
 #app.handheld #result-screen .share-cta svg{width:20px;height:20px}
 #app.handheld #result-status{font-size:11px;margin:4px 0;line-height:1.4}
 #app.handheld #result-board .leader-switch button{min-height:30px;font-size:12px;padding:4px}
 #app.handheld #result-board .score-table{font-size:11px}
 #app.handheld #result-board .score-table td{height:32px;padding:4px}
 #app.handheld #share-modal .share-shell{padding:10px 12px;gap:6px;height:100%;display:grid;grid-template-rows:32px minmax(0,1fr)}
 #app.handheld #share-modal .share-head h2{font-size:18px;margin:0}
 #app.handheld #share-modal .share-head button{width:32px;height:32px}
 #app.handheld #share-modal .share-body{display:grid;grid-template-columns:minmax(0,1fr) minmax(260px,42%);gap:14px;overflow:hidden;min-height:0}
 #app.handheld #share-modal .share-visual{display:grid;grid-template-rows:minmax(0,1fr) 36px;min-height:0;gap:6px}
 #app.handheld #share-modal .share-preview{height:auto;min-height:0;padding:0}
 #app.handheld #share-modal .share-preview img{position:absolute;inset:6px;width:calc(100% - 12px);height:calc(100% - 12px);max-height:none;object-fit:contain}
 #app.handheld #share-modal .share-sizes{gap:6px}
 #app.handheld #share-modal .share-sizes button{min-height:0;height:36px;font-size:11px;padding:4px;gap:4px;flex-wrap:nowrap;white-space:nowrap}
 #app.handheld #share-modal .share-sizes small{font-size:10px}
 #app.handheld #share-modal .share-side{display:flex;flex-direction:column;overflow:visible;padding:0;gap:6px}
 #app.handheld #share-modal .share-summary{flex:1;min-height:0;overflow:auto;padding:0 0 4px}
 #app.handheld #share-modal .share-summary .eyebrow{font-size:10px;letter-spacing:0;line-height:1.3}
 #app.handheld #share-modal #share-outcome{display:block}
 #app.handheld #share-modal .share-summary h3{font-size:17px;line-height:1.3;margin:4px 0;display:inline-block;max-width:100%}
 #app.handheld #share-modal .share-summary p{font-size:12px;display:inline;margin-left:8px}
 #app.handheld #share-modal .share-details{grid-template-columns:1fr 1fr;margin:5px 0 0;gap:8px}
 #app.handheld #share-modal .share-details dt{font-size:11px;margin-bottom:2px}
 #app.handheld #share-modal .share-details dd{font-size:18px}
 #app.handheld #share-modal .share-actions{flex:none;display:grid;grid-template-columns:1fr 1fr;gap:6px;margin:0}
 #app.handheld #share-modal .share-actions>*{grid-column:auto;min-height:36px;font-size:12px;padding:6px}
 #app.handheld #share-modal .share-hint{font-size:10px;line-height:1.4;margin:0;flex:none}
 #app.handheld #share-status{font-size:11px;line-height:1.3}
}
@media (any-pointer:coarse){
 #app.handheld #pheromone-button{touch-action:none}
 #app.handheld #pheromone-button kbd{display:none}
 #app.handheld #pheromone-button #pheromone-state{display:block;font-size:10px;line-height:1.2}
 #app.handheld .ability.cooldown{border-color:#91a76d;color:#b4c3a6}
}
@media (orientation:landscape) and (max-width:760px) and (max-height:600px){
 #app.handheld #result-screen .result-personal .result-stats{grid-template-columns:1fr 1.5fr .7fr .7fr;gap:4px;padding:6px 0}
 #app.handheld #result-screen .result-personal .result-stats strong,#app.handheld #result-screen .result-personal .result-stats>div:first-child strong{font-size:16px;margin:2px 0}
}

