/* ============================================================
   家教会的本体论革命 — Digital Scriptorium reading theme
   Three themes (paper / sepia / night) via [data-theme].
   Reader-adjustable type size & column width via custom props.
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ----- palette: paper (default) ----- */
  --bg:        #FAF6EC;
  --bg-grain:  #F3ECDB;
  --surface:   #F4EEDF;
  --surface-2: #EFE7D4;
  --text:      #241B11;
  --muted:     #6A5C49;
  --faint:     #94866F;
  --accent:    #8A3517;   /* oxblood / sienna */
  --accent-ink:#732A11;
  --accent2:   #4A6741;   /* olive */
  --border:    #E2D8C3;
  --rule:      #D9CDB4;
  --quote-bg:  #F1E8D3;
  --mark:      rgba(138,53,23,0.10);
  --shadow:    rgba(48,33,16,0.13);

  /* ----- geometry ----- */
  --sidebar-w: 272px;
  --topbar-h:  56px;
  --reading-font:    19px;   /* set by reader controls */
  --reading-measure: 720px;  /* set by reader controls */
  --reading-lh:      1.95;

  --font-body: 'Noto Serif SC', 'Songti SC', 'Source Han Serif SC', Georgia, serif;
  --font-ui:   'Noto Sans SC', 'PingFang SC', system-ui, sans-serif;
  --font-latin:'EB Garamond', 'Noto Serif SC', Georgia, serif;
}

/* ----- sepia ----- */
:root[data-theme="sepia"] {
  --bg:#F3E7CE; --bg-grain:#ECDCBE; --surface:#EBDDBF; --surface-2:#E4D3B0;
  --text:#3A2C19; --muted:#6E5B3E; --faint:#917A56;
  --accent:#9A4318; --accent-ink:#7E3413; --accent2:#566B36;
  --border:#DBC8A4; --rule:#D2BD96; --quote-bg:#E9D9B6; --mark:rgba(154,67,24,0.12);
  --shadow:rgba(60,40,18,0.16);
}

/* ----- night ----- */
:root[data-theme="dark"] {
  --bg:#17140F; --bg-grain:#1C1813; --surface:#211C15; --surface-2:#272118;
  --text:#E4DAC8; --muted:#A89A82; --faint:#7E7361;
  --accent:#D98A4E; --accent-ink:#E59A5E; --accent2:#9DB87E;
  --border:#352D22; --rule:#3A3125; --quote-bg:#221D16; --mark:rgba(217,138,78,0.14);
  --shadow:rgba(0,0,0,0.5);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--reading-font);
  line-height: var(--reading-lh);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* faint paper grain via layered gradients */
  background-image:
    radial-gradient(circle at 18% 12%, var(--bg-grain) 0, transparent 42%),
    radial-gradient(circle at 82% 78%, var(--bg-grain) 0, transparent 46%);
  background-attachment: fixed;
  transition: background-color 0.4s ease, color 0.4s ease;
}

::selection { background: var(--mark); }

/* ===== Progress bar ===== */
#progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  z-index: 9999;
  transition: width 0.12s linear;
}

/* ===== Overlay (mobile sidebar) ===== */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(24, 16, 8, 0.5);
  backdrop-filter: blur(2px);
  z-index: 200;
}
.overlay.active { display: block; }

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 300;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.sidebar::-webkit-scrollbar { width: 7px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 4px; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.book-title-link {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  line-height: 1.45;
  letter-spacing: 0.01em;
}
.book-title-link small {
  display: block;
  font-family: var(--font-latin);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--faint);
  font-weight: 500;
  margin-top: 3px;
  text-transform: uppercase;
}
.book-title-link:hover { color: var(--accent-ink); }

.close-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  display: none;
  flex-shrink: 0;
}
.close-btn:hover { background: var(--surface-2); }

/* TOC tree */
.toc-tree { padding: 12px 0 28px; flex: 1; }

.toc-part {
  padding: 14px 16px 4px;
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.13em;
  opacity: 0.92;
}

.toc-item {
  display: block;
  padding: 6px 16px 6px 22px;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  line-height: 1.5;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.toc-item:hover { background: var(--surface-2); color: var(--text); }
.toc-item.active {
  background: var(--mark);
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* ===== Main layout ===== */
.layout {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px) saturate(1.1);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 12px;
  z-index: 100;
}

.hamburger {
  background: none; border: none;
  font-size: 20px; color: var(--text);
  cursor: pointer; padding: 4px 6px; border-radius: 6px;
  display: none; flex-shrink: 0;
}
.hamburger:hover { background: var(--surface-2); }

.topbar-title {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--faint);
  flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  letter-spacing: 0.02em;
}

.chapter-nav { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

.nav-btn {
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: var(--accent);
  text-decoration: none;
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-btn:hover { background: var(--mark); border-color: var(--accent); }
.nav-btn.disabled { color: var(--faint); opacity: 0.5; pointer-events: none; }

/* ===== Reader settings (Aa) ===== */
.reader-tools { position: relative; flex-shrink: 0; }
.tool-btn {
  font-family: var(--font-latin);
  font-size: 16px; font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 40px; height: 32px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1;
}
.tool-btn:hover, .tool-btn.open { background: var(--mark); border-color: var(--accent); }

.settings-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 268px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 44px -12px var(--shadow), 0 4px 10px -6px var(--shadow);
  padding: 18px;
  z-index: 400;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.settings-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.settings-row { margin-bottom: 16px; }
.settings-row:last-child { margin-bottom: 0; }
.settings-label {
  font-family: var(--font-ui);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--faint);
  margin-bottom: 9px;
}
.seg {
  display: flex; gap: 6px;
}
.seg-btn {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 4px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.seg-btn:hover { border-color: var(--accent); color: var(--text); }
.seg-btn.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 2px 8px -2px var(--shadow);
}
:root[data-theme="dark"] .seg-btn.active { color: #1a1610; }
.swatch-dot {
  width: 13px; height: 13px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.18);
  display: inline-block;
}
.font-stepper { display: flex; align-items: center; gap: 10px; }
.font-stepper button {
  flex-shrink: 0;
  width: 38px; height: 34px;
  font-family: var(--font-latin); font-size: 15px; font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.15s;
}
.font-stepper button:hover { border-color: var(--accent); background: var(--mark); }
.font-stepper .font-val {
  flex: 1; text-align: center;
  font-family: var(--font-ui); font-size: 13px; color: var(--muted);
}

/* ===== Content area ===== */
.content {
  flex: 1;
  max-width: calc(var(--reading-measure) + 64px);
  margin: 0 auto;
  padding: 64px 32px 96px;
  width: 100%;
}

/* ===== Chapter header ===== */
.chapter-header {
  margin-bottom: 44px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.chapter-header::after {
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  width: 64px; height: 2px;
  background: var(--accent);
}

.chapter-kicker {
  font-family: var(--font-ui);
  font-size: 12px; font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.14em;
  margin-bottom: 16px;
}

.chapter-title {
  font-family: var(--font-body);
  font-size: clamp(1.7rem, 1rem + 2.4vw, 2.55rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.32;
  letter-spacing: -0.005em;
}
.chapter-title .latin { font-family: var(--font-latin); font-weight: 600; }

.chapter-meta {
  display: flex; align-items: center; gap: 14px;
  margin-top: 16px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: var(--faint);
  letter-spacing: 0.02em;
}
.chapter-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }

/* ===== Body text ===== */
.body-text {
  font-size: var(--reading-font);
  line-height: var(--reading-lh);
}

/* chapter epigraph = the first ### subtitle, distinct from numbered sections */
.body-text .chapter-epigraph {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.22em;
  line-height: 1.6;
  color: var(--accent2);
  text-align: center;
  letter-spacing: 0.01em;
  margin: 0 0 2.4rem;
  padding-bottom: 1.6rem;
  border: none;
  position: relative;
}
.body-text .chapter-epigraph::after {
  content: "✦";
  position: absolute;
  left: 50%; bottom: 0;
  transform: translateX(-50%);
  font-size: 0.66em;
  color: var(--faint);
}

/* numbered / regular section headings */
.body-text h2 {
  font-family: var(--font-body);
  font-size: 1.4em;
  font-weight: 700;
  color: var(--text);
  margin: 2.4rem 0 1rem;
  scroll-margin-top: 80px;
}
.body-text h3 {
  font-family: var(--font-body);
  font-size: 1.22em;
  font-weight: 700;
  color: var(--accent);
  margin: 2.6rem 0 1rem;
  padding-left: 16px;
  border-left: 3px solid var(--accent);
  line-height: 1.45;
  scroll-margin-top: 80px;
}
.body-text h4, .body-text h5, .body-text h6 {
  font-family: var(--font-ui);
  font-size: 1.02em;
  font-weight: 600;
  color: var(--accent2);
  margin: 1.8rem 0 0.7rem;
  scroll-margin-top: 80px;
}

/* Paragraphs */
.body-text p {
  margin-bottom: 1.25em;
  text-align: justify;
  text-justify: inter-character;
  text-indent: 2em;
}
/* opening paragraph after the epigraph: drop the indent, lift it */
.body-text .chapter-epigraph + p { text-indent: 0; }
.body-text .chapter-epigraph + p::first-letter {
  font-family: var(--font-latin);
  font-size: 3.1em;
  font-weight: 600;
  float: left;
  line-height: 0.82;
  padding: 0.05em 0.12em 0 0;
  color: var(--accent);
}

/* Blockquotes — scripture / citation */
.body-text blockquote {
  margin: 1.8em 0;
  padding: 18px 24px 18px 26px;
  background: var(--quote-bg);
  border-left: 3px solid var(--accent2);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
  font-size: 0.98em;
  text-indent: 0;
  position: relative;
}
.body-text blockquote p { text-indent: 0; margin-bottom: 0.5em; }
.body-text blockquote p:last-child { margin-bottom: 0; }

/* Lists */
.body-text ul, .body-text ol { margin: 1.2em 0 1.2em 1.6em; }
.body-text li { margin-bottom: 0.5em; line-height: 1.85; padding-left: 0.2em; }
.body-text ul li::marker { color: var(--accent); }
.body-text ol li::marker { color: var(--accent); font-family: var(--font-latin); }

/* Tables */
.body-text table {
  width: 100%; border-collapse: collapse;
  margin: 1.8em 0; font-size: 0.93em;
  font-family: var(--font-ui);
  box-shadow: 0 1px 0 var(--border);
}
.body-text td, .body-text th {
  border: 1px solid var(--border);
  padding: 10px 14px; vertical-align: top;
  line-height: 1.6;
}
.body-text th { background: var(--surface-2); font-weight: 600; color: var(--text); }
.body-text tr:nth-child(even) td { background: color-mix(in srgb, var(--surface) 50%, transparent); }

/* Code */
.body-text pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px; overflow-x: auto;
  font-size: 0.86em; margin: 1.4em 0;
}
.body-text code {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.88em;
  background: var(--surface-2);
  padding: 2px 6px; border-radius: 4px;
  color: var(--accent-ink);
}
.body-text pre code { background: none; padding: 0; color: inherit; }

/* Links */
.body-text a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  transition: border-color 0.15s;
}
.body-text a:hover { border-bottom-color: var(--accent); }

/* Images */
.body-text img { max-width: 100%; height: auto; display: block; margin: 1.6em auto; border-radius: 6px; }

/* Horizontal rules — section break before references */
.body-text hr {
  border: none;
  margin: 2.8em auto;
  width: 40%;
  height: 14px;
  background: radial-gradient(circle, var(--faint) 1.2px, transparent 1.4px) 0 50% / 18px 14px repeat-x;
  opacity: 0.6;
}

/* Strong / em — theological key terms */
.body-text strong {
  color: var(--accent-ink);
  font-weight: 700;
}
.body-text em { color: var(--muted); font-style: italic; }

/* references / notes block (the trailing ol after the last hr) reads finer */
.body-text hr ~ p { font-size: 0.92em; color: var(--muted); }
.body-text hr ~ ol { font-size: 0.9em; color: var(--muted); }
.body-text hr ~ ol li { margin-bottom: 0.7em; line-height: 1.75; }

/* ===== In-chapter outline (left rail, scroll-spy) ===== */
.outline {
  position: fixed;
  top: calc(var(--topbar-h) + 40px);
  left: calc(var(--sidebar-w) + max(24px, calc((100vw - var(--sidebar-w) - var(--reading-measure)) / 2 - 230px)));
  width: 200px;
  max-height: calc(100vh - var(--topbar-h) - 90px);
  overflow-y: auto;
  display: none;
  z-index: 50;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.outline-title {
  font-family: var(--font-ui);
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.13em;
  color: var(--faint);
  margin-bottom: 12px;
  padding-left: 13px;
}
.outline-link {
  display: block;
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.45;
  color: var(--faint);
  text-decoration: none;
  padding: 5px 0 5px 13px;
  border-left: 2px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.outline-link:hover { color: var(--text); }
.outline-link.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

/* ===== Chapter footer ===== */
.chapter-footer { margin-top: 72px; padding-top: 28px; border-top: 1px solid var(--rule); }
.chapter-nav-footer { display: flex; justify-content: space-between; align-items: stretch; gap: 14px; }
.chapter-nav-footer a {
  font-family: var(--font-ui);
  font-size: 13.5px;
  color: var(--accent);
  text-decoration: none;
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  background: var(--surface);
}
.chapter-nav-footer a:hover { background: var(--mark); border-color: var(--accent); }
.chapter-nav-footer a.foot-home { color: var(--muted); }

/* ===== Back to top ===== */
.back-to-top {
  position: fixed;
  bottom: 30px; right: 30px;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--accent); color: #fff;
  border: none; font-size: 18px; cursor: pointer;
  opacity: 0; transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s, background 0.2s;
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 22px -6px var(--shadow);
}
.back-to-top.visible { opacity: 1; transform: translateY(0); }
.back-to-top:hover { background: var(--accent-ink); }
:root[data-theme="dark"] .back-to-top { color: #1a1610; }

/* ===== Responsive ===== */
@media (max-width: 1300px) { .outline { display: none !important; } }
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 6px 0 30px rgba(24,16,8,0.22); }
  .close-btn { display: block; }
  .layout { margin-left: 0; }
  .hamburger { display: block; }
}
@media (max-width: 768px) {
  .content { padding: 40px 20px 72px; }
  .chapter-title { font-size: 1.6rem; }
  .nav-btn { font-size: 12px; padding: 5px 10px; }
  .nav-btn .nav-label { display: none; }
  .chapter-nav-footer { flex-direction: column; }
  .chapter-nav-footer a { text-align: center; }
  .body-text .chapter-epigraph + p::first-letter { font-size: 2.6em; }
  .settings-panel { position: fixed; top: var(--topbar-h); right: 8px; left: 8px; width: auto; }
}

/* ===== Index / cover page ===== */
.cover-page { padding: 0; }
.cover-controls {
  position: fixed; top: 18px; right: 20px; z-index: 100;
}
.cover-hero {
  max-width: 760px;
  margin: clamp(48px, 11vh, 120px) auto 0;
  padding: 0 32px;
  text-align: center;
}
.cover-decoration {
  font-family: var(--font-latin);
  font-size: 13px; letter-spacing: 0.4em;
  color: var(--faint);
  margin-bottom: 30px;
  text-transform: uppercase;
}
.cover-main-title {
  font-family: var(--font-body);
  font-size: clamp(2.4rem, 1rem + 6vw, 4.4rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin-bottom: 22px;
}
.cover-greek {
  font-family: var(--font-latin);
  font-size: clamp(0.95rem, 0.6rem + 1vw, 1.2rem);
  font-weight: 500;
  font-style: italic;
  color: var(--accent);
  letter-spacing: 0.16em;
  margin-bottom: 34px;
}
.cover-tagline {
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.85;
  max-width: 30em;
  margin: 0 auto 28px;
  padding: 20px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.cover-stat {
  font-family: var(--font-ui);
  font-size: 12.5px; color: var(--faint);
  letter-spacing: 0.04em;
  margin-bottom: 40px;
}
.cover-cta {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 34px;
  background: var(--accent); color: #fff;
  font-family: var(--font-ui); font-size: 15px;
  text-decoration: none; border-radius: 30px;
  letter-spacing: 0.05em;
  box-shadow: 0 12px 30px -10px var(--shadow);
  transition: transform 0.2s, background 0.2s;
}
.cover-cta:hover { background: var(--accent-ink); transform: translateY(-2px); }
:root[data-theme="dark"] .cover-cta { color: #1a1610; }
.cover-resume {
  display: block;
  margin-top: 18px;
  font-family: var(--font-ui); font-size: 13px;
  color: var(--accent2); text-decoration: none;
}
.cover-resume:hover { text-decoration: underline; }

.cover-toc { max-width: 760px; margin: 84px auto 100px; padding: 0 32px; }
.cover-toc h2 {
  font-family: var(--font-body);
  font-size: 1.1rem; font-weight: 700;
  color: var(--faint);
  letter-spacing: 0.18em;
  text-align: center;
  margin-bottom: 36px;
}
.cover-part-title {
  font-family: var(--font-ui);
  font-size: 12px; font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin: 30px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.cover-toc-item {
  display: flex; align-items: baseline; gap: 12px;
  padding: 9px 6px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-body); font-size: 15.5px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s, padding-left 0.15s;
}
.cover-toc-item:hover { background: var(--surface-2); color: var(--accent); padding-left: 12px; }
.cover-toc-item .item-title { flex: 1; }
.cover-toc-item .item-arrow { color: var(--faint); font-family: var(--font-latin); opacity: 0; transition: opacity 0.15s; }
.cover-toc-item:hover .item-arrow { opacity: 1; }

/* Added Interactive Courseware styles */
.courseware-btn {
  background-color: var(--accent2) !important;
  color: #fff !important;
  border-color: var(--accent2) !important;
}
.courseware-btn:hover {
  background-color: var(--accent) !important;
  border-color: var(--accent) !important;
}
.chapter-nav-footer a.courseware-footer-btn {
  background-color: var(--accent2) !important;
  color: #fff !important;
  border-color: var(--accent2) !important;
}
.chapter-nav-footer a.courseware-footer-btn:hover {
  background-color: var(--accent) !important;
  border-color: var(--accent) !important;
}
/* ===== Site Navigation Bar ===== */
.site-nav {
  height: 48px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px) saturate(1.1);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  z-index: 500;
  position: relative;
}
.site-nav .nav-link {
  font-family: 'Noto Sans SC', 'PingFang SC', system-ui, sans-serif;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
  position: relative;
  letter-spacing: 0.02em;
}
.site-nav .nav-link:hover { color: var(--accent); }
.site-nav .nav-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -5px;
  width: 0; height: 1.5px;
  background: var(--accent);
  transition: width 0.25s ease;
}
.site-nav .nav-link:hover::after { width: 100%; }
