/* Forest Frontier v0.10.0-rc41 — measured battle fit and optional-row aware layout. */

/* Ruins progress has one source in battle: the upper run notice. */

/*
 * The fixed action dock is measured by viewport-layout.js. The battle panel gets
 * exactly the remaining visual viewport, so optional rows (including the Ruins
 * potion) cannot cover the mechanics panel.
 */
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel{
  display:flex!important;
  flex-direction:column!important;
  box-sizing:border-box!important;
  width:100%!important;
  height:var(--ff-battle-panel-available-height)!important;
  min-height:0!important;
  max-height:var(--ff-battle-panel-available-height)!important;
  overflow:hidden!important;
}
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel>.log-head,
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel>.legacy-auto-controls,
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel>.ruins-run-notice,
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel>.tutorial-notice,
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel>.zone-progress,
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel>.battle-atmosphere,
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel>.trial-battle-banner,
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel>.combat-mechanics-status{
  flex:0 0 auto!important;
}
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-stage{
  flex:1 1 auto!important;
  align-items:stretch!important;
  min-height:0!important;
  height:auto!important;
  max-height:none!important;
  overflow:visible!important;
}
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-stage .combatant{
  box-sizing:border-box!important;
  align-self:stretch!important;
  height:100%!important;
  min-height:0!important;
  max-height:100%!important;
  overflow:hidden!important;
}
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combatant-hero{
  grid-template-rows:max-content minmax(0,1fr) max-content!important;
}
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-stage .combatant-enemy{
  grid-template-rows:max-content max-content minmax(0,1fr) max-content max-content!important;
}
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combat-scene{
  align-self:stretch!important;
  min-height:0!important;
  overflow:visible!important;
}
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combat-scene .figure{
  width:100%!important;
  height:100%!important;
  min-height:36px!important;
  max-height:none!important;
  margin:0!important;
}
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .enemy-trait{
  align-self:stretch!important;
  min-height:0!important;
  max-height:26px!important;
  margin:0 0 4px!important;
  padding:4px 6px!important;
  line-height:1.1!important;
}
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combat-state-stack{
  align-self:stretch!important;
}
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .ruins-run-notice{
  min-height:0!important;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combat-mechanics-status{
  min-height:0!important;
  overflow:hidden!important;
}

/* The normal fit preserves the current premium spacing. */
html[data-battle-fit="normal"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-stage .combatant{
  min-height:0!important;
}

/* Compact battle fit is selected from the measured remaining stage height. */
html[data-battle-fit="compact"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel{
  padding:8px!important;
}
html[data-battle-fit="compact"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel .log-head h2{
  font-size:20px!important;
}
html[data-battle-fit="compact"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel .section-label{
  font-size:8px!important;
}
html[data-battle-fit="compact"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .ruins-run-notice,
html[data-battle-fit="compact"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .tutorial-notice,
html[data-battle-fit="compact"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .trial-battle-banner{
  margin:5px 0!important;
  padding:6px 8px!important;
  font-size:9px!important;
  line-height:1.15!important;
}
html[data-battle-fit="compact"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-stage{
  gap:5px!important;
  margin:5px 0!important;
  padding:4px!important;
}
html[data-battle-fit="compact"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-stage .combatant{
  padding:7px 5px!important;
}
html[data-battle-fit="compact"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combat-scene .figure{
  min-height:32px!important;
}
html[data-battle-fit="compact"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combat-mechanics-status{
  gap:4px!important;
  margin:4px 0 0!important;
  padding:6px 8px!important;
}
html[data-battle-fit="compact"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combat-mechanics-line,
html[data-battle-fit="compact"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .crushing-charge-row{
  gap:5px!important;
}
html[data-battle-fit="compact"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .crushing-charge-row{
  padding-top:3px!important;
}

/* Ultra fit keeps all mandatory controls visible on 360x640-class devices. */
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel{
  padding:6px!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel .log-head{
  gap:4px!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel .log-head h2{
  font-size:18px!important;
  line-height:1!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel .section-label{
  margin-bottom:2px!important;
  font-size:7.5px!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel .state{
  padding:4px 6px!important;
  font-size:8px!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .ruins-run-notice,
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .tutorial-notice,
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .trial-battle-banner{
  margin:3px 0!important;
  padding:5px 7px!important;
  font-size:8px!important;
  line-height:1.1!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-stage{
  gap:4px!important;
  margin:3px 0!important;
  padding:3px!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-stage .combatant{
  padding:5px 4px!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-stage .combatant-name{
  margin-bottom:1px!important;
  font-size:11px!important;
  line-height:1.05!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .enemy-card-header{
  gap:2px!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .enemy-level,
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .enemy-tier{
  min-height:17px!important;
  padding:1px 4px!important;
  font-size:8px!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .enemy-trait{
  max-height:20px!important;
  margin-bottom:2px!important;
  padding:3px 4px!important;
  font-size:7.5px!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combat-scene .figure{
  min-height:24px!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combat-state-stack{
  gap:2px!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combat-hp{
  font-size:8px!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combat-mechanics-status{
  gap:2px!important;
  margin:3px 0 0!important;
  padding:4px 6px!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combat-mechanics-line,
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .crushing-charge-row{
  gap:4px!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combat-mechanics-line strong,
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combat-mechanics-line span,
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .crushing-charge-row>span:first-child{
  font-size:8px!important;
  line-height:1.08!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .crushing-charge-row{
  padding-top:2px!important;
}
html[data-battle-fit="ultra"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .crushing-charge-segments{
  width:66px!important;
  gap:3px!important;
}

/* Last-resort safety: scroll the reserved panel instead of allowing overlap. */
html[data-battle-fit="scroll"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel{
  height:var(--ff-battle-panel-available-height)!important;
  max-height:var(--ff-battle-panel-available-height)!important;
  padding:5px!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior:contain;
  scrollbar-width:thin;
}
html[data-battle-fit="scroll"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-stage{
  flex:0 0 118px!important;
  min-height:118px!important;
  margin:3px 0!important;
  padding:3px!important;
}
html[data-battle-fit="scroll"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-stage .combatant{
  min-height:118px!important;
  padding:4px 3px!important;
}
html[data-battle-fit="scroll"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combat-scene .figure{
  min-height:22px!important;
}
html[data-battle-fit="scroll"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .enemy-trait{
  max-height:18px!important;
  margin-bottom:2px!important;
  padding:2px 4px!important;
  font-size:7px!important;
}
html[data-battle-fit="scroll"] body.theme-ashen.screen-battle-active:not(.reward-flow-open) .combat-mechanics-status{
  margin:3px 0 0!important;
  padding:4px 5px!important;
}

/* The extra Ruins potion row participates in the dock measurement and is compacted first. */
html[data-battle-potion="present"][data-battle-fit="compact"] body.theme-ashen .battle-action-dock .attack-meter-heading,
html[data-battle-potion="present"][data-battle-fit="ultra"] body.theme-ashen .battle-action-dock .attack-meter-heading,
html[data-battle-potion="present"][data-battle-fit="scroll"] body.theme-ashen .battle-action-dock .attack-meter-heading{
  margin-bottom:2px!important;
}

@media(max-width:430px){
  body.theme-ashen.screen-battle-active:not(.reward-flow-open) .enemy-trait{
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
}

/* v0.10.0-rc41 — iPhone stability fixes for header, battle telegraphs and Ruins navigation. */

.brand-title-compact{display:none}

/* Enemy telegraphs occupy a permanent slot inside the scene. Visibility changes no longer resize the card. */
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 .enemy-combat-scene{
  display:grid!important;
  grid-template-rows:28px minmax(0,1fr)!important;
  align-items:stretch!important;
  justify-items:stretch!important;
}

/* The detailed combat warning also keeps a fixed row, avoiding a second layout jump. */
body.theme-ashen .heavy-sequence-state{
  display:flex!important;
  align-items:center;
  justify-content:center;
  min-height:20px;
  max-height:20px;
  margin:0!important;
  padding:3px 6px!important;
  overflow:hidden;
  opacity:0;
  visibility:hidden;
  animation:none!important;
  font-size:8.5px!important;
  line-height:1.05!important;
  text-align:center;
  text-overflow:ellipsis;
  white-space:nowrap;
  transition:none!important;
}
html[data-battle-fit="compact"] body.theme-ashen .heavy-sequence-state{min-height:17px;max-height:17px;padding:2px 5px!important;font-size:7.5px!important}
html[data-battle-fit="ultra"] body.theme-ashen .enemy-combat-scene,
html[data-battle-fit="scroll"] body.theme-ashen .enemy-combat-scene{grid-template-rows:20px minmax(0,1fr)!important}
html[data-battle-fit="ultra"] body.theme-ashen .enemy-intent-slot,
html[data-battle-fit="scroll"] body.theme-ashen .enemy-intent-slot{min-height:20px}
html[data-battle-fit="ultra"] body.theme-ashen .enemy-intent-slot .enemy-intent,
html[data-battle-fit="scroll"] body.theme-ashen .enemy-intent-slot .enemy-intent{min-height:17px;padding:2px 4px!important;font-size:7px!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:15px;max-height:15px;padding:1px 4px!important;font-size:7px!important}

/* Clear, intentional compact brand instead of a single clipped letter. */
@media(max-width:479px){
  html[data-ui-density="compact"] body.theme-ashen .topbar,
  html[data-ui-density="ultra"] body.theme-ashen .topbar{
    grid-template-columns:minmax(88px,1fr) auto!important;
    gap:4px!important;
  }
  html[data-ui-density="compact"] body.theme-ashen .title-row,
  html[data-ui-density="ultra"] body.theme-ashen .title-row{
    min-width:88px!important;
    gap:4px!important;
  }
  html[data-ui-density="compact"] body.theme-ashen .brand-title-full,
  html[data-ui-density="ultra"] body.theme-ashen .brand-title-full{display:none!important}
  html[data-ui-density="compact"] body.theme-ashen .brand-title-compact,
  html[data-ui-density="ultra"] body.theme-ashen .brand-title-compact{display:inline!important}
  html[data-ui-density="compact"] body.theme-ashen .brand-copy h1,
  html[data-ui-density="ultra"] body.theme-ashen .brand-copy h1{
    max-width:none!important;
    overflow:visible!important;
    font-size:16px!important;
    line-height:1!important;
    text-overflow:clip!important;
    white-space:nowrap!important;
  }
  html[data-ui-density="ultra"] body.theme-ashen .brand-copy h1{font-size:14px!important}
  html[data-ui-density="compact"] body.theme-ashen .world-tagline,
  html[data-ui-density="ultra"] body.theme-ashen .world-tagline{display:none!important}
  html[data-ui-density="compact"] body.theme-ashen .client-refresh-label,
  html[data-ui-density="ultra"] body.theme-ashen .client-refresh-label{display:none!important}
  html[data-ui-density="compact"] body.theme-ashen .client-refresh-button,
  html[data-ui-density="ultra"] body.theme-ashen .client-refresh-button{
    width:32px!important;
    min-width:32px!important;
    min-height:32px!important;
    padding:3px!important;
  }
  html[data-ui-density="compact"] body.theme-ashen .top-actions,
  html[data-ui-density="ultra"] body.theme-ashen .top-actions{gap:3px!important}
  html[data-ui-density="compact"] body.theme-ashen .top-summary,
  html[data-ui-density="ultra"] body.theme-ashen .top-summary{gap:3px!important}
  html[data-ui-density="compact"] body.theme-ashen .top-summary>span,
  html[data-ui-density="ultra"] body.theme-ashen .top-summary>span{
    min-height:30px!important;
    padding:4px 6px!important;
    font-size:9.5px!important;
  }
  html[data-ui-density="compact"] body.theme-ashen #topGoldUnit,
  html[data-ui-density="ultra"] body.theme-ashen #topGoldUnit{display:none!important}
}

/* Activity cards: remove the ambiguous watermark and use a clear forge mark. */
body.theme-ashen .activity-map-card::after{display:none!important}
body.theme-ashen .activity-map-card::before{pointer-events:none!important}
body.theme-ashen .ruins-map-card::before{
  content:'⚒'!important;
  color:#83d5c5!important;
  font-family:system-ui,sans-serif!important;
  font-size:21px!important;
}
@media(max-width:479px){
  html[data-ui-density="compact"] body.theme-ashen .activity-map-card{
    min-height:58px!important;
    padding:9px 10px 9px 54px!important;
  }
  html[data-ui-density="compact"] body.theme-ashen .activity-map-card::before{
    left:9px!important;
    width:34px!important;
    height:34px!important;
    font-size:18px!important;
  }
  html[data-ui-density="ultra"] body.theme-ashen .activity-map-card{
    min-height:52px!important;
    padding:7px 8px 7px 48px!important;
  }
  html[data-ui-density="ultra"] body.theme-ashen .activity-map-card::before{
    left:7px!important;
    width:31px!important;
    height:31px!important;
    font-size:16px!important;
  }
}

/* Ruins map is an explicit iOS scroll region and focuses the actionable node. */
body.theme-ashen.screen-ruins-active .ruins-screen-panel{
  display:flex!important;
  flex-direction:column!important;
  min-height:0!important;
}
body.theme-ashen.screen-ruins-active .ruins-active-run:not([hidden]){
  display:flex!important;
  flex:1 1 auto!important;
  flex-direction:column!important;
  min-height:0!important;
}
body.theme-ashen.screen-ruins-active .ruins-route-map{
  flex:1 1 auto!important;
  width:100%!important;
  height:clamp(260px,calc(var(--ff-viewport-height) - var(--ff-topbar-rendered-height) - var(--ff-bottom-nav-rendered-height) - 230px),620px)!important;
  min-height:260px!important;
  max-height:620px!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior-y:contain;
  touch-action:pan-y!important;
  -webkit-overflow-scrolling:touch;
  scroll-behavior:auto!important;
  scroll-padding-block:72px;
}
body.theme-ashen.screen-ruins-active .ruins-labyrinth-map{
  min-height:max-content;
}
body.theme-ashen.screen-ruins-active button.ruins-medallion-node{
  position:relative;
  z-index:3;
  pointer-events:auto!important;
  touch-action:manipulation!important;
  -webkit-tap-highlight-color:transparent;
}
body.theme-ashen.screen-ruins-active .ruins-medallion-paths,
body.theme-ashen.screen-ruins-active .ruins-medallion-canvas::before{pointer-events:none!important}
@media(max-width:479px){
  html[data-ui-density="compact"] body.theme-ashen.screen-ruins-active .ruins-route-map{
    height:clamp(250px,calc(var(--ff-viewport-height) - var(--ff-topbar-rendered-height) - var(--ff-bottom-nav-rendered-height) - 205px),560px)!important;
    min-height:250px!important;
  }
  html[data-ui-density="ultra"] body.theme-ashen.screen-ruins-active .ruins-route-map{
    height:clamp(220px,calc(var(--ff-viewport-height) - var(--ff-topbar-rendered-height) - var(--ff-bottom-nav-rendered-height) - 180px),500px)!important;
    min-height:220px!important;
  }
}

/* Forest Frontier v0.10.0-rc41 - stable mobile layout and bounded Ruins workspace. */

/* Battle fit is now selected from stable viewport bands. Size transitions are forbidden. */
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-panel,
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-stage,
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-stage .combatant,
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-action-dock{
  transition-property:background-color,border-color,box-shadow,opacity!important;
  transition-duration:.12s!important;
}
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-stage,
body.theme-ashen.screen-battle-active:not(.reward-flow-open) .battle-stage .combatant{
  contain:layout;
}

/* The active Ruins screen owns one fixed viewport workspace. The map scrolls, controls stay visible. */
body.theme-ashen.screen-ruins-active{overflow:hidden!important}
body.theme-ashen.screen-ruins-active #screenRuins.active{
  height:max(0px,calc(var(--ff-viewport-height) - var(--ff-topbar-rendered-height) - var(--ff-bottom-nav-rendered-height) - var(--ff-app-top) - var(--ff-topbar-margin) - var(--ff-app-bottom)))!important;
  min-height:0!important;
  overflow:hidden!important;
}
body.theme-ashen.screen-ruins-active #screenRuins.active>.ruins-screen-panel{
  display:flex!important;
  flex-direction:column!important;
  box-sizing:border-box!important;
  height:100%!important;
  min-height:0!important;
  max-height:100%!important;
  padding-bottom:var(--ff-panel-padding)!important;
  overflow:hidden!important;
}
body.theme-ashen.screen-ruins-active .ruins-screen-head,
body.theme-ashen.screen-ruins-active .ruins-rules,
body.theme-ashen.screen-ruins-active .ruins-result{
  flex:0 0 auto!important;
}
body.theme-ashen.screen-ruins-active .ruins-active-run:not([hidden]){
  display:grid!important;
  grid-template-rows:auto minmax(0,1fr) auto!important;
  flex:1 1 auto!important;
  gap:6px!important;
  min-height:0!important;
  margin-top:7px!important;
  overflow:hidden!important;
}
body.theme-ashen.screen-ruins-active .ruins-route-head{min-height:0!important}
body.theme-ashen.screen-ruins-active .ruins-route-map{
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  margin:0!important;
  padding:8px 5px 10px!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior:contain!important;
  touch-action:pan-y!important;
  -webkit-overflow-scrolling:touch!important;
  scroll-behavior:auto!important;
  scroll-padding-block:56px!important;
}
body.theme-ashen.screen-ruins-active .ruins-leave-button{
  position:relative!important;
  z-index:5!important;
  flex:0 0 auto!important;
  width:100%!important;
  min-height:var(--ff-control-height)!important;
  margin:0!important;
  box-shadow:0 -5px 18px rgba(0,0,0,.34)!important;
}

/* Compact map geometry leaves room for future node explanations. */
body.theme-ashen .ruins-medallion-grid{
  grid-auto-rows:var(--ruins-row-gap,104px)!important;
}
@media(max-width:479px){
  body.theme-ashen.screen-ruins-active .ruins-screen-head h2{font-size:20px!important;line-height:1.05!important}
  body.theme-ashen.screen-ruins-active .ruins-rules{padding:7px 9px!important}
  body.theme-ashen.screen-ruins-active .ruins-route-head h3{font-size:17px!important;line-height:1.08!important}
  body.theme-ashen.screen-ruins-active .ruins-route-status{font-size:10px!important;line-height:1.15!important}
  body.theme-ashen .ruins-labyrinth-map{gap:6px!important}
  body.theme-ashen .ruins-labyrinth-head{display:none!important}
  body.theme-ashen .ruins-guardian-caption{margin-top:0!important;font-size:10px!important}
  body.theme-ashen .ruins-medallion-node{
    min-height:80px!important;
    gap:2px!important;
    padding-inline:1px!important;
  }
  body.theme-ashen .ruins-medallion-shell,
  body.theme-ashen .ruins-medallion-node.round .ruins-medallion-shell,
  body.theme-ashen .ruins-medallion-node.hex .ruins-medallion-shell{
    width:52px!important;
    height:52px!important;
  }
  body.theme-ashen .ruins-medallion-icon{width:27px!important;height:27px!important}
  body.theme-ashen .ruins-medallion-node.boss .ruins-medallion-shell{width:64px!important;height:64px!important}
  body.theme-ashen .ruins-medallion-node.boss .ruins-medallion-icon{width:34px!important;height:34px!important}
  body.theme-ashen .ruins-medallion-node.available::after{top:51px!important;font-size:9px!important}
  body.theme-ashen .ruins-node-label{
    width:auto!important;
    max-width:92px!important;
    min-height:22px!important;
    margin-top:0!important;
    padding:2px 4px!important;
  }
  body.theme-ashen .ruins-node-label strong{
    font-size:9px!important;
    line-height:1.08!important;
  }
  body.theme-ashen .ruins-node-label small{
    display:block!important;
    max-width:100%!important;
    overflow:hidden!important;
    font-size:8px!important;
    line-height:1.05!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }
  body.theme-ashen .ruins-node-level{
    min-width:18px!important;
    height:18px!important;
    font-size:9px!important;
  }
  body.theme-ashen .ruins-start-marker{margin-top:0!important;padding-bottom:2px!important}
  body.theme-ashen .ruins-start-marker strong{font-size:11px!important}
  body.theme-ashen .ruins-start-marker small{font-size:8px!important}
  body.theme-ashen .ruins-medallion-node.available .ruins-medallion-shell{animation:none!important}
}

@media(max-height:720px) and (max-width:479px){
  body.theme-ashen.screen-ruins-active .ruins-screen-head{gap:5px!important}
  body.theme-ashen.screen-ruins-active .ruins-screen-head h2{font-size:18px!important}
  body.theme-ashen.screen-ruins-active .ruins-rules{margin-top:5px!important}
  body.theme-ashen.screen-ruins-active .ruins-active-run:not([hidden]){margin-top:5px!important;gap:4px!important}
  body.theme-ashen.screen-ruins-active .ruins-leave-button{min-height:40px!important;padding:6px 8px!important;font-size:11px!important}
}

/* === rc41: stable combat feedback, explicit Berserk state, Path isolation. === */

/* Berserk is a persistent card state, not a transient line in the mechanics panel. */
body.theme-ashen .enemy-combat-scene{position:relative}

/* One gameplay event produces one visible recoil: no opposite-direction second shake. */

/* Full label is for wide layouts only. Phone buttons always use a stable one-line label. */
@media(max-width:520px){
  body.theme-ashen .crushing-action{min-width:0!important;padding-inline:7px!important;overflow:hidden!important}
  body.theme-ashen .crushing-action small{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}

/* Path owns its internal geometry; global density tokens may change spacing, not layout. */
body.theme-ashen.screen-map-active .path-tabs{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  align-items:stretch!important;
  width:100%!important;
  box-sizing:border-box!important;
}
body.theme-ashen.screen-map-active .path-tab-button{
  width:100%!important;
  min-width:0!important;
  height:auto!important;
  min-height:var(--ff-tab-height)!important;
  margin:0!important;
  box-sizing:border-box!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  line-height:1!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  transform:none!important;
}
body.theme-ashen.screen-map-active .path-tab-button.active,
body.theme-ashen.screen-map-active .path-tab-button:active{transform:none!important}
body.theme-ashen.screen-map-active .map-chapter-details{
  width:100%!important;
  min-width:0!important;
  box-sizing:border-box!important;
}
body.theme-ashen.screen-map-active .map-chapter-details>.map-chapter-summary{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  align-items:center!important;
  width:100%!important;
  min-width:0!important;
  box-sizing:border-box!important;
  margin:0!important;
}
body.theme-ashen.screen-map-active .map-chapter-summary>span{
  min-width:0!important;
  overflow:hidden!important;
}
body.theme-ashen.screen-map-active .map-chapter-summary>span strong{
  display:-webkit-box!important;
  max-width:100%!important;
  overflow:hidden!important;
  overflow-wrap:anywhere!important;
  -webkit-box-orient:vertical!important;
  -webkit-line-clamp:2!important;
}
body.theme-ashen.screen-map-active .map-chapter-summary>em{
  min-width:0!important;
  max-width:118px!important;
  justify-self:end!important;
  text-align:right!important;
  white-space:normal!important;
  line-height:1.15!important;
}
body.theme-ashen.screen-map-active .chapter-map-list{
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  align-items:stretch!important;
  width:auto!important;
  min-width:0!important;
}
body.theme-ashen.screen-map-active .chapter-map-list .location-button{
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  align-content:center!important;
  justify-items:start!important;
  width:100%!important;
  min-width:0!important;
  min-height:58px!important;
  height:auto!important;
  margin:0!important;
  box-sizing:border-box!important;
  text-align:left!important;
  transform:none!important;
  overflow:hidden!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{
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:normal!important;
  text-align:left!important;
}
body.theme-ashen.screen-map-active .chapter-map-list .location-button.active,
body.theme-ashen.screen-map-active .chapter-map-list .location-button:active{transform:none!important}

/* Slightly larger header values without increasing the outer header or pill geometry. */
body.theme-ashen .top-summary>span{
  font-size:clamp(10px,2.65vw,13px)!important;
  line-height:1!important;
}
body.theme-ashen .top-summary>span strong,
body.theme-ashen #topGold,
body.theme-ashen #topShards{
  font-size:1.09em!important;
  line-height:1!important;
}
body.theme-ashen .top-summary .top-shards{letter-spacing:.01em!important}

@media(max-width:380px){
  body.theme-ashen.screen-map-active .path-tab-button{font-size:10px!important;letter-spacing:0!important}
  body.theme-ashen.screen-map-active .map-chapter-summary>em{max-width:92px!important;font-size:9px!important}
  body.theme-ashen.screen-map-active .chapter-map-list .location-button{min-height:54px!important}
}

@media(prefers-reduced-motion:reduce){
  body.theme-ashen .combatant-enemy.enemy-berserk-enter,
  body.theme-ashen .combatant.hit,
  body.theme-ashen .combatant.hit-strong,
  body.theme-ashen .combatant.hit-perfect,
  body.theme-ashen .combatant.hit-critical,
  body.theme-ashen .combatant.hit-power{animation:none!important}
}
