/* ASTERVEIL full battle-screen redesign v2 — visual-only preview; preserve original IDs, auth, server scoring */
body.battle-redesign-v2{background:#091626;color:#f5e8c9}
.battle-redesign-v2 .hero{min-height:155px;padding:24px 0;background:linear-gradient(90deg,#081726ed,#122b43d5),url('/game/asterveil/asterveil-hero-banner.webp') center/cover}
.battle-redesign-v2 .hero h1{font-size:clamp(36px,5vw,62px)}
.battle-redesign-v2 .hero p{margin-bottom:0}
.battle-redesign-v2 main.wrap{max-width:1540px;padding:20px 24px 60px}
.battle-redesign-v2 #play.grid{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:18px}
.battle-redesign-v2 #play.grid.hide{display:none!important}
.battle-redesign-v2 #play>.panel,.battle-redesign-v2 #play>div>.panel{background:linear-gradient(160deg,#13243ce8,#0a182eea);border:1px solid #aa8656;border-radius:16px;box-shadow:0 12px 45px #0008;padding:20px}
.battle-redesign-v2 #play .panel h2{font-family:Marcellus,Georgia,serif;color:#f4d9a2}
.battle-redesign-v2 #play .eyebrow{color:#d8b678;letter-spacing:.14em}
.battle-redesign-v2 #play .pill{background:#1b2a43;color:#f6d99f;border:1px solid #b08b53}
.battle-redesign-v2 .game-vellotale .battle-stage.hd2d-stage,.battle-redesign-v2 .battle-stage.hd2d-stage{height:clamp(360px,40vw,590px);border:3px solid #c49d5d;border-radius:12px;background:radial-gradient(ellipse at 70% 17%,#5b4f8a55,transparent 45%),linear-gradient(180deg,#07162c,#193854 57%,#1b443e 100%)}
.battle-redesign-v2 .hd2d-stage .hd2d-backdrop{background:radial-gradient(ellipse at 75% 23%,#a14db633,transparent 28%),radial-gradient(ellipse at 22% 40%,#257f9455,transparent 43%)}
.battle-redesign-v2 .hd2d-stage .hd2d-platform{bottom:-10%;height:54%;background:repeating-linear-gradient(90deg,#687a75 0 83px,#2c4b4e 84px 87px);border-top:5px solid #d8b983}
.battle-redesign-v2 .hd2d-tactical-tiles{position:absolute;inset:58% -10% -20%;transform:perspective(480px) rotateX(57deg);background:repeating-linear-gradient(0deg,transparent 0 61px,#e7bd7466 62px 65px),repeating-linear-gradient(90deg,transparent 0 72px,#e7bd7466 73px 76px);opacity:.75;pointer-events:none;z-index:2}
.battle-redesign-v2 .hd2d-versus{position:absolute;z-index:5;top:23%;left:50%;transform:translateX(-50%);font:italic 700 clamp(24px,4vw,50px) Georgia,serif;color:#fff1c7;text-shadow:0 0 10px #ffbd57,0 0 30px #f5a43b}
.battle-redesign-v2 .hd2d-stage .stage-combatants{inset:76px 16px 28px}
.battle-redesign-v2 .hd2d-stage .ally .hero-sprite{width:clamp(150px,20vw,255px);height:clamp(210px,30vw,355px);filter:drop-shadow(0 12px 8px #040c16a8)}
.battle-redesign-v2 .hd2d-stage .enemy-unit .monster-sprite{width:clamp(190px,28vw,365px);height:clamp(220px,29vw,355px)}
.battle-redesign-v2 .hd2d-stage .combatant small{border:1px solid #f3c47b;background:#071629ed;color:#fff1d1;font-size:13px}
.battle-redesign-v2 .hd2d-stage .hd2d-topline{font-size:clamp(11px,1.3vw,17px)}
.battle-redesign-v2 #arena{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.battle-redesign-v2 #battleStage{grid-column:1/-1;grid-row:1}
.battle-redesign-v2 #arena .enemy{grid-column:1/-1;grid-row:2;background:#101f35;border:1px solid #92734f;color:#f8e4bf;border-radius:10px;padding:12px 18px}
.battle-redesign-v2 #arena .enemy .muted{color:#c2cbd5}
.battle-redesign-v2 #arena .battleword{grid-column:1/-1;grid-row:3;background:linear-gradient(140deg,#101e35,#09182c);border:2px solid #b9955d;border-radius:12px;padding:22px 18px;text-align:center;box-shadow:inset 0 0 24px #d2aa5422}
.battle-redesign-v2 #arena .battleword .letters{font:700 clamp(38px,5vw,68px) Georgia,serif;letter-spacing:.08em;color:#ffdf9d;text-shadow:0 0 20px #ffc65a55}
.battle-redesign-v2 #arena .battleword .muted{color:#e3d4b7}
.battle-redesign-v2 #arena #answerChoices{grid-column:1/-1;grid-row:4;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.battle-redesign-v2 #arena #answerChoices .choice{min-height:60px;background:linear-gradient(160deg,#1a2e48,#10233b);border:1px solid #a98a60;color:#f8e7c8;font:600 clamp(17px,2vw,24px) Georgia,serif;border-radius:9px;box-shadow:inset 0 0 15px #a9913320;transition:background .2s,border-color .2s,transform .2s}
.battle-redesign-v2 #arena #answerChoices .choice:hover:not(:disabled){transform:translateY(-2px);background:#34415a;border-color:#ffe1a2;box-shadow:0 0 15px #f8ce7944}
.battle-redesign-v2 #arena #feedback{grid-column:1/-1;grid-row:5}
.battle-redesign-v2 #arena>.row.between{grid-column:1/-1;grid-row:6}
.battle-redesign-v2 #play aside .panel{background:#101e33;border:1px solid #9d7e54;color:#f0dfc3;border-radius:12px;margin-bottom:14px}
.battle-redesign-v2 #play aside .panel .rank{background:#1b3044;color:#f4dca9;border:1px solid #756247}
.battle-redesign-v2 #play aside .panel .notice{background:#172d40;color:#f3d9a2;border:1px solid #7d694d}
.battle-redesign-v2 #play aside .panel .muted{color:#bfc9d0}
.battle-redesign-v2 #play aside .panel .choice{background:#203a4c;color:#f8dfb6;border-color:#8f7958}
.battle-redesign-v2 #play aside .panel .meter{background:#30404c}
.battle-redesign-v2 #play aside .panel #quests{color:#d9e5d9}
.battle-redesign-v2 #result{padding:45px 25px;background:radial-gradient(ellipse at top,#8b693b44,transparent 60%);border:1px solid #ab8853;border-radius:12px}
.battle-redesign-v2 #result h2{font:700 46px Marcellus,Georgia,serif}
@media(min-width:1100px){.battle-redesign-v2 main.wrap{max-width:1640px}.battle-redesign-v2 #play.grid{grid-template-columns:minmax(0,1fr) 350px}}
@media(max-width:950px){.battle-redesign-v2 #play.grid{grid-template-columns:minmax(0,1fr)}.battle-redesign-v2 #play aside{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.battle-redesign-v2 #play aside .panel{margin:0}.battle-redesign-v2 .battle-stage.hd2d-stage{height:410px}}
@media(max-width:620px){.battle-redesign-v2 main.wrap{padding:10px 8px 45px}.battle-redesign-v2 #play>.panel,.battle-redesign-v2 #play>div>.panel{padding:12px}.battle-redesign-v2 #play aside{display:block}.battle-redesign-v2 #play aside .panel{margin-bottom:12px}.battle-redesign-v2 .battle-stage.hd2d-stage{height:290px}.battle-redesign-v2 .hd2d-stage .stage-combatants{inset:56px 4px 22px}.battle-redesign-v2 .hd2d-stage .ally .hero-sprite{width:130px;height:170px}.battle-redesign-v2 .hd2d-stage .enemy-unit .monster-sprite{width:170px;height:175px}.battle-redesign-v2 .hd2d-versus{top:25%}.battle-redesign-v2 #arena #answerChoices .choice{min-height:52px;font-size:17px}.battle-redesign-v2 #arena .battleword{padding:15px 9px}.battle-redesign-v2 #arena .battleword .letters{font-size:38px}}

/* Live combat HUD and stage choreography */
.battle-redesign-v2 .hd2d-battle-hud{position:absolute;z-index:7;left:15px;right:15px;top:54px;display:flex;justify-content:space-between;align-items:flex-start;gap:clamp(50px,15vw,200px);pointer-events:none}
.battle-redesign-v2 .hd2d-hud-unit{width:min(36%,300px);min-width:115px;padding:10px 12px;background:linear-gradient(100deg,#0b172de8,#172944c9);border:1px solid #c29c5b;border-radius:8px;box-shadow:0 5px 15px #030b19aa;color:#f9e8bf}
.battle-redesign-v2 .hd2d-hud-unit strong{display:block;font:700 clamp(12px,1.5vw,20px) Georgia,serif;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.battle-redesign-v2 .hd2d-hud-unit small{display:block;font-size:10px;letter-spacing:.12em;color:#d9b783}
.battle-redesign-v2 .hd2d-hud-unit>span{font-size:11px;display:block;text-align:right;margin-top:3px}
.battle-redesign-v2 .hd2d-hud-track{height:11px;border:1px solid #a08b6d;border-radius:6px;background:#342e39;overflow:hidden;margin-top:5px}
.battle-redesign-v2 .hd2d-hud-track span{display:block;height:100%;width:100%;background:linear-gradient(90deg,#2b9e66,#87e48d);transition:width .4s ease}
.battle-redesign-v2 .hd2d-hud-enemy .hd2d-hud-track span{background:linear-gradient(90deg,#a92f50,#ff7779)}
.battle-redesign-v2 .hd2d-hud-enemy{text-align:right}
.battle-redesign-v2 .hd2d-stage.attack .hd2d-tactical-tiles{animation:hd2dTileFlash .8s ease-out}
.battle-redesign-v2 .hd2d-stage.miss .hd2d-tactical-tiles{animation:hd2dTileDanger .85s ease-out}
.battle-redesign-v2 .hd2d-stage.attack .hd2d-versus{animation:hd2dVsPulse 1s ease-out}
@keyframes hd2dTileFlash{0%,100%{filter:brightness(1)}40%{filter:brightness(2.2)}}
@keyframes hd2dTileDanger{0%,100%{filter:none}40%{filter:hue-rotate(140deg) brightness(1.8)}}
@keyframes hd2dVsPulse{0%,100%{transform:translateX(-50%) scale(1)}40%{transform:translateX(-50%) scale(1.3);filter:brightness(2)}}
@media(max-width:620px){.battle-redesign-v2 .hd2d-battle-hud{top:48px;left:5px;right:5px;gap:38px}.battle-redesign-v2 .hd2d-hud-unit{padding:5px 6px;min-width:90px;width:38%}.battle-redesign-v2 .hd2d-hud-unit strong{font-size:11px}.battle-redesign-v2 .hd2d-hud-unit small{font-size:8px}.battle-redesign-v2 .hd2d-hud-unit>span{font-size:9px}.battle-redesign-v2 .hd2d-hud-track{height:7px}.battle-redesign-v2 .hd2d-versus{top:43%}}

/* Combat animations must override the idle stance in the HD-2D redesign. */
.battle-redesign-v2 .hd2d-stage.attack.warrior .ally .hero-sprite{animation:vtBladeDash .86s cubic-bezier(.2,.75,.25,1) both!important}
.battle-redesign-v2 .hd2d-stage.attack.mage .ally .hero-sprite{animation:vtMageCast 1s ease-in-out both!important}
.battle-redesign-v2 .hd2d-stage.attack.ranger .ally .hero-sprite{animation:vtArcherRelease .9s ease-out both!important}
.battle-redesign-v2 .hd2d-stage.attack .enemy-unit .monster-sprite{animation:vtEnemyImpact .82s ease-out both!important}
.battle-redesign-v2 .hd2d-stage.miss .enemy-unit .monster-sprite{animation:vtEnemyLunge .82s ease-out both!important}
.battle-redesign-v2 .hd2d-stage.miss .ally .hero-sprite{animation:vtHeroRecoil .82s ease-out both!important}
.battle-redesign-v2 .hd2d-stage.attack.warrior .hit-effect{z-index:6}
.battle-redesign-v2 .hd2d-stage.attack.mage .hit-effect{z-index:6}
.battle-redesign-v2 .hd2d-stage.attack.ranger .hit-effect{z-index:6}
@media(prefers-reduced-motion:reduce){.battle-redesign-v2 .hd2d-stage.attack .ally .hero-sprite,.battle-redesign-v2 .hd2d-stage.attack .enemy-unit .monster-sprite,.battle-redesign-v2 .hd2d-stage.miss .ally .hero-sprite,.battle-redesign-v2 .hd2d-stage.miss .enemy-unit .monster-sprite{animation:none!important}}

/* Cinematic job-specific weapon trails and responsive arena motion */
.battle-redesign-v2 .hd2d-stage:before{content:"";position:absolute;inset:0;z-index:1;pointer-events:none;background:linear-gradient(110deg,transparent 30%,#d5f1ff12 44%,transparent 58%);mix-blend-mode:screen}
.battle-redesign-v2 .hd2d-stage .ally:after{content:"";position:absolute;left:48%;top:25%;width:20px;height:20px;border:2px solid #e6c784;border-radius:50%;opacity:0;pointer-events:none}
.battle-redesign-v2 .hd2d-stage.attack.mage .ally:after{animation:vtMagicSigil 1.05s ease-out both;box-shadow:0 0 0 8px #a476f633,0 0 0 18px #bca1ff22,0 0 40px #ab8dff}
.battle-redesign-v2 .hd2d-stage.attack.ranger .ally:after{animation:vtRangerDraw .9s ease-out both;border-radius:0;width:125px;height:3px;background:linear-gradient(90deg,#f2e2a3,#a9ffed);box-shadow:0 0 14px #9bffe9}
.battle-redesign-v2 .hd2d-stage.attack.warrior .ally:after{animation:vtWarriorBlade .85s ease-out both;border-radius:0;width:115px;height:6px;background:linear-gradient(90deg,transparent,#fff6c3 30%,#ffe08d 80%,transparent);box-shadow:0 0 16px #f9c86a}
.battle-redesign-v2 .hd2d-stage.attack.mage .hd2d-platform{animation:vtGroundSpell 1.1s ease-out}
.battle-redesign-v2 .hd2d-stage.attack.warrior .hd2d-platform{animation:vtGroundImpact .8s ease-out}
.battle-redesign-v2 .hd2d-stage.attack.ranger .hd2d-motes{animation:vtRangerWind .95s ease-out}
.battle-redesign-v2 .hd2d-stage.miss .hd2d-versus{animation:vtCounterPulse .8s ease-out}
@keyframes vtMagicSigil{0%{opacity:0;transform:translate(0,0) scale(.2) rotate(0)}30%{opacity:1;transform:translate(12px,-14px) scale(3) rotate(45deg)}70%{opacity:.9;transform:translate(160px,-20px) scale(5) rotate(180deg)}100%{opacity:0;transform:translate(260px,-20px) scale(7) rotate(270deg)}}
@keyframes vtRangerDraw{0%{opacity:0;transform:translate(-20px,10px) scaleX(.3)}30%{opacity:1;transform:translate(20px,0) scaleX(1)}70%{opacity:1;transform:translate(190px,-15px) scaleX(1.3)}100%{opacity:0;transform:translate(320px,-20px) scaleX(.3)}}
@keyframes vtWarriorBlade{0%{opacity:0;transform:translate(-15px,20px) rotate(-80deg) scale(.3)}35%{opacity:1;transform:translate(50px,-25px) rotate(30deg) scale(1.1)}65%{opacity:1;transform:translate(150px,0) rotate(130deg) scale(1.3)}100%{opacity:0;transform:translate(210px,20px) rotate(160deg) scale(.2)}}
@keyframes vtGroundSpell{0%,100%{filter:none}50%{filter:hue-rotate(95deg) brightness(1.6)}}
@keyframes vtGroundImpact{0%,100%{transform:perspective(480px) rotateX(48deg)}40%{transform:perspective(480px) rotateX(48deg) translateY(5px)}}
@keyframes vtRangerWind{0%,100%{transform:translateX(0)}45%{transform:translateX(24px)}}
@keyframes vtCounterPulse{0%,100%{color:#fff1c7}40%{color:#ff7794;text-shadow:0 0 22px #ff3c67}}
@media(prefers-reduced-motion:reduce){.battle-redesign-v2 .hd2d-stage .ally:after,.battle-redesign-v2 .hd2d-stage .hd2d-platform,.battle-redesign-v2 .hd2d-stage .hd2d-motes,.battle-redesign-v2 .hd2d-stage .hd2d-versus{animation:none!important}}

/* Integrated original scenic asset; UI and actors remain independent layers */
.battle-redesign-v2 .battle-stage.hd2d-stage{background:#172d43 url('/game/asterveil/assets/hd2d-echo-forest.svg') center 46%/cover no-repeat!important}
.battle-redesign-v2 .hd2d-stage .hd2d-backdrop{opacity:.18}
.battle-redesign-v2 .hd2d-stage .hd2d-platform{opacity:.22}
.battle-redesign-v2 .hd2d-stage .hd2d-tactical-tiles{opacity:.22}
.battle-redesign-v2 .hd2d-stage .stage-combatants{filter:drop-shadow(0 12px 9px #0a1724a8)}

/* Victory/defeat choreography for the selected class */
.battle-redesign-v2 .hd2d-stage.battle-victory .ally .hero-sprite{animation:vtVictoryPose 1.5s ease-out 1 both!important}
.battle-redesign-v2 .hd2d-stage.battle-victory .enemy-unit .monster-sprite{animation:vtMonsterFall 1.2s ease-out 1 both!important}
.battle-redesign-v2 .hd2d-stage.battle-defeat .ally .hero-sprite{animation:vtHeroDown 1.1s ease-out 1 both!important}
.battle-redesign-v2 .hd2d-stage.battle-victory .hd2d-motes{animation:vtVictoryGlitter 2s ease-out 1 both!important}
@keyframes vtVictoryPose{0%{transform:translateY(0) scale(1)}35%{transform:translateY(-32px) scale(1.08)}65%{transform:translateY(-16px) scale(1.04)}100%{transform:translateY(0) scale(1)}}
@keyframes vtMonsterFall{0%{opacity:1;transform:translateY(0) scale(1)}40%{opacity:.85;transform:translateY(20px) rotate(5deg)}100%{opacity:.15;transform:translateY(55px) scale(.83) rotate(12deg)}}
@keyframes vtHeroDown{0%{transform:translateY(0)}50%{transform:translateY(10px) rotate(-8deg)}100%{transform:translateY(24px) rotate(-10deg);filter:grayscale(.6)}}
@keyframes vtVictoryGlitter{0%{opacity:.3;filter:brightness(1)}50%{opacity:1;filter:brightness(2.4)}100%{opacity:.7;filter:brightness(1.2)}}
@media(prefers-reduced-motion:reduce){.battle-redesign-v2 .hd2d-stage.battle-victory .ally .hero-sprite,.battle-redesign-v2 .hd2d-stage.battle-victory .enemy-unit .monster-sprite,.battle-redesign-v2 .hd2d-stage.battle-defeat .ally .hero-sprite,.battle-redesign-v2 .hd2d-stage.battle-victory .hd2d-motes{animation:none!important}}

/* Optional preloaded class pose artwork. Original character portrait remains the fallback. */
.battle-redesign-v2 .hd2d-stage .hero-sprite.has-combat-pose{background-image:var(--pose-image)!important;background-size:contain!important;background-position:center bottom!important;background-repeat:no-repeat!important}
.battle-redesign-v2 .hd2d-stage .hero-sprite.has-combat-pose:after{content:none!important}

/* Production-art-preserving motion: animate the existing detailed portraits, never replace them. */
@keyframes vtBladeDash{0%,100%{transform:translate3d(0,0,0) rotate(0);filter:drop-shadow(0 12px 8px #040c16a8)}25%{transform:translate3d(-18px,5px,0) rotate(-7deg)}53%{transform:translate3d(72px,-13px,0) rotate(12deg);filter:drop-shadow(0 0 22px #ffda8b)}72%{transform:translate3d(28px,0,0) rotate(-3deg)}}
@keyframes vtMageCast{0%,100%{transform:translate3d(0,0,0) scale(1);filter:drop-shadow(0 12px 8px #040c16a8)}25%{transform:translate3d(-8px,-8px,0) rotate(-5deg)}55%{transform:translate3d(7px,-20px,0) scale(1.08);filter:drop-shadow(0 0 32px #c98dff)}80%{transform:translate3d(0,-5px,0)}}
@keyframes vtArcherRelease{0%,100%{transform:translate3d(0,0,0) rotate(0)}30%{transform:translate3d(-24px,-5px,0) rotate(-7deg)}58%{transform:translate3d(17px,-8px,0) rotate(6deg);filter:drop-shadow(0 0 22px #b5f8d5)}}
@keyframes vtEnemyImpact{0%,100%{transform:translate3d(0,0,0);filter:brightness(1)}35%{transform:translate3d(18px,-8px,0) rotate(5deg);filter:brightness(2.3)}65%{transform:translate3d(-12px,7px,0) rotate(-4deg);filter:brightness(1.3)}}
@keyframes vtEnemyLunge{0%,100%{transform:translate3d(0,0,0)}40%{transform:translate3d(-55px,-9px,0) scale(1.07)}70%{transform:translate3d(-12px,0,0)}}
@keyframes vtHeroRecoil{0%,100%{transform:translate3d(0,0,0);filter:brightness(1)}38%{transform:translate3d(-19px,12px,0) rotate(-8deg);filter:brightness(1.7)}68%{transform:translate3d(8px,3px,0) rotate(3deg)}}
@keyframes vtIdleBreathe{0%,100%{transform:translate3d(0,0,0)}50%{transform:translate3d(0,-5px,0)}}
@keyframes vtIdleHover{0%,100%{transform:translate3d(0,0,0)}50%{transform:translate3d(0,-7px,0)}}
.battle-redesign-v2 .hd2d-stage:not(.attack):not(.miss):not(.battle-victory):not(.battle-defeat) .ally .hero-sprite{animation:vtIdleBreathe 3.2s ease-in-out infinite}
.battle-redesign-v2 .hd2d-stage:not(.attack):not(.miss):not(.battle-victory):not(.battle-defeat) .enemy-unit .monster-sprite{animation:vtIdleHover 3.8s ease-in-out infinite}
@media(prefers-reduced-motion:reduce){.battle-redesign-v2 .hd2d-stage .ally .hero-sprite,.battle-redesign-v2 .hd2d-stage .enemy-unit .monster-sprite{animation:none!important}}

/* Clearly visible battle choreography and ambient stage, preserving approved character art. */
@keyframes vtAuraOrbit{0%{transform:translate(-50%,-50%) rotate(0deg) scale(.9);opacity:.35}50%{opacity:.85}100%{transform:translate(-50%,-50%) rotate(360deg) scale(1.07);opacity:.35}}
@keyframes vtRunePulse{0%,100%{opacity:.3;transform:translateX(-50%) perspective(250px) rotateX(65deg) scale(.86)}50%{opacity:.85;transform:translateX(-50%) perspective(250px) rotateX(65deg) scale(1.15)}}
.battle-redesign-v2 .hd2d-stage .ally:before{content:"";position:absolute;z-index:0;left:50%;top:58%;width:clamp(125px,17vw,225px);aspect-ratio:1;border:3px solid #c49aff80;border-radius:50%;box-shadow:0 0 22px #ae79ff99,inset 0 0 24px #b08aff77;background:radial-gradient(circle,#c29aff38,transparent 68%);pointer-events:none;animation:vtAuraOrbit 6s linear infinite}
.battle-redesign-v2 .hd2d-stage .ally:after{content:"✧  ✦  ✧";position:absolute;z-index:1;bottom:4%;left:50%;color:#f6caff;font-size:23px;letter-spacing:12px;text-shadow:0 0 15px #d39aff;pointer-events:none;animation:vtRunePulse 2.6s ease-in-out infinite}
.battle-redesign-v2 .hd2d-stage.attack .ally:before{animation:vtAuraOrbit .65s linear 1;box-shadow:0 0 65px #c997ff,inset 0 0 35px #f3ccff;background:radial-gradient(circle,#e5baff9a,transparent 75%)}
.battle-redesign-v2 .hd2d-stage.attack .ally:after{color:#fff0a5;text-shadow:0 0 25px #ffe3aa}
.battle-redesign-v2 .hd2d-stage .ally .hero-sprite{position:relative;z-index:2}
@media(prefers-reduced-motion:reduce){.battle-redesign-v2 .hd2d-stage .ally:before,.battle-redesign-v2 .hd2d-stage .ally:after{animation:none!important}}

/* HD-2D combat spell choreography: full-stage projectile travels from hero to enemy.
   Visual-only; server remains sole authority for HP, XP and score. */
@keyframes vtArcaneProjectile{0%,12%{left:31%;top:55%;transform:translate(-50%,-50%) scale(.15);opacity:0}24%{opacity:1;transform:translate(-50%,-50%) scale(.85)}62%{left:74%;top:54%;transform:translate(-50%,-50%) scale(1.3);opacity:1}77%{left:75%;top:54%;transform:translate(-50%,-50%) scale(2.7);opacity:1}100%{left:75%;top:54%;transform:translate(-50%,-50%) scale(3.4);opacity:0}}
@keyframes vtArcaneBeam{0%,24%{opacity:0;transform:scaleX(.02)}35%{opacity:1}70%{opacity:1;transform:scaleX(1)}100%{opacity:0;transform:scaleX(1)}}
@keyframes vtArcaneImpact{0%,58%{opacity:0;transform:translate(-50%,-50%) scale(.15)}74%{opacity:1;transform:translate(-50%,-50%) scale(1.2)}100%{opacity:0;transform:translate(-50%,-50%) scale(2.4)}}
.battle-redesign-v2 .hd2d-stage .battle-action-effect{pointer-events:none;z-index:15}
.battle-redesign-v2 .hd2d-stage.attack.mage .battle-action-effect:before{content:"✦";position:absolute;left:31%;top:55%;font-size:clamp(36px,6vw,90px);line-height:1;color:#fff;z-index:3;text-shadow:0 0 9px #fff,0 0 22px #e7a2ff,0 0 44px #b448ff,0 0 70px #8a27ff;animation:vtArcaneProjectile 1.7s ease-in-out both}
.battle-redesign-v2 .hd2d-stage.attack.mage .battle-action-effect:after{content:"";position:absolute;left:31%;top:54%;width:44%;height:12px;transform-origin:left center;border-radius:99px;background:linear-gradient(90deg,#9b4cff33,#f6baff,#fff,#c363ff);box-shadow:0 0 14px 6px #c263ff,0 0 40px #9d45ff;animation:vtArcaneBeam 1.7s ease-in-out both}
.battle-redesign-v2 .hd2d-stage.attack.mage .enemy-unit:after{content:"✧";position:absolute;left:50%;top:43%;z-index:10;font-size:clamp(65px,10vw,150px);color:#fff;text-shadow:0 0 20px #fff,0 0 45px #e6a3ff,0 0 80px #a83cff;animation:vtArcaneImpact 1.7s ease-out both;pointer-events:none}
@media(prefers-reduced-motion:reduce){.battle-redesign-v2 .hd2d-stage.attack.mage .battle-action-effect:before,.battle-redesign-v2 .hd2d-stage.attack.mage .battle-action-effect:after,.battle-redesign-v2 .hd2d-stage.attack.mage .enemy-unit:after{animation:none!important;opacity:.45}}

/* Choreographed class attacks: windup, release, enemy impact, recovery. */
@keyframes vtMageChoreography{0%,100%{transform:translate(0,0) rotate(0)}12%{transform:translate(-9px,7px) rotate(-5deg)}30%{transform:translate(-3px,-20px) rotate(-10deg);filter:drop-shadow(0 0 25px #b875ff)}46%{transform:translate(13px,-25px) rotate(9deg);filter:drop-shadow(0 0 40px #f4bcff)}65%{transform:translate(5px,-12px) rotate(3deg)}}
@keyframes vtWarriorChoreography{0%,100%{transform:translate(0,0) rotate(0)}18%{transform:translate(-20px,5px) rotate(-12deg)}40%{transform:translate(60px,-17px) rotate(13deg)}60%{transform:translate(32px,-5px) rotate(-4deg)}}
@keyframes vtRangerChoreography{0%,100%{transform:translate(0,0) rotate(0)}22%{transform:translate(-20px,-7px) rotate(-8deg)}43%{transform:translate(9px,-10px) rotate(6deg)}}
@keyframes vtHitChoreography{0%,35%,100%{transform:translate(0,0) rotate(0);filter:brightness(1)}53%{transform:translate(21px,-13px) rotate(8deg);filter:brightness(2.2) drop-shadow(0 0 22px #ffdfab)}68%{transform:translate(-12px,4px) rotate(-5deg);filter:brightness(1.35)}}
@keyframes vtHeroHitChoreography{0%,100%{transform:translate(0,0) rotate(0)}30%{transform:translate(-16px,8px) rotate(-8deg);filter:brightness(1.8)}55%{transform:translate(10px,0) rotate(4deg)}}
.battle-redesign-v2 .hd2d-stage.attack.mage .ally .hero-sprite{animation:vtMageChoreography 1.7s ease-in-out both!important}
.battle-redesign-v2 .hd2d-stage.attack.warrior .ally .hero-sprite{animation:vtWarriorChoreography 1.7s ease-in-out both!important}
.battle-redesign-v2 .hd2d-stage.attack.ranger .ally .hero-sprite{animation:vtRangerChoreography 1.7s ease-in-out both!important}
.battle-redesign-v2 .hd2d-stage.attack .enemy-unit .monster-sprite{animation:vtHitChoreography 1.7s ease-in-out both!important}
.battle-redesign-v2 .hd2d-stage.miss .ally .hero-sprite{animation:vtHeroHitChoreography 1.7s ease-in-out both!important}
@media(prefers-reduced-motion:reduce){.battle-redesign-v2 .hd2d-stage.attack .ally .hero-sprite,.battle-redesign-v2 .hd2d-stage.attack .enemy-unit .monster-sprite,.battle-redesign-v2 .hd2d-stage.miss .ally .hero-sprite{animation:none!important}}

/* Distinct full-field Warrior and Ranger special attacks. */
@keyframes vtSwordArc{0%,22%{opacity:0;transform:translate(-50%,-50%) rotate(-65deg) scale(.3)}42%{opacity:1;transform:translate(-50%,-50%) rotate(18deg) scale(1.1)}64%{opacity:1;transform:translate(-50%,-50%) rotate(110deg) scale(1.4)}100%{opacity:0;transform:translate(-50%,-50%) rotate(140deg) scale(1.6)}}
@keyframes vtArrowFlight{0%,20%{left:31%;top:58%;opacity:0;transform:translate(-50%,-50%) rotate(-8deg) scale(.6)}35%{opacity:1}65%{left:76%;top:50%;opacity:1;transform:translate(-50%,-50%) rotate(-8deg) scale(1.2)}80%,100%{left:76%;top:50%;opacity:0;transform:translate(-50%,-50%) scale(1.6)}}
@keyframes vtBladeFlash{0%,35%,100%{opacity:0}53%{opacity:1}}
.battle-redesign-v2 .hd2d-stage.attack.warrior .battle-action-effect:before{content:"";position:absolute;left:72%;top:52%;width:clamp(90px,13vw,190px);aspect-ratio:1;border:clamp(9px,1.5vw,22px) solid transparent;border-top-color:#fff4b9;border-right-color:#ffe28b;border-radius:50%;filter:drop-shadow(0 0 12px #ffd36b) drop-shadow(0 0 22px #ffb343);z-index:5;animation:vtSwordArc 1.7s ease-out both}
.battle-redesign-v2 .hd2d-stage.attack.warrior .enemy-unit:after{content:"✦";position:absolute;left:50%;top:45%;font-size:100px;color:#fff6cf;text-shadow:0 0 30px #ffc34b;animation:vtBladeFlash 1.7s ease-out both;pointer-events:none}
.battle-redesign-v2 .hd2d-stage.attack.ranger .battle-action-effect:before{content:"➤";position:absolute;left:31%;top:58%;font-size:clamp(38px,6vw,90px);line-height:1;color:#d9ffe1;text-shadow:0 0 12px #fff,0 0 24px #7cf8b6,0 0 45px #35d68d;z-index:5;animation:vtArrowFlight 1.7s ease-in both}
.battle-redesign-v2 .hd2d-stage.attack.ranger .enemy-unit:after{content:"✳";position:absolute;left:50%;top:42%;font-size:100px;color:#e0ffb5;text-shadow:0 0 30px #7affac;animation:vtBladeFlash 1.7s ease-out both;pointer-events:none}
@media(prefers-reduced-motion:reduce){.battle-redesign-v2 .hd2d-stage.attack.warrior .battle-action-effect:before,.battle-redesign-v2 .hd2d-stage.attack.warrior .enemy-unit:after,.battle-redesign-v2 .hd2d-stage.attack.ranger .battle-action-effect:before,.battle-redesign-v2 .hd2d-stage.attack.ranger .enemy-unit:after{animation:none!important;opacity:.45}}

/* Actual Luna six-frame artwork, loaded only after all frames pass preload. */
.battle-redesign-v2 .hd2d-stage .ally .hero-sprite.has-luna-frames{background-image:var(--luna-frame)!important;background-size:contain!important;background-repeat:no-repeat!important;background-position:center bottom!important;animation:none!important;transform:none!important}
@media(prefers-reduced-motion:reduce){.battle-redesign-v2 .hd2d-stage .ally .hero-sprite.has-luna-frames{animation:none!important}}

/* Layered crossfades keep Luna in the same battle slot instead of abruptly replacing art. */
.battle-redesign-v2 .hd2d-stage .ally .hero-sprite.has-luna-transition{position:relative;isolation:isolate;background-image:none!important;animation:none!important;transform:none!important}
.battle-redesign-v2 .hd2d-stage .ally .hero-sprite .luna-transition-layer{position:absolute;inset:0;pointer-events:none;background-size:contain;background-repeat:no-repeat;background-position:center bottom;opacity:0;transition:opacity 170ms ease-in-out;will-change:opacity}
.battle-redesign-v2 .hd2d-stage .ally .hero-sprite .luna-original{opacity:1;z-index:1}
@media(prefers-reduced-motion:reduce){.battle-redesign-v2 .hd2d-stage .ally .hero-sprite .luna-transition-layer{transition:none}}

/* Mage uses the same generated combat sprite at rest and while attacking. */
.battle-redesign-v2 .hd2d-stage .ally .hero-sprite.has-luna-frames.luna-facing-enemy{background-image:var(--luna-frame)!important;background-size:contain!important;background-position:center bottom!important;background-repeat:no-repeat!important;animation:vtLunaGuard 2.7s ease-in-out infinite!important;transform-origin:center bottom!important}
.battle-redesign-v2 .hd2d-stage.attack.mage .ally .hero-sprite.has-luna-frames.luna-facing-enemy{animation:none!important}
@keyframes vtLunaGuard{0%,100%{transform:translateY(0)}50%{transform:translateY(-3px)}}
@media(prefers-reduced-motion:reduce){.battle-redesign-v2 .hd2d-stage .ally .hero-sprite.has-luna-frames.luna-facing-enemy{animation:none!important}}

/* High-clarity character presentation and portrait in battle HUD. */
.battle-redesign-v2 .hd2d-hud-hero{display:flex;align-items:center;gap:10px;width:min(43%,390px);min-width:205px;padding:7px 10px}
.battle-redesign-v2 .hd2d-hero-hud-details{min-width:0;flex:1}
.battle-redesign-v2 .hd2d-hero-portrait{flex:0 0 clamp(54px,7vw,88px);width:clamp(54px,7vw,88px);aspect-ratio:1;border:2px solid #e6b66c;border-radius:14px;background:#14233b url('/game/asterveil/animation/luna-pose-2.webp') no-repeat;background-size:370% auto;background-position:49% 12%;box-shadow:inset 0 0 0 2px #152642,0 2px 10px #020815;image-rendering:auto}
.battle-redesign-v2 .hd2d-hud-hero>span{display:none}
.battle-redesign-v2 .hd2d-hero-hud-details>span{font-size:11px;display:block;text-align:right;margin-top:3px}
.battle-redesign-v2 .hd2d-stage .ally .hero-sprite.has-luna-frames{filter:drop-shadow(0 9px 5px #040c1680)!important;image-rendering:auto;backface-visibility:hidden}
@media(max-width:550px){.battle-redesign-v2 .hd2d-hud-hero{min-width:145px;gap:6px;padding:5px}.battle-redesign-v2 .hd2d-hero-portrait{flex-basis:48px;width:48px;border-radius:9px}.battle-redesign-v2 .hd2d-hud-unit strong{font-size:13px}}

.battle-redesign-v2 .hd2d-hero-portrait[hidden]{display:none!important}

/* HD portrait asset: no zoomed crop of the small combat sprite. */
.battle-redesign-v2 .hd2d-hero-portrait{background-image:url('/game/asterveil/animation/luna-portrait-hd.webp'),url('/game/asterveil/animation/luna-pose-2.webp');background-size:cover,370% auto;background-position:center 24%,49% 12%;image-rendering:auto}

/* Larger, balanced Luna combat presence. Keep portrait and monster unobstructed. */
@media(min-width:700px){
 .battle-redesign-v2 .hd2d-stage .ally .hero-sprite{width:clamp(180px,23vw,292px);height:clamp(250px,33vw,390px)}
 .battle-redesign-v2 .hd2d-stage .ally .hero-sprite.has-luna-frames{filter:drop-shadow(0 7px 3px #040c1666)!important}
}
@media(max-width:699px){
 .battle-redesign-v2 .hd2d-stage .ally .hero-sprite{width:clamp(140px,23vw,205px);height:clamp(195px,32vw,275px)}
}

/* HD artwork uses four identically sized transparent canvases and a stable floor anchor. */
.battle-redesign-v2 .hd2d-stage .ally .hero-sprite.has-luna-hd{background-size:contain!important;background-position:center bottom!important;image-rendering:auto;filter:drop-shadow(0 7px 3px #040c1666)!important}
.battle-redesign-v2 .hd2d-stage.attack.mage .ally .hero-sprite.has-luna-hd{animation:none!important}

/* Fix Arcane Nova: align projectile with Luna's staff and enemy's body, not HUD height.
   One CSS-driven beam only; HD frame with baked-in purple streak is excluded in JS. */
@keyframes vtArcaneProjectileFixed{
 0%,22%{left:30%;top:66%;transform:translate(-50%,-50%) scale(.1);opacity:0}
 35%{opacity:.85;transform:translate(-50%,-50%) scale(.5)}
 67%{left:73%;top:54%;transform:translate(-50%,-50%) scale(.95);opacity:1}
 85%{left:74%;top:54%;transform:translate(-50%,-50%) scale(1.6);opacity:.8}
 100%{left:74%;top:54%;transform:translate(-50%,-50%) scale(1.9);opacity:0}
}
@keyframes vtArcaneBeamFixed{
 0%,24%{opacity:0;transform:rotate(-15deg) scaleX(.01)}
 34%{opacity:1;transform:rotate(-15deg) scaleX(.08)}
 65%,77%{opacity:1;transform:rotate(-15deg) scaleX(1)}
 100%{opacity:0;transform:rotate(-15deg) scaleX(1)}
}
.battle-redesign-v2 .hd2d-stage.attack.mage .battle-action-effect:before{
 animation:vtArcaneProjectileFixed 1.7s ease-in-out both!important
}
.battle-redesign-v2 .hd2d-stage.attack.mage .battle-action-effect:after{
 left:30%!important;top:66%!important;width:45%!important;height:10px!important;
 animation:vtArcaneBeamFixed 1.7s ease-in-out both!important;
 box-shadow:0 0 10px 3px #c263ff,0 0 20px #9d45ff!important
}

/* Luna animation v3: one effect source, no duplicated pseudo beams or left-edge leakage. */
.battle-redesign-v2 .hd2d-stage{overflow:hidden}
.battle-redesign-v2 .hd2d-stage.attack.mage .battle-action-effect::before,
.battle-redesign-v2 .hd2d-stage.attack.mage .battle-action-effect::after{content:none!important;display:none!important;animation:none!important}
.battle-redesign-v2 .hd2d-stage .ally .hero-sprite.has-luna-frames{position:relative;isolation:isolate}
.battle-redesign-v2 .hd2d-stage .ally .hero-sprite .luna-blend-layer{
 position:absolute;inset:0;z-index:3;pointer-events:none;
 background-repeat:no-repeat;background-size:contain;background-position:center bottom;
 opacity:1;transition:opacity 150ms ease-in-out;
}
.battle-redesign-v2 .hd2d-stage .luna-vector-beam{
 position:absolute;z-index:18;height:6px;border-radius:20px;
 background:linear-gradient(180deg,#fff 0%,#f8d8ff 45%,#bd7eff 100%);
 box-shadow:0 0 8px 2px #bd7aff,0 0 18px 4px #a250e477;
 transform-origin:left center;opacity:0;pointer-events:none;
 transition:opacity 130ms ease-in-out;
}
.battle-redesign-v2 .hd2d-stage .luna-vector-beam.is-firing{opacity:1}
@media(prefers-reduced-motion:reduce){
 .battle-redesign-v2 .hd2d-stage .ally .hero-sprite .luna-blend-layer,
 .battle-redesign-v2 .hd2d-stage .luna-vector-beam{transition:none}
}

/* Luna spell: one visual projectile only; suppress legacy fixed-position mage orb. */
.battle-redesign-v2 .hd2d-stage.attack.mage .attack-projectile{display:none!important}
.battle-redesign-v2 .hd2d-stage .luna-vector-beam{
 height:5px;max-width:none;overflow:hidden;box-shadow:0 0 7px 1px #bd7aff;
 background:linear-gradient(180deg,#fff,#d9a9ff 65%,#a775ff);
}
.battle-redesign-v2 .hd2d-stage .luna-vector-beam.is-firing{
 animation:lunaBeamTravel .46s ease-out both;
}
@keyframes lunaBeamTravel{
 0%{clip-path:inset(0 100% 0 0);opacity:0}
 12%{opacity:1}
 75%{clip-path:inset(0 0 0 0);opacity:1}
 100%{clip-path:inset(0 0 0 0);opacity:0}
}
@media(prefers-reduced-motion:reduce){
 .battle-redesign-v2 .hd2d-stage .luna-vector-beam.is-firing{animation:none;opacity:.8;clip-path:none}
}

/* QA 2026-11-20: eliminate the stray purple flare to Luna's rear.
   The glow is visible even in the idle screenshot, so do not tie this fix to attack timing. */
.battle-redesign-v2 .hd2d-stage .ally .hero-sprite.has-luna-frames{
 clip-path:inset(0 0 0 13%);
}
.battle-redesign-v2 .hd2d-stage .ally::before,
.battle-redesign-v2 .hd2d-stage .ally::after{
 content:none!important;display:none!important;
}

/* Magic Bolt: short luminous projectile, not a stationary line. */
.battle-redesign-v2 .hd2d-stage .luna-magic-bolt{
 position:absolute;z-index:18;left:0;top:0;width:23px;height:23px;
 border-radius:50%;pointer-events:none;opacity:0;
 background:radial-gradient(circle,#fff 0 19%,#f6baff 29%,#bf56ff 57%,#8a39f400 76%);
 box-shadow:0 0 12px 5px #dd86ff,0 0 25px 9px #9b4cff77;
 transform:translate(-50%,-50%);will-change:transform,opacity;
}
.battle-redesign-v2 .hd2d-stage .luna-magic-bolt::after{
 content:"";position:absolute;right:70%;top:39%;width:34px;height:5px;border-radius:20px;
 background:linear-gradient(90deg,transparent,#a44aff77,#fff0ff);
 filter:blur(2px);
}
.battle-redesign-v2 .hd2d-stage .luna-magic-bolt.is-flying{
 animation:lunaBoltFlight .5s cubic-bezier(.25,.3,.6,1) both;
}
@keyframes lunaBoltFlight{
 0%{opacity:0;transform:translate(-50%,-50%) scale(.45)}
 12%{opacity:1}
 88%{opacity:1}
 100%{opacity:0;transform:translate(calc(var(--bolt-dx) - 50%),calc(var(--bolt-dy) - 50%)) scale(1.4)}
}
@media(prefers-reduced-motion:reduce){
 .battle-redesign-v2 .hd2d-stage .luna-magic-bolt.is-flying{animation:lunaBoltFlight .5s linear both}
}

/* Explicitly visible fallback for invalid or unavailable monster atlases. */
.battle-redesign-v2 .hd2d-stage .monster-emoji-fallback{
 display:flex!important;align-items:center;justify-content:center;
 font-size:clamp(70px,10vw,145px);line-height:1;
 text-shadow:0 0 20px #b6f3ff88;opacity:1!important;visibility:visible!important;
}

/* ASTERVEIL Arena polish — visual only, preserve sprites, combat hitboxes and HP UI. */
.battle-redesign-v2 .game-vellotale .battle-stage.hd2d-stage,
.battle-redesign-v2 .battle-stage.hd2d-stage{
 border:2px solid #d8b66d;
 box-shadow:inset 0 0 0 2px #fff0c329,inset 0 0 65px #030e2b77,0 14px 38px #0207139c;
 background:radial-gradient(ellipse at 74% 14%,#f6d4a035,transparent 22%),
 radial-gradient(ellipse at 35% 38%,#7658bb2c,transparent 47%),
 linear-gradient(180deg,#0b1639 0%,#172a55 38%,#183e55 67%,#122c3d 100%);
}
.battle-redesign-v2 .hd2d-stage .hd2d-backdrop{
 background:radial-gradient(ellipse at 72% 14%,#fff0bc38,transparent 19%),
 radial-gradient(ellipse at 21% 46%,#b976df20,transparent 33%),
 linear-gradient(180deg,transparent 48%,#1b4b5570 83%,#0b253760);
}
.battle-redesign-v2 .hd2d-stage .hd2d-platform{
 background:linear-gradient(180deg,#d6c58e26 0%,#5d7a8a18 16%,#091d3555 100%),
 repeating-linear-gradient(90deg,#547082 0 80px,#9cbaae 81px,#354e60 83px);
 border-top:3px solid #efcf89;
 box-shadow:inset 0 12px 28px #f5d69d20,0 -3px 14px #ffdc8550;
}
.battle-redesign-v2 .hd2d-tactical-tiles{
 background:repeating-linear-gradient(0deg,transparent 0 61px,#e4d7ad46 62px 63px),
 repeating-linear-gradient(90deg,transparent 0 72px,#d9cb9a45 73px 74px),
 radial-gradient(ellipse at 50% 45%,#cba9ff24,transparent 55%);
 opacity:.56;
}
.battle-redesign-v2 .hd2d-stage .combatant small{
 box-shadow:0 5px 12px #010a20a8,0 0 10px #efc27b25;
}
@media(max-width:700px){
 .battle-redesign-v2 .hd2d-stage .hd2d-platform{background-size:auto}
 .battle-redesign-v2 .hd2d-tactical-tiles{opacity:.4}
}

/* Male Mage preview: retain the male hero sprite-sheet cell and never show Luna art. */
.battle-redesign-v2 .hd2d-stage .ally .hero-sprite.male-mage-combat{background-image:url('assets/heroes.webp')!important;background-size:300% 200%!important;background-position:50% 100%!important;background-repeat:no-repeat!important;image-rendering:auto}
/* Independent and replaceable HUD portrait slot: the frame is unchanged. */
.battle-redesign-v2 .hd2d-hero-portrait.male-mage-portrait{background-image:var(--asterveil-hud-portrait,url('/game/asterveil/assets/meta-portrait-default.webp'))!important;background-size:contain!important;background-position:center center!important;background-repeat:no-repeat!important;background-color:#14233b}
/* Luna and Meta share identical HUD proportions. Dedicated file per character enables future premium cosmetic variants after server-verified entitlement checks. */
.battle-redesign-v2 .hd2d-hero-portrait.female-mage-portrait{background-image:var(--asterveil-hud-portrait,url('/game/asterveil/assets/luna-portrait-default.webp'))!important;background-size:contain!important;background-position:center center!important;background-repeat:no-repeat!important;background-color:#14233b}
/* Meta uses animated frame artwork, never the legacy full-width magic beam. */

/* Preview-only male Mage casting effect: projectile travels from the staff to the target. */
.battle-redesign-v2 .hd2d-stage .meta-arcane-projectile{position:absolute;z-index:9;width:24px;height:24px;border-radius:50%;pointer-events:none;transform:translate(-50%,-50%);background:radial-gradient(circle,#fff 0 14%,#e7dcff 18% 32%,#ab82ff 43%,#6d5ae6 60%,transparent 75%);box-shadow:0 0 12px 5px #b996ff,0 0 32px 12px #6d57e7a0;animation:metaArcaneFlight .82s cubic-bezier(.35,.1,.65,1) .18s both}
.battle-redesign-v2 .hd2d-stage .meta-arcane-projectile:after{content:'';position:absolute;inset:-16px;border:2px solid #d5baff;border-radius:50%;opacity:.7;animation:metaArcaneRing .6s ease-in-out infinite}
@keyframes metaArcaneFlight{0%{opacity:0;transform:translate(-50%,-50%) scale(.3)}18%{opacity:1;transform:translate(-50%,-50%) scale(1.25)}85%{opacity:1}100%{opacity:0;transform:translate(calc(-50% + var(--meta-dx)),calc(-50% + var(--meta-dy))) scale(1.6)}}
@keyframes metaArcaneRing{0%{transform:scale(.6);opacity:.8}100%{transform:scale(1.6);opacity:0}}
/* Dedicated forest guardian fallback: preserve existing monster hit/defeat animations. */
.battle-redesign-v2 .hd2d-stage .enemy-unit .monster-sprite:not(.monster-emoji-fallback){background-repeat:no-repeat}
@media(prefers-reduced-motion:reduce){.battle-redesign-v2 .hd2d-stage .meta-arcane-projectile,.battle-redesign-v2 .hd2d-stage .meta-arcane-projectile:after{animation:none!important;opacity:.85}}

/* Twelve-frame Meta animation is activated only after all 12 assets load. */
.battle-redesign-v2 .hd2d-stage .ally .hero-sprite.male-mage-combat.has-meta-frames{background-image:var(--meta-frame)!important;background-size:contain!important;background-position:center bottom!important;background-repeat:no-repeat!important}
.battle-redesign-v2 .hd2d-stage:has(.male-mage-combat) .battle-action-effect:before,
.battle-redesign-v2 .hd2d-stage:has(.male-mage-combat) .battle-action-effect:after{content:none!important;display:none!important}
.battle-redesign-v2 .hd2d-stage:has(.male-mage-combat) .luna-magic-bolt,
.battle-redesign-v2 .hd2d-stage:has(.male-mage-combat) .luna-vector-beam{display:none!important}

/* High-specificity suppression of legacy mage beam, sparkle and static choreography for Meta only. */
.battle-redesign-v2 .hd2d-stage.attack.mage:has(.male-mage-combat) .battle-action-effect::before,
.battle-redesign-v2 .hd2d-stage.attack.mage:has(.male-mage-combat) .battle-action-effect::after,
.battle-redesign-v2 .hd2d-stage.attack.mage:has(.male-mage-combat) .ally::after,
.battle-redesign-v2 .hd2d-stage.attack.mage:has(.male-mage-combat) .enemy-unit::after{content:none!important;display:none!important;animation:none!important}
.battle-redesign-v2 .hd2d-stage.attack.mage .ally .hero-sprite.male-mage-combat.has-meta-frames{animation:none!important}
.battle-redesign-v2 .hd2d-stage:has(.male-mage-combat) .meta-arcane-projectile{display:none!important}

/* Meta's 12 WebP frames are the sole animation authority in every battle state.
   Prevent idle breathing, recoil, and choreography from competing with frame swaps. */
.battle-redesign-v2 .hd2d-stage .ally .hero-sprite.male-mage-combat.has-meta-frames{animation:none!important;transform:none!important;opacity:1!important;visibility:visible!important}

/* Meta independent violet-gold projectile: never baked into character sprites. */
.battle-redesign-v2 .hd2d-stage .meta-independent-bolt{position:absolute;width:27px;height:27px;z-index:18;pointer-events:none;border-radius:50%;transform:translate(-50%,-50%) scale(.6);opacity:0;background:radial-gradient(circle at 37% 32%,#fff 0%,#f9d6ff 18%,#b87cff 40%,#6535d5 67%,#251064 100%);box-shadow:0 0 12px 5px #b88cff,0 0 29px 9px #7c40f5,0 0 38px #f4d39c;will-change:transform,opacity}
.battle-redesign-v2 .hd2d-stage .meta-independent-bolt:before{content:'';position:absolute;inset:-9px;border:2px solid #f5cf93;border-radius:50%;box-shadow:0 0 12px #a78aff}
.battle-redesign-v2 .hd2d-stage .meta-independent-bolt.flying{animation:metaIndependentFlight .63s cubic-bezier(.22,.5,.55,1) forwards!important}
@keyframes metaIndependentFlight{0%{opacity:0;transform:translate(-50%,-50%) scale(.5)}12%{opacity:1;transform:translate(-50%,-50%) scale(1)}80%{opacity:1}100%{opacity:0;transform:translate(calc(-50% + var(--meta-flight-x)),calc(-50% + var(--meta-flight-y))) scale(1.7)}}

/* Meta V2: persistent decoded canvas, never two visible character layers. */
.battle-redesign-v2 .hd2d-stage .ally .hero-sprite.male-mage-combat:has(>.meta-frame-canvas){position:relative!important;background-image:none!important;background-size:contain!important;background-position:center bottom!important;background-repeat:no-repeat!important;isolation:isolate;overflow:visible}
.battle-redesign-v2 .hd2d-stage .ally .hero-sprite.male-mage-combat>.meta-frame-canvas{display:block!important;position:relative!important;inset:auto!important;width:100%!important;height:100%!important;max-width:none!important;max-height:none!important;object-fit:contain;pointer-events:none;opacity:1!important;visibility:visible!important;z-index:10}

/* Replaced former overlapping question/potion layout with Arena v2 below. */
/* Character display balance: independent CSS scale/translate preserve the existing
   animation transform keyframes, stable feet baseline, HUD layout and hit-test controls. */
.battle-redesign-v2 #battleStage .stage-combatants .combatant.ally #battleHero.hero-sprite{
 transform-origin:center bottom;
 scale:var(--combat-display-scale,0.95);
 translate:var(--combat-display-x,0px) var(--combat-display-y,0px);
}
@media(max-width:620px){
 .battle-redesign-v2 #battleStage .stage-combatants .combatant.ally #battleHero.hero-sprite{
  scale:var(--combat-display-mobile-scale,0.97);
 }
}
/* Iris: remove CSS-created legacy arrows and duplicate light streaks; keep verified hit state. */
.battle-redesign-v2 #battleStage.iris-straight-shot .attack-projectile,
.battle-redesign-v2 #battleStage.iris-straight-shot.attack.ranger .battle-action-effect::before,
.battle-redesign-v2 #battleStage.iris-straight-shot.attack.ranger .battle-action-effect::after,
.battle-redesign-v2 #battleStage.iris-straight-shot.attack.ranger .ally::after,
.battle-redesign-v2 #battleStage.iris-straight-shot.attack.ranger .enemy-unit::after{
 content:none!important;display:none!important;animation:none!important;
}
.battle-redesign-v2 #battleStage .iris-straight-arrow{
 position:absolute;z-index:16;width:72px;height:6px;
 transform:translate(-50%,-50%) translate3d(0,0,0);
 pointer-events:none;opacity:0;
 border-radius:20px;
 background:linear-gradient(90deg,transparent 0%,#68cb8c44 18%,#c4ffb4 66%,#ffffff 88%);
 box-shadow:0 0 7px #a5ffbe,0 0 19px #69df8fbb,0 0 35px #c1d97955;
 will-change:transform,opacity;
}
.battle-redesign-v2 #battleStage .iris-straight-arrow::before{
 content:'';position:absolute;right:-8px;top:50%;transform:translateY(-50%);
 width:26px;height:17px;background:linear-gradient(90deg,#b7e98c,#fff4c1 72%,#fafff5);
 clip-path:polygon(0 14%,100% 50%,0 86%,17% 50%);
 filter:drop-shadow(0 0 7px #f5e6a2);
}
.battle-redesign-v2 #battleStage .iris-straight-arrow::after{
 content:'';position:absolute;right:30px;top:50%;transform:translateY(-50%);
 width:100px;height:3px;
 background:linear-gradient(90deg,transparent,#6bdb9a33,#aef2b9ba);
 box-shadow:0 0 10px #75e8ab75;
}
.battle-redesign-v2 #battleStage .iris-straight-arrow.in-flight{
 animation:irisArrowStraightFlight .47s linear both;
}
@keyframes irisArrowStraightFlight{
 0%{opacity:0;transform:translate(-50%,-50%) translate3d(0,0,0) scale(.8)}
 14%{opacity:1}
 84%{opacity:1}
 100%{opacity:0;transform:translate(-50%,-50%) translate3d(var(--iris-shot-distance),0,0) scale(1)}
}
.battle-redesign-v2 #battleStage .iris-arrow-impact{
 position:absolute;z-index:18;width:66px;height:66px;
 transform:translate(-50%,-50%) scale(.2);
 pointer-events:none;border-radius:50%;
 border:2px solid #e4ffb6;
 background:radial-gradient(circle,#fff9d2 0 9%,#c7ffa0b8 13%,#88eec877 34%,transparent 67%);
 box-shadow:0 0 16px #b9ffaf,0 0 35px #6bd9a58c;
 animation:irisArrowImpact .48s ease-out both;
}
.battle-redesign-v2 #battleStage .iris-arrow-impact::before,
.battle-redesign-v2 #battleStage .iris-arrow-impact::after{
 content:'✦';position:absolute;font-size:26px;color:#edffcd;
 text-shadow:0 0 12px #b6f4a6;
}
.battle-redesign-v2 #battleStage .iris-arrow-impact::before{left:-9px;top:2px}
.battle-redesign-v2 #battleStage .iris-arrow-impact::after{right:-8px;bottom:2px;font-size:20px}
@keyframes irisArrowImpact{
 0%{opacity:0;transform:translate(-50%,-50%) scale(.18)}
 30%{opacity:1}
 100%{opacity:0;transform:translate(-50%,-50%) scale(1.5)}
}
@media(prefers-reduced-motion:reduce){
 .battle-redesign-v2 #battleStage .iris-straight-arrow.in-flight,
 .battle-redesign-v2 #battleStage .iris-arrow-impact{animation-duration:.08s!important}
}


/* Adam illustrated ranger animation — uses one canvas only; no doubled sprite background. */
.battle-redesign-v2 #battleStage #battleHero.hero-sprite.has-adam-frames{
  position:relative;isolation:isolate;
  background-image:none!important;background-color:transparent!important;
  background-size:contain!important;background-repeat:no-repeat!important;
  transform-origin:center bottom;overflow:visible;
}
.battle-redesign-v2 #battleStage #battleHero.hero-sprite.has-adam-frames .adam-frame-canvas{
  display:block;position:absolute;inset:0;width:100%;height:100%;
  pointer-events:none;object-fit:contain;image-rendering:auto;
  transform:none!important;
}
@media(prefers-reduced-motion:reduce){
  .battle-redesign-v2 #battleStage #battleHero.hero-sprite.has-adam-frames{animation:none!important}
}


/* Arena v2 / unified scene + control deck — no overlapping question, potion or HP. */
.battle-redesign-v2 #arena #battleStage.battle-stage.hd2d-stage{
 display:flex!important;flex-direction:column!important;height:auto!important;min-height:0!important;
 border:2px solid #c7a468;border-radius:15px;overflow:hidden;isolation:isolate;
 background:#091b32!important;box-shadow:0 15px 36px #010918a6;
}
.battle-redesign-v2 #battleStage .battle-arena-scene{
 position:relative;flex:0 0 auto;height:clamp(340px,34vw,435px);
 min-height:0;isolation:isolate;overflow:hidden;
 background:linear-gradient(180deg,#09152b00,#06182b22),
 url('/game/asterveil/assets/hd2d-echo-forest.svg') center 48%/cover no-repeat;
}
.battle-redesign-v2 #battleStage .hd2d-topline{
 position:absolute;top:9px;left:12px;right:12px;z-index:9;
 display:flex;justify-content:space-between;gap:10px;
 font-size:clamp(10px,1.15vw,13px);pointer-events:none;
}
.battle-redesign-v2 #battleStage .hd2d-battle-hud{
 position:absolute;top:47px;left:14px;right:14px;z-index:12;
 display:flex;justify-content:space-between;align-items:flex-start;
 gap:clamp(34px,17vw,200px);pointer-events:none;
}
.battle-redesign-v2 #battleStage .hd2d-hud-unit{
 width:min(33%,315px);flex:0 1 315px;min-width:0;
 border:1px solid #bea076bd;border-radius:10px;
 box-sizing:border-box;padding:8px 10px;background:linear-gradient(140deg,#0a1a32dd,#09172bdc);
 box-shadow:0 6px 18px #0006;color:#f5e7c9;
}
.battle-redesign-v2 #battleStage .hd2d-hud-hero{
 display:flex;align-items:center;flex-wrap:nowrap;gap:9px;
 min-width:0;max-width:315px;row-gap:0;
}
.battle-redesign-v2 #battleStage .hd2d-hud-unit strong{
 font:700 clamp(12px,1.5vw,19px)/1.15 Georgia,serif;
 white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.battle-redesign-v2 #battleStage .hd2d-hud-unit .hd2d-hud-track{
 height:8px;margin-top:5px;overflow:hidden;
}
.battle-redesign-v2 #battleStage .hd2d-hud-hero .hd2d-hero-hud-details{flex:1;min-width:0}
.battle-redesign-v2 #battleStage .hd2d-hud-unit>span,
.battle-redesign-v2 #battleStage .hd2d-hero-hud-details>span{
 display:block;text-align:right;font:600 10px/1.3 system-ui,sans-serif;margin-top:3px;
}
.battle-redesign-v2 #battleStage .stage-combatants{
 position:absolute;inset:128px 25px 13px!important;z-index:4;
 display:flex;justify-content:space-around;align-items:flex-end;
 transform:none;filter:drop-shadow(0 10px 8px #061021a9);pointer-events:none;
}
.battle-redesign-v2 #battleStage .stage-combatants .combatant{
 width:43%;max-height:100%;justify-content:flex-end;align-items:center;
}
.battle-redesign-v2 #battleStage .stage-combatants .combatant.ally .hero-sprite{
 width:clamp(155px,21vw,245px)!important;height:clamp(195px,23vw,265px)!important;
 max-height:calc(100% - 22px);background-position:center bottom;
}
.battle-redesign-v2 #battleStage .stage-combatants .enemy-unit .monster-sprite{
 width:clamp(185px,25vw,290px)!important;height:clamp(205px,24vw,265px)!important;
 max-height:calc(100% - 22px);background-position:center bottom;
}
.battle-redesign-v2 #battleStage .stage-combatants .combatant small{
 max-width:96%;margin-top:2px;font:600 11px/1.2 system-ui,sans-serif;padding:3px 10px;
}
.battle-redesign-v2 #battleStage .hd2d-versus{
 top:49%;font-size:clamp(23px,2.9vw,34px);opacity:.84;pointer-events:none;
}
.battle-redesign-v2 #battleStage .battle-question-overlay{
 position:relative!important;inset:auto!important;left:auto!important;bottom:auto!important;
 transform:none!important;flex:0 0 auto;z-index:40;
 width:100%!important;max-height:none!important;overflow:visible!important;
 box-sizing:border-box;padding:13px clamp(12px,2vw,24px) 17px;
 border:0;border-top:1px solid #c5a46cbb;border-radius:0!important;
 box-shadow:0 -10px 28px #06132396;backdrop-filter:none;-webkit-backdrop-filter:none;
 background:linear-gradient(165deg,#101e34f9,#102b46fc)!important;color:#f7e5c4;
}
.battle-redesign-v2 #battleStage .battle-quiz-heading{
 display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;
 gap:8px 16px;max-width:1040px;margin:0 auto 6px;min-height:39px;
}
.battle-redesign-v2 #battleStage .battle-quiz-labels{
 display:flex;align-items:center;flex-wrap:wrap;gap:5px 11px;min-width:0;
}
.battle-redesign-v2 #battleStage .battle-quiz-labels .eyebrow{
 color:#ebc282;font:800 10px/1.3 system-ui,sans-serif;letter-spacing:.12em;
}
.battle-redesign-v2 #battleStage .battle-quiz-progress{
 color:#aec5d6;font:600 11px/1.3 system-ui,sans-serif;
}
.battle-redesign-v2 #battleStage .battle-quiz-toolbar{
 display:flex;align-items:center;gap:7px;min-width:0;flex-wrap:wrap;
}
.battle-redesign-v2 #battleStage .battle-potion-tools{
 display:flex;align-items:center;gap:6px;padding:3px 4px 3px 8px;
 border:1px solid #a98d6c8f;border-radius:8px;background:#1c354ed9;
 pointer-events:auto;
}
.battle-redesign-v2 #battleStage .battle-potion-stock{
 display:flex;gap:5px;align-items:center;white-space:nowrap;
 color:#f7dbae;font:700 11px/1 system-ui,sans-serif;
}
.battle-redesign-v2 #battleStage .battle-potion-icon{font-size:14px;line-height:1}
.battle-redesign-v2 #battleStage .battle-potion-caption{display:none}
.battle-redesign-v2 #battleStage #potionCount{font:800 11px/1 system-ui,sans-serif;color:#fff0ce}
.battle-redesign-v2 #battleStage #usePotion.battle-potion-use{
 min-height:36px;min-width:76px;max-width:none;padding:6px 9px;
 border:1px solid #ead3a9;border-radius:7px;background:linear-gradient(#fff2d9,#dfc494);
 color:#182d43;font:800 11px/1.15 system-ui,sans-serif;
 white-space:nowrap;box-shadow:none;cursor:pointer;touch-action:manipulation;
}
.battle-redesign-v2 #battleStage #usePotion.battle-potion-use:disabled{
 opacity:.5;cursor:not-allowed;box-shadow:none;
}
.battle-redesign-v2 #battleStage .battle-sound-slot{display:flex}
.battle-redesign-v2 #battleStage .battle-sound-slot .sound-toggle{
 display:inline-flex;align-items:center;justify-content:center;
 width:auto;max-width:none;min-height:42px;padding:7px 12px;
 border:1px solid #6886a2;border-radius:8px;background:#233c58;
 color:#e0eff4;font:700 11px/1.2 system-ui,sans-serif;
 white-space:nowrap;box-shadow:none;cursor:pointer;touch-action:manipulation;
}
.battle-redesign-v2 #arena #battleStage .battle-question-overlay .battleword{
 grid-column:auto;grid-row:auto;display:block;margin:0 auto;padding:4px 0 9px;
 max-width:1040px;min-width:0;text-align:center;
 border:0;border-radius:0;box-shadow:none;background:transparent!important;
}
.battle-redesign-v2 #arena #battleStage #pattern{
 margin:0;color:#f9e5bf;font:750 clamp(18px,2.05vw,26px)/1.28 system-ui,sans-serif;
 letter-spacing:0;overflow-wrap:anywhere;text-shadow:0 2px 9px #0007;
}
.battle-redesign-v2 #arena #battleStage #wordHint{
 margin:5px 0 0;color:#bbd0dc;font:500 11px/1.3 system-ui,sans-serif;
}
.battle-redesign-v2 #arena #battleStage #answerChoices{
 display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;
 grid-column:auto;grid-row:auto;max-width:890px;margin:4px auto 0;
}
.battle-redesign-v2 #arena #battleStage #answerChoices .choice{
 display:flex;align-items:center;justify-content:center;width:100%;
 min-height:49px;min-width:0;padding:10px 12px;
 border:1px solid #66859f;border-radius:9px;background:#1d3855;
 color:#f6ecd9;font:650 clamp(13px,1.27vw,16px)/1.3 system-ui,sans-serif;
 white-space:normal;overflow-wrap:anywhere;text-align:center;
 box-shadow:inset 0 1px #ffffff24;cursor:pointer;touch-action:manipulation;
 transition:background .15s,border-color .15s,transform .15s;
}
.battle-redesign-v2 #arena #battleStage #answerChoices .choice:hover:not(:disabled){
 transform:translateY(-1px);background:#284868;border-color:#f0ca85;
}
.battle-redesign-v2 #arena #battleStage #answerChoices .choice:disabled{cursor:default;opacity:.68;transform:none}
.battle-redesign-v2 #arena #battleStage #answerChoices .choice:focus-visible,
.battle-redesign-v2 #battleStage .sound-toggle:focus-visible,
.battle-redesign-v2 #battleStage #next:focus-visible,
.battle-redesign-v2 #battleStage #usePotion:focus-visible{
 outline:3px solid #f6d28b;outline-offset:2px;
}
.battle-redesign-v2 #arena #battleStage #feedback{
 margin:9px auto 0;max-width:890px;max-height:140px;overflow-y:auto;
 padding:10px 12px;border-radius:9px;border:1px solid #6db19b;
 color:#eafff6;background:#174c43;font:500 12px/1.42 system-ui,sans-serif;
}
.battle-redesign-v2 #arena #battleStage #feedback.bad{background:#5a2940;border-color:#cc8d96}
.battle-redesign-v2 #arena #battleStage #feedback.hide{display:none!important}
.battle-redesign-v2 #arena #battleStage .battle-quiz-actions{
 max-width:890px;display:flex;justify-content:flex-end;margin:9px auto 0;
}
.battle-redesign-v2 #arena #battleStage .battle-quiz-actions:has(#next.hide){display:none}
.battle-redesign-v2 #battleStage #next{
 min-height:43px;padding:8px 17px;border-radius:8px;
 color:#112538;background:#f1d6a7;border:1px solid #fae0b1;
 font:800 12px/1.2 system-ui,sans-serif;
}
.battle-redesign-v2 #battleStage #next.hide{display:none!important}
.battle-redesign-v2 #battleStage.battle-victory .battle-question-overlay,
.battle-redesign-v2 #battleStage.battle-defeat .battle-question-overlay{opacity:.35;pointer-events:none}
.battle-redesign-v2 #arena .battle-legacy-stats[hidden]{display:none!important}
@media(max-width:950px){
 .battle-redesign-v2 #battleStage .battle-arena-scene{height:380px}
 .battle-redesign-v2 #battleStage .stage-combatants{inset:120px 12px 11px!important}
}
@media(max-width:620px){
 .battle-redesign-v2 #battleStage .battle-arena-scene{height:302px}
 .battle-redesign-v2 #battleStage .hd2d-topline{top:7px;left:7px;right:7px;font-size:9px;gap:5px}
 .battle-redesign-v2 #battleStage .hd2d-battle-hud{top:38px;left:7px;right:7px;gap:12px}
 .battle-redesign-v2 #battleStage .hd2d-hud-unit{flex:0 1 48%;width:48%;min-width:0;padding:6px 6px}
 .battle-redesign-v2 #battleStage .hd2d-hud-hero{gap:5px;min-width:0}
 .battle-redesign-v2 #battleStage .hd2d-hud-unit strong{font-size:11px}
 .battle-redesign-v2 #battleStage .hd2d-hud-unit small{font-size:8px}
 .battle-redesign-v2 #battleStage .hd2d-hero-portrait{width:43px;flex-basis:43px;border-radius:7px}
 .battle-redesign-v2 #battleStage .hd2d-hud-track{height:6px;margin-top:3px}
 .battle-redesign-v2 #battleStage .stage-combatants{inset:111px 3px 8px!important}
 .battle-redesign-v2 #battleStage .stage-combatants .combatant.ally .hero-sprite{
  width:clamp(115px,34vw,165px)!important;height:clamp(156px,43vw,199px)!important;
 }
 .battle-redesign-v2 #battleStage .stage-combatants .enemy-unit .monster-sprite{
  width:clamp(130px,41vw,185px)!important;height:clamp(159px,42vw,202px)!important;
 }
 .battle-redesign-v2 #battleStage .hd2d-versus{top:48%;font-size:22px}
 .battle-redesign-v2 #battleStage .battle-question-overlay{padding:12px 10px 15px}
 .battle-redesign-v2 #battleStage .battle-quiz-heading{gap:8px}
 .battle-redesign-v2 #battleStage #usePotion.battle-potion-use{min-height:40px;font-size:10px;padding:7px 8px}
 .battle-redesign-v2 #battleStage .battle-sound-slot .sound-toggle{min-height:40px;font-size:10px;padding:7px 9px}
 .battle-redesign-v2 #arena #battleStage #pattern{font-size:clamp(17px,4.8vw,21px)}
 .battle-redesign-v2 #arena #battleStage #answerChoices{gap:8px}
 .battle-redesign-v2 #arena #battleStage #answerChoices .choice{min-height:48px;padding:8px;font-size:13px}
}
@media(max-width:430px){
 .battle-redesign-v2 #battleStage .battle-arena-scene{height:286px}
 .battle-redesign-v2 #battleStage .stage-combatants{inset:101px 3px 7px!important}
 .battle-redesign-v2 #battleStage .battle-quiz-labels{width:100%;justify-content:space-between}
 .battle-redesign-v2 #arena #battleStage #answerChoices{grid-template-columns:1fr;gap:7px}
 .battle-redesign-v2 #arena #battleStage #answerChoices .choice{min-height:45px;font-size:14px;padding:8px}
}
@media(prefers-reduced-motion:reduce){
 .battle-redesign-v2 #arena #battleStage #answerChoices .choice{transition:none}
}
