/* V14 999-Species Supernatural Pantheon x 999 Dynamic Reactions + 8-Layer Evil Abyssal Netherworld Stage (zero canvas repaint). */
#theme-motion-background{position:fixed;inset:0;z-index:0;pointer-events:none;overflow:hidden;contain:strict;display:none;--motion-color:#ff2a5f;--motion-alpha:.56}
#theme-motion-overflow{position:fixed;inset:0;z-index:45;pointer-events:none!important;overflow:hidden;contain:layout style paint;display:none}
#theme-motion-overflow *,#theme-motion-background *{pointer-events:none!important;user-select:none;-webkit-user-drag:none}

body[data-theme-motion="running"] #theme-motion-background{display:block}
body[data-theme-motion="running"][data-theme="black-ghost"] #theme-motion-overflow{display:block}
body[data-theme-motion="paused"]:not([data-theme="black-ghost"]) #theme-motion-background{display:none}
body[data-theme-motion="paused"][data-theme="black-ghost"] #theme-motion-background,
body[data-theme-motion="paused"][data-theme="black-ghost"] #theme-motion-overflow{display:block}
body[data-theme-motion="off"] #theme-motion-background,
body[data-theme-motion="off"] #theme-motion-overflow{display:none!important}

/* Step creatures gently behind open modal dialogs so dialogs stay 100% prominent. */
body:has(dialog[open]) #theme-motion-overflow{z-index:20;opacity:.30}

body:is([data-theme-motion="running"],[data-theme-motion="paused"]):not([data-theme="black-ghost"]) #appearance-background .appearance-wallpaper{animation:theme-wall-drift 19s ease-in-out infinite alternate;transform-origin:50% 50%;will-change:transform}
body[data-theme-motion="paused"]:not([data-theme="black-ghost"]) #appearance-background .appearance-wallpaper{animation-play-state:paused;will-change:auto}
body[data-theme="black-ghost"]:not([data-theme-motion="off"]) #appearance-background .appearance-wallpaper{animation:none!important;transform-origin:50% 48%;will-change:transform}
body[data-theme="black-ghost"] #theme-motion-background{--motion-color:#ff2a5f;--motion-alpha:.55}
body[data-theme="black-ghost"] .theme-motion-particle{display:none!important}

/* ==========================================================================
   DIRECTIVE #14: 8-LAYER EVIL ABYSSAL NETHERWORLD STAGE (black-ghost)
   ========================================================================== */
.theme-ghost-bg-stage{
  position:absolute;
  inset:0;
  overflow:hidden;
  display:none;
  contain:strict;
}
body[data-theme="black-ghost"]:not([data-theme-motion="off"]) .theme-ghost-bg-stage{
  display:block!important;
}

/* Layer 1: Sinister Abyssal Miasma (Blood-Crimson, Cursed-Violet, Necro-Emerald) */
.theme-bg-miasma{
  position:absolute;
  left:-20vw;
  top:-20vh;
  width:140vw;
  height:140vh;
  border-radius:50%;
  mix-blend-mode:screen;
  will-change:transform,opacity;
}
.theme-bg-miasma.miasma-0{
  background:radial-gradient(ellipse 60% 34% at 34% 34%,rgba(220,20,60,.26) 0%,rgba(136,19,55,.12) 44%,transparent 74%);
}
.theme-bg-miasma.miasma-1{
  background:radial-gradient(ellipse 66% 38% at 68% 60%,rgba(139,30,225,.27) 0%,rgba(88,28,135,.12) 46%,transparent 76%);
}
.theme-bg-miasma.miasma-2{
  background:radial-gradient(ellipse 54% 30% at 52% 26%,rgba(16,185,129,.17) 0%,rgba(6,95,70,.08) 42%,transparent 72%);
}

/* Layer 2: Dual counter-rotating Demonic Forbidden Hexagram Summoning Arrays */
.theme-bg-demonic-array{
  position:absolute;
  left:55%;
  top:48%;
  display:block;
  object-fit:contain;
  opacity:.23;
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
  filter:drop-shadow(0 0 24px rgba(225,29,72,.42)) drop-shadow(0 0 12px rgba(147,51,234,.34));
  will-change:transform,opacity;
}
.theme-bg-array-outer{
  width:min(85vw,900px);
  height:min(85vw,900px);
}
.theme-bg-array-inner{
  width:min(56vw,590px);
  height:min(56vw,590px);
}
body:has(.auth-shell) .theme-bg-demonic-array{
  left:31%;
  top:53%;
}

/* Layer 3: Blinking Abyssal Void-Eyes lurking & tracking in the dark */
.theme-bg-void-eyes{
  position:absolute;
  left:0;
  top:0;
  width:96px;
  height:42px;
  opacity:0;
  transform-origin:50% 50%;
  filter:drop-shadow(0 0 12px var(--eye-glow,#ff1e42));
  will-change:transform,opacity;
}
.theme-bg-void-eyes-img,
.theme-bg-void-pupils-img{
  position:absolute;
  inset:0;
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  will-change:transform;
}

/* Layer 4: Abyssal Hell-Lightning (forked crimson/violet bolts + local rift glow) */
.theme-bg-lightning{
  position:absolute;
  left:0;
  top:0;
  width:320px;
  height:68vh;
  opacity:0;
  transform-origin:50% 0%;
  mix-blend-mode:screen;
  will-change:transform,opacity;
}
.theme-bg-lightning-glow{
  position:absolute;
  left:-45%;
  top:-12%;
  width:190%;
  height:95%;
  border-radius:50%;
  background:radial-gradient(ellipse at 50% 28%,var(--bolt-glow,rgba(225,29,72,.34)) 0%,rgba(139,30,225,.14) 45%,transparent 74%);
}
.theme-bg-lightning-img{
  position:relative;
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  filter:drop-shadow(0 0 18px var(--bolt-shadow,#ff1e42));
}

/* Layer 5: 34 Hellfire Embers & Hitodama Soul-Flames */
.theme-bg-ember{
  position:absolute;
  left:0;
  top:0;
  display:block;
  border-radius:50%;
  opacity:0;
  will-change:transform,opacity;
}
.theme-bg-ember.is-flame{
  border-radius:50% 50% 50% 50% / 66% 66% 36% 36%;
}
.theme-bg-ember.ember-crimson{
  background:radial-gradient(circle at 50% 60%,#fff1f2 0%,#fb7185 32%,rgba(225,29,72,.52) 65%,transparent 100%);
  box-shadow:0 0 18px rgba(244,63,94,.72);
}
.theme-bg-ember.ember-violet{
  background:radial-gradient(circle at 50% 60%,#faf5ff 0%,#d8b4fe 32%,rgba(147,51,234,.52) 65%,transparent 100%);
  box-shadow:0 0 18px rgba(168,85,247,.70);
}
.theme-bg-ember.ember-necro{
  background:radial-gradient(circle at 50% 60%,#ecfdf5 0%,#6ee7b7 32%,rgba(16,185,129,.48) 65%,transparent 100%);
  box-shadow:0 0 18px rgba(52,211,153,.66);
}
.theme-bg-ember.ember-gold{
  background:radial-gradient(circle at 50% 60%,#fffbeb 0%,#fcd34d 34%,rgba(217,119,6,.48) 65%,transparent 100%);
  box-shadow:0 0 16px rgba(251,191,36,.66);
}

/* Layer 6: 4 Blood Comets & Dimensional Rift Claw-Slashes */
.theme-bg-comet{
  position:absolute;
  left:0;
  top:0;
  display:block;
  width:270px;
  height:3.5px;
  border-radius:999px;
  transform-origin:100% 50%;
  opacity:0;
  background:linear-gradient(90deg,rgba(88,28,135,0) 0%,rgba(168,85,247,.36) 38%,rgba(244,63,94,.90) 84%,#ffe4e6 100%);
  box-shadow:0 0 16px rgba(244,63,94,.66);
  will-change:transform,opacity;
}
.theme-bg-comet.is-rift{
  height:4.5px;
  background:linear-gradient(90deg,rgba(16,185,129,0) 0%,rgba(139,92,246,.42) 36%,rgba(217,70,239,.92) 84%,#fae8ff 100%);
  box-shadow:0 0 18px rgba(192,38,211,.72);
}
.theme-bg-comet::after{
  content:"";
  position:absolute;
  right:-3px;
  top:-3.5px;
  width:11px;
  height:11px;
  border-radius:50%;
  background:radial-gradient(circle,#ffffff 0%,#fb7185 55%,transparent 100%);
  box-shadow:0 0 18px #f43f5e,0 0 6px #ffffff;
}

/* Layer 7: Cursor Hellfire Soul-Lantern + Cursed Hex Shockwave Ripples */
.theme-bg-lantern{
  position:absolute;
  left:0;
  top:0;
  display:block;
  width:460px;
  height:460px;
  border-radius:50%;
  opacity:0;
  mix-blend-mode:screen;
  background:radial-gradient(circle,rgba(225,29,72,.22) 0%,rgba(147,51,234,.13) 38%,rgba(16,185,129,.05) 58%,transparent 74%);
  will-change:transform,opacity;
}
.theme-bg-ripple{
  --ripple-color:#f43f5e;
  position:absolute;
  left:0;
  top:0;
  display:block;
  width:200px;
  height:200px;
  border-radius:50%;
  border:2px solid var(--ripple-color);
  box-shadow:0 0 24px var(--ripple-color),inset 0 0 20px color-mix(in srgb,var(--ripple-color) 48%,transparent);
  opacity:0;
  transform-origin:50% 50%;
  will-change:transform,opacity;
}
.theme-bg-ripple.is-shockwave{
  border-width:3px;
}

/* ==========================================================================
   V14 999-SPECIES SUPERNATURAL PANTHEON ACTORS & 8-SLOT ACCESSORIES
   ========================================================================== */
.theme-ghost-actor{
  position:absolute;
  left:0;
  top:0;
  display:block;
  width:156px;
  height:156px;
  transform:translate3d(-999px,-999px,0);
  will-change:transform,opacity;
}

.theme-ghost-aura{
  position:absolute;
  inset:-6%;
  border-radius:50%;
  z-index:0;
  transition:none!important;
  will-change:opacity,transform;
}

.theme-ghost-aura-calm{
  --calm-glow:#38d6ff;
  background:radial-gradient(circle,color-mix(in srgb,var(--calm-glow) 16%,transparent) 0%,color-mix(in srgb,var(--calm-glow) 6%,transparent) 42%,transparent 64%);
  opacity:1;
}

.theme-ghost-aura-react{
  --react-glow:#ff1e42;
  inset:-6%;
  background:radial-gradient(circle at 50% 48%,color-mix(in srgb,var(--react-glow) 22%,transparent) 0%,color-mix(in srgb,var(--react-glow) 8%,transparent) 44%,transparent 66%);
  opacity:0;
}

.theme-ghost-shockwave{
  position:absolute;
  inset:-10%;
  border-radius:50%;
  border:2.2px solid #ff1e42;
  opacity:0;
  z-index:1;
  transform-origin:50% 50%;
  will-change:transform,opacity;
}

.theme-ghost-rig{
  position:relative;
  z-index:2;
  display:block;
  width:100%;
  height:100%;
  transform-origin:50% 54%;
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
  will-change:transform;
}

.theme-ghost-img{
  position:absolute;
  inset:0;
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  transition:none!important;
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
  will-change:opacity;
}

.theme-ghost-calm{
  z-index:1;
  opacity:1;
  visibility:visible;
  filter:drop-shadow(0 16px 26px rgba(0,2,10,.92)) drop-shadow(0 3px 8px rgba(0,0,0,.74));
}

.theme-ghost-react{
  z-index:2;
  opacity:0;
  visibility:hidden;
  filter:drop-shadow(0 16px 26px rgba(0,2,10,.92)) drop-shadow(0 3px 8px rgba(0,0,0,.74));
}

/* 8 Supernatural Accessory Slots: head | eyes | cheek | neck | back | weapon | tail | companion */
.theme-ghost-acc{
  position:absolute;
  left:48%;
  top:14%;
  width:28%;
  height:28%;
  z-index:3;
  display:none;
  transform:translate(-50%,-50%);
  transform-origin:50% 50%;
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
  filter:drop-shadow(0 6px 12px rgba(0,2,10,.78)) drop-shadow(0 1px 3px rgba(0,0,0,.65));
}
.theme-ghost-acc:is(.slot-back,.slot-wings,.slot-tail){
  z-index:0;
}
.theme-ghost-acc.slot-weapon{
  z-index:3;
}
.theme-ghost-acc.slot-companion{
  z-index:4;
  will-change:transform;
}
.theme-ghost-acc-img{
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
}

.theme-ghost-emote{
  position:absolute;
  left:50%;
  top:2%;
  width:0;
  height:0;
  z-index:5;
  opacity:0;
  will-change:opacity;
}

.theme-ghost-badge{
  position:absolute;
  left:0;
  top:-36px;
  width:48px;
  height:48px;
  transform:translate3d(-50%,0,0);
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
  filter:drop-shadow(0 8px 16px rgba(0,0,0,.88)) drop-shadow(0 0 10px rgba(244,63,94,.32));
  will-change:transform;
}

.theme-ghost-spark{
  position:absolute;
  left:-4px;
  top:24px;
  width:9px;
  height:9px;
  border-radius:50%;
  background:#ff1e42;
  opacity:0;
  will-change:transform,opacity;
}

/* V16 GhostEmotion & SocialTheater: Pre-allocated 3D Comic Emotion Bubbles & Clash/Synergy VFX */
.theme-ghost-mood-bubble{
  --mood-glow:rgba(244,63,94,.45);
  position:absolute;
  left:50%;
  top:-4px;
  width:0;
  height:0;
  z-index:6;
  opacity:0;
  will-change:transform,opacity;
}

.theme-ghost-mood-bubble-img{
  position:absolute;
  left:0;
  top:-56px;
  width:66px;
  height:66px;
  display:block;
  object-fit:contain;
  transform:translate3d(-50%,0,0);
  transform-origin:50% 92%;
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
  filter:drop-shadow(0 8px 16px rgba(0,0,0,.88)) drop-shadow(0 0 12px var(--mood-glow));
  will-change:transform;
}

.theme-social-clash{
  position:absolute;
  left:0;
  top:0;
  width:136px;
  height:136px;
  z-index:4;
  opacity:0;
  transform:translate3d(-999px,-999px,0);
  transform-origin:50% 50%;
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
  will-change:transform,opacity;
}

.theme-social-clash-img{
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  filter:drop-shadow(0 0 18px rgba(251,191,36,.68)) drop-shadow(0 0 10px rgba(244,63,94,.52));
}

.theme-social-arc{
  position:absolute;
  left:0;
  top:0;
  width:160px;
  height:48px;
  z-index:3;
  opacity:0;
  transform:translate3d(-999px,-999px,0);
  transform-origin:0% 50%;
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
  will-change:transform,opacity;
}

.theme-social-arc-img{
  display:block;
  width:100%;
  height:100%;
  object-fit:fill;
  filter:drop-shadow(0 0 14px rgba(244,63,94,.72));
}

body[data-theme-motion="running"] dialog::backdrop{backdrop-filter:none;background:#030510c8}
body[data-theme-motion="running"] :is(.sidebar,.topbar,.site-dropdown-panel,.mobile-backdrop){backdrop-filter:none;-webkit-backdrop-filter:none}

@keyframes theme-wall-drift{0%{transform:translate3d(-1.5%,-.8%,0) scale(1.075)}100%{transform:translate3d(1.5%,.8%,0) scale(1.105)}}
@keyframes theme-wall-orbit{0%{transform:translate3d(1%,-1%,0) scale(1.085) rotate(-.5deg)}100%{transform:translate3d(-1%,1%,0) scale(1.115) rotate(.5deg)}}
@keyframes theme-particle-float{0%{transform:translate3d(0,25px,0) scale(.6);opacity:0}25%{opacity:var(--motion-alpha)}75%{opacity:var(--motion-alpha)}100%{transform:translate3d(22px,-55px,0) scale(1.15);opacity:0}}

@media(max-width:768px){
  .theme-motion-particle:nth-child(n+7){display:none}
  body:is([data-theme-motion="running"],[data-theme-motion="paused"]):not([data-theme="black-ghost"]) #appearance-background .appearance-wallpaper{animation-duration:24s}
  .theme-ghost-badge{width:38px;height:38px;top:-28px}
  .theme-ghost-mood-bubble-img{width:44px;height:44px;top:-40px}
  .theme-social-clash{width:98px;height:98px}
  .theme-bg-lantern{width:280px;height:280px}
  .theme-bg-comet{width:180px}
  .theme-bg-void-eyes{width:72px;height:32px}
}

@media(prefers-reduced-motion:reduce){
  body:not([data-theme="black-ghost"]) #theme-motion-background{display:none!important}
  body[data-theme="black-ghost"]:not([data-theme-motion="off"]) #theme-motion-background,
  body[data-theme="black-ghost"]:not([data-theme-motion="off"]) #theme-motion-overflow{display:block!important}
  body:not([data-theme="black-ghost"]) #appearance-background .appearance-wallpaper{animation:none!important;transform:none!important;will-change:auto!important}
  body[data-theme="black-ghost"] #appearance-background .appearance-wallpaper{animation:none!important}
}
