:root {
  --ink: oklch(0.2 0.03 215);
  --paper: oklch(0.96 0.012 210);
  --teal: oklch(0.74 0.11 200);
  --teal-deep: oklch(0.42 0.08 205);
  --gold: oklch(0.84 0.14 88);
  --hall: oklch(0.16 0.03 215);
  --danger: oklch(0.4 0.14 25);
  --z-wheel: 1;
  --z-pointer: 3;
  --z-hub: 2;
  --z-flash: 4;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  display: grid;
  /* HotYeah stacked pair: one 1920x2160 window, top 1080 is the wheel, bottom 1080 is the form and photo. */
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--hall);
  color: oklch(0.97 0.01 210);
  font-family: Lexend, "Segoe UI", sans-serif;
  font-weight: 500;
}

.stage {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  justify-items: center;
  align-items: center;
  overflow: hidden;
  padding: 0.35rem 1rem 0.2rem;
  background:
    radial-gradient(ellipse 55% 70% at 50% 46%, oklch(0.3 0.06 200) 0%, transparent 68%),
    var(--hall);
}

.rehearsal {
  grid-row: 1;
  margin: 0;
  justify-self: center;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 800;
}

.wheel-wrap {
  grid-row: 2;
  position: relative;
  height: 90%;
  width: auto;
  max-height: 90%;
  max-width: 96%;
  aspect-ratio: 1;
  z-index: var(--z-wheel);
}

.wheel {
  width: 94%;
  height: 94%;
  margin: 3%;
  border-radius: 50%;
  transform: rotate(var(--angle, 22deg));
  transition: transform 5.6s cubic-bezier(0.08, 0.55, 0.05, 1);
  filter: drop-shadow(0 18px 24px oklch(0.1 0.03 215 / 0.55));
}

.wheel svg { width: 100%; height: 100%; display: block; }

.bulbs {
  position: absolute;
  inset: 0;
  z-index: var(--z-pointer);
  pointer-events: none;
}

.bulb {
  position: absolute;
  width: 2.4%;
  aspect-ratio: 1;
  margin: -1.2%;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px oklch(0.9 0.12 90 / 0.85);
  animation: glow 1.5s ease-in-out infinite;
}

.pointer {
  position: absolute;
  top: 1%;
  left: 50%;
  z-index: var(--z-pointer);
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 34px solid var(--gold);
  filter: drop-shadow(0 4px 0 oklch(0.35 0.08 70));
}

.hub {
  position: absolute;
  inset: 31%;
  z-index: var(--z-hub);
  display: grid;
  place-content: center;
  text-align: center;
  border-radius: 50%;
  background: oklch(0.18 0.03 215);
  color: var(--gold);
  box-shadow: inset 0 0 0 8px oklch(0.72 0.12 85);
}

#hub-word {
  font-family: Anton, "Arial Black", Impact, sans-serif;
  font-size: clamp(2.8rem, 7vh, 5.2rem);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.03em;
  transform-origin: center;
}

body:not(.is-spinning):not(.is-won) #hub-word {
  animation: beckon 1.15s ease-in-out infinite;
}

@keyframes beckon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.22); }
}

.win-name:empty {
  min-height: 0;
  margin: 0;
}

.win-name {
  grid-row: 3;
  margin: 0.15rem 0 0;
  min-height: 1.15em;
  font-family: Anton, "Arial Black", Impact, sans-serif;
  font-size: clamp(1.8rem, 4.4vh, 3.6rem);
  letter-spacing: -0.03em;
  line-height: 0.95;
  text-align: center;
  text-wrap: balance;
  color: var(--gold);
}

.sheet {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.45rem clamp(1rem, 3vw, 2.4rem) 0.7rem;
  background: var(--paper);
  color: var(--ink);
}

.sheet-head, .days, .times, #book-form, .spin-panel, .won-panel, .error {
  flex-shrink: 0;
}

.resort {
  flex: 1 1 11rem;
  min-height: 11rem;
  margin: 0.35rem 0 0;
  overflow: hidden;
}

.resort img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  display: block;
}

.sheet-head h1 {
  margin: 0;
  font-family: Anton, "Arial Black", Impact, sans-serif;
  font-size: clamp(1.25rem, 2.2vh, 1.7rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 0.95;
  text-wrap: balance;
}

.sheet-sub, .chosen, .booked-line, #won-line {
  margin: 0.35rem 0 0.8rem;
  max-width: 62ch;
  font-size: clamp(1rem, 2vh, 1.25rem);
  line-height: 1.35;
  text-wrap: pretty;
  color: oklch(0.32 0.03 215);
}

.error {
  margin: 0 0 0.8rem;
  padding: 0.75rem 1rem;
  background: var(--danger);
  color: white;
  font-weight: 700;
}

.days, .times {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.days button, .times button, #book, #spin {
  font: inherit;
  cursor: pointer;
  border: 2px solid var(--ink);
  background: white;
  color: var(--ink);
  min-height: 2.7rem;
  padding: 0.4rem 1rem;
  font-weight: 800;
  font-size: clamp(1.05rem, 2.2vh, 1.35rem);
}

.days button[aria-pressed="true"],
.times button[aria-pressed="true"] {
  background: var(--teal);
  border-color: var(--teal-deep);
}

#book, #spin {
  width: 100%;
  min-height: 5.2rem;
  margin-top: 0.4rem;
  background: var(--ink);
  color: var(--gold);
  font-family: Anton, "Arial Black", Impact, sans-serif;
  font-size: clamp(2rem, 4.5vh, 3.4rem);
  font-weight: 400;
  letter-spacing: -0.02em;
}

#book:disabled, #spin:disabled {
  opacity: 0.45;
  cursor: wait;
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem 1rem;
}

.fields label {
  display: grid;
  gap: 0.25rem;
  font-weight: 700;
  color: oklch(0.28 0.03 215);
}

.fields input {
  min-height: 3.4rem;
  padding: 0.4rem 0.7rem;
  border: 2px solid var(--ink);
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 1.2rem;
}

.fields input::placeholder { color: oklch(0.38 0.03 215); }

.spin-panel .booked-line,
.won-panel #won-line {
  font-size: clamp(1.2rem, 2.6vh, 1.7rem);
  color: var(--ink);
  font-weight: 700;
}

#flash {
  position: fixed;
  inset: 0;
  z-index: var(--z-flash);
  pointer-events: none;
  background: oklch(0.92 0.12 92);
  opacity: 0;
}

body.is-won #flash { animation: burst 2.2s linear 1; }

body.is-spinning .bulb { animation-duration: 0.22s; }

@keyframes glow {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

@keyframes burst {
  0% { opacity: 0; }
  8% { opacity: 0.88; }
  22% { opacity: 0; }
  36% { opacity: 0.88; }
  50% { opacity: 0; }
  64% { opacity: 0.88; }
  78% { opacity: 0; }
  90% { opacity: 0.45; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .wheel { transition: none; }
  .bulb { animation: none; opacity: 1; }
  #hub-word { animation: none; }
  body.is-won #flash { animation: none; opacity: 0.2; }
}

button:focus-visible, input:focus-visible {
  outline: 3px solid var(--teal-deep);
  outline-offset: 2px;
}
