/* ====== 主题变量 ====== */
:root {
  --bg: #1a1a2e;
  --bg-soft: #16213e;
  --card-bg: #1f2a44;
  --accent: #6c63ff;
  --accent-soft: rgba(108, 99, 255, 0.16);
  --cyan: #4ecdc4;
  --text: #e8e9f3;
  --text-dim: #9aa0c3;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(108, 99, 255, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(78, 205, 196, 0.06), transparent);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

/* ====== 吸顶头部容器（导航+标签+过滤，单一吸顶单元防缝隙） ====== */
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg); /* 完全不透明，滚动内容不会透出 */
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
}

/* ====== 顶部导航栏 ====== */
.navbar { border-bottom: 1px solid rgba(108, 99, 255, 0.25); }

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.brand-logo {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #8f7bff);
  box-shadow: 0 4px 14px rgba(108, 99, 255, 0.45);
}

.brand-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.search-box {
  flex: 1;
  max-width: 480px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid rgba(108, 99, 255, 0.35);
  color: var(--text-dim);
  transition: var(--transition);
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  color: var(--accent);
}

.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
}

.search-box input::placeholder { color: var(--text-dim); }
.search-box input::-webkit-search-cancel-button { cursor: pointer; }

.count-badge {
  flex-shrink: 0;
  min-width: 44px;
  text-align: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--cyan);
  background: rgba(78, 205, 196, 0.12);
  border: 1px solid rgba(78, 205, 196, 0.3);
}

.learned-badge { color: #b9f5cf; background: rgba(80, 200, 120, 0.12); border-color: rgba(80, 200, 120, 0.35); }

.sync-badge { font-size: 11.5px; padding: 6px 10px; }
.sync-badge.st-busy { color: var(--text-dim); background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.15); }
.sync-badge.st-pending { color: #ffd9a0; background: rgba(255, 167, 38, 0.1); border-color: rgba(255, 167, 38, 0.3); }
.sync-badge.st-offline { color: #ff9a9a; background: rgba(255, 107, 107, 0.1); border-color: rgba(255, 107, 107, 0.3); }

/* ====== 分类过滤栏 ====== */
.filter-bar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(22, 33, 62, 0.55);
}

.filter-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-inner::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: var(--text-dim);
  font-size: 13.5px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-1px);
}

.chip.active {
  background: linear-gradient(135deg, var(--accent), #8f7bff);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(108, 99, 255, 0.4);
}

.chip .num {
  opacity: 0.75;
  font-size: 12px;
  margin-left: 4px;
}

/* ====== 卡片网格 ====== */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

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

.card {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  animation: cardIn 0.4s ease backwards;
  content-visibility: auto;          /* 视口外的卡片跳过渲染，滚动更顺 */
  contain-intrinsic-size: auto 420px;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.card:hover {
  transform: translateY(-6px);
  border-color: rgba(108, 99, 255, 0.55);
  box-shadow: 0 14px 34px rgba(108, 99, 255, 0.28);
}

.card-img-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg-soft);
}

.card-learn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(22, 33, 62, 0.75);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
}

.card:hover .card-learn, .card-learn:focus-visible { opacity: 1; }
.card.learned .card-learn { opacity: 1; background: var(--cyan); border-color: var(--cyan); color: #0d2b2a; font-weight: 700; }
.card.learned { border-color: rgba(78, 205, 196, 0.45); }

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.card:hover .card-img-wrap img { transform: scale(1.06); }

.card-body { padding: 14px 16px 16px; }

.card-title {
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-desc {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-dim);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.learn-hint {
  font-size: 12px;
  color: var(--cyan);
  opacity: 0;
  transform: translateX(-4px);
  transition: var(--transition);
  white-space: nowrap;
}

.card:hover .learn-hint { opacity: 1; transform: translateX(0); }

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  color: #b9b3ff;
  background: var(--accent-soft);
  border: 1px solid rgba(108, 99, 255, 0.35);
}

/* ====== 空状态 ====== */
.empty { text-align: center; padding: 90px 0; color: var(--text-dim); }
.empty-icon { font-size: 46px; margin-bottom: 14px; }
.empty p { font-size: 17px; }
.empty-hint { font-size: 13.5px !important; margin-top: 8px; opacity: 0.7; }

/* ====== 模态框 ====== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 10, 22, 0.72);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.modal-backdrop[hidden] { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  position: relative;
  width: min(680px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid rgba(108, 99, 255, 0.35);
  border-radius: 20px;
  box-shadow: var(--shadow);
  animation: popIn 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.92) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(22, 33, 62, 0.85);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--accent);
  border-color: transparent;
  transform: rotate(90deg);
}

.modal-img-wrap {
  aspect-ratio: 16 / 9;
  background: var(--bg-soft);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.modal-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.modal-body { padding: 22px 26px 28px; }

.modal-body h2 {
  font-size: 22px;
  margin: 12px 0 6px;
  background: linear-gradient(90deg, #fff, #b9b3ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ----- 模态框学习内容分区 ----- */
.modal-section { margin-top: 20px; }

.section-title {
  font-size: 14px;
  color: #b9b3ff;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(108, 99, 255, 0.3);
}

.modal-section > p {
  font-size: 14.5px;
  line-height: 1.9;
  color: var(--text-dim);
}

.analogy-box {
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.14), rgba(78, 205, 196, 0.08));
  border: 1px solid rgba(108, 99, 255, 0.3);
}

.analogy-box p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
}

.problem-box {
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(78, 205, 196, 0.07);
  border-left: 3px solid var(--cyan);
}

.problem-box p {
  font-size: 14px;
  line-height: 1.85;
  color: var(--text);
}

/* 常见误区：警示琥珀色 */
.pitfall-list { list-style: none; display: grid; gap: 8px; }

.pitfall-list li {
  position: relative;
  padding: 8px 12px 8px 34px;
  font-size: 13.5px;
  line-height: 1.75;
  color: #ffd9a0;
  background: rgba(255, 167, 38, 0.07);
  border: 1px solid rgba(255, 167, 38, 0.22);
  border-radius: 10px;
}

.pitfall-list li::before {
  content: "✗";
  position: absolute;
  left: 12px;
  top: 8px;
  font-weight: 700;
  color: #ffa726;
}

/* 实际应用场景 */
.app-list { list-style: none; display: grid; gap: 8px; }

.app-list li {
  position: relative;
  padding-left: 22px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-dim);
}

.app-list li::before {
  content: "▸";
  position: absolute;
  left: 4px;
  color: var(--cyan);
  font-weight: 700;
}

/* 延伸学习 */
.extended-box { display: grid; gap: 12px; }

.extended-text {
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--text-dim);
}

.related-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.related-chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(108, 99, 255, 0.4);
  background: var(--accent-soft);
  color: #c9c4ff;
  font-size: 12.5px;
  cursor: pointer;
  transition: var(--transition);
}

.related-chip:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 99, 255, 0.4);
}

.points-list {
  list-style: none;
  display: grid;
  gap: 8px;
}

.points-list li {
  position: relative;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-dim);
}

.points-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.75em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
}

.example-box { display: grid; gap: 12px; }

.example-box .scenario {
  font-size: 14px;
  line-height: 1.9;
  color: var(--text-dim);
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(78, 205, 196, 0.07);
  border-left: 3px solid var(--cyan);
}

.code-block {
  position: relative;
  padding: 16px 18px;
  border-radius: 12px;
  background: #12121f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
}

.code-block code {
  font-family: "Cascadia Code", Consolas, "JetBrains Mono", monospace;
  font-size: 12.5px;
  line-height: 1.75;
  color: #d6e2ff;
  white-space: pre;
}

.lang-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #b9b3ff;
  background: var(--accent-soft);
  border: 1px solid rgba(108, 99, 255, 0.35);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ====== 视图切换标签 ====== */
.view-tabs { border-bottom: 1px solid rgba(108, 99, 255, 0.25); }

.view-tabs-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  gap: 8px;
}

.view-tab {
  padding: 8px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.view-tab:hover { color: var(--text); }

.view-tab.active {
  background: var(--accent-soft);
  border-color: rgba(108, 99, 255, 0.45);
  color: #c9c4ff;
  font-weight: 600;
}

/* ====== 教程列表 ====== */
.tutorial-list {
  display: grid;
  gap: 18px;
  max-width: 860px;
  margin: 0 auto;
}

.tutorial-card {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
  padding: 22px 26px;
  cursor: pointer;
  transition: var(--transition);
  animation: cardIn 0.4s ease backwards;
}

.tutorial-card:hover {
  transform: translateY(-4px);
  border-color: rgba(108, 99, 255, 0.55);
  box-shadow: 0 14px 34px rgba(108, 99, 255, 0.25);
}

.tc-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  color: #b9b3ff;
  background: var(--accent-soft);
  border: 1px solid rgba(108, 99, 255, 0.35);
  margin-bottom: 10px;
}

.tc-title { font-size: 19px; margin-bottom: 4px; }

.tc-sub {
  color: var(--cyan);
  font-size: 13.5px;
  margin-bottom: 12px;
}

.tc-intro {
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.8;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tc-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  padding-top: 12px;
}

.tc-go { margin-left: auto; color: var(--cyan); }

/* ====== 教程阅读器 ====== */
.reader-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(10, 10, 22, 0.8);
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: center;
  padding: 24px 16px;
  animation: fadeIn 0.2s ease;
}

.reader-backdrop[hidden] { display: none; }

.reader {
  position: relative;
  width: min(880px, 100%);
  background: var(--card-bg);
  border: 1px solid rgba(108, 99, 255, 0.35);
  border-radius: 20px;
  overflow-y: auto;
  padding: 40px 48px 60px;
  animation: popIn 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.reader-close {
  position: sticky;
  top: 0;
  float: right;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(22, 33, 62, 0.9);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  transition: var(--transition);
  z-index: 5;
}

.reader-close:hover {
  background: var(--accent);
  border-color: transparent;
  transform: rotate(90deg);
}

.reader-head h1 { font-size: 26px; margin: 6px 0 8px; }

.reader-sub {
  color: var(--cyan);
  font-size: 15px;
  margin-bottom: 8px;
}

.reader-meta {
  color: var(--text-dim);
  font-size: 12.5px;
  margin-bottom: 14px;
}

.reader-link {
  display: inline-block;
  font-size: 13px;
  color: #ffe08a;
  text-decoration: none;
  border: 1px solid rgba(255, 224, 138, 0.3);
  border-radius: 999px;
  padding: 4px 14px;
  margin-bottom: 6px;
  transition: var(--transition);
}

.reader-link:hover { background: rgba(255, 224, 138, 0.12); }

.reader-intro {
  color: var(--text-dim);
  font-size: 14.5px;
  line-height: 2;
  padding: 16px 20px;
  border-radius: 12px;
  background: rgba(108, 99, 255, 0.08);
  border-left: 3px solid var(--accent);
}

.reader-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 8px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}

.reader-toc a {
  font-size: 12.5px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: var(--transition);
}

.reader-toc a:hover {
  color: var(--cyan);
  border-color: var(--cyan);
}

.reader-section { margin-top: 34px; }

.reader-section h2 {
  font-size: 20px;
  padding-bottom: 10px;
  margin-bottom: 16px;
  border-bottom: 2px solid rgba(108, 99, 255, 0.35);
  background: linear-gradient(90deg, #fff, #b9b3ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ----- 内容块 ----- */
.tb-text {
  font-size: 14.5px;
  line-height: 2;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.tb-list, .tb-steps {
  margin: 0 0 16px 0;
  padding-left: 22px;
  display: grid;
  gap: 8px;
}

.tb-list li, .tb-steps li {
  font-size: 14px;
  line-height: 1.9;
  color: var(--text-dim);
}

.tb-list li::marker { color: var(--accent); }
.tb-steps li::marker { color: var(--cyan); font-weight: 700; }

.tb-callout {
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
  border: 1px solid;
}

.tb-callout strong { display: block; font-size: 14px; margin-bottom: 6px; }
.tb-callout p { font-size: 13.5px; line-height: 1.85; }

.tone-info {
  background: rgba(108, 99, 255, 0.1);
  border-color: rgba(108, 99, 255, 0.35);
}
.tone-info strong { color: #b9b3ff; }

.tone-tip {
  background: rgba(78, 205, 196, 0.08);
  border-color: rgba(78, 205, 196, 0.35);
}
.tone-tip strong { color: var(--cyan); }

.tone-warn {
  background: rgba(255, 167, 38, 0.08);
  border-color: rgba(255, 167, 38, 0.35);
}
.tone-warn strong { color: #ffa726; }
.tone-warn p { color: #ffd9a0; }

.tb-quote {
  border-radius: 12px;
  background: #12121f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid #ffe08a;
  padding: 16px 20px;
  margin: 0 0 16px;
}

.q-en {
  font-size: 13.5px;
  line-height: 1.8;
  color: #d6e2ff;
  font-style: italic;
  margin-bottom: 8px;
}

.q-zh {
  font-size: 13px;
  line-height: 1.85;
  color: var(--text-dim);
}

.tb-quote figcaption {
  font-size: 12px;
  color: #ffe08a;
  opacity: 0.8;
  margin-top: 6px;
}

.tb-formula {
  border-radius: 12px;
  background: #12121f;
  border: 1px solid rgba(108, 99, 255, 0.35);
  padding: 18px 20px;
  margin-bottom: 16px;
  text-align: center;
}

.f-name { font-size: 12.5px; color: #b9b3ff; margin-bottom: 10px; }

.f-expr {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 16px;
  color: #fff;
  line-height: 1.8;
  white-space: pre-wrap;
  margin-bottom: 10px;
}

.f-explain { font-size: 12.5px; color: var(--text-dim); }

.tb-diagram {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: #9fe8e0;
  background: #12121f;
  border: 1px solid rgba(78, 205, 196, 0.3);
  border-radius: 12px;
  padding: 18px 20px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.tb-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 13px;
}

.tb-table th {
  text-align: left;
  padding: 9px 12px;
  background: var(--accent-soft);
  color: #c9c4ff;
  border: 1px solid rgba(108, 99, 255, 0.25);
}

.tb-table td {
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  line-height: 1.7;
}

.tb-table tr:nth-child(even) td { background: rgba(255, 255, 255, 0.02); }

.tb-concepts {
  border-radius: 12px;
  background: rgba(108, 99, 255, 0.06);
  border: 1px dashed rgba(108, 99, 255, 0.35);
  padding: 14px 18px;
  margin-bottom: 8px;
}

.tc-lead { font-size: 13px; color: #b9b3ff; margin-bottom: 10px; }

/* ====== 模态框已学按钮 ====== */
.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.learn-toggle {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  transition: var(--transition);
}

.learn-toggle:hover { border-color: var(--cyan); color: var(--cyan); }
.learn-toggle.on {
  background: rgba(78, 205, 196, 0.15);
  border-color: var(--cyan);
  color: var(--cyan);
}

/* ====== 自测复习 ====== */
.review-view { max-width: 720px; margin: 0 auto; }

.review-stats { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }

.stat-chip {
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.stat-chip.c-cyan { color: var(--cyan); background: rgba(78, 205, 196, 0.1); border: 1px solid rgba(78, 205, 196, 0.3); }
.stat-chip.c-amber { color: #ffd9a0; background: rgba(255, 167, 38, 0.1); border: 1px solid rgba(255, 167, 38, 0.3); }

.review-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--text-dim);
}

.rv-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.rv-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  transition: width 0.3s ease;
}

.flashcard {
  background: var(--card-bg);
  border: 1px solid rgba(108, 99, 255, 0.4);
  border-radius: 20px;
  padding: 40px 44px 36px;
  text-align: center;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  animation: popIn 0.25s ease;
  min-height: 340px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.fc-tag { font-size: 12.5px; color: #b9b3ff; }

.fc-name {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(90deg, #fff, #b9b3ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.fc-hint { font-size: 13px; color: var(--text-dim); margin-bottom: 10px; }

.fc-summary {
  font-size: 17px;
  font-weight: 700;
  color: #ffe08a;
  line-height: 1.8;
}

.fc-desc { font-size: 14px; line-height: 2; color: var(--text-dim); text-align: left; }

.fc-points {
  list-style: none;
  display: grid;
  gap: 6px;
  text-align: left;
  margin-bottom: 6px;
}

.fc-points li {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-dim);
  padding-left: 18px;
  position: relative;
}

.fc-points li::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: var(--cyan);
}

.rv-btn {
  padding: 11px 26px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 14.5px;
  cursor: pointer;
  transition: var(--transition);
  align-self: center;
}

.rv-btn.primary {
  background: linear-gradient(135deg, var(--accent), #8f7bff);
  color: #fff;
  box-shadow: 0 6px 18px rgba(108, 99, 255, 0.4);
}
.rv-btn.primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(108, 99, 255, 0.5); }

.rv-btn.danger {
  background: rgba(255, 107, 107, 0.12);
  border-color: rgba(255, 107, 107, 0.4);
  color: #ff9a9a;
}
.rv-btn.danger:hover { background: rgba(255, 107, 107, 0.22); }

.rv-btn.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-dim);
}
.rv-btn.ghost:hover { color: var(--text); }

.rv-link {
  background: none;
  border: none;
  color: var(--cyan);
  font-size: 13px;
  cursor: pointer;
  align-self: center;
  padding: 4px;
}
.rv-link:hover { text-decoration: underline; }

.rv-grades {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 6px;
  flex-wrap: wrap;
}

.review-done {
  background: var(--card-bg);
  border: 1px solid rgba(108, 99, 255, 0.3);
  border-radius: 20px;
  padding: 50px 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.rd-icon { font-size: 52px; }
.rd-title { font-size: 22px; font-weight: 700; }
.rd-sub { font-size: 14px; color: var(--text-dim); }
.rd-tip { font-size: 12px; color: var(--text-dim); opacity: 0.7; margin-top: 8px; }

/* ====== 学习统计看板 ====== */
.stats-host {
  background: var(--card-bg);
  border: 1px solid rgba(108, 99, 255, 0.3);
  border-radius: 20px;
  padding: 24px 28px;
  margin-bottom: 18px;
}

.stats-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}
.stats-head strong { font-size: 16px; }
.stats-sub { font-size: 12.5px; color: var(--text-dim); }

.heatmap {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 14px;
}

.hm-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: #24284a;
  min-width: 10px;
}
.hm-cell.lv1 { background: rgba(78, 205, 196, 0.35); }
.hm-cell.lv2 { background: rgba(78, 205, 196, 0.6); }
.hm-cell.lv3 { background: var(--cyan); }
.hm-cell.lv4 { background: var(--accent); }
.hm-cell.box0 { background: #24284a; }
.hm-cell.box1 { background: rgba(78, 205, 196, 0.3); }
.hm-cell.box2 { background: rgba(78, 205, 196, 0.55); }
.hm-cell.box3 { background: var(--cyan); }
.hm-cell.box4 { background: rgba(108, 99, 255, 0.6); }
.hm-cell.box5 { background: var(--accent); }

.stats-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
}
.stats-legend .hm-cell { width: 12px; flex: none; }
.stats-legend .lg-gap { margin: 0 8px; opacity: 0.4; }

.mastery { display: grid; gap: 8px; margin-bottom: 14px; }

.mastery-row {
  display: grid;
  grid-template-columns: 118px 1fr 52px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.mastery-cat {
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mastery-num { text-align: right; color: var(--text-dim); }

.mastery-bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #24284a;
}
.mastery-seg { height: 100%; }
.mastery-seg.box1 { background: rgba(78, 205, 196, 0.3); }
.mastery-seg.box2 { background: rgba(78, 205, 196, 0.55); }
.mastery-seg.box3 { background: var(--cyan); }
.mastery-seg.box4 { background: rgba(108, 99, 255, 0.6); }
.mastery-seg.box5 { background: var(--accent); }

.rv-tools { display: flex; gap: 10px; justify-content: center; margin-top: 6px; }
.rv-file { display: none; }

/* 响应式 */
@media (max-width: 640px) {
  .reader { padding: 26px 20px 40px; }
  .view-tabs-inner { padding: 8px 12px; gap: 6px; }
  .view-tab { padding: 7px 12px; font-size: 13px; }
  .tb-table { font-size: 11.5px; }
  .tb-table th, .tb-table td { padding: 6px 8px; }
}

.footer code {
  color: var(--cyan);
  background: rgba(78, 205, 196, 0.1);
  padding: 2px 6px;
  border-radius: 6px;
}

/* ====== 响应式 ====== */
@media (max-width: 640px) {
  .nav-inner { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .search-box { order: 3; max-width: none; flex-basis: 100%; }
  .count-badge { margin-left: auto; }
  .brand-text { font-size: 16px; }
  .filter-inner { padding: 10px 16px; }
  .main { padding: 20px 16px 50px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
}
