:root {
  --bg: #FFF6EC;
  --paper: #FFFFFF;
  --cream: #F7E7D7;
  --ink: #2A211C;
  --ink-2: #6B5D54;
  --ink-3: #A39488;
  --brand: #F05A22;
  --brand-2: #FF8A4C;
  --brand-soft: #FFE6D8;
  --green: #1F9D6B;
  --green-soft: #E3F6EE;
  --red: #E0473B;
  --red-soft: #FDECEA;
  --blue: #2B6DE0;
  --blue-soft: #E8F0FD;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(120, 70, 30, .08);
  --top-h: 58px;
  --nav-h: 50px;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top-h) + var(--nav-h) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.75 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
b { font-weight: 700; }
button { font: inherit; cursor: pointer; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--top-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(16px, env(safe-area-inset-left));
  background: rgba(255, 246, 236, .92);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand-logo {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: 0 4px 12px rgba(240, 90, 34, .35);
}
.brand-text { font-weight: 800; font-size: 17px; line-height: 1.15; }
.brand-text small { display: block; font-weight: 500; font-size: 12px; color: var(--ink-2); }

.progress-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 99px;
  background: var(--paper); box-shadow: var(--shadow);
  font-size: 13px; font-weight: 700; color: var(--ink-2);
}
.progress-track { width: 64px; height: 6px; border-radius: 9px; background: var(--cream); overflow: hidden; }
.progress-bar { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand-2), var(--brand)); transition: width .4s; }

/* ---------- 课程导航 ---------- */
.lesson-nav {
  position: sticky; top: var(--top-h); z-index: 29;
  height: var(--nav-h);
  display: flex; gap: 8px; align-items: center;
  padding: 0 16px;
  overflow-x: auto; scrollbar-width: none;
  background: rgba(255, 246, 236, .92);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(160, 110, 70, .1);
}
.lesson-nav::-webkit-scrollbar { display: none; }
.lesson-nav a {
  flex: none;
  padding: 6px 14px; border-radius: 99px;
  font-size: 14px; font-weight: 600; color: var(--ink-2);
  background: var(--paper);
  transition: all .2s;
}
.lesson-nav a.active { background: var(--ink); color: #fff; }
.lesson-nav a.done::after { content: " ✓"; color: var(--green); }
.lesson-nav a.active.done::after { color: #7EE2B5; }

main { max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* ---------- 首页 ---------- */
.hero { padding: 36px 0 12px; }
.hero-inner { text-align: center; max-width: 640px; margin: 0 auto 28px; }
.eyebrow {
  display: inline-block; margin: 0 0 14px;
  padding: 4px 14px; border-radius: 99px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 13px; font-weight: 700; letter-spacing: .08em;
}
.hero h1 { margin: 0; font-size: clamp(30px, 7vw, 46px); line-height: 1.25; letter-spacing: -.01em; }
.hero h1 span { color: var(--brand); }
.hero-lead { margin: 14px 0 18px; color: var(--ink-2); font-size: 16px; }
.no-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.no-list li {
  padding: 5px 12px; border-radius: 10px;
  background: var(--paper); font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow);
}
.no-list li::before { content: "✓ "; color: var(--green); font-weight: 800; }

.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.lesson-card {
  position: relative; display: block;
  padding: 18px 18px 16px; border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  overflow: hidden;
}
.lesson-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(120, 70, 30, .14); }
.lesson-card .lc-num { font-size: 32px; font-weight: 900; color: var(--brand-soft); line-height: 1; position: absolute; right: 16px; top: 14px; }
.lesson-card h3 { margin: 0 0 4px; font-size: 18px; }
.lesson-card p { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; }
.lc-tag { display: inline-block; padding: 2px 10px; border-radius: 8px; background: var(--cream); color: var(--ink-2); font-size: 12px; font-weight: 600; }
.lc-tag.easy { background: var(--green-soft); color: var(--green); }
.lc-tag.hard { background: var(--brand-soft); color: var(--brand); }
.lesson-card.done::after {
  content: "已完成 ✓"; position: absolute; right: 14px; bottom: 14px;
  font-size: 12px; font-weight: 700; color: var(--green);
}

/* ---------- 单页切换 ---------- */
.hero, .lesson { display: none; }
.hero.active, .lesson.active { display: block; animation: fade .3s ease; }
.lesson-nav { display: none; }
body[data-module="bbkt"] .lesson-nav[data-for="bbkt"],
body[data-module="qm"] .lesson-nav[data-for="qm"] { display: flex; }
body[data-module=""] .progress-pill { visibility: hidden; }

/* 模块二换一套主色，和宝宝课堂区分开 */
body[data-module="qm"] {
  --brand: #0F9B8E;
  --brand-2: #3CC7A9;
  --brand-soft: #DAF3EC;
  --bg: #F3FAF6;
  --cream: #E2EEE7;
}
body[data-module="qm"] .topbar,
body[data-module="qm"] .lesson-nav { background: rgba(243, 250, 246, .92); }
body[data-module="qm"] .brand-logo { box-shadow: 0 4px 12px rgba(15, 155, 142, .35); }
body[data-module="qm"] .step::before { box-shadow: 0 6px 14px rgba(15, 155, 142, .35); }
body[data-module="qm"] .step::after { border-left-color: rgba(15, 155, 142, .3); }
body[data-module="qm"] .copy-card { border-color: rgba(15, 155, 142, .45); background: #F7FCFA; }
body[data-module="qm"] .tip { color: #0B5E56; }
body[data-module="qm"] .path.crumbs li { color: #0B5E56; }

/* 模块切换 */
.module-switch { display: flex; padding: 3px; border-radius: 99px; background: var(--paper); box-shadow: var(--shadow); }
.module-switch a { padding: 5px 12px; border-radius: 99px; font-size: 13px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.module-switch a.active { background: var(--ink); color: #fff; }
@media (max-width: 640px) { .brand-text { display: none; } .module-switch a { padding: 5px 10px; } }

/* 总首页 */
.module-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 18px; }
.module-card {
  position: relative; display: flex; flex-direction: column;
  padding: 24px 22px 20px; border-radius: 24px; color: #fff; overflow: hidden;
  box-shadow: 0 14px 34px rgba(80, 50, 20, .16); transition: transform .2s;
}
.module-card:hover { transform: translateY(-3px); }
.module-card.bbkt { background: linear-gradient(140deg, #FF9A5A, #F05A22); }
.module-card.qm { background: linear-gradient(140deg, #3CC7A9, #0F8A7E); }
.module-card .mc-no { font-size: 13px; font-weight: 800; letter-spacing: .12em; opacity: .85; }
.module-card h2 { margin: 4px 0 6px; font-size: 26px; line-height: 1.3; }
.module-card p { margin: 0 0 14px; opacity: .92; font-size: 15px; }
.module-card ul { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 6px; }
.module-card li { padding: 3px 10px; border-radius: 8px; background: rgba(255,255,255,.2); font-size: 13px; font-weight: 600; }
.module-card .mc-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; font-weight: 700; }
.module-card .mc-go { padding: 6px 16px; border-radius: 99px; background: #fff; color: var(--ink); font-size: 14px; }
.module-card .mc-progress { font-size: 13px; opacity: .9; }
.module-card::after {
  content: attr(data-mark); position: absolute; right: -6px; top: -18px;
  font-size: 120px; font-weight: 900; opacity: .12; line-height: 1;
}

/* 表格 */
.table-scroll { overflow-x: auto; margin: 6px 0 14px; border-radius: 14px; box-shadow: var(--shadow); }
.data-table { width: 100%; min-width: 520px; border-collapse: collapse; background: var(--paper); font-size: 14px; line-height: 1.6; }
.data-table th, .data-table td { padding: 9px 12px; border-bottom: 1px solid var(--cream); text-align: left; vertical-align: top; }
.data-table th { background: var(--brand-soft); color: var(--ink); font-weight: 800; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td.hl { color: var(--brand); font-weight: 800; }

/* 技术人外挂 */
.tech-tip { margin: 0 0 16px; padding: 16px 18px; border-radius: var(--radius); background: #1F2A2E; color: #DCEBE6; }
.tech-tip h4 { margin: 0 0 6px; font-size: 16px; color: #7EE2C8; }
.tech-tip h4::before { content: "💻 技术人外挂 · "; }
.tech-tip p, .tech-tip ul { margin: 0; font-size: 15px; }
.tech-tip ul { padding-left: 20px; }
.tech-tip b { color: #fff; }
.tech-tip code { padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,.1); font-size: 13px; }

.foot-bbkt { display: none; }
body[data-module="bbkt"] .foot-bbkt { display: block; }

.persona { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 6px; }
.persona div { padding: 14px; border-radius: 14px; background: var(--bg); font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.persona b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 2px; }
.persona .pick { background: var(--brand-soft); outline: 2px solid var(--brand); }
.persona .pick b::after { content: " 推荐"; font-size: 12px; color: #fff; background: var(--brand); padding: 1px 6px; border-radius: 6px; margin-left: 4px; }

.lesson-pager { display: flex; gap: 10px; margin-top: 16px; }
.lesson-pager a {
  flex: 1; min-width: 0;
  padding: 12px 14px; border-radius: 14px;
  background: var(--paper); box-shadow: var(--shadow); color: var(--ink);
  font-weight: 700; font-size: 15px; line-height: 1.4;
}
.lesson-pager a small { display: block; color: var(--ink-3); font-weight: 500; font-size: 12px; }
.lesson-pager a.next { text-align: right; }
.lesson-pager a:only-child { flex: 0 1 50%; }
.lesson-pager a.next:only-child { margin-left: auto; }
.lesson-pager a:hover { color: var(--brand); }

/* ---------- 课程区块 ---------- */
.lesson {
  margin: 20px 0 28px; padding: 26px 22px 22px;
  background: rgba(255, 255, 255, .55);
  border: 1px solid rgba(160, 110, 70, .1);
  border-radius: 26px;
}
.lesson-head { margin-bottom: 18px; }
.lesson-no {
  display: inline-block; padding: 3px 12px; border-radius: 8px;
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 700;
}
.lesson-head h2 { margin: 8px 0 6px; font-size: clamp(24px, 5vw, 30px); line-height: 1.3; }
.lesson-lead { margin: 0; color: var(--ink-2); }
.lesson-lead b { color: var(--ink); }

/* tabs */
.tabs {
  display: inline-flex; gap: 4px; padding: 4px; margin: 4px 0 16px;
  border-radius: 14px; background: var(--cream);
}
.tab {
  border: 0; background: transparent; color: var(--ink-2);
  padding: 7px 16px; border-radius: 11px; font-size: 15px; font-weight: 600;
}
.tab em { font-style: normal; font-size: 12px; padding: 0 6px; border-radius: 6px; background: rgba(0,0,0,.06); margin-left: 2px; }
.tab.active { background: var(--paper); color: var(--ink); box-shadow: 0 2px 8px rgba(120, 70, 30, .12); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.panel-lead { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; }

.card {
  background: var(--paper); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card > p { margin: 0 0 10px; }
.card-title { margin: 0 0 12px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.sub-title { margin: 22px 0 10px; font-size: 16px; }
.badge {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: inline-grid; place-items: center;
  background: var(--brand); color: #fff; font-size: 14px;
}
.hint { margin: 0 0 12px; color: var(--ink-2); font-size: 15px; }
.hint b { color: var(--ink); }

.tip {
  margin: 14px 0; padding: 10px 14px; border-radius: 12px;
  background: var(--brand-soft); color: #8A3A14; font-size: 15px;
}
.tip.warn { background: #FFF4D6; color: #7A5600; }

/* lists */
.x-list, .check-list, .num-list { list-style: none; padding: 0; margin: 0 0 14px; }
.x-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.x-list li { padding: 8px 12px; border-radius: 10px; background: var(--red-soft); font-weight: 600; font-size: 15px; }
.x-list li::before { content: "✕ "; color: var(--red); font-weight: 800; }
.check-list li { padding: 5px 0 5px 28px; position: relative; }
.check-list li::before {
  content: "!"; position: absolute; left: 0; top: 9px;
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--red); color: #fff; font-size: 12px; font-weight: 800; line-height: 1;
}
.num-list { counter-reset: n; }
.num-list li { counter-increment: n; position: relative; padding: 6px 0 6px 34px; }
.num-list li::before {
  content: counter(n); position: absolute; left: 0; top: 8px;
  width: 24px; height: 24px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 13px;
}

.path { margin: 0 0 14px; padding-left: 0; list-style: none; counter-reset: p; }
.path li {
  counter-increment: p; position: relative;
  padding: 9px 12px 9px 44px; margin-bottom: 6px;
  border-radius: 12px; background: var(--bg);
}
.path li::before {
  content: counter(p); position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 700;
}
.path.crumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.path.crumbs li { padding: 5px 12px; margin: 0; font-size: 14px; font-weight: 600; background: var(--brand-soft); color: #8A3A14; }
.path.crumbs li::before { display: none; }
.path.crumbs li:not(:last-child)::after { content: " →"; color: var(--brand); }

/* steps */
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.step {
  counter-increment: s; position: relative;
  padding: 18px 18px 18px 18px; margin: 0 0 16px 22px;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
}
.step::before {
  content: counter(s); position: absolute; left: -22px; top: 16px;
  width: 40px; height: 40px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff; font-weight: 900; font-size: 19px;
  box-shadow: 0 6px 14px rgba(240, 90, 34, .35);
}
.step::after {
  content: ""; position: absolute; left: -3px; top: 64px; bottom: -16px;
  border-left: 2px dashed rgba(240, 90, 34, .3);
}
.step:last-child::after { display: none; }
.step > h3 { margin: 4px 0 6px 26px; font-size: 18px; }
.step > h3::before { content: "第 " counter(s) " 步 · "; color: var(--brand); }
.step > .hint:first-of-type { margin-left: 26px; }

/* rules */
.rule { border-radius: var(--radius); padding: 16px 18px; margin: 0 0 16px; }
.rule h4 { margin: 0 0 6px; font-size: 16px; }
.rule p { margin: 0; }
.rule.ok { background: var(--green-soft); }
.rule.ok h4 { color: var(--green); }
.rule.ok h4::before { content: "✅ "; }
.rule.bad { background: var(--red-soft); }
.rule.bad h4 { color: var(--red); }
.rule.bad h4::before { content: "⛔ "; }
.rule.info { background: var(--blue-soft); }
.rule.info h4 { color: var(--blue); }
.rule.info h4::before { content: "ℹ️ "; }

/* copy cards */
.copy-card {
  position: relative; margin: 0 0 12px;
  border: 1.5px dashed rgba(240, 90, 34, .45);
  border-radius: 14px; background: #FFFBF7;
}
.copy-card[data-label]::before {
  content: attr(data-label);
  position: absolute; left: 12px; top: -11px;
  padding: 0 8px; border-radius: 6px;
  background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; line-height: 22px;
}
.copy-card pre {
  margin: 0; padding: 18px 14px 14px;
  white-space: pre-wrap; word-break: break-word;
  font: inherit; font-size: 15px; line-height: 1.8;
}
.copy-btn {
  position: absolute; right: 8px; top: -14px;
  border: 0; padding: 4px 12px; border-radius: 99px;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 700;
  box-shadow: 0 4px 10px rgba(0,0,0,.15);
}
.copy-btn.copied, .btn-mini.copied, .chip.copied, .case-list .copied { background: var(--green) !important; color: #fff !important; }
.copy-grid { display: grid; gap: 14px; padding-top: 6px; }
.copy-grid.two { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
@media (min-width: 760px) { .copy-grid:not(.two) { grid-template-columns: 1fr 1fr; } }
.copy-grid .copy-card { margin: 0; }

.btn-mini {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; padding: 6px 14px; border-radius: 99px;
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap;
}
.btn-mini.ghost { background: var(--cream); color: var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--cream); background: var(--bg); color: var(--ink);
  padding: 7px 14px; border-radius: 99px; font-size: 14px; text-align: left;
  transition: all .15s;
}
.chip:hover { border-color: var(--brand); }

/* flow */
.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 18px; }
.flow-item {
  position: relative; padding: 14px 14px 14px 52px; border-radius: 14px;
  background: var(--paper); box-shadow: var(--shadow); font-weight: 700; font-size: 15px; line-height: 1.45;
}
.flow-item span {
  position: absolute; left: 14px; top: 14px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ink); color: #fff; font-size: 13px;
}
.flow-item small { display: block; font-weight: 500; color: var(--ink-3); font-size: 13px; }

/* misc blocks */
.music, .attach {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px; margin: 14px 0;
  background: var(--bg);
}
.attach { background: var(--paper); box-shadow: var(--shadow); }
.music > div:nth-child(2), .attach > div { flex: 1; min-width: 0; }
.music p, .attach p { margin: 0; color: var(--ink-2); font-size: 13px; }
.attach b { display: block; line-height: 1.4; word-break: break-all; }
.music-icon, .attach-icon { font-size: 26px; }
.music-actions, .res-actions { display: flex; gap: 6px; }

.case-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.case-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 14px; background: var(--paper); box-shadow: var(--shadow);
  font-size: 14px; color: var(--ink-2); line-height: 1.5;
}
.case-list li .case-text { flex: 1; min-width: 0; }
.case-list li b { display: block; color: var(--ink); font-size: 15px; }
.case-list li b::before { content: "♪ "; color: #111; }
.case-list li.xhs b::before { content: "📕 "; }
.case-list .case-actions { display: flex; gap: 6px; flex: none; }

.shoot { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.shoot div { padding: 14px; border-radius: 14px; background: var(--bg); font-weight: 700; font-size: 15px; line-height: 1.5; }
.shoot span { display: block; font-size: 26px; margin-bottom: 4px; }
.shoot small { display: block; font-weight: 500; color: var(--ink-3); font-size: 13px; }

.two-col { display: grid; gap: 16px; }
@media (min-width: 820px) { .two-col { grid-template-columns: 1fr 1fr; align-items: start; } .two-col .card { margin: 0; } }
.two-col + .rule { margin-top: 16px; }

.live-chain { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 16px; }
.live-chain span { padding: 5px 12px; border-radius: 10px; background: var(--brand-soft); color: #8A3A14; font-weight: 700; font-size: 14px; }
.live-chain span:not(:last-child)::after { content: " →"; color: var(--brand); }

.resources .res-row {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: 12px 0; border-top: 1px dashed var(--cream);
}
.resources .res-row:first-of-type { border-top: 0; padding-top: 0; }
.resources .res-row > div:first-child { min-width: 0; }
.resources small { display: block; color: var(--ink-2); font-size: 13px; }
.resources b { display: block; word-break: break-all; line-height: 1.5; }
.resources .code { font-size: 26px; letter-spacing: .12em; color: var(--brand); font-family: ui-monospace, Menlo, Consolas, monospace; }

.demo-video {
  display: block; width: 100%; max-width: 340px; max-height: 72vh;
  aspect-ratio: 9 / 16; margin: 0 auto;
  border-radius: 16px; background: #000; object-fit: contain;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}

/* ---------- 教程在线阅读 ---------- */
.doc-attach { flex-wrap: wrap; }
.reader {
  position: fixed; inset: 0; z-index: 90;
  display: none; flex-direction: column;
  background: var(--bg);
}
.reader.open { display: flex; animation: fade .25s ease; }
.reader-bar {
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: var(--paper); box-shadow: 0 2px 12px rgba(120, 70, 30, .08);
}
.reader-title { flex: 1; min-width: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-btn {
  flex: none; border: 0; padding: 6px 12px; border-radius: 99px;
  background: var(--cream); color: var(--ink); font-size: 14px; font-weight: 700;
}
.reader-btn:first-child { width: 36px; padding: 6px 0; font-size: 18px; line-height: 1.2; }
.reader-toc {
  display: none; flex-wrap: wrap; gap: 6px;
  padding: 12px; max-height: 45vh; overflow-y: auto;
  background: var(--paper); border-top: 1px solid var(--cream);
}
.reader-toc.open { display: flex; }
.reader-toc a {
  padding: 5px 12px; border-radius: 10px;
  background: var(--bg); color: var(--ink); font-size: 14px; font-weight: 600;
}
.reader-toc a:hover { background: var(--brand-soft); color: var(--brand); }
.reader-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.reader-doc {
  max-width: 760px; margin: 0 auto; padding: 20px 18px 80px;
  font-size: 16px; line-height: 1.85;
}
.reader-doc p { margin: 0 0 10px; }
.reader-doc .doc-cover {
  margin: 0 0 20px; padding: 22px 20px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff;
}
.reader-doc .doc-cover p { margin: 0; }
.reader-doc .doc-cover p:nth-child(3) { font-size: 26px; font-weight: 900; margin: 4px 0; }
.reader-doc h2 {
  margin: 34px 0 12px; padding: 10px 14px; border-radius: 12px;
  background: var(--ink); color: #fff; font-size: 19px; line-height: 1.4;
  scroll-margin-top: 12px;
}
.reader-doc h3 { margin: 20px 0 8px; font-size: 16px; color: var(--brand); }
.reader-doc .table-wrap { overflow-x: auto; margin: 12px 0 16px; border-radius: 12px; box-shadow: var(--shadow); }
.reader-doc table { width: 100%; min-width: 520px; border-collapse: collapse; background: var(--paper); font-size: 14px; line-height: 1.6; }
.reader-doc td { padding: 8px 10px; border: 1px solid var(--cream); vertical-align: top; }
.reader-doc td p { margin: 0; }
.reader-doc tr:first-child td { background: var(--brand-soft); color: #8A3A14; font-weight: 700; }

/* done toggle */
.done-toggle {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 20px 0 0; padding: 14px; border-radius: 16px;
  background: var(--paper); border: 2px dashed var(--cream);
  font-weight: 700; color: var(--ink-2); cursor: pointer; user-select: none;
  transition: all .2s;
}
.done-toggle input { width: 20px; height: 20px; accent-color: var(--green); }
.done-toggle.checked { border-color: var(--green); background: var(--green-soft); color: var(--green); }

/* ---------- 图片墙 ---------- */
.gallery { display: grid; gap: 10px; margin: 12px 0; }
.gallery figure { margin: 0; position: relative; cursor: zoom-in; border-radius: 12px; overflow: hidden; background: var(--cream); }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gallery figure:hover img { transform: scale(1.03); }
.gallery figure .num {
  position: absolute; left: 6px; top: 6px;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 7px;
  background: rgba(0,0,0,.55); color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}
.gallery.slides { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 420px)); }
.gallery.slides figure { aspect-ratio: 4 / 3; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.gallery.photos { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.gallery.photos figure { aspect-ratio: 4 / 5; }
.gallery.phones { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.gallery.phones figure { aspect-ratio: 9 / 18; }
.gallery.phones img { object-position: top; }
.gallery.phones.single { grid-template-columns: minmax(0, 220px); }
.gallery.natural { grid-template-columns: repeat(auto-fill, minmax(140px, 320px)); align-items: start; }
.gallery.natural img { height: auto; object-fit: contain; background: #fff; }
.gallery.wide { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.gallery.wide figure { aspect-ratio: 2374 / 1080; }

/* ---------- 页脚 / 浮动 ---------- */
.footer { text-align: center; padding: 30px 16px 60px; color: var(--ink-3); font-size: 14px; }
.footer p { margin: 4px 0; }

.to-top {
  position: fixed; right: 18px; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 40;
  width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: var(--ink); color: #fff; font-size: 20px; font-weight: 800;
  box-shadow: 0 8px 20px rgba(0,0,0,.2);
  opacity: 0; pointer-events: none; transform: translateY(10px); transition: all .25s;
}
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 20px; border-radius: 99px;
  background: rgba(30, 24, 20, .92); color: #fff; font-size: 15px; font-weight: 600;
  transition: all .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 大图查看 ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: center; justify-content: center;
  background: rgba(15, 11, 9, .94);
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 94vw; max-height: 80vh; object-fit: contain; border-radius: 6px; user-select: none; }
.lb-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px; color: #fff; font-weight: 700;
}
.lb-actions { display: flex; gap: 8px; }
.lb-btn {
  border: 0; padding: 7px 14px; border-radius: 99px;
  background: rgba(255,255,255,.14); color: #fff; font-size: 14px; font-weight: 700;
}
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.14); color: #fff; font-size: 30px; line-height: 1;
}
.lb-nav.prev { left: 12px; }
.lb-nav.next { right: 12px; }
.lb-tip { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: rgba(255,255,255,.55); font-size: 13px; margin: 0; }
@media (hover: hover) { .lb-tip { display: none; } }

@media (max-width: 560px) {
  .lesson { padding: 22px 14px 16px; border-radius: 22px; margin: 20px -4px; }
  .step { padding: 16px 14px; }
  .step > h3 { font-size: 17px; }
  .x-list { grid-template-columns: 1fr 1fr; }
  .progress-track { width: 44px; }
  .lb-nav { display: none; }
  .case-list li { flex-wrap: wrap; }
  .case-list .case-actions { width: 100%; justify-content: flex-end; }
  .resources .res-row { flex-wrap: wrap; }
}
