.desktop-toolbar{display:none}
.desktop-shortcut-hint{display:none}
@media(min-width:701px) and (pointer:fine){.desktop-shortcut-hint{display:block;padding:10px 12px;border:1px solid #627e86;border-radius:7px;background:#142e38;color:#f8dfac;font-size:12px;line-height:1.7}}
#hq-armory-status{margin:4px 0;color:#ffe0a2;line-height:1.4}
@media(min-width:701px){
 html,body{height:100%;overflow:hidden}
 body:not(.hq-home)>.app{height:100dvh;max-width:none;width:100%;padding:0 24px;display:flex;flex-direction:column}
 body:not(.hq-home) .topbar,body:not(.hq-home) .footer,body:not(.hq-home) .right-rail{display:none}
 body:not(.hq-home) .layout{flex:1;min-height:0;display:flex;justify-content:center;gap:36px;padding:0 0 16px;align-items:center}
 body:not(.hq-home) .left-rail{flex:0 1 260px;max-height:100%;overflow:auto}
 body:not(.hq-home) .game-shell{flex:none;height:calc(100dvh - 80px);width:calc((100dvh - 80px)*.5625);max-width:calc(100vw - 360px);max-height:none;aspect-ratio:9/16;border-radius:12px}
 body[data-desktop-size="compact"]:not(.hq-home) .game-shell{height:min(720px,calc(100dvh - 80px));width:min(405px,calc((100dvh - 80px)*.5625))}
 .desktop-toolbar{position:relative;display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:8px 14px;min-height:60px;padding:8px 0;color:#d6e3df;z-index:7;font-size:12px}
 .desktop-toolbar label{display:flex;gap:8px;align-items:center}
 .desktop-toolbar :is(button,select,summary){min-height:44px;max-width:100%;border:1px solid #627e86;border-radius:7px;background:#203e48;color:#f8dfac;padding:8px 12px;font:inherit;cursor:pointer}
 .desktop-toolbar [role="status"]{flex-basis:100%;text-align:center;color:#ffce9b}
 .desktop-toolbar [role="status"]:empty{display:none}
 .desktop-toolbar details{position:relative}
 .desktop-toolbar details[open]{border:1px solid #66848b;background:#132c36;border-radius:8px;padding:8px;width:min(520px,calc(100vw - 32px))}
 .desktop-toolbar details[open] p{line-height:1.6;margin:10px 0;max-width:100%}
 .app>.desktop-toolbar:has(details[open]){position:absolute;top:0;left:0;right:0;background:#132c36}
 #levels-dialog.hq-screen[open]{max-width:1440px}
 .hq-screen .hq-shell{grid-template-areas:'head head' 'modes modes' 'display display' 'chapter chapter' 'map prep' 'settings settings';gap:10px 18px;padding:clamp(14px,2vw,28px)}
 .hq-shell>.desktop-toolbar{grid-area:display;justify-content:flex-end;padding:0;min-height:40px;border-bottom:1px solid #49616b;padding-bottom:8px}
 .hq-screen .campaign-map{aspect-ratio:auto;height:min(64dvh,720px);min-height:360px;align-self:stretch}
 .hq-screen .campaign-selection{align-content:start;gap:10px 12px}
 .hq-screen #hq-launch-actions{position:sticky;bottom:0;padding:9px 0;background:#142e38;z-index:5}
 .hq-screen #campaign-launch{min-height:52px;font-size:18px}
 body.desktop-fullscreen:not(.hq-home) .left-rail{display:none}
 body.desktop-fullscreen:not(.hq-home) .game-shell{max-width:calc(100vw - 24px);border:0;border-radius:0;box-shadow:0 0 90px #0008}
 body.desktop-fullscreen:not(.hq-home)>.app{background:radial-gradient(ellipse at center,#294553,#0a161d 75%)}
 @media(max-height:800px){
  .hq-screen .hq-shell{gap:7px 14px;padding:12px 20px}
  .hq-screen .campaign-head h2{font-size:24px}.hq-screen .campaign-head{padding-bottom:8px}
  .hq-screen .campaign-mode-choice button{min-height:36px}
  .hq-screen .campaign-map{height:max(360px,calc(100dvh - 236px))}
  .hq-screen #mission-guide{min-height:170px;max-height:260px}
  .hq-screen .campaign-selection{gap:6px 10px}
  .hq-screen #campaign-level-name{font-size:22px}.hq-screen #campaign-brief{font-size:12px}
 }
 @media(max-width:1000px){body:not(.hq-home) .left-rail{display:none}body:not(.hq-home) .game-shell{max-width:calc(100vw - 32px)}.hq-shell>.desktop-toolbar{justify-content:center}}
 @media(max-height:500px){
  .hq-screen .campaign-map{height:calc(100dvh - 240px);min-height:120px;max-height:none;align-self:start}
 }
}
@media(max-width:700px){#hq-armory-status{font-size:11px;line-height:1.25}}

/* Shared touch controls also work with a mouse, keyboard, and hybrid tablets. */
.control-options{grid-column:1/-1;min-width:0;padding:10px 0;border-top:1px solid #8ba6ac38}
.control-options label{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;font-size:13px;color:#d6e3df}
.control-options select{min-height:44px;max-width:100%;padding:8px 12px;border:1px solid #627e86;border-radius:7px;background:#203e48;color:#f8dfac;font:inherit}
.control-options .control-hint{margin:8px 0 0;font-size:12px;line-height:1.45;color:#b7cdd0}
.movement-controls{display:grid;grid-template-columns:1fr 1.2fr 1fr;gap:8px;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.movement-controls[hidden]{display:none}
.movement-controls button{display:flex;justify-content:center;align-items:center;gap:8px;min-width:0;min-height:52px;padding:6px;border:1px solid #819b9b;border-radius:10px;background:#203b45;color:#e9f2e3;touch-action:none;font-family:inherit;font-weight:700;font-size:12px;line-height:1.2}
.movement-controls button>span:first-child{font:400 26px/1 sans-serif}
.movement-controls [data-move="fire"]{background:#344c37;border-color:#bce881;color:#e0f5bb}
.movement-controls button[aria-pressed="true"]{background:#55746d;border-color:#e0f5bb;box-shadow:inset 0 0 0 2px #d1edb568}
.movement-controls button:focus-visible{outline:2px solid #e8e89c;outline-offset:2px}
body[data-active-input="touch"] .game-shell{touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
@container(max-width:300px){
 .movement-controls button{flex-direction:column;gap:0;font-size:11px}
 .movement-controls button>span:first-child{font-size:20px}
}
@media(min-width:701px) and (pointer:coarse){
 body:not(.hq-home) .left-rail{display:none}
 body:not(.hq-home) .game-shell{max-width:calc(100vw - 32px)}
}

/* Expand touch targets on tablets, including iPad with a trackpad.
   Phones keep their compact HQ controls and the larger map area. */
@media(min-width:701px){
body[data-touch-capable="true"] .hq-shell :is(.campaign-mode-choice button,.hq-difficulty button),
body[data-touch-capable="true"] :is(#hq-settings-open,#chapter-prev,#chapter-next,#hq-points-open,#hq-stars-open,#hq-money-open,.hq-map-motion){min-height:44px;min-width:44px}
body[data-touch-capable="true"] .hq-shell .level-node{min-width:44px;min-height:44px}
body[data-touch-capable="true"] .hq-shell .level-node:before{inset:-3px}
body[data-touch-capable="true"] .hq-shell #territories-open{min-height:44px}
body[data-touch-capable="true"] :is(#hq-settings,.pause-settings) :is(button,select,summary){min-height:44px}
body[data-touch-capable="true"] .game-shell :is(#pause,#sound){width:44px;height:44px;min-width:44px;min-height:44px}
body[data-active-input="touch"] .desktop-keyboard-help{display:none}

/* Reserve the same mission rows on tablets and desktop, including long titles. */
@media(min-width:701px){
 .hq-screen .campaign-selection{grid-template-areas:'label label' 'title title' 'hero brief' 'hero stats' 'hero weapons' 'actions actions' 'difficulty difficulty' 'launch launch' 'note note'}
 .hq-screen #campaign-level-name{height:52px;min-height:52px;max-height:none;margin:0;font-size:20px;line-height:26px;white-space:normal;overflow:visible}
 .hq-screen #campaign-brief{height:54px;min-height:54px;max-height:none;font-size:12px;line-height:18px;display:block;overflow:visible;-webkit-line-clamp:unset}
 .hq-screen .hq-difficulty button{min-width:0}
 .hq-screen .hq-difficulty button small{white-space:normal}
}

body[data-touch-capable="true"] :is(dialog[open],#hq-settings) :is(button,select,summary){min-height:44px;min-width:44px}

}
body[data-active-input="touch"] .desktop-keyboard-help{display:none}
