@property --wheel-rotation {
  syntax: '<angle>';
  inherits: true;
  initial-value: 0deg;
}

.roulette {
  grid-area: 1 / 2 / 3 / 3;
  align-self: start;
  aspect-ratio: 1;
  position: relative;
  width: 143%;
  margin: 32px 0 0 -21.5%;
  z-index: 2;
  container-type: inline-size;
  filter: drop-shadow(0 20px 22px #000a);
}
.wheel-frame {
  position: absolute;
  inset: -2.4%;
  z-index: 1;
  border-radius: 50%;
  padding: 11%;
}
.wheel-frame::after {
  content: '';
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
  background: url('/assets/wheel-frame-illustrated.png?v=2') center / contain
    no-repeat;
}
.wheel-rim {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 50%;
  border: clamp(3px, 0.9cqi, 6px) solid #4b2d1f;
  background: #4b2d1f;
  box-shadow:
    0 0 0 clamp(2px, 0.6cqi, 4px) #d5a05f,
    inset 0 0 22px #000b;
}
.wheel-rotor {
  --wheel-rotation: 0deg;
  position: absolute;
  inset: 0;
  border-radius: 50%;
  transform: rotate(var(--wheel-rotation));
  transition: --wheel-rotation 4.6s cubic-bezier(0.12, 0.7, 0.12, 1);
  box-shadow:
    inset 0 0 0 clamp(2px, 0.65cqi, 4px) #41291d,
    inset 0 0 34px #0008;
}
.wheel-rotor::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 24%, #fff3 0, transparent 34%),
    radial-gradient(circle, transparent 55%, #1d120e55 86%, #120b08aa 100%);
  pointer-events: none;
}
.wheel-rotor::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 50%;
  background:
    repeating-linear-gradient(
      118deg,
      transparent 0 11px,
      #fff 12px,
      transparent 13px 23px
    ),
    repeating-radial-gradient(
      circle at 38% 31%,
      transparent 0 17px,
      #170d09 18px,
      transparent 20px 34px
    );
  mix-blend-mode: soft-light;
  opacity: 0.13;
  pointer-events: none;
}
.wheel-slot {
  --slot-radius: 29cqi;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: #fff2d9;
  filter: drop-shadow(0 3px 1px #3c2118) drop-shadow(0 0 1px #fff5);
  z-index: 2;
  transform: translate(-50%, -50%) rotate(var(--slot-angle))
    translateY(calc(-1 * var(--slot-radius)))
    rotate(calc(-1 * var(--slot-angle) - var(--wheel-rotation)));
}
.wheel-icon {
  width: 100%;
  height: 100%;
}
.wheel-center {
  position: absolute;
  inset: 32.5%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(2px, 1cqi, 6px);
  text-align: center;
  padding: 0;
  overflow: hidden;
  color: #fff1df;
  z-index: 3;
  border: clamp(3px, 0.95cqi, 6px) solid #b27b45;
  background: radial-gradient(circle at 50% 25%, #26353d, #111a21 72%);
  border-radius: 50%;
  box-shadow:
    inset 0 0 15px #0009,
    0 0 0 clamp(3px, 0.9cqi, 6px) #342117,
    0 0 0 clamp(5px, 1.5cqi, 9px) #c29459;
}
.wheel-center button {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff1df;
  font-size: clamp(16px, 5.5cqi, 29px);
  box-shadow: none;
}
.wheel-center button:hover:not(:disabled),
.wheel-center button:focus-visible {
  background-color: #274655;
  box-shadow: none;
  filter: none;
  outline: none;
}
.wheel-center button:focus-visible {
  text-decoration: underline;
  text-underline-offset: 4px;
}
#wheel-spin {
  border-radius: 50%;
}
.wheel-choice {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr 1fr;
}
.wheel-choice #wheel-play {
  background: linear-gradient(110deg, #ffc17e, #ff994f);
  color: #201a14;
  padding-top: 15%;
}
.wheel-choice #wheel-cancel {
  background: #102b3a;
  color: var(--muted);
  padding-bottom: 15%;
  border-top: 1px solid #b27b45;
  font-size: clamp(12px, 3.8cqi, 20px);
}
.wheel-choice #wheel-play:hover,
.wheel-choice #wheel-play:focus-visible {
  background: linear-gradient(110deg, #ffd3a0, #ffb66c);
}
.wheel-choice #wheel-cancel:hover,
.wheel-choice #wheel-cancel:focus-visible {
  background: #234858;
  border-color: #b27b45;
  color: var(--ink);
}
.wheel-center [hidden] {
  display: none;
}
.wheel-result {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 22px 28px;
  margin: 24px auto;
  max-width: 700px;
  border: 1px solid #ac8051;
  border-radius: 18px;
  background: #142e3c;
  color: #fff1df;
}
.wheel-result[hidden] {
  display: none;
}
.wheel-result > svg {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  color: #ffc17e;
}
.wheel-result small {
  display: block;
  color: var(--muted);
}
.wheel-result strong {
  display: block;
  font-size: clamp(22px, 3vw, 30px);
}
.wheel-result p {
  margin: 6px 0 0;
}
@media (prefers-reduced-motion: reduce) {
  .wheel-rotor {
    transition-duration: 0.01ms;
  }
}
