:root {
  --ink: #102a43;
  --ink-soft: #486581;
  --ink-faint: #71879a;
  --paper: #f7faf9;
  --white: #ffffff;
  --line: #d8e4e3;
  --line-strong: #b9cecc;
  --teal: #1f706a;
  --teal-dark: #155650;
  --teal-pale: #e5f2ef;
  --blue-pale: #e9f1f7;
  --amber: #9b6413;
  --amber-pale: #fbf2df;
  --danger: #a83832;
  --danger-pale: #fbeceb;
  --rare: #5c5977;
  --rare-pale: #efeff5;
  --shadow: 0 22px 60px rgba(16, 42, 67, 0.09);
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --display: "Songti SC", "STSong", "Noto Serif SC", serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --utility: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(31, 112, 106, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 112, 106, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  font-family: var(--body);
  line-height: 1.65;
  min-height: 100vh;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  z-index: 100;
  left: 16px;
  top: -60px;
  padding: 10px 16px;
  color: var(--white);
  background: var(--ink);
  border-radius: 8px;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 12px; }

.site-header {
  max-width: 1440px;
  height: 84px;
  margin: 0 auto;
  padding: 0 5vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(247, 250, 249, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--teal);
}
.brand-mark svg { width: 100%; height: 100%; stroke-width: 1.45; }
.brand strong { display: block; font-family: var(--display); font-size: 21px; letter-spacing: 0.08em; }
.brand small { display: block; margin-top: -4px; color: var(--ink-faint); font-size: 10px; letter-spacing: 0.12em; }

.main-nav { display: flex; align-items: center; gap: 34px; }
.main-nav a {
  position: relative;
  padding: 8px 0;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 2px;
  background: var(--teal);
  transition: right 0.2s ease;
}
.main-nav a:hover::after,
.main-nav a.active::after { right: 0; }
.main-nav a.active { color: var(--teal-dark); }

.prototype-ribbon {
  min-height: 36px;
  padding: 7px 5vw;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #5f4b27;
  background: var(--amber-pale);
  border-block: 1px solid #ead9b3;
  font-size: 12px;
}
.prototype-ribbon span {
  padding: 1px 7px;
  color: var(--white);
  background: var(--amber);
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.view { min-height: calc(100vh - 210px); }
#main-content:focus { outline: none; }
.eyebrow {
  margin: 0 0 14px;
  color: var(--teal);
  font-family: var(--utility);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 78px 5vw 54px;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(420px, 0.72fr);
  gap: clamp(64px, 9vw, 140px);
  align-items: center;
}

.hero-copy h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(50px, 5.5vw, 82px);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.045em;
}
.hero-copy h1 em { color: var(--teal); font-style: normal; }
.hero-intro { max-width: 560px; margin: 30px 0 26px; color: var(--ink-soft); font-size: 17px; line-height: 1.9; }
.scope-note {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px 9px 10px;
  color: var(--teal-dark);
  background: var(--teal-pale);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}
.scope-note svg { width: 18px; height: 18px; }
.coverage-note {
  margin-top: 18px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--ink-faint);
  font-size: 11px;
}
.coverage-note strong { color: var(--ink); font-family: var(--utility); font-size: 16px; }
.coverage-note i { width: 1px; height: 14px; margin: 0 7px; background: var(--line-strong); }

.symptom-panel {
  position: relative;
  padding: 34px;
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.symptom-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--teal);
}
.panel-index {
  position: absolute;
  top: 16px;
  right: 24px;
  color: var(--line);
  font-family: var(--utility);
  font-size: 58px;
  font-weight: 300;
  line-height: 1;
}
.panel-heading { position: relative; margin-bottom: 24px; }
.panel-heading p { margin: 0 0 4px; color: var(--teal); font-size: 12px; font-weight: 700; }
.panel-heading h2 { margin: 0; font-family: var(--display); font-size: 26px; }

label, legend { color: var(--ink); font-size: 13px; font-weight: 650; }
legend { padding: 0; }
.input-composer { margin-top: 8px; background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); transition: border 0.2s, box-shadow 0.2s; }
.input-composer:focus-within { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(31, 112, 106, 0.1); }
textarea, input, select { color: var(--ink); background: var(--white); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); outline: none; }
textarea:focus, input:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(31, 112, 106, 0.1); }
.input-composer textarea { width: 100%; min-height: 118px; padding: 16px; resize: vertical; background: transparent; border: 0; box-shadow: none; line-height: 1.7; }
.input-composer textarea:focus { border: 0; box-shadow: none; }
textarea::placeholder, input::placeholder { color: #91a4b5; }
.input-meta { padding: 9px 12px; display: flex; justify-content: space-between; gap: 20px; color: var(--ink-faint); border-top: 1px solid var(--line); font-size: 11px; }
.input-meta b { color: var(--teal); font-weight: 600; }
.field-error { min-height: 18px; margin: 5px 0 0; color: var(--danger); font-size: 12px; }
.has-error { border-color: var(--danger) !important; }

.quick-examples { margin: 6px 0 20px; display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--ink-faint); font-size: 11px; }
.quick-examples button { padding: 4px 10px; color: var(--teal-dark); background: transparent; border: 1px solid var(--line); border-radius: 100px; cursor: pointer; }
.quick-examples button:hover { background: var(--teal-pale); border-color: var(--teal); }

.primary-button, .outline-button, .text-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 0; cursor: pointer; }
.primary-button {
  min-height: 50px;
  padding: 0 21px;
  color: var(--white);
  background: var(--teal);
  border-radius: var(--radius-sm);
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(31, 112, 106, 0.18);
  transition: transform 0.2s ease, background 0.2s ease;
}
.primary-button:hover { background: var(--teal-dark); transform: translateY(-1px); }
.primary-button svg { width: 18px; height: 18px; }
.symptom-panel .primary-button { width: 100%; }
.outline-button { min-height: 40px; padding: 0 14px; color: var(--ink-soft); background: var(--white); border: 1px solid var(--line-strong); border-radius: 9px; font-size: 12px; font-weight: 650; }
.outline-button:hover { color: var(--teal-dark); border-color: var(--teal); }
.outline-button svg { width: 16px; height: 16px; }
.text-button { padding: 5px 0; color: var(--ink-soft); background: transparent; font-size: 13px; font-weight: 650; }
.text-button:hover { color: var(--teal-dark); }
.text-button svg { width: 17px; height: 17px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(31, 112, 106, 0.3); outline-offset: 3px; }

.how-it-works {
  max-width: 1120px;
  margin: 0 auto 70px;
  padding: 24px 3vw;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  background: rgba(255, 255, 255, 0.68);
  border-block: 1px solid var(--line);
}
.how-it-works > div { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; }
.step-dot { grid-row: 1 / 3; width: 32px; height: 32px; display: grid; place-items: center; color: var(--teal-dark); background: var(--teal-pale); border-radius: 50%; font-family: var(--utility); font-size: 11px; }
.how-it-works strong { font-size: 13px; }
.how-it-works small { color: var(--ink-faint); font-size: 11px; }
.how-it-works i { width: 46px; height: 1px; margin: 0 20px; background: var(--line-strong); }

.symptom-library {
  max-width: 1180px;
  margin: 0 auto 80px;
  padding: 42px 3.5vw;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 48px rgba(16, 42, 67, 0.05);
}
.library-heading { margin-bottom: 24px; display: flex; justify-content: space-between; align-items: end; gap: 40px; }
.library-heading h2 { margin: 0; font-family: var(--display); font-size: clamp(28px, 3.5vw, 42px); }
.library-heading > div > p:last-child { margin: 8px 0 0; color: var(--ink-faint); font-size: 12px; }
.library-search { width: min(280px, 100%); }
.library-search span { display: block; margin-bottom: 7px; color: var(--ink-soft); font-size: 10px; }
.library-search input { width: 100%; min-height: 42px; padding: 9px 12px; }
.category-filters { margin-bottom: 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.category-filters button {
  padding: 7px 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 100px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}
.category-filters button span { min-width: 18px; padding: 0 5px; color: var(--ink-faint); background: var(--white); border-radius: 100px; font-family: var(--utility); font-size: 9px; }
.category-filters button:hover, .category-filters button.active { color: var(--white); background: var(--teal); border-color: var(--teal); }
.category-filters button.active span { color: var(--teal-dark); }
.symptom-library-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.symptom-library-card {
  position: relative;
  min-height: 128px;
  padding: 17px 42px 17px 17px;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  text-align: left;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.symptom-library-card:hover { border-color: var(--teal); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(16, 42, 67, 0.07); }
.symptom-library-card > span { color: var(--teal); font-family: var(--utility); font-size: 9px; letter-spacing: 0.08em; }
.symptom-library-card strong { margin: 5px 0 3px; font-family: var(--display); font-size: 19px; }
.symptom-library-card small { color: var(--ink-faint); font-size: 10px; line-height: 1.55; }
.symptom-library-card i { position: absolute; right: 15px; top: 50%; width: 26px; height: 26px; display: grid; place-items: center; color: var(--teal); background: var(--teal-pale); border-radius: 50%; font-family: var(--utility); font-size: 11px; font-style: normal; transform: translateY(-50%); }
.library-empty { padding: 34px; color: var(--ink-faint); text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); font-size: 12px; }

.form-page-shell, .results-shell, .detail-shell, .sources-shell { max-width: 1280px; margin: 0 auto; padding: 42px 5vw 80px; }
.progress-header, .results-toolbar { margin-bottom: 36px; display: flex; justify-content: space-between; align-items: center; }
.step-progress { display: flex; align-items: center; gap: 6px; }
.step-progress > span { width: 44px; height: 3px; background: var(--line-strong); border-radius: 10px; }
.step-progress > span:first-child, .step-progress > span.active { background: var(--teal); }
.step-progress small { margin-left: 8px; color: var(--ink-faint); font-family: var(--utility); font-size: 10px; }
.details-layout { display: grid; grid-template-columns: minmax(220px, 0.32fr) minmax(0, 1fr); gap: clamp(40px, 7vw, 100px); align-items: start; }
.case-summary { position: sticky; top: 24px; padding-top: 18px; }
.case-summary blockquote { margin: 0; font-family: var(--display); font-size: 31px; line-height: 1.5; }
.case-summary .summary-rule { width: 48px; height: 4px; margin: 25px 0; background: var(--teal); }
.case-summary > p:last-child { color: var(--ink-faint); font-size: 12px; }
.details-form { padding: 38px; background: rgba(255, 255, 255, 0.95); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow); }
.form-title-row { margin-bottom: 34px; display: flex; justify-content: space-between; gap: 30px; align-items: end; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.form-title-row h2 { margin: 0; font-family: var(--display); font-size: 30px; }
.required-note { color: var(--ink-faint); font-size: 11px; white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.field-group { min-width: 0; border: 0; padding: 0; margin: 0; }
.field-group > label, .field-group > legend { display: block; margin-bottom: 8px; }
.field-group input:not([type="radio"]):not([type="range"]), .field-group select, .field-group textarea { width: 100%; min-height: 46px; padding: 10px 12px; }
.field-group textarea { resize: vertical; }
.full-width { grid-column: 1 / -1; }
.input-with-unit { display: flex; align-items: center; }
.input-with-unit input { border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important; }
.input-with-unit span { height: 46px; padding: 0 14px; display: grid; place-items: center; color: var(--ink-faint); background: var(--paper); border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 12px; }
.segmented-control { display: flex; gap: 7px; }
.segmented-control label { flex: 1; }
.segmented-control input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-control span { min-height: 46px; padding: 0 9px; display: grid; place-items: center; text-align: center; color: var(--ink-soft); background: var(--white); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; }
.segmented-control input:checked + span { color: var(--teal-dark); background: var(--teal-pale); border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.segmented-control input:focus-visible + span { outline: 3px solid rgba(31, 112, 106, 0.3); outline-offset: 2px; }
.label-row { display: flex; justify-content: space-between; }
.label-row output { color: var(--teal-dark); font-family: var(--utility); font-size: 12px; font-weight: 700; }
input[type="range"] { width: 100%; height: 5px; margin: 14px 0 5px; background: linear-gradient(to right, var(--teal) 0 44%, var(--line) 44% 100%); border: 0; border-radius: 10px; appearance: none; box-shadow: none; }
input[type="range"]::-webkit-slider-thumb { width: 20px; height: 20px; background: var(--white); border: 5px solid var(--teal); border-radius: 50%; appearance: none; cursor: pointer; }
.range-labels { display: flex; justify-content: space-between; color: var(--ink-faint); font-size: 10px; }
.consent-check { margin-top: 28px; padding: 14px; display: flex; align-items: flex-start; gap: 10px; color: var(--ink-soft); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.consent-check input { width: 17px; height: 17px; margin-top: 3px; accent-color: var(--teal); }
.form-actions { margin-top: 28px; display: flex; justify-content: space-between; align-items: center; gap: 30px; }
.form-actions p { max-width: 450px; margin: 0; display: flex; gap: 8px; color: var(--ink-faint); font-size: 11px; }
.form-actions p svg { flex: 0 0 auto; width: 16px; height: 16px; color: var(--amber); }

.loading-shell, .state-shell { min-height: 62vh; padding: 80px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.loading-shell h2, .state-shell h2 { margin: 0; font-family: var(--display); font-size: clamp(28px, 4vw, 44px); }
.loading-shell > p:last-child, .state-shell > p { color: var(--ink-faint); }
.evidence-loader { width: 160px; margin-bottom: 34px; display: flex; align-items: center; justify-content: center; gap: 18px; }
.evidence-loader span { width: 12px; height: 12px; background: var(--line-strong); border-radius: 50%; animation: evidence-pulse 1.35s infinite ease-in-out; }
.evidence-loader span:nth-child(2) { background: var(--teal); animation-delay: 0.16s; }
.evidence-loader span:nth-child(3) { animation-delay: 0.32s; }
@keyframes evidence-pulse { 0%, 70%, 100% { transform: scale(0.7); opacity: 0.4; } 35% { transform: scale(1.2); opacity: 1; } }

.urgent-banner { margin: 0 0 28px; padding: 18px 20px; display: flex; gap: 14px; color: #762622; background: var(--danger-pale); border: 1px solid #efc7c4; border-left: 5px solid var(--danger); border-radius: var(--radius-sm); }
.urgent-banner svg { flex: 0 0 auto; width: 22px; height: 22px; margin-top: 2px; }
.urgent-banner strong { display: block; margin-bottom: 2px; }
.urgent-banner p { margin: 0; font-size: 12px; }
.results-header { margin-bottom: 32px; display: flex; justify-content: space-between; gap: 50px; align-items: end; }
.results-header h1 { margin: 0 0 12px; font-family: var(--display); font-size: clamp(34px, 4vw, 52px); line-height: 1.25; }
.results-header > div:first-child > p:last-child { max-width: 680px; margin: 0; color: var(--ink-soft); }
.result-meta { min-width: 180px; padding-left: 18px; border-left: 2px solid var(--teal); }
.result-meta span, .result-meta small { display: block; color: var(--ink-faint); font-size: 10px; }
.result-meta strong { display: block; margin: 3px 0; font-family: var(--utility); font-size: 12px; }

.evidence-track { margin-bottom: 40px; padding: 18px 22px; display: grid; grid-template-columns: minmax(180px, 1fr) auto minmax(40px, 0.35fr) auto minmax(40px, 0.35fr) auto minmax(40px, 0.35fr); align-items: center; gap: 14px; background: var(--ink); color: var(--white); border-radius: var(--radius-md); box-shadow: 0 15px 35px rgba(16, 42, 67, 0.15); }
.track-intro span { display: block; font-family: var(--display); font-size: 18px; }
.track-intro small { color: #aebfcd; font-size: 10px; }
.track-item { display: flex; align-items: center; gap: 9px; }
.track-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; font-family: var(--utility); font-size: 11px; }
.known .track-icon { color: #b8eee5; background: rgba(62, 191, 172, 0.18); }
.missing .track-icon { color: #f7d995; background: rgba(220, 166, 69, 0.18); }
.next .track-icon { color: #bad7ec; background: rgba(101, 160, 204, 0.18); }
.track-item strong, .track-item small { display: block; }
.track-item strong { font-family: var(--utility); font-size: 16px; }
.track-item small { color: #aebfcd; font-size: 9px; white-space: nowrap; }
.track-connector { width: 100%; height: 1px; background: #36516a; }

.results-grid { display: grid; grid-template-columns: minmax(210px, 0.28fr) minmax(0, 1fr); gap: clamp(36px, 6vw, 80px); align-items: start; }
.result-sidebar { position: sticky; top: 24px; display: grid; gap: 16px; }
.sidebar-card { padding: 22px; background: rgba(255, 255, 255, 0.9); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.sidebar-card dl { margin: 0; }
.sidebar-card dl div { padding: 11px 0; border-bottom: 1px solid var(--line); }
.sidebar-card dl div:last-child { border: 0; padding-bottom: 0; }
.sidebar-card dt { color: var(--ink-faint); font-size: 10px; }
.sidebar-card dd { margin: 2px 0 0; font-size: 12px; font-weight: 650; }
.reminder-card { color: var(--teal-dark); background: var(--teal-pale); border-color: #cbe1dc; }
.reminder-card svg { width: 22px; height: 22px; margin-bottom: 10px; }
.reminder-card strong { display: block; font-size: 13px; }
.reminder-card p { margin: 7px 0 0; color: #406b66; font-size: 11px; }
.category-heading { margin: 10px 0 14px; display: flex; align-items: center; gap: 14px; }
.category-heading:not(:first-child) { margin-top: 42px; }
.category-heading span { padding: 5px 10px; border-radius: 6px; font-size: 11px; font-weight: 750; letter-spacing: 0.05em; }
.category-heading p { margin: 0; color: var(--ink-faint); font-size: 11px; }
.common-heading span { color: var(--teal-dark); background: var(--teal-pale); }
.exclude-heading span { color: #724a0f; background: var(--amber-pale); }
.conditional-heading span { color: #405d77; background: var(--blue-pale); }
.rare-heading span { color: var(--rare); background: var(--rare-pale); }
.rare-safety-note {
  margin: -2px 0 14px;
  padding: 14px 16px;
  color: #4d4a67;
  background: rgba(239, 239, 245, 0.78);
  border: 1px solid #d9d8e5;
  border-left: 4px solid var(--rare);
  border-radius: var(--radius-sm);
}
.rare-safety-note strong { display: block; margin-bottom: 2px; font-size: 11px; }
.rare-safety-note p { margin: 0; font-size: 10px; line-height: 1.65; }
.disease-list { display: grid; gap: 12px; }
.disease-card { background: rgba(255, 255, 255, 0.94); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; transition: border-color 0.2s, box-shadow 0.2s; }
.disease-card:hover { border-color: var(--line-strong); box-shadow: 0 10px 30px rgba(16, 42, 67, 0.06); }
.disease-card-header { width: 100%; padding: 19px 20px; display: grid; grid-template-columns: 1fr auto auto; gap: 18px; align-items: center; text-align: left; background: transparent; border: 0; cursor: pointer; }
.disease-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.disease-title-row h3 { margin: 0; font-family: var(--display); font-size: 20px; }
.demo-badge { padding: 2px 6px; color: var(--amber); background: var(--amber-pale); border-radius: 4px; font-size: 9px; font-weight: 700; }
.rare-badge { padding: 2px 6px; color: var(--rare); background: var(--rare-pale); border-radius: 4px; font-size: 9px; font-weight: 700; }
.disease-card-header p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; }
.urgency-badge { padding: 4px 8px; border-radius: 100px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.urgency-routine { color: var(--teal-dark); background: var(--teal-pale); }
.urgency-soon { color: #724a0f; background: var(--amber-pale); }
.urgency-emergency { color: #852b26; background: var(--danger-pale); }
.expand-icon { width: 28px; height: 28px; display: grid; place-items: center; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 50%; transition: transform 0.2s; }
.disease-card.open .expand-icon { transform: rotate(45deg); }
.disease-card-body { padding: 0 20px 21px; }
.disease-card-body-inner { padding-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 22px; border-top: 1px solid var(--line); }
.mini-section h4 { margin: 0 0 8px; font-size: 11px; letter-spacing: 0.06em; }
.mini-section ul { margin: 0; padding-left: 17px; color: var(--ink-soft); font-size: 12px; }
.mini-section li + li { margin-top: 5px; }
.test-row { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.test-row:last-child { border: 0; }
.test-row strong, .test-row small { display: block; }
.test-row strong { font-size: 12px; }
.test-row small { color: var(--ink-faint); font-size: 10px; }
.card-footer { grid-column: 1 / -1; padding-top: 13px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-top: 1px solid var(--line); }
.card-footer span { color: var(--ink-faint); font-size: 10px; }
.card-footer a { color: var(--teal-dark); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.detail-link { color: var(--teal-dark); background: transparent; border: 0; cursor: pointer; font-size: 11px; font-weight: 750; }

.state-symbol { width: 70px; height: 70px; margin-bottom: 25px; display: grid; place-items: center; color: var(--teal); background: var(--teal-pale); border-radius: 50%; font-family: var(--display); font-size: 34px; }
.state-shell > p { max-width: 560px; }
.state-shell .primary-button { margin-top: 16px; }
.error-state .state-symbol { color: var(--danger); background: var(--danger-pale); }

.detail-shell { max-width: 1000px; }
.detail-shell > .text-button { margin-bottom: 32px; }
.detail-hero { margin-bottom: 34px; padding: clamp(28px, 5vw, 54px); color: var(--white); background: var(--ink); border-radius: var(--radius-lg); }
.detail-hero-top { display: flex; justify-content: space-between; gap: 30px; }
.detail-hero h1 { margin: 8px 0 12px; font-family: var(--display); font-size: clamp(38px, 6vw, 62px); }
.detail-hero p { max-width: 650px; margin: 0; color: #c5d3dd; }
.detail-content { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.detail-section { padding: 28px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-md); }
.detail-section.full { grid-column: 1 / -1; }
.detail-section h2 { margin: 0 0 14px; font-family: var(--display); font-size: 23px; }
.detail-section ul { margin: 0; padding-left: 20px; color: var(--ink-soft); }
.detail-section li + li { margin-top: 8px; }
.detail-test { padding: 16px 0; display: grid; grid-template-columns: minmax(150px, 0.35fr) 1fr; gap: 22px; border-bottom: 1px solid var(--line); }
.detail-test:last-child { border: 0; }
.detail-test strong { font-size: 13px; }
.detail-test p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.source-stamp { margin-top: 24px; padding: 15px; color: var(--ink-soft); background: var(--paper); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); font-size: 11px; }
.source-stamp a { color: var(--teal-dark); text-underline-offset: 3px; }

.sources-shell { max-width: 1120px; }
.sources-title { max-width: 760px; margin: 34px 0 58px; }
.sources-title h1 { margin: 0; font-family: var(--display); font-size: clamp(42px, 6vw, 70px); line-height: 1.25; letter-spacing: -0.04em; }
.sources-title > p:last-child { margin-top: 22px; color: var(--ink-soft); }
.boundary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.boundary-grid article { padding: 30px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-md); }
.boundary-grid article > span { width: 34px; height: 34px; display: grid; place-items: center; color: var(--teal-dark); background: var(--teal-pale); border-radius: 50%; font-family: var(--utility); }
.boundary-grid article:last-child > span { color: var(--ink-soft); background: var(--blue-pale); }
.boundary-grid h2 { margin: 22px 0 14px; font-family: var(--display); font-size: 25px; }
.boundary-grid ul { margin: 0; padding-left: 19px; color: var(--ink-soft); }
.boundary-grid li + li { margin-top: 7px; }
.source-ledger { margin-top: 62px; }
.ledger-heading { margin-bottom: 16px; display: flex; justify-content: space-between; align-items: end; }
.ledger-heading h2 { margin: 0; font-family: var(--display); font-size: 31px; }
.ledger-heading > span { color: var(--ink-faint); font-family: var(--utility); font-size: 10px; }
.source-ledger > a, .demo-ledger-row, .textbook-ledger-row { padding: 20px 3px; display: flex; justify-content: space-between; gap: 30px; align-items: center; text-decoration: none; border-top: 1px solid var(--line-strong); }
.ledger-subheading { padding: 32px 3px 9px; color: var(--rare); border-top: 1px solid var(--line-strong); font-family: var(--utility); font-size: 10px; font-weight: 700; letter-spacing: 0.12em; }
.source-ledger > a:hover { color: var(--teal-dark); }
.source-ledger strong, .source-ledger small { display: block; }
.source-ledger strong { font-size: 13px; }
.source-ledger small { color: var(--ink-faint); font-size: 10px; }
.source-ledger > a > span, .demo-ledger-row > span, .textbook-ledger-row > span { max-width: 380px; color: var(--ink-faint); font-size: 11px; text-align: right; }
.demo-ledger-row { border-bottom: 1px solid var(--line-strong); }
.demo-ledger-row > span { color: var(--amber); }
.disclaimer-block { margin-top: 62px; padding: 35px; color: var(--white); background: var(--ink); border-radius: var(--radius-lg); }
.disclaimer-block h2 { margin: 0 0 20px; font-family: var(--display); font-size: 27px; }
.disclaimer-block ol { margin: 0; padding: 0; list-style: none; }
.disclaimer-block li { padding: 13px 0; display: flex; align-items: baseline; gap: 18px; color: #ccdae3; border-top: 1px solid #2d4960; }
.disclaimer-block li span { color: #76bdb4; font-family: var(--utility); font-size: 10px; }

.site-footer { min-height: 90px; padding: 25px 5vw; display: flex; justify-content: space-between; gap: 30px; align-items: center; color: var(--ink-faint); background: rgba(255, 255, 255, 0.65); border-top: 1px solid var(--line); font-size: 11px; }
.site-footer p { margin: 0; }
.site-footer strong { color: var(--ink); font-family: var(--display); font-size: 13px; }
.toast { position: fixed; z-index: 60; right: 22px; bottom: 22px; max-width: 320px; padding: 12px 16px; color: var(--white); background: var(--ink); border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 12px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: 0.25s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .hero-shell { grid-template-columns: 1fr; gap: 50px; padding-top: 52px; }
  .hero-copy { max-width: 700px; }
  .symptom-panel { max-width: 620px; }
  .details-layout, .results-grid { grid-template-columns: 1fr; }
  .case-summary, .result-sidebar { position: static; }
  .case-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: end; }
  .case-summary .eyebrow { grid-column: 1 / -1; margin-bottom: -10px; }
  .case-summary .summary-rule { display: none; }
  .result-sidebar { grid-template-columns: 1fr 1fr; }
  .evidence-track { grid-template-columns: 1fr repeat(5, auto); }
  .track-intro { grid-column: 1 / -1; padding-bottom: 10px; border-bottom: 1px solid #36516a; }
  .boundary-grid { grid-template-columns: 1fr; }
  .symptom-library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .site-header { height: 70px; padding-inline: 20px; }
  .brand small { display: none; }
  .brand strong { font-size: 18px; }
  .brand-mark { width: 33px; height: 33px; }
  .main-nav { gap: 18px; }
  .main-nav a { font-size: 12px; }
  .prototype-ribbon { padding-inline: 18px; justify-content: flex-start; line-height: 1.4; }
  .prototype-ribbon span { flex: 0 0 auto; }
  .hero-shell { padding: 44px 20px 40px; }
  .hero-copy h1 { font-size: 43px; }
  .hero-intro { font-size: 15px; }
  .symptom-panel { padding: 25px 20px; border-radius: var(--radius-md); }
  .panel-index { font-size: 44px; }
  .how-it-works { margin-bottom: 40px; padding: 22px 20px; grid-template-columns: 1fr; gap: 18px; }
  .how-it-works i { display: none; }
  .symptom-library { margin: 0 20px 48px; padding: 28px 18px; border-radius: var(--radius-md); }
  .library-heading { align-items: stretch; flex-direction: column; gap: 20px; }
  .library-search { width: 100%; }
  .category-filters { flex-wrap: nowrap; margin-inline: -18px; padding-inline: 18px; overflow-x: auto; scrollbar-width: none; }
  .category-filters::-webkit-scrollbar { display: none; }
  .category-filters button { flex: 0 0 auto; }
  .symptom-library-grid { grid-template-columns: 1fr; }
  .symptom-library-card { min-height: 110px; }
  .form-page-shell, .results-shell, .detail-shell, .sources-shell { padding: 28px 20px 58px; }
  .progress-header, .results-toolbar { margin-bottom: 25px; }
  .details-layout { gap: 28px; }
  .case-summary { display: block; }
  .case-summary blockquote { font-size: 25px; }
  .details-form { padding: 24px 18px; }
  .form-title-row { align-items: start; flex-direction: column; gap: 8px; }
  .form-title-row h2 { font-size: 25px; }
  .form-grid { grid-template-columns: 1fr; gap: 20px; }
  .full-width { grid-column: auto; }
  .segmented-control { flex-wrap: wrap; }
  .segmented-control label:last-child { flex-basis: 100%; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions .primary-button { width: 100%; }
  .results-header { align-items: start; flex-direction: column; gap: 20px; }
  .result-meta { padding-left: 12px; }
  .evidence-track { padding: 18px; grid-template-columns: 1fr; gap: 10px; }
  .track-intro { grid-column: auto; }
  .track-connector { display: none; }
  .track-item { padding: 7px 0; border-bottom: 1px solid #2d4960; }
  .track-item:last-child { border: 0; }
  .result-sidebar { grid-template-columns: 1fr; }
  .disease-card-header { padding: 17px; grid-template-columns: 1fr auto; gap: 10px; }
  .urgency-badge { grid-column: 1; grid-row: 2; justify-self: start; }
  .expand-icon { grid-column: 2; grid-row: 1 / 3; }
  .disease-card-body { padding: 0 17px 18px; }
  .disease-card-body-inner { grid-template-columns: 1fr; }
  .card-footer { grid-column: auto; align-items: flex-start; flex-direction: column; gap: 8px; }
  .category-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .detail-hero-top { flex-direction: column; }
  .detail-content { grid-template-columns: 1fr; }
  .detail-section.full { grid-column: auto; }
  .detail-test { grid-template-columns: 1fr; gap: 5px; }
  .sources-title { margin-top: 12px; }
  .source-ledger > a, .demo-ledger-row, .textbook-ledger-row, .ledger-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .source-ledger > a > span, .demo-ledger-row > span, .textbook-ledger-row > span { text-align: left; }
  .disclaimer-block { padding: 27px 22px; }
  .site-footer { align-items: flex-start; flex-direction: column; gap: 5px; padding-inline: 20px; }
}

@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; }
}

@media print {
  body { background: white; }
  .site-header, .prototype-ribbon, .results-toolbar, .site-footer, .toast { display: none !important; }
  .view { display: none !important; }
  #view-results { display: block !important; }
  .results-shell { max-width: none; padding: 0; }
  .disease-card-body { display: block !important; }
  .results-grid { grid-template-columns: 220px 1fr; }
  .result-sidebar { position: static; }
}
