@font-face {
  font-family: Onest;
  src: url("/fonts/onest-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #021518;
  color: #e7f4f1;
  font-family: Onest, system-ui, sans-serif;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  position: fixed;
  inset: 0;
}

button {
  -webkit-user-select: none;
  user-select: none;
}

.app {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  overflow: hidden;
  padding:
    max(16px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
}

.stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, rgba(48, 158, 142, 0.04), transparent 46%),
    #021518;
}

.stage-burst {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 160vmax;
  height: 160vmax;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(48, 158, 142, 0.11) 0deg 2.4deg,
    transparent 2.4deg 15deg
  );
  -webkit-mask-image: radial-gradient(circle, transparent 0 18%, #000 28%, #000 52%, transparent 74%);
  mask-image: radial-gradient(circle, transparent 0 18%, #000 28%, #000 52%, transparent 74%);
  filter: blur(10px);
  animation: stage-turn 180s linear infinite;
}

.stage-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(108vmin, 980px);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 10px solid rgba(232, 197, 107, 0.12);
  box-shadow: 0 0 0 16px rgba(125, 206, 192, 0.07);
  filter: blur(8px);
}

.wheel-slot {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  min-width: 0;
  display: grid;
  place-items: center;
}

.app[data-mode="idle"],
.app[data-mode="won"] {
  cursor: grab;
}

.app[data-mode="holding"] {
  cursor: grabbing;
}

.banner {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 50%;
  max-width: 88%;
  margin: 0;
  pointer-events: none;
  text-align: center;
  font-size: clamp(52px, 9vw, 112px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: #f6f3ea;
  text-shadow:
    0 0 28px rgba(232, 197, 107, 0.65),
    0 10px 28px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translate(-50%, -50%);
}

.banner.is-on {
  animation: banner-pop 4.4s ease forwards;
}

.housing {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
}

.bulbs {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.bulb {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform: rotate(var(--a));
}

.bulb::before {
  content: "";
  position: absolute;
  left: calc(var(--bulb, 10px) / -2);
  top: calc(var(--radius, 200px) * -1 - var(--bulb, 10px) / 2);
  width: var(--bulb, 10px);
  height: var(--bulb, 10px);
  border-radius: 50%;
  background: #143833;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.app[data-mode="idle"] .bulb:nth-child(odd)::before {
  animation: twinkle 2.8s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.18s);
}

.app[data-mode="spinning"] .bulb::before {
  animation: chase 0.55s linear infinite;
  animation-delay: calc(var(--i) * -0.023s);
}

.app[data-mode="won"] .bulb::before {
  background: #7ee0d0;
  box-shadow: 0 0 10px #60cdba;
}

.disc {
  position: absolute;
  inset: 5.8%;
  border-radius: 50%;
  overflow: hidden;
  background: #071614;
  box-shadow:
    0 0 0 2px rgba(232, 197, 107, 0.55),
    0 22px 50px rgba(0, 0, 0, 0.45);
  z-index: 2;
}

.app[data-mode="won"] .disc {
  box-shadow:
    0 0 0 2px rgba(232, 197, 107, 0.95),
    0 0 42px rgba(96, 205, 186, 0.35),
    0 22px 50px rgba(0, 0, 0, 0.45);
}

.rotor,
.rotor svg {
  width: 100%;
  height: 100%;
  display: block;
}

.rotor {
  transform-origin: 50% 50%;
  will-change: transform;
}

.glass {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(
    128deg,
    rgba(255, 255, 255, 0.2),
    transparent 36%,
    transparent 64%,
    rgba(255, 255, 255, 0.05)
  );
  pointer-events: none;
}

.hub {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: grid;
  width: 24%;
  aspect-ratio: 1;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(96, 205, 186, 0.75);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #245e56, #0c2422 64%);
  box-shadow:
    inset 0 0 0 7px rgba(2, 21, 24, 0.5),
    0 10px 24px rgba(0, 0, 0, 0.35);
}

.pointer-wrap {
  position: absolute;
  top: 2.8%;
  left: 50%;
  z-index: 5;
  width: 6.4%;
  transform: translateX(-50%);
  filter: drop-shadow(0 8px 4px rgba(0, 0, 0, 0.45));
}

.pointer {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: 50% 12%;
  transition: transform 0.08s ease-out;
}

.confetti {
  position: fixed;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

@keyframes banner-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -42%) scale(0.84);
  }
  11% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  77% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -56%) scale(1.05);
  }
}

@keyframes stage-turn {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes twinkle {
  0%,
  100% {
    background: #143833;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  }
  50% {
    background: #60cdba;
    box-shadow: 0 0 8px rgba(96, 205, 186, 0.85);
  }
}

@keyframes chase {
  0%,
  42% {
    background: #e8c56b;
    box-shadow: 0 0 10px rgba(232, 197, 107, 0.95);
  }
  58%,
  100% {
    background: #12312d;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bulb::before,
  .stage-burst,
  .banner.is-on {
    animation: none;
  }

  .banner.is-on {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}
