:root {
  --ink: #0b0b09;
  --paper: #ece8dc;
  --muted: #aaa598;
  --signal: #ff5a24;
  --wheel-size: clamp(310px, min(49vw, 68svh), 680px);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 78% 46%, rgba(255, 90, 36, 0.07), transparent 32%),
    var(--ink);
  color: var(--paper);
  font-family: "Arial Narrow", "Helvetica Neue", Helvetica, Arial, sans-serif;
  text-rendering: geometricPrecision;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.page-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100%;
  min-height: 100svh;
  padding: 24px 30px 22px;
  overflow: hidden;
  isolation: isolate;
}

.page-shell::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.12;
  background-image:
    linear-gradient(rgba(236, 232, 220, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(236, 232, 220, 0.08) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.site-header,
.site-footer {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.site-header {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(236, 232, 220, 0.23);
}

.wordmark {
  color: var(--paper);
  font-size: 17px;
  font-weight: 900;
  text-decoration: none;
  letter-spacing: -0.04em;
}

.wordmark span,
.date-stamp span {
  color: var(--signal);
}

.date-stamp,
.site-footer p {
  margin: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 10px;
  font-weight: 700;
}

.stage {
  display: grid;
  grid-template-columns: minmax(310px, 0.8fr) minmax(480px, 1.2fr);
  gap: clamp(24px, 5vw, 96px);
  align-items: center;
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: clamp(26px, 4vh, 54px) 0;
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 510px;
}

.kicker {
  display: inline-block;
  margin: 0 0 22px;
  padding: 7px 10px 6px;
  border: 1px solid rgba(236, 232, 220, 0.35);
  border-radius: 999px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

h1 {
  margin: 0;
  font-size: clamp(56px, 6.5vw, 116px);
  font-stretch: condensed;
  font-weight: 900;
  line-height: 0.82;
  letter-spacing: -0.085em;
}

.intro {
  max-width: 410px;
  margin: 28px 0 34px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.result-card {
  position: relative;
  min-height: 144px;
  padding: 16px 0 17px;
  border-top: 1px solid rgba(236, 232, 220, 0.38);
  border-bottom: 1px solid rgba(236, 232, 220, 0.18);
}

.result-card::before {
  position: absolute;
  top: -1px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--signal);
  content: "";
  transition: width 360ms ease;
}

.result-card.has-result::before {
  width: 100%;
}

.result-topline {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.result-value {
  min-height: 52px;
  margin: 8px 0 1px;
  color: var(--paper);
  font-size: clamp(36px, 4vw, 64px);
  font-weight: 900;
  line-height: 0.96;
  letter-spacing: -0.06em;
}

.has-result .result-value {
  color: var(--signal);
}

.challenge {
  margin: 0;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.wheel-zone {
  display: grid;
  place-items: center;
  min-width: 0;
}

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

.wheel-wrap::after {
  position: absolute;
  inset: -13px;
  z-index: -1;
  border: 1px solid rgba(236, 232, 220, 0.19);
  border-radius: 50%;
  content: "";
}

.wheel {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background:
    conic-gradient(
      from -45deg,
      var(--paper) 0 24.5%,
      var(--ink) 24.5% 25%,
      var(--signal) 25% 49.5%,
      var(--ink) 49.5% 50%,
      #171714 50% 74.5%,
      var(--paper) 74.5% 75%,
      #cbc5b6 75% 99.5%,
      var(--ink) 99.5% 100%
    );
  box-shadow:
    0 26px 80px rgba(0, 0, 0, 0.46),
    inset 0 0 0 9px rgba(11, 11, 9, 0.22);
  transition: transform 4.2s cubic-bezier(0.12, 0.68, 0.08, 1);
  will-change: transform;
}

.wheel::after {
  position: absolute;
  inset: 8%;
  border: 1px solid rgba(11, 11, 9, 0.26);
  border-radius: 50%;
  content: "";
}

.wheel-label {
  position: absolute;
  z-index: 2;
  font-size: clamp(22px, 2.2vw, 38px);
  font-weight: 900;
  letter-spacing: -0.055em;
  white-space: nowrap;
}

.label-0 {
  top: 18%;
  left: 50%;
  color: var(--ink);
  transform: translate(-50%, -50%);
}

.label-1 {
  top: 50%;
  left: 82%;
  color: var(--ink);
  transform: translate(-50%, -50%) rotate(90deg);
}

.label-2 {
  top: 82%;
  left: 50%;
  color: var(--paper);
  transform: translate(-50%, -50%) rotate(180deg);
}

.label-3 {
  top: 50%;
  left: 18%;
  color: var(--ink);
  font-size: clamp(17px, 1.7vw, 29px);
  transform: translate(-50%, -50%) rotate(270deg);
}

.pointer {
  position: absolute;
  top: -24px;
  left: 50%;
  z-index: 5;
  width: 0;
  height: 0;
  border-top: 34px solid var(--signal);
  border-right: 18px solid transparent;
  border-left: 18px solid transparent;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.45));
  transform: translateX(-50%);
}

.spin-core {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  display: grid;
  place-content: center;
  width: 25%;
  min-width: 88px;
  aspect-ratio: 1;
  padding: 0;
  border: 8px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 0 0 1px rgba(236, 232, 220, 0.65);
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition:
    background-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.spin-core:hover:not(:disabled),
.spin-core:focus-visible {
  background: var(--signal);
  transform: translate(-50%, -50%) scale(1.045);
}

.spin-core:focus-visible {
  outline: 3px solid var(--paper);
  outline-offset: 4px;
}

.spin-core:active:not(:disabled) {
  transform: translate(-50%, -50%) scale(0.97);
}

.spin-core:disabled {
  cursor: wait;
}

.spin-core span {
  font-size: clamp(21px, 2vw, 32px);
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1;
}

.spin-core small {
  margin-top: 5px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.wheel-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 24px 0 0;
}

.wheel-caption,
.connection-status {
  margin: 0;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.wheel-caption {
  text-align: right;
}

.connection-status {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.connection-status .status-dot {
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
}

.connection-status[data-status="ready"],
.connection-status[data-status="offline"] {
  color: var(--signal);
}

.connection-status[data-status="ready"] .status-dot,
.connection-status[data-status="offline"] .status-dot {
  border-color: var(--signal);
  background: var(--signal);
  box-shadow: 0 0 0 3px rgba(255, 90, 36, 0.12);
}

.site-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(236, 232, 220, 0.23);
  color: var(--muted);
}

.site-footer p:last-child {
  text-align: right;
}

.instagram-link {
  position: relative;
  padding: 9px 13px 8px;
  border: 1px solid var(--signal);
  border-radius: 999px;
  background: var(--signal);
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-decoration: none;
  transition:
    background-color 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.instagram-link:hover,
.instagram-link:focus-visible {
  background: transparent;
  color: var(--signal);
  transform: translateY(-2px);
}

.instagram-link:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 5px;
}

@media (max-width: 880px) {
  :root {
    --wheel-size: min(78vw, 43svh);
  }

  .page-shell {
    min-height: 100svh;
    padding: 18px 18px 16px;
    overflow: auto;
  }

  .stage {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 22px 0 26px;
  }

  .hero-copy {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 18px;
    align-items: end;
    max-width: none;
  }

  .kicker,
  .intro {
    display: none;
  }

  h1 {
    font-size: clamp(47px, 14vw, 74px);
    line-height: 0.83;
  }

  .result-card {
    min-width: min(40vw, 210px);
    min-height: 106px;
    padding: 12px 0;
  }

  .result-value {
    min-height: 36px;
    margin-top: 7px;
    font-size: clamp(27px, 8vw, 42px);
  }

  .challenge {
    max-width: 190px;
    font-size: 8px;
  }

  .wheel-meta {
    margin-top: 18px;
  }
}

@media (max-width: 520px) {
  :root {
    --wheel-size: min(86vw, 44svh);
  }

  .site-header {
    padding-bottom: 14px;
  }

  .wordmark {
    font-size: 15px;
  }

  .date-stamp {
    font-size: 8px;
  }

  .stage {
    align-content: center;
    gap: 26px;
    padding-top: 18px;
  }

  .hero-copy {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(45px, 15.5vw, 66px);
  }

  .result-card {
    display: none;
  }

  .wheel-label {
    font-size: clamp(19px, 6vw, 30px);
  }

  .label-3 {
    font-size: clamp(14px, 4.4vw, 22px);
  }

  .spin-core {
    min-width: 74px;
    border-width: 6px;
  }

  .spin-core span {
    font-size: 21px;
  }

  .site-footer {
    grid-template-columns: 1fr auto;
    gap: 10px 18px;
    align-items: flex-end;
  }

  .site-footer p {
    max-width: none;
    font-size: 7px;
    line-height: 1.45;
  }

  .site-footer p:last-child {
    grid-column: 1 / -1;
    grid-row: 2;
    text-align: left;
  }

  .instagram-link {
    font-size: 8px;
  }

  .wheel-caption,
  .connection-status {
    font-size: 7px;
  }
}

@media (max-height: 670px) and (max-width: 880px) {
  :root {
    --wheel-size: min(70vw, 47svh);
  }

  .stage {
    grid-template-columns: minmax(190px, 0.7fr) 1fr;
    gap: 18px;
  }

  .hero-copy {
    display: block;
  }

  h1 {
    font-size: clamp(40px, 8vw, 58px);
  }

  .result-card {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .wheel {
    transition-duration: 240ms;
  }

  .spin-core,
  .result-card::before {
    transition-duration: 0.01ms;
  }
}
