/* ============ 量化部署教程 · 讲义风格 ============ */
:root {
  --paper: #f7f2e7;
  --paper-deep: #efe8d8;
  --paper-light: #fdfaf3;
  --ink: #35322b;
  --ink-soft: #75705f;
  --rule: #d9cfb8;
  --red: #b53a2b;
  --red-soft: #f3e2dc;
  --green: #40714f;
  --link: #2c5d8f;
}

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 16.5px;
  line-height: 2;
}

.serif, h1, h2, h3, .nav-logo, .toc-title, .pager a, .stamp {
  font-family: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", "STSong", Georgia, serif;
}

a { color: var(--link); text-decoration: none; word-break: break-all; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- 顶部 ---------- */
.nav {
  background: var(--paper);
  border-bottom: 3px double var(--ink);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px;
  height: 54px;
  display: flex;
  align-items: center;
}
.nav-logo {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 2px;
  color: var(--ink);
  margin-right: auto;
  white-space: nowrap;
}
.nav-logo:hover { text-decoration: none; }
.nav-links { display: flex; gap: 2px; overflow-x: auto; }
.nav-links a {
  color: var(--ink-soft);
  font-size: 14.5px;
  padding: 4px 11px;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--ink); text-decoration: none; }
.nav-links a.active { color: var(--red); font-weight: 700; }

/* ---------- 版面 ---------- */
.wrap {
  max-width: 820px;
  margin: 26px auto 34px;
  padding: 40px 48px 48px;
  position: relative;
}
/* 试卷式双线边框 */
.wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--rule);
  pointer-events: none;
}
.wrap::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid var(--rule);
  pointer-events: none;
}

p { margin-bottom: 10px; }

/* 着重号(字上加点) */
.dot-em {
  -webkit-text-emphasis: filled dot var(--red);
  text-emphasis: filled dot var(--red);
  font-weight: 600;
}

/* ---------- 封面(首页) ---------- */
.cover { text-align: center; padding: 30px 0 8px; position: relative; }
.cover .kicker {
  font-size: 13px;
  letter-spacing: 6px;
  color: var(--ink-soft);
  margin-bottom: 22px;
}
.cover h1 {
  font-size: clamp(30px, 5vw, 40px);
  font-weight: 900;
  letter-spacing: 6px;
  line-height: 1.6;
  margin-bottom: 16px;
}
.cover .sub {
  color: var(--ink-soft);
  max-width: 540px;
  margin: 0 auto;
  font-size: 16px;
}
.cover .meta {
  margin-top: 18px;
  font-size: 14px;
  color: var(--ink-soft);
  letter-spacing: 1px;
}
.cover .rule-red {
  width: 56px; height: 4px;
  background: var(--red);
  margin: 26px auto 0;
}

/* 印章 */
.stamp {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 78px; height: 78px;
  border: 3px solid var(--red);
  border-radius: 8px;
  color: var(--red);
  display: grid;
  grid-template-columns: 1fr 1fr;
  place-items: center;
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
  transform: rotate(7deg);
  opacity: 0.78;
  user-select: none;
}

/* ---------- 章节标题 ---------- */
h2.sec {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 3px;
  text-align: center;
  margin: 52px 0 20px;
}
h2.sec::after {
  content: "";
  display: block;
  width: 40px; height: 3px;
  background: var(--red);
  margin: 10px auto 0;
}

/* ---------- 目录 ---------- */
.toc { margin: 0 auto; max-width: 560px; }
.toc a {
  display: flex;
  align-items: baseline;
  color: var(--ink);
  padding: 10px 2px;
  font-size: 16.5px;
}
.toc a:hover { text-decoration: none; color: var(--red); }
.toc .no { font-weight: 700; margin-right: 14px; white-space: nowrap; }
.toc .dots {
  flex: 1;
  border-bottom: 2px dotted #b9ae95;
  margin: 0 12px;
  transform: translateY(-5px);
  min-width: 30px;
}
.toc .len { color: var(--ink-soft); font-size: 13.5px; white-space: nowrap; }

/* ---------- 路线一行 ---------- */
.route-line {
  text-align: center;
  color: var(--ink-soft);
  font-size: 15px;
  margin: 4px 0 0;
}
.route-line b { color: var(--ink); font-weight: 600; }
.route-line .ar { color: var(--red); padding: 0 6px; }

/* ---------- 课前准备(圈号列表) ---------- */
.prep { list-style: none; max-width: 640px; margin: 0 auto; }
.prep li {
  padding: 9px 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 15.8px;
}
.prep li:last-child { border-bottom: none; }
.prep .cn { color: var(--red); font-weight: 700; margin-right: 10px; }
.prep b { font-weight: 700; }
.prep .note { color: var(--ink-soft); }

/* ---------- 课程页页眉 ---------- */
.lesson-head { margin-bottom: 30px; }
.lesson-head .les-no {
  color: var(--red);
  font-size: 14px;
  letter-spacing: 5px;
  font-weight: 700;
  margin-bottom: 8px;
}
.lesson-head h1 {
  font-size: clamp(25px, 4.5vw, 32px);
  font-weight: 900;
  letter-spacing: 3px;
  line-height: 1.6;
}
.lesson-head h1::after {
  content: "";
  display: block;
  width: 48px; height: 4px;
  background: var(--red);
  margin-top: 12px;
}
.lesson-head .desc { color: var(--ink-soft); margin-top: 14px; font-size: 15.5px; }

/* ---------- 大节标题(Part) ---------- */
h2.part {
  font-size: 19.5px;
  font-weight: 900;
  letter-spacing: 2px;
  margin: 48px 0 6px;
  padding-top: 30px;
  border-top: 1px dashed var(--rule);
}
h2.part .pno { color: var(--red); margin-right: 10px; }
.part-sub { color: var(--ink-soft); font-size: 15px; margin-bottom: 6px; }

/* ---------- 步骤 ---------- */
.step { margin: 34px 0; }
.step h3 {
  font-size: 17.5px;
  font-weight: 700;
  line-height: 1.7;
  margin-bottom: 8px;
}
.step h3 .sno {
  color: var(--red);
  margin-right: 12px;
  white-space: nowrap;
}
.step h3 .sno::after {
  content: "";
  display: inline-block;
  width: 1px; height: 14px;
  background: var(--rule);
  margin-left: 12px;
  vertical-align: -2px;
}
.step p { font-size: 15.8px; margin-bottom: 8px; }

/* ---------- 插图 ---------- */
.fig { margin: 14px 0 18px; }
.fig .shot {
  background: #fff;
  border: 1px solid var(--rule);
  padding: 6px;
  cursor: zoom-in;
}
.fig .shot:hover { border-color: #c0b394; }
.fig img { width: 100%; height: auto; display: block; }
.fig figcaption {
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-top: 8px;
  letter-spacing: 1px;
}
.fig figcaption .fno { color: var(--red); margin-right: 8px; }

/* ---------- 教材注意框 ---------- */
.note-box {
  border: 1px dashed var(--red);
  padding: 16px 18px 10px;
  margin: 26px 0;
  position: relative;
  font-size: 15.5px;
  background: transparent;
}
.note-box > .nb-label {
  position: absolute;
  top: -14px;
  left: 16px;
  background: var(--paper);
  padding: 0 10px;
  color: var(--red);
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 15px;
}
.note-box.plain { border-color: #a99f88; }
.note-box.plain > .nb-label { color: var(--ink); }
.note-box.done { border-color: var(--green); border-style: solid; }
.note-box.done > .nb-label { color: var(--green); }
.note-box p { margin-bottom: 8px; }

/* ---------- 指令抄写框(填空题样式) ---------- */
.prompt-box {
  background: var(--paper-light);
  border: 1px solid var(--rule);
  margin: 14px 0;
}
.prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px dashed var(--rule);
}
.prompt-head span {
  font-size: 13.5px;
  color: var(--ink-soft);
  letter-spacing: 1px;
}
.copy-btn {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  font-size: 13px;
  padding: 2px 16px;
  cursor: pointer;
  font-family: inherit;
  border-radius: 3px;
}
.copy-btn:hover { background: var(--red); color: var(--paper-light); }
.copy-btn.copied { color: var(--green); border-color: var(--green); background: transparent; }
.prompt-body {
  padding: 13px 16px;
  font-size: 15.5px;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 2.1;
}
/* 填空:红字+下划线 */
.prompt-body mark {
  background: transparent;
  color: var(--red);
  border-bottom: 2px solid var(--red);
  padding: 0 2px;
}

/* ---------- 完成清单 ---------- */
.done-list { list-style: none; margin: 6px 0 2px; }
.done-list li {
  padding: 5px 0 5px 28px;
  position: relative;
  font-size: 15.5px;
}
.done-list li::before {
  content: "☑";
  position: absolute;
  left: 2px;
  color: var(--green);
}

/* ---------- 翻页 ---------- */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 54px;
  padding-top: 22px;
  border-top: 3px double var(--rule);
  font-size: 15.5px;
}
.pager a { color: var(--ink); letter-spacing: 1px; }
.pager a:hover { color: var(--red); text-decoration: none; }

/* ---------- 页脚(版权页) ---------- */
.footer {
  max-width: 820px;
  margin: 0 auto;
  padding: 4px 20px 40px;
  text-align: center;
  font-size: 12.8px;
  color: var(--ink-soft);
  line-height: 2;
}
.footer .risk { max-width: 620px; margin: 0 auto 6px; }
.footer .colophon { letter-spacing: 2px; }

/* ---------- 灯箱 ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(30, 26, 18, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 96vw;
  max-height: 92vh;
  background: #fff;
  padding: 4px;
}
.lightbox .lb-tip {
  position: absolute;
  bottom: 16px;
  left: 0; right: 0;
  text-align: center;
  color: #cfc8b8;
  font-size: 13px;
  letter-spacing: 1px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 680px) {
  body { font-size: 15.5px; }
  .wrap { margin: 14px 10px 22px; padding: 28px 20px 32px; }
  .cover h1 { letter-spacing: 3px; }
  .stamp { width: 62px; height: 62px; font-size: 17px; top: 0; right: 0; }
  .toc .no { margin-right: 8px; }
  .pager { flex-direction: column; gap: 10px; }
}
