:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #5f6d65;
  --line: #d9e1dc;
  --surface: #ffffff;
  --band: #f4f7f2;
  --accent: #1f7a5a;
  --accent-dark: #14553f;
  --gold: #c98924;
  --rose: #a84753;
  --blue: #315f8a;
  --shadow: 0 16px 48px rgba(23, 32, 27, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  background: #fbfcfa;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 54px);
  background: rgba(251, 252, 250, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  min-width: 0;
}

.app-header h1,
.intro-copy h2,
.section-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.app-header h1 {
  font-size: clamp(1.2rem, 2vw, 1.75rem);
}

.app-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app-header a {
  color: var(--muted);
  padding: 8px 10px;
  text-decoration: none;
}

.app-header a:hover,
.app-header a:focus {
  color: var(--accent-dark);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  min-width: 0;
}

.intro-band,
.section-band {
  margin: 28px 0;
  padding: clamp(22px, 4vw, 42px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.intro-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
  gap: 28px;
  align-items: end;
  background:
    linear-gradient(120deg, rgba(31, 122, 90, 0.12), transparent 44%),
    linear-gradient(90deg, #ffffff, #f5f8f4);
}

.intro-copy,
.section-band,
.status-panel,
.insight-panel,
.first-focus {
  min-width: 0;
}

.intro-copy h2 {
  max-width: 760px;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.intro-copy p:not(.eyebrow) {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.08rem;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-panel,
.insight-panel,
.first-focus {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  padding: 18px;
}

.status-panel {
  display: grid;
  gap: 6px;
}

.status-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.status-panel strong {
  font-size: 2rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-heading h2 {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.with-controls {
  align-items: end;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

input:focus,
textarea:focus,
select:focus {
  outline: 3px solid rgba(31, 122, 90, 0.18);
  border-color: var(--accent);
}

.consent-row {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.check-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink);
}

.check-label input {
  width: 18px;
  min-width: 18px;
  margin-top: 3px;
}

.search-box {
  min-width: min(320px, 100%);
}

.rating-key {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.rating-key span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  background: var(--band);
  font-size: 0.86rem;
}

.symptom-list {
  display: grid;
  gap: 10px;
}

.symptom-row {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-width: 0;
}

.symptom-name {
  color: var(--ink);
  font-weight: 750;
}

.system-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.system-tags span {
  color: var(--muted);
  background: var(--band);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.78rem;
}

.rating-options {
  display: grid;
  grid-template-columns: repeat(4, 44px);
  gap: 6px;
}

.rating-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rating-options span {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.rating-options input:checked + span {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.results-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
}

.first-focus {
  margin-bottom: 16px;
}

.first-focus h3,
.insight-panel h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.first-focus strong {
  color: var(--accent-dark);
  font-size: clamp(2rem, 4vw, 3rem);
}

.result-bars {
  display: grid;
  gap: 10px;
}

.result-bar {
  display: grid;
  grid-template-columns: minmax(90px, 130px) minmax(0, 1fr) 48px;
  gap: 12px;
  align-items: center;
}

.bar-track {
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ede9;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

.bar-score {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.insight-panel p {
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.submit-status {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--accent-dark);
  font-weight: 750;
}

.submit-status.error {
  color: var(--rose);
}

button {
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  font-weight: 800;
}

button:hover,
button:focus {
  background: var(--accent-dark);
}

button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 32px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  .app-header,
  .intro-band,
  .results-layout,
  .form-grid,
  .section-heading,
  .symptom-row {
    grid-template-columns: 1fr;
  }

  .app-header {
    display: grid;
  }

  .section-heading {
    display: grid;
  }

  .rating-options {
    grid-template-columns: repeat(4, minmax(44px, 1fr));
  }

  .result-bar {
    grid-template-columns: 104px minmax(90px, 1fr) 42px;
  }
}

@media print {
  .app-header,
  .actions,
  .search-box,
  .rating-key {
    display: none;
  }

  body {
    background: #fff;
  }

  main,
  footer {
    width: 100%;
  }

  .intro-band,
  .section-band {
    box-shadow: none;
    break-inside: avoid;
  }
}
