.disco-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.35s ease;
}

html.disco-mode .disco-layer {
  opacity: 1;
}

.disco-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 18%, hsl(330 70% 45% / 0.08) 0%, transparent 45%),
    radial-gradient(ellipse at 82% 22%, hsl(200 75% 42% / 0.07) 0%, transparent 42%),
    radial-gradient(ellipse at 70% 88%, hsl(55 80% 45% / 0.06) 0%, transparent 48%),
    radial-gradient(ellipse at 12% 78%, hsl(270 65% 48% / 0.07) 0%, transparent 44%),
    hsl(240 10% 3.9%);
  animation: disco-bg-drift 10s ease-in-out infinite alternate;
}

.disco-bg-sweep {
  position: absolute;
  inset: -60%;
  opacity: 0.35;
  background: conic-gradient(
    from 0deg at 50% 50%,
    hsl(0 70% 50% / 0.05),
    hsl(50 80% 50% / 0.04),
    hsl(120 65% 45% / 0.05),
    hsl(190 75% 50% / 0.04),
    hsl(260 70% 52% / 0.05),
    hsl(320 75% 52% / 0.04),
    hsl(0 70% 50% / 0.05)
  );
  animation: disco-bg-spin 18s linear infinite;
}

.disco-bg-grid {
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background-image:
    linear-gradient(hsl(0 0% 100% / 0.02) 1px, transparent 1px),
    linear-gradient(90deg, hsl(0 0% 100% / 0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 65%, black 10%, transparent 70%);
  animation: disco-grid-pulse 3s ease-in-out infinite alternate;
}

@keyframes disco-bg-drift {
  from { filter: hue-rotate(0deg); }
  to { filter: hue-rotate(25deg); }
}

@keyframes disco-bg-spin {
  to { transform: rotate(360deg); }
}

@keyframes disco-grid-pulse {
  from { opacity: 0.25; }
  to { opacity: 0.45; }
}

html.disco-mode,
html.disco-mode body {
  background: hsl(240 10% 3.9%) !important;
}

html.disco-mode main {
  position: relative;
  z-index: 10;
}

.disco-ball-assembly {
  position: absolute;
  top: 2.5%;
  left: 50%;
  width: 0;
  height: 0;
  animation: disco-ball-sway 5.5s ease-in-out infinite alternate;
}

.disco-ball-rod {
  position: absolute;
  left: -1px;
  top: -2.4rem;
  width: 2px;
  height: 2.4rem;
  background: linear-gradient(
    to bottom,
    hsl(0 0% 55% / 0.15),
    hsl(0 0% 78% / 0.55) 55%,
    hsl(0 0% 92% / 0.75)
  );
  box-shadow: 0 0 6px hsl(0 0% 100% / 0.15);
}

.disco-ball-wrap {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
}

.disco-ball {
  position: absolute;
  top: -2rem;
  left: -2rem;
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 100%, hsl(240 12% 8% / 0.55) 0%, transparent 58%),
    radial-gradient(circle at 32% 24%, hsl(0 0% 100% / 0.95) 0%, transparent 18%),
    repeating-conic-gradient(
      from 8deg at 50% 50%,
      hsl(0 0% 88%) 0deg 7deg,
      hsl(0 0% 58%) 7deg 8deg,
      hsl(0 0% 92%) 8deg 15deg,
      hsl(0 0% 62%) 15deg 16deg,
      hsl(195 55% 72% / 0.55) 16deg 23deg,
      hsl(0 0% 54%) 23deg 24deg,
      hsl(0 0% 90%) 24deg 31deg,
      hsl(280 45% 74% / 0.45) 31deg 32deg
    );
  box-shadow:
    inset -6px -10px 16px hsl(240 15% 6% / 0.55),
    inset 4px 4px 10px hsl(0 0% 100% / 0.22),
    0 0 18px hsl(0 0% 100% / 0.18),
    0 0 34px hsl(280 80% 60% / 0.35),
    0 0 56px hsl(200 85% 55% / 0.2);
  animation: disco-ball-spin 7s linear infinite;
}

.disco-ball::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0 5px,
      hsl(0 0% 100% / 0.07) 5px 6px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0 5px,
      hsl(0 0% 100% / 0.07) 5px 6px
    );
  mix-blend-mode: overlay;
  opacity: 0.65;
}

.disco-ball::after {
  content: '';
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, hsl(0 0% 100% / 0.55) 0%, transparent 42%);
  animation: disco-ball-sparkle 2.4s ease-in-out infinite alternate;
}

.disco-ball-cap {
  position: absolute;
  top: -2.45rem;
  left: -0.45rem;
  width: 0.9rem;
  height: 0.55rem;
  border-radius: 0.2rem 0.2rem 0.05rem 0.05rem;
  background: linear-gradient(180deg, hsl(0 0% 72%), hsl(0 0% 48%));
  box-shadow: 0 1px 0 hsl(0 0% 92% / 0.35);
}

.disco-ball-spotlight {
  position: absolute;
  top: 0.35rem;
  left: -3.25rem;
  width: 6.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: radial-gradient(
    ellipse at 50% 0%,
    hsl(0 0% 100% / 0.14) 0%,
    hsl(280 80% 62% / 0.08) 35%,
    transparent 72%
  );
  filter: blur(2px);
  animation: disco-ball-spotlight 2.8s ease-in-out infinite alternate;
}

.disco-laser-hub {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
}

.disco-laser {
  position: absolute;
  top: 0;
  left: 0;
  width: 140vmax;
  height: 18px;
  margin-top: -9px;
  transform-origin: 0 50%;
  opacity: 0.72;
  mix-blend-mode: screen;
  border-radius: 9999px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    hsl(var(--hue) 90% 55% / 0.2) 18%,
    hsl(var(--hue) 95% 60% / 0.55) 38%,
    hsl(var(--hue) 100% 68%) 46%,
    hsl(0 0% 100% / 0.98) 50%,
    hsl(var(--hue) 100% 68%) 54%,
    hsl(var(--hue) 95% 60% / 0.55) 62%,
    hsl(var(--hue) 90% 55% / 0.2) 82%,
    transparent 100%
  );
  box-shadow:
    0 0 10px hsl(var(--hue) 100% 65% / 0.7),
    0 0 24px hsl(var(--hue) 95% 58% / 0.45),
    0 0 48px hsl(var(--hue) 90% 52% / 0.25);
}

.disco-laser::before {
  content: '';
  position: absolute;
  inset: -10px -20px;
  border-radius: 9999px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    hsl(var(--hue) 85% 50% / 0.12) 30%,
    hsl(var(--hue) 90% 55% / 0.22) 50%,
    hsl(var(--hue) 85% 50% / 0.12) 70%,
    transparent 100%
  );
  filter: blur(8px);
}

.disco-laser-1 { --hue: 330; animation: disco-laser-spin 4.2s linear infinite; }
.disco-laser-2 { --hue: 55; animation: disco-laser-spin 5.1s linear infinite reverse; animation-delay: -1.2s; }
.disco-laser-3 { --hue: 145; animation: disco-laser-spin 3.8s linear infinite; animation-delay: -0.6s; }
.disco-laser-4 { --hue: 200; animation: disco-laser-spin 6s linear infinite reverse; animation-delay: -2s; }
.disco-laser-5 { --hue: 270; animation: disco-laser-spin 4.8s linear infinite; animation-delay: -1.8s; }
.disco-laser-6 { --hue: 15; animation: disco-laser-spin 5.5s linear infinite reverse; animation-delay: -0.3s; }

.disco-floor-glow {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 40%;
  background:
    radial-gradient(ellipse at 30% 100%, hsl(330 70% 50% / 0.1) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 100%, hsl(200 75% 50% / 0.1) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 100%, hsl(280 65% 55% / 0.08) 0%, transparent 65%);
  animation: disco-floor-pulse 2s ease-in-out infinite alternate;
}

@keyframes disco-ball-spin {
  to { transform: rotate(360deg); }
}

@keyframes disco-ball-sway {
  from { transform: rotate(-4deg); }
  to { transform: rotate(4deg); }
}

@keyframes disco-ball-sparkle {
  from { opacity: 0.45; transform: scale(0.96); }
  to { opacity: 0.95; transform: scale(1.04); }
}

@keyframes disco-ball-spotlight {
  from { opacity: 0.55; transform: scaleX(0.92); }
  to { opacity: 0.9; transform: scaleX(1.08); }
}

@keyframes disco-laser-spin {
  to { transform: rotate(360deg); }
}

@keyframes disco-floor-pulse {
  from { opacity: 0.45; transform: scaleX(0.98); }
  to { opacity: 0.75; transform: scaleX(1.02); }
}

@keyframes disco-rainbow {
  to { background-position: 200% center; }
}

@keyframes disco-hue-cycle {
  to { filter: hue-rotate(360deg); }
}

html.disco-mode .glitch-text {
  background: linear-gradient(
    90deg,
    hsl(0 95% 62%),
    hsl(45 100% 58%),
    hsl(90 90% 55%),
    hsl(150 85% 58%),
    hsl(200 95% 62%),
    hsl(260 90% 68%),
    hsl(320 95% 62%),
    hsl(0 95% 62%)
  );
  background-size: 250% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: disco-rainbow 2s linear infinite, glitch 1.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

html.disco-mode .glitch-text::before {
  text-shadow: -3px 0 hsl(330 100% 62%);
  animation: glitch 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite reverse, disco-hue-cycle 2.5s linear infinite;
}

html.disco-mode .glitch-text::after {
  text-shadow: 3px 0 hsl(190 100% 58%);
  animation: glitch 1.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite, disco-hue-cycle 3s linear infinite reverse;
}

html.disco-mode .noise-overlay {
  opacity: 0.4;
  mix-blend-mode: normal;
  animation: noise 0.5s steps(2) infinite;
}

html.disco-mode .scanline {
  opacity: 0.3;
  background: linear-gradient(
    to bottom,
    transparent 50%,
    hsl(0 0% 100% / 0.03) 50%
  );
}

html.disco-mode .rounded-lg.border {
  animation: disco-card-glow 1.4s ease-in-out infinite alternate;
}

@keyframes disco-card-glow {
  from {
    border-color: hsl(330 80% 58% / 0.45);
    box-shadow: 0 0 12px hsl(330 80% 50% / 0.15);
  }
  to {
    border-color: hsl(200 90% 60% / 0.55);
    box-shadow: 0 0 18px hsl(200 90% 55% / 0.25);
  }
}

.battle-map-border {
  position: absolute;
  inset: 1.25rem;
  border: 1px dashed hsl(var(--border) / 0.4);
  border-radius: var(--radius);
  box-shadow: inset 0 0 40px hsl(270 50% 20% / 0.08);
}

.fighter {
  position: absolute;
  width: 3.5rem;
  height: 4.5rem;
  will-change: left, top, transform;
  transition: filter 0.1s ease;
}

.fighter svg {
  width: 100%;
  height: 100%;
}

.fighter-wizard svg {
  filter: drop-shadow(0 0 12px hsl(220 85% 58% / 0.5));
}

.wizard-orb {
  animation: wizard-orb-pulse 1.1s ease-in-out infinite alternate;
}

@keyframes wizard-orb-pulse {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

.fighter-skeleton svg {
  filter: drop-shadow(0 0 8px hsl(0 84% 60% / 0.4));
}

.fighter-ghost {
  width: 3.25rem;
  height: 4rem;
  opacity: 0.9;
}

.fighter-ghost svg {
  filter: drop-shadow(0 0 16px hsl(165 70% 62% / 0.55));
}

.ghost-body {
  animation: ghost-wisp 1.6s ease-in-out infinite alternate;
}

.ghost-chain {
  animation: ghost-chain-sway 2.2s ease-in-out infinite alternate;
}

.fighter.is-floating svg {
  animation: ghost-float 1.7s ease-in-out infinite alternate;
}

.fighter-ghost.is-shooting .ghost-mouth {
  animation: ghost-scream 0.24s ease-out 2 alternate;
}

.fighter-hit {
  filter: brightness(2) saturate(1.4);
}

.fighter.is-running {
  animation: fighter-bob 0.22s ease-in-out infinite alternate;
}

.fighter.is-running .run-leg-a {
  transform-box: fill-box;
  transform-origin: center top;
  animation: run-leg-a 0.28s ease-in-out infinite alternate;
}

.fighter.is-running .run-leg-b {
  transform-box: fill-box;
  transform-origin: center top;
  animation: run-leg-b 0.28s ease-in-out infinite alternate-reverse;
}

.fighter.is-running .run-arm-a {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: run-arm-a 0.28s ease-in-out infinite alternate;
}

.fighter.is-running .run-arm-b {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: run-arm-b 0.28s ease-in-out infinite alternate-reverse;
}

.fighter.is-shooting .run-arm-a {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: shoot-arm 0.18s ease-out 2 alternate;
}

.skeleton-eye {
  animation: skeleton-blink 2.4s step-end infinite;
}

.projectile {
  position: absolute;
  pointer-events: none;
  will-change: left, top;
}

.projectile-wizard {
  width: 0.65rem;
  height: 0.65rem;
  margin-left: -0.325rem;
  margin-top: -0.325rem;
  border-radius: 50%;
  background: hsl(180 70% 50%);
  box-shadow: 0 0 10px hsl(180 70% 50%), 0 0 18px hsl(180 70% 70% / 0.6);
}

.projectile-skeleton {
  width: 0.45rem;
  height: 0.85rem;
  margin-left: -0.225rem;
  margin-top: -0.425rem;
  border-radius: 1px;
  background: hsl(0 84% 60%);
  box-shadow: 0 0 8px hsl(0 84% 60% / 0.7);
}

.projectile-ghost {
  width: 0.8rem;
  height: 0.55rem;
  margin-left: -0.4rem;
  margin-top: -0.275rem;
  border-radius: 50% 50% 50% 10%;
  background: hsl(165 55% 78% / 0.95);
  box-shadow: 0 0 12px hsl(165 70% 58% / 0.85), 0 0 20px hsl(165 80% 72% / 0.45);
  animation: ghost-bolt 0.35s ease-in-out infinite alternate;
}

.battle-flash {
  position: absolute;
  width: 2.5rem;
  height: 2.5rem;
  margin-left: -1.25rem;
  margin-top: -1.25rem;
  border-radius: 50%;
  pointer-events: none;
  animation: battle-flash 0.35s ease-out forwards;
}

.battle-flash-wizard {
  background: radial-gradient(circle, hsl(180 70% 60% / 0.7) 0%, transparent 70%);
}

.battle-flash-skeleton {
  background: radial-gradient(circle, hsl(0 84% 60% / 0.7) 0%, transparent 70%);
}

.battle-flash-ghost {
  background: radial-gradient(circle, hsl(165 70% 62% / 0.75) 0%, transparent 70%);
}

@keyframes ghost-float {
  from { transform: translateY(0); }
  to { transform: translateY(-9px); }
}

@keyframes ghost-wisp {
  from { transform: scaleX(1) skewX(0deg); }
  to { transform: scaleX(1.04) skewX(-3deg); }
}

@keyframes ghost-chain-sway {
  from { transform: rotate(-6deg); }
  to { transform: rotate(8deg); }
}

@keyframes ghost-scream {
  from { transform: scaleY(1); }
  to { transform: scaleY(1.35); }
}

@keyframes ghost-bolt {
  from { opacity: 0.75; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1.1); }
}

@keyframes fighter-bob {
  from { margin-top: 0; }
  to { margin-top: -4px; }
}

@keyframes run-leg-a {
  from { transform: rotate(28deg); }
  to { transform: rotate(-22deg); }
}

@keyframes run-leg-b {
  from { transform: rotate(-28deg); }
  to { transform: rotate(22deg); }
}

@keyframes run-arm-a {
  from { transform: rotate(-24deg); }
  to { transform: rotate(30deg); }
}

@keyframes run-arm-b {
  from { transform: rotate(24deg); }
  to { transform: rotate(-30deg); }
}

@keyframes shoot-arm {
  from { transform: rotate(-10deg); }
  to { transform: rotate(-55deg); }
}

@keyframes skeleton-blink {
  0%, 88%, 100% { opacity: 1; }
  90%, 96% { opacity: 0.2; }
}

@keyframes battle-flash {
  from { opacity: 1; transform: scale(0.4); }
  to { opacity: 0; transform: scale(1.6); }
}

