/* Phone HUD uses CSS pixels and keeps the simulation and desktop layout shared. */
#mobileBar,#mobileHint,#mobileBuild,#mobileSelection{display:none}
.mobile-mode #game{height:100dvh;min-height:0;width:100%;overflow:hidden}
.mobile-mode .ui-layer{--mobile-bottom:calc(102px + env(safe-area-inset-bottom,0px))}
.mobile-mode button,.mobile-mode select,.mobile-mode input{touch-action:manipulation}
.mobile-mode .ui-layer .topbar{height:104px;padding:4px max(8px,env(safe-area-inset-right)) 4px max(8px,env(safe-area-inset-left));gap:3px;flex-wrap:wrap;align-content:center}
.mobile-mode .wordmark{display:none}
.mobile-mode .ui-layer .resources{order:0;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));height:46px;width:100%;flex:0 0 100%;gap:3px}
.mobile-mode .ui-layer .resource{min-width:0;padding:2px 0;gap:3px;border:0}
.mobile-mode .resource>span:first-child{display:none}
.mobile-mode .ui-layer .resource b{font-size:15px;line-height:18px;font-weight:600;white-space:nowrap}
.mobile-mode .ui-layer .resource small{font-size:8px;letter-spacing:0;line-height:12px;margin:0}
.mobile-mode .ui-layer .idle-workers{min-width:0;min-height:44px;justify-content:center;padding:2px;border:1px solid #bba96c55}
.mobile-mode kbd{display:none!important}
.mobile-mode .top-actions{width:100%;justify-content:space-between;gap:4px;height:44px}
.mobile-mode .ui-layer .queue-shortcuts{display:flex;gap:4px;flex:1;min-width:0}
.mobile-mode .ui-layer .queue-shortcut{min-height:44px;padding:6px;font-size:11px;line-height:16px}
.mobile-mode .ui-layer .icon-btn{width:44px;min-width:44px;height:44px}
.mobile-mode .ui-layer .objectives-toggle{top:110px;left:8px;min-height:44px;max-width:44%;font-size:11px;padding:6px 8px}
.mobile-mode .ui-layer .time-panel{top:110px;right:8px;width:51%;max-width:210px;padding:4px 7px;gap:3px;min-height:44px}
.mobile-mode .time-panel #stage,.mobile-mode .time-panel #dayPhase,.mobile-mode .time-panel #waveScope{display:none}
.mobile-mode .time-panel b,.mobile-mode .time-panel #waveTime{font-size:10px;letter-spacing:0;line-height:14px;margin:0}
.mobile-mode .time-panel #weatherPhase{font-size:10px;letter-spacing:0}
.mobile-mode .ui-layer .operations.expanded{top:160px;left:8px;max-height:calc(100dvh - 280px);overflow:auto;width:min(320px,calc(100vw - 16px))}
.mobile-mode .ui-layer .sector-label,.mobile-mode .controls,.mobile-mode #idleDock{display:none!important}
.mobile-mode .ui-layer .bottom-hud{left:8px;right:8px;bottom:calc(var(--mobile-bottom) + 57px);height:auto;display:block}
.mobile-mode .ui-layer .command-panel{width:100%;max-width:100%;max-height:43dvh;overflow:auto;padding:9px 10px;overscroll-behavior:contain}
.mobile-mode .ui-layer .command-header{display:grid;grid-template-columns:minmax(0,1fr) 44px;min-height:44px;gap:5px;margin-bottom:4px}
.mobile-mode .ui-layer #selectionName{font-size:19px;overflow-wrap:anywhere;margin-top:3px}
.mobile-mode .selection-title .eyebrow{font-size:9px}
.mobile-mode .selection-shortcuts button{display:none}
.mobile-mode .selection-shortcuts #hudToggle{display:block;width:44px;height:44px;font-size:24px}
.mobile-mode .ui-layer .build-tabs{display:flex;flex-wrap:nowrap;overflow-x:auto;gap:4px;padding-bottom:5px}
.mobile-mode .build-tabs button{min-height:44px;min-width:max-content;padding:6px 9px;font-size:12px}
.mobile-mode .ui-layer .actions{grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:minmax(88px,auto);gap:5px}
.mobile-mode .ui-layer .action{min-height:88px;padding:7px;grid-template-rows:18px minmax(26px,auto) 16px;gap:3px}
.mobile-mode .ui-layer .action .name{font-size:13px;line-height:16px}.mobile-mode .ui-layer .action .cost{font-size:11px;gap:5px}
.mobile-mode .ui-layer .selection-vitals{font-size:12px;line-height:17px;overflow-wrap:anywhere}
.mobile-mode .ui-layer .selection-description{white-space:normal;font-size:12px;line-height:17px;height:auto;min-height:34px;max-height:none;overflow:visible}
.mobile-mode .ui-layer .minimap-panel{display:none;position:absolute;right:0;bottom:0;width:165px;height:160px;z-index:4}
.mobile-mode.mobile-map-open .ui-layer .minimap-panel{display:flex;flex-direction:column}
.mobile-mode.mobile-map-open #minimap{display:block!important;min-height:100px;touch-action:none}
.mobile-mode .minimap-header{height:36px;flex-shrink:0;letter-spacing:0;font-size:10px}
.mobile-mode .minimap-buttons button{min-width:36px;min-height:36px}.mobile-mode .map-legend{display:none}
.mobile-mode .mobile-playing #mobileBar{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:3px;position:absolute;bottom:0;left:0;right:0;padding:5px max(5px,env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom,0px)) max(5px,env(safe-area-inset-left));background:#142b25f5;border-top:1px solid #879b6b77;pointer-events:auto;z-index:6}
.mobile-mode #mobileBar button{min-width:0;min-height:44px;font:12px/15px 'Segoe UI',sans-serif;padding:4px 2px;border:1px solid #788a6b55;border-radius:4px;color:#e0dfc8}
.mobile-mode #mobileBar button[aria-pressed=true]{background:#c9ba7940;border-color:#ddc58b;color:#fff0c1}
.mobile-mode .mobile-playing #mobileHint{display:block;position:absolute;left:8px;right:8px;bottom:calc(var(--mobile-bottom) + 61px);padding:5px 7px;max-width:100%;font-size:11px;line-height:15px;background:#172e27e8;color:#dbdfc9;pointer-events:none}
.mobile-mode .has-selection #mobileHint,.mobile-mode [data-mobile-panel="actions"] #mobileHint{display:none}
.mobile-mode .mobile-playing #mobileBuild:not([hidden]){display:flex;position:absolute;top:165px;left:8px;right:8px;gap:6px;pointer-events:auto;z-index:7;background:#152c25ee;padding:6px;border:1px solid #9caf7d}
.mobile-mode #mobileBuild button{min-height:44px;flex:1;font-size:13px;border:1px solid #9caf7d;padding:6px;color:#eedca6}
.mobile-mode #mobileConfirm{background:#d5bc80;color:#172b24;font-weight:600}
.mobile-mode .ui-layer .placement-hint{top:225px;left:8px;right:8px;transform:none;max-width:none;font-size:12px;padding:7px;pointer-events:none}
.mobile-mode .placing-mobile .command-panel{display:none!important}
.mobile-mode .ui-layer .toast{top:165px;bottom:auto!important;left:8px;right:8px;transform:none;max-width:none;padding:10px 12px;font-size:13px;z-index:8}
.mobile-mode .ui-layer .paused{top:160px;left:8px;transform:none;max-width:calc(100% - 16px);z-index:9}.mobile-mode .paused button{min-height:44px}
.mobile-mode .ui-layer dialog,.mobile-mode .ui-layer #options{width:calc(100% - 16px);max-width:calc(100% - 16px);max-height:calc(100dvh - 24px);padding:16px;margin:auto;font-size:14px;overscroll-behavior:contain}
.mobile-mode dialog button,.mobile-mode dialog .file-label{min-height:44px}.mobile-mode dialog h2{font-size:24px}.mobile-mode dialog p{font-size:13px}
.mobile-mode .guide-tabs{flex-wrap:nowrap;overflow-x:auto;white-space:nowrap}.mobile-mode .guide-tabs button{flex-shrink:0;padding:8px}
.mobile-mode .guide-grid,.mobile-mode .building-grid,.mobile-mode .research-grid,.mobile-mode .diplomacy-grid{grid-template-columns:1fr}
.mobile-mode .ui-layer #startScreen{display:block;overflow:auto;overscroll-behavior:contain;padding:env(safe-area-inset-top,0px) max(0px,env(safe-area-inset-right)) env(safe-area-inset-bottom,0px) max(0px,env(safe-area-inset-left));background:#0e251fe8}
.mobile-mode .ui-layer #startScreen.hidden{display:none}
.mobile-mode .ui-layer .screen-overlay .start-copy{margin:0;padding:28px 20px 15px;width:100%;max-width:100%;max-height:none;overflow:visible}
.mobile-mode .start-copy>h2{font-size:62px;line-height:.98;margin:18px 0}.mobile-mode .start-copy>.eyebrow{font-size:9px;line-height:15px;letter-spacing:1px}
.mobile-mode .start-copy>p{font-size:14px;line-height:1.6}.mobile-mode .start-facts,.mobile-mode .start-rule{display:none}
.mobile-mode .expedition-setup{display:grid;grid-template-columns:1fr;gap:12px;width:100%;max-width:none;margin:16px 0}
.mobile-mode .expedition-setup label,.mobile-mode .expedition-setup .biome-choices,.mobile-mode .expedition-setup p{grid-column:1/-1;min-width:0;max-width:100%}
.mobile-mode .expedition-setup select,.mobile-mode .expedition-setup input{font-size:16px;min-height:46px;width:100%;max-width:100%}
.mobile-mode .expedition-setup .biome-choices{grid-template-columns:1fr 1fr}.mobile-mode .expedition-setup .biome-choices label{grid-column:auto;min-height:56px}
.mobile-mode .expedition-setup .biome-choices input{width:18px;min-height:18px}
.mobile-mode .start-buttons{display:grid;grid-template-columns:1fr;gap:10px}.mobile-mode .start-buttons button{width:100%;min-height:48px;padding:12px;font-size:14px}
.mobile-mode #startGuide{min-height:44px;font-size:14px}.mobile-mode .start-copy .version{font-size:10px;white-space:normal;line-height:16px;margin-top:10px}
.mobile-mode .start-right-column{position:static;margin:10px 20px 28px;max-width:calc(100% - 40px)}.mobile-mode .start-support{width:100%;max-width:360px}.mobile-mode .start-right-column .start-caption{display:none}
@media(orientation:landscape){
 .mobile-mode .ui-layer{--mobile-bottom:calc(54px + env(safe-area-inset-bottom,0px))}
 .mobile-mode .ui-layer .topbar{height:58px;flex-wrap:nowrap;gap:12px}.mobile-mode .ui-layer .resources{width:auto;flex:1 1 55%;height:46px}.mobile-mode .top-actions{width:auto;flex:0 1 44%;gap:2px}.mobile-mode .ui-layer .queue-shortcut{font-size:10px;padding:3px}
 .mobile-mode .ui-layer .objectives-toggle,.mobile-mode .ui-layer .time-panel{top:64px}.mobile-mode .ui-layer .time-panel{width:200px}.mobile-mode .time-panel #weatherPhase{display:none}
 .mobile-mode .mobile-playing #mobileBar{display:flex;overflow-x:auto;gap:4px}.mobile-mode #mobileBar button{flex:1 0 58px;font-size:11px}
 .mobile-mode .ui-layer .command-panel{width:min(470px,58vw);max-height:calc(100dvh - 229px)}
 .mobile-mode .ui-layer #selectionName{font-size:17px}.mobile-mode .ui-layer .actions{grid-auto-rows:minmax(76px,auto)}.mobile-mode .ui-layer .action{min-height:76px}
 .mobile-mode .ui-layer .toast{top:113px;left:auto;right:8px;max-width:44vw}.mobile-mode .ui-layer .operations.expanded{top:112px;max-height:calc(100dvh - 175px)}
 .mobile-mode .mobile-playing #mobileBuild:not([hidden]){top:113px;left:auto;max-width:420px}.mobile-mode .ui-layer .placement-hint{top:170px;left:auto;max-width:420px}
 .mobile-mode .ui-layer .paused{top:113px;left:auto;right:8px}
 .mobile-mode .expedition-setup{grid-template-columns:1fr 1fr}.mobile-mode .expedition-setup label{grid-column:auto}.mobile-mode .expedition-setup .seed-label{grid-column:1/-1}
}
@media(prefers-reduced-motion:reduce){.mobile-mode *{scroll-behavior:auto!important;transition:none!important}}

.mobile-menu-tip{display:none}.mobile-mode .mobile-menu-tip{display:block;padding:10px 12px;background:#b5c68f16;border-left:2px solid #d0bb7f;color:#d9dfc9;font-size:13px;line-height:1.5}
.mobile-mode .ui-layer .topbar{padding-top:calc(4px + env(safe-area-inset-top,0px));height:calc(104px + env(safe-area-inset-top,0px))}
.mobile-mode .ui-layer .objectives-toggle,.mobile-mode .ui-layer .time-panel{top:calc(110px + env(safe-area-inset-top,0px))}
@media(orientation:landscape){.mobile-mode .ui-layer .topbar{height:calc(58px + env(safe-area-inset-top,0px))}.mobile-mode .ui-layer .objectives-toggle,.mobile-mode .ui-layer .time-panel{top:calc(64px + env(safe-area-inset-top,0px))}}

.mobile-guide-tip{display:none}.mobile-mode .mobile-guide-tip{display:block;padding:12px;background:#b5c68f16;border:1px solid #90a17555;margin-bottom:16px}.mobile-mode .mobile-guide-tip p{font-size:14px;line-height:1.6}.mobile-mode .mobile-guide-tip h3{font-size:20px;margin:0 0 10px}
.mobile-mode .time-panel #dayPhase{display:block;font-size:9px;line-height:12px;letter-spacing:0;margin:0}
@media(orientation:landscape){.mobile-mode .time-panel #dayPhase{display:none}}
.mobile-mode .top-actions #help{display:none}

/* Closed sheets have no layout, focus or hit targets; no invisible drawers. */
.mobile-mode #commandPanel[data-mobile-hidden="true"]:not(.panel-closing),.mobile-mode #commandPanel[hidden]{display:none!important;visibility:hidden!important;pointer-events:none!important}
.mobile-mode #commandPanel[data-mobile-hidden="true"] *{pointer-events:none!important}
.mobile-mode #commandPanel[data-mobile-hidden="false"]{visibility:visible;pointer-events:auto}
.mobile-mode .mobile-playing #mobileSelection{display:flex;position:absolute;left:5px;right:5px;bottom:var(--mobile-bottom);height:53px;gap:8px;padding:4px 7px;background:#172e27fa;border:1px solid #7b916a;pointer-events:auto;z-index:6}
.mobile-mode #mobileSelection>div{flex:1;min-width:0;display:flex;flex-direction:column;justify-content:center;gap:2px}
.mobile-mode #mobileSelection strong{font:600 13px/17px "Segoe UI",sans-serif;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#ece3c0}
.mobile-mode #mobileSelection small{font:10px/14px "Segoe UI",sans-serif;color:#b9cbaa}
.mobile-mode #mobileOpenActions{min-width:88px;min-height:44px;padding:5px 7px;border:1px solid #c8b777;background:#b7a66422;color:#f2dda7;font:13px "Segoe UI",sans-serif}
.mobile-mode #mobileOpenActions[aria-expanded=true]{background:#c7b67a3d}
.mobile-mode #game[data-mobile-gesture="ready"] #mobileSelection,.mobile-mode #game[data-mobile-gesture="selecting"] #mobileSelection{border-color:#eed18b;background:#32412b}
.mobile-mode #world{-webkit-touch-callout:none;user-select:none;-webkit-user-select:none}

.mobile-mode .ui-layer .build-tabs{overflow-y:hidden;scrollbar-width:thin}

.mobile-mode .ui-layer #startScreen .start-copy{width:100%;max-width:100%;padding:32px 20px 18px;margin:0;max-height:none;overflow:visible}
.mobile-mode .ui-layer #startScreen h2{font-size:62px;margin-bottom:28px}
.mobile-mode .home-menu{width:100%;max-width:360px;gap:10px}
.mobile-mode .ui-layer #startScreen .expedition-setup{grid-template-columns:1fr;gap:12px}
.mobile-mode .ui-layer #startScreen .expedition-setup select,.mobile-mode .ui-layer #startScreen .expedition-setup input{font-size:16px}
.mobile-mode .ui-layer #startScreen .start-right-column{position:static;margin:20px 20px 26px;max-width:240px}
.mobile-mode .ui-layer #startScreen .start-support{width:240px}
.mobile-mode .ui-layer #startScreen .setup-play{width:100%;min-height:48px}
.mobile-mode .ui-layer #startScreen .version{margin-top:22px}
@media(orientation:landscape){.mobile-mode .ui-layer #startScreen .start-copy{max-width:620px}.mobile-mode .ui-layer #startScreen h2{font-size:54px}.mobile-mode .ui-layer #startScreen .expedition-setup{grid-template-columns:1fr 1fr}}

.mobile-mode .ui-layer .command-panel{height:auto;max-height:43dvh;display:block;overflow:auto}
.mobile-mode .ui-layer .actions{flex:none;max-height:none;overflow:visible;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:88px}
.mobile-mode .ui-layer .action{height:88px;min-height:88px}
.mobile-mode .recruitment-selected{height:120px;min-height:120px}
.mobile-mode .recruitment-header{height:44px}
.mobile-mode .recruitment-cancel{height:44px;min-height:44px;font-size:11px}
.mobile-mode #foodConsumption{font-size:8px!important;line-height:10px!important}
@media(orientation:landscape){.mobile-mode .ui-layer .command-panel{height:auto;max-height:calc(100dvh - 229px)}}

.mobile-mode .ui-layer .build-tabs:empty{display:none}

.mobile-mode #placementTools{display:none!important}.mobile-mode .ui-layer .placement-hint{pointer-events:none;width:auto}

.mobile-mode .tactics-bar button,.mobile-mode .tactics-bar select{min-height:44px}.mobile-mode .tactics-bar{display:grid;grid-template-columns:1fr 1fr}.mobile-mode .tactics-bar[hidden]{display:none}.mobile-mode .tactical-hint{top:calc(var(--mobile-top,62px) + 8px);width:calc(100% - 28px);box-sizing:border-box}.mobile-mode .tactical-hint button{min-height:44px}.mobile-mode .tactics-bar select{max-width:none}

.mobile-mode .ui-layer .resources{grid-template-columns:repeat(7,minmax(0,1fr))}.mobile-mode .topbar .noise-info{min-width:0;min-height:44px}.mobile-mode .noise-data{min-width:0;width:100%}.mobile-mode .noise-track{width:90%;height:4px;margin:1px auto 0}.mobile-mode #noiseDialog{width:calc(100% - 26px)}

/* Touch placement forms one compact dock above the bottom toolbar. */
.mobile-mode .placing-mobile #mobileSelection{display:none!important}
.mobile-mode .mobile-playing #mobileBuild:not([hidden]){top:auto;bottom:calc(var(--mobile-bottom) + 4px);left:8px;right:8px;max-width:none}
.mobile-mode .ui-layer .placement-hint{top:auto;bottom:calc(var(--mobile-bottom) + 62px);left:8px;right:8px;width:auto;max-width:none;max-height:64px;overflow:auto;transform:none;padding:6px 8px;line-height:16px;pointer-events:none}
