/* ==========================================
   模板引擎 — 全局 + 8 种模板样式
   ========================================== */

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

:root {
  --bg:   #060d1a;
  --fg:   #edf2fa;
  --sub:  #7c849e;
  --dim:  #444c66;
  --font: 'PingFang SC', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
  height: 100%; overflow: hidden;
  font-family: var(--font);
  background: #020810;
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  display: flex; align-items: center; justify-content: center;
}

/* ====== 主容器 ====== */
.app {
  width: min(960px, 100vw - 16px);
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 16px);
  position: relative; overflow: hidden;
  background: var(--bg);
  box-shadow: 0 12px 60px rgba(0,0,0,0.5);
}

/* ====== 章节标记 ====== */
.chapter-mark {
  position: absolute; top: 24px; left: 32px; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  opacity: 0.32;
}
.cm-icon { font-size: 14px; }
.cm-idx  { font-size: 10px; font-weight: 600; letter-spacing: 1.5px; color: var(--dim); }

/* ====== 场景舞台 ====== */
.scene-stage {
  position: absolute; inset: 0; z-index: 3;
}

/* ====== 视觉层 ====== */
.visual-layer {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
}
.visual-layer svg { width: 100%; height: 100%; }

/* ====== 人物 ====== */
.char-container {
  position: absolute; left: 3%; bottom: 5%;
  width: 72px; height: 80px;
  z-index: 5; pointer-events: none;
}
.char-container svg { width: 100%; height: 100%; }

/* ====== 呼吸线 ====== */
.breath-line {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  width: 64px; height: 1.5px; border-radius: 1px;
  background: rgba(255,255,255,0.04);
  z-index: 10; overflow: hidden;
}
.br-seg {
  display: block; height: 100%; width: 0%;
  background: rgba(124,111,247,0.35);
  border-radius: 1px;
}

/* ====== 暂停 ====== */
.pause-btn {
  position: absolute; bottom: 6px; right: 24px; z-index: 10;
  width: 22px; height: 22px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.03); cursor: pointer;
  opacity: 0.25; transition: opacity 0.3s;
  display: flex; align-items: center; justify-content: center; gap: 3px;
}
.pause-btn::before, .pause-btn::after {
  content: ''; display: block; width: 2.5px; height: 9px; border-radius: 1px;
  background: var(--dim); transition: all 0.2s;
}
.pause-btn.paused::before {
  width: 0; height: 0;
  border-left: 6px solid var(--dim);
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  background: transparent; border-radius: 0;
}
.pause-btn.paused::after  { display: none; }
.pause-btn:hover { opacity: 0.6; }

/* ===========================================================
   基础：高亮词 + 词级动画
   =========================================================== */
.em {
  color: var(--em-c, #7c6ff7);
  font-weight: 700;
  text-shadow: 0 0 12px var(--em-c, #7c6ff7);
}
.w-in {
  display: inline-block;
  will-change: transform, opacity;
}

/* ===========================================================
   模板 1：hero — 标题
   =========================================================== */
.tpl-hero {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 48px;
  opacity: 0;
}
.tpl-hero-headline {
  font-size: 44px; font-weight: 900; line-height: 1.25;
  letter-spacing: 1.5px;
  color: #f4f6ff;
  margin-bottom: 4px;
}
.tpl-hero-subtitle {
  font-size: 22px; font-weight: 400; line-height: 1.5;
  color: var(--sub);
}
.tpl-hero-rule {
  display: block; width: 56px; height: 2px; border-radius: 1px;
  margin-top: 28px;
  background: var(--rule-c, #7c6ff7);
  opacity: 0.35;
}

/* ===========================================================
   模板 2：stat — 大数字
   =========================================================== */
.tpl-stat {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 48px;
  opacity: 0;
}
.tpl-stat-num {
  font-size: 120px; font-weight: 900; line-height: 1;
  color: var(--st-c, #7c6ff7);
  text-shadow: 0 0 40px var(--st-c, #7c6ff7);
  position: relative;
}
.tpl-stat-unit {
  font-size: 28px; font-weight: 600; opacity: 0.5;
  margin-left: 4px;
}
.tpl-stat-label {
  font-size: 18px; font-weight: 700; letter-spacing: 3px;
  color: var(--st-c, #7c6ff7);
  text-transform: uppercase;
  margin-top: 6px;
}
.tpl-stat-desc {
  font-size: 14px; color: var(--dim);
  margin-top: 10px;
  text-align: center;
}

/* ===========================================================
   模板 3：list — 列表
   =========================================================== */
.tpl-list {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: 32px 64px 32px 72px;
  gap: 18px;
  opacity: 0;
}
.tpl-list-row {
  display: flex; align-items: flex-start; gap: 14px;
  padding-left: 14px;
  border-left: 3px solid transparent;
}
.tpl-list-marker {
  flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%;
  margin-top: 7px;
  background: var(--mk-c, #7c6ff7);
  box-shadow: 0 0 8px var(--mk-c, #7c6ff7);
}
.tpl-list-icon {
  width: auto; height: auto; border-radius: 0;
  background: none; box-shadow: none;
  font-size: 18px; margin-top: 4px;
}
.tpl-list-text {
  flex: 1;
}
.tpl-list-title {
  font-size: 16px; font-weight: 700; line-height: 1.5;
}
.tpl-list-desc {
  font-size: 13px; color: var(--sub); line-height: 1.6;
  margin-top: 2px;
}

/* ===========================================================
   模板 4：compare — 对比
   =========================================================== */
.tpl-compare {
  position: absolute; inset: 0;
  display: flex; flex-direction: row; align-items: center; justify-content: center;
  gap: 48px;
  padding: 40px 48px;
  opacity: 0;
}
.tpl-cmp-side {
  flex: 0 0 38%;
  display: flex; flex-direction: column;
}
.tpl-cmp-left  { align-items: flex-end; text-align: right; }
.tpl-cmp-right { align-items: flex-start; text-align: left; }
.tpl-cmp-title {
  font-size: 28px; font-weight: 900; letter-spacing: 0.8px;
  margin-bottom: 8px;
}
.tpl-cmp-body {
  font-size: 15px; line-height: 1.8; color: var(--sub);
}
/* 中分线 */
.tpl-cmp-divider {
  position: absolute; left: 50%; top: 25%; bottom: 25%;
  width: 1px; transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, rgba(255,255,255,0.08), transparent);
}

/* ===========================================================
   模板 5：quote — 引用
   =========================================================== */
.tpl-quote {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 48px;
  opacity: 0;
}
.tpl-qt-mark {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 80px; line-height: 0.5; opacity: 0;
  color: var(--qt-c, #7c6ff7);
}
.tpl-qt-text {
  font-size: 28px; font-weight: 700; line-height: 1.55;
  text-align: center; max-width: 560px;
  margin: 4px 0;
}
.tpl-qt-note {
  font-size: 13px; color: var(--dim);
  margin-top: 20px;
}

/* ===========================================================
   模板 6：cards — 卡片网格
   =========================================================== */
.tpl-cards {
  position: absolute; inset: 0;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 16px;
  padding: 40px 48px;
  opacity: 0;
}
.tpl-cd-card {
  flex: 0 0 calc(50% - 8px);
  display: flex; flex-direction: column; align-items: center;
  padding: 18px 12px 14px;
}
.tpl-cd-icon {
  font-size: 28px; margin-bottom: 6px;
}
.tpl-cd-title {
  font-size: 15px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--cd-c, #7c6ff7);
  margin-bottom: 3px;
}
.tpl-cd-body {
  font-size: 12px; color: var(--sub); text-align: center;
  line-height: 1.55;
}

/* ===========================================================
   模板 7：flow — 流程
   =========================================================== */
.tpl-flow {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 48px;
  opacity: 0;
}
.tpl-flow-track {
  display: flex; align-items: flex-start; gap: 0;
}
.tpl-flow-node {
  display: flex; align-items: flex-start; position: relative;
  padding-right: 36px;
}
.tpl-flow-node:last-child { padding-right: 0; }

/* 连接线 */
.tpl-flow-line {
  position: absolute; top: 17px; left: 34px;
  width: calc(100% - 34px); height: 2px;
  background: var(--fl-c, #7c6ff7);
  opacity: 0.25;
  transform-origin: left center;
}

/* 圆点 */
.tpl-flow-dot {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
  background: transparent;
  border: 2px solid var(--fl-c, #7c6ff7);
  color: var(--fl-c, #7c6ff7);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

/* 文字 */
.tpl-flow-info {
  margin-left: 10px; margin-top: 4px;
  min-width: 60px; text-align: center;
}
.tpl-flow-title {
  font-size: 15px; font-weight: 700;
}
.tpl-flow-desc {
  font-size: 11px; color: var(--sub); margin-top: 2px;
}

/* ===========================================================
   模板 8：visual — SVG 可视化
   =========================================================== */
.tpl-visual {
  position: absolute; inset: 0;
  display: flex; flex-direction: row; align-items: center;
  gap: 0;
  opacity: 0;
}
.tpl-vis-svg {
  flex: 0 0 52%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.tpl-vis-svg svg {
  width: 90%; height: 90%;
}
.tpl-vis-labels {
  flex: 1;
  display: flex; flex-direction: column; justify-content: center; gap: 16px;
  padding-right: 32px;
}
.tpl-vis-item {
  padding-left: 12px;
  border-left: 3px solid transparent;
}
.tpl-vis-label {
  font-size: 26px; font-weight: 900; letter-spacing: 0.5px;
}
.tpl-vis-info {
  font-size: 12px; color: var(--sub);
  margin-top: 2px;
}

/* ====== 响应式 ====== */
@media (max-width: 768px) {
  .tpl-hero-headline { font-size: 28px; }
  .tpl-hero-subtitle { font-size: 16px; }
  .tpl-stat-num { font-size: 72px; }
  .tpl-stat-label { font-size: 14px; }
  .tpl-list { padding: 24px 32px; }
  .tpl-compare { flex-direction: column; gap: 20px; padding: 24px; }
  .tpl-cmp-side { flex: auto; align-items: center !important; text-align: center !important; }
  .tpl-cmp-divider { display: none; }
  .tpl-qt-text { font-size: 22px; }
  .tpl-cards { gap: 10px; padding: 16px; }
  .tpl-cd-card { flex: 0 0 calc(50% - 5px); }
  .tpl-flow-track { flex-wrap: wrap; justify-content: center; gap: 16px; }
  .tpl-flow-node { padding-right: 0; }
  .tpl-flow-line { display: none; }
  .tpl-visual { flex-direction: column; }
  .tpl-vis-svg { flex: 0 0 40%; }
  .chapter-mark { top: 12px; left: 16px; }
}
