#battle-screen{position:fixed;inset:0;z-index:100;background:#899976;color:#4b3924;isolation:isolate;--morale-danger:#f0b08d;--morale-warning:#ffe2a0;--morale-back:#34281ff2}
#battle-screen[hidden],#battle-screen [hidden]{display:none!important}
.battle-field{position:absolute;inset:0;width:100%;height:100%;touch-action:none;outline:none;cursor:crosshair}
.battle-hud,.battle-top-actions,.battle-camera,.battle-orders,.battle-unit-card,.battle-deploy,.battle-notice,.battle-paper{background:var(--papyrus-face);border:1px solid var(--papyrus-edge);box-shadow:0 3px 12px #3c42232b;color:var(--ink)}
.battle-hud{position:absolute;top:max(8px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);width:min(720px,calc(100% - 180px));display:flex;justify-content:space-between;align-items:center;gap:12px;padding:9px 16px;border-radius:5px;pointer-events:none}
.battle-force{display:flex;align-items:center;gap:7px;min-width:0}.battle-force strong{font-size:24px}.battle-force span{font-size:13px;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.battle-force svg{width:24px;height:24px;stroke:currentColor;fill:none;stroke-width:1.6}.battle-force.player{color:#943f32}.battle-force.enemy{color:#466b7a}.battle-heading{text-align:center}.battle-heading strong{font-family:Georgia,serif;font-size:21px;display:block;white-space:nowrap}.battle-heading small{font-size:12px;display:block;margin-top:3px}
.battle-top-actions{position:absolute;top:77px;left:max(12px,env(safe-area-inset-left));display:flex;border-radius:5px;padding:3px;gap:2px}.battle-top-actions button,.battle-camera button,.battle-orders button{width:40px;height:40px;display:grid;place-items:center;font-size:18px;font-weight:600;color:inherit;border-radius:3px;flex-shrink:0}
#battle-screen button svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7}.battle-top-actions button:hover,.battle-camera button:hover,.battle-orders button:hover,.battle-orders button[aria-pressed="true"]{background:#ba9b5738}.battle-top-actions button:disabled,.battle-orders button:disabled{opacity:.4}
.battle-camera{position:absolute;right:max(12px,env(safe-area-inset-right));top:82px;display:flex;flex-direction:column;padding:3px;border-radius:5px}.battle-notice{position:absolute;top:135px;left:50%;transform:translateX(-50%);padding:8px 14px;max-width:min(560px,90%);text-align:center;border-radius:4px;font-size:14px;pointer-events:none}
.battle-bottom{position:absolute;bottom:max(8px,env(safe-area-inset-bottom));left:max(10px,env(safe-area-inset-left));right:max(10px,env(safe-area-inset-right));display:flex;flex-direction:column;align-items:center;gap:6px;pointer-events:none}.battle-orders{display:flex;align-items:center;padding:3px 7px;gap:3px;border-radius:5px;max-width:100%;pointer-events:auto}.battle-orders i{height:24px;width:1px;background:var(--papyrus-edge);margin:0 3px}.battle-selection-info{font-size:13px;min-width:150px;text-align:center;margin:0 6px}
.battle-cards{display:flex;gap:5px;max-width:100%;overflow-x:auto;padding:2px 3px 5px;pointer-events:auto;scrollbar-width:thin}.battle-unit-card{border-radius:4px;min-width:139px;height:66px;display:flex;align-items:center;position:relative;text-align:left;gap:6px;padding:5px 10px 10px;flex-shrink:0}.battle-unit-card .unit-emblem{font-size:25px;color:#953f31}.battle-unit-card strong{display:block;font-size:13px;white-space:nowrap}.battle-unit-card small{display:block;font-size:12px;white-space:nowrap;margin-top:4px}.battle-unit-card[aria-pressed="true"]{border:2px solid #865c28;background:var(--papyrus-inset);box-shadow:0 0 0 2px #f0d88955}.unit-morale{position:absolute;bottom:4px;left:9px;right:9px;height:3px;background:#745c3733}.unit-morale i{display:block;background:#68845d;height:100%}.battle-unit-card.routed{opacity:.7}.battle-unit-card.routed .unit-morale i{background:#ac613b}.battle-unit-card.fallen{opacity:.45}
.battle-deploy{position:absolute;bottom:150px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:18px;padding:8px 12px;border-radius:5px;max-width:calc(100% - 130px)}.battle-deploy span{font-size:14px}.battle-deploy button{display:flex;align-items:center;justify-content:center;gap:8px;min-height:42px;white-space:nowrap;background:#86653a;color:#fbedd0;border-radius:4px;padding:8px 18px;font-size:15px;font-weight:600}
.battle-paper{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:min(570px,calc(100% - 32px));max-height:calc(100% - 24px);overflow:auto;border-radius:6px;padding:28px 32px;box-shadow:0 12px 60px #26301e88;z-index:5}.battle-paper h2{font:32px Georgia,serif;margin:9px 0 16px}.battle-paper small{font-size:11px;letter-spacing:1.7px;color:#987344}.battle-paper p{font-size:15px;line-height:1.55;margin:10px 0}.battle-paper-close{position:absolute;right:8px;top:7px;width:40px;height:40px;font-size:27px;color:inherit}.battle-paper .action-button{min-height:44px;margin-top:12px;display:inline-flex;align-items:center;justify-content:center;gap:8px}.battle-help .battle-shortcuts{font-size:13px;color:var(--muted)}.battle-confirm>div{display:flex;flex-wrap:wrap;gap:10px}.battle-result{text-align:center}.battle-result-seal{display:block;color:#8d6334;font-size:40px}.battle-result-stats{display:flex;justify-content:space-around;padding:16px 0;border-block:1px solid var(--papyrus-edge)}.battle-result-stats strong{display:block;font-size:28px}.battle-result-stats span{display:block;font-size:12px;margin-top:3px}
.battle-aftermath{position:absolute;inset:0;z-index:6;display:flex;flex-direction:column;align-items:center;justify-content:center;overflow:hidden;text-align:center;padding:24px;background:linear-gradient(#20251fcc,#343527dd);color:#f3e7c7}.battle-aftermath[hidden]{display:none}.battle-aftermath>small{font-size:11px;letter-spacing:2px;color:#e2be80}.battle-aftermath h2{font:clamp(24px,4vw,40px) Georgia,serif;margin:10px 0}.battle-aftermath p{font:16px Georgia,serif}.aftermath-scene{position:relative;width:min(680px,88vw);height:min(42vh,300px);min-height:190px;overflow:hidden;border-bottom:12px solid #4a4432;background:linear-gradient(#c4ad79 0 68%,#80734d 68%);box-shadow:0 12px 45px #10130f99}.aftermath-wall{position:absolute;inset:30% 0 0;background:repeating-linear-gradient(0deg,transparent 0 34px,#594d3760 35px 38px),repeating-linear-gradient(90deg,#9b8358 0 68px,#6d5d42 69px 74px)}.aftermath-house{position:absolute;left:50%;bottom:12px;transform:translateX(-50%);width:230px;height:150px;background:#d0bd91;border:7px solid #66583e;box-shadow:inset 0 8px #ead9ae}.aftermath-house:before{content:"";position:absolute;left:-22px;top:-65px;border-left:130px solid transparent;border-right:130px solid transparent;border-bottom:66px solid #754d3a}.aftermath-house:after{content:"";position:absolute;left:86px;bottom:0;width:45px;height:82px;background:#5d4635}.aftermath-house span{position:absolute;right:22px;top:-24px;color:#bd5539;font-size:36px;animation:aftermath-flame .6s ease-in-out infinite alternate}.aftermath-soldiers{position:absolute;inset:0}.aftermath-soldiers i{position:absolute;bottom:18px;left:16%;font-style:normal;font-size:39px;color:#443a32;text-shadow:0 2px #d7c69d;animation:aftermath-raid 7s ease-in-out both}.aftermath-soldiers i:nth-child(2){left:29%;animation-delay:.15s}.aftermath-soldiers i:nth-child(3){left:42%;animation-delay:.3s}.aftermath-soldiers i:nth-child(4){left:55%;animation-delay:.45s}.aftermath-dust{position:absolute;left:0;right:0;bottom:0;height:30px;background:radial-gradient(ellipse,#d2bd8b88,transparent 70%);animation:aftermath-dust 1s ease-in-out infinite alternate}@keyframes aftermath-raid{0%{transform:translateX(-180px);opacity:0}15%{opacity:1}30%,65%{transform:translateX(0)}100%{transform:translateX(760px);opacity:0}}@keyframes aftermath-flame{to{transform:scale(1.3);opacity:.55}}@keyframes aftermath-dust{to{transform:translateX(25px);opacity:.45}}
body.battle-active .rotate-prompt{z-index:110!important}
.battle-modal-open:before{content:"";position:absolute;inset:0;background:#25301db3;z-index:4}
.battle-modal-open .battle-paper{background:var(--papyrus-solid);z-index:7}
.battle-modal-open .battle-practice{visibility:hidden}
#battle-screen button:focus-visible{outline:2px solid #88602c;outline-offset:2px}
.battle-field:focus-visible{outline:2px solid #88602c;outline-offset:-3px}
.battle-mobile-control,.unit-number,.unit-count,.battle-menu-camera,.battle-secondary button span{display:none!important}
.battle-roster-toggle,.battle-guide-toggle,.battle-plan-done,.plan-settings-short{display:none}
.battle-practice .battle-guide-toggle{display:none}
.battle-secondary{display:contents}
.battle-roster{display:flex;align-items:center;gap:6px;max-width:100%;min-width:0}
.battle-roster-tools{display:flex;align-items:center;flex-shrink:0;padding:3px;border-radius:5px;pointer-events:auto;background:var(--papyrus-face);border:1px solid var(--papyrus-edge);color:var(--ink)}
.battle-roster-tools button{width:44px;height:44px;display:grid;place-items:center;color:inherit;border-radius:3px}
.battle-roster-tools button:hover,.battle-roster-tools button[aria-pressed="true"]{background:#ba9b5738}
@media(max-height:480px){.battle-hud{top:6px;padding:6px 10px;gap:7px;width:min(650px,calc(100% - 115px))}.battle-force strong{font-size:21px}.battle-force span{font-size:12px;max-width:110px}.battle-heading strong{font-size:18px}.battle-heading small{font-size:11px}.battle-top-actions{top:64px;left:8px}.battle-camera{top:64px;right:8px}.battle-camera button{height:36px}.battle-bottom{bottom:3px;gap:3px}.battle-orders{padding:1px 5px}.battle-orders button{height:36px;width:38px}.battle-cards{padding-bottom:3px}.battle-unit-card{height:59px;min-width:132px;padding:4px 8px 9px}.battle-deploy{bottom:121px;padding:5px 9px;gap:10px}.battle-deploy button{min-height:38px;padding:5px 12px}.battle-deploy span{font-size:13px}.battle-notice{top:113px;font-size:13px}.battle-paper{padding:18px 24px}.battle-paper h2{font-size:26px;margin:6px 0 12px}.battle-result-seal{font-size:27px}.battle-result-stats{padding:9px 0}}
@media(max-width:760px){.battle-force span{display:none}.battle-hud{width:calc(100% - 100px)}.battle-selection-info{min-width:0;font-size:12px}.battle-paper p{font-size:14px}.battle-paper .action-button{font-size:14px}.battle-unit-card strong{font-size:14px}.battle-unit-card small{font-size:12px}.battle-deploy span{display:none}.battle-deploy{max-width:calc(100% - 24px)}.battle-orders{gap:1px}.battle-orders button{width:37px}}
@media(pointer:coarse){.battle-top-actions button,.battle-orders button,.battle-camera button{width:44px;height:44px}.battle-orders{padding:1px 4px}.battle-unit-card{min-width:140px}.battle-bottom{gap:2px}.battle-selection-info{font-size:13px}.battle-deploy{bottom:132px}}
@media(pointer:coarse) and (max-height:480px){.battle-top-actions{display:grid;grid-template-columns:repeat(2,44px)}.battle-deploy span{display:none}.battle-deploy button{min-height:44px}}
/* Touch battle UI: keep the field open and reveal controls when needed. */
@media(pointer:coarse), (max-width:1100px) and (max-height:600px), (max-width:760px){
  .battle-mobile-control{display:grid!important}
  .battle-hud{top:max(8px,env(safe-area-inset-top));left:max(8px,env(safe-area-inset-left));transform:none;width:auto;max-width:calc(100% - 214px - env(safe-area-inset-left) - env(safe-area-inset-right));height:44px;padding:4px 10px;gap:12px;background:#f2e6c9e8}
  .battle-force span{display:none}.battle-force strong{font-size:19px}.battle-force svg{width:19px;height:19px}.battle-force{gap:4px}
  .battle-heading strong{font:600 12px system-ui}.battle-heading small{font-size:11px;margin-top:2px}
  .battle-top-actions{top:max(8px,env(safe-area-inset-top));left:auto;right:max(8px,env(safe-area-inset-right));display:flex;gap:2px;padding:0;height:44px;background:#f2e6c9e8}
  .battle-top-actions button,.battle-orders button,.battle-roster-tools button{width:44px;height:44px}
  .battle-secondary{display:none;position:absolute;right:0;top:52px;width:190px;max-height:calc(100dvh - 72px);overflow-y:auto;padding:6px;background:var(--papyrus-face);border:1px solid var(--papyrus-edge);border-radius:5px;box-shadow:0 5px 20px #26301e55;z-index:2}
  .battle-menu-open .battle-secondary{display:flex;flex-direction:column}
  .battle-menu-open .battle-practice{visibility:hidden}
  .battle-secondary>button,.battle-secondary>.battle-mobile-control{display:flex!important;align-items:center;gap:12px;width:100%;padding:0 10px;text-align:left;font-size:14px}
  .battle-secondary button[aria-pressed="true"]{background:#ba9b5738}
  .battle-secondary button span{display:block!important}
  .battle-menu-camera{display:flex!important;justify-content:space-between;border-top:1px solid var(--papyrus-edge);padding-top:4px;margin-top:4px}
  .battle-camera{display:none}
  .battle-bottom{bottom:max(6px,env(safe-area-inset-bottom));left:max(8px,env(safe-area-inset-left));right:max(8px,env(safe-area-inset-right));gap:0;align-items:stretch}
  .battle-roster{gap:6px;width:100%}.battle-roster-tools{padding:1px;align-self:stretch;background:#f2e6c9e8}
  .battle-cards{flex:1;min-width:0;gap:4px;padding:2px 2px 3px;scrollbar-width:none}.battle-cards::-webkit-scrollbar{display:none}
  .battle-unit-card{width:64px;min-width:64px;height:54px;display:grid;grid-template-columns:26px 1fr;align-content:center;justify-items:center;gap:0;padding:3px 5px 9px;background:#f2e6c9e8}
  .battle-unit-card .unit-detail{display:none}.battle-unit-card .unit-emblem{grid-row:1 / 3;display:grid;place-items:center}#battle-screen .battle-unit-card svg{width:26px;height:26px}
  .battle-unit-card .unit-number{display:block!important;font-size:10px;color:var(--muted);line-height:13px}.battle-unit-card .unit-count{display:block!important;font-size:15px;font-weight:700;line-height:18px}
  .unit-morale{left:5px;right:5px;bottom:4px}
  .battle-orders{display:none;position:absolute;bottom:64px;right:0;padding:2px 4px;gap:1px;background:#f2e6c9f2;box-shadow:0 3px 12px #3c42232b}
  .battle-has-selection .battle-orders{display:flex}.battle-selection-info{min-width:0;max-width:150px;font-size:12px;margin:0 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .battle-deploy{bottom:78px;padding:3px;max-width:calc(100% - 24px);background:#f2e6c9e8}.battle-deploy span{display:none}.battle-deploy button{min-height:44px;padding:7px 15px}
  .battle-has-selection .battle-deploy{bottom:132px}
  .battle-notice{top:62px;left:auto;right:max(8px,env(safe-area-inset-right));transform:none;max-width:calc(100% - 264px);font-size:13px;padding:6px 10px;z-index:11}
  .battle-paper-close{width:44px;height:44px}
  .battle-hud-hidden .battle-hud,.battle-hud-hidden .battle-bottom,.battle-hud-hidden .battle-deploy,.battle-hud-hidden .battle-practice,.battle-hud-hidden .battle-top-actions>button:not([data-battle="hud"]){display:none!important}
  .battle-hud-hidden .battle-top-actions{background:#f2e6c9d9}
}
@media(max-width:560px){.battle-selection-info{display:none}.battle-heading strong{display:none}.battle-hud{gap:7px;padding:4px 7px;max-width:calc(100% - 206px)}}
@media(max-width:480px){
  .battle-hud{width:calc(100% - 16px - env(safe-area-inset-left) - env(safe-area-inset-right));max-width:none}
  .battle-heading{min-width:0}.battle-heading strong{display:block;font:600 12px system-ui}.battle-heading small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .battle-top-actions{top:calc(max(8px,env(safe-area-inset-top)) + 52px)}
  .battle-secondary{max-height:calc(100dvh - 132px - env(safe-area-inset-top))}
  .battle-notice{top:auto;bottom:132px;left:max(8px,env(safe-area-inset-left));max-width:calc(100% - 16px);text-align:center}
}
/* A general prepares the orders on a surveyed map, then watches them unfold. */
.battle-planner{--plan-accent:#7c392d;position:absolute;top:142px;left:14px;width:224px;padding:16px;background:var(--papyrus-solid);border:1px solid var(--papyrus-edge);border-top:3px solid var(--plan-accent);border-radius:4px;box-shadow:0 5px 22px #28322038;color:var(--ink)}
.battle-planner>small{font-size:10px;letter-spacing:1.8px;color:var(--plan-accent)}
.battle-planner h2{font:24px Georgia,serif;margin:7px 0 14px}
.battle-plan-modes,.battle-plan-edit{display:flex;gap:4px}
.battle-planner button{min-height:40px;flex:1;padding:6px;color:inherit;border:1px solid var(--papyrus-edge);border-radius:3px;font-size:12px}
.battle-plan-modes button[aria-pressed="true"]{background:#7c392d;color:#f9e6bd;border-color:#7c392d}
.battle-plan-hint{font-size:12px;line-height:1.5;margin:12px 0;color:var(--muted)}
.battle-plan-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:12px 0}
.battle-plan-options label{font-size:11px;display:grid;gap:4px;color:var(--muted)}
.battle-plan-options select{width:100%;min-width:0;height:38px;font:13px system-ui;color:var(--ink);background:var(--papyrus-inset);border:1px solid var(--papyrus-edge);padding:0 6px;border-radius:3px}
.battle-plan-options select:focus-visible{outline:2px solid #88602c;outline-offset:2px}
.battle-planner button:disabled,.battle-plan-options select:disabled{opacity:.45}
.battle-plan-face{width:100%;margin-top:6px}
.battle-plan-settings{display:none}
.battle-plan-summary{margin:12px 0 0;font-size:11px;border-top:1px solid var(--papyrus-edge);padding-top:10px;color:var(--plan-accent)}
.battle-observing .battle-orders,.battle-observing .battle-roster-tools,.battle-planning .battle-orders{display:none!important}
.battle-observing .battle-field{cursor:grab}
.battle-planning .battle-practice{left:auto;right:72px;top:136px;max-width:235px}
.battle-hud-hidden .battle-planner{display:none!important}
@media(max-height:600px) and (pointer:fine) and (min-width:901px){.battle-planner{top:115px;padding:10px}.battle-planner h2{font-size:20px;margin:5px 0}.battle-plan-options{gap:5px;margin:8px 0}.battle-plan-hint{margin:6px 0}.battle-plan-summary{margin-top:6px;padding-top:6px}}
@media(pointer:coarse), (max-width:1100px) and (max-height:600px), (max-width:760px){
 .battle-planner{top:auto;bottom:72px;left:8px;right:8px;width:auto;padding:6px;display:flex;align-items:end;gap:6px;flex-wrap:wrap;border-top-width:2px;background:#f2e6c9f5}
 .battle-planner>small,.battle-planner h2,.battle-plan-summary{display:none}
 .battle-plan-modes{flex:1;min-width:150px}.battle-planner button{min-height:44px}
 .battle-plan-hint{flex:1;min-width:150px;margin:0;font-size:11px;align-self:center}
 .battle-plan-options{display:none;margin:0;flex:3;grid-template-columns:repeat(4,minmax(70px,1fr));gap:5px;min-width:310px}
 .battle-plan-options select{height:44px;font-size:12px}.battle-plan-options label{font-size:10px;gap:2px}
 .battle-plan-edit{display:none;flex:1;min-width:130px}
 .battle-has-selection .battle-plan-settings{display:block;min-width:120px;margin:0}
 .battle-plan-face{width:auto;margin:0;display:none;min-width:85px}
 .battle-has-selection.battle-plan-options-open .battle-plan-options{display:grid;flex-basis:100%;order:2}.battle-has-selection .battle-plan-edit{display:flex}.battle-has-selection .battle-plan-face{display:block}.battle-has-selection .battle-plan-hint{display:none}
 .battle-planning .battle-deploy,.battle-planning.battle-has-selection .battle-deploy{top:60px;bottom:auto;left:auto;right:8px;transform:none;max-width:180px}
 .battle-planning .battle-notice{top:118px}
 .battle-planning .battle-practice{top:62px;right:auto;left:8px;max-width:220px}
}
@media(max-width:480px){.battle-planning .battle-deploy,.battle-planning.battle-has-selection .battle-deploy{top:112px}.battle-planning .battle-practice{top:112px;max-width:190px}.battle-planning .battle-notice{top:274px;bottom:auto}}

/* Direct combat leaves the center clear; the strategy roster returns after combat. */
.battle-action .battle-bottom,.battle-action .battle-camera,.battle-action .battle-practice{display:none!important}
.commander-ui{position:absolute;inset:0;pointer-events:none;color:#f4dfb8;font-family:system-ui,sans-serif}
.commander-ui[hidden]{display:none}
.commander-vitals{position:absolute;left:22px;top:100px;width:215px;padding:12px 15px;background:linear-gradient(120deg,#262c27ee,#262c27bb);border-left:3px solid #d5b16f;border-radius:3px;box-shadow:0 4px 18px #14221c55}
.commander-vitals strong{display:block;font:600 19px Georgia,serif;margin-bottom:8px}
.commander-vitals label{display:flex;align-items:center;gap:10px;font-size:11px;margin:5px 0}
.commander-vitals label span{width:57px;flex-shrink:0}
.commander-vitals meter{width:100%;height:13px;accent-color:#c55d42}
.commander-vitals meter::-webkit-meter-bar{background:#111e19;border:0;border-radius:2px}
.commander-vitals meter::-webkit-meter-optimum-value{background:#bf563c}
.commander-vitals [data-hero=stamina]::-webkit-meter-optimum-value{background:#d3b66d}
.commander-vitals small{display:block;margin-top:8px;font-size:10px;color:#d0c1a4}
.commander-objective{position:absolute;top:94px;left:50%;transform:translateX(-50%);max-width:48%;margin:0;padding:8px 14px;background:#202923cd;border-radius:3px;text-align:center;font-size:12px}
.commander-actions{position:absolute;right:24px;bottom:38px;display:grid;grid-template-columns:repeat(3,auto);gap:9px;pointer-events:auto}
.commander-actions button{min-width:88px;min-height:60px;border:1px solid #c0a06b;background:linear-gradient(#3c4137,#232e28);color:#ffe4b5;border-radius:8px;font:600 12px system-ui;box-shadow:0 4px 15px #101a18aa;touch-action:none;user-select:none}
.commander-actions button:first-child{background:linear-gradient(#9b4834,#602d26);border-color:#e0a46a}
.commander-actions button[aria-pressed=true]{background:#8c7342;box-shadow:0 0 16px #eec87977}
.commander-actions button:disabled{opacity:.5}
.commander-actions button:focus-visible{outline:3px solid #ffe2a0;outline-offset:3px}
.commander-hint{position:absolute;bottom:7px;left:50%;transform:translateX(-50%);margin:0;width:max-content;max-width:96%;text-align:center;padding:4px 9px;border-radius:3px;background:#1e2b24c9;color:#dfcfad;font-size:11px}
.commander-stick{position:absolute;left:30px;bottom:43px;width:100px;height:100px;border:1px solid #d5bf8e88;border-radius:50%;background:#1c2b25a8;pointer-events:auto;touch-action:none}
.commander-stick i{position:absolute;left:30px;top:30px;width:38px;height:38px;border:1px solid #d3bd87;border-radius:50%;background:radial-gradient(#a58c5b,#524f37);box-shadow:0 3px 10px #0006;pointer-events:none}
.battle-action.battle-modal-open .commander-ui{visibility:hidden}
@media(max-width:760px),(pointer:coarse){
 .commander-vitals{top:70px;left:10px;width:175px;padding:8px 10px}.commander-vitals strong{font-size:16px;margin-bottom:5px}
 .commander-objective{top:72px;left:auto;right:10px;transform:none;max-width:48%;font-size:11px;padding:6px 10px}
 .commander-actions{right:14px;bottom:37px;grid-template-columns:repeat(2,76px);gap:7px}.commander-actions button{min-height:48px;min-width:72px;font-size:11px}
 .commander-stick{left:20px;bottom:42px;width:100px;height:100px}.commander-hint{font-size:10px;bottom:7px}
}
@media(max-width:480px){.commander-vitals{top:120px;width:170px}.commander-objective{top:236px;left:10px;right:auto;max-width:calc(100% - 20px)}.commander-actions{right:12px}.commander-hint{max-width:95%;white-space:normal}}
@media(max-height:480px) and (min-width:481px){.commander-vitals{top:66px;width:164px;padding:6px 9px}.commander-vitals strong{font-size:14px;margin-bottom:3px}.commander-vitals small{font-size:9px;margin-top:4px}.commander-objective{top:64px}.commander-actions{bottom:26px}.commander-stick{bottom:29px;width:90px;height:90px}.commander-stick i{left:25px;top:25px}.commander-hint{bottom:2px}}
@media(min-width:1101px) and (min-height:601px) and (pointer:fine){.commander-vitals{top:138px}.battle-action .battle-notice{top:86px;left:auto;right:14px;transform:none;max-width:280px}}
.battle-action .battle-field{cursor:crosshair}
.battle-action .battle-top-actions{z-index:2}
.commander-exit{pointer-events:auto;font:11px system-ui;color:#ffe2aa;text-decoration:underline;text-underline-offset:3px;min-height:28px;margin-top:4px;padding:3px 0}
@media(pointer:coarse){.commander-exit{min-height:44px}}
@media(max-height:480px){.commander-vitals small{display:none}.commander-exit{margin:0}.commander-vitals strong{margin:0}}
@media(max-width:480px){.commander-objective{top:280px}}
/* Keep the touch controls available when hiding secondary battle information. */
.battle-hud-hidden .commander-vitals,.battle-hud-hidden .commander-objective,.battle-hud-hidden .commander-hint{display:none}
/* The practice exit is a text action, not one of the collapsed guide's icon buttons. */
.compact-ui #battle-screen .commander-exit{display:block;width:auto;max-width:100%;padding:3px 0;white-space:nowrap;text-align:left}
.combat-feedback{position:absolute;left:50%;top:calc(52% - 154px);transform:translateX(-50%);padding:7px 13px;border:1px solid #d6bd7f88;border-radius:3px;background:#202b24ed;color:#ffe6a9;font:700 14px system-ui;white-space:nowrap;text-shadow:0 1px 2px #111;box-shadow:0 3px 12px #14201766;opacity:clamp(0,calc((1 - var(--impact-progress,0))*2.5),1);pointer-events:none}
.combat-feedback[data-kind=hurt],.combat-feedback[data-kind=guard-break]{color:#ffc4af;border-color:#c37661}
.combat-feedback[data-kind=block],.combat-feedback[data-kind=parry],.combat-feedback[data-kind=enemy-block],.combat-feedback[data-kind=evade]{color:#c8eef3;border-color:#8bb7c2}
.combat-feedback[data-kind=miss],.combat-feedback[data-kind=tired]{color:#ddd2b8;border-color:#a59c7f}
@media(max-height:480px){.combat-feedback{top:calc(52% - 134px);font-size:12px;padding:5px 9px}}

@media(max-width:480px){.combat-feedback{top:calc(52% - 133px)}}

/* Passive command aura keeps its count visible even in the compact battle HUD. */
.commander-aura{margin-top:8px;padding-top:6px;border-top:1px solid #e0bc6b44;font-size:11px;font-weight:600;color:#f5d78b}
.commander-aura-bonus{display:block;font-size:9px;font-weight:400;color:#d8cbaa;margin-top:3px}
.commander-aura[data-active=false]{color:#a9afa5}
@media(max-height:480px){.commander-aura{margin-top:3px;padding-top:3px;font-size:10px}.commander-aura-bonus{display:none}}
@media(max-width:480px){.commander-objective{top:346px}}

@media(max-width:760px),(pointer:coarse){.commander-actions button[data-hero-action=dodge]{grid-column:1/-1}}

/* Critical morale feedback stays visible even with the secondary HUD collapsed. */
.battle-morale{position:absolute;top:82px;left:50%;transform:translateX(-50%);box-sizing:border-box;width:max-content;max-width:min(430px,calc(100% - 24px));padding:8px 12px;border:1px solid var(--morale-danger);border-left-width:4px;border-radius:4px;background:var(--morale-back);color:var(--morale-danger);box-shadow:0 3px 12px #17221966;pointer-events:none;z-index:3}
.battle-morale[hidden]{display:none}.battle-morale strong,.battle-morale span{display:block}.battle-morale strong{font:700 14px system-ui}.battle-morale span{font:12px/1.4 system-ui;margin-top:3px;color:#fff0d4}.battle-morale[data-warning=low]{border-color:var(--morale-warning);color:var(--morale-warning)}
.battle-morale:not([hidden])~.commander-ui .commander-objective{visibility:hidden}
.battle-unit-card.routed:not(.fallen){opacity:1;border-color:#b05132;background:var(--papyrus-inset);box-shadow:inset 0 0 0 2px #b0513244}
@media(pointer:coarse),(max-width:1100px) and (max-height:600px),(max-width:760px){.battle-morale{top:calc(max(8px,env(safe-area-inset-top)) + 54px);left:auto;right:max(8px,env(safe-area-inset-right));transform:none;max-width:calc(100% - 210px);padding:6px 9px}.battle-morale strong{font-size:12px}.battle-morale span{font-size:11px}}
@media(max-width:480px){.battle-morale{top:calc(max(8px,env(safe-area-inset-top)) + 112px);max-width:calc(100% - 202px)}}
