:root {
  --ink: #131313;
  --yellow: #ffd000;
  --peach: #ffac7d;
  --canvas-width: min(100vw, 56.25vh);
}

* { box-sizing: border-box; }

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

body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: #171717;
  font-family: Arial, Helvetica, sans-serif;
}

.stage {
  position: relative;
  width: var(--canvas-width);
  height: calc(var(--canvas-width) * 16 / 9);
  container-type: inline-size;
  overflow: hidden;
  background: #fff8db url("../assets/background.png") center / 100% 100% no-repeat;
}

.experience {
  display: grid;
  grid-template-rows: 22.5% 51.5% 15% 11%;
  width: 100%;
  height: 100%;
}

.brand-section, .wheel-section, .action-section, .result-section {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-section { flex-direction: column; gap: 30%; padding-top: 12%; }
.logo { width: 45.2%; height: auto; }
.title { width: 60.8%; height: auto; }

.wheel-section { align-items: flex-start; }
.wheel {
  position: relative;
  width: 89.6%;
  aspect-ratio: 1;
  margin-top: 5%;
}

.wheel-disc {
  position: absolute;
  border-radius: 50%;
}

.wheel-exterior {
  inset: 0;
  position: absolute;
  z-index: 3;
  overflow: hidden;
  border-radius: 50%;
  background:
    radial-gradient(circle closest-side at center,
      transparent 0 84.1%,
      #743927 84.25% 84.5%,
      #e8956e 84.7% 85.3%,
      #ffdec9 85.45% 85.8%,
      #151515 86% 95.1%,
      #f0aa84 95.35% 96.7%,
      #ffd9c5 96.95% 98.5%,
      #d47c57 98.75% 100%);
  box-shadow:
    inset 0 0 0 clamp(1px, .16vw, 3px) #ffe8da,
    inset 0 0 0 clamp(2px, .32vw, 6px) rgba(103, 44, 27, .48);
  pointer-events: none;
}

.wheel-exterior::after {
  position: absolute;
  inset: 7.1%;
  border: clamp(1px, .2vw, 4px) solid #e8956e;
  border-radius: 50%;
  box-shadow: 0 0 0 clamp(1px, .1vw, 2px) #743927;
  content: "";
}

.wheel-disc {
  inset: 7.1%;
  z-index: 1;
  overflow: hidden;
  background: #fff url("../assets/ruleta-interior.jpg") center / 117% 117% no-repeat;
  will-change: transform;
}

.wheel-reveal {
  position: absolute;
  inset: 7.1%;
  z-index: 2;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--reveal-background, var(--yellow));
  box-shadow: inset 0 0 0 clamp(2px, .34vw, 6px) #0c0c0c;
  opacity: 0;
  pointer-events: none;
  transform: scale(.05);
  transform-origin: 50% 50%;
}

.wheel-reveal img {
  width: 32.4%;
  height: auto;
  opacity: 0;
  transform: scale(.6);
}

.wheel.is-revealing .wheel-reveal {
  animation: prize-reveal 560ms cubic-bezier(.16, .84, .25, 1) forwards;
}

.wheel.is-revealing .wheel-reveal img {
  animation: prize-reveal-image 360ms 220ms cubic-bezier(.16, .84, .25, 1) forwards;
}

.wheel.is-revealing .mascot {
  opacity: 0;
  transform: translate(-50%, -50%) scale(.7);
}

.wheel-bolt {
  position: absolute;
  z-index: 4;
  width: 2.65%;
  aspect-ratio: 1;
  border: clamp(1px, .1vw, 2px) solid #7c422d;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #ffe3d2 0 18%, #f6ab80 35%, #c76b4b 100%);
  box-shadow: 0 0 0 clamp(1px, .12vw, 2px) #fac7ab;
  transform: translate(-50%, -50%);
}

.wheel-bolt-1 { top: 4.7%; left: 50%; }.wheel-bolt-2 { top: 10.8%; left: 72.65%; }
.wheel-bolt-3 { top: 27.35%; left: 89.2%; }.wheel-bolt-4 { top: 50%; left: 95.3%; }
.wheel-bolt-5 { top: 72.65%; left: 89.2%; }.wheel-bolt-6 { top: 89.2%; left: 72.65%; }
.wheel-bolt-7 { top: 95.3%; left: 50%; }.wheel-bolt-8 { top: 89.2%; left: 27.35%; }
.wheel-bolt-9 { top: 72.65%; left: 10.8%; }.wheel-bolt-10 { top: 50%; left: 4.7%; }
.wheel-bolt-11 { top: 27.35%; left: 10.8%; }.wheel-bolt-12 { top: 10.8%; left: 27.35%; }

.prize {
  position: absolute;
  z-index: 1;
  width: 13.1%;
}
.prize img { display: block; width: 100%; height: auto; }
.prize-1 { top: 21.4%; left: 66.5%; transform: translate(-50%, -50%) rotate(30deg); }
.prize-2 { top: 50%; left: 83%; transform: translate(-50%, -50%) rotate(90deg); }
.prize-3 { top: 78.6%; left: 66.5%; transform: translate(-50%, -50%) rotate(150deg); }
.prize-4 { top: 78.6%; left: 33.5%; transform: translate(-50%, -50%) rotate(210deg); }
.prize-5 { top: 50%; left: 17%; transform: translate(-50%, -50%) rotate(270deg); }
.prize-6 { top: 21.4%; left: 33.5%; transform: translate(-50%, -50%) rotate(330deg); }

.pointer {
  position: absolute;
  z-index: 4;
  top: -3.4%;
  left: 50%;
  width: 14.4%;
  height: auto;
  transform: translateX(-50%);
}

.mascot {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 31%;
  height: auto;
  transform: translate(-50%, -50%);
  transition: opacity 180ms ease, transform 180ms ease;
}

.action-section { align-items: flex-start; padding-top: 10%; }
.spin-button {
  width: 61.8%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: filter 160ms ease, transform 160ms ease;
}
.spin-button img { display: block; width: 100%; height: auto; }
.spin-button:hover:not(:disabled) { filter: brightness(1.04); transform: translateY(-1%); }
.spin-button:focus-visible { outline: 4px solid var(--ink); outline-offset: 5px; border-radius: 20px; }
.spin-button:disabled { cursor: wait; filter: saturate(.65) brightness(.9); }

.result-section { align-items: flex-start; padding: 2% 9% 0; text-align: center; }
.result { margin: 0; color: var(--ink); font-size: clamp(11px, 1.85vw, 34px); font-weight: 900; line-height: 1.1; text-transform: uppercase; }
.result.is-winner { color: #a94620; }

.confetti-layer { position: absolute; inset: 0; z-index: 10; pointer-events: none; overflow: hidden; }
.confetti {
  position: absolute;
  top: var(--start-y);
  left: var(--start-x);
  width: clamp(3.5px, .925cqw, 20px);
  height: clamp(6px, 1.575cqw, 34px);
  background: var(--color);
  border-radius: var(--radius);
  animation: confetti-flight var(--duration) cubic-bezier(.12,.72,.4,1) forwards;
  animation-delay: var(--delay);
}
@keyframes confetti-flight {
  0% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  82% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--travel-x), var(--travel-y)) rotate(var(--spin)); }
}

@keyframes prize-reveal {
  0% { opacity: 0; transform: scale(.05); }
  70% { opacity: 1; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes prize-reveal-image {
  0% { opacity: 0; transform: scale(.6); }
  100% { opacity: 1; transform: scale(1); }
}

@media (max-aspect-ratio: 9 / 16) { .stage { width: 100vw; } }
@media (prefers-reduced-motion: reduce) {
  .wheel-disc, .confetti, .wheel-reveal, .wheel-reveal img { animation: none !important; transition: none !important; }
  .wheel.is-revealing .wheel-reveal, .wheel.is-revealing .wheel-reveal img { opacity: 1; transform: scale(1); }
}