/* ==========================================================================
   图解 AI · 从训练到对话 — 全站设计系统
   零依赖纯静态站 · 暗色主题 · 每章一个主题色
   ========================================================================== */

/* ---------- 1. 设计令牌 ---------- */
:root {
  --bg: #070b14;
  --bg-glow-1: rgba(59, 130, 246, .07);
  --bg-glow-2: rgba(168, 85, 247, .05);
  --bg-soft: #0b1220;
  --bg-card: #0e1728;
  --bg-inset: #0a111e;
  --border: #1d2c49;
  --border-soft: #16223c;
  --text: #dce5f5;
  --text-dim: #8ea1c2;
  --text-faint: #5c6d8f;

  --accent: #60a5fa;            /* 默认（总览/术语表） */
  --accent-soft: rgba(96, 165, 250, .13);
  --accent-line: rgba(96, 165, 250, .35);

  --cyan: #22d3ee;  --orange: #fb923c;  --purple: #a78bfa;
  --green: #4ade80; --pink: #f472b6;    --gold: #fbbf24;
  --red: #f87171;

  --radius: 14px;
  --radius-sm: 8px;
  --sidebar-w: 248px;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

body.page-basics    { --accent: var(--cyan);   --accent-soft: rgba(34,211,238,.12);  --accent-line: rgba(34,211,238,.35); }
body.page-training  { --accent: var(--orange); --accent-soft: rgba(251,146,60,.12);  --accent-line: rgba(251,146,60,.35); }
body.page-inference { --accent: var(--purple); --accent-soft: rgba(167,139,250,.12); --accent-line: rgba(167,139,250,.35); }
body.page-context   { --accent: var(--green);  --accent-soft: rgba(74,222,128,.12);  --accent-line: rgba(74,222,128,.35); }
body.page-sampling  { --accent: var(--pink);   --accent-soft: rgba(244,114,182,.12); --accent-line: rgba(244,114,182,.35); }
body.page-eco       { --accent: var(--gold);   --accent-soft: rgba(251,191,36,.12);  --accent-line: rgba(251,191,36,.35); }

/* ---------- 2. 基础 ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  background:
    radial-gradient(1100px 500px at 85% -5%, var(--bg-glow-2), transparent 60%),
    radial-gradient(900px 480px at -10% 10%, var(--bg-glow-1), transparent 55%),
    var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent-soft); color: #fff; }

/* ---------- 3. 布局：侧边栏 + 主区 ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: rgba(9, 14, 26, .92); backdrop-filter: blur(10px);
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column;
  padding: 22px 14px; z-index: 50; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; border-bottom: 1px solid var(--border-soft); margin-bottom: 14px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, #22d3ee, #a78bfa 55%, #f472b6);
  display: grid; place-items: center; font-size: 17px; color: #07101f; font-weight: 800;
}
.brand-name { font-weight: 700; font-size: 15.5px; letter-spacing: .5px; }
.brand-sub { font-size: 11px; color: var(--text-faint); margin-top: 1px; }

.nav-group-label { font-size: 11px; color: var(--text-faint); letter-spacing: 2px; padding: 12px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px; color: var(--text-dim);
  font-size: 13.5px; transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.04); color: var(--text); text-decoration: none; }
.nav-item .num {
  font-family: var(--mono); font-size: 11px; color: var(--text-faint);
  width: 20px; flex: none; text-align: center;
}
.nav-item.active { background: var(--accent-soft); color: #fff; }
.nav-item.active .num { color: var(--accent); }
.nav-item.active::before { content: ""; width: 3px; height: 18px; border-radius: 2px; background: var(--accent); margin-left: -6px; margin-right: 3px; }
.sidebar-foot { margin-top: auto; padding: 14px 12px 4px; font-size: 11.5px; color: var(--text-faint); border-top: 1px solid var(--border-soft); line-height: 1.9; }

main {
  margin-left: var(--sidebar-w);
  padding: 48px 48px 90px;
  max-width: 1020px;
}
.content-wrap { max-width: 840px; }

/* 阅读进度条 */
#progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--accent), #f472b6);
  z-index: 99; transition: width .1s linear;
}

/* 移动端顶栏 */
.topbar {
  display: none; position: sticky; top: 0; z-index: 60;
  background: rgba(7, 11, 20, .9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
  padding: 12px 16px; align-items: center; gap: 12px;
}
.hamburger {
  width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text); font-size: 17px; cursor: pointer;
  display: grid; place-items: center;
}
.topbar-title { font-size: 14.5px; font-weight: 600; }

/* ---------- 4. 章节头部 ---------- */
.hero { margin-bottom: 46px; }
.kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; letter-spacing: 2.5px; color: var(--accent);
  border: 1px solid var(--accent-line); background: var(--accent-soft);
  border-radius: 999px; padding: 4px 14px; margin-bottom: 18px; font-weight: 600;
}
h1 {
  font-size: clamp(28px, 4.6vw, 40px); line-height: 1.25; margin: 0 0 14px;
  letter-spacing: .5px;
  background: linear-gradient(120deg, #fff 30%, var(--accent));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-sub { color: var(--text-dim); font-size: 17px; max-width: 700px; margin: 0; }
.hero-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 20px; font-size: 13px; color: var(--text-faint); }
.hero-meta b { color: var(--text-dim); font-weight: 600; }

.sec { margin: 62px 0; }
.sec > h2 {
  display: flex; align-items: baseline; gap: 14px;
  font-size: 24px; margin: 0 0 6px; letter-spacing: .3px;
}
.sec-num { font-family: var(--mono); font-size: 15px; color: var(--accent); }
.sec > h3 { font-size: 18.5px; margin: 34px 0 8px; }
.sec p { margin: 12px 0; color: var(--text); }
.sec p.dim, .dim { color: var(--text-dim); }
.sec-lead { font-size: 17px; color: var(--text-dim); margin-top: 2px; }

hr.sep { border: none; border-top: 1px solid var(--border-soft); margin: 54px 0; }

/* ---------- 5. 卡片 / 提示框 ---------- */
.card {
  background: linear-gradient(180deg, var(--bg-card), var(--bg-soft));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; margin: 20px 0;
}
.card:hover { border-color: var(--border); }
.card h4 { margin: 0 0 8px; font-size: 15.5px; }

.callout {
  border-radius: var(--radius-sm); padding: 14px 18px 14px 46px;
  margin: 20px 0; font-size: 14.5px; line-height: 1.8; position: relative;
  border: 1px solid var(--border); background: var(--bg-inset);
}
.callout::before { position: absolute; left: 15px; top: 13px; font-size: 16px; }
.callout .callout-title { font-weight: 700; margin-right: 6px; }
.callout.note::before { content: "💡"; }
.callout.note .callout-title { color: var(--accent); }
.callout.analogy { border-color: rgba(96,165,250,.3); }
.callout.analogy::before { content: "🧭"; }
.callout.analogy .callout-title { color: #7db4ff; }
.callout.warn { border-color: rgba(248,113,113,.3); }
.callout.warn::before { content: "⚠️"; }
.callout.warn .callout-title { color: var(--red); }
.callout.misconception::before { content: "❌"; }
.callout.misconception .callout-title { color: var(--gold); }

/* ---------- 6. 术语高亮 + Tooltip ---------- */
.term {
  border-bottom: 1px dashed var(--accent-line); cursor: help;
  color: #e8eefc; position: relative; white-space: nowrap;
}
.term:hover { background: var(--accent-soft); border-radius: 4px; }
#term-tip {
  position: absolute; z-index: 200; max-width: 320px;
  background: #101b31; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-size: 13px; line-height: 1.7; color: var(--text-dim);
  box-shadow: 0 12px 34px rgba(0,0,0,.5); pointer-events: none; display: none;
}
#term-tip .tt-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
#term-tip .tt-en { color: var(--accent); font-weight: 700; font-size: 13.5px; }
#term-tip .tt-zh { color: #fff; }
#term-tip .tt-link { color: var(--accent); font-size: 12px; margin-top: 6px; display: inline-block; pointer-events: auto; }

/* ---------- 7. 交互演示组件（widget） ---------- */
.widget {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); margin: 26px 0; overflow: hidden;
  box-shadow: 0 18px 44px rgba(0,0,0,.28);
}
.widget-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%);
}
.widget-head .w-icon { font-size: 17px; }
.widget-head .w-title { font-weight: 700; font-size: 14.5px; letter-spacing: .3px; }
.widget-head .w-tag {
  margin-left: auto; font-size: 11px; color: var(--accent);
  border: 1px solid var(--accent-line); padding: 2px 10px; border-radius: 999px;
  white-space: nowrap;
}
.widget-body { padding: 20px 22px; }
.widget-hint { font-size: 13px; color: var(--text-faint); padding: 0 22px 16px; }

/* ---------- 8. 控件 ---------- */
.btn {
  appearance: none; border: 1px solid var(--border); border-radius: 9px;
  background: var(--bg-inset); color: var(--text);
  padding: 8px 16px; font-size: 13.5px; cursor: pointer; font-family: inherit;
  transition: all .15s; line-height: 1.4; display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { border-color: var(--accent-line); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #06101f; font-weight: 700;
}
.btn-primary:hover { filter: brightness(1.12); color: #06101f; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn.active { border-color: var(--accent); background: var(--accent-soft); color: #fff; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 14px 0; }

input[type="text"], select {
  background: var(--bg-inset); border: 1px solid var(--border); border-radius: 9px;
  color: var(--text); padding: 9px 13px; font-size: 14px; font-family: inherit;
  outline: none; transition: border-color .15s;
}
input[type="text"]:focus, select:focus { border-color: var(--accent); }
select { cursor: pointer; }
select option { background: #0e1728; }

.slider-row { display: grid; grid-template-columns: 130px 1fr 74px; gap: 14px; align-items: center; margin: 13px 0; }
.slider-row label { font-size: 13.5px; color: var(--text-dim); }
.slider-row .val { font-family: var(--mono); font-size: 13px; color: var(--accent); text-align: right; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px;
  background: var(--border); border-radius: 4px; outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 3px solid #0b1220; box-shadow: 0 0 0 1px var(--accent);
  cursor: grab;
}
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%; background: var(--accent);
  border: 2px solid #0b1220; cursor: grab;
}

.switch { position: relative; display: inline-block; width: 42px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px; background: var(--border);
  transition: .2s; cursor: pointer;
}
.switch .track::before {
  content: ""; position: absolute; width: 17px; height: 17px; border-radius: 50%;
  background: #8ea1c2; top: 3px; left: 3px; transition: .2s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::before { transform: translateX(19px); background: #06101f; }
.switch-label { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text-dim); cursor: pointer; }

/* ---------- 9. 共享演示原语 ---------- */
/* token 小方块 */
.token-pill {
  display: inline-block; padding: 3px 9px; margin: 3px 3px; border-radius: 7px;
  background: var(--bg-inset); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 13px; color: var(--text);
  transition: all .25s; vertical-align: middle;
}
.token-pill.new { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); transform: scale(1.06); }
.token-pill.faded { opacity: .28; filter: grayscale(.8); }
.token-pill.hl { background: rgba(251, 191, 36, .15); border-color: rgba(251,191,36,.4); color: var(--gold); }

/* 概率条 */
.prob-row { display: grid; grid-template-columns: 92px 1fr 58px; gap: 12px; align-items: center; margin: 7px 0; }
.prob-row .p-name { font-size: 13.5px; text-align: right; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prob-row .p-name b { color: var(--text); font-weight: 600; }
.prob-row .p-track { height: 20px; background: var(--bg-inset); border-radius: 6px; overflow: hidden; border: 1px solid var(--border-soft); }
.prob-row .p-fill { height: 100%; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #fff)); border-radius: 6px; transition: width .35s cubic-bezier(.4,0,.2,1); }
.prob-row .p-pct { font-family: var(--mono); font-size: 12.5px; color: var(--text-dim); }

/* 聊天气泡 */
.chat { display: flex; flex-direction: column; gap: 12px; padding: 6px 2px; }
.chat-msg { max-width: 86%; padding: 10px 15px; border-radius: 14px; font-size: 14px; line-height: 1.7; position: relative; }
.chat-msg .role-tag {
  font-size: 10.5px; letter-spacing: 1.5px; color: var(--text-faint);
  display: block; margin-bottom: 3px; font-family: var(--mono);
}
.chat-msg.user { align-self: flex-end; background: #1b2b4d; border: 1px solid #274071; border-bottom-right-radius: 4px; }
.chat-msg.assistant { align-self: flex-start; background: var(--bg-inset); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-msg.system { align-self: center; background: transparent; border: 1px dashed var(--border); color: var(--text-faint); font-size: 12.5px; max-width: 100%; border-radius: 10px; }
.chat-msg.evicted { opacity: .3; border-style: dashed; filter: grayscale(.6); }
.chat-msg .mem-badge {
  font-size: 10px; color: var(--green); border: 1px solid rgba(74,222,128,.4);
  border-radius: 5px; padding: 1px 6px; margin-left: 8px; vertical-align: 1px;
}

/* 指标小方块 */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 16px 0; }
.metric { background: var(--bg-inset); border: 1px solid var(--border-soft); border-radius: 10px; padding: 12px 14px; }
.metric .m-val { font-family: var(--mono); font-size: 20px; color: var(--accent); font-weight: 700; }
.metric .m-label { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; letter-spacing: .5px; }

/* 流程管线 */
.pipeline { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; margin: 18px 0; }
.pipe-step {
  flex: 1; min-width: 92px; text-align: center; padding: 12px 8px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg-inset);
  font-size: 13px; transition: all .3s; position: relative; color: var(--text-dim);
}
.pipe-step .ps-ico { font-size: 20px; display: block; margin-bottom: 5px; }
.pipe-step.active { border-color: var(--accent); background: var(--accent-soft); color: #fff; transform: translateY(-3px); }
.pipe-step.done { border-color: rgba(74,222,128,.4); color: var(--green); }
.pipe-arrow { display: flex; align-items: center; color: var(--text-faint); font-size: 15px; }

/* 图例 */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-dim); margin: 10px 0; }
.legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }

/* 进度/占用条 */
.bar-track { height: 16px; background: var(--bg-inset); border: 1px solid var(--border-soft); border-radius: 999px; overflow: hidden; position: relative; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #f472b6); transition: width .4s; }
.bar-fill.warn { background: linear-gradient(90deg, var(--gold), var(--red)); }

/* 通用 canvas 容器 */
.canvas-box { background: var(--bg-inset); border: 1px solid var(--border-soft); border-radius: 10px; overflow: hidden; position: relative; }
.canvas-box canvas { display: block; width: 100%; height: 100%; }

/* ---------- 10. 徽章 / 标签 / 代码 / 公式 / 表格 ---------- */
.badge {
  display: inline-block; font-size: 11.5px; padding: 2px 10px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-dim); background: var(--bg-inset);
  margin-right: 6px; vertical-align: 1px; white-space: nowrap;
}
.badge.b-basics { color: var(--cyan);   border-color: rgba(34,211,238,.35); }
.badge.b-training { color: var(--orange); border-color: rgba(251,146,60,.35); }
.badge.b-inference { color: var(--purple); border-color: rgba(167,139,250,.35); }
.badge.b-context { color: var(--green);  border-color: rgba(74,222,128,.35); }
.badge.b-sampling { color: var(--pink);  border-color: rgba(244,114,182,.35); }
.badge.b-app { color: var(--gold);       border-color: rgba(251,191,36,.35); }

code {
  font-family: var(--mono); font-size: .88em; background: var(--bg-inset);
  border: 1px solid var(--border-soft); border-radius: 5px; padding: 1px 6px; color: #a5d6ff;
}
pre {
  background: #0a101d; border: 1px solid var(--border-soft); border-radius: 10px;
  padding: 16px 18px; overflow-x: auto; font-size: 13px; line-height: 1.8;
}
pre code { background: none; border: none; padding: 0; }

.formula {
  font-family: var(--mono); font-size: 15px; text-align: center;
  background: var(--bg-inset); border: 1px solid var(--border-soft); border-radius: 10px;
  padding: 16px; margin: 18px 0; color: #cfe3ff; overflow-x: auto; white-space: nowrap;
}
.formula .op { color: var(--text-faint); }
.formula .hi { color: var(--accent); font-weight: 700; }

table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14px; }
th, td { text-align: left; padding: 10px 13px; border-bottom: 1px solid var(--border-soft); }
th { color: var(--text-faint); font-weight: 600; font-size: 12.5px; letter-spacing: 1px; }
td { color: var(--text-dim); }
td:first-child { color: var(--text); }
tr:hover td { background: rgba(255,255,255,.02); }

/* ---------- 11. 网格 / 对比布局 ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 18px 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px 0; }
.vs-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; background: var(--bg-inset); }
.vs-card h5 { margin: 0 0 10px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.vs-card .vs-badge { font-size: 10.5px; font-family: var(--mono); padding: 2px 8px; border-radius: 6px; letter-spacing: 1px; }

/* ---------- 12. 滚动显现 & 杂项动画 ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.pulsing { animation: pulse 1.1s infinite; }
@keyframes floatIn { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
.float-in { animation: floatIn .3s ease; }

/* 章末翻页 */
.pager {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 80px; padding-top: 26px; border-top: 1px solid var(--border-soft);
}
.pager a {
  display: flex; flex-direction: column; gap: 3px; padding: 14px 20px;
  border: 1px solid var(--border); border-radius: 12px; color: var(--text-dim);
  max-width: 46%; transition: all .15s; font-size: 13px;
}
.pager a:hover { text-decoration: none; border-color: var(--accent-line); color: #fff; background: var(--accent-soft); }
.pager .p-dir { font-size: 11.5px; color: var(--text-faint); letter-spacing: 1px; }
.pager .p-title { font-size: 15px; font-weight: 700; color: var(--text); }
.pager a.next { margin-left: auto; text-align: right; align-items: flex-end; }

footer.site-foot { margin-top: 70px; color: var(--text-faint); font-size: 12.5px; border-top: 1px solid var(--border-soft); padding-top: 22px; }

/* ---------- 13. 响应式 ---------- */
@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: none; box-shadow: 30px 0 60px rgba(0,0,0,.5); }
  .topbar { display: flex; }
  main { margin-left: 0; padding: 30px 20px 70px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .slider-row { grid-template-columns: 96px 1fr 60px; gap: 10px; }
  .prob-row { grid-template-columns: 72px 1fr 50px; gap: 8px; }
  .sec { margin: 46px 0; }
}
@media (max-width: 560px) {
  .widget-body { padding: 15px 14px; }
  .pager { flex-direction: column; }
  .pager a { max-width: 100%; }
}

/* ==========================================================================
   v2 增强层：通俗版排版 · 插画 · 全站动效
   ========================================================================== */

/* ---------- 极光背景（全站，缓慢漂移） ---------- */
body::before {
  content: ""; position: fixed; inset: -10%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(560px 380px at 18% 8%, var(--accent-soft), transparent 65%),
    radial-gradient(640px 420px at 82% 88%, rgba(244,114,182,.055), transparent 60%),
    radial-gradient(500px 360px at 70% 20%, rgba(96,165,250,.05), transparent 60%);
  animation: auroraShift 16s ease-in-out infinite alternate;
}
@keyframes auroraShift {
  from { transform: translate3d(0,0,0) scale(1); opacity: .75; }
  to   { transform: translate3d(-36px, 26px, 0) scale(1.12); opacity: 1; }
}

/* ---------- Hero 双栏（左文右插画） ---------- */
.hero { display: grid; grid-template-columns: 1.3fr .7fr; gap: 26px; align-items: center; }
.hero-art { animation: heroFloat 6s ease-in-out infinite; }
.hero-art svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 20px 44px rgba(0,0,0,.38)); }
@keyframes heroFloat {
  0%, 100% { transform: translateY(0) rotate(-.6deg); }
  50% { transform: translateY(-13px) rotate(.6deg); }
}
.hero .hero-copy { min-width: 0; }
@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { max-width: 330px; margin: 6px auto 0; }
}

/* ---------- 章节图标（56x56） ---------- */
.sec-ico {
  display: inline-flex; width: 56px; height: 56px; flex: none;
  border-radius: 15px; background: var(--accent-soft);
  border: 1px solid var(--accent-line); color: var(--accent);
  align-items: center; justify-content: center; margin-right: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,.25), inset 0 0 14px var(--accent-soft);
}
.sec-ico svg { width: 34px; height: 34px; }
.sec > h2 { display: flex; align-items: center; }
.reveal.in .sec-ico { animation: icoPop .65s cubic-bezier(.34,1.56,.64,1) both .1s; }
@keyframes icoPop {
  from { transform: scale(.3) rotate(-18deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}
h3 .h3-ico { display: inline-flex; width: 26px; height: 26px; color: var(--accent); vertical-align: -6px; margin-right: 7px; }
h3 .h3-ico svg { width: 100%; height: 100%; }

/* ---------- 「说人话」盒子 ---------- */
.callout.plain {
  border-color: rgba(94,234,212,.35);
  background: linear-gradient(95deg, rgba(94,234,212,.08), var(--bg-inset) 55%);
}
.callout.plain::before { content: "🗣"; }
.callout.plain .callout-title { color: #5eead4; }

/* ---------- 卡片扫光 ---------- */
.ch-card::after, .vs-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 32%, rgba(255,255,255,.09) 46%, transparent 60%);
  transform: translateX(-130%);
}
.ch-card, .vs-card { position: relative; overflow: hidden; }
.ch-card:hover::after, .vs-card:hover::after { animation: shine .85s ease; }
@keyframes shine { to { transform: translateX(130%); } }

/* ---------- 首页概念地图：流光连线 + 节点呼吸 ---------- */
.cmap .arrow { stroke-dasharray: 7 5; animation: dashFlow 1.5s linear infinite; }
@keyframes dashFlow { to { stroke-dashoffset: -24; } }
.cmap .node rect { animation: nodeBreath 3.4s ease-in-out infinite; }
.cmap .node:nth-of-type(2n) rect { animation-delay: .8s; }
.cmap .node:nth-of-type(3n) rect { animation-delay: 1.6s; }
@keyframes nodeBreath { 0%,100% { opacity: .9; } 50% { opacity: 1; } }

/* ---------- Widget 头部图标摇摆 + 进入时上浮 ---------- */
.widget-head .w-icon { display: inline-block; animation: wob 3s ease-in-out infinite; }
@keyframes wob { 0%,100% { transform: rotate(-7deg) scale(1); } 50% { transform: rotate(7deg) scale(1.12); } }
.widget { animation: widgetIn .5s ease both; }
.widget:hover { border-color: var(--accent-line); }
@keyframes widgetIn { from { transform: translateY(14px); opacity: .6; } }

/* ---------- 新 token 微光扩散 ---------- */
@keyframes newGlow {
  0% { box-shadow: 0 0 0 0 var(--accent-line); }
  100% { box-shadow: 0 0 0 12px transparent; }
}
.token-pill.new { animation: newGlow 1.1s ease; }

/* ---------- 打字机光标 ---------- */
.type-cursor::after { content: "▌"; color: var(--accent); margin-left: 2px; animation: blinkC 1s steps(1) infinite; }
@keyframes blinkC { 50% { opacity: 0; } }

/* ---------- tooltip 弹入 ---------- */
#term-tip { animation: tipIn .16s ease; }
@keyframes tipIn { from { opacity: 0; transform: translateY(5px); } }

/* ---------- 顶部进度条流动 ---------- */
#progress { background: linear-gradient(90deg, var(--accent), #f472b6, #22d3ee, var(--accent)); background-size: 220% 100%; animation: gradFlow 3.5s linear infinite; }
@keyframes gradFlow { to { background-position: 220% 0; } }

/* ---------- 指标数字强调 ---------- */
.metric { transition: transform .2s, border-color .2s; }
.metric:hover { transform: translateY(-3px); border-color: var(--accent-line); }

/* ---------- 按钮微交互 ---------- */
.btn { transition: transform .12s, border-color .15s, background .15s, color .15s, filter .15s; }
.btn:not(:disabled):hover { transform: translateY(-1px); }
.btn-primary { box-shadow: 0 6px 20px -6px var(--accent-line); }

/* ---------- 侧边栏指示 ---------- */
.nav-item.active { box-shadow: inset 0 0 0 1px var(--accent-line); }

/* ---------- SVG 插画内部动画 ---------- */
.illust .floaty { animation: bob 3.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.illust .spin-slow { animation: spinSlow 12s linear infinite; transform-box: fill-box; transform-origin: center; }
.illust .drift { animation: driftX 4.5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.illust .blink { animation: eyeBlink 4.2s infinite; transform-box: fill-box; transform-origin: center; }
.illust .dashline { animation: dashFlow 1.4s linear infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes spinSlow { to { transform: rotate(360deg); } }
@keyframes driftX { to { transform: translateX(9px); } }
@keyframes eyeBlink { 0%, 91%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }

/* ---------- 大字号友好（通俗版排版微调） ---------- */
.hero-sub { font-size: 17.5px; }
.sec p { font-size: 16.5px; }

/* ---------- 动效偏好：减少动画 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

