:root {
  color: #172126;
  background: #f4f6f5;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.5;
  --ink: #172126;
  --muted: #58666b;
  --brand: #173f4b;
  --brand-dark: #0f3039;
  --line: #cbd4d1;
  --surface: #ffffff;
  --soft: #eaf1ef;
  --focus: #e49d23;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
}

.brand,
.shell {
  width: min(100% - 2rem, 46rem);
  margin-inline: auto;
}

.brand {
  padding-top: 1.25rem;
}

.brand img {
  display: block;
  width: min(9rem, 40vw);
  height: auto;
  mix-blend-mode: multiply;
}

.shell {
  padding: 1.5rem 0 4rem;
}

.shell[data-layout="wide"] {
  width: min(100% - 1rem, 82rem);
}

button,
textarea,
input {
  font: inherit;
}

button {
  min-height: 3rem;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
.matrix-scroll:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

h1,
h2 {
  color: var(--ink);
  line-height: 1.2;
  margin: 0;
}

h1 {
  max-width: 24ch;
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(1.15rem, 3vw, 1.35rem);
}

p {
  margin: 0 0 1rem;
}

.progress {
  margin-bottom: 0.55rem;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro,
.supporting-copy {
  max-width: 62ch;
  margin-top: 1.25rem;
  color: #354247;
  font-size: 1.05rem;
}

.primary,
.secondary,
.tree-choice,
.text-action,
.back-action {
  width: 100%;
  border-radius: 0.65rem;
  cursor: pointer;
}

.primary {
  margin-top: 1.75rem;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  padding: 0.8rem 1rem;
  text-align: center;
  font-weight: 750;
}

.primary:hover {
  background: var(--brand-dark);
}

.primary:disabled {
  cursor: wait;
  opacity: 0.65;
}

.secondary,
.tree-choice {
  border: 1px solid #9eaaa6;
  background: var(--surface);
  color: var(--ink);
  padding: 0.85rem 1rem;
  text-align: left;
}

.secondary:hover,
.tree-choice:hover {
  border-color: var(--brand);
  background: #f9fbfa;
}

.choice-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.choice {
  min-height: 3.5rem;
  font-weight: 650;
}

.frequency-form {
  margin-top: 2rem;
}

.frequency-group + .frequency-group {
  margin-top: 3rem;
}

.frequency-group h2 {
  margin: 0 0 0.8rem 0.25rem;
}

.matrix-scroll + .matrix-scroll {
  margin-top: 0.9rem;
}

.matrix-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: 0 0.2rem 1rem rgb(23 33 38 / 5%);
  overscroll-behavior-inline: contain;
  scrollbar-color: #81908b #edf1ef;
}

.frequency-matrix {
  width: 100%;
  min-width: 58rem;
  border-spacing: 0;
  border-collapse: separate;
  table-layout: fixed;
}

.frequency-matrix.option-count-3 {
  min-width: 43rem;
}

.frequency-matrix.option-count-4 {
  min-width: 50rem;
}

.frequency-matrix th,
.frequency-matrix td {
  border-bottom: 1px solid #dfe5e2;
  border-left: 1px solid #edf0ef;
}

.frequency-matrix tr:last-child th,
.frequency-matrix tr:last-child td {
  border-bottom: 0;
}

.frequency-matrix thead th {
  padding: 0.8rem 0.6rem;
  background: var(--soft);
  color: #354247;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  vertical-align: bottom;
}

.frequency-matrix .question-column {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 17rem;
  border-left: 0;
  background: var(--surface);
  text-align: left;
}

.frequency-matrix thead .question-column {
  z-index: 2;
  background: var(--soft);
}

.frequency-matrix tbody .question-column {
  padding: 1rem;
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: middle;
}

.question-text,
.question-example {
  display: block;
}

.question-example {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 400;
}

.mobile-option-label {
  display: none;
}

.frequency-matrix tbody tr:nth-child(even) .question-column,
.frequency-matrix tbody tr:nth-child(even) td {
  background: #fafcfb;
}

.frequency-matrix td {
  width: 8rem;
  padding: 0;
  text-align: center;
}

.radio-cell {
  display: grid;
  min-height: 4.5rem;
  cursor: pointer;
  place-items: center;
}

.radio-cell:hover {
  background: var(--soft);
}

.radio-cell input {
  width: 1.35rem;
  height: 1.35rem;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.form-actions {
  width: min(100%, 30rem);
  margin: 0 auto;
}

.scenario {
  max-width: none;
  margin: 1.25rem 0;
  border-left: 0.3rem solid var(--brand);
  border-radius: 0 0.65rem 0.65rem 0;
  background: var(--surface);
  padding: 1rem 1.1rem;
  box-shadow: 0 0.2rem 1rem rgb(23 33 38 / 5%);
  font-size: 1.1rem;
  font-weight: 600;
}

.location {
  min-height: 1.35rem;
  margin-bottom: 0.65rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
}

.location-current {
  color: #354247;
  font-weight: 750;
}

.tree-instruction {
  margin-bottom: 0.65rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.how-heading {
  margin-top: 1.75rem;
}

.scenario-steps {
  margin: 0.75rem 0 0;
  padding-left: 1.4rem;
}

.scenario-steps li + li {
  margin-top: 0.55rem;
}

.reassurance {
  margin-top: 1.25rem;
  color: #354247;
  font-weight: 650;
}

.tree-list {
  display: grid;
  gap: 0.65rem;
}

.tree-choice {
  position: relative;
  min-height: 3.4rem;
  padding-right: 3rem;
  font-weight: 650;
}

.chevron {
  position: absolute;
  top: 50%;
  right: 1rem;
  color: var(--brand);
  font-size: 1.7rem;
  font-weight: 400;
  line-height: 1;
  transform: translateY(-53%);
}

.back-action {
  width: 100%;
  min-height: 2.75rem;
  margin-top: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  padding: 0.5rem;
  font-weight: 650;
  text-align: center;
  text-decoration: underline;
}

.back-action::before {
  content: "← ";
  text-decoration: none;
}

.commit-panel {
  margin-top: 1.5rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.tree-actions .primary {
  margin-top: 0;
}

.exit-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.exit-actions.has-back {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.text-action {
  min-height: 2.75rem;
  border: 0;
  background: transparent;
  color: var(--brand);
  padding: 0.5rem;
  text-align: center;
  text-decoration: underline;
}

.muted-action {
  color: var(--muted);
}

.textarea-label {
  display: block;
  margin-top: 1.5rem;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 10rem;
  margin-top: 0.5rem;
  resize: vertical;
  border: 1px solid #9eaaa6;
  border-radius: 0.65rem;
  background: var(--surface);
  padding: 0.85rem;
}

.actions {
  display: grid;
}

.honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.error {
  color: #9b1c1c;
  font-weight: 650;
}

.loading,
.muted {
  color: var(--muted);
}

@media (min-width: 42rem) {
  .brand {
    padding-top: 2.5rem;
  }

  .shell {
    padding-top: 2rem;
  }
}

@media (max-width: 41.99rem) {
  .matrix-scroll {
    overflow: visible;
  }

  .frequency-matrix {
    min-width: 0;
  }

  .frequency-matrix,
  .frequency-matrix tbody,
  .frequency-matrix tr,
  .frequency-matrix th,
  .frequency-matrix td {
    display: block;
    width: 100%;
  }

  .frequency-matrix thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .frequency-matrix .question-column {
    position: static;
    width: 10rem;
  }

  .frequency-matrix tbody .question-column {
    width: 100%;
    border-bottom: 0;
    background: transparent;
    padding: 1rem 1rem 0.5rem;
    font-size: 0.96rem;
  }

  .frequency-matrix td {
    border: 0;
    padding-inline: 0.75rem;
    text-align: left;
  }

  .frequency-matrix tbody tr {
    border-bottom: 1px solid var(--line);
    padding-bottom: 0.65rem;
  }

  .frequency-matrix tbody tr:last-child {
    border-bottom: 0;
  }

  .frequency-matrix tbody tr:nth-child(even) .question-column,
  .frequency-matrix tbody tr:nth-child(even) td {
    background: transparent;
  }

  .radio-cell {
    display: flex;
    min-height: 2.75rem;
    align-items: center;
    gap: 0.75rem;
    border-radius: 0.45rem;
    padding: 0.45rem 0.25rem;
  }

  .mobile-option-label {
    display: inline;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
