/* ndph.org headache checker — mobile-first, no build step, no external requests.
   The palette is defined once on :root and re-declared for dark, so a single
   token change moves the whole product. */

:root {
  color-scheme: light dark;

  /* Taken from ndph.org's own :root, so the checker reads as part of the
     site rather than a separate product bolted onto a subdomain. */
  --accent:      #6b8478;   /* sage */
  --accent-2:    #c08552;   /* amber */
  --accent-ink:  #ffffff;

  --bg:          #f6f1e8;
  --bg-2:        #fbf6ec;
  --surface:     #fbf6ec;
  --surface-2:   #efe7d7;
  --line:        #e4dccd;
  --line-strong: #d2c7b2;

  --ink:         #2a2e2c;
  --ink-2:       #5c625e;
  --ink-3:       #8a8f8b;

  --danger:      #a8453c;
  --danger-bg:   #f7e3dd;
  --warn:        #b06f2e;
  --warn-bg:     #f7ead6;
  --caution:     #8a6b34;
  --caution-bg:  #f3ecda;
  --ok:          #4a7a5e;
  --ok-bg:       #e4ede6;
  --info:        #4d6a84;
  --info-bg:     #e5ecf1;

  --radius:      18px;
  --radius-sm:   12px;
  --shadow:      0 1px 2px rgba(16,25,42,.06), 0 8px 28px -12px rgba(16,25,42,.18);
  --shadow-lg:   0 2px 6px rgba(16,25,42,.07), 0 24px 60px -24px rgba(16,25,42,.32);

  --max:         46rem;
  --pad:         1.15rem;

  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
          "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent:      #93b0a1;
    --accent-2:    #d9a273;
    --accent-ink:  #191b19;

    --bg:          #191b19;
    --bg-2:        #1f221f;
    --surface:     #242724;
    --surface-2:   #2c302c;
    --line:        #383c37;
    --line-strong: #4a4f49;

    --ink:         #ece7dc;
    --ink-2:       #b5b9b1;
    --ink-3:       #888d85;

    --danger:      #e8938a;
    --danger-bg:   #2e1c19;
    --warn:        #e0a969;
    --warn-bg:     #2d2214;
    --caution:     #d6bd85;
    --caution-bg:  #2a2517;
    --ok:          #8cc0a1;
    --ok-bg:       #1a2a20;
    --info:        #9db8cc;
    --info-bg:     #1c2630;

    --shadow:      0 1px 2px rgba(0,0,0,.5), 0 10px 30px -14px rgba(0,0,0,.8);
    --shadow-lg:   0 2px 8px rgba(0,0,0,.55), 0 28px 70px -28px rgba(0,0,0,.9);
  }
}

/* Explicit override beats the media query in both directions. */
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"]  { color-scheme: dark; }

html[data-theme="dark"] {
  --accent:#93b0a1; --accent-2:#d9a273; --accent-ink:#191b19;
  --bg:#191b19; --bg-2:#1f221f; --surface:#242724; --surface-2:#2c302c;
  --line:#383c37; --line-strong:#4a4f49;
  --ink:#ece7dc; --ink-2:#b5b9b1; --ink-3:#888d85;
  --danger:#e8938a; --danger-bg:#2e1c19; --warn:#e0a969; --warn-bg:#2d2214;
  --caution:#d6bd85; --caution-bg:#2a2517; --ok:#8cc0a1; --ok-bg:#1a2a20;
  --info:#9db8cc; --info-bg:#1c2630;
  --shadow:0 1px 2px rgba(0,0,0,.5), 0 10px 30px -14px rgba(0,0,0,.8);
  --shadow-lg:0 2px 8px rgba(0,0,0,.55), 0 28px 70px -28px rgba(0,0,0,.9);
}
html[data-theme="light"] {
  --accent:#6b8478; --accent-2:#c08552; --accent-ink:#ffffff;
  --bg:#f6f1e8; --bg-2:#fbf6ec; --surface:#fbf6ec; --surface-2:#efe7d7;
  --line:#e4dccd; --line-strong:#d2c7b2;
  --ink:#2a2e2c; --ink-2:#5c625e; --ink-3:#8a8f8b;
  --danger:#a8453c; --danger-bg:#f7e3dd; --warn:#b06f2e; --warn-bg:#f7ead6;
  --caution:#8a6b34; --caution-bg:#f3ecda; --ok:#4a7a5e; --ok-bg:#e4ede6;
  --info:#4d6a84; --info-bg:#e5ecf1;
}

*, *::before, *::after { box-sizing: border-box; }

/* A declared display value beats the UA sheet's [hidden] rule, which silently
   un-hides anything given display:grid or display:flex. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(70rem 40rem at 78% -12%, color-mix(in oklab, var(--accent) 10%, transparent), transparent 62%),
    radial-gradient(60rem 34rem at 6% -6%, color-mix(in oklab, var(--accent-2) 8%, transparent), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 { line-height: 1.22; letter-spacing: -0.018em; margin: 0 0 .5rem; }
h1, h2, .dx-name, .brand-name {
  font-family: var(--font-display);
  letter-spacing: -0.012em;
}
h1 { font-size: clamp(1.85rem, 6.4vw, 2.85rem); font-weight: 780; }
h2 { font-size: clamp(1.35rem, 4.6vw, 1.75rem); font-weight: 720; }
h3 { font-size: 1.06rem; font-weight: 680; }
p  { margin: 0 0 .85rem; }

svg { width: 100%; height: 100%; }
.icon-btn svg, .btn-icon, .feature-icon svg, .disclaimer-icon, .emergency-icon {
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: .7rem 1rem; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2.5px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------------- top bar ---------------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem var(--pad);
  padding-top: calc(.6rem + env(safe-area-inset-top));
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; display: block; }
.brand-name { font-weight: 730; letter-spacing: -0.02em; font-size: 1.1rem; }

.topbar-actions { display: flex; align-items: center; gap: .45rem; }

.lang-select select {
  font: inherit; font-size: .85rem; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: .38rem 1.8rem .38rem .7rem;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px; padding: 8px;
  color: var(--ink-2); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
}
.icon-btn:hover { color: var(--ink); }
.icon-moon { display: none; }
@media (prefers-color-scheme: dark) { .icon-sun { display: none; } .icon-moon { display: block; } }
html[data-theme="dark"]  .icon-sun  { display: none; }
html[data-theme="dark"]  .icon-moon { display: block; }
html[data-theme="light"] .icon-sun  { display: block; }
html[data-theme="light"] .icon-moon { display: none; }

/* ---------------- layout ---------------- */

main { display: block; }

.screen {
  display: none;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.6rem var(--pad) 3rem;
}
/* No fill-mode: if animations are suppressed - a backgrounded tab, a reduced
   motion setting, an odd browser - the content must still be visible. */
.screen-active { display: block; animation: rise .38s cubic-bezier(.22,.7,.3,1); }
.screen-center { min-height: 68vh; display: none; place-items: center; }
.screen-center.screen-active { display: grid; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .screen-active { animation: none; }
  * { transition-duration: .01ms !important; }
}

/* ---------------- hero ---------------- */

.hero { text-align: center; padding: 1.4rem 0 2.2rem; }

.eyebrow {
  display: inline-block;
  font-size: .74rem; font-weight: 640; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--accent) 26%, transparent);
  border-radius: 999px; padding: .28rem .8rem; margin-bottom: 1.1rem;
}

.hero-title {
  background: linear-gradient(135deg, var(--ink), color-mix(in oklab, var(--accent) 62%, var(--ink)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub {
  color: var(--ink-2); font-size: 1.06rem;
  max-width: 34rem; margin: .9rem auto 1.7rem;
}
.hero-note { color: var(--ink-3); font-size: .86rem; margin-top: .9rem; }

/* ---------------- buttons ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-weight: 620; line-height: 1.2;
  padding: .78rem 1.25rem;
  border-radius: 999px; border: 1px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease;
  min-height: 46px;
}
.btn:active { transform: translateY(1px) scale(.995); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-icon { width: 19px; height: 19px; flex: none; }

.btn-primary {
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 20px -8px color-mix(in oklab, var(--accent) 70%, transparent);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 28px -8px color-mix(in oklab, var(--accent) 78%, transparent); }

.btn-ghost {
  color: var(--ink-2); background: var(--surface); border-color: var(--line-strong);
}
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); }

.btn-danger { color: #fff; background: #c02a34; }

.btn-lg { font-size: 1.06rem; padding: .95rem 1.75rem; min-height: 54px; }
.btn-wide { width: 100%; }

.linkish {
  font: inherit; font-size: .92rem; font-weight: 560;
  color: var(--accent); background: none; border: 0; padding: .5rem;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}

/* ---------------- cards ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow);
}

.cards-3 { display: grid; gap: .85rem; margin-bottom: 1.6rem; }
@media (min-width: 46rem) { .cards-3 { grid-template-columns: repeat(3, 1fr); } }

.feature h3 { margin-bottom: .3rem; }
.feature p { color: var(--ink-2); font-size: .93rem; margin: 0; }
.feature-icon {
  width: 38px; height: 38px; padding: 8px; margin-bottom: .7rem;
  color: var(--accent);
  background: color-mix(in oklab, var(--accent) 13%, transparent);
  border-radius: 11px;
}

/* ---------------- disclaimer ---------------- */

.disclaimer {
  display: flex; gap: .8rem; align-items: flex-start;
  background: var(--caution-bg);
  border: 1px solid color-mix(in oklab, var(--caution) 34%, transparent);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  color: var(--ink-2); font-size: .92rem; line-height: 1.55;
}
.disclaimer strong { color: var(--ink); display: block; margin-bottom: .18rem; }
.disclaimer-icon { width: 22px; height: 22px; flex: none; color: var(--caution); margin-top: .1rem; }

/* ---------------- steps ---------------- */

.step-head { margin-bottom: 1.4rem; }
.step-sub { color: var(--ink-2); margin: 0; }
.step-count {
  font-size: .76rem; font-weight: 620; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); margin: .85rem 0 .3rem;
}

.progress-track {
  height: 5px; border-radius: 999px; background: var(--surface-2);
  overflow: hidden; border: 1px solid var(--line);
}
.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  transition: width .45s cubic-bezier(.22,.7,.3,1);
}

.step-nav {
  display: flex; gap: .7rem; margin-top: 1.6rem;
}
.step-nav .btn { flex: 1; }
@media (min-width: 34rem) { .step-nav { justify-content: flex-end; } .step-nav .btn { flex: 0 0 auto; min-width: 9rem; } }

.skip-hint { text-align: center; margin-top: .6rem; }

/* ---------------- uploader ---------------- */

.upload-actions { display: grid; gap: .65rem; margin-bottom: 1.1rem; }
@media (min-width: 34rem) { .upload-actions { grid-template-columns: 1fr 1fr; } }

.thumbs { list-style: none; display: grid; gap: .7rem; padding: 0; margin: 0 0 1.1rem; }
@media (min-width: 30rem) { .thumbs { grid-template-columns: repeat(3, 1fr); } }

.thumb {
  position: relative; aspect-ratio: 1;
  border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--line); background: var(--surface-2);
  box-shadow: var(--shadow);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-remove {
  position: absolute; top: .4rem; right: .4rem;
  width: 30px; height: 30px; padding: 6px;
  color: #fff; background: rgba(12,18,30,.66); backdrop-filter: blur(6px);
  border: 0; border-radius: 999px; cursor: pointer; line-height: 0;
}
.thumb-remove svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.thumb-meta {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: .7rem; color: #fff; padding: .8rem .5rem .35rem;
  background: linear-gradient(transparent, rgba(8,12,20,.78));
}

.tips { border-top: 1px solid var(--line); padding-top: .9rem; }
.tips summary {
  cursor: pointer; font-weight: 600; font-size: .93rem; color: var(--accent);
  list-style: none;
}
.tips summary::-webkit-details-marker { display: none; }
.tips summary::before { content: "＋ "; font-weight: 700; }
.tips[open] summary::before { content: "－ "; }
.tips ul { color: var(--ink-2); font-size: .9rem; padding-left: 1.1rem; margin: .7rem 0 0; }
.tips li { margin-bottom: .45rem; }

/* ---------------- questionnaire ---------------- */

.q-form { display: grid; gap: 1.3rem; }

.q-block { }
.q-label { font-weight: 640; font-size: 1.04rem; display: block; margin-bottom: .2rem; }
.q-required { color: var(--accent); }
.q-help { color: var(--ink-3); font-size: .87rem; margin: 0 0 .7rem; }

.opts { display: grid; gap: .5rem; margin-top: .6rem; }
@media (min-width: 22rem) { .opts-dense { grid-template-columns: 1fr 1fr; } }
@media (min-width: 46rem) { .opts-dense { grid-template-columns: repeat(3, 1fr); } }
.opts-dense .opt { padding: .6rem .7rem; font-size: .89rem; line-height: 1.35; }
.opts-dense .opt-box { width: 18px; height: 18px; }

.opt {
  display: flex; align-items: center; gap: .7rem;
  padding: .72rem .9rem;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  font-size: .96rem;
}
.opt:hover { border-color: var(--line-strong); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }

.opt-box {
  width: 21px; height: 21px; flex: none;
  border: 2px solid var(--line-strong); background: var(--bg-2);
  display: grid; place-items: center;
  transition: border-color .15s ease, background .15s ease;
}
.opt-radio .opt-box { border-radius: 999px; }
.opt-check .opt-box { border-radius: 6px; }
.opt-box::after {
  content: ""; width: 9px; height: 9px; border-radius: inherit;
  background: var(--accent-ink); transform: scale(0);
  transition: transform .16s cubic-bezier(.3,1.4,.5,1);
}
.opt-check .opt-box::after {
  width: 11px; height: 11px; border-radius: 2px;
  clip-path: polygon(14% 46%, 0 60%, 40% 100%, 100% 22%, 86% 8%, 38% 70%);
}
.opt input:checked ~ .opt-box { border-color: var(--accent); background: var(--accent); }
.opt input:checked ~ .opt-box::after { transform: scale(1); }
.opt:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 8%, var(--surface));
}
.opt input:focus-visible ~ .opt-box { outline: 2.5px solid var(--accent-2); outline-offset: 2px; }

.opt-emergency:has(input:checked) {
  border-color: var(--danger);
  background: var(--danger-bg);
}
.opt-emergency:has(input:checked) .opt-box { border-color: var(--danger); background: var(--danger); }

textarea.q-text {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); padding: .8rem .9rem;
  min-height: 6.5rem; resize: vertical;
}
textarea.q-text:focus { border-color: var(--accent); }
.char-count { font-size: .78rem; color: var(--ink-3); text-align: right; margin: .25rem 0 0; }

.q-error { color: var(--danger); font-size: .87rem; margin: .45rem 0 0; }

/* ---------------- review ---------------- */

.review-card { margin-bottom: 1rem; }
.review-list { list-style: none; padding: 0; margin: 0 0 .8rem; }
.review-list li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .55rem 0; border-bottom: 1px solid var(--line);
  font-size: .92rem;
}
.review-list li:last-child { border-bottom: 0; }
.review-list dt, .review-key { color: var(--ink-3); flex: 1; }
.review-val { color: var(--ink); font-weight: 560; text-align: right; flex: 1; }

.consent-card { display: grid; gap: .85rem; margin-bottom: 1rem; }
.checkline { display: flex; gap: .7rem; align-items: flex-start; font-size: .93rem; color: var(--ink-2); cursor: pointer; }
.checkline input { width: 20px; height: 20px; margin: .15rem 0 0; flex: none; accent-color: var(--accent); }

.captcha-holder { display: flex; justify-content: center; min-height: 0; margin-bottom: .4rem; }
.captcha-note { text-align: center; color: var(--ink-3); font-size: .82rem; }
.error-line { color: var(--danger); text-align: center; font-size: .92rem; margin-top: .8rem; }

/* ---------------- working ---------------- */

.working { text-align: center; max-width: 26rem; }
.pulse { display: flex; gap: .5rem; justify-content: center; margin-bottom: 1.6rem; }
.pulse span {
  width: 13px; height: 13px; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  animation: bounce 1.25s infinite ease-in-out;
}
.pulse span:nth-child(2) { animation-delay: .16s; }
.pulse span:nth-child(3) { animation-delay: .32s; }
@keyframes bounce {
  0%, 70%, 100% { transform: translateY(0); opacity: .45; }
  35% { transform: translateY(-11px); opacity: 1; }
}
.working-sub { color: var(--ink-2); }

.stage-list { list-style: none; padding: 0; margin: 1.6rem 0 1rem; text-align: left; display: grid; gap: .55rem; }
.stage-list li {
  display: flex; align-items: center; gap: .7rem;
  color: var(--ink-3); font-size: .93rem;
  padding: .55rem .85rem; border-radius: var(--radius-sm);
  border: 1px solid transparent;
}
.stage-list li::before {
  content: ""; width: 9px; height: 9px; border-radius: 999px;
  background: var(--line-strong); flex: none;
  transition: background .3s ease, box-shadow .3s ease;
}
.stage-list li.active {
  color: var(--ink); background: var(--surface); border-color: var(--line);
}
.stage-list li.active::before {
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 22%, transparent);
}
.stage-list li.done { color: var(--ink-2); }
.stage-list li.done::before { background: var(--ok); }

/* ---------------- results ---------------- */

.urgency {
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  margin-bottom: 1.2rem;
  border: 1.5px solid;
  box-shadow: var(--shadow);
}
.urgency-emergency { background: var(--danger-bg);  border-color: var(--danger);  color: var(--danger); }
.urgency-urgent    { background: var(--warn-bg);    border-color: var(--warn);    color: var(--warn); }
.urgency-soon      { background: var(--caution-bg); border-color: var(--caution); color: var(--caution); }
.urgency-routine   { background: var(--ok-bg);      border-color: var(--ok);      color: var(--ok); }
.urgency-self_care { background: var(--info-bg);    border-color: var(--info);    color: var(--info); }

.urgency-top { display: flex; align-items: center; gap: .6rem; margin-bottom: .35rem; }
.urgency-dot { width: 11px; height: 11px; border-radius: 999px; background: currentColor; flex: none;
  box-shadow: 0 0 0 4px color-mix(in oklab, currentColor 24%, transparent); }
.urgency-label { font-size: .76rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.urgency h2 { color: var(--ink); margin-bottom: .3rem; }
.urgency p { color: var(--ink-2); margin: 0; font-size: .95rem; }

.result-section { margin-bottom: 1.5rem; }
.result-section > h3 {
  font-size: .78rem; font-weight: 680; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: .7rem;
}

.summary-card { font-size: 1.05rem; line-height: 1.62; }
.summary-card p:last-child { margin-bottom: 0; }

.dx { margin-bottom: .8rem; overflow: hidden; }
.dx-head { display: flex; align-items: flex-start; gap: .8rem; justify-content: space-between; }
.dx-name { font-weight: 680; font-size: 1.06rem; margin: 0; }
.dx-plain { color: var(--ink-3); font-size: .88rem; margin: .05rem 0 0; }
.dx-rank {
  font-size: .68rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: .22rem .55rem; border-radius: 999px; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.dx-rank-most_likely    { background: color-mix(in oklab, var(--accent) 15%, transparent); color: var(--accent); border-color: color-mix(in oklab, var(--accent) 34%, transparent); }
.dx-rank-cannot_exclude { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in oklab, var(--danger) 34%, transparent); }

.conf { margin: .85rem 0 .2rem; }
.conf-track { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.conf-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0; transition: width .8s cubic-bezier(.22,.7,.3,1); }
.conf-meta { display: flex; justify-content: space-between; font-size: .76rem; color: var(--ink-3); margin-top: .3rem; }

.dx-body { margin-top: .9rem; display: grid; gap: .8rem; font-size: .93rem; }
.dx-body h4 { font-size: .74rem; font-weight: 680; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 .2rem; }
.dx-body p { margin: 0; color: var(--ink-2); }
.dx-body ul { margin: .1rem 0 0; padding-left: 1.15rem; color: var(--ink-2); }
.dx-body li { margin-bottom: .3rem; }

.dx-toggle {
  font: inherit; font-size: .89rem; font-weight: 600; color: var(--accent);
  background: none; border: 0; padding: .55rem 0 0; cursor: pointer;
}

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.chip {
  font-size: .76rem; font-weight: 580;
  padding: .24rem .62rem; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.chip-warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in oklab, var(--warn) 32%, transparent); }

.flag-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.flag {
  display: flex; gap: .7rem; align-items: flex-start;
  background: var(--danger-bg); border: 1px solid color-mix(in oklab, var(--danger) 30%, transparent);
  border-radius: var(--radius-sm); padding: .75rem .9rem; font-size: .93rem;
}
.flag-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--danger); flex: none; margin-top: .5rem; }
.flag strong { display: block; color: var(--ink); }
.flag span { color: var(--ink-2); }

.obs-grid { display: grid; gap: .1rem; }
.obs-row { display: grid; grid-template-columns: 8.5rem 1fr; gap: .8rem; padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.obs-row:last-child { border-bottom: 0; }
.obs-row dt { color: var(--ink-3); }
.obs-row dd { margin: 0; color: var(--ink-2); }
@media (max-width: 30rem) { .obs-row { grid-template-columns: 1fr; gap: .1rem; } }

.abcde { display: grid; gap: .5rem; }
.abcde-row { display: flex; gap: .8rem; align-items: flex-start; padding: .6rem .75rem; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .92rem; }
.abcde-row.flagged { background: var(--warn-bg); }
.abcde-letter {
  width: 27px; height: 27px; flex: none; display: grid; place-items: center;
  border-radius: 8px; font-weight: 760; font-size: .88rem;
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--line);
}
.abcde-row.flagged .abcde-letter { background: var(--warn); color: #fff; border-color: transparent; }
.abcde-row b { color: var(--ink); font-weight: 620; }
.abcde-row span { color: var(--ink-2); }

.list-card ul { margin: 0; padding-left: 1.15rem; color: var(--ink-2); font-size: .95rem; }
.list-card li { margin-bottom: .45rem; }
.list-card li:last-child { margin-bottom: 0; }

.result-actions { display: grid; gap: .6rem; margin: 1.8rem 0 1.2rem; }
@media (min-width: 34rem) { .result-actions { grid-template-columns: 1fr 1fr; } }

.notice {
  border-radius: var(--radius-sm); padding: .85rem 1rem; font-size: .9rem;
  border: 1px solid; margin-bottom: 1rem;
}
.notice-info { background: var(--info-bg); border-color: color-mix(in oklab, var(--info) 30%, transparent); color: var(--ink-2); }
.notice-warn { background: var(--warn-bg); border-color: color-mix(in oklab, var(--warn) 32%, transparent); color: var(--ink-2); }
.notice strong { color: var(--ink); }

/* ---------------- emergency overlay ---------------- */

.emergency-overlay {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center; padding: var(--pad);
  background: rgba(8,12,20,.72); backdrop-filter: blur(6px);
}
.emergency-overlay[hidden] { display: none; }
.emergency-box {
  background: var(--surface); border-radius: var(--radius);
  border: 1.5px solid var(--danger);
  padding: 1.6rem 1.4rem; max-width: 30rem; text-align: center;
  box-shadow: var(--shadow-lg);
  animation: rise .3s cubic-bezier(.22,.7,.3,1);
}
.emergency-icon { width: 46px; height: 46px; color: var(--danger); margin-bottom: .6rem; }
.emergency-box h2 { color: var(--danger); }
.emergency-box > p { color: var(--ink-2); }
.emergency-reasons { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .4rem; }
.emergency-reasons li {
  background: var(--danger-bg); color: var(--ink);
  border-radius: var(--radius-sm); padding: .55rem .8rem; font-size: .9rem;
}
.emergency-actions { display: grid; gap: .4rem; margin-top: 1rem; }

/* ---------------- legal pages ---------------- */

.legal {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2rem var(--pad) 3rem;
}
.legal h1 { margin-bottom: .8rem; }

.legal-updated {
  font-size: .76rem; font-weight: 620; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: .4rem;
}
.legal-lede {
  font-size: 1.08rem; line-height: 1.6; color: var(--ink-2);
  padding-bottom: 1.4rem; margin-bottom: .6rem;
  border-bottom: 1px solid var(--line);
}

.legal-section { margin-top: 2rem; }
.legal-section h2 {
  font-size: 1.12rem; font-weight: 680;
  margin-bottom: .5rem;
}
.legal-section p { color: var(--ink-2); }
.legal-section p:last-child { margin-bottom: 0; }
.legal-section ul { color: var(--ink-2); padding-left: 1.2rem; margin: .3rem 0 0; }
.legal-section li { margin-bottom: .4rem; }

.legal-back { margin-top: 2.6rem; }

/* ---------------- flag banner and clarifiers ---------------- */

.flag-banner {
  border-radius: var(--radius); padding: 1.05rem 1.15rem; margin-bottom: 1.2rem;
  border: 1.5px solid; box-shadow: var(--shadow);
}
.flag-banner-emergency { background: var(--danger-bg);  border-color: var(--danger);  color: var(--danger); }
.flag-banner-urgent    { background: var(--warn-bg);    border-color: var(--warn);    color: var(--warn); }
.flag-banner-concern   { background: var(--caution-bg); border-color: var(--caution); color: var(--caution); }
.flag-banner h3 { color: var(--ink); font-size: 1.02rem; margin-bottom: .45rem; }
.flag-banner ul { margin: 0; padding-left: 1.15rem; color: var(--ink-2); font-size: .93rem; }
.flag-banner li { margin-bottom: .4rem; }
.flag-banner li b { color: var(--ink); font-weight: 620; }

.criteria { display: grid; gap: .3rem; margin-top: .2rem; }
.criterion { display: flex; gap: .55rem; align-items: flex-start; font-size: .9rem; color: var(--ink-2); }
.criterion::before { flex: none; margin-top: .05rem; font-weight: 700; }
.criterion-met::before { content: "\2713"; color: var(--ok); }
.criterion-against::before { content: "\2715"; color: var(--ink-3); }

.clarify {
  background: color-mix(in oklab, var(--accent) 7%, var(--surface));
  border: 1.5px solid color-mix(in oklab, var(--accent) 32%, transparent);
  border-radius: var(--radius); padding: 1.15rem; margin-bottom: 1.4rem;
}
.clarify h3 { margin-bottom: .3rem; }
.clarify-why { color: var(--ink-2); font-size: .93rem; margin-bottom: 1rem; }
.clarify-q { margin-bottom: 1.1rem; }
.clarify-q .q-label { font-size: .98rem; }
.clarify-note { color: var(--ink-3); font-size: .84rem; margin: .1rem 0 .5rem; }

/* ---------------- footer ---------------- */

.footer {
  max-width: var(--max); margin: 0 auto;
  padding: 2rem var(--pad) 3rem;
  border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: .84rem; text-align: center;
}
.footer-disclaimer { max-width: 38rem; margin: 0 auto .7rem; }
.footer-meta .dot, .footer-credit .dot, .footer-links .dot { margin: 0 .4rem; }

.footer-links { margin: .5rem 0 0; }
.footer-links a { color: var(--ink-2); text-decoration: none; }
.footer-links a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.footer-credit { margin: .55rem 0 0; }
.footer-credit strong { color: var(--ink-2); font-weight: 620; }
.footer-credit a { color: var(--accent); text-decoration: none; }
.footer-credit a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------------- print: the summary a visitor takes to an appointment --- */

@media print {
  .topbar, .result-actions, .step-nav, .emergency-overlay,
  .dx-toggle, .skip-hint { display: none !important; }

  /* The footer stays: a printout taken to an appointment should carry the
     disclaimer and say who made it. */
  .footer { border-top: 1px solid #bbb; margin-top: 1.5rem; }
  body { background: #fff; color: #000; }
  .screen { display: none !important; }
  #screen-result { display: block !important; max-width: none; padding: 0; }
  .card, .urgency { box-shadow: none; break-inside: avoid; border-color: #bbb; }
  /* Everything expands on paper: a printout is for the appointment, so the
     detail behind each "more detail" toggle has to be on it. */
  .dx-body[hidden] { display: grid !important; }
  a[href]::after { content: ""; }
}
