:root {
  /* 设计 tokens：去 AI 味，克制专业风（Notion / 微信读书 / Linear 气质） */
  --bg: #fafbfc;          /* 页面背景：近白微灰，不要蓝灰 */
  --surface: #ffffff;     /* 卡片面 */
  --panel: #ffffff;       /* 兼容旧引用 = --surface */
  --ink: #191d24;         /* 主文字：近黑 */
  --ink-2: #4b5262;       /* 次文字 */
  --muted: #9aa0ac;       /* 弱文字 */
  --line: #e7e9ee;        /* 细分割线/卡片边框 */
  --border: #e7e9ee;      /* 兼容旧引用 = --line */
  --accent: #0f7b5f;      /* 主色：沉静深绿（脱离蓝紫 AI 味） */
  --accent-ink: #0a5a45;  /* 主色加深（hover/强调文字） */
  --accent-soft: #eaf4f0; /* 极浅绿底（选中态/标记） */
  --danger: #c0392b;      /* 警示红（克制使用） */
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --code-bg: #0f172a;     /* 代码块保留深色 */
  --code-ink: #e2e8f0;
  --radius: 10px;         /* 卡片圆角 */
  --radius-sm: 8px;       /* 按钮/小元素圆角 */
  --shadow: none;         /* 卡片无阴影 */
  --shadow-pop: 0 2px 16px rgba(16, 24, 40, 0.08); /* 仅浮层/模态允许的极浅阴影 */
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
/* 隐藏 WebView 原生滚动条（更接近 App 体验） */
::-webkit-scrollbar { width: 0; height: 0; background: transparent; }

/* ---------- 移动端阅读防横向溢出 ---------- */
html, body { overflow-x: hidden; }
.lesson-body, .ai-md, .run-output {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.lesson-body a, .ai-md a, .lesson-meta a { word-break: break-all; }
.lesson-body code, .ai-md code { overflow-wrap: anywhere; }
.lesson-body img { max-width: 100%; height: auto; }
.lesson-body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.lesson-body th, .lesson-body td { overflow-wrap: anywhere; }
.codeblock { max-width: 100%; }
.codeblock pre { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.lesson-head h1, .lesson-meta, .quiz-q-title, .mat-head { overflow-wrap: anywhere; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.75;
}

/* ---------- 顶栏 ---------- */
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  padding-top: env(safe-area-inset-top);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-size: 17px; font-weight: 700; white-space: nowrap; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs a {
  padding: 6px 14px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}
.tabs a:hover { background: var(--bg); color: var(--ink); }
.tabs a.active { background: var(--accent-soft); color: var(--accent-ink); }

.checkin { display: flex; align-items: center; gap: 8px; }
.checkin .today { color: var(--muted); font-size: 13px; white-space: nowrap; }
.checkin input {
  width: 64px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

/* ---------- 按钮 ---------- */
.btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { opacity: 0.9; color: #fff; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: calc(100vh - 56px); }
#sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 16px 12px 60px;
  overflow-y: auto;
  height: calc(100vh - 56px);
  position: sticky;
  top: 56px;
}
#main { flex: 1; padding: 28px 36px 80px; min-width: 0; }
.content-col { max-width: 860px; margin: 0 auto; }
.loading { color: var(--muted); padding: 40px; text-align: center; }

/* ---------- 侧栏 ---------- */
.side-section { margin-bottom: 18px; }
.side-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.side-section-head .count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 400; }
.side-group {
  padding: 10px 8px 2px 26px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.side-lesson {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 26px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  line-height: 1.4;
}
.side-lesson:hover { background: var(--bg); color: var(--ink); }
/* 当前项：左侧主色竖条 + 极浅绿底（代替整块变色） */
.side-lesson.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: inset 2.5px 0 0 var(--accent);
}
.side-lesson .tick { width: 16px; flex-shrink: 0; color: #c9cedb; font-weight: 700; }
.side-lesson .tick.tick-done { color: var(--ok); }
.side-lesson.done { color: var(--ink); }
.side-lesson .mins { margin-left: auto; font-size: 11px; color: #b0b6c3; flex-shrink: 0; }
.side-lesson .lock { margin-left: 4px; font-size: 11px; flex-shrink: 0; }

/* ---------- 付费墙 ---------- */
.lock-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #fef3c7;
  border: 1px solid #f0d58a;
  color: #8a5a12;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 14px 0;
  font-size: 14px;
}

.remote-row { display: flex; gap: 8px; margin-bottom: 8px; }
.remote-row input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  min-width: 0;
}
.remote-req { margin: 8px 0 12px; }
.remote-req summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--accent-ink);
  padding: 4px 0;
  user-select: none;
}
.req-body {
  font-size: 13px;
  line-height: 1.7;
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 6px;
}
.req-body ul { margin: 4px 0 10px; padding-left: 18px; }
.req-body li { margin: 3px 0; color: var(--muted); }

/* ---------- 页脚 ---------- */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 12px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--panel);
  font-size: 12.5px;
  color: var(--muted);
}
.app-footer a { color: var(--muted); text-decoration: none; }
.app-footer a:hover { color: var(--accent-ink); }

/* ---------- 云服务双方案 ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 10px 0; }
.plan-card {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  background: var(--surface);
}
.plan-card.plan-off { opacity: 0.55; }
.plan-name { font-weight: 700; font-size: 15px; }
.plan-price { margin: 8px 0 2px; font-size: 13px; color: var(--muted); }
.plan-price b { font-size: 28px; color: var(--accent); }
.plan-config { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.plan-note { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; min-height: 34px; }

/* ---------- 底部 TabBar（小程序风格，移动端） ---------- */
.tabbar { display: none; }

/* ---------- 我的页 ---------- */
.mine-checkin-row { display: flex; gap: 10px; margin-top: 10px; }
.mine-checkin-row input { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 15px; }
.mine-checkin-row .btn { padding: 10px 24px; }
.mine-status-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mine-status-row .btn { margin-left: auto; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.mine-entry {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 4px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--ink);
}
.mine-entry:last-child { border-bottom: none; }
.mine-entry:active { background: var(--bg); }
.me-ico { font-size: 20px; }
.me-body { flex: 1; display: flex; flex-direction: column; }
.me-title { font-size: 15px; font-weight: 600; }
.me-sub { font-size: 12px; color: var(--muted); }
.me-arrow { color: #c3c8d4; font-size: 20px; }
.mine-month { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.mine-month:last-child { border-bottom: none; }

/* ---------- AI 助教页 ---------- */
/* 用负 margin 抵消 #main 的 padding，让聊天页精确撑满 topbar 与底部之间，
   输入框自然固定到屏幕底部（移动端聊天 App 布局） */
.ai-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  margin: -28px -36px -80px;
  /* PC 端 AI 助教用更宽布局，避免右侧大片空白（content-col 默认 860px） */
  max-width: 1100px;
}
@supports (height: 100dvh) {
  .ai-page { height: calc(100dvh - 56px); }
}
.ai-page-head {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 2px 10px; border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.ai-page-ctx { flex: 1; color: var(--muted); font-size: 12px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-page-msgs { flex: 1; overflow-y: auto; padding: 12px 2px; display: flex; flex-direction: column; gap: 12px; }
.ai-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 40px 10px; }
.ai-seltext {
  font-size: 12px; color: var(--ink-2); background: var(--accent-soft);
  border-radius: var(--radius-sm); padding: 6px 10px; width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 课程素材 ---------- */
.mat-block { margin-top: 34px; border-top: 1px dashed var(--border); padding-top: 18px; }
.mat-block h3 { margin: 0 0 12px; }
.mat-item { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: var(--panel); }
.mat-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mat-cat { font-size: 11px; background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 2px 10px; }
.mat-name { font-weight: 600; font-size: 14px; flex: 1; }
.mat-size { color: var(--muted); font-size: 12px; }
.mat-note { color: var(--muted); font-size: 12.5px; margin: 6px 0; }
.mat-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; margin-bottom: 8px; flex-wrap: wrap; }
.mat-path { background: #f2f3f5; border-radius: 6px; padding: 3px 8px; font-family: Menlo, monospace; }

/* ---------- 学习榜单 ---------- */
.goal-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.goal-input { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.goal-input input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.week-chart { display: flex; justify-content: space-around; align-items: flex-end; height: 150px; gap: 6px; }
.day-bar { display: flex; flex-direction: column; align-items: center; flex: 1; max-width: 70px; }
.day-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 120px; width: 100%; }
.day-val { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.day-bar-fill {
  width: 60%;
  max-width: 34px;
  min-height: 4px;
  border-radius: 6px 6px 2px 2px;
  background: var(--accent);
}
.day-today .day-bar-fill { background: var(--accent-ink); }
.day-today .day-label { color: var(--accent-ink); font-weight: 700; }
.day-label { font-size: 12px; color: var(--muted); margin-top: 5px; }
.rank-bar { height: 8px; background: #eef0f2; border-radius: 99px; overflow: hidden; }
.rank-bar > i { display: block; height: 100%; background: #f59e0b; border-radius: 99px; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 20px;
  animation: modal-fade .18s ease;
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal[hidden] { display: none !important; }
.modal-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px 20px;
  width: 100%;
  max-width: 420px;
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: var(--shadow-pop);
  animation: modal-pop .2s cubic-bezier(.2, .8, .3, 1.2);
}
@keyframes modal-pop { from { transform: scale(.97); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-box h3 { margin: 0 0 14px; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.modal-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; line-height: 1.6; }
.modal-steps { margin: 4px 0 12px; }
.modal-steps .step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  font-size: 14px;
}
.modal-steps .step-no {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.unlock-qr {
  display: block;
  margin: 6px auto 10px;
  width: 140px;
  height: 140px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.modal-box input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  letter-spacing: 1px;
  box-sizing: border-box;
}
.modal-box textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}
.modal-msg { min-height: 20px; font-size: 13px; margin: 8px 0 4px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.note-sel {
  font-size: 12px;
  color: var(--muted);
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
}

/* ---------- 搜索 ---------- */
.search-btn {
  border: none;
  background: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 8px;
}
.search-btn:hover { background: var(--bg); color: var(--ink); }
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 85;
  padding: 10vh 16px 16px;
  overflow-y: auto;
}
.search-overlay[hidden] { display: none !important; }
.search-box {
  max-width: 640px;
  margin: 0 auto 12px;
  display: flex;
  gap: 8px;
}
.search-box input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 16px;
  background: var(--surface);
}
.search-close {
  width: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  font-size: 16px;
  cursor: pointer;
}
#searchResults {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.search-hit {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  text-decoration: none;
  color: var(--ink);
}
.search-hit:hover { border-left: 3px solid var(--accent); }
.sh-title { font-weight: 600; font-size: 14px; }
.sh-snippet { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.search-empty { text-align: center; color: var(--muted); padding: 30px; }

/* ---------- 自测题 ---------- */
.quiz-block, .lab-block {
  margin-top: 34px;
  border-top: 1px dashed var(--border);
  padding-top: 18px;
}
.quiz-block h3, .lab-block h3 { margin: 0 0 10px; }
.quiz-score { font-size: 13px; font-weight: 600; }
.score-ok { color: var(--ok); }
.score-no { color: var(--warn); }
.quiz-actions { margin-bottom: 10px; }
.quiz-q {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--panel);
}
.quiz-q.q-ok { border-color: #86efac; }
.quiz-q.q-bad { border-color: #fca5a5; }
.quiz-q-title { font-weight: 600; margin-bottom: 8px; }
.quiz-opt {
  display: block;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  margin: 3px 0;
  font-size: 14px;
}
.quiz-opt input { margin-right: 8px; }
.quiz-opt:hover { background: var(--bg); }
.opt-right { background: #dcfce7; font-weight: 600; }
.opt-wrong { background: #fee2e2; }
.quiz-explain {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--accent-soft);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}
.quiz-result {
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 700;
  margin-top: 6px;
}
.result-ok { background: #dcfce7; color: var(--ok); }
.result-bad { background: #fee2e2; color: var(--bad); }

/* ---------- 实验验收 ---------- */
.lab-hint { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.lab-check { padding: 6px 0; font-size: 14px; }
.lab-ok { color: var(--ok); }
.lab-no { color: var(--muted); }

/* ---------- 笔记 ---------- */
.notes-list { margin-bottom: 12px; }
.note-item {
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
.note-item:last-child { border-bottom: none; }
.note-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; }
.note-date { color: var(--muted); font-weight: 400; font-size: 12px; }
.note-seltext {
  font-size: 12.5px;
  color: var(--muted);
  border-left: 3px solid var(--accent);
  padding-left: 8px;
  margin: 6px 0;
}
.note-body { font-size: 14px; }
.cert-cards { display: flex; flex-wrap: wrap; gap: 10px; }
.cert-btn { flex: 1; min-width: 200px; }
.cert-row { display: flex; gap: 10px; flex-wrap: wrap; flex: 1; }
.cert-row .cert-btn { flex: 1; }
.milestone-share { flex-shrink: 0; }
.share-tpls { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.share-tpls .btn { padding: 4px 12px; font-size: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); }
.share-tpls .btn:hover { border-color: var(--accent); color: var(--accent-ink); }
#shareText {
  font-size: 13px; line-height: 1.8; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
  outline: none; transition: border-color .15s, background .15s;
}
#shareText:focus { border-color: var(--accent); background: var(--surface); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

/* ---------- 课时页 ---------- */
.lesson-head { margin-bottom: 8px; }
.lesson-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 8px; line-height: 1.35; }
.lesson-ico { font-size: 22px; margin-right: 8px; vertical-align: -2px; }
.lesson-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.lesson-meta a { color: var(--accent-ink); text-decoration: none; }
.lesson-actions { margin: 16px 0 4px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.done-hint { color: var(--ok); font-size: 13px; }

.lesson-body h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; margin: 32px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.lesson-body h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; margin: 24px 0 8px; }
.lesson-body h4 { font-size: 15px; font-weight: 600; margin: 18px 0 6px; }
.lesson-body p { margin: 10px 0; line-height: 1.75; }
.lesson-body ul, .lesson-body ol { margin: 8px 0; padding-left: 24px; }
.lesson-body li { margin: 4px 0; }
.lesson-body blockquote {
  margin: 12px 0;
  padding: 10px 16px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-2);
}
.lesson-body hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.lesson-body code {
  background: #f2f3f5;
  padding: 2px 6px;
  border-radius: 5px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
}
.lesson-body a { color: var(--accent-ink); }
.lesson-body table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 14px; }
.lesson-body th, .lesson-body td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.lesson-body th { background: #f5f6f7; }
.lesson-body img { max-width: 100%; }

.codeblock {
  margin: 14px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--code-bg);
}
.codehead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  font-size: 12px;
}
.copy-btn {
  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
  border-radius: 6px;
  padding: 2px 10px;
  font-size: 12px;
  cursor: pointer;
}
.copy-btn:hover { color: #fff; border-color: #64748b; }
.codeblock pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.codeblock code {
  background: none;
  padding: 0;
  color: var(--code-ink);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
}

/* ---------- 代码运行控制台 ---------- */
.code-actions { display: flex; gap: 8px; }
.run-btn {
  background: #16a34a;
  border: 1px solid #15803d;
  color: #fff;
  border-radius: 6px;
  padding: 2px 12px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
}
.run-btn:hover { background: #15803d; }
.run-btn:disabled { opacity: 0.5; cursor: default; }

.run-console {
  margin: -6px 0 14px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: #0b1220;
  border: 1px solid #1e293b;
  border-top: none;
  overflow: hidden;
}
.run-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
}
.run-status { font-weight: 600; }
.run-status.running { color: #fbbf24; }
.run-status.ok { color: #4ade80; }
.run-status.failed { color: #f87171; }
.run-stop {
  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
  border-radius: 6px;
  padding: 2px 10px;
  font-size: 12px;
  cursor: pointer;
}
.run-stop:hover { color: #fff; border-color: #64748b; }
.run-stop:disabled { opacity: 0.4; cursor: default; }
.run-output {
  margin: 0;
  padding: 10px 16px;
  max-height: 320px;
  overflow-y: auto;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
}
.run-line { white-space: pre-wrap; word-break: break-all; }
.run-line.cmd { color: #7dd3fc; margin-bottom: 4px; }
.run-line.out { color: #d1d5db; }
.run-line.err { color: #fca5a5; }
.run-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 16px 12px;
}
.run-images img {
  max-width: 220px;
  max-height: 160px;
  border-radius: 8px;
  border: 1px solid #334155;
}
.run-images img:hover { border-color: var(--accent); }

/* ---------- AI 助教 ---------- */
.ai-fab[hidden], .ai-drawer[hidden], .sel-bubble[hidden] { display: none !important; }

.ai-fab {
  position: fixed;
  right: 18px;
  bottom: 88px;
  z-index: 65;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(16, 24, 40, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
}
.ai-fab:hover { border-color: var(--accent); transform: scale(1.05); }


.ai-drawer {
  position: fixed;
  top: 56px;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 92vw;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 16px rgba(16, 24, 40, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 70;
}
.ai-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.ai-lesson {
  flex: 1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-close { border: none; background: none; font-size: 16px; cursor: pointer; color: var(--muted); }
.ai-close:hover { color: var(--ink); }
.ai-max {
  border: 1px solid var(--border);
  background: none;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
  border-radius: 6px;
  padding: 2px 8px;
}
.ai-max:hover { color: var(--accent-ink); border-color: var(--accent); }
.ai-clear { border: none; background: none; font-size: 14px; cursor: pointer; color: var(--muted); }
.ai-clear:hover { color: var(--bad); }

/* 助教面板全屏模式 */
.ai-drawer.max { left: 0; width: auto; }
.ai-drawer.max .ai-msgs { padding: 14px 10vw; }
@media (max-width: 900px) {
  .ai-drawer.max { height: 96%; }
  .ai-drawer.max .ai-msgs { padding: 14px; }
}

.ai-selbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--accent-soft);
  font-size: 12px;
  color: var(--ink-2);
}
.ai-selbar[hidden], .ai-chips[hidden] { display: none !important; }
.ai-selbar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-selbar button { border: none; background: none; cursor: pointer; color: var(--muted); }

.ai-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-msg { max-width: 94%; }
.ai-msg.user { align-self: flex-end; }
.ai-msg.user .ai-text {
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  border-radius: 14px 14px 4px 14px;
  font-size: 14px;
  white-space: pre-wrap;
}
.ai-msg.assistant .ai-text {
  background: #f5f6f7;
  padding: 10px 12px;
  border-radius: 14px 14px 14px 4px;
  font-size: 14px;
  white-space: pre-wrap;
}
.ai-msg.assistant .ai-md { white-space: normal; }
.ai-md p { margin: 6px 0; }
.ai-md h2, .ai-md h3, .ai-md h4 { border: none; margin: 12px 0 6px; font-size: 15px; }
.ai-md pre { font-size: 12px; }
.ai-md ul, .ai-md ol { padding-left: 20px; margin: 6px 0; }
.ai-quote {
  font-size: 12px;
  color: var(--muted);
  border-left: 3px solid var(--accent);
  padding: 4px 8px;
  margin-bottom: 4px;
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
}

.ai-chips { display: flex; gap: 6px; padding: 0 14px 8px; flex-wrap: wrap; }
.ai-chips button {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  color: var(--ink);
}
.ai-chips button:hover { border-color: var(--accent); color: var(--accent-ink); }

.ai-input {
  display: flex; gap: 8px; padding: 10px 14px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  /* 固定在消息区底部：滚动时也贴住屏幕底部 */
  position: sticky;
  bottom: 0;
  background: var(--panel);
  z-index: 5;
}
.ai-input-bar {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  background: #f4f5f7;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 6px 6px 6px 14px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.ai-input-bar:focus-within {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ai-input textarea {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  padding: 7px 4px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.5;
  outline: none;
  max-height: 120px;
}
.ai-mic {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: transparent;
  font-size: 18px; cursor: pointer; flex-shrink: 0;
  color: var(--muted);
}
.ai-mic:hover { background: #eef0f2; color: var(--accent-ink); }
.ai-mic.listening { background: #fee2e2; color: #dc2626; animation: mic-pulse 1s infinite; }
@keyframes mic-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.3); } 50% { box-shadow: 0 0 0 6px rgba(220,38,38,0); } }
.ai-send {
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: var(--accent); color: #fff;
  font-size: 16px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.ai-send:active { transform: scale(.92); }

.sel-bubble {
  position: absolute;
  z-index: 80;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  padding: 3px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  user-select: none;
  display: flex;
  gap: 2px;
}
.sel-bubble button {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.sel-bubble button:hover { background: var(--accent); }

@media (max-width: 900px) {
  .ai-fab { bottom: calc(88px + env(safe-area-inset-bottom)); }
    .ai-drawer {
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none; /* 移动端铺满宽度（否则 92vw 按 dp 视口算会留空） */
    height: 78%;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
  }
  .ai-drawer.max { height: 96%; }
}

.lesson-nav { display: flex; justify-content: space-between; margin-top: 48px; gap: 12px; }
.lesson-nav a {
  flex: 1;
  max-width: 48%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
}
.lesson-nav a:hover { border-color: var(--accent); }
.lesson-nav a.next { text-align: right; }
.lesson-nav .nav-label { display: block; font-size: 12px; color: var(--muted); }

/* ---------- 卡片 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 24px 0; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
/* 专栏图标：缩小至与文字同级（20px 级），无底色块 */
.sec-ico { font-size: 20px; margin-right: 6px; vertical-align: -2px; }
.card .desc { color: var(--muted); font-size: 13px; min-height: 60px; line-height: 1.6; }
.card .card-actions { margin-top: 12px; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 24px 0; }
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat .num { font-size: 28px; font-weight: 700; color: var(--accent); }
.stat .label { color: var(--muted); font-size: 13px; }

/* ---------- 进度条（3-4px 细条，主色填充，轨道浅灰，无渐变发光） ---------- */
.bar { height: 4px; background: #eef0f2; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar-text { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- 赞踩按钮 ---------- */
.rate-btn { padding: 6px 12px; }
.rate-btn .rate-count { font-size: 12px; opacity: .65; margin-left: 2px; }
.rate-btn.on {
  border-color: var(--ok);
  background: #dcfce7;
}
#dislikeBtn.rate-btn.on {
  border-color: var(--bad);
  background: #fee2e2;
}
.liked-list { margin: 0; padding-left: 20px; }
.liked-list li { margin: 6px 0; }
.liked-list a:hover { color: var(--accent-ink) !important; }

/* ---------- 返回上一级 ---------- */
.back-chip {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  margin: 0 0 10px -8px;
  padding: 6px 10px;
  border-radius: 8px;
  min-height: 32px;
}
.back-chip:hover { background: var(--accent-soft); color: var(--accent-ink); }

@media (max-width: 420px) {
  .brand { display: none; }
}

/* ---------- 月历 ---------- */
.calendar { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.calendar h3 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: #f6f7f8;
  color: var(--muted);
  min-height: 40px;
}
.cal-cell.head { background: none; font-weight: 600; color: var(--ink); aspect-ratio: auto; min-height: 24px; }
.cal-cell.empty { background: none; }
.cal-cell.studied { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.cal-cell.studied.l2 { background: #d5e8e0; }
.cal-cell.studied.l3 { background: var(--accent); color: #fff; }
.cal-cell.today { outline: 2px solid var(--accent); }
.cal-cell .mins { font-size: 10px; font-weight: 400; }

/* ---------- 环境检测 ---------- */
.env-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin: 20px 0; }
.env-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.env-card h3 { margin: 0 0 8px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.env-status { font-size: 13px; white-space: pre-wrap; word-break: break-all; color: var(--muted); font-family: "SF Mono", Menlo, monospace; background: #f6f7f8; border-radius: var(--radius-sm); padding: 10px; margin-top: 8px; max-height: 140px; overflow: auto; }
.badge { font-size: 12px; padding: 2px 10px; border-radius: 99px; font-weight: 600; }
.badge.ok { background: #dcfce7; color: var(--ok); }
.badge.bad { background: #fee2e2; color: var(--bad); }
.badge.warn { background: #fef3c7; color: var(--warn); }

.section-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 28px 0 6px; }
.section-sub { color: var(--muted); margin: 0 0 14px; }

/* ---------- 历史月份表 ---------- */
.history-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.history-table th, .history-table td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.history-table th { background: #f5f6f7; font-size: 13px; color: var(--muted); }

/* ---------- 欢迎页 ---------- */
.hero { padding: 16px 0 8px; }
.hero h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 8px; }
.hero p { color: var(--muted); margin: 0; line-height: 1.75; }

/* ---------- 移动端目录按钮与抽屉 ---------- */
.toc-btn {
  display: none;
  border: none;
  background: none;
  font-size: 20px;
  color: var(--ink);
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 8px;
}
.toc-btn:hover { background: var(--bg); }
.toc-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 54;
}

/* ---------- 移动端：悬浮打卡按钮 ---------- */
.checkin-fab { display: none; }

@media (max-width: 900px) {
  #sidebar { display: none; }
  body.toc-open #sidebar {
    display: block;
    position: fixed;
    top: calc(56px + env(safe-area-inset-top));
    left: 0;
    bottom: 0;
    width: 82%;
    max-width: 320px;
    height: auto;
    z-index: 55;
    box-shadow: 4px 0 16px rgba(16, 24, 40, 0.12);
    border-radius: 0 12px 12px 0;
  }
  .toc-btn { display: block; }
  #main { padding: 16px 14px 118px; }

  .topbar { gap: 6px; padding: 0 12px; padding-top: env(safe-area-inset-top); height: auto; min-height: 56px; justify-content: space-between; }
  .brand { font-size: 16px; white-space: nowrap; }
  .search-btn { display: block; }
  .tabs { justify-content: space-around; gap: 0; }
  .tabs a {
    padding: 8px 10px;
    font-size: 13px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
  }
  /* 顶栏打卡组件已移除 */
  .checkin { display: none; }

  /* 底部 TabBar */
  .tabbar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0; z-index: 50;
    background: var(--panel);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    flex: 1;
    display: flex; flex-direction: column; align-items: center;
    padding: 8px 0 6px;
    text-decoration: none; color: var(--muted); font-size: 11px;
  }
  .tabbar a .tb-ico { font-size: 20px; line-height: 1.2; }
  .tabbar a.active { color: var(--accent-ink); font-weight: 600; }
  .ai-page {
    height: calc(100vh - 56px - 60px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    margin: -16px -14px -118px;
  }
  @supports (height: 100dvh) {
    .ai-page { height: calc(100dvh - 56px - 60px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  }
  .checkin-fab {
    display: block;
    position: fixed;
    right: 16px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 60;
  }
  .fab-back { width: 100%; margin-bottom: 8px; color: var(--accent); border-color: var(--accent); }
  .fab-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(16, 24, 40, 0.18);
    cursor: pointer;
  }
  .fab-btn:active { transform: scale(0.93); }
  .fab-panel {
    position: absolute;
    right: 0;
    bottom: 70px;
    width: 210px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-pop);
    padding: 14px;
  }
  .fab-panel .fab-today { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 8px; }
  .fab-row { display: flex; gap: 8px; }
  .fab-row input {
    width: 72px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
  }
  .fab-row .btn { flex: 1; padding: 8px 0; }
}

/* ---------- 邀请好友解锁 ---------- */
.unlock-divider { text-align: center; color: var(--muted); font-size: 12px; margin: 10px 0 6px; }
.invite-card { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.invite-progress { height: 8px; background: #eef0f2; border-radius: 6px; overflow: hidden; margin-top: 8px; }
.invite-progress-fill { height: 100%; background: var(--accent); border-radius: 6px; transition: width .4s; width: 0; }
.invite-progress-label { font-size: 12px; color: var(--muted); margin-top: 5px; }
.invite-ok { color: var(--ok); font-size: 14px; font-weight: 600; padding: 8px 0; }

/* ---------- AI 助教引导 ---------- */
.ai-empty-title { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 10px; }
.ai-suggest { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 10px; }
.ai-suggest-btn { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.ai-empty-hint { font-size: 12px; color: var(--muted); line-height: 1.9; margin-top: 4px; }

/* ---------- AI 助教上下文 ---------- */
.ai-ctx-clear { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 0 4px; margin-left: 4px; line-height: 1; }
.ai-ctx-clear:active { color: var(--bad); }
.ai-auto-ctx { background: var(--accent-soft); color: var(--ink-2); font-size: 12.5px; padding: 7px 12px; border-radius: var(--radius-sm); margin-bottom: 10px; line-height: 1.5; }

/* ---------- 续读（阅读位置记忆） ---------- */
.resume-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--accent-soft); color: var(--ink-2);
  border-radius: var(--radius-sm); padding: 8px 12px; margin: 12px 0 4px; font-size: 13px;
}
.resume-card { border-left: 2px solid var(--accent); }
.resume-info { margin-bottom: 8px; font-size: 14px; }
.resume-info .muted { font-size: 12px; }

/* ---------- 文章留言 ---------- */
.comment-block { margin-top: 30px; border-top: 1px dashed var(--border); padding-top: 16px; }
.comment-head { font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.comment-tip { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; color: var(--ink-2); margin-bottom: 12px; line-height: 1.6; }
.comment-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.comment-form input { max-width: 220px; }
.comment-form textarea { resize: vertical; }
.comment-form-row { display: flex; align-items: center; gap: 10px; }
.comment-list { display: flex; flex-direction: column; gap: 10px; }
.comment-item {
  background: #f6f7f8;
  border: none;
  border-radius: var(--radius);
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
}
.comment-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.comment-name { color: var(--accent-ink); font-weight: 600; font-size: 13px; }
.comment-time { color: var(--muted); font-size: 11px; }
.comment-text { color: var(--ink); font-size: 14.5px; line-height: 1.7; word-break: break-word; }
.comment-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 16px 0; }

/* ---------- 移动端课时页右侧悬浮操作栏 ---------- */
.lesson-fab {
  position: fixed; right: 10px; top: 50%; transform: translateY(-50%);
  z-index: 60; display: none; flex-direction: column; gap: 8px;
  transition: opacity .28s ease;
}
.lesson-fab[hidden] { display: none !important; }
/* 滚动阅读时淡出悬浮栏（避免干扰），停止滚动后恢复 */
.lesson-fab.fab-dim { opacity: 0.12; pointer-events: none; }
.fab-item {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; cursor: pointer; position: relative;
  color: var(--ink);
  transition: transform .15s;
}
.fab-item:active { transform: scale(0.92); }
.fab-count {
  position: absolute; top: -3px; right: -3px;
  background: var(--accent); color: #fff; font-size: 10px;
  border-radius: 8px; padding: 1px 5px; min-width: 15px; text-align: center;
}
@media (max-width: 900px) {
  .lesson-fab { display: flex; }
  /* 浮动栏存在时（移动端），隐藏标题下与浮动栏重复的入口，仅保留"标记完成"等独有按钮 */
  .lesson-actions .fab-dup { display: none; }
}

/* ---------- 首页学习状态卡 / 更新横幅 / APK 横幅：收敛为简洁横向条目 ---------- */
.learn-status, .update-banner, .apk-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 10px 0;
}
/* 学习状态：左侧主色细条标识，一行文字 + 右侧操作链接，不抢戏 */
.learn-status { border-left: 2px solid var(--accent); }
.learn-status .status-line, .update-banner .status-line, .apk-banner .status-line {
  font-size: 14px; font-weight: 600; color: var(--ink);
  margin-bottom: 2px; line-height: 1.5;
}
.learn-status .status-sub, .update-banner .status-sub, .apk-banner .status-sub {
  font-size: 12.5px; color: var(--muted); line-height: 1.6;
}
.status-row { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.status-body { min-width: 0; flex: 1; }
.status-cta { flex-shrink: 0; color: var(--accent-ink); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.status-cta:hover { text-decoration: underline; }

/* ---------- 用户学习榜 ---------- */
.rank-mine td { background: var(--accent-soft); font-weight: 600; }

/* ---------- 更新横幅与弹窗 ---------- */
.update-banner { border-left: 2px solid var(--warn); }
.upd-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; }
.upd-head { font-size: 14px; margin-bottom: 4px; }
.upd-sum { font-size: 13px; color: var(--muted); margin-bottom: 8px; line-height: 1.6; }
.upd-lessons { display: flex; flex-wrap: wrap; gap: 6px; }
.upd-lesson { font-size: 12.5px; background: var(--accent-soft); color: var(--accent-ink); padding: 4px 10px; border-radius: 14px; text-decoration: none; }

/* ---------- 侧栏导航偏好 ---------- */
.sidebar-top { padding: 0 0 10px; }
.sidebar-top .btn { width: 100%; justify-content: center; }
.side-section-head { cursor: pointer; user-select: none; }
.side-arrow { display: inline-block; width: 16px; color: var(--muted); font-size: 11px; }
.side-lessons[hidden] { display: none; }

/* ---------- APK 更新横幅 ---------- */
.apk-banner { border-left: 2px solid var(--ok); }

/* ---------- 分享弹窗（微信风格） ---------- */
.share-box { position: relative; padding-top: 20px; }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: #f2f3f5; color: var(--muted);
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:active { background: #e2e4ec; }
.share-box h3 { padding-right: 30px; }
.share-actions { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.share-actions-row { display: flex; gap: 10px; }
.share-actions-row .share-mini { flex: 1; }
.share-main { width: 100%; padding: 12px; font-size: 15px; }

/* ---------- 「关于」区 / 公众号弹窗 ---------- */
.mine-entry { cursor: pointer; }
.wechat-placeholder {
  text-align: center; color: var(--muted); font-size: 13px;
  background: var(--bg); border-radius: var(--radius); padding: 28px 12px; margin-top: 8px;
}

/* ---------- 横幅关闭按钮 ---------- */
.banner-close {
  width: 26px; height: 26px; border-radius: 50%;
  border: none; background: #f2f3f5; color: var(--muted);
  font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.banner-close:active { background: #e2e4ec; }
