/* The camera measures this available space; controls never resize the world. */
#tactics-toggle{display:none}
#map{touch-action:none;user-select:none;-webkit-user-select:none}
.map-zoom button>svg{width:18px;height:18px}
#reinforce-button[aria-pressed="true"]{background:#b8d29f;color:#29422b}
.battle-map-options{display:grid;gap:10px;margin-top:22px}.battle-map-options button{display:grid;gap:7px;text-align:left;padding:18px;border:1px solid #bdcbb8;border-radius:12px;color:#293e33;background:#eef3e7}.battle-map-options button:hover{background:#e2edd8}.battle-map-options strong{font-size:17px}.battle-map-options span{font-size:12px;color:#65795c}
#map[data-density="mega"] .city-base{r:10px;stroke-width:1.2px}
#map[data-density="mega"] .troop-number{font-size:10px;transform:translateY(-2px)}
#map[data-density="mega"] .select-ring{r:14px;stroke-width:1.5px}
#map[data-density="mega"] .shield-ring{r:13px;stroke-width:1px}
#map[data-density="mega"] .island-name{font-size:var(--mega-label-size,9px);transform:translateY(-15px);stroke-width:2px;pointer-events:none}
#map[data-density="mega"] .land{vector-effect:non-scaling-stroke;stroke-width:1px}
#map[data-density="mega"] .island-name.label-hidden{visibility:hidden}
#map[data-density="mega"] .city-marker:hover .island-name,#map[data-density="mega"] .city-marker.selected .island-name{visibility:visible}
#map[data-density="mega"] .region-name,#map[data-density="mega"] .type-glyph{display:none}
#map[data-density="mega"] .player-emblem{transform:translate(0,27px) scale(.55)}
#map[data-density="mega"] .rocket-site{transform:translate(10px,-10px) scale(.6)}
#map[data-density="mega"] .key-star{transform:translateY(26px);font-size:11px}
#map[data-density="mega"][data-zoomed="false"] .island-name{display:none}
#map[data-density="mega"] .city-marker.selected .island-name{display:block}
@media(max-width:900px),(pointer:coarse) and (max-width:1200px){
  body{--mobile-top:calc(76px + env(safe-area-inset-top,0px));--mobile-deck:calc(142px + env(safe-area-inset-bottom,0px));--mobile-left:max(8px,env(safe-area-inset-left,0px));--mobile-right:max(8px,env(safe-area-inset-right,0px));--mobile-home-top:calc(66px + env(safe-area-inset-top,0px));--mobile-home-bottom:calc(190px + env(safe-area-inset-bottom,0px))}
  .app-layout{height:100dvh}
  .topbar.game-header{top:env(safe-area-inset-top,0px);left:var(--mobile-left);right:var(--mobile-right);height:60px;padding:8px 0;display:flex;align-items:center;gap:8px}
  .game-header .brand{font-size:10px;gap:6px;letter-spacing:.35px}.game-header .brand-mark{width:32px;height:32px}.game-header .session-badge{display:none}
  .header-actions{gap:4px}.header-actions .icon-button{width:44px;height:44px;border-radius:10px}.header-actions #help-button{display:none}.wallet-button{min-height:44px;padding:7px 9px}.wallet-button b{font-size:16px}.wallet-label{display:none}
  body[data-screen="home"]:has(#generator-settings-button:not([hidden])){--mobile-home-bottom:calc(234px + env(safe-area-inset-bottom,0px))}
  body[data-screen="home"] #map,body[data-screen="home"]:has(#generator-settings-button:not([hidden])) #map{top:var(--mobile-home-top);bottom:var(--mobile-home-bottom);left:var(--mobile-left);right:var(--mobile-right);width:calc(100% - var(--mobile-left) - var(--mobile-right));height:calc(100% - var(--mobile-home-top) - var(--mobile-home-bottom));min-height:0;max-height:none;aspect-ratio:auto}
  .start-card,.start-card:has(#generator-settings-button:not([hidden])){top:auto;left:var(--mobile-left);right:var(--mobile-right);bottom:calc(78px + env(safe-area-inset-bottom,0px));width:auto;min-width:0;max-width:none;padding:10px;border-radius:12px;transform:none}
  .start-card h2{margin:4px 0 8px;font-size:18px;line-height:1.2}.start-card p,.start-card .eyebrow,.start-card .victory-reward{display:none}.launch-actions{gap:8px}.start-card .primary-button,.start-card .secondary-button{min-height:44px;padding:9px 8px;font-size:13px}.generator-settings-link{min-height:44px;padding:10px 8px 2px;font-size:11px}
  .game-nav{left:var(--mobile-left);right:var(--mobile-right);bottom:calc(8px + env(safe-area-inset-bottom,0px));width:auto;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;transform:none}
  .game-nav button{width:100%;height:60px;min-width:0;padding:5px 3px;gap:4px}.game-nav button>svg{width:20px;height:20px}.game-nav button>span{font-size:9px;line-height:1.15}.local-save-status{display:none}.map-attribution{bottom:2px;right:var(--mobile-right);font-size:6px}
  body[data-screen="battle"] .game-header{left:auto;right:var(--mobile-right);top:calc(8px + env(safe-area-inset-top,0px));width:44px;height:56px;padding:0;justify-content:flex-end}
  body[data-screen="battle"] .game-header .brand,body[data-screen="battle"] .game-header .wallet-button,body[data-screen="battle"] .game-header #sound-button{display:none}
  body[data-screen="battle"] .battle-status{top:calc(8px + env(safe-area-inset-top,0px));left:var(--mobile-left);right:calc(var(--mobile-right) + 52px);width:auto;height:56px;padding:5px 8px;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;gap:6px;border-radius:10px;transform:none}
  .battle-status .stat{min-width:0;gap:0;overflow:hidden}.battle-status .stat>svg,.battle-status .balance{display:none}.battle-status .stat>span{font-size:8px;line-height:1.15;white-space:nowrap}.battle-status .stat b{margin-top:3px;font-size:17px;line-height:1.15}.battle-status .stat small{font-size:10px}.battle-status .clock-controls{gap:3px;margin:0}.battle-status .clock-controls>span{margin:0;font-size:11px!important;letter-spacing:0}.battle-status .clock-controls .icon-button{width:44px;height:44px}
  body[data-screen="battle"] #map,body[data-screen="battle"][data-tactics="true"] #map{top:var(--mobile-top);bottom:var(--mobile-deck);left:var(--mobile-left);right:var(--mobile-right);width:calc(100% - var(--mobile-left) - var(--mobile-right));height:calc(100% - var(--mobile-top) - var(--mobile-deck));min-height:0;max-height:none;aspect-ratio:auto}
  body[data-screen="battle"] .command-deck{left:var(--mobile-left);right:var(--mobile-right);bottom:calc(8px + env(safe-area-inset-bottom,0px));width:auto;max-height:calc(100dvh - var(--mobile-top) - 16px - env(safe-area-inset-bottom,0px));padding:10px;grid-template-columns:minmax(0,1fr) 88px;gap:8px;border-radius:12px;transform:none;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
  .command-deck .selection-info{grid-column:1/-1;min-width:0;min-height:44px;gap:6px;padding:0;border:0}.command-deck .selection-info>div{min-width:0;flex:1}.command-deck .selection-info .eyebrow,.command-deck .selection-symbol{display:none}
  .command-deck .selection-info strong{margin:0 0 4px;font-size:12px;line-height:1.2;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.command-deck .selection-info small{font-size:10px;line-height:1.2;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}
  .command-deck .select-all{min-height:44px;min-width:54px;margin:0;padding:6px;font-size:9px}.command-deck .army-split{grid-column:1;grid-row:2;padding:0;border:0}.command-deck .army-split>.eyebrow{display:none}.command-deck .segmented{max-width:none;margin:0;padding:2px}.command-deck .segmented button{min-width:0;min-height:44px;padding:8px 4px;font-size:12px}
  #tactics-toggle{grid-column:2;grid-row:2;display:flex;align-items:center;justify-content:center;gap:5px;min-height:50px;min-width:0;padding:8px 5px;border:1px solid #6b875f;border-radius:7px;background:#3d5b43;color:#edf3e6;font-size:11px}
  #tactics-toggle[aria-expanded="true"]{background:#b8d29f;color:#29422b}
  .command-deck .abilities{display:none;grid-column:1/-1;padding:0;border:0}
  body[data-tactics-open="true"]{--mobile-deck:calc(268px + env(safe-area-inset-bottom,0px))}body[data-tactics-open="true"] .command-deck .abilities{display:block}
  .command-deck .ability-label{min-height:16px;margin-bottom:8px}.command-deck .ability-label .eyebrow{font-size:9px}.command-deck .ability-label>span:last-child{font-size:12px}
  .command-deck .ability-buttons,body[data-tactics="true"] .command-deck .ability-buttons{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}.command-deck .ability-buttons button,body[data-tactics="true"] .command-deck .ability-buttons button{min-height:44px;padding:8px 5px;gap:5px;font-size:11px}.command-deck .ability-buttons kbd{display:none}
  body[data-screen="battle"] .map-hint{display:none}.map-zoom{top:calc(var(--mobile-top) + 8px);right:calc(var(--mobile-right) + 4px);left:auto;bottom:auto;gap:6px;transform:none}.map-zoom button{width:44px;height:44px;border-radius:10px;font-size:22px}.map-zoom button>svg{width:20px;height:20px}
  .control-progress{top:var(--mobile-top);max-width:calc(100% - 76px);padding:5px 8px;font-size:9px}
  .multiplayer-bar{top:calc(66px + env(safe-area-inset-top,0px));left:var(--mobile-left);right:var(--mobile-right);margin:0;padding:0;min-height:44px;flex-wrap:nowrap;gap:8px;font-size:9px}.multiplayer-bar #mp-connection{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}.multiplayer-bar .text-button{min-height:44px;padding:8px;font-size:10px;flex-shrink:0}
  body:has(#multiplayer-bar:not([hidden])){--mobile-top:calc(120px + env(safe-area-inset-top,0px));--mobile-home-top:calc(120px + env(safe-area-inset-top,0px))}
  #toast,body[data-tactics="true"] #toast{bottom:var(--mobile-deck);max-width:calc(100vw - 24px);padding:10px 13px;font-size:11px}
  dialog,#multiplayer-dialog{max-height:calc(100dvh - 24px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));padding:28px 18px}.modal-close{width:44px;height:44px;top:8px;right:8px}.modal-title{padding-right:25px}dialog .primary-button,dialog .secondary-button,.alliance-actions button{min-height:44px}
}
@media(orientation:landscape) and (max-width:900px),(orientation:landscape) and (pointer:coarse) and (max-width:1200px){
  body{--mobile-sidebar:174px;--mobile-deck:calc(8px + env(safe-area-inset-bottom,0px))}body[data-tactics-open="true"]{--mobile-deck:calc(8px + env(safe-area-inset-bottom,0px))}
  body[data-screen="battle"] .battle-status{right:calc(var(--mobile-right) + var(--mobile-sidebar) + 8px)}
  body[data-screen="battle"] #map,body[data-screen="battle"][data-tactics="true"] #map{right:calc(var(--mobile-right) + var(--mobile-sidebar) + 8px);bottom:var(--mobile-deck);width:calc(100% - var(--mobile-left) - var(--mobile-right) - var(--mobile-sidebar) - 8px);height:calc(100% - var(--mobile-top) - var(--mobile-deck))}
  body[data-screen="battle"] .command-deck{top:var(--mobile-top);left:auto;right:var(--mobile-right);bottom:calc(8px + env(safe-area-inset-bottom,0px));width:var(--mobile-sidebar);max-height:none;padding:8px;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:repeat(3,max-content);align-content:start;align-items:stretch;gap:6px;border-radius:10px}
  .command-deck .selection-info{display:grid;grid-template-columns:1fr 1fr;grid-column:1;min-height:0;padding-bottom:6px;border-bottom:1px solid #58704c}.command-deck .selection-info>div{grid-column:1/-1}.command-deck .selection-info strong{font-size:12px}.command-deck .selection-info small{font-size:9px}.command-deck .select-all{width:100%;margin:0}
  .command-deck .army-split{grid-row:auto;grid-column:1}.command-deck .army-split>.eyebrow{display:none}.command-deck .segmented{margin-top:0}.command-deck .segmented button{font-size:11px}
  #tactics-toggle{display:none}.command-deck .abilities,body[data-tactics-open="true"] .command-deck .abilities{display:block;grid-column:1}.command-deck .ability-label{margin-bottom:6px}.command-deck .ability-buttons button,body[data-tactics="true"] .command-deck .ability-buttons button{font-size:10px;gap:3px;padding:7px 3px}
  body[data-screen="battle"] .map-zoom{top:auto;bottom:calc(8px + env(safe-area-inset-bottom,0px));left:var(--mobile-left);right:auto;flex-direction:row}
  body[data-screen="battle"] .map-attribution{right:calc(var(--mobile-right) + var(--mobile-sidebar) + 12px)}body[data-screen="battle"] .control-progress{left:var(--mobile-left);transform:none;max-width:calc(100% - var(--mobile-sidebar) - var(--mobile-right) - var(--mobile-left) - 16px)}
  body[data-screen="battle"] #toast,body[data-screen="battle"][data-tactics="true"] #toast{left:var(--mobile-left);bottom:calc(62px + env(safe-area-inset-bottom,0px));transform:translateY(15px);max-width:calc(100vw - var(--mobile-sidebar) - var(--mobile-left) - var(--mobile-right) - 16px)}body[data-screen="battle"] #toast.visible{transform:translateY(0)}
  body[data-screen="home"],body[data-screen="home"]:has(#generator-settings-button:not([hidden])){--mobile-home-bottom:calc(78px + env(safe-area-inset-bottom,0px))}
  body[data-screen="home"] #map,body[data-screen="home"]:has(#generator-settings-button:not([hidden])) #map{top:var(--mobile-home-top);bottom:var(--mobile-home-bottom);right:calc(var(--mobile-right) + var(--mobile-sidebar) + 8px);width:calc(100% - var(--mobile-left) - var(--mobile-right) - var(--mobile-sidebar) - 8px);height:calc(100% - var(--mobile-home-top) - var(--mobile-home-bottom))}
  .start-card,.start-card:has(#generator-settings-button:not([hidden])){top:var(--mobile-home-top);bottom:calc(8px + env(safe-area-inset-bottom,0px));left:auto;right:var(--mobile-right);width:var(--mobile-sidebar);display:flex;flex-direction:column;justify-content:center;gap:6px;padding:10px;overflow-y:auto;overscroll-behavior:contain}
  .start-card h2{font-size:16px;margin:0 0 4px}.launch-actions{flex-direction:column;gap:8px}.start-card .primary-button,.start-card .secondary-button{flex:0 0 auto;min-height:44px;font-size:12px}.generator-settings-link{padding:6px 2px;line-height:1.3}.game-nav{right:calc(var(--mobile-right) + var(--mobile-sidebar) + 8px)}.game-nav button{height:60px}.game-nav button>span{font-size:8px}
  body[data-screen="home"] .map-zoom{top:auto;bottom:var(--mobile-home-bottom);left:var(--mobile-left);right:auto;gap:6px;flex-direction:row}
}
@media(orientation:portrait) and (max-width:350px){.game-header .brand-copy{display:none}.battle-status .clock-controls{gap:2px}.battle-status .clock-controls>span{font-size:10px!important}.battle-status .stat>span{font-size:7px}.command-deck .selection-info strong{font-size:11px}}
@media(orientation:landscape) and (max-height:360px) and (max-width:900px){body[data-screen="battle"] .command-deck{padding:6px;gap:4px}.command-deck .selection-info>div{display:none}.command-deck .selection-info{padding-bottom:4px}.command-deck .ability-label{min-height:14px;margin-bottom:4px}}
