:root {
  color-scheme: dark;
  --bg: #050505;
  --bg-soft: #0b0b0c;
  --panel: rgba(255, 255, 255, 0.035);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: rgba(248, 246, 242, 0.92);
  --muted: rgba(248, 246, 242, 0.54);
  --muted-strong: rgba(248, 246, 242, 0.72);
  --accent: #ff8a3d;
  --shadow: rgba(0, 0, 0, 0.56);
  --wheel-size: min(78vw, 30rem);
  --orbit-radius: calc(var(--wheel-size) * 0.38);
  --item-width: clamp(7.5rem, 24vw, 10rem);
  --item-height: clamp(3rem, 10vw, 4rem);
  --transition-slow: 720ms cubic-bezier(0.22, 1, 0.36, 1);
  --transition-fast: 220ms ease;
  --grain-opacity: 0.08;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.05), transparent 30%),
    radial-gradient(circle at 50% 120%, rgba(255, 255, 255, 0.04), transparent 45%),
    linear-gradient(180deg, var(--bg-soft), var(--bg));
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 3px 3px, 4px 4px;
  mix-blend-mode: soft-light;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(1.15rem, 4vw, 2rem);
}

.masthead {
  display: flex;
  justify-content: center;
  padding-top: clamp(0.3rem, 1.5vw, 0.8rem);
}

.wordmark {
  margin: 0;
  font-size: clamp(0.82rem, 2vw, 0.95rem);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--muted);
}

.stage {
  display: grid;
  place-items: center;
}

.wheel-panel {
  width: min(100%, 44rem);
  display: grid;
  justify-items: center;
  gap: 1.2rem;
}

.wheel-frame {
  position: relative;
  width: var(--wheel-size);
  height: var(--wheel-size);
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
    rgba(255, 255, 255, 0.015);
  border: 1px solid var(--line);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 -1.75rem 3rem rgba(0, 0, 0, 0.2),
    0 1.2rem 3rem var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  touch-action: none;
}

.wheel-frame::before,
.wheel-frame::after {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  pointer-events: none;
}

.wheel-frame::before {
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.wheel-frame::after {
  inset: 15%;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.wheel-glow,
.wheel-halo,
.wheel-core {
  position: absolute;
  inset: 50%;
  translate: -50% -50%;
  border-radius: 50%;
  pointer-events: none;
}

.wheel-glow {
  width: 62%;
  height: 62%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.065), transparent 68%);
  filter: blur(16px);
}

.wheel-halo {
  width: 34%;
  height: 34%;
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.2);
}

.wheel-core {
  width: 16%;
  height: 16%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.11), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 1.2rem rgba(0, 0, 0, 0.22);
}

.wheel-list {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wheel-item {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--item-width);
  height: var(--item-height);
  margin: 0;
  transform:
    translate(-50%, -50%)
    rotate(var(--angle))
    translateY(calc(var(--orbit-radius) * -1))
    rotate(calc(var(--angle) * -1));
  transition:
    transform var(--transition-slow),
    opacity var(--transition-fast),
    filter var(--transition-fast);
  display: grid;
  place-items: center;
}

.wheel-button {
  position: relative;
  width: 100%;
  min-height: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font: inherit;
  font-size: clamp(0.92rem, 2.3vw, 1rem);
  letter-spacing: 0.03em;
  line-height: 1.1;
  cursor: pointer;
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast),
    background-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0.55rem 1rem rgba(0, 0, 0, 0.14);
}

.wheel-button span {
  display: block;
  text-align: center;
  text-wrap: balance;
}

.wheel-item.is-active {
  z-index: 4;
  filter: saturate(1.02);
}

.wheel-item.is-active .wheel-button {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0.9rem 1.6rem rgba(0, 0, 0, 0.22);
}

.wheel-item.is-active .wheel-button::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.45rem;
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  translate: -50% 0;
  background: var(--accent);
  box-shadow: 0 0 0.75rem rgba(255, 138, 61, 0.24);
}

.wheel-item.is-near .wheel-button {
  color: var(--muted-strong);
}

.wheel-item.is-dim {
  opacity: 0.48;
}

.wheel-button:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.16);
}

.wheel-button:focus-visible {
  outline: none;
  border-color: rgba(255, 138, 61, 0.75);
  box-shadow:
    0 0 0 2px rgba(255, 138, 61, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0.9rem 1.6rem rgba(0, 0, 0, 0.22);
}

.wheel-hint,
.footer-line,
.status-toast {
  margin: 0;
  text-align: center;
  font-size: 0.73rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.wheel-hint,
.footer-line {
  color: rgba(248, 246, 242, 0.34);
}

.footer-line {
  align-self: end;
  padding-bottom: 0.1rem;
}

.status-toast {
  position: fixed;
  left: 50%;
  bottom: clamp(1.35rem, 5vw, 2rem);
  translate: -50% 0.5rem;
  color: rgba(248, 246, 242, 0.82);
  opacity: 0;
  transition:
    opacity 180ms ease,
    translate 220ms ease;
  pointer-events: none;
}

.status-toast.is-visible {
  opacity: 1;
  translate: -50% 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 40rem) {
  :root {
    --wheel-size: min(88vw, 24rem);
    --orbit-radius: calc(var(--wheel-size) * 0.37);
    --item-width: clamp(6.8rem, 28vw, 8.8rem);
    --item-height: clamp(2.85rem, 12vw, 3.6rem);
  }

  .page-shell {
    padding-inline: 0.9rem;
  }

  .wheel-hint {
    max-width: 14rem;
    line-height: 1.5;
  }
}

@media (max-width: 23rem) {
  :root {
    --wheel-size: min(92vw, 21rem);
    --orbit-radius: calc(var(--wheel-size) * 0.35);
    --item-width: clamp(5.8rem, 26vw, 7.25rem);
  }

  .wheel-button {
    padding-inline: 0.65rem;
    font-size: 0.84rem;
  }

  .wheel-hint,
  .footer-line,
  .status-toast {
    font-size: 0.66rem;
    letter-spacing: 0.14em;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-slow: 0ms linear;
    --transition-fast: 0ms linear;
    --grain-opacity: 0.04;
  }

  html:focus-within {
    scroll-behavior: auto;
  }
}
