/* ============================================================
   XuanYuan AI 底层原理 · 学习文档站
   视觉基准：视频本身的近黑底、细网格、信号红、发光连线
   ============================================================ */

:root {
  --ink: #08090b;
  --ink-2: #0d0f12;
  --panel: #111318;
  --panel-2: #161920;
  --line: #23262f;
  --line-soft: #1a1d24;
  --text: #f1efe9;
  --muted: #9a9da8;
  --dim: #6b6f7b;

  --red: #ff4438;
  --red-deep: #b3201a;
  --red-soft: rgba(255, 68, 56, 0.12);
  --cyan: #57d9c9;
  --cyan-soft: rgba(87, 217, 201, 0.12);
  --amber: #f2b24c;
  --amber-soft: rgba(242, 178, 76, 0.12);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.12);
  --green: #7bd88f;

  --font-sans: "Inter", "HarmonyOS Sans SC", "MiSans", "PingFang SC",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas,
    monospace;

  --rail: 264px;
  --content: 880px;
  --wide: 1120px;
  --radius: 14px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.95;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 固定网格底：对应视频画面里的暗格 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 78%);
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(255, 68, 56, 0.10), transparent 60%),
    radial-gradient(700px 400px at 0% 20%, rgba(87, 217, 201, 0.05), transparent 60%);
  pointer-events: none;
}

::selection {
  background: rgba(255, 68, 56, 0.35);
  color: #fff;
}

a {
  color: var(--text);
  text-decoration-color: rgba(255, 68, 56, 0.6);
  text-underline-offset: 4px;
  transition: color 0.18s ease;
}
a:hover { color: var(--red); }

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

img { max-width: 100%; display: block; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  background: rgba(8, 9, 11, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: var(--text); }

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 12px var(--red), 0 0 28px rgba(255, 68, 56, 0.5);
  animation: pulse 2.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.82); }
}

.topbar-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}
.topbar-nav a {
  padding: 6px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
}
.topbar-nav a:hover { color: var(--text); background: var(--panel-2); }
.topbar-nav .sep { color: var(--line); }

.read-progress {
  position: fixed;
  top: 59px;
  left: 0;
  height: 2px;
  width: 100%;
  z-index: 61;
  background: transparent;
}
.read-progress i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--red), var(--amber));
  box-shadow: 0 0 14px rgba(255, 68, 56, 0.8);
}

/* ---------- 左侧课程轨 ---------- */
.rail {
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  width: var(--rail);
  padding: 34px 22px 40px 28px;
  border-right: 1px solid var(--line-soft);
  overflow-y: auto;
  font-size: 13.5px;
  z-index: 40;
  background: rgba(8, 9, 11, 0.55);
}
.rail::-webkit-scrollbar { width: 3px; }
.rail::-webkit-scrollbar-thumb { background: var(--line); }

.rail-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 14px 10px;
}

.rail ol {
  list-style: none;
  margin: 0 0 30px;
  padding: 0;
  counter-reset: rail;
}
.rail li { position: relative; }
.rail li a {
  display: block;
  padding: 7px 10px 7px 34px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.5;
}
.rail li a::before {
  counter-increment: rail;
  content: counter(rail, decimal-leading-zero);
  position: absolute;
  left: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim);
  top: 10px;
}
.rail li a:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.rail li a.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(255,68,56,0.14), transparent 80%);
  box-shadow: inset 2px 0 0 var(--red);
}
.rail li a.active::before { color: var(--red); }

.rail .rail-meta {
  margin: 0 0 26px 10px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.8;
}

.rail-tools {
  border-top: 1px solid var(--line-soft);
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rail-tools a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 6px;
}
.rail-tools a:hover { color: var(--text); background: var(--panel-2); }

/* ---------- 主内容 ---------- */
.shell {
  margin-left: var(--rail);
  padding: 60px 40px 120px;
}

.wrap {
  max-width: var(--content);
  margin: 0 auto;
}
.wrap-wide {
  max-width: var(--wide);
  margin: 0 auto;
}

/* ---------- Hero ---------- */
.hero {
  padding: 72px 0 26px;
  position: relative;
}

.eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--red);
  margin: 0 0 22px;
}
.eyebrow .chip {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  letter-spacing: 0.06em;
}

.hero h1 {
  font-size: clamp(2.1rem, 5.4vw, 4rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 800;
  margin: 0 0 26px;
  max-width: none;
}
.hero h1 em {
  font-style: normal;
  white-space: nowrap;
  color: var(--red);
  text-shadow: 0 0 30px rgba(255, 68, 56, 0.35);
}

.lede {
  font-size: 1.12rem;
  color: #c9c8c2;
  max-width: 62ch;
  margin: 0 0 30px;
}
.lede strong { color: var(--text); font-weight: 650; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 44px;
}
.hero-meta span { display: inline-flex; gap: 7px; align-items: center; }
.hero-meta b { color: var(--text); font-weight: 500; }

/* 信号轨：页面签名元素，章节即节点 */
.signal-map {
  position: relative;
  margin: 0 0 64px;
  padding: 22px 24px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent 60%),
    var(--ink-2);
  overflow: hidden;
}
.signal-map::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
  pointer-events: none;
}
.signal-map svg { display: block; width: 100%; height: auto; position: relative; }
.signal-path {
  fill: none;
  stroke: var(--red);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(255, 68, 56, 0.65));
  stroke-dasharray: 1400;
  stroke-dashoffset: 1400;
  animation: draw-path 2.4s 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes draw-path { to { stroke-dashoffset: 0; } }

.signal-node { cursor: pointer; }
.signal-node circle {
  fill: var(--ink);
  stroke: var(--red);
  stroke-width: 2;
  transition: fill 0.2s ease, transform 0.2s ease;
  transform-box: fill-box;
  transform-origin: center;
}
.signal-node text {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  transition: fill 0.2s ease;
}
.signal-node:hover circle, .signal-node.active circle {
  fill: var(--red);
  transform: scale(1.25);
}
.signal-node:hover text, .signal-node.active text { fill: var(--text); }

.signal-legend {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim);
  letter-spacing: 0.08em;
  margin-top: 10px;
  position: relative;
}

/* ---------- 章节 ---------- */
.chapter {
  position: relative;
  padding: 54px 0 18px;
  border-top: 1px solid var(--line-soft);
}
.chapter:first-of-type { border-top: 0; padding-top: 8px; }

.chapter-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 8px;
}
.ch-index {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--red);
  border: 1px solid rgba(255, 68, 56, 0.35);
  border-radius: 6px;
  padding: 2px 8px;
  transform: translateY(-3px);
}
.chapter h2 {
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0;
  font-weight: 750;
  flex: 1;
}

.ch-done {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
  transform: translateY(-2px);
}
.ch-done:hover { border-color: var(--green); color: var(--green); }
.ch-done.on {
  background: rgba(123, 216, 143, 0.14);
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 0 12px rgba(123, 216, 143, 0.25);
}

.t-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px dashed rgba(87, 217, 201, 0.4);
  padding-bottom: 1px;
}
.t-link:hover { color: var(--cyan); border-bottom-style: solid; }

.chapter h3 {
  font-size: 1.18rem;
  margin: 38px 0 10px;
  font-weight: 650;
  letter-spacing: 0.01em;
}
.chapter h3::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  margin-right: 10px;
  transform: translateY(-3px);
  box-shadow: 0 0 8px rgba(242, 178, 76, 0.7);
}

.chapter p { margin: 14px 0; color: #d4d3cd; }
.chapter p strong { color: #fff; font-weight: 650; }
.chapter ul, .chapter ol { color: #d4d3cd; padding-left: 1.4em; }
.chapter li { margin: 7px 0; }
.chapter li::marker { color: var(--red); }

.term {
  color: var(--amber);
  font-weight: 600;
  border-bottom: 1px dotted rgba(242, 178, 76, 0.45);
  cursor: help;
}
.term-en { font-family: var(--font-mono); font-size: 0.88em; color: var(--amber); }

/* 关键结论 */
.takeaway {
  margin: 30px 0;
  padding: 18px 22px 18px 24px;
  border: 1px solid rgba(255, 68, 56, 0.28);
  border-left: 3px solid var(--red);
  border-radius: 0 12px 12px 0;
  background: linear-gradient(90deg, var(--red-soft), transparent 70%);
}
.takeaway .tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 6px;
}
.takeaway p { margin: 0; color: #e8e6e0; }
.takeaway p + p { margin-top: 8px; }

/* 截图 */
.shot {
  margin: 26px 0 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--ink-2);
}
.shot a { display: block; position: relative; }
.shot img {
  width: 100%;
  height: auto;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.3s ease;
}
.shot a:hover img { transform: scale(1.012); opacity: 0.94; }
.shot a::after {
  content: "▶ 跳到视频";
  position: absolute;
  right: 12px;
  bottom: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--text);
  background: rgba(8, 9, 11, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  padding: 4px 9px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(6px);
}
.shot a:hover::after { opacity: 1; transform: translateY(0); }
.shot figcaption {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 12px 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}
.shot figcaption .ts {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan);
  white-space: nowrap;
}

.shot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 26px 0 30px;
}
.shot-grid .shot { margin: 0; }

/* 原话引用 */
.quote {
  margin: 26px 0;
  padding: 2px 0 2px 22px;
  border-left: 2px solid var(--line);
  color: #b9b8b2;
}
.quote p { margin: 0; font-size: 0.98rem; }
.quote cite {
  display: block;
  margin-top: 8px;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.06em;
}
.quote em {
  font-style: normal;
  color: var(--text);
  background: linear-gradient(transparent 62%, rgba(255, 68, 56, 0.22) 62%);
}

/* 公式 */
.formula {
  margin: 24px 0;
  padding: 18px 22px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.94rem;
  color: #e9e7e1;
  overflow-x: auto;
  line-height: 1.9;
}
.formula .frac {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  margin: 0 0.2em;
  line-height: 1.25;
}
.formula .frac span:first-child { border-bottom: 1px solid currentColor; padding: 0 0.35em; }
.formula .frac span:last-child { padding: 0 0.35em; }
.formula .op { color: var(--red); }
.formula .var-q { color: var(--red); }
.formula .var-k { color: var(--cyan); }
.formula .var-v { color: var(--amber); }

/* 误区 */
.misconception {
  margin: 26px 0;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--ink-2);
  position: relative;
}
.misconception::before {
  content: "常见误区";
  position: absolute;
  top: -9px;
  left: 16px;
  background: var(--ink);
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--amber);
}
.misconception p { margin: 4px 0; font-size: 0.96rem; }
.misconception .wrong { color: #e0a09a; }
.misconception .right { color: #b9e3ce; }

/* 讨论卡 */
.discuss {
  margin: 34px 0;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(600px 200px at 100% 0%, rgba(87, 217, 201, 0.07), transparent 70%),
    var(--ink-2);
}
.discuss .tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--cyan);
  text-transform: uppercase;
}
.discuss h4 {
  margin: 8px 0 10px;
  font-size: 1.02rem;
  font-weight: 650;
}
.discuss ul { margin: 0; padding-left: 1.2em; }
.discuss li { color: #c7c6c0; font-size: 0.95rem; margin: 6px 0; }

/* 逐字稿折叠 */
.transcript {
  margin: 24px 0;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.012);
}
.transcript summary {
  cursor: pointer;
  padding: 11px 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
  list-style: none;
}
.transcript summary::-webkit-details-marker { display: none; }
.transcript summary::before {
  content: "+";
  display: inline-block;
  width: 16px;
  color: var(--red);
}
.transcript[open] summary::before { content: "−"; }
.transcript summary:hover { color: var(--text); }
.transcript-body {
  padding: 4px 18px 16px;
  font-size: 14px;
  line-height: 1.85;
  color: #b5b4ae;
  max-height: 420px;
  overflow-y: auto;
}
.transcript-body p { margin: 6px 0; }
.transcript-body .ts {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim);
  margin-right: 9px;
}

/* ---------- 原片 / 解析 对读 ---------- */
.read-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--dim);
}
.read-legend .lg-src {
  color: var(--red);
  border: 1px solid rgba(255, 68, 56, 0.32);
  border-radius: 5px;
  padding: 1px 8px;
}
.read-legend .lg-sep { color: var(--line); }

.src {
  margin: 26px 0 22px;
  padding: 13px 18px 11px;
  border-left: 2px solid rgba(255, 68, 56, 0.52);
  border-radius: 2px 10px 10px 2px;
  background: linear-gradient(90deg, rgba(255, 68, 56, 0.075), rgba(255, 68, 56, 0.016) 70%);
  color: #c3c0b8;
  font-size: 0.94rem;
  line-height: 1.82;
  break-inside: avoid;
}
.src-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  color: var(--dim);
}
.src-head .src-label {
  color: var(--red);
  letter-spacing: 0.12em;
}
.src-head a {
  color: var(--muted);
  border-bottom: 1px dotted var(--line);
}
.src-head a:hover { color: var(--text); }
.src p { margin: 7px 0; }
.src .ts {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #6b6862;
  margin-right: 9px;
}

/* ---------- 交互前的概念说明 ---------- */
.concept-box {
  margin: 26px 0 30px;
  padding: 16px 18px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.016);
}
.concept-box .cb-title {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.concept-box dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
  margin: 0;
}
.concept-box dt {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 650;
}
.concept-box dt span {
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--dim);
}
.concept-box dd {
  margin: 4px 0 0;
  color: #b9b6ae;
  font-size: 0.9rem;
  line-height: 1.72;
}
.concept-box .cb-foot {
  margin: 14px 0 0;
  padding-top: 11px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}
.concept-box .cb-step {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.concept-box .cb-step-title {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 650;
}
.concept-box .cb-step p {
  margin: 8px 0;
  color: #b9b6ae;
  font-size: 0.9rem;
  line-height: 1.72;
}
.concept-box .cb-formula {
  margin: 10px 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #e9e7e1;
  text-align: center;
}

/* ---------- 交互组件 ---------- */
.widget {
  margin: 38px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent 40%), var(--panel);
  overflow: hidden;
}
.widget-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
}
.widget-head .w-index {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--red);
  border: 1px solid rgba(255, 68, 56, 0.3);
  border-radius: 5px;
  padding: 2px 7px;
}
.widget-head h4 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 650;
  flex: 1;
  min-width: 200px;
}
.widget-head .w-hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim);
}
.widget-body { padding: 20px; }
.widget-body canvas { display: block; width: 100%; height: auto; }
.widget-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--muted);
  line-height: 1.75;
}
.widget-foot strong { color: var(--text); }

.w-canvas-wrap {
  position: relative;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #0a0b0e;
  overflow: hidden;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  align-items: flex-end;
  margin-top: 16px;
}
.control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 130px;
  flex: 1;
}
.control label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.control label output { color: var(--text); }
.control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: var(--line);
  border-radius: 99px;
  outline: none;
}
.control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px rgba(255, 68, 56, 0.7);
  cursor: grab;
}
.control input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px rgba(255, 68, 56, 0.7);
  cursor: grab;
}

.btn {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.12s ease;
}
.btn:hover { border-color: var(--red); background: rgba(255, 68, 56, 0.08); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.btn.primary:hover { background: #ff5c50; }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.seg button {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-right: 1px solid var(--line);
  padding: 7px 12px;
  cursor: pointer;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--red); color: #fff; }

.readout {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}
.readout b { color: var(--text); font-weight: 500; }
.readout .hot { color: var(--red); }
.readout .cool { color: var(--cyan); }
.readout .warn { color: var(--amber); }

/* 图例 */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 12px;
}
.legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 6px;
  transform: translateY(-1px);
}

/* ---------- 术语表 / 自测 ---------- */
.section-block {
  margin: 72px 0 0;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}
.section-block h2 {
  font-size: 1.6rem;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.section-block > .sub {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 26px;
}

.glossary {
  margin: 0;
  display: grid;
  gap: 0;
}
.glossary div {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 18px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}
.glossary dt {
  font-weight: 650;
  color: var(--text);
  font-size: 0.95rem;
}
.glossary dt span {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim);
  font-weight: 400;
  margin-top: 2px;
}
.glossary dd {
  margin: 0;
  color: #c2c1bb;
  font-size: 0.93rem;
  line-height: 1.85;
}

.quiz { counter-reset: quiz; display: grid; gap: 12px; }
.quiz details {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--ink-2);
  padding: 0 18px;
}
.quiz details[open] { border-color: rgba(87, 217, 201, 0.3); }
.quiz summary {
  cursor: pointer;
  padding: 14px 0;
  font-size: 0.96rem;
  color: var(--text);
  list-style: none;
  counter-increment: quiz;
}
.quiz summary::-webkit-details-marker { display: none; }
.quiz summary::before {
  content: "Q" counter(quiz);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--cyan);
  margin-right: 12px;
  border: 1px solid rgba(87, 217, 201, 0.3);
  border-radius: 5px;
  padding: 1px 6px;
}
.quiz .answer {
  padding: 0 0 16px;
  color: #bdbcb6;
  font-size: 0.94rem;
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
}
.quiz .answer strong { color: var(--cyan); }

/* ---------- 页脚 / 翻页 ---------- */
.lesson-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 80px 0 0;
}
.lesson-nav a {
  display: block;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  background: var(--ink-2);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.lesson-nav a:hover { border-color: var(--red); transform: translateY(-2px); }
.lesson-nav .dir {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--dim);
  display: block;
  margin-bottom: 5px;
}
.lesson-nav .name { font-size: 0.95rem; color: var(--text); }
.lesson-nav .next { text-align: right; }

.site-foot {
  margin: 90px auto 0;
  max-width: var(--wide);
  padding: 30px 0 0;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 30px;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.04em;
}
.site-foot a { color: var(--muted); }

/* ---------- 首页 ---------- */
.home-hero {
  padding: 90px 0 40px;
}
.home-hero h1 {
  font-size: clamp(2.4rem, 7vw, 5.4rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 850;
  margin: 18px 0 26px;
  max-width: 20ch;
}
.home-hero h1 .thin {
  display: block;
  color: transparent;
  -webkit-text-stroke: 1.2px rgba(241, 239, 233, 0.68);
  font-weight: 800;
}
.home-hero .lede { max-width: 58ch; font-size: 1.15rem; }

.home-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 36px 0 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}
.home-stats span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 14px;
}
.home-stats b { color: var(--text); font-weight: 500; }

.course-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 44px 0 0;
}
.course-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 250px;
  padding: 24px 24px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(400px 180px at 100% 0%, rgba(255, 68, 56, 0.06), transparent 70%),
    var(--ink-2);
  text-decoration: none;
  overflow: hidden;
  transition: border-color 0.22s ease, transform 0.22s ease, background 0.22s ease;
}
.course-card:hover {
  border-color: rgba(255, 68, 56, 0.5);
  transform: translateY(-3px);
  color: var(--text);
}
.course-card .num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--red);
  letter-spacing: 0.12em;
}
.course-card h3 {
  font-size: 1.28rem;
  line-height: 1.4;
  margin: 12px 0 8px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.course-card p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.75;
  margin: 0;
  flex: 1;
}
.course-card .meta {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim);
}
.course-card .thread {
  position: absolute;
  top: 0;
  right: 0;
  width: 90px;
  height: 90px;
  opacity: 0.6;
  pointer-events: none;
}
.course-card .thread path {
  fill: none;
  stroke: var(--red);
  stroke-width: 1.5;
  stroke-dasharray: 3 5;
}

.route {
  margin: 70px 0 0;
  padding: 28px 30px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--ink-2);
}
.route h2 { font-size: 1.3rem; margin: 0 0 8px; }
.route p { color: var(--muted); font-size: 0.94rem; margin: 0 0 20px; }
.route-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}
.route-line .node {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.route-line .node:hover { border-color: var(--red); color: var(--red); }
.route-line .arrow { color: var(--red); }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .rail { display: none; }
  .shell { margin-left: 0; padding: 60px 26px 100px; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .shell { padding: 60px 18px 80px; }
  .hero { padding-top: 46px; }
  .hero h1 { max-width: none; }
  .topbar { padding: 0 16px; gap: 12px; }
  .topbar-nav a { padding: 5px 8px; font-size: 12.5px; white-space: nowrap; }
  .topbar-nav .sep, .topbar-nav a[href*="transcripts"] { display: none; }
  .brand span:last-child { max-width: 128px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .shot-grid { grid-template-columns: 1fr; }
  .course-grid { grid-template-columns: 1fr; }
  .glossary div { grid-template-columns: 1fr; gap: 4px; }
  .lesson-nav { grid-template-columns: 1fr; }
  .chapter-head { flex-wrap: wrap; }
  .t-link { margin-left: 0; }
  .signal-map { padding: 16px 12px; }
  .src { padding: 12px 14px 10px; font-size: 0.91rem; }
  .src-head { flex-wrap: wrap; gap: 6px; }
  .concept-box { padding: 14px 14px 12px; }
  .concept-box dl { grid-template-columns: 1fr; gap: 10px; }
}

/* ---------- 减弱动态 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .signal-path { stroke-dashoffset: 0; }
}

/* ---------- 打印 ---------- */
@media print {
  body { background: #fff; color: #111; }
  .rail, .topbar, .read-progress, .signal-map, .widget, .lesson-nav { display: none; }
  .shell { margin: 0; }
  .chapter { break-inside: avoid; }
  .shot img { max-width: 100%; }
}
