:root{color-scheme:dark;--gold:#be955b;--paper:#f1e5ce;--muted:#c7baa3;--edge:#be955b70;--panel:#151b1eee;--red:#8d2935}*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#111719;color:var(--paper);font:15px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}button,input{font:inherit}button{cursor:pointer;color:inherit;touch-action:manipulation}button:disabled{cursor:default;opacity:.43}button:focus-visible,input:focus-visible,label:focus-within{outline:2px solid #ffe0a1;outline-offset:3px}button{min-height:44px;background:#202627;border:1px solid var(--edge);border-radius:4px;padding:10px 18px}h1,h2,h3,p{margin:0}h1,h2,h3{font-family:Georgia,serif;font-weight:400}#app{height:100dvh;width:100%;position:relative;isolation:isolate;overflow:hidden}#battle{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none;background:#181d1d}#overlay{position:absolute;inset:0;z-index:10;background:linear-gradient(90deg,#101417e8,#10141775),url('../art/backgrounds/key-art.png') 65% center/cover;overflow-y:auto}#overlay:empty{display:none}.panel{max-width:920px;margin:auto;padding:clamp(24px,5vh,60px) 36px;min-height:100%;display:flex;flex-direction:column;justify-content:center}.panel.narrow{max-width:640px}.eyebrow{color:#d7b77b;letter-spacing:2.5px;font-size:11px;text-transform:uppercase}.wordmark{font-size:clamp(58px,10vw,115px);letter-spacing:.12em;line-height:1.1;color:#edcf8e}.subtitle{font:clamp(19px,3vw,29px) Georgia,serif;margin:9px 0 22px}.panel h2{font-size:clamp(26px,4vw,42px);line-height:1.15;margin:8px 0 18px}.panel p{color:var(--muted);max-width:600px}.home-panel{margin:0;max-width:670px;padding-left:7vw}.home-panel p{max-width:390px}.menu-buttons{display:flex;flex-direction:column;gap:10px;max-width:340px;margin-top:25px}.primary{background:linear-gradient(#96333e,#6f202b);border-color:#d1a66d}.secondary{background:#171c20da}.fine{font-size:11px;color:#b9ae9b;margin-top:18px;max-width:450px}.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:22px}.brief-goals{list-style:none;padding:0;margin:22px 0;color:#e5cfac}.brief-goals li{margin:10px 0}.brief-goals li:before{content:'◇';color:#d7b77b;margin-right:12px}.small-profile{position:absolute;top:max(18px,env(safe-area-inset-top));right:max(20px,env(safe-area-inset-right));display:flex;align-items:center;gap:10px;background:var(--panel);max-width:260px;padding:6px 12px 6px 6px}.small-profile span{max-width:165px;overflow-wrap:anywhere}.portrait{width:48px;aspect-ratio:1;background-image:url('../art/characters/portraits.png');background-size:400% 200%;background-position:var(--px) var(--py);border:1px solid var(--edge);border-radius:4px;flex-shrink:0}.custom-avatar{object-fit:cover;background:none}.small-profile .portrait{width:34px}.stats{display:flex;justify-content:space-between;gap:18px;margin:30px 0;max-width:570px}.stats b{display:block;font:32px Georgia,serif;color:#edcf8e}.stats small{color:var(--muted);font-size:12px}.help-list{padding-left:22px;color:#dfd2bc}.help-list li{margin:12px 0}.profile-header{display:flex;justify-content:space-between;align-items:center;gap:20px}.profile-grid{display:grid;grid-template-columns:1fr 1fr;gap:35px;margin-top:10px}.identity{display:flex;align-items:center;gap:16px}.identity .portrait{width:70px}.identity h3{font-size:24px;overflow-wrap:anywhere;max-width:260px}.avatar-grid{display:flex;gap:7px;margin:18px 0 12px}.avatar-grid button{width:44px;padding:0;min-height:44px}.avatar-grid .active{outline:2px solid #ecd298;outline-offset:2px}.upload{display:inline-flex;align-items:center;min-height:44px;border:1px solid var(--edge);border-radius:3px;background:#23292a;padding:8px 12px;cursor:pointer;font-size:13px}#avatar-file{position:absolute;width:1px;height:1px;opacity:0}.image-hint{font-size:10px;color:var(--muted);display:block;margin-top:4px}.name-form{margin-top:15px}.name-form label{font-size:12px;display:block;margin-bottom:4px}.name-row{display:flex;gap:7px}.name-row input{min-width:0;width:100%;height:44px;background:#101619;border:1px solid var(--edge);color:var(--paper);border-radius:3px;padding:8px 10px}.name-row button{font-size:12px}.setting{border:1px solid var(--edge);background:#161c1ee8;padding:15px;border-radius:4px;margin-bottom:12px}.setting>span{display:block;font-size:13px;color:var(--muted);margin-bottom:10px}.choices{display:flex;gap:8px}.choices .active{background:#b18b53;color:#101417;border-color:#e5c58e}.profile-status{font-size:12px;color:#e1c98c;min-height:20px;margin-top:8px}#hud{position:absolute;inset:0;pointer-events:none;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}#hud button{pointer-events:auto}.hud-top{position:absolute;left:max(14px,env(safe-area-inset-left));right:max(14px,env(safe-area-inset-right));top:max(12px,env(safe-area-inset-top));display:flex;justify-content:space-between;align-items:flex-start;gap:15px}.objective{background:var(--panel);border:1px solid var(--edge);padding:10px 15px;border-radius:4px;max-width:56%;box-shadow:0 4px 20px #0004}.objective h2{font-size:19px}.objective p{font-size:12px;margin-top:3px;color:#e6d8be}.objective .eyebrow{font-size:9px;margin-bottom:2px;letter-spacing:1.5px}.objective .progress{font-size:10px;color:#d6ba86;margin-top:4px}.top-buttons{display:flex;gap:7px}.square{min-width:44px;padding:8px 10px;font-size:18px;background:var(--panel)}.hud-bottom{position:absolute;left:max(14px,env(safe-area-inset-left));right:max(14px,env(safe-area-inset-right));bottom:max(12px,env(safe-area-inset-bottom));display:flex;align-items:flex-end;justify-content:space-between;gap:10px}.roster{display:flex;gap:7px;align-items:stretch}.unit{background:var(--panel);width:115px;text-align:left;padding:7px;border:1px solid var(--edge);position:relative}.unit.selected{border-color:#f2d38d;box-shadow:0 0 0 1px #f2d38d,inset 0 0 15px #d2aa4d20}.unit .portrait{width:33px;display:inline-block;vertical-align:middle;margin-right:7px}.unit .count{font-size:12px}.unit .name{display:block;font-size:12px;margin:5px 0 3px;white-space:nowrap}.health{height:4px;background:#49453d;border-radius:3px}.health i{height:100%;display:block;background:#afbd85;border-radius:3px;transition:width .15s}.unit.dead .health i{background:#9f5e52}.all{font-size:11px;max-width:85px;padding:7px;background:var(--panel)}.all.selected{border-color:#f2d38d;background:#58472eea}.commands{display:flex;gap:8px}.command{position:relative;background:var(--panel);min-width:108px;max-width:170px;padding:8px 12px;font-size:12px;text-align:center;overflow:hidden;user-select:none;-webkit-user-select:none}.command-icon{display:block;width:32px;height:32px;margin:0 auto 4px;background:url('../art/ui/command-icons.png') no-repeat;background-size:400% 300%;pointer-events:none}.command small{font-size:10px;display:block;color:#d6bb8e;margin-top:2px}.command.focus{background:#58472eea;touch-action:none}.command.holding{border-color:#ffe0a1;box-shadow:0 0 15px #e7b15c60}.focus-meter{height:3px;margin-top:4px;background:#15191b}.focus-meter i{display:block;height:100%;background:#e6c58c}.tutorial{position:absolute;left:16px;bottom:120px;max-width:440px;background:#171c20e8;border-left:2px solid #d9b477;padding:9px 13px;font-size:12px;pointer-events:none;color:#e9d9b8}.tutorial:empty{display:none}#toast{position:absolute;left:50%;top:29%;transform:translateX(-50%);z-index:20;background:transparent;border:1px solid #d4af70;border-radius:5px;padding:12px 20px;max-width:90%;text-align:center;font-size:13px;pointer-events:none;opacity:0;transition:opacity .2s}#toast.show{opacity:1}.load-spinner{height:3px;background:#3b352b;margin-top:25px;overflow:hidden;max-width:360px}.load-spinner:after{content:'';display:block;width:40%;height:100%;background:#d5b172;animation:loading 1.2s infinite}@keyframes loading{from{transform:translateX(-100%)}to{transform:translateX(350%)}}
@media(max-height:550px) and (min-width:600px){.panel{padding:22px 32px;justify-content:flex-start}.home-panel{justify-content:center;padding-left:6vw}.wordmark{font-size:60px}.subtitle{font-size:20px;margin:4px 0 12px}.menu-buttons{margin-top:16px;gap:7px;max-width:280px}.menu-buttons button{padding:7px 15px}.home-panel .fine{margin-top:10px;font-size:10px}.panel h2{font-size:28px;margin-bottom:12px}.panel p{font-size:13px}.brief-goals{margin:10px 0;font-size:13px}.row{margin-top:15px}.objective{padding:7px 12px}.objective h2{font-size:16px}.objective p{font-size:11px}.objective .progress{margin-top:2px}.unit{width:99px;padding:5px}.unit .portrait{width:26px}.unit .name{font-size:11px;margin:2px 0 3px}.commands{gap:6px}.command{min-width:96px;max-width:138px;padding:5px 8px;font-size:11px}.command-icon{width:24px;height:24px;margin-bottom:2px}.command small{font-size:9px}.tutorial{bottom:94px;font-size:11px;max-width:360px}.all{max-width:65px;font-size:10px}.hud-bottom{gap:7px}.profile-grid{gap:26px}.identity .portrait{width:50px}.identity h3{font-size:21px}.avatar-grid{margin:10px 0}.name-form{margin-top:9px}.setting{padding:10px}.stats{margin:16px 0}.help-list{font-size:12px}.help-list li{margin:8px 0}}
@media(max-width:600px){.panel{padding:80px 24px 30px;justify-content:flex-start}.panel.narrow{padding-top:34px}.home-panel{justify-content:center;padding-top:75px}.wordmark{font-size:65px}.subtitle{font-size:20px}.home-panel p{font-size:14px}.menu-buttons{max-width:none}.small-profile{top:14px;right:14px}.panel h2{font-size:29px}.profile-grid{grid-template-columns:1fr;gap:18px}.profile-header{align-items:flex-start}.profile-header h2{margin:0}.profile-grid .fine{margin-top:10px}.objective{max-width:73%;padding:8px 10px}.objective h2{font-size:15px}.objective p{font-size:11px}.objective .eyebrow{font-size:8px}.top-buttons{flex-direction:column;gap:6px}.hud-top{left:10px;right:10px;top:10px}.hud-bottom{display:block;left:10px;right:10px;bottom:10px}.roster{gap:5px;margin-bottom:8px}.unit{width:calc((100vw - 98px)/3);padding:5px}.unit .portrait{width:25px;margin-right:3px}.unit .name{font-size:10px}.unit .count{font-size:10px}.all{max-width:64px;font-size:10px;padding:5px}.commands{justify-content:flex-end}.command{min-width:100px;max-width:165px;display:grid;grid-template-columns:25px 1fr;gap:0 8px;padding:6px 10px;align-items:center;font-size:11px}.command-icon{width:25px;height:25px;grid-row:1/3;margin:0}.command small{font-size:9px}.focus-meter{grid-column:2;margin-top:3px}.tutorial{left:10px;bottom:162px;max-width:calc(100vw - 20px);font-size:11px;padding:7px 10px}.stats{gap:10px}.stats b{font-size:27px}.stats small{font-size:11px}.row button{flex:1}.profile-header button{flex:none}.square{padding:7px;min-width:44px}#toast{top:22%;font-size:12px;width:max-content;max-width:90%}.fine{font-size:10px}}
.campaign-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:22px 0}.mission-card{min-height:160px;text-align:left;display:flex;flex-direction:column;justify-content:flex-end;gap:7px;background:linear-gradient(0deg,#10181bf5,#10181b30),var(--scene) center/cover;padding:16px}.mission-card strong{font:22px Georgia,serif}.mission-card small{font-size:12px;color:#e5d5b8}.mission-card.finished{border-color:#a5bc84}.mission-card:disabled{opacity:.65;filter:saturate(.3)}.upgrade-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin:25px 0}.upgrade-card{text-align:left;padding:24px 18px;background:#242a26}.upgrade-card strong{display:block;font:24px Georgia,serif;color:#edcf8e;margin-bottom:12px}.upgrade-card span{font-size:14px;color:#d5c9b2}.roster:has([data-unit="archers"]) .unit{width:100px}.roster:has([data-unit="archers"]) .unit .name{font-size:10px}
@media(max-width:900px){.roster:has([data-unit="archers"]) .unit{width:88px}.roster:has([data-unit="archers"]) .unit .portrait{width:24px;margin-right:3px}.roster:has([data-unit="archers"]) .unit .name{white-space:normal}.campaign-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:600px){.campaign-grid{grid-template-columns:1fr 1fr;gap:8px}.mission-card{min-height:155px;padding:12px}.mission-card strong{font-size:18px}.upgrade-grid{grid-template-columns:1fr}.roster:has([data-unit="archers"]) .unit{width:calc((100vw - 102px)/4);padding:4px}.roster:has([data-unit="archers"]) .unit .portrait{width:22px}.roster:has([data-unit="archers"]) .unit .count{font-size:9px}.roster:has([data-unit="archers"]) .unit .name{font-size:9px;overflow-wrap:anywhere}}
/* Compact control sizing; the canvas remains edge-to-edge. */
@media (max-height:600px) and (orientation:landscape), (max-width:600px){
 #app{--combat-top:52px;--combat-bottom:64px;--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px)}
 .hud-top{top:var(--safe-top);left:env(safe-area-inset-left,0px);right:env(safe-area-inset-right,0px);height:var(--combat-top);align-items:center;gap:8px;padding:0 8px;background:transparent;border-bottom:1px solid #be955b40}
 .objective{border:0;background:none;box-shadow:none;padding:0;max-width:none;flex:1;min-width:0}
 .objective .eyebrow,.objective h2{display:none}
 .objective p{font-size:11px;line-height:1.25;margin:0}
 .objective .progress{font-size:10px;line-height:1.2;margin-top:3px}
 .top-buttons{flex-direction:row;flex-shrink:0}
 .top-buttons [data-action="help"]{display:none}
 .top-buttons .square{height:44px;width:44px;padding:0}
 .hud-bottom{left:env(safe-area-inset-left,0px);right:env(safe-area-inset-right,0px);bottom:var(--safe-bottom);height:var(--combat-bottom);display:flex;align-items:center;justify-content:space-between;gap:8px;padding:5px 8px;background:transparent;border-top:1px solid #be955b40}
 .roster{gap:5px;margin:0;flex-shrink:0;align-items:center}
 .unit,.roster:has([data-unit="archers"]) .unit{width:58px;min-height:48px;height:48px;padding:4px;display:grid;grid-template-columns:25px 1fr;align-items:center;gap:3px}
 .unit .portrait,.roster:has([data-unit="archers"]) .unit .portrait{width:25px;height:25px;margin:0}
 .unit .count,.roster:has([data-unit="archers"]) .unit .count{font-size:10px;line-height:1;overflow:hidden}
 .unit .name,.roster:has([data-unit="archers"]) .unit .name{display:none}
 .unit .health{grid-column:1/-1;width:100%;height:3px}
 .unit:disabled .count{font-size:8px;overflow-wrap:anywhere}
 .all{width:48px;max-width:48px;min-height:48px;padding:3px;font-size:9px;line-height:1.2}
 .commands{gap:5px;align-items:center}
 .command{width:100px;min-width:80px;max-width:110px;height:48px;min-height:48px;padding:4px 6px;display:grid;grid-template-columns:22px 1fr;gap:0 5px;align-items:center;font-size:10px;line-height:1.1}
 .command-icon{width:22px;height:22px;margin:0;grid-row:1/3}
 .command small{font-size:9px;margin:0}
 .command.focus small{display:none}
 .focus-meter{grid-column:2;height:3px;margin:0}
 .tutorial{display:none}
 #toast{top:calc(var(--safe-top) + 3px);left:calc(env(safe-area-inset-left,0px) + 8px);transform:none;width:calc(100% - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px) - 76px);max-width:none;min-height:44px;max-height:46px;padding:5px 8px;border:0;border-left:2px solid #d4af70;border-radius:0;background:transparent;display:flex;align-items:center;text-align:left;font-size:11px;line-height:1.2}
 #app:has(#toast.show) .objective{visibility:hidden}
}
@media(max-width:600px) and (orientation:portrait){
 #app{--combat-top:64px;--combat-bottom:112px}
 .hud-bottom{flex-wrap:wrap;gap:4px;justify-content:center;padding:5px 6px}
 .roster{justify-content:center;width:100%}
 .commands{justify-content:center;width:100%}
 .command{height:44px;min-height:44px;width:130px;max-width:150px}
}
@media (max-height:600px) and (orientation:landscape){
 #app{--combat-top:44px;--combat-bottom:56px}
 .hud-bottom{padding-top:3px;padding-bottom:3px}
}

.tactic-options{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:14px 0}
.tactic-options button{text-align:left;padding:12px}
.tactic-options strong,.tactic-options small{display:block}
.tactic-options small{font-size:12px;color:var(--muted);margin-top:6px}
.unit{-webkit-touch-callout:none;user-select:none;-webkit-user-select:none}
@media(max-width:600px) and (orientation:portrait){
 .commands .command{flex:1;min-width:0;max-width:150px;width:auto;font-size:10px}
 .tactics-button{display:block}
 .tactic-options{grid-template-columns:1fr}
}
@media (max-height:600px) and (orientation:landscape), (max-width:1400px) and (orientation:landscape) and (any-pointer:coarse){
 #app{--combat-top:44px;--combat-bottom:0px;--left-rail:76px;--right-rail:100px;--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px)}
 .hud-top{top:var(--safe-top);left:env(safe-area-inset-left,0px);right:env(safe-area-inset-right,0px);height:44px;align-items:center;padding:0 8px;background:transparent}
 .objective{background:none;border:0;box-shadow:none;max-width:none;flex:1;padding:0}
 .objective h2,.objective .eyebrow,.tutorial{display:none}
 .objective p{font-size:11px;margin:0}.objective .progress{font-size:10px;margin:0}
 .top-buttons{flex-direction:row}.top-buttons [data-action="help"]{display:none}
 .hud-bottom{inset:calc(44px + var(--safe-top)) 0 var(--safe-bottom);height:auto;padding:0;background:none;border:0;display:block}
 .roster{position:absolute;left:env(safe-area-inset-left,0px);top:0;bottom:0;width:76px;display:flex;flex-direction:column;justify-content:center;gap:4px;padding:5px;background:transparent;overflow-y:auto;pointer-events:auto}
 .unit,.roster:has([data-unit="archers"]) .unit{width:64px;min-height:44px;height:44px;flex-shrink:0;padding:4px;display:grid;grid-template-columns:27px 1fr;gap:2px;align-items:center}
 .unit .portrait,.roster:has([data-unit="archers"]) .unit .portrait{width:25px;height:25px;margin:0}
 .unit .name,.roster:has([data-unit="archers"]) .unit .name{display:none}
 .unit .count{font-size:10px}.unit .health{grid-column:1/-1}
 .all{width:64px;max-width:64px;min-height:44px;flex-shrink:0;font-size:10px;padding:4px}
 .commands{position:absolute;right:env(safe-area-inset-right,0px);top:0;bottom:0;width:100px;display:flex;flex-direction:column;justify-content:center;gap:8px;padding:5px;background:transparent;overflow-y:auto;pointer-events:auto}
 .command{width:90px;min-width:90px;max-width:90px;height:auto;min-height:56px;flex-shrink:0;padding:5px;font-size:10px;display:block}
 .command-icon{width:24px;height:24px;margin:0 auto 4px}.command small{font-size:9px}.command.focus small{display:none}
 .tactics-button{min-height:44px}
 .focus-meter{margin-top:4px}
 #toast{top:calc(var(--safe-top) + 2px);left:calc(env(safe-area-inset-left,0px) + 8px);transform:none;max-width:none;width:calc(100% - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px) - 76px);max-height:42px;min-height:40px;padding:5px 8px;font-size:11px;text-align:left;display:flex;align-items:center;background:transparent;border:0}
 #app:has(#toast.show) .objective{visibility:hidden}
}
@media(max-height:330px) and (orientation:landscape){.roster{justify-content:flex-start}.commands{justify-content:flex-start}}


/* The battlefield extends under the HUD and safe areas in both orientations. */
#hud .hud-top,#hud .hud-bottom,#hud .roster,#hud .commands{
 background:transparent;border:0;box-shadow:none;
}
#hud .roster,#hud .commands{pointer-events:none}
#hud .unit,#hud .all,#hud .command,#hud .square,#hud .objective,#toast{
 background:linear-gradient(145deg,rgba(35,43,43,.32),rgba(12,22,25,.48));
 -webkit-backdrop-filter:blur(8px) saturate(115%);
 backdrop-filter:blur(8px) saturate(115%);
 border:1px solid rgba(238,216,172,.38);
 box-shadow:0 2px 10px rgba(0,0,0,.12),inset 0 1px 0 rgba(255,255,255,.13);
 text-shadow:0 1px 3px rgba(0,0,0,.8);
 border-radius:7px;
}
#hud .objective{flex:0 1 auto;padding:5px 10px;max-width:calc(100% - 60px)}
#hud .hud-top{justify-content:space-between}
#hud .unit.selected,#hud .all.selected{
 border-color:#f2d38d;background:linear-gradient(145deg,rgba(171,131,58,.28),rgba(34,40,35,.48));
 box-shadow:0 0 0 1px rgba(242,211,141,.5),inset 0 1px 0 rgba(255,255,255,.18);
}
#hud .command.focus{background:linear-gradient(145deg,rgba(174,135,66,.3),rgba(64,52,30,.48))}
#hud .objective p{color:#fff3dc}
#hud .objective .progress{color:#f5dca6}
#hud .unit .health{background:rgba(18,27,26,.45)}
@media(max-width:600px) and (orientation:portrait){
 #hud .hud-bottom{padding-bottom:8px}
}


/* All screens share device safe areas; artwork stays edge-to-edge. */
:root{
 --safe-top:env(safe-area-inset-top,0px);
 --safe-right:env(safe-area-inset-right,0px);
 --safe-bottom:env(safe-area-inset-bottom,0px);
 --safe-left:env(safe-area-inset-left,0px);
}
#app{height:100vh;height:100dvh}
#overlay{
 padding:var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
 overflow-x:hidden;overscroll-behavior:contain;
 scroll-padding-top:24px;scroll-padding-bottom:24px;
}
#overlay .panel{width:100%;min-width:0}
#overlay .small-profile{
 top:calc(var(--safe-top) + 14px);right:calc(var(--safe-right) + 14px);
 max-width:calc(100% - var(--safe-left) - var(--safe-right) - 28px);
}
.profile-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
.profile-grid>div,.profile-header h2,.identity h3{min-width:0}
.avatar-grid,.choices{flex-wrap:wrap}
.name-row input{font-size:16px}
.panel h2,.mission-card strong,.tactic-options strong,.upgrade-card strong{overflow-wrap:anywhere}
.stats{flex-wrap:wrap}
#hud{padding:0}
#hud .hud-top{
 top:calc(var(--safe-top) + 8px);left:calc(var(--safe-left) + 8px);
 right:calc(var(--safe-right) + 8px);height:auto;min-height:44px;padding:0;
}
#hud .hud-bottom{
 left:calc(var(--safe-left) + 8px);right:calc(var(--safe-right) + 8px);
 bottom:calc(var(--safe-bottom) + 10px);
}
#toast{
 top:calc(var(--safe-top) + 8px);left:calc(var(--safe-left) + 8px);transform:none;
 width:auto;max-width:calc(100% - var(--safe-left) - var(--safe-right) - 76px);
 min-height:44px;max-height:none;padding:8px 12px;
}
#app:has(#toast.show) .objective{visibility:hidden}
@media(max-width:700px){
 .profile-grid{grid-template-columns:minmax(0,1fr)}
 .panel .row>button{min-width:0;overflow-wrap:anywhere}
}
@media(max-width:380px){
 .panel,.panel.narrow{padding-left:16px;padding-right:16px}
 .campaign-grid{grid-template-columns:minmax(0,1fr)}
 .name-row{flex-wrap:wrap}.name-row input{flex:1 1 160px}
 .wordmark{font-size:54px}
}
/* iPad portrait and narrow multitasking windows: two comfortable bottom rows. */
@media(min-width:601px) and (orientation:portrait){
 #hud .hud-bottom{display:flex;flex-direction:column;align-items:center;gap:10px;height:auto;padding:0}
 #hud .roster{width:auto;max-width:100%;gap:8px;margin:0;justify-content:center}
 #hud .unit,#hud .roster:has([data-unit="archers"]) .unit{
  width:clamp(74px,11vw,112px);min-height:64px;padding:7px;
 }
 #hud .unit .portrait,#hud .roster:has([data-unit="archers"]) .unit .portrait{width:30px}
 #hud .unit .name{font-size:11px;white-space:normal}
 #hud .all{min-width:64px;max-width:90px;font-size:12px}
 #hud .commands{width:auto;max-width:100%;gap:10px}
 #hud .command{min-width:0;width:clamp(120px,20vw,160px);max-width:180px;min-height:58px;font-size:13px}
 #hud .tutorial{display:none}
}
/* Landscape phone and tablet controls stay inside left/right safe areas. */
@media(max-height:600px) and (orientation:landscape), (max-width:1400px) and (orientation:landscape) and (any-pointer:coarse){
 #hud .hud-bottom{top:calc(var(--safe-top) + 64px);left:0;right:0;bottom:calc(var(--safe-bottom) + 8px);height:auto}
 #hud .roster{left:calc(var(--safe-left) + 8px);padding-left:0;padding-right:0}
 #hud .commands{right:calc(var(--safe-right) + 8px);padding-left:0;padding-right:0}
}
/* Full-size iPads, including a connected pointer, get readable larger controls. */
@media(min-width:768px) and (min-height:601px) and (orientation:landscape) and (any-pointer:coarse){
 #hud .hud-bottom{top:calc(var(--safe-top) + 82px)}
 #hud .roster{width:104px;gap:10px}
 #hud .unit,#hud .roster:has([data-unit="archers"]) .unit{
  width:96px;height:66px;min-height:66px;padding:7px;grid-template-columns:34px 1fr;gap:4px;
 }
 #hud .unit .portrait,#hud .roster:has([data-unit="archers"]) .unit .portrait{width:32px;height:32px}
 #hud .unit .count,#hud .roster:has([data-unit="archers"]) .unit .count{font-size:13px}
 #hud .all{width:96px;max-width:96px;min-height:52px;font-size:12px}
 #hud .commands{width:136px;gap:12px}
 #hud .command{width:128px;min-width:128px;max-width:128px;min-height:72px;font-size:13px;padding:8px}
 #hud .command-icon{width:30px;height:30px}
 #hud .tactics-button{min-height:52px}
 #hud .objective p{font-size:14px}
 #hud .objective .progress{font-size:12px}
 .panel{max-width:1040px;padding:40px 48px}
 .panel.narrow{max-width:760px}
 .campaign-grid{gap:18px}
 .mission-card{min-height:190px}
}
@media(min-width:701px) and (min-height:700px) and (orientation:portrait){
 .panel{padding:40px 32px}
 .home-panel{padding-top:90px;padding-left:7vw}
 .campaign-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
 .mission-card{min-height:190px}
}
@media(max-width:600px) and (orientation:portrait){
 #hud .hud-bottom{padding:0}
 #hud .unit,#hud .roster:has([data-unit="archers"]) .unit{
  width:clamp(44px,calc((100vw - var(--safe-left) - var(--safe-right) - 92px)/4),58px);
 }
}

/* Single-line wordmark with a full-width motto beneath it. */
.brand-lockup{width:100%;max-width:540px;container-type:inline-size;margin-bottom:22px}
.wordmark{display:flex;align-items:baseline;justify-content:space-between;gap:.22em;font-size:clamp(24px,6.4vw,62px);letter-spacing:.015em;line-height:1;white-space:nowrap}
.wordmark>span{display:block}
.wordmark .brand-bet{display:flex;gap:.07em;font-size:1em;letter-spacing:0;margin:0;padding-right:.13em}
.brand-bet>span{position:relative}
.brand-bet i{position:absolute;right:-.65em;bottom:.1em;font-size:.18em;font-style:normal;line-height:1;opacity:.28}
.home-panel .brand-lockup .subtitle{display:flex;justify-content:space-between;align-items:baseline;gap:.25em;font-size:clamp(11px,1.65vw,18px);line-height:1.3;margin:12px 0 0;white-space:nowrap}
.brand-lockup .subtitle>span[aria-hidden]{font-size:.65em;opacity:.65}
@supports(font-size:1cqw){
 .brand-lockup .wordmark{font-size:11.5cqw}
 .home-panel .brand-lockup .subtitle{font-size:3.8cqw}
}
@media(max-height:550px) and (orientation:landscape){
 .brand-lockup{max-width:420px;margin-bottom:12px}
 .home-panel .brand-lockup .subtitle{margin-top:8px}
}
