
:root {
  /* 语义变量：gray-950 = 最深文字，white = 背景。深色模式下整体翻转，所有规则自动跟着变。
     浅色为纯白底 + 近黑文字（中性灰阶），干净、专业、对比清晰。 */
  --gray-950: #1a1a1a; --gray-900: #2b2b2b; --gray-700: #444444;
  --gray-500: #767676; --gray-400: #9a9a9a; --gray-200: #e2e2e2;
  --gray-100: #f0f0f0; --gray-50: #f7f7f7; --white: #ffffff;
  --line: rgba(0,0,0,.12);
  --accent: #b4491f;
  --accent-soft: #f7ede6;
  --code-bg: #f0f0f0; --pre-bg: #1a1a1a; --pre-fg: #f0f0f0;
  --sidebar-w: 18rem;
  color-scheme: light;
}

/* 深色变量组：三种触发都套用同一组值。
   主路径是纯 CSS —— 勾选顶栏那个隐藏 checkbox 即变深色，完全不依赖 JS，
   广告拦截器拦不掉（之前点不动就是 Adblock Plus 拦了内联脚本）。 */
:root[data-theme=dark] {
  --gray-950: #dfe3ea; --gray-900: #cdd3dc; --gray-700: #a5adbb;
  --gray-500: #7e8797; --gray-400: #5b6470; --gray-200: #333944;
  --gray-100: #262b33; --gray-50: #21252c; --white: #1a1d23;
  --line: rgba(255,255,255,.09);
  --accent: #e0876a;
  --accent-soft: #24201d;
  --code-bg: #262b33; --pre-bg: #14171c; --pre-fg: #cdd3dc;
  color-scheme: dark;
}
/* 拆成独立规则，不与 [data-theme] 逗号分组 —— 分组里若某选择器被引擎丢弃会连累整条 */
html:has(#theme-checkbox:checked) {
  --gray-950: #dfe3ea; --gray-900: #cdd3dc; --gray-700: #a5adbb;
  --gray-500: #7e8797; --gray-400: #5b6470; --gray-200: #333944;
  --gray-100: #262b33; --gray-50: #21252c; --white: #1a1d23;
  --line: rgba(255,255,255,.09);
  --accent: #e0876a;
  --accent-soft: #24201d;
  --code-bg: #262b33; --pre-bg: #14171c; --pre-fg: #cdd3dc;
  color-scheme: dark;
}
/* 未手动选择时跟随系统（用户没勾 checkbox、也没被 JS 设过 data-theme） */
@media (prefers-color-scheme: dark) {
  html:not([data-theme]):not(:has(#theme-checkbox:checked)) {
    --gray-950: #dfe3ea; --gray-900: #cdd3dc; --gray-700: #a5adbb;
    --gray-500: #7e8797; --gray-400: #5b6470; --gray-200: #333944;
    --gray-100: #262b33; --gray-50: #21252c; --white: #1a1d23;
    --line: rgba(255,255,255,.09);
    --accent: #e0876a;
    --accent-soft: #24201d;
    --code-bg: #262b33; --pre-bg: #14171c; --pre-fg: #cdd3dc;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { scroll-padding-top: 5rem; }
body {
  margin: 0; background: var(--white); color: var(--gray-700);
  /* 系统默认字体优先：各系统用自己最优的 UI 字体（Mac 苹方/SF、Windows 雅黑/Segoe、Android 思源等） */
  font: 15px/1.65 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC",
    Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--gray-950); text-decoration: none; }

/* ---------- 骨架：固定左侧栏 + 内容区 ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 20;
  overflow-y: auto; border-right: 1px solid var(--line);
  padding: 16px 24px 40px; background: var(--white);
  transition: transform .2s ease;
}
.content { margin-left: var(--sidebar-w); transition: margin-left .2s ease; }
.content.no-sidebar { margin-left: 0; }

/* 收起状态：侧栏滑走、内容顶格 */
body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .content { margin-left: 0; }

.sidebar-head { display: flex; align-items: center; padding-bottom: 20px; }
.brand {
  display: block; font-weight: 700; font-size: 15px; letter-spacing: -.01em; color: var(--gray-950);
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--gray-500);
}
.icon-btn:hover { background: var(--gray-100); color: var(--gray-950); }

/* 主题切换：checkbox 彻底移出视口（不占位、不影响 flex 对齐），label 当按钮。 */
.theme-checkbox { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
label.icon-btn { cursor: pointer; flex-shrink: 0; margin: 0; vertical-align: middle; -webkit-user-select: none; user-select: none; }
label.icon-btn svg { pointer-events: none; }
/* 浅色（未勾）显示月亮，深色（勾选）显示太阳 */
.theme-sun { display: none; }
.theme-moon { display: block; }
html:has(#theme-checkbox:checked) .theme-sun { display: block; }
html:has(#theme-checkbox:checked) .theme-moon { display: none; }
/* 跟随系统深色时（未勾且未被 JS 设过）也显示太阳 */
@media (prefers-color-scheme: dark) {
  html:not([data-theme]):not(:has(#theme-checkbox:checked)) .theme-sun { display: block; }
  html:not([data-theme]):not(:has(#theme-checkbox:checked)) .theme-moon { display: none; }
}

/* ---------- 课程导航 ---------- */
.course-nav { display: flex; flex-direction: column; gap: 30px; }
.nav-module-title {
  font-size: 13px; font-weight: 600; color: var(--gray-950); margin: 0 0 12px;
  letter-spacing: -.01em;
}
.nav-lessons {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 11px;
  border-left: 1px solid var(--line);
}
.nav-lesson { margin-left: -1px; border-left: 1px solid transparent; }
.nav-lesson a {
  display: flex; align-items: baseline; gap: 7px; padding: 0 14px;
  font-size: 13.5px; line-height: 1.5; color: var(--gray-500);
}
.nav-lesson:hover { border-left-color: var(--gray-400); }
.nav-lesson:hover a { color: var(--gray-950); }
.nav-lesson.active { border-left-color: var(--gray-950); }
.nav-lesson.active a { color: var(--gray-950); font-weight: 500; }
.nav-lesson-no { color: var(--gray-400); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.nav-lesson-title { flex: 1; }
.nav-check { color: #2f7d4f; font-size: 12px; flex-shrink: 0; }
/* 未付款：锁住的课时压暗，锁标记本身不透明（不然看不清是锁） */
.nav-lesson.locked a { color: var(--gray-400); }
.nav-lesson.locked:hover a { color: var(--gray-500); }
.nav-lock { font-size: 11px; flex-shrink: 0; opacity: .65; }

/* ---------- 免费试读 / 锁定态 ---------- */
.lesson-row.locked { background: var(--gray-50); border-style: dashed; }
.lesson-row.locked .lesson-title, .lesson-row.locked .lesson-no { color: var(--gray-400); }
.lesson-row.locked:hover { border-color: var(--gray-400); background: var(--gray-100); }
.badge-lock { background: transparent; }
.badge-free { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.upsell-card {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, var(--white));
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  height: 64px; background: color-mix(in srgb, var(--white) 85%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  height: 100%; padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.home-link { display: inline-flex; align-items: center; gap: 6px; color: var(--gray-700); font-size: 14px; text-decoration: none; }
.home-link:hover { color: var(--gray-950); }
.home-icon { font-size: 16px; line-height: 1; }
.pref-group { display: flex; align-items: center; gap: 2px; }
.pref-divider { width: 1px; height: 22px; background: var(--line); flex-shrink: 0; }
.topbar-nav { display: flex; gap: 24px; font-size: 14px; }
.topbar-nav a { color: var(--gray-700); white-space: nowrap; }
.topbar-nav a:hover { color: var(--gray-950); }
.topbar-right { display: flex; align-items: center; gap: 20px; font-size: 14px; flex-shrink: 0; }
.who, .linkish { white-space: nowrap; }
.who { color: var(--gray-500); -webkit-user-select: none; user-select: none; }
.who-link { text-decoration: none; }
.who-link:hover { color: var(--gray-950); }
.inline { display: inline; margin: 0; }
.linkish { background: none; border: 0; padding: 0; cursor: pointer; color: var(--gray-700); font: inherit; }
.linkish:hover { color: var(--gray-950); }

/* ---------- 右侧用户下拉菜单 ---------- */
.usermenu { position: relative; }
.usermenu-trigger {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer; list-style: none;
  padding: 6px 10px; border-radius: 8px; color: var(--gray-950); font-size: 14px; font-weight: 500;
  -webkit-user-select: none; user-select: none; white-space: nowrap;
}
.usermenu-trigger::-webkit-details-marker { display: none; }
.usermenu-trigger:hover { background: var(--gray-100); }
.usermenu-name { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
.usermenu-caret { font-size: 10px; color: var(--gray-500); transition: transform .15s; }
.usermenu[open] .usermenu-caret { transform: rotate(180deg); }
.usermenu-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 50;
  min-width: 168px; padding: 6px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--white); box-shadow: 0 8px 28px rgba(0,0,0,.12);
  display: flex; flex-direction: column;
}
.usermenu-item {
  display: block; padding: 9px 12px; border-radius: 8px; font-size: 14px; color: var(--gray-950);
  text-align: left; white-space: nowrap;
}
.usermenu-item:hover { background: var(--gray-100); }
.usermenu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.usermenu-logout-form { padding: 0; margin: 0; }
.usermenu-logout { width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 14px; color: var(--gray-700); }
.usermenu-logout:hover { background: var(--gray-100); color: var(--gray-950); }
.brand-inline { min-width: 0; }

/* ---------- 面包屑 ---------- */
.breadcrumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; }
.crumb { color: var(--gray-950); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb:hover { color: var(--gray-700); }
.crumb-current { color: var(--gray-500); }
.crumb-sep { color: rgba(3,7,18,.25); flex-shrink: 0; }

/* ---------- 主内容 + 右侧 TOC ---------- */
/* 用容器查询：TOC 是否显示看「内容区实际宽度」，而不是视口宽度 —— 否则侧栏占掉 288px 后正文会被 TOC 挤出界 */
.content { container-type: inline-size; container-name: content; }
.main-grid { max-width: 1024px; margin: 0 auto; }
.main-grid.has-toc {
  display: grid; grid-template-columns: minmax(0,1fr) 15rem; gap: 40px;
  max-width: 1180px;
}
.main-padded { padding: 48px 32px 120px; min-width: 0; }
main:not(.main-padded) { max-width: 420px; margin: 0 auto; padding: 0 24px; }

/* 内容区窄于 1000px 就收起 TOC，正文独占，永不溢出 */
@container content (max-width: 1000px) {
  .main-grid.has-toc { display: block; max-width: 1024px; }
  .toc { display: none; }
}

.toc { padding: 48px 24px 0 0; }
.toc-inner { position: sticky; top: 88px; }
.toc-title { font-size: 13px; font-weight: 600; color: var(--gray-950); margin: 0 0 14px; }
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 11px; }
.toc-item { margin-left: -1px; border-left: 1px solid transparent; }
.toc-item a { display: block; padding: 0 14px; font-size: 13px; line-height: 1.5; color: var(--gray-500); }
.toc-sub a { padding-left: 28px; }
.toc-item:hover { border-left-color: var(--gray-400); }
.toc-item:hover a { color: var(--gray-950); }
.toc-item a.active { color: var(--gray-950); font-weight: 500; }
.toc-item:has(a.active) { border-left-color: var(--gray-950); }

h1 { font-size: 32px; line-height: 1.2; letter-spacing: -.025em; color: var(--gray-950); margin: 0 0 10px; font-weight: 700; }
h2 { font-size: 20px; line-height: 1.5; letter-spacing: -.025em; color: var(--gray-950); margin: 56px 0 14px; font-weight: 600; }
.sub { color: var(--gray-500); font-size: 15px; margin: 0 0 40px; }

/* ---------- prose：课程正文 ---------- */
/* 正文字号：默认 15.5px；2K 及以上宽屏（≥2560px）放大 10% ≈ 17px，大屏读着更舒服 */
:root { --prose-size: 15.5px; }
@media (min-width: 2560px) { :root { --prose-size: 17px; } }
.prose { color: var(--gray-700); font-size: var(--prose-size); line-height: 1.8; }
.prose > * + * { margin-top: 22px; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3 { color: var(--gray-950); letter-spacing: -.025em; }
.prose h2 { font-size: 20px; font-weight: 600; margin-top: 52px; line-height: 1.5; }
.prose h3 { font-size: 17px; font-weight: 600; margin-top: 36px; }
.prose strong { color: var(--gray-950); font-weight: 600; }
.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(3,7,18,.25); font-weight: 600; }
.prose img { max-width: 100%; border-radius: 8px; }
.prose ul { list-style: disc; margin-left: 24px; }
.prose ol { list-style: decimal; margin-left: 24px; }
.prose li { padding-left: 6px; margin-top: 8px; }
.prose blockquote {
  margin: 22px 0; padding: 16px 22px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--gray-700);
}
.prose blockquote > :first-child { margin-top: 0; }
.prose pre { background: var(--pre-bg); color: var(--pre-fg); padding: 16px; border-radius: 8px; overflow-x: auto; font-size: 13px; }
.prose code { background: var(--gray-100); padding: 2px 6px; border-radius: 4px; font-size: .88em; font-family: ui-monospace, "SF Mono", monospace; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; }
.prose th { background: var(--gray-50); font-weight: 600; color: var(--gray-950); }

/* ---------- 卡片 / 组件 ---------- */
.card { border: 1px solid var(--line); border-radius: 12px; padding: 24px; margin-bottom: 16px; background: var(--white); }
.block { margin: 36px 0; }

.video-wrap { position: relative; padding-top: 56.25%; background: #000; border-radius: 12px; overflow: hidden; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.watermark { position: absolute; right: 12px; bottom: 12px; z-index: 2; color: rgba(255,255,255,.35); font-size: 12px; pointer-events: none; text-shadow: 0 1px 2px rgba(0,0,0,.5); }

.assignment { border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--accent-soft); }
.assignment .module-title { color: var(--accent); }
.module-title { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gray-400); margin-bottom: 14px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 8px; cursor: pointer;
  background: var(--gray-950); color: var(--white); border: 0; font: inherit; font-size: 14px; font-weight: 500; text-decoration: none;
}
.btn:hover { background: var(--gray-900); }
.btn-ghost { background: var(--white); border: 1px solid var(--line); color: var(--gray-950); }
.btn-ghost:hover { background: var(--gray-50); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-danger { background: #a32c2c; }
.btn-danger:hover { background: #8a2424; }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=file], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; background: var(--white); color: var(--gray-950);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gray-950); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 110px; resize: vertical; }
label { display: block; margin-bottom: 16px; font-size: 13px; font-weight: 500; color: var(--gray-700); }
label > input, label > select, label > textarea { margin-top: 6px; font-weight: 400; }
.row { display: flex; gap: 14px; }
.row > * { flex: 1; }

.err { background: color-mix(in srgb, #dc2626 12%, var(--white)); color: #ef4444; padding: 11px 15px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; border: 1px solid color-mix(in srgb, #dc2626 30%, var(--white)); }
.ok  { background: color-mix(in srgb, #16a34a 12%, var(--white)); color: #22c55e; padding: 11px 15px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; border: 1px solid color-mix(in srgb, #16a34a 30%, var(--white)); }

.lesson-row {
  display: flex; align-items: center; gap: 14px; padding: 16px 20px;
  border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; color: var(--gray-950);
}
.lesson-row:hover { border-color: var(--gray-400); background: var(--gray-50); }
.lesson-no { color: var(--gray-400); font-variant-numeric: tabular-nums; font-size: 14px; min-width: 42px; }
.lesson-title { flex: 1; font-weight: 500; }
.check { color: #2f7d4f; font-size: 14px; }
.badge { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--gray-100); color: var(--gray-500); }
.section-label { font-size: 13px; font-weight: 600; color: var(--gray-950); margin: 40px 0 14px; }

/* ---------- 游客预览遮罩 ---------- */
/* 预览正文完整显示前 10%（服务端已截断，本来就不多），末尾用渐隐做「下面还有」的视觉暗示，
   不硬截高、不盖内容。渐隐块放在正文之后（不 absolute），遮罩卡片自然往下排。 */
.preview-wrap { position: relative; }
.preview-fade {
  height: 90px; margin-top: -90px; pointer-events: none; position: relative;
  background: linear-gradient(to bottom, transparent, var(--white));
}
.paywall-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 32px 28px; margin: 20px 0 28px;
  background: var(--accent-soft); text-align: center;
}
.paywall-icon { font-size: 30px; margin-bottom: 8px; }
.paywall-title { font-size: 19px; font-weight: 700; color: var(--gray-950); margin-bottom: 8px; }
.paywall-desc { font-size: 15px; color: var(--gray-700); margin: 0 auto 20px; max-width: 460px; line-height: 1.7; }
.paywall-actions { margin-bottom: 14px; }
.paywall-actions .btn { padding: 11px 28px; font-size: 15px; }
.paywall-value {
  display: inline-block; margin: 0 auto 18px; padding: 8px 18px; border-radius: 999px;
  background: var(--white); border: 1px solid var(--line); font-size: 14px; color: var(--gray-700);
}
.paywall-value strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.paywall-hint { font-size: 13px; color: var(--gray-500); margin: 0; }

/* ---------- 学员仪表盘 ---------- */
.dash-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 14px; padding: 26px 28px; margin: 8px 0 14px;
  background: var(--accent-soft);
}
.dash-hero-left { display: flex; align-items: center; gap: 22px; }
.dash-pct { font-size: 46px; font-weight: 700; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.dash-hero-meta { font-size: 15px; color: var(--gray-700); }
.dash-expire { font-size: 13px; color: var(--gray-500); margin-top: 4px; }
.dash-continue { white-space: nowrap; }

.progress-track { height: 8px; border-radius: 999px; background: var(--gray-100); overflow: hidden; margin-bottom: 8px; }
.progress-track.sm { height: 6px; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }
.progress-fill.done { background: #2f7d4f; }

.module-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 14px; }
.module-card {
  display: block; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; color: var(--gray-950);
  background: var(--white);
}
.module-card:hover { border-color: var(--gray-400); background: var(--gray-50); }
.module-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.module-card-name { font-size: 14px; font-weight: 600; }
.module-card-count { font-size: 13px; color: var(--gray-500); font-variant-numeric: tabular-nums; flex-shrink: 0; }
@media (max-width: 640px) { .module-grid { grid-template-columns: 1fr; } }

table.admin { width: 100%; border-collapse: collapse; font-size: 14px; }
table.admin th, table.admin td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; }
table.admin th { color: var(--gray-500); font-weight: 500; font-size: 13px; }

.comment { padding: 18px 0; border-bottom: 1px solid var(--line); }
.comment-head { font-size: 14px; margin-bottom: 5px; }
.comment-author { font-weight: 600; color: var(--gray-950); }
.comment-time { color: var(--gray-400); font-size: 13px; margin-left: 8px; }
.reply { margin-left: 28px; padding-left: 16px; border-left: 2px solid var(--accent); }
.tag-teacher { font-size: 11px; background: var(--accent); color: #fff; padding: 1px 8px; border-radius: 999px; margin-left: 6px; }
.tag-private { font-size: 11px; background: var(--gray-200); color: var(--gray-500); padding: 1px 8px; border-radius: 999px; margin-left: 6px; }

/* 留言正文（支持受限 markdown 渲染） */
.comment-body { font-size: 14px; line-height: 1.65; }
.comment-body > :first-child { margin-top: 0; }
.comment-body > :last-child { margin-bottom: 0; }
.comment-body p { margin: 8px 0; }
.comment-body ul, .comment-body ol { margin: 8px 0 8px 22px; }
.comment-body ul { list-style: disc; }
.comment-body ol { list-style: decimal; }
.comment-body code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: .88em; }
.comment-body pre { background: var(--pre-bg); color: var(--pre-fg); padding: 12px; border-radius: 8px; overflow-x: auto; margin: 8px 0; }
.comment-body pre code { background: none; padding: 0; }
.comment-body blockquote { border-left: 3px solid var(--line); padding-left: 12px; color: var(--gray-500); margin: 8px 0; }
.comment-body a { color: var(--accent); text-decoration: underline; }

/* ---------- GitHub 风格留言编辑器 ---------- */
.comment-editor { padding: 0 !important; overflow: hidden; }
.comment-editor.card { border: 1px solid var(--line); }
.editor-tabs {
  display: flex; align-items: center; gap: 2px; padding: 8px 8px 0; background: var(--gray-50);
  border-bottom: 1px solid var(--line);
}
.editor-tab {
  background: none; border: 1px solid transparent; border-bottom: none; padding: 7px 14px; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--gray-500); border-radius: 6px 6px 0 0;
}
.editor-tab.active { background: var(--white); border-color: var(--line); color: var(--gray-950); font-weight: 500; margin-bottom: -1px; }
.editor-toolbar { display: flex; gap: 2px; margin-left: auto; padding-bottom: 4px; }
.editor-tool {
  background: none; border: 0; width: 28px; height: 28px; cursor: pointer; border-radius: 5px;
  color: var(--gray-500); font-size: 13px; display: inline-flex; align-items: center; justify-content: center;
}
.editor-tool:hover { background: var(--gray-100); color: var(--gray-950); }
.editor-ta {
  border: 0 !important; border-radius: 0 !important; min-height: 110px; padding: 14px !important;
  outline: none !important; display: block; width: 100%; resize: vertical; background: var(--white);
}
.editor-ta.small { min-height: 72px; }
.editor-preview { padding: 14px; min-height: 110px; background: var(--white); }
.editor-foot {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line);
  background: var(--gray-50);
}
.editor-private { display: flex; align-items: center; gap: 7px; margin: 0; font-weight: 400; font-size: 13px; cursor: pointer; }
.editor-private input { width: auto; }

/* ---------- 社区聚合页 ---------- */
.qa-card {
  display: block; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 12px;
  background: var(--white); color: var(--gray-950);
}
.qa-card:hover { border-color: var(--gray-400); background: var(--gray-50); }
.qa-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; font-size: 14px; }
.qa-author { font-weight: 600; }
.qa-time { color: var(--gray-400); font-size: 13px; margin-left: auto; }
.qa-body { color: var(--gray-700); font-size: 15px; line-height: 1.65; }
.qa-foot { display: flex; align-items: center; gap: 14px; margin-top: 12px; font-size: 13px; }
.qa-lesson { color: var(--gray-500); }
.qa-answered { color: #2f7d4f; margin-left: auto; font-weight: 500; }
.qa-pending { color: var(--accent); margin-left: auto; }

.pdf-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 14px; }
.pdf-canvas { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

.muted { color: var(--gray-500); }
.center { text-align: center; }
.login-box { padding-top: 14vh; }
.login-box h1 { font-size: 26px; }

/* ---------- 窄屏（≤1024）：左侧课程目录改成「抽屉」 ---------- */
@media (max-width: 1024px) {
  /* 内容顶格，不再给侧栏留位置 */
  .content { margin-left: 0; }
  /* 侧栏默认滑到屏幕外，点顶栏按钮才滑入（覆盖在内容上） */
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.18); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  /* 半透明遮罩：抽屉打开时铺满，点它关闭 */
  body.sidebar-open::after {
    content: ''; position: fixed; inset: 0; z-index: 15; background: rgba(0,0,0,.4);
  }
  /* 桌面版的「收起」在窄屏无意义，禁掉，统一用 sidebar-open 控制 */
  body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
}

/* ---------- 手机窄屏：顶栏内边距收紧 ---------- */
@media (max-width: 640px) {
  .topbar-inner { padding: 0 12px; gap: 8px; }
  .topbar-right { gap: 12px; }
  .usermenu-name { max-width: 32vw; }
}
