/* ICUNERD — design system
   Dark by default (bedside monitor at 3 a.m.), light mode = paper. */

:root {
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Source Sans 3", "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --bg: #0d1117;
  --bg-2: #141b24;
  --bg-3: #1b2431;
  --line: #27313e;
  --line-2: #344152;
  --ink: #ebe6da;
  --ink-2: #aaa59a;
  --ink-3: #7c786f;
  --accent: #e2593d;
  --accent-ink: #ffffff;
  --accent-soft: rgba(226, 89, 61, 0.14);
  --green: #7fd6a7;   /* ECG trace */
  --red: #f0705c;     /* arterial line */
  --blue: #86b9ea;    /* CVP / SpO2 */
  --amber: #e9b95a;   /* respiratory / warning */
  --violet: #b8a1e6;
  --grid: rgba(127, 214, 167, 0.12);
  --shadow: 0 20px 50px -30px rgba(0, 0, 0, 0.8);
  --radius: 10px;
  --maxw: 1180px;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f4efe4;
  --bg-2: #fbf8f1;
  --bg-3: #ebe4d5;
  --line: #d9d0be;
  --line-2: #c4b9a3;
  --ink: #17140f;
  --ink-2: #5b554a;
  --ink-3: #8a8375;
  --accent: #b9432b;
  --accent-ink: #ffffff;
  --accent-soft: rgba(185, 67, 43, 0.1);
  --green: #1f8a5a;
  --red: #c2372a;
  --blue: #2f6ea8;
  --amber: #a8730f;
  --violet: #6b4fb0;
  --grid: rgba(31, 138, 90, 0.14);
  --shadow: 0 20px 40px -30px rgba(40, 30, 10, 0.35);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-feature-settings: "kern", "liga";
}
img, svg, canvas { max-width: 100%; }
a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; line-height: 1.12; letter-spacing: -0.012em; margin: 0 0 0.5em; font-variation-settings: "opsz" 96; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.6rem); }
h2 { font-size: clamp(1.55rem, 2.6vw, 2.15rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.05rem; font-family: var(--font-body); font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-2); }
p { margin: 0 0 1em; }
code { font-family: var(--font-mono); font-size: 0.88em; background: var(--bg-3); padding: 0.05em 0.35em; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
sub, sup { line-height: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 0.9rem; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff; padding: 0.5rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0.7rem clamp(1rem, 3vw, 2.5rem);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid var(--line);
}
.wordmark { font-family: var(--font-display); font-size: 1.45rem; text-decoration: none; letter-spacing: -0.02em; display: inline-flex; align-items: baseline; }
.wordmark .wm-icu { font-weight: 300; font-variation-settings: "opsz" 144, "SOFT" 100; }
.wordmark .wm-nerd { font-weight: 800; font-style: italic; color: var(--accent); margin-left: 0.06em; }
.topnav { display: flex; gap: 0.2rem; margin-left: auto; }
.topnav a { text-decoration: none; padding: 0.4rem 0.75rem; border-radius: 6px; font-weight: 500; color: var(--ink-2); }
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--ink); background: var(--bg-3); }
.topbar-actions { display: flex; gap: 0.5rem; align-items: center; }
.theme-toggle, .menu-toggle { background: none; border: 1px solid var(--line-2); color: var(--ink); border-radius: 6px; width: 2.2rem; height: 2.2rem; cursor: pointer; font-size: 1.1rem; display: inline-grid; place-items: center; }
.theme-toggle .moon { display: none; }
[data-theme="light"] .theme-toggle .sun { display: none; }
[data-theme="light"] .theme-toggle .moon { display: inline; }
.menu-toggle { display: none; flex-direction: column; gap: 4px; padding: 0; }
.menu-toggle span { width: 16px; height: 2px; background: currentColor; display: block; }
@media (max-width: 760px) {
  .topnav { position: fixed; inset: 3.4rem 0 auto 0; flex-direction: column; background: var(--bg-2); border-bottom: 1px solid var(--line); padding: 0.5rem; display: none; }
  .topnav.open { display: flex; }
  .menu-toggle { display: inline-flex; }
}

main { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2.5rem); }
.narrow { max-width: 760px; }

/* ---------- buttons, tags ---------- */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.15rem; border-radius: 8px; font-weight: 600; text-decoration: none; border: 1px solid transparent; cursor: pointer; font-family: var(--font-body); font-size: 1rem; line-height: 1.2; transition: transform 0.12s ease, background 0.12s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, black); color: #fff; }
.btn-ghost { border-color: var(--line-2); color: var(--ink); background: transparent; }
.btn-ghost:hover { background: var(--bg-3); color: var(--ink); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.9rem; }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0; }
.tag { font-family: var(--font-mono); font-size: 0.74rem; padding: 0.2rem 0.5rem; border: 1px solid var(--line-2); border-radius: 999px; color: var(--ink-2); text-decoration: none; }
.tag:hover { border-color: var(--accent); color: var(--accent); }
.eyebrow { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin: 0 0 0.8rem; }
.lede { font-size: 1.2rem; color: var(--ink-2); max-width: 62ch; }
.cta-row { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 1.6rem; }

/* ---------- home ---------- */
.masthead { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 3rem; align-items: center; padding: clamp(3rem, 8vw, 6.5rem) 0 3rem; }
.masthead h1 { font-size: clamp(2.4rem, 5.4vw, 4.4rem); font-weight: 400; }
.masthead h1 em { font-style: italic; font-weight: 600; color: var(--accent); }
.hero-trace { width: 100%; height: auto; color: var(--green); }
.hero-trace .trace { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 3.2s ease-out forwards; }
.hero-trace .trace.ekg { stroke: url(#fade); color: var(--green); }
.hero-trace .trace.art { stroke: var(--red); animation-delay: 0.5s; }
.hero-trace .trace.vent { stroke: var(--amber); animation-delay: 0.9s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.hero-trace .trace { pathLength: 1; }
@media (prefers-reduced-motion: reduce) { .hero-trace .trace { animation: none; stroke-dashoffset: 0; } }
@media (max-width: 860px) { .masthead { grid-template-columns: 1fr; gap: 1.5rem; } .masthead-art { order: -1; } }

.section-head { margin: 2rem 0 1.5rem; max-width: 60ch; }
.section-head p { color: var(--ink-2); }
.modules-band { padding: 2rem 0; border-top: 1px solid var(--line); }
.module-stagger { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.2rem; }
.module-card { text-decoration: none; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; display: flex; flex-direction: column; gap: 0.4rem; position: relative; overflow: hidden; transition: border-color 0.15s ease, transform 0.15s ease; box-shadow: var(--shadow); }
.module-card:hover { border-color: var(--accent); transform: translateY(-2px); color: inherit; }
.module-card h3 { font-size: 1.5rem; margin: 0.2rem 0; }
.module-card p { color: var(--ink-2); margin: 0 0 0.6rem; }
.module-card .mc-icon { width: 44px; height: 44px; color: var(--green); }
.mc-0 { grid-column: 1 / span 7; }
.mc-1 { grid-column: 8 / span 5; margin-top: 2.5rem; }
.mc-2 { grid-column: 1 / span 5; margin-top: -1.5rem; }
.mc-3 { grid-column: 6 / span 7; }
.mc-0 .mc-icon { color: var(--red); } .mc-1 .mc-icon { color: var(--amber); } .mc-2 .mc-icon { color: var(--blue); } .mc-3 .mc-icon { color: var(--green); }
@media (max-width: 860px) { .module-stagger > * { grid-column: 1 / -1 !important; margin-top: 0 !important; } }
.mc-kicker { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin: 0; }
.mc-meta { display: flex; gap: 1rem; font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-3); margin-top: auto; }
.mc-progress { height: 4px; background: var(--bg-3); border-radius: 2px; margin-top: 0.8rem; overflow: hidden; position: relative; }
.mc-progress::after { content: ""; position: absolute; inset: 0; width: var(--p, 0%); background: var(--green); transition: width 0.4s ease; }
.mc-progress.big { height: 6px; margin-top: 1rem; }
.mc-progress[data-label]::before { content: attr(data-label); position: absolute; right: 0; top: -1.4rem; font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-3); }

.blueprint-band { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 3rem; padding: 3.5rem 0; border-top: 1px solid var(--line); align-items: center; }
@media (max-width: 860px) { .blueprint-band { grid-template-columns: 1fr; gap: 1.5rem; } }
.bp-bars { display: grid; gap: 0.55rem; }
.bp-bar { display: grid; grid-template-columns: 11rem 1fr 3rem; align-items: center; gap: 0.8rem; font-size: 0.92rem; }
.bp-bar .bp-fill { height: 18px; border-radius: 3px; background: var(--green); width: calc(var(--w) * 1% * 4.2); max-width: 100%; opacity: 0.85; }
.bp-bar.pc .bp-fill { background: var(--amber); }
.bp-bar .bp-num { font-family: var(--font-mono); color: var(--ink-2); text-align: right; }
@media (max-width: 560px) { .bp-bar { grid-template-columns: 7rem 1fr 3rem; font-size: 0.82rem; } }

.method-band { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 2rem; padding: 3rem 0 4rem; border-top: 1px solid var(--line); }
.method-item h3 { font-size: 1.25rem; }
.method-item p { color: var(--ink-2); font-size: 0.98rem; }
.method-item:nth-child(even) { padding-top: 1.5rem; }

/* ---------- generic page heads ---------- */
.page-head { padding: clamp(2.5rem, 6vw, 4.5rem) 0 1.5rem; }
.page-head.narrow { max-width: 760px; }
.prose { padding-bottom: 4rem; }
.prose h2 { margin-top: 2.2rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: 0.5rem; }

/* ---------- modules index ---------- */
.module-list { display: grid; gap: 1rem; padding-bottom: 2rem; }
.module-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 1.5rem; align-items: start; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.module-row .mr-icon { color: var(--green); width: 56px; }
.module-row:nth-child(1) .mr-icon { color: var(--red); } .module-row:nth-child(2) .mr-icon { color: var(--amber); } .module-row:nth-child(3) .mr-icon { color: var(--blue); }
.module-row h2 { font-size: 1.7rem; margin: 0.2rem 0 0.4rem; }
.module-row h2 a { text-decoration: none; }
.module-row p { color: var(--ink-2); }
.mr-actions { display: flex; flex-direction: column; gap: 0.5rem; }
@media (max-width: 700px) { .module-row { grid-template-columns: 1fr; } .mr-actions { flex-direction: row; } }
.queued { padding: 1rem 0 4rem; }

/* ---------- module layout ---------- */
.module-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 3rem; padding: 2rem 0 4rem; }
.module-side, .module-main { min-width: 0; }
.module-side { position: sticky; top: 4.2rem; align-self: start; max-height: calc(100vh - 5rem); overflow: auto; padding-right: 0.5rem; }
.side-label { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin: 1.4rem 0 0.5rem; }
.section-list { list-style: none; margin: 0; padding: 0; }
.section-list a { display: grid; grid-template-columns: 2rem 1fr 1.1rem; gap: 0.4rem; align-items: center; text-decoration: none; padding: 0.42rem 0.5rem; border-radius: 6px; color: var(--ink-2); font-size: 0.95rem; line-height: 1.3; }
.section-list a:hover, .section-list a.active { background: var(--bg-3); color: var(--ink); }
.section-list .sn-num { font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-3); }
.section-list .sn-title { overflow-wrap: anywhere; min-width: 0; }
.section-list .sn-check { width: 1rem; height: 1rem; color: var(--green); opacity: 0; }
.section-list a.read .sn-check { opacity: 1; }
.other-modules { list-style: none; padding: 0; margin: 0; }
.other-modules a { display: block; padding: 0.3rem 0.5rem; font-size: 0.95rem; color: var(--ink-2); text-decoration: none; overflow-wrap: anywhere; }
.other-modules a:hover { color: var(--accent); }
.module-side .btn { margin-top: 1rem; }
@media (max-width: 960px) {
  .module-layout { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .module-side { position: static; max-height: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: var(--bg-2); }
  .other-modules { display: flex; flex-wrap: wrap; gap: 0.3rem; }
}
.module-main { max-width: 78ch; }
.module-head { padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: 2rem; }
.module-meta { display: flex; flex-wrap: wrap; gap: 1.2rem; font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-3); margin-top: 0.8rem; }
.objectives { background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 1.3rem 1.5rem; margin-bottom: 2.5rem; }
.objectives h2 { font-size: 1.15rem; font-family: var(--font-body); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); }
.objectives ol { margin: 0; padding-left: 1.2rem; }
.objectives li { margin-bottom: 0.35rem; }

.content-section { padding: 1.5rem 0 2.5rem; border-bottom: 1px solid var(--line); scroll-margin-top: 4.5rem; }
.section-num { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.4rem; }
.content-section h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
.content-section h3 { margin-top: 2rem; font-size: 1.45rem; }
.content-section h4 { margin-top: 1.6rem; }
.content-section ul, .content-section ol { padding-left: 1.3rem; }
.content-section li { margin-bottom: 0.4rem; }
.content-section li > ul, .content-section li > ol { margin-top: 0.3rem; }
.content-section blockquote { border-left: 3px solid var(--line-2); margin: 1.2rem 0; padding: 0.2rem 1.2rem; color: var(--ink-2); font-style: italic; }
.content-section strong { color: var(--ink); }
sup.cite { font-size: 0.68em; margin-left: 0.1em; }
sup.cite a { text-decoration: none; color: var(--accent); font-family: var(--font-mono); }
sup.cite a:hover { text-decoration: underline; }
.table-wrap { overflow-x: auto; margin: 1.2rem 0; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg-3); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-2); }
tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; }

.callout { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1.4rem 0; background: var(--bg-2); border-left-width: 4px; }
.callout p:last-child, .callout ul:last-child, .callout ol:last-child { margin-bottom: 0; }
.callout-label { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0.5rem; }
.callout-label span { text-transform: none; letter-spacing: 0; font-family: var(--font-body); font-weight: 600; font-size: 0.95rem; color: var(--ink); }
.callout-key { border-left-color: var(--green); } .callout-key .callout-label { color: var(--green); }
.callout-pearl { border-left-color: var(--blue); } .callout-pearl .callout-label { color: var(--blue); }
.callout-warn { border-left-color: var(--red); } .callout-warn .callout-label { color: var(--red); }
.callout-exam { border-left-color: var(--amber); } .callout-exam .callout-label { color: var(--amber); }
.callout-update { border-left-color: var(--violet); } .callout-update .callout-label { color: var(--violet); }
.callout-mol { border-left-color: var(--accent); } .callout-mol .callout-label { color: var(--accent); }

.section-foot { margin-top: 1.5rem; }
.mark-read { display: inline-flex; align-items: center; gap: 0.6rem; background: none; border: 1px solid var(--line-2); color: var(--ink-2); padding: 0.5rem 0.9rem; border-radius: 999px; cursor: pointer; font-family: var(--font-body); font-size: 0.92rem; }
.mark-read .mr-box { width: 1.2rem; height: 1.2rem; border: 1px solid var(--line-2); border-radius: 4px; display: inline-grid; place-items: center; }
.mark-read .mr-box svg { width: 0.85rem; opacity: 0; }
.mark-read.done { border-color: var(--green); color: var(--green); }
.mark-read.done .mr-box { background: var(--green); border-color: var(--green); color: var(--bg); }
.mark-read.done .mr-box svg { opacity: 1; }

.sources h2 { font-size: 1.6rem; }
.source-list { padding-left: 1.6rem; font-size: 0.92rem; }
.source-list li { margin-bottom: 0.6rem; scroll-margin-top: 5rem; color: var(--ink-2); }
.source-list li:target { color: var(--ink); background: var(--accent-soft); border-radius: 4px; padding: 0.2rem 0.4rem; }
.src-link { font-family: var(--font-mono); font-size: 0.78rem; white-space: nowrap; }
.src-note { display: block; font-size: 0.85rem; color: var(--ink-3); }
.module-next { display: flex; gap: 0.8rem; flex-wrap: wrap; padding: 2rem 0; }

/* ---------- widgets ---------- */
.widget { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem 1.2rem; margin: 1.6rem 0; box-shadow: var(--shadow); }
.widget-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.6rem; }
.widget-title h3 { margin: 0; font-size: 1.15rem; font-family: var(--font-body); font-weight: 600; }
.widget-title .w-hint { font-size: 0.82rem; color: var(--ink-3); font-family: var(--font-mono); }
.w-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.7rem 1.2rem; margin: 0.8rem 0; }
.w-controls label { display: grid; gap: 0.15rem; font-size: 0.85rem; color: var(--ink-2); }
.w-controls label .w-val { font-family: var(--font-mono); color: var(--ink); font-size: 0.85rem; }
.w-controls label > span:first-child { display: flex; justify-content: space-between; }
.w-controls input[type="range"] { width: 100%; accent-color: var(--accent); }
.w-controls select, .w-controls input[type="number"], .w-controls input[type="text"] { background: var(--bg); color: var(--ink); border: 1px solid var(--line-2); border-radius: 6px; padding: 0.4rem 0.5rem; font-family: var(--font-mono); font-size: 0.9rem; }
.w-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.6rem 0; }
.w-btn { background: var(--bg-3); border: 1px solid var(--line-2); color: var(--ink); padding: 0.4rem 0.75rem; border-radius: 6px; cursor: pointer; font-family: var(--font-body); font-size: 0.9rem; }
.w-btn:hover { border-color: var(--accent); }
.w-btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.w-readout { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.6rem; margin-top: 0.8rem; }
.w-readout .ro { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.7rem; }
.w-readout .ro b { display: block; font-family: var(--font-mono); font-size: 1.15rem; font-weight: 600; }
.w-readout .ro span { font-size: 0.75rem; color: var(--ink-3); letter-spacing: 0.04em; text-transform: uppercase; }
.w-readout .ro.ok b { color: var(--green); } .w-readout .ro.warn b { color: var(--amber); } .w-readout .ro.bad b { color: var(--red); }
.w-note { font-size: 0.9rem; color: var(--ink-2); margin: 0.6rem 0 0; }
.w-note strong { color: var(--ink); }
.w-canvas { width: 100%; display: block; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.w-svg { width: 100%; height: auto; display: block; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.w-svg text { font-family: var(--font-mono); fill: var(--ink-2); }
.w-steps { display: grid; gap: 0.4rem; margin: 0.6rem 0; }
.w-step { display: grid; grid-template-columns: 2rem 1fr; gap: 0.6rem; padding: 0.5rem 0.7rem; border-radius: 8px; border: 1px solid transparent; font-size: 0.95rem; color: var(--ink-2); }
.w-step .n { font-family: var(--font-mono); color: var(--ink-3); }
.w-step.active { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.w-step.done { color: var(--ink); }
.w-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.8rem; font-family: var(--font-mono); color: var(--ink-2); margin-top: 0.5rem; }
.w-legend i { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 0.4rem; border-radius: 2px; }
.w-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 700px) { .w-grid2 { grid-template-columns: 1fr; } }
.w-table { font-size: 0.88rem; }
.vx-row { display: grid; grid-template-columns: minmax(9rem, 12rem) 1fr 130px; gap: 0.9rem; align-items: center; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.vx-row:last-child { border-bottom: 0; }
.vx-label { font-size: 0.95rem; }
.vx-trace { width: 130px; height: 52px; display: block; }
@media (max-width: 760px) { .vx-row { grid-template-columns: 1fr; gap: 0.4rem; } .vx-trace-cell:empty { display: none; } }
.w-table td, .w-table th { padding: 0.4rem 0.6rem; }

/* ---------- quiz ---------- */
.quiz-shell { padding-bottom: 2rem; }
.quiz-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.quiz-progress { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-3); margin-bottom: 0.8rem; }
.quiz-bar { height: 4px; background: var(--bg-3); border-radius: 2px; margin-bottom: 1.2rem; overflow: hidden; }
.quiz-bar i { display: block; height: 100%; background: var(--green); width: 0; transition: width 0.3s ease; }
.quiz-stem { font-size: 1.12rem; margin-bottom: 1rem; }
.quiz-opts { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.quiz-opt { display: grid; grid-template-columns: 1.8rem 1fr; gap: 0.7rem; align-items: start; text-align: left; width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 0.75rem 0.9rem; cursor: pointer; color: var(--ink); font-family: var(--font-body); font-size: 1rem; line-height: 1.45; }
.quiz-opt:hover { border-color: var(--accent); }
.quiz-opt .l { font-family: var(--font-mono); color: var(--ink-3); }
.quiz-opt.correct { border-color: var(--green); background: color-mix(in srgb, var(--green) 12%, var(--bg)); }
.quiz-opt.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 12%, var(--bg)); }
.quiz-opt[disabled] { cursor: default; }
.quiz-rationale { margin-top: 1.2rem; padding: 1rem 1.2rem; border-radius: 8px; border-left: 4px solid var(--green); background: var(--bg); }
.quiz-rationale.miss { border-left-color: var(--red); }
.quiz-rationale .qr-label { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 0.3rem; }
.quiz-rationale p:last-child { margin-bottom: 0; }
.quiz-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 1.2rem; gap: 1rem; flex-wrap: wrap; }
.quiz-tag { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-3); }
.quiz-result { text-align: center; padding: 1rem 0; }
.quiz-result .score { font-family: var(--font-display); font-size: 4rem; line-height: 1; color: var(--green); }
.quiz-result .score.mid { color: var(--amber); } .quiz-result .score.low { color: var(--red); }
.quiz-review { margin-top: 1.5rem; text-align: left; }
.quiz-review li { margin-bottom: 0.5rem; font-size: 0.95rem; }
.quiz-review .ok { color: var(--green); } .quiz-review .miss { color: var(--red); }

/* ---------- blueprint page ---------- */
.blueprint { padding-bottom: 4rem; display: grid; gap: 2.5rem; }
.bp-domain h2 { display: flex; align-items: baseline; gap: 0.8rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); }
.weight { font-family: var(--font-mono); font-size: 0.85rem; color: var(--accent); font-weight: 500; }
.bp-cat { margin: 1.5rem 0 0; scroll-margin-top: 4.5rem; }
.bp-cat h3 { display: flex; align-items: baseline; gap: 0.6rem; }
.bp-sub { color: var(--ink-2); font-size: 0.95rem; }
.bp-topics { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.3rem; }
.bp-topics li { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: baseline; padding: 0.45rem 0.6rem; border-radius: 6px; border: 1px solid transparent; scroll-margin-top: 4.5rem; }
.bp-topics li.covered { border-color: var(--line); background: var(--bg-2); }
.bp-topics li:target { border-color: var(--accent); }
.bp-mods { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; font-size: 0.82rem; }
.bp-mods a { font-family: var(--font-mono); font-size: 0.74rem; padding: 0.1rem 0.5rem; border: 1px solid var(--green); color: var(--green); border-radius: 999px; text-decoration: none; }
.bp-mods.muted { font-family: var(--font-mono); font-size: 0.74rem; }
@media (max-width: 600px) { .bp-topics li { grid-template-columns: 1fr; } .bp-mods { justify-content: flex-start; } }

/* ---------- dashboard ---------- */
.dashboard { padding-bottom: 4rem; display: grid; gap: 2rem; }
.dash-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.8rem; }
.dash-summary .ro { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.dash-summary .ro b { display: block; font-family: var(--font-display); font-size: 2.2rem; line-height: 1; }
.dash-summary .ro span { font-size: 0.78rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; }
.dash-cats { display: grid; gap: 0.6rem; }
.dash-cat { display: grid; grid-template-columns: minmax(10rem, 16rem) 1fr 4rem; gap: 1rem; align-items: center; padding: 0.7rem 0.9rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; }
.dash-cat .dc-name { font-weight: 600; font-size: 0.95rem; }
.dash-cat .dc-name small { display: block; font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-3); font-weight: 400; }
.dash-cat .dc-bar { height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; border: 1px solid var(--line); }
.dash-cat .dc-bar i { display: block; height: 100%; background: var(--green); width: var(--p, 0%); transition: width 0.5s ease; }
.dash-cat.none .dc-bar i { background: var(--ink-3); }
.dash-cat .dc-num { font-family: var(--font-mono); text-align: right; color: var(--ink-2); }
@media (max-width: 600px) { .dash-cat { grid-template-columns: 1fr 3.5rem; } .dash-cat .dc-bar { grid-column: 1 / -1; } }
.dash-modules { display: grid; gap: 0.6rem; }
.dash-mod { display: grid; grid-template-columns: 1fr auto auto; gap: 1rem; align-items: center; padding: 0.7rem 0.9rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); font-size: 0.95rem; }
.dash-mod .dm-stat { font-family: var(--font-mono); font-size: 0.82rem; color: var(--ink-2); }
.dash-tools { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.dash-tools textarea { width: 100%; min-height: 80px; background: var(--bg); color: var(--ink); border: 1px solid var(--line-2); border-radius: 6px; font-family: var(--font-mono); font-size: 0.8rem; padding: 0.5rem; }

/* ---------- resources ---------- */
.resources { display: grid; gap: 2.5rem; padding-bottom: 4rem; }
.res-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.res-list li { padding: 0.8rem 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); display: grid; gap: 0.2rem; }
.res-list a { text-decoration: none; }
.res-desc { color: var(--ink-2); font-size: 0.95rem; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 3rem; padding: 2.5rem clamp(1rem, 3vw, 2.5rem) 2rem; background: var(--bg-2); }
.footer-grid { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 2fr) 1fr 1fr; gap: 2.5rem; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; } }
.footer-brand p { color: var(--ink-2); max-width: 52ch; font-size: 0.95rem; }
.footer-col a { display: block; color: var(--ink-2); text-decoration: none; padding: 0.15rem 0; font-size: 0.95rem; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { max-width: var(--maxw); margin: 2rem auto 0; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 1rem; }

/* ---------- print ---------- */
@media print {
  .topbar, .module-side, .section-foot, .module-next, .footer, .widget .w-controls { display: none !important; }
  .module-layout { grid-template-columns: 1fr; }
  body { background: #fff; color: #000; }
}
