* {
  box-sizing: border-box;
}

:root {
  --flashlight-x: 50vw;
  --flashlight-y: 50vh;
  --flashlight-core: clamp(70px, 9vw, 130px);
  --flashlight-falloff: clamp(220px, 34vw, 420px);
  --flashlight-light-opacity: 0.85;
  --flashlight-shadow-opacity: 1;
}

html,
body {
  margin: 0;
  min-height: 100%;
  cursor: none;
}

body {
  background: #000;
  -webkit-user-select: none;
  user-select: none;
}

body * {
  cursor: none;
}

.cursor-ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 56px;
  height: 56px;
  overflow: visible;
  pointer-events: none;
  z-index: 80;
  opacity: 0.5;
  will-change: transform;
}

.cursor-ghost::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("./cursor.png") center / contain no-repeat;
  opacity: 1;
}

.cursor-light-halo {
  position: absolute;
  left: 18px;
  top: 20px;
  width: 20px;
  height: 20px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, background 180ms ease;
}

.cursor-ghost::after {
  content: "";
  position: absolute;
  top: 20px;
  right: 36px;
  width: 1px;
  height: 1px;
  border-radius: 50%;
  border: 1px solid transparent;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.cursor-ghost.is-audio-on::after {
  opacity: 0.3;
  background: radial-gradient(circle at 30% 30%,
      rgba(235, 255, 236, 0.95) 0 25%,
      rgba(76, 255, 118, 0.92) 45%,
      rgba(18, 118, 42, 0.98) 100%);
  border-color: rgba(144, 255, 177, 0.88);
  box-shadow:
    0 0 22px rgba(95, 255, 152, 1),
    0 0 42px rgba(65, 225, 120, 0.98),
    0 0 78px rgba(48, 186, 96, 0.92),
    0 0 120px rgba(30, 142, 71, 0.84);
}

.cursor-ghost.is-audio-on .cursor-light-halo {
  opacity: 0.5;
  background: radial-gradient(circle,
      rgba(126, 255, 164, 0.56) 0%,
      rgba(98, 236, 140, 0.38) 35%,
      rgba(60, 176, 104, 0.2) 57%,
      rgba(20, 84, 45, 0) 78%);
}

.cursor-ghost.is-audio-off::after {
  opacity: 0.3;
  background: radial-gradient(circle at 30% 30%,
      rgba(255, 231, 231, 0.95) 0 25%,
      rgba(255, 98, 98, 0.9) 45%,
      rgba(132, 28, 28, 0.98) 100%);
  border-color: rgba(255, 152, 152, 0.86);
  box-shadow:
    0 0 20px rgba(255, 115, 115, 0.96),
    0 0 40px rgba(229, 72, 72, 0.92),
    0 0 72px rgba(176, 42, 42, 0.86),
    0 0 112px rgba(136, 27, 27, 0.76);
}

.cursor-ghost.is-audio-off .cursor-light-halo {
  opacity: 0.5;
  background: radial-gradient(circle,
      rgba(255, 138, 138, 0.52) 0%,
      rgba(239, 95, 95, 0.35) 35%,
      rgba(184, 56, 56, 0.19) 57%,
      rgba(89, 24, 24, 0) 78%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: var(--flashlight-shadow-opacity);
  background: radial-gradient(circle at var(--flashlight-x) var(--flashlight-y),
      rgba(0, 0, 0, 0) 0,
      rgba(0, 0, 0, 0.08) var(--flashlight-core),
      rgba(0, 0, 0, 0.62) calc(var(--flashlight-core) * 1.9),
      rgba(0, 0, 0, 0.9) var(--flashlight-falloff));
  transition: opacity 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  opacity: var(--flashlight-light-opacity);
  mix-blend-mode: screen;
  background: radial-gradient(circle at var(--flashlight-x) var(--flashlight-y),
      rgba(198, 230, 184, 0.08) 0,
      rgba(144, 190, 134, 0.045) var(--flashlight-core),
      rgba(0, 0, 0, 0) calc(var(--flashlight-core) * 1.8),
      rgba(0, 0, 0, 0) var(--flashlight-falloff));
  transition: opacity 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.audio-pulse-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 31;
}

.audio-wave {
  position: absolute;
  width: 28px;
  height: 18px;
  border-style: solid;
  border-radius: 50%;
  /* Asymmetric stroke gives the tilted "Saturn ring" feel. */
  border-width: 1.8px 4.4px 4.4px 1.8px;
  border-color:
    rgba(188, 255, 216, 0.22) rgba(188, 255, 216, 0.62) rgba(188, 255, 216, 0.62) rgba(188, 255, 216, 0.22);
  box-shadow:
    0 0 14px rgba(144, 255, 196, 0.2),
    inset 0 0 1px rgba(188, 255, 216, 0.2);
  --wave-start-x: -60%;
  --wave-start-y: -40%;
  --wave-end-x: 60%;
  --wave-end-y: 40%;
  --wave-scale-end: 1;
  --wave-tilt: -30deg;
  transform: translate(var(--wave-start-x), var(--wave-start-y)) scale(0, 0) rotate(var(--wave-tilt));
  opacity: 0;
  animation: cursor-audio-pulse 1.35s ease-out forwards;
}

.scene {
  min-height: 100svh;
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 0;
}

.sigil-stack {
  width: min(92vw, 760px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.5rem, 2vh, 1.1rem);
}

.sigil-stage {
  position: relative;
  width: min(92vw, 760px);
  aspect-ratio: 1 / 1;
  --ring-scale: 0.95;
  --ring-opacity: 0.42;
  --ring-duration: 7000ms;
  --image-opacity: 0;
  --image-duration: 1100ms;
  --distort-duration: 150ms;
  --distort-skew-x: 2deg;
  --distort-skew-y: 0.6deg;
  --distort-tear-x: 6px;
  --distort-noise: 0.22;
}

.sigil-stage::before {
  content: "";
  position: absolute;
  inset: -10%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
      rgba(10, 41, 18, 0.4) 38%,
      rgba(5, 21, 10, 0.21) 56%,
      rgba(0, 0, 0, 0) 78%);
  filter: blur(18px);
  pointer-events: none;
  z-index: 1;
  opacity: var(--ring-opacity);
  transform: scale(var(--ring-scale));
  transform-origin: 50% 50%;
  transition:
    transform var(--ring-duration) ease-in-out,
    opacity var(--ring-duration) ease-in-out;
}

.sigil-image {
  position: relative;
  z-index: 2;
  opacity: var(--image-opacity);
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(circle at 50% 50%,
      rgba(0, 0, 0, 1) 0%,
      rgba(0, 0, 0, 1) 36%,
      rgba(0, 0, 0, 0.9) 46%,
      rgba(0, 0, 0, 0.55) 56%,
      rgba(0, 0, 0, 0.2) 65%,
      rgba(0, 0, 0, 0) 74%);
  mask-image: radial-gradient(circle at 50% 50%,
      rgba(0, 0, 0, 1) 0%,
      rgba(0, 0, 0, 1) 36%,
      rgba(0, 0, 0, 0.9) 46%,
      rgba(0, 0, 0, 0.55) 56%,
      rgba(0, 0, 0, 0.2) 65%,
      rgba(0, 0, 0, 0) 74%);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  transition: opacity var(--image-duration) ease-out;
}

.sigil-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background:
    repeating-linear-gradient(0deg,
      rgba(128, 128, 128, 0.08) 0 1px,
      rgba(0, 0, 0, 0) 1px 3px),
    linear-gradient(90deg,
      rgba(110, 176, 255, 0.08) 0%,
      rgba(255, 88, 88, 0.06) 48%,
      rgba(88, 255, 155, 0.06) 100%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%,
      rgba(0, 0, 0, 1) 0%,
      rgba(0, 0, 0, 1) 36%,
      rgba(0, 0, 0, 0.9) 46%,
      rgba(0, 0, 0, 0.55) 56%,
      rgba(0, 0, 0, 0.2) 65%,
      rgba(0, 0, 0, 0) 74%);
  mask-image: radial-gradient(circle at 50% 50%,
      rgba(0, 0, 0, 1) 0%,
      rgba(0, 0, 0, 1) 36%,
      rgba(0, 0, 0, 0.9) 46%,
      rgba(0, 0, 0, 0.55) 56%,
      rgba(0, 0, 0, 0.2) 65%,
      rgba(0, 0, 0, 0) 74%);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  mix-blend-mode: screen;
}

.sigil-black-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: #000;
  --overlay-opacity: 0;
  --overlay-duration: 2200ms;
  opacity: var(--overlay-opacity);
  -webkit-mask-image: radial-gradient(circle at 50% 50%,
      rgba(0, 0, 0, 1) 0%,
      rgba(0, 0, 0, 1) 36%,
      rgba(0, 0, 0, 0.9) 46%,
      rgba(0, 0, 0, 0.55) 56%,
      rgba(0, 0, 0, 0.2) 65%,
      rgba(0, 0, 0, 0) 74%);
  mask-image: radial-gradient(circle at 50% 50%,
      rgba(0, 0, 0, 1) 0%,
      rgba(0, 0, 0, 1) 36%,
      rgba(0, 0, 0, 0.9) 46%,
      rgba(0, 0, 0, 0.55) 56%,
      rgba(0, 0, 0, 0.2) 65%,
      rgba(0, 0, 0, 0) 74%);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  transition: opacity var(--overlay-duration) ease-in-out;
}

.album-callout {
  position: relative;
  z-index: 5;
  margin: 0;
  width: min(84%, 560px);
  padding: 0.8rem 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.21em;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  font-weight: 700;
  line-height: 1.12;
  color: #12410067;
  /* border: 1px solid rgba(140, 226, 175, 0.55); */
  background: linear-gradient(90deg,
      rgba(4, 15, 9, 0.15) 0%,
      rgba(10, 46, 29, 0.58) 50%,
      rgba(4, 15, 9, 0.15) 100%);
  /* box-shadow:
    0 0 0 1px rgba(116, 210, 158, 0.2) inset,
    0 0 24px rgba(45, 143, 95, 0.34); */
  text-shadow: none;
  backdrop-filter: blur(2px);
  --callout-opacity: 0;
  --callout-duration: 2200ms;
  opacity: var(--callout-opacity);
  transition: opacity var(--callout-duration) ease-in-out;
  animation: none;
}

.album-callout::before,
.album-callout::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg,
      rgba(220, 255, 233, 0) 0%,
      rgba(220, 255, 233, 0.144) 50%,
      rgba(220, 255, 233, 0) 100%);
}

.album-callout::before {
  top: -7px;
}

.album-callout::after {
  bottom: -7px;
}

.album-callout span {
  display: block;
  will-change: filter;
  filter: blur(2.4px);
  text-shadow: 0 0 4px rgba(126, 255, 187, 0.24);
  transition: filter 420ms cubic-bezier(0.22, 1, 0.36, 1), text-shadow 420ms ease;
  animation: none;
}

.album-callout.is-spotlit span {
  animation: none;
  filter: blur(0.84px) !important;
  text-shadow: 0 0 4px rgba(126, 255, 187, 0.2);
}

.album-callout span:first-child {
  font-size: clamp(0.72rem, 0.42rem + 1vw, 1.02rem);
  opacity: 1;
}

.album-callout span:last-child {
  font-size: clamp(0.96rem, 0.58rem + 1.4vw, 1.5rem);
  letter-spacing: 0.16em;
}

.sigil-stage.is-distorting {
  animation: unease-distort var(--distort-duration) steps(2, end) 1;
}

.sigil-stage.is-distorting .sigil-image {
  animation: image-tv-distort var(--distort-duration) steps(3, end) 1;
  filter:
    contrast(1.16) saturate(0.84) hue-rotate(-4deg) drop-shadow(2px 0 rgba(255, 70, 70, 0.24)) drop-shadow(-2px 0 rgba(90, 170, 255, 0.22));
}

.sigil-stage.is-distorting::after {
  animation: tv-static var(--distort-duration) steps(6, end) 1;
}

@keyframes unease-distort {
  0% {
    transform: translate3d(0, 0, 0) skew(0deg, 0deg);
  }

  22% {
    transform: translate3d(var(--distort-tear-x),
        -1px,
        0) skew(var(--distort-skew-x), var(--distort-skew-y));
  }

  48% {
    transform: translate3d(calc(var(--distort-tear-x) * -0.9),
        1px,
        0) skew(calc(var(--distort-skew-x) * -0.75), calc(var(--distort-skew-y) * 0.6));
  }

  76% {
    transform: translate3d(calc(var(--distort-tear-x) * 0.5),
        1px,
        0) skew(calc(var(--distort-skew-x) * 0.35), calc(var(--distort-skew-y) * -0.4));
  }

  100% {
    transform: translate3d(0, 0, 0) skew(0deg, 0deg);
  }
}

@keyframes image-tv-distort {
  0% {
    transform: translate3d(0, 0, 0) skew(0deg, 0deg) scale(1);
    clip-path: inset(0 0 0 0);
  }

  30% {
    transform: translate3d(calc(var(--distort-tear-x) * -0.6),
        0,
        0) skew(calc(var(--distort-skew-x) * 0.9), calc(var(--distort-skew-y) * -0.4)) scaleX(1.02) scaleY(0.992);
    clip-path: inset(6% 0 4% 0);
  }

  62% {
    transform: translate3d(calc(var(--distort-tear-x) * 0.7),
        0,
        0) skew(calc(var(--distort-skew-x) * -0.8), var(--distort-skew-y)) scaleX(0.986) scaleY(1.012);
    clip-path: inset(2% 0 10% 0);
  }

  100% {
    transform: translate3d(0, 0, 0) skew(0deg, 0deg) scale(1);
    clip-path: inset(0 0 0 0);
  }
}

@keyframes tv-static {
  0% {
    opacity: 0;
    transform: translateY(0);
  }

  26% {
    opacity: calc(var(--distort-noise) * 0.7);
    transform: translateY(-2px);
  }

  58% {
    opacity: var(--distort-noise);
    transform: translateY(2px);
  }

  84% {
    opacity: calc(var(--distort-noise) * 0.55);
    transform: translateY(-1px);
  }

  100% {
    opacity: 0;
    transform: translateY(0);
  }
}

@keyframes album-flicker {

  0%,
  100% {
    opacity: 1;
  }

  18% {
    opacity: 0.93;
  }

  34% {
    opacity: 0.86;
  }

  52% {
    opacity: 0.92;
  }

  68% {
    opacity: 0.84;
  }

  84% {
    opacity: 0.91;
  }
}

@keyframes cursor-audio-pulse {
  0% {
    opacity: 0.1;
    transform: translate(var(--wave-start-x), var(--wave-start-y)) scale(0, 0) rotate(var(--wave-tilt));
  }

  60% {
    opacity: 0.05;
  }

  100% {
    opacity: 0;
    transform: translate(var(--wave-end-x), var(--wave-end-y)) scale(var(--wave-scale-end), var(--wave-scale-end)) rotate(var(--wave-tilt));
  }
}

@media (prefers-reduced-motion: reduce) {

  .sigil-stage::before,
  .sigil-black-overlay,
  .sigil-image,
  .sigil-stage.is-distorting,
  .album-callout,
  .album-callout::before,
  .album-callout::after,
  .album-callout span,
  .audio-pulse-layer,
  .audio-wave {
    transition: none;
    animation: none;
  }
}