/* ============================================================
   高中知识讲解库 · 重设计方案 v1
   安静编辑型 + 现代学习工具 · 暖纸感浅色主题
   仅改外壳视觉，类名契约与 app.js 完全一致
   ============================================================ */
:root {
  --bg: #f5f4f1;
  --bg-grain: #efece6;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --surface-3: #f3f1ec;
  --ink: #151b27;
  --text: #232a38;
  --muted: #6a7280;
  --faint: #9aa1ad;
  --border: #e8e5df;
  --border-strong: #dcd8d0;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --accent: #4f46e5; /* 默认品牌色，学科页由 --accent 覆盖 */
  --accent-weak: color-mix(in srgb, var(--accent) 9%, #fff);
  --accent-line: color-mix(in srgb, var(--accent) 24%, transparent);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 2px 6px rgba(16, 24, 40, 0.05), 0 12px 30px -18px rgba(16, 24, 40, 0.20);
  --shadow-hover: 0 6px 14px rgba(16, 24, 40, 0.08), 0 22px 48px -20px rgba(16, 24, 40, 0.30);
  --maxw: 1180px;
  --readw: 940px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui,
    -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% -10%, rgba(79, 70, 229, 0.05), transparent 42%),
    radial-gradient(circle at 92% 0%, rgba(13, 148, 136, 0.045), transparent 40%);
  background-attachment: fixed;
  line-height: 1.78;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--ink); }

a { color: inherit; text-decoration: none; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 11px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; }
.brand-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(150deg, #4f46e5, #4338ca);
  color: #fff; font-size: 19px; font-weight: 800;
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.34);
  letter-spacing: 0;
}
.brand-text { font-size: 17px; letter-spacing: 0.4px; color: var(--ink); }

.search { position: relative; margin-left: auto; flex: 0 1 380px; }
.search input {
  width: 100%;
  padding: 9px 16px 9px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.search::before {
  content: "";
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px;
  background: var(--faint);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M21 20.3l-5.6-5.6a7.5 7.5 0 10-.7.7l5.6 5.6zM4.5 10.5a6 6 0 1112 0 6 6 0 01-12 0z'/></svg>") center/contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M21 20.3l-5.6-5.6a7.5 7.5 0 10-.7.7l5.6 5.6zM4.5 10.5a6 6 0 1112 0 6 6 0 01-12 0z'/></svg>") center/contain no-repeat;
  pointer-events: none;
}
.search input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}
.search-results {
  position: absolute;
  top: 48px; left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
  overflow: hidden;
  max-height: 380px;
  overflow-y: auto;
  z-index: 60;
}
.search-results .item {
  padding: 11px 15px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  transition: background 0.15s;
}
.search-results .item:last-child { border-bottom: none; }
.search-results .item:hover { background: var(--surface-2); }
.search-results .item .t { font-size: 14px; font-weight: 600; color: var(--ink); }
.search-results .item .p { font-size: 12px; color: var(--muted); }
.search-results .empty { padding: 15px; color: var(--muted); font-size: 13px; }

/* ---------------- 主体 ---------------- */
.app { max-width: var(--maxw); margin: 0 auto; padding: 30px 22px 64px; }

/* ---------------- 首页 Hero ---------------- */
.hero {
  position: relative;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 55%),
    linear-gradient(180deg, var(--accent-weak), #fff 78%);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 50px 46px;
  margin-bottom: 34px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(21, 27, 39, 0.05) 1px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask: radial-gradient(120% 120% at 80% 0%, #000, transparent 70%);
  mask: radial-gradient(120% 120% at 80% 0%, #000, transparent 70%);
  opacity: 0.7;
  pointer-events: none;
}
.hero > * { position: relative; }
.hero .eyebrow {
  display: inline-block;
  font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  border: 1px solid var(--accent-line);
  padding: 4px 12px; border-radius: var(--radius-pill);
  margin-bottom: 16px;
}
.hero h1 {
  margin: 0 0 10px; font-size: clamp(26px, 3.4vw, 36px);
  letter-spacing: 0.5px; color: var(--ink); font-weight: 800; line-height: 1.25;
}
.hero p { margin: 0; color: var(--muted); font-size: 15.5px; max-width: 660px; line-height: 1.8; }

.stats { display: flex; flex-wrap: wrap; gap: 34px; margin-top: 26px; }
.stats .stat { position: relative; padding-left: 18px; }
.stats .stat::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; border-radius: 3px; background: var(--accent); opacity: 0.7;
}
.stats .stat .n { font-size: 27px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.stats .stat .l { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* ---------------- 学科卡片 ---------------- */
.section-title {
  font-size: 18px; font-weight: 800; color: var(--ink);
  margin: 8px 0 20px; display: flex; align-items: center; gap: 10px;
}
.section-title::before {
  content: ""; width: 6px; height: 18px; border-radius: 3px;
  background: var(--accent);
}
.grid { display: grid; gap: 18px; }
.grid.subjects { grid-template-columns: repeat(3, 1fr); }
.grid.books { grid-template-columns: repeat(3, 1fr); }
.grid.units { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s;
  cursor: pointer;
  position: relative;
  display: block;
  box-shadow: var(--shadow-sm);
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent-line);
}
.card .topbar-accent {
  position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 4px; border-radius: 0 4px 4px 0;
  background: var(--accent);
}
.subject-card { display: flex; align-items: center; gap: 16px; }
.subject-card .badge {
  width: 54px; height: 54px; flex: 0 0 54px;
  border-radius: 16px;
  display: grid; place-items: center;
  color: #fff; font-size: 23px; font-weight: 800;
  background: linear-gradient(150deg, var(--accent), color-mix(in srgb, var(--accent) 72%, #000 8%));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 34%, transparent);
}
.subject-card .meta .name { font-size: 19px; font-weight: 800; color: var(--ink); }
.subject-card .meta .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; letter-spacing: 0.3px; }
.subject-card .meta .count { font-size: 12px; color: var(--faint); margin-top: 5px; }

/* ---------------- 页头 ---------------- */
.page-head {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 22px;
}
.page-head .badge {
  width: 58px; height: 58px; flex: 0 0 58px;
  border-radius: 17px; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 25px;
  background: linear-gradient(150deg, var(--accent), color-mix(in srgb, var(--accent) 72%, #000 8%));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 34%, transparent);
}
.page-head .title { font-size: 25px; font-weight: 800; margin: 0; color: var(--ink); }
.page-head .desc { color: var(--muted); font-size: 14px; margin: 3px 0 0; }
.note {
  background: #fffbeb; border: 1px solid #fde68a;
  color: #92400e; border-radius: var(--radius-sm);
  padding: 11px 15px; font-size: 13px; margin-bottom: 20px;
  line-height: 1.7;
}

/* ---------------- 面包屑 ---------------- */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { margin: 0 8px; color: var(--faint); }
.crumbs .cur { color: var(--ink); font-weight: 600; }

/* ---------------- 书/专题/单元 卡片 ---------------- */
.book-card { padding: 18px 20px; }
.book-card .name { font-size: 16px; font-weight: 700; color: var(--ink); }
.book-card .sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.topic-card { padding: 16px 18px; }
.topic-card .name { font-size: 16px; font-weight: 700; color: var(--ink); }
.topic-card .sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.unit-card { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.unit-card .name { font-size: 15px; font-weight: 600; color: var(--text); }
.unit-card .go {
  font-size: 12.5px; color: #fff; margin-top: 0; font-weight: 700;
  background: var(--accent); padding: 5px 12px; border-radius: var(--radius-pill);
  white-space: nowrap; transition: transform 0.18s var(--ease);
}
.unit-card:hover .go { transform: translateX(3px); }

.tag-example {
  display: inline-block; font-size: 11px; font-weight: 700;
  color: #b45309; background: #fef3c7;
  border-radius: 6px; padding: 1px 7px; margin-left: 8px;
  vertical-align: middle;
}

/* ---------------- 单元内容页 ---------------- */
.unit-layout { display: block; position: relative; }
.content-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 38px 42px;
  margin: 10px auto 0;
  max-width: var(--readw);
  box-shadow: var(--shadow);
}
.content-wrap h1 { font-size: 25px; border-left: 5px solid var(--accent); padding-left: 14px; color: var(--ink); font-weight: 800; }
.content-wrap h2 { font-size: 20px; margin-top: 30px; color: var(--ink); font-weight: 800; }
.content-wrap h3 { font-size: 17px; margin-top: 22px; color: #334155; font-weight: 700; }
.content-wrap img { max-width: 100%; border-radius: 12px; border: 1px solid var(--border); margin: 14px 0; box-shadow: var(--shadow-sm); }
.content-wrap pre {
  background: #0f172a; color: #e2e8f0; padding: 15px 18px;
  border-radius: 12px; overflow-x: auto; font-size: 13px; line-height: 1.7;
  box-shadow: var(--shadow-sm);
}
.content-wrap code { font-family: var(--mono); }
.content-wrap :not(pre) > code { background: color-mix(in srgb, var(--accent) 10%, #fff); color: color-mix(in srgb, var(--accent) 80%, #1e1b4b); padding: 1.5px 7px; border-radius: 6px; font-size: 0.92em; }
.content-wrap blockquote {
  border-left: 4px solid var(--accent); background: var(--surface-2);
  margin: 16px 0; padding: 10px 18px; color: var(--muted); border-radius: 0 10px 10px 0;
}
.content-wrap table { border-collapse: collapse; width: 100%; margin: 16px 0; }
.content-wrap th, .content-wrap td { border: 1px solid var(--border); padding: 9px 13px; font-size: 14px; }
.content-wrap th { background: var(--surface-3); color: var(--ink); font-weight: 700; }

.placeholder { text-align: center; padding: 60px 20px; color: var(--muted); }
.placeholder .big { font-size: 42px; margin-bottom: 12px; }
.placeholder .hint {
  display: inline-block; text-align: left; max-width: 560px;
  background: var(--surface-2); border: 1px dashed var(--border);
  border-radius: var(--radius-sm); padding: 16px 20px; margin-top: 14px;
  font-size: 14px; color: var(--text);
}
.placeholder .hint code { background: color-mix(in srgb, var(--accent) 10%, #fff); color: color-mix(in srgb, var(--accent) 80%, #1e1b4b); padding: 1px 6px; border-radius: 5px; }

/* ---------------- 讲义标题层级 ---------------- */
.content-wrap .sec-h1 {
  font-size: 23px; font-weight: 800; border-left: 5px solid var(--accent);
  padding-left: 14px; margin: 34px 0 16px; color: var(--ink);
}
.content-wrap .divider {
  font-size: 21px; font-weight: 800; color: var(--ink);
  margin: 32px 0 14px; padding-left: 15px; border-left: 5px solid var(--accent);
}
.content-wrap .sec-h3 { font-size: 16.5px; color: #475569; margin-top: 18px; font-weight: 700; }

/* 「讲」区块：每个知识点一张卡 */
.lecture {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  padding: 4px 26px 22px;
  margin: 24px 0;
  background: linear-gradient(180deg, #fff, var(--accent-weak));
  box-shadow: var(--shadow-sm);
}
.content-wrap .lec-title {
  font-size: 19px; font-weight: 800; color: var(--accent);
  margin: 22px 0 10px; padding-bottom: 11px;
  border-bottom: 2px solid var(--accent-line);
}

/* 「练习」区块：课后习题一张卡 */
.exercise {
  border: 1px solid #fde68a; border-left: 4px solid #d97706;
  background: linear-gradient(180deg, #fff, #fffdf5);
  border-radius: 14px; padding: 4px 26px 20px; margin: 24px 0;
  box-shadow: var(--shadow-sm);
}
.content-wrap .ex-title {
  font-size: 18px; font-weight: 800; color: #b45309; margin: 20px 0 10px;
  padding-bottom: 10px; border-bottom: 2px solid #fde68a;
}

/* 五段字段卡片：左色条 + 标签胶囊 + 正文 */
.seg {
  border-left: 4px solid var(--seg-c, #94a3b8);
  background: var(--seg-bg, #f8fafc);
  border-radius: 0 12px 12px 0;
  padding: 13px 17px; margin: 13px 0;
  box-shadow: var(--shadow-sm);
}
.seg-label {
  display: inline-block; font-size: 12px; font-weight: 800; color: #fff;
  background: var(--seg-c, #94a3b8); padding: 2px 11px; border-radius: var(--radius-pill);
  margin-bottom: 7px; letter-spacing: 0.5px;
}
.seg-body { font-size: 15px; color: #334155; line-height: 1.82; }
.seg-body p { margin: 6px 0; }
.seg-body ul, .seg-body ol { margin: 6px 0; padding-left: 22px; }
.seg-body table { margin: 10px 0; }

.seg-textbook { --seg-c: #2563eb; --seg-bg: #eff6ff; }
.seg-plain   { --seg-c: #16a34a; --seg-bg: #f0fdf4; }
.seg-think   { --seg-c: #7c3aed; --seg-bg: #f5f3ff; }
.seg-exam    { --seg-c: #ea580c; --seg-bg: #fff7ed; }
.seg-warn    { --seg-c: #dc2626; --seg-bg: #fef2f2; }
.seg-core    { --seg-c: #d97706; --seg-bg: #fffbeb; }
.seg-core .seg-body { font-weight: 700; color: #92400e; }
.seg-orig    { --seg-c: #475569; --seg-bg: #f8fafc; }
.seg-point   { --seg-c: #4f46e5; --seg-bg: #eef2ff; }
.seg-rel     { --seg-c: #0d9488; --seg-bg: #f0fdfa; }
.seg-entry   { --seg-c: #db2777; --seg-bg: #fdf2f8; }
.seg-route   { --seg-c: #0891b2; --seg-bg: #ecfeff; }
.seg-why     { --seg-c: #6d28d9; --seg-bg: #f5f3ff; }
.seg-ans     { --seg-c: #059669; --seg-bg: #ecfdf5; }
.seg-ans .seg-body { font-weight: 600; color: #065f46; }
.seg-detail  { --seg-c: #64748b; --seg-bg: #f8fafc; }
.warn-ico { font-size: 13px; vertical-align: -1px; }

/* 引用块 */
.content-wrap blockquote.callout {
  border-left: 4px solid var(--accent); background: var(--surface-2);
  border-radius: 0 10px 10px 0; padding: 11px 18px; margin: 16px 0;
  color: #475569; font-size: 14px;
}

/* 课本页图 */
.content-wrap figure.fig { margin: 16px 0; text-align: center; }
.content-wrap figure.fig img {
  max-width: 100%; border-radius: 12px; border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(20, 30, 50, 0.10);
}
.content-wrap figcaption { font-size: 12.5px; color: var(--muted); margin-top: 7px; }
.content-wrap .inline-img { max-width: 100%; vertical-align: middle; border-radius: 8px; }

/* 表格：横向滚动 + 斑马纹 */
.table-wrap {
  overflow-x: auto; margin: 16px 0; border-radius: 12px;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.content-wrap table { border-collapse: collapse; width: 100%; margin: 0; font-size: 13.5px; }
.content-wrap th {
  background: var(--surface-3); color: var(--ink); font-weight: 700; text-align: left;
  padding: 10px 13px; border-bottom: 2px solid var(--border-strong); white-space: nowrap;
}
.content-wrap td { padding: 9px 13px; border-bottom: 1px solid var(--border); color: #334155; }
.content-wrap tbody tr:nth-child(even) { background: var(--surface-2); }
.content-wrap tbody tr:hover { background: var(--accent-weak); }

/* 方程式 code 块 */
.content-wrap pre.eq {
  background: #0f172a; color: #e2e8f0; padding: 15px 19px;
  border-radius: 12px; overflow-x: auto; font-size: 13.5px; line-height: 1.7;
  box-shadow: var(--shadow-sm);
}
.content-wrap pre.eq code { font-family: var(--mono); }
.content-wrap .chem-cond,
.content-wrap pre.eq sup.chem-cond { color: #f59e0b; font-weight: 600; font-size: 0.82em; }
.content-wrap pre.eq sub { color: #94a3b8; }
.content-wrap pre.eq sup { color: #f59e0b; }

/* ---- 目录悬浮按钮 ---- */
.toc-toggle {
  position: fixed; right: 24px; bottom: 32px;
  z-index: 200; cursor: pointer;
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--accent); color: #fff;
  border: none; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
  font-size: 20px; display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
}
.toc-toggle:hover { transform: scale(1.08); box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 50%, transparent); }

/* ---- 目录侧滑面板 ---- */
.toc-overlay { display: none; position: fixed; inset: 0; z-index: 298; background: rgba(15, 23, 42, 0.32); }
.toc-overlay.show { display: block; }
.toc-drawer {
  position: fixed; top: 0; right: -330px; bottom: 0; z-index: 299;
  width: 310px; background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.10);
  transition: right 0.3s var(--ease); overflow-y: auto;
  padding: 22px 16px 44px;
}
.toc-drawer.open { right: 0; }
.toc-drawer-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.toc-drawer-close {
  background: none; border: none; font-size: 22px; cursor: pointer;
  color: var(--muted); padding: 2px 8px; border-radius: 9px; transition: background 0.15s;
}
.toc-drawer-close:hover { background: var(--surface-2); color: var(--ink); }
.toc { position: static; max-height: none; }
.toc-box { background: transparent; border: none; border-radius: 0; padding: 0; }
.toc-title {
  font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: 1.5px;
  margin: 2px 8px 12px; text-transform: uppercase;
}
.toc-link {
  display: block; padding: 6px 11px; border-radius: 9px; font-size: 13px;
  color: #475569; cursor: pointer; border-left: 3px solid transparent;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background 0.15s, color 0.15s;
}
.toc-link:hover { background: var(--surface-2); color: var(--accent); }
.toc-link.active {
  background: var(--accent-weak); color: var(--accent); border-left-color: var(--accent); font-weight: 700;
}
.toc-link.l2 { padding-left: 22px; }
.toc-link.l3 { padding-left: 34px; font-size: 12.5px; color: var(--muted); }

/* ---------------- 页脚 ---------------- */
.footer { border-top: 1px solid var(--border); margin-top: 44px; background: rgba(255, 255, 255, 0.6); }
.footer-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 20px 22px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  font-size: 13px; color: var(--muted);
}
.muted { color: var(--muted); }

/* ---------------- 全文检索片段 ---------------- */
.search-results .item .snip { display: block; color: #475569; font-size: 12px; margin-top: 3px; line-height: 1.55; }
.search-results .item .tag-cont { display: inline-block; font-size: 11px; color: var(--accent); margin-left: 6px; font-weight: 600; }
.search-results mark { background: #fde68a; color: #7c2d12; padding: 0 2px; border-radius: 3px; }

/* ---------------- 反馈条 ---------------- */
.feedback-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 22px 0;
  padding: 13px 15px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px;
}
.fb-q { font-weight: 700; color: #334155; margin-right: 4px; }
.fb-opt {
  border: 1px solid #cbd5e1; background: #fff; border-radius: var(--radius-pill);
  padding: 6px 13px; cursor: pointer; font-size: 13px; transition: 0.15s;
}
.fb-opt:hover { border-color: var(--accent); color: var(--accent); }
.fb-opt.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.fb-note { flex: 1; min-width: 160px; border: 1px solid #cbd5e1; border-radius: 9px; padding: 6px 11px; font-size: 13px; }
.fb-save { background: #16a34a; color: #fff; border: none; border-radius: 9px; padding: 6px 15px; cursor: pointer; font-weight: 600; }
.fb-tip { color: #16a34a; font-size: 12px; }

/* ---------------- 卡点面板 ---------------- */
.fb-btn {
  border: 1px solid var(--border); background: #fff; border-radius: var(--radius-pill);
  padding: 6px 13px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 6px;
  margin-left: 10px; color: var(--ink); transition: border-color 0.15s, box-shadow 0.15s;
}
.fb-btn:hover { border-color: var(--accent-line); box-shadow: var(--shadow-sm); }
.fb-count { background: #dc2626; color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px; min-width: 16px; text-align: center; }
.fb-panel {
  position: fixed; top: 0; right: 0; width: 350px; max-width: 92vw; height: 100%;
  background: #fff; box-shadow: -6px 0 28px rgba(0, 0, 0, 0.18); z-index: 60;
  display: flex; flex-direction: column;
}
.fb-panel[hidden] { display: none; }
.fb-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.25); z-index: 55; }
.fb-overlay[hidden] { display: none; }
.fb-panel-head { display: flex; justify-content: space-between; align-items: center; padding: 15px 17px; border-bottom: 1px solid var(--border); font-weight: 700; color: var(--ink); }
.fb-panel-head button { border: none; background: none; font-size: 18px; cursor: pointer; color: #64748b; }
.fb-panel-body { flex: 1; overflow: auto; padding: 13px 17px; }
.fb-item { padding: 11px 0; border-bottom: 1px solid #f1f5f9; }
.fb-path { font-weight: 600; color: #334155; font-size: 13px; }
.fb-st { color: #64748b; font-size: 13px; margin-top: 3px; }
.fb-note-t { color: #dc2626; }
.fb-panel-foot { padding: 13px 17px; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.fb-panel-foot button { flex: 1; border: none; border-radius: 9px; padding: 9px; cursor: pointer; font-size: 13px; font-weight: 600; }
#fbCopy { background: var(--accent); color: #fff; }
#fbClear { background: var(--surface-3); color: #475569; }

/* ---------------- 入场微动效 ---------------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card, .lecture, .seg, .unit-card, .book-card, .topic-card {
  animation: rise 0.5s var(--ease) both;
}
.content-wrap { animation: rise 0.45s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 880px) {
  .grid.subjects, .grid.books { grid-template-columns: repeat(2, 1fr); }
  .grid.units { grid-template-columns: 1fr; }
  .hero { padding: 38px 26px; }
  .hero h1 { font-size: 24px; }
  .content-wrap { max-width: 100%; padding: 26px 22px; }
  .toc-drawer { width: 270px; }
}
@media (max-width: 560px) {
  .grid.subjects, .grid.books { grid-template-columns: 1fr; }
  .topbar-inner { flex-wrap: wrap; }
  .search { flex-basis: 100%; order: 3; }
  .app { padding: 22px 14px 52px; }
  .hero { padding: 30px 20px; border-radius: 20px; }
}
