html body main[data-hud] #battle #aht,
html body main[data-hud] #battle #bht{
  flex:0 0 84px!important;
  width:84px!important;
  min-width:84px!important;
  max-width:none!important;
  overflow:visible!important;
  font-size:12px!important;
}
/* PvE fight fits the phone: HUD, both fighters on the arena floor, then six
   buttons the same size as a Dexrun boss fight. Nothing scrolls.
   PvP is unchanged because these rules require body.pve-mode. */
body.pve-mode:has(#battle:not(.hide)){
  height:100dvh!important;
  overflow:hidden!important;
}
body.pve-mode main:has(#battle:not(.hide)){
  height:100dvh!important;
  max-height:100dvh!important;
  display:flex!important;
  flex-direction:column!important;
  overflow:hidden!important;
}
body.pve-mode #battle:not(.hide){
  display:flex!important;
  flex-direction:column!important;
  flex:1 1 auto!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  overflow:hidden!important;
  box-sizing:border-box!important;
}
body.pve-mode #battle:not(.hide) > #arena{
  flex:1 1 0!important;
  min-height:0!important;
  height:auto!important;
  display:flex!important;
  flex-direction:column!important;
  overflow:hidden!important;
}
body.pve-mode #battle .arena-hud{
  flex:0 0 auto!important;
}
body.pve-mode:has(#battle:not(.hide)) .battle-utility-bar,
body.pve-mode:has(#battle:not(.hide)) #hudLaunch,
body.pve-mode:has(#battle:not(.hide)) #beaniverseGlobalNav,
body.pve-mode:has(#battle:not(.hide)) #dexaGlobalMusicBtn{
  display:none!important;
}
body.pve-mode main[data-hud] #battle .pve-parity-arena .arena-hud > .f > .hp-row > #aht,
body.pve-mode main[data-hud] #battle .pve-parity-arena .arena-hud > .f > .hp-row > #bht{
  flex:0 0 84px!important;
  width:84px!important;
  min-width:84px!important;
  max-width:none!important;
  overflow:hidden!important;
  font-size:13px!important;
}
body.pve-mode #battle .arena-hud > .f > b{
  display:block!important;
  margin:0 0 2px!important;
  color:#fff!important;
  font:900 13px/1.2 system-ui,sans-serif!important;
  text-shadow:0 2px 4px #000!important;
  white-space:nowrap!important;
}
body.pve-mode main[data-hud] #battle .pve-parity-arena .arena-hud > .f > .hp-row > .hp-readout{
  flex:0 0 84px!important;
  width:84px!important;
  min-width:84px!important;
  max-width:none!important;
  overflow:hidden!important;
  font-size:13px!important;
}
body.pve-mode #battle .icons.clash{
  flex:1 1 auto!important;
  min-height:0!important;
  height:auto!important;
  align-items:flex-end!important;
  justify-content:space-between!important;
  padding:0 var(--fighter-edge-inset, 8px) 4px!important;
}
/* SPI-12 size parity: PvE no longer overrides the fighter host or art size.
   FighterDrawScale + fight_fit.css own size and stance, exactly as in PvP
   (269px x --sprite-size-factor, ring 15/85 portrait, 30/70 landscape). */
html:not([data-pve-dexatron-approved="1"]) body.pve-mode #battle .icons.clash #bi .arena-art{
  scale:-1 1!important;
}
body.pve-mode #battle > .moves{
  flex:0 0 auto!important;
  display:grid!important;
  grid-template-columns:repeat(2, minmax(0, 1fr))!important;
  column-gap:8px!important;
  row-gap:18px!important;
  width:100%!important;
  margin:0!important;
  padding:0 8px 18px!important;
  box-sizing:border-box!important;
}
body.pve-mode #battle > .moves + .moves,
body.pve-mode #battle .battle-history{
  display:none!important;
}
body.pve-mode #battle > .moves > :is(#strike,#lightPower,#ability,#guard,#regen,#siphon){
  aspect-ratio:auto!important;
  width:100%!important;
  max-width:none!important;
  height:clamp(40px, 6.2vh, 56px)!important;
  min-height:40px!important;
  max-height:56px!important;
  margin:0!important;
  /* Button artwork sizing is owned by the shared scene. */
}
@media (max-height: 520px){
  body:has(#battle:not(.hide)) #beaniverseGlobalNav,
  body:has(#battle:not(.hide)) #dexaGlobalMusicBtn,
  body:has(#battle:not(.hide)) .battle-utility-bar,
  body:has(#battle:not(.hide)) #hudLaunch{
    display:none!important;
  }
  #battle .battle-history{display:none!important;}
  body main[data-hud] #battle .pve-parity-arena .arena-hud > .f > .hp-row > .hp-readout{
    flex:0 0 84px!important;
    width:84px!important;
    min-width:84px!important;
    overflow:visible!important;
    font-size:12px!important;
  }
  body:has(#battle:not(.hide)){
    height:100dvh!important;
    overflow:hidden!important;
    background-position:center 92%!important;
    background-size:cover!important;
  }
  body:has(#battle:not(.hide)) main{
    height:100dvh!important;
    max-height:100dvh!important;
    display:flex!important;
    flex-direction:column!important;
    overflow:hidden!important;
  }
  #battle:not(.hide){
    flex:1 1 auto!important;
    min-height:0!important;
    max-height:100dvh!important;
    overflow:hidden!important;
    display:flex!important;
    flex-direction:column!important;
  }
  #battle:not(.hide) > #arena{
    flex:1 1 0!important;
    min-height:0!important;
    display:flex!important;
    flex-direction:column!important;
  }
  #battle:not(.hide) > #arena{
    position:relative!important;
    overflow:visible!important;
  }
  #battle .pve-parity-arena .icons.clash{
    position:absolute!important;
    left:var(--fighter-edge-inset, 8px)!important;
    right:var(--fighter-edge-inset, 8px)!important;
    bottom:196px!important;
    height:auto!important;
    min-height:0!important;
    align-items:flex-end!important;
    z-index:4!important;
  }
  html:not([data-pve-dexatron-approved="1"]) #battle .pve-parity-arena .icons.clash .arena-art{
    height:min(38vh, 156px)!important;
  }
  html:not([data-pve-dexatron-approved="1"]) #battle .pve-parity-arena .icons.clash #bi .arena-art{
    scale:-1 1!important;
  }
  #battle .arena-hud > .f > b{
    overflow:visible!important;
    text-overflow:clip!important;
    white-space:nowrap!important;
    font-size:13px!important;
  }
  #battle .arena-hud .hp-readout{
    flex:0 0 84px!important;
    width:84px!important;
    min-width:84px!important;
    overflow:visible!important;
    font-size:12px!important;
  }
  body main[data-hud] #battle > .moves,
  body.pve-mode #battle > .moves{
    position:absolute!important;
    left:50%!important;
    bottom:6px!important;
    transform:translateX(-50%)!important;
    width:min(560px, 94%)!important;
    margin:0!important;
    justify-items:stretch!important;
    column-gap:8px!important;
    row-gap:2px!important;
    z-index:6!important;
    overflow:visible!important;
  }
  body main[data-hud] #battle > .moves > :is(#strike,#lightPower,#ability,#guard,#regen,#siphon),
  body.pve-mode #battle > .moves > :is(#strike,#lightPower,#ability,#guard,#regen,#siphon){
    width:100%!important;
    max-width:none!important;
    height:40px!important;
    min-height:40px!important;
    max-height:40px!important;
    margin:0 0 16px!important;
    overflow:visible!important;
    /* Portrait/landscape button art uses the shared two-layer sizing. */
  }
  body main[data-hud] #battle > .moves > :is(#strike,#lightPower,#ability,#guard,#regen,#siphon)::after{
    letter-spacing:0!important;
    overflow:visible!important;
    height:16px!important;
    font-size:11px!important;
    white-space:nowrap!important;
  }
}

/* Combat artwork, frame and energy captions are owned by HudPackScene.
   Do not re-introduce per-fighter [data-pve-buttons] art overrides here. */
/* One readout size on every pack, including the older Emberfall 40px pin. */
main[data-hud] #battle .pve-parity-arena .arena-hud > .f > .hp-row > .hp-readout,
main[data-hud="hud_emberfall"] #battle .pve-parity-arena > .arena-hud > .f > .hp-row > .hp-readout{
  position:static!important;left:auto!important;right:auto!important;top:auto!important;
  width:84px!important;min-width:84px!important;max-width:84px!important;
  height:16px!important;flex:0 0 84px!important;
  font:900 13px/16px ui-sans-serif,system-ui,Arial,sans-serif!important;
  overflow:hidden!important;
}
main[data-hud="hud_emberfall"] #battle #arena > .arena-hud > .f > .hp-row{
  position:relative!important;left:auto!important;right:auto!important;
  width:100%!important;max-width:none!important;
}
main[data-hud="hud_emberfall"] #battle #arena > .arena-hud > .f > .resource-bar{
  position:relative!important;left:auto!important;right:auto!important;
  width:calc(100% - 91px)!important;max-width:none!important;
  margin:0 0 0 91px!important;
}
main[data-hud="hud_emberfall"] #battle #arena > .arena-hud > .f.r > .resource-bar{
  margin:0 91px 0 0!important;
}
#battle .pve-parity-arena .arena-hud .stats,
#battle .pve-parity-arena .arena-hud .resource-label{
  display:block!important;min-height:16px!important;height:auto!important;
  margin:0!important;padding:0!important;
  font:900 12px/16px ui-sans-serif,system-ui,Arial,sans-serif!important;
  color:#fff!important;white-space:nowrap!important;overflow:hidden!important;
}
/* Emberfall's older absolute lanes use a 40px number. The shared row wins. */
html body main[data-hud="hud_emberfall"] #battle #arena > .arena-hud.fight{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  grid-template-rows:repeat(9,auto)!important;
  height:auto!important;max-height:none!important;aspect-ratio:auto!important;
}
html body main[data-hud="hud_emberfall"] #battle #arena > .arena-hud.fight > .f,
html body main[data-hud="hud_emberfall"] #battle #arena > .arena-hud.fight > .f.r{
  position:relative!important;display:grid!important;
  left:auto!important;right:auto!important;top:auto!important;
  width:100%!important;height:auto!important;max-width:100%!important;
  min-width:0!important;transform:none!important;
  grid-template-rows:subgrid!important;grid-row:1 / span 9!important;
}
html body main[data-hud="hud_emberfall"] #battle #arena > .arena-hud.fight > .f > .hp-row,
html body main[data-hud="hud_emberfall"] #battle #arena > .arena-hud.fight > .f.r > .hp-row{
  position:relative!important;display:flex!important;flex-direction:row!important;
  align-items:center!important;left:auto!important;right:auto!important;top:auto!important;
  width:100%!important;max-width:none!important;height:auto!important;max-height:none!important;
}
html body main[data-hud="hud_emberfall"] #battle #arena > .arena-hud.fight > .f > .hp-row > #ahealthbar,
html body main[data-hud="hud_emberfall"] #battle #arena > .arena-hud.fight > .f > .hp-row > #bhealthbar{
  position:relative!important;flex:1 1 auto!important;width:auto!important;max-width:none!important;
  height:9px!important;min-height:9px!important;max-height:9px!important;
}
html body main[data-hud="hud_emberfall"] #battle #arena > .arena-hud.fight > #aenergybar,
html body main[data-hud="hud_emberfall"] #battle #arena > .arena-hud.fight > #ashieldbar,
html body main[data-hud="hud_emberfall"] #battle #arena > .arena-hud.fight .f > #aenergybar,
html body main[data-hud="hud_emberfall"] #battle #arena > .arena-hud.fight .f > #ashieldbar,
html body main[data-hud="hud_emberfall"] #battle #arena > .arena-hud.fight .f > #benergybar,
html body main[data-hud="hud_emberfall"] #battle #arena > .arena-hud.fight .f > #bshieldbar{
  position:relative!important;left:auto!important;right:auto!important;top:auto!important;
  width:calc(100% - 91px)!important;max-width:none!important;height:9px!important;max-height:9px!important;
  margin:0 0 0 91px!important;
}
html body main[data-hud="hud_emberfall"] #battle #arena > .arena-hud.fight .f.r > #benergybar,
html body main[data-hud="hud_emberfall"] #battle #arena > .arena-hud.fight .f.r > #bshieldbar{
  margin:0 91px 0 0!important;
}
html body main[data-hud="hud_emberfall"] #battle #arena > .arena-hud > .f > .hp-row > #aht,
html body main[data-hud="hud_emberfall"] #battle #arena > .arena-hud > .f > .hp-row > #bht{
  position:static!important;left:auto!important;right:auto!important;top:auto!important;
  width:84px!important;min-width:84px!important;max-width:84px!important;
  height:16px!important;flex:0 0 84px!important;
  font:900 13px/16px ui-sans-serif,system-ui,Arial,sans-serif!important;
  overflow:hidden!important;
}
