/* =====================================================================
   FOMOMD — styles.css
   Calm, clinical palette. Mobile-first. Light + dark themes.
   To change colours, edit the variables in :root below.
   ===================================================================== */

:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-2: #eef4f2;
  --ink: #12282f;
  --muted: #475e66;          /* 6.6:1 on white */
  --border: #d3dfdc;
  --primary: #0f766e;        /* 5.4:1 on white */
  --primary-strong: #0b5e58;
  --primary-ink: #ffffff;
  --primary-soft: #dff1ed;
  --accent: #9a4a07;         /* amber, 6:1 on white */
  --warn-bg: #fff4e5;
  --warn-ink: #7a3b00;
  --warn-border: #f2c48d;
  --info-bg: #e8f1fb;
  --info-ink: #173e66;
  --info-border: #b7d0ec;
  --focus: #2563eb;
  --shadow: 0 1px 2px rgba(18, 40, 47, .06), 0 6px 20px rgba(18, 40, 47, .07);
  --radius: 16px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;

  /* mascot */
  --m-ring: #14b8a6;
  --m-face: #f0fdfa;
  --m-ink: #12343b;
  --m-tube: #0f766e;

  /* category tags */
  --tag-clinical-bg: #dff1ed;   --tag-clinical-ink: #0b5049;
  --tag-surgical-bg: #fde8e4;   --tag-surgical-ink: #8a2a17;
  --tag-diagnostic-bg: #e6ecfb; --tag-diagnostic-ink: #26408b;
  --tag-preclinical-bg: #f1e9fb;--tag-preclinical-ink: #5b2d8f;
  --tag-public-bg: #fbf3d9;     --tag-public-ink: #6b4b00;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1a1e;
    --surface: #13262b;
    --surface-2: #19323a;
    --ink: #e6f0ee;
    --muted: #a8bdc2;
    --border: #2a444b;
    --primary: #2dd4bf;
    --primary-strong: #5eead4;
    --primary-ink: #04201d;
    --primary-soft: #133c3a;
    --accent: #fbbf24;
    --warn-bg: #3a2a12; --warn-ink: #fde0b3; --warn-border: #6b4a1b;
    --info-bg: #14283d; --info-ink: #cfe3f7; --info-border: #2d4d6e;
    --focus: #93c5fd;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    --m-face: #e6f6f3; --m-tube: #5eead4;
    --tag-clinical-bg: #133c3a;   --tag-clinical-ink: #a7f3e4;
    --tag-surgical-bg: #432019;   --tag-surgical-ink: #fecaca;
    --tag-diagnostic-bg: #1d2a4d; --tag-diagnostic-ink: #c7d6fb;
    --tag-preclinical-bg: #2f1f47;--tag-preclinical-ink: #e2d0fa;
    --tag-public-bg: #3b3013;     --tag-public-ink: #fbe6a2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0c1a1e;
    --surface: #13262b;
    --surface-2: #19323a;
    --ink: #e6f0ee;
    --muted: #a8bdc2;
    --border: #2a444b;
    --primary: #2dd4bf;
    --primary-strong: #5eead4;
    --primary-ink: #04201d;
    --primary-soft: #133c3a;
    --accent: #fbbf24;
    --warn-bg: #3a2a12; --warn-ink: #fde0b3; --warn-border: #6b4a1b;
    --info-bg: #14283d; --info-ink: #cfe3f7; --info-border: #2d4d6e;
    --focus: #93c5fd;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    --m-face: #e6f6f3; --m-tube: #5eead4;
    --tag-clinical-bg: #133c3a;   --tag-clinical-ink: #a7f3e4;
    --tag-surgical-bg: #432019;   --tag-surgical-ink: #fecaca;
    --tag-diagnostic-bg: #1d2a4d; --tag-diagnostic-ink: #c7d6fb;
    --tag-preclinical-bg: #2f1f47;--tag-preclinical-ink: #e2d0fa;
    --tag-public-bg: #3b3013;     --tag-public-ink: #fbe6a2;
    color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;          /* 17px */
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.3rem, 3.6vw, 1.6rem); }
h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
p { margin: 0 0 1rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.25rem; }
button { font: inherit; }
img { max-width: 100%; height: auto; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important; 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: 12px; top: -60px; z-index: 100;
  background: var(--primary); color: var(--primary-ink); padding: 10px 16px; border-radius: 8px;
}
.skip-link:focus { top: 12px; }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding-inline: 16px; }
main { flex: 1; padding-block: 16px 48px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }

/* ---------- Header / footer ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-height: 44px; }
.brand-mark { width: 34px; height: 34px; flex-shrink: 0; }
.bm-bg { fill: #0f766e; }
.bm-path { stroke: #ffffff; stroke-width: 2.6; stroke-linecap: round; fill: none; }
.bm-dot { fill: #ffffff; } .bm-dot-hi { fill: #fde68a; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 800; font-size: 1.1rem; letter-spacing: .02em; }
.brand-sub { font-size: .75rem; color: var(--muted); }
.header-note { font-size: .85rem; color: var(--muted); text-align: right; }
@media (max-width: 520px) { .header-note { display: none; } }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding-block: 16px; font-size: .9rem; color: var(--muted); }
.site-footer p { margin: 0 0 4px; }
.footer-meta { font-size: .82rem; }
.site-footer a { color: var(--primary); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 22px;
  border-radius: 999px; border: 2px solid transparent;
  font-weight: 650; cursor: pointer; text-decoration: none;
  transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: 0 4px 14px rgba(15,118,110,.25); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-secondary { background: var(--surface); color: var(--primary); border-color: var(--primary); }
.btn-secondary:hover { background: var(--primary-soft); }
.btn-ghost { background: transparent; color: var(--muted); padding-inline: 12px; }
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn-lg { min-height: 56px; padding-inline: 36px; font-size: 1.125rem; }
.btn-small { min-height: 44px; padding: 6px 16px; font-size: .92rem; font-weight: 600; background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.btn-small:hover { color: var(--ink); border-color: var(--primary); }

/* ---------- Cards & common ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 700; color: var(--primary); margin-bottom: .25rem; }
.lede { font-size: 1.125rem; color: var(--muted); }

.disclaimer {
  background: var(--surface-2); border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm); padding: 16px 18px; margin-block: 20px; font-size: .95rem;
}
.disclaimer p { margin: 0; }

/* ---------- Screen transitions ---------- */
.screen { animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Landing ---------- */
.hero { text-align: center; padding-block: 20px 8px; }
.hero-mascot .mascot { width: 110px; height: auto; }
.hero .lede { max-width: 36rem; margin-inline: auto; }
.app-title { font-size: clamp(2.2rem, 8vw, 3.2rem); letter-spacing: .02em; margin-bottom: .1rem; }
.tagline { font-size: clamp(1.15rem, 4vw, 1.4rem); font-weight: 700; color: var(--primary); margin-bottom: .75rem; }
.method-link { margin: 12px 0 0; }
.method-link a, .timestamp { color: var(--primary); font-weight: 600; }
.meta-list { list-style: none; padding: 0; margin: 20px auto 24px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.meta-list li { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: .95rem; }
.how { margin-top: 28px; }
.steps { padding-left: 1.4rem; }
.steps li { margin-bottom: .5rem; }
.never { background: var(--primary-soft); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0; }

/* ---------- Mascot ---------- */
.mascot .m-tube { stroke: var(--m-tube); }
.mascot .m-ear { fill: var(--m-tube); }
.mascot .m-ring { fill: var(--m-ring); }
.mascot .m-face { fill: var(--m-face); }
.mascot .m-eyes { fill: var(--m-ink); transform-origin: 50px 66px; animation: blink 5s infinite; }
.mascot .m-cheek { fill: #f472b6; opacity: .45; }
.mascot .m-smile { stroke: var(--m-ink); }
.mascot .m-grin { fill: var(--m-ink); display: none; }
.mascot[data-mood="happy"] .m-smile { display: none; }
.mascot[data-mood="happy"] .m-grin { display: inline; }
.mascot.bounce { animation: bounce .6s ease; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes bounce { 0%,100% { transform: translateY(0); } 35% { transform: translateY(-10px) rotate(-4deg); } 65% { transform: translateY(2px) rotate(2deg); } }

/* ---------- Progress ---------- */
.progress-wrap { margin-bottom: 16px; }
.progress-labels { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #14b8a6); border-radius: 999px; transition: width .45s ease; }
.progress-fill.pulse { animation: pulse .6s ease; }
@keyframes pulse { 0% { filter: brightness(1); } 40% { filter: brightness(1.35); } 100% { filter: brightness(1); } }

/* ---------- Round intro ---------- */
.round-card {
  text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px 20px; box-shadow: var(--shadow);
}
.round-mascot .mascot { width: 96px; height: auto; }
.round-card h2 { font-size: clamp(1.8rem, 6vw, 2.4rem); }
.round-count { color: var(--muted); font-size: .95rem; }

/* ---------- Question ---------- */
.q-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); transition: opacity .2s ease, transform .2s ease;
}
.q-card.leaving { opacity: 0; transform: translateX(-24px); }
.q-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.q-mascot { display: flex; align-items: center; gap: 10px; }
.q-mascot .mascot { width: 48px; height: auto; flex-shrink: 0; }
.bubble {
  position: relative; background: var(--primary-soft); color: var(--ink); font-size: .9rem;
  padding: 6px 12px; border-radius: 12px;
}
.bubble::before {
  content: ""; position: absolute; left: -6px; top: 50%; transform: translateY(-50%);
  border: 6px solid transparent; border-right-color: var(--primary-soft); border-left: 0;
}
.q-count { margin: 0; font-size: .9rem; color: var(--muted); font-weight: 600; }
.kind { color: var(--accent); }
.q-card h2 { margin-bottom: 18px; }

.options { display: grid; gap: 12px; }
.option {
  display: flex; align-items: flex-start; gap: 12px; text-align: left; width: 100%;
  min-height: 60px; padding: 16px; cursor: pointer;
  background: var(--surface); color: var(--ink);
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .15s ease, background-color .15s ease, transform .15s ease, opacity .25s ease, box-shadow .15s ease;
}
.option:hover { border-color: var(--primary); background: var(--primary-soft); }
.option:active { transform: scale(.98); }
.option.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.option.chosen { animation: chosen .45s ease; }
.option.dimmed { opacity: .5; }
@keyframes chosen { 0% { transform: scale(1); } 40% { transform: scale(1.03); } 100% { transform: scale(1); } }
.opt-key {
  flex-shrink: 0; width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 50%; background: var(--surface-2); color: var(--primary); font-weight: 800; font-size: .9rem;
}
.option.selected .opt-key { background: var(--primary); color: var(--primary-ink); }
.opt-text { padding-top: 2px; }

/* This-or-that: two big cards with an "or" divider */
.this-or-that .option { min-height: 96px; font-size: 1.05rem; }
.or {
  justify-self: center; font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 2px 12px;
}

/* Rooms: icon cards */
.rooms { grid-template-columns: 1fr; }
.rooms .option { flex-direction: column; gap: 2px; }
.room-icon { font-size: 1.8rem; line-height: 1.2; }
.room-title { font-weight: 700; }
.room-text { color: var(--muted); font-size: .95rem; }

/* Slider */
.slider-block { display: grid; gap: 12px; }
.helper { background: var(--info-bg); color: var(--info-ink); border-radius: var(--radius-sm); padding: 10px 14px; margin: 0; font-size: .95rem; }
.slider-value { justify-self: center; font-size: 2.5rem; font-weight: 800; color: var(--primary); line-height: 1; }
.slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; cursor: pointer; margin: 0;
}
.slider::-webkit-slider-runnable-track {
  height: 10px; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) var(--fill, 50%), var(--surface-2) var(--fill, 50%));
  border: 1px solid var(--border);
}
.slider::-moz-range-track { height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.slider::-moz-range-progress { height: 10px; border-radius: 999px; background: var(--primary); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 32px; height: 32px; margin-top: -12px; border-radius: 50%;
  background: var(--surface); border: 4px solid var(--primary); box-shadow: var(--shadow);
}
.slider::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--surface); border: 4px solid var(--primary); }
.slider-ends { display: flex; justify-content: space-between; gap: 16px; font-size: .9rem; color: var(--muted); }
.slider-ends span:last-child { text-align: right; }
.slider-block .btn { justify-self: center; min-width: 180px; }

.q-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; gap: 8px; }
.kbd-hint { display: none; margin: 8px 0 0; font-size: .8rem; color: var(--muted); text-align: center; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 10px 20px; border-radius: 999px; font-weight: 650;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 50;
  width: max-content; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Computing ---------- */
.computing { text-align: center; padding-block: 60px; }
.computing .mascot { width: 110px; height: auto; }
.dots { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); animation: dot 1s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: .15s; } .dots span:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }

/* ---------- Results ---------- */
.results-head { text-align: center; padding-block: 12px 4px; }
.results-mascot .mascot { width: 80px; height: auto; }
.soft-disclaimer { color: var(--muted); max-width: 34rem; margin-inline: auto; }
.results-intro { max-width: 36rem; margin-inline: auto; color: var(--ink); }
.results-intro a { color: var(--primary); font-weight: 600; }

.banners { display: grid; gap: 10px; margin-block: 16px; }
.banner { margin: 0; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid; font-size: .95rem; }
.banner-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-border); }
.banner-info { background: var(--info-bg); color: var(--info-ink); border-color: var(--info-border); }

.results-grid { display: grid; gap: 20px; margin-block: 20px; }
.result-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  animation: fadeUp .45s ease both;
}
.result-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--primary); }
.result-card.rank-2 { animation-delay: .08s; } .result-card.rank-2::before { background: #14b8a6; }
.result-card.rank-3 { animation-delay: .16s; } .result-card.rank-3::before { background: #5eaaa8; }
.result-card.honourable { margin-bottom: 20px; }
.result-card.honourable::before { background: var(--border); }

.rc-head { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; margin-bottom: 8px; }
.rc-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.band { display: inline-block; font-size: .82rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--primary); }
.band-strong { background: var(--primary); color: var(--primary-ink); }
.band-good { background: var(--primary-soft); color: var(--ink); }
.band-possible { background: var(--surface); color: var(--muted); border-color: var(--border); }
.stability { font-size: .9rem; color: var(--muted); margin: 0 0 4px; }
.notfit { border-left: 4px solid var(--info-border); padding-left: 12px; }
.notfit ul { padding-left: 1.1rem; }
.chips { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 12px; font-size: .92rem; }
.notme { margin-top: 16px; }
.notme-reply { margin: 10px 0 0; background: var(--primary-soft); border-radius: var(--radius-sm); padding: 10px 14px; }
.ignores summary { font-size: 1.05rem; }
.ignores ul { margin-top: 8px; }
.support { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; margin-top: 16px; }
.support a { color: var(--primary); font-weight: 700; }
.copy-fallback { display: grid; gap: 6px; margin-block: 8px 16px; }
.copy-fallback textarea { width: 100%; font: inherit; font-size: .9rem; padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--ink); }

/* Glossary (i) tips */
.terms { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: -6px 0 14px; }
.rc-section + .terms { margin-top: 10px; }
.term-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px 4px 6px; cursor: pointer;
  background: var(--surface); color: var(--primary); border: 1px dashed var(--primary); border-radius: 999px; font-size: .88rem; font-weight: 600;
}
.term-btn[aria-expanded="true"] { background: var(--primary-soft); border-style: solid; }
.term-i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--primary-ink); font-size: .78rem; font-weight: 800; font-style: italic; font-family: Georgia, serif; }
.term-def { flex-basis: 100%; margin: 0; background: var(--info-bg); color: var(--info-ink); border-radius: var(--radius-sm); padding: 8px 12px; font-size: .92rem; }

/* Method page */
.method h2 { margin-bottom: .75rem; }
.dims li { margin-bottom: .4rem; }
.sources-title { margin-top: 1.25rem; }
.sources { padding-left: 1.25rem; }
.sources p { margin: 0 0 .25rem; }
.citation { font-size: .9rem; color: var(--muted); font-style: italic; }
.label-warn { display: inline-block; background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-border); border-radius: 999px; padding: 2px 12px; font-weight: 700; font-size: .9rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.profiles { border-collapse: collapse; font-size: .85rem; width: 100%; }
.profiles caption { text-align: left; padding: 8px 10px; color: var(--muted); font-size: .85rem; }
.profiles th, .profiles td { padding: 5px 7px; border-bottom: 1px solid var(--border); text-align: center; white-space: nowrap; }
.profiles tbody th { text-align: left; position: sticky; left: 0; background: var(--surface); }
.profiles thead th { background: var(--surface-2); }
.profiles abbr { text-decoration: none; cursor: help; }
.rank-badge {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: var(--primary-ink); font-weight: 800; font-size: 1.05rem;
}
.rank-badge.small { background: var(--surface-2); color: var(--muted); }
.rc-titles h2 { margin-bottom: 4px; font-size: clamp(1.15rem, 3.8vw, 1.45rem); }
.rc-titles .eyebrow { margin: 0; }
.tag { display: inline-block; font-size: .8rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.tag-clinical { background: var(--tag-clinical-bg); color: var(--tag-clinical-ink); }
.tag-surgical { background: var(--tag-surgical-bg); color: var(--tag-surgical-ink); }
.tag-diagnostic { background: var(--tag-diagnostic-bg); color: var(--tag-diagnostic-ink); }
.tag-preclinical { background: var(--tag-preclinical-bg); color: var(--tag-preclinical-ink); }
.tag-public { background: var(--tag-public-bg); color: var(--tag-public-ink); }


.close-note { display: inline-block; background: var(--info-bg); color: var(--info-ink); border-radius: 999px; padding: 4px 12px; font-size: .88rem; font-weight: 600; margin-bottom: 8px; }
.rc-section { margin-top: 14px; }
.rc-section h3 { margin-bottom: 4px; font-size: .82rem; }
.rc-section p, .rc-section ul { margin-bottom: 0; }
.rc-section li { margin-bottom: 4px; }
.reality { background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: var(--radius-sm); padding: 12px 14px; }
.reality h3 { color: var(--warn-ink); }
.reality p { color: var(--warn-ink); }
.caution { margin: 12px 0 0; background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .95rem; }

details summary { cursor: pointer; font-weight: 650; color: var(--primary); min-height: 44px; display: flex; align-items: center; }
details[open] summary { margin-bottom: 4px; }

.snapshot .bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.bar-label { display: flex; justify-content: space-between; gap: 8px; font-size: .95rem; font-weight: 600; margin-bottom: 4px; }
.bar-word { color: var(--muted); font-weight: 500; }
.bar { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #14b8a6); border-radius: 999px; animation: grow .8s ease both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-block: 24px 12px; }
.actions .btn { flex: 1 1 180px; }

/* ---------- Share card ---------- */
.share-head { text-align: center; }
.share-layout { display: grid; gap: 20px; justify-items: center; margin-top: 12px; }
.story-card {
  width: min(100%, 360px); aspect-ratio: 9 / 16;
  background: linear-gradient(160deg, #0f766e 0%, #0b2f3a 100%);
  color: #ffffff; border-radius: 22px; padding: 22px 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; text-align: center; overflow: hidden; position: relative;
}
.story-card::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.06); top: -60px; right: -80px; }
.sc-top { align-self: stretch; text-align: left; display: flex; flex-direction: column; }
.sc-brand { font-weight: 800; font-size: 1.05rem; }
.sc-tag { font-size: .78rem; color: #b8e6df; }
.sc-mascot .mascot { width: 52px; height: auto; margin-top: 8px; --m-face: #f0fdfa; --m-tube: #e6f6f3; --m-ink: #12343b; }
.sc-label { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: #b8e6df; margin: 6px 0 2px; font-weight: 700; }
.sc-list { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 8px; width: 100%; counter-reset: sc; }
.sc-list li { counter-increment: sc; background: rgba(255,255,255,.12); border-radius: 14px; padding: 8px 10px; display: grid; gap: 4px; justify-items: center; }
.sc-list li::before { content: counter(sc); color: #fde68a; font-weight: 800; font-size: .8rem; }
.sc-name { font-size: 1.15rem; font-weight: 800; line-height: 1.15; }
.sc-band { background: #ffffff; color: #0b3b3a; border-radius: 999px; padding: 1px 10px; font-size: .72rem; font-weight: 700; }
.sc-verdict { color: #fde68a; font-weight: 800; font-style: italic; font-size: 1.15rem; margin: auto 0 4px; }
.sc-sub { font-size: .72rem; color: rgba(255,255,255,.85); margin: 0; }
.share-actions { display: grid; gap: 10px; width: min(100%, 360px); text-align: center; }
.generated { border-radius: 12px; border: 1px solid var(--border); max-width: 220px; justify-self: center; }

/* ---------- v1.2 results sections ---------- */
.section-title { margin-top: 28px; }
.section-intro { margin-top: -4px; }
.section-block { margin-top: 24px; }
.calm { background: var(--primary-soft); border-radius: var(--radius-sm); padding: 10px 14px; }
.thrives p { font-style: italic; }

.branch-panel { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 10px; background: var(--surface); }
.branch-panel > summary {
  padding: 12px 14px; border-radius: var(--radius-sm); cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  list-style: none; min-height: 48px;
}
.branch-panel > summary::-webkit-details-marker { display: none; }
.branch-panel > summary::after { content: "\25be"; color: var(--primary); font-size: 1.2rem; line-height: 1; transition: transform .2s ease; flex-shrink: 0; }
.branch-panel[open] > summary::after { transform: rotate(180deg); }
.branch-panel[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.bp-line { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bp-lead { font-size: .82rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.bp-name { font-weight: 700; color: var(--ink); }
.bp-body { padding: 4px 14px 16px; }
.fit-map > summary { min-height: 48px; display: flex; align-items: center; font-weight: 650; color: var(--primary); }
.fit-map-body { margin-top: 8px; }
.map-hidden-title { margin-top: 20px; text-transform: none; font-size: 1rem; color: var(--ink); }

.sl-picker > summary { min-height: 48px; display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--primary); }
.sl-count { color: var(--muted); font-weight: 500; font-size: .9rem; }
.sl-list { display: grid; gap: 2px; max-height: 320px; overflow-y: auto; margin: 8px 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; }
.sl-item { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 8px; border-radius: 8px; cursor: pointer; }
.sl-item:hover { background: var(--surface-2); }
.sl-item input { width: 20px; height: 20px; accent-color: var(--primary); flex-shrink: 0; }
.sl-all { border-bottom: 1px solid var(--border); font-weight: 700; margin-bottom: 4px; }
.sl-results { margin-top: 16px; }
.sl-results-title { text-transform: none; font-size: 1.1rem; color: var(--ink); }
.sl-results .btn { margin-top: 12px; }

.beta-tag { display: inline-block; background: var(--accent); color: #fff; border-radius: 999px; padding: 0 8px; font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.beta-note { font-style: italic; }

/* ---------- v1.3 availability, coverage, state-vs-trait ---------- */
.avail { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; border: 1px dashed var(--accent); color: var(--accent); }
.avail-restricted { border-style: solid; background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-border); }
.avail-note { background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 12px; font-size: .92rem; }
.avail-note.strong-note { background: var(--info-bg); color: var(--info-ink); border: 1px solid var(--info-border); }
.thin-note { color: var(--muted); font-size: .9rem; font-style: italic; margin: 0 0 12px; }
.state-trait { max-width: 34rem; margin: 0 auto 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; font-size: .95rem; }
.banner .btn-small { margin-left: 8px; vertical-align: middle; }

/* ---------- v1.4 outlook + aliases ---------- */
.outlook { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 12px; margin: 0 0 12px; font-size: .92rem; font-weight: 600; }
.also-called { color: var(--muted); font-size: .9rem; margin: 0 0 8px; }
.sl-alias { color: var(--muted); font-size: .85rem; }

/* ---------- v1.6 feedback block ---------- */
.feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 20px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.fb-title { margin: 0; font-weight: 650; }
.fb-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.fb-thanks { margin: 0; color: var(--muted); flex-basis: 100%; }
.fb-link { color: var(--primary); font-size: .92rem; text-decoration: underline; min-height: 44px; display: inline-flex; align-items: center; }
.fb-form { text-decoration: none; }

/* ---------- Small phones (360px) ---------- */
@media (max-width: 380px) {
  .card, .q-card, .result-card, .round-card { padding: 16px; }
  .option { padding: 12px; }
  .actions .btn { flex-basis: 100%; }
  .brand-sub { font-size: .7rem; }
}

/* ---------- Larger screens ---------- */
@media (min-width: 640px) {
  .card, .q-card, .result-card { padding: 28px; }
  .this-or-that { grid-template-columns: 1fr auto 1fr; align-items: stretch; }
  .this-or-that .or { align-self: center; }
  .rooms { grid-template-columns: repeat(2, 1fr); }
  .kbd-hint { display: block; }
}
@media (min-width: 900px) {
  .share-layout { grid-template-columns: auto 320px; align-items: start; justify-content: center; }
}
@media (hover: none) { .kbd-hint { display: none !important; } }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

/* ---------- Print ---------- */
@media print {
  :root { color-scheme: light; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .no-print, .terms, .site-header, .toast, .skip-link, .results-mascot, .q-nav { display: none !important; }
  main { padding: 0; }
  .result-card, .card { box-shadow: none; border: 1px solid #999; break-inside: avoid; page-break-inside: avoid; animation: none; }
  .reality { background: #fff; border-color: #999; }
  .reality h3, .reality p { color: #000; }
  details > *:not(summary) { display: block; }
  .bar-fill { animation: none; background: #333; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .band { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
