/* Biology Career Compass
   Palette borrows from the H&E stain: hematoxylin blue-violet and eosin pink. */

:root {
  --bg: #f6f5fa;
  --surface: #ffffff;
  --surface-2: #eeedf6;
  --ink: #1d1b30;
  --muted: #5e5b78;
  --line: #dcdae8;
  --hema: #3a3d8f;
  --hema-soft: #e3e4f6;
  --eosin: #c93a6e;
  --eosin-soft: #f9e1ea;
  --c-lab: #3a3d8f;
  --c-rehab: #c93a6e;
  --c-clinical: #1f7a6c;
  --c-research: #a8691a;
  --on-accent: #ffffff;
  --shadow: 0 1px 2px rgba(29, 27, 48, .06), 0 8px 24px rgba(29, 27, 48, .08);

  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --r: 10px;
  --gutter: clamp(16px, 4vw, 40px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #14131d;
    --surface: #1d1c29;
    --surface-2: #262436;
    --ink: #eceaf6;
    --muted: #a6a3c0;
    --line: #33314a;
    --hema: #a3a6f7;
    --hema-soft: #2a2b52;
    --eosin: #f27ba6;
    --eosin-soft: #3f2130;
    --c-lab: #a3a6f7;
    --c-rehab: #f27ba6;
    --c-clinical: #5cc8b5;
    --c-research: #e6b35a;
    --on-accent: #14131d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14131d;
  --surface: #1d1c29;
  --surface-2: #262436;
  --ink: #eceaf6;
  --muted: #a6a3c0;
  --line: #33314a;
  --hema: #a3a6f7;
  --hema-soft: #2a2b52;
  --eosin: #f27ba6;
  --eosin-soft: #3f2130;
  --c-lab: #a3a6f7;
  --c-rehab: #f27ba6;
  --c-clinical: #5cc8b5;
  --c-research: #e6b35a;
  --on-accent: #14131d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--hema); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--eosin); outline-offset: 2px; border-radius: 4px;
}
h1, h2, h3 { font-family: var(--f-display); line-height: 1.1; text-wrap: balance; margin: 0; letter-spacing: -.01em; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.25rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0; }
code { font-family: var(--f-mono); font-size: .85em; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1160px; margin-inline: auto; padding-inline: var(--gutter); }
.eyebrow { font-family: var(--f-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--eosin); }
.fine { font-size: .9rem; color: var(--muted); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 38% 38%, var(--hema) 0 30%, transparent 31%), var(--eosin-soft);
  border: 2px solid var(--eosin);
}
.brand-text { font-family: var(--f-display); font-weight: 800; font-size: 1.05rem; line-height: 1.1; display: flex; flex-direction: column; }
.brand-text small { font-family: var(--f-body); font-weight: 400; font-size: .72rem; color: var(--muted); }
.topnav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.topnav a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem; padding: 6px 10px; border-radius: 999px; }
.topnav a:hover { color: var(--ink); background: var(--surface-2); }


/* ---------- hero ---------- */
.hero { padding-block: clamp(32px, 6vw, 80px) 24px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: 20px 32px; align-items: center; }
.hero-copy { display: grid; gap: 20px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } .hero-art { display: none; } }
.hero h1 { font-size: clamp(2.3rem, 6.4vw, 4.4rem); font-weight: 800; letter-spacing: -.025em; max-width: 16ch; }
.hero .hl { color: var(--hema); }
.lede { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--muted); max-width: 60ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 1rem/1 var(--f-body); padding: 13px 20px; border-radius: 999px;
  text-decoration: none; border: 2px solid transparent; cursor: pointer; transition: transform .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--hema); color: var(--on-accent); }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { border-color: var(--hema); }
.hero-cats { grid-column: 1 / -1; list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.hero-cats a {
  display: grid; gap: 4px; padding: 14px 16px; border-radius: var(--r); text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--cat);
  height: 100%;
}
.hero-cats a:hover { border-color: var(--cat); }
.hero-cats strong { font-family: var(--f-display); font-size: 1.05rem; }
.hero-cats span { font-size: .9rem; color: var(--muted); }
.hero-cats em { font-style: normal; font-family: var(--f-mono); font-size: .75rem; color: var(--cat); }

/* category color hook */
[data-cat="lab"] { --cat: var(--c-lab); }
[data-cat="rehab"] { --cat: var(--c-rehab); }
[data-cat="clinical"] { --cat: var(--c-clinical); }
[data-cat="research"] { --cat: var(--c-research); }

/* ---------- sections ---------- */
.section { padding-block: clamp(40px, 6vw, 72px); display: grid; gap: 24px; }
.section-head { display: grid; gap: 8px; max-width: 70ch; }
.section-sub { color: var(--muted); }

/* ---------- ruler ---------- */
.ruler-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.ruler { min-width: 820px; padding: 16px 20px 8px; display: grid; gap: 0; }
.r-row { display: grid; grid-template-columns: 130px 1fr; align-items: stretch; border-bottom: 1px dashed var(--line); }
.r-label { font-family: var(--f-display); font-weight: 700; font-size: .92rem; color: var(--cat); padding: 12px 8px 12px 0; display: flex; align-items: center; }
.r-track { position: relative; min-height: 64px; }
.r-col { position: absolute; top: 8px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; padding-bottom: 8px; }
.r-dot {
  position: absolute; transform: translateX(-50%);
  animation: pop-in .4s cubic-bezier(.3, 1.5, .6, 1) both; animation-delay: calc(var(--i, 0) * 25ms);
  transition: background .15s ease, color .15s ease, transform .15s ease;
  display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer;
  font: 600 .78rem/1 var(--f-body); color: var(--ink); white-space: nowrap;
  background: var(--surface); padding: 5px 8px 5px 6px; border-radius: 999px; box-shadow: inset 0 0 0 1.5px var(--cat);
}
.r-dot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--cat); flex: none; }
.r-dot:hover, .r-dot:focus-visible { background: var(--cat); color: var(--on-accent); transform: translateX(-50%) scale(1.08); z-index: 2; }
.r-dot:hover::before { background: var(--on-accent); }
.r-axis { display: grid; grid-template-columns: 130px 1fr; padding-top: 6px; }
.r-ticks { position: relative; height: 28px; }
.r-tick { position: absolute; transform: translateX(-50%); font-family: var(--f-mono); font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.r-tick::before { content: ""; display: block; width: 1px; height: 6px; background: var(--muted); margin: 0 auto 3px; }
.r-axis-label { font-family: var(--f-mono); font-size: .72rem; color: var(--muted); align-self: start; }

/* ---------- explorer ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.search { flex: 1 1 260px; position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input { padding-left: 40px; }
.search input, .sort select {
  width: 100%; font: 400 1rem var(--f-body); color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 999px; padding: 11px 16px;
}
.search input:focus, .sort select:focus { border-color: var(--hema); outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: 600 .9rem/1 var(--f-body); padding: 9px 14px; border-radius: 999px; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--line);
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip[data-cat][aria-pressed="true"] { background: var(--cat); border-color: var(--cat); color: var(--on-accent); }
.sort { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }
.sort select { width: auto; padding-block: 9px; }
.count { font-size: .9rem; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.group-title { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 12px; margin-top: 12px; padding-bottom: 6px; border-bottom: 2px solid var(--cat); }
.group-title h3 { color: var(--cat); font-size: 1.3rem; }
.group-title span { color: var(--muted); font-size: .92rem; }
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
  animation: rise .45s ease both; animation-delay: calc(min(var(--i, 0), 12) * 30ms);
}
.card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; border-radius: var(--r) var(--r) 0 0; background: var(--cat); transform: scaleX(0); transform-origin: left; transition: transform .3s ease; }
.card:hover, .card:focus-within { border-color: var(--cat); transform: translateY(-3px); box-shadow: var(--shadow); }
.card:hover::before, .card:focus-within::before { transform: scaleX(1); }
.card-open {
  display: grid; grid-template-rows: auto auto 1fr auto auto; gap: 10px; text-align: left; width: 100%; height: 100%;
  background: none; border: 0; border-radius: var(--r); padding: 18px; cursor: pointer; font: inherit; color: inherit;
}
.card-top { padding-right: 40px; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cred { font-family: var(--f-mono); font-size: .75rem; color: var(--cat); background: color-mix(in srgb, var(--cat) 12%, transparent); padding: 3px 8px; border-radius: 4px; }
.yrs { font-family: var(--f-mono); font-size: .75rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.card-title { display: block; font-family: var(--f-display); font-weight: 700; font-size: 1.2rem; line-height: 1.15; }
.card-text { display: block; font-size: .95rem; color: var(--muted); }
.card-foot { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; font-weight: 600; }
.card-foot .deg { color: var(--ink); }
.card-foot .more { color: var(--hema); }
.empty { grid-column: 1 / -1; padding: 32px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); }

/* ---------- bio grad routes ---------- */
.routes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.route { transition: transform .2s ease, border-color .2s ease; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 8px; align-content: start; }
.route .time { font-family: var(--f-mono); font-size: .8rem; color: var(--eosin); }
.route h3 { font-size: 1.1rem; }
.route p { font-size: .95rem; color: var(--muted); }
.route button { justify-self: start; background: none; border: 0; padding: 0; color: var(--hema); font: 600 .9rem var(--f-body); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- quiz ---------- */
.quiz { display: grid; gap: 16px; }
.q { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 18px; margin: 0; min-width: 0; }
.q legend { font-family: var(--f-display); font-weight: 700; font-size: 1.1rem; padding: 0 6px; margin-left: -6px; }
.q-num { font-family: var(--f-mono); color: var(--eosin); font-size: .8rem; margin-right: 8px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; inset: 0; }
.opt span { display: inline-block; padding: 9px 14px; border-radius: 999px; border: 1.5px solid var(--line); cursor: pointer; font-weight: 600; font-size: .95rem; background: var(--bg); }
.opt input:checked + span { background: var(--hema); border-color: var(--hema); color: var(--on-accent); }
.opt input:focus-visible + span { outline: 3px solid var(--eosin); outline-offset: 2px; }
.quiz-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.quiz-results { display: grid; gap: 12px; }
.result { animation: rise .5s ease both; animation-delay: calc(var(--i, 0) * 120ms); display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--cat); border-radius: var(--r); padding: 16px 18px; }
.result .rank { font-family: var(--f-display); font-weight: 800; font-size: 1.8rem; color: var(--cat); font-variant-numeric: tabular-nums; }
.result h4 { font-family: var(--f-display); font-size: 1.15rem; margin: 0 0 4px; }
.result p { font-size: .92rem; color: var(--muted); }
@media (max-width: 560px) { .result { grid-template-columns: auto 1fr; } .result-actions { grid-column: 1 / -1; } }

/* ---------- resources ---------- */
.res-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.res-block { display: grid; gap: 8px; align-content: start; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.res-note { font-size: .9rem; color: var(--muted); }
.res-list { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 6px; }
.res-list li { display: flex; justify-content: space-between; gap: 12px; font-size: .95rem; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.res-list li:last-child { border-bottom: 0; }
.res-list small { color: var(--muted); font-size: .82rem; text-align: right; }

/* ---------- series ---------- */
.series-card {
  display: flex; flex-wrap: wrap; gap: 24px; align-items: end; justify-content: space-between;
  background: var(--hema-soft); border-radius: 16px; padding: clamp(20px, 4vw, 40px);
}
.series-card > div { display: grid; gap: 12px; max-width: 64ch; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); padding-block: 32px 48px; }
.footer .wrap { display: grid; gap: 8px; }

/* ---------- detail dialog ---------- */
.detail {
  width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 0;
  border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.detail::backdrop { background: rgba(20, 19, 29, .55); backdrop-filter: blur(3px); }
.detail-inner { display: grid; gap: 20px; padding: clamp(20px, 4vw, 36px); }
.d-head { display: grid; gap: 10px; border-top: 6px solid var(--cat); margin: calc(-1 * clamp(20px, 4vw, 36px)) calc(-1 * clamp(20px, 4vw, 36px)) 0; padding: clamp(20px, 4vw, 36px) clamp(20px, 4vw, 36px) 0; }
.d-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.d-cat { font-family: var(--f-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--cat); }
.close { border: 0; background: var(--surface-2); color: var(--ink); width: 36px; height: 36px; border-radius: 50%; font-size: 1.3rem; line-height: 1; cursor: pointer; flex: none; }
.d-head h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.d-tag { font-size: 1.08rem; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.fact { background: var(--bg); padding: 12px 14px; display: grid; gap: 2px; }
.fact dt { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fact dd { margin: 0; font-weight: 600; font-size: .95rem; }
.d-sec { display: grid; gap: 8px; }
.d-sec h3 { font-size: 1.05rem; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 8px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.steps li::before { content: counter(s); font-family: var(--f-mono); font-size: .8rem; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--cat) 15%, transparent); color: var(--cat); font-weight: 600; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links a { font-size: .9rem; font-weight: 600; text-decoration: none; padding: 8px 12px; border-radius: 999px; border: 1.5px solid var(--line); color: var(--ink); }
.links a:hover { border-color: var(--cat); color: var(--cat); }
.video-box { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; background: var(--eosin-soft); border-radius: var(--r); padding: 14px 16px; }
.video-box p { font-size: .95rem; }
.share { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.share code { user-select: all; }
.share button { font: 600 .8rem var(--f-body); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 5px 10px; cursor: pointer; }
.d-nav { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; }
.d-nav button { background: none; border: 0; color: var(--hema); font: 600 .92rem var(--f-body); cursor: pointer; padding: 4px 0; text-align: left; }
.d-nav button:last-child { text-align: right; }

/* =====================================================================
   Interactive layer: motion, theme toggle, shortlist, compare, quiz steps
   ===================================================================== */

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateX(-50%) scale(.6); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(var(--dx, 6px), var(--dy, -10px)); } }
@keyframes heart-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes bump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-6px); } }
@keyframes step-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }

.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--hema); color: var(--on-accent); padding: 10px 14px; border-radius: 8px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }

/* scroll progress */
.progress { position: fixed; inset: 0 0 auto; height: 3px; z-index: 30; transform-origin: left; transform: scaleX(0);
  background: linear-gradient(90deg, var(--hema), var(--eosin)); }

/* reveal on scroll (only when JS is running) */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.in { opacity: 1; transform: none; }

/* top bar actions */
.top-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; transition: border-color .15s ease, transform .2s ease; }
.icon-btn:hover { border-color: var(--hema); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#theme-toggle:active { transform: rotate(40deg); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
.menu-btn { display: none; }
.topnav a.active { color: var(--ink); background: var(--hema-soft); }
.topnav a { transition: background .15s ease, color .15s ease; }
.topbar-inner { position: relative; }
@media (max-width: 900px) {
  .menu-btn { display: grid; }
  .topnav {
    position: absolute; top: calc(100% + 1px); left: 0; right: 0; flex-direction: column; gap: 2px;
    padding: 10px var(--gutter) 16px; background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
    opacity: 0; transform: translateY(-8px); pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  }
  .topnav.open { opacity: 1; transform: none; pointer-events: auto; }
  .topnav a { padding: 12px 14px; font-size: 1rem; }
}

/* hero extras */
.hero h1 .hl { background: linear-gradient(90deg, var(--hema), var(--eosin)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 8px 0 0; max-width: 620px; }
.stats > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.stats dt { font-family: var(--f-mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-family: var(--f-display); font-weight: 800; font-size: clamp(1.5rem, 3vw, 2rem); color: var(--hema); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stats dd small { font-size: .9rem; font-weight: 700; color: var(--muted); }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.hero-art { position: relative; aspect-ratio: 1; width: 100%; max-width: 420px; justify-self: center; }
.cells { width: 100%; height: 100%; overflow: visible; }
.cells .cyto { fill: var(--eosin-soft); stroke: var(--eosin); stroke-width: 2; }
.cells .nuc { fill: var(--hema); opacity: .88; }
.cells .nucleolus { fill: var(--eosin-soft); opacity: .7; }
.cell { animation: float 7s ease-in-out infinite; transform-box: fill-box; }
.c2 { --dx: -8px; --dy: 8px; animation-duration: 6s; animation-delay: -2s; }
.c3 { --dx: 6px; --dy: 10px; animation-duration: 8s; animation-delay: -4s; }
.c4 { --dx: 10px; --dy: -6px; animation-duration: 5.5s; animation-delay: -1s; }
.c5 { --dx: -6px; --dy: -8px; animation-duration: 4.5s; }
.c6 { --dx: 5px; --dy: 7px; animation-duration: 5s; animation-delay: -3s; }
.compass {
  --angle: 35deg;
  position: absolute; left: 50%; top: 50%; width: 46%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(6px);
  border: 2px solid var(--line); box-shadow: var(--shadow);
  font-family: var(--f-mono); font-size: .62rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.compass::after { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); transform: translate(-50%, -50%); }
.needle {
  position: absolute; left: 50%; top: 50%; width: 10px; height: 72%; margin: -36% 0 0 -5px;
  transform: rotate(var(--angle)); transition: transform .8s cubic-bezier(.3, 1.6, .5, 1);
  background: linear-gradient(var(--eosin) 0 50%, var(--hema) 50% 100%);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.compass span:not(.needle) { position: absolute; }
.c-n { top: 8%; left: 50%; transform: translateX(-50%); }
.c-s { bottom: 8%; left: 50%; transform: translateX(-50%); }
.c-e { right: 6%; top: 50%; transform: translateY(-50%); }
.c-w { left: 6%; top: 50%; transform: translateY(-50%); }
.hero-cats a { transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.hero-cats a:hover, .hero-cats a:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow); }

/* year range filter */
.year-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: .95rem; color: var(--muted); }
.year-filter strong { color: var(--ink); }
.year-filter input[type="range"] {
  --fill: 100%; flex: 1 1 220px; max-width: 420px; height: 6px; border-radius: 999px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background: linear-gradient(90deg, var(--hema) var(--fill), var(--line) var(--fill));
}
.year-filter input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 3px solid var(--hema); box-shadow: var(--shadow); }
.year-filter input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 3px solid var(--hema); }

/* card meter + save heart */
.card-meter { display: block; height: 4px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.card-meter span { display: block; height: 100%; background: var(--cat); border-radius: inherit; }
.save {
  position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.save svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.save:hover { color: var(--eosin); border-color: var(--eosin); }
.save[aria-pressed="true"] { color: var(--eosin); border-color: var(--eosin); background: var(--eosin-soft); }
.save[aria-pressed="true"] svg { fill: currentColor; }
.save.pop svg { animation: heart-pop .35s ease; }
.save-lg, .result .save { position: static; }
.d-top-actions { display: flex; gap: 8px; align-items: center; }
.traits { display: flex; flex-wrap: wrap; gap: 6px; }
.trait { font-size: .8rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--cat) 12%, transparent); color: var(--cat); }

.route:hover { transform: translateY(-3px); border-color: var(--eosin); }

/* quiz steps */
.quiz-shell { display: grid; gap: 14px; max-width: 780px; }
.quiz-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.quiz-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--hema), var(--eosin)); transition: width .4s ease; }
.q.enter { animation: step-in .35s ease both; }
.q legend { font-size: 1.3rem; }
.opts { gap: 10px; }
.opt span { transition: background .15s ease, border-color .15s ease, transform .15s ease; padding: 12px 18px; font-size: 1rem; }
.opt:hover span { border-color: var(--hema); transform: translateY(-1px); }
.btn-link { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; padding-inline: 8px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.quiz-results h3 { font-size: 1.3rem; }
.result-actions { display: flex; gap: 8px; align-items: center; }
.fit { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.fit-bar { flex: 1; max-width: 240px; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.fit-bar span { display: block; height: 100%; width: var(--w); background: var(--cat); border-radius: inherit; animation: grow 1s ease both .2s; }
@keyframes grow { from { width: 0; } }
.fit-num { font-family: var(--f-mono); font-size: .75rem; color: var(--cat); }

/* how to choose */
.choose { list-style: none; margin: 0; padding: 0; counter-reset: ch; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.choose li { counter-increment: ch; position: relative; display: grid; gap: 8px; align-content: start; padding: 22px 18px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; transition: transform .2s ease, box-shadow .2s ease; }
.choose li:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.choose li::before { content: "0" counter(ch); font-family: var(--f-display); font-weight: 800; font-size: 2.6rem; line-height: 1; background: linear-gradient(135deg, var(--hema), var(--eosin)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.choose strong { font-family: var(--f-display); font-size: 1.1rem; }
.choose span { color: var(--muted); font-size: .95rem; }

/* shortlist tray */
.tray {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 25; transform: translateX(-50%);
  width: min(560px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 12px 40px rgba(20, 19, 29, .25); padding: 12px 14px;
}
.tray.bump { animation: bump .4s ease; }
.tray[hidden] { display: none; }
.tray-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tray-toggle { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--ink); font: 700 1rem var(--f-display); }
.tray-toggle .heart { color: var(--eosin); }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--eosin); color: var(--on-accent); font: 700 .75rem var(--f-mono); }
.tray-body { display: grid; gap: 10px; margin-top: 8px; }
.tray.collapsed .tray-body { display: none; }
.tray-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 30vh; overflow-y: auto; }
.tray-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; }
.tray-list li:hover { background: var(--surface-2); }
.tray-pick { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: .95rem; min-width: 0; }
.tray-pick input { accent-color: var(--hema); width: 18px; height: 18px; flex: none; }
.tray-pick .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cat); flex: none; }
.tray-pick input:disabled ~ span { opacity: .55; }
.tray-x { border: 0; background: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; width: 28px; height: 28px; border-radius: 50%; }
.tray-x:hover { background: var(--eosin-soft); color: var(--eosin); }
.tray-actions { display: flex; gap: 8px; }
.btn-sm { padding: 9px 16px; font-size: .9rem; }
body:has(.tray:not([hidden])) .footer { padding-bottom: 180px; }

/* back to top */
.to-top {
  position: fixed; right: 16px; bottom: 16px; z-index: 24; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; border: 0; cursor: pointer; background: var(--hema); color: var(--on-accent); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .25s ease, transform .25s ease;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
body:has(.tray:not([hidden])) .to-top { right: auto; left: 16px; }
html:has(.tray:not([hidden])) { scroll-padding-bottom: 220px; }
@media (min-width: 900px) {
  .tray { left: auto; right: 16px; transform: none; width: 340px; }
  html:has(.tray:not([hidden])) { scroll-padding-bottom: 16px; }
}

/* dialogs */
.detail[open] { animation: rise .3s ease; }
.detail::backdrop { animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; } }
.compare { width: min(1000px, calc(100vw - 24px)); }
.compare .d-top { align-items: start; }
.cmp-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
.cmp { width: 100%; min-width: calc(160px + var(--n) * 200px); border-collapse: collapse; font-size: .95rem; }
.cmp th, .cmp td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cmp tbody tr:last-child > * { border-bottom: 0; }
.cmp tbody th { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 500; background: var(--bg); width: 160px; }
.cmp thead th { border-top: 5px solid var(--cat); background: var(--surface); }
.cmp thead th button { background: none; border: 0; padding: 0; font: 700 1.1rem/1.2 var(--f-display); color: var(--ink); cursor: pointer; text-align: left; }
.cmp thead th button:hover { color: var(--cat); }
.cmp .d-cat { color: var(--cat); }
.cmp-years { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-bottom: 6px; }
.cmp-years span { display: block; height: 100%; background: var(--cat); border-radius: inherit; animation: grow .8s ease both; }

/* series card glow */
.series-card { position: relative; overflow: hidden; }
.series-card::after { content: ""; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--eosin) 30%, transparent), transparent 70%); pointer-events: none; }
[hidden] { display: none !important; }

/* start from your degree */
.degree-chips .chip[aria-pressed="true"] { background: var(--hema); border-color: var(--hema); color: var(--on-accent); }
.degree-panel { display: grid; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.degree-note { color: var(--muted); max-width: 75ch; }
.degree-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.degree-card {
  display: grid; gap: 4px; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--cat); border-radius: 8px; padding: 12px 14px;
  animation: rise .35s ease both; animation-delay: calc(var(--i, 0) * 40ms);
  transition: transform .15s ease, border-color .15s ease;
}
.degree-card:hover, .degree-card:focus-visible { transform: translateY(-2px); border-color: var(--cat); }
.degree-card .d-cat { color: var(--cat); font-size: .68rem; }
.degree-card strong { font-family: var(--f-display); font-size: 1.02rem; line-height: 1.2; }
.sub-head { margin-top: 24px; }
.h-sub { font-size: clamp(1.3rem, 2.4vw, 1.7rem); }
