:root {
  color-scheme: light;
  --paper: #f7f6f2;
  --ink: #181817;
  --muted: #696966;
  --quiet: #e3e0d8;
  --line: #cfccc3;
  --panel: #fffefa;
  --accent: #b84d3f;
  --accent-soft: rgba(184, 77, 63, 0.18);
  --accent-faint: rgba(184, 77, 63, 0.08);
  --peer: #4f6c70;
  --self: #181817;
  --good: #3f6f5f;
  --shadow: 0 18px 70px rgba(24, 24, 23, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0) 320px),
    var(--paper);
  font-size: 16px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.app {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 18px 56px;
}

.topbar {
  padding: 10px 2px 22px;
}

.eyebrow,
.section-kicker,
.score-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p,
button,
code {
  overflow-wrap: anywhere;
}

h1 {
  margin: 8px 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.55rem, 13vw, 5.5rem);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 0.95;
}

.promise {
  max-width: 36rem;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.screen {
  min-height: 420px;
}

.intro-panel,
.share-state,
.thank-you,
.missing-state,
.result-hero {
  padding: 28px 0 30px;
  border-bottom: 1px solid var(--line);
}

.intro-panel h2,
.share-state h2,
.thank-you h2,
.missing-state h2,
.result-actions h2 {
  max-width: 42rem;
  margin: 8px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 8vw, 3.3rem);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
}

.intro-panel p:last-child,
.share-state > p,
.thank-you p:last-of-type,
.missing-state p:last-of-type,
.result-actions h2 + p {
  max-width: 38rem;
  margin: 16px 0 0;
  color: var(--muted);
}

.rating-form {
  padding-bottom: 28px;
}

.name-field {
  display: grid;
  gap: 10px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.name-field input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 1rem;
  outline: none;
}

.name-field input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(24, 24, 23, 0.08);
}

.question-list {
  display: grid;
}

.rating-question {
  display: grid;
  gap: 16px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}

.question-copy h2 {
  margin: 8px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 6.4vw, 2.4rem);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.04;
}

.question-copy p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.choice-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.choice-button {
  min-height: 54px;
  padding: 7px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.46);
  color: var(--muted);
  font-size: clamp(0.68rem, 2.6vw, 0.82rem);
  font-weight: 760;
  line-height: 1.1;
}

.choice-button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.button-row {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 52px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 780;
}

.primary-button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.ghost-button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}

.submit-button {
  width: 100%;
  margin-top: 24px;
}

.helper-text {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.progress-block {
  margin-top: 24px;
}

.progress-top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.progress-track {
  height: 12px;
  margin-top: 9px;
  border-radius: 999px;
  background: var(--quiet);
  box-shadow: inset 0 0 0 1px rgba(24, 24, 23, 0.06);
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--good);
}

.link-box {
  display: grid;
  gap: 8px;
  margin-top: 24px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.46);
}

.link-box span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.link-box code {
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.8rem;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.88rem;
}

.status-line span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
}

.score-block {
  margin-top: 34px;
}

.score {
  margin: 2px 0 10px;
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(5rem, 27vw, 10rem);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 0.84;
}

.score-block h2 {
  max-width: 44rem;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.6rem, 7vw, 3rem);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.04;
}

.interpretation {
  max-width: 38rem;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.spectrum {
  margin-top: 34px;
  padding: 18px 0 0;
}

.spectrum-labels,
.pole-labels,
.range-labels,
.legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  color: var(--muted);
  font-size: 0.72rem;
}

.spectrum-labels span:nth-child(2),
.pole-labels span:nth-child(2),
.range-labels span:nth-child(2) {
  text-align: center;
}

.spectrum-labels span:nth-child(3),
.pole-labels span:nth-child(3),
.range-labels span:nth-child(3) {
  text-align: right;
}

.track {
  position: relative;
  height: 16px;
  margin: 9px 0 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #d7d5ce, #f1f0eb 50%, #d7d5ce);
  box-shadow: inset 0 0 0 1px rgba(24, 24, 23, 0.08);
}

.zero-line,
.ideal-zone,
.score-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.zero-line {
  left: 50%;
  width: 1px;
  height: 28px;
  background: rgba(24, 24, 23, 0.35);
}

.ideal-zone {
  left: 62.5%;
  width: 5%;
  height: 16px;
  border-radius: 999px;
  background: var(--accent-soft);
}

.score-marker {
  left: 50%;
  width: 26px;
  height: 26px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 8px 22px rgba(184, 77, 63, 0.26);
}

.mirror-note,
.domains,
.privacy-panel,
.result-actions {
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}

.compact-panel {
  border-top: 0;
}

.mirror-note p:last-child,
.privacy-panel ul,
.section-heading h2 {
  margin-bottom: 0;
}

.mirror-note p:last-child {
  max-width: 40rem;
  margin-top: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.32rem, 5.5vw, 2rem);
  line-height: 1.15;
}

.section-heading h2 {
  margin-top: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 7vw, 3rem);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
}

.domain-list {
  display: grid;
  gap: 0;
  margin-top: 22px;
}

.domain-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px 16px;
  padding: 22px 0;
  border-top: 1px solid rgba(207, 204, 195, 0.78);
}

.domain-copy h3 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 720;
}

.domain-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.domain-score {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

.gap-pill {
  display: inline-flex;
  min-width: 58px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(184, 77, 63, 0.3);
  border-radius: 999px;
  background: var(--accent-faint);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-weight: 760;
}

.range-wrap {
  grid-column: 1 / -1;
}

.range-track {
  position: relative;
  height: 12px;
  margin: 8px 0 12px;
  border-radius: 999px;
  background: #e2e0d9;
  box-shadow: inset 0 0 0 1px rgba(24, 24, 23, 0.06);
}

.gap-fill {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--accent-soft);
}

.marker-dot {
  position: absolute;
  top: 50%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.peer-dot {
  border: 2px solid var(--peer);
  background: var(--paper);
}

.self-dot {
  border: 3px solid var(--paper);
  background: var(--self);
  box-shadow: 0 7px 18px rgba(24, 24, 23, 0.15);
}

.legend {
  grid-template-columns: 1fr 1fr;
  align-items: center;
}

.legend span:last-child {
  text-align: right;
}

.legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: 0;
}

.peer-key {
  border: 1.5px solid var(--peer);
}

.self-key {
  background: var(--self);
}

.privacy-panel ul {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-left: 1.2rem;
  color: var(--muted);
}

.privacy-panel p:not(.section-kicker) {
  max-width: 38rem;
  margin: 12px 0 0;
  color: var(--muted);
}

@media (min-width: 560px) {
  .button-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .submit-button {
    width: auto;
    min-width: 260px;
  }
}

@media (min-width: 700px) {
  .app {
    padding-inline: 28px;
  }

  .result-hero {
    padding-top: 42px;
  }

  .rating-question {
    grid-template-columns: minmax(230px, 0.82fr) minmax(340px, 1.18fr);
    align-items: center;
    gap: 26px;
  }

  .domain-row {
    grid-template-columns: minmax(210px, 0.85fr) 90px minmax(300px, 1.15fr);
    align-items: center;
    gap: 24px;
  }

  .range-wrap {
    grid-column: auto;
  }

  .domain-score {
    align-items: center;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .topbar,
  .screen,
  .score,
  #result-title,
  .interpretation,
  .score-marker,
  .domain-row,
  .choice-button,
  .primary-button,
  .secondary-button,
  .ghost-button {
    transition:
      border-color 160ms ease,
      background-color 160ms ease,
      color 160ms ease,
      opacity 160ms ease,
      transform 160ms ease,
      left 240ms ease;
  }

  .app.is-switching .topbar,
  .app.is-switching .screen {
    opacity: 0.72;
  }
}
