:root {
  --ink: #181713;
  --paper: #f4f0e7;
  --paper-deep: #e9e0d1;
  --card: #fffdf8;
  --line: rgba(24, 23, 19, 0.14);
  --muted: #69655d;
  --olive: #53643d;
  --olive-soft: #e4ead9;
  --terracotta: #bb5e3b;
  --terracotta-soft: #f3ddd3;
  --gold: #b68a37;
  --shadow: 0 28px 80px rgba(50, 40, 26, 0.14);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Avenir Next", Avenir, Montserrat, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 16%, rgba(187, 94, 59, 0.11), transparent 26rem),
    radial-gradient(circle at 92% 80%, rgba(83, 100, 61, 0.13), transparent 30rem),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

a {
  color: inherit;
}

.masthead {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: #080808;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.masthead::after {
  position: absolute;
  inset: auto -8rem -12rem auto;
  width: 28rem;
  height: 28rem;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  box-shadow: 0 0 0 4rem rgba(255, 255, 255, 0.025), 0 0 0 8rem rgba(255, 255, 255, 0.02);
}

.masthead-inner,
.page-shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.masthead-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 116px;
  padding: 1rem 0;
}

.brand-image {
  display: block;
  width: min(350px, 64vw);
  height: auto;
}

.tool-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  transition: border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.tool-switch:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.52);
  transform: translateY(-1px);
}

.page-shell {
  padding: clamp(2rem, 5vw, 5rem) 0 2.5rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(420px, 1.18fr);
  gap: clamp(2rem, 5vw, 5.5rem);
  align-items: start;
}

.intro {
  position: sticky;
  top: 2rem;
  padding-top: 1rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 1.25rem;
  color: var(--terracotta);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 2.25rem;
  height: 1px;
  content: "";
  background: currentColor;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 10ch;
  margin-bottom: 1.25rem;
  font-family: var(--serif);
  font-size: clamp(3rem, 7vw, 5.8rem);
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: -0.055em;
}

.lead {
  max-width: 35rem;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  line-height: 1.72;
}

.privacy-note,
.measurement-note {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  max-width: 34rem;
  padding-top: 1rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
  border-top: 1px solid var(--line);
}

.note-mark {
  display: grid;
  flex: 0 0 1.65rem;
  width: 1.65rem;
  height: 1.65rem;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  place-items: center;
  background: var(--olive);
  border-radius: 50%;
}

.tool-card {
  position: relative;
  overflow: hidden;
  padding: clamp(1.35rem, 4vw, 3rem);
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 2px 2px 2rem 2px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.tool-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  content: "";
  background: linear-gradient(90deg, var(--olive) 0 66%, var(--terracotta) 66%);
}

.card-kicker {
  margin-bottom: 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tool-card h2 {
  margin-bottom: 0.55rem;
  font-family: var(--serif);
  font-size: clamp(1.85rem, 4vw, 2.7rem);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.card-intro {
  margin-bottom: 2rem;
  color: var(--muted);
  line-height: 1.62;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
}

.field-wide {
  grid-column: 1 / -1;
}

.field label,
.field-label {
  font-size: 0.84rem;
  font-weight: 800;
}

.field small {
  color: var(--muted);
  font-size: 0.75rem;
}

.control-wrap {
  position: relative;
}

.control-wrap input,
.field select {
  width: 100%;
  min-height: 54px;
  padding: 0.85rem 1rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.control-wrap input {
  padding-right: 3.2rem;
}

.control-wrap span {
  position: absolute;
  top: 50%;
  right: 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  transform: translateY(-50%);
}

.control-wrap input:focus,
.field select:focus {
  border-color: var(--olive);
  box-shadow: 0 0 0 4px rgba(83, 100, 61, 0.13);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0.85rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 800;
  border-radius: 999px;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.primary-button {
  width: 100%;
  color: #fff;
  background: var(--ink);
  border: 1px solid var(--ink);
  box-shadow: 0 12px 28px rgba(24, 23, 19, 0.2);
}

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

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.tool-switch:focus-visible,
.choice:focus-within {
  outline: 3px solid rgba(187, 94, 59, 0.35);
  outline-offset: 3px;
}

.result-panel {
  animation: rise 420ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.result-panel[hidden],
.quiz-panel[hidden] {
  display: none;
}

.result-number {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin: 1.25rem 0;
  color: var(--terracotta);
  font-family: var(--serif);
  font-size: clamp(4rem, 12vw, 7rem);
  line-height: 0.85;
  letter-spacing: -0.06em;
}

.result-number span {
  font-family: var(--sans);
  font-size: 0.24em;
  font-weight: 800;
  letter-spacing: 0;
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.status-card {
  padding: 1rem;
  background: var(--olive-soft);
  border-radius: 1rem;
}

.status-card[data-tone="elevated"],
.status-card[data-tone="substantially-elevated"],
.status-card[data-tone="high"] {
  background: var(--terracotta-soft);
}

.status-card small {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-card strong {
  font-size: 0.95rem;
  line-height: 1.35;
}

.guidance {
  padding: 1.15rem 1.2rem;
  color: var(--muted);
  line-height: 1.62;
  background: rgba(24, 23, 19, 0.04);
  border-left: 3px solid var(--gold);
}

.guidance strong {
  color: var(--ink);
}

.disclaimer {
  margin: 1.2rem 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.progress-track {
  height: 5px;
  margin-bottom: 2.2rem;
  overflow: hidden;
  background: var(--paper-deep);
  border-radius: 999px;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--olive), var(--terracotta));
  border-radius: inherit;
  transition: width 280ms ease;
}

.question-number {
  display: inline-grid;
  width: 2.2rem;
  height: 2.2rem;
  margin-bottom: 1.15rem;
  color: #fff;
  font-family: var(--serif);
  place-items: center;
  background: var(--ink);
  border-radius: 50%;
}

.question-title {
  min-height: 4.7em;
  margin-bottom: 1.5rem;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.choice {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 1rem;
  font-weight: 800;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 1rem;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.choice:hover {
  transform: translateY(-1px);
  border-color: rgba(83, 100, 61, 0.55);
}

.choice:has(input:checked) {
  background: var(--olive-soft);
  border-color: var(--olive);
}

.choice input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0 0.75rem 0 0;
  accent-color: var(--olive);
}

.quiz-actions,
.result-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 2rem;
}

.quiz-actions .primary-button {
  flex: 1;
  width: auto;
}

.level-chip {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0.6rem 0 1rem;
  padding: 0.6rem 0.85rem;
  color: var(--olive);
  font-size: 0.78rem;
  font-weight: 800;
  background: var(--olive-soft);
  border-radius: 999px;
}

.level-chip[data-tone="medium"],
.level-chip[data-tone="high"] {
  color: #8d3e24;
  background: var(--terracotta-soft);
}

.result-copy {
  color: var(--muted);
  line-height: 1.68;
}

.page-footer {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.55;
  border-top: 1px solid var(--line);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 820px) {
  .masthead-inner {
    min-height: 96px;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .intro {
    position: static;
    padding-top: 0;
  }

  h1 {
    max-width: 12ch;
  }
}

@media (max-width: 560px) {
  .masthead-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
    padding-bottom: 1.1rem;
  }

  .brand-image {
    width: min(330px, 88vw);
  }

  .tool-switch {
    align-self: flex-end;
  }

  .page-shell {
    width: min(100% - 1rem, 1120px);
    padding-top: 1.5rem;
  }

  .field-grid,
  .status-grid,
  .choices {
    grid-template-columns: 1fr;
  }

  .tool-card {
    padding: 1.25rem;
    border-radius: 2px 2px 1.4rem 2px;
  }

  .question-title {
    min-height: 0;
  }

  .quiz-actions,
  .result-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
