/* ============================================================
   设计系统变量
   ============================================================ */
:root {
  --ink: #17202a;
  --muted: #5d6b78;
  --line: #d8e1e8;
  --paper: #fbfcf7;
  --panel: #ffffff;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --teal-light: #eef8f6;
  --coral: #d14f3f;
  --gold: #c58a15;
  --gold-light: #fff7ed;
  --blue: #2c5f9e;
  --blue-light: #eaf1f8;
  --shadow: 0 20px 70px rgba(18, 31, 43, 0.12);
  --shadow-sm: 0 10px 35px rgba(18, 31, 43, 0.06);
  --dark: #17202a;
  --dark-2: #1e2a36;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, p { overflow-wrap: anywhere; }

h1 {
  margin: 0;
  max-width: 850px;
  font-size: clamp(36px, 5.5vw, 68px);
  line-height: 1.08;
}
h2 {
  margin: 0;
  font-size: clamp(26px, 3.5vw, 42px);
  line-height: 1.15;
}
h3 {
  margin: 0 0 10px;
  font-size: 20px;
  line-height: 1.3;
}

/* ============================================================
   顶部导航
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 60px;
  padding: 10px clamp(18px, 4vw, 56px);
  background: rgba(251, 252, 247, 0.92);
  border-bottom: 1px solid rgba(216, 225, 232, 0.8);
  backdrop-filter: blur(16px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  white-space: nowrap;
  font-size: 15px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
}
.nav {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.8vw, 22px);
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
}
.nav a {
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color .2s, border-color .2s;
}
.nav a:hover {
  color: var(--ink);
  border-bottom-color: var(--teal);
}

/* ============================================================
   Hero 首屏
   ============================================================ */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  padding: clamp(70px, 9vw, 130px) clamp(18px, 6vw, 88px) clamp(50px, 6vw, 90px);
  overflow: hidden;
  background: #eef4f2;
}
#heroCanvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  opacity: 0.7;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(238,244,242,0.96) 0%, rgba(238,244,242,0.7) 50%, rgba(238,244,242,0.3) 100%),
    linear-gradient(0deg, rgba(251,252,247,0.9) 0%, rgba(251,252,247,0) 28%);
}
.hero-content, .hero-panel { position: relative; z-index: 1; }
.hero-content { max-width: 820px; }

.eyebrow {
  margin: 0 0 12px;
  color: var(--coral);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}
.hero-copy {
  max-width: 680px;
  margin: 22px 0 0;
  color: #344554;
  font-size: clamp(16px, 1.8vw, 20px);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  transition: background .2s, border-color .2s, transform .15s;
}
.button:hover { transform: translateY(-1px); }
.primary { background: var(--teal); color: #fff; }
.primary:hover { background: var(--teal-dark); }
.secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.secondary:hover { border-color: var(--teal); color: var(--teal); }

.hero-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.chat-bubble {
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.5;
  max-width: 90%;
}
.user-bubble {
  justify-self: end;
  background: var(--teal);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-bubble {
  justify-self: start;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.typing-cursor::after {
  content: "▋";
  animation: blink 1s step-end infinite;
  color: var(--teal);
}
@keyframes blink { 50% { opacity: 0; } }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 4px;
}
.hero-stats > div {
  display: flex;
  flex-direction: column;
  padding: 12px;
  background: rgba(251,252,247,0.8);
  border-radius: 8px;
  text-align: center;
}
.stat {
  color: var(--blue);
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
}
.hero-stats span:last-child {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* ============================================================
   侧边故事进度轨
   ============================================================ */
.story-rail {
  position: fixed;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
}
.story-rail ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}
.story-rail li {
  position: relative;
  display: flex;
  align-items: center;
  height: 44px;
  cursor: pointer;
}
.story-rail li::before {
  content: "";
  position: absolute;
  left: 7px;
  top: -22px;
  width: 2px;
  height: 22px;
  background: var(--line);
}
.story-rail li:first-child::before { display: none; }
.story-rail .node-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--line);
  transition: all .3s;
  flex-shrink: 0;
}
.story-rail .node-label {
  margin-left: 12px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
.story-rail li:hover .node-label,
.story-rail li.active .node-label {
  opacity: 1;
  transform: translateX(0);
}
.story-rail li.active .node-dot {
  background: var(--teal);
  border-color: var(--teal);
  transform: scale(1.3);
  box-shadow: 0 0 0 4px rgba(15,118,110,0.2);
}
.story-rail li.active .node-label {
  color: var(--teal);
  font-weight: 800;
}
.story-rail li.read .node-dot {
  background: var(--teal-light);
  border-color: var(--teal);
}

/* ============================================================
   故事主体
   ============================================================ */
.story-main {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 48px);
}
.story-stage {
  padding: clamp(48px, 7vw, 88px) 0;
  border-bottom: 1px solid var(--line);
}
.story-stage.alt {
  position: relative;
  background: transparent;
  margin: 0;
  padding: clamp(48px, 7vw, 88px) 0;
  border-left: 0;
  border-right: 0;
}

.story-stage.alt::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  background: #f5f7ee;
  z-index: -1;
}

.stage-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 24px;
}
.stage-num {
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 900;
  color: var(--teal);
  opacity: 0.25;
  line-height: 1;
  flex-shrink: 0;
}
.stage-header h2 { flex: 1; }

/* 故事旁白 */
.narrative { margin-bottom: 28px; }
.narrative-bubble {
  position: relative;
  margin: 0;
  padding: 20px 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--coral);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  font-size: 17px;
  color: #344554;
}
.narrative-bubble strong { color: var(--ink); }

/* 概念揭秘 */
.concept-reveal {
  margin-bottom: 28px;
  padding: 22px 24px;
  background: var(--teal-light);
  border: 1px solid rgba(15,118,110,0.2);
  border-radius: 8px;
}
.concept-reveal h3 {
  color: var(--teal-dark);
  margin-bottom: 10px;
}
.concept-reveal p {
  margin: 0;
  color: #344554;
}
.concept-reveal strong { color: var(--ink); }

/* ============================================================
   演示面板通用样式
   ============================================================ */
.demo-panel {
  background: var(--dark);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.demo-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: var(--dark-2);
  color: #e8f1f2;
  font-size: 14px;
  font-weight: 700;
}
.demo-btn {
  padding: 8px 16px;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: background .2s, transform .15s;
}
.demo-btn:hover { background: var(--teal-dark); transform: translateY(-1px); }
.demo-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.demo-body {
  padding: 24px;
  color: #dce7eb;
}
.demo-body label { color: #a0b5c0; }
.demo-body p { color: #a0b5c0; }

/* ============================================================
   阶段1: 三面板对比
   ============================================================ */
.three-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.panel-card {
  padding: 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  text-align: center;
}
.panel-tag {
  display: inline-block;
  padding: 4px 12px;
  margin-bottom: 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.panel-card[data-type="rule"] .panel-tag { background: var(--coral); color: #fff; }
.panel-card[data-type="ml"] .panel-tag { background: var(--gold); color: #fff; }
.panel-card[data-type="gen"] .panel-tag { background: var(--teal); color: #fff; }
.panel-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 120px;
  justify-content: center;
  margin-bottom: 12px;
}
.flow-node {
  padding: 8px 14px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}
.flow-arrow-down {
  color: #6b8290;
  font-size: 18px;
}
.panel-card p {
  font-size: 13px;
  margin: 0;
  color: #a0b5c0;
  line-height: 1.5;
}

/* ============================================================
   阶段2: Token 切分
   ============================================================ */
.demo-body textarea {
  width: 100%;
  resize: vertical;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
  color: #fff;
  font: inherit;
  font-size: 15px;
}
.demo-body textarea:focus {
  outline: none;
  border-color: var(--teal);
}
.token-blocks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0;
  min-height: 40px;
}
.token-block {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  opacity: 0;
  transform: scale(0.8);
}
.token-block.t-zh { background: var(--teal); }
.token-block.t-en { background: var(--blue); }
.token-block.t-num { background: var(--coral); }
.token-block.t-punct { background: var(--gold); }
.token-block.t-space { background: #4a5a68; }
.token-stats { margin-top: 12px; }
.result-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 16px;
  margin-bottom: 8px;
}
.result-row strong {
  color: var(--teal);
  font-size: 30px;
}
.meter {
  height: 10px;
  overflow: hidden;
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
}
.meter-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--coral));
  transition: width 200ms ease;
  border-radius: 999px;
}
.hint {
  margin: 10px 0 0;
  color: #6b8290;
  font-size: 13px;
}

/* ============================================================
   阶段3: 推理演示
   ============================================================ */
.inference-demo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.inference-output, .inference-candidates {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 16px;
  min-height: 200px;
}
.inference-label {
  font-size: 12px;
  color: #6b8290;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.inference-text {
  font-size: 18px;
  line-height: 1.6;
  min-height: 100px;
}
.inference-text .cursor {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: var(--teal);
  vertical-align: text-bottom;
  animation: blink 0.8s step-end infinite;
}
.prob-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.prob-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateX(-10px);
}
.prob-bar .prob-word {
  min-width: 60px;
  font-size: 15px;
  font-weight: 600;
  text-align: right;
}
.prob-bar .prob-track {
  flex: 1;
  height: 22px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.prob-bar .prob-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
  background: var(--blue);
}
.prob-bar.selected .prob-fill {
  background: var(--teal);
}
.prob-bar.selected .prob-word {
  color: var(--teal);
}
.prob-bar .prob-pct {
  min-width: 44px;
  font-size: 13px;
  color: #6b8290;
}

/* ============================================================
   阶段4: 训练流水线
   ============================================================ */
.training-pipeline {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: stretch;
  gap: 12px;
}
.train-stage {
  padding: 20px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  text-align: center;
  opacity: 0.3;
  transition: opacity 0.5s;
}
.train-stage.active { opacity: 1; }
.train-icon { font-size: 32px; margin-bottom: 8px; }
.train-name {
  font-size: 18px;
  font-weight: 800;
  color: #e8f1f2;
  margin-bottom: 4px;
}
.train-desc {
  font-size: 13px;
  color: #a0b5c0;
  margin-bottom: 12px;
}
.train-visual {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
}
.train-visual .mini-block {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  opacity: 0;
}
.train-arrow {
  display: flex;
  align-items: center;
  font-size: 24px;
  color: #6b8290;
}

/* ============================================================
   阶段5: Prompt 对比
   ============================================================ */
.prompt-compare {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: stretch;
}
.prompt-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.prompt-label {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  align-self: flex-start;
}
.prompt-label.bad { background: var(--coral); color: #fff; }
.prompt-label.good { background: var(--teal); color: #fff; }
.prompt-text {
  padding: 12px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
  color: #dce7eb;
}
.prompt-result {
  flex: 1;
  padding: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.6;
  min-height: 120px;
  white-space: pre-wrap;
}
.prompt-result .placeholder { color: #6b8290; font-style: italic; }

/* 演示表格（用于 Prompt 对比） */
.demo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.5;
  color: #dce7eb;
}
.demo-table thead tr {
  background: rgba(255, 255, 255, 0.06);
}
.demo-table th,
.demo-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
  vertical-align: top;
}
.demo-table th {
  color: #e8f1f2;
  font-weight: 800;
}
.demo-table td {
  color: #dce7eb;
}
.demo-table tbody tr:last-child td {
  border-bottom: 0;
}
.prompt-vs {
  display: flex;
  align-items: center;
  font-size: 18px;
  font-weight: 900;
  color: var(--gold);
}

/* ============================================================
   阶段6: RAG 演示
   ============================================================ */
.rag-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.rag-step {
  width: 100%;
  max-width: 600px;
  padding: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 4px 14px;
  align-items: start;
  opacity: 0.4;
  transition: opacity 0.5s;
}
.rag-step.active { opacity: 1; }
.rag-icon {
  grid-column: 1;
  grid-row: 1;
  font-size: 28px;
  line-height: 1;
}
.rag-label {
  grid-column: 2;
  grid-row: 1;
  font-size: 13px;
  font-weight: 800;
  color: var(--teal);
  line-height: 1.4;
}
.rag-content {
  grid-column: 2;
  grid-row: 2;
  font-size: 14px;
  color: #dce7eb;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.rag-content .placeholder { color: #6b8290; font-style: italic; }
.rag-docs {
  display: grid;
  gap: 6px;
}
.rag-doc {
  padding: 8px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 4px;
  font-size: 12px;
  transition: all 0.4s;
}
.rag-doc.matched {
  background: rgba(15,118,110,0.2);
  border-color: var(--teal);
  color: #e8f1f2;
}
.rag-arrow {
  color: #6b8290;
  font-size: 20px;
}

/* ============================================================
   阶段7: Agent 环形
   ============================================================ */
.agent-demo {
  display: grid;
  gap: 20px;
}
.agent-cycle {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.agent-node {
  padding: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  text-align: center;
  opacity: 0.4;
  transition: all 0.4s;
}
.agent-node.active {
  opacity: 1;
  border-color: var(--teal);
  background: rgba(15,118,110,0.15);
  transform: scale(1.05);
}
.agent-node-icon { font-size: 28px; margin-bottom: 6px; }
.agent-node-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--teal);
  margin-bottom: 4px;
}
.agent-node-text {
  font-size: 12px;
  color: #a0b5c0;
  line-height: 1.4;
}
.agent-stage {
  min-height: 60px;
  padding: 16px;
  background: rgba(15,118,110,0.12);
  border: 1px solid rgba(15,118,110,0.3);
  border-radius: 8px;
  font-weight: 700;
  color: #e8f1f2;
}
.agent-log {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: #a0b5c0;
  font-size: 14px;
}
.agent-log li {
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
  border-left: 3px solid var(--teal);
}

/* ============================================================
   阶段8: CLI 演示
   ============================================================ */
.cli-demo { display: grid; gap: 20px; }

.cli-terminal {
  padding: 16px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
  font-size: 13px;
  min-height: 180px;
}
.terminal-line {
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
}
.terminal-line .prompt {
  color: var(--teal);
  font-weight: 700;
}
.terminal-line .cmd {
  color: #dce7eb;
  word-break: break-all;
}
.term-cursor {
  color: var(--teal);
  animation: blink 0.8s step-end infinite;
}
.terminal-output {
  margin-top: 12px;
  color: #a0b5c0;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
}

.cli-narrative {
  padding: 16px 20px;
  background: rgba(15,118,110,0.1);
  border: 1px solid rgba(15,118,110,0.25);
  border-radius: 8px;
  font-size: 15px;
  color: #e8f1f2;
  line-height: 1.6;
  min-height: 60px;
}
.cli-narrative .placeholder { color: #6b8290; font-style: italic; }
.cli-narrative strong { color: var(--teal); }

.cli-code {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  overflow: hidden;
}
.cli-code .code-block {
  margin: 0;
  padding: 16px;
  background: rgba(0,0,0,0.4);
  color: #dce7eb;
  font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  max-height: 320px;
  overflow-y: auto;
}

/* ============================================================
   阶段9: MCP 演示
   ============================================================ */
.mcp-demo { display: grid; gap: 20px; }

.mcp-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
}
.mcp-node {
  padding: 10px 20px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  color: #dce7eb;
  transition: all 0.4s;
}
.mcp-ai.active {
  border-color: var(--teal);
  background: rgba(15,118,110,0.2);
  box-shadow: 0 0 16px rgba(15,118,110,0.4);
  transform: scale(1.05);
}
.mcp-conn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  opacity: 0.3;
  transition: opacity 0.4s;
}
.mcp-conn.active { opacity: 1; }
.mcp-protocol {
  font-size: 11px;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.5px;
}
.mcp-line {
  width: 2px;
  height: 20px;
  background: var(--gold);
}
.mcp-servers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}
.mcp-server {
  padding: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  font-size: 13px;
  color: #6b8290;
  transition: all 0.4s;
  text-align: center;
}
.mcp-server.active {
  background: rgba(15,118,110,0.2);
  border-color: var(--teal);
  color: #e8f1f2;
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(15,118,110,0.3);
}

.mcp-narrative {
  padding: 16px 20px;
  background: rgba(15,118,110,0.1);
  border: 1px solid rgba(15,118,110,0.25);
  border-radius: 8px;
  font-size: 15px;
  color: #e8f1f2;
  line-height: 1.6;
  min-height: 60px;
}
.mcp-narrative .placeholder { color: #6b8290; font-style: italic; }
.mcp-narrative strong { color: var(--teal); }

.mcp-code {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  overflow: hidden;
}
.mcp-code .code-block {
  margin: 0;
  padding: 16px;
  background: rgba(0,0,0,0.4);
  color: #dce7eb;
  font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  max-height: 320px;
  overflow-y: auto;
}

/* ============================================================
   阶段10: SKILL 演示
   ============================================================ */
.skill-demo { display: grid; gap: 20px; }

.skill-explorer {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
  min-height: 400px;
  align-items: stretch;
}

/* 左侧：目录树 */
.skill-tree {
  padding: 14px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.skill-folder {
  color: #e8f1f2;
  font-weight: 700;
  padding: 4px 0;
}
.skill-folder.sub {
  color: var(--gold);
  font-size: 12px;
  padding-left: 8px;
  margin-top: 6px;
}
/* 子文件夹内的文件添加缩进 */
.skill-tree > .skill-folder.sub + .skill-file,
.skill-tree > .skill-file[data-file="run-test-sh"],
.skill-tree > .skill-file[data-file="parse-response-py"],
.skill-tree > .skill-file[data-file="test-patterns-md"],
.skill-tree > .skill-file[data-file="security-checklist-md"],
.skill-tree > .skill-file[data-file="report-template-md"] {
  padding-left: 24px;
}
.skill-file {
  color: #6b8290;
  opacity: 0.5;
  transition: all 0.3s;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.skill-file:hover {
  opacity: 0.8;
  background: rgba(255,255,255,0.04);
}
.skill-file.active {
  opacity: 1;
  color: var(--teal);
  background: rgba(15,118,110,0.15);
  border: 1px solid rgba(15,118,110,0.3);
}
.skill-file .file-icon { font-size: 14px; }
.skill-file .file-name { font-weight: 600; }
.skill-file .file-hint {
  color: #4a5a68;
  font-size: 11px;
  width: 100%;
  padding-left: 22px;
}

/* 右侧：文件内容 */
.skill-content {
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  overflow: hidden;
  min-height: 0;
}
.skill-content-header {
  padding: 10px 16px;
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--teal);
}
.skill-code-block {
  margin: 0;
  padding: 16px;
  background: transparent;
  color: #dce7eb;
  font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  flex: 1;
  overflow-y: auto;
  min-height: 200px;
}

.skill-narrative {
  padding: 16px 20px;
  background: rgba(15,118,110,0.1);
  border: 1px solid rgba(15,118,110,0.25);
  border-radius: 8px;
  font-size: 15px;
  color: #e8f1f2;
  line-height: 1.6;
  min-height: 60px;
}
.skill-narrative .placeholder { color: #6b8290; font-style: italic; }
.skill-narrative strong { color: var(--teal); }

/* ============================================================
   阶段9: 安全实验室（原阶段9，现阶段11）
   ============================================================ */
.security-lab { display: grid; gap: 16px; }
.lab-intro p {
  margin: 0 0 6px;
  font-size: 14px;
  color: #a0b5c0;
}
.lab-intro code {
  padding: 4px 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  font-size: 13px;
  color: var(--gold);
  font-family: "SFMono-Regular", Consolas, monospace;
}
.lab-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.lab-chip {
  padding: 6px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  color: #dce7eb;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.lab-chip:hover {
  background: rgba(209,79,63,0.2);
  border-color: var(--coral);
}
.lab-input-row {
  display: flex;
  gap: 10px;
}
.lab-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  background: rgba(0,0,0,0.3);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-family: "SFMono-Regular", Consolas, monospace;
}
.lab-input:focus {
  outline: none;
  border-color: var(--coral);
}
.lab-output {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  padding: 16px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
}
.lab-light {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #4a5a68;
  margin-top: 4px;
  transition: background 0.3s, box-shadow 0.3s;
}
.lab-light.safe { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.lab-light.warn { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.lab-light.danger { background: var(--coral); box-shadow: 0 0 8px var(--coral); }
.lab-response {
  font-size: 14px;
  color: #dce7eb;
  line-height: 1.6;
}
.lab-response .placeholder { color: #6b8290; font-style: italic; }
.lab-response .blocked { color: var(--coral); font-weight: 700; }
.lab-response .ok { color: #22c55e; }

/* ============================================================
   阶段10: 测试场景（原阶段10，现阶段12）
   ============================================================ */
.filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}
.chip {
  padding: 8px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s;
}
.chip:hover { border-color: var(--teal); color: var(--teal); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}
.scenario {
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}
.scenario:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.scenario.hidden { display: none; }
.scenario h3 { margin-bottom: 8px; }
.scenario p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.scenario-tag {
  display: inline-block;
  margin-top: 12px;
  padding: 3px 10px;
  background: var(--teal-light);
  color: var(--teal-dark);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.quality-matrix { margin-bottom: 32px; }
.quality-matrix h3 { margin-bottom: 14px; }
.matrix {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.matrix > div {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.matrix > div:nth-child(odd) {
  background: var(--teal-light);
  color: var(--teal-dark);
  font-weight: 800;
}
.matrix > div:nth-last-child(-n+2) { border-bottom: 0; }

.closing-callout {
  padding: 24px;
  background: var(--dark);
  border-radius: 12px;
  color: #fff;
  text-align: center;
}
.closing-callout p {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
}
.closing-callout .muted {
  font-size: 15px;
  font-weight: 400;
  color: #a0b5c0;
}

/* ============================================================
   阶段间导航
   ============================================================ */
.stage-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px dashed var(--line);
}
.nav-btn {
  padding: 10px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  transition: all 0.2s;
}
.nav-btn:hover:not(:disabled) {
  border-color: var(--teal);
  color: var(--teal);
  transform: translateY(-1px);
}
.nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.nav-btn.next {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}
.nav-btn.next:hover:not(:disabled) {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: #fff;
}

/* ============================================================
   页脚
   ============================================================ */
.footer {
  padding: 28px clamp(18px, 6vw, 88px);
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
}

/* ============================================================
   滚动浮现
   ============================================================ */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 880px) {
  .nav { display: none; }
  .hero { grid-template-columns: 1fr; }
  .story-rail { display: none; }
  .three-panel,
  .training-pipeline,
  .agent-cycle,
  .scenario-grid,
  .mcp-servers,
  .skill-explorer {
    grid-template-columns: 1fr;
  }
  .train-arrow,
  .agent-cycle .agent-node { text-align: center; }
  .training-pipeline {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .train-arrow { transform: rotate(90deg); justify-self: center; }
  .prompt-compare {
    grid-template-columns: 1fr;
  }
  .prompt-vs { justify-self: center; transform: rotate(90deg); }
  .inference-demo {
    grid-template-columns: 1fr;
  }
  .matrix {
    grid-template-columns: 1fr;
  }
  .matrix > div:nth-last-child(-n+2) { border-bottom: 1px solid var(--line); }
  .matrix > div:last-child { border-bottom: 0; }
  .story-stage.alt {
    margin: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .story-stage.alt::before {
    width: 100vw;
  }
}

@media (max-width: 480px) {
  .stage-nav {
    flex-direction: column;
  }
  .nav-btn { width: 100%; }
}

/* ============================================================
   prefers-reduced-motion 降级
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .fade-up {
    opacity: 1;
    transform: none;
  }
  html { scroll-behavior: auto; }
}
