/* Preserve the existing illustrations, physical table props, card flights and
   six-frame premium cels. Only continuous decorative repaint work is changed.
   Ambient movement is composited from a static paint, not background-position
   or filter recalculated over the whole viewport on every animation frame. */
body.v45-battle-active #v67-battle-atmosphere > div {
    will-change:auto !important;
}
body.v45-battle-active #v67-battle-atmosphere > :is(.v67-aurora,.v67-energy-river,.v67-depth-grid,.v67-light-sweep,.v67-suit-orbit) {
    will-change:transform,opacity !important;
}
body.v45-battle-active #v67-battle-atmosphere .v67-aurora {
    /* 1.35 viewport areas instead of 1.85, with the same painted gradients. */
    inset:-8%;
    animation-name:v168AuroraDrift;
}
body.v45-battle-active #v67-battle-atmosphere .v67-energy-river {
    /* 1.54 viewport areas instead of 2.89; no edge can enter the viewport. */
    inset:-12%;
    animation:v168EnergyDrift 15s ease-in-out infinite alternate;
}
body.v45-battle-active #v67-battle-atmosphere .v67-depth-grid {
    animation-name:v168GridDrift;
}
body.v45-battle-active.v64-shocker-battle .field-area::before {
    animation-name:v168FieldCurrent;
    filter:none;
}
body.v45-battle-active.v64-shocker-battle .deck-pile:not(.v68-deck-launch):not(.v68-deck-absorb) {
    animation-name:v168DeckBreath;
    filter:drop-shadow(0 8px 10px rgba(0,0,0,.48));
}
body.v45-battle-active.v67-atmosphere-impact #v67-battle-atmosphere .v67-aurora {
    animation:v168AtmosphereImpact .56s ease-out both;
}
body.v45-battle-active.v66-revolution-active #v66-revolution-frame {
    animation-name:v168RevolutionFramePulse;
    /* The original red border, gold edge and inset shadows remain intact. */
    filter:none;
}

/* A stationary card does not need a permanently reserved filtered surface.
   CSS / Web Animations still promote the actual moving card automatically. */
body.v45-battle-active :is(#hand-zone,#player-field,#opponent-field) > .card,
body.v45-battle-active #opponent-hand-display .opponent-mini-card {
    will-change:auto !important;
}
@media (hover:hover) and (pointer:fine) {
    body.v45-battle-active :is(#hand-zone,#player-field,#opponent-field) > .card:hover {
        will-change:transform !important;
    }
}

/* Visibility handling used to pause only the v67 atmosphere. The extra idle
   table-light, revolution shake and hand motion are also decorative, and can
   pause in a hidden tab without changing battle / AI / clock timers. */
body.v67-paused.v45-battle-active :is(#v72-casino-table,#v66-revolution-frame,#v95-character-hand-underlay) *,
body.v67-paused.v45-battle-active #v66-revolution-frame,
body.v67-paused.v45-battle-active #v66-revolution-frame::before,
body.v67-paused.v45-battle-active :is(#hand-zone,#player-field,#opponent-field) > .card,
body.v67-paused.v45-battle-active #opponent-hand-display .opponent-mini-card,
body.v67-paused.v45-battle-active :is(.persistent-joker-grain,.persistent-joker-scratches,.persistent-joker-flicker),
body.v67-paused.v45-battle-active .field-area::before,
body.v67-paused.v45-battle-active .deck-pile {
    animation-play-state:paused !important;
}

@keyframes v168AuroraDrift {
    0% { transform:translate3d(calc(var(--v67-px,0px) - 2%),calc(var(--v67-py,0px) - 1%),0) scale(1.03) rotate(-1deg);opacity:.74; }
    55% { transform:translate3d(calc(var(--v67-px,0px) + 1.5%),calc(var(--v67-py,0px) + 1%),0) scale(1.09) rotate(1deg);opacity:1; }
    100% { transform:translate3d(calc(var(--v67-px,0px) + 3%),calc(var(--v67-py,0px) - .5%),0) scale(1.05);opacity:.82; }
}
@keyframes v168EnergyDrift {
    from { transform:translate3d(-3%,-1%,0) rotate(-2deg); }
    to { transform:translate3d(3%,1%,0) rotate(-2deg); }
}
@keyframes v168GridDrift {
    from { transform:perspective(420px) rotateX(62deg) translate3d(0,0,0); }
    to { transform:perspective(420px) rotateX(62deg) translate3d(0,34px,0); }
}
@keyframes v168FieldCurrent {
    0%,100% { opacity:.45; }
    50% { opacity:1; }
}
@keyframes v168DeckBreath {
    0%,100% { opacity:.93; }
    50% { opacity:1; }
}
@keyframes v168AtmosphereImpact {
    0% { opacity:.6;transform:scale(1.02); }
    16% { opacity:1;transform:scale(1.05); }
    100% { opacity:.82;transform:scale(1.03); }
}
@keyframes v168RevolutionFramePulse {
    from { opacity:.82; }
    to { opacity:1; }
}
@media (prefers-reduced-motion:reduce) {
    body.v45-battle-active #v67-battle-atmosphere :is(.v67-aurora,.v67-energy-river,.v67-depth-grid),
    body.v45-battle-active.v66-revolution-active #v66-revolution-frame,
    body.v45-battle-active.v64-shocker-battle .field-area::before,
    body.v45-battle-active.v64-shocker-battle .deck-pile:not(.v68-deck-launch):not(.v68-deck-absorb) {
        animation:none !important;
    }
}
