/* ==========================================================================
   Eric Holland — site styles
   Clean clinical / academic: off-white ground, navy + teal accents,
   serif headings (Source Serif 4), Inter body.
   ========================================================================== */

:root {
    --artery: #b3312b;
    --bg: #f7f6f2;
    --bg-elev: #ffffff;
    --bg-soft: #eef1f4;
    --ink: #1c2530;
    --ink-2: #4a5665;
    --ink-3: #7b8794;
    --line: #dde3e9;
    --navy: #12365c;
    --navy-2: #1e4d80;
    --teal: #0f7c85;
    --teal-soft: #d9eff0;
    --amber: #b7791f;
    --amber-soft: #fbefd6;
    --red: #b5382f;
    --red-soft: #f8dfdc;
    --green: #2f7d4f;
    --green-soft: #dcefe2;
    --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
    --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(20, 30, 40, .06), 0 6px 20px -8px rgba(20, 30, 40, .12);
    --maxw: 1100px;

    /* diagram tokens */
    --map-fill: #e9eef3;
    --map-stroke: #b8c4d0;
    --map-hover: #cfe3e5;
    --node-root: #e3eaf2;
    --node-trunk: #d9eff0;
    --node-division: #f2f2f2;
    --node-cord: #fbefd6;
    --node-branch: #ffffff;
    --pill-navy-bg: #e3eaf2;
    --row-hover: #fafbfc;
    --code-bg: #182230;
    --code-ink: #e6edf3;

    color-scheme: light dark;
}

/* ---------- Dark mode (follows the OS / browser preference) ---------- */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12171d;
        --bg-elev: #1a2129;
        --artery: #e0564d;
        --bg-soft: #232c36;
        --ink: #e6ebf0;
        --ink-2: #b4bfca;
        --ink-3: #7f8b98;
        --line: #2c3742;
        --navy: #9dbbe0;
        --navy-2: #b9d0ec;
        --teal: #4fc0c9;
        --teal-soft: #163a3f;
        --amber: #e0a94a;
        --amber-soft: #3a2d14;
        --red: #f08a80;
        --red-soft: #3f1f1c;
        --green: #7fce9c;
        --green-soft: #17331f;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -10px rgba(0, 0, 0, .6);

        --map-fill: #2a3440;
        --map-stroke: #4a5866;
        --map-hover: #2f4a4e;
        --node-root: #2b3a4d;
        --node-trunk: #1f3d41;
        --node-division: #2a313a;
        --node-cord: #3d3320;
        --node-branch: #1f2730;
        --pill-navy-bg: #2b3a4d;
        --row-hover: #1f272f;
        --code-bg: #0d1218;
        --code-ink: #dfe6ee;
    }
    .brand-mark { background: #1e4d80; }
    .site-nav a.nav-accent.active, .btn { color: #0f1418; }
    .btn.secondary { color: var(--navy); }
    .btn:hover { color: #0f1418; }
    .mode-tabs button.active { color: #0f1418; }
    .region.correct { fill: #2f7d4f; }
    .region.wrong { fill: #b5382f; }
    .region.hl-2 { fill: #b7791f; }
    svg .px-node.correct { fill: #2f7d4f; }
    svg .px-node.wrong { fill: #b5382f; }
    svg .px-node.hl, svg .region.hl { fill: var(--teal); stroke: var(--navy-2); }
    svg .px-node.hl-soft { fill: var(--teal-soft); stroke: var(--teal); }
    svg .px-node.side.correct { fill: #2f7d4f; }
    svg .px-node.side.wrong { fill: #b5382f; }
    svg .px-node.side.hl { fill: var(--teal); stroke: var(--navy-2); }
    .prose img, .about-photo img { filter: brightness(.92); }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--serif);
    color: var(--navy);
    line-height: 1.2;
    margin: 0 0 .5rem;
    font-weight: 600;
    letter-spacing: -.005em;
}
h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
/* Blazor moves focus to the h1 after navigation (for screen readers); don't draw a focus box for it */
h1:focus, h1:focus-visible { outline: none; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.8rem); margin-top: 2rem; }
h3 { font-size: 1.2rem; margin-top: 1.5rem; }

p { margin: 0 0 1rem; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
a.muted { color: var(--ink-3); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }
html, body { overflow-x: hidden; max-width: 100%; }
@media (max-width: 600px) {
    .container { padding: 0 1rem; }
    .site-main { padding: 1.5rem 0 3rem; }
    .page-hero { margin-bottom: 1.25rem; }
    .lede { font-size: 1.05rem; }
    .question { font-size: 1.15rem; }
    .options { grid-template-columns: 1fr !important; }
    .card { padding: 1rem 1.1rem; }
    .scorebar { gap: .5rem .9rem; }
    .brand-sub { display: none; }
}

/* ---------- Header / nav ---------- */
.site { min-height: 100vh; display: flex; flex-direction: column; }
.site-header {
    background: var(--bg-elev);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 68px; position: relative; }
.brand { display: flex; align-items: center; gap: .75rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 40px; height: 40px; border-radius: 9px;
    background: var(--navy); color: #fff;
    display: grid; place-items: center;
    font-family: var(--serif); font-weight: 700; letter-spacing: .02em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; color: var(--navy); }
.brand-sub { font-size: .72rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }

.site-nav { display: flex; gap: .25rem; align-items: center; }
.site-nav a {
    padding: .5rem .85rem; border-radius: 999px;
    color: var(--ink-2); font-weight: 500; font-size: .95rem;
}
.site-nav a:hover { background: var(--bg-soft); text-decoration: none; color: var(--navy); }
.site-nav a.active { background: var(--teal-soft); color: var(--teal); }
.site-nav a.nav-accent { border: 1px solid var(--teal); color: var(--teal); }
.site-nav a.nav-accent.active { background: var(--teal); color: #fff; }
.site-nav a.nav-admin { color: var(--amber); }

.nav-toggle { display: none; background: none; border: 0; padding: .5rem; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--navy); margin: 5px 0; }

@media (max-width: 760px) {
    .nav-toggle { display: block; }
    .site-nav {
        display: none; position: absolute; right: 1.25rem; top: 64px;
        flex-direction: column; align-items: stretch;
        background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
        box-shadow: var(--shadow); padding: .5rem; min-width: 200px;
    }
    .site-nav.open { display: flex; }
    .site-nav a { border-radius: 8px; }
}

/* ---------- Main / footer ---------- */
.site-main { flex: 1; padding: 2.5rem 0 4rem; }
.site-footer { border-top: 1px solid var(--line); padding: 1.25rem 0; color: var(--ink-3); font-size: .875rem; background: var(--bg-elev); }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; }
.live-visitors { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 var(--green); animation: live-pulse 2.4s ease-out infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.footer-links a { margin-left: 1rem; color: var(--ink-2); }

/* ---------- Generic blocks ---------- */
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 600; color: var(--teal); margin-bottom: .5rem; }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: 62ch; }
.page-hero { padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: 2rem; }

.card {
    background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.25rem 1.4rem; box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.card-link { display: block; color: inherit; transition: transform .12s ease, box-shadow .12s ease; }
.card-link:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 10px 28px -10px rgba(18, 54, 92, .25); }
.card-link .arrow { color: var(--teal); font-weight: 600; }

.pill { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--bg-soft); color: var(--ink-2); }
.pill.teal { background: var(--teal-soft); color: var(--teal); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.navy { background: var(--pill-navy-bg); color: var(--navy); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red { background: var(--red-soft); color: var(--red); }

.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .55rem 1.1rem; border-radius: 8px; border: 1px solid var(--navy);
    background: var(--navy); color: #fff; font-weight: 600; font-size: .95rem;
    cursor: pointer; text-decoration: none; font-family: var(--sans);
    transition: background .12s ease;
}
.btn:hover { background: var(--navy-2); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--navy); }
.btn.secondary:hover { background: var(--bg-soft); }
.btn.teal { background: var(--teal); border-color: var(--teal); }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.small { padding: .35rem .75rem; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }

hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

/* ---------- Timeline (About page) ---------- */
.timeline { list-style: none; padding: 0; margin: 1.5rem 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 1.5rem 1.5rem; }
.timeline li::before {
    content: ""; position: absolute; left: -7px; top: .45rem;
    width: 12px; height: 12px; border-radius: 50%; background: var(--teal); border: 2px solid var(--bg);
}
.timeline .when { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; }
.timeline .what { font-family: var(--serif); font-size: 1.1rem; color: var(--navy); font-weight: 600; }

.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2.5rem; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- About page photos ---------- */
.hero-split { display: grid; grid-template-columns: 1.5fr 1fr; gap: 2.5rem; align-items: center; }
@media (max-width: 860px) { .hero-split { grid-template-columns: 1fr; } .hero-split .about-photo { max-width: 360px; } }
.about-photo { margin: 0; }
.about-photo img { display: block; width: 100%; height: auto; border-radius: 14px; box-shadow: var(--shadow); }
.about-photo figcaption { font-size: .8rem; color: var(--ink-3); margin-top: .5rem; }
.photo-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin: 1.5rem 0 .5rem; }
.photo-strip img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 10px; display: block; box-shadow: var(--shadow); }
@media (max-width: 600px) { .photo-strip { grid-template-columns: 1fr; } .photo-strip img { aspect-ratio: 16 / 9; } }
.timeline .thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; float: right; margin-left: .75rem; }

/* ---------- Blog ---------- */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.post-list h3 { margin: .25rem 0; }
.post-meta { font-size: .85rem; color: var(--ink-3); display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }

.prose { max-width: 72ch; }
.prose h2, .prose h3 { margin-top: 2rem; }
.prose img { max-width: 100%; border-radius: var(--radius); }
.prose blockquote { margin: 1.5rem 0; padding: .5rem 1.25rem; border-left: 3px solid var(--teal); background: var(--bg-elev); color: var(--ink-2); }
.prose code { font-family: var(--mono); font-size: .9em; background: var(--bg-soft); padding: .1em .35em; border-radius: 4px; }
.prose pre { background: var(--code-bg); color: var(--code-ink); padding: 1rem 1.25rem; border-radius: var(--radius); overflow-x: auto; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose table { border-collapse: collapse; width: 100%; margin: 1.25rem 0; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: .5rem .75rem; text-align: left; }
.prose th { background: var(--bg-soft); }
.prose details { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; margin: 1rem 0; background: var(--bg-elev); }
.prose summary { cursor: pointer; font-weight: 600; color: var(--navy); }

/* ---------- Forms (admin) ---------- */
.form-grid { display: grid; gap: 1rem; }
label.field { display: grid; gap: .35rem; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], textarea, select {
    width: 100%; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 8px;
    font: inherit; color: var(--ink); background: var(--bg-elev);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
textarea.editor { font-family: var(--mono); font-size: .9rem; min-height: 420px; line-height: 1.5; }
.editor-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .editor-split { grid-template-columns: 1fr; } }
.preview { border: 1px dashed var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; background: var(--bg-elev); min-height: 420px; overflow: auto; }
.alert { padding: .75rem 1rem; border-radius: 8px; font-size: .95rem; }
.alert.error { background: var(--red-soft); color: var(--red); }
.alert.ok { background: var(--green-soft); color: var(--green); }
.alert.info { background: var(--teal-soft); color: var(--teal); }

table.admin { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.admin th, table.admin td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.admin th { color: var(--ink-3); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }

.checkbox { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; }

/* ---------- Resources ---------- */
.resource { display: flex; gap: 1rem; align-items: flex-start; }
.resource .icon {
    flex: 0 0 44px; height: 44px; border-radius: 8px; background: var(--bg-soft);
    display: grid; place-items: center; font-family: var(--mono); font-size: .7rem; font-weight: 700; color: var(--navy);
    text-transform: uppercase;
}

/* ---------- Learn / games ---------- */
.learn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.learn-card .level { font-size: .75rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }

.game { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 2rem; align-items: start; min-width: 0; }
.game.wide-figure { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.game.extra-wide-figure { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.game.single { grid-template-columns: minmax(0, 1fr); }
.game > * { min-width: 0; }
@media (max-width: 900px) {
    .game, .game.wide-figure, .game.extra-wide-figure { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
    .game-panel { position: static; }
}

.game-panel { position: sticky; top: 90px; }
.game-figure { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; box-shadow: var(--shadow); }
.game-figure { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.game-figure svg { width: 100%; height: auto; max-height: 86vh; display: block; margin: 0 auto; }

/* Drag-to-pan (wwwroot/js/site.js). The panel becomes a fixed viewport you move the
   drawing inside, instead of a zoomed diagram pushing the whole page taller. */
.game-figure.pannable { overflow: auto; max-height: 86vh; cursor: grab; }
.game-figure.pannable.panning { cursor: grabbing; user-select: none; }
.game-figure.pannable.panning * { cursor: grabbing; }
/* Wide flow diagrams keep a legible minimum width and scroll sideways inside their card on small screens */
.game-figure .flow-diagram { min-width: 720px; }
/* vertical pathways: never squash to the panel height — the panel scrolls instead */
/* A vertical pathway keeps its natural proportions and is scaled down to fit the panel, so 1x shows the whole
   thing. The zoom buttons raise BOTH caps by --z rather than stretching the drawing: an SVG with width:auto
   takes the smaller of the two, so raising only max-height was a no-op for any drawing wide enough to be
   width-bound (most of them). Past 1x the drawing overflows and .pannable scrolls / drag-pans. */
.game-figure svg.flow-diagram.vertical,
.flow-diagram.vertical {
    width: auto; height: auto;
    max-width: calc(100% * var(--z, 1));
    max-height: calc(76vh * var(--z, 1));
    min-width: 0;
    display: block; margin: 0 auto;
}

/* ── Artery tree (ArteryTree.razor) ─────────────────────────────────────────
   Anatomy-diagram idiom: the great vessels are one heavy continuous line that forks where a vessel
   ends by dividing; branches spur off it in a lighter weight; anastomotic contributions are dashed. */
.game-figure svg.artery-tree { width: auto; max-height: none; min-width: 0; display: block; margin: 0 auto; }

.at-link { fill: none; stroke: var(--line-2, #9fb3c6); stroke-width: 1.5; }
.at-link.spine { stroke: var(--navy); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.at-link.lineage { stroke: #5b7a99; stroke-width: 2.2; stroke-linejoin: round; }
.at-link.cross { stroke: var(--teal); stroke-width: 1.4; stroke-dasharray: 5 4; opacity: .45; }

.at-node { cursor: pointer; }
.at-node rect { fill: var(--bg-elev); stroke: var(--line-2, #9fb3c6); stroke-width: 1.2; }
.at-node text {
    font-weight: 600; font-size: 11.5px; fill: var(--ink);
    dominant-baseline: middle; text-anchor: middle; pointer-events: none;
}
.at-node.trunk rect { fill: var(--teal-soft); stroke: var(--navy); stroke-width: 2; }
.at-node.trunk text { fill: var(--navy); font-size: 12.5px; }
.at-node:hover rect { stroke: var(--teal); stroke-width: 2; }

/* Question states, matching the plexus/flow diagrams. */
.at-node.hl rect { fill: var(--teal); stroke: var(--navy); stroke-width: 2.5; }
.at-node.hl text { fill: #fff; }
.at-node.hl-soft rect { fill: var(--teal-soft); stroke: var(--teal); stroke-width: 1.8; }
.at-node.correct rect { fill: #2f7d4f; stroke: #1e5a37; stroke-width: 2.5; }
.at-node.correct text { fill: #fff; }
.at-node.wrong rect { fill: #b5382f; stroke: #832620; stroke-width: 2.5; }
.at-node.wrong text { fill: #fff; }
.at-node.dim { opacity: .3; }
.at-node.hidden-name rect { fill: var(--bg); stroke-dasharray: 4 3; }
.at-node.hidden-name text { fill: var(--ink-3); }

.at-link.hl { stroke: var(--teal); stroke-width: 3; opacity: 1; }
.at-link.dim { opacity: .18; }

@media (prefers-color-scheme: dark) {
    .at-node rect { fill: #17222c; }
    .at-node.trunk rect { fill: var(--teal-soft); }
    .at-link { stroke: #55697d; }
    .at-link.lineage { stroke: #7e9bb8; }
}
.px-arrowhead { fill: var(--ink-3); }
.px-arrowhead.hl { fill: var(--teal); }
/* Flow pages get the full window width so the tree has room */
.site-main .container:has(.flow-page) { max-width: min(1600px, 100%); }
.flow-page .game-figure { max-height: 80vh; overflow: auto; }
@media (max-width: 900px) { .game-figure svg { max-height: 70vh; } }

.scorebar { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.scorebar .stat { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--navy); }
.scorebar .stat span { color: var(--ink-3); font-weight: 500; margin-right: .3rem; }
.progress { flex: 1; min-width: 120px; height: 8px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--teal); transition: width .25s ease; }

.question { font-family: var(--serif); font-size: 1.35rem; color: var(--navy); margin: 0 0 1rem; }
.question .hl { color: var(--teal); }

.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.option {
    text-align: left; padding: .7rem .9rem; border-radius: 8px; border: 1px solid var(--line);
    background: var(--bg-elev); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer;
    transition: border-color .1s ease, background .1s ease;
}
.option:hover:not(:disabled) { border-color: var(--teal); background: var(--teal-soft); }
.option:disabled { cursor: default; }
.option.correct { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.option.wrong { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.option.missed { outline: 2px dashed var(--green); }
.option.selected { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }

.feedback { margin-top: 1rem; padding: 1rem 1.25rem; border-radius: var(--radius); background: var(--bg-elev); border: 1px solid var(--line); }
.feedback.correct { border-color: var(--green); background: var(--green-soft); }
.feedback.wrong { border-color: var(--red); background: var(--red-soft); }
.feedback h4 { margin: 0 0 .35rem; font-family: var(--sans); font-size: 1rem; }
.feedback p { margin: 0; }
.feedback .explain { margin-top: .5rem; color: var(--ink-2); font-size: .95rem; }

.filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filters .label { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; }
.mode-tabs.compact button { padding: .3rem .7rem; font-size: .85rem; }
.mode-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--bg-elev); margin-bottom: 1.25rem; }
@media (max-width: 760px) {
    .mode-tabs { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
    .mode-tabs::-webkit-scrollbar { display: none; }
    .mode-tabs button { white-space: nowrap; flex: 0 0 auto; }
    .filters { gap: .5rem; }
    .filters .label { flex-basis: 100%; }
}
.mode-tabs button { border: 0; background: none; padding: .4rem .9rem; border-radius: 999px; font: inherit; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.mode-tabs button.active { background: var(--navy); color: #fff; }

.summary { text-align: center; padding: 2rem; }
.summary .big { font-family: var(--serif); font-size: 3rem; color: var(--navy); font-weight: 700; line-height: 1; }

/* Body-map SVG regions */
.region { fill: var(--map-fill); stroke: var(--map-stroke); stroke-width: 1; cursor: pointer; transition: fill .12s ease; }
.region:hover { fill: var(--map-hover); }
/* Per-level tints for the reference map */
.region.lv-c2 { fill: #c7d5e6; }
.region.lv-c3 { fill: #b8cbe0; }
.region.lv-c4 { fill: #a9c1da; }
.region.lv-c5 { fill: #f6cfa8; }
.region.lv-c6 { fill: #f3b98a; }
.region.lv-c7 { fill: #f0a26a; }
.region.lv-c8 { fill: #e98d4c; }
.region.lv-t1 { fill: #dccb9f; }
.region.lv-t2 { fill: #e9e0c8; }
.region.lv-t3 { fill: #dbe8d0; }
.region.lv-t4 { fill: #c9dfbf; }
.region.lv-t5 { fill: #dbe8d0; }
.region.lv-t6 { fill: #c9dfbf; }
.region.lv-t7 { fill: #dbe8d0; }
.region.lv-t8 { fill: #c9dfbf; }
.region.lv-t9 { fill: #dbe8d0; }
.region.lv-t10 { fill: #c9dfbf; }
.region.lv-t11 { fill: #dbe8d0; }
.region.lv-t12 { fill: #c9dfbf; }
.region.lv-l1 { fill: #f2d9df; }
.region.lv-l2 { fill: #eac4d0; }
.region.lv-l3 { fill: #e2afc1; }
.region.lv-l4 { fill: #d99ab2; }
.region.lv-l5 { fill: #cf85a3; }
.region.lv-s1 { fill: #b9a3d6; }
.region.lv-s2 { fill: #a68cca; }
.region.lv-s3-s5 { fill: #9375bd; }
@media (prefers-color-scheme: dark) {
    .region.lv-c2 { fill: #33475e; }
    .region.lv-c3 { fill: #2e4460; }
    .region.lv-c4 { fill: #2a4262; }
    .region.lv-c5 { fill: #6b4a2e; }
    .region.lv-c6 { fill: #7a5230; }
    .region.lv-c7 { fill: #875a32; }
    .region.lv-c8 { fill: #946034; }
    .region.lv-t1 { fill: #5c5636; }
    .region.lv-t2 { fill: #4a4736; }
    .region.lv-t3 { fill: #37483a; }
    .region.lv-t4 { fill: #3d5240; }
    .region.lv-t5 { fill: #37483a; }
    .region.lv-t6 { fill: #3d5240; }
    .region.lv-t7 { fill: #37483a; }
    .region.lv-t8 { fill: #3d5240; }
    .region.lv-t9 { fill: #37483a; }
    .region.lv-t10 { fill: #3d5240; }
    .region.lv-t11 { fill: #37483a; }
    .region.lv-t12 { fill: #3d5240; }
    .region.lv-l1 { fill: #4d3340; }
    .region.lv-l2 { fill: #563547; }
    .region.lv-l3 { fill: #5f374e; }
    .region.lv-l4 { fill: #683a55; }
    .region.lv-l5 { fill: #713c5c; }
    .region.lv-s1 { fill: #4a3d6a; }
    .region.lv-s2 { fill: #544375; }
    .region.lv-s3-s5 { fill: #5e4a80; }
}

.region:hover { filter: brightness(.9); }
.region.hl { fill: var(--teal); stroke: var(--navy); }
.region.hl-2 { fill: #f0c46a; stroke: var(--amber); }
.region.correct { fill: #7fc79a; stroke: var(--green); }
.region.wrong { fill: #e79c96; stroke: var(--red); }
.region.dim { opacity: .35; }
.region-label { font-family: var(--sans); font-size: 9px; fill: var(--ink-2); pointer-events: none; }
.body-base { fill: var(--map-fill); stroke: none; }
.body-outline { fill: none; stroke: var(--ink-3); stroke-width: 1.1; pointer-events: none; }
.region { stroke: var(--bg-elev); }

/* Brachial plexus diagram */
.px-node { fill: var(--node-branch); stroke: var(--navy); stroke-width: 1.4; }
.px-node.root { fill: var(--node-root); }
.px-node.trunk { fill: var(--node-trunk); }
.px-node.division { fill: var(--node-division); }
.px-node.cord { fill: var(--node-cord); }
.px-node.branch { fill: var(--node-branch); }
.px-node.flow { fill: var(--node-branch); }
.px-node.hl { fill: var(--teal); stroke: var(--navy); stroke-width: 2.5; }
.px-node.correct { fill: #7fc79a; }
.px-node.wrong { fill: #e79c96; }
.px-node.dim { opacity: .3; }
.px-edge { stroke: var(--ink-3); stroke-width: 1.6; fill: none; }
.px-edge.hl { stroke: var(--teal); stroke-width: 3; }
.px-edge.dim { opacity: .25; }
.px-label { font-family: var(--sans); font-size: 10px; fill: var(--ink); pointer-events: none; }
.px-label.small { font-size: 8.5px; fill: var(--ink-2); }
.px-hit { cursor: pointer; }
.px-node.hl-soft { fill: var(--teal-soft); stroke: var(--teal); }
.flow-diagram { width: 100%; height: auto; }
/* Histology */
.histo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .75rem; }
.histo-thumb { display: flex; flex-direction: column; gap: .35rem; padding: .4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-elev); cursor: pointer; text-align: left; font: inherit; color: var(--ink); }
.histo-thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
.histo-thumb span { font-size: .8rem; line-height: 1.2; color: var(--ink-2); }
.histo-thumb:hover { border-color: var(--teal); }
.histo-figure { display: block; overflow: visible; }
.histo-figure img { max-width: 100%; max-height: 72vh; border-radius: 6px; }

/* ── Micrograph label overlay (HistoFigure.razor) ───────────────────────────
   The wrapper carries the image's own aspect-ratio and the image fills it, so the wrapper's box IS the picture's
   box. Percent-positioned marks then land exactly where they were placed. (Sizing the image with max-height
   instead leaves it narrower than its shrink-to-fit wrapper, and every label drifts sideways.) */
.histo-figure .histo-fig { max-width: 100%; }
.histo-fig {
    position: relative; display: block; margin: 0 auto; line-height: 0;
    width: 100%; max-width: 100%;
}
/* The panel scrolls horizontally for wide SVG diagrams; a micrograph always fits, so don't let that
   turn into a scrollbox around the labels. */
.game-figure:has(.histo-fig) { overflow: visible; }
.histo-fig img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
/* No known aspect ratio (a slide missing from the size table): fall back to plain sizing. */
.histo-fig:not([style*="aspect-ratio"]) { width: fit-content; }
.histo-fig:not([style*="aspect-ratio"]) img { width: auto; height: auto; max-width: 100%; max-height: 70vh; }

.hf-leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.hf-leaders line { stroke: var(--teal); stroke-width: 1.25; opacity: .9; }
.hf-leaders line.zone { stroke-dasharray: 3 2; opacity: .75; }

.hf-dot {
    position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px;
    border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 2px #fff, 0 0 3px rgba(0,0,0,.55);
    pointer-events: none;
}
.hf-dot.orient { background: var(--amber); }

.hf-tag {
    position: absolute; max-width: 96%; padding: .1rem .35rem;
    /* Longhands, not the `font` shorthand: `inherit` is not a valid shorthand component, so
       `font: 600 .72rem/1.2 inherit` is dropped wholesale and the tag inherits the wrapper's line-height:0,
       collapsing every label box to nothing. */
    font-weight: 600; font-size: .72rem; line-height: 1.25;
    text-align: center; white-space: nowrap;
    color: #08343a; background: rgba(255,255,255,.93); border: 1px solid var(--teal);
    border-radius: 4px; pointer-events: none;
}
.hf-tag.orient { color: #4a2c00; border-color: var(--amber); background: rgba(255,251,240,.95); }

/* Anchor to whichever edge the label sits near, so a wide label never hangs off the picture. */
.hf-tag.at-c { translate: -50% 0; }
.hf-tag.at-r { translate: -100% 0; }
.hf-tag.at-l { translate: 0 0; }
.hf-tag.at-m { margin-top: -0.65rem; }
.hf-tag.at-b { margin-top: -1.3rem; }
.hf-tag.at-t { margin-top: 0; }

.hf-zone {
    position: absolute; border: 2px dashed var(--teal); border-radius: 4px;
    background: rgba(15,124,133,.07); pointer-events: none;
}
.hf-zone.orient { border-color: var(--amber); background: rgba(178,106,0,.07); }

/* Labels fade in on reveal rather than snapping. */
.histo-fig.marked .hf-tag, .histo-fig.marked .hf-dot,
.histo-fig.marked .hf-zone, .histo-fig.marked .hf-leaders { animation: hf-in .22s ease-out both; }
@keyframes hf-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .histo-fig.marked .hf-tag, .histo-fig.marked .hf-dot,
    .histo-fig.marked .hf-zone, .histo-fig.marked .hf-leaders { animation: none; }
}

.histo-marklist { margin: .25rem 0 .5rem; padding-left: 1.1rem; }
.histo-marklist li::marker { color: var(--teal); }
.histo-marklist li.orient::marker { color: var(--amber); }

@media (max-width: 620px) {
    .hf-tag { font-size: .6rem; padding: .05rem .25rem; }
    .hf-dot { width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; }
}

/* Artery map (anatomical drawing) */
.artery-map { height: auto; display: block; }
.game-figure.map-figure { display: flex; justify-content: center; overflow: auto; }
.am-bone { fill: none; stroke: var(--ink-3); stroke-width: 2; opacity: .55; }
.am-vessel { fill: none; stroke: var(--artery); stroke-linecap: round; stroke-linejoin: round; transition: stroke .15s; }
.am-vessel.posterior { stroke-dasharray: 5 4; }
.am-vessel.hl { stroke: var(--teal); stroke-width: 7px !important; stroke-dasharray: none; }
.am-vessel.hl-soft { stroke: var(--teal); opacity: .55; }
.am-vessel.correct { stroke: var(--green); stroke-width: 7px !important; stroke-dasharray: none; }
.am-vessel.wrong { stroke: var(--red); stroke-width: 7px !important; stroke-dasharray: none; }
.am-vessel.dim { opacity: .25; }
.am-hitarea { fill: none; stroke: transparent; stroke-width: 14px; }
.am-hit { cursor: pointer; }
.am-hit:hover .am-vessel:not(.hl):not(.correct):not(.wrong) { stroke: var(--navy); }
.px-enzyme { font-family: var(--sans); font-size: 8.5px; font-style: italic; fill: var(--ink-2); pointer-events: none; paint-order: stroke; stroke: var(--bg-elev); stroke-width: 3px; stroke-linejoin: round; }
.px-enzyme.hl { fill: var(--teal); font-weight: 600; font-style: normal; }
.px-enzyme.dim { opacity: .25; }
.hl-text { color: var(--teal); }

/* Metabolism cases */
.case-box { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; }
.case-box p { margin: 0 0 .6rem; }
.compact-table td { padding: .25rem .5rem; font-size: .85rem; }
.mechanism { margin: .5rem 0 0; padding-left: 1.4rem; }
.mechanism li { margin: .35rem 0; padding: .4rem .6rem; border-radius: 8px; border: 1px solid transparent; cursor: pointer; }
.mechanism li.active { background: var(--teal-soft); border-color: var(--teal); }
.mechanism li.done { color: var(--ink-2); }
.mechanism li.todo { color: var(--ink-3); }

/* SVG text colour helpers (declared after .region-label/.px-label so they win) */
.svg-heading { fill: var(--navy); font-weight: 600; }
.svg-muted { fill: var(--ink-3); }
.svg-red { fill: var(--red); }

.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--ink-2); margin-top: .5rem; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; border: 1px solid var(--navy); }
.legend .root::before { background: var(--node-root); }
.legend .trunk::before { background: var(--node-trunk); }
.legend .division::before { background: var(--node-division); }
.legend .cord::before { background: var(--node-cord); }
.legend .branch::before { background: var(--node-branch); }
.legend .side::before { background: var(--bg-elev); border-style: dashed; }
.px-node.side { fill: var(--bg-elev); stroke: var(--ink-3); stroke-width: 1.1; stroke-dasharray: 3 2; }
.px-node.division { stroke-width: 1; opacity: .8; }
.px-edge.side { stroke-width: 1.1; stroke-dasharray: 3 2; }
.px-edge.side.hl { stroke-width: 2.2; stroke-dasharray: none; }
.px-node.side.hl { fill: var(--teal); stroke: var(--navy); stroke-dasharray: none; stroke-width: 2.5; }
.px-node.side.correct { fill: #7fc79a; stroke-dasharray: none; }
.px-node.side.wrong { fill: #e79c96; stroke-dasharray: none; }
.px-node.side.hl-soft { fill: var(--teal-soft); stroke: var(--teal); }

/* Reference tables */
.ref-table { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--bg-elev); }
.ref-table th, .ref-table td { border: 1px solid var(--line); padding: .5rem .7rem; text-align: left; vertical-align: top; }
.ref-table th { background: var(--bg-soft); color: var(--navy); }
.ref-table tr:hover td { background: var(--row-hover); }

/* Blazor error UI */
#blazor-error-ui {
    background: var(--amber-soft); color: var(--ink); border-top: 2px solid var(--amber);
    bottom: 0; box-shadow: 0 -2px 10px rgba(0,0,0,.1); display: none; left: 0; padding: .6rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* row deep-linked from another module */
.ref-table tr.hl-row td { background: var(--teal-soft); }

/* ── Porphyrin structures (PorphyrinFigure.cs), shown above the heme map ── */
.structure-card { margin-bottom: 1rem; overflow-x: auto; }
.porphyrin-figure { width: 100%; height: auto; font-family: var(--sans); }
.porphyrin-figure .panel { fill: var(--bg-soft); stroke: var(--line); }
.porphyrin-figure .ptitle { font-size: 15px; font-weight: 700; fill: var(--navy); }
.porphyrin-figure .psub { font-size: 11.5px; fill: var(--ink-3); }
.porphyrin-figure .py { fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linejoin: round; }
.porphyrin-figure .nfill { fill: var(--bg-elev); stroke: var(--ink-2); stroke-width: 1.2; }
.porphyrin-figure .atom { font-size: 10.5px; font-weight: 700; fill: var(--navy); text-anchor: middle; }
.porphyrin-figure .bond { stroke: var(--ink-2); stroke-width: 2; }
.porphyrin-figure .bond2 { stroke: var(--teal); stroke-width: 1.6; }
.porphyrin-figure .bond.hot { stroke: var(--amber); stroke-width: 2.4; }
.porphyrin-figure .side { font-size: 10.5px; font-weight: 600; text-anchor: middle; }
.porphyrin-figure .sideA { fill: var(--teal); }
.porphyrin-figure .sideP { fill: var(--navy-2); }
.porphyrin-figure .hotlab { fill: var(--amber); font-size: 11px; }
.porphyrin-figure .bridgedot { fill: var(--bg-elev); stroke: var(--ink-3); stroke-width: 1.2; }
.porphyrin-figure .bridgedot.conj { stroke: var(--teal); }
.porphyrin-figure .bridgelab { font-size: 9.5px; fill: var(--ink-3); text-anchor: middle; }
.porphyrin-figure .flow { stroke: var(--ink-3); stroke-width: 2; }
.porphyrin-figure .flow.hotflow { stroke: var(--red); stroke-width: 3; }
.porphyrin-figure .ahead { fill: var(--ink-3); }
.porphyrin-figure .flowlab { font-size: 12px; font-weight: 700; fill: var(--ink-2); text-anchor: middle; }
.porphyrin-figure .flowsub { font-size: 10.5px; fill: var(--ink-3); text-anchor: middle; }
.porphyrin-figure .cap { font-size: 11px; fill: var(--ink-3); text-anchor: middle; }
.porphyrin-figure .neuro { fill: var(--amber); font-weight: 700; }
.porphyrin-figure .cut { fill: var(--red); font-weight: 700; }
.porphyrin-figure .fe { fill: var(--red-soft); stroke: var(--red); stroke-width: 1.6; }
.porphyrin-figure .felab { font-size: 10px; font-weight: 700; fill: var(--red); text-anchor: middle; }
.porphyrin-figure .coord { stroke: var(--red); stroke-width: 1.2; stroke-dasharray: 3 2.5; }
.porphyrin-figure .bandneuro { fill: var(--amber-soft); stroke: var(--amber); }
.porphyrin-figure .bandcut { fill: var(--red-soft); stroke: var(--red); }
.porphyrin-figure .bandtitle { font-size: 13px; font-weight: 700; }
.porphyrin-figure .bandtext { font-size: 11.5px; fill: var(--ink-2); }
.porphyrin-figure .foot { font-size: 10.5px; fill: var(--ink-3); text-anchor: middle; font-style: italic; }

.porphyrin-figure .dring { fill: none; stroke: var(--red); stroke-width: 2; stroke-dasharray: 4 3; opacity:.85 }
.porphyrin-figure .ringlab { font-size: 11px; font-weight: 700; fill: var(--ink-3); text-anchor: middle; }
.porphyrin-figure .ringlab.flipped { fill: var(--red); }

.pill.teal a, a.pill { text-decoration: none; }

/* viscerosomatic spine column */
.spine-seg { fill: var(--bg-elev); stroke: var(--line); stroke-width: 1; }
.spine-seg.hl { fill: var(--teal); stroke: var(--navy-2); }
.spine-seg.soft { fill: var(--teal-soft); stroke: var(--teal); }
.spine-seg.picked { fill: var(--navy); stroke: var(--navy-2); }
.spine-seg.correct { fill: #2f7d4f; }
.spine-seg.missed { fill: var(--green-soft); stroke: #2f7d4f; stroke-dasharray: 3 2; stroke-width: 1.6; }
.spine-seg.wrong { fill: #b5382f; }
.spine-label { font-size: 9.5px; fill: var(--ink); pointer-events: none; }
.spine-seg.hl + text, .spine-seg.picked + text, .spine-seg.correct + text, .spine-seg.wrong + text { fill: #fff; }
.spine-region { font-size: 8.5px; fill: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.spine-column .px-hit { cursor: pointer; }

/* cram feed */
.cram:focus { outline: none; }
.cram-card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); max-width: 900px; }
.cram-option { display: flex; align-items: center; gap: .75rem; text-align: left; font-size: 1rem; padding: .7rem .9rem; }
.cram-option kbd, .cram .btn kbd, .lede kbd { display: inline-block; min-width: 1.4em; padding: .05em .35em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--bg-soft); font-family: ui-monospace, monospace; font-size: .8em; text-align: center; color: var(--ink-2); }
.cram-option.correct kbd { border-color: var(--green); color: var(--green); }
.cram-option.wrong kbd { border-color: var(--red); color: var(--red); }

/* 3D anatomy */
.a3d .game-panel { min-width: 0; position: sticky; top: 1rem; }
/* The side panel scrolls on its own so the model stays put while you browse the list. */
.a3d-side { min-width: 0; max-height: calc(100vh - 2rem); overflow-y: auto; position: sticky; top: 1rem; padding-right: .5rem; scrollbar-width: thin; }
@media (max-width: 900px) { .a3d .game-panel, .a3d-side { position: static; max-height: none; overflow: visible; } }
.a3d-stage { position: relative; width: 100%; height: min(72vh, 760px); background: radial-gradient(ellipse at 50% 40%, var(--bg-elev), var(--bg-soft)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; touch-action: none; }
.a3d-stage canvas { display: block; width: 100% !important; height: 100% !important; }
.a3d-loading { position: absolute; inset: 0; display: grid; place-items: center; }
.a3d-toolbar { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }

/* midterm checklist */
.check-grid { display: grid; gap: .35rem; }
.check-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .45rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-elev); }
.check-row.know { border-color: var(--green); background: var(--green-soft); }
.check-row.unsure { border-color: var(--amber); background: var(--amber-soft); }
.check-row.no { border-color: var(--red); background: var(--red-soft); }
.check-rate { display: flex; gap: .25rem; flex-shrink: 0; }
.check-rate button { width: 2rem; height: 2rem; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-size: .95rem; color: var(--ink-2); }
.check-rate button.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* 3D checklist jump list */
.check-jump summary{cursor:pointer;color:var(--teal)}
.check-jump-row{display:flex;flex-wrap:wrap;gap:.3rem}
.check-jump-row .pill{cursor:pointer;border:1px solid transparent;font:inherit;font-size:.75rem}
.check-jump-row .pill.know{background:rgba(46,160,67,.25);color:#9be7a8}
.check-jump-row .pill.unsure{background:rgba(210,153,34,.25);color:#f2cc60}
.check-jump-row .pill.no{background:rgba(220,60,60,.25);color:#ffb3b3}
.check-jump-row .pill.current{border-color:var(--teal);box-shadow:0 0 0 2px rgba(31,182,193,.35)}
.pill.green{background:rgba(46,160,67,.25);color:#9be7a8}
.pill.red{background:rgba(220,60,60,.25);color:#ffb3b3}

/* 3D landmark labels */
.a3d-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.a3d-label { position: absolute; left: 0; top: 0; translate: -50% -150%; pointer-events: auto; cursor: pointer; white-space: nowrap; font-size: .72rem; line-height: 1.2; padding: .12rem .45rem; border-radius: .7rem; background: rgba(10, 14, 20, .82); color: #d9f3f5; border: 1px solid rgba(31, 182, 193, .55); }
.a3d-label::after { content: ""; position: absolute; left: 50%; top: 100%; translate: -50% 0; border: 4px solid transparent; border-top-color: rgba(31, 182, 193, .55); }
.a3d-label.hl { background: #ffb020; color: #1a1408; border-color: #ffb020; font-weight: 600; font-size: .8rem; z-index: 2; }
.a3d-label.hl::after { border-top-color: #ffb020; }

/* Supply & course */
.table-wrap { overflow-x: auto; }
input.search { padding: .4rem .7rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--bg-elev); color: inherit; font: inherit; }

/* ── Lecture index (/learn/lecturers) ── */
.lecturer-card { margin-bottom: 1rem; }
.lecturer-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; }
.lecturer-head .arrow { color: var(--teal); }
.lecturer-head:hover .arrow { text-decoration: underline; }
.code-line { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin: .6rem 0 0; }
.code-chip { display: inline-block; padding: .1rem .4rem; border: 1px solid var(--line); border-radius: .35rem;
             background: var(--bg-soft); font-family: var(--mono); font-size: .8rem; white-space: nowrap; }
.pill.small-pill { font-size: .7rem; padding: .05rem .35rem; margin-left: .35rem; vertical-align: middle; }
code.path { font-size: .8rem; word-break: break-all; }

/* ── Vitamin & mineral lookup (/learn/vitamins) ── */
.vit-card { margin-bottom: 1rem; }
.vit-head { display: flex; align-items: center; gap: .8rem; }
.vit-badge { display: inline-grid; place-items: center; min-width: 3rem; height: 2.4rem; padding: 0 .5rem;
             border-radius: .5rem; background: var(--teal-soft); color: var(--teal);
             font-weight: 700; font-size: 1.15rem; border: 1px solid var(--teal); }
.vit-h { margin: 1rem 0 .3rem; font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.vit-h.warn { color: var(--red); }
.vit-list { margin: 0; padding-left: 1.1rem; }
.vit-list li { margin: .25rem 0; }
.act-pill { margin: 0 .3rem .3rem 0; display: inline-block; }
.option.picked { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(31,182,193,.3); }
ol.course { list-style: none; margin: .5rem 0; padding: 0 0 0 .9rem; border-left: 2px solid var(--line); font-size: .9rem; }
ol.course li { position: relative; margin: 0 0 .45rem; }
ol.course li::before { content: ""; position: absolute; left: -1.25rem; top: .45rem; width: .55rem; height: .55rem; border-radius: 50%; background: var(--line); }
ol.course li.course-origin::before { background: var(--green); }
ol.course li.course-end::before { background: var(--amber); }
ol.course .label { display: inline-block; min-width: 3.6rem; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }

.a3d-label.begin { border-color: #3ddc84; color: #bff5d6; }
.a3d-label.begin::after { border-top-color: #3ddc84; }
.a3d-label.end { border-color: #ffb020; color: #ffe1a8; }
.a3d-label.end::after { border-top-color: #ffb020; }
.course-pills .pill { cursor: pointer; border: 1px solid transparent; font: inherit; font-size: .75rem; }
.course-pills .pill.artery { background: rgba(216,58,58,.22); color: #ffb3b3; }
.course-pills .pill.nerve { background: rgba(240,207,58,.22); color: #f7e28a; }
.course-pills .pill.current { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(31,182,193,.35); }

/* Pathway diagram: regulators, allosteric signals, compartments */
.px-reg { stroke-dasharray: 5 4; fill: none; stroke-width: 1.6; }
.px-reg.plus { stroke: var(--green); }
.px-reg.minus { stroke: #d64545; }
.px-reg-dot { stroke-width: 1.5; }
.px-reg-dot.plus { fill: var(--green-soft); stroke: var(--green); }
.px-reg-dot.minus { fill: #fbe3e3; stroke: #d64545; }
.px-reg-sign { font-size: 11px; font-weight: 700; fill: var(--ink); }
.px-reg-txt { font-size: 9.5px; font-style: normal; paint-order: stroke; stroke: var(--bg-elev); stroke-width: 3px; stroke-linejoin: round; }
.px-reg-txt.plus { fill: var(--green); }
.px-reg-txt.minus { fill: #d64545; }
.px-zone { stroke: none; opacity: .55; }
.px-zone.zone-0 { fill: rgba(31, 182, 193, .10); }
.px-zone.zone-1 { fill: rgba(163, 104, 220, .16); }
.px-zone.zone-2 { fill: rgba(240, 160, 40, .16); }
.px-zone.zone-3 { fill: rgba(80, 200, 120, .16); }
.px-zone.zone-4 { fill: rgba(220, 80, 120, .14); }
.px-zone.zone-5 { fill: rgba(120, 140, 200, .16); }
.px-zone.zone-6 { fill: rgba(200, 120, 90, .16); }
.px-zone.zone-7 { fill: rgba(110, 190, 170, .16); }
.px-zone.zone-8 { fill: rgba(150, 150, 215, .16); }
.px-zone.zone-9 { fill: rgba(175, 175, 90, .16); }
.px-zone.zone-10 { fill: rgba(215, 110, 180, .14); }
.px-zone.zone-11 { fill: rgba(150, 140, 125, .16); }
.px-zone.legend { opacity: 1; }
.px-legend { font-size: 10px; fill: var(--ink-3); }
.px-node.cp-1 { stroke: rgba(163, 104, 220, .9); }
.px-node.cp-2 { stroke: rgba(240, 160, 40, .9); }
.px-node.cp-3 { stroke: rgba(80, 200, 120, .9); }
.px-node.cp-4 { stroke: rgba(220, 80, 120, .9); }
.px-node.cp-5 { stroke: rgba(120, 140, 200, .9); }
.px-node.cp-6 { stroke: rgba(200, 120, 90, .9); }
.px-node.cp-7 { stroke: rgba(110, 190, 170, .9); }
.px-node.cp-8 { stroke: rgba(150, 150, 215, .9); }
.px-node.cp-9 { stroke: rgba(175, 175, 90, .9); }
.px-node.cp-10 { stroke: rgba(215, 110, 180, .9); }
.px-node.cp-11 { stroke: rgba(150, 140, 125, .9); }

/* ───────────── hand-placed maps: the whole-metabolism chart and the TCA ring (MapCanvas) ───────────── */
/* Both caps scale with --z — see the note on .flow-diagram.vertical above. The chart is nearly square, so on a
   wide screen it is width-bound and a height-only zoom did nothing at all. */
.game-figure svg.metabolic-map {
    width: auto; height: auto;
    max-width: calc(100% * var(--z, 1));
    max-height: calc(80vh * var(--z, 1));
    min-width: 0;
    display: block; margin: 0 auto;
}
.mp-zone { cursor: pointer; }
.mp-zone:hover .px-zone { opacity: .8; }
.mp-zone-title { font-family: var(--sans); font-size: 12px; font-weight: 600; fill: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; pointer-events: none; }
.px-edge.gng { stroke: #d9a441; stroke-width: 2.2; stroke-dasharray: 7 4; }
.px-enzyme.gng { fill: #d9a441; }
.px-edge.minor { opacity: .6; stroke-dasharray: 2 3; }
.px-node.hub { stroke-width: 2.4; }

/* condition overlay: ✕ blocked · ↑ up · ↓ down; everything else fades back */
.metabolic-map .faded { opacity: .38; }
.metabolic-map .mp-box.faded { opacity: .55; }
.metabolic-map .mp-box.active { opacity: 1; }
.metabolic-map .px-edge.dim, .metabolic-map .px-enzyme.dim, .metabolic-map .px-tag.dim { opacity: .15; }
.metabolic-map .mp-box.dim { opacity: .25; }
.px-edge.block { stroke: #d64545; stroke-width: 3.2; stroke-dasharray: 5 3; opacity: 1; }
.px-arrowhead.block { fill: #d64545; }
.px-edge.up { stroke: var(--green); stroke-width: 3.2; opacity: 1; }
.px-edge.down { stroke: #e0a640; stroke-width: 3.2; stroke-dasharray: 9 4; opacity: 1; }
.px-edge.reverse { stroke: #e0a640; stroke-width: 3.6; stroke-dasharray: none; opacity: 1; }
.px-arrowhead.up { fill: var(--green); }
.px-arrowhead.down { fill: #e0a640; }
.px-enzyme.reverse { fill: #e0a640; font-weight: 600; font-style: normal; opacity: 1; }
.px-node.reverse { stroke: #e0a640; stroke-width: 2.6; }
.sign.reverse { background: rgba(240, 160, 40, .15); color: #e0a640; }
.mp-box.reverse .mp-badge circle { stroke: #e0a640; }  .mp-box.reverse .mp-badge-text { fill: #e0a640; }
.px-edge.hl.mp-edge { opacity: 1; }
.px-enzyme.block { fill: #d64545; font-weight: 600; font-style: normal; opacity: 1; }
.px-enzyme.up { fill: var(--green); font-weight: 600; font-style: normal; opacity: 1; }
.px-enzyme.down { fill: #e0a640; font-weight: 600; font-style: normal; opacity: 1; }
.px-node.block { stroke: #d64545; stroke-width: 2.6; fill: rgba(214, 69, 69, .16); }
.px-node.up { stroke: var(--green); stroke-width: 2.6; fill: rgba(80, 200, 120, .18); }
.px-node.down { stroke: #e0a640; stroke-width: 2.6; fill: rgba(240, 160, 40, .16); }
.mp-badge circle { fill: var(--bg-elev); stroke: var(--ink-3); stroke-width: 1.4; }
.mp-badge-text { font-family: var(--sans); font-size: 11px; font-weight: 700; fill: var(--ink); pointer-events: none; }
.mp-box.up .mp-badge circle { stroke: var(--green); }   .mp-box.up .mp-badge-text { fill: var(--green); }
.mp-box.down .mp-badge circle { stroke: #e0a640; }      .mp-box.down .mp-badge-text { fill: #e0a640; }
.mp-box.block .mp-badge circle { stroke: #d64545; }     .mp-box.block .mp-badge-text { fill: #d64545; }
.mp-box.hl .mp-badge circle { stroke: var(--teal); }    .mp-box.hl .mp-badge-text { fill: var(--teal); }

/* energy tags under an enzyme: what the step spends (amber) and makes (green) */
.px-tag rect { fill: var(--bg-elev); stroke-width: 1; }
.px-tag.made rect { stroke: var(--green); fill: rgba(80, 200, 120, .14); }
.px-tag.made .px-tag-text { fill: var(--green); }
.px-tag.used rect { stroke: #e0a640; fill: rgba(240, 160, 40, .14); }
.px-tag.used .px-tag-text { fill: #e0a640; }
.px-tag-text { font-family: var(--sans); font-size: 7.5px; font-weight: 600; pointer-events: none; }
.tag-demo { display: inline-block; font-size: .7rem; font-weight: 600; padding: 0 .35rem; border-radius: 4px; border: 1px solid; line-height: 1.3; }
.tag-demo.used { color: #e0a640; border-color: #e0a640; background: rgba(240, 160, 40, .12); }
.tag-demo.made { color: var(--green); border-color: var(--green); background: rgba(80, 200, 120, .12); }

/* effects table beside the painted chart */
.lesion-table tr { cursor: pointer; }
.lesion-table tr:hover td { background: var(--bg-elev); }
.lesion-table tr.active td { background: var(--teal-soft); }
.sign { display: inline-block; width: 1.5rem; height: 1.5rem; border-radius: 50%; text-align: center; line-height: 1.5rem; font-weight: 700; font-size: .85rem; }
.sign.block { background: rgba(214, 69, 69, .15); color: #d64545; }
.sign.up { background: rgba(80, 200, 120, .15); color: var(--green); }
.sign.down { background: rgba(240, 160, 40, .15); color: #e0a640; }
.sign.hl { background: var(--teal-soft); color: var(--teal); }

/* Autonomic receptors */
.rc-map { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; }
.rc-col { border-radius: var(--radius); padding: .8rem .9rem; border: 1px solid var(--line); background: var(--bg-elev); }
.rc-col h3 { margin: 0 0 .2rem; }
.rc-col.gq { border-top: 4px solid #d64545; }
.rc-col.gi { border-top: 4px solid var(--amber); }
.rc-col.gs { border-top: 4px solid var(--green); }
.rc-col.ion { border-top: 4px solid var(--navy); }
.rc-chip { display: flex; flex-direction: column; gap: .1rem; padding: .4rem .6rem; margin: .35rem 0; border-radius: .6rem; background: var(--bg-soft); }
.rc-why { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin: 1rem 0; }
.rc-why-col { border-radius: var(--radius); padding: .8rem 1rem; border: 1px solid var(--line); }
.rc-why-col.relax { background: rgba(80, 200, 120, .08); }
.rc-why-col.contract { background: rgba(214, 69, 69, .08); }
.rc-why-col h4 { margin: 0 0 .2rem; }
.rc-why-col ol.course li::before { background: var(--line); }

.rc-chain { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.rc-chain:last-of-type { border-bottom: none; }
.rc-chain code { display: block; font-size: .95rem; padding: .25rem 0; color: var(--teal); background: none; }

/* Development timeline */
.dev-timeline { list-style: none; margin: 0; padding: 0; }
.dev-timeline li { display: grid; grid-template-columns: 7.5rem 1fr; gap: .8rem; padding: .55rem 0 .55rem .9rem; border-left: 3px solid var(--line); position: relative; }
.dev-timeline li::before { content: ""; position: absolute; left: -7px; top: 1rem; width: 11px; height: 11px; border-radius: 50%; background: var(--teal); border: 2px solid var(--bg-elev); }
.dev-timeline .dev-when { font-weight: 600; color: var(--navy); font-size: .9rem; }
.dev-timeline li.tp-0::before { background: #1fb6c1; } .dev-timeline li.tp-1::before { background: #a368dc; } .dev-timeline li.tp-2::before { background: #f0a028; }
.dev-timeline li.tp-3::before { background: #50c878; } .dev-timeline li.tp-4::before { background: #dc5078; } .dev-timeline li.tp-5::before { background: #d64545; } .dev-timeline li.tp-6::before { background: #788cc8; }
@media (max-width: 600px) { .dev-timeline li { grid-template-columns: 1fr; gap: .2rem; } }

/* ── Muscles page: multi-select region picker ───────────────────────────────
   Each anatomical group is its own segmented control, so "all four back
   layers" is one click on the group button rather than four separate picks. */
.region-picker { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; margin: 0 0 1.25rem; }
.region-picker .mode-tabs { margin-bottom: 0; }
.region-picker .mode-tabs button.group { font-weight: 700; }
.region-picker .mode-tabs button.group.active { background: var(--teal); color: #0f1418; }
.region-picker .label { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; }

/* ── Transitions page: structure → landmark → structure ─────────────────────── */
.trans-card { margin-bottom: .7rem; }
.trans-line { font-size: 1.05rem; line-height: 1.5; }
.trans-from, .trans-to { font-weight: 600; }
.trans-to { color: var(--teal); }
.trans-verb { color: var(--ink-3); font-style: italic; margin: 0 .35rem; }
.trans-landmark { color: var(--ink-2); }
.trans-landmark strong { color: var(--amber); }
.landmark-stem { font-size: 1.15rem; font-weight: 600; color: var(--amber); margin: .2rem 0 0; line-height: 1.4; }

/* ── 3D transitions explorer: one traceable step per row ─────────────────────── */
.tx-row { padding: .55rem 0; border-top: 1px solid var(--line); }
.tx-row:first-of-type { border-top: 0; }
.tx-row-head { margin: 0 0 .15rem; }
