/* Landscape mobile HUD: short-edge rail, long-edge commands, independent map. */
.mobile-edition{--mobile-edge:max(7px,env(safe-area-inset-left));--mobile-right:max(7px,env(safe-area-inset-right));--dock-height:144px;--dock-bottom:max(6px,env(safe-area-inset-bottom));--rail-width:154px;--hud-top:82px;--map-size:96px;touch-action:manipulation}
.mobile-edition #main-menu-screen{padding:12px max(20px,env(safe-area-inset-right)) 18px max(20px,env(safe-area-inset-left))}
.mobile-edition .menu-shell{min-height:0;max-width:860px}
.mobile-edition .menu-heading{margin:0 auto 10px}
.mobile-edition .menu-heading h1{font-size:28px;margin:5px 0}
.mobile-edition .menu-heading .crest,.mobile-edition .menu-heading p{display:none}
.mobile-edition #main-mode-menu{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:12px auto}
.mobile-edition #main-mode-menu button{min-height:58px;padding:9px;gap:3px}
.mobile-edition #main-mode-menu b{font-size:22px}
.mobile-edition #main-mode-menu span{font-size:12px}
.mobile-edition #main-mode-menu #choose-ffa,.mobile-edition #main-mode-menu #choose-friends{grid-column:auto}
.mobile-edition .healthy-play{font-size:11px;line-height:1.8;margin:14px auto 0;text-align:center}
.mobile-edition .healthy-play span{display:block}
.mobile-edition .menu-footer{font-size:12px;line-height:1.8;padding:12px 0 4px}
.mobile-edition #menu-navigation{gap:8px;margin-top:12px}
.mobile-edition #menu-navigation button{min-height:40px!important;font-size:14px!important}
.mobile-edition #setup-heading{font-size:18px;margin:0 0 10px}
.mobile-edition .civ-card{min-height:104px;padding:8px}
.mobile-edition .civ-card i{font-size:26px;margin-bottom:3px}
.mobile-edition .civ-card b{font-size:15px}
.mobile-edition .topbar{position:fixed;box-sizing:border-box;left:var(--mobile-edge);right:var(--mobile-right);top:max(4px,env(safe-area-inset-top));height:44px;min-height:44px;padding:4px 8px;display:flex;flex-wrap:nowrap;align-items:center;justify-content:space-between;gap:8px;background:#11261bf5;border:1px solid #66775d;border-radius:7px}
.mobile-edition .topbar .brand{display:none}
.mobile-edition .topbar .resources{display:flex;flex:1;position:static;transform:none;justify-content:space-evenly;gap:8px;min-width:0;margin:0}
.mobile-edition .topbar .resources>div{display:flex;align-items:center;gap:4px;min-width:0;padding:0;background:transparent;border:0}
.mobile-edition .topbar .resources .res{display:inline-flex!important;align-items:center;justify-content:center;flex:none;width:22px;height:26px;font-size:22px;line-height:1}
.mobile-edition .topbar .resources small{display:none}
.mobile-edition .topbar .resources strong{font-size:14px;line-height:1.2;white-space:nowrap}
.mobile-edition .topbar .time-tools{display:flex;gap:5px;position:static;flex:none;align-items:center}
.mobile-edition .topbar .clock{display:none}
.mobile-edition .topbar .time-tools button{display:block;box-sizing:border-box;width:36px;min-width:36px;height:34px;min-height:34px;margin:0;padding:3px;font-size:17px}
.mobile-edition #left-rail{left:var(--mobile-edge);top:var(--hud-top);bottom:calc(var(--dock-height) + var(--dock-bottom) + 12px);width:var(--rail-width)!important;min-width:0;height:auto!important;padding-bottom:0;gap:4px}
.mobile-edition #rail-content{padding:3px;gap:4px;overscroll-behavior:contain}
.mobile-edition #rail-resize{display:none}
.mobile-edition #left-rail .mission,.mobile-edition #left-rail .royal-hud{padding:7px;font-size:11px}
.mobile-edition #left-rail .mission h1{font-size:13px;margin:2px 0}
.mobile-edition #left-rail .mission p,.mobile-edition #left-rail .factions,.mobile-edition #left-rail .kingdom-list{font-size:10px;margin:3px 0;line-height:1.4}
.mobile-edition #left-rail .worker-shortcuts{grid-template-columns:1fr}
.mobile-edition #left-rail .worker-shortcuts button{min-height:32px;padding:4px;font-size:11px}
.mobile-edition #left-rail #royal-focus b{font-size:11px}
.mobile-edition #left-rail .royal-quick{display:flex;flex-direction:column}
.mobile-edition .side-toggle{left:var(--mobile-edge);top:52px;min-height:26px;height:26px;padding:3px 10px;font-size:11px}
.mobile-edition #command-panel{position:fixed;box-sizing:border-box;left:var(--mobile-edge);right:calc(var(--mobile-right) + var(--map-size) + 7px);bottom:var(--dock-bottom);height:var(--dock-height);max-height:none;display:grid;grid-template-columns:90px minmax(0,1fr);grid-template-rows:minmax(0,1fr);gap:5px;overflow:visible}
.mobile-edition #command-panel section{padding:5px!important;min-width:0}
.mobile-edition #command-panel .selection-panel{grid-column:1;grid-row:1;display:flex;flex-direction:column}
.mobile-edition #command-panel .selection-panel .panel-caption{display:none}
.mobile-edition #command-panel .selection-body{display:flex;flex-direction:column;align-items:stretch;gap:3px;height:auto;overflow-y:auto}
.mobile-edition #command-panel #portrait{width:30px;height:30px;min-height:30px;font-size:24px}
.mobile-edition #command-panel #selection-name{font-size:11px;margin:0 0 2px}
.mobile-edition #command-panel #selection-detail,.mobile-edition #command-panel #selection-status{font-size:10px;line-height:1.3}
.mobile-edition #command-panel #selected-units{max-height:22px;margin-top:2px}
.mobile-edition #command-panel .actions-panel{grid-column:2;grid-row:1;display:flex;flex-direction:column;min-height:0}
.mobile-edition #command-panel .actions-panel .panel-caption{display:flex;flex:none;min-height:20px;height:20px;gap:4px;margin:0 0 3px;font-size:11px}
.mobile-edition #command-panel #actions{display:grid;min-height:0;flex:1;grid-template-columns:repeat(var(--action-cols,9),minmax(76px,1fr));grid-template-rows:repeat(var(--action-rows,2),minmax(43px,1fr));grid-auto-flow:row;gap:3px;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;touch-action:pan-x;overscroll-behavior:contain}
.mobile-edition #command-panel #actions .action{display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:0;min-height:43px;height:auto;padding:2px!important;gap:1px}
.mobile-edition #command-panel #actions .action-icon{font-size:16px;line-height:17px}
.mobile-edition #command-panel #actions .action-name{font-size:11px;line-height:13px}
.mobile-edition #command-panel #actions[data-layout=worker] .action-icon{font-size:11px;line-height:14px;white-space:normal}
.mobile-edition #command-panel #actions small,.mobile-edition #command-panel #actions[data-layout=worker] small,.mobile-edition #command-panel #actions[data-layout=king] small{display:block!important;font-size:10px;line-height:12px;white-space:nowrap;color:#e4c992}
.mobile-edition #command-panel #queue{flex:none;height:17px;min-height:17px;padding-top:1px;margin:1px 0 0;font-size:10px}
.mobile-edition #command-panel #fortification-tools button,.mobile-edition #command-panel #building-facing{min-height:20px;padding:2px 4px;font-size:10px}
.mobile-edition #command-panel #mode-label{display:none}
.mobile-edition #game>.minimap-panel{position:fixed;box-sizing:border-box;z-index:23;right:var(--mobile-right);bottom:var(--dock-bottom);width:var(--map-size);height:var(--map-size);margin:0;padding:4px;border:1px solid #8a8e67;border-radius:6px;background:#11241bf5}
.mobile-edition #game>.minimap-panel .panel-caption{display:none}
.mobile-edition #game>.minimap-panel #minimap{display:block;width:100%;height:100%;object-fit:contain;touch-action:none}
.mobile-edition .dock-toggle{right:var(--mobile-right);bottom:calc(var(--map-size) + var(--dock-bottom) + 7px);height:28px;min-height:28px;padding:3px 6px;font-size:11px}
.mobile-edition .camera-tools{right:var(--mobile-right);top:86px;bottom:auto;display:flex;gap:4px;flex-direction:column}
.mobile-edition .camera-tools button{width:28px;height:27px;min-height:27px;font-size:17px;padding:2px}
.mobile-edition #touch-toolbar{position:fixed;top:52px;bottom:auto;left:auto;right:var(--mobile-right);width:auto;transform:none;gap:4px;display:flex}
.mobile-edition #touch-toolbar button{flex:none;min-width:48px;min-height:28px;height:28px;padding:3px 6px;font-size:11px}
.mobile-edition #touch-stick{left:calc(var(--mobile-edge) + var(--rail-width) + 10px);right:auto;bottom:calc(var(--dock-height) + var(--dock-bottom) + 12px);width:54px;height:54px}
.mobile-edition #touch-confirm{left:50%;right:auto;bottom:calc(var(--dock-height) + var(--dock-bottom) + 12px);transform:translateX(-50%);min-height:34px;padding:7px 12px;font-size:13px;z-index:27}
.mobile-edition #command-hint{display:none}
.mobile-edition #notification{top:86px;max-width:calc(100vw - 250px);font-size:12px}
.mobile-edition #pvp-live{top:52px;bottom:auto;left:calc(var(--mobile-edge) + 80px);font-size:10px}
.mobile-edition.dock-collapsed #command-panel{display:none}
.mobile-edition.dock-collapsed #left-rail{bottom:var(--dock-bottom)}
.mobile-edition.dock-collapsed .dock-toggle{bottom:calc(var(--map-size) + var(--dock-bottom) + 7px)}
.mobile-edition.dock-collapsed #touch-stick,.mobile-edition.dock-collapsed #touch-confirm{bottom:calc(var(--dock-bottom) + 12px)}
.mobile-edition.sidebar-collapsed #left-rail{display:none}
.mobile-edition.sidebar-collapsed #touch-stick{left:var(--mobile-edge)}
@media(max-height:350px) and (orientation:landscape){.mobile-edition{--dock-height:132px;--rail-width:136px;--map-size:80px}.mobile-edition #command-panel{grid-template-columns:70px minmax(0,1fr)}.mobile-edition #command-panel #queue{height:12px;min-height:12px}.mobile-edition #command-panel .actions-panel .panel-caption{height:18px;min-height:18px}}
@media(orientation:portrait){
 html.mobile-layout #landscape-gate{display:flex;position:fixed;inset:0;z-index:2147483646;box-sizing:border-box;background:#0d1e17;color:#efdeb8;align-items:center;justify-content:center;flex-direction:column;text-align:center;padding:28px;gap:14px;font:16px/1.7 system-ui,sans-serif}
 html.mobile-layout #landscape-gate .rotate-device{font-size:64px;color:#d5b670}
 html.mobile-layout #landscape-gate h2{font-size:24px;margin:0}
 html.mobile-layout #landscape-gate p{max-width:320px;margin:0}
 html.mobile-layout #landscape-gate button{font:inherit;min-height:48px;padding:10px 24px;border:1px solid #b39b65;border-radius:8px;background:#294234;color:#f6dfad}
 html.mobile-layout #main-menu-screen,html.mobile-layout #game-screen,html.mobile-layout #intro-screen,html.mobile-layout #battle-loading-screen{visibility:hidden!important;pointer-events:none!important}
}
