:root {
  --bg:          #F3F4F2;
  --surface:     #FFFFFF;
  --stone:       #9E9C8F; /* borders, dividers only, never text */
  --rust:        #C95140; /* primary buttons, active selection */
  --teal:        #164A59; /* headings, body text */
  --copper:      #DCAC7F;
  --rust-text:   #A8432F;
  --muted-text:  #6B6A60;
  --footer-text: #A9CFDB;
  --rust-tint:   #FBEDEA;
  --copper-tint: #F6EADF;
  --gutter: 16px;
  --radius: 12px;
  --tap: 48px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--teal);
  font-family: var(--font); font-size: 18px; line-height: 1.5;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0 0 16px; }
h1:focus { outline: none; }
a { color: var(--rust-text); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 10; background: var(--teal); color: #fff; padding: 10px 14px; border-radius: 8px; }
.skip-link:focus { top: 8px; }

/* ---------- Brand band ---------- */
.brand-band {
  background: var(--surface); display: flex; justify-content: center;
  padding: calc(16px + env(safe-area-inset-top)) var(--gutter) 16px;
  border-bottom: 1px solid var(--stone);
}
.logo-link { display: inline-block; padding: 4px; text-decoration: none; }
.logo { display: block; width: 220px; max-width: 100%; height: auto; }

/* ---------- Layout ---------- */
main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; }
.screen { padding: 28px var(--gutter) 48px; }
.lead { font-size: 19px; }
.subhead { font-size: 21px; line-height: 1.4; }
.small { font-size: 16px; color: var(--muted-text); }
.stack { display: grid; gap: 12px; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--stone); border-radius: var(--radius); padding: 20px; margin: 0 0 16px; }

/* ---------- Buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 56px; padding: 12px 20px;
  border-radius: var(--radius); font: inherit; font-size: 19px; font-weight: 700;
  text-align: center; text-decoration: none; cursor: pointer; border: 2px solid transparent;
}
.btn-primary { background: var(--rust); color: #fff; }
.btn-primary:hover { background: #B44736; }
.btn-secondary { background: var(--surface); color: var(--teal); border-color: var(--teal); }
.btn-secondary:hover { background: var(--teal); color: #fff; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--rust-text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; }

/* ---------- Welcome ---------- */
.screen-welcome { padding-top: 0; }

/* Hero: the homepage's black-and-white walking video, full width, darkened toward the bottom so white text reads. */
.hero {
  position: relative; overflow: hidden; background: #222;
  width: 100vw; margin-left: calc(50% - 50vw);
  min-height: max(560px, 78vh); display: flex; align-items: flex-end;
}
.hero-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(rgba(0,0,0,0.12) 0%, rgba(0,0,0,0.30) 40%, rgba(0,0,0,0.82) 100%);
}
.hero-content { position: relative; z-index: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 32px var(--gutter) 36px; color: #fff; }
.hero .notice { color: var(--teal); }

.title-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 12px; }
.app-icon { flex: none; width: 36px; height: 36px; border-radius: 9px; border: 1px solid rgba(255,255,255,0.5); }
.screen-welcome h1 { font-size: min(28px, calc((100vw - 86px) / 12.6)); font-weight: 600; white-space: nowrap; margin: 0; color: #fff; }
.screen-welcome .subtitle { font-size: 20px; font-weight: 600; color: var(--copper); text-align: center; margin: 4px 0 18px; }
.screen-welcome .subhead { text-align: center; margin-bottom: 28px; color: #F1EEE9; }
.screen-welcome .btn { width: fit-content; min-width: 240px; padding: 12px 40px; margin: 0 auto; }
.screen-welcome .lead { text-align: center; color: #F1EEE9; }
.screen-welcome .stack { justify-items: center; }
.hero .btn-secondary { background: transparent; color: #fff; border-color: #fff; }
.hero .btn-secondary:hover { background: #fff; color: var(--teal); }
.reassure { text-align: center; font-size: 15px; color: #E7E3DC; margin: 12px 0 0; }
.screen-welcome .definition { margin: 28px var(--gutter) 0; }
.screen-welcome { padding-left: 0; padding-right: 0; }

.definition { margin-top: 28px; background: var(--surface); border-left: 4px solid var(--copper); border-radius: 8px; padding: 14px 16px; }
.definition p { margin: 0; font-size: 16px; }
.definition p + p { margin-top: 8px; }
.definition .term { font-weight: 700; }
.definition .pos { font-style: italic; color: var(--muted-text); }

/* ---------- Forms ---------- */
.field { margin: 0 0 22px; border: 0; padding: 0; }
label, legend { display: block; font-weight: 600; margin-bottom: 8px; }
input[type="text"], input[type="email"] {
  width: 100%; min-height: var(--tap); padding: 10px 14px; font: inherit; color: var(--teal);
  background: var(--surface); border: 2px solid var(--stone); border-radius: 10px;
}
input[type="text"]:focus, input[type="email"]:focus { border-color: var(--teal); }
input[aria-invalid="true"] { border-color: var(--rust); }
.consent {
  display: flex; align-items: flex-start; gap: 12px; min-height: var(--tap); padding: 10px 14px;
  background: var(--surface); border: 2px solid var(--stone); border-radius: 10px;
  font-weight: 500; font-size: 16px; cursor: pointer; margin: 0;
}
.consent input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--rust); flex: none; }
.field-error { color: var(--rust-text); font-size: 16px; font-weight: 600; margin: 8px 0 0; }
.error-summary { border: 2px solid var(--rust); background: var(--surface); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
.error-summary ul { margin: 0; padding-left: 20px; }
.error-summary p { margin-bottom: 8px; }
.privacy-note { font-size: 16px; color: var(--muted-text); margin-top: 16px; }

/* ---------- Check ---------- */
.progress { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 10px 0; margin: 0 0 4px; }
.progress-bar { height: 6px; border-radius: 3px; background: #E4E4DF; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--rust); transition: width 0.3s ease; }
.progress p { margin: 6px 0 0; font-size: 15px; color: var(--muted-text); }

.group { margin: 26px 0 8px; }
.group h2 { border-bottom: 1px solid var(--stone); padding-bottom: 6px; }
.group-note { font-size: 16px; color: var(--muted-text); margin: -4px 0 12px; }
.item { margin: 0 0 16px; padding: 14px; background: var(--surface); border-radius: var(--radius); border: 2px solid transparent; }
.item.invalid { border-color: var(--rust); }
.item legend { float: left; width: 100%; font-weight: 500; margin-bottom: 12px; }
.choice { clear: both; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.choice.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 380px) { .choice { grid-template-columns: 1fr 1fr; } .choice.three { grid-template-columns: 1fr 1fr 1fr; } }
.choice label {
  position: relative; margin: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: var(--tap); padding: 6px 4px; border: 2px solid var(--stone); border-radius: 10px;
  font-weight: 600; font-size: 15px; line-height: 1.2; cursor: pointer;
}
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice label:has(input:checked) { border-color: var(--rust); background: var(--rust-tint); }
.choice label:has(input:focus-visible) { outline: 3px solid var(--teal); outline-offset: 2px; }

/* ---------- Report ---------- */
.demo-note { font-size: 15px; background: var(--surface); border: 1px dashed var(--stone); border-radius: 8px; padding: 8px 12px; }
.screen-report h1 { margin-bottom: 4px; }
.screen-report > .small { margin-bottom: 20px; }

.summary { border: 2px solid var(--teal); }
.summary .eyebrow, .next-step .eyebrow { font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-text); font-weight: 700; margin-bottom: 6px; }
.summary h2 { font-size: 23px; }
.summary p:last-child { margin-bottom: 0; }

.gap-note { margin-top: 14px; padding-top: 14px; border-top: 1px solid #E4E4DF; font-size: 16px; }

.signals { list-style: none; margin: 0; padding: 0; }
.signals li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-top: 1px solid #E4E4DF; }
.signals li:first-child { border-top: 0; }
.signals .name { font-weight: 600; }
.signals .level { font-size: 15px; font-weight: 700; text-align: right; }
.signals .change { grid-column: 1 / -1; font-size: 14px; color: var(--muted-text); margin-top: -2px; }
.meter { display: inline-flex; gap: 4px; vertical-align: middle; margin-left: 8px; }
.meter i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--stone); display: block; }
.lvl-1 .meter i:nth-child(-n+1), .lvl-2 .meter i:nth-child(-n+2), .lvl-3 .meter i:nth-child(-n+3) { border-color: var(--rust); background: var(--rust); }
.lvl-1 .meter i:nth-child(1) { background: var(--teal); border-color: var(--teal); }
.lvl-1 .level { color: var(--teal); }
.lvl-2 .level, .lvl-3 .level { color: var(--rust-text); }
.legend { font-size: 14px; color: var(--muted-text); margin: 12px 0 0; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { position: relative; padding: 8px 0 8px 32px; border-top: 1px solid #E4E4DF; }
.list li:first-child { border-top: 0; }
.list li::before { position: absolute; left: 0; top: 9px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.list-in li::before { content: "✓"; background: var(--teal); color: #fff; }
.list-guess li::before { content: "?"; border: 2px solid var(--rust); color: var(--rust-text); }
.list-q li::before { content: "•"; font-size: 22px; top: 3px; }
.empty { color: var(--muted-text); margin: 0; }
.insight { background: var(--copper-tint); border-radius: 8px; padding: 12px 14px; font-weight: 600; margin: 14px 0 0; }

.next-step { border: 2px solid var(--rust); }
.next-step h2 { font-size: 22px; }
.next-step .btn { margin-top: 8px; }
.not-yet { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid #E4E4DF; font-size: 16px; }
.not-yet .link { font-weight: 600; }

.safety { border-left: 4px solid var(--rust); }
.safety h2 { font-size: 18px; }
.safety p { font-size: 16px; }
.safety p:last-child { margin-bottom: 0; }
.crisis { font-weight: 600; }

.report-actions { display: grid; gap: 10px; margin-top: 24px; }
.notice { background: var(--surface); border: 1px solid var(--stone); border-left: 4px solid var(--teal); border-radius: 8px; padding: 10px 14px; font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer { background: var(--teal); color: var(--footer-text); padding: 24px var(--gutter) calc(24px + env(safe-area-inset-bottom)); font-size: 15px; }
.site-footer p { max-width: 560px; margin: 0 auto 10px; }
.site-footer .clear-data { text-align: center; margin: 24px auto; }
.site-footer .clear-data a { color: #fff; display: inline-block; min-height: 44px; line-height: 44px; }
.site-footer .disclaimer { font-weight: 600; }
.site-footer .physician { font-weight: 600; white-space: nowrap; }
.site-footer .practice { margin-bottom: 0; }

/* ---------- Print: the report only ---------- */
@media print {
  @page { margin: 0.6in; }
  body { background: #fff; font-size: 11pt; display: block; min-height: 0; }
  .brand-band { border: 0; padding: 0 0 8pt; justify-content: flex-start; }
  .logo { width: 160px; }
  .skip-link, .no-print, .site-footer .clear-data { display: none !important; }
  .site-footer { background: none; color: #444; padding: 12pt 0 0; }
  .screen { padding: 0; }
  .card { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
