:root {
  --bg-color: #d8c5ff;
  --text-color: #0057b8;
  --gif-lift: clamp(150px, 18vh, 260px);
  --soft-white: rgba(255, 255, 255, 0.78);
  --soft-black: rgba(20, 20, 26, 0.28);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg-color);
  color: var(--text-color);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background 700ms ease, color 700ms ease;
}

.stage {
  position: relative;
  z-index: 3;
  display: grid;
  min-height: 100vh;
  width: 100%;
  place-items: center;
  padding: clamp(18px, 5vw, 48px);
  text-align: center;
}

.proud-line {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.32em;
  max-width: min(92vw, 1120px);
  margin: 0;
  font-size: clamp(2rem, 7vw, 6rem);
  font-weight: 760;
  line-height: 1.02;
  letter-spacing: 0;
  text-shadow:
    0 2px 18px var(--soft-white),
    0 1px 4px var(--soft-black);
}

.name-wheel {
  display: inline-block;
  min-width: 8ch;
  text-align: right;
  transform-origin: 50% 62%;
  will-change: transform, filter;
}

body.spinning .name-wheel {
  animation: wheel-pop 280ms ease-in-out infinite;
  filter: blur(0.35px);
}

.pride-gif {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: clamp(132px, 22vw, 280px);
  height: auto;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-50% - var(--gif-lift))) scale(0.42) rotate(-8deg);
}

body.finished .pride-gif {
  animation:
    gif-pop 980ms cubic-bezier(0.18, 0.86, 0.24, 1.15) forwards,
    float-softly 4.8s ease-in-out 980ms infinite;
}

.curtain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  transform: translateY(-106%);
  background:
    linear-gradient(
      to bottom,
      #e40303 0%,
      #e40303 16.666%,
      #ff8c00 16.666%,
      #ff8c00 33.333%,
      #ffed00 33.333%,
      #ffed00 50%,
      #008026 50%,
      #008026 66.666%,
      #24408e 66.666%,
      #24408e 83.333%,
      #732982 83.333%,
      #732982 100%
    );
  box-shadow: 0 20px 42px rgba(20, 20, 26, 0.28);
}

.curtain::before {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 18px;
  content: "";
  background: rgba(255, 255, 255, 0.28);
  box-shadow: 0 7px 18px rgba(20, 20, 26, 0.18);
}

.curtain::after {
  position: absolute;
  right: 0;
  bottom: -28px;
  left: 0;
  height: 42px;
  content: "";
  background:
    radial-gradient(36px 22px at 18px 0, transparent 19px, #732982 20px) 0 0 / 72px 42px repeat-x;
}

body.finished .curtain {
  animation: curtain-fall 7.2s cubic-bezier(0.17, 0.78, 0.18, 1) forwards;
}

body.sound-ready::after {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 5;
  max-width: calc(100vw - 32px);
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  color: #17171c;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 22px rgba(20, 20, 26, 0.16);
  content: "TAP HERE NOW";
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0;
  transform: translateX(-50%);
}

@keyframes wheel-pop {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-0.08em) scale(1.025);
  }
}

@keyframes gif-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, calc(-50% - var(--gif-lift))) scale(0.42) rotate(-8deg);
  }

  70% {
    opacity: 1;
    transform: translate(-50%, calc(-50% - var(--gif-lift) - 24px)) scale(1.08) rotate(4deg);
  }

  100% {
    opacity: 0.92;
    transform: translate(-50%, calc(-50% - var(--gif-lift) - 12px)) scale(1) rotate(0deg);
  }
}

@keyframes float-softly {
  0%,
  100% {
    transform: translate(-50%, calc(-50% - var(--gif-lift) - 12px)) scale(1) rotate(0deg);
  }

  50% {
    transform: translate(-50%, calc(-50% - var(--gif-lift) - 32px)) scale(1.03) rotate(2deg);
  }
}

@keyframes curtain-fall {
  0% {
    transform: translateY(-106%);
  }

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

@media (max-width: 560px) {
  .proud-line {
    font-size: clamp(2.2rem, 13vw, 4.6rem);
  }

  .name-wheel {
    min-width: 0;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
