:root {
  --paper: #f8f4eb;
  --paper-deep: #eee6d7;
  --ink: #18372f;
  --ink-soft: #4d625b;
  --green: #1f5749;
  --green-2: #6e8d7b;
  --orange: #bd663c;
  --orange-soft: #ead0be;
  --blue: #89a8b4;
  --line: rgba(24, 55, 47, .16);
  --white: rgba(255, 255, 255, .9);
  --shadow: 0 24px 70px rgba(44, 48, 40, .17);
  --page-w: 210mm;
  --page-h: 297mm;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(189, 102, 60, .12), transparent 26rem),
    radial-gradient(circle at 90% 30%, rgba(137, 168, 180, .15), transparent 34rem),
    #dcd8cf;
  font-family: "Noto Sans CJK SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-variant-numeric: tabular-nums;
}

button { font: inherit; }
.reader-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 62px;
  padding: 0 28px;
  display: grid;
  grid-template-columns: 1fr minmax(180px, 420px) 1fr;
  align-items: center;
  gap: 24px;
  color: #fff;
  background: rgba(19, 47, 40, .94);
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .16);
}
.reader-brand, .reader-actions { display: flex; align-items: center; gap: 12px; }
.reader-actions { justify-content: flex-end; }
.brand-mark { font-family: "Noto Serif CJK SC", "Source Han Serif SC", serif; font-weight: 800; letter-spacing: .08em; }
.brand-version { padding: 3px 8px; border: 1px solid rgba(255,255,255,.25); border-radius: 99px; font-size: 11px; }
.reader-progress { height: 4px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.16); }
.reader-progress span { display: block; width: 0; height: 100%; background: #e9b894; transition: width .15s linear; }
.reader-actions button, .screen-footer button {
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px;
  padding: 7px 12px;
  color: inherit;
  background: rgba(255,255,255,.08);
  cursor: pointer;
}
.reader-actions button:hover, .screen-footer button:hover { background: rgba(255,255,255,.16); }

.toc {
  position: fixed;
  z-index: 60;
  top: 0;
  right: 0;
  width: min(420px, 92vw);
  height: 100dvh;
  padding: 22px;
  color: var(--ink);
  background: #fbf8f1;
  box-shadow: -20px 0 60px rgba(0,0,0,.24);
  transform: translateX(105%);
  transition: transform .25s ease;
  overflow-y: auto;
}
.toc.open { transform: translateX(0); }
.toc-mask { position: fixed; z-index: 50; inset: 0; background: rgba(5, 18, 15, .45); }
.toc-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.toc-head strong { font-size: 22px; font-family: "Noto Serif CJK SC", "Source Han Serif SC", serif; }
.toc-head button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--paper-deep); font-size: 24px; cursor: pointer; }
.toc nav { padding: 14px 0 40px; }
.toc a { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 11px 8px; color: var(--ink); text-decoration: none; border-bottom: 1px solid rgba(24,55,47,.08); }
.toc a:hover { background: rgba(110,141,123,.1); }
.toc-index { color: var(--orange); font-size: 12px; font-weight: 800; padding-top: 3px; }
.toc-title { line-height: 1.4; }

.course { padding: 44px 0 80px; }
.page {
  position: relative;
  width: var(--page-w);
  height: var(--page-h);
  margin: 0 auto 34px;
  overflow: hidden;
  isolation: isolate;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255,255,255,.72), rgba(255,255,255,.2)),
    var(--paper);
  box-shadow: var(--shadow);
  page-break-after: always;
  break-after: page;
}
.page:last-child { page-break-after: auto; break-after: auto; }
.page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -3;
  opacity: .42;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.8), transparent 35%),
    repeating-linear-gradient(0deg, rgba(24,55,47,.018) 0, rgba(24,55,47,.018) 1px, transparent 1px, transparent 5px);
}
.page-no {
  position: absolute;
  z-index: 6;
  right: 15mm;
  bottom: 10mm;
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--ink-soft);
  font-size: 9pt;
  letter-spacing: .05em;
}
.page-no::before { content: ""; width: 20mm; height: 1px; background: var(--line); }
.page-inner {
  position: relative;
  z-index: 5;
  height: 100%;
  padding: 18mm 17mm 18mm;
  display: flex;
  flex-direction: column;
}
.eyebrow {
  margin-bottom: 5mm;
  color: var(--orange);
  font-size: 10pt;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
.page-title {
  margin: 0;
  max-width: 165mm;
  font-family: "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", serif;
  font-size: 27pt;
  line-height: 1.2;
  letter-spacing: -.03em;
  white-space: pre-line;
}
.page-lead {
  max-width: 164mm;
  margin: 5mm 0 0;
  color: var(--ink-soft);
  font-size: 11.4pt;
  line-height: 1.76;
}
.section-rule { width: 18mm; height: 3px; margin: 5mm 0; border-radius: 9px; background: var(--orange); }
.section-spacer { flex: 1; }

.image-wash {
  position: absolute;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .16;
  filter: saturate(.9) contrast(.95);
}
.image-panel {
  position: relative;
  overflow: hidden;
  border-radius: 7mm;
  min-height: 64mm;
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 16px 34px rgba(48, 54, 44, .12);
}
.image-panel img { width: 100%; height: 100%; display: block; object-fit: cover; }
.image-panel::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px rgba(24,55,47,.08); border-radius: inherit; pointer-events: none; }

.cover-page { color: #17372f; }
.cover-page .image-wash { opacity: 1; filter: none; }
.cover-page::after { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg, rgba(248,244,235,.96) 0%, rgba(248,244,235,.83) 49%, rgba(248,244,235,.18) 80%); }
.cover-page .page-inner { padding: 25mm 18mm 20mm; }
.cover-page .eyebrow { margin-top: 4mm; }
.cover-title { max-width: 128mm; margin: 20mm 0 7mm; font-family: "Noto Serif CJK SC", "Source Han Serif SC", serif; font-size: 42pt; line-height: 1.12; letter-spacing: -.04em; white-space: pre-line; }
.cover-subtitle { max-width: 115mm; color: var(--ink-soft); font-size: 15pt; line-height: 1.6; }
.cover-badge { display: inline-flex; align-self: flex-start; margin-top: 8mm; padding: 3.5mm 5mm; border-radius: 99px; color: #fff; background: var(--green); font-size: 10pt; font-weight: 800; letter-spacing: .04em; }
.cover-note { max-width: 120mm; margin-top: auto; padding-top: 5mm; border-top: 1px solid rgba(24,55,47,.28); color: var(--ink-soft); font-size: 9.5pt; line-height: 1.65; }

.intro-grid, .blocks-grid { display: grid; gap: 4mm; margin-top: 8mm; }
.intro-grid { grid-template-columns: repeat(3, 1fr); }
.blocks-grid { grid-template-columns: repeat(2, 1fr); }
.info-card {
  min-height: 42mm;
  padding: 6mm;
  border: 1px solid var(--line);
  border-radius: 5mm;
  background: rgba(255,255,255,.72);
}
.info-card:nth-child(3n+2) { background: rgba(234,208,190,.35); }
.info-card h3 { margin-bottom: 3mm; font-size: 13pt; }
.info-card p { margin: 0; color: var(--ink-soft); font-size: 9.8pt; line-height: 1.68; }
.callout {
  position: relative;
  margin-top: 6mm;
  padding: 5mm 6mm 5mm 11mm;
  border-radius: 4mm;
  color: #fff;
  background: var(--green);
  font-family: "Noto Serif CJK SC", "Source Han Serif SC", serif;
  font-size: 12pt;
  line-height: 1.6;
}
.callout::before { content: "“"; position: absolute; left: 4mm; top: 1.5mm; color: #e9b894; font-size: 27pt; }
.small-note { margin-top: 4mm; color: var(--ink-soft); font-size: 8.6pt; line-height: 1.6; }

.step-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; margin-top: 8mm; }
.step { display: grid; grid-template-columns: 13mm 1fr; gap: 4mm; min-height: 34mm; padding: 5mm; border-radius: 4mm; background: rgba(255,255,255,.76); border: 1px solid var(--line); }
.step-num { color: var(--orange); font-family: Georgia, serif; font-size: 20pt; font-weight: 800; }
.step strong { display: block; margin: 1mm 0 2mm; font-size: 12pt; }
.step p { margin: 0; color: var(--ink-soft); font-size: 9.2pt; line-height: 1.55; }

.module-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; margin-top: 9mm; }
.module { padding: 6mm; border-left: 4px solid var(--orange); background: rgba(255,255,255,.75); border-radius: 0 4mm 4mm 0; }
.module strong { display: block; margin-bottom: 2mm; font-size: 13pt; }
.module span { color: var(--ink-soft); font-size: 9.4pt; line-height: 1.55; }

.lesson-open .page-inner { padding-bottom: 15mm; }
.lesson-open .hero-split { display: grid; grid-template-columns: 1.02fr .98fr; gap: 8mm; flex: 1; min-height: 0; margin-top: 7mm; }
.lesson-open .image-panel { height: 100%; min-height: 112mm; }
.bullet-list { display: grid; gap: 4mm; align-content: start; margin: 0; padding: 0; list-style: none; }
.bullet-list li { position: relative; padding: 4mm 4mm 4mm 11mm; color: var(--ink-soft); background: rgba(255,255,255,.78); border: 1px solid var(--line); border-radius: 4mm; font-size: 10pt; line-height: 1.62; }
.bullet-list li::before { content: ""; position: absolute; left: 4mm; top: 7mm; width: 3.3mm; height: 3.3mm; border-radius: 50%; background: var(--orange); }
.takeaway { margin-top: 5mm; padding: 5mm; border-top: 2px solid var(--green); font-family: "Noto Serif CJK SC", "Source Han Serif SC", serif; font-size: 12pt; line-height: 1.55; }

.concept-page .image-ribbon { height: 58mm; margin: 7mm 0; }
.concept-page .image-ribbon img { object-position: center 56%; }
.concept-page .blocks-grid { margin-top: 0; }
.concept-page .info-card { min-height: 37mm; }

.data-page .data-body { margin-top: 7mm; }
.formula-box { margin: 5mm 0; padding: 5mm 6mm; border: 1px solid rgba(189,102,60,.35); border-radius: 5mm; background: linear-gradient(135deg, rgba(234,208,190,.62), rgba(255,255,255,.75)); }
.formula-label { color: var(--orange); font-size: 8.5pt; font-weight: 900; letter-spacing: .12em; }
.formula-expression { margin: 3mm 0 2mm; font-family: "Noto Serif CJK SC", "Source Han Serif SC", serif; font-size: 17pt; line-height: 1.35; }
.formula-note { color: var(--ink-soft); font-size: 8.8pt; line-height: 1.55; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; margin-top: 5mm; border: 1px solid var(--line); border-radius: 4mm; background: rgba(255,255,255,.78); font-size: 8.8pt; line-height: 1.45; }
.data-table th { padding: 3.2mm 3mm; color: #fff; background: var(--green); text-align: left; font-weight: 800; }
.data-table td { padding: 3mm; border-top: 1px solid var(--line); vertical-align: top; }
.data-table tr:nth-child(even) td { background: rgba(110,141,123,.075); }
.data-table th + th, .data-table td + td { border-left: 1px solid var(--line); }
.data-page .image-accent { position: absolute; z-index: -1; right: -15mm; bottom: -8mm; width: 95mm; height: 80mm; border-radius: 50% 0 0 0; opacity: .14; object-fit: cover; }

.case-page .case-grid { display: grid; grid-template-columns: .86fr 1.14fr; gap: 7mm; flex: 1; min-height: 0; margin-top: 7mm; }
.case-page .image-panel { height: 100%; min-height: 130mm; }
.case-scenario { margin-bottom: 5mm; padding: 5mm; border-radius: 4mm; background: var(--orange-soft); font-size: 10pt; line-height: 1.65; }
.analysis-list { display: grid; gap: 3mm; }
.analysis-item { padding: 4mm; border-left: 3px solid var(--green-2); background: rgba(255,255,255,.77); }
.analysis-item strong { display: block; margin-bottom: 1.5mm; color: var(--green); font-size: 10pt; }
.analysis-item p { margin: 0; color: var(--ink-soft); font-size: 9.2pt; line-height: 1.58; }
.case-conclusion { margin-top: 5mm; padding: 5mm; color: #fff; border-radius: 4mm; background: var(--green); font-size: 10pt; font-weight: 700; line-height: 1.6; }

.appendix-page .page-inner { padding-bottom: 16mm; }
.appendix-page .page-title { max-width: 145mm; }
.appendix-page .data-table { font-size: 8.5pt; }
.formula-list { display: grid; gap: 4mm; margin-top: 8mm; }
.formula-row { padding: 5mm; border-radius: 4mm; background: rgba(255,255,255,.76); border: 1px solid var(--line); }
.formula-row strong { display: block; color: var(--orange); font-size: 9pt; letter-spacing: .05em; }
.formula-row span { display: block; margin-top: 2mm; font-family: "Noto Serif CJK SC", "Source Han Serif SC", serif; font-size: 15pt; }
.example-list { margin: 6mm 0 0; padding: 5mm 8mm; border-radius: 4mm; background: rgba(110,141,123,.12); color: var(--ink-soft); font-size: 10pt; line-height: 1.75; }
.source-list { display: grid; gap: 4mm; margin-top: 7mm; }
.source-row { display: grid; grid-template-columns: 15mm 1fr; gap: 4mm; padding: 4mm; border-bottom: 1px solid var(--line); }
.source-id { width: 12mm; height: 12mm; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--orange); font-weight: 800; }
.source-row strong { display: block; font-size: 10pt; line-height: 1.45; }
.source-row p { margin: 1mm 0 0; color: var(--ink-soft); font-size: 8.7pt; line-height: 1.5; }
.final-page .image-wash { opacity: .24; }
.final-page .page-inner { justify-content: center; }
.final-page .page-title { max-width: 155mm; font-size: 32pt; }
.final-page .blocks-grid { margin-top: 10mm; }
.final-page .version { margin-top: 8mm; color: var(--orange); font-weight: 800; font-size: 10pt; }

.screen-footer { max-width: 900px; margin: 0 auto 50px; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; color: #fff; background: rgba(19,47,40,.9); border-radius: 12px; }

@media screen and (max-width: 860px) {
  .reader-bar { height: auto; min-height: 58px; padding: 10px 14px; grid-template-columns: 1fr auto; gap: 8px; }
  .reader-progress { grid-column: 1 / -1; grid-row: 2; }
  .brand-version { display: none; }
  .reader-actions button { padding: 6px 9px; font-size: 13px; }
  .course { padding: 18px 0 50px; }
  .page {
    width: 100%;
    height: auto;
    min-height: 0;
    margin: 0 0 14px;
    box-shadow: none;
    border-bottom: 1px solid rgba(24,55,47,.14);
  }
  .page-inner { min-height: 0; padding: 44px 22px 58px; }
  .page-title { font-size: clamp(27px, 8vw, 38px); }
  .page-lead { font-size: 16px; }
  .cover-page { min-height: calc(100dvh - 90px); }
  .cover-page .page-inner { min-height: calc(100dvh - 90px); padding: 48px 24px 44px; }
  .cover-title { margin-top: 12vh; font-size: clamp(46px, 14vw, 66px); }
  .cover-page::after { background: linear-gradient(180deg, rgba(248,244,235,.88), rgba(248,244,235,.68) 60%, rgba(248,244,235,.92)); }
  .intro-grid, .blocks-grid, .step-list, .module-list, .lesson-open .hero-split, .case-page .case-grid { grid-template-columns: 1fr; }
  .info-card { min-height: 0; }
  .lesson-open .image-panel, .case-page .image-panel { height: 52vw; min-height: 240px; }
  .concept-page .image-ribbon { height: 48vw; min-height: 220px; }
  .data-table { display: block; overflow-x: auto; white-space: normal; font-size: 13px; }
  .page-no { right: 18px; bottom: 18px; }
  .screen-footer { margin: 0; border-radius: 0; font-size: 12px; }
}

@page { size: A4 portrait; margin: 0; }
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  html, body { width: 210mm; background: #fff; }
  .reader-bar, .toc, .toc-mask, .screen-footer { display: none !important; }
  .course { padding: 0; }
  .page { width: 210mm; height: 297mm; margin: 0; box-shadow: none; }
}
