/* ============================================================
   跟陈凯学「交易之路」 — 课程站点样式
   ============================================================ */

:root {
  /* 可通过 Nudge 调整的设计变量 */
  --site-bg: #f5efe3;
  --site-fg: #1d1a15;
  --site-accent: #c2452d;
  --site-on-accent: #fff8ec;
  --site-surface: #fffcf5;
  --site-muted: #6f6759;
  --site-border: #e0d5c0;
  --site-font: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --site-radius: 16px;
  --site-space: 1;
  --site-type: 1;
  --site-motion: 1;

  /* 派生变量 */
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 302px;
  --accent-ink: color-mix(in srgb, var(--site-accent) 84%, var(--site-fg));
  --accent-soft: color-mix(in srgb, var(--site-accent) 8%, var(--site-surface));
  --accent-line: color-mix(in srgb, var(--site-accent) 34%, var(--site-border));
  --sidebar-bg: color-mix(in srgb, var(--site-fg) 94%, #000);
  --sidebar-fg: color-mix(in srgb, var(--site-bg) 84%, #fff);
  --good: #2f7d55;
  --warn: #a06a00;
  --shadow: 0 22px 46px -30px rgba(30, 24, 16, 0.5);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --motion: calc(180ms * var(--site-motion, 1));
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--site-bg);
  color: var(--site-fg);
  font-family: var(--site-font);
  font-size: calc(16px * var(--site-type, 1));
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.nav-open { overflow: hidden; }

::selection { background: color-mix(in srgb, var(--site-accent) 24%, transparent); }

a { color: var(--site-accent); }

:focus-visible {
  outline: 2px solid var(--site-accent);
  outline-offset: 3px;
  border-radius: 3px;
}

.skip {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--site-accent);
  color: var(--site-on-accent);
  border-radius: 8px;
  transform: translateY(-160%);
  transition: transform var(--motion) var(--ease);
}
.skip:focus { transform: translateY(0); }

/* ---------- 顶部阅读进度 ---------- */

.read-progress {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: 3px;
  z-index: 70;
  background: var(--site-accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* ---------- 侧边栏 ---------- */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  transition: transform var(--motion) var(--ease);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 24px 22px 20px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: calc(var(--site-radius) * 0.72);
  background: var(--site-accent);
  color: var(--site-on-accent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.brand-mark svg { display: block; width: 30px; height: 30px; }

.brand-text { min-width: 0; }
.brand-title {
  display: block;
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.02em;
  line-height: 1.35;
}
.brand-sub {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: color-mix(in srgb, var(--sidebar-fg) 60%, transparent);
}

.nav {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 14px 26px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 3px; }

.nav-group + .nav-group { margin-top: 16px; }

.nav-group-title {
  margin: 0;
  padding: 10px 12px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: color-mix(in srgb, var(--sidebar-fg) 55%, transparent);
}

.nav-link {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border-radius: calc(var(--site-radius) * 0.5);
  color: color-mix(in srgb, var(--sidebar-fg) 86%, transparent);
  text-decoration: none;
  font-size: 13.5px;
  line-height: 1.5;
  transition: background var(--motion) var(--ease), color var(--motion) var(--ease);
}
.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-link[aria-current="page"] {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  font-weight: 600;
}
.nav-link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: var(--site-accent);
}

.nav-num {
  flex: none;
  width: 24px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: color-mix(in srgb, var(--sidebar-fg) 52%, transparent);
  padding-top: 1px;
}
.nav-link[aria-current="page"] .nav-num { color: color-mix(in srgb, var(--site-accent) 55%, #fff); }

.nav-label { min-width: 0; }

.nav-tick {
  flex: none;
  margin-left: auto;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--sidebar-fg) 26%, transparent);
  font-size: 10px;
  line-height: 1;
  color: transparent;
  transition: background var(--motion) var(--ease), color var(--motion) var(--ease),
    border-color var(--motion) var(--ease);
}
.nav-link.is-done .nav-tick {
  background: var(--site-accent);
  border-color: var(--site-accent);
  color: var(--site-on-accent);
}

.sidebar-foot {
  padding: 14px 22px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  line-height: 1.65;
  color: color-mix(in srgb, var(--sidebar-fg) 48%, transparent);
}

.nav-close {
  display: none;
  position: absolute;
  top: 18px;
  right: 14px;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: transparent;
  color: var(--sidebar-fg);
  font-size: 18px;
  cursor: pointer;
}

.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(14, 11, 7, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--motion) var(--ease), visibility var(--motion);
  backdrop-filter: blur(2px);
}

/* ---------- 移动端顶栏 ---------- */

.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 45;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--site-bg) 88%, transparent);
  border-bottom: 1px solid var(--site-border);
  backdrop-filter: blur(14px);
}

.topbar-btn {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--site-border);
  border-radius: 10px;
  background: var(--site-surface);
  color: var(--site-fg);
  cursor: pointer;
}
.topbar-btn svg { display: block; }

.topbar-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--serif);
  font-size: 15px;
}

/* ---------- 主体布局 ---------- */

.shell { padding-left: var(--sidebar-w); }

.main {
  display: grid;
  grid-template-columns: minmax(0, 768px) 206px;
  justify-content: center;
  gap: calc(56px * var(--site-space, 1));
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 48px 90px;
}

.column { min-width: 0; }

/* ---------- 首页 Hero ---------- */

.home-hero {
  position: relative;
  overflow: hidden;
  padding: calc(36px * var(--site-space, 1)) 0 calc(32px * var(--site-space, 1));
  border-bottom: 1px solid var(--site-border);
  margin-bottom: 8px;
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: -10px -10px 0 -10px;
  background-image: radial-gradient(circle, var(--site-border) 1px, transparent 1.2px);
  background-size: 22px 22px;
  opacity: 0.6;
  -webkit-mask-image: linear-gradient(100deg, transparent 6%, #000 60%, #000);
  mask-image: linear-gradient(100deg, transparent 6%, #000 60%, #000);
  pointer-events: none;
}

.home-hero > * { position: relative; }

.hero-mark {
  position: absolute;
  right: -14px;
  top: 6px;
  width: clamp(150px, 22vw, 250px);
  height: auto;
  color: var(--site-accent);
  opacity: 0.1;
  pointer-events: none;
  user-select: none;
}

.kicker {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.home-hero h1 {
  margin: 0;
  max-width: 14em;
  font-family: var(--serif);
  font-size: calc(50px * var(--site-type, 1));
  font-weight: 650;
  line-height: 1.2;
}

.home-hero .lede {
  max-width: 33em;
  margin: 20px 0 0;
  font-size: calc(17px * var(--site-type, 1));
  line-height: 1.85;
  color: var(--site-muted);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: calc(var(--site-radius) * 0.62);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--motion) var(--ease), box-shadow var(--motion) var(--ease),
    background var(--motion) var(--ease), border-color var(--motion) var(--ease);
}

.btn-primary {
  background: var(--site-accent);
  color: var(--site-on-accent);
  box-shadow: 0 14px 28px -16px color-mix(in srgb, var(--site-accent) 80%, transparent);
}
.btn-primary:hover { transform: translateY(-2px); }

.btn-ghost {
  border-color: var(--site-border);
  background: var(--site-surface);
  color: var(--site-fg);
}
.btn-ghost:hover { border-color: var(--accent-line); transform: translateY(-2px); }

.btn-sm { padding: 8px 15px; font-size: 13px; }

.resume {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 18px;
  font-size: 13px;
  color: var(--site-muted);
  text-decoration: none;
  border-bottom: 1px dashed var(--site-border);
  padding-bottom: 2px;
}
.resume span { color: var(--accent-ink); font-weight: 600; }
.resume[hidden] { display: none; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 32px;
  border: 1px solid var(--site-border);
  border-radius: var(--site-radius);
  background: var(--site-border);
  overflow: hidden;
}

.stat { background: var(--site-surface); padding: 16px 18px; }
.stat b {
  display: block;
  font-family: var(--serif);
  font-size: calc(26px * var(--site-type, 1));
  font-weight: 600;
  line-height: 1.2;
}
.stat span {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--site-muted);
}

/* ---------- 学习进度面板 ---------- */

.progress-panel {
  margin: calc(30px * var(--site-space, 1)) 0 8px;
  padding: calc(22px * var(--site-space, 1)) 24px;
  border: 1px solid var(--site-border);
  border-radius: var(--site-radius);
  background: var(--site-surface);
  box-shadow: var(--shadow);
}

.progress-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.progress-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: calc(21px * var(--site-type, 1));
  font-weight: 650;
}
.progress-head p { margin: 0; font-size: 12.5px; color: var(--site-muted); }

.progress-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.meter-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--site-muted);
}
.meter-label b {
  font-family: var(--serif);
  font-size: calc(19px * var(--site-type, 1));
  font-weight: 600;
  color: var(--site-fg);
}

.meter {
  height: 8px;
  margin-top: 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--site-border) 70%, var(--site-bg));
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--site-accent);
  transition: width calc(420ms * var(--site-motion, 1)) var(--ease);
}

.lesson-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px dashed var(--site-border);
}
.lesson-dot {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--site-border);
  border-radius: calc(var(--site-radius) * 0.45);
  background: var(--site-bg);
  color: var(--site-muted);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
  transition: transform var(--motion) var(--ease), background var(--motion) var(--ease),
    color var(--motion) var(--ease), border-color var(--motion) var(--ease);
}
.lesson-dot:hover { transform: translateY(-2px); border-color: var(--accent-line); }
.lesson-dot.is-done {
  background: var(--site-accent);
  border-color: var(--site-accent);
  color: var(--site-on-accent);
}

.progress-note {
  margin: 16px 0 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--site-muted);
}

/* ---------- 内页 Hero ---------- */

.page-hero {
  position: relative;
  overflow: hidden;
  padding: calc(26px * var(--site-space, 1)) 0 calc(22px * var(--site-space, 1));
  border-bottom: 1px solid var(--site-border);
}

.hero-num {
  position: absolute;
  right: -6px;
  top: -26px;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(110px, 15vw, 170px);
  line-height: 1;
  color: var(--site-accent);
  opacity: 0.08;
  user-select: none;
  pointer-events: none;
}

.page-hero h1 {
  position: relative;
  margin: 0;
  max-width: 17em;
  font-family: var(--serif);
  font-size: calc(36px * var(--site-type, 1));
  font-weight: 650;
  line-height: 1.3;
}

.hero-meta {
  margin: 14px 0 0;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--site-muted);
}
.hero-meta .dot { margin: 0 8px; opacity: 0.5; }

.hero-question {
  position: relative;
  margin: 16px 0 0;
  padding: 12px 16px;
  border-left: 3px solid var(--site-accent);
  border-radius: 0 calc(var(--site-radius) * 0.6) calc(var(--site-radius) * 0.6) 0;
  background: var(--accent-soft);
  font-size: calc(15px * var(--site-type, 1));
  line-height: 1.7;
}
.hero-question b { color: var(--accent-ink); }

/* ---------- 正文排版 ---------- */

.article {
  padding-top: calc(18px * var(--site-space, 1));
  font-size: calc(17px * var(--site-type, 1));
  line-height: 1.9;
  overflow-wrap: break-word;
}

.article > *:first-child { margin-top: 0; }
.article p { margin: 1.05em 0; }

.article h2 {
  position: relative;
  margin: calc(52px * var(--site-space, 1)) 0 16px;
  padding-top: 18px;
  border-top: 1px solid var(--site-border);
  font-family: var(--serif);
  font-size: calc(27px * var(--site-type, 1));
  font-weight: 650;
  line-height: 1.45;
  scroll-margin-top: 86px;
}
.article h2::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 54px;
  height: 2px;
  background: var(--site-accent);
}

.article h3 {
  margin: 32px 0 10px;
  font-family: var(--serif);
  font-size: calc(20.5px * var(--site-type, 1));
  font-weight: 650;
  line-height: 1.5;
  color: var(--accent-ink);
  scroll-margin-top: 86px;
}

.article h4 {
  margin: 24px 0 8px;
  font-size: calc(16.5px * var(--site-type, 1));
  font-weight: 700;
  scroll-margin-top: 86px;
}

.anchor {
  margin-left: 0.35em;
  font-family: var(--mono);
  font-size: 0.62em;
  font-weight: 400;
  color: var(--site-accent);
  text-decoration: none;
  opacity: 0;
  transition: opacity var(--motion) var(--ease);
}
h2:hover .anchor,
h3:hover .anchor,
.anchor:focus-visible { opacity: 0.65; }

.article strong { font-weight: 700; }
.article em { color: var(--accent-ink); }

.article a {
  color: var(--accent-ink);
  text-decoration-color: color-mix(in srgb, var(--site-accent) 40%, transparent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.article a:hover { text-decoration-color: var(--site-accent); }

.article ul,
.article ol { margin: 1em 0; padding-left: 1.5em; }
.article li { margin: 0.38em 0; }
.article li::marker { color: var(--site-accent); }

.article hr {
  height: 1px;
  margin: calc(40px * var(--site-space, 1)) 0;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--site-border) 18%, var(--site-border) 82%, transparent);
}

.article blockquote {
  margin: 26px 0;
  padding: 17px 22px;
  background: var(--accent-soft);
  border-left: 3px solid var(--site-accent);
  border-radius: 0 var(--site-radius) var(--site-radius) 0;
  color: color-mix(in srgb, var(--site-fg) 88%, var(--site-muted));
}
.article blockquote p { margin: 0.4em 0; }
.article blockquote p:first-child { margin-top: 0; }
.article blockquote p:last-child { margin-bottom: 0; }
.article blockquote strong { color: var(--site-fg); }

/* 一句话带走 */

.takeaway {
  margin: 26px 0;
  padding: 22px 24px;
  border: 1px solid var(--accent-line);
  border-radius: var(--site-radius);
  background: color-mix(in srgb, var(--site-accent) 10%, var(--site-surface));
}
.takeaway p {
  margin: 0;
  font-family: var(--serif);
  font-size: calc(19px * var(--site-type, 1));
  line-height: 1.75;
}
.takeaway-label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

/* 表格 */

.table-wrap {
  margin: 28px 0;
  overflow-x: auto;
  border: 1px solid var(--site-border);
  border-radius: var(--site-radius);
  background: var(--site-surface);
}

.article table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: calc(14.5px * var(--site-type, 1));
  line-height: 1.62;
}

.article th {
  padding: 11px 14px;
  background: color-mix(in srgb, var(--site-accent) 9%, var(--site-surface));
  border-bottom: 1px solid var(--site-border);
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

.article td {
  padding: 11px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--site-border) 70%, transparent);
  vertical-align: top;
}

.article tbody tr:last-child td { border-bottom: 0; }
.article tbody tr:nth-child(even) { background: color-mix(in srgb, var(--site-bg) 46%, transparent); }

/* 代码与 ASCII 图 */

.article code {
  padding: 0.12em 0.38em;
  border-radius: calc(var(--site-radius) * 0.3);
  background: color-mix(in srgb, var(--site-accent) 9%, var(--site-surface));
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 0.87em;
}

.article pre {
  margin: 26px 0;
  padding: 18px 20px;
  overflow-x: auto;
  border-radius: var(--site-radius);
  background: color-mix(in srgb, var(--site-fg) 94%, #000);
  color: color-mix(in srgb, var(--site-bg) 90%, #fff);
  box-shadow: var(--shadow);
  line-height: 1.7;
  tab-size: 2;
}

.article pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: calc(13px * var(--site-type, 1));
  white-space: pre;
}

/* 答案折叠 */

.article details,
.q-answer {
  margin: 12px 0 20px;
  padding: 0 18px;
  border: 1px solid var(--site-border);
  border-radius: calc(var(--site-radius) * 0.75);
  background: var(--site-surface);
  transition: border-color var(--motion) var(--ease), background var(--motion) var(--ease);
}

.article details[open],
.q-answer[open] {
  padding-bottom: 14px;
  border-color: var(--accent-line);
  background: color-mix(in srgb, var(--site-accent) 4%, var(--site-surface));
}

.article summary,
.q-answer summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  list-style: none;
  cursor: pointer;
  font-size: calc(14.5px * var(--site-type, 1));
  font-weight: 600;
  color: var(--accent-ink);
  user-select: none;
}
.article summary::-webkit-details-marker,
.q-answer summary::-webkit-details-marker { display: none; }

.article summary::before,
.q-answer summary::before {
  content: "＋";
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--site-accent) 12%, var(--site-surface));
  border: 1px solid var(--accent-line);
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  transition: transform var(--motion) var(--ease), background var(--motion) var(--ease);
}
.article details[open] summary::before,
.q-answer[open] summary::before {
  content: "－";
  background: var(--site-accent);
  color: var(--site-on-accent);
  border-color: var(--site-accent);
}
.article summary:hover::before,
.q-answer summary:hover::before { transform: scale(1.08); }

.q-answer > div { font-size: calc(15px * var(--site-type, 1)); line-height: 1.85; }
.q-answer p { margin: 0.5em 0; }

/* ---------- 学完标记 ---------- */

.done-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: calc(40px * var(--site-space, 1));
  padding: 18px 20px;
  border: 1px dashed var(--accent-line);
  border-radius: var(--site-radius);
  background: var(--accent-soft);
}

.done-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  border: 1px solid var(--site-accent);
  border-radius: calc(var(--site-radius) * 0.6);
  background: var(--site-surface);
  color: var(--accent-ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--motion) var(--ease), color var(--motion) var(--ease),
    transform var(--motion) var(--ease);
}
.done-toggle:hover { transform: translateY(-1px); }
.done-toggle .box {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1.5px solid currentColor;
  border-radius: 5px;
  font-size: 11px;
  line-height: 1;
}
.done-toggle[aria-pressed="true"] {
  background: var(--site-accent);
  color: var(--site-on-accent);
}
.done-hint { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--site-muted); }

/* ---------- 练习册 ---------- */

.quiz-intro {
  margin: 0 0 8px;
  padding: 16px 20px;
  border-radius: var(--site-radius);
  background: var(--accent-soft);
  border-left: 3px solid var(--site-accent);
  font-size: calc(15px * var(--site-type, 1));
  line-height: 1.8;
}

.quiz-block { margin-top: calc(40px * var(--site-space, 1)); }

.quiz-block > h2 {
  margin: 0 0 6px;
  padding-top: 18px;
  border-top: 1px solid var(--site-border);
  font-family: var(--serif);
  font-size: calc(26px * var(--site-type, 1));
  font-weight: 650;
  scroll-margin-top: 86px;
}

.quiz-sub { margin: 0 0 18px; font-size: 13px; color: var(--site-muted); }
.quiz-sub .btn { margin-left: 10px; vertical-align: middle; }

.quiz-module { margin-top: 6px; }
.q-module-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  margin: 30px 0 6px;
}
.q-module-head h3 { margin: 0; }

.meter-box { min-width: 0; }

.q-card {
  margin: 14px 0;
  padding: 18px 20px;
  border: 1px solid var(--site-border);
  border-radius: var(--site-radius);
  background: var(--site-surface);
  transition: border-color var(--motion) var(--ease), box-shadow var(--motion) var(--ease);
}
.q-card.is-right { border-color: color-mix(in srgb, var(--good) 45%, var(--site-border)); }

.q-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.q-no {
  flex: none;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--site-accent) 12%, var(--site-surface));
  border: 1px solid var(--accent-line);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 12px;
}
.q-type {
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--site-muted);
}
.q-score {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--site-muted);
}

.q-body { font-size: calc(15.5px * var(--site-type, 1)); line-height: 1.85; }
.q-body p { margin: 0.5em 0; }
.q-body p:first-child { margin-top: 0; }
.q-body ul, .q-body ol { margin: 0.5em 0; padding-left: 1.4em; }
.q-body .opts { margin: 0.6em 0 0; padding-left: 0; list-style: none; }
.q-body .opts li {
  margin: 0.3em 0;
  padding: 7px 12px;
  border: 1px solid var(--site-border);
  border-radius: calc(var(--site-radius) * 0.5);
  background: var(--site-bg);
}

.q-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.mark-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--site-border);
  border-radius: 999px;
  background: var(--site-bg);
  color: var(--site-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--motion) var(--ease), color var(--motion) var(--ease),
    border-color var(--motion) var(--ease);
}
.mark-btn:hover { border-color: var(--accent-line); color: var(--accent-ink); }
.mark-btn[aria-pressed="true"] {
  background: color-mix(in srgb, var(--good) 14%, var(--site-surface));
  border-color: color-mix(in srgb, var(--good) 50%, var(--site-border));
  color: var(--good);
}

.exam-board {
  position: sticky;
  top: 12px;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 18px 0 6px;
  padding: 14px 18px;
  border: 1px solid var(--accent-line);
  border-radius: var(--site-radius);
  background: color-mix(in srgb, var(--site-surface) 92%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.exam-board .score {
  font-family: var(--serif);
  font-size: calc(30px * var(--site-type, 1));
  font-weight: 650;
  line-height: 1;
  color: var(--accent-ink);
}
.exam-board .score small { font-size: 13px; font-weight: 400; color: var(--site-muted); }
.exam-board .verdict { font-size: 12.5px; line-height: 1.6; color: var(--site-muted); }
.exam-board .btn { margin-left: auto; }

.rubric-row { display: flex; align-items: center; gap: 10px; }
.rubric-select {
  padding: 6px 10px;
  border: 1px solid var(--site-border);
  border-radius: calc(var(--site-radius) * 0.45);
  background: var(--site-bg);
  color: var(--site-fg);
  font-family: inherit;
  font-size: 13.5px;
}

.rubric-total {
  margin-top: 16px;
  padding: 16px 20px;
  border: 1px solid var(--accent-line);
  border-radius: var(--site-radius);
  background: var(--accent-soft);
  font-size: calc(15px * var(--site-type, 1));
}
.rubric-total b { font-family: var(--serif); font-size: calc(24px * var(--site-type, 1)); color: var(--accent-ink); }

/* ---------- 知识卡片 ---------- */

.card-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 22px 0 6px;
  padding: 14px 16px;
  border: 1px solid var(--site-border);
  border-radius: var(--site-radius);
  background: var(--site-surface);
}

.chip {
  padding: 7px 14px;
  border: 1px solid var(--site-border);
  border-radius: 999px;
  background: var(--site-bg);
  color: var(--site-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--motion) var(--ease), color var(--motion) var(--ease),
    border-color var(--motion) var(--ease);
}
.chip:hover { border-color: var(--accent-line); color: var(--accent-ink); }
.chip[aria-pressed="true"] {
  background: var(--site-accent);
  border-color: var(--site-accent);
  color: var(--site-on-accent);
}

.card-count { margin-left: auto; font-size: 12.5px; color: var(--site-muted); }
.card-count b { color: var(--accent-ink); font-family: var(--serif); font-size: 16px; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.flip {
  position: relative;
  min-height: 244px;
  perspective: 1200px;
}
.flip[hidden] { display: none; }

.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 244px;
  transform-style: preserve-3d;
  transition: transform calc(420ms * var(--site-motion, 1)) var(--ease);
}
.flip.is-flipped .flip-inner { transform: rotateY(180deg); }
.flip.is-known .flip-front { border-color: color-mix(in srgb, var(--good) 48%, var(--site-border)); }
.flip.is-again .flip-front { border-color: color-mix(in srgb, var(--warn) 48%, var(--site-border)); }

.flip-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px;
  border: 1px solid var(--site-border);
  border-radius: var(--site-radius);
  background: var(--site-surface);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  font: inherit;
  color: inherit;
  text-align: left;
}
button.flip-face { cursor: pointer; width: 100%; }
button.flip-face:hover { border-color: var(--accent-line); }
.flip-back {
  transform: rotateY(180deg);
  overflow-y: auto;
  background: color-mix(in srgb, var(--site-accent) 7%, var(--site-surface));
  border-color: var(--accent-line);
}

.flip-no {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--site-muted);
}
.flip-term {
  margin: 0;
  font-family: var(--serif);
  font-size: calc(22px * var(--site-type, 1));
  font-weight: 650;
  line-height: 1.4;
}
.flip-en {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent-ink);
  letter-spacing: 0.02em;
}
.flip-hint {
  margin-top: auto;
  font-size: 11.5px;
  color: var(--site-muted);
}
.flip-line { margin: 0; font-size: calc(15px * var(--site-type, 1)); line-height: 1.75; }
.flip-eg {
  margin: 0;
  padding-top: 10px;
  border-top: 1px dashed var(--accent-line);
  font-size: calc(13px * var(--site-type, 1));
  line-height: 1.7;
  color: var(--site-muted);
}
.flip-eg b { color: var(--accent-ink); font-weight: 600; }

.flip-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}
.flip-actions .mark-btn { padding: 6px 12px; font-size: 12px; }

.card-empty {
  margin: 24px 0;
  padding: 26px;
  border: 1px dashed var(--site-border);
  border-radius: var(--site-radius);
  text-align: center;
  color: var(--site-muted);
  font-size: 14px;
}
.card-empty[hidden] { display: none; }

/* ---------- 复习表 ---------- */

.review-table td:last-child,
.review-table th:last-child { text-align: center; width: 74px; }

.tick {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--site-accent);
  cursor: pointer;
}

.review-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  padding: 16px 20px;
  border: 1px solid var(--site-border);
  border-radius: var(--site-radius);
  background: var(--site-surface);
}
.review-progress .meter { flex: 1; min-width: 160px; margin-top: 0; }
.review-progress b { font-family: var(--serif); font-size: calc(20px * var(--site-type, 1)); }
.review-progress span { font-size: 12.5px; color: var(--site-muted); }

/* ---------- 本页目录 ---------- */

.toc {
  position: sticky;
  top: 28px;
  align-self: start;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  padding-top: 10px;
  font-size: 12.5px;
  scrollbar-width: none;
}
.toc::-webkit-scrollbar { display: none; }

.toc-title {
  margin: 0 0 12px;
  padding-left: 14px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--site-muted);
}

.toc a {
  display: block;
  padding: 6px 0 6px 14px;
  border-left: 2px solid var(--site-border);
  color: var(--site-muted);
  text-decoration: none;
  line-height: 1.5;
  transition: color var(--motion) var(--ease), border-color var(--motion) var(--ease);
}
.toc a:hover { color: var(--accent-ink); }
.toc a.active {
  border-left-color: var(--site-accent);
  color: var(--accent-ink);
  font-weight: 600;
}

/* ---------- 上下课 ---------- */

.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: calc(60px * var(--site-space, 1));
  padding-top: 28px;
  border-top: 1px solid var(--site-border);
}

.pager a {
  display: block;
  padding: 15px 18px;
  border: 1px solid var(--site-border);
  border-radius: calc(var(--site-radius) * 0.8);
  background: var(--site-surface);
  text-decoration: none;
  transition: transform var(--motion) var(--ease), border-color var(--motion) var(--ease),
    box-shadow var(--motion) var(--ease);
}
.pager a:hover {
  transform: translateY(-2px);
  border-color: var(--accent-line);
  box-shadow: var(--shadow);
}

.pager .lbl {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--site-muted);
}
.pager .ttl {
  display: block;
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.45;
  color: var(--site-fg);
}
.pager a.next { text-align: right; grid-column: 2; }
.pager a.next .lbl::after { content: " →"; }
.pager a.prev .lbl::before { content: "← "; }

.page-foot {
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px solid var(--site-border);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--site-muted);
}
.page-foot p { margin: 0.35em 0; }

/* ---------- 响应式 ---------- */

@media (max-width: 1180px) {
  .main {
    grid-template-columns: minmax(0, 768px);
    gap: 0;
    padding-left: 40px;
    padding-right: 40px;
  }
  .toc { display: none; }
}

@media (max-width: 900px) {
  .read-progress { left: 0; }
  .shell { padding-left: 0; }
  .sidebar {
    width: min(86vw, 320px);
    transform: translateX(-104%);
    box-shadow: 30px 0 60px -30px rgba(0, 0, 0, 0.5);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-overlay { opacity: 1; visibility: visible; }
  .nav-close { display: flex; }
  .topbar { display: flex; }
  .main { padding: 24px 20px 68px; }
  .home-hero { padding-top: 24px; }
  .home-hero h1 { font-size: calc(35px * var(--site-type, 1)); }
  .page-hero h1 { font-size: calc(29px * var(--site-type, 1)); }
  .hero-num { font-size: 108px; top: -14px; }
  .hero-mark { width: 140px; opacity: 0.08; }
  .article { font-size: calc(16px * var(--site-type, 1)); }
  .article h2 { font-size: calc(23px * var(--site-type, 1)); margin-top: 40px; }
  .article h3 { font-size: calc(19px * var(--site-type, 1)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .progress-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .cards-grid { grid-template-columns: minmax(0, 1fr); }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager a.next { grid-column: 1; }
  .exam-board { position: static; }
}

@media (max-width: 480px) {
  .home-hero h1 { font-size: calc(30px * var(--site-type, 1)); }
  .home-hero .lede { font-size: calc(15.5px * var(--site-type, 1)); }
  .cta-row .btn { width: 100%; justify-content: center; }
  .article blockquote { padding: 15px 17px; }
  .article table { min-width: 460px; }
  .stat { padding: 13px 14px; }
  .q-card { padding: 15px 16px; }
  .flip-face { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .flip-inner { transition: none; }
}

/* ---------- 打印 ---------- */

@media print {
  .sidebar,
  .topbar,
  .toc,
  .pager,
  .read-progress,
  .nav-overlay,
  .skip,
  .card-tools,
  .done-bar,
  .exam-board .btn { display: none !important; }
  .shell { padding-left: 0; }
  .main { display: block; padding: 0; max-width: none; }
  body { background: #fff; }
  .article { font-size: 11pt; line-height: 1.6; }
  .article details, .q-answer { break-inside: avoid; }
  .article details > *, .q-answer > * { display: block; }
  .flip-inner { transform: none !important; }
  .flip-face { position: static; backface-visibility: visible; }
  .flip-back { transform: none; margin-top: 8px; }
  .flip { min-height: 0; }
  .flip-actions { display: none; }
}