/* ============================================================
   kome 视频学习库 — 全局样式
   风格：现代知识管理平台（Notion 风）
   ============================================================ */

:root {
  --bg: #f6f7f9;
  --bg-soft: #eef0f4;
  --card: #ffffff;
  --card-2: #fafbfd;
  --border: #e5e8ef;
  --border-strong: #d5dae4;
  --text: #1c2333;
  --text-2: #5a6478;
  --text-3: #8a93a8;
  --accent: #4f6ef7;
  --accent-2: #7c8cf8;
  --accent-soft: rgba(79, 110, 247, 0.10);
  --accent-softer: rgba(79, 110, 247, 0.06);
  --green: #12b76a;
  --green-soft: rgba(18, 183, 106, 0.12);
  --red: #f04438;
  --red-soft: rgba(240, 68, 56, 0.12);
  --amber: #f79009;
  --amber-soft: rgba(247, 144, 9, 0.14);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 6px 24px -8px rgba(16, 24, 40, .12);
  --shadow-lg: 0 16px 48px -12px rgba(16, 24, 40, .18);
  --radius: 14px;
  --radius-sm: 9px;
  --nav-h: 60px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0e1116;
  --bg-soft: #151a23;
  --card: #151a23;
  --card-2: #12161e;
  --border: #262d3a;
  --border-strong: #333c4d;
  --text: #e8ebf2;
  --text-2: #9aa4b8;
  --text-3: #667085;
  --accent: #7c8cf8;
  --accent-2: #9aa7ff;
  --accent-soft: rgba(124, 140, 248, 0.16);
  --accent-softer: rgba(124, 140, 248, 0.08);
  --green: #2fd48a;
  --green-soft: rgba(47, 212, 138, 0.16);
  --red: #ff6b5e;
  --red-soft: rgba(255, 107, 94, 0.16);
  --amber: #ffb020;
  --amber-soft: rgba(255, 176, 32, 0.18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 6px 24px -8px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 48px -12px rgba(0, 0, 0, .55);
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}

::selection { background: var(--accent-soft); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: var(--font); cursor: pointer; }

img, svg { display: block; }

/* 图标兜底：无专用尺寸规则的图标默认 1em（约 15px），防止异常放大 */
svg { width: 1em; height: 1em; }
.no-case svg { width: 15px; height: 15px; }

/* ---------- 顶部导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1180px; margin: 0 auto; height: 100%;
  padding: 0 24px;
  display: flex; align-items: center; gap: 16px;
}
.nav-logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 16px; }
.nav-logo:hover { text-decoration: none; }
.nav-logo img { width: 28px; height: 28px; border-radius: 8px; }
.nav-logo .nav-sub { color: var(--text-3); font-weight: 500; font-size: 13px; margin-left: 2px; }
.nav-spacer { flex: 1; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card);
  color: var(--text-2); transition: all .18s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .badge-dot { position: relative; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 13.5px; font-weight: 600;
  transition: all .18s; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); color: #fff; }
.btn-danger { color: var(--red); border-color: var(--red); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }

/* ---------- 首页 ---------- */
.home-main { max-width: 1180px; margin: 0 auto; padding: 32px 24px 72px; }

.hero {
  background: linear-gradient(135deg, var(--accent-softer), var(--card) 55%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 40px 34px;
  margin-bottom: 28px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -80px; top: -80px;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  pointer-events: none;
}
.hero h1 { font-size: 30px; line-height: 1.25; letter-spacing: -.5px; }
.hero h1 .grad {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--text-2); margin-top: 10px; max-width: 640px; font-size: 15px; }
.hero-stats { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 18px; display: flex; flex-direction: column; min-width: 108px;
}
.stat b { font-size: 20px; color: var(--text); }
.stat span { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.toolbar { display: flex; align-items: center; gap: 12px; margin: 26px 0 18px; flex-wrap: wrap; }
.search-box {
  flex: 1; min-width: 240px; display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 9px 14px; transition: border-color .2s, box-shadow .2s;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box svg { width: 17px; height: 17px; color: var(--text-3); flex: none; }
.search-box input { flex: 1; border: none; outline: none; background: transparent; color: var(--text); font-size: 14px; font-family: var(--font); }
.search-box input::placeholder { color: var(--text-3); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); color: var(--text-2); font-size: 13px; font-weight: 500;
  transition: all .16s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.course-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}
.course-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.cc-thumb { height: 86px; position: relative; padding: 16px 18px; display: flex; align-items: flex-start; justify-content: space-between; }
.cc-thumb .cc-tag { color: #fff; font-size: 12px; font-weight: 600; opacity: .95; letter-spacing: .3px; }
.cc-thumb .cc-fav { color: #fff; opacity: .9; transition: transform .2s; }
.cc-thumb .cc-fav:hover { transform: scale(1.15); }
.cc-thumb .cc-fav svg { width: 18px; height: 18px; }
.cc-thumb .cc-fav.on svg { fill: #fff; }
.cc-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.cc-body h3 { font-size: 16.5px; line-height: 1.4; color: var(--text); }
.cc-body p { font-size: 13.5px; color: var(--text-2); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }
.cc-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }
.cc-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-tag { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: var(--bg-soft); color: var(--text-2); font-weight: 500; }
.mini-tag.lv { background: var(--accent-soft); color: var(--accent); }

.cc-progress { margin-top: auto; }
.progress-track { height: 5px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s; }
.cc-progress-row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.status-badge { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.status-badge.done { background: var(--green-soft); color: var(--green); }
.status-badge.learning { background: var(--amber-soft); color: var(--amber); }
.status-badge.new { background: var(--bg-soft); color: var(--text-3); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty-state svg { width: 34px; height: 34px; margin: 0 auto 12px; opacity: .5; }

/* ---------- 课程页 ---------- */
.course-main { max-width: 1120px; margin: 0 auto; padding: 24px 24px 80px; }

.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); margin-bottom: 14px; }
.crumb a { color: var(--text-2); }
.crumb a:hover { color: var(--accent); text-decoration: none; }
.crumb svg { width: 13px; height: 13px; }

.hero-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  padding: 28px 30px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.hero-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.hero-card h1 { font-size: 26px; line-height: 1.35; letter-spacing: -.4px; padding-right: 60px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hero-meta .mini-tag { font-size: 12px; padding: 3px 11px; }
.hero-meta .src { font-family: var(--mono); font-size: 11.5px; background: var(--bg-soft); }
.hero-actions { position: absolute; top: 24px; right: 26px; display: flex; gap: 8px; }
.hero-progress { margin-top: 18px; max-width: 420px; }
.hero-progress .progress-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.hero-progress b { color: var(--accent); }

/* 顶部横向章节导航条（sticky） */
.course-subnav {
  position: sticky; top: var(--nav-h); z-index: 60;
  display: flex; gap: 4px; overflow-x: auto;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 8px 24px; margin: 0 -24px 24px;
  scrollbar-width: none;
}
.course-subnav::-webkit-scrollbar { display: none; }
.course-subnav a {
  flex: none; padding: 6px 13px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--text-2);
  border: 1px solid transparent; transition: all .16s; white-space: nowrap;
}
.course-subnav a:hover { color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.course-subnav a.active { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-soft); }

/* 章节工具（全部展开 / 折叠） */
.chapter-tools { display: flex; gap: 8px; margin-bottom: 12px; }
.chapter-tools .btn svg { width: 14px; height: 14px; }

/* 上一门 / 下一门 */
.course-pager { display: flex; gap: 12px; margin-top: 26px; align-items: stretch; }
.pager-item {
  flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px;
  padding: 13px 18px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--card); color: var(--text-3); font-size: 12px;
  transition: all .18s;
}
.pager-item b {
  color: var(--text); font-size: 13.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pager-item:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.pager-item:hover b { color: var(--accent); }
.pager-next { text-align: right; align-items: flex-end; }
.pager-home { flex: 0 0 auto; justify-content: center; align-items: center; gap: 6px; flex-direction: row; font-size: 13px; font-weight: 600; color: var(--text-2); }
.pager-home svg { width: 15px; height: 15px; }
.pager-disabled { visibility: hidden; }

/* 返回顶部 */
.back-top {
  position: fixed; right: 22px; bottom: 24px; z-index: 90;
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--card); color: var(--text-2);
  box-shadow: var(--shadow-md); display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transform: translateY(10px); transition: all .25s;
}
.back-top svg { width: 18px; height: 18px; }
.back-top.show { opacity: 1; pointer-events: auto; transform: none; }
.back-top:hover { color: var(--accent); border-color: var(--accent); }

/* 密码门 */
.gate {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
              var(--bg);
  transition: opacity .25s;
}
.gate.ok { opacity: 0; }
.gate-card {
  width: 100%; max-width: 380px; background: var(--card);
  border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 34px 30px 30px; text-align: center;
}
.gate-card img { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 14px; }
.gate-card h1 { font-size: 20px; letter-spacing: -.3px; }
.gate-card > p { color: var(--text-3); font-size: 13.5px; margin: 8px 0 20px; }
.gate-card input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border-strong);
  border-radius: 11px; background: var(--card-2); color: var(--text);
  font-size: 15px; text-align: center; outline: none; font-family: var(--font);
  transition: border-color .2s, box-shadow .2s;
}
.gate-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.gate-btn { width: 100%; justify-content: center; margin-top: 12px; padding: 11px; font-size: 14.5px; }
.gate-err {
  display: none; color: var(--red); font-size: 12.5px; margin-top: 11px; font-weight: 600;
}
.gate-hint { display: block; color: var(--text-3); font-size: 11.5px; margin-top: 12px; }
.gate.shake .gate-card { animation: gateShake .4s; }
@keyframes gateShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); } 40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); } 80% { transform: translateX(5px); }
}

/* 视频区 */
.video-block { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.video-frame-wrap { position: relative; padding-top: 56.25%; background: #000; }
.video-frame-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-info { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--card); flex-wrap: wrap; }
.video-info .v-title { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; min-width: 160px; }
.video-info .btn svg { width: 15px; height: 15px; }
.video-info .v-note { width: 100%; font-size: 12px; color: var(--amber); }

/* 视频封面卡（不可嵌入时的降级展示，点击跳转 YouTube） */
.video-cover { position: relative; display: block; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.video-cover img { width: 100%; height: 100%; object-fit: cover; opacity: .85; transition: transform .3s, opacity .3s; }
.video-cover:hover img { transform: scale(1.03); opacity: 1; }
.video-cover .vc-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(15, 15, 15, .62); border: 2px solid rgba(255, 255, 255, .9);
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, transform .2s;
}
.video-cover .vc-play svg { width: 26px; height: 26px; margin-left: 3px; fill: #fff; }
.video-cover:hover .vc-play { background: #e62117; transform: translate(-50%, -50%) scale(1.06); }
@media (max-width: 480px) {
  .video-cover .vc-play { width: 48px; height: 48px; }
  .video-cover .vc-play svg { width: 20px; height: 20px; }
}

/* 布局：桌面 TOC 居左（262px）+ 正文自适应 */
.course-layout {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr);
  grid-template-areas: "toc content";
  gap: 26px; margin-top: 24px; align-items: start;
}
.course-article { min-width: 0; display: flex; flex-direction: column; gap: 22px; grid-area: content; }
.course-sidebar { position: sticky; top: calc(var(--nav-h) + 18px); grid-area: toc; }

/* 侧栏 TOC */
.toc-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.toc-card h4 { font-size: 13px; color: var(--text-3); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 12px; font-weight: 600; }
.toc-list { list-style: none; display: flex; flex-direction: column; gap: 2px; max-height: 46vh; overflow: auto; padding-right: 4px; }
.toc-list::-webkit-scrollbar { width: 4px; }
.toc-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.toc-list a {
  display: flex; align-items: center; gap: 8px; padding: 6.5px 10px; border-radius: 8px;
  color: var(--text-2); font-size: 13px; font-weight: 500; transition: all .15s; border-left: 2px solid transparent;
}
.toc-list a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.toc-list a.active { background: var(--accent-soft); color: var(--accent); border-left-color: var(--accent); }
.toc-list a .toc-num { font-size: 11px; color: var(--text-3); font-weight: 600; width: 18px; flex: none; }
.toc-list a .toc-check { margin-left: auto; width: 15px; height: 15px; flex: none; color: var(--green); opacity: .28; transition: opacity .18s; }
.toc-list a .toc-check svg { width: 13px; height: 13px; }
.toc-list a .toc-check.on { opacity: 1; }
.toc-ring { display: flex; align-items: center; gap: 12px; padding: 12px 6px 4px; }
.toc-ring .ring-num { font-size: 19px; font-weight: 700; color: var(--accent); }
.toc-ring .ring-label { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.toc-actions { display: flex; gap: 8px; margin-top: 12px; }
.toc-actions .btn { flex: 1; justify-content: center; }

/* 区块卡片 */
.section-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 28px; box-shadow: var(--shadow-sm); scroll-margin-top: calc(var(--nav-h) + 14px);
}
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.section-head .s-icon {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.section-head .s-icon svg { width: 19px; height: 19px; }
.section-head h2 { font-size: 19px; letter-spacing: -.2px; }
.section-head .s-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

/* 简介 */
.intro-block h3 { font-size: 15px; margin: 18px 0 8px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.intro-block h3:first-child { margin-top: 0; }
.intro-block h3 svg, .intro-block h3 .tag-icon { color: var(--accent); width: 16px; height: 16px; flex: none; }
.intro-block p { color: var(--text-2); font-size: 14.5px; }
.obj-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.obj-list li { position: relative; padding-left: 24px; color: var(--text-2); font-size: 14px; }
.obj-list li::before {
  content: ""; position: absolute; left: 0; top: 8px;
  width: 15px; height: 15px; border-radius: 5px;
  background: var(--accent-soft);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%234f6ef7' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
  background-size: 10px; background-position: center; background-repeat: no-repeat;
}
[data-theme="dark"] .obj-list li::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%237c8cf8' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E"); }
.ov-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ov-list li { position: relative; padding-left: 20px; color: var(--text-2); font-size: 14px; }
.ov-list li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); opacity: .7; transform: rotate(45deg); }

/* 目录手风琴 */
.chapter-item { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; overflow: hidden; background: var(--card-2); transition: border-color .2s; }
.chapter-item.open { border-color: var(--accent); }
.chapter-head {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; cursor: pointer; user-select: none;
}
.chapter-head:hover { background: var(--accent-softer); }
.chapter-check {
  width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border-strong);
  flex: none; display: flex; align-items: center; justify-content: center; transition: all .18s;
}
.chapter-check svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 3.2; opacity: 0; }
.chapter-item.done .chapter-check { background: var(--green); border-color: var(--green); }
.chapter-item.done .chapter-check svg { opacity: 1; }
.chapter-num { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 7px; padding: 3px 8px; flex: none; }
.chapter-title { flex: 1; font-size: 14.5px; font-weight: 600; }
.chapter-item.done .chapter-title { color: var(--text-3); text-decoration: line-through; }
.chapter-arrow { width: 16px; height: 16px; color: var(--text-3); transition: transform .25s; flex: none; }
.chapter-item.open .chapter-arrow { transform: rotate(180deg); }
.chapter-body { display: none; padding: 4px 16px 16px; }
.chapter-item.open .chapter-body { display: block; animation: fadeIn .25s ease; }
.ch-body-block { margin-bottom: 12px; }
.ch-body-block:last-child { margin-bottom: 0; }
.ch-body-block .lbl { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 5px; display: flex; align-items: center; gap: 6px; }
.ch-body-block .lbl svg { width: 13px; height: 13px; }
.ch-body-block p, .ch-body-block ul { font-size: 13.5px; color: var(--text-2); }
.ch-body-block ul { list-style: none; display: flex; flex-direction: column; gap: 5px; }
.ch-body-block ul li { position: relative; padding-left: 17px; }
.ch-body-block ul li::before { content: "›"; position: absolute; left: 2px; color: var(--accent); font-weight: 700; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* 知识体系 */
.know-grid { display: flex; flex-direction: column; gap: 12px; }
.concept-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; background: var(--card-2); }
.concept-card h4 { font-size: 14.5px; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.concept-card h4 .c-dot { width: 9px; height: 9px; border-radius: 3px; background: var(--accent); flex: none; }
.concept-card p { font-size: 13.5px; color: var(--text-2); }
.concept-card .c-extra { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.concept-card .c-extra span { font-size: 12.5px; color: var(--text-3); }
.concept-card .c-extra b { color: var(--text-2); font-weight: 600; }

.method-card { border: 1px solid var(--accent); border-radius: 12px; overflow: hidden; background: var(--accent-softer); }
.method-card .m-head { padding: 13px 18px; font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 8px; color: var(--accent); }
.method-card .m-head svg { width: 17px; height: 17px; }
.method-card .m-body { padding: 0 18px 16px; }
.m-steps { list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 8px; }
.m-steps li { counter-increment: step; position: relative; padding-left: 34px; font-size: 13.5px; color: var(--text-2); }
.m-steps li::before {
  content: counter(step); position: absolute; left: 0; top: 1px;
  width: 23px; height: 23px; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.m-flow { margin-top: 10px; background: var(--card); border: 1px dashed var(--border-strong); border-radius: 9px; padding: 9px 12px; font-size: 12.5px; color: var(--text-2); font-family: var(--mono); }
.m-flow b { color: var(--accent); }
.m-cautions { margin-top: 10px; font-size: 12.5px; color: var(--text-3); }
.m-cautions b { color: var(--amber); }

.viewpoint-card { border-left: 3px solid var(--amber); background: var(--amber-soft); border-radius: 0 12px 12px 0; padding: 13px 16px; }
.viewpoint-card h4 { font-size: 14px; margin-bottom: 4px; }
.viewpoint-card p { font-size: 13px; color: var(--text-2); }
.viewpoint-card .v-ch { font-size: 11.5px; color: var(--text-3); margin-top: 6px; font-family: var(--mono); }

/* 详细笔记 */
.note-block { margin-bottom: 20px; }
.note-block:last-child { margin-bottom: 0; }
.note-block .n-head { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 700; margin-bottom: 9px; }
.note-block .n-head svg { width: 17px; height: 17px; color: var(--accent); }
.note-block ul { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.note-block ul li { position: relative; padding-left: 22px; color: var(--text-2); font-size: 14px; }
.note-block ul li::before { content: ""; position: absolute; left: 3px; top: 9px; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); opacity: .75; transform: rotate(45deg); }
.note-block.warn ul li::before { background: var(--amber); }
.note-block.sum ul li::before { background: var(--green); }

/* 案例 */
.case-card { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.case-card .case-head { display: flex; align-items: center; gap: 8px; padding: 11px 16px; background: var(--bg-soft); font-weight: 700; font-size: 13.5px; }
.case-card .case-head svg { width: 15px; height: 15px; color: var(--accent); }
.case-body { padding: 13px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.case-field { font-size: 13px; color: var(--text-2); }
.case-field.full { grid-column: 1 / -1; }
.case-field b { display: block; font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 2px; }
.no-case {
  text-align: center; padding: 26px; color: var(--text-3); font-size: 14px;
  border: 1px dashed var(--border-strong); border-radius: 12px;
}

/* 复习清单 */
.check-list { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.check-list li {
  display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--text-2);
  cursor: pointer; padding: 8px 12px; border-radius: 9px; border: 1px solid transparent; transition: all .15s;
}
.check-list li:hover { background: var(--accent-softer); border-color: var(--accent-soft); }
.check-list li .box {
  width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--border-strong);
  flex: none; margin-top: 2px; display: flex; align-items: center; justify-content: center; transition: all .18s;
}
.check-list li .box svg { width: 11px; height: 11px; stroke: #fff; stroke-width: 3.4; opacity: 0; }
.check-list li.checked { color: var(--text-3); }
.check-list li.checked .box { background: var(--green); border-color: var(--green); }
.check-list li.checked .box svg { opacity: 1; }
.review-col h4 { font-size: 13.5px; margin: 18px 0 8px; display: flex; align-items: center; gap: 7px; color: var(--text); }
.review-col h4 svg { width: 15px; height: 15px; color: var(--accent); }
.review-col:first-child h4 { margin-top: 0; }

/* 测验 */
.quiz-group { margin-bottom: 24px; }
.quiz-group:last-child { margin-bottom: 0; }
.quiz-group > h4 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.quiz-group > h4 .q-chip { font-size: 11.5px; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 2px 8px; font-weight: 700; }
.q-item { border: 1px solid var(--border); border-radius: 12px; padding: 15px 17px; margin-bottom: 12px; background: var(--card-2); }
.q-item .q-text { font-size: 14px; font-weight: 600; margin-bottom: 11px; line-height: 1.6; }
.q-opts { display: flex; flex-direction: column; gap: 7px; }
.q-opt {
  display: flex; align-items: center; gap: 10px; padding: 9px 13px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--card); font-size: 13.5px; color: var(--text-2);
  transition: all .15s; text-align: left; width: 100%;
}
.q-opt:hover { border-color: var(--accent); color: var(--text); }
.q-opt .opt-key { width: 22px; height: 22px; border-radius: 50%; border: 1.6px solid var(--border-strong); display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; color: var(--text-3); flex: none; transition: all .15s; }
.q-opt.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.q-opt.selected .opt-key { background: var(--accent); border-color: var(--accent); color: #fff; }
.q-opt.correct { border-color: var(--green); background: var(--green-soft); color: var(--text); }
.q-opt.correct .opt-key { background: var(--green); border-color: var(--green); color: #fff; }
.q-opt.wrong { border-color: var(--red); background: var(--red-soft); color: var(--text); }
.q-opt.wrong .opt-key { background: var(--red); border-color: var(--red); color: #fff; }
.q-opt:disabled { cursor: default; opacity: .85; }
.q-actions { display: flex; align-items: center; gap: 10px; margin-top: 11px; flex-wrap: wrap; }
.q-feedback { display: none; font-size: 13px; padding: 10px 13px; border-radius: 9px; margin-top: 11px; line-height: 1.65; }
.q-feedback.show { display: block; animation: fadeIn .2s ease; }
.q-feedback.ok { background: var(--green-soft); color: var(--text-2); }
.q-feedback.no { background: var(--red-soft); color: var(--text-2); }
.q-feedback b { color: var(--text); }
.q-score { font-size: 12.5px; font-weight: 700; color: var(--accent); }

.q-tf { display: flex; gap: 10px; }
.q-tf .q-opt { flex: 1; justify-content: center; }
.q-recall textarea {
  width: 100%; min-height: 90px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--card); color: var(--text); padding: 11px 13px; font-size: 13.5px;
  font-family: var(--font); resize: vertical; outline: none; transition: border-color .2s;
}
.q-recall textarea:focus { border-color: var(--accent); }
.q-answer { display: none; margin-top: 10px; font-size: 13px; color: var(--text-2); background: var(--accent-softer); border-radius: 9px; padding: 11px 13px; line-height: 1.7; }
.q-answer.show { display: block; animation: fadeIn .2s; }
.q-answer b { color: var(--accent); }

/* 学习记录 */
.record-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.record-cell { background: var(--card-2); border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px; }
.record-cell b { display: block; font-size: 21px; color: var(--accent); }
.record-cell span { font-size: 12px; color: var(--text-3); }
.record-history { margin-top: 14px; }
.record-history h4 { font-size: 13.5px; margin-bottom: 9px; color: var(--text-2); }
.quiz-record-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-radius: 8px; background: var(--card-2); border: 1px solid var(--border); margin-bottom: 7px; font-size: 13px; }
.quiz-record-row .qr-tag { font-size: 11.5px; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 2px 8px; font-weight: 700; margin-right: 8px; }
.quiz-record-row .qr-score { font-weight: 700; }
.quiz-record-row .qr-date { color: var(--text-3); font-size: 12px; }
.empty-rec { color: var(--text-3); font-size: 13px; text-align: center; padding: 14px; border: 1px dashed var(--border-strong); border-radius: 10px; }

/* 页脚 */
.site-footer { border-top: 1px solid var(--border); padding: 26px 24px 40px; background: var(--card); }
.footer-inner { max-width: 1180px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; color: var(--text-3); font-size: 13px; }
.footer-inner a { color: var(--text-2); }

/* 模态 */
.modal-mask {
  position: fixed; inset: 0; z-index: 200; background: rgba(10, 13, 20, .5);
  display: none; align-items: flex-start; justify-content: center; padding: 7vh 18px 30px; overflow: auto;
  backdrop-filter: blur(4px);
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  max-width: 640px; width: 100%; box-shadow: var(--shadow-lg); animation: fadeIn .2s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px 22px; max-height: 66vh; overflow: auto; }
.modal-body h4 { font-size: 14px; margin: 16px 0 7px; color: var(--accent); }
.modal-body h4:first-child { margin-top: 0; }
.modal-body p, .modal-body li { font-size: 13.5px; color: var(--text-2); line-height: 1.75; }
.modal-body ul { padding-left: 18px; }
.modal-body code { font-family: var(--mono); background: var(--bg-soft); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }

/* 加载 */
.page-loader { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--text-3); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); font-size: 13.5px; font-weight: 600;
  padding: 10px 20px; border-radius: 999px; box-shadow: var(--shadow-lg); z-index: 300;
  opacity: 0; pointer-events: none; transition: all .3s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 响应式 */
@media (max-width: 1100px) {
  .course-layout { grid-template-columns: 232px minmax(0, 1fr); gap: 20px; }
}
@media (max-width: 980px) {
  /* 单列：正文优先显示，TOC 沉底 */
  .course-layout { grid-template-columns: 1fr; grid-template-areas: "content" "toc"; gap: 18px; }
  .course-sidebar { position: static; }
  .toc-card { max-height: none; }
  .toc-list { max-height: 300px; }
  .toc-actions { flex-wrap: wrap; }
}
@media (max-width: 720px) {
  :root { --nav-h: 52px; }
  .nav-inner { padding: 0 14px; gap: 10px; }
  .nav-logo { font-size: 15px; gap: 8px; }
  .nav-logo .nav-sub { display: none; }
  .icon-btn { width: 34px; height: 34px; }
  .home-main, .course-main { padding-left: 14px; padding-right: 14px; }
  .course-subnav { padding: 7px 14px; margin: 0 -14px 18px; }
  .course-subnav a { padding: 5px 11px; font-size: 12.5px; }
  .hero { padding: 24px 20px; margin-bottom: 20px; }
  .hero h1 { font-size: 22px; }
  .hero p { font-size: 14px; }
  .course-grid { grid-template-columns: 1fr; gap: 14px; }
  .section-card { padding: 18px 16px; }
  .section-head h2 { font-size: 17px; }
  .section-head .s-icon { width: 34px; height: 34px; }
  .hero-card { padding: 20px 18px; }
  .hero-card h1 { font-size: 20px; padding-right: 0; }
  .hero-actions { position: static; margin-top: 12px; }
  .hero-actions .icon-btn { width: 36px; height: 36px; }
  .hero-meta { gap: 6px; }
  .case-body { grid-template-columns: 1fr; }
  .stat { min-width: 0; padding: 8px 12px; flex: 1; }
  .chapter-head { padding: 12px 13px; }
  .chapter-body { padding: 2px 13px 14px; }
  .crumb { font-size: 12.5px; flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .nav-logo { font-size: 14px; }
  .nav-logo img { width: 24px; height: 24px; }
  .hero { padding: 20px 16px; }
  .hero h1 { font-size: 19px; }
  .hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .hero-stats .stat { min-width: 0; padding: 8px 10px; }
  .stat b { font-size: 17px; }
  .toolbar { gap: 8px; margin: 18px 0 14px; }
  .search-box { min-width: 0; padding: 8px 12px; }
  .section-card { padding: 16px 13px; border-radius: 12px; }
  .section-head { margin-bottom: 14px; padding-bottom: 11px; }
  .section-head h2 { font-size: 16px; }
  .section-head .s-sub { font-size: 11.5px; }
  .intro-block p, .ov-list li, .obj-list li, .note-block ul li { font-size: 13.5px; }
  .concept-card { padding: 13px 14px; }
  .method-card .m-body { padding: 0 13px 13px; }
  .m-steps li { padding-left: 30px; font-size: 13px; }
  .q-item { padding: 13px 13px; }
  .q-opt { padding: 8px 11px; font-size: 13px; }
  .check-list li { font-size: 13.5px; padding: 7px 10px; }
  .record-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .record-cell { padding: 11px 13px; }
  .record-cell b { font-size: 18px; }
  .toc-actions .btn { font-size: 12px; padding: 6px 8px; }
  .video-info { padding: 9px 11px; gap: 9px; }
  .video-info .v-title { min-width: 0; font-size: 12.5px; }
  .case-field { font-size: 12.5px; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .course-pager { flex-direction: column; }
  .pager-home { flex: 1; padding: 10px; }
  .back-top { right: 14px; bottom: 16px; width: 38px; height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
