/* Arena layout (JYN, 27 Nov 2026). Loaded just before fight_fit.css on /pvp.
   Dexatron: "chaos cards look ugly ... change how they look in game and
   the positioning". Layout and styling only: same card art files, names,
   effects and prices. The Glass (no pack) bottom strip in hud_v2_glass.css
   is left alone; these rules apply while a HUD pack plate is on.

   Phones and narrow windows: the strip takes no height in the arena column,
   so it no longer pushes the fighters down. In portrait, each player's cards
   stack in a column hugging that side of the screen (SPI-51), so they never
   cover a fighter. Wide windows (>=1020px, where the 760px arena has side
   room): each player's cards stand in a column outside the arena on that
   player's side, level with the HUD plate. */
html[data-hudpack] body #battle #arena.pve-parity-arena > .battle-chaos-strip{
  position:relative!important;
  order:0!important;
  display:flex!important;
  justify-content:space-between!important;
  align-items:flex-start!important;
  gap:8px!important;
  width:100%!important;
  height:0!important;
  min-height:0!important;
  margin:0!important;
  padding:0 max(6px, env(safe-area-inset-right, 0px)) 0 max(6px, env(safe-area-inset-left, 0px))!important;
  box-sizing:border-box!important;
  overflow:visible!important;
  z-index:8!important;
  pointer-events:none!important;
}
html[data-hudpack] body #battle #arena.pve-parity-arena > .battle-chaos-strip[hidden]{display:none!important}
html[data-hudpack] body #battle .battle-chaos-strip > .battle-chaos-side{
  display:flex!important;
  flex:0 0 auto!important;
  flex-direction:row!important;
  align-items:flex-start!important;
  gap:5px!important;
  min-width:0!important;
  margin-top:4px!important;
}
html[data-hudpack] body #battle .battle-chaos-strip > .battle-chaos-side.right{
  flex-direction:row-reverse!important;
}
html[data-hudpack] body #battle .battle-chaos-strip .battle-chaos-tile{
  --chaos-tile-w:50px;
  display:flex!important;
  flex-direction:column!important;
  align-items:stretch!important;
  gap:3px!important;
  box-sizing:border-box!important;
  width:var(--chaos-tile-w)!important;
  min-width:var(--chaos-tile-w)!important;
  max-width:var(--chaos-tile-w)!important;
  padding:3px!important;
  border:1px solid var(--chaos-accent, #6cac52)!important;
  border-radius:7px!important;
  background:linear-gradient(180deg, rgba(12,20,16,.92), rgba(3,8,6,.94))!important;
  box-shadow:0 2px 8px rgba(0,0,0,.55), 0 0 6px color-mix(in srgb, var(--chaos-accent, #6cac52) 35%, transparent)!important;
  color:#f3fff0!important;
  backdrop-filter:none!important;
}
html[data-hudpack] body #battle .battle-chaos-strip .battle-chaos-tile > img{
  display:block!important;
  width:100%!important;
  height:auto!important;
  aspect-ratio:3 / 4!important;
  object-fit:cover!important;
  border-radius:4px!important;
  flex:none!important;
}
html[data-hudpack] body #battle .battle-chaos-strip .battle-chaos-tile > span[aria-hidden]{
  display:flex!important;align-items:center!important;justify-content:center!important;
  width:100%!important;aspect-ratio:3 / 4!important;font-size:20px!important;
}
html[data-hudpack] body #battle .battle-chaos-strip .battle-chaos-tile .battle-chaos-name{
  display:-webkit-box!important;
  -webkit-box-orient:vertical!important;
  -webkit-line-clamp:2!important;
  overflow:hidden!important;
  white-space:normal!important;
  text-overflow:clip!important;
  min-height:2.2em!important;
  max-width:100%!important;
  font:800 8px/1.1 system-ui,sans-serif!important;
  letter-spacing:.02em!important;
  text-transform:uppercase!important;
  text-align:center!important;
  overflow-wrap:anywhere!important;
  text-shadow:0 1px 2px #000!important;
}
html[data-hudpack] body #battle .battle-chaos-strip .battle-chaos-tile.countered{
  opacity:.72!important;
  border-color:#e5a966!important;
}
html[data-hudpack] body #battle .battle-chaos-strip .battle-chaos-tile.countered > img{
  filter:grayscale(.85) brightness(.8)!important;
}
/* SPI-51: phones in portrait stack each player's Chaos cards in a column
   hugging that side of the screen, so they never cover a fighter. The centre
   turn wording is gone (the portrait ring replaces it), so the old text inset
   is no longer needed. Narrow phones still get slightly smaller 42px cards.
   Landscape is unchanged (row above the button columns; wide windows keep
   the outside columns). */
@media (orientation:portrait) and (max-width:1019px){
  html[data-hudpack] body #battle .battle-chaos-strip > .battle-chaos-side,
  html[data-hudpack] body #battle .battle-chaos-strip > .battle-chaos-side.right{
    flex-direction:column!important;
    gap:4px!important;
  }
  html[data-hudpack] body #battle .battle-chaos-strip > .battle-chaos-side{
    align-items:flex-start!important;
  }
  html[data-hudpack] body #battle .battle-chaos-strip > .battle-chaos-side.right{
    align-items:flex-end!important;
  }
}
@media (max-width:379px){
  html[data-hudpack] body #battle .battle-chaos-strip .battle-chaos-tile{--chaos-tile-w:42px}
  html[data-hudpack] body #battle .battle-chaos-strip .battle-chaos-tile .battle-chaos-name{font-size:7px!important}
}

/* Collapse empty centre turn slots so leftover min-heights cannot cover a fighter. */
#battle .pve-parity-arena > .arena-notifications > #fx:empty,
#battle .pve-parity-arena > .arena-notifications > #status:empty{
  display:none!important;
  min-height:0!important;
}
/* Short landscape phones: smaller cards so they stay above the fighters. */
@media (max-height:520px) and (min-width:521px){
  html[data-hudpack] body #battle .battle-chaos-strip .battle-chaos-tile{--chaos-tile-w:40px}
  html[data-hudpack] body #battle .battle-chaos-strip .battle-chaos-tile .battle-chaos-name{font-size:7px!important}
}
/* Wide windows: a column of cards outside each side of the 760px arena. */
@media (min-width:1020px){
  html[data-hudpack] body #battle #arena.pve-parity-arena > .battle-chaos-strip{
    position:absolute!important;
    top:30px!important;
    left:-122px!important;
    right:-122px!important;
    width:auto!important;
    padding:0!important;
  }
  html[data-hudpack] body #battle .battle-chaos-strip > .battle-chaos-side,
  html[data-hudpack] body #battle .battle-chaos-strip > .battle-chaos-side.right{
    flex-direction:column!important;
    gap:8px!important;
    margin-top:0!important;
  }
  html[data-hudpack] body #battle .battle-chaos-strip .battle-chaos-tile{--chaos-tile-w:96px;padding:4px!important;gap:4px!important;border-radius:9px!important}
  html[data-hudpack] body #battle .battle-chaos-strip .battle-chaos-tile .battle-chaos-name{font-size:10px!important}
}
@media (min-width:1020px) and (max-height:700px){
  html[data-hudpack] body #battle .battle-chaos-strip .battle-chaos-tile{--chaos-tile-w:72px}
  html[data-hudpack] body #battle .battle-chaos-strip .battle-chaos-tile .battle-chaos-name{font-size:9px!important}
}
/* The crossed swords between the fighters drop with them. Their box used to
   stretch to about 150px tall, so the glyph sat high and, once the turn text
   moved up, ran into "Choose your next move" on desktop. Fix the box at the
   glyph's own size so the swords sit at the fighters' waist height. */
html[data-hudpack] body #battle .pve-parity-arena .icons.clash > .versus-core{
  height:44px!important;
  min-height:0!important;
  max-height:44px!important;
}
@media (max-width:520px){
  html[data-hudpack] body #battle .pve-parity-arena .icons.clash > .versus-core{height:34px!important;max-height:34px!important}
}

/* Short landscape phones (JYN, 27 Nov 2026; 640-932 wide, 320-430 tall,
   e.g. 844x390, 932x430, 740x360, 667x375). Dexatron: "Yes fix it". The
   pack plate used to be 760px wide and ~290px tall (the whole screen
   height), the six buttons sat in a 2x3 grid in the middle of the screen
   and the fighters were pushed up off the top.
   Now: a compact plate centred at the top (31% of the height), the turn
   text right under it, the six buttons in two columns of three at the
   left and right screen edges, the fighters standing near the bottom of
   the screen between the columns, and each player's Chaos cards just
   above that player's button column. --dexa-moves-side tells
   FighterDrawScale and ArenaRingAlign that the buttons are at the sides,
   so the floor line is no longer capped by the top of the button grid.
   Portrait phones and desktop windows (height > 520px) are unchanged. */
@media (max-height:520px) and (min-width:560px) and (orientation:landscape){
  html body:has(#battle:not(.hide)) main #battle#battle:not(.hide){
    --dexa-moves-side:1;
    --side-btn-w:clamp(124px, 18vw, 168px);
    --side-btn-h:clamp(34px, 10.5vh, 44px);
    --side-btn-gap:6px;
    --side-pad-l:max(6px, env(safe-area-inset-left, 0px));
    --side-pad-r:max(6px, env(safe-area-inset-right, 0px));
    --side-pad-b:max(6px, env(safe-area-inset-bottom, 0px));
    position:relative!important;
    width:100%!important;
    max-width:none!important;
    margin:0!important;
    padding:0!important;
    box-sizing:border-box!important;
  }
  html body:has(#battle:not(.hide)) main#battle-main,
  html body:has(#battle:not(.hide)) > main{
    padding-left:0!important;
    padding-right:0!important;
    max-width:none!important;
  }
  /* Same chrome in every mode: no top nav (PvE used to bring it back),
     sound pills in the top-right corner, clear of the centred plate. */
  html body:has(#battle:not(.hide)) #beaniverseGlobalNav#beaniverseGlobalNav,
  html body.pve-mode:has(#battle:not(.hide)) #beaniverseGlobalNav#beaniverseGlobalNav,
  html body.pve-mode:has(#battle:not(.hide)) .battle-utility-bar.battle-utility-bar,
  html body.pve-mode:has(#battle:not(.hide)) #hudLaunch#hudLaunch{
    display:none!important;
  }
  html body:has(#battle:not(.hide)) #dexaSfxBtn#dexaSfxBtn,
  html body:has(#battle:not(.hide)) #dexaGlobalMusicBtn#dexaGlobalMusicBtn{
    top:max(4px, env(safe-area-inset-top, 0px))!important;
  }
  /* Compact plate. */
  html[data-hudpack] body:has(#battle:not(.hide)) main[data-hud] #battle#battle #arena#arena > .arena-hud.fight,
  html[data-hudpack] body:has(#battle:not(.hide)) #battle#battle #arena#arena > .arena-hud{
    width:min(46vw, calc(31vh * 2172 / 832))!important;
    max-width:min(46vw, calc(31vh * 2172 / 832))!important;
    margin:2px auto 0!important;
    flex:0 0 auto!important;
  }
  /* Turn text straight under the plate, no tall empty box. */
  html body:has(#battle:not(.hide)) #battle#battle #arena#arena > .arena-notifications{
    min-height:0!important;
    height:auto!important;
    margin:0 auto!important;
    padding:2px 0 0!important;
    width:calc(100% - 2 * (var(--side-btn-w) + 16px))!important;
    max-width:520px!important;
    flex:0 0 auto!important;
  }
  html body:has(#battle:not(.hide)) #battle#battle #arena#arena > .arena-notifications #status{
    font-size:16px!important;
    line-height:1.2!important;
  }
  /* Fighters' stage: the whole arena below the text; FighterDrawScale
     stands them near the bottom of the screen. */
  html body:has(#battle:not(.hide)) main #battle#battle:not(.hide) > #arena > .icons.clash{
    position:absolute!important;
    left:0!important;
    right:0!important;
    top:auto!important;
    bottom:0!important;
    height:62%!important;
    min-height:0!important;
    flex:none!important;
  }
  /* The crossed swords sit low between the fighters, under the turn text. */
  html[data-hudpack] body:has(#battle:not(.hide)) #battle#battle .pve-parity-arena .icons.clash > .versus-core{
    top:auto!important;
    bottom:28%!important;
    margin:0!important;
  }
  /* Six buttons: two columns of three at the screen edges. */
  html body:has(#battle:not(.hide)) main #battle#battle:not(.hide) > .moves:has(#strike){
    position:absolute!important;
    left:var(--side-pad-l)!important;
    right:var(--side-pad-r)!important;
    bottom:var(--side-pad-b)!important;
    top:auto!important;
    width:auto!important;
    max-width:none!important;
    transform:none!important;
    margin:0!important;
    padding:0!important;
    display:grid!important;
    grid-template-columns:var(--side-btn-w) 1fr var(--side-btn-w)!important;
    grid-auto-rows:var(--side-btn-h)!important;
    row-gap:var(--side-btn-gap)!important;
    column-gap:0!important;
    pointer-events:none!important;
    z-index:7!important;
  }
  html body:has(#battle:not(.hide)) main #battle#battle:not(.hide) > .moves:has(#strike) > :is(#strike,#lightPower,#ability,#guard,#regen,#siphon){
    pointer-events:auto!important;
    width:100%!important;
    max-width:none!important;
    height:var(--side-btn-h)!important;
    min-height:0!important;
    max-height:none!important;
    margin:0!important;
    aspect-ratio:auto!important;
  }
  html body:has(#battle:not(.hide)) main #battle#battle:not(.hide) > .moves:has(#strike) > #strike{grid-column:1!important;grid-row:1!important}
  html body:has(#battle:not(.hide)) main #battle#battle:not(.hide) > .moves:has(#strike) > #ability{grid-column:1!important;grid-row:2!important}
  html body:has(#battle:not(.hide)) main #battle#battle:not(.hide) > .moves:has(#strike) > #regen{grid-column:1!important;grid-row:3!important}
  html body:has(#battle:not(.hide)) main #battle#battle:not(.hide) > .moves:has(#strike) > #lightPower{grid-column:3!important;grid-row:1!important}
  html body:has(#battle:not(.hide)) main #battle#battle:not(.hide) > .moves:has(#strike) > #guard{grid-column:3!important;grid-row:2!important}
  html body:has(#battle:not(.hide)) main #battle#battle:not(.hide) > .moves:has(#strike) > #siphon{grid-column:3!important;grid-row:3!important}
  /* Chaos cards: each player's pair sits just above that player's button
     column, away from the plate, the text and the fighters. */
  html[data-hudpack] body:has(#battle:not(.hide)) #battle#battle #arena#arena > .battle-chaos-strip{
    position:absolute!important;
    left:var(--side-pad-l)!important;
    right:var(--side-pad-r)!important;
    width:auto!important;
    top:auto!important;
    bottom:calc(var(--side-pad-b) + 3 * var(--side-btn-h) + 2 * var(--side-btn-gap) + 8px)!important;
    height:auto!important;
    padding:0!important;
    align-items:flex-end!important;
  }
  html[data-hudpack] body #battle#battle .battle-chaos-strip > .battle-chaos-side{
    margin-top:0!important;
    flex-direction:row!important;
  }
  html[data-hudpack] body #battle#battle .battle-chaos-strip > .battle-chaos-side.right{
    flex-direction:row-reverse!important;
  }
  html[data-hudpack] body #battle#battle .battle-chaos-strip .battle-chaos-tile{--chaos-tile-w:42px}
  /* Squad benches and the history drawer have no room here. */
  html body:has(#battle:not(.hide)) main #battle#battle:not(.hide) > .battle-history{display:none!important}
}
