* { box-sizing: border-box; }

html { min-width: 300px; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background: var(--background);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  line-height: 1.55;
  isolation: isolate;
}

.road-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

[hidden] { display: none !important; }
button, textarea, input { font: inherit; }
a { color: inherit; }
h1, h2, p, figure { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1[tabindex="-1"]:focus { outline: none; }

.site-header, .site-footer, .page {
  width: min(100% - 80px, 1200px);
  margin-inline: auto;
}

.site-header, .site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.site-header {
  min-height: 86px;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 1.1rem;
  font-weight: 850;
  letter-spacing: .09em;
  text-decoration: none;
}

.wordmark-icon {
  display: flex;
  width: 33px;
  height: 33px;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 5px;
}

.wordmark-icon i { width: 3px; height: 11px; background: currentColor; }
.wordmark-icon i:first-child { height: 6px; }
.wordmark-icon i:nth-child(3) { height: 18px; }
.wordmark-icon i:last-child { height: 8px; }

.header-label, .site-footer { color: var(--muted); font-size: .86rem; }
.site-footer {
  min-height: 70px;
  flex-wrap: wrap;
  gap: 4px 20px;
  padding-block: 8px;
  border-top: 1px solid var(--line);
  margin-top: auto;
}
.footer-identity, .social-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.footer-wordmark { font-weight: 750; letter-spacing: .09em; }
.social-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text);
  text-underline-offset: .2em;
}
.social-links a:hover { color: var(--accent); }
.page { padding-block: clamp(28px, 5vw, 70px); }

.hero, .result {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.hero {
  grid-template-columns: .94fr 1fr;
  background: color-mix(in srgb, var(--panel) 57%, transparent);
}

.hero-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(24px, 5.6vw, 76px);
  touch-action: pan-y pinch-zoom;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--accent);
  font-size: .875rem;
  font-weight: 725;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.eyebrow span { width: 8px; height: 8px; background: var(--accent); rotate: 45deg; }
.hero h1 {
  margin-block: 24px;
  font-weight: 900;
  font-size: clamp(4.4rem, 8vw, 7.6rem);
  letter-spacing: -.075em;
  line-height: .91;
}
.hero h1 span { color: var(--accent); }
.hero-description { max-width: 31ch; color: var(--muted); font-size: clamp(1rem, 1.55vw, 1.22rem); }
.hero .button { margin-top: 32px; }

.hero-art { position: relative; min-width: 0; }
.hero-art img { display: block; width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1; }
.hero-art figcaption {
  position: absolute;
  bottom: 20px;
  left: 20px;
  max-width: calc(100% - 40px);
  padding: 7px 12px;
  color: var(--text);
  background: var(--background);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 720;
  letter-spacing: .075em;
}
.hero-art figcaption span { color: var(--accent); padding-inline: 3px; }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 50px;
  padding: 12px 23px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.button-primary { background: var(--accent); color: var(--accent-ink); }
.button-primary:hover { background: var(--accent-hover); }
.button-secondary { border-color: var(--line); background: var(--panel); color: var(--text); }
.button-secondary:hover { background: var(--raised); }
.button:disabled { opacity: .65; cursor: wait; }

.quiz-panel {
  width: min(100%, 700px);
  padding: clamp(24px, 5.5vw, 58px);
  margin-inline: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.step-indicator { display: grid; gap: 12px; color: var(--muted); font-size: .9rem; font-weight: 700; }
.step-indicator progress {
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 3px;
  overflow: hidden;
  background: var(--line);
  color: var(--accent);
}
.step-indicator progress::-webkit-progress-bar { background: var(--line); }
.step-indicator progress::-webkit-progress-value { background: var(--accent); }
.step-indicator progress::-moz-progress-bar { background: var(--accent); }
.quiz-panel h1, .result h1 {
  margin-block: 24px 26px;
  font-size: clamp(1.95rem, 4.5vw, 3.6rem);
  font-weight: 860;
  line-height: 1.06;
  letter-spacing: -.05em;
  overflow-wrap: anywhere;
}

.scale { padding: 21px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); }
.scale output { color: var(--accent); font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.scale-featured { padding: clamp(14px, 3vw, 22px); }
.scale-featured output { display: block; color: var(--muted); font-size: 1rem; text-align: center; }
.scale-featured output span { color: var(--accent); font-size: 2rem; }
.scale-dial { max-width: 332px; margin-inline: auto; }
.scale-dial svg { display: block; width: 100%; }
.dial-track, .dial-fill { stroke-width: 12; stroke-linecap: round; }
.dial-track { stroke: var(--line); }
.dial-fill { stroke: var(--accent); transition: stroke-dasharray 130ms ease-out; }
.dial-fill[stroke-dasharray="0 100"] { opacity: 0; }
.dial-marks { stroke: var(--muted); stroke-width: 1.4; opacity: .72; }
.dial-needle {
  fill: var(--text);
  transform: rotate(var(--needle, 0deg));
  transform-origin: 166px 140px;
  transition: transform 130ms ease-out;
}
.dial-hub { fill: var(--accent); }
.dial-numbers { display: flex; justify-content: space-between; padding-inline: 13%; color: var(--muted); font-size: .8125rem; }
.scale-segments {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: clamp(3px, 1.15vw, 7px);
  margin: 12px 6px;
}
.scale-segments span { height: 32px; border-radius: 3px; background: var(--line); transform: skewX(-11deg); }
.scale-segments span[data-filled] { background: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .dial-fill, .dial-needle { transition: none; }
}

.scale input {
  display: block;
  width: 100%;
  height: 44px;
  margin: 8px 0 4px;
  appearance: none;
  background: transparent;
  accent-color: var(--accent);
  cursor: pointer;
}
.scale input::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--accent) var(--fill), var(--line) var(--fill));
}
.scale input::-webkit-slider-thumb {
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border: 2px solid var(--accent-ink);
  border-radius: 50%;
  background: var(--accent);
}
.scale input::-moz-range-track { height: 6px; background: var(--line); border-radius: 4px; }
.scale input::-moz-range-progress { height: 6px; background: var(--accent); border-radius: 4px; }
.scale input::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); }
.scale-labels { display: flex; justify-content: space-between; gap: 12px; font-size: .86rem; color: var(--muted); }
.scale-labels :last-child { text-align: right; }

.options { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.options label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 47px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}
.options label:hover, .options label:has(input:checked) { background: var(--raised); }
.options label:has(input:checked) { border-color: var(--accent); }
.options input { flex: 0 0 1rem; width: 1rem; height: 1rem; margin: 0; accent-color: var(--accent); }

textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
  color: var(--text);
}
.comment-label { display: block; margin-bottom: 6px; font-size: .875rem; color: var(--muted); }
textarea::placeholder { color: var(--muted); }
.form-error { color: var(--error); margin-top: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.quiz-panel form .actions { justify-content: space-between; }

.result {
  grid-template-columns: minmax(0, 1fr) minmax(0, .86fr);
  align-items: center;
  gap: 16px clamp(20px, 5vw, 64px);
  max-width: 1040px;
  margin-inline: auto;
  padding: clamp(16px, 4vw, 32px);
}
.result:has(.result-art:empty) { grid-template-columns: minmax(0, 1fr); max-width: 700px; }
.result-kicker { grid-column: 1 / -1; }
.result-art { align-self: start; min-width: 0; }
.result-art:empty { display: none; }
.result-art img { border-radius: 8px; }
.result-content { min-width: 0; }
.result h1 { margin-block: 0 4px; }
.artist { color: var(--muted); }
.result-title { margin-top: 16px; font-size: 1.22rem; line-height: 1.25; }
.result .actions { margin-top: 18px; }
.story-download { align-self: center; padding-block: 10px; text-underline-offset: .2em; }
.story-status { color: var(--muted); font-size: .875rem; margin-top: 10px; }
.story-status:empty { display: none; }
.daily-hint { color: var(--muted); font-size: .875rem; margin-top: 16px; }
.result-content [data-restart] { margin-top: 14px; }
.result-description {
  max-width: 1040px;
  margin: 14px auto 0;
  padding: clamp(16px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.result:has(.result-art:empty) + .result-description { max-width: 700px; }
.result-description h2 { margin-bottom: 7px; font-size: 1.16rem; }
.result-description p { max-width: 68ch; }
.result-description p, .support-copy p { color: var(--muted); }
.support-copy p + p { margin-top: 14px; }

@media (max-width: 850px) {
  .site-header, .site-footer, .page { width: calc(100% - 40px); }
  .hero-content { padding: clamp(22px, 4vw, 38px); }
  .hero h1 { font-size: clamp(3.45rem, 9vw, 5.6rem); }
}

@media (max-width: 640px) {
  .site-header, .site-footer, .page { width: calc(100% - 32px); }
  .site-header { min-height: 66px; }
  .site-footer { min-height: 58px; }
  .header-label { display: none; }
  .page { padding-block: 22px 32px; }
  .hero, .result { grid-template-columns: minmax(0, 1fr); }
  .hero-content { padding: 28px 24px 30px; }
  .hero h1 { font-size: clamp(4rem, 14vw, 5.6rem); }
  .hero .button { margin-top: 24px; }
  .hero-art img { aspect-ratio: 1.28; }
  .hero-art figcaption { bottom: 12px; left: 12px; }
  .result .button-primary { width: 100%; }
}
