/* The original transparent artwork stays intact; all magic is a separate layer. */
.hero-art[data-mage-hero] { overflow: visible; }
.hero-art[data-mage-hero]::before { display: none; }
.mage-stage {
  position: absolute;
  left: 50%; top: 50%;
  width: var(--mage-width, 100%); height: var(--mage-height, calc(100% - 40px));
  transform: translate(-50%, -50%);
  pointer-events: none;
  isolation: isolate;
}
.mage-rig { position: absolute; inset: 0; transform-origin: 52% 85%; animation: mage-idle 7s ease-in-out infinite; }
.hero-art .mage-figure {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  padding: 0;
  filter: drop-shadow(0 15px 20px #0005) drop-shadow(0 0 14px #47d9e417);
}
.mage-aura {
  position: absolute; inset: 14% -20% 3%; z-index: -1;
  background: radial-gradient(ellipse at 58% 32%, #53e8df19, transparent 52%),
    radial-gradient(ellipse at 45% 74%, #8877f014, transparent 62%);
  animation: mage-aura 8s ease-in-out infinite;
}
.mage-crystal {
  position: absolute; left: 63.5%; top: 12.15%; width: 13%; aspect-ratio: 1;
  transform: translate(-50%, -50%); border-radius: 50%; mix-blend-mode: screen;
  background: radial-gradient(ellipse, #d7ffff99 0, #64ffee50 22%, #40e8d824 45%, transparent 72%);
  box-shadow: 0 0 28px 8px #4ce8de26;
  animation: mage-crystal 4.6s ease-in-out infinite;
}
.mage-crystal::after {
  content: ''; position: absolute; inset: 13%; border: 1px solid #96fff858; border-radius: 50%;
  animation: mage-ripple 4.6s ease-out infinite;
}
.mage-magic { position: absolute; inset: -12%; width: 124%; height: 124%; pointer-events: none; }
.mage-magic-front { z-index: 2; }
.mage-seal {
  position: absolute; left: 13%; right: 6%; bottom: -2%; height: 19%; z-index: -1;
  transform: perspective(550px) rotateX(67deg) rotateZ(-12deg);
  border: 1px solid #83e6db46; border-radius: 50%;
  box-shadow: 0 0 26px #42e0d41a, inset 0 0 28px #42e0d417;
  background: radial-gradient(ellipse, #65e9dd0c, transparent 67%);
  animation: mage-seal-breathe 7s ease-in-out infinite;
}
.mage-seal::before, .mage-seal::after, .mage-seal span, .mage-seal i {
  content: ''; position: absolute; inset: 10%; border: 1px solid #7ee8de35; border-radius: 50%;
}
.mage-seal::before { inset: 6%; border: 2px dashed #88ede34d; animation: mage-turn 65s linear infinite; }
.mage-seal::after { inset: 29%; border-color: #d9bc854d; }
.mage-seal span { inset: 18%; border-radius: 0; border-color: #80e6dd40; animation: mage-turn 45s linear infinite reverse; }
.mage-seal i { inset: 18%; border-radius: 0; border-color: #d9bc853d; transform: rotate(45deg); }
.mage-toggle {
  position: absolute; right: 12px; bottom: 14px; z-index: 3;
  padding: 7px 10px; border: 1px solid #d9bc852a; border-radius: 5px;
  background: #11141bbf; color: #a4b0bf; font: inherit; font-size: .75rem;
  cursor: pointer; transition: color .2s, border-color .2s;
}
.mage-toggle:hover { color: #e4ded1; border-color: #d9bc8570; }
.mage-toggle:focus-visible { outline: 2px solid #83e6db; outline-offset: 4px; }
.mage-stage *, .mage-stage *::before, .mage-stage *::after { animation-play-state: paused; }
.is-magic-playing .mage-stage *, .is-magic-playing .mage-stage *::before,
.is-magic-playing .mage-stage *::after { animation-play-state: running; }
@keyframes mage-idle {
  0%, 100% { transform: translateY(3px) rotate(-.35deg); }
  50% { transform: translateY(-7px) rotate(.35deg); }
}
@keyframes mage-aura { 0%, 100% { opacity: .65; transform: scale(.96); } 50% { opacity: 1; transform: scale(1.05); } }
@keyframes mage-crystal { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
@keyframes mage-ripple { 0%, 35% { transform: scale(.75); opacity: 0; } 45% { opacity: .65; } 100% { transform: scale(2.5); opacity: 0; } }
@keyframes mage-turn { to { transform: rotate(360deg); } }
@keyframes mage-seal-breathe { 0%, 100% { opacity: .5; } 50% { opacity: .9; } }
@media (max-width: 760px) {
  .mage-toggle { right: 0; bottom: 5px; }
  .mage-seal { bottom: 1%; }
}
@media (prefers-reduced-motion: reduce) {
  .mage-stage *, .mage-stage *::before, .mage-stage *::after { animation: none !important; }
  .mage-magic, .mage-toggle, .mage-crystal::after { display: none; }
  .mage-crystal { opacity: .5; }
}
