/* =========================================================
   拾光 HTML · 全站样式
   小清新文艺风格：纸感米白 / 雾绿 / 干枯玫瑰 / 细线分隔
   ========================================================= */

/* ---------- 1. 设计变量 ---------- */
:root {
  --paper: #faf7f0;
  --paper-2: #f2ece0;
  --card: #fffdf9;
  --ink: #3a3631;
  --ink-2: #6b6459;
  --ink-3: #978d7f;
  --sage: #8ba79a;
  --sage-d: #587768;
  --sage-l: #e9f0ea;
  --rose: #d8ae9f;
  --rose-d: #a97862;
  --rose-l: #f8ece6;
  --gold: #c2a06b;
  --line: #e7dece;
  --code-bg: #2c332e;
  --code-head: #343c36;
  --code-ink: #e6ebe4;
  --shadow-sm: 0 2px 10px -6px rgba(88, 74, 56, .35);
  --shadow: 0 18px 42px -28px rgba(88, 74, 56, .55);
  --radius: 16px;
  --radius-sm: 10px;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  --maxw: 1180px;
}

/* ---------- 2. 基础重置 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.78;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 10% 4%, rgba(139, 167, 154, .13), transparent 42%),
    radial-gradient(circle at 92% 2%, rgba(216, 174, 159, .14), transparent 38%),
    radial-gradient(rgba(120, 108, 90, .055) 1px, transparent 1px);
  background-size: auto, auto, 22px 22px;
}

img, svg, video { max-width: 100%; }
img { display: block; height: auto; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4, h5, h6, p, ul, ol, dl, figure, blockquote { margin: 0; }
ul, ol { padding-left: 1.35em; }

::selection { background: var(--rose-l); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--sage-d);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 18px;
  border-radius: 0 0 10px 10px;
  background: var(--sage-d);
  color: #fff;
  font-size: 13px;
  transition: top .2s;
}
.skip-link:focus { top: 0; }

/* ---------- 3. 通用小组件 ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--sage-d);
  font-weight: 600;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: currentColor;
  opacity: .55;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: .05em;
  color: var(--ink-2);
  background: rgba(255, 253, 249, .7);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14px;
  letter-spacing: .04em;
  transition: transform .25s, background-color .25s, color .25s, border-color .25s, box-shadow .25s;
}
.btn-primary {
  background: var(--sage-d);
  color: #fbf8f2;
  box-shadow: 0 12px 26px -18px var(--sage-d);
}
.btn-primary:hover { background: #4a6759; transform: translateY(-1px); }
.btn-ghost {
  border-color: var(--line);
  color: var(--ink-2);
  background: rgba(255, 253, 249, .65);
}
.btn-ghost:hover { border-color: var(--sage); color: var(--sage-d); transform: translateY(-1px); }
.btn-sm { padding: 7px 16px; font-size: 12.5px; }

/* ---------- 4. 进度条 ---------- */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 80;
  background: transparent;
  pointer-events: none;
}
.progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--sage), var(--rose));
  transition: width .12s linear;
}

/* ---------- 5. 顶部导航 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 70;
  background: rgba(250, 247, 240, .86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--sage-l);
  border: 1px solid rgba(88, 119, 104, .22);
  display: grid;
  place-items: center;
  color: var(--sage-d);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-text strong {
  display: block;
  font-family: var(--serif);
  font-size: 17.5px;
  letter-spacing: .1em;
  font-weight: 600;
  line-height: 1.35;
}
.brand-text small {
  display: block;
  font-size: 10.5px;
  letter-spacing: .08em;
  color: var(--ink-3);
  line-height: 1.3;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  font-size: 13.5px;
  letter-spacing: .04em;
  color: var(--ink-2);
  border-radius: 8px;
  transition: color .2s;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 1px;
  background: var(--sage-d);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s ease;
}
.nav-link:hover { color: var(--sage-d); }
.nav-link:hover::after { transform: scaleX(1); }
.nav-link.is-active { color: var(--sage-d); font-weight: 600; }
.nav-link.is-active::after { transform: scaleX(1); }
.nav-drop { position: relative; }
.caret { font-size: 10px; opacity: .6; }
.drop-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  width: 268px;
  transform: translate(-50%, -8px);
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s, transform .22s, visibility .22s;
}
.drop-menu::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  background: var(--card);
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(45deg);
}
.nav-drop:hover .drop-menu,
.nav-drop:focus-within .drop-menu,
.nav-drop.is-open .drop-menu {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
.drop-menu a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-2);
  transition: background-color .18s, color .18s;
}
.drop-menu a span {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--gold);
  letter-spacing: .06em;
}
.drop-menu a:hover { background: var(--paper-2); color: var(--ink); }
.drop-menu a.is-active { color: var(--sage-d); background: var(--sage-l); }
.nav-toggle {
  display: none;
  width: 42px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  background: rgba(255, 253, 249, .7);
}
.nav-toggle span {
  display: block;
  width: 17px;
  height: 1.6px;
  background: var(--ink-2);
  transition: transform .25s, opacity .25s;
}
body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(5.6px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-5.6px) rotate(-45deg); }

/* ---------- 6. 首页 Hero ---------- */
.page-wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

.hero { padding: clamp(46px, 7vw, 86px) 0 clamp(26px, 4vw, 44px); }
.hero-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}
.hero-title {
  font-family: var(--serif);
  font-size: clamp(2.3rem, 4.4vw, 3.55rem);
  line-height: 1.3;
  letter-spacing: .02em;
  font-weight: 600;
  margin: 18px 0 20px;
}
.hero-title em {
  position: relative;
  z-index: 0;
  font-style: normal;
  color: var(--sage-d);
}
.hero-title em::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: 4px;
  height: 10px;
  border-radius: 4px;
  background: var(--rose-l);
  z-index: -1;
}
.hero-lead {
  font-size: 15.5px;
  line-height: 1.95;
  color: var(--ink-2);
  max-width: 33em;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(18px, 3vw, 38px);
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px dashed var(--line);
}
.hero-stats div strong {
  display: block;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--sage-d);
  line-height: 1.4;
}
.hero-stats div span { font-size: 11.5px; letter-spacing: .12em; color: var(--ink-3); }

.hero-art {
  position: relative;
  min-height: clamp(320px, 36vw, 400px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-art::before {
  content: "";
  position: absolute;
  width: min(86%, 340px);
  aspect-ratio: 1;
  border-radius: 58% 42% 55% 45% / 48% 52% 48% 52%;
  background: linear-gradient(150deg, var(--sage-l), rgba(248, 236, 230, .85));
  transform: rotate(-7deg);
}
.hero-art::after {
  content: "";
  position: absolute;
  width: 72px;
  height: 72px;
  right: 6%;
  top: 8%;
  border: 1px dashed rgba(169, 120, 98, .45);
  border-radius: 50%;
}
.art-frame {
  position: relative;
  width: min(100%, 368px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  transform: rotate(-2.2deg);
}
.art-frame-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}
.art-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.art-dot:nth-child(1) { background: var(--rose); }
.art-dot:nth-child(2) { background: var(--gold); }
.art-dot:nth-child(3) { background: var(--sage); }
.art-frame-label {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.art-code {
  margin: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
}
.art-code .c-tag { color: var(--sage-d); }
.art-code .c-attr { color: var(--rose-d); }
.art-code .c-str { color: var(--gold); }
.art-code .c-com { color: var(--ink-3); }
.art-stamp {
  position: absolute;
  right: 2%;
  bottom: 6%;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 1px solid var(--rose);
  background: rgba(255, 253, 249, .9);
  color: var(--rose-d);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 12.5px;
  letter-spacing: .16em;
  text-align: center;
  line-height: 1.5;
  transform: rotate(9deg);
  box-shadow: var(--shadow-sm);
}
.art-leaf { position: absolute; left: 0; bottom: 2%; width: 54px; color: var(--sage); opacity: .8; transform: rotate(-12deg); }

/* ---------- 7. 首页区块 ---------- */
.section { padding: clamp(40px, 6vw, 74px) 0; }
.section--tint {
  background: linear-gradient(180deg, rgba(233, 240, 234, .55), rgba(250, 247, 240, 0));
  border-top: 1px solid rgba(231, 222, 206, .6);
  border-bottom: 1px solid rgba(231, 222, 206, .6);
}
.section-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section-head { max-width: 620px; margin-bottom: clamp(26px, 4vw, 40px); }
.section-head h2 {
  font-family: var(--serif);
  font-size: clamp(1.65rem, 3vw, 2.2rem);
  font-weight: 600;
  letter-spacing: .02em;
  margin: 12px 0 10px;
}
.section-lead { font-size: 14.5px; color: var(--ink-2); line-height: 1.9; }

.chapters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.chapter {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 24px 24px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
  transition: transform .28s, box-shadow .28s, border-color .28s;
}
.chapter::after {
  content: attr(data-num);
  position: absolute;
  right: 16px;
  top: 4px;
  font-family: var(--serif);
  font-size: 54px;
  line-height: 1;
  color: rgba(139, 167, 154, .16);
  pointer-events: none;
}
.chapter:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: rgba(139, 167, 154, .55);
}
.chapter .chapter-kicker {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
}
.chapter h3 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .02em;
}
.chapter p { font-size: 13.5px; color: var(--ink-2); line-height: 1.85; }
.chapter-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.chapter-tags span {
  font-size: 11px;
  color: var(--ink-3);
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.chapter-go {
  margin-top: auto;
  padding-top: 12px;
  font-size: 12.5px;
  color: var(--sage-d);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chapter-go::after { content: "→"; transition: transform .25s; }
.chapter:hover .chapter-go::after { transform: translateX(4px); }
.chapter.is-done { border-color: rgba(88, 119, 104, .45); }
.chapter.is-done::before {
  content: "已学";
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 1;
  font-size: 10.5px;
  letter-spacing: .08em;
  color: var(--sage-d);
  background: var(--sage-l);
  padding: 2px 8px;
  border-radius: 999px;
}

.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.feature {
  padding: 24px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 249, .72);
}
.feature-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border-radius: 11px;
  background: var(--sage-l);
  color: var(--sage-d);
  display: grid;
  place-items: center;
}
.feature-icon svg { width: 20px; height: 20px; }
.feature h3 { font-family: var(--serif); font-size: 16.5px; margin-bottom: 6px; font-weight: 600; }
.feature p { font-size: 13px; color: var(--ink-2); line-height: 1.85; }

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; counter-reset: step; }
.step {
  position: relative;
  padding: 22px 20px;
  border-top: 2px solid var(--sage);
  background: rgba(255, 253, 249, .55);
  border-radius: 0 0 12px 12px;
}
.step::before {
  counter-increment: step;
  content: "0" counter(step);
  font-family: var(--serif);
  font-size: 24px;
  color: var(--rose-d);
  opacity: .75;
  display: block;
  margin-bottom: 8px;
}
.step h3 { font-size: 14.5px; margin-bottom: 5px; font-weight: 600; }
.step p { font-size: 12.5px; color: var(--ink-2); line-height: 1.8; }

.progress-card {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.progress-card-text { flex-shrink: 0; }
.progress-card-text strong { display: block; font-family: var(--serif); font-size: 17px; font-weight: 600; }
.progress-card-text span { font-size: 12px; color: var(--ink-3); }
.progress-track {
  flex: 1;
  min-width: 180px;
  height: 8px;
  border-radius: 999px;
  background: var(--paper-2);
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sage), var(--rose));
  transition: width .9s cubic-bezier(.22, .61, .36, 1);
}
.progress-count {
  font-family: var(--serif);
  font-size: 21px;
  color: var(--sage-d);
  white-space: nowrap;
}
.progress-count small { font-size: 12px; color: var(--ink-3); }

.quote-band {
  padding: clamp(48px, 7vw, 72px) 24px;
  text-align: center;
  background: var(--paper-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.quote-band blockquote {
  max-width: 760px;
  margin: 0 auto;
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.3vw, 1.5rem);
  line-height: 2.05;
  color: var(--ink-2);
}
.quote-band cite {
  display: block;
  margin-top: 16px;
  font-size: 11.5px;
  font-style: normal;
  letter-spacing: .18em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.cta-band { padding: clamp(48px, 6vw, 76px) 24px; }
.cta-card {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(30px, 4vw, 46px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(circle at 88% 12%, rgba(216, 174, 159, .2), transparent 55%),
    var(--card);
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.cta-card h2 { font-family: var(--serif); font-size: clamp(1.5rem, 3vw, 1.95rem); font-weight: 600; margin-bottom: 10px; }
.cta-card p { font-size: 14px; color: var(--ink-2); margin-bottom: 22px; }

/* ---------- 8. 课程页布局 ---------- */
.lesson-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: clamp(28px, 4vw, 54px);
  align-items: start;
  padding-top: clamp(30px, 4vw, 46px);
  padding-bottom: 70px;
}
.lesson-side { position: sticky; top: 92px; }
.side-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 249, .72);
  padding: 18px 16px;
}
.side-label {
  font-size: 10.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
  padding-left: 12px;
}
.toc {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 420px);
  min-height: 60px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.toc-link {
  padding: 6px 0 6px 12px;
  border-left: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-2);
  transition: color .2s, border-color .2s, background-color .2s;
}
.toc-link:hover { color: var(--sage-d); background: rgba(233, 240, 234, .45); }
.toc-link.is-active {
  color: var(--sage-d);
  font-weight: 600;
  border-left: 2px solid var(--sage-d);
  background: rgba(233, 240, 234, .55);
}
.side-mark { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.mark-btn {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--ink-2);
  transition: background-color .22s, color .22s, border-color .22s;
}
.mark-btn:hover { border-color: var(--sage); color: var(--sage-d); }
.mark-btn.is-done {
  background: var(--sage-l);
  border-color: rgba(88, 119, 104, .4);
  color: var(--sage-d);
  font-weight: 600;
}
.mark-hint { margin-top: 7px; font-size: 10.5px; color: var(--ink-3); text-align: center; letter-spacing: .04em; }
.side-nav { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.side-nav-link {
  font-size: 11.5px;
  color: var(--ink-3);
  padding: 5px 0;
  transition: color .2s;
}
.side-nav-link:hover { color: var(--sage-d); }

.lesson-main { min-width: 0; max-width: 860px; counter-reset: sec; }

.lesson-head {
  padding-bottom: 26px;
  margin-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}
.lesson-head h1 {
  font-family: var(--serif);
  font-size: clamp(1.85rem, 3.6vw, 2.5rem);
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: .015em;
  margin: 12px 0 14px;
}
.lesson-lead {
  font-size: 15px;
  line-height: 1.95;
  color: var(--ink-2);
  max-width: 44em;
}
.lesson-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.lesson-meta span {
  font-size: 11px;
  color: var(--ink-3);
  background: rgba(255, 253, 249, .8);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  letter-spacing: .04em;
}

/* 章节标题与正文 */
.lesson-main h2 {
  counter-increment: sec;
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 54px 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2.2vw, 1.55rem);
  font-weight: 600;
  line-height: 1.5;
  scroll-margin-top: 96px;
}
.lesson-main h2::before {
  content: counter(sec, decimal-leading-zero);
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--rose-d);
  background: var(--rose-l);
  padding: 2px 8px;
  border-radius: 6px;
  transform: translateY(-2px);
}
.lesson-main h3 {
  margin: 30px 0 10px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  scroll-margin-top: 96px;
}
.lesson-main h4 { margin: 22px 0 8px; font-size: 14.5px; font-weight: 600; }
.lesson-main p {
  font-size: 15px;
  line-height: 1.95;
  color: #4a453e;
  margin: 12px 0;
}
.lesson-main > section > p:first-of-type { margin-top: 0; }
.lesson-main ul,
.lesson-main ol { margin: 12px 0; font-size: 15px; line-height: 1.95; color: #4a453e; }
.lesson-main li { margin: 5px 0; }
.lesson-main li::marker { color: var(--sage); }
.lesson-main strong { color: var(--ink); font-weight: 600; }
.lesson-main a:not(.btn):not(.side-nav-link):not(.chapter) {
  color: var(--sage-d);
  text-decoration: underline;
  text-decoration-color: rgba(88, 119, 104, .4);
  text-underline-offset: 3px;
  transition: color .2s, text-decoration-color .2s;
}
.lesson-main a:not(.btn):hover { color: var(--rose-d); text-decoration-color: rgba(169, 120, 98, .55); }
.lesson-main :not(pre) > code {
  font-family: var(--mono);
  font-size: .86em;
  padding: 1px 6px;
  margin: 0 1px;
  border-radius: 5px;
  background: #f1ebdf;
  color: #7b5c47;
  word-break: break-word;
}
.lesson-main kbd {
  font-family: var(--mono);
  font-size: 12px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--card);
  color: var(--ink-2);
}
.lesson-main blockquote {
  margin: 20px 0;
  padding: 4px 0 4px 20px;
  border-left: 2px solid var(--rose);
  color: var(--ink-2);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.95;
}
.lesson-main mark { background: var(--rose-l); color: var(--ink); padding: 0 3px; border-radius: 3px; }
.lesson-main hr { margin: 34px 0; border: 0; border-top: 1px dashed var(--line); }

/* 表格 */
.table-wrap {
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
  background: var(--card);
}
.lesson-main table,
.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.7;
}
.lesson-main table th,
.lesson-main table td,
.doc-table th,
.doc-table td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.lesson-main table th,
.doc-table th {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--paper-2);
  letter-spacing: .03em;
  white-space: nowrap;
}
.lesson-main table tr:last-child td,
.doc-table tr:last-child td { border-bottom: 0; }
.lesson-main table tbody tr:hover { background: rgba(242, 236, 224, .45); }
.lesson-main table code { font-size: 12px; }

/* 提示框 */
.callout {
  position: relative;
  margin: 20px 0;
  padding: 15px 18px 15px 20px;
  border-radius: 0 12px 12px 0;
  border-left: 3px solid var(--sage);
  background: rgba(233, 240, 234, .55);
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--ink-2);
}
.callout .callout-title {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--sage-d);
}
.callout p { margin: 4px 0; font-size: 13.5px; line-height: 1.85; color: var(--ink-2); }
.callout ul, .callout ol { margin: 6px 0; font-size: 13.5px; }
.callout--warn { border-left-color: var(--rose); background: rgba(248, 236, 230, .6); }
.callout--warn .callout-title { color: var(--rose-d); }
.callout--note { border-left-color: var(--gold); background: rgba(244, 236, 220, .55); }
.callout--note .callout-title { color: #9a7a45; }

/* 定义清单 / 要点 / 徽章 */
.def-list { display: grid; gap: 10px; margin: 18px 0; }
.def-list div {
  padding: 10px 16px;
  border-left: 2px solid var(--sage-l);
  background: rgba(255, 253, 249, .6);
  border-radius: 0 8px 8px 0;
  font-size: 13.5px;
  color: var(--ink-2);
}
.def-list b { color: var(--ink); font-weight: 600; }

.pill-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.pill-row span {
  font-size: 11.5px;
  font-family: var(--mono);
  color: var(--sage-d);
  border: 1px solid rgba(88, 119, 104, .25);
  background: rgba(233, 240, 234, .5);
  border-radius: 999px;
  padding: 2px 10px;
}

.check-list { list-style: none; padding-left: 0; margin: 16px 0; }
.check-list li {
  position: relative;
  padding-left: 26px;
  margin: 8px 0;
  font-size: 14px;
  line-height: 1.85;
}
.check-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 1px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--sage-l);
  color: var(--sage-d);
  font-size: 10px;
  display: grid;
  place-items: center;
}
.check-list.is-cross li::before { content: "×"; background: var(--rose-l); color: var(--rose-d); }

/* ---------- 9. 代码卡片 ---------- */
.code-card {
  margin: 20px 0;
  border-radius: 13px;
  overflow: hidden;
  background: var(--code-bg);
  box-shadow: 0 16px 34px -26px rgba(44, 51, 46, .9);
}
.code-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--code-head);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.code-lang {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #9fb3a7;
}
.code-title {
  font-size: 11px;
  color: #8b9c91;
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.code-actions { margin-left: auto; display: flex; gap: 7px; flex-shrink: 0; }
.mini-btn {
  padding: 4px 11px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  font-size: 10.5px;
  letter-spacing: .06em;
  color: #cbd6cf;
  background: transparent;
  transition: background-color .2s, color .2s, border-color .2s;
}
.mini-btn:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.mini-btn.is-copied { color: #b6d4c2; border-color: rgba(182, 212, 194, .4); }
.code-card pre {
  margin: 0;
  padding: 17px 19px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.85;
  color: var(--code-ink);
  tab-size: 2;
  scrollbar-width: thin;
  scrollbar-color: #56645b transparent;
}
.code-card code { font-family: inherit; white-space: pre; }
.code-card pre::-webkit-scrollbar { height: 8px; }
.code-card pre::-webkit-scrollbar-thumb { background: #4a564e; border-radius: 999px; }
.code-card pre::-webkit-scrollbar-track { background: transparent; }

/* 简易语法着色 */
.tok-tag { color: #b8d3c5; }
.tok-attr { color: #e8c9a0; }
.tok-str { color: #d9b0a4; }
.tok-punct { color: #7f9186; }
.tok-doctype { color: #c2a06b; }
.tok-comment { color: #7e8b81; font-style: italic; }
.tok-eq { color: #9aab9f; }

.preview-pane {
  display: none;
  border-top: 1px solid rgba(255, 255, 255, .12);
  background: #ffffff;
}
.preview-pane.is-open { display: block; }
.preview-pane iframe {
  display: block;
  width: 100%;
  height: 300px;
  border: 0;
  background: #fff;
}
.preview-pane iframe.is-tall { height: 420px; }

/* 直接展示的示例 */
.demo-box {
  position: relative;
  margin: 22px 0;
  padding: 24px 20px 20px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
}
.demo-label {
  position: absolute;
  top: -9px;
  left: 16px;
  padding: 0 8px;
  background: var(--paper);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.demo-box > :last-child { margin-bottom: 0; }
.demo-box p { font-size: 14px; }

/* ---------- 10. 课程页尾 ---------- */
.lesson-foot {
  margin-top: 56px;
  padding-top: 26px;
  border-top: 1px dashed var(--line);
}
.lesson-foot-label { font-size: 11px; letter-spacing: .18em; color: var(--ink-3); margin-bottom: 12px; text-transform: uppercase; }
.lesson-foot-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lesson-foot-links a {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 249, .7);
  transition: border-color .25s, transform .25s, box-shadow .25s;
}
.lesson-foot-links a:hover { border-color: var(--sage); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.lesson-foot-links span { display: block; font-size: 10.5px; letter-spacing: .12em; color: var(--ink-3); margin-bottom: 3px; }
.lesson-foot-links strong { font-family: var(--serif); font-size: 14.5px; font-weight: 600; color: var(--ink); }
.lesson-foot-links a.next { text-align: right; }

/* ---------- 11. 练习场 ---------- */
.tool-page { max-width: 1320px; margin: 0 auto; padding: 34px 24px 60px; }
.tool-head { margin-bottom: 24px; max-width: 760px; }
.tool-head h1 { font-family: var(--serif); font-size: clamp(1.8rem, 3.4vw, 2.4rem); font-weight: 600; margin: 10px 0 10px; }
.tool-head p { font-size: 14px; color: var(--ink-2); line-height: 1.9; }

.pg-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.pg-toolbar label { font-size: 12px; color: var(--ink-3); letter-spacing: .06em; }
.pg-select {
  max-width: 100%;
  padding: 8px 34px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.pg-toolbar .spacer { flex: 1; }
.pg-status { font-size: 11px; color: var(--ink-3); letter-spacing: .04em; }

.pg-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - 340px);
  min-height: 430px;
}
.pg-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.pg-pane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(242, 236, 224, .5);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.pg-pane-head .pg-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sage); }
.pg-pane-head .pg-dot.rose { background: var(--rose); }
.pg-actions { margin-left: auto; display: flex; gap: 6px; }
.pg-btn {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10.5px;
  color: var(--ink-2);
  background: var(--card);
  letter-spacing: .04em;
  transition: border-color .2s, color .2s;
}
.pg-btn:hover { border-color: var(--sage); color: var(--sage-d); }
#editor {
  flex: 1;
  width: 100%;
  padding: 16px;
  border: 0;
  outline: none;
  resize: none;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.75;
  color: #33413a;
  background: #fffdf8;
  tab-size: 2;
}
#preview { flex: 1; width: 100%; border: 0; background: #fff; }
.pg-tip {
  margin-top: 14px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.9;
}
.pg-tip code {
  font-family: var(--mono);
  background: var(--paper-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11.5px;
}

/* ---------- 12. 速查表 ---------- */
.cheat-page { max-width: var(--maxw); margin: 0 auto; padding: 34px 24px 70px; }
.cheat-head { max-width: 740px; margin-bottom: 22px; }
.cheat-head h1 { font-family: var(--serif); font-size: clamp(1.8rem, 3.4vw, 2.4rem); font-weight: 600; margin: 10px 0; }
.cheat-head p { font-size: 14px; color: var(--ink-2); line-height: 1.9; }
.filter-bar {
  position: sticky;
  top: 70px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  margin: 18px 0 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(250, 247, 240, .94);
  backdrop-filter: blur(10px);
}
.filter-search {
  flex: 1;
  min-width: 190px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 13px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.filter-search:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(139, 167, 154, .18); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--card);
  transition: all .2s;
}
.chip:hover { border-color: var(--sage); color: var(--sage-d); }
.chip.is-active { background: var(--sage-d); border-color: var(--sage-d); color: #fbf8f2; }
.cheat-group { margin-top: 32px; }
.cheat-group h2 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.cheat-group h2 span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gold);
  letter-spacing: .08em;
}
.cheat-table code { font-size: 12px; white-space: nowrap; }
.cheat-table td:first-child { width: 170px; }
.cheat-table td:nth-child(2) { width: 190px; color: var(--ink-2); }
.cheat-table td:last-child { color: var(--ink-3); font-size: 12.5px; }
.cheat-table tbody tr.is-hidden { display: none; }
.cheat-group.is-hidden { display: none; }
.cheat-empty { display: none; padding: 40px 0; text-align: center; color: var(--ink-3); font-size: 13px; }
.cheat-empty.is-visible { display: block; }

/* 局部工具类 */
.mt-18 { margin-top: 18px; }
.section-lead a { color: var(--sage-d); text-decoration: underline; text-underline-offset: 3px; }
.cta-card .eyebrow { justify-content: center; }
.cta-card .hero-actions { justify-content: center; }

/* ---------- 13. 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(242, 236, 224, .4);
  padding: 38px 24px 26px;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  align-items: flex-start;
  justify-content: space-between;
}
.footer-title { font-family: var(--serif); font-size: 16px; letter-spacing: .1em; font-weight: 600; }
.footer-note { font-size: 12px; color: var(--ink-2); margin-top: 6px; line-height: 1.8; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 18px; font-size: 12px; color: var(--ink-2); padding-top: 4px; }
.footer-nav a:hover { color: var(--sage-d); }
.footer-copy {
  max-width: var(--maxw);
  margin: 22px auto 0;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: .05em;
}

/* ---------- 14. 回到顶部 ---------- */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 253, 249, .92);
  color: var(--ink-2);
  font-size: 16px;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .25s, visibility .25s, transform .25s, color .2s, border-color .2s;
  box-shadow: var(--shadow-sm);
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { color: var(--sage-d); border-color: var(--sage); }

/* ---------- 15. 入场动画 ---------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero-title, .hero-lead, .hero-actions, .hero-stats { animation: fade-up .8s both; }
.hero-lead { animation-delay: .08s; }
.hero-actions { animation-delay: .16s; }
.hero-stats { animation-delay: .24s; }
.hero-art { animation: fade-up .9s .2s both; }

/* ---------- 16. 响应式 ---------- */
@media (max-width: 1020px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { order: -1; min-height: 300px; }
  .hero-art::before { width: 260px; }
  .hero-title { font-size: clamp(2.1rem, 6vw, 2.9rem); }
  .art-frame { width: min(100%, 340px); }
  .lesson-layout { grid-template-columns: minmax(0, 1fr); }
  .lesson-side { display: none; }
  .lesson-main { max-width: 100%; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 10px 20px 20px;
    background: rgba(250, 247, 240, .985);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    max-height: calc(100vh - 68px);
    overflow-y: auto;
  }
  body.nav-open .nav-links { display: flex; }
  .nav-link {
    padding: 12px 4px;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    width: 100%;
    justify-content: space-between;
  }
  .nav-link::after { display: none; }
  .nav-link.is-active { color: var(--sage-d); }
  .nav-drop { width: 100%; }
  .drop-menu {
    position: static;
    display: none;
    width: 100%;
    transform: none;
    opacity: 1;
    visibility: visible;
    border: 0;
    box-shadow: none;
    background: transparent;
    padding: 4px 0 8px 8px;
  }
  .drop-menu::before { display: none; }
  .nav-drop.is-open .drop-menu { display: block; }
  .nav-drop:hover .drop-menu { display: none; }
  .nav-drop.is-open:hover .drop-menu { display: block; }
  .drop-menu a { padding: 9px 12px; }
  .pg-layout { grid-template-columns: 1fr; height: auto; }
  .pg-pane { min-height: 340px; }
  .pg-pane:nth-child(1) { height: 380px; }
  .pg-pane:nth-child(2) { height: 420px; }
  .filter-bar { top: 62px; }
  .cheat-table td:first-child { width: auto; }
}

@media (max-width: 720px) {
  .chapters { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .lesson-foot-links { grid-template-columns: 1fr; }
  .lesson-foot-links a.next { text-align: left; }
  .brand-text small { display: none; }
  .hero-stats { gap: 20px; }
  .art-stamp { width: 70px; height: 70px; font-size: 10.5px; }
  .footer-inner { flex-direction: column; }
  .progress-card { gap: 14px; padding: 20px; }
  .lesson-main p, .lesson-main ul, .lesson-main ol { font-size: 14.5px; }
  .code-card pre { font-size: 12px; padding: 14px; }
  .demo-box { padding: 22px 16px 16px; }
  .tool-page, .cheat-page { padding-left: 16px; padding-right: 16px; }
  .page-wrap, .hero-inner, .section-inner { padding-left: 18px; padding-right: 18px; }
  .topbar-inner { padding: 0 18px; }
  .filter-bar { position: static; }
}

/* ---------- 17. 可访问性与打印 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-delay: 0ms !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  .topbar, .lesson-side, .to-top, .progress-bar, .site-footer, .code-actions, .preview-pane { display: none !important; }
  body { background: #fff; }
  .lesson-layout { display: block; }
  .code-card { background: #f5f5f5; box-shadow: none; }
  .code-card pre { color: #222; }
}
