:root {
  --bg: #14213d;
  --bg-2: #1d2d50;
  --ink: #ffffff;
  --muted: #b8c4e0;
  --accent: #ffb703;
  --accent-ink: #14213d;
  --red: #ef476f;
  --orange: #fb8500;
  --yellow: #ffd166;
  --green: #06d6a0;
  --blue: #118ab2;
  --purple: #8338ec;
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  background: radial-gradient(120% 80% at 50% 0%, var(--bg-2) 0%, var(--bg) 70%);
  background-color: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

main {
  min-height: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

h1 {
  margin: 4px 0 0;
  font-size: clamp(1.4rem, 6vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.sub {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: clamp(1.3rem, 6vw, 1.7rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 18px 44px;
  min-width: 70%;
  box-shadow: 0 6px 0 #c98c00, 0 10px 24px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s, opacity 0.2s, filter 0.2s;
  touch-action: manipulation;
}

.btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #c98c00, 0 4px 12px rgba(0, 0, 0, 0.35);
}

.btn:disabled {
  opacity: 0.45;
  filter: grayscale(0.6);
  cursor: default;
}

.result {
  min-height: 5.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.6rem, 7.5vw, 2.4rem);
  font-weight: 900;
  line-height: 1.15;
  padding: 0 4px;
}

.result.pop { animation: pop 0.45s cubic-bezier(.2, 1.6, .4, 1); }

@keyframes pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.hint { color: var(--muted); font-size: 0.95rem; min-height: 1.2em; }

/* landing */
.links { display: grid; gap: 14px; width: 100%; margin-top: 24px; }
.links a {
  display: block;
  padding: 22px;
  border-radius: 20px;
  background: var(--bg-2);
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 800;
  text-decoration: none;
  border: 2px solid rgba(255, 255, 255, 0.12);
}

/* ---- wheel ---- */
.wheel-wrap {
  position: relative;
  width: min(92vw, 440px);
  aspect-ratio: 1;
}

.wheel-wrap .pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  width: 44px;
  height: 52px;
  transform: translateX(-50%);
  z-index: 2;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.4));
}

#wheel {
  width: 100%;
  height: 100%;
  display: block;
  transition: transform 4.2s cubic-bezier(0.12, 0.7, 0.12, 1);
  will-change: transform;
  cursor: pointer;
}

#wheel .seg text {
  font-weight: 800;
  fill: #fff;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.35);
  stroke-width: 3px;
}

#wheel .seg.dim path { opacity: 0.35; }
#wheel .seg.win path { stroke: #fff; stroke-width: 6; }

/* ---- exercise ---- */
.stage {
  width: min(92vw, 440px);
  aspect-ratio: 4 / 3;
  border-radius: 24px;
  background: #f6f1e7;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.08), 0 10px 24px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.stage svg { width: 100%; height: 100%; display: block; }

.stage .placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  font-weight: 900;
  color: #d7cdb9;
}

.stage .placeholder[hidden] { display: none; }

.beat {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--red);
}

@media (prefers-reduced-motion: reduce) {
  #wheel { transition-duration: 1.5s; }
}
