/* 研究生三门核心课程 V3 全局共享样式表 (assets/v3-common.css) */
:root {
  --ink: #1e293b; --muted: #64748b; --paper: #f4f3ee; --card: #ffffff; --card-alt: #fbfaf6;
  --primary: #1e3a5f; --primary-dark: #16324f; --primary-light: #274b73; --primary-soft: #eef3f8;
  --accent: #0e7490; --accent-soft: #e6f4f7; --bar-bg: #0f2338;
  --warn: #b91c1c; --warn-soft: #fef2f2; --eg: #15803d; --eg-soft: #f0fdf4;
  --idea: #b45309; --idea-soft: #fffbeb; --exam: #6d28d9; --exam-soft: #f5f3ff;
  --line: #e2e8f0; --line-strong: #cbd5e1; --tc-strong: #94a3b8; --tc-mid: #cbd5e1;
  --thead-bg: #eef3f8; --thead-ink: #16324f;
  --r-s: 6px; --r-m: 10px; --r-l: 14px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.09);
  --t: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", Georgia, "Microsoft YaHei", serif;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Noto Sans SC", sans-serif;
  --mono: "JetBrains Mono", Consolas, Menlo, Monaco, "Courier New", monospace;
}
body.dark-mode {
  --ink: #e2e8f0; --muted: #94a3b8; --paper: #0f172a; --card: #1e293b; --card-alt: #162032;
  --primary: #93c5fd; --primary-dark: #bfdbfe; --primary-soft: rgba(59, 130, 246, 0.14);
  --accent: #38bdf8; --accent-soft: rgba(56, 189, 248, 0.14); --bar-bg: #091524;
  --warn: #f87171; --warn-soft: rgba(239, 68, 68, 0.14); --eg: #4ade80; --eg-soft: rgba(34, 197, 94, 0.14);
  --idea: #fbbf24; --idea-soft: rgba(245, 158, 11, 0.14); --exam: #c084fc; --exam-soft: rgba(168, 85, 247, 0.14);
  --line: #334155; --line-strong: #475569; --thead-bg: rgba(51, 65, 85, 0.5); --thead-ink: #f1f5f9;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 68px; }
html, body { overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.82;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; transition: color var(--t); }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
::selection { background: var(--accent-soft); color: var(--primary-dark); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

header.hero {
  background:
    radial-gradient(110% 150% at 12% 0%, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0) 58%),
    linear-gradient(135deg, #16324f 0%, #1e3a5f 55%, #274b73 100%);
  color: #fff;
  padding: 28px max(3vw, calc(50% - 780px)) 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
}
.hero .crumbs {
  font-size: 13px;
  opacity: 0.85;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.hero .crumbs a { color: #e0f2fe; text-decoration: none; border-bottom: 1px dashed rgba(255,255,255,0.4); }
.hero .crumbs a:hover { color: #fff; border-bottom-style: solid; }
.hero h1 {
  margin: 8px 0 10px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(24px, 3vw, 31px);
  letter-spacing: 0.02em;
  line-height: 1.32;
  color: #fff;
}
.hero h1::before {
  content: "";
  display: block;
  width: 32px;
  height: 3px;
  background: #38bdf8;
  margin: 0 0 10px;
  border-radius: 2px;
}
.hero .meta, .hero .sub {
  font-size: 14px;
  opacity: 0.92;
  line-height: 1.65;
  max-width: 1280px;
}
.hero .meta span { margin-right: 18px; display: inline-block; }
.hero code {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.9em;
}

.modswitch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px max(3vw, calc(50% - 780px));
  background: var(--bar-bg);
  position: sticky;
  top: 0;
  z-index: 80;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.modswitch-links {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
}
.modswitch a {
  color: #dbeafe;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  padding: 4px 11px;
  text-decoration: none;
  transition: all var(--t);
  white-space: nowrap;
}
.modswitch a:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  text-decoration: none;
}
.modswitch a.here {
  background: #ffffff;
  color: #16324f;
  font-weight: 700;
  border-color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.modswitch a.nav-home {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.45);
  color: #e0f2fe;
  font-weight: 600;
}
.modswitch-tools {
  display: flex;
  gap: 6px;
  align-items: center;
}
.modswitch-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--t);
  white-space: nowrap;
}
.modswitch-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.wrap {
  display: flex;
  max-width: 1600px;
  width: 94%;
  margin: 0 auto;
  gap: 28px;
  padding: 26px 20px 72px;
  align-items: flex-start;
}
nav.toc {
  width: 272px;
  flex-shrink: 0;
  position: sticky;
  top: 62px;
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: 15px 13px;
  font-size: 13.5px;
  max-height: calc(100vh - 82px);
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}
nav.toc .toc-title {
  font-weight: 700;
  color: var(--primary);
  font-size: 14px;
  margin-bottom: 8px;
  padding-bottom: 7px;
  border-bottom: 1.5px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
nav.toc details {
  margin: 5px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-alt);
  overflow: hidden;
}
nav.toc summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--primary);
  padding: 7px 10px;
  list-style: none;
  font-size: 13px;
  line-height: 1.45;
  user-select: none;
}
nav.toc summary::-webkit-details-marker { display: none; }
nav.toc summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
  margin-right: 7px;
  transition: transform 0.2s ease;
}
nav.toc details[open] > summary::before { transform: rotate(90deg); }
nav.toc a {
  display: block;
  color: var(--ink);
  padding: 4px 9px 4px 20px;
  border-radius: 6px;
  line-height: 1.5;
  font-size: 13px;
  margin: 1px 4px;
  transition: background var(--t), color var(--t);
}
nav.toc > .toc-list > a {
  padding-left: 10px;
  font-weight: 600;
  color: var(--primary);
}
nav.toc a:hover {
  background: var(--primary-soft);
  color: var(--accent);
  text-decoration: none;
}
nav.toc a.cur {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--accent);
  color: var(--primary);
  font-weight: 700;
}
nav.toc::-webkit-scrollbar { width: 4px; }
nav.toc::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

main {
  flex: 1;
  min-width: 0;
}
section {
  margin-bottom: 34px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: 22px 26px;
  box-shadow: var(--shadow-xs);
}
section > h2:first-child {
  margin-top: 0;
}
h2 {
  font-family: var(--serif);
  font-size: 21.5px;
  color: var(--primary);
  border-bottom: 2px solid var(--line);
  padding-bottom: 9px;
  margin: 14px 0 16px;
  letter-spacing: 0.01em;
  line-height: 1.4;
}
h2 .h2-no { color: var(--accent); font-weight: 800; }
h3 {
  font-size: 17.5px;
  color: var(--primary-dark);
  margin: 22px 0 10px;
  line-height: 1.45;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
h3::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
}
h4 {
  font-size: 15.5px;
  color: var(--primary);
  margin: 16px 0 8px;
}
p { margin: 10px 0; }
ul, ol { padding-left: 1.45em; margin: 10px 0; }
li { margin: 5px 0; }

.slide-ref {
  font-size: 12px;
  color: var(--muted);
  background: var(--primary-soft);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2px 9px;
  margin-left: 8px;
  white-space: nowrap;
  font-family: var(--sans);
  font-weight: 500;
}

.box {
  border-radius: var(--r-m);
  padding: 16px 20px;
  margin: 15px 0;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  background: var(--card-alt);
  box-shadow: var(--shadow-xs);
}
.box .box-tag, .box .tag {
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 7px;
}
.def { background: var(--primary-soft); border-color: #cbd5e1; border-left-color: var(--primary); }
.def .box-tag, .def .tag { color: var(--primary); }
.def .box-tag::before, .def .tag::before { content: "📘 "; }

.thm { background: var(--accent-soft); border-color: #bae6fd; border-left-color: var(--accent); }
.thm .box-tag, .thm .tag { color: var(--accent); }
.thm .box-tag::before, .thm .tag::before { content: "⭐ "; }

.idea { background: var(--idea-soft); border-color: #fde68a; border-left-color: var(--idea); }
.idea .box-tag, .idea .tag { color: var(--idea); }
.idea .box-tag::before, .idea .tag::before { content: "💡 "; }

.warn { background: var(--warn-soft); border-color: #fecaca; border-left-color: var(--warn); }
.warn .box-tag, .warn .tag { color: var(--warn); }
.warn .box-tag::before, .warn .tag::before { content: "⚠️ "; }

.eg { background: var(--eg-soft); border-color: #bbf7d0; border-left-color: var(--eg); }
.eg .box-tag, .eg .tag { color: var(--eg); }
.eg .box-tag::before, .eg .tag::before { content: "✏️ "; }

.exam { background: var(--exam-soft); border-color: #ddd6fe; border-left-color: var(--exam); }
.exam .box-tag, .exam .tag { color: var(--exam); }
.exam .box-tag::before, .exam .tag::before { content: "📝 "; }

.ug-bridge {
  background: linear-gradient(135deg, var(--card) 0%, var(--primary-soft) 100%);
  border: 1.5px solid var(--accent);
  border-left: 5px solid var(--accent);
  border-radius: var(--r-l);
  padding: 20px 24px;
  margin: 0 0 26px;
  box-shadow: var(--shadow-sm);
}
.ug-bridge .bridge-kicker {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}
.ug-bridge h2 {
  margin-top: 4px;
  border-bottom-color: rgba(14, 116, 144, 0.2);
}

.part-head {
  margin: 36px 0 18px;
  padding: 20px 24px;
  border-radius: var(--r-l);
  color: #fff;
  background: linear-gradient(135deg, #16324f 0%, #274b73 100%);
  box-shadow: var(--shadow-sm);
}
.part-head.first { margin-top: 0; }
.part-head .part-kicker {
  font-size: 12.5px;
  letter-spacing: 0.1em;
  opacity: 0.9;
  text-transform: uppercase;
  font-weight: 600;
}
.part-head h2 {
  color: #fff;
  border: none;
  margin: 6px 0 4px;
  font-size: 23px;
  padding: 0;
}
.part-head .part-meta { font-size: 13.5px; opacity: 0.9; }
.part-head code { background: rgba(255, 255, 255, 0.18); color: #fff; padding: 2px 7px; border-radius: 4px; }

main details, details.acc {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  background: var(--card);
  padding: 0;
  overflow: hidden;
  transition: border-color var(--t);
}
main details[open], details.acc[open] {
  border-color: var(--accent);
}
main details > summary, details.acc > summary {
  cursor: pointer;
  padding: 10px 16px;
  font-weight: 600;
  color: var(--primary);
  background: var(--card-alt);
  user-select: none;
  list-style: none;
  transition: background var(--t), color var(--t);
}
main details > summary::-webkit-details-marker, details.acc > summary::-webkit-details-marker { display: none; }
main details > summary::before, details.acc > summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 6px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  margin-right: 9px;
  transition: transform 0.2s ease;
  vertical-align: 1px;
}
main details[open] > summary::before, details.acc[open] > summary::before { transform: rotate(90deg); }
main details > summary:hover, details.acc > summary:hover { background: var(--primary-soft); color: var(--accent); }
main details > :not(summary) { padding: 0 18px; }
main details > .inner, details.acc > .inner {
  padding: 12px 18px 14px;
  border-top: 1px dashed var(--line);
  background: var(--card);
}

.table-wrap { width: 100%; overflow-x: auto; margin: 14px 0; }
table {
  border-collapse: collapse;
  width: 100%;
  margin: 14px 0;
  font-size: 14.5px;
  background: var(--card);
  border-radius: var(--r-s);
  overflow: hidden;
}
th, td {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 9px 13px;
  text-align: left;
  vertical-align: top;
  line-height: 1.65;
}
th {
  border-top: 2px solid var(--tc-strong);
  border-bottom: 1.5px solid var(--tc-mid);
  background: var(--thead-bg);
  color: var(--thead-ink);
  font-weight: 700;
  letter-spacing: 0.03em;
  font-size: 13.5px;
}
tbody tr:last-child td { border-bottom: 2px solid var(--tc-strong); }
tbody tr:nth-child(even) { background: var(--card-alt); }
tbody tr:hover { background: var(--primary-soft); }
.box table { background: transparent; }

code {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.89em;
  font-family: var(--mono);
}
pre {
  background: #0f172a;
  color: #f8fafc;
  padding: 16px 18px;
  border-radius: var(--r-m);
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.6;
  margin: 14px 0;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}
pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.study-block, .review-addendum, .combined-section, .merged-appendix {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--r-l);
  padding: 20px 24px;
  margin: 22px 0;
  box-shadow: var(--shadow-xs);
}
.study-kicker {
  font-size: 12px;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
}
.study-pill {
  display: inline-block;
  margin: 4px 6px 4px 0;
  padding: 2px 10px;
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
}
.study-linkbox {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 14px;
}

.grid-cards, .coursecards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 18px;
  margin: 18px 0;
}
.mod, .coursecard {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--r-l);
  padding: 20px 22px;
  margin: 16px 0;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t), box-shadow var(--t);
  display: block;
  color: var(--ink);
  text-decoration: none;
}
.mod:hover, .coursecard:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.mod .no {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.mod .no.pend { background: #64748b; }
.mod h3 { margin: 6px 0 8px; font-size: 19px; }
.mod h3::before { display: none; }
.mod .kw { margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.mod .kw span {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12.5px;
  padding: 2px 9px;
  border-radius: 6px;
  font-weight: 500;
}
.mod .desc { color: var(--muted); font-size: 14px; margin: 8px 0; }
.mod .parts {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mod .parts a {
  font-size: 13px;
  background: var(--card-alt);
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: 6px;
  color: var(--primary);
  font-weight: 600;
}
.mod .parts a:hover {
  background: var(--primary-soft);
  border-color: var(--accent);
  text-decoration: none;
}

nav.quick {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: 14px 18px;
  margin: 18px 0;
  box-shadow: var(--shadow-xs);
}
nav.quick a {
  display: inline-block;
  margin: 3px 6px 3px 0;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 3px 12px;
  background: var(--card-alt);
  color: var(--primary);
  font-weight: 500;
}
nav.quick a:hover {
  border-color: var(--accent);
  background: var(--primary-soft);
  color: var(--accent);
  text-decoration: none;
}

footer.pagemod {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 42px;
  border-top: 2px solid var(--line);
  padding-top: 20px;
}
footer.pagemod a {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  box-shadow: var(--shadow-xs);
  transition: all var(--t);
}
footer.pagemod a:hover {
  text-decoration: none;
  border-color: var(--accent);
  background: var(--primary-soft);
  transform: translateY(-1px);
}
footer {
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
  padding: 28px 16px;
  border-top: 1px solid var(--line);
  margin-top: 40px;
}

.katex-display {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
  margin: 12px 0;
}
#nettip {
  display: none;
  margin: 10px auto;
  max-width: 1280px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13.5px;
}

.toc-mobile-toggle { display: none; }
nav.toc .toc-list { display: block; }
@media (max-width: 960px) {
  .wrap { flex-direction: column; padding: 16px 14px 48px; gap: 18px; }
  nav.toc { position: relative; top: 0; width: 100%; max-height: none; }
  nav.toc .toc-mobile-toggle {
    display: block;
    width: 100%;
    padding: 9px 12px;
    margin: 6px 0;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--primary-soft);
    font: inherit;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    text-align: left;
  }
  nav.toc .toc-list { display: none; }
  nav.toc.is-expanded .toc-list { display: block; }
  section { padding: 18px 16px; }
  .modswitch { padding: 8px 14px; }
  .modswitch-links { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 2px; }
}

/* === V3 升级扩充：英雄区主题适配、记号防混胶囊、进度条、背诵模式、双层折叠、打卡与全局搜索 === */
header.hero {
  background: radial-gradient(110% 150% at 12% 0%, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0) 58%),
              linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 55%, var(--primary-light) 100%);
}
.part-head, .part {
  margin: 36px 0 18px; padding: 20px 24px; border-radius: var(--r-l); color: #fff;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
  box-shadow: var(--shadow-sm);
}
.part h2, .part-head h2 { color: #fff; border: none; margin: 6px 0 4px; font-size: 23px; padding: 0; }
.src, .slide-ref {
  font-size: 12px; color: var(--muted); background: var(--primary-soft);
  border: 1px solid var(--line); border-radius: 20px; padding: 2px 9px; margin-left: 8px;
  white-space: nowrap; font-family: var(--sans); font-weight: 500;
}
.modswitch { position: sticky; top: 0; z-index: 80; }
.reading-progress-wrap {
  position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: rgba(255, 255, 255, 0.08); overflow: hidden; pointer-events: none;
}
.reading-progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #38bdf8, #34d399, #fbbf24);
  transition: width 0.08s linear;
}
.notation-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(251, 191, 36, 0.16); color: #fde68a;
  border: 1px solid rgba(251, 191, 36, 0.45); border-radius: 999px;
  padding: 3px 11px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.modswitch-btn.is-active {
  background: #fbbf24; color: #0f172a; border-color: #fbbf24; font-weight: 700;
}
/* 双层折叠与例题掌握打卡 */
.box { position: relative; }
.box-head-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap; margin-bottom: 7px;
}
.box-head-row .box-tag, .box-head-row .tag { margin-bottom: 0; }
.box-meta-actions {
  display: inline-flex; gap: 6px; align-items: center; margin-left: auto;
}
.meta-Saved-btn {
  background: var(--card); color: var(--muted); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 2px 9px; font-size: 11.5px; cursor: pointer;
  font-family: inherit; transition: all var(--t); user-select: none;
}
.meta-Saved-btn:hover { border-color: var(--accent); color: var(--accent); }
.meta-Saved-btn.is-mastered {
  background: var(--eg-soft); color: var(--eg); border-color: var(--eg); font-weight: 700;
}
.meta-Saved-btn.is-pinned {
  background: var(--idea-soft); color: var(--idea); border-color: var(--idea); font-weight: 700;
}
.box.is-mastered-box { opacity: 0.78; }
.dual-details-wrap { margin: 10px 0; display: flex; flex-direction: column; gap: 8px; }
details.hint-layer > summary {
  color: var(--idea); background: var(--idea-soft); border-bottom: 1px solid rgba(245, 158, 11, 0.2);
}
details.sol-layer > summary {
  color: var(--primary); background: var(--card-alt);
}
details .details-body { padding: 12px 18px 14px; border-top: 1px dashed var(--line); }
/* 算法课四步模板与 Python 嵌入 */
.algo-dual-column { margin: 16px 0; display: flex; flex-direction: column; gap: 10px; }
details.exam-nl-template > summary {
  background: var(--primary-soft); color: var(--primary); font-weight: 700;
}
details.job-py-impl > summary {
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
}
.nl-steps li { margin: 6px 0; }
/* 考场信号词速查表 */
.exam-signals-card { border-top: 4px solid var(--accent); }
.signal-table th { background: var(--thead-bg); }
.deduct-tag {
  display: inline-block; background: var(--warn-soft); color: var(--warn);
  font-weight: 700; font-size: 12px; padding: 1px 6px; border-radius: 4px; margin-right: 4px;
}
/* SVG 矢量图自适应容器 */
.svg-card, .svg-placeholder {
  margin: 16px 0; padding: 16px 18px; border-radius: var(--r-m);
  background: var(--card-alt); border: 1px solid var(--line);
  text-align: center; overflow-x: auto;
}
.svg-card figcaption {
  font-size: 13px; color: var(--muted); margin-top: 8px; font-weight: 600;
}
.svg-card svg { max-width: 100%; height: auto; display: block; margin: 0 auto; }
/* ⚡ 背诵模式（仅保留 .def/.thm/.warn、速查表、信号词表与收入一页纸条目） */
body.recite-mode main p:not(.box p):not(table p):not(.study-linkbox),
body.recite-mode main > .review-addendum,
body.recite-mode main .ug-bridge,
body.recite-mode main .box.idea:not(.is-pinned-box),
body.recite-mode main .box.eg:not(.is-pinned-box),
body.recite-mode main .box.exam:not(.is-pinned-box),
body.recite-mode main .job-py-impl {
  display: none !important;
}
body.recite-mode main section { padding: 14px 18px; margin-bottom: 18px; }
/* 🔍 跨课程全局搜索弹窗 */
.search-modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(3px); z-index: 200; display: none;
  align-items: flex-start; justify-content: center; padding: 8vh 16px 24px;
}
.search-modal-backdrop.is-open { display: flex; }
.search-modal {
  width: 100%; max-width: 680px; background: var(--card); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-l);
  box-shadow: var(--shadow-md); overflow: hidden;
}
.search-input-bar {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px;
  border-bottom: 1px solid var(--line); background: var(--card-alt);
}
.search-input-bar input {
  flex: 1; border: none; background: transparent; color: var(--ink);
  font-size: 16px; font-family: inherit; outline: none;
}
.search-close-btn {
  background: var(--primary-soft); color: var(--primary); border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 9px; font-size: 12px; cursor: pointer;
}
.search-results {
  max-height: 62vh; overflow-y: auto; padding: 8px 12px 14px;
}
.search-item {
  display: block; padding: 10px 12px; border-radius: 8px;
  border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.search-item:hover { background: var(--primary-soft); text-decoration: none; }
.search-item-top {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 3px;
}
.search-course-tag {
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
  padding: 1px 7px; border-radius: 999px; font-size: 11.5px;
}
.search-item-title { font-weight: 700; color: var(--primary); font-size: 14.5px; }
.search-item-snippet { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
/* 学习导航与代码阅读器兼容样式 */
.course-hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 18px; margin: 18px 0; }
.hub-card { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: var(--r-l); padding: 20px 22px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; justify-content: space-between; }
.hub-card.algo { border-top-color: #047857; }
.hub-card.sjgc { border-top-color: #0e7490; }
.hub-card.queue { border-top-color: #1e3a5f; }
.hub-card .kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; }
.hub-card h3 { margin: 6px 0 8px; font-size: 20px; }
.hub-card h3::before { display: none; }
.hub-card .mod-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.hub-card .mod-pills a { font-size: 12.5px; padding: 4px 10px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); border: 1px solid var(--line); font-weight: 600; text-decoration: none; }
.hub-card .mod-pills a:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.hub-card .enter-btn { display: inline-block; text-align: center; padding: 8px 14px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 13.5px; border: 1px solid var(--line); }
.code-toolbar { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:10px; padding:10px 16px; background:#1e293b; color:#e2e8f0; border-radius:10px 10px 0 0; font-size:13px; }
.code-copy-btn { background:#0ea5e9; color:#fff; border:none; border-radius:6px; padding:5px 12px; font-size:12.5px; font-weight:600; cursor:pointer; }
.code-viewer-pre { margin:0 !important; border-radius:0 0 10px 10px !important; background:#0f172a !important; color:#f8fafc !important; padding:16px 18px !important; overflow-x:auto; font-size:13.5px; line-height:1.65; }
.code-line { display:block; white-space:pre; }
.ln { display:inline-block; width:38px; color:#64748b; user-select:none; text-align:right; margin-right:14px; font-size:12px; }
.py-kw { color:#f472b6; font-weight:600; }
.py-bi { color:#38bdf8; }
.py-fn { color:#a78bfa; font-weight:600; }
.py-cm { color:#94a3b8; font-style:italic; }
.py-st { color:#fde047; }
.py-nu { color:#fb923c; }

/* === 《算法设计与分析》森林绿与暗夜森林绿主题变量覆盖 (html[data-course="algo"]) === */
html[data-course="algo"] {
  --paper: #f3f5f1;
  --card: #ffffff;
  --card-alt: #f9fbf8;
  --primary: #14532d;
  --primary-dark: #0f3f22;
  --primary-light: #166534;
  --primary-soft: #ecfdf5;
  --accent: #047857;
  --accent-soft: #d1fae5;
  --bar-bg: #0b2e19;
  --line: #d8e4dc;
  --line-strong: #b8cec0;
  --tc-strong: #86a895;
  --tc-mid: #b8cec0;
  --thead-bg: #ecfdf5;
  --thead-ink: #14532d;
}
html[data-course="algo"] body.dark-mode {
  --ink: #e2f1e8;
  --muted: #94b8a3;
  --paper: #0b1710;
  --card: #13241b;
  --card-alt: #0f1d15;
  --primary: #6ee7b7;
  --primary-dark: #a7f3d0;
  --primary-soft: rgba(16, 185, 129, 0.15);
  --accent: #34d399;
  --accent-soft: rgba(52, 211, 153, 0.15);
  --bar-bg: #07120b;
  --line: #233e30;
  --line-strong: #2f5440;
  --thead-bg: rgba(20, 83, 45, 0.45);
  --thead-ink: #d1fae5;
}
