/* sotay — handbook stylesheet. Do not edit inside a built site: edit the plugin template and rebuild. */
:root {
  --accent: #0f766e;
  --bg: #f8f7f3; --surface: #ffffff; --surface-2: #f1efe8; --fg: #1d1d1b; --muted: #66655f;
  --line: #e2e0d8; --code-bg: #f4f2ec; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  --ok: #15803d; --ok-bg: #e9f7ee; --bad: #b42318; --bad-bg: #fdecea; --warn: #a15c00; --warn-bg: #fff4e0;
  --info: #1d4ed8; --info-bg: #eaf0fe; --vio: #6d28d9; --vio-bg: #f1eafe;
  --radius: 10px; --sidebar: 290px; --toc: 220px; --topbar: 56px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --serif: "Source Serif 4", "Noto Serif", Georgia, serif;
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, "Cascadia Code", Consolas, monospace;
  --fs: 17px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #141413; --surface: #1c1c1a; --surface-2: #242421; --fg: #ebeae4; --muted: #a29f96; --line: #33322e;
    --code-bg: #20201d; --shadow: none; --ok-bg: #12301d; --bad-bg: #3a1714; --warn-bg: #33250d; --info-bg: #15213d; --vio-bg: #251a3b;
    --ok: #4ade80; --bad: #f87171; --warn: #fbbf24; --info: #93b4ff; --vio: #c4a7ff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141413; --surface: #1c1c1a; --surface-2: #242421; --fg: #ebeae4; --muted: #a29f96; --line: #33322e;
  --code-bg: #20201d; --shadow: none; --ok-bg: #12301d; --bad-bg: #3a1714; --warn-bg: #33250d; --info-bg: #15213d; --vio-bg: #251a3b;
  --ok: #4ade80; --bad: #f87171; --warn: #fbbf24; --info: #93b4ff; --vio: #c4a7ff; color-scheme: dark;
}
* { box-sizing: border-box; }
html { font-size: var(--fs); scroll-padding-top: calc(var(--topbar) + 16px); }
body { margin: 0; background: var(--bg); color: var(--fg); font: 1rem/1.65 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; height: auto; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
kbd { font: .8em var(--mono); padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); }
mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; padding: 0 2px; border-radius: 3px; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar); display: flex; align-items: center; gap: 12px;
  padding: 0 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; font-weight: 650; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; font-size: .8rem; letter-spacing: .02em; flex: none; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.search input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); font: inherit; font-size: .9rem; }
.search-results { position: absolute; top: 44px; left: 0; right: 0; max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.18); padding: 6px; }
.search-results a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--fg); text-decoration: none; }
.search-results a:hover, .search-results a.active { background: var(--surface-2); }
.search-results .sr-t { font-weight: 600; font-size: .9rem; }
.search-results .sr-x { font-size: .82rem; color: var(--muted); }
.search-results mark { padding: 0; }
.top-actions { display: flex; gap: 4px; }
.icon-btn { height: 36px; min-width: 36px; padding: 0 8px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--fg); font: inherit; font-size: .95rem; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn[aria-pressed="true"] { background: var(--vio-bg); color: var(--vio); border-color: color-mix(in srgb, var(--vio) 40%, transparent); }
.menu-btn { display: none; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--toc); min-height: calc(100vh - var(--topbar)); }
.sidebar { position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); overflow: auto; padding: 18px 14px 40px; border-right: 1px solid var(--line); font-size: .88rem; }
.sidebar .sb-top a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--fg); text-decoration: none; }
.sidebar .sb-top a:hover, .sidebar a.current { background: var(--surface-2); }
.sidebar .sb-progress { margin: 6px 10px 14px; font-size: .8rem; color: var(--muted); }
.sidebar details { margin: 4px 0; }
.sidebar summary { list-style: none; cursor: pointer; padding: 6px 10px; border-radius: 6px; font-weight: 600; display: flex; gap: 6px; align-items: baseline; }
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar summary::before { content: "›"; transition: transform .15s; display: inline-block; color: var(--muted); }
.sidebar details[open] > summary::before { transform: rotate(90deg); }
.sidebar summary:hover { background: var(--surface-2); }
.sidebar summary .sb-count { margin-left: auto; font-weight: 400; color: var(--muted); font-size: .78rem; }
.sidebar ol { list-style: none; margin: 2px 0 8px; padding: 0 0 0 14px; }
.sidebar ol a { display: flex; gap: 8px; padding: 4px 10px; border-radius: 6px; color: var(--fg); text-decoration: none; line-height: 1.4; }
.sidebar ol a:hover { background: var(--surface-2); }
.sidebar ol a.current { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 600; }
.sidebar ol a.pending { color: var(--muted); }
.sidebar .tick, .lesson-list .tick { flex: none; width: 15px; height: 15px; margin-top: 3px; border: 1.5px solid var(--line); border-radius: 50%; }
.done > a .tick, a.done .tick, li.done .tick { background: var(--ok); border-color: var(--ok); box-shadow: inset 0 0 0 2px var(--surface); }
.sb-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 10px 4px; }
.main-col { min-width: 0; display: flex; flex-direction: column; }
main { width: 100%; max-width: 820px; margin: 0 auto; padding: 32px 28px 40px; flex: 1; }
main.home, main.syllabus, main.all { max-width: 980px; }
.toc { position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); overflow: auto; padding: 32px 16px; font-size: .82rem; }
.toc .toc-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.toc a { display: block; padding: 3px 0 3px 10px; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc a.l3 { padding-left: 22px; font-size: .78rem; }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }
.toc .reading { margin-top: 16px; color: var(--muted); }
.site-footer { display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: center; padding: 20px 16px 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
@media (max-width: 1180px) { .layout { grid-template-columns: var(--sidebar) minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .menu-btn { display: inline-block; }
  .sidebar { position: fixed; z-index: 40; top: var(--topbar); left: 0; width: min(86vw, 320px); background: var(--bg); transform: translateX(-102%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  body.nav-open .sidebar { transform: none; }
  main { padding: 22px 16px 32px; }
  .brand-name { display: none; }
  .topbar { gap: 6px; padding: 0 10px; }
  #btn-font { display: none; }
}

/* ---------- headings & content ---------- */
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 2.1rem; margin: .2em 0 .3em; }
.content h2 { font-size: 1.5rem; margin: 2.4rem 0 .8rem; padding-top: .4rem; }
.content h3 { font-size: 1.18rem; margin: 1.8rem 0 .6rem; }
.content h4 { font-size: 1rem; margin: 1.4rem 0 .4rem; }
.content h2 .anchor, .content h3 .anchor { opacity: 0; margin-left: 6px; text-decoration: none; color: var(--muted); }
.content h2:hover .anchor, .content h3:hover .anchor { opacity: 1; }
.content p, .content li { max-width: 72ch; }
.content ul, .content ol { padding-left: 1.4em; }
.content li + li { margin-top: .25em; }
.content blockquote { margin: 1.2em 0; padding: .4em 1.1em; border-left: 3px solid var(--line); color: var(--muted); }
.content code { font: .88em var(--mono); background: var(--code-bg); padding: .1em .35em; border-radius: 4px; }
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 650; }
.lede { font-size: 1.12rem; color: var(--muted); max-width: 65ch; }
.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.lesson-hero { padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.meta-strip { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 18px 0 0; font-size: .88rem; }
.meta-strip dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.meta-strip dd { margin: 2px 0 0; }
.diff { color: var(--accent); letter-spacing: 2px; }
.table-wrap { overflow-x: auto; margin: 1.2em 0; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { background: var(--surface-2); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
.matrix td.dot { text-align: center; color: var(--accent); }
.schedule .ch-row td { background: var(--surface-2); }
.obj-mini { margin: 4px 0 0; padding-left: 1em; font-size: .85rem; color: var(--muted); }

/* ---------- code ---------- */
.code { margin: 1.2em 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--code-bg); overflow: hidden; }
.code-title { padding: 6px 14px; font-size: .8rem; font-weight: 600; border-bottom: 1px solid var(--line); }
.code-bar { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 0 14px; }
.code-lang { font: .72rem var(--mono); color: var(--muted); text-transform: uppercase; }
.code-bar .copy { margin-left: auto; font-size: .75rem; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.code pre { margin: 0; padding: 8px 14px 14px; overflow-x: auto; font: .85rem/1.55 var(--mono); }
.code pre code { background: none; padding: 0; font: inherit; }
.mermaid-wrap { margin: 1.4em 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow-x: auto; text-align: center; }
.mermaid-wrap pre.mermaid:not([data-processed]) { text-align: left; font: .8rem var(--mono); color: var(--muted); }
.math-block { overflow-x: auto; margin: 1em 0; }

/* ---------- callouts ---------- */
.callout, .instructor, .gap { margin: 1.4em 0; padding: 12px 16px; border-radius: var(--radius); border: 1px solid; border-left-width: 4px; }
.callout > :last-child, .instructor > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 650; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.callout.note, .callout.info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 35%, transparent); }
.callout.note .callout-title, .callout.info .callout-title { color: var(--info); }
.callout.tip { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.callout.tip .callout-title { color: var(--ok); }
.callout.warning { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.callout.warning .callout-title { color: var(--warn); }
.callout.danger { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.callout.danger .callout-title { color: var(--bad); }
.callout.example { background: var(--surface); border-color: var(--line); border-left-color: var(--accent); }
.callout.example .callout-title { color: var(--accent); }
.callout.important { background: var(--vio-bg); border-color: color-mix(in srgb, var(--vio) 35%, transparent); }
.callout.important .callout-title { color: var(--vio); }
.callout-title::before { font-size: .95em; }
.callout.note .callout-title::before { content: "ℹ"; } .callout.tip .callout-title::before { content: "💡"; }
.callout.warning .callout-title::before { content: "⚠"; } .callout.danger .callout-title::before { content: "⛔"; }
.callout.example .callout-title::before { content: "✎"; } .callout.important .callout-title::before { content: "★"; }
.instructor { display: none; background: var(--vio-bg); border-color: color-mix(in srgb, var(--vio) 40%, transparent); border-style: dashed; border-left-style: solid; }
.instructor .callout-title { color: var(--vio); }
.instructor .callout-title::before { content: "🎓"; }
.instructor-on .instructor { display: block; }
.gap { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 40%, transparent); font-size: .92rem; }
.badge { display: inline-block; font-size: .72rem; font-weight: 650; padding: 1px 8px; border-radius: 99px; vertical-align: 1px; }
.gap-badge { background: var(--warn); color: #fff; }

/* ---------- objectives & bloom ---------- */
.objectives { margin: 24px 0; padding: 16px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.objectives .obj-title { font-size: 1.05rem; margin: 0 0 2px; padding: 0; }
.objectives p { margin: 0 0 8px; font-size: .9rem; }
.objectives ul { list-style: none; padding: 0; margin: 0; }
.objectives li { padding: 5px 0; border-top: 1px dashed var(--line); }
.objectives li:first-child { border-top: 0; }
.bloom { display: inline-block; font-size: .68rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; padding: 1px 7px; border-radius: 99px; margin-right: 6px; vertical-align: 2px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.b-remember { background: #e6eefc; color: #2949a8; } .b-understand { background: #e3f4f1; color: #0d6b60; }
.b-apply { background: #e8f5e3; color: #2f6b1f; } .b-analyze { background: #fff1db; color: #8a5300; }
.b-evaluate { background: #fde7e4; color: #a3271c; } .b-create { background: #efe7fd; color: #5b2bb5; }
:root[data-theme="dark"] .bloom { filter: brightness(.85) saturate(1.2); }
.bloom-bars .bar-row { display: grid; grid-template-columns: 90px 1fr 32px; gap: 10px; align-items: center; margin: 6px 0; font-size: .9rem; }
.bar { height: 12px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; }
.bar i.b-remember { background: #5b7fe0; } .bar i.b-understand { background: #17a394; } .bar i.b-apply { background: #4f9a35; }
.bar i.b-analyze { background: #e09a2b; } .bar i.b-evaluate { background: #d9493b; } .bar i.b-create { background: #8b5cf6; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.3; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn[disabled] { opacity: .45; cursor: default; }

/* ---------- quiz ---------- */
.quiz { margin: 1.8em 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.quiz-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface-2); font-weight: 650; }
.quiz-icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .8rem; }
.quiz-score { margin-left: auto; font-weight: 500; font-size: .85rem; color: var(--muted); }
.q { padding: 14px 18px; border-top: 1px solid var(--line); }
.q:first-of-type { border-top: 0; }
.qstem { font-weight: 550; margin-bottom: 8px; }
.qhint { font-weight: 400; color: var(--muted); font-size: .85rem; }
.qopts { list-style: none; padding: 0; margin: 0; }
.qopts li { margin: 6px 0; max-width: none; }
.qopts label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.qopts label:hover { border-color: var(--accent); }
.qopts input { margin-top: 5px; accent-color: var(--accent); }
.qopts label.correct { border-color: var(--ok); background: var(--ok-bg); }
.qopts label.wrong { border-color: var(--bad); background: var(--bad-bg); }
.qopts label.missed { border-color: var(--ok); border-style: dashed; }
.qshort input { width: 100%; max-width: 360px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); font: inherit; }
.qshort input.correct { border-color: var(--ok); background: var(--ok-bg); } .qshort input.wrong { border-color: var(--bad); background: var(--bad-bg); }
.qactions { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.qfeedback { font-weight: 600; font-size: .9rem; }
.qfeedback.ok { color: var(--ok); } .qfeedback.bad { color: var(--bad); }
.qexpl { margin-top: 10px; padding: 10px 14px; border-radius: 8px; background: var(--surface-2); font-size: .93rem; }
.qexpl::before { content: "Giải thích: "; font-weight: 650; }

/* ---------- flashcards ---------- */
.flashcards { margin: 1.8em 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.fc-head { display: flex; justify-content: space-between; margin-bottom: 10px; }
.fc-count { color: var(--muted); font-size: .85rem; }
.fc-deck { position: relative; perspective: 1200px; min-height: 180px; }
.fc-deck .card { display: none; position: relative; min-height: 180px; cursor: pointer; transform-style: preserve-3d; transition: transform .45s; }
.fc-deck .card.active { display: block; }
.fc-deck .card.flipped { transform: rotateY(180deg); }
.fc-deck .front, .fc-deck .back { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; border-radius: 10px; backface-visibility: hidden; border: 1px solid var(--line); }
.fc-deck .front { background: var(--surface-2); font-size: 1.25rem; font-weight: 650; }
.fc-deck .back { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); transform: rotateY(180deg); }
.fc-deck .card.known .front::after { content: "✓ đã nhớ"; position: absolute; top: 8px; right: 12px; font-size: .75rem; color: var(--ok); }
.fc-actions { display: flex; gap: 6px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }

/* ---------- exercise / lab / checklist ---------- */
.exercise, .lab, .checklist, .steps { margin: 1.8em 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.ex-head, .lab-head, .cl-head, .steps-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; background: var(--surface-2); }
.ex-label, .lab-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: #fff; background: var(--accent); padding: 2px 8px; border-radius: 5px; }
.lab-label { background: #b45309; }
.level { color: #d18f00; letter-spacing: 1px; margin-left: auto; }
.ex-body, .lab-intro { padding: 4px 18px; }
.exercise details { margin: 0 18px 10px; border: 1px solid var(--line); border-radius: 8px; }
.exercise summary { cursor: pointer; padding: 8px 12px; font-weight: 600; font-size: .92rem; }
.exercise details > div { padding: 0 14px 6px; border-top: 1px dashed var(--line); }
.ex-solution summary { color: var(--accent); }
.ex-done { display: block; padding: 6px 18px 14px; font-size: .88rem; color: var(--muted); }
.lab-time, .lab-progress, .cl-progress { font-size: .85rem; color: var(--muted); }
.lab-time { margin-left: auto; }
.lab-sec { padding: 4px 18px 6px; border-top: 1px solid var(--line); }
.lab-sec h4 { margin: 10px 0 4px; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.checklist > ul { padding: 8px 18px 12px; }
ul.tasks { list-style: none; padding-left: 0 !important; }
ul.tasks ul.tasks { padding-left: 1.4em !important; }
.task { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.task input { margin-top: 6px; accent-color: var(--ok); width: 16px; height: 16px; flex: none; }
.task input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }

/* ---------- tabs / steps / columns / details / figure ---------- */
.tabs { margin: 1.4em 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.tab-list { display: flex; gap: 2px; padding: 6px 6px 0; background: var(--surface-2); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab-list button { border: 0; background: none; padding: 8px 14px; font: inherit; font-size: .9rem; color: var(--muted); cursor: pointer; border-radius: 8px 8px 0 0; white-space: nowrap; }
.tab-list button[aria-selected="true"] { background: var(--surface); color: var(--fg); font-weight: 600; box-shadow: 0 1px 0 var(--surface); }
.tab-panel { padding: 4px 18px; }
.steps ol { list-style: none; margin: 0; padding: 0; counter-reset: st; }
.steps .step { display: grid; grid-template-columns: 34px 1fr; gap: 4px 12px; padding: 14px 18px; border-top: 1px solid var(--line); counter-increment: st; max-width: none; }
.steps .step::before { content: counter(st); grid-row: span 2; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: .85rem; }
.step-label { font-weight: 650; }
.step-body > :first-child { margin-top: 0; }
.steps.stepping .step { display: none; }
.steps.stepping .step.on { display: grid; }
.steps-nav { display: flex; gap: 8px; align-items: center; padding: 10px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }
.steps-count { margin: 0 auto; color: var(--muted); font-size: .85rem; }
.columns { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 16px; margin: 1.4em 0; }
.columns .col { padding: 4px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.col-title { font-weight: 650; padding-top: 10px; }
@media (max-width: 700px) { .columns { grid-template-columns: 1fr; } }
details.more { margin: 1.2em 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
details.more > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; }
details.more > div { padding: 0 16px 6px; }
.fig { margin: 1.6em 0; text-align: center; }
.fig figcaption, .video figcaption { font-size: .86rem; color: var(--muted); margin-top: 6px; }
.video { margin: 1.6em 0; }
.video-load { width: 100%; aspect-ratio: 16/9; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--fg); font: inherit; font-weight: 600; cursor: pointer; }
.video iframe { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: var(--radius); }

/* ---------- citations, terms, glossary, refs ---------- */
.cites { font-size: .7em; } .cites a { text-decoration: none; }
a.term { color: inherit; text-decoration: underline dotted color-mix(in srgb, var(--accent) 70%, transparent); text-underline-offset: 3px; }
.term-demo { text-decoration: underline dotted var(--accent); }
.term-pop { position: absolute; z-index: 50; max-width: 340px; padding: 10px 12px; border-radius: 8px; background: var(--fg); color: var(--bg); font-size: .85rem; line-height: 1.45; box-shadow: 0 8px 30px rgba(0,0,0,.25); pointer-events: none; }
.term-pop strong { display: block; margin-bottom: 2px; }
.glossary-local dl, .g-list { display: grid; grid-template-columns: minmax(140px, 30%) 1fr; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.glossary-local dt, .glossary-local dd, .g-item dt, .g-item dd { margin: 0; padding: 8px 12px; border-top: 1px solid var(--line); }
.glossary-local dt, .g-item dt { font-weight: 600; background: var(--surface-2); }
.g-item { display: contents; }
.g-item[hidden] { display: none; }
.g-src { font-size: .75rem; margin-left: 6px; }
.g-tools { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.g-tools input { flex: 1; min-width: 200px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); font: inherit; }
.reflist { padding-left: 1.6em; font-size: .92rem; }
.reflist li { margin: 6px 0; word-break: break-word; }
.reflist .rid { display: none; }
.reflist li:target { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 6px; }

/* ---------- lesson end / pager ---------- */
.lesson-end { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 40px 0 16px; padding: 18px; border: 1px dashed var(--line); border-radius: 12px; }
.btn.complete.is-done { background: var(--ok); border-color: var(--ok); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.pager a { display: block; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--fg); background: var(--surface); }
.pager a:hover { border-color: var(--accent); }
.pager a small { display: block; color: var(--muted); font-size: .78rem; }
.pager a.next { text-align: right; grid-column: 2; }

/* ---------- home ---------- */
.hero { padding: 24px 0 28px; }
.hero h1 { font-size: 2.6rem; font-family: var(--serif); font-weight: 650; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 18px; }
.progress-wrap { display: flex; align-items: center; gap: 12px; font-size: .88rem; color: var(--muted); }
.progress { flex: 1; max-width: 360px; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 99px; transition: width .3s; }
.clo-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.clo-list li { padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); max-width: none; }
.clo-id { font-weight: 700; color: var(--accent); margin-right: 6px; }
.chapter-card { margin: 18px 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.chapter-card header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.chapter-card h3 { margin: 0; font-size: 1.2rem; }
.ch-no { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; }
.ch-progress { margin-left: auto; font-size: .8rem; color: var(--muted); }
.lesson-list { list-style: none; padding: 0; margin: 10px 0 0; }
.lesson-list li { padding: 10px 0; border-top: 1px solid var(--line); max-width: none; }
.lesson-list a { display: flex; gap: 10px; align-items: baseline; color: var(--fg); text-decoration: none; font-weight: 600; }
.lesson-list a:hover .l-title { color: var(--accent); }
.l-id { font: .78rem var(--mono); color: var(--muted); }
.l-hours { margin-left: auto; font-size: .8rem; color: var(--muted); font-weight: 400; }
.l-sum { margin: 2px 0 4px 25px; font-size: .88rem; color: var(--muted); }
.chips { margin-left: 25px; display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: .7rem; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.howto-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.howto-grid > div { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: .9rem; }
.howto-grid p { margin: 4px 0 0; color: var(--muted); }

/* ---------- practice ---------- */
.practice-form { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); align-items: flex-start; }
.practice-form fieldset { border: 0; padding: 0; margin: 0; }
.practice-form legend { font-weight: 650; margin-bottom: 6px; }
.ch-opts { display: flex; flex-direction: column; gap: 4px; }
.practice-form select { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); font: inherit; }
.p-result { margin: 20px 0; padding: 16px 18px; border-radius: 12px; background: var(--ok-bg); font-weight: 600; }
.q .q-src { font-size: .78rem; color: var(--muted); margin-top: 8px; }

/* ---------- all-in-one & print ---------- */
.all-ch { font-family: var(--serif); font-size: 2rem; margin-top: 3rem; padding-top: 1rem; border-top: 3px solid var(--accent); }
.all-title { font-size: 1.6rem; margin-top: 2.6rem; }
.all-lesson + .all-lesson { border-top: 1px solid var(--line); margin-top: 2rem; }
@media print {
  :root { --fs: 11pt; --bg: #fff; --surface: #fff; --surface-2: #f3f3f3; --fg: #000; }
  .topbar, .sidebar, .toc, .pager, .lesson-end, .site-footer, .no-print, .qactions, .fc-actions, .steps-nav, .ex-done, .copy, .skip { display: none !important; }
  .layout { display: block; } main { max-width: none; padding: 0; }
  .fc-deck .card { display: block !important; transform: none !important; min-height: 0; margin-bottom: 6px; }
  .fc-deck .front, .fc-deck .back { position: static; transform: none; backface-visibility: visible; display: block; padding: 6px 10px; text-align: left; font-size: 1rem; }
  .steps .step { display: grid !important; }
  details { border: 0 !important; } details > summary { list-style: none; font-weight: 700; }
  details:not([open]) > div { display: block; }
  .quiz, .exercise, .lab, .callout, .chapter-card, .objectives, figure { break-inside: avoid; box-shadow: none; }
  .all-ch, .all-lesson { break-before: page; }
  a { color: inherit; text-decoration: none; }
  .tab-panel[hidden] { display: block !important; }
  .video { display: none; }
}
