/* ECG Engineering course styles (built from src/css) */
/* ECG Engineering course: design tokens. Bright editorial theme, no dark mode by design. */
@font-face { font-family: Inter; src: url(fonts/Inter-Regular.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/Inter-Italic.woff2) format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/Inter-Medium.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/Inter-SemiBold.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/Inter-Bold.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/Inter-ExtraBold.woff2) format('woff2'); font-weight: 800 900; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url(fonts/JetBrainsMono-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url(fonts/JetBrainsMono-500.woff2) format('woff2'); font-weight: 500 600; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url(fonts/JetBrainsMono-700.woff2) format('woff2'); font-weight: 700 800; font-display: swap; }

:root {
  color-scheme: light;
  --canvas: #FFFFFF;
  --surface: #F8FAFC;
  --surface2: #F1F5F9;
  --ink: #0F172A;
  --ink2: #1E293B;
  --muted: #475569;
  --faint: #64748B;
  --line: #E2E8F0;
  --line2: #CBD5E1;
  --leader: #94A3B8;
  --hair: rgba(15, 23, 42, 0.08);
  --crimson: #DC2626; --crimson-d: #991B1B; --crimson-t: #FEE2E2; --crimson-w: #FEF2F2;
  --blue: #1D4ED8; --blue-d: #1E3A8A; --blue-t: #DBEAFE; --blue-w: #EFF6FF;
  --teal: #0D9488; --teal-d: #115E59; --teal-t: #CCFBF1; --teal-w: #F0FDFA;
  --amber: #D97706; --amber-d: #92400E; --amber-t: #FEF3C7; --amber-w: #FFFBEB;
  --grid-minor: #F1E4E6; --grid-major: #E9C9CE;
  --sans: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", Consolas, "SFMono-Regular", monospace;
  --hi: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --sh-1: 0 1px 1px rgba(15, 23, 42, 0.03), 0 1px 3px rgba(15, 23, 42, 0.05);
  --sh-2: 0 1px 1px rgba(15, 23, 42, 0.03), 0 2px 4px rgba(15, 23, 42, 0.04), 0 8px 20px -6px rgba(15, 23, 42, 0.08);
  --sh-3: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 14px -4px rgba(15, 23, 42, 0.08), 0 24px 48px -12px rgba(15, 23, 42, 0.14);
  --sh-pop: 0 2px 4px rgba(15, 23, 42, 0.05), 0 12px 32px -8px rgba(15, 23, 42, 0.18), 0 40px 80px -20px rgba(15, 23, 42, 0.22);
  --glass: rgba(255, 255, 255, 0.72);
  --spring: cubic-bezier(0.34, 1.36, 0.64, 1);
  --out: cubic-bezier(0.16, 1, 0.3, 1);
  --r-sm: 8px; --r: 12px; --r-lg: 18px;
  --topbar: 58px; --sidebar: 296px; --measure: 780px;
}

/* =============================================================================
   Base typography (shared with the Wi-Fi 6 course)
   ============================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar) + 20px); }
body {
  margin: 0; background: var(--canvas); color: var(--ink2);
  font: 400 16px/1.68 var(--sans); font-feature-settings: "cv01", "ss01", "calt";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
::selection { background: #BFDBFE; color: var(--ink); }
img, svg, canvas { max-width: 100%; }
button { font-family: inherit; }
a { color: var(--blue); text-decoration: none; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.templates { display: none; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip:focus { top: 10px; }
.noscript { padding: 40px; font-size: 18px; }

h1, h2, h3, h4 { color: var(--ink); font-weight: 700; letter-spacing: -0.015em; line-height: 1.25; }
h2 { font-size: 30px; letter-spacing: -0.025em; margin: 0 0 18px; }
h2 .hn, h3 .hn { font: 600 0.62em var(--mono); color: var(--blue); letter-spacing: 0; margin-right: 12px; vertical-align: 0.18em; font-variant-numeric: tabular-nums; }
h3 { font-size: 21px; margin: 44px 0 12px; }
h3 .hn { font-size: 0.66em; }
h4 { font-size: 17px; margin: 28px 0 8px; }
p { margin: 0 0 16px; }
ul, ol { padding-left: 24px; margin: 0 0 18px; }
li { margin: 0 0 7px; }
li::marker { color: var(--faint); }
ol li::marker { font: 600 0.88em var(--mono); color: var(--blue); }
strong, b { color: var(--ink); font-weight: 650; }
em { font-style: italic; }
sub, sup { font-size: 0.72em; line-height: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
code {
  font: 500 0.86em var(--mono); color: var(--ink); background: #F1F5F9; border: 1px solid var(--hair);
  border-radius: 6px; padding: 1px 5px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
}
pre {
  font: 400 13px/1.6 var(--mono); background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r);
  padding: 16px 18px; overflow-x: auto; margin: 0 0 18px; box-shadow: var(--hi); color: var(--ink2); tab-size: 4;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
kbd {
  font: 600 11px/1 var(--mono); color: var(--muted); background: #fff; border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 6px; padding: 3px 6px;
}

/* ---------- app chrome: frosted top bar, sticky collapsible sidebar, main stage ---------- */
:root { --spring-soft: cubic-bezier(0.22, 1.2, 0.36, 1); --wide: 1180px; }
.topbar { position: fixed; inset: 0 0 auto 0; height: var(--topbar); z-index: 60; display: flex; align-items: center; gap: 14px; padding: 0 18px 0 12px;
  background: rgba(255, 255, 255, 0.74); -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--hair); }
.tb-icon { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer;
  transition: background .2s, color .2s, transform .15s var(--out); }
.tb-icon:hover { background: var(--surface); color: var(--ink); border-color: var(--hair); }
.tb-icon:active { transform: scale(0.96); }
.tb-icon svg { width: 18px; height: 18px; }
.tb-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font: 700 15px/1 var(--sans); letter-spacing: -0.01em; white-space: nowrap; }
.tb-brand:hover { text-decoration: none; }
.tb-crumb { display: flex; align-items: center; gap: 8px; min-width: 0; font: 500 13px/1 var(--sans); color: var(--faint); overflow: hidden; }
.tb-crumb span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-crumb span + span::before { content: "/"; color: var(--line2); margin-right: 8px; }
.tb-crumb .cb-m { font: 600 12px/1 var(--mono); color: var(--crimson); flex: none; }
.tb-crumb .cb-t { color: var(--ink2); font-weight: 600; max-width: 380px; }
.tb-sp { flex: 1; }
.tb-search { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 8px 0 12px; min-width: 240px; border: 1px solid var(--line); border-radius: 10px;
  background: rgba(248, 250, 252, 0.8); color: var(--faint); font: 500 13.5px/1 var(--sans); cursor: pointer; box-shadow: var(--hi), var(--sh-1);
  transition: border-color .2s, box-shadow .25s var(--out), transform .15s var(--out); }
.tb-search:hover { border-color: var(--line2); box-shadow: var(--hi), var(--sh-2); }
.tb-search:active { transform: scale(0.98); }
.tb-search svg { width: 16px; height: 16px; }
.tb-st { flex: 1; text-align: left; }
.tb-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; pointer-events: none; }
.tb-progress span { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--crimson), var(--blue) 60%, var(--teal)); transition: transform .12s linear; }

.side { position: fixed; top: var(--topbar); bottom: 0; left: 0; width: var(--sidebar); z-index: 50; background: rgba(248, 250, 252, 0.88); border-right: 1px solid var(--hair);
  -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%); transition: transform .45s var(--out); }
.side-in { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 18px 14px 24px; display: flex; flex-direction: column; gap: 14px; scrollbar-width: thin; scrollbar-color: #CBD5E1 transparent; }
.side-prog { background: #fff; border: 1px solid var(--hair); border-radius: var(--r); padding: 14px 14px 12px; box-shadow: var(--hi), var(--sh-1); }
.sp-top { display: flex; justify-content: space-between; align-items: baseline; font: 600 12.5px/1 var(--sans); color: var(--ink2); }
.sp-top b { font: 700 13px/1 var(--mono); color: var(--teal-d); font-variant-numeric: tabular-nums; }
.sp-bar { height: 6px; background: #EEF2F6; border-radius: 999px; margin: 10px 0 8px; overflow: hidden; }
.sp-bar span { display: block; height: 100%; width: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--crimson), var(--teal)); transform-origin: 0 50%; transform: scaleX(0); transition: transform .7s var(--spring-soft); }
.sp-sub { font: 500 11.5px/1.3 var(--sans); color: var(--faint); font-variant-numeric: tabular-nums; }
.sn-home { display: flex; align-items: center; gap: 9px; font: 600 13px/1 var(--sans); color: var(--ink2); padding: 9px 10px; border-radius: 9px; }
.sn-home svg { width: 16px; height: 16px; color: var(--faint); }
.sn-home:hover, .sn-home.on { background: #fff; color: var(--crimson); text-decoration: none; box-shadow: var(--sh-1); }
.sn-ph { font: 700 10.5px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 4px 10px 2px; }
.sn-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.sn-item { margin: 0; border-radius: 10px; }
.sn-row { display: flex; align-items: center; gap: 4px; padding: 2px 6px 2px 4px; border-radius: 10px; transition: background .2s; }
.sn-row:hover { background: rgba(255, 255, 255, 0.9); }
.sn-item.on > .sn-row { background: #fff; box-shadow: var(--hi), var(--sh-1); }
.sn-check { position: relative; width: 24px; height: 24px; flex: none; display: grid; place-items: center; cursor: pointer; }
.sn-check input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.sn-check span { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid #CBD5E1; background: #fff; transition: background .2s, border-color .2s, transform .25s var(--spring); }
.sn-check input:checked + span { background: var(--teal); border-color: var(--teal); background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M4 8.5l2.6 2.6L12 5.5' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/></svg>"); background-size: 100%; }
.sn-check input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.sn-item[data-status="progress"] .sn-check span { border-color: var(--crimson-m, #FCA5A5); }
.sn-link { flex: 1; min-width: 0; display: flex; gap: 9px; align-items: baseline; padding: 8px 4px; color: var(--ink2); font: 500 13px/1.35 var(--sans); }
.sn-link:hover { text-decoration: none; color: var(--ink); }
.sn-item.on .sn-link { color: var(--crimson-d); font-weight: 650; }
.sn-n { font: 600 11px/1 var(--mono); color: var(--faint); flex: none; width: 20px; font-variant-numeric: tabular-nums; }
.sn-item.on .sn-n { color: var(--crimson); }
.sn-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-min { font: 500 10.5px/1 var(--mono); color: #94A3B8; flex: none; font-variant-numeric: tabular-nums; }
.sn-tabs { list-style: none; margin: 2px 0 8px 34px; padding: 0 0 0 10px; border-left: 1px solid var(--line); }
.sn-tabs li { margin: 0; }
.sn-tabs a { display: flex; gap: 8px; align-items: center; padding: 5px 8px; font: 500 12.5px/1.35 var(--sans); color: var(--muted); border-radius: 7px; position: relative; }
.sn-tabs a:hover { text-decoration: none; color: var(--ink); background: rgba(255, 255, 255, 0.8); }
.sn-tabs a.on { color: var(--crimson-d); font-weight: 600; background: #fff; }
.sn-tabs a.on::before { content: ""; position: absolute; left: -11px; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: var(--crimson); }
.sn-tabs a i { width: 6px; height: 6px; border-radius: 50%; background: var(--line2); flex: none; }
.sn-tabs a.seen i { background: var(--teal); }
.side-keys { background: #fff; border: 1px solid var(--hair); border-radius: var(--r); padding: 10px 12px; font: 500 11.5px/1.9 var(--sans); color: var(--muted); }
.side-keys div { display: flex; justify-content: space-between; gap: 10px; }
.side-foot { margin-top: auto; padding: 10px 10px 0; font: 500 11px/1.4 var(--mono); color: #94A3B8; }

.main { padding: var(--topbar) 0 0 var(--sidebar); min-height: 100vh; transition: padding-left .45s var(--out); outline: none; }
html.side-collapsed .side { transform: translateX(-100%); }
html.side-collapsed .main { padding-left: 0; }
@media (max-width: 1100px) {
  .main { padding-left: 0; }
  .side { transform: translateX(-100%); box-shadow: var(--sh-pop); width: min(320px, 88vw); }
  html.side-over .side { transform: none; }
}
@media (max-width: 860px) { .tb-crumb { display: none; } .tb-search { min-width: 0; } .tb-st { display: none; } }

/* ---------- module page ---------- */
.mod { padding: 34px 40px 80px; }
.mod-head { max-width: var(--wide); margin: 0 auto 18px; display: grid; grid-template-columns: 1fr auto; gap: 18px 32px; align-items: end; }
.mod-kicker { font: 600 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--crimson); margin-bottom: 12px; }
.mod-title { font-size: 38px; line-height: 1.12; letter-spacing: -0.03em; margin: 0 0 12px; max-width: 880px; }
.mod-sum { color: var(--muted); font-size: 16.5px; max-width: 820px; margin: 0; }
.mod-meta { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2); background: #fff; color: var(--ink2);
  font: 600 13px/1 var(--sans); cursor: pointer; box-shadow: var(--sh-1); transition: transform .18s var(--spring), border-color .15s, background-color .15s; white-space: nowrap; }
.btn:hover { border-color: var(--leader); text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink2); }
.btn.done { background: var(--teal-w); border-color: var(--teal); color: var(--teal-d); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font: 600 11.5px/1 var(--mono); color: var(--muted); }

.tabs { position: sticky; top: var(--topbar); z-index: 40; margin: 0 -40px; padding: 10px 40px; background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%); border-bottom: 1px solid var(--hair); }
.tabs-in { position: relative; max-width: var(--wide); margin: 0 auto; display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--hair); }
.tab { position: relative; z-index: 1; flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: 9px; height: 40px; border: 0; border-radius: 10px; background: transparent;
  color: var(--muted); font: 600 13.5px/1 var(--sans); cursor: pointer; transition: color .25s var(--out); white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); }
.tab .tn { font: 600 11px/1 var(--mono); color: var(--faint); }
.tab.on .tn { color: var(--crimson); }
.tab svg { width: 16px; height: 16px; }
.tab-pill { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 10px; background: #fff; box-shadow: var(--sh-2), inset 0 0 0 1px var(--hair);
  transition: transform .42s var(--spring-soft), width .42s var(--spring-soft); will-change: transform; }

.body { max-width: var(--wide); margin: 0 auto; padding-top: 34px; }
.prose > * { max-width: var(--measure); margin-left: auto; margin-right: auto; }
.prose > .sim-mount, .prose > .wide { max-width: var(--wide); }
.prose > h2 { margin-top: 56px; }
.prose > h2:first-child { margin-top: 8px; }
.tab-enter { animation: tabIn .45s var(--out); }
@keyframes tabIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.mod-foot { max-width: var(--measure); margin: 64px auto 0; padding-top: 26px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 18px; }
.mf-done { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--hair); }
.mf-done p { margin: 0; color: var(--muted); font-size: 14px; }
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pn a { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line); background: #fff; box-shadow: var(--sh-1); color: var(--ink); transition: border-color .2s, box-shadow .2s, transform .2s var(--out); }
.pn a:hover { text-decoration: none; border-color: var(--leader); box-shadow: var(--sh-2); transform: translateY(-1px); }
.pn a small { font: 600 11px/1 var(--mono); color: var(--faint); letter-spacing: .04em; text-transform: uppercase; }
.pn a b { font-size: 14.5px; }
.pn .nx { text-align: right; align-items: flex-end; }
.pn .empty { visibility: hidden; }
.hl-flash { animation: hlFlash 2.2s var(--out); border-radius: 6px; }
@keyframes hlFlash { 0%, 30% { background: #FEF3C7; box-shadow: 0 0 0 6px #FEF3C7; } 100% { background: transparent; box-shadow: 0 0 0 6px transparent; } }
@media (prefers-reduced-motion: reduce) { .tab-pill, .tab-enter, .sp-bar span, .side { transition: none; animation: none; } .hl-flash { animation: none; background: #FEF3C7; } }

/* ---------- content building blocks: lenses, formula cards, analogies, callouts, tables, figures, quizzes ---------- */
.prose h2 { font-size: 28px; letter-spacing: -0.025em; }
.prose h3 { font-size: 20px; margin: 36px auto 10px; }
.prose p, .prose li { color: var(--ink2); }
.prose ul, .prose ol { padding-left: 24px; }
.prose > ul, .prose > ol { padding-left: 24px; }

.lens { position: relative; margin: 26px auto; padding: 18px 20px 6px; border-radius: var(--r); border: 1px solid; box-shadow: var(--sh-1); }
.lens.phys { background: #FEF2F2; border-color: #DC2626; }
.lens.dsp { background: #EFF6FF; border-color: #1D4ED8; }
.lens-badge { display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px; margin: 0 0 12px; border-radius: 999px; font: 700 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: #fff; }
.lens.phys .lens-badge { background: #DC2626; }
.lens.dsp .lens-badge { background: #1D4ED8; }
.lens.phys .lens-badge::before, .lens.dsp .lens-badge::before { content: ""; width: 10px; height: 10px; background: #fff; flex: none;
  -webkit-mask: var(--lens-ic) center / contain no-repeat; mask: var(--lens-ic) center / contain no-repeat; }
.lens.phys { --lens-ic: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'><path d='M5 9 1.3 5.2A2.2 2.2 0 0 1 5 2.4a2.2 2.2 0 0 1 3.7 2.8z'/></svg>"); }
.lens.dsp { --lens-ic: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'><path d='M0 6h2l1.5-4 3 7L8 5h2v1H8.6L6.6 10 3.4 3.3 2.7 7H0z'/></svg>"); }
.lens p:last-child, .lens ul:last-child { margin-bottom: 14px; }

.formula { margin: 24px auto; border-radius: var(--r); background: #fff; border: 1px solid var(--line); box-shadow: var(--sh-2); overflow: hidden; }
.f-title { padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); font: 700 12px/1.3 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--blue-d); }
.f-eq { padding: 16px 18px; font: 600 16px/1.6 var(--mono); color: var(--ink); background: linear-gradient(#fff, #FBFCFE); overflow-x: auto; font-variant-numeric: tabular-nums; }
.f-legend { margin: 0; padding: 10px 18px 14px; display: grid; grid-template-columns: max-content 1fr; gap: 5px 16px; border-top: 1px dashed var(--line); font-size: 13.5px; }
.f-legend dt { font: 600 13px/1.5 var(--mono); color: var(--blue); }
.f-legend dd { margin: 0; color: var(--muted); line-height: 1.5; }

.analogy { margin: 24px auto; padding: 16px 20px 4px 22px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ink2); }
.an-k { font: 700 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); margin-bottom: 10px; }
div.note, div.warn, div.key { margin: 22px auto; padding: 14px 18px 2px; border-radius: var(--r); border: 1px solid; font-size: 15px; }
div.note { background: var(--surface); border-color: var(--line); }
div.warn { background: var(--amber-w); border-color: #FCD34D; }
div.warn::before { content: "Pitfall"; display: block; font: 700 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--amber-d); margin-bottom: 8px; }
div.key { background: var(--teal-w); border-color: #5EEAD4; }
div.key::before { content: "Reference"; display: block; font: 700 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--teal-d); margin-bottom: 8px; }

.tbl { width: 100%; border-collapse: separate; border-spacing: 0; margin: 22px auto; font-size: 14px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--sh-1); }
.tbl th { text-align: left; font: 700 11.5px/1.3 var(--sans); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 12px; border-bottom: 1px solid #EEF2F6; vertical-align: top; color: var(--ink2); line-height: 1.5; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #FAFBFD; }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 22px auto; }
.grid2 > div > :first-child { margin-top: 0; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

.fig { margin: 30px auto; padding: 18px 18px 12px; border-radius: var(--r-lg); background: #fff; border: 1px solid var(--hair); box-shadow: var(--sh-2); }
.fig svg { display: block; width: 100%; height: auto; }
.fig figcaption { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.fig figcaption b { color: var(--ink); font-family: var(--mono); font-size: 12.5px; margin-right: 6px; }

.quiz { margin: 14px auto; border: 1px solid var(--line); border-radius: var(--r); background: #fff; box-shadow: var(--sh-1); overflow: hidden; }
.quiz summary { list-style: none; cursor: pointer; padding: 14px 44px 14px 18px; position: relative; font-weight: 600; color: var(--ink); }
.quiz summary::-webkit-details-marker { display: none; }
.quiz summary::before { content: "Q"; font: 700 11px/20px var(--mono); display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--blue-t); color: var(--blue-d); margin-right: 10px; vertical-align: 1px; }
.quiz summary::after { content: ""; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: translateY(-70%) rotate(45deg); transition: transform .25s var(--out); }
.quiz[open] summary::after { transform: translateY(-30%) rotate(225deg); }
.quiz .ans { padding: 2px 18px 6px 48px; border-top: 1px dashed var(--line); background: var(--teal-w); }
.quiz .ans p { margin: 10px 0; }

ol.steps { list-style: none; counter-reset: st; padding: 0; margin: 22px auto; }
ol.steps > li { counter-increment: st; position: relative; padding: 12px 14px 12px 52px; margin: 0 0 8px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--hair); }
ol.steps > li::before { content: counter(st); position: absolute; left: 14px; top: 12px; width: 26px; height: 26px; border-radius: 8px; background: var(--ink); color: #fff; display: grid; place-items: center; font: 700 12px/1 var(--mono); }
ol.steps > li::marker { content: none; }

/* ---------- simulators: stage (upper 70%) + bottom instrument dock ---------- */
.sim-mount { margin: 28px 0 32px; }
.sim { position: relative; background: var(--canvas); border: 1px solid var(--hair); border-radius: var(--r-lg); box-shadow: var(--sh-2); overflow: hidden; outline: none; }
.sim-head { display: flex; align-items: baseline; gap: 12px; padding: 12px 18px 10px; border-bottom: 1px solid var(--line); background: linear-gradient(#fff, #FBFCFE); }
.sim-title { font-weight: 700; font-size: 14.5px; color: var(--ink); letter-spacing: -0.005em; }
.sim-sub { font-size: 12.5px; color: var(--muted); }
.sim-stage { position: relative; height: clamp(360px, 62vh, 640px); background: #fff; }
.sim-stage.short { height: clamp(300px, 48vh, 520px); }
.sim-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.sim-dock { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 9px 12px; border-top: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.82); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); font-size: 12.5px; }
.dk-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dk-sep { width: 1px; height: 22px; background: var(--line2); }
.dk-spacer { flex: 1 1 0; }
.dk-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--line2);
  background: #fff; color: var(--ink2); font: 500 12.5px var(--sans); cursor: pointer; box-shadow: var(--sh-1);
  transition: transform .18s var(--spring), background-color .15s, border-color .15s, color .15s; white-space: nowrap; }
.dk-btn svg { width: 14px; height: 14px; flex: none; }
.dk-btn:hover { border-color: var(--leader); }
.dk-btn:active { transform: scale(0.96); }
.dk-btn:focus-visible, .dk-pill:focus-visible, .dk-slider input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.dk-btn.on { background: var(--blue-w); border-color: var(--blue); color: var(--blue-d); }
.dk-btn.btn-play { background: var(--ink); color: #fff; border-color: var(--ink); min-width: 84px; }
.dk-btn.btn-play:hover { background: var(--ink2); }
.dk-btn.btn-audio.on { background: var(--crimson-w); border-color: var(--crimson); color: var(--crimson-d); }
.dk-btn.warn.on { background: var(--amber-w); border-color: var(--amber); color: var(--amber-d); }
.dk-slider { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.dk-lab { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
.dk-val { min-width: 46px; text-align: right; font: 600 12px var(--mono); color: var(--ink); }
.dk-slider input[type=range] { width: 110px; accent-color: var(--blue); height: 18px; margin: 0; }
.dk-slider.speed input[type=range] { accent-color: var(--ink2); }
.dk-pills { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 3px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.dk-pills .dk-lab { padding: 0 6px 0 5px; }
.dk-pill { height: 26px; padding: 0 10px; border-radius: 7px; border: 0; background: transparent; color: var(--ink2); font: 500 12px var(--sans); cursor: pointer; white-space: nowrap;
  transition: background-color .2s var(--out), color .2s; }
.dk-pill:hover { background: var(--surface2); }
.dk-pill.on { background: var(--ink); color: #fff; }
.dk-read { display: inline-flex; align-items: baseline; gap: 6px; height: 30px; line-height: 30px; padding: 0 10px; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.dk-read .num { font: 600 12.5px var(--mono); color: var(--ink); }
.num, .dk-val, .cal-badge, .readout { font-variant-numeric: tabular-nums; }
/* floating glass readouts inside the stage */
.cal-badge { position: absolute; z-index: 3; pointer-events: none; min-width: 132px; padding: 8px 10px; border-radius: 10px; background: var(--glass);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(29, 78, 216, 0.25); box-shadow: var(--sh-2); font-size: 12px; }
.cal-badge div { display: flex; justify-content: space-between; gap: 12px; }
.cal-badge span { color: var(--muted); }
.cal-badge b { font: 600 12.5px var(--mono); color: var(--blue-d); }
.cal-badge .cal-small { color: var(--faint); font: 500 11px var(--mono); justify-content: flex-end; }
.sim-panel { position: absolute; z-index: 2; padding: 10px 12px; border-radius: 12px; background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--hair); box-shadow: var(--sh-2); font-size: 12.5px; line-height: 1.45; color: var(--ink2); }
.sim-panel h4 { margin: 0 0 4px; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.sim-panel .mono, .sim-panel code { font-family: var(--mono); font-size: 12px; }
.readout-box { border-left: 3px solid var(--amber); }
.readout-box.ok { border-left-color: var(--teal); }
.sim-missing { padding: 24px; border: 1px dashed var(--line2); border-radius: var(--r); color: var(--muted); }
/* cinema / full-stage focus */
.sim.cinema { position: fixed; inset: 14px; z-index: 900; border-radius: 20px; box-shadow: var(--sh-pop); display: flex; flex-direction: column; }
.sim.cinema .sim-stage { flex: 1 1 auto; height: auto; }
body.has-cinema::after { content: ''; position: fixed; inset: 0; z-index: 899; background: rgba(15, 23, 42, 0.42); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
body.has-cinema { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .dk-btn, .dk-pill { transition: none; } }

/* ---------- dashboard: Bento grid ---------- */
.dash { padding: 34px 40px 80px; }
.bento { max-width: var(--wide); margin: 0 auto; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; }
.bx { position: relative; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--hair); box-shadow: var(--sh-2); padding: 22px 24px; }
.bx.intro { grid-column: span 8; background: #fff; }
.bx.prog { grid-column: span 4; display: flex; flex-direction: column; gap: 14px; }
.bx.hero { grid-column: span 12; padding: 0; background: #fff; overflow: hidden; }
.bx.hero .sim-mount { margin: 0; }
.bx.hero .sim { border: 0; border-radius: 0; box-shadow: none; }
.bx.card { grid-column: span 4; display: flex; flex-direction: column; gap: 12px; background: #fff; transition: transform .3s var(--out), box-shadow .3s var(--out), border-color .3s; }
.bx.card:hover { transform: translateY(-2px); box-shadow: var(--sh-3); border-color: rgba(15, 23, 42, 0.14); }
.bx.card.wide { grid-column: span 8; }
.d-kick { font: 600 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--crimson); margin-bottom: 12px; }
.d-title { font-size: 34px; line-height: 1.12; letter-spacing: -0.03em; margin: 0 0 14px; }
.d-title span { color: var(--crimson); }
.d-lead { color: var(--muted); font-size: 16px; margin: 0 0 18px; max-width: 680px; }
.d-legend { display: flex; flex-wrap: wrap; gap: 8px; }
.d-legend .chip i { width: 9px; height: 9px; border-radius: 3px; }
.ring { display: flex; align-items: center; gap: 16px; }
.ring svg { width: 86px; height: 86px; flex: none; }
.ring .rv { font: 700 26px/1 var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.ring small { display: block; color: var(--faint); font-size: 12.5px; margin-top: 6px; }
.prog .btn { justify-content: center; }
.prog .kb { font-size: 12px; color: var(--faint); line-height: 1.9; }
.c-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.c-num { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font: 700 15px/1 var(--mono); color: #fff; background: var(--ink); box-shadow: var(--sh-1); }
.c-stat { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font: 600 11px/1 var(--mono); letter-spacing: .02em; border: 1px solid var(--line); color: var(--faint); background: var(--surface); }
.c-stat[data-s="progress"] { color: var(--crimson-d); border-color: #FCA5A5; background: var(--crimson-w); }
.c-stat[data-s="done"] { color: var(--teal-d); border-color: #5EEAD4; background: var(--teal-w); }
.c-title { font-size: 19px; line-height: 1.25; margin: 2px 0 0; letter-spacing: -0.015em; }
.c-sum { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0; }
.c-scope { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.c-scope li { position: relative; padding-left: 16px; margin: 0; font-size: 13px; line-height: 1.45; color: var(--ink2); }
.c-scope li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 6px; height: 6px; border-radius: 2px; background: var(--crimson); opacity: .7; }
.c-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.c-time { font: 600 12px/1 var(--mono); color: var(--faint); font-variant-numeric: tabular-nums; }
.c-bar { height: 4px; border-radius: 999px; background: #EEF2F6; overflow: hidden; }
.c-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--crimson), var(--teal)); border-radius: 999px; }
@media (max-width: 1200px) { .bx.card { grid-column: span 6; } .bx.intro { grid-column: span 12; } .bx.prog { grid-column: span 12; } }
@media (max-width: 760px) { .bx.card { grid-column: span 12; } .dash, .mod { padding-left: 18px; padding-right: 18px; } .tabs { margin: 0 -18px; padding: 10px 18px; } .tab .tl { display: none; } }
/* primer card: full width, sits above the six modules */
.bx.card.primer { grid-column: span 12; background: linear-gradient(180deg, #EFF6FF, #fff 70%); border-color: rgba(29, 78, 216, 0.22); }
.bx.card.primer .c-num { background: var(--blue); }
.bx.card.primer .c-scope { columns: 2; column-gap: 28px; }
.c-pk { font: 700 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--blue); }

/* ---------- Ctrl+K global search (glass modal) ---------- */
.sk { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 20px 20px; background: rgba(15, 23, 42, 0.32);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: skIn .2s var(--out); }
@keyframes skIn { from { opacity: 0; } to { opacity: 1; } }
.sk-box { width: min(720px, 100%); max-height: 70vh; display: flex; flex-direction: column; border-radius: 18px; background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%); border: 1px solid rgba(255, 255, 255, 0.7); box-shadow: var(--sh-pop); overflow: hidden;
  animation: skBox .32s var(--spring-soft); }
@keyframes skBox { from { transform: translateY(-10px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.sk-in { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--hair); }
.sk-in svg { width: 18px; height: 18px; color: var(--faint); flex: none; }
.sk-in input { flex: 1; height: 58px; border: 0; outline: 0; background: transparent; font: 500 17px/1 var(--sans); color: var(--ink); }
.sk-in input::placeholder { color: #94A3B8; }
.sk-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.sk-list li { margin: 0; }
.sk-it { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; color: var(--ink2); cursor: pointer; }
.sk-it:hover { text-decoration: none; }
.sk-it.on { background: #fff; box-shadow: var(--sh-1), inset 0 0 0 1px var(--hair); }
.sk-path { display: flex; gap: 8px; align-items: center; font: 600 11px/1 var(--mono); color: var(--faint); letter-spacing: .02em; }
.sk-path b { color: var(--crimson); }
.sk-h { font-weight: 650; color: var(--ink); font-size: 14.5px; }
.sk-x { font-size: 13px; color: var(--muted); line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sk-x mark, .sk-h mark { background: #FEF3C7; color: inherit; border-radius: 3px; padding: 0 1px; }
.sk-empty { padding: 26px; text-align: center; color: var(--faint); font-size: 14px; }
.sk-foot { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--hair); font-size: 12px; color: var(--faint); background: rgba(248, 250, 252, 0.6); }

/* ---------- one-page printable cheat sheet per module ---------- */
.print-sheet { display: none; }
@media print {
  @page { size: auto; margin: 9mm; }
  body.printing-cheat > *:not(.print-sheet) { display: none !important; }
  body.printing-cheat .print-sheet { display: block; }
  body.printing-cheat { background: #fff; font-size: 9pt; line-height: 1.3; }
  .print-sheet { color: #0F172A; font-family: var(--sans); }
  .ps-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #0F172A; padding-bottom: 4pt; margin-bottom: 8pt; }
  .ps-head h1 { font-size: 15pt; margin: 0; letter-spacing: -0.01em; }
  .ps-head small { font: 600 8pt var(--mono); color: #DC2626; letter-spacing: .06em; text-transform: uppercase; display: block; margin-bottom: 2pt; }
  .ps-head span { font: 500 8pt var(--mono); color: #475569; }
  .ps-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8pt 12pt; }
  .ps-sec h2 { font: 700 8.5pt var(--mono); letter-spacing: .08em; text-transform: uppercase; color: #1D4ED8; margin: 6pt 0 4pt; padding-bottom: 2pt; border-bottom: 1px solid #CBD5E1; }
  .ps-sec.full { grid-column: 1 / -1; }
  .ps-f { break-inside: avoid; border: 1px solid #CBD5E1; border-radius: 4pt; padding: 4pt 6pt; margin: 0 0 5pt; }
  .ps-f b { display: block; font: 700 7.5pt var(--mono); letter-spacing: .04em; text-transform: uppercase; color: #1E3A8A; }
  .ps-f code { display: block; font: 600 9pt var(--mono); background: none; border: 0; padding: 2pt 0; color: #0F172A; }
  .ps-f i { font-style: normal; color: #475569; font-size: 8pt; }
  .ps-t { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
  .ps-t th { text-align: left; font: 700 7.5pt var(--sans); text-transform: uppercase; letter-spacing: .04em; color: #475569; border-bottom: 1px solid #94A3B8; padding: 2pt 4pt; }
  .ps-t td { border-bottom: 1px solid #E2E8F0; padding: 2pt 4pt; vertical-align: top; }
  .ps-t td:nth-child(2) { font-family: var(--mono); white-space: nowrap; }
  .ps-paper { font: 500 8pt var(--mono); color: #475569; margin-top: 6pt; border-top: 1px solid #CBD5E1; padding-top: 4pt; }
  /* plain printing of a module page (Ctrl+P) */
  body:not(.printing-cheat) .topbar, body:not(.printing-cheat) .side, body:not(.printing-cheat) .tabs, body:not(.printing-cheat) .sim-dock, body:not(.printing-cheat) .mod-foot { display: none !important; }
  body:not(.printing-cheat) .main { padding: 0 !important; }
}
