:root {
  --realm-color: #D6ECF0;
  --realm-glow: #D6ECF033;
}

/* 元婴期紫色境界色覆写 */
:root, :root[data-theme="light"] {
  --accent: var(--accent);
  --accent-ink: #7C3AED;
  --accent-soft: var(--accent-soft);
  --glass-line: rgba(139, 92, 246, 0.22);
  --glow: 0 0 18px rgba(139, 92, 246, 0.28);
  --on-accent: #FFFFFF;
}
:root[data-theme="dark"] {
  --accent: #A78BFA;
  --accent-ink: #C4B5FD;
  --accent-soft: rgba(139, 92, 246, 0.16);
  --glass-line: rgba(139, 92, 246, 0.24);
  --glow: 0 0 22px rgba(139, 92, 246, 0.34);
  --on-accent: #1A0B2E;
}

.op-title span,
.op-sub {
  color: var(--realm-color);
}
/* 元婴期·月白光晕：开场与场景头点缀 */
.op-kicker,
.scene-kicker {
  color: var(--realm-color);
}
/* focus-breath 呼吸光晕（下一场景按钮引导） */
.focus-breath {
  box-shadow: 0 0 0 0 #D6ECF066;
  animation: ch22Breath 2s ease-in-out infinite;
}

@keyframes ch22Breath {
  0%, 100% { box-shadow: 0 0 0 0 #D6ECF066; }
  50% { box-shadow: 0 0 16px 4px #D6ECF044; }
}

/* 统纹（S10 本命石新痕）—— 微缩 SoC 契约版图 */
.s10-scar-tongwen {
  display: inline-block;
  width: 56px;
  height: 56px;
  position: relative;
  vertical-align: middle;
  margin: 0 0.4rem;
  border: 1.5px solid var(--realm-color);
  border-radius: 6px;
  background:
    /* 中军帐 CPU 银色方块 */
    linear-gradient(135deg, #C0C0C0 0%, #C0C0C0 100%) 18% 18% / 22% 22% no-repeat,
    /* 演武场 GPU 青蓝方块 */
    linear-gradient(135deg, #4FC3F7 0%, #4FC3F7 100%) 60% 18% / 22% 22% no-repeat,
    /* 矩阵塔 NPU 金色方块 */
    linear-gradient(135deg, #FFD54F 0%, #FFD54F 100%) 18% 60% / 22% 22% no-repeat,
    /* 浮屠塔 Memory 铜色方块 */
    linear-gradient(135deg, #B87333 0%, #B87333 100%) 60% 60% / 22% 22% no-repeat;
  box-shadow: 0 0 10px #D6ECF055, inset 0 0 8px rgba(0,0,0,.4);
}

/* 五色 AXI 通道光带（连接四模块的十字光带） */
.s10-scar-tongwen::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    /* 横向 AR黄/R绿/AW橙/W蓝/B紫 五色细带 */
    linear-gradient(90deg,
      transparent 0%, transparent 38%,
      #FFD54F 38%, #FFD54F 44%,
      #4CAF50 44%, #4CAF50 50%,
      #FF9800 50%, #FF9800 56%,
      #4FC3F7 56%, #4FC3F7 62%,
      transparent 62%, transparent 100%) center / 100% 2px no-repeat,
    /* 纵向五色带 */
    linear-gradient(0deg,
      transparent 0%, transparent 38%,
      #FFD54F 38%, #FFD54F 44%,
      #4CAF50 44%, #4CAF50 50%,
      #FF9800 50%, #FF9800 56%,
      #4FC3F7 56%, #4FC3F7 62%,
      transparent 62%, transparent 100%) center / 2px 100% no-repeat;
  opacity: 0.85;
}

/* 金色契约环（脉动）+ 角落印记 */
.s10-scar-tongwen::after {
  content: '';
  position: absolute;
  inset: 2px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  box-shadow: 0 0 6px var(--gold)88;
  animation: ch22Contract 2.2s ease-in-out infinite;
}
@keyframes ch22Contract {
  0%, 100% { box-shadow: 0 0 4px var(--gold)66; opacity: 0.7; }
  50% { box-shadow: 0 0 10px var(--gold)cc; opacity: 1; }
}

/* S8 Boss 战触发按钮的月白描边 */
#s8-start {
  border-color: var(--realm-color);
  color: var(--realm-color);
}
#s8-start:hover {
  background: var(--realm-color);
  color: var(--bg-sunk);
}

/* S0 万器之城鸟瞰：模块色块网格 */
.s0-city-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin: 1rem 0;
}
.s0-city-cell {
  padding: 0.6rem 0.4rem;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--glass-bg);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.75rem;
}
.s0-city-cell:hover {
  border-color: var(--realm-color);
  transform: translateY(-2px);
}
.s0-city-cell .ico { font-size: 1.3rem; display: block; }
.s0-city-cell .nm { color: var(--text-2); display: block; margin-top: 0.2rem; }
.s0-city-cell .warn { color: var(--danger); font-size: 0.65rem; display: block; }

/* S7 系统上电体检报告 LED 行 */
.s7-report-led {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  margin: 0.4rem 0;
  background: rgba(0,0,0,.25);
  font-size: 0.82rem;
}
.s7-report-led .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #7F1D1D;
  box-shadow: 0 0 8px #7F1D1Daa;
  flex-shrink: 0;
}
.s7-report-led.ok .dot { background: #4CAF50; box-shadow: 0 0 8px #4CAF50aa; }

/* 三法则金光卡片 */
.s7-law-card {
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  margin: 0.5rem 0;
  background: rgba(212,168,83,.08);
  box-shadow: 0 0 12px var(--gold)22;
}
.s7-law-card h4 { color: var(--gold); margin-bottom: 0.3rem; font-size: 0.9rem; }
.s7-law-card p { font-size: 0.8rem; color: var(--text-2); line-height: 1.6; }

/* S9 悟道时刻：万器归芯旗 */
.s9-banner {
  text-align: center;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  letter-spacing: 0.3em;
  color: var(--realm-color);
  text-shadow: 0 0 20px #D6ECF0aa;
  padding: 1.2rem;
  margin: 1rem 0;
  border-top: 1px solid var(--realm-color);
  border-bottom: 1px solid var(--realm-color);
}

/* ============================================================
   交互组件通用样式（元婴期紫色 var(--accent)）
   ============================================================ */

/* 组件标题区 */
.cmp-head { margin-bottom: 0.6rem; }
/* 控件区 */
.cmp-ctrl {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.6rem; margin-bottom: 0.6rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--glass-line);
  border-radius: 8px;
  background: var(--bg-sunk);
}
.cmp-val {
  font-size: 0.85rem; font-weight: bold;
  color: var(--accent); min-width: 4rem; text-align: right;
}
.cmp-slider {
  flex: 1; min-width: 120px; max-width: 220px;
  accent-color: var(--accent); cursor: pointer;
}

/* 画布容器 */
.cmp-canvas-box {
  margin: 0.6rem 0;
  border: 1px solid var(--accent-soft);
  border-radius: 8px;
  padding: 0.5rem;
  background: var(--bg-sunk);
  overflow: hidden;
}
/* 读数面板 */
.cmp-readout {
  display: flex; flex-wrap: wrap; gap: 0.8rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line-strong, #475569);
  border-radius: 8px;
  background: var(--bg-sunk);
  margin-bottom: 0.5rem; font-size: 0.85rem;
}
.ro-item b { color: var(--accent); font-size: 0.95rem; }

/* 警告/提示框 */
.cmp-warn {
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line-strong, #475569);
  border-radius: 8px;
  background: var(--bg-sunk);
  font-size: 0.82rem; color: var(--text-2, #CBD5E1);
  margin-bottom: 0.5rem; line-height: 1.6;
}
.cmp-warn.ok {
  border-color: var(--color-correct);
  background: rgba(34, 197, 94, 0.08);
  color: #86EFAC;
}
.cmp-warn.warn {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.08);
  color: #FCD34D;
}
.cmp-warn.danger {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
  color: #FCA5A5;
}

/* S0 体检报告 */
.s0-health-report {
  margin: 0.6rem 0;
  padding: 0.8rem;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  background: var(--bg-sunk);
}
.s0-health-report h4 {
  color: var(--danger); font-size: 0.9rem; margin-bottom: 0.5rem;
}
.s0-warnings { display: flex; flex-direction: column; gap: 0.4rem; }
.s0-complexity-note {
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--glass-line);
  border-radius: 8px;
  background: var(--bg-sunk);
  font-size: 0.82rem; color: var(--text-2, #CBD5E1);
  margin: 0.6rem 0;
}
.s0-complexity-note b { color: var(--accent); }
.s0-connect-btn {
  margin: 0.6rem 0;
}
.s0-connect-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* S0 红字引导 */
.s0-red-redirect {
  margin: 0.8rem 0;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.06);
}
.s0-red-text {
  color: var(--danger); font-size: 1rem; font-weight: bold;
  margin-bottom: 0.4rem;
}
.s0-mentor-cue {
  color: var(--text-2, #CBD5E1); font-size: 0.85rem;
  line-height: 1.6;
}

/* S1 CPU流水线 */
.s1-pipeline {
  display: flex; gap: 0.4rem; margin: 0.6rem 0;
  flex-wrap: wrap;
}
.s1-pipe-stage {
  flex: 1; min-width: 80px;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--glass-line);
  border-radius: 6px;
  background: var(--bg-sunk);
  text-align: center;
  font-size: 0.8rem; color: var(--text-2, #CBD5E1);
}

/* S1 CPU对比表 */
.s1-cpu-table {
  margin: 0.6rem 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--accent-soft);
  border-radius: 8px;
  background: var(--bg-sunk);
}
.s1-cpu-table h4 {
  color: var(--accent); font-size: 0.9rem; margin-bottom: 0.4rem;
}
.s1-cpu-table table {
  width: 100%; border-collapse: collapse; font-size: 0.8rem;
}
.s1-cpu-table th, .s1-cpu-table td {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--line-strong, #475569);
  text-align: left;
}
.s1-cpu-table th { color: var(--text-3, #94A3B8); }
.s1-cpu-table td { color: var(--text-2, #CBD5E1); }
.s1-cpu-table .dim { color: var(--text-3, #94A3B8); font-size: 0.78rem; margin-top: 0.3rem; }

/* S8 公式组装器 */
.s8-assembler {
  margin-top: 0.6rem;
}
.s8-question {
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(214, 236, 240, 0.2);
  border-radius: 8px;
  background: var(--bg-sunk);
  margin-bottom: 0.6rem;
}
.s8-question h4 {
  color: var(--realm-color); font-size: 0.95rem; margin-bottom: 0.3rem;
}
.s8-question p {
  font-size: 0.85rem; color: var(--text-2, #CBD5E1); line-height: 1.6;
}
.s8-formula-zone {
  margin: 0.6rem 0;
  padding: 0.8rem;
  border: 1px solid var(--glass-line);
  border-radius: 8px;
  background: var(--bg-sunk);
}
.s8-formula-label {
  font-size: 0.82rem; color: var(--text-3, #94A3B8); margin-bottom: 0.4rem;
}
.s8-parts-bin {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin: 0.5rem 0; justify-content: center;
}
.s8-part-btn {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line-strong, #475569);
  border-radius: 6px;
  background: var(--bg-elev);
  color: var(--text-2, #CBD5E1);
  cursor: pointer; font-size: 0.82rem;
  font-family: var(--font-mono, monospace);
  transition: all 200ms ease-out;
}
.s8-part-btn:hover { border-color: var(--accent); color: var(--accent); }
.s8-assembly {
  padding: 0.6rem;
  border: 1px dashed var(--line-strong, #475569);
  border-radius: 8px;
  background: var(--bg-sunk);
  margin: 0.5rem 0;
  font-family: var(--font-mono, monospace);
  font-size: 0.9rem; text-align: center;
}
.s8-assem-label { color: var(--text-3, #94A3B8); }
.s8-assem-slot { color: var(--accent); }
.s8-clear-btn {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line-strong, #475569);
  border-radius: 6px;
  background: var(--bg-elev);
  color: var(--text-3, #94A3B8);
  cursor: pointer; font-size: 0.78rem;
  margin-top: 0.3rem;
}
.s8-clear-btn:hover { border-color: var(--danger); color: var(--danger); }
.s8-calc-zone {
  margin: 0.6rem 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--accent-soft);
  border-radius: 8px;
  background: var(--bg-sunk);
}
.s8-calc-label {
  font-size: 0.82rem; color: var(--text-3, #94A3B8); margin-bottom: 0.3rem;
}
.s8-calc-result {
  font-size: 0.85rem; color: var(--text-2, #CBD5E1);
  line-height: 1.7; margin: 0.4rem 0;
  font-family: var(--font-mono, monospace);
}
.s8-verify-btn { margin: 0.4rem 0; }
.s8-options-zone {
  margin: 0.6rem 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--accent-soft);
  border-radius: 8px;
  background: var(--bg-sunk);
}
.s8-options-label {
  font-size: 0.82rem; color: var(--text-3, #94A3B8); margin-bottom: 0.4rem;
}
.s8-option-btn {
  display: block; width: 100%;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line-strong, #475569);
  border-radius: 6px;
  background: var(--bg-elev);
  color: var(--text-2, #CBD5E1);
  cursor: pointer; font-size: 0.85rem;
  text-align: left; margin-bottom: 0.3rem;
  transition: all 200ms ease-out;
}
.s8-option-btn:hover { border-color: var(--accent); }
.s8-option-btn.correct {
  border-color: var(--color-correct);
  background: rgba(34, 197, 94, 0.12);
  color: #86EFAC;
}
.s8-option-btn.wrong {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
  color: #FCA5A5;
}

/* S9 排除法收网器 */
.s9-option-panel {
  margin: 0.6rem 0;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.s9-option-btn {
  display: block; width: 100%;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line-strong, #475569);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--text-2, #CBD5E1);
  cursor: pointer; font-size: 0.88rem;
  text-align: left; transition: all 200ms ease-out;
}
.s9-option-btn:hover { border-color: var(--accent); }
.s9-option-btn.correct {
  border-color: var(--gold);
  background: rgba(255, 215, 0, 0.12);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.2);
}
.s9-option-btn.eliminated {
  border-color: #7F1D1D;
  background: rgba(127, 29, 29, 0.15);
  color: #FCA5A5;
  text-decoration: line-through;
  opacity: 0.6;
}
.s9-evidence {
  padding: 0.5rem 0.8rem;
  border: 1px solid rgba(127, 29, 29, 0.3);
  border-radius: 8px;
  background: rgba(127, 29, 29, 0.08);
  font-size: 0.82rem; color: #FCA5A5;
  margin: 0.4rem 0; line-height: 1.6;
}
.s9-evidence b { color: var(--danger); }

/* S9 契约光网 */
.s9-contract-net {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 0.8rem 0;
}
.s9-contract-node {
  padding: 0.5rem;
  border: 1px solid var(--line-strong, #475569);
  border-radius: 8px;
  background: var(--bg-sunk);
  text-align: center;
  opacity: 0.4;
  transition: all 400ms ease-in-out;
}
.s9-contract-node.lit {
  border-color: var(--accent);
  background: var(--accent-soft);
  opacity: 1;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}
.s9-contract-icon {
  display: block; font-size: 1.3rem; color: var(--accent); margin-bottom: 0.2rem;
}
.s9-contract-name {
  display: block; font-size: 0.82rem; color: var(--text-1, #F1F5F9);
  font-weight: bold; margin-bottom: 0.1rem;
}
.s9-contract-desc {
  display: block; font-size: 0.72rem; color: var(--text-3, #94A3B8);
}

/* S9 契约公式 */
.s9-formula {
  margin: 0.8rem 0;
  padding: 0.8rem 1rem;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: rgba(212, 168, 83, 0.06);
  text-align: center;
}
.s9-formula-line {
  font-family: var(--font-mono, monospace);
  font-size: 0.9rem; color: var(--gold);
  margin: 0.3rem 0;
}

/* S9 悟道金句 */
.s9-winlines {
  margin: 1rem 0;
  text-align: center;
}
.s9-winline {
  font-family: var(--font-serif, serif);
  font-size: 1rem; color: var(--realm-color);
  line-height: 2; letter-spacing: 0.05em;
  text-shadow: 0 0 8px rgba(214, 236, 240, 0.3);
}

/* S10 碎片网格 */
.frag-grid {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  justify-content: center; margin: 0.8rem 0;
}
.frag-node {
  min-height: 40px;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line-strong, #475569);
  border-radius: 999px;
  background: transparent;
  color: var(--text-3, #94A3B8);
  cursor: pointer;
  font-family: var(--font-serif, serif);
  font-size: 0.82rem;
  transition: all 300ms ease-out;
}
.frag-node:hover { border-color: var(--accent); color: var(--accent); }
.frag-node.lit {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.25);
}

/* ============================================================
   S3 Cache一致性实验台 · Tab 导览
   ============================================================ */
.cache-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}
.cache-tab {
  min-height: 38px;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--line-strong, #475569);
  border-radius: 8px;
  background: transparent;
  color: var(--text-3, #94A3B8);
  cursor: pointer;
  font-family: var(--font-serif, serif);
  font-size: 0.82rem;
  transition: all 260ms ease-out;
  text-align: left;
}
.cache-tab:hover { border-color: var(--accent); color: var(--realm-color); }
.cache-tab.active {
  border-color: var(--accent);
  color: var(--realm-color);
  background: var(--accent-soft);
  box-shadow: 0 0 10px var(--glass-line);
}
.cache-tab .tab-num {
  font-family: var(--font-mono, monospace);
  color: var(--accent);
  margin-right: 0.25rem;
}
.cache-panel {
  display: none;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line, rgba(148,163,184,0.12));
  border-radius: 10px;
  background: var(--bg-sunk);
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-2, #94A3B8);
}
.cache-panel.active { display: block; animation: cacheFadeIn 360ms ease-out; }
@keyframes cacheFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.cache-panel h4 {
  color: var(--realm-color);
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
}
.cache-panel b { color: var(--accent); }
.cache-panel .trade { color: var(--danger, #F27A63); }
.cache-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0;
  font-size: 0.78rem;
}
.cache-table th, .cache-table td {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line, rgba(148,163,184,0.12));
  text-align: center;
}
.cache-table th { color: var(--realm-color); background: var(--accent-soft); }
.cache-table td { color: var(--text-2, #94A3B8); }
.mesi-lights {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.5rem 0;
}
.mesi-light {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--line-strong, #475569);
  border-radius: 8px;
  min-width: 64px;
}
.mesi-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--line-strong, #475569);
  transition: all 260ms ease-out;
}
.mesi-light.M .mesi-dot { background: var(--accent); box-shadow: 0 0 8px rgba(139,92,246,0.5); }
.mesi-light.E .mesi-dot { background: var(--tech-cyan-light); box-shadow: 0 0 8px rgba(6,182,212,0.5); }
.mesi-light.S .mesi-dot { background: #10B981; box-shadow: 0 0 8px rgba(16,185,129,0.5); }
.mesi-light.I .mesi-dot { background: #475569; }
.mesi-label {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  color: var(--text-3, #94A3B8);
}
.mesi-desc { font-size: 0.68rem; color: var(--text-3, #94A3B8); text-align: center; }
.cache-progress {
  text-align: center;
  margin-top: 0.6rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  color: var(--text-3, #94A3B8);
}
.cache-progress b { color: var(--accent); }
.cache-progress.done { color: var(--realm-color); }

/* 刻痕列表 */
.carve-item {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line-strong, #475569);
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text-2, #CBD5E1);
  margin-bottom: 0.3rem;
  border-left: 2px solid var(--accent);
}

/* 响应式适配 */
@media (max-width: 600px) {
  .cmp-ctrl { flex-direction: column; align-items: stretch; }
  .cmp-slider { max-width: 100%; }
  .cmp-canvas { height: 200px; }
  .s9-contract-net { grid-template-columns: repeat(2, 1fr); }
  .s1-pipe-stage { min-width: 60px; }
}
