/* ASTERVEIL V9 — clean female atlas edge, HD Luna portrait,
   one stage-wide character scale system and decoded Iris 12-frame battle art. */
/* The legacy 3-by-2 atlas has a few stray pixels along lower female-cell
   borders. Crop only its transparent lower band; NEVER crop combat canvases. */
body.av-ui-ready #creator .hero-sprite[data-avatar-gender="female"],
body.av-ui-ready #characterSelect .hero-sprite[data-avatar-gender="female"],
body.av-ui-ready #profile .hero-sprite[data-avatar-gender="female"],
body.av-ui-ready #equipment .hero-sprite[data-avatar-gender="female"],
body.av-ui-ready #wardrobe .hero-sprite[data-avatar-gender="female"]{
 -webkit-mask-image:linear-gradient(to bottom,#000 0%,#000 91%,rgba(0,0,0,.82) 93%,transparent 97%);
 mask-image:linear-gradient(to bottom,#000 0%,#000 91%,rgba(0,0,0,.82) 93%,transparent 97%);
}
/* If no decoded specialty art is available, apply the same atlas cleanup
   to the female combat sprite. Avoid masking genuine animation silhouettes. */
body.av-ui-ready #battleStage.battle-command-v3 .ally #battleHero.hero-sprite[data-avatar-gender="female"]:not(.has-luna-frames):not(.has-meta-frames):not(.has-adam-frames):not(.has-iris-frames){
 -webkit-mask-image:linear-gradient(to bottom,#000 0%,#000 91%,rgba(0,0,0,.82) 93%,transparent 97%);
 mask-image:linear-gradient(to bottom,#000 0%,#000 91%,rgba(0,0,0,.82) 93%,transparent 97%);
}
body.av-ui-ready #battleStage.battle-command-v3 .ally #battleHero.has-iris-frames,
body.av-ui-ready #battleStage.battle-command-v3 .ally #battleHero.has-luna-frames,
body.av-ui-ready #battleStage.battle-command-v3 .ally #battleHero.has-adam-frames{
 -webkit-mask-image:none!important;mask-image:none!important;
}
/* The old 7-kB Luna thumbnail is retired. Use the approved sharp HD image
   in the hero HUD, matching the full-size light-novel character artwork. */
body.av-ui-ready #battleStage.battle-command-v3 .hd2d-hero-portrait.female-mage-portrait{
 background-image:url('/game/asterveil/animation/luna-portrait-hd.webp')!important;
 background-repeat:no-repeat!important;
 background-size:contain!important;
 background-position:center!important;
}
/* All classes share exactly the same geometry and scale in their battle slot.
   Per-role artwork uses object-fit:contain, not class-specific zoom. */
body.av-ui-ready #battleStage.battle-command-v3 .stage-combatants .combatant.ally #battleHero.hero-sprite{
 width:clamp(155px,24cqw,286px)!important;
 height:clamp(205px,30cqw,355px)!important;
 max-height:calc(100% - 19px)!important;
 scale:var(--combat-display-scale,.96)!important;
 translate:var(--combat-display-x,0px) var(--combat-display-y,3px);
 transform-origin:center bottom;
}
@container av3-stage (max-width:780px){
 body.av-ui-ready #battleStage.battle-command-v3 .stage-combatants .combatant.ally #battleHero.hero-sprite{
  width:clamp(128px,28cqw,205px)!important;
  height:clamp(177px,38cqw,285px)!important;
  scale:var(--combat-display-mobile-scale,.98)!important;
 }
}
@container av3-stage (max-width:500px){
 body.av-ui-ready #battleStage.battle-command-v3 .stage-combatants .combatant.ally #battleHero.hero-sprite{
  width:clamp(112px,33cqw,158px)!important;
  height:clamp(159px,49cqw,207px)!important;
 }
}
/* Iris has 12 verified original WebP poses; keep one canvas, not a second
   backdrop or double-exposed character. Preserve foot position in the slot. */
body.av-ui-ready #battleStage.battle-command-v3 .ally #battleHero.hero-sprite.has-iris-frames{
 position:relative!important;
 isolation:isolate;
 background-image:none!important;
 background-color:transparent!important;
 background-repeat:no-repeat!important;
 animation:none!important;
 transform:none!important;
 filter:drop-shadow(0 8px 6px rgba(3,9,29,.42));
}
body.av-ui-ready #battleStage.battle-command-v3 .ally #battleHero.hero-sprite.has-iris-frames .iris-frame-canvas{
 display:block!important;position:absolute!important;
 inset:0;width:100%!important;height:100%!important;
 max-width:100%;max-height:100%;
 object-fit:contain;pointer-events:none;
 opacity:1!important;visibility:visible!important;
 image-rendering:auto;transform:none!important;
}
body.av-ui-ready #battleStage.battle-command-v3.attack.ranger .ally #battleHero.hero-sprite.has-iris-frames{
 animation:none!important;transform:none!important;
}
/* 420ms arrow flight is owned by the same timing constant in game.js.
   The bow-string sound and the drawn projectile now share the release frame. */
body.av-ui-ready #battleStage.battle-command-v3 .iris-straight-arrow.in-flight{
 animation:av7ArrowFly .42s linear both!important;
}
/* Keep enemy hit reaction near the ARRIVAL, not near the initial bow draw. */
body.av-ui-ready #battleStage.battle-command-v3.attack.ranger .enemy-unit .monster-sprite{
 animation:av9RangerImpact 1.7s linear both!important;
}
@keyframes av9RangerImpact{
 0%,61%{transform:translate3d(0,0,0) scale(1);filter:brightness(1)}
 69%{transform:translate3d(6px,0,0) scale(.99);filter:brightness(1.15)}
 80%{transform:translate3d(-2px,0,0) scale(1.005);filter:brightness(1.06)}
 100%{transform:translate3d(0,0,0) scale(1);filter:brightness(1)}
}
@media(prefers-reduced-motion:reduce){
 body.av-ui-ready #battleStage.battle-command-v3.attack.ranger .enemy-unit .monster-sprite{
  animation:none!important;
 }
}
