.gift-wheel {
  --wheel-ink: #27261e;
  --wheel-muted: #4f5446;
  --wheel-paper: #e4ece0;
  --wheel-ticket: #fbf3df;
  --wheel-red: #c41c23;
  background: var(--wheel-paper) url('./wheel-paper.webp') repeat;
  background-blend-mode: multiply;
  color: var(--wheel-ink);
}
.wheel-layout {
  display: grid;
  grid-template-columns: minmax(0,1.46fr) minmax(0,1fr);
  grid-template-areas: "scene intro" "scene controls" "results results" "confirmation confirmation";
  align-items: start;
  column-gap: clamp(1rem,4vw,4rem);
  padding-block: clamp(3rem,7vw,6.5rem);
}
.wheel-intro { grid-area: intro; align-self: end; }
.wheel-intro h2 {
  font-family: Cormorant, Georgia, serif;
  font-size: clamp(3.3rem,6vw,6rem);
  font-weight: 600;
  line-height: .82;
  letter-spacing: -.035em;
}
.wheel-intro h2 em { display: block; }
.wheel-intro > p {
  margin-top: 1.2rem;
  max-width: 30ch;
  font-size: clamp(1rem,1.55vw,1.2rem);
  font-weight: 750;
  line-height: 1.5;
}
.wheel-intro .wheel-eligibility {
  margin-top: .58rem;
  font-size: .88rem;
  font-weight: 650;
  color: var(--wheel-muted);
}
.wheel-controls { grid-area: controls; padding-top: 1.35rem; }
.wheel-progress { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem .8rem; font-size: .88rem; font-weight: 800; }
.wheel-marks { display: inline-flex; gap: .3rem; }
.wheel-marks i { width: .55rem; height: .55rem; border-radius: 50%; background: var(--wheel-red); border: 1px solid var(--wheel-red); }
.wheel-marks i.is-used { background: transparent; border-color: #687461; }
.wheel-spin { justify-content: center; min-width: min(100%, 14rem); margin-top: .7rem; }
.wheel-status { color: var(--wheel-muted); font-size: .92rem; font-weight: 800; }
.wheel-status:not(:empty) { margin-top: .65rem; }
.wheel-announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
.wheel-ticket-stage { position: relative; margin-top: .9rem; max-width: 25rem; }
.wheel-ticket {
  position: relative;
  color: var(--wheel-ink);
  --ticket-fill: var(--wheel-ticket);
  background: var(--ticket-fill);
  border: 1px solid #a5947d;
  border-radius: .65rem;
}
.wheel-ticket::before, .wheel-ticket::after {
  content: "";
  position: absolute;
  top: 50%;
  width: .68rem;
  height: .68rem;
  background: var(--wheel-paper);
  border: 1px solid #a5947d;
  border-radius: 50%;
  pointer-events: none;
}
.wheel-ticket::before { left: -.37rem; clip-path: inset(0 0 0 50%); }
.wheel-ticket::after { right: -.37rem; clip-path: inset(0 50% 0 0); }
.wheel-preview, .wheel-outcome {
  display: flex;
  align-items: center;
  gap: .68rem;
  padding: .55rem .9rem;
  font-size: .98rem;
}
.wheel-outcome { z-index: 3; padding-block: .62rem; }
.wheel-outcome .wheel-prize-photo { margin-left: auto; }
.wheel-ticket .wheel-prize-icon { display: block; width: 2.5rem; height: 2.5rem; object-fit: contain; flex: none; }
.wheel-ticket strong { display: block; line-height: 1.2; }
.wheel-ticket small { display: block; margin-top: .26rem; color: var(--wheel-muted); line-height: 1.4; }
.wheel-prize-photo { width: clamp(3.3rem,16vw,5.2rem); height: auto; border-radius: .28rem; flex: none; }

.wheel-scene { grid-area: scene; align-self: center; position: relative; isolation: isolate; aspect-ratio: 1.29; }
.wheel-ground {
  position: absolute;
  bottom: var(--wheel-floor,6%);
  left: 8%;
  width: 84%;
  height: 1px;
  background: #66765c;
}
.wheel-stand {
  position: absolute;
  left: 48%;
  top: 46%;
  bottom: var(--wheel-floor,6%);
  width: 4%;
  border: 2px solid var(--wheel-ink);
  border-radius: 3px;
  background: #b4c7ae;
}
.wheel-face {
  position: absolute;
  left: 50%;
  top: 4%;
  translate: -50%;
  width: 65%;
  aspect-ratio: 1;
  z-index: 1;
  container-type: inline-size;
}
.wheel-rotor {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid #544534;
  background:
    repeating-conic-gradient(from -30deg, transparent 0deg 59.55deg, #706650 59.55deg 60deg),
    conic-gradient(from -30deg, #f4e4bc 60deg, #d1e2cd 0 120deg, #f3cabd 0 180deg,
      #f9efd5 0 240deg, #dce7cb 0 300deg, #f5d5c3 0);
  box-shadow: .2rem .55rem 1rem #514d3a33;
}
.wheel-rotor::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from -30deg, #a33130 0deg 1deg, transparent 1deg 10deg)
      center / 97% 97% no-repeat,
    #fff6e3;
  box-shadow: inset 0 0 0 1px #584232, inset 0 0 0 3px #f3c4a6;
  mask: radial-gradient(farthest-side, transparent 91%, black 91%);
  pointer-events: none;
}
.wheel-rotor[data-winning]::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from calc(var(--wheel-winner) - 30deg), #e8a29a 0deg 60deg, transparent 60deg);
  animation: wheel-highlight .32s ease-out both;
}
@keyframes wheel-highlight { from { opacity: 0; } }
.wheel-sector {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 32%;
  text-align: center;
  transform: translate(-50%,-50%) rotate(var(--sector-angle)) translateY(-31cqi);
}
.wheel-sector-label {
  display: grid;
  justify-items: center;
  gap: .12em;
  font-weight: 850;
  font-size: clamp(.5rem,3.8cqi,1.05rem);
  line-height: 1.08;
  color: #27261e;
  transform: rotate(calc(var(--wheel-counter,0deg) - var(--sector-angle)));
}
.wheel-sector-label span { display: block; width: max-content; white-space: nowrap; }
.wheel-sector-label .wheel-prize-icon {
  width: clamp(1.25rem,11cqi,3.15rem);
  height: auto;
  margin-bottom: .12em;
}
.wheel-hub {
  position: absolute;
  inset: 42%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid #6e4d3e;
  background: #fff5dc;
  box-shadow: inset 0 0 0 2px #ecc89b;
}
.wheel-hub img { width: 57%; height: auto; }
.wheel-pointer {
  position: absolute;
  z-index: 2;
  top: -3%;
  left: 50%;
  translate: -50%;
  width: 10%;
  height: 10%;
  background: var(--wheel-red);
  clip-path: polygon(2% 3%,98% 3%,92% 23%,50% 100%,8% 23%);
  transform-origin: 50% 0;
}
.wheel-mascot {
  position: absolute;
  width: 24%;
  height: auto;
  bottom: var(--wheel-floor,6%);
  transform-origin: center 90%;
}
.wheel-valya { left: -.8%; }
.wheel-vanya { right: -.8%; width: 25%; }
.is-spinning .wheel-valya { animation: wheel-push .68s cubic-bezier(.16,.71,.18,1) both; }
.is-spinning .wheel-vanya { animation: wheel-catch .68s cubic-bezier(.16,.71,.18,1) .25s both; }
@keyframes wheel-push {
  0%,100% { transform: none; }
  28% { transform: translateX(-3%) rotate(-4deg); }
  63% { transform: translateX(9%) rotate(9deg); }
}
@keyframes wheel-catch {
  0%,100% { transform: none; }
  43% { transform: translateX(-9%) rotate(-8deg); }
}

.wheel-results { grid-area: results; margin-top: clamp(1.7rem,4vw,3.25rem); }
.wheel-results h3, .wheel-confirmation h3 { font-size: clamp(1.4rem,3.5vw,2rem); }
.wheel-choices { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .65rem; border: 0; padding: 0; margin: .8rem 0 0; }
.wheel-choice {
  display: grid;
  grid-template-columns: auto auto minmax(0,1fr);
  align-items: start;
  align-content: start;
  gap: .45rem .6rem;
  padding: .9rem;
  cursor: pointer;
}
.wheel-choice:has(input:checked) { --ticket-fill: #ffe6d2; border-color: var(--wheel-red); }
.wheel-choice:has(input:focus-visible) { outline: 2px solid var(--wheel-red); outline-offset: 3px; }
.wheel-choice input { width: 1rem; height: 1rem; margin: .1rem 0 0; accent-color: var(--wheel-red); }
.wheel-choice small { font-size: .86rem; }
.wheel-choice .wheel-prize-photo { grid-column: 3; }
.wheel-form-shell { max-width: 31rem; margin-top: 1.35rem; padding: 0; }
.wheel-form-shell > p, .wheel-confirmation [data-wheel-claimed] { font-weight: 850; margin-block: .35rem .9rem; }
.wheel-confirmation { grid-area: confirmation; padding: 1rem 0 0; }

@media (max-width: 720px) {
  .wheel-layout {
    grid-template-columns: minmax(0,1fr);
    grid-template-areas: "intro" "scene" "controls" "results" "confirmation";
  }
  .wheel-intro h2 em { display: inline; }
  .wheel-scene { width: min(100%,30rem); margin: .65rem auto 0; aspect-ratio: 1.15; --wheel-floor: 3.5%; }
  .wheel-face { width: 76%; }
  .wheel-mascot { width: 22%; }
  .wheel-controls { padding-top: .45rem; }
}
@media (max-width: 520px) {
  .wheel-intro h2 { font-size: clamp(2.3rem,12vw,3.7rem); }
  .wheel-choices { grid-template-columns: 1fr; }
  .wheel-spin { width: 100%; }
  .wheel-choice .wheel-prize-icon { width: 2rem; height: 2rem; }
  .wheel-outcome .wheel-prize-icon { width: 2.1rem; height: 2.1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .wheel-mascot, .wheel-rotor[data-winning]::before { animation: none; }
}
