/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* 亮色模式配色 */
  --primary: #1a365d;
  --primary-light: #2a4a7f;
  --accent: #ebf4ff;
  --accent-hover: #bee3f8;
  --bg: #f7fafc;
  --bg-card: #ffffff;
  --text: #333;
  --text-muted: #6b7280;
  --border: #e2e8f0;
  --sidebar-bg: linear-gradient(180deg, #1a365d, #2a4365);
  --highlight-bg: #fefcbf;
  --toggle-bg: rgba(0,0,0,.06);
  --math-inline-bg: #f0f5ff;
  --math-inline-color: #2b6cb0;
  --math-block-bg: #ebf8ff;
  --math-block-border: #4299e1;
  --math-shadow: rgba(0,0,0,.08);
  --h1-color: #1a365d;
  --h2-color: #2b6cb0;
  --corollary-bg: #f0fff4;
  --corollary-border: #48bb78;
  --corollary-label-bg: #48bb78;
  --example-border: #4299e1;
  --example-label-bg: #4299e1;
  --card-shadow: 0 2px 8px rgba(0,0,0,.06);
  --sidebar-w: 260px;
  --font-cn: "LXGW WenKai", "Noto Serif SC", "Source Han Serif SC", "思源宋体", Georgia, serif, system-ui;
  --font-en: Georgia, "Times New Roman", serif;
  --font-mono: "Fira Code", "JetBrains Mono", monospace;
}

/* 暗色模式配色 */
body.dark, [data-theme="dark"] {
  --primary: #90cdf4;
  --primary-light: #a0d2f0;
  --accent: #2d3748;
  --accent-hover: #4a5568;
  --bg: #1a202c;
  --bg-card: #2d3748;
  --text: #d4d4d8;
  --text-muted: #a1a1aa;
  --border: #4a5568;
  --sidebar-bg: linear-gradient(180deg, #171923, #1a202c);
  --highlight-bg: #b794f4;
  --toggle-bg: rgba(255,255,255,.1);
  --math-inline-bg: #1a2744;
  --math-inline-color: #90cdf4;
  --math-block-bg: #1a2744;
  --math-block-border: #63b3ed;
  --math-shadow: rgba(0,0,0,.3);
  --h1-color: #90cdf4;
  --h2-color: #90cdf4;
  --corollary-bg: #1a2744;
  --corollary-border: #48bb78;
  --corollary-label-bg: #48bb78;
  --example-border: #63b3ed;
  --example-label-bg: #4299e1;
  --card-shadow: 0 2px 8px rgba(0,0,0,.25);
}

html { scroll-behavior: smooth; }

/* ===== 顶部渐变装饰条 ===== */
.top-gradient-bar {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #4299e1, #667eea, #9f7aea, #ed64a6);
  z-index: 400;
}

body {
  font-family: var(--font-cn);
  font-size: 16px;
  line-height: 1.9;
  color: var(--text);
  background: var(--bg);
  transition: color .3s, background .3s;
}

/* ===== 暗色模式切换按钮 ===== */
.dark-toggle {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 300;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--toggle-bg);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .3s, border-color .3s;
}
.dark-toggle:hover { background: var(--accent-hover); }

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  color: #fff;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  overflow-y: auto;
  z-index: 100;
  transition: transform .3s ease, background .3s;
}

.sidebar-header {
  padding: 24px 20px 12px;
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.sidebar-header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .5px;
}
.sidebar-subtitle {
  font-size: 13px;
  opacity: .7;
}

/* ===== 搜索框 ===== */
.search-box {
  padding: 10px 16px 6px;
}
.search-box input {
  width: 100%;
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.1);
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color .2s, background .2s;
}
.search-box input::placeholder { color: rgba(255,255,255,.5); }
.search-box input:focus {
  border-color: #63b3ed;
  background: rgba(255,255,255,.15);
}

/* ===== 学习进度条 ===== */
.progress-bar-container {
  padding: 8px 16px 4px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.progress-text {
  font-size: 12px;
  color: rgba(255,255,255,.7);
  margin-bottom: 5px;
}
.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,.15);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #48bb78, #4299e1);
  border-radius: 3px;
  transition: width .5s ease;
}

/* ===== TOC 树 ===== */
.toc { padding: 10px 0; }

/* 侧边栏章节标题（带折叠箭头 + 复选框） */
.toc-chapter {
  display: flex;
  align-items: center;
  padding: 8px 12px 8px 16px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,.9);
  cursor: pointer;
  transition: background .15s;
  border-left: 3px solid transparent;
  user-select: none;
}
.toc-chapter:hover { background: rgba(255,255,255,.15); }
.toc-chapter.active { background: rgba(255,255,255,.15); border-left-color: #63b3ed; }

.toc-arrow {
  display: inline-block;
  width: 16px;
  font-size: 10px;
  transition: transform .2s;
  flex-shrink: 0;
  text-align: center;
}
.toc-arrow.open { transform: rotate(90deg); }

.toc-chapter-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 侧边栏小节 */
.toc-section {
  display: flex;
  align-items: center;
  padding: 5px 12px 5px 36px;
  font-size: 13px;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.toc-section:hover { background: rgba(255,255,255,.08); color: #fff; }
.toc-section.active { color: #63b3ed; border-left-color: #63b3ed; }
/* 本章例题入口 */
.toc-examples {
  color: #fbd38d;
  font-weight: 600;
  border-left-color: transparent;
  margin-top: 2px;
}
.toc-examples:hover {
  background: rgba(251,211,141,.15);
  color: #f6e05e;
}
.toc-examples.active {
  color: #f6e05e;
  border-left-color: #ecc94b;
  background: rgba(251,211,141,.12);
}
/* 搜索时隐藏的项 */
.toc-section.hidden-by-search, .toc-chapter.hidden-by-search { display: none; }

.toc-section-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 侧边栏复选框 */
.toc-check {
  width: 16px;
  height: 16px;
  margin-left: 6px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #48bb78;
}

/* 侧边栏练习入口 */
.toc-practice {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  margin: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.85);
  cursor: pointer;
  border-radius: 6px;
  border-left: 3px solid transparent;
  background: rgba(72,187,120,.15);
  transition: background .15s, border-color .15s;
}
.toc-practice:hover { background: rgba(72,187,120,.25); }
.toc-practice.active { border-left-color: #48bb78; background: rgba(72,187,120,.25); }

/* ===== 侧边栏遮罩 ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}

/* ===== 汉堡菜单 ===== */
.hamburger {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 200;
  width: 40px; height: 40px;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.hamburger span {
  display: block;
  width: 20px; height: 2px;
  background: #fff;
  border-radius: 1px;
  transition: transform .3s, opacity .3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== Main ===== */
.main {
  margin-left: var(--sidebar-w);
  padding: 32px 40px 60px;
  max-width: calc(800px + var(--sidebar-w));
  transition: background .3s;
}

/* ===== 章节与例题分隔线 ===== */
.chapter-examples-sep {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border) 20%, var(--border) 80%, transparent);
  margin: 24px 0;
}

/* ===== 章节折叠容器 ===== */
.chapter-group { margin-bottom: 8px; }

.chapter-heading {
  font-size: 1.8em;
  font-weight: 700;
  color: var(--h1-color);
  margin: 2em 0 0.8em;
  padding: 10px 0 8px;
  border-bottom: none;
  position: relative;
  scroll-margin-top: 70px;
  cursor: pointer;
  user-select: none;
  transition: color .3s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.chapter-heading::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 60px; height: 2px;
  background: linear-gradient(90deg, #4299e1, transparent);
}
.chapter-heading:hover { opacity: .85; }

.chapter-toggle-icon {
  font-size: 14px;
  transition: transform .3s;
  flex-shrink: 0;
}
.chapter-heading.collapsed .chapter-toggle-icon { transform: rotate(-90deg); }

.chapter-count {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  transition: color .3s;
}

/* 章节内容区（折叠动画） */
.chapter-sections {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows .35s ease;
}
.chapter-sections.collapsed {
  grid-template-rows: 0fr;
}
.chapter-sections-inner {
  overflow: hidden;
}

/* ===== 内容卡片 ===== */
.section-block, .example-card, .corollary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px 28px;
  margin-bottom: 20px;
  margin-top: 16px;
  scroll-margin-top: 70px;
  word-break: break-word;
  box-shadow: var(--card-shadow);
  transition: background .3s, border-color .3s, box-shadow .3s;
}

.section-block h2 {
  font-size: 1.4em;
  font-weight: 600;
  color: var(--h2-color);
  margin: 1.8em 0 0.6em;
  padding-bottom: 8px;
  padding-left: 12px;
  border-bottom: none;
  border-left: 3px solid #4299e1;
  transition: color .3s;
}
.section-block h3 {
  font-size: 1.15em;
  font-weight: 600;
  color: var(--primary-light);
  margin: 1.5em 0 0.5em;
  transition: color .3s;
}

/* 例题卡片 */
.example-card {
  border-left: 4px solid var(--example-border);
}
.example-card .example-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  transition: color .3s;
}
.example-card .example-chapter {
  font-size: 12px;
  color: #fff;
  margin-bottom: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--example-label-bg);
  width: 28px; height: 28px;
  border-radius: 50%;
  padding: 0;
  transition: background .3s;
}
.example-card .problem-label, .example-card .solution-label {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  transition: color .3s;
}

/* ===== 解答/推论 折叠 ===== */
.toggle-solution-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #4299e1, #667eea);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}
.toggle-solution-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(66,153,225,.4);
}

.solution-wrapper, .corollary-content-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .35s ease;
}
.solution-wrapper.open, .corollary-content-wrapper.open {
  grid-template-rows: 1fr;
}
.solution-inner, .corollary-content-inner {
  overflow: hidden;
}

/* 推论卡片 */
.corollary-card {
  border-left: 4px solid var(--corollary-border);
  background: var(--corollary-bg);
}
.corollary-card .corollary-parent {
  font-size: 12px;
  color: #fff;
  margin-bottom: 8px;
  display: inline-block;
  background: var(--corollary-label-bg);
  padding: 2px 10px;
  border-radius: 4px;
  transition: background .3s;
}
.corollary-card .corollary-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary-light);
  margin-bottom: 10px;
  transition: color .3s;
}

/* ===== 内容排版 ===== */
.section-block p, .example-card p, .corollary-card p {
  margin-bottom: 1.2em;
  text-indent: 2em;
}
/* 标题后的第一个段落不缩进 */
.section-block h2 + p, .section-block h3 + p,
.example-card .problem-label + p, .example-card .solution-label + p,
.corollary-card .corollary-title + p,
.section-block h2 + div p:first-child,
.section-block h3 + div p:first-child {
  text-indent: 0;
}
.section-block ul, .section-block ol,
.example-card ul, .example-card ol {
  margin: 0.5em 0 1em 2em;
}
.section-block li, .example-card li {
  margin-bottom: 0.5em;
}
/* 列表内的段落不缩进 */
.section-block li p, .example-card li p {
  text-indent: 0;
  margin-bottom: 0.3em;
}
/* 包含块级公式的段落不干扰居中 */
p:has(> mjx-container[display]) {
  text-indent: 0;
  text-align: center;
}
.section-block table, .example-card table {
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
}
/* 内容中的代码/等宽字体 */
.section-block code, .example-card code, .corollary-card code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--accent);
  padding: 1px 5px;
  border-radius: 3px;
  transition: background .3s;
}
/* 粗体在衬线体下加粗效果更明显 */
.section-block strong, .example-card strong {
  font-weight: 700;
}
.section-block th, .section-block td,
.example-card th, .example-card td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: center;
  transition: border-color .3s;
}
.section-block th, .example-card th {
  background: var(--accent);
  font-weight: 600;
  transition: background .3s;
}

/* ===== 动态图表容器 ===== */

/* ===== 讲义图片 ===== */
.lecture-image {
  text-align: center;
  margin: 20px 0;
}
.lecture-image img {
  max-width: 85%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: box-shadow .3s;
}
.image-caption {
  text-align: center;
  font-size: 13px;
  color: #718096;
  margin-top: 6px;
}
[data-theme="dark"] .lecture-image img {
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* 重点图片 */
.lecture-image.essential {
  text-align: center;
  margin: 20px 0;
}
.lecture-image.essential img {
  max-width: 70%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ===== 推导按钮 ===== */
.derivation-toggle {
  margin: 12px 0;
}
.show-derivation-btn {
  padding: 6px 16px;
  background: linear-gradient(135deg, #ed8936, #dd6b20);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  transition: transform .2s, box-shadow .2s;
}
.show-derivation-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(237,137,54,0.3);
}
.derivation-content {
  display: none;
  margin-top: 12px;
  text-align: center;
}
.derivation-content img {
  max-width: 90%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.derivation-content.show {
  display: block;
}

/* ===== MathJax 公式样式 ===== */

/* 行内公式（$...$） */
mjx-container:not([display]) {
  margin-left: 2px;
  margin-right: 2px;
  font-size: 1em;
  color: var(--math-inline-color);
  transition: color .3s;
}

/* 块级公式（$$...$$） */
mjx-container[display],
mjx-container[display="true"] {
  display: block !important;
  width: fit-content;
  margin: 1.2em auto !important;
  text-align: center !important;
  font-size: 1.05em;
  color: var(--math-inline-color);
  background: var(--math-block-bg);
  border-left: 3px solid var(--math-block-border);
  border-radius: 6px;
  padding: 12px 20px;
  box-shadow: 0 1px 3px var(--math-shadow);
  overflow-x: auto;
  transition: color .3s, background .3s, border-color .3s, box-shadow .3s;
}

/* ===== 搜索高亮 ===== */
mark.search-hl {
  background: #fefcbf;
  color: inherit;
  padding: 1px 2px;
  border-radius: 2px;
}
body.dark mark.search-hl, [data-theme="dark"] mark.search-hl {
  background: #b794f4;
  color: #1a202c;
}

/* 内容区搜索隐藏 */
.hidden-by-search { display: none !important; }

/* ===== 练习模式（游戏化风格） ===== */

.practice-panel {
  max-width: 600px;
  margin: 0 auto;
}

/* 顶部栏 */
.practice-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.practice-exit-btn {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s;
}
.practice-exit-btn:hover { color: var(--primary); border-color: var(--primary); }

/* 章节筛选 */
.practice-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.practice-filter-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: all .2s;
}
.practice-filter-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #4299e1, #667eea);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(66,153,225,.3);
}
.practice-filter-btn:hover:not(.active) { color: var(--primary); border-color: var(--primary); }

/* ---- 统计面板 ---- */
.practice-stats {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--card-shadow);
  transition: background .3s, border-color .3s;
}

/* 环形进度条 */
.practice-ring {
  position: relative;
  width: 80px; height: 80px;
  flex-shrink: 0;
}
.practice-ring svg {
  transform: rotate(-90deg);
}
.practice-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
}
.practice-ring-fill {
  fill: none;
  stroke: url(#ring-gradient);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset .6s ease;
}
.practice-ring-text {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}
/* 金徽章 (>80%) */
.practice-ring.gold .practice-ring-fill { stroke: url(#ring-gold); }
.practice-ring.gold .practice-ring-text { color: #d69e2e; }

/* 彩色徽章 */
.practice-badges {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.practice-badge-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}
.practice-badge-item.badge-mastered { background: linear-gradient(135deg, #48bb78, #38a169); }
.practice-badge-item.badge-partial  { background: linear-gradient(135deg, #ecc94b, #d69e2e); }
.practice-badge-item.badge-notyet   { background: linear-gradient(135deg, #fc8181, #f56565); }
.practice-badge-num {
  font-size: 18px;
  font-weight: 700;
}

/* ---- 练习题卡片 ---- */
.practice-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  animation: slideUp .35s ease;
  transition: background .3s, border-color .3s;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

.practice-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.practice-card-number {
  display: inline-block;
  padding: 4px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #4299e1, #667eea);
  border-radius: 20px;
  letter-spacing: .5px;
}
.practice-card-chapter {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--accent);
  padding: 3px 10px;
  border-radius: 12px;
  transition: background .3s, color .3s;
}
.practice-problem {
  font-size: 18px;
  line-height: 2;
  margin-bottom: 24px;
  color: var(--text);
}
.practice-problem .problem-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* ---- 查看答案按钮 ---- */
.practice-reveal-btn {
  display: block;
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, #4299e1, #667eea);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  letter-spacing: .5px;
}
.practice-reveal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(66,153,225,.4);
}

/* ---- 答案区域 ---- */
.practice-answer {
  border-top: 2px dashed var(--border);
  padding-top: 24px;
  margin-top: 20px;
  background: rgba(66,153,225,.03);
  border-radius: 0 0 12px 12px;
  padding: 24px;
  margin-left: -32px;
  margin-right: -32px;
  margin-bottom: -32px;
  padding-bottom: 32px;
  animation: fadeIn .3s ease;
  transition: background .3s, border-color .3s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.practice-solution-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.practice-answer-content {
  line-height: 2;
  color: var(--text);
}
.practice-corollary {
  margin-top: 16px;
  padding: 14px 18px;
  background: var(--corollary-bg);
  border-left: 4px solid var(--corollary-border);
  border-radius: 0 8px 8px 0;
  transition: background .3s, border-color .3s;
}
.practice-corollary-title {
  font-size: 14px;
  font-weight: 700;
  color: #38a169;
  margin-bottom: 6px;
  transition: color .3s;
}

/* ---- 自评按钮 ---- */
.practice-rating {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}
.practice-rating-btn {
  flex: 1;
  padding: 12px 8px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  letter-spacing: .3px;
}
.practice-rating-btn:hover {
  transform: scale(1.05);
}
.practice-rating-btn.rate-mastered {
  color: #fff;
  background: linear-gradient(135deg, #48bb78, #38a169);
}
.practice-rating-btn.rate-mastered:hover { box-shadow: 0 4px 16px rgba(72,187,120,.4); }
.practice-rating-btn.rate-partial {
  color: #fff;
  background: linear-gradient(135deg, #ecc94b, #d69e2e);
}
.practice-rating-btn.rate-partial:hover { box-shadow: 0 4px 16px rgba(214,158,46,.4); }
.practice-rating-btn.rate-notyet {
  color: #fff;
  background: linear-gradient(135deg, #fc8181, #e53e3e);
}
.practice-rating-btn.rate-notyet:hover { box-shadow: 0 4px 16px rgba(229,62,62,.4); }

/* ---- 练习完成 ---- */
.practice-done {
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  position: relative;
  overflow: hidden;
  animation: slideUp .4s ease;
}
.practice-done h3 {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}
.practice-done p {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 24px;
  line-height: 1.8;
}
.practice-done-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.practice-restart-btn {
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}
.practice-restart-btn.primary {
  background: linear-gradient(135deg, #4299e1, #667eea);
}
.practice-restart-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(66,153,225,.4);
}
.practice-restart-btn.secondary {
  background: linear-gradient(135deg, #48bb78, #38a169);
}
.practice-restart-btn.secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(72,187,120,.4);
}
.practice-restart-btn.back {
  background: var(--border);
  color: var(--text-muted);
}
.practice-restart-btn.back:hover {
  transform: translateY(-2px);
  background: var(--text-muted);
  color: #fff;
}

/* 金徽章 */
.gold-badge {
  display: inline-block;
  font-size: 48px;
  margin-bottom: 12px;
  animation: bounce 1s ease infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* 彩带动画 */
@keyframes confetti-fall {
  0%   { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(120px) rotate(720deg); opacity: 0; }
}
.confetti {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 1px;
  animation: confetti-fall 2s ease-in forwards;
}

/* 例题列表中已练习标记 */
.example-card .practice-badge {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-left: 8px;
  vertical-align: middle;
}
.practice-badge.mastered { background: #48bb78; }
.practice-badge.partial  { background: #ecc94b; }
.practice-badge.notyet   { background: #fc8181; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .hamburger { display: flex; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main { margin-left: 0; padding: 60px 20px 40px; }
  .tabs { overflow-x: auto; }
  .tab { padding: 10px 16px; font-size: 14px; white-space: nowrap; }
  .dark-toggle { top: 12px; right: 60px; }
}
