/* Forest Frontier v0.10.0-rc44 - mobile combat density, encounter choice, Ruins overview and Shop compact pass. */

/* The pre-battle choice is a normal content block. It must not inherit the fixed dock translation. */
body.theme-ashen.screen-battle-active.battle-encounter-choice #screenBattle,
body.theme-ashen.screen-battle-active.battle-encounter-choice .battle-screen{
  overflow-x:hidden!important;
}
body.theme-ashen.screen-battle-active.battle-encounter-choice .battle-action-dock{
  position:relative!important;
  left:auto!important;
  right:auto!important;
  bottom:auto!important;
  inset:auto!important;
  width:100%!important;
  max-width:100%!important;
  margin:8px 0 0!important;
  transform:none!important;
  box-sizing:border-box!important;
  overflow:hidden!important;
}
body.theme-ashen.screen-battle-active.battle-encounter-choice .battle-main-action{
  width:100%!important;
  max-width:100%!important;
  margin:6px 0 0!important;
  box-sizing:border-box!important;
}
body.theme-ashen.screen-battle-active.battle-encounter-choice .combatant-enemy .enemy-figure[data-art="boss"],
body.theme-ashen.screen-battle-active.battle-encounter-choice .combatant-enemy .enemy-figure[data-art="unknown"]{
  background-size:122% auto!important;
  animation:none!important;
}

/* Tall phone screens no longer stretch portrait cards into the free vertical space. */
@media(max-width:520px) and (min-height:820px){
  html[data-battle-fit="normal"] body.theme-ashen.screen-battle-active:not(.reward-flow-open):not(.battle-encounter-choice) .battle-panel,
  html[data-battle-fit="compact"] body.theme-ashen.screen-battle-active:not(.reward-flow-open):not(.battle-encounter-choice) .battle-panel{
    height:auto!important;
    min-height:0!important;
    max-height:none!important;
    overflow:visible!important;
  }
  html[data-battle-fit="normal"] body.theme-ashen.screen-battle-active:not(.reward-flow-open):not(.battle-encounter-choice) .battle-stage,
  html[data-battle-fit="compact"] body.theme-ashen.screen-battle-active:not(.reward-flow-open):not(.battle-encounter-choice) .battle-stage{
    flex:0 0 clamp(310px,80vw,350px)!important;
    height:clamp(310px,80vw,350px)!important;
    min-height:310px!important;
    max-height:350px!important;
  }
  html[data-battle-fit="normal"] body.theme-ashen.screen-battle-active:not(.reward-flow-open):not(.battle-encounter-choice) .battle-stage .combatant,
  html[data-battle-fit="compact"] body.theme-ashen.screen-battle-active:not(.reward-flow-open):not(.battle-encounter-choice) .battle-stage .combatant{
    height:100%!important;
    min-height:0!important;
    max-height:100%!important;
  }
}

/* Progress to the boss always stays inside the panel, including seven and nine-step routes. */
body.theme-ashen .boss-progress-visual{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  align-items:center!important;
  width:min(100%,230px)!important;
  max-width:100%!important;
  min-width:0!important;
  margin:0 auto!important;
  padding:0 4px!important;
  box-sizing:border-box!important;
}
body.theme-ashen .boss-progress-dots{
  display:flex!important;
  justify-content:center!important;
  min-width:0!important;
  max-width:100%!important;
  gap:clamp(3px,1.15vw,5px)!important;
  overflow:hidden!important;
}
body.theme-ashen .boss-progress-dot{
  flex:0 1 9px!important;
  width:clamp(7px,2.1vw,9px)!important;
  min-width:7px!important;
  height:clamp(7px,2.1vw,9px)!important;
  box-sizing:border-box!important;
}
body.theme-ashen .boss-progress-visual strong{
  flex:0 0 auto!important;
  min-width:28px!important;
  margin-left:5px!important;
  white-space:nowrap!important;
}

/* The dangerous attack row presents the result of defense, not an internal calculation label. */
body.theme-ashen .heavy-sequence-state{
  min-height:32px!important;
  max-height:32px!important;
  padding:6px 9px!important;
  font-size:12px!important;
  font-weight:800!important;
  line-height:1.15!important;
  letter-spacing:0!important;
  white-space:normal!important;
  text-overflow:clip!important;
  box-sizing:border-box!important;
}
html[data-battle-fit="ultra"] body.theme-ashen .heavy-sequence-state,
html[data-battle-fit="scroll"] body.theme-ashen .heavy-sequence-state{
  min-height:27px!important;
  max-height:27px!important;
  padding:4px 7px!important;
  font-size:10.5px!important;
}

/* Ruins overview: all three progression cards are rendered in one real vertical scroll region. */
body.theme-ashen.screen-ruins-active #ruinsFloorList:not([hidden]){
  display:grid!important;
  grid-auto-flow:row!important;
  grid-auto-rows:max-content!important;
  align-content:start!important;
  width:100%!important;
  min-width:0!important;
  min-height:0!important;
  max-height:100%!important;
  box-sizing:border-box!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  padding-bottom:max(24px,env(safe-area-inset-bottom))!important;
}
body.theme-ashen.screen-ruins-active #ruinsFloorList>.ruins-floor-card{
  display:grid!important;
  width:100%!important;
  min-width:0!important;
  visibility:visible!important;
  opacity:1!important;
  box-sizing:border-box!important;
}
body.theme-ashen .ruins-result-summary-meta{
  grid-template-columns:auto!important;
  min-width:max-content!important;
  column-gap:0!important;
}
body.theme-ashen .ruins-result-summary-meta i{display:none!important}

/* Showcase compact pass: remove the duplicate title and use the same density as other main screens. */

/* Forest Frontier v0.10.0-rc49 - victory-state hardening, chapter card cleanup, enemy portrait normalization and second Shop compact pass. */

/* Victory transition keeps the active-battle geometry instead of filling released vertical space. */
body.theme-ashen.screen-battle-active.battle-ending-active:not(.reward-flow-open) .battle-panel{
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  overflow:visible!important;
}
body.theme-ashen.screen-battle-active.battle-ending-active:not(.reward-flow-open) .battle-stage{
  flex:0 0 clamp(300px,80vw,348px)!important;
  height:clamp(300px,80vw,348px)!important;
  min-height:300px!important;
  max-height:348px!important;
}
body.theme-ashen.screen-battle-active.battle-ending-active:not(.reward-flow-open) .battle-stage .combatant{
  height:100%!important;
  min-height:0!important;
  max-height:100%!important;
}
body.theme-ashen.screen-battle-active.battle-ending-active #zoneProgress,
body.theme-ashen.screen-battle-active #zoneProgress:empty{
  display:none!important;
}

/* Chapter locations no longer reserve or paint the retired circular symbols. */
body.theme-ashen.screen-map-active .chapter-map-list .location-button{
  padding:10px 12px!important;
  grid-template-columns:minmax(0,1fr)!important;
}
body.theme-ashen.screen-map-active .chapter-map-list .location-button::before{
  content:none!important;
  display:none!important;
}
body.theme-ashen.screen-map-active .chapter-map-list .location-button strong,
body.theme-ashen.screen-map-active .chapter-map-list .location-button small{
  position:relative!important;
  z-index:1!important;
  margin-left:0!important;
  padding-left:0!important;
}

/* Normal enemies use a visually equal portrait mass. Boss art keeps its current scale. */
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combatant-enemy:not(.enemy-boss) .enemy-figure[data-art="wolf"]{
  background-size:118% auto!important;
}
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combatant-enemy:not(.enemy-boss) .enemy-figure[data-art="boar"]{
  background-size:124% auto!important;
}
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combatant-enemy:not(.enemy-boss) .enemy-figure[data-art="bandit"],
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combatant-enemy:not(.enemy-boss) .enemy-figure[data-art="carrier"]{
  background-size:122% auto!important;
}
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combatant-enemy:not(.enemy-boss) .enemy-figure[data-art="construct"]{
  background-size:126% auto!important;
}
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combatant-enemy:not(.enemy-boss) .enemy-figure[data-art="unknown"]{
  background-size:130% auto!important;
}

/* Generic enemy flavour text is hidden in JS; real mechanics remain compact. */

/* Second selective compact pass for the Showcase: lighter buttons and almost no section gap. */

/* Forest Frontier v0.10.0-rc49 - stabilization hotfix after refactor stage 1. */

/*
 * The enemy card has four direct layout rows: header, scene, trait and bars.
 * Earlier five-row templates placed the trait in the flexible row, so the
 * "Броня · ярость" panel could grow into an empty rectangle during armor phases.
 */
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-stage .combatant-enemy{
  grid-template-rows:max-content minmax(0,1fr) max-content max-content!important;
}
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .enemy-trait:not([hidden]){
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  align-self:end!important;
  width:100%!important;
  height:auto!important;
  min-height:24px!important;
  max-height:28px!important;
  margin:0 0 5px!important;
  padding:4px 7px!important;
  box-sizing:border-box!important;
  overflow:hidden!important;
  font-size:9.5px!important;
  line-height:1.1!important;
  white-space:nowrap!important;
  text-overflow:ellipsis!important;
}

/*
 * Keep essential combat feedback visible when a desktop browser reports
 * reduced motion. Idle/ambient movement stays disabled, but hits, damage,
 * berserk entry and armor break retain a short non-moving flash/fade.
 */
@media(prefers-reduced-motion:reduce){
  body.theme-ashen.screen-battle-active .combatant.hit,
  body.theme-ashen.screen-battle-active .combatant.hit-strong,
  body.theme-ashen.screen-battle-active .combatant.hit-perfect,
  body.theme-ashen.screen-battle-active .combatant.hit-critical,
  body.theme-ashen.screen-battle-active .combatant.hit-power,
  body.theme-ashen.screen-battle-active .combatant.defense-block,
  body.theme-ashen.screen-battle-active .combatant.defense-parry,
  body.theme-ashen.screen-battle-active .combatant.response-counter,
  body.theme-ashen.screen-battle-active .combatant.response-parry{
    animation:ffRc47ImpactFlash .34s ease-out both!important;
  }
  body.theme-ashen.screen-battle-active .damage-float.show,
  body.theme-ashen.screen-battle-active .damage-float.visible{
    animation:ffRc47DamageFade .82s ease-out both!important;
  }
  body.theme-ashen.screen-battle-active .combatant-enemy.enemy-berserk-enter,
  body.theme-ashen.screen-battle-active .combatant-enemy.state-armor-break,
  body.theme-ashen.screen-battle-active .battle-stage.state-danger-flash{
    animation:ffRc47StateFlash .42s ease-out both!important;
  }
}
