:root {
  color-scheme: dark;
  --ink: #f8fbff;
  --muted: #a9b6c7;
  --cyan: #28d9ff;
  --gold: #ffd166;
  --red: #ff496d;
  --green: #49f2a4;
  --panel: rgba(9, 14, 26, 0.72);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow: hidden;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 17% 12%, rgba(40, 217, 255, 0.24), transparent 30%),
    radial-gradient(circle at 81% 19%, rgba(255, 209, 102, 0.2), transparent 28%),
    linear-gradient(135deg, #090a12 0%, #101a20 44%, #1b1120 100%);
}

body::before {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle, black 0 48%, transparent 78%);
}

.stage {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: clamp(20px, 4vw, 54px);
}

.panel {
  position: relative;
  display: grid;
  width: min(92vw, 620px);
  justify-items: center;
  gap: clamp(18px, 3vh, 28px);
  padding: clamp(18px, 4vw, 36px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: var(--panel);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(18px);
}

.aura {
  position: absolute;
  width: min(78vw, 520px);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0.55;
  filter: blur(22px);
  background: conic-gradient(from 20deg, var(--gold), var(--cyan), var(--red), var(--green), var(--gold));
  animation: orbit 9s linear infinite;
}

.wheel-shell {
  position: relative;
  display: grid;
  width: min(78vw, 470px);
  aspect-ratio: 1;
  place-items: center;
}

.wheel {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 10px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, transparent 0 17%, rgba(0, 0, 0, 0.14) 18% 21%, transparent 22%),
    repeating-conic-gradient(from -60deg, rgba(255, 255, 255, 0.22) 0 1deg, transparent 1deg 12deg),
    conic-gradient(from -60deg, #ffd166 0 120deg, #28d9ff 120deg 240deg, #ff496d 240deg 360deg);
  box-shadow:
    inset 0 0 46px rgba(255, 255, 255, 0.18),
    inset 0 0 80px rgba(0, 0, 0, 0.22),
    0 0 42px rgba(40, 217, 255, 0.22);
  transition: transform 5.2s cubic-bezier(0.08, 0.78, 0.1, 1);
  will-change: transform;
}

.wheel::before,
.wheel::after {
  position: absolute;
  inset: 4.5%;
  content: "";
  border-radius: inherit;
  pointer-events: none;
}

.wheel::before {
  border: 2px dashed rgba(255, 255, 255, 0.48);
  animation: orbit 12s linear infinite reverse;
}

.wheel::after {
  background:
    linear-gradient(30deg, transparent 45%, rgba(255, 255, 255, 0.24) 49%, transparent 54%),
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.34), transparent 23%);
  mix-blend-mode: screen;
}

.rim {
  position: absolute;
  inset: -2.5%;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
  pointer-events: none;
  box-shadow:
    0 0 0 10px rgba(255, 255, 255, 0.05),
    0 0 44px rgba(255, 209, 102, 0.34);
}

.slice-label {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  width: 30%;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  color: #111722;
  font-size: clamp(48px, 11vw, 78px);
  font-weight: 950;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.28);
  transform-origin: center;
}

.label-peace {
  transform: translate(-50%, -50%) rotate(0deg) translateY(-123%) rotate(0deg);
}

.label-courage {
  transform: translate(-50%, -50%) rotate(120deg) translateY(-123%) rotate(-120deg);
}

.label-water {
  transform: translate(-50%, -50%) rotate(240deg) translateY(-123%) rotate(-240deg);
}

.hub {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  width: 24%;
  aspect-ratio: 1;
  place-items: center;
  border: 8px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  color: white;
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 900;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.42), transparent 24%),
    linear-gradient(145deg, #16202f, #05070c);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
  transform: translate(-50%, -50%);
}

.pointer {
  position: absolute;
  top: -1%;
  z-index: 5;
  width: clamp(36px, 9vw, 58px);
  height: clamp(64px, 13vw, 88px);
  clip-path: polygon(50% 100%, 6% 0, 94% 0);
  background: linear-gradient(180deg, white, #ffd166 58%, #ff496d);
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.45));
}

.spin-button {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 10px;
  min-width: 172px;
  min-height: 56px;
  border: 0;
  border-radius: 8px;
  color: #061018;
  cursor: pointer;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0;
  background: linear-gradient(135deg, #ffffff, var(--gold) 50%, var(--green));
  box-shadow:
    0 14px 34px rgba(255, 209, 102, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transition:
    transform 0.18s ease,
    filter 0.18s ease;
}

.spin-button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.spin-button:disabled {
  cursor: wait;
  filter: saturate(0.75);
  transform: none;
}

.button-icon {
  font-size: 24px;
}

.result {
  min-height: 32px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(18px, 4vw, 24px);
  font-weight: 750;
  text-align: center;
}

.result.reveal {
  color: white;
  text-shadow:
    0 0 16px rgba(255, 209, 102, 0.85),
    0 0 30px rgba(73, 242, 164, 0.46);
  animation: pop 0.62s ease both;
}

#sparks {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

@keyframes orbit {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pop {
  0% {
    transform: scale(0.9);
  }

  58% {
    transform: scale(1.08);
  }

  100% {
    transform: scale(1);
  }
}

@media (max-width: 520px) {
  .panel {
    width: 100%;
  }

  .wheel-shell {
    width: min(84vw, 390px);
  }
}
