/* RIMBA TCG v59.68.10.1 — Mobile End Turn Hotfix.
   Loaded LAST: old battle CSS put hand cards over the full-width end-turn button
   in portrait. Keep the card grid and the action bar in separate grid rows. */
@media (max-width:720px) and (orientation:portrait){
  #app .battle-shell.rimba-5968 .battle.battle-compact > .v53-battle-dock{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-rows:minmax(0,1fr) 58px!important;
    grid-auto-rows:auto!important;
    grid-auto-flow:row!important;
    align-items:stretch!important;
    justify-items:stretch!important;
    row-gap:5px!important;
    overflow:hidden!important;
    isolation:isolate!important;
    position:relative!important;
    z-index:85!important;
    padding:5px 6px max(6px,env(safe-area-inset-bottom,0px))!important;
  }
  #app .battle-shell.rimba-5968 .battle.battle-compact > .v53-battle-dock > .hand-panel.hand-drawer{
    grid-column:1!important;
    grid-row:1!important;
    min-width:0!important;
    min-height:0!important;
    max-height:100%!important;
    height:100%!important;
    overflow:hidden!important;
    position:relative!important;
    z-index:1!important;
  }
  #app .battle-shell.rimba-5968 .battle.battle-compact > .v53-battle-dock > .always-end-turn{
    grid-column:1!important;
    grid-row:2!important;
    position:relative!important;
    isolation:isolate!important;
    z-index:8!important;
    display:flex!important;
    flex-direction:row!important;
    align-items:stretch!important;
    justify-content:center!important;
    width:100%!important;
    height:100%!important;
    min-height:48px!important;
    max-height:100%!important;
    box-sizing:border-box!important;
    padding:3px!important;
    margin:0!important;
    pointer-events:auto!important;
  }
  #app .battle-shell.rimba-5968 .battle.battle-compact > .v53-battle-dock > .always-end-turn > .end-turn-btn{
    display:block!important;
    flex:1 1 0!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    height:100%!important;
    min-height:44px!important;
    position:relative!important;
    z-index:10!important;
    pointer-events:auto!important;
    touch-action:manipulation!important;
    user-select:none!important;
    -webkit-user-select:none!important;
    -webkit-tap-highlight-color:transparent;
    font-size:clamp(11px,3vw,14px)!important;
    line-height:1.15!important;
    cursor:pointer!important;
  }
  #app .battle-shell.rimba-5968 .battle.battle-compact > .v53-battle-dock > .always-end-turn > .basic-attack-btn{
    flex:1 1 0!important;
    width:auto!important;
    min-width:0!important;
    min-height:44px!important;
    height:100%!important;
    position:relative!important;
    z-index:10!important;
    touch-action:manipulation!important;
  }
  #app .battle-shell.rimba-5968 .battle.battle-compact > .v53-battle-dock > .always-end-turn > small{
    display:none!important;
  }
  /* A selected skill's floating description must not cover the dock. */
  #app .battle-shell.rimba-5968 .battle.battle-compact > .selected-action-panel{
    z-index:48!important;
  }
}
@media (max-width:720px) and (orientation:landscape){
  #app .battle-shell.rimba-5968 .v53-battle-dock > .always-end-turn{
    position:relative!important;
    z-index:9!important;
    pointer-events:auto!important;
  }
  #app .battle-shell.rimba-5968 .v53-battle-dock .end-turn-btn{
    min-height:40px!important;
    touch-action:manipulation!important;
    pointer-events:auto!important;
  }
}


/* RIMBA TCG v59.68.11.1 — Skill panel and target/status alignment hotfix */
.battle.battle-compact > .selected-action-panel,
.online-battle .selected-action-panel{
  bottom:148px!important;
  z-index:320!important;
}
.battle.battle-compact > .selected-action-panel .selected-card-summary,
.online-battle .selected-action-panel .selected-card-summary{
  align-items:start!important;
}
.battle.battle-compact > .selected-action-panel .target-prompt,
.online-battle .selected-action-panel .target-prompt{
  margin:6px 0 8px!important;
}

/* Lower the status pills so they sit closer to the character art. */
.battle .unit-card.living-unit .statusline.status-visuals,
.online-battle .unit-card.living-unit .statusline.status-visuals{
  top:6px!important;
  right:6px!important;
  max-width:56%!important;
}

/* Put selection emphasis on the art area, not on a tall full-card box. */
.battle .unit-card.selectable-target,
.online-battle .unit-card.selectable-target,
.battle .unit-card.targeted,
.online-battle .unit-card.targeted{
  outline:none!important;
  box-shadow:inherit!important;
  transform:none!important;
}
.battle .unit-card.selectable-target .unit-art,
.online-battle .unit-card.selectable-target .unit-art{
  box-shadow:0 0 0 2px rgba(255,217,92,.78),0 0 18px rgba(255,217,92,.28)!important;
  border-radius:18px!important;
}
.battle .unit-card.targeted .unit-art,
.online-battle .unit-card.targeted .unit-art{
  box-shadow:0 0 0 2px rgba(255,217,92,.92),0 0 22px rgba(255,217,92,.34)!important;
  border-radius:18px!important;
}

/* Lower and shrink the shield/status effect bubble around the character. */
.battle .unit-card .unit-status-effects,
.online-battle .unit-card .unit-status-effects{
  inset:-6px -6px -2px!important;
}
.battle .unit-card .state-shield:before,
.online-battle .unit-card .state-shield:before{
  top:58%!important;
  width:72%!important;
  height:68%!important;
  border-width:1.5px!important;
  box-shadow:0 0 12px rgba(86,188,255,.18), inset 0 0 10px rgba(96,200,255,.08)!important;
}

@media(max-width:980px){
  .battle.battle-compact > .selected-action-panel,
  .online-battle .selected-action-panel{
    bottom:156px!important;
    width:min(720px,calc(100vw - 24px))!important;
  }
}
@media(max-width:760px){
  .battle.battle-compact > .selected-action-panel,
  .online-battle .selected-action-panel{
    bottom:min(49dvh,340px)!important;
    left:8px!important;
    right:8px!important;
    width:auto!important;
    transform:none!important;
  }
  .battle .unit-card.living-unit .statusline.status-visuals,
  .online-battle .unit-card.living-unit .statusline.status-visuals{
    top:4px!important;
    right:4px!important;
    max-width:54%!important;
  }
  .battle .unit-card.selectable-target .unit-art,
  .online-battle .unit-card.selectable-target .unit-art,
  .battle .unit-card.targeted .unit-art,
  .online-battle .unit-card.targeted .unit-art{
    border-radius:14px!important;
  }
  .battle .unit-card .state-shield:before,
  .online-battle .unit-card .state-shield:before{
    top:60%!important;
    width:68%!important;
    height:64%!important;
  }
}
@media(max-width:430px){
  .battle.battle-compact > .selected-action-panel,
  .online-battle .selected-action-panel{
    bottom:min(52dvh,352px)!important;
  }
}
