:root {
  --night: #2a1760;
  --night-deep: #1a0d40;
  --sun: #ffc93c;
  --coral: #ff5c8a;
  --teal: #1fc8b5;
  --cream: #fff8e7;
  --wheel-size: min(88vw, 480px);
}

* { box-sizing: border-box; }

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

body {
  font-family: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  color: var(--cream);
  background:
    radial-gradient(circle at 50% 35%, #4a2a9a 0%, var(--night) 45%, var(--night-deep) 100%);
  display: grid;
  place-items: center;
  min-height: 100vh;
  overflow-x: hidden;
}

.stage {
  text-align: center;
  padding: 24px 16px 40px;
}

h1 {
  font-size: clamp(2.4rem, 8vw, 4rem);
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--sun);
  letter-spacing: 0.01em;
  text-shadow: 0 4px 0 var(--coral);
}

.subtitle {
  margin: 0 0 28px;
  font-size: 1.15rem;
  opacity: 0.9;
}

/* ---------- Wheel ---------- */

.wheel-wrap {
  position: relative;
  width: var(--wheel-size);
  height: var(--wheel-size);
  margin: 0 auto;
}

#wheel {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  cursor: pointer;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.45));
  will-change: transform;
}

.pointer {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 42px solid var(--coral);
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.3));
  z-index: 3;
}

.hub {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22%;
  height: 22%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 6px solid var(--cream);
  background: var(--coral);
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: clamp(0.95rem, 3.4vw, 1.4rem);
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 6px 0 #c23a64, 0 10px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.hub:hover { transform: translate(-50%, -50%) scale(1.05); }

.hub:active {
  transform: translate(-50%, -48%) scale(0.98);
  box-shadow: 0 2px 0 #c23a64, 0 4px 10px rgba(0, 0, 0, 0.35);
}

.hub:disabled {
  cursor: default;
  background: #8d7bb8;
  box-shadow: 0 6px 0 #5f4e8a;
}

.hub:focus-visible,
#again:focus-visible,
#wheel:focus-visible {
  outline: 4px solid var(--sun);
  outline-offset: 4px;
}

/* ---------- Result dialog ---------- */

dialog {
  border: 6px solid var(--sun);
  border-radius: 28px;
  background: var(--cream);
  color: var(--night);
  text-align: center;
  padding: 28px 44px 32px;
  max-width: 90vw;
  animation: pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}

dialog::backdrop { background: rgba(10, 4, 30, 0.7); }

.result-small {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
}

dialog h2 {
  margin: 0 0 18px;
  font-size: clamp(3.4rem, 16vw, 5.5rem);
  line-height: 1.1;
  color: var(--coral);
}

#again {
  font-family: inherit;
  font-weight: 700;
  font-size: 1.2rem;
  padding: 10px 32px;
  border: 0;
  border-radius: 999px;
  background: var(--teal);
  color: #053b35;
  cursor: pointer;
  box-shadow: 0 4px 0 #139584;
}

#again:active { transform: translateY(2px); box-shadow: 0 2px 0 #139584; }

@keyframes pop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ---------- Confetti ---------- */

#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 100;
}

.bit {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  animation: fall linear forwards;
}

@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); }
}

@media (prefers-reduced-motion: reduce) {
  dialog { animation: none; }
  .bit { display: none; }
}
