* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --border: #e5e7eb;
  --radius: 12px;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
}

.brand { font-size: 1.2rem; font-weight: 700; letter-spacing: .5px; }

nav { display: flex; gap: 6px; flex-wrap: wrap; }

.nav-btn {
  background: rgba(255,255,255,.12);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .9rem;
  transition: background .15s;
}
.nav-btn:hover { background: rgba(255,255,255,.25); }
.nav-btn.active { background: #fff; color: var(--primary-dark); font-weight: 600; }

main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 24px 20px 40px; }

.view { display: none; animation: fadeIn .2s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

h2 { margin-bottom: 16px; font-size: 1.35rem; }
h3 { margin-bottom: 10px; }

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.course-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.course-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,.08); }
.course-card .c-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.course-card .c-code { color: var(--primary); font-weight: 600; font-size: .85rem; }
.course-card .c-meta { color: var(--muted); font-size: .85rem; margin-top: 8px; }
.course-card .c-tag {
  display: inline-block; background: #eff6ff; color: var(--primary-dark);
  border-radius: 6px; padding: 2px 8px; font-size: .78rem; margin-top: 10px;
}

.stats-bar { margin-top: 20px; color: var(--muted); font-size: .9rem; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }

select, input[type="text"], input[type="password"] {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .95rem;
  background: #fff;
  color: var(--ink);
  min-width: 200px;
}
input[type="text"], input[type="password"] { flex: 1; min-width: 260px; }
select:focus, input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }

button {
  padding: 9px 18px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: .95rem;
  transition: background .15s, transform .1s;
}
button:hover { background: #f3f4f6; }
button:active { transform: scale(.98); }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-dark); }
button.danger { background: #fff; border-color: var(--red); color: var(--red); }
button.danger:hover { background: #fef2f2; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.q-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; }
.q-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }
.q-badge { background: #eff6ff; color: var(--primary-dark); border-radius: 6px; padding: 2px 8px; font-size: .78rem; }
.q-text { font-size: 1.02rem; margin-bottom: 14px; line-height: 1.6; }

.opt {
  display: block;
  width: 100%;
  text-align: left;
  background: #f9fafb;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: .95rem;
  cursor: pointer;
  transition: border-color .1s, background .1s;
}
.opt:hover { border-color: var(--primary); background: #eff6ff; }
.opt.selected { border-color: var(--primary); background: #dbeafe; font-weight: 600; }
.opt.correct { border-color: var(--green); background: #f0fdf4; font-weight: 600; }
.opt.wrong { border-color: var(--red); background: #fef2f2; }

.feedback { margin-top: 12px; padding: 12px 14px; border-radius: 8px; font-size: .93rem; line-height: 1.6; display: none; }
.feedback.ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; display: block; }
.feedback.bad { background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d; display: block; }
.feedback .exp { margin-top: 6px; color: var(--muted); }

.score-banner {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff; border-radius: var(--radius); padding: 24px; text-align: center; margin-bottom: 18px;
}
.score-banner .big { font-size: 2.2rem; font-weight: 800; }
.score-banner .sub { opacity: .9; margin-top: 4px; }

.ask-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.ask-box .toolbar { margin-bottom: 6px; }

.answer-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; }
.answer-card .q { font-weight: 700; margin-bottom: 10px; }
.answer-card .a { line-height: 1.8; white-space: pre-wrap; }
.answer-card .a b { color: var(--primary-dark); }
.answer-card .a hr.lite { border: none; border-top: 1px dashed var(--border); margin: 10px 0; }
.answer-card .a code { background: #f1f5f9; border-radius: 4px; padding: 1px 5px; font-size: .9em; }

.source-list { margin-top: 14px; }
.source-item {
  background: #f9fafb; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; margin-top: 8px; font-size: .88rem;
}
.source-item .src-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.source-item .src-file { font-weight: 600; color: var(--primary-dark); }
.source-item .src-score { color: var(--muted); font-size: .8rem; }
.source-item .src-snip { color: var(--muted); margin-top: 6px; line-height: 1.55; }

.mistake-item { background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--amber); border-radius: 8px; padding: 14px 16px; margin-bottom: 10px; }
.mistake-item .m-q { font-weight: 600; margin-bottom: 6px; }
.mistake-item .m-meta { color: var(--muted); font-size: .85rem; margin-bottom: 6px; }
.mistake-item .m-wrong { color: var(--red); }
.mistake-item .m-right { color: var(--green); font-weight: 600; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
label { display: block; font-size: .88rem; font-weight: 600; margin: 12px 0 4px; color: var(--ink); }

.empty { color: var(--muted); text-align: center; padding: 40px 0; }

footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 16px; border-top: 1px solid var(--border); background: #fff; }

.loading { color: var(--muted); padding: 20px 0; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* access guard overlay */
.guard-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .85);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.guard-box {
  background: #fff; border-radius: 16px; padding: 32px; width: 340px;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.4);
}

/* lesson view */
.lesson-toc { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.lesson-toc button {
  background: #eff6ff; color: var(--primary-dark); border: 1px solid #bfdbfe;
  border-radius: 20px; padding: 6px 14px; font-size: .85rem;
}
.lesson-toc button:hover { background: #dbeafe; }
.lesson-toc button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.lesson-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.lesson-card h3 { font-size: 1.15rem; margin-bottom: 12px; color: var(--primary-dark); }
.lesson-summary { line-height: 1.85; margin-bottom: 12px; }
.lesson-summary b { color: var(--primary-dark); }
.lesson-points { margin: 10px 0 16px 4px; padding-left: 18px; line-height: 1.8; }
.lesson-points li { margin-bottom: 6px; }
.lesson-example {
  background: #f8fafc; border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: 8px; padding: 14px 16px; margin-top: 12px;
}
.lesson-example .ex-title { font-weight: 700; margin-bottom: 8px; color: var(--ink); }
.lesson-example .ex-q { line-height: 1.7; margin-bottom: 8px; color: var(--ink); }
.lesson-example .ex-steps { margin: 8px 0 8px 4px; padding-left: 18px; line-height: 1.75; color: var(--muted); font-size: .93rem; }
.lesson-example .ex-answer { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 6px; padding: 8px 12px; color: #14532d; font-weight: 600; margin-top: 8px; }
.lesson-example .ex-src { color: var(--muted); font-size: .8rem; margin-top: 8px; }
.lesson-more { margin-top: 18px; padding: 14px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; font-size: .92rem; line-height: 1.7; color: #78350f; }
.lesson-more b { color: var(--amber); }

/* subtopic two-level structure */
.subtopic { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; background: #fff; overflow: hidden; }
.subtopic > summary {
  cursor: pointer; padding: 13px 16px; font-weight: 700; font-size: 1.02rem;
  background: #f8fafc; color: var(--primary-dark); list-style: none; user-select: none;
}
.subtopic > summary::-webkit-details-marker { display: none; }
.subtopic > summary::before { content: '▶ '; font-size: .8rem; color: var(--primary); }
.subtopic[open] > summary::before { content: '▼ '; }
.subtopic > summary:hover { background: #eff6ff; }
.subtopic-body { padding: 14px 16px 16px; }
.subtopic-body .lesson-summary { margin-bottom: 8px; }

/* mini quiz drawer (collapsed by default) */
.quiz-drawer { margin-top: 14px; border: 1px solid #c7d2fe; border-radius: 8px; background: #fafaff; }
.quiz-drawer > summary {
  cursor: pointer; padding: 10px 14px; font-weight: 600; color: var(--primary-dark);
  list-style: none; user-select: none; border-radius: 8px;
}
.quiz-drawer > summary::-webkit-details-marker { display: none; }
.quiz-drawer > summary::before { content: '▶ '; font-size: .8rem; }
.quiz-drawer[open] > summary::before { content: '▼ '; }
.quiz-drawer > summary:hover { background: #eff6ff; }

/* mini quiz */
.quiz-mini { background: #fafaff; border: 1px dashed #c7d2fe; border-radius: 8px; padding: 12px 14px; margin: 12px 14px 4px; }
.quiz-mini .quiz-q { font-weight: 600; margin-bottom: 10px; line-height: 1.6; }
.quiz-mini .opt { padding: 7px 12px; font-size: .9rem; margin-bottom: 6px; }
.quiz-mini .opt.dim { opacity: .45; }
.quiz-fb { margin-top: 8px; padding: 8px 12px; border-radius: 6px; font-size: .9rem; line-height: 1.6; }
.quiz-fb.ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; }
.quiz-fb.bad { background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d; }
.quiz-fb .exp { margin-top: 4px; color: var(--muted); font-size: .88rem; }

/* lesson source browsing */
.src-file-btn {
  background: #eff6ff; color: var(--primary-dark); border: 1px solid #bfdbfe;
  border-radius: 16px; padding: 5px 12px; font-size: .82rem; max-width: 260px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.src-file-btn:hover { background: #dbeafe; }
.src-file-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* subscription pricing */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; max-width: 720px; margin: 0 auto; }
.pricing-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 24px; position: relative; }
.pricing-card.featured { border: 2px solid var(--primary); box-shadow: 0 10px 30px rgba(37,99,235,.15); }
.p-badge { position: absolute; top: -12px; right: 14px; background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; font-size: .78rem; font-weight: 700; padding: 4px 10px; border-radius: 12px; }
.p-name { font-weight: 700; font-size: 1.05rem; }
.p-price { font-size: 2rem; font-weight: 800; color: var(--primary-dark); margin: 8px 0 12px; }
.p-price span { font-size: .9rem; color: var(--muted); font-weight: 400; }
.pricing-card ul { list-style: none; padding: 0; margin: 0 0 16px; line-height: 2; color: var(--ink); }
.p-btn { width: 100%; }

/* auth login / activate */
.auth-box { max-width: 380px; margin: 60px auto 0; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 30px 28px; text-align: center; }
.auth-box h2 { margin-bottom: 4px; }
.auth-box label { text-align: left; }
.auth-box input { width: 100%; min-width: 0; margin-bottom: 4px; }
/* admin */
.admin-wrap { max-width: 1100px; }
.badge-ok { color: var(--green); font-weight: 600; }
.badge-no { color: var(--red); font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat-box { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 14px; text-align: center; }
.stat-box .n { font-size: 1.5rem; font-weight: 800; color: var(--primary-dark); }
.stat-box .l { font-size: .78rem; color: var(--muted); }
.code-pill { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 6px 12px; font-family: ui-monospace, monospace; cursor: pointer; }
.code-pill:hover { background: #dbeafe; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: #f8fafc; }
button.small { padding: 4px 10px; font-size: .8rem; }

/* ============ mobile responsiveness (max-width: 768px) ============ */
@media (max-width: 768px) {
  nav { flex-wrap: nowrap; overflow-x: auto; gap: 6px; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
  nav::-webkit-scrollbar { display: none; }
  nav .nav-btn { font-size: .85rem; padding: 6px 12px; white-space: nowrap; }
  header { padding: 10px 14px; gap: 8px; }
  header .brand { font-size: 1.02rem; }
  main { padding: 16px 12px 32px; }
  .toolbar { display: flex; }
  .toolbar > * { min-width: 0; }
  .toolbar input, .toolbar select { flex: 1 1 100%; }
  .toolbar button { flex: 1 1 44%; white-space: nowrap; }
  .toolbar .primary { flex: 1 1 100%; }
  .course-grid { grid-template-columns: 1fr; gap: 12px; }
  .course-card { padding: 16px; }
  .auth-box { margin: 20px auto 0; padding: 24px 20px; }
  .q-card, .lesson-card, .card { padding: 16px; }
  .ai-hero { flex-wrap: wrap; }
  .ai-hero-badge { order: -1; }
  .score-banner { padding: 20px 14px; }
  .score-banner .big { font-size: 1.8rem; }
  h2 { font-size: 1.2rem; }
  .note-btn, .src-file-btn { white-space: nowrap; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .msg-assistant, .msg-user { font-size: .93rem; }
  .guard-box { width: calc(100% - 40px); }
}
@media (max-width: 480px) {
  .toolbar button { flex: 1 1 48%; }
  .ai-hero-title { font-size: 1.1rem; }
  .ai-hero-sub { font-size: .82rem; }
  .c-name { font-size: 1rem; }
}

/* ============ multi-turn chat bubbles ============ */
.msg-user { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px; padding: 10px 12px; margin: 8px 0; white-space: pre-wrap; }
.msg-assistant { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 8px 0; white-space: pre-wrap; }
.msg-role { font-size: .78rem; color: var(--muted); margin-bottom: 4px; }

/* ============ learning progress bar ============ */
.progress-bar { background: #eef2f7; border: 1px solid var(--border); border-radius: 999px; height: 10px; overflow: hidden; margin-top: 6px; max-width: 320px; }
.progress-fill { background: var(--primary-dark); height: 100%; width: 0; transition: width .3s; }

/* ============ AI highlight (nav + hero) ============ */
.nav-btn.nav-ai { background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; border-color: transparent; font-weight: 700; }
.nav-btn.nav-ai:hover { background: linear-gradient(135deg, #1d4ed8, #6d28d9); }
.nav-btn.nav-ai.active { box-shadow: 0 4px 14px rgba(37, 99, 235, .35); }

.ai-hero { display: flex; align-items: center; gap: 16px; background: linear-gradient(135deg, #1e3a8a, #2563eb 55%, #7c3aed); color: #fff; border-radius: 16px; padding: 18px 20px; margin-bottom: 20px; cursor: pointer; box-shadow: 0 8px 24px rgba(37, 99, 235, .28); transition: transform .15s, box-shadow .15s; }
.ai-hero:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(37, 99, 235, .36); }
.ai-hero-icon { font-size: 2.4rem; line-height: 1; }
.ai-hero-body { flex: 1; min-width: 0; }
.ai-hero-title { font-size: 1.3rem; font-weight: 800; letter-spacing: .5px; }
.ai-hero-sub { font-size: .88rem; opacity: .92; margin-top: 4px; }
.ai-hero-badge { background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .35); color: #fff; font-weight: 800; font-size: .8rem; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
@media (max-width: 768px) { .ai-hero { flex-wrap: wrap; } .ai-hero-badge { order: -1; } }

/* ============ 模拟考试 ============ */
.exam-timer { font-size: 1.05rem; letter-spacing: .5px; }
#exam-result .mistake-item .m-expl { margin-top: 6px; color: var(--muted); line-height: 1.6; }

/* ============ 记笔记 / 收藏 ============ */
.note-btn {
  background: #fffbeb; color: #b45309; border: 1px solid #fde68a; border-radius: 8px;
  padding: 5px 11px; font-size: .82rem; cursor: pointer; transition: background .15s, transform .15s;
}
.note-btn:hover { background: #fef3c7; transform: translateY(-1px); }
.subtopic-actions { margin-top: 10px; }
.note-item { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; }
.note-item .note-text { color: var(--ink); line-height: 1.7; margin-top: 4px; white-space: pre-wrap; }
#note-toggle-star.active { background: #fef3c7; border-color: #f59e0b; color: #b45309; font-weight: 700; }
#note-modal textarea { min-height: 120px; resize: vertical; font-family: inherit; }
.note-edit-help { color: var(--muted); font-size: .82rem; }

/* ---- 选择专业（一次性） ---- */
.prog-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; padding: 16px 18px; margin-bottom: 12px; text-align: left; border-radius: 12px; background: #fff; border: 1px solid var(--border); cursor: pointer; }
.prog-btn:hover { border-color: var(--primary); background: #eff6ff; }
.prog-btn .prog-ico { font-size: 1.5rem; }
.prog-btn .prog-name { font-size: 1.05rem; font-weight: 700; }
.prog-btn .prog-desc { font-size: .82rem; color: var(--muted); }

/* ---- 当前体系徽标 ---- */
.prog-badge { display: inline-block; padding: 6px 14px; margin: 0 0 14px; border-radius: 999px; background: #eef2ff; border: 1px solid #c7d2fe; color: #3730a3; font-weight: 600; font-size: .92rem; }

/* ============ 平滑滚动 & 返回顶部 ============ */
html { scroll-behavior: smooth; }
#back-top { position: fixed; bottom: 22px; right: 22px; width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #fff; border: none; font-size: 1.2rem; box-shadow: 0 6px 18px rgba(37,99,235,.4); cursor: pointer; z-index: 60; display: none; align-items: center; justify-content: center; transition: transform .15s, background .15s; }
#back-top:hover { background: var(--primary-dark); transform: translateY(-2px); }

/* ============ 轻提示 toast ============ */
#toast { position: fixed; bottom: 76px; left: 50%; transform: translateX(-50%) translateY(20px); background: rgba(17,24,39,.92); color: #fff; padding: 10px 20px; border-radius: 999px; font-size: .9rem; z-index: 120; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: 0 8px 24px rgba(0,0,0,.3); max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 相关知识点 chips ============ */
.rel-topics { margin-top: 12px; }
.rel-topics .rel-label { color: var(--muted); font-size: .8rem; margin-bottom: 6px; }
.rel-topics .rel-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rel-chip { background: #eff6ff; color: var(--primary-dark); border: 1px solid #bfdbfe; border-radius: 999px; padding: 6px 14px; font-size: .85rem; cursor: pointer; transition: background .15s; }
.rel-chip:hover { background: #dbeafe; }

/* ============ 掌握度徽标 ============ */
.mastery-pill { display: inline-block; font-size: .78rem; font-weight: 600; border-radius: 999px; padding: 2px 10px; margin-left: 6px; }
.mastery-new { background: #fee2e2; color: #b91c1c; }
.mastery-progress { background: #fef3c7; color: #b45309; }
.mastery-done { background: #dcfce7; color: #15803d; }

/* ============ 课程进度 chip ============ */
.c-progress { color: var(--muted); font-size: .8rem; margin-top: 8px; }
.c-progress .bar { height: 5px; border-radius: 999px; background: #eef2f7; margin-top: 4px; overflow: hidden; }
.c-progress .fill { height: 100%; background: linear-gradient(90deg, #2563eb, #7c3aed); border-radius: 999px; }

/* ============ 考试趋势图 ============ */
.trend-wrap { margin-top: 8px; display: flex; align-items: flex-end; gap: 6px; height: 90px; }
.trend-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.trend-bar .tb { width: 100%; max-width: 34px; background: linear-gradient(180deg, #60a5fa, #2563eb); border-radius: 4px 4px 0 0; min-height: 2px; transition: height .3s ease; position: relative; }
.trend-bar .tb:hover { filter: brightness(1.1); }
.trend-bar .tl { font-size: .68rem; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.trend-bar .tpct { font-size: .66rem; color: var(--primary-dark); font-weight: 700; margin-bottom: 2px; }

/* ============ 富文本排版（AI 回答 & 知识点讲解通用） ============ */
.rich-p { margin: 0 0 .6em; line-height: 1.85; }
.rich-h1 { font-size: 1.12rem; font-weight: 800; color: var(--primary-dark); margin: .7em 0 .35em; padding-left: 8px; border-left: 4px solid var(--primary); }
.rich-h2 { font-size: 1.02rem; font-weight: 700; color: var(--primary-dark); margin: .7em 0 .3em; }
.rich-h3 { font-size: .98rem; font-weight: 700; color: var(--ink); margin: .6em 0 .25em; }
.rich-h4 { font-size: .94rem; font-weight: 700; color: var(--ink); margin: .6em 0 .25em; }
.rich-list { margin: .35em 0 .7em; padding-left: 22px; }
.rich-list li { margin-bottom: .4em; line-height: 1.75; }
.rich-quote { border-left: 3px solid var(--green); background: #f0fdf4; padding: 8px 12px; border-radius: 0 8px 8px 0; color: #14532d; margin: .4em 0; line-height: 1.7; }
.rich-quote b, .rich-p b, .rich-list b, .rich-h1 b, .rich-h2 b { color: var(--primary-dark); }
.msg-assistant .rich-p:last-child, .msg-assistant .rich-list:last-child { margin-bottom: 0; }

/* 知识点讲解 sub-summary 可读性 */
.lesson-summary .rich-p { margin: 0 0 .5em; }
.lesson-summary .rich-h1 { margin: .6em 0 .3em; }
.lesson-summary .rich-list { margin: .3em 0 .6em; }
.lesson-more .rich-p { margin: 0 0 .5em; }
.rich-table { width: 100%; border-collapse: collapse; margin: .5em 0 .8em; font-size: .9rem; }
.rich-table th, .rich-table td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.rich-table th { background: #f0f6ff; font-weight: 700; color: var(--primary-dark); }
.rich-table td { background: #fff; }

/* ---- AI 问答：最新在上 ---- */
.ask-block { margin-bottom: 12px; }
.ask-block .msg-user { background: #eef2ff; }

/* ---- AI 回答快捷操作（重试/收藏/加入错题） ---- */
.ai-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }
.ai-actions button { background: #f8fafc; color: var(--primary-dark); border: 1px solid var(--border); font-size: .82rem; padding: 5px 12px; border-radius: 999px; }
.ai-actions button:hover { background: #eff6ff; border-color: #bfdbfe; }

/* ============ 移动端底部标签导航 ============ */
#bottom-nav { display: none; }
@media (max-width: 768px) {
  header nav:not(#bottom-nav) { display: none; }
  #bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: #fff; border-top: 1px solid var(--border); box-shadow: 0 -2px 12px rgba(0,0,0,.07); padding-bottom: env(safe-area-inset-bottom); }
  #bottom-nav .bnav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: none; color: var(--muted); font-size: 1.15rem; padding: 9px 2px 7px; border-radius: 0; }
  #bottom-nav .bnav-btn span { font-size: .72rem; font-weight: 600; }
  #bottom-nav .bnav-btn.active { color: var(--primary-dark); background: #eef2ff; }
  #bottom-nav .bnav-btn.active span { color: var(--primary-dark); }
  main { padding-bottom: 84px; }
  footer { display: none; }
}
.view-my { }
