/* Load after all existing styles. Rules are gated by mount()'s body class. */
@media(max-width:1100px),(pointer:coarse){body.command-deck .cd-expansion .expansion button{min-height:44px}}
body.command-deck{--cd-header:64px;--cd-nav:58px;--cd-footer:264px;overflow:hidden}
body.command-deck #app{min-width:0;min-height:0;height:100dvh;grid-template-rows:var(--cd-header) var(--cd-nav) minmax(120px,1fr) var(--cd-footer)}
body.command-deck #app>header{grid-row:1;gap:18px;padding:0 16px;min-width:0;position:relative;z-index:31}
body.command-deck #app>main,body.command-deck #app>main.sidebar-closed{grid-row:3;display:block;min-width:0;min-height:0;position:relative}
body.command-deck .battlefield{width:100%;height:100%;min-height:0}
body.command-deck #app>footer{grid-row:4;display:grid;grid-template-columns:200px 245px minmax(0,1fr);height:auto;min-height:0;min-width:0;max-height:none;aspect-ratio:auto;overflow:hidden}
body.command-deck .brand{font-size:23px;gap:7px}body.command-deck .brand small{display:none}
body.command-deck .resources{gap:18px;margin-left:auto;flex:none}body.command-deck .resources b{font-size:17px}
body.command-deck .top-controls{gap:5px;margin-left:auto;min-width:0;flex:none}
body.command-deck .top-controls button{height:36px;min-width:36px;width:auto;padding:5px 9px;font-size:12px}
body.command-deck .top-controls #city-drawer-toggle{display:none!important}
body.command-deck .cd-navigation{grid-row:2;display:flex;gap:10px;align-items:center;min-width:0;padding:6px 16px;background:var(--panel);border-bottom:1px solid var(--edge);z-index:20}
body.command-deck .cd-nav-label{font-size:11px;text-transform:uppercase;letter-spacing:1px;flex:none}
body.command-deck #cities{display:flex;flex:1;align-items:center;gap:5px;max-height:none;min-width:0;padding:0;margin:0;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;overscroll-behavior-x:contain}
body.command-deck #cities .city-card{flex:0 0 65px;min-width:65px;max-width:none;min-height:42px;padding:3px 5px;display:flex;align-items:center;justify-content:center;gap:5px;border-radius:5px}
body.command-deck #cities .city-card strong{font-size:18px}body.command-deck #cities .city-card small{font-size:10px;margin:0}body.command-deck #cities .city-card sup{font-size:12px}
body.command-deck #cd-context{flex:none;font-size:12px;min-height:42px;padding:6px 11px;max-width:180px;white-space:normal}
body.command-deck #cd-research{min-width:180px;max-width:240px;flex:none;text-align:left;padding:6px 12px;min-height:44px;border-radius:5px}
body.command-deck #cd-research strong{display:block;font-size:13px;line-height:1.3}body.command-deck #cd-research small{display:block;font-size:10px;line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.command-deck #app>main>aside{position:fixed;z-index:30;top:calc(var(--cd-header) + var(--cd-nav));right:0;bottom:0;left:auto;width:350px;max-width:100vw;display:flex;flex-direction:column;height:auto;max-height:none;transform:none;visibility:visible;overflow:auto;border-left:1px solid var(--edge);box-shadow:-12px 0 35px #0005}
body.command-deck #app>main>aside.panel-hidden{display:none!important;visibility:hidden;pointer-events:none}
body.command-deck aside>.panel-heading{display:flex;align-items:center;position:sticky;top:0;z-index:2;min-height:50px;flex-shrink:0;background:var(--panel);padding:8px 13px}
body.command-deck #close-sidebar{min-height:36px;min-width:70px;font-size:12px}
body.command-deck aside .sidebar-tabs{flex-shrink:0}body.command-deck aside .sidebar-tabs button{min-height:44px}
body.command-deck aside :is(#quick-stabilize,#quick-conscript,#quick-govern,#quick-civil,#strategic-research,#strategic-prepare,#strategic-launch,#declare-war,#attack-city,#open-log){min-height:44px;font-size:12px}
body.command-deck #strategic-panel{margin:8px 12px;padding:10px;border:1px solid var(--edge)}
body.command-deck #strategic-panel p{font-size:12px;line-height:1.5}
body.command-deck .cd-strategic{flex-shrink:0;margin:8px 12px;border:1px solid var(--edge);border-radius:4px}
body.command-deck .cd-strategic>summary{cursor:pointer;min-height:44px;padding:12px;font-size:12px}
body.command-deck .cd-strategic #strategic-panel{margin:0;border:0;padding:10px}
body.command-deck :is(.minimap-panel,.selection-panel,.command-panel){min-height:0;min-width:0;height:auto}
body.command-deck .minimap-panel{padding:14px 12px}body.command-deck #minimap{width:100%;height:148px;margin:0;display:block}
body.command-deck .minimap-panel>div{font-size:9px;display:flex;flex-wrap:wrap;gap:5px}
body.command-deck #minimap-overview{font-size:10px;min-height:30px}
body.command-deck .selection-panel{display:block;padding:12px;overflow-y:auto}
body.command-deck .selection-content{display:flex;align-items:center;gap:8px;margin:10px 0}
body.command-deck .marine-portrait{width:56px;height:68px;flex:none}body.command-deck .marine-portrait .art-icon{width:56px;height:68px}
body.command-deck .selection-content h3{font-size:19px;line-height:1.15;margin:0 0 5px}body.command-deck .selection-content p{font-size:11px;line-height:1.4;margin:0}
body.command-deck .selection-actions{position:static;display:flex;gap:5px;flex-wrap:wrap;margin-top:8px}
body.command-deck .selection-actions button{min-height:34px;font-size:11px;padding:6px 8px}
body.command-deck .selection-panel .hint{display:none}
body.command-deck .command-panel{padding:10px 14px 8px;display:flex;flex-direction:column;gap:0;overflow:auto}
body.command-deck .command-panel>.panel-heading{display:flex;gap:8px;align-items:center;font-size:11px;letter-spacing:.3px;flex-shrink:0;min-height:32px}
body.command-deck #command-city{flex:1;min-width:0;line-height:1.4;max-height:44px;overflow:auto}
body.command-deck #queue-status{display:none}
body.command-deck #cd-open-queue{min-height:32px;flex:none;padding:4px 8px;font-size:11px;letter-spacing:0}
body.command-deck #cd-compact{display:none}
body.command-deck .command-tabs{display:flex;gap:6px;margin:5px 0 6px;flex-shrink:0}
body.command-deck .command-tabs button{flex:1;text-align:center;min-height:34px;font-size:12px;padding:5px 8px}
body.command-deck #commands,body.command-deck #commands.unit-roster{display:grid;grid-template-columns:repeat(6,minmax(112px,1fr));gap:7px;overflow-x:auto;overflow-y:hidden;padding:0 0 7px;margin:0;min-height:112px;flex:0 0 112px;scroll-snap-type:x proximity;overscroll-behavior-x:contain;scrollbar-width:thin}
body.command-deck #commands:not(.unit-roster){grid-auto-columns:minmax(130px,1fr);grid-auto-flow:column;grid-template-columns:none}
body.command-deck #commands button{position:relative;padding:5px 7px!important;min-height:96px;text-align:left;scroll-snap-align:start;border-radius:5px;overflow:auto}
body.command-deck #commands .art-icon{position:static;float:left;margin:0 6px 2px 0;width:50px;height:58px}
body.command-deck #commands strong{display:block;font-size:12px;line-height:1.3;white-space:normal;overflow-wrap:anywhere;margin-bottom:4px}
body.command-deck #commands small{display:block;font-size:10px;line-height:1.4;white-space:normal}
body.command-deck #commands .wide-info{font-size:11px;min-width:180px;line-height:1.4;padding:6px;overflow:auto}
body.command-deck .cd-expansion{margin-top:4px;flex-shrink:0}
body.command-deck .cd-expansion>summary{cursor:pointer;font-size:11px;min-height:28px;padding:5px;border-top:1px solid var(--edge)}
body.command-deck .cd-expansion .expansion{display:flex;gap:8px;flex-wrap:wrap;margin:0;padding:7px 0;align-items:center}
body.command-deck .expansion>div{flex:1;min-width:150px}body.command-deck .expansion>div span{display:block;font-size:11px;line-height:1.4}
body.command-deck .expansion button{font-size:12px;padding:7px;min-height:40px}
body.command-deck .cd-utilities{position:relative;flex:none}
body.command-deck .cd-utilities>summary{cursor:pointer;min-height:36px;min-width:52px;padding:8px;font-size:12px;border:1px solid var(--edge);border-radius:4px}
body.command-deck .cd-utility-items{position:absolute;right:0;top:100%;z-index:40;width:180px;padding:8px;background:var(--panel);border:1px solid var(--edge);box-shadow:0 10px 25px #0006;display:grid;gap:5px;max-height:65dvh;overflow:auto}
body.command-deck .cd-utility-items button{width:100%;min-height:44px;text-align:left;font-size:13px}
body.command-deck .cd-order-instruction:not([hidden]){position:absolute;top:10px;left:12px;right:12px;z-index:12;display:flex;align-items:center;justify-content:space-between;gap:12px;background:var(--panel);color:inherit;padding:8px 12px;border:1px solid var(--amber);border-radius:5px;box-shadow:0 5px 22px #0005;font-size:13px}
body.command-deck .cd-order-instruction[hidden]{display:none!important}
body.command-deck #cd-cancel-order{min-width:70px;min-height:44px;padding:8px;font-size:12px}
body.command-deck .battlefield:has(.cd-order-instruction:not([hidden])) #sector-heading{visibility:hidden}
body.command-deck .map-tools{right:12px;bottom:40px;gap:5px}
body.command-deck .map-tools button{width:34px;height:34px}
body.command-deck #cd-queue-dialog{width:620px;max-width:94vw;max-height:88dvh;padding:20px;overflow:auto;background:var(--panel);color:inherit;border:1px solid var(--edge);border-radius:10px}
body.command-deck #cd-queue-dialog::backdrop{background:#06101899}
body.command-deck #cd-close-queue{float:right;position:sticky;top:0;z-index:2;min-height:44px;padding:8px 12px;background:var(--panel)}
body.command-deck #cd-queue-title{font-size:26px;line-height:1.3;margin:5px 85px 12px 0}
body.command-deck .cd-queue-summary,body.command-deck .cd-queue-footnote{font-size:12px;line-height:1.6;clear:both}
body.command-deck .cd-queue-list{list-style:none;padding:0;margin:10px 0}
body.command-deck .cd-queue-item{display:flex;gap:13px;align-items:center;padding:12px 0;border-bottom:1px solid var(--edge)}
body.command-deck .cd-queue-art{width:62px;height:68px;flex:none;background-size:600% 600%;background-repeat:no-repeat}
body.command-deck .cd-queue-copy{flex:1;min-width:0}body.command-deck .cd-queue-copy strong{display:block;font-size:15px;margin:4px 0}
body.command-deck .cd-queue-position{display:block;font-size:10px;letter-spacing:.7px}body.command-deck .cd-queue-note{display:block;font-size:11px;line-height:1.5}
body.command-deck .cd-queue-item progress{display:block;width:100%;height:7px;margin-top:7px;accent-color:var(--teal)}
body.command-deck .cd-empty{font-size:13px;line-height:1.6}
body.command-deck :is(button,summary):focus-visible{outline:3px solid var(--teal);outline-offset:-3px}
@media(max-width:1100px){
 body.command-deck{--cd-header:58px;--cd-nav:58px;--cd-footer:340px}
 body.command-deck .brand{display:none}body.command-deck #app>header{gap:10px;padding:0 10px}
 body.command-deck .resources{margin-left:0;gap:12px}body.command-deck .top-controls #clock{font-size:11px;margin-right:3px}
 body.command-deck #app>footer{grid-template-columns:150px minmax(0,1fr);grid-template-rows:108px minmax(0,1fr)}
 body.command-deck .minimap-panel{grid-row:1;grid-column:1;padding:7px 9px;border-bottom:1px solid var(--edge)}
 body.command-deck #minimap{height:72px}body.command-deck .minimap-panel>div{margin-top:2px}body.command-deck #map-size{display:none}
 body.command-deck .selection-panel{grid-row:1;grid-column:2;padding:7px 10px;display:flex;align-items:center;gap:10px;border-bottom:1px solid var(--edge);overflow:auto}
 body.command-deck .selection-panel>.panel-heading{display:none}body.command-deck .selection-content{margin:0;flex:0 0 180px}
 body.command-deck .selection-content p{font-size:10px;max-height:42px;overflow:auto}body.command-deck .selection-content h3{font-size:17px}
 body.command-deck .marine-portrait,body.command-deck .marine-portrait .art-icon{width:44px;height:54px}
 body.command-deck .selection-actions{margin:0;gap:4px}body.command-deck .selection-actions button{min-height:44px;padding:5px 8px;font-size:11px}
 body.command-deck .command-panel{grid-row:2;grid-column:1/-1;padding:5px 10px}
 body.command-deck .command-panel>.panel-heading{min-height:44px}body.command-deck #cd-open-queue{min-height:44px;font-size:11px}
 body.command-deck .command-tabs{margin:0 0 4px}body.command-deck .command-tabs button{min-height:44px}
 body.command-deck #commands,body.command-deck #commands.unit-roster{grid-template-columns:repeat(6,minmax(125px,1fr));min-height:96px;flex-basis:96px}
 body.command-deck #commands:not(.unit-roster){grid-template-columns:none;grid-auto-columns:minmax(150px,1fr)}
 body.command-deck #commands button{min-height:80px}body.command-deck #commands .art-icon{width:48px;height:50px}
 body.command-deck :is(#cd-context,#cities .city-card,.top-controls button,.cd-utilities>summary,.map-tools button,.cd-expansion>summary,#minimap-overview){min-height:44px}
 body.command-deck .map-tools button{min-width:44px}body.command-deck #cd-research{min-width:165px}
 body.command-deck .cd-expansion>summary{padding:10px 5px}
}
@media(max-width:700px){
 body.command-deck{--cd-header:52px;--cd-nav:54px;--cd-footer:354px}
 body.command-deck #app{grid-template-rows:var(--cd-header) var(--cd-nav) minmax(100px,1fr) var(--cd-footer)}
 body.command-deck #app>header{gap:6px;padding:0 7px}body.command-deck .resources{gap:8px;flex:1;min-width:0}
 body.command-deck .resources>span{display:grid;grid-template-columns:auto;grid-template-rows:18px 11px;gap:0;flex:none}
 body.command-deck .resources>span:not(:first-child){display:grid}body.command-deck .resources>span:last-child{display:none}
 body.command-deck .resources i{display:none}body.command-deck .resources b{font-size:13px}body.command-deck .resources small{font-size:8px;letter-spacing:.1px;white-space:nowrap}body.command-deck .resources em{display:none}
 body.command-deck .top-controls{gap:3px;margin:0}body.command-deck .top-controls #clock{display:none}
 body.command-deck .top-controls button{min-width:38px;width:auto;padding:4px;font-size:12px}body.command-deck #online-indicator{max-width:50px;font-size:10px!important;overflow:hidden}
 body.command-deck .cd-utilities>summary{min-width:42px;padding:12px 5px;font-size:11px}
 body.command-deck .cd-navigation{padding:4px 7px;gap:5px}body.command-deck .cd-nav-label{display:none}
 body.command-deck #cities .city-card{min-width:48px;flex-basis:48px;gap:2px}body.command-deck #cities .city-card strong{font-size:14px}body.command-deck #cities .city-card small{font-size:8px}body.command-deck #cities .city-card sup{font-size:11px;padding-left:0}
 body.command-deck #cd-context{font-size:11px;max-width:92px;padding:5px;min-width:70px}
 body.command-deck #cd-research{min-width:96px;max-width:120px;padding:5px 7px}body.command-deck #cd-research strong{font-size:12px}body.command-deck #cd-research small{font-size:9px;max-width:100px}
 body.command-deck #app>footer{grid-template-columns:96px minmax(0,1fr);grid-template-rows:112px minmax(0,1fr)}
 body.command-deck .minimap-panel{padding:6px}body.command-deck #minimap{height:58px}body.command-deck #minimap-overview{font-size:9px;padding:2px;min-width:70px}
 body.command-deck .selection-panel{display:block;padding:5px 7px;overflow:auto}body.command-deck .selection-content{margin:0 0 4px;display:block}body.command-deck .marine-portrait{display:none}
 body.command-deck .selection-content h3{font-size:13px;margin:0;line-height:18px}body.command-deck .selection-content p{display:none}
 body.command-deck .selection-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:3px;margin:0}
 body.command-deck .selection-actions button{padding:3px;min-width:0;font-size:10px;line-height:1.3;min-height:44px}
 body.command-deck .selection-actions kbd{display:none}body.command-deck #issue-order{grid-column:span 2}
 body.command-deck .command-panel{padding:3px 7px;overflow:auto}body.command-deck .command-panel>.panel-heading{gap:4px;min-height:44px;font-size:10px}
 body.command-deck #command-city{font-size:10px;line-height:1.4}body.command-deck #cd-open-queue{font-size:10px;padding:4px 6px}
 body.command-deck #cd-compact{display:block;min-height:44px;font-size:10px;white-space:nowrap;padding:4px 6px}
 body.command-deck .command-tabs{gap:3px;margin:0 0 3px}body.command-deck .command-tabs button{font-size:12px;min-height:44px;padding:4px}
 body.command-deck #commands,body.command-deck #commands.unit-roster{grid-template-columns:repeat(6,132px);flex-basis:98px;min-height:98px;gap:5px}
 body.command-deck #commands:not(.unit-roster){grid-template-columns:none;grid-auto-columns:156px}
 body.command-deck #commands button{min-height:82px;padding:5px!important}body.command-deck #commands .art-icon{width:46px;height:50px;margin-right:5px}
 body.command-deck #commands strong{font-size:11px}body.command-deck #commands small{font-size:10px}
 body.command-deck .cd-expansion{margin-top:0}body.command-deck .cd-expansion>summary{font-size:11px;min-height:44px;padding:10px 4px}
 body.command-deck.cd-compact{--cd-footer:252px}body.command-deck.cd-compact #commands{display:none}
 body.command-deck #app>main>aside{width:min(360px,100vw)}
 body.command-deck .camera-tip,body.command-deck #map-status{display:none}
 body.command-deck .map-tools{right:7px;bottom:35px;display:flex;flex-direction:row;gap:3px}.command-deck .map-tools button{font-size:18px}
 body.command-deck #faction-legend{font-size:8px;gap:8px;left:8px;right:8px;bottom:8px;overflow-x:auto;white-space:nowrap;flex-wrap:nowrap;max-width:calc(100% - 16px);pointer-events:auto}
 body.command-deck .cd-order-instruction:not([hidden]){top:7px;left:7px;right:7px;padding:6px 8px;gap:7px;font-size:12px}
 body.command-deck #horde-hud{right:7px;bottom:85px;max-width:calc(100% - 14px)}body.command-deck #horde-hud button{min-height:44px}
 body.command-deck #cd-queue-dialog{padding:14px}body.command-deck #cd-queue-title{font-size:23px}
}
@media(pointer:coarse){body.command-deck :is(.top-controls button,.cd-navigation button,.selection-actions button,.command-tabs button,.map-tools button,.cd-utilities>summary,.cd-expansion>summary,#cd-open-queue,#cd-compact,#close-sidebar){min-height:44px}}
@media(max-height:600px) and (min-width:701px){body.command-deck{--cd-header:50px;--cd-nav:52px;--cd-footer:230px}body.command-deck #app>footer{grid-template-rows:80px minmax(0,1fr)}body.command-deck .selection-content p{display:none}body.command-deck #minimap{height:45px}body.command-deck .command-panel{overflow:auto}}
html[data-theme=vina] body.command-deck :is(.cd-navigation,.cd-utilities>summary,.cd-utility-items,.cd-order-instruction,#cd-queue-dialog,aside>.panel-heading){background:#fff3fb;color:#54284c;border-color:#d3a8c6}
html[data-theme=vina] body.command-deck #cd-close-queue{background:#fff3fb;color:#54284c}
@media(max-height:500px){
 body.command-deck,body.command-deck.cd-compact{--cd-header:44px;--cd-nav:48px;--cd-footer:190px}
 body.command-deck #app{grid-template-rows:var(--cd-header) var(--cd-nav) minmax(70px,1fr) var(--cd-footer)}
 body.command-deck #app>footer{grid-template-columns:110px minmax(0,1fr);grid-template-rows:76px minmax(0,1fr)}
 body.command-deck .minimap-panel{grid-row:1;grid-column:1;padding:3px}body.command-deck #minimap{height:68px}body.command-deck .minimap-panel>div{display:none}
 body.command-deck .selection-panel{grid-row:1;grid-column:2;overflow:auto;padding:4px 8px}
 body.command-deck .command-panel{grid-row:2;grid-column:1/-1;overflow:auto}
 body.command-deck .map-tools{display:flex;flex-direction:row;bottom:6px;right:8px}
 body.command-deck :is(.camera-tip,#map-status,#faction-legend){display:none}
}

/* 2.4.1: reserve the viewport for play. All persistent controls share one bottom dock. */
body.command-deck,body.command-deck.cd-compact{--cd-header:40px;--cd-nav:36px;--cd-footer:112px}
body.command-deck #app{height:100dvh;min-height:0;grid-template-rows:var(--cd-header) minmax(0,1fr) var(--cd-footer)}
body.command-deck #app>header{grid-row:1;padding:0 10px;gap:8px}
body.command-deck #app>main,body.command-deck #app>main.sidebar-closed{grid-row:2;min-height:0}
body.command-deck #app>footer{grid-row:3;position:relative;z-index:25;grid-template-columns:120px 380px minmax(0,1fr);grid-template-rows:var(--cd-nav) minmax(0,1fr);height:var(--cd-footer);overflow:visible}
body.command-deck .cd-navigation{grid-row:1;grid-column:1/-1;padding:2px 8px;gap:6px;border-top:1px solid var(--edge);border-bottom:1px solid var(--edge);z-index:auto}
body.command-deck .cd-nav-label{font-size:10px}
body.command-deck #cities .city-card{min-height:30px;height:30px;flex-basis:54px;min-width:54px;padding:2px 4px}
body.command-deck #cities .city-card strong{font-size:14px}
body.command-deck :is(#cd-context,#cd-research,#cd-open-queue){min-height:30px;height:30px;padding:3px 9px;font-size:11px;white-space:nowrap}
body.command-deck #cd-context{max-width:155px}
body.command-deck #cd-research{min-width:100px;max-width:160px;text-align:center}
body.command-deck #cd-research strong{font-size:12px}
body.command-deck #cd-research small{display:none}
body.command-deck .brand{font-size:18px}
body.command-deck .resources{gap:14px}
body.command-deck .resources b{font-size:14px}
body.command-deck .top-controls button{height:32px;min-height:32px;min-width:32px;padding:3px 7px}
body.command-deck .cd-utilities>summary{min-height:32px;padding:6px}
body.command-deck .minimap-panel{grid-row:2;grid-column:1;padding:4px 6px;overflow:hidden}
body.command-deck #minimap{width:100%;height:100%;max-height:none;aspect-ratio:auto}
body.command-deck .minimap-panel>div{display:none}
body.command-deck .selection-panel{grid-row:2;grid-column:2;padding:3px 7px;overflow:hidden;display:flex;flex-direction:column;justify-content:center;gap:3px}
body.command-deck .selection-panel>.panel-heading{font-size:10px;min-height:14px}
body.command-deck .selection-panel>.panel-heading>span:first-child{display:none}
body.command-deck .selection-content,body.command-deck .selection-panel .hint{display:none}
body.command-deck .selection-actions{display:flex;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:thin;gap:4px;margin:0;padding:0 0 2px}
body.command-deck .selection-actions button{min-height:44px;height:44px;min-width:0;flex:1;font-size:11px;padding:3px 4px;white-space:normal;line-height:1.15}
body.command-deck .selection-actions kbd{display:none}
body.command-deck .command-panel{grid-row:2;grid-column:3;display:flex;flex-direction:row;align-items:center;gap:5px;padding:4px 8px;overflow:visible;position:static}
body.command-deck .command-tabs{flex:1;min-width:0;margin:0;gap:4px}
body.command-deck .command-tabs button{min-height:36px;height:36px;padding:4px 5px;font-size:12px;min-width:0}
body.command-deck .cd-expansion{margin:0;flex:none}
body.command-deck .cd-expansion>summary{min-height:36px;padding:10px 6px;font-size:11px;border:1px solid var(--edge);border-radius:4px}
body.command-deck .cd-expansion .expansion{position:absolute;bottom:100%;right:8px;z-index:29;margin:0;padding:12px;width:min(540px,calc(100vw - 16px));max-height:45dvh;overflow:auto;background:var(--panel);border:1px solid var(--edge);box-shadow:0 -8px 24px #0005}
body.command-deck #cd-close-expansion{margin-left:auto}
body.command-deck .cd-palette{position:absolute;bottom:100%;right:8px;width:min(880px,calc(100vw - 16px));max-height:40dvh;padding:8px;background:var(--panel);border:1px solid var(--edge);border-radius:6px 6px 0 0;box-shadow:0 -8px 24px #0005;overflow:auto}
body.command-deck.cd-compact .cd-palette{display:none}
body.command-deck .cd-palette-heading{display:flex;align-items:center;gap:8px;margin-bottom:6px;font-size:11px}
body.command-deck #cd-compact{display:block;flex:none;min-height:36px;padding:5px 10px;font-size:12px}
body.command-deck #commands,body.command-deck #commands.unit-roster,body.command-deck.cd-compact #commands{display:grid;grid-template-columns:repeat(6,minmax(110px,1fr));min-height:90px;height:auto;flex-basis:auto;overflow-x:auto;overflow-y:hidden;gap:6px;padding:0 0 5px}
body.command-deck #commands:not(.unit-roster){grid-template-columns:none;grid-auto-columns:minmax(140px,1fr)}
body.command-deck #commands button{min-height:80px;padding:5px 7px!important}
body.command-deck #commands .art-icon{width:42px;height:46px}
body.command-deck #app>main>aside{top:var(--cd-header);bottom:var(--cd-footer);max-height:none}
body.command-deck :is(.camera-tip,#map-status){display:none}
body.command-deck .map-tools{display:flex;flex-direction:row;bottom:22px;right:8px}
@media(max-width:1000px){
 body.command-deck #app>footer{grid-template-columns:90px minmax(250px,.85fr) minmax(0,1fr)}
 body.command-deck .cd-nav-label{display:none}
 body.command-deck .selection-actions button{font-size:10px;padding:4px 6px}
 body.command-deck .command-tabs button{font-size:11px}
}
@media(max-width:700px){
 body.command-deck,body.command-deck.cd-compact{--cd-header:44px;--cd-nav:44px;--cd-footer:132px}
 body.command-deck #app>footer{grid-template-columns:minmax(0,1fr);grid-template-rows:44px 44px 44px}
 body.command-deck .minimap-panel{display:none}
 body.command-deck .selection-panel{grid-row:2;grid-column:1;padding:0 6px}
 body.command-deck .selection-panel>.panel-heading{display:none}
 body.command-deck .selection-actions{gap:3px;padding:0}
 body.command-deck .selection-actions button{min-height:44px;height:44px;flex:1;font-size:10px;padding:3px;white-space:normal;line-height:1.2}
 body.command-deck .command-panel{grid-row:3;grid-column:1;padding:0 6px;gap:4px}
 body.command-deck .command-tabs button,body.command-deck .cd-expansion>summary{min-height:44px;height:44px;font-size:11px;padding:6px}
 body.command-deck .cd-expansion>summary{padding-top:13px}
 body.command-deck .cd-navigation{gap:4px;padding:0 6px}
 body.command-deck #cities .city-card{min-height:44px;height:44px;min-width:40px;flex-basis:40px}
 body.command-deck #cities .city-card small{display:none}
 body.command-deck :is(#cd-context,#cd-research,#cd-open-queue){min-height:44px;height:44px;min-width:0;max-width:100px;font-size:10px;padding:4px 6px}
 body.command-deck #cd-context{max-width:84px;white-space:normal}
 body.command-deck #cd-research strong{font-size:10px}
 body.command-deck .top-controls button,body.command-deck .cd-utilities>summary{height:44px;min-height:44px}
 body.command-deck #cd-compact{min-height:44px}
 body.command-deck .cd-palette{max-height:40dvh;right:4px;width:calc(100vw - 8px);padding:6px}
 body.command-deck #commands,body.command-deck #commands.unit-roster,body.command-deck.cd-compact #commands{grid-template-columns:repeat(6,138px)}
 body.command-deck #commands:not(.unit-roster){grid-template-columns:none;grid-auto-columns:150px}
 body.command-deck .map-tools{bottom:6px}
}
@media(max-height:500px) and (min-width:701px){
 body.command-deck,body.command-deck.cd-compact{--cd-header:32px;--cd-nav:32px;--cd-footer:76px}
 body.command-deck #app>footer{grid-template-columns:75px minmax(260px,.9fr) minmax(0,1fr)}
 body.command-deck .selection-panel>.panel-heading{display:none}
 body.command-deck .selection-actions button,body.command-deck .command-tabs button,body.command-deck .cd-expansion>summary{min-height:40px;height:40px}
 body.command-deck .cd-palette{max-height:48dvh}
 body.command-deck .cd-navigation{padding:0 6px}
 body.command-deck :is(#cd-context,#cd-research,#cd-open-queue,#cities .city-card){min-height:30px;height:30px}
}
html[data-theme=vina] body.command-deck :is(.cd-palette,.cd-expansion .expansion){background:#fff3fb;color:#54284c;border-color:#d3a8c6}
body.command-deck .cd-action-scope{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:4px 0 8px;font-size:12px}
body.command-deck .cd-action-scope[hidden]{display:none}
body.command-deck .cd-action-scope label{display:flex;align-items:center;gap:6px;margin:0}
body.command-deck .cd-action-scope select{width:auto;margin:0;min-height:36px;padding:5px 8px}
body.command-deck .cd-action-scope button{min-height:36px;padding:5px 8px;font-size:12px}
#start-devourer{width:auto;margin-right:8px}
.devourer-choice{display:block;margin:12px 0}
.devourer-choice small{display:block;margin-top:6px}
body.command-deck .cd-city-alert{position:absolute;top:10px;left:50%;transform:translateX(-50%);z-index:24;width:min(520px,calc(100% - 24px));padding:10px 12px;background:#20160ff5;border:2px solid #f4b265;border-radius:6px;color:#fff4dc;box-shadow:0 4px 20px #0008;font-size:13px;pointer-events:auto}
body.command-deck .cd-city-alert[hidden]{display:none}
body.command-deck .cd-city-alert[data-kind=strike],body.command-deck .cd-city-alert[data-kind=destroyed]{border-color:#ff7568;background:#291311f7}
body.command-deck .cd-city-alert strong{display:block;line-height:1.4}
body.command-deck .cd-city-alert select{margin:7px 0 0;padding:5px;min-height:32px;width:100%;color:inherit;background:#20160f}
body.command-deck .cd-alert-actions{display:flex;justify-content:flex-end;gap:6px;margin-top:6px}
body.command-deck .cd-alert-actions button{padding:5px 10px;min-height:32px;color:inherit;background:#423027}
@media(max-height:500px){body.command-deck .cd-city-alert{top:4px;padding:5px 8px;font-size:11px}body.command-deck .cd-alert-actions{margin-top:3px}}
/* Keep dock rows from acquiring internal vertical scrollbars. */
body.command-deck .selection-actions{min-height:44px;flex-shrink:0;overflow-y:hidden}
@media(max-height:500px) and (min-width:701px){
 body.command-deck .selection-panel{padding:0 6px}
 body.command-deck #app>header .top-controls button,body.command-deck #app>header .cd-utilities>summary{min-height:32px;height:32px;padding:4px}
}

/* Keep all surviving factions reachable without adding a permanent HUD row. */
body.command-deck #faction-legend{right:24px;max-width:calc(100% - 48px);overflow-x:auto;flex-wrap:nowrap;pointer-events:auto}
body.command-deck #faction-legend>span{flex-shrink:0}
body.command-deck .selection-actions #deploy-artillery,body.command-deck .selection-actions #pack-artillery{min-width:76px;flex:0 0 76px}
body.command-deck .selection-actions:has(#deploy-artillery:not([hidden])) button{min-width:58px;flex:0 0 58px}
