/* CCNA Sprint: styles. System fonts only, so the course works offline. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --topbar: 58px;
  --sidebar: 304px;
  --read: 780px;
  --c-router: #4aa8ff;
  --c-switch: #2dd4bf;
  --c-fw: #fb7185;
  --c-wifi: #a78bfa;
  --c-server: #fbbf24;
  --c-wire-orange: #fb923c;
  --c-wire-green: #34d399;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e14;
  --bg-2: #0e121a;
  --panel: #121824;
  --panel-2: #172031;
  --panel-3: #1e2a42;
  --line: #212a3b;
  --line-2: #2c3852;
  --text: #e9edf5;
  --text-2: #c3cbdb;
  --muted: #8a96ad;
  --accent: #4aa8ff;
  --accent-ink: #04121f;
  --good: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --good-bg: rgba(52, 211, 153, .12);
  --bad-bg: rgba(248, 113, 113, .12);
  --shadow: 0 12px 32px rgba(0, 0, 0, .35);
  --node-fill: #172031;
  --node-stroke: #c3cbdb;
  --link: #3a4864;
  --zone: rgba(74, 168, 255, .06);
  --hook: #c084fc;
  --hook-2: #f472b6;
  --gold: #f5c542;
  --mark: rgba(250, 204, 21, .34);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7fb;
  --bg-2: #eef1f7;
  --panel: #ffffff;
  --panel-2: #f2f5fa;
  --panel-3: #e6ecf6;
  --line: #e1e6ef;
  --line-2: #cdd6e4;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --accent: #0b6bd6;
  --accent-ink: #ffffff;
  --good: #059669;
  --bad: #dc2626;
  --warn: #b45309;
  --good-bg: rgba(5, 150, 105, .10);
  --bad-bg: rgba(220, 38, 38, .08);
  --shadow: 0 12px 32px rgba(15, 23, 42, .08);
  --node-fill: #ffffff;
  --node-stroke: #334155;
  --link: #9aa8bd;
  --zone: rgba(11, 107, 214, .05);
  --c-router: #0b6bd6;
  --c-switch: #0d9488;
  --c-fw: #e11d48;
  --c-wifi: #7c3aed;
  --c-server: #b45309;
  --hook: #7c3aed;
  --hook-2: #db2777;
  --gold: #b45309;
  --mark: rgba(250, 204, 21, .55);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar);
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.brand-name { font: 750 17px var(--font-display); letter-spacing: -.01em; white-space: nowrap; }
.brand-tag {
  font: 600 11.5px var(--font); color: var(--muted);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 8px;
}
.topnav { display: flex; gap: 4px; margin-left: 18px; }
.topnav a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 600; font-size: 14.5px;
}
.topnav a:hover { background: var(--panel); text-decoration: none; color: var(--text); }
.topnav a.active { background: var(--panel-2); color: var(--text); }
.spacer { flex: 1; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); cursor: pointer;
}
.icon-btn:hover { border-color: var(--line-2); }
.menu-btn { display: none; }
html[data-theme="dark"] .i-sun, html[data-theme="light"] .i-moon { display: none; }
.pill {
  display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font: 750 12px var(--font);
}

/* ---------- layout ---------- */

.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar {
  position: sticky; top: var(--topbar);
  height: calc(100vh - var(--topbar));
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: transparent transparent;
  padding: 16px 12px 48px;
  border-right: 1px solid var(--line);
  background: var(--bg-2);
}
.view { min-width: 0; padding: 36px 44px 140px; outline: none; }
.scrim { display: none; }
/* Rail: the course menu idles as a slim strip of day badges with progress, and slides over the page on hover. */
:root { --rail: 60px; }
.rail { display: none; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.side-top .side-home { flex: 1; min-width: 0; }
.side-pin { width: 30px; height: 30px; color: var(--muted); }
.side-pin[aria-pressed="true"] { color: var(--accent); background: var(--panel); }
@media (min-width: 1001px) {
  body.rail-mode .shell { grid-template-columns: var(--rail) minmax(0, 1fr); }
  body.rail-mode .rail { display: flex; flex-direction: column; align-items: center; gap: 10px; position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); padding: 10px 0 16px; border-inline-end: 1px solid var(--line); background: var(--bg-2); z-index: 30; overflow-y: auto; scrollbar-width: none; }
  body.rail-mode .rail::-webkit-scrollbar { display: none; }
  body.rail-mode .sidebar { position: fixed; inset-inline-start: 0; top: var(--topbar); z-index: 40; width: var(--sidebar); transform: translateX(calc(-100% - 8px)); transition: transform .22s ease .25s; box-shadow: var(--shadow); }
  body.rail-mode .shell:has(.rail:hover) .sidebar, body.rail-mode .sidebar:hover, body.rail-mode .sidebar:focus-within { transform: none; transition-delay: 0s; }
}
.rail-home { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--muted); }
.rail-home:hover, .rail-home.active { color: var(--text); background: var(--panel); text-decoration: none; }
.rail-day { display: grid; justify-items: center; gap: 6px; text-decoration: none; }
.rail-day:hover { text-decoration: none; }
.rail-num { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font: 800 12px var(--font); color: var(--day); background: color-mix(in srgb, var(--day) 14%, var(--panel-2)); border: 1px solid color-mix(in srgb, var(--day) 35%, transparent); }
.rail-day.current .rail-num { color: #fff; background: var(--day); border-color: var(--day); box-shadow: 0 0 0 3px color-mix(in srgb, var(--day) 28%, transparent); }
.rail-bar { position: relative; width: 4px; height: 36px; border-radius: 2px; background: var(--line-2); }
.rail-bar i { position: absolute; left: 0; right: 0; top: 0; border-radius: 2px; background: var(--day); }
.rail-bar b { position: absolute; left: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--text); border: 2px solid var(--bg-2); box-sizing: border-box; }
.lesson-strip { grid-column: 1 / -1; position: sticky; top: var(--topbar); z-index: 20; display: flex; align-items: center; gap: 18px; margin: -36px 0 22px; padding: 10px 0; background: var(--bg); border-bottom: 1px solid var(--line); }
.ls-day { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); white-space: nowrap; flex: 0 0 min(36%, 440px); min-width: 0; }
.ls-name { color: var(--text); font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.ls-day .rail-num { width: 24px; height: 24px; }
.ls-steps { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; flex-wrap: wrap; position: relative; }
.ls-steps li { position: relative; }
.ls-steps li + li::before { content: ""; position: absolute; left: -10px; top: 50%; width: 10px; height: 2px; margin-top: -1px; background: var(--line-2); }
.ls-step { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font: 700 10.5px var(--mono); text-decoration: none; background: var(--bg); border: 2px solid var(--line-2); color: var(--muted); }
.ls-step:hover { border-color: var(--day); color: var(--text); text-decoration: none; }
.ls-step.seen { border-color: color-mix(in srgb, var(--day) 55%, var(--line-2)); color: var(--text-2); }
.ls-step.done { background: var(--day); border-color: var(--day); color: #fff; }
.ls-step.now { background: var(--text); border-color: var(--text); color: var(--bg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--day) 35%, transparent); }
.ls-tip { display: none; }
.ls-name.peek { color: var(--text-2); font-weight: 600; }
.side-tools { display: flex; justify-content: flex-end; margin: 2px 6px 8px; }
.ls-pos { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.ls-pos span:nth-child(2) { color: var(--text); font-weight: 600; }
@media (max-width: 860px) { .lesson-strip { margin-top: -24px; gap: 10px; flex-wrap: wrap; } .ls-pos { width: 100%; } }
/* Phone: the strip is one quiet line (day number, lesson name, position); the dots stay on wider screens. */
@media (max-width: 700px) {
  .lesson { row-gap: 0; }
  .lesson-strip { position: static; flex-wrap: nowrap; gap: 10px; margin: -12px 0 18px; padding: 6px 0 10px; }
  .ls-steps { display: none; }
  .ls-day { flex: 1 1 auto; }
  .ls-pos { width: auto; flex: none; }
  .ls-pos span:first-child, .ls-pos span:last-child { display: none; }
  .ls-pos { font-size: 0; }
  .ls-pos span:nth-child(2) { font-size: 13px; }
}
html.lang-switch .sidebar { transition: none !important; }
.btn-done { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, var(--line-2)); }
.review-page .review { max-width: none; margin: 0; }
.toc { overflow-x: hidden; }
.review-status { scrollbar-width: none; }
.rs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rs-all { border: 0; background: none; padding: 0; font: 600 11px var(--font); letter-spacing: 0; text-transform: none; color: var(--accent); cursor: pointer; }
.rs-all:hover { text-decoration: underline; }
.rs-day { box-sizing: border-box; }
.review-status::-webkit-scrollbar { display: none; }
.rs-day { display: flex; align-items: center; gap: 8px; width: 100%; margin: 10px 0 4px; padding: 4px 0; border: 0; background: none; font: inherit; font-size: 12.5px; color: var(--text-2); text-align: start; cursor: pointer; }
.rs-day:first-of-type { margin-top: 0; }
.rs-day { padding-inline-end: 6px; }
.rs-day .nav-chev { flex: none; width: 16px; display: inline-grid; place-items: center; color: var(--muted); transition: transform .2s; }
.rs-day[aria-expanded="true"] .nav-chev { transform: rotate(90deg); }
.rs-day .rail-num { width: 22px; height: 22px; font-size: 11px; }
.rs-title { flex: 1; min-width: 0; font-weight: 600; color: var(--text); }
.rs-sum { font: 700 11px var(--mono); color: var(--muted); }
.toc a.rs-row { display: flex; align-items: center; gap: 8px; padding: 4px 0 4px 10px; }
.rs-row .st { width: 14px; height: 14px; margin: 0; }
.rs-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-n { font: 700 11px var(--mono); color: var(--muted); }
.rs-n.in { color: var(--good); }
.rail-day.current { gap: 6px; }
.rail-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; position: relative; }
.rail-steps::before { content: ""; position: absolute; left: 50%; top: 4px; bottom: 4px; width: 2px; margin-left: -1px; background: var(--line-2); }
.rail-step { position: relative; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font: 700 9.5px var(--mono); text-decoration: none; background: var(--bg-2); border: 2px solid var(--line-2); color: var(--muted); }
.rail-step:hover { border-color: var(--day); color: var(--text); text-decoration: none; }
.rail-step.seen { border-color: color-mix(in srgb, var(--day) 55%, var(--line-2)); color: var(--text-2); }
.rail-step.done { background: var(--day); border-color: var(--day); color: #fff; }
.rail-step.now { background: var(--text); border-color: var(--text); color: var(--bg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--day) 35%, transparent); }
.rail-step i { font-style: normal; }
.rail-left { font: 700 10px var(--font); color: var(--muted); white-space: nowrap; }
.rail-cap { font: 700 9px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lg-st { display: inline-flex; gap: 6px; }
.brand-sub { font-size: 12.5px; color: var(--muted); margin-left: 6px; white-space: nowrap; }
@media (max-width: 1100px) { .brand-sub { display: none; } }
@media (max-width: 860px) { .hero { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .menu-btn { display: inline-grid; }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar); z-index: 40;
    width: min(330px, 88vw);
    transform: translateX(-102%);
    transition: transform .25s ease;
    box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: var(--topbar) 0 0 0; z-index: 35; background: rgba(0, 0, 0, .45); }
  .view { padding: 24px 18px 110px; }
  .brand-tag { display: none; }
  .topnav { margin-left: 4px; }
}

@media (max-width: 560px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .topnav { margin-left: 0; }
  .topnav a[data-nav="home"] { display: none; }
  .topnav a { padding: 7px 8px; }
  .brand-name { font-size: 16px; }
  .icon-btn { width: 36px; height: 36px; flex: none; }
}

/* ---------- sidebar ---------- */

.side-home {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; margin-bottom: 10px; border-radius: 10px;
  color: var(--text-2); font-weight: 650; font-size: 14px;
}
.side-home:hover, .side-home.active { background: var(--panel); color: var(--text); text-decoration: none; }
.nav-day { margin-bottom: 4px; }
.nav-day-head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 10px;
  background: none; cursor: pointer; text-align: left;
  color: var(--text); font-weight: 650; font-size: 14px; line-height: 1.3;
}
.nav-day-head:hover { background: var(--panel); }
.nav-day-num {
  flex: none; width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--day) 18%, transparent);
  color: var(--day); font: 800 12.5px var(--font);
}
.nav-day-title { flex: 1; min-width: 0; }
.nav-day-meta { font-size: 12px; color: var(--muted); font-weight: 600; }
.nav-chev { color: var(--muted); transition: transform .2s; }
.nav-day.open .nav-chev { transform: rotate(90deg); }
.nav-lessons { display: none; margin: 2px 0 10px 22px; border-left: 1px solid var(--line); }
.nav-day.open .nav-lessons { display: block; }
.nav-lessons a {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 6px 10px 6px 12px; margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--text-2); font-size: 13.5px; line-height: 1.4;
}
.nav-lessons a:hover { color: var(--text); text-decoration: none; background: var(--panel); }
.nav-lessons a.active { color: var(--text); border-left-color: var(--day); background: var(--panel); font-weight: 600; }
.nav-empty { margin: 2px 0 10px 34px; font-size: 12.5px; color: var(--muted); }
.st {
  flex: none; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%;
  border: 1.5px solid var(--line-2); display: grid; place-items: center;
}
.st.seen { border-color: var(--accent); overflow: hidden; }
.st.seen::after { content: ""; width: 100%; height: 100%; background: linear-gradient(90deg, var(--accent) 50%, transparent 50%); }
.st.done { border-color: var(--good); background: var(--good); }
.st.done::after {
  content: ""; width: 7px; height: 4px; margin-top: -2px;
  border-left: 2px solid var(--bg); border-bottom: 2px solid var(--bg); transform: rotate(-45deg);
}

/* ---------- shared bits ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 11px;
  border: 1px solid var(--line-2); background: var(--panel-2);
  color: var(--text); font-weight: 650; font-size: 15px; line-height: 1.2;
  cursor: pointer; transition: border-color .15s, background .15s, transform .05s;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; border-color: var(--line-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-sm { padding: 7px 12px; font-size: 14px; border-radius: 9px; }
.btn-good { background: var(--good); border-color: var(--good); color: #04130d; }
.btn-bad { background: transparent; border-color: var(--bad); color: var(--bad); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--panel);
  color: var(--text-2); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.chip-exam { font-family: var(--mono); font-size: 12px; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line-2)); }
.chip-day { color: var(--day); border-color: color-mix(in srgb, var(--day) 40%, var(--line-2)); }

.bar { height: 8px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--day, var(--accent)); transition: width .4s ease; }

.crumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13.5px; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { opacity: .5; }

.eyebrow { font: 750 12.5px var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
.lead { font-size: 18.5px; line-height: 1.6; color: var(--text-2); margin: 0; }
.section-title { font: 750 13px var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 46px 0 14px; }

.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 11px 18px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-weight: 650; font-size: 14.5px;
  box-shadow: var(--shadow); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- home ---------- */

.page { max-width: 1120px; margin: 0 auto; }
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 36px; align-items: center;
  padding: 34px; border-radius: 22px;
  background:
    radial-gradient(900px 300px at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    var(--panel);
  border: 1px solid var(--line);
}
.hero h1 { font: 800 clamp(30px, 3.6vw, 44px)/1.1 var(--font-display); letter-spacing: -.025em; margin: 0 0 14px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.hero-actions .btn { max-width: 100%; }
.hero-actions .btn span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats { display: grid; gap: 14px; justify-items: center; }
.ring { position: relative; width: 150px; height: 150px; }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring .track { stroke: var(--panel-3); }
.ring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label b { font: 800 34px var(--font-display); letter-spacing: -.02em; }
.ring-label span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-row { display: flex; gap: 22px; font-size: 13.5px; color: var(--muted); }
.stat-row b { display: block; font: 750 20px var(--font-display); color: var(--text); text-align: center; }

.day-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.day-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 20px 18px 16px; border-radius: 18px; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  transition: border-color .15s, transform .15s;
}
.day-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--day); }
.day-card:hover { text-decoration: none; transform: translateY(-2px); border-color: color-mix(in srgb, var(--day) 55%, var(--line)); }
.day-card .dc-top { display: flex; justify-content: space-between; align-items: center; }
.day-card .dc-num { font: 800 12px var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--day); }
.day-card h3 { margin: 0; font: 750 19px/1.25 var(--font-display); letter-spacing: -.01em; }
.day-card p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.5; flex: 1; }
.day-card .dc-foot { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.badge-soon {
  font: 700 11px var(--font); letter-spacing: .04em; color: var(--muted);
  border: 1px dashed var(--line-2); border-radius: 999px; padding: 2px 8px;
}

.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tool {
  display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
}
.tool:hover { text-decoration: none; border-color: var(--line-2); }
.tool .ti { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 21px; background: var(--panel-2); }
.tool b { display: block; font-size: 15.5px; }
.tool span { font-size: 13.5px; color: var(--muted); }
.tool.off { opacity: .6; pointer-events: none; }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.fact { padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.fact b { display: block; font: 750 18px var(--font-display); }
.fact span { font-size: 13px; color: var(--muted); }

/* About page */
.about-hero {
  margin: 14px 0 38px; padding: 30px 34px 34px; border-radius: 22px; border: 1px solid var(--line);
  background:
    radial-gradient(900px 300px at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    var(--panel);
}
html[dir="rtl"] .about-hero { background: radial-gradient(900px 300px at 100% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%), var(--panel); }
.about-hero .lesson-head { margin-bottom: 20px; }
.about-hero .lesson-head h1 { margin-bottom: 0; }
.about .about-hero .facts { margin: 0; }
.about-hero .fact { background: var(--bg); }
@media (max-width: 620px) { .about-hero { padding: 22px 18px 20px; border-radius: 18px; } }
.side-about { margin-top: -6px; }
.about .facts { margin: 6px 0 34px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.about-cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 44px; align-items: start; }
.about-side .section-title { margin-top: 6px; }
.domains { display: grid; gap: 14px; padding: 18px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.domain { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 14.5px; color: var(--text-2); }
.domain b { font: 750 15px var(--font-display); color: var(--text); }
.domain .bar { grid-column: 1 / -1; }
.refs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.ref { display: grid; gap: 2px; padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.ref b { font: 750 16px var(--font-display); }
.ref span { font-size: 13px; color: var(--muted); }
.ref a svg, .source-group a svg { margin-inline-start: 6px; vertical-align: -1px; }
.ref a { margin-top: 6px; font-weight: 650; }
.section-title .pill { margin-inline-start: 8px; vertical-align: 1px; }
html[dir="rtl"] .source-group summary svg { transform: rotate(180deg); }
html[dir="rtl"] .source-group[open] summary svg { transform: rotate(90deg); }
.about .glance-head { margin-bottom: 16px; }
.about .glance-title { font: 800 26px/1.25 var(--font-display); letter-spacing: -.015em; }
.sources { display: grid; gap: 8px; }
.source-group { border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.source-group summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none; font-weight: 650; font-size: 15px; }
.source-group summary::-webkit-details-marker { display: none; }
.source-group summary span:first-child { flex: 1; }
.source-group summary svg { flex: none; width: 14px; height: 14px; transition: transform .2s ease; color: var(--muted); }
.source-group[open] summary svg { transform: rotate(90deg); }
.source-group ul { margin: 0; padding: 4px 18px 16px 18px; display: grid; gap: 10px; font-size: 14.5px; list-style: none; text-align: left; }
.source-group li { position: relative; padding-left: 18px; line-height: 1.45; }
.source-group li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); }
.about .glance { margin: 40px 0 0; --day: var(--accent); }
.about .glance-label, .about .glance .count { display: none; }
.about .glance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 620px) { .about .glance-grid { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .about .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .about-cols { grid-template-columns: 1fr; gap: 26px; } }
@media (max-width: 520px) { .about .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding: 24px; }
  .hero > * { min-width: 0; }
  .hero-actions { flex-wrap: wrap; }
  .stats { justify-items: start; }
}

/* ---------- day page ---------- */

.day-head { margin-bottom: 26px; }
.day-head h1 { font: 800 clamp(28px, 3.2vw, 40px)/1.12 var(--font-display); letter-spacing: -.02em; margin: 10px 0 10px; }
.day-head .bar { margin-top: 18px; max-width: 420px; }
.day-intro { max-width: var(--read); }
.lesson-list { display: grid; gap: 10px; margin-top: 24px; max-width: 900px; }
.lesson-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); color: var(--text);
}
.lesson-row:hover { text-decoration: none; border-color: color-mix(in srgb, var(--day) 50%, var(--line)); }
.lesson-row .ln {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--day) 15%, transparent); color: var(--day); font: 800 15px var(--font-display);
}
.lesson-row.done .ln { background: var(--good-bg); color: var(--good); }
.lesson-row b { display: block; font-size: 16px; line-height: 1.35; }
.lesson-row .lr-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.lesson-row .lr-score { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.boss {
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center;
  margin-top: 26px; max-width: 900px; padding: 20px 22px; border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--day) 45%, var(--line)); background: color-mix(in srgb, var(--day) 7%, var(--panel));
}
.boss b { font-size: 17px; }
.boss p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.empty-day { margin-top: 24px; max-width: 760px; padding: 26px; border-radius: 16px; border: 1px dashed var(--line-2); color: var(--muted); }

/* ---------- lesson page ---------- */

.lesson { display: grid; grid-template-columns: minmax(0, var(--read)) 230px; gap: 56px; justify-content: center; }
/* Wide screens: the side column matches the course menu on the left, then the reading column widens. */
/* The side column hugs the window edge instead of leaving centering slack beside it. */
@media (min-width: 1500px) { .lesson { grid-template-columns: minmax(0, 1fr) var(--sidebar); gap: 32px; justify-content: stretch; margin-inline: -20px; } }
@media (max-width: 1320px) { .lesson { grid-template-columns: minmax(0, var(--read)); } .toc { display: none; } }
.lesson-head { margin-bottom: 30px; }
.lesson-kicker { font: 750 12.5px var(--font); letter-spacing: .09em; text-transform: uppercase; color: var(--day); }
.lesson-head h1 { font: 800 clamp(28px, 3.3vw, 40px)/1.14 var(--font-display); letter-spacing: -.022em; margin: 10px 0 16px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; }
.toc { position: sticky; top: calc(var(--topbar) + 30px); align-self: start; max-height: calc(100vh - var(--topbar) - 42px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; container-type: inline-size; }
.toc-title { font: 750 11.5px var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.toc a { display: block; padding: 3px 0 3px 12px; border-left: 2px solid var(--line); color: var(--muted); font-size: 13px; line-height: 18px; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--text); border-left-color: var(--day); }
.toc-legend { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.toc-legend summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; font: 750 11.5px var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.toc-legend summary::-webkit-details-marker { display: none; }
.toc-legend summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin-inline-end: 2px; }
.toc-legend[open] summary::before { transform: rotate(45deg); }
.toc-legend .legend-grid { margin-top: 10px; gap: 6px; }
.toc-legend .lg-row { grid-template-columns: 108px minmax(0, 1fr); gap: 8px; align-items: start; font-size: 12px; line-height: 16px; }
.toc-legend .lgm { font-size: 11px; padding: 2px 8px; line-height: 16px; }
.toc-legend .lgm-hook b { width: 18px; height: 18px; font-size: 11px; }
.toc-legend .lg-ex .hbadge, .toc-legend .lg-ex .chip { font-size: 11px; line-height: 16px; padding-top: 2px; padding-bottom: 2px; }
.toc-legend .lg-ex mark { line-height: 16px; }
.toc.fits { overflow-y: hidden; }
/* Slim scrollbars that only show while the pointer is over the panel. */
.sidebar:hover, .toc:hover { scrollbar-color: var(--line-2) transparent; }
:is(.sidebar, .toc)::-webkit-scrollbar { width: 6px; }
:is(.sidebar, .toc)::-webkit-scrollbar-track { background: transparent; }
:is(.sidebar, .toc)::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
:is(.sidebar, .toc):hover::-webkit-scrollbar-thumb { background: var(--line-2); }
@media (min-width: 1321px) { .legend { display: none; } }

/* ---------- prose ---------- */

.prose { font-size: 17.5px; line-height: 1.75; color: var(--text-2); }
.prose > :first-child { margin-top: 0; }
.prose h2 {
  font: 760 26px/1.25 var(--font-display); letter-spacing: -.015em; color: var(--text);
  margin: 60px 0 16px; scroll-margin-top: 84px;
}
.prose h3 { font: 700 20.5px/1.3 var(--font-display); color: var(--text); margin: 36px 0 10px; scroll-margin-top: 84px; }
.prose h4 { font: 700 17.5px/1.35 var(--font); color: var(--text); margin: 26px 0 8px; }
/* Lesson section titles (Bakr, 2026-11-15: "so it's read as a title"): a numbered band in the day's colour, not a line of text. */
#lesson-body { counter-reset: sec; }
#lesson-body > h2 {
  counter-increment: sec; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 14px;
  margin: 64px 0 22px; padding: 14px 18px; border-radius: 16px;
  font: 800 25px/1.25 var(--font-display); letter-spacing: -.015em;
  background: color-mix(in srgb, var(--day, var(--accent)) 9%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--day, var(--accent)) 28%, var(--line));
  border-inline-start: 6px solid var(--day, var(--accent));
}
#lesson-body > h2::before {
  content: counter(sec); flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  font: 800 16px/1 var(--font-display); letter-spacing: 0; color: #fff; background: var(--day, var(--accent));
}
#lesson-body > h2 .hbadge, #lesson-body > h3 .hbadge { margin: 0; grid-column: 2; justify-self: start; }
#lesson-body > h3 { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 10px; margin: 40px 0 12px; font-weight: 760; }
#lesson-body > h3::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--day, var(--accent)); }
@media (max-width: 700px) {
  #lesson-body > h2 { margin: 48px 0 18px; padding: 12px 14px; font-size: 21px; gap: 6px 11px; border-radius: 14px; }
  #lesson-body > h2::before { width: 30px; height: 30px; font-size: 14.5px; border-radius: 9px; }
}
.prose p { margin: 0 0 16px; }
.prose strong { color: var(--text); font-weight: 680; }
.prose em { color: var(--text); }
.prose a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 3px; }
.prose code {
  font: .86em var(--mono); color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line);
  padding: .12em .42em; border-radius: 6px;
}
.prose ul, .prose ol { padding-left: 1.35em; margin: 0 0 18px; }
.prose li { margin: 7px 0; }
.prose li::marker { color: var(--muted); }
.prose ol > li::marker { font-weight: 700; color: var(--day, var(--accent)); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.prose kbd {
  font: 600 .82em var(--mono); padding: .1em .45em; border-radius: 6px;
  border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--panel); color: var(--text);
}
.prose blockquote { margin: 20px 0; padding: 4px 18px; border-left: 3px solid var(--line-2); color: var(--muted); }

.table-wrap { overflow-x: auto; margin: 22px 0 28px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.55; }
.prose th { text-align: left; background: var(--panel-2); color: var(--text); font-weight: 680; white-space: nowrap; }
.prose th, .prose td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td code { white-space: nowrap; }

/* callouts */
.callout {
  margin: 26px 0; padding: 14px 18px 2px; border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--cc) 26%, var(--line));
  border-left: 4px solid var(--cc);
  background: color-mix(in srgb, var(--cc) 7%, var(--panel));
}
.callout-title { display: flex; align-items: center; gap: 9px; font: 720 15.5px var(--font); color: var(--text); margin-bottom: 6px; }
.callout-icon { font-size: 17px; }
.callout-body { font-size: 16.5px; line-height: 1.7; }
.callout-body p { margin-bottom: 12px; }
.callout-analogy { --cc: #f5c542; }
.callout-deep { --cc: #a78bfa; }
.callout-exam { --cc: #4aa8ff; }
.callout-trap { --cc: #f87171; }
.callout-remember { --cc: #34d399; }
.callout-note { --cc: #8a96ad; }
.callout-lab { --cc: #2dd4bf; }
.callout-why { --cc: #fb923c; }
.callout-mistake { --cc: #f472b6; }

/* terminal and code */
.cli, .code {
  margin: 24px 0; border-radius: 13px; overflow: hidden;
  border: 1px solid #1f2a3e; background: #070a10; box-shadow: var(--shadow);
}
.cli-head, .code-head {
  display: flex; align-items: center; gap: 12px; padding: 9px 14px;
  background: #0d1320; border-bottom: 1px solid #1f2a3e;
  font: 650 12.5px var(--font); color: #8a96ad;
}
.cli-dots { display: flex; gap: 6px; }
.cli-dots i { display: block; width: 10px; height: 10px; border-radius: 50%; background: #2a3448; }
.cli-dots i:nth-child(1) { background: #f87171; }
.cli-dots i:nth-child(2) { background: #fbbf24; }
.cli-dots i:nth-child(3) { background: #34d399; }
.cli pre, .code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font: 14px/1.65 var(--mono); color: #d5ddea; }
.cli code, .code code { font: inherit; background: none; border: 0; padding: 0; color: inherit; white-space: pre; }
.c-prompt { color: #4aa8ff; }
.c-cmd { color: #ffffff; font-weight: 650; }
.c-cmt { color: #6b7a96; font-style: italic; }
.c-note { color: #f5c542; font: italic 13px var(--font); }
.c-note::before { content: "   \2190  "; font-style: normal; }
.c-note code { color: #f5c542; background: none; border: 0; }

/* diagrams */
figure.diagram {
  margin: 28px 0; padding: 20px 18px 14px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line);
}
figure.diagram svg { display: block; width: 100%; height: auto; overflow: visible; }
/* Phone: a diagram keeps a readable size and scrolls inside its box, like tables and code. */
@media (max-width: 700px) {
  figure.diagram { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  figure.diagram svg { width: 620px; max-width: none; }
  figure.diagram figcaption { position: sticky; left: 0; max-width: calc(100vw - 76px); }
}
figure.diagram figcaption { margin-top: 12px; font-size: 14px; color: var(--muted); text-align: center; line-height: 1.5; }
.node { fill: var(--node-fill); color: var(--node-stroke); }
.n-router { color: var(--c-router); }
.n-switch { color: var(--c-switch); }
.n-fw { color: var(--c-fw); }
.n-wifi { color: var(--c-wifi); }
.n-server { color: var(--c-server); }
.link { stroke: var(--link); stroke-width: 2.5; fill: none; }
.link.wl { stroke-dasharray: 3 6; stroke-linecap: round; }
.link.hot { stroke: var(--accent); }
.zone { fill: var(--zone); stroke: var(--line-2); stroke-dasharray: 5 6; }
.lbl { fill: var(--text); font: 650 13px var(--font); text-anchor: middle; }
.sub { fill: var(--muted); font: 12px var(--font); text-anchor: middle; }
.sub.left { text-anchor: end; }
.sub.right { text-anchor: start; }
.dg-title { fill: var(--text); font: 720 14.5px var(--font); text-anchor: middle; }
.pinbox { fill: var(--panel-2); stroke: var(--line-2); }
.pintxt { fill: var(--text); font: 600 12.5px var(--mono); text-anchor: middle; }
.wire { fill: none; stroke-width: 3.5; stroke-linecap: round; }
.w-orange { stroke: var(--c-wire-orange); }
.w-green { stroke: var(--c-wire-green); }
.layerbox { stroke: var(--line-2); }
.layertxt { fill: var(--text); font: 600 11.5px var(--font); text-anchor: middle; }
.lb-a { fill: rgba(251, 191, 36, .16); stroke: rgba(251, 191, 36, .55); }
.lb-4 { fill: rgba(167, 139, 250, .16); stroke: rgba(167, 139, 250, .6); }
.lb-3 { fill: rgba(74, 168, 255, .16); stroke: rgba(74, 168, 255, .6); }
.lb-2 { fill: rgba(45, 212, 191, .16); stroke: rgba(45, 212, 191, .6); }
.lb-1 { fill: rgba(251, 146, 60, .16); stroke: rgba(251, 146, 60, .6); }
.path-hot { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 6 6; }
.dg-dot { fill: var(--accent); }
@media (prefers-reduced-motion: reduce) { .dg-dot { display: none; } }

/* reveal (show the answer) */
details.reveal { margin: 18px 0; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel); }
details.reveal > summary { cursor: pointer; padding: 11px 16px; font-weight: 650; color: var(--text); list-style: none; }
details.reveal > summary::-webkit-details-marker { display: none; }
details.reveal > summary::before { content: "\25B8"; display: inline-block; margin-right: 10px; color: var(--accent); transition: transform .2s; }
details.reveal[open] > summary::before { transform: rotate(90deg); }
.reveal-body { padding: 0 16px 6px; font-size: 16.5px; }

/* ---------- questions (inline checks and quizzes) ---------- */

.check, .quiz {
  margin: 30px 0; padding: 20px 22px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line-2);
}
.check { border-left: 4px solid var(--accent); }
.q-label { font: 780 11.5px var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.q-stem { color: var(--text); font-size: 17px; line-height: 1.6; }
.q-stem p { margin: 0 0 10px; }
.q-stem .cli, .q-stem .code { margin: 12px 0; }
.q-hint { font-size: 13.5px; font-weight: 700; color: var(--warn); margin: 2px 0 6px; }
.opts { display: grid; gap: 8px; margin: 12px 0 4px; }
.opt {
  display: flex; gap: 12px; align-items: flex-start; width: 100%;
  padding: 11px 14px; border-radius: 11px; text-align: left;
  border: 1px solid var(--line-2); background: var(--panel-2);
  color: var(--text); font-size: 16px; line-height: 1.5; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt:disabled { cursor: default; }
.opt[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, var(--panel-2)); }
.opt .k {
  flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: var(--panel-3); color: var(--text-2); font: 750 12.5px var(--font);
}
.opt[aria-pressed="true"] .k { background: var(--accent); color: var(--accent-ink); }
.opt.right { border-color: var(--good); background: var(--good-bg); }
.opt.right .k { background: var(--good); color: #04130d; }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.wrong .k { background: var(--bad); color: #fff; }
.opt code { font: .88em var(--mono); background: var(--panel-3); padding: .1em .35em; border-radius: 5px; }
.q-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.q-actions .muted { font-size: 13px; }
.feedback { margin-top: 14px; padding: 14px 16px; border-radius: 12px; font-size: 16px; line-height: 1.65; color: var(--text-2); }
.feedback.good { background: var(--good-bg); }
.feedback.bad { background: var(--bad-bg); }
.feedback .verdict { font-weight: 780; margin-bottom: 4px; }
.feedback.good .verdict { color: var(--good); }
.feedback.bad .verdict { color: var(--bad); }
.feedback p { margin: 0 0 8px; }
.feedback p:last-child { margin-bottom: 0; }

.quiz-intro { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: center; }
.quiz-title { font: 750 18px var(--font-display); color: var(--text); }
.quiz-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; font-size: 13.5px; font-weight: 650; color: var(--muted); }
.quiz-top .bar { flex: 1; height: 6px; }
.result { text-align: center; padding: 8px 0; }
.result .big { font: 820 54px/1 var(--font-display); letter-spacing: -.03em; margin: 6px 0; }
.result .big.good { color: var(--good); }
.result .big.mid { color: var(--warn); }
.result .big.low { color: var(--bad); }
.result p { color: var(--text-2); margin: 6px 0 16px; }
.missed { text-align: left; margin-top: 18px; display: grid; gap: 12px; }
.missed-item { padding: 14px 16px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.missed-item .q-stem { font-size: 15.5px; }
.missed-item .ans { font-size: 14.5px; margin: 8px 0; color: var(--text-2); }
.missed-item .ans b { color: var(--good); }
.missed-item .x { font-size: 14.5px; color: var(--text-2); }
.missed-item .x p { margin: 0 0 6px; }

/* ---------- lesson extras ---------- */

.lesson-section { margin-top: 64px; }
.lesson-section > h2 { font: 760 26px/1.25 var(--font-display); letter-spacing: -.015em; margin: 0 0 8px; scroll-margin-top: 84px; }
.lesson-section > p { color: var(--muted); margin: 0 0 16px; }
.videos { display: grid; gap: 8px; }
.video {
  display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
}
.video:hover { text-decoration: none; border-color: var(--line-2); }
.video .play { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #ff3b3b; color: #fff; }
.video b { font-size: 15px; font-weight: 650; }
.video span { margin-left: auto; font: 600 13px var(--mono); color: var(--muted); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.mini {
  position: relative; min-height: 132px; perspective: 900px; cursor: pointer;
  border: 0; padding: 0; background: none; text-align: center;
}
.mini-inner { position: absolute; inset: 0; transition: transform .45s; transform-style: preserve-3d; }
.mini.flipped .mini-inner { transform: rotateY(180deg); }
.mini-face {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 14px 16px;
  border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  font-size: 14.5px; line-height: 1.5; color: var(--text);
}
.mini-back { transform: rotateY(180deg); background: var(--panel-2); color: var(--text-2); }
.mini-face code { font: .88em var(--mono); }

.lesson-foot {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center;
  margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line);
}
.lesson-foot .prev { justify-self: start; }
.lesson-foot .next { justify-self: end; }
.lesson-foot a.navlink { display: grid; gap: 2px; max-width: 280px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); color: var(--text); }
.lesson-foot a.navlink:hover { text-decoration: none; border-color: var(--line-2); }
.lesson-foot a.navlink small { color: var(--muted); font-size: 12px; font-weight: 650; }
.lesson-foot a.navlink b { font-size: 14px; line-height: 1.35; }
.lesson-foot .next { text-align: right; }
@media (max-width: 640px) {
  .lesson-foot { grid-template-columns: 1fr; }
  .lesson-foot .prev, .lesson-foot .next { justify-self: stretch; }
  .lesson-foot a.navlink { max-width: none; }
}

/* ---------- flashcard review ---------- */

.review { max-width: 720px; margin: 0 auto; }
.review-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 14px; }
.review-head h1 { font: 800 30px var(--font-display); letter-spacing: -.02em; margin: 0; }
.flash { perspective: 1400px; cursor: pointer; }
.flash-inner { position: relative; min-height: 300px; transition: transform .5s; transform-style: preserve-3d; }
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 34px;
  border-radius: 22px; border: 1px solid var(--line-2); background: var(--panel);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  font: 650 22px/1.45 var(--font-display); text-align: center; color: var(--text);
  box-shadow: var(--shadow);
}
.flash-back { transform: rotateY(180deg); background: var(--panel-2); font: 500 19px/1.6 var(--font); color: var(--text-2); }
.flash-face code { font: .85em var(--mono); background: var(--panel-3); padding: .1em .4em; border-radius: 6px; }
.flash-tag { position: absolute; top: 16px; left: 18px; font: 700 11.5px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.review-actions { display: flex; gap: 12px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.review-actions .btn { min-width: 170px; }
.keys { text-align: center; margin-top: 14px; font-size: 13px; color: var(--muted); }
.keys kbd { font: 600 12px var(--mono); padding: 1px 6px; border: 1px solid var(--line-2); border-radius: 5px; }
.boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 22px; }
.boxes div { padding: 12px 8px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); text-align: center; }
.boxes b { display: block; font: 750 20px var(--font-display); }
.boxes span { font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* ---------- widgets ---------- */

.widget { margin: 30px 0; }
.wg {
  border-radius: 18px; border: 1px solid var(--line-2); background: var(--panel); overflow: hidden;
}
.wg-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.wg-title { font: 750 16px var(--font); color: var(--text); display: flex; gap: 9px; align-items: center; }
.wg-title::before { content: "\25B6"; font-size: 10px; color: var(--accent); }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--panel-2); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 650; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.wg-body { padding: 18px; }
.wg-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
.dots { display: flex; gap: 7px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); transition: background .2s, transform .2s; }
.dots i.on { background: var(--accent); transform: scale(1.25); }

/* encapsulation widget */
.encap { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 20px; }
.ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.ladder li {
  display: flex; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 9px;
  font-size: 13px; color: var(--muted); border: 1px solid transparent; transition: all .25s;
}
.ladder li b { width: 18px; text-align: center; font: 800 13px var(--font); }
.ladder li.on { color: var(--text); background: color-mix(in srgb, var(--lc) 16%, var(--panel-2)); border-color: color-mix(in srgb, var(--lc) 55%, transparent); }
.ladder li.on b { color: var(--lc); }
.pdu-name { font: 800 24px var(--font-display); letter-spacing: -.01em; color: var(--text); margin-bottom: 12px; }
.pdu-name small { font: 650 13px var(--font); color: var(--muted); margin-left: 8px; }
.pdu { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; }
.part {
  flex: 0 0 auto; min-width: 78px; padding: 14px 12px; border-radius: 10px; text-align: center;
  background: color-mix(in srgb, var(--lc) 14%, var(--panel-2));
  border: 1px solid color-mix(in srgb, var(--lc) 45%, transparent);
  font: 750 13.5px var(--font); color: var(--text-2);
}
.part.data { flex: 1 1 auto; min-width: 140px; }
.part.focus { color: var(--text); background: color-mix(in srgb, var(--lc) 26%, var(--panel-2)); border-color: var(--lc); box-shadow: 0 0 0 2px color-mix(in srgb, var(--lc) 35%, transparent); }
.part.new { animation: pop .45s ease; }
@keyframes pop { from { transform: translateY(-10px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.fields { margin-top: 14px; display: grid; gap: 6px; }
.fields-title { font: 750 11.5px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.field {
  display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; align-items: baseline;
  padding: 7px 12px; border-radius: 9px; border-left: 3px solid var(--lc);
  background: var(--panel-2); font-size: 14px;
}
.field span { color: var(--muted); font-weight: 600; }
.field b { color: var(--text); font-weight: 600; }
@media (max-width: 640px) { .field { grid-template-columns: 1fr; gap: 2px; } }
.bits { font: 600 14px/1.7 var(--mono); color: var(--accent); word-break: break-all; padding: 12px 14px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); animation: pop .45s ease; }
.wg-text { margin: 18px 0 0; font-size: 16px; line-height: 1.65; color: var(--text-2); }
.wg-text b { color: var(--text); }
.lc-7 { --lc: #fbbf24; } .lc-6 { --lc: #fbbf24; } .lc-5 { --lc: #fbbf24; }
.lc-4 { --lc: #a78bfa; } .lc-3 { --lc: #4aa8ff; } .lc-2 { --lc: #2dd4bf; } .lc-1 { --lc: #fb923c; }
@media (max-width: 640px) {
  .encap { grid-template-columns: 1fr; }
  .ladder { grid-template-columns: repeat(7, 1fr); }
  .ladder li { justify-content: center; padding: 6px 2px; }
  .ladder li span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- intake blocks: marker, exam favorite, glance, hook, versus, steps, lock it in ---------- */

mark.key {
  color: var(--text); font-weight: 650; padding: 0 3px; border-radius: 3px;
  background: linear-gradient(100deg, transparent 0, var(--mark) 1.5%, var(--mark) 98%, transparent 100%) no-repeat 0 88% / 100% 62%;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

.hbadge {
  display: inline-flex; align-items: center; gap: 5px; margin-left: 12px; vertical-align: 4px;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  font: 750 12px var(--font); letter-spacing: .01em;
  color: var(--bad); background: var(--bad-bg); border: 1px solid color-mix(in srgb, var(--bad) 45%, transparent);
}
.toc a.fav::after { content: " \1F3AF"; font-size: 11px; }

.count {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 9px;
  border-radius: 999px; background: var(--day, var(--accent)); color: #06121f; font: 800 13px var(--font);
}

/* at a glance */
.glance {
  margin: 6px 0 38px; padding: 18px; border-radius: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--day) 9%, var(--panel)), var(--panel));
  border: 1px solid color-mix(in srgb, var(--day) 32%, var(--line));
}
.glance-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.glance-label { font: 820 11.5px var(--font); letter-spacing: .13em; text-transform: uppercase; color: var(--day); }
.glance-title { font: 720 16px var(--font); color: var(--text); }
.glance-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 10px; }
.gl { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 13px; background: var(--panel); border: 1px solid var(--line); }
.gl-ico { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: var(--panel-2); }
.gl-ico svg { width: 36px; height: 36px; }
.gl b { display: block; color: var(--text); font-size: 15px; line-height: 1.3; }
.gl > div:last-child > span { display: block; margin-top: 3px; font-size: 13.5px; line-height: 1.45; color: var(--text-2); }
.emo { font-size: 26px; line-height: 1; }
.hk-key .emo { font-size: 24px; }
.numb { font: 850 22px var(--font-display); color: var(--day, var(--accent)); }
.lyrb { display: inline-grid; place-items: center; padding: 3px 7px; border-radius: 8px; font: 850 13px var(--mono); color: var(--lc); background: color-mix(in srgb, var(--lc) 16%, transparent); border: 1px solid color-mix(in srgb, var(--lc) 50%, transparent); }
.lyrb.l1 { --lc: #fb923c; } .lyrb.l2 { --lc: #2dd4bf; } .lyrb.l3 { --lc: #4aa8ff; } .lyrb.l4 { --lc: #a78bfa; }
.lyrb.l5, .lyrb.l6, .lyrb.l7 { --lc: #f5b83d; }

/* memory hook */
.hook {
  margin: 32px 0; padding: 20px; border-radius: 18px;
  border: 1.5px dashed color-mix(in srgb, var(--hook) 60%, transparent);
  background:
    radial-gradient(520px 180px at 100% 0%, color-mix(in srgb, var(--hook-2) 11%, transparent), transparent 70%),
    radial-gradient(520px 180px at 0% 100%, color-mix(in srgb, var(--hook) 12%, transparent), transparent 70%),
    var(--panel);
}
.hook-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.hook-count {
  flex: none; width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
  font: 850 28px var(--font-display); color: #fff;
  background: linear-gradient(135deg, var(--hook), var(--hook-2));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--hook) 35%, transparent);
}
.hook-label { font: 820 11.5px var(--font); letter-spacing: .13em; text-transform: uppercase; color: var(--hook); }
.hook-title { font: 740 17.5px var(--font-display); color: var(--text); line-height: 1.3; }
.hook-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.hk {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  padding: 12px 6px; border-radius: 13px; text-align: center;
  background: var(--panel-2); border: 1px solid var(--line);
}
.hk-key { font: 800 12.5px var(--mono); color: var(--muted); }
.hk-main { font: 720 14.5px/1.25 var(--font); color: var(--text); }
.hk-cue { font: 720 13.5px/1.25 var(--font); color: var(--hook); }
.ini { color: var(--hook-2); font-size: 1.28em; font-weight: 850; }
.hook-trick { margin: 14px 0 0; text-align: center; font: 640 17.5px/1.5 var(--font-display); color: var(--text); }
.hook-trick strong { color: var(--hook-2); font-size: 1.18em; font-weight: 850; }

/* versus */
.versus { margin: 32px 0; border-radius: 18px; border: 1px solid var(--line-2); background: var(--panel); overflow: hidden; }
.vs-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; }
.vs-a, .vs-b { display: grid; place-items: center; padding: 15px 26px; font: 780 17.5px var(--font-display); color: var(--text); text-align: center; }
.vs-a { background: color-mix(in srgb, #4aa8ff 16%, var(--panel)); }
.vs-b { background: color-mix(in srgb, #fb923c 16%, var(--panel)); }
.vs-badge {
  align-self: center; position: relative; z-index: 1; width: 42px; height: 42px; margin: 0 -21px;
  border-radius: 50%; display: grid; place-items: center;
  font: 900 13px var(--font); letter-spacing: .04em; background: var(--text); color: var(--bg);
  box-shadow: 0 0 0 4px var(--panel);
}
.vs-row { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.vs-aspect { grid-column: 1 / -1; padding: 9px 12px 0; text-align: center; font: 780 11px var(--font); letter-spacing: .11em; text-transform: uppercase; color: var(--muted); }
.vs-cell { padding: 5px 18px 13px; text-align: center; font-size: 15.5px; line-height: 1.5; color: var(--text-2); }
.vs-l { border-right: 1px solid var(--line); }
.vs-cell code { font: .88em var(--mono); background: var(--panel-2); padding: .1em .35em; border-radius: 5px; }
.vs-trick { margin: 0; padding: 13px 18px; border-top: 1px solid var(--line); background: var(--panel-2); text-align: center; font-weight: 650; color: var(--text); }
.vs-trick strong { color: var(--accent); }

/* steps */
.steps { margin: 30px 0; }
.steps-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font: 740 16.5px var(--font); color: var(--text); }
.steps-row { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.steps-row li { position: relative; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.steps-row li:not(:last-child)::after {
  content: "\2192"; position: absolute; right: -13px; top: 22px; z-index: 1;
  width: 18px; text-align: center; font-weight: 800; color: var(--muted);
}
.st-n { width: 30px; height: 30px; margin-bottom: 8px; border-radius: 50%; display: grid; place-items: center; background: var(--day, var(--accent)); color: #06121f; font: 800 13.5px var(--font); }
.steps-row b { display: block; font-size: 15px; color: var(--text); line-height: 1.3; }
.steps-row li > span:last-child { display: block; margin-top: 4px; font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
@media (max-width: 640px) { .steps-row li::after { display: none; } }

/* lock it in */
.keyfacts {
  margin: 56px 0 8px; padding: 20px 22px; border-radius: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 12%, transparent), transparent 60%), var(--panel);
  border: 1.5px solid color-mix(in srgb, var(--gold) 55%, transparent);
}
.kf-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; font: 820 12.5px var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.kf-head .count { background: var(--gold); color: #1a1205; letter-spacing: 0; text-transform: none; }
.keyfacts ol { margin: 0; padding: 0; list-style: none; counter-reset: kf; display: grid; gap: 9px; }
.keyfacts li { counter-increment: kf; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: baseline; font-size: 16.5px; line-height: 1.55; color: var(--text); }
.keyfacts li::before { content: counter(kf); font: 850 19px var(--font-display); color: var(--gold); text-align: right; }

/* legend */
.legend { margin: 18px 0 6px; padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line-2); }
.legend-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.legend-head b { font-size: 15px; }
.legend-grid { display: grid; gap: 8px; }
.lg-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 14px; align-items: center; font-size: 14.5px; color: var(--text-2); }
.lg-ex { justify-self: start; }
.lg-ex .hbadge { margin-left: 0; vertical-align: 0; }
.topics { margin: 12px 0 0; padding: 10px 14px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line-2); display: grid; gap: 7px; }
.topics-head { font-size: 12px; color: var(--text-2); letter-spacing: .05em; text-transform: uppercase; margin-bottom: 2px; }
.topic-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; font-size: 14px; color: var(--text); }
#topics-btn { cursor: pointer; gap: 4px; }
#topics-btn svg { transition: transform .15s; }
#topics-btn[aria-expanded="true"] svg { transform: rotate(90deg); }
.lgm { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 9px; font: 750 12.5px var(--font); }
.lgm-glance { color: var(--day); background: color-mix(in srgb, var(--day) 12%, var(--panel-2)); border: 1px solid color-mix(in srgb, var(--day) 35%, transparent); letter-spacing: .06em; text-transform: uppercase; font-size: 11px; }
.lgm-hook { color: var(--text); border: 1.5px dashed color-mix(in srgb, var(--hook) 60%, transparent); }
.lgm-hook b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; color: #fff; background: linear-gradient(135deg, var(--hook), var(--hook-2)); font-size: 12px; }
.lgm-vs { color: var(--text); border: 1px solid var(--line-2); background: linear-gradient(90deg, color-mix(in srgb, #4aa8ff 16%, transparent) 50%, color-mix(in srgb, #fb923c 16%, transparent) 50%); }
.lgm-vs i { font-style: normal; font-size: 10px; padding: 1px 5px; border-radius: 999px; background: var(--text); color: var(--bg); }
.lgm-steps { color: var(--muted); }
.lgm-steps i { font-style: normal; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--day, var(--accent)); color: #06121f; font-size: 11.5px; }
.lgm-kf { color: var(--gold); border: 1.5px solid color-mix(in srgb, var(--gold) 55%, transparent); letter-spacing: .06em; text-transform: uppercase; font-size: 11px; }
@media (max-width: 640px) { .lg-row { grid-template-columns: 1fr; gap: 4px; } }

/* Blocks live inside .prose; these win over its paragraph and list spacing. */
.prose .versus .vs-trick { margin: 0; }
.prose .hook .hook-trick { margin: 14px 0 0; }
.prose .wg .wg-text { margin: 18px 0 0; }
.prose .steps .steps-row { padding: 0; margin: 0; }
.prose .steps .steps-row li { margin: 0; }
.prose .keyfacts ol { padding: 0; margin: 0; }
.prose .keyfacts li { margin: 0; }
.prose .encap .ladder { padding: 0; margin: 0; }
.prose .encap .ladder li { margin: 0; }

/* mac-learning widget */
.ml { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.ml-svg { width: 100%; height: auto; display: block; }
.ml-link.in { stroke: var(--accent); stroke-width: 4; }
.ml-link.fwd { stroke: var(--good); stroke-width: 4; }
.ml-link.flood { stroke: var(--warn); stroke-width: 4; stroke-dasharray: 7 6; }
.ml-pc.sender { color: var(--accent); }
.ml-pc.accept { color: var(--good); }
.ml-pc.ignore { color: var(--bad); opacity: .75; }
.ml-tag { font: 750 11.5px var(--font); text-anchor: middle; }
.ml-tag.sender { fill: var(--accent); }
.ml-tag.accept { fill: var(--good); }
.ml-tag.ignore { fill: var(--bad); }
.ml-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; font-size: 14px; color: var(--text-2); }
.ml-controls select { margin-left: 6px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font: inherit; }
.ml-title { font: 750 11.5px var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ml-table { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.prose .ml-table table { font: 13px var(--mono); }
.prose .ml-table th { font: 700 12px var(--font); }
.prose .ml-table th, .prose .ml-table td { padding: 7px 10px; }
.ml-table tr.new td { background: var(--good-bg); }
@media (max-width: 760px) { .ml { grid-template-columns: 1fr; } }

/* binary widget */
.bn-goal { margin-bottom: 14px; font: 650 17px var(--font); color: var(--text-2); }
.bn-goal b { font: 850 26px var(--font-display); color: var(--accent); margin: 0 4px; }
.bn-row { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.bn-bit {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0 12px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer;
}
.bn-bit:hover { border-color: var(--accent); }
.bn-place { font: 700 12px var(--mono); color: var(--muted); }
.bn-val { font: 800 26px var(--mono); color: var(--text-2); }
.bn-bit[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 16%, var(--panel-2)); border-color: var(--accent); }
.bn-bit[aria-pressed="true"] .bn-val { color: var(--accent); }
.bn-out { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 14px; }
.bn-dec { display: flex; align-items: baseline; gap: 10px; padding: 8px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.bn-dec span { font: 700 11.5px var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.bn-dec b { font: 850 28px var(--font-display); color: var(--text); }
.bn-sum { font-size: 15px; color: var(--text-2); }
.bn-input { display: block; margin-top: 14px; font-size: 14.5px; color: var(--text-2); }
.bn-input input { width: 90px; margin-left: 8px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font: 600 15px var(--mono); }
@media (max-width: 520px) { .bn-val { font-size: 20px; } .bn-place { font-size: 10px; } }

/* header-layout diagrams (IPv4 header, TCP header, ...) */
.hf { fill: var(--panel-2); stroke: var(--line-2); stroke-width: 1.2; }
.hf.key { fill: color-mix(in srgb, var(--accent) 15%, var(--panel-2)); stroke: var(--accent); }
.hf.dash { stroke-dasharray: 5 5; fill: none; }
.hft { fill: var(--text); font: 650 12.5px var(--font); text-anchor: middle; }
.hfb { fill: var(--muted); font: 10.5px var(--mono); text-anchor: middle; }
.ruler { fill: var(--muted); font: 11px var(--mono); text-anchor: middle; }

/* lpm widget */
.lp-toggle { font-size: 13.5px; color: var(--text-2); display: inline-flex; gap: 8px; align-items: center; }
.lp-ask { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 14.5px; color: var(--text-2); }
.lp-ask input { margin-left: 8px; width: 170px; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font: 600 15px var(--mono); }
.lp-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 14px; }
.lp-presets .chip { cursor: pointer; font-family: var(--mono); }
.lp-presets .chip:hover { border-color: var(--accent); color: var(--text); }
.lp-table { border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.prose .lp-table table { font: 13.5px var(--mono); margin: 0; }
.prose .lp-table th { font: 700 12px var(--font); }
.prose .lp-table th, .prose .lp-table td { padding: 6px 10px; white-space: nowrap; }
.lp-table tr.match td { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.lp-table tr.best td { background: var(--good-bg); color: var(--text); font-weight: 700; }

/* packet-walk widget */
.pw-svg { width: 100%; height: auto; display: block; }
.node.pw-on { color: var(--accent); fill: color-mix(in srgb, var(--accent) 16%, var(--node-fill)); }
.pw-card { margin-top: 12px; }
.pw-frame { display: grid; gap: 6px; }
.pw-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 9px 12px; border-radius: 11px; font-size: 14px; }
.pw-row span { font: 800 11px var(--font); letter-spacing: .1em; text-transform: uppercase; min-width: 74px; }
.pw-row b { font: 600 13.5px var(--mono); padding: 3px 8px; border-radius: 7px; background: var(--panel); border: 1px solid var(--line); color: var(--text); }
.pw-row.l2 { background: color-mix(in srgb, #2dd4bf 12%, var(--panel-2)); }
.pw-row.l2 span { color: #2dd4bf; }
.pw-row.l3 { background: color-mix(in srgb, #4aa8ff 12%, var(--panel-2)); }
.pw-row.l3 span { color: #4aa8ff; }
.pw-row.arp { background: color-mix(in srgb, #fbbf24 12%, var(--panel-2)); }
.pw-row.arp span { color: #f5b83d; }

/* subnet drill */
.sd-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.sd-q { font: 650 17px var(--font); color: var(--text); }
.sd-q code { font: 750 19px var(--mono); color: var(--accent); background: none; border: 0; padding: 0; }
.sd-time { font: 800 18px var(--mono); color: var(--muted); padding: 4px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.sd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.sd-field { display: grid; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.sd-field input { padding: 9px 10px; border-radius: 10px; border: 1.5px solid var(--line-2); background: var(--panel-2); color: var(--text); font: 650 15px var(--mono); min-width: 0; }
.sd-field input:focus { outline: none; border-color: var(--accent); }
.sd-field.right input { border-color: var(--good); background: var(--good-bg); }
.sd-field.wrong input { border-color: var(--bad); background: var(--bad-bg); }
.sd-field em { font: 700 13px var(--mono); font-style: normal; color: var(--good); min-height: 1em; }
.sd .seg button { padding: 6px 10px; }

/* stp-election widget */
.stp-svg { width: 100%; height: auto; display: block; }
.link.stp-cut { stroke: var(--bad); stroke-dasharray: 8 7; }
.node.stp-root { color: var(--warn); fill: color-mix(in srgb, var(--warn) 18%, var(--node-fill)); }
.stp-port { font-size: 11px; }
.stp-role rect { stroke-width: 1.5; }
.stp-role text { font: 800 11px var(--font); text-anchor: middle; }
.stp-role.dp rect { fill: color-mix(in srgb, #4aa8ff 22%, var(--panel)); stroke: #4aa8ff; }
.stp-role.dp text { fill: #4aa8ff; }
.stp-role.rp rect { fill: var(--good-bg); stroke: var(--good); }
.stp-role.rp text { fill: var(--good); }
.stp-role.blk rect { fill: var(--bad-bg); stroke: var(--bad); }
.stp-role.blk text { fill: var(--bad); }
.stp-legend { font-size: 12.5px; }
.stp-key { display: inline-grid; place-items: center; min-width: 26px; padding: 1px 6px; border-radius: 9px; font: 800 11px var(--font); border: 1.5px solid; }
.stp-key.dp { color: #4aa8ff; } .stp-key.rp { color: var(--good); } .stp-key.blk { color: var(--bad); }

/* acl-match widget (reuses the lpm ask, presets, and table styles) */
.lp-ask select { margin-left: 8px; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font: 600 15px var(--mono); }
.acl-ask input { width: 150px; }
.acl-ask .acl-port input { width: 80px; }
.acl-ask input:disabled { opacity: .45; }
.acl-table tr.acl-miss td { color: var(--muted); }
.acl-table tr.acl-skip td { opacity: .42; }
.acl-table tr.acl-permit td { background: var(--good-bg); color: var(--text); font-weight: 700; }
.acl-table tr.acl-deny td { background: var(--bad-bg); color: var(--text); font-weight: 700; }
.acl-table tr.acl-implicit td { font-style: italic; }
.lp-presets .chip.word { font-family: var(--font); }

/* mock exam */
.exam-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 18px; }
.exam-timer { font: 700 17px var(--mono); padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); }
.exam-timer.low { color: var(--bad); border-color: var(--bad); }
.q-actions .exam-end { margin-left: auto; }
.exam-hist { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.exam-hist > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-size: 13px; color: var(--muted); }
.exam-hist b { font-size: 20px; }
.exam-hist .good { color: var(--good); }
.exam-hist .mid { color: var(--warn); }
.exam-hist .low { color: var(--bad); }
.dom-list { border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px; background: var(--panel); }
.dom-row { display: grid; grid-template-columns: minmax(0, 1fr) 56px 160px 48px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.dom-row:last-child { border-bottom: 0; }
.dom-row b { text-align: right; }
.dom-row.weak b, .dom-row.weak span:first-child { color: var(--bad); }
@media (max-width: 560px) { .dom-row { grid-template-columns: minmax(0, 1fr) 48px 44px; } .dom-row .bar { display: none; } }
.exam-hist .tag { font-size: 11.5px; font-weight: 650; letter-spacing: .02em; color: var(--text-2); }
.exam-fresh { margin: 0 0 18px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 15px; color: var(--text-2); }
.exam-fresh b { color: var(--accent); font-size: 17px; }

/* Drag and drop questions: a tray of items above the boxes they go into */
.dd { display: grid; gap: 12px; margin: 14px 0 6px; }
.dd-tray { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 58px; padding: 10px; border: 1.5px dashed var(--line-2); border-radius: 12px; background: var(--panel-2); outline: none; }
.dd-done { font-size: 13.5px; color: var(--muted); padding: 0 4px; }
.dd-boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.dd-boxes.dd-order { grid-template-columns: 1fr; }
.dd-box { padding: 10px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--panel); outline: none; transition: border-color .12s, background .12s; }
.dd-label { margin-bottom: 8px; font-size: 14px; font-weight: 720; color: var(--text); }
.dd-label code { font: .9em var(--mono); background: var(--panel-3); padding: .1em .35em; border-radius: 5px; }
.dd-order .dd-box { display: grid; grid-template-columns: 70px minmax(0, 1fr); align-items: center; gap: 10px; padding: 8px 10px; }
.dd-order .dd-label { margin: 0; font-size: 13px; color: var(--muted); }
.dd-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.dd-slot { flex: 1 1 130px; min-height: 42px; border: 1.5px dashed var(--line-2); border-radius: 9px; }
.dd-tray.over, .dd-box.over, .dd-tray:focus-visible, .dd-box:focus-visible { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel-2)); }
.dd-item { min-height: 42px; padding: 9px 13px; border: 1.5px solid var(--line-2); border-radius: 9px; background: var(--panel-3); color: var(--text); font: inherit; font-size: 14.5px; line-height: 1.4; text-align: left; cursor: grab; touch-action: manipulation; transition: border-color .12s, transform .12s, box-shadow .12s; }
.dd-slots .dd-item { flex: 1 1 130px; }
.dd-item:hover:not(:disabled) { border-color: var(--accent); }
.dd-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dd-item.held { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--panel-3)); box-shadow: 0 6px 16px rgba(0, 0, 0, .28); transform: translateY(-1px); }
.dd-item:disabled { cursor: default; }
.dd-item.right { border-color: var(--good); background: var(--good-bg); }
.dd-item.wrong { border-color: var(--bad); background: var(--bad-bg); }
.dd-item code { font: .88em var(--mono); background: var(--panel); padding: .1em .35em; border-radius: 5px; }
.dd-fix { display: block; margin-top: 3px; font-size: 12.5px; color: var(--text-2); }
.dd-review { width: 100%; margin: 8px 0; border-collapse: collapse; font-size: 14px; }
.dd-review th, .dd-review td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.dd-review th { font-size: 12.5px; color: var(--muted); font-weight: 650; }
.dd-review tr.bad td { background: var(--bad-bg); }
.dd-review tr.bad td:last-child { color: var(--good); font-weight: 650; }

/* Config labs */
.lab-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.lab-tasks { display: grid; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; counter-reset: lt; }
.lab-tasks li { counter-increment: lt; display: grid; grid-template-columns: 30px 92px minmax(0, 1fr); gap: 4px 10px; align-items: start; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-size: 15px; line-height: 1.5; }
.lab-tasks li::before { content: counter(lt); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--panel-3); color: var(--text-2); font-weight: 750; font-size: 13px; }
.lab-tasks .lt-dev { justify-self: start; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, var(--panel-2)); color: var(--accent); font: 700 12px var(--mono); }
.lab-tasks .lt-res { grid-column: 3; font-size: 14px; color: var(--text-2); }
.lab-tasks .lt-res:empty { display: none; }
.lab-tasks li.ok { border-color: var(--good); background: var(--good-bg); }
.lab-tasks li.ok::before { content: "✓"; background: var(--good); color: #04130d; }
.lab-tasks li.ok .lt-res b { color: var(--good); }
.lab-tasks li.bad { border-color: var(--bad); }
.lab-tasks li.bad .lt-res b { color: var(--bad); }
.lab-help code { font: .9em var(--mono); background: var(--panel-3); padding: .1em .35em; border-radius: 5px; }
.lab-eds { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; margin: 10px 0 4px; }
.lab-ed { display: grid; gap: 6px; }
.lab-ed .le-name { font-weight: 750; font-size: 14px; }
.lab-ed textarea { width: 100%; min-height: 260px; resize: vertical; padding: 12px 14px; border: 1.5px solid var(--line-2); border-radius: 12px; background: #0a0f17; color: #d5ddea; font: 14px/1.6 var(--mono); tab-size: 2; }
.lab-ed textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.lab-ed textarea::placeholder { color: #5d6b84; }
.lab-out { margin-top: 12px; }
.lab-notes { margin-top: 12px; padding: 12px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel-2); }
.lab-note { font-size: 14px; color: var(--text-2); }
.lab-note ul { margin: 4px 0 8px; padding-left: 18px; }
.lab-note li { font-family: var(--mono); font-size: 13px; }
.lab-model { margin-top: 14px; display: grid; gap: 10px; }
@media (max-width: 560px) { .lab-tasks li { grid-template-columns: 26px minmax(0, 1fr); } .lab-tasks .lt-dev { grid-column: 2; } .lab-tasks .lt-text, .lab-tasks .lt-res { grid-column: 2; } }
.lab-exhibits { display: grid; gap: 12px; margin: 6px 0 22px; }
.lab-exhibits .cli { margin: 0; }
.lab-exhibits .cli code { white-space: pre-wrap; }

/* Narrow phones: keep the top bar inside 320px. Last so it wins over the 560px rules above. */
/* 381 to 440 px: the language key joined the bar, so the mark gives way and the gaps tighten. */
@media (max-width: 440px) { .brand-mark { display: none; } .topbar { gap: 6px; padding-inline: 10px; } }
@media (max-width: 380px) { .brand-tag, .brand-mark { display: none; } .brand-name { font-size: 14px; } .topbar { gap: 4px; padding-inline: 6px; } .icon-btn { width: 32px; height: 32px; } .topnav a { font-size: 12px; padding-inline: 3px; } .topnav { margin-left: 0; } }

/* Phones: wide tables and code samples scroll inside their box instead of widening the page. */
@media (max-width: 860px) {
  .table-wrap, .prose .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .prose table { min-width: max-content; }
  pre, .cli pre, .prose pre { overflow-x: auto; max-width: 100%; }
  .prose code:not(pre code), .opt code, .q-stem code { white-space: normal; overflow-wrap: anywhere; }
  .opt, .q-stem, .check { min-width: 0; overflow-wrap: anywhere; }
}
