/* Mobile battle layout: information above, unobstructed arena, thumb controls below. */
#game[data-page=battle] .hud{padding:10px 12px;isolation:isolate}
#game[data-page=battle] .hud>.top{gap:8px}
#game[data-page=battle] .wave{min-height:51px;padding:9px 12px;border-radius:14px}
#game[data-page=battle] .wave small{font-size:10px;letter-spacing:1px}
#game[data-page=battle] .wave #boss-label{font-size:8px!important;margin-top:4px!important}
#game[data-page=battle] .hud .top>.iconbtn{width:44px;height:44px;border-radius:12px;font-size:14px}
#game[data-page=battle] .battle-counts{top:72px;left:12px;gap:6px}
#game[data-page=battle] .counter-pill{min-width:80px;padding:6px 9px;border-radius:11px;gap:7px}
#game[data-page=battle] .counter-pill b{font-size:18px}
#game[data-page=battle] .counter-pill small{font-size:7px}
#game[data-page=battle] .camera-control{top:72px;right:12px;width:70px;min-height:44px;font-size:8px}
#game[data-page=battle] .camera-reset{top:124px;right:12px;width:70px;min-height:44px;font-size:8px}
#game[data-page=battle] .camera-pan{display:none}
#game[data-page=battle] .hpbox{position:absolute;top:124px;left:12px;right:90px;bottom:auto;width:auto;min-height:39px;padding:8px 10px;border-radius:11px;font-size:8px;box-shadow:none}
#game[data-page=battle] .hpbox #base-value{font-size:10px}
#game[data-page=battle] .hpbox .bar{margin-top:5px;height:5px}
#game[data-page=battle] .hpbox #army-value{display:none}
#game[data-page=battle] .battle-bottom{position:static;inset:auto}
#game[data-page=battle] .battle-hint{top:177px;left:12px;right:90px;font-size:8px;line-height:1.4}
#game[data-page=battle] .combo-meter{top:109px;left:12px;font-size:9px}
#game[data-page=battle] #siege-notice,#game[data-page=battle] #tactics-callout{top:177px;left:12px;right:90px;bottom:auto;max-width:none;font-size:9px;line-height:1.4;max-height:48px;overflow:hidden}
#game[data-page=battle]:has(#siege-notice:not(:empty)) #tactics-callout{display:none}
#game[data-page=battle]:has(#siege-notice:not(:empty),#tactics-callout:not(:empty)) .battle-hint{visibility:hidden}
.battle-control-base{position:absolute;left:0;right:0;bottom:0;height:154px;background:linear-gradient(0deg,#0b1929fa 5%,#102238f5 76%,#10223800);z-index:-1;pointer-events:none}
.move-pad{position:absolute;left:12px;bottom:max(20px,env(safe-area-inset-bottom));display:flex;gap:6px;pointer-events:none}
.move-button{display:flex;flex-direction:column;align-items:center;justify-content:center;width:52px;height:58px;min-width:44px;min-height:44px;background:#213c54;border:1px solid #9dc6db88;border-radius:15px;color:#e0f6ff;box-shadow:0 3px 0 #061525;pointer-events:auto;touch-action:none!important;user-select:none}
.move-button b{font-size:25px;line-height:1}
.move-button small{font-size:7px;letter-spacing:.7px;margin-top:5px}
.move-button.move-pressed{background:#286d75;border-color:#b3fff2;transform:translateY(2px);box-shadow:0 1px 0 #061525}
#game[data-page=battle] .special{position:absolute;bottom:max(18px,env(safe-area-inset-bottom));right:12px;width:62px;height:62px;padding:4px;border-radius:50%}
#game[data-page=battle] .special-pet{width:45px;height:45px}
#game[data-page=battle] .special em{font-size:19px!important}
#game[data-page=battle] #siege-controls{display:contents}
#game[data-page=battle] #siege-controls[hidden]{display:none}
#game[data-page=battle] #weapon-fire{position:absolute;left:130px;right:86px;bottom:max(20px,env(safe-area-inset-bottom));height:58px;min-height:58px;padding:7px 6px;border-radius:15px;font-size:9px;line-height:1.3;background:#394337;border-color:#ddcf90;color:#fff0b3}
#game[data-page=battle] #weapon-fire small{font-size:8px;margin-top:5px}
#game[data-page=battle] #arsenal-toggle{position:absolute;left:12px;bottom:94px;width:70px;height:44px;padding:6px;font-size:8px;border-radius:12px}
#game[data-page=battle] #fusion-button{position:absolute;right:12px;bottom:94px;width:62px;height:44px;padding:5px;font-size:8px;border-radius:12px}
#game[data-page=battle] #arsenal-toggle small{display:none}
#game[data-page=battle] .field-orders{left:90px;right:82px;bottom:94px;gap:5px;height:44px}
#game[data-page=battle] .field-orders button{flex:1;min-width:0;min-height:44px;height:44px;display:flex;flex-direction:column;justify-content:center;gap:3px;padding:3px;border-radius:11px}
#game[data-page=battle] .field-orders .ui-icon{width:16px;height:16px}
#game[data-page=battle] .field-orders b{font-size:7px;letter-spacing:0}
#game[data-page=battle] .field-orders small{position:absolute;right:3px;top:2px;font-size:7px}
#game[data-page=battle] .upicons{top:111px;bottom:auto;left:13px;max-width:190px;height:9px;overflow:hidden;opacity:.7}
#game[data-page=battle] .upicons .ui-icon{width:9px;height:9px}
#game[data-page=battle] .upgrade-prompt{left:auto;right:12px;top:176px;bottom:auto;width:70px;max-width:70px;min-height:44px;padding:6px 4px;font-size:7px;border-radius:12px}
#game[data-page=battle] #arsenal-panel{left:8px;right:8px;bottom:151px;max-height:166px;overflow-y:auto;padding:8px;border-radius:16px;background:#102137f5;box-shadow:0 4px 18px #07112066;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:5px;z-index:17}
#game[data-page=battle] #arsenal-panel[hidden]{display:none}
#game[data-page=battle] .arsenal-heading{grid-column:1/-1;min-height:32px;font-size:9px}
#game[data-page=battle] .arsenal-heading button{min-height:44px;min-width:44px;font-size:8px}
#game[data-page=battle] #arsenal-panel>[data-weapon]{margin:0;padding:5px 3px;min-height:70px;display:flex;flex-direction:column;gap:4px;justify-content:center;position:relative;text-align:center;border-radius:10px}
#game[data-page=battle] #arsenal-panel .ui-icon{width:23px;height:23px;margin:0}
#game[data-page=battle] #arsenal-panel b{font-size:7px;line-height:1.3}
#game[data-page=battle] #arsenal-panel small{display:none}
#game[data-page=battle] #arsenal-panel em{font-size:6px}
#game[data-page=battle] #arsenal-panel>p{grid-column:1/-1;font-size:8px;line-height:1.3;margin:0;max-height:24px;overflow:hidden}
#game[data-page=battle] .upgrade-dock{left:8px;right:8px;bottom:151px;z-index:17;gap:5px;padding:8px;background:#102137f5;border:1px solid #9cc9df66;border-radius:15px;max-height:175px;overflow-y:auto;pointer-events:auto}
#game[data-page=battle] .upgrade-dock button{padding:5px;min-height:72px;box-shadow:none;border-radius:10px}
#game[data-page=battle] .upgrade-dock b{font-size:8px;margin:4px 0}
#game[data-page=battle] .upgrade-dock small{font-size:8px;line-height:1.25;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
#game[data-page=battle] .upgrade-dock .ui-icon{width:19px;height:19px}
#game[data-page=battle] .upgrade-dock .dock-reroll{grid-column:auto;min-height:44px;font-size:8px;padding:6px}
#game[data-page=battle] .upgrade-dock .dock-close{grid-column:2/-1;min-height:44px;font-size:8px}
#game[data-page=battle] .tutorial-card{top:177px;left:12px;right:90px;padding:9px}
#game[data-page=battle] .tutorial-copy p{font-size:10px;line-height:1.4}
#game[data-page=battle] .tutorial-actions button{font-size:8px}
#game.battle-paused .move-pad,#game.battle-paused #arsenal-panel,#game.battle-paused #upgrade-dock{display:none}
@media(max-width:350px){#game[data-page=battle] .field-orders{left:86px;right:78px;gap:3px}#game[data-page=battle] .field-orders b{font-size:6px}#game[data-page=battle] #weapon-fire{font-size:8px}#game[data-page=battle] .counter-pill{min-width:72px}.move-button{width:52px}}

#game[data-page=battle] #upgrade-prompt{top:176px;bottom:auto!important;height:44px;min-height:44px;max-height:44px}#game[data-page=battle] #upgrade-dock{bottom:151px;max-height:175px}

/* Event-driven mobile polish: no blur filters, extra canvases or idle FX loops. */
#game[data-page=battle] .hud{--battle-cyan:#83e9ff;--battle-gold:#ffe3a4;--battle-panel:#101f35; font-family:system-ui,sans-serif}
#game[data-page=battle] .wave{position:relative;background:linear-gradient(135deg,#23354e,#101e33 75%);border:1px solid #a3c7e34d;border-top-color:#c4e5f579;padding:6px 12px 7px;box-shadow:inset 0 1px #fff1,0 4px 14px #06122455;min-height:51px;text-align:left}
.battle-sector{display:block;color:var(--world-accent,#b3f4d6);font-size:8px;line-height:12px;font-weight:800;letter-spacing:1px;text-transform:uppercase;white-space:nowrap}.battle-sector b{color:#9ab2c9;font-size:8px}
#game[data-page=battle] .wave small{font-size:11px;letter-spacing:1.1px;line-height:15px;color:#f2f9ff;font-weight:850}
#game[data-page=battle] .wave>.bar{height:4px;margin-top:5px;background:#061020;border:0;border-radius:4px}
#game[data-page=battle] .wave>.bar i{background:linear-gradient(90deg,#36bad9,#97f5e1);border-radius:4px;box-shadow:0 0 6px #79dfed55}
#game[data-page=battle] #boss-label:empty{display:none}
#game[data-page=battle] .wave{min-width:0}
#game[data-page=battle] .wave:has(#boss-health:not([hidden])) .battle-sector{display:none}
#game[data-page=battle] .boss-hp{height:3px;margin-top:3px}
#game[data-page=battle] .wave #boss-label{font-size:7px!important;line-height:9px;margin-top:2px!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#game[data-page=battle] .hud .top>.iconbtn{background:linear-gradient(145deg,#293d57,#13243b);border:1px solid #9ecae355;box-shadow:inset 0 1px #e4f7ff26,0 3px 0 #091425;color:#e2f6ff;font-weight:900}
#game[data-page=battle] .counter-pill{background:linear-gradient(120deg,#18374bfa,#122238f5);border-color:#72d4f266;border-left:3px solid #76e2ff;box-shadow:0 3px 9px #07172c44;min-height:37px}
#game[data-page=battle] .counter-pill.enemy{background:linear-gradient(120deg,#3c293ff5,#19243af5);border-color:#ef899855;border-left-color:#ff929d}
#game[data-page=battle] .counter-pill small{font-size:8px;letter-spacing:.6px;color:#d8e8f3;font-weight:750}
#game[data-page=battle] .counter-pill b{color:#94ecff;font-size:21px;letter-spacing:-.6px}
#game[data-page=battle] .counter-pill.enemy b{color:#ffacb4}
#game[data-page=battle] .hpbox{background:linear-gradient(110deg,#122b3df5,#13223af5);border-color:#87bfc34d;border-left:3px solid #a8edc3;box-shadow:0 3px 10px #07192a33}
#game[data-page=battle] .hpbox .row{font-weight:800;letter-spacing:.4px;color:#c6e6df;font-size:9px}
#game[data-page=battle] .hpbox .bar{height:5px;background:#071526;border:0}
#game[data-page=battle] .hpbox .bar i{border-radius:5px;transition:width .16s linear}
#game[data-page=battle] .base-danger .hpbox{border-color:#ff909c;background:#3b2036f5}
#game[data-page=battle] .camera-control,#game[data-page=battle] .camera-reset{background:linear-gradient(135deg,#20364cf5,#122238f5);border-color:#a4c6da44;color:#d1eaf3;font-weight:800;font-size:9px;box-shadow:inset 0 1px #c8efff10,0 3px 8px #06122433}
#game[data-page=battle] .camera-control[data-mode=FOLLOW]{border-color:#8ae3e6;color:#a4efff}
#game[data-page=battle] .battle-control-base{height:168px;background:linear-gradient(0deg,#091426 4%,#111f35fa 65%,#142943a8 84%,#14294300);border-radius:24px 24px 0 0;box-shadow:inset 0 -1px #78c6df22}
#game[data-page=battle] .move-pad:before{content:'HOLD TO STEER';position:absolute;top:-16px;width:100%;text-align:center;color:#9fc6db;font-size:7px;font-weight:800;letter-spacing:1.2px}
#game[data-page=battle] .move-button{background:linear-gradient(145deg,#294e67,#17314b);border:1px solid #8ad8ed88;border-bottom:3px solid #10233a;box-shadow:inset 0 1px #dcfaff26,0 4px 9px #0003;border-radius:17px;color:#baf2ff}
#game[data-page=battle] .move-button b{font-size:28px}#game[data-page=battle] .move-button small{color:#ccdfed;font-weight:800}
#game[data-page=battle] .move-button.move-pressed{background:linear-gradient(145deg,#328695,#20506c);border-color:#adf7ff;color:white}
#game[data-page=battle] #weapon-fire{border:1px solid #ffe3a4a8;border-bottom:3px solid #806443;background:linear-gradient(145deg,#ffe2a4,#eebd72);color:#352a32;box-shadow:inset 0 1px #fff7dfaa,0 4px 14px #e4bb5822;font-weight:900;letter-spacing:.1px;border-radius:17px}
#game[data-page=battle] #weapon-fire small{color:#5b4e4b;font-weight:800;letter-spacing:.4px;font-size:8px}
#game[data-page=battle] #weapon-fire:disabled{background:linear-gradient(135deg,#3b3e49,#293246);color:#c2c8d1;border-color:#8698a64d;box-shadow:inset 0 1px #d8e4f011;border-bottom-color:#132238;opacity:1}
#game[data-page=battle] #weapon-fire:disabled small{color:#a6b5c5}
#game[data-page=battle] .field-orders button,#game[data-page=battle] #arsenal-toggle,#game[data-page=battle] #fusion-button{background:linear-gradient(145deg,#243b56,#14243c);border:1px solid #91bfd74d;box-shadow:inset 0 1px #d7f1ff18,0 3px 0 #091426;color:#d1e9f3;font-weight:800}
#game[data-page=battle] .field-orders button b{font-size:8px;color:#cce3ef}
#game[data-page=battle] #fusion-button:not(:disabled){border-color:#ccbbfa99;color:#e8d8ff;background:linear-gradient(135deg,#493b6a,#25304b)}
#game[data-page=battle] .special{border-color:#ffe5a5;background:radial-gradient(circle at 40% 25%,#426079,#192b47 72%);box-shadow:0 0 0 3px #091529,0 0 0 4px #dfc78566,0 4px 12px #030b1a88}
#game[data-page=battle] .special.ability-ready{border-color:#fff0b8;box-shadow:0 0 0 3px #091529,0 0 0 4px #ffe3a4,0 3px 15px #f3c77533}
#game[data-page=battle] .upgrade-prompt{background:linear-gradient(135deg,#354467,#202d4b);border-color:#e6d09688;color:#ffe6ac;box-shadow:inset 0 1px #fff2,0 3px 8px #06142c44;font-weight:850}
#game[data-page=battle] #arsenal-panel,#game[data-page=battle] #upgrade-dock{background:linear-gradient(145deg,#22324afc,#101f35fc);border-color:#99cce76b;border-top:2px solid var(--world-accent,#98e8d4);box-shadow:0 -5px 22px #06142566}
#game[data-page=battle] #arsenal-panel>[data-weapon]{background:linear-gradient(155deg,#2a3f59,#182940);border-color:#8caec344}
#game[data-page=battle] #arsenal-panel>[data-weapon].equipped{background:linear-gradient(145deg,#2c5967,#20364e);border-color:#9cecff;box-shadow:inset 0 1px #e1fcff33}
#game[data-page=battle] .arsenal-heading{color:#eaf7ff;letter-spacing:.8px}
#game[data-page=battle] .battle-hint,#game[data-page=battle] #siege-notice,#game[data-page=battle] #tactics-callout{color:#e1edf5;text-shadow:0 1px 3px #071021;font-size:10px;letter-spacing:0}
#game[data-page=battle] .combo-meter{background:#14213b;color:#ffe6a4;border-radius:6px;padding:2px 6px;font-weight:900}
#game[data-page=battle] .combo-meter:empty{display:none}
.hud .battle-tap{animation:battle-tap .36s ease-out}.hud .battle-impact{animation:battle-impact .45s ease-out}.hud .battle-celebrate{animation:battle-celebrate .48s ease-out}
@keyframes battle-tap{0%{filter:brightness(1.4);transform:scale(.95)}100%{filter:brightness(1);transform:scale(1)}}
@keyframes battle-impact{0%,40%{border-color:#ff9d9d;background:#52273b}20%{transform:translateX(-2px)}60%{transform:translateX(2px)}100%{transform:translateX(0)}}
@keyframes battle-celebrate{25%{transform:scale(1.035);border-color:#fff0b9}100%{transform:scale(1)}}
.hud[data-effects=low] .battle-tap{animation:none}.hud[data-effects=low] .battle-celebrate{animation:none}
@media(max-width:350px){.battle-sector{font-size:7px;letter-spacing:.4px}#game[data-page=battle] .field-orders button b{font-size:6px}#game[data-page=battle] .battle-hint,#game[data-page=battle] #siege-notice,#game[data-page=battle] #tactics-callout{font-size:9px}}
@media(prefers-reduced-motion:reduce){.hud .battle-tap,.hud .battle-impact,.hud .battle-celebrate{animation:none!important}#game[data-page=battle] .hpbox .bar i{transition:none}}

/* Warning stays at the edge and never intercepts combat controls. */
#game[data-page=battle].critical-health::after{content:"";position:absolute;inset:0;z-index:9;pointer-events:none;box-shadow:inset 0 0 46px 12px #f1274066;animation:critical-pulse 1.4s ease-in-out infinite}
@keyframes critical-pulse{50%{box-shadow:inset 0 0 70px 18px #f1274099}}
@media(prefers-reduced-motion:reduce){#game[data-page=battle].critical-health::after{animation:none}}
