.viewport:has(.battle:not([hidden])){min-height:0;aspect-ratio:auto;width:100%;min-width:0}
.viewport:has(.battle:not([hidden]))>#world,.viewport:has(.battle:not([hidden]))>.map-tag,.viewport:has(.battle:not([hidden]))>.map-legend{display:none}
.battle{position:relative;inset:auto;background:#152238}
.battle-sky{height:350px;min-height:350px;flex:none;overflow:hidden}
.battle-stage-label{top:12px;left:14px;right:14px;color:#fff4cd;background:#172a46dc;padding:9px 12px;border-left:3px solid #e8c879;font:10px Consolas,monospace;letter-spacing:1px}
.opponent-card,.player-card{position:absolute;z-index:1;width:245px;max-width:48%;background:#fff8dfef;color:#25364b;border:2px solid #3a5265;border-radius:4px 14px;box-shadow:3px 4px 0 #19283c55;padding:10px 12px}
.opponent-card{top:62px;left:18px;right:auto}
.player-card{bottom:15px;right:18px;left:auto}
.opponent-card p,.player-card p{margin:0 0 4px;font:bold 17px Consolas,monospace}
.opponent-card>span,.player-card>span{display:block;font:10px Consolas,monospace;line-height:1.5}
.player-card p span{float:right;font-size:10px}
.hp-row{margin-top:8px;gap:6px}.hp-row>b{font-size:10px}.hp-track{height:10px;background:#d3d5bd;border:2px solid #4b5a56}.hp-row small{font-size:10px;min-width:48px}
.battle-console{border-top:4px solid #e6ce93;background:#17273a;padding:14px}
.battle-command{display:flex;justify-content:space-between;gap:12px;font:10px Consolas,monospace;color:#e3cf9b;margin-bottom:10px}
#battle-log{min-height:48px;margin:0 0 10px;padding:10px;border:1px solid #617483;background:#0d1d2c;border-radius:4px;font:12px/1.6 Consolas,monospace;color:#fff3d4}
.move-button{min-height:62px;background:#233b50;border:1px solid #5b7c8e;border-left:4px solid var(--move-color,#92c6d6);border-radius:4px;padding:9px 11px}
.move-button strong{font:600 12px/1.4 Consolas,monospace}
.move-button small{font:9px Consolas,monospace;color:#c3d4db}
.move-button .move-power{font-size:9px;color:#e9dfba}
.move-button .move-power{flex-shrink:0}
.counter-preview{display:block;white-space:nowrap;font-size:8px;color:#c3d4db;margin-top:3px}
.move-button.effective{border-color:#d6d99b;border-left-color:var(--move-color)}
.move-button:disabled{cursor:not-allowed}
.move-button.move-used{background:#2c4850}
#battle-coverage{font:10px/1.6 Consolas,monospace;color:#e3cf9b;margin:0 0 10px}
.battle-keyboard{font:10px/1.6 Consolas,monospace;color:#c3d4db;margin:0 0 10px}
#battle-learning{border-left:3px solid #99d9c0;background:#203b45;padding:10px;margin-bottom:10px;color:#e2f1e4;font:11px/1.6 Consolas,monospace}
#battle-learning strong{display:block;color:#c9e6a3}
#battle-learning p{margin:5px 0 0}
#battle-reaction{font-style:italic;color:#f5dcad}
.battle-tools{gap:10px;margin-top:12px}.battle-tools>button{padding:10px;background:#28445a;border:1px solid #577587;border-radius:4px;font:10px Consolas,monospace;min-height:38px}
.battle-tools>button:last-child{background:transparent}
.scene-nav #scene-challenge{border-color:#d6d99b;background:#354b33;color:#f2e7b5}
@media(max-width:540px){
  .battle-sky{height:clamp(180px,28svh,230px);min-height:180px}
  .battle-stage-label{font-size:8px;left:6px;right:6px;top:6px;padding:5px 7px;letter-spacing:0}
  .opponent-card,.player-card{max-width:56%;width:190px;padding:5px 6px;border-width:1px}
  .opponent-card{left:6px;top:31px}.player-card{right:6px;bottom:6px}
  .opponent-card p,.player-card p{font-size:12px;margin-bottom:2px}
  .opponent-card>span,.player-card>span{font-size:8px;line-height:1.3}
  .hp-row{margin-top:4px;gap:3px}.hp-row small{font-size:8px;min-width:40px}
  .battle-console{padding:8px;display:flex;flex-direction:column}
  .battle-command{order:0}.battle-console .moves{order:1;gap:6px}
  .battle-tools{order:2;margin:6px 0 8px}
  #battle-coverage{order:3;margin-bottom:6px}
  #battle-log{order:4}.battle-keyboard{display:none}
  #battle-learning{order:5;margin:0;padding:8px}
  .move-button{padding:7px 6px;min-height:60px;gap:4px}
  .move-button strong{font-size:10px}.move-button small{font-size:8px}
  .move-button .move-power{font-size:8px;white-space:normal;text-align:right}
  .battle-tools>button{font-size:10px;padding:9px 6px;min-height:44px}
  #battle-log{font-size:11px;min-height:0;padding:8px;margin-bottom:8px}
  .battle-command{font-size:9px;margin-bottom:6px}
  .game-shell:has(.battle:not([hidden]))>.touch-controls{display:none}
}
@media(prefers-reduced-motion:reduce){.hp-track>div{transition:none}}
