/* Fight fit (JYN-45 B). Loaded last on /pvp.
   During a fight the page is one 100dvh flex column: top nav, then main,
   then #battle, then #arena. The clash stage takes whatever height is left,
   so all six move buttons sit on screen without scrolling (390x844 phones,
   1280x800 desktops) in PvE, PvP, 3v3, Best-of-3, Tournament and Clan War,
   with the default HUD and every pack. If a screen is too short even with
   the stage at its minimum, the page still scrolls rather than hiding the
   buttons. Stacking order is left alone. */

/* Fighter sprites stand partly outside the 390px column; clip them instead
   of letting them widen the page (it used to scroll sideways to 458px). */
html:has(#battle:not(.hide)),
body:has(#battle:not(.hide)){overflow-x:clip!important}

body:has(#battle:not(.hide)){
  display:flex!important;flex-direction:column!important;
  height:100dvh!important;min-height:0!important;box-sizing:border-box!important;
}
body:has(#battle:not(.hide)) > :not(main){flex:0 0 auto!important}
body:has(#battle:not(.hide)) > main{
  flex:1 1 0!important;height:auto!important;min-height:0!important;max-height:none!important;
  width:100%!important;box-sizing:border-box!important;
  display:flex!important;flex-direction:column!important;
  padding-bottom:env(safe-area-inset-bottom,0px)!important;
}
body:has(#battle:not(.hide)) > main > :not(#battle){flex:0 0 auto!important}

main > #battle#battle:not(.hide){
  flex:1 1 0!important;min-height:0!important;height:auto!important;max-height:none!important;
  display:flex!important;flex-direction:column!important;
}
main > #battle#battle:not(.hide) > #arena{
  flex:1 1 0!important;min-height:0!important;height:auto!important;max-height:none!important;
}
/* The stage between the HUD plate and the buttons absorbs the spare
   height; FighterDrawScale then stands the fighters on the button top. */
main > #battle#battle:not(.hide) > #arena > .icons.clash{
  flex:1 1 0!important;min-height:96px!important;height:auto!important;
}
main > #battle#battle:not(.hide) > .moves{
  flex:0 0 auto!important;margin:6px auto 0!important;row-gap:0!important;
}
main > #battle#battle:not(.hide) > .moves:empty{display:none!important}
main > #battle#battle:not(.hide) > .moves > :is(#strike,#lightPower,#ability,#guard,#regen,#siphon){
  height:clamp(44px,7vh,58px)!important;min-height:44px!important;max-height:58px!important;
  margin:0 auto 18px!important;
}
main > #battle#battle:not(.hide) > .battle-history{flex:0 0 auto!important;margin:0!important}

/* Same top chrome and the same sound/music pills in every fight mode.
   PvE used to hide the nav, HUD pill and music pill to make room, which
   left the SFX pill on top of the Regen / Life Siphon row and gave PvE
   fighters a different size from PvP. */
html body.pve-mode:has(#battle:not(.hide)) #beaniverseGlobalNav{display:flex!important}
html body.pve-mode:has(#battle:not(.hide)) .battle-utility-bar{display:flex!important}
html body.pve-mode:has(#battle:not(.hide)) #hudLaunch{display:inline-flex!important}
html body:has(#battle:not(.hide)) #dexaGlobalMusicBtn,
html body.pve-mode:has(#battle:not(.hide)) #dexaGlobalMusicBtn{
  display:inline-flex!important;position:fixed!important;
  top:46px!important;right:8px!important;bottom:auto!important;left:auto!important;
  padding:3px 7px!important;font-size:8px!important;line-height:1.2!important;min-height:0!important;
}

/* Short desktop windows (1280x800): a slightly smaller pack plate leaves
   room for the fighters between the pfp rings and the buttons. */
@media (min-width:900px) and (max-height:860px){
  html[data-hudpack] body:has(#battle:not(.hide)) main[data-hud] #battle #arena > .arena-hud.fight,
  html[data-hudpack] body:has(#battle:not(.hide)) #battle .arena-hud{
    width:min(100%,500px)!important;max-width:500px!important;
  }
}
