/* 张宇涵的cos后期Procreate 自学站：贴纸糖果风
   颜色即分类：紫=知识 粉=作业 薄荷=找图 黄=易错 */
:root {
  color-scheme: light;
  --cream: #FFFDF5;
  --ink: #1E293B;
  --white: #FFFFFF;
  --violet: #8B5CF6; --violet-50: #F5F3FF; --violet-100: #EDE9FE; --violet-700: #6D28D9;
  --pink: #F472B6;   --pink-50: #FDF2F8;   --pink-100: #FCE7F3;
  --mint: #34D399;   --mint-50: #ECFDF5;   --mint-100: #D1FAE5;
  --yellow: #FBBF24; --yellow-50: #FFFBEB; --yellow-100: #FEF3C7;
  --red: #EF4444;    --red-50: #FEF2F2;
  --muted: #475569; --line: #E2E8F0; --line-strong: #CBD5E1;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --bd: 2px solid var(--ink);
  --sh-s: 2px 2px 0 var(--ink); --sh: 4px 4px 0 var(--ink); --sh-l: 6px 6px 0 var(--ink);
  --r-l: 16px; --r-m: 12px; --r-s: 8px;
  --pop: cubic-bezier(.34, 1.56, .64, 1);
  --measure: 680px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.8; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--violet-700); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: #C4B5FD; }
a:hover { text-decoration-color: var(--violet-700); }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.3; font-weight: 800; margin: 0; }
p { margin: 0 0 1em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--yellow); border: var(--bd); border-radius: 999px; padding: 6px 16px; color: var(--ink); font-weight: 700; }
.skip:focus { top: 12px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------- 页眉 ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--cream); border-bottom: var(--bd); }
.header-inner { max-width: 1160px; margin: 0 auto; padding: 0 20px; height: 68px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex-shrink: 0; }
.brand-mark { width: 30px; height: 30px; border: var(--bd); border-radius: 50%; background: var(--pink); box-shadow: var(--sh-s); position: relative; }
.brand-mark::after { content: ""; position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--white); border: 2px solid var(--ink); right: -2px; top: -3px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 17px; font-weight: 800; }
.brand-text span { font-size: 13px; color: var(--muted); font-weight: 600; }
.nav { display: flex; gap: 8px; margin-left: auto; overflow-x: auto; scrollbar-width: none; padding: 4px 4px 6px; }
.nav::-webkit-scrollbar { display: none; }
.nav-link { flex-shrink: 0; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px; padding: 5px 14px; border: 2px solid transparent; border-radius: 999px; }
.nav-link:hover { border-color: var(--ink); background: var(--white); }
.nav-link.is-current { background: var(--violet-100); border-color: var(--ink); box-shadow: var(--sh-s); }

/* ---------- 通用组件 ---------- */
.page { max-width: 1160px; margin: 0 auto; padding: 36px 20px 72px; }
.page-head { max-width: 760px; margin-bottom: 32px; }
.page-head h1 { font-size: 38px; margin-bottom: 12px; }
.lead { font-size: 18px; color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 20px; font: inherit; font-size: 16px; font-weight: 800; color: var(--ink); text-decoration: none; background: var(--white); border: var(--bd); border-radius: 999px; box-shadow: var(--sh); cursor: pointer; transition: transform .2s var(--pop), box-shadow .2s var(--pop), background .2s; }
.btn:hover { transform: translate(-2px, -2px); box-shadow: var(--sh-l); }
.btn:active { transform: translate(2px, 2px); box-shadow: var(--sh-s); }
.btn-primary { background: #7C3AED; color: var(--white); }
.btn-ghost { box-shadow: none; background: transparent; }
.btn-ghost:hover { box-shadow: var(--sh-s); transform: none; }
.btn-small { min-height: 36px; padding: 4px 14px; font-size: 14px; box-shadow: var(--sh-s); }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 14px; font-weight: 700; padding: 2px 12px; border: var(--bd); border-radius: 999px; background: var(--white); }
.chip-lv-a { background: var(--mint-100); } .chip-lv-b { background: var(--yellow-100); } .chip-lv-c { background: var(--pink-100); } .chip-lv-d { background: var(--violet-100); }
.pill { display: inline-block; font-size: 12px; font-weight: 700; line-height: 1.6; padding: 0 9px; border: 1.5px solid var(--ink); border-radius: 999px; background: var(--white); white-space: nowrap; }
.pill-muted { border-color: var(--line-strong); color: var(--muted); background: transparent; }
.pill-paid { background: var(--yellow-100); }
.mod-no { display: inline-flex; align-items: center; justify-content: center; min-width: 2.6em; padding: 0 8px; margin-right: 10px; font-size: .62em; vertical-align: .22em; background: var(--white); border: var(--bd); border-radius: 999px; box-shadow: var(--sh-s); }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 20px; }
.crumbs a { color: var(--muted); }
.section-head { margin-bottom: 20px; }
.section-head h2 { font-size: 28px; margin-bottom: 6px; }
.section-head p { color: var(--muted); margin: 0; }

/* 卡片：颜色即分类 */
.card { background: var(--white); border: var(--bd); border-radius: var(--r-l); padding: 22px 24px 18px; margin: 28px 0; box-shadow: var(--sh); }
.card h2 { font-size: 21px; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.card h2::before { content: ""; width: 14px; height: 14px; border: var(--bd); border-radius: 4px; flex-shrink: 0; }
.card h3 { font-size: 16px; margin: 16px 0 6px; }
.card ul { padding-left: 1.3em; margin: 0 0 .6em; }
.card p:last-child { margin-bottom: 0; }
.card-sub, .card-foot { font-size: 14px; color: var(--muted); }
.card-foot { margin-top: 12px; }
.card-goal { box-shadow: 4px 4px 0 var(--violet); } .card-goal h2::before { background: var(--violet); }
.card-find { background: var(--mint-50); box-shadow: 4px 4px 0 var(--mint); } .card-find h2::before { background: var(--mint); }
.card-hw { background: var(--pink-50); box-shadow: 4px 4px 0 var(--pink); } .card-hw h2::before { background: var(--pink); }
.card-check { box-shadow: var(--sh); } .card-check h2::before { background: var(--yellow); }
.ticks { list-style: none; padding-left: 0 !important; }
.ticks li { position: relative; padding-left: 28px; margin-bottom: 6px; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 14px; height: 8px; border-left: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(-45deg); }
.hw-toggle { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 2px dashed #F9A8D4; font-weight: 700; cursor: pointer; }
input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--violet); flex-shrink: 0; cursor: pointer; }

/* 提示框 */
.callout { border: var(--bd); border-radius: var(--r-m); padding: 14px 18px 4px; margin: 22px 0; background: var(--white); }
.callout-title { font-weight: 800; margin-bottom: 4px; }
.callout > :last-child { margin-bottom: 10px; }
.callout ul, .callout ol { padding-left: 1.3em; }
.callout-warn { background: var(--yellow-50); box-shadow: 4px 4px 0 var(--yellow); }
.callout-tip, .callout-why { background: var(--violet-50); box-shadow: 4px 4px 0 var(--violet); }
.callout-danger { background: var(--red-50); box-shadow: 4px 4px 0 var(--red); }
.callout-check { background: var(--mint-50); box-shadow: 4px 4px 0 var(--mint); }

/* 步骤卡：每个二级标题下重新从 1 编号 */
.prose h2 { counter-reset: step; }
.step { position: relative; counter-increment: step; margin: 20px 0; padding: 16px 20px 6px 66px; background: var(--white); border: var(--bd); border-radius: var(--r-l); box-shadow: var(--sh-s); }
.step::before { content: counter(step); position: absolute; left: 16px; top: 14px; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 17px; background: var(--yellow); border: var(--bd); border-radius: 50%; }
.step-title { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.step .fig { margin: 14px 0; }
.step .fig img { box-shadow: none; }
.step-see { margin: 10px 0 12px; padding: 8px 12px; background: var(--mint-50); border-left: 5px solid var(--mint); border-radius: 6px; font-size: 16px; }
.step ul, .step ol { padding-left: 1.3em; }

/* 菜单路径按键贴纸 */
.path { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; vertical-align: 1px; }
.path kbd { font: inherit; font-size: .88em; font-weight: 700; line-height: 1.5; padding: 0 9px; background: var(--white); border: 1.5px solid var(--ink); border-radius: 7px; box-shadow: 1.5px 1.5px 0 var(--ink); white-space: nowrap; }
.path i { font-style: normal; font-weight: 800; color: var(--muted); }

/* ---------- 首页 ---------- */
.home .page { padding-top: 0; }
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 48px; align-items: center; padding: 48px 0 44px; border-bottom: 2px dashed var(--line-strong); }
.hero-demo { margin: 0; }
.hero-demo .compare-stage { transform: rotate(1.2deg); }
.hero-demo .compare-stage { box-shadow: var(--sh-l); }
.hero-demo figcaption { font-size: 14px; }
.hero-demo-link { display: inline-block; margin-top: 4px; font-weight: 700; font-size: 15px; }
.hero h1 { font-size: clamp(34px, 5.4vw, 60px); line-height: 1.18; letter-spacing: -.01em; margin-bottom: 20px; }
.hero .lead { max-width: 36em; font-size: 19px; margin-bottom: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.continue-note { margin-top: 16px; font-size: 15px; color: var(--muted); }
.quest { padding: 48px 0 24px; }
.quest-path { list-style: none; margin: 0; padding: 8px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px 32px; counter-reset: q; }
.quest-stop { position: relative; }
/* 连接线：同一行内向右，行尾向下 */
.quest-stop::after { content: ""; position: absolute; top: 50%; right: -34px; width: 36px; border-top: 3px dashed var(--ink); z-index: 0; }
.quest-stop:nth-child(3n)::after, .quest-stop:last-child::after { display: none; }
.quest-card { position: relative; z-index: 1; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "no title" "no meta" "bar bar" "count count"; column-gap: 14px; padding: 18px 18px 14px; color: var(--ink); text-decoration: none; background: var(--white); border: var(--bd); border-radius: 20px; box-shadow: var(--sh); transition: transform .2s var(--pop), box-shadow .2s var(--pop); }
.quest-card:hover { transform: translate(-2px, -3px) rotate(-.6deg); box-shadow: var(--sh-l); }
.quest-no { grid-area: no; align-self: start; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 900; border: var(--bd); border-radius: 50%; }
.quest-title { grid-area: title; font-size: 19px; font-weight: 800; line-height: 1.35; align-self: end; }
.quest-meta { grid-area: meta; font-size: 14px; color: var(--muted); }
.quest-bar { grid-area: bar; height: 10px; margin-top: 14px; border: var(--bd); border-radius: 999px; background: var(--cream); overflow: hidden; }
.quest-bar i { display: block; height: 100%; background: var(--ink); transition: width .6s var(--pop); }
.quest-count { grid-area: count; font-size: 13px; font-weight: 700; margin-top: 6px; color: var(--muted); }
.lv-a .quest-no { background: var(--mint); } .lv-b .quest-no { background: var(--yellow); } .lv-c .quest-no { background: var(--pink); } .lv-d .quest-no { background: #7C3AED; color: var(--white); }
.quest-card.is-done .quest-count { color: var(--ink); }
.home-problems, .how { padding: 40px 0 8px; }
.sticker-wall { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.sticker { display: inline-block; padding: 6px 16px; font-size: 15px; font-weight: 700; color: var(--ink); text-decoration: none; background: var(--white); border: var(--bd); border-radius: 999px; box-shadow: var(--sh-s); transition: transform .2s var(--pop), box-shadow .2s var(--pop); }
.sticker:hover { transform: translate(-1px, -2px); box-shadow: var(--sh); }
.sticker.has-page { background: var(--yellow-100); }
.sticker-wall li:nth-child(4n+2) .sticker { transform: rotate(-1.2deg); }
.sticker-wall li:nth-child(4n+3) .sticker { transform: rotate(.9deg); }
.sticker-wall li:nth-child(4n+2) .sticker:hover, .sticker-wall li:nth-child(4n+3) .sticker:hover { transform: translate(-1px, -2px); }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.how-item { padding: 18px 20px 6px; border: var(--bd); border-radius: var(--r-l); background: var(--white); }
.how-item h3 { font-size: 18px; margin-bottom: 6px; }
.how-item p { font-size: 15px; color: var(--muted); }

/* ---------- 课程地图 / 模块页 ---------- */
.map-module { margin: 0 0 40px; }
.map-module-head { margin-bottom: 14px; }
.map-module-head h2 { font-size: 24px; margin-bottom: 4px; }
.map-module-head h2 a { color: var(--ink); text-decoration: none; }
.map-module-head p { color: var(--muted); margin: 0; }
.map-meta { margin-left: 10px; font-size: 14px; font-weight: 700; color: var(--ink); }
.lv-a .mod-no { background: var(--mint); } .lv-b .mod-no { background: var(--yellow); } .lv-c .mod-no { background: var(--pink); } .lv-d .mod-no { background: #7C3AED; color: var(--white); }
.lesson-list { list-style: none; padding: 0; margin: 0; border: var(--bd); border-radius: var(--r-l); background: var(--white); box-shadow: var(--sh); overflow: hidden; }
.lesson-list li + li { border-top: 1.5px solid var(--line); }
.lesson-row { display: flex; align-items: center; gap: 14px; padding: 12px 18px; color: var(--ink); text-decoration: none; }
.lesson-row:hover { background: var(--violet-50); }
.lr-check { width: 22px; height: 22px; flex-shrink: 0; border: var(--bd); border-radius: 6px; background: var(--white); position: relative; }
.is-done .lr-check, [data-done-state="1"] .lr-check { background: var(--mint); }
.is-done .lr-check::after { content: ""; position: absolute; left: 5px; top: 1px; width: 6px; height: 11px; border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(45deg); }
.lr-no { font-weight: 800; width: 2.2em; flex-shrink: 0; }
.lr-title { flex: 1; font-weight: 700; display: flex; flex-direction: column; }
.lr-title small { font-weight: 400; font-size: 14px; color: var(--muted); line-height: 1.6; }
.lr-time { font-size: 14px; color: var(--muted); white-space: nowrap; }
.lesson-list-big .lesson-row { padding: 16px 20px; align-items: flex-start; }
.lesson-list-big .lr-check, .lesson-list-big .lr-no { margin-top: 2px; }
.stage { margin-top: 36px; }

/* ---------- 课程页 ---------- */
.lesson-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 48px; align-items: start; }
.lesson-side { position: sticky; top: 92px; max-height: calc(100vh - 110px); overflow: auto; padding: 2px 6px 8px 2px; }
.side-toc { border: var(--bd); border-radius: var(--r-m); background: var(--white); box-shadow: var(--sh-s); }
.side-toc summary { cursor: pointer; padding: 10px 14px; font-weight: 800; font-size: 15px; list-style: none; }
.side-toc summary::-webkit-details-marker { display: none; }
.side-toc summary::after { content: "▾"; float: right; }
.side-toc[open] summary { border-bottom: 1.5px solid var(--line); }
.side-toc ol { list-style: none; margin: 0; padding: 6px; }
.side-toc a { display: flex; gap: 8px; align-items: flex-start; padding: 5px 8px; border-radius: 8px; font-size: 14px; line-height: 1.5; color: var(--ink); text-decoration: none; }
.side-toc a:hover { background: var(--violet-50); }
.side-toc a.is-current { background: var(--violet-100); font-weight: 800; }
.side-toc .lr-check { width: 16px; height: 16px; border-width: 1.5px; border-radius: 4px; margin-top: 3px; }
.side-toc .is-done .lr-check::after { left: 3.5px; top: 0; width: 4px; height: 8px; border-width: 2px; }
.side-sections { margin-top: 18px; font-size: 14px; }
.side-sections p { font-weight: 800; margin-bottom: 4px; }
.side-sections ol { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line-strong); }
.side-sections a { display: block; padding: 3px 0 3px 12px; color: var(--muted); text-decoration: none; line-height: 1.5; }
.side-sections a:hover { color: var(--ink); }
.lesson { max-width: var(--measure); }
.lesson-head { margin-bottom: 28px; }
.lesson-head h1 { font-size: 36px; margin-bottom: 12px; }
.lesson-no { display: inline-block; margin-right: 12px; padding: 0 12px; font-size: .7em; vertical-align: .14em; background: var(--yellow); border: var(--bd); border-radius: 10px; box-shadow: var(--sh-s); }
.lesson-head .chips { margin-top: 4px; }
.prereq { margin: 14px 0 0; font-size: 15px; color: var(--muted); }

/* 正文排版 */
.prose { font-size: 17px; }
.prose h2 { font-size: 25px; margin: 48px 0 14px; padding-top: 4px; }
.prose h2::before { content: ""; display: inline-block; width: 10px; height: 24px; margin-right: 12px; vertical-align: -4px; background: var(--violet); border: var(--bd); border-radius: 4px; }
.prose h3 { font-size: 19px; margin: 30px 0 10px; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
.prose li > ul, .prose li > ol { margin-top: .35em; }
.prose ol > li::marker { font-weight: 800; }
.prose strong, .prose b { font-weight: 800; }
.prose code { font-size: .88em; padding: 0 5px; background: #F1F5F9; border: 1.5px solid var(--line-strong); border-radius: 6px; }
.prose hr { border: 0; border-top: 2px dashed var(--line-strong); margin: 40px 0; }
.prose-page { max-width: var(--measure); }
.table-wrap { overflow-x: auto; margin: 18px 0 24px; border: var(--bd); border-radius: var(--r-m); background: var(--white); box-shadow: var(--sh-s); }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.6; }
.table-wrap th { text-align: left; font-weight: 800; padding: 9px 14px; background: var(--violet-100); border-bottom: var(--bd); white-space: nowrap; }
.table-wrap td { padding: 9px 14px; border-top: 1.5px solid var(--line); vertical-align: top; }
.table-wrap tr:first-child td { border-top: 0; }
.fig { margin: 26px 0; }
.fig img { width: 100%; height: auto; }
.fig img, .compare-stage { border: var(--bd); border-radius: var(--r-m); background: var(--white); box-shadow: var(--sh-s); }
.fig figcaption, .compare figcaption { font-size: 14px; color: var(--muted); margin-top: 10px; }

/* 修图前后对比滑块 */
.compare { margin: 28px 0; }
.compare-stage { position: relative; overflow: hidden; --pos: 50%; }
.compare-stage img { width: 100%; user-select: none; -webkit-user-drag: none; }
.compare-after { position: absolute; inset: 0; height: 100%; object-fit: cover; clip-path: inset(0 0 0 var(--pos)); }
.compare-handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 0; border-left: 3px solid var(--ink); pointer-events: none; }
.compare-handle::after { content: "⇆"; position: absolute; top: 86%; left: -21px; width: 38px; height: 38px; margin-top: -19px; display: flex; align-items: center; justify-content: center; font-weight: 900; background: var(--yellow); border: var(--bd); border-radius: 50%; box-shadow: var(--sh-s); }
.compare-range { width: 100%; margin: 12px 0 0; accent-color: var(--violet); height: 28px; cursor: ew-resize; }
.compare figcaption { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* 资料列表 */
.lesson-res { margin: 48px 0 8px; }
.lesson-res h2 { font-size: 22px; margin: 28px 0 12px; }
.res-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.res-item { padding: 12px 16px; border: var(--bd); border-radius: var(--r-m); background: var(--white); }
.res-item > a { font-weight: 800; }
.res-tags { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 8px; vertical-align: 2px; }
.res-item p { margin: 6px 0 0; font-size: 15px; color: var(--muted); }
.res-list-compact .res-item { padding: 9px 16px; }
.related { margin: 36px 0; }
.related h2 { font-size: 20px; margin-bottom: 12px; }
.checklist { list-style: none; padding: 0 !important; }
.checklist li { margin-bottom: 8px; }
.checklist label { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.checklist input { margin-top: 4px; }
.checklist input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--mint); text-decoration-thickness: 3px; }
.lesson-foot { margin-top: 44px; padding-top: 28px; border-top: 2px dashed var(--line-strong); }
.btn-done[aria-pressed="true"] { background: var(--mint); color: var(--ink); }
.pager { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-top: 22px; }
.pager .btn { box-shadow: var(--sh-s); font-size: 15px; }
.pager-next { margin-left: auto; }
.lesson-outline h2 { font-size: 22px; margin: 8px 0 10px; }

/* ---------- 问题速查 ---------- */
.prob-group { margin-bottom: 40px; }
.prob-group > h2 { font-size: 22px; margin-bottom: 14px; }
.prob-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.prob-card { padding: 18px 20px 14px; border: var(--bd); border-radius: var(--r-l); background: var(--white); box-shadow: var(--sh-s); }
.prob-card.has-page { background: var(--yellow-50); box-shadow: 4px 4px 0 var(--yellow); }
.prob-card h3 { font-size: 18px; margin-bottom: 8px; }
.prob-card h3 a { color: var(--ink); }
.prob-card p { font-size: 15px; margin-bottom: 10px; }
.prob-lessons { color: var(--muted); }
.prob-card:target { outline: 3px solid var(--violet); outline-offset: 4px; }
.problem-layout { max-width: var(--measure); }
.lesson-links { list-style: none; padding: 0 !important; display: grid; gap: 8px; }
.lesson-links a { font-weight: 700; }

/* ---------- 资料库 ---------- */
.filters { display: grid; gap: 10px; margin-bottom: 28px; padding: 16px 18px; border: var(--bd); border-radius: var(--r-l); background: var(--white); }
.filters fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters legend { float: left; font-weight: 800; font-size: 14px; margin-right: 6px; width: 3em; }
.fchip { font: inherit; font-size: 14px; font-weight: 700; padding: 2px 12px; color: var(--ink); background: var(--white); border: 1.5px solid var(--ink); border-radius: 999px; cursor: pointer; }
.fchip:hover { background: var(--violet-50); }
.fchip.is-on { background: #7C3AED; color: var(--white); box-shadow: var(--sh-s); }
.filter-count { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.res-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.res-card { padding: 16px 20px 12px; border: var(--bd); border-radius: var(--r-l); background: var(--white); box-shadow: var(--sh-s); }
.res-card[hidden] { display: none; }
.res-card h2 { font-size: 17px; line-height: 1.45; margin-bottom: 8px; }
.res-card .res-tags { margin: 0 0 8px; display: flex; }
.res-card p { font-size: 15px; margin-bottom: 8px; }
.res-used { color: var(--muted); }
.res-card:target { outline: 3px solid var(--violet); outline-offset: 4px; }

/* ---------- 作业中心 ---------- */
.hw-total { font-weight: 800; }
.hw-module { margin-bottom: 36px; }
.hw-module > h2 { font-size: 22px; margin-bottom: 14px; }
.hw-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.hw-item { display: flex; gap: 14px; padding: 14px 18px; border: var(--bd); border-radius: var(--r-m); background: var(--white); }
.hw-item h3 { font-size: 16px; margin-bottom: 4px; }
.hw-item p { font-size: 15px; margin-bottom: 4px; }
.hw-find { color: var(--muted); }
.hw-task p, .hw-task ol, .hw-task ul { font-size: 15px; margin: 0 0 4px; }
.hw-task ol, .hw-task ul { padding-left: 1.3em; }
.hw-check { padding-top: 2px; }
.hw-stage { background: var(--pink-50); box-shadow: 4px 4px 0 var(--pink); }
.hw-item.is-done { background: var(--mint-50); }

/* ---------- 搜索 / 使用说明 ---------- */
.search-box { display: flex; gap: 12px; max-width: 640px; }
.search-box input { flex: 1; min-width: 0; font: inherit; font-size: 17px; padding: 8px 18px; border: var(--bd); border-radius: 999px; background: var(--white); box-shadow: inset 2px 2px 0 var(--line); }
.search-count { margin: 18px 0 10px; color: var(--muted); }
.search-results { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; max-width: 760px; }
.search-results li { padding: 12px 18px; border: var(--bd); border-radius: var(--r-m); background: var(--white); }
.search-results a { font-weight: 800; }
.search-results p { margin: 4px 0 0; font-size: 15px; color: var(--muted); }
.search-results mark { background: var(--yellow-100); color: inherit; padding: 0 2px; border-radius: 3px; }
.backup { display: flex; flex-wrap: wrap; gap: 14px; margin: 18px 0 10px; }
.backup-msg { font-weight: 700; min-height: 1.8em; }
.notfound { padding: 60px 0; }

/* ---------- 页脚 ---------- */
.site-footer { border-top: var(--bd); background: var(--white); }
.footer-inner { max-width: 1160px; margin: 0 auto; padding: 28px 20px 40px; font-size: 14px; color: var(--muted); }
.footer-inner p { margin-bottom: 6px; }
.footer-inner b { color: var(--ink); }

/* ---------- 响应式 ---------- */
@media (max-width: 1000px) {
  .lesson-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .lesson-side { position: static; max-height: none; overflow: visible; padding: 0; margin-bottom: 24px; }
  .side-sections { display: none; }
  .side-toc:not([open]) { box-shadow: var(--sh-s); }
  .lesson { max-width: none; }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .hero-demo { max-width: 460px; }
  .hero-demo .compare-stage { transform: none; }
  .quest-path { grid-template-columns: 1fr 1fr; gap: 22px 26px; }
  .quest-stop:nth-child(3n)::after { display: block; }
  .quest-stop:nth-child(2n)::after, .quest-stop:last-child::after { display: none; }
  .quest-stop::after { right: -28px; width: 30px; }
  .how-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .header-inner { height: auto; flex-wrap: wrap; gap: 6px; padding: 10px 14px 4px; }
  .brand-text b { font-size: 16px; }
  .nav { margin-left: -4px; width: calc(100% + 8px); }
  .nav-link { padding: 3px 12px; font-size: 14px; }
  html { scroll-padding-top: 120px; }
  .page { padding: 24px 16px 56px; }
  .page-head h1, .lesson-head h1 { font-size: 28px; }
  .hero { padding: 36px 0 32px; }
  .hero .lead { font-size: 17px; }
  .quest-path { grid-template-columns: 1fr; gap: 20px; }
  .quest-stop::after { display: block !important; top: auto; bottom: -22px; right: auto; left: 44px; width: 0; height: 22px; border-top: 0; border-left: 3px dashed var(--ink); }
  .quest-stop:last-child::after { display: none !important; }
  .card { padding: 18px 16px 14px; }
  .step { padding: 14px 14px 4px; }
  .step::before { position: static; float: left; margin: 0 10px 4px 0; width: 30px; height: 30px; font-size: 15px; }
  .step-title { padding-top: 2px; }
  .step .fig { clear: both; }
  .prose { font-size: 16px; }
  .prose h2 { font-size: 22px; }
  .lesson-row { padding: 12px 14px; gap: 10px; flex-wrap: wrap; }
  .lr-title { flex-basis: calc(100% - 90px); }
  .lr-time { margin-left: 46px; }
  .res-grid, .prob-grid { grid-template-columns: 1fr; }
  .pager .btn { width: 100%; }
  .search-box { flex-direction: column; }
}

/* ---------- 打印（作业卡、清单） ---------- */
@media print {
  .site-header, .site-footer, .lesson-side, .lesson-foot, .hw-toggle, .crumbs, .skip { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .card, .callout, .table-wrap, .fig img { box-shadow: none !important; }
  .lesson-layout { display: block; }
  a { color: inherit; text-decoration: none; }
  .print-sheet { break-inside: avoid; }
}

/* ---------- v4：阅读进度、悬浮按钮、目录抽屉 ---------- */
.read-progress { position: fixed; left: 0; right: 0; top: 0; height: 4px; z-index: 30; pointer-events: none; }
.read-progress i { display: block; height: 100%; width: 0; background: var(--violet-700); }
.fab { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 25; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.fab-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; min-width: 46px; padding: 6px 16px; font: inherit; font-size: 15px; font-weight: 800; color: var(--ink); background: var(--yellow); border: var(--bd); border-radius: 999px; box-shadow: var(--sh); cursor: pointer; }
.fab-btn:active { transform: translate(2px, 2px); box-shadow: var(--sh-s); }
.fab-top { justify-content: center; padding: 0; width: 46px; background: var(--white); font-size: 20px; }
.fab-cur { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 13px; color: var(--ink); }
.fab-cur:empty { display: none; }
.fab-cur::before { content: "· "; }
.toc-sheet { position: fixed; inset: 0; z-index: 40; background: rgba(30, 41, 59, .35); display: flex; justify-content: flex-end; }
.toc-sheet[hidden] { display: none; }
.toc-sheet-panel { width: min(420px, 92vw); height: 100%; overflow: auto; background: var(--cream); border-left: var(--bd); padding: 18px 18px 40px; }
.toc-sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 18px; }
.toc-sheet-list, .toc-sheet-list ol { list-style: none; margin: 0; padding: 0; }
.toc-sheet-list > li { border-bottom: 1.5px solid var(--line); }
.toc-sheet-list a { display: block; padding: 10px 6px; color: var(--ink); text-decoration: none; font-weight: 700; line-height: 1.5; }
.toc-sheet-list ol a { padding: 6px 6px 6px 22px; font-weight: 500; font-size: 15px; color: var(--muted); }
.toc-sheet-list a.is-current, .side-sections a.is-current { color: var(--violet-700); background: var(--violet-50); border-radius: 8px; }
.side-sections a.is-current { font-weight: 800; }
.sr-sep { color: var(--muted); font-weight: 600; }
/* 宽屏有左侧目录时，只留回到顶部 */
@media (min-width: 1001px) { .page-lesson ~ .fab [data-toc-open] { display: none; } }
@media print { .fab, .toc-sheet, .read-progress { display: none !important; } }
/* 图片：懒加载时保留占位比例 */
.prose img[width][height] { height: auto; max-width: 100%; }
.lesson, .prose, .problem-layout { min-width: 0; }
.notice { margin: 24px 0 0; padding: 14px 18px; background: var(--yellow-50); border: var(--bd); border-radius: var(--r-l); box-shadow: 4px 4px 0 var(--yellow); }
.notice[hidden] { display: none; }
.notice p { margin: 0 0 10px; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.backup-last { color: var(--muted); font-size: 15px; }
.res-note { font-size: 15px; color: var(--muted); margin: 0 0 14px; }
.prose-wide { max-width: none; }
