/* ============================================================
   Power AI 短片 — 播放器样式
   全屏黑场 / 字幕排版 / 入场仪式页 / 数据大字 / 落版
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  background: #0b2b45;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  color: #eaf6f8;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

#stage-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  transition: opacity 1.2s ease;
}

/* ---------- 场间遮罩 / 白场闪光 ---------- */
#veil, #flash {
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 20;
}
#veil { background: #000; }

/* ---------- 字幕 ---------- */
#subtitle {
  position: fixed;
  left: 50%; bottom: 7vh;
  transform: translateX(-50%) translateY(8px);
  max-width: 94vw;
  text-align: center;
  white-space: nowrap;             /* 电影字幕纪律：单行呈现 */
  font-size: clamp(15px, 1.75vw, 26px);
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: 0.04em;
  color: #f4f8fa;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: opacity 0.45s ease, transform 0.45s ease;
  z-index: 30;
  pointer-events: none;
}
@media (max-width: 760px) {
  /* 小屏允许折行；width:max-content 抵消 left:50% 收缩可用宽，让 max-width:88vw 真正生效（两行内排下长句） */
  #subtitle { white-space: normal; max-width: 88vw; width: max-content; }
}
#subtitle.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 画幅遮幅（2.35:1 上下黑边） ---------- */
#lb-top, #lb-bot {
  position: fixed; left: 0; right: 0;
  height: 12.17vh;
  background: #000;
  z-index: 24;
  pointer-events: none;
}
#lb-top { top: 0; transform-origin: top; box-shadow: 0 1px 0 rgba(40, 55, 70, 0.5); }
#lb-bot { bottom: 0; transform-origin: bottom; box-shadow: 0 -1px 0 rgba(40, 55, 70, 0.5); }
@media (max-width: 760px) {
  /* 竖屏遮幅收窄：12.17vh → 8vh，给纵向构图留出主体空间（须置于基础规则之后方能覆盖） */
  #lb-top, #lb-bot { height: 8vh; }
}

/* ---------- 质感叠加：径向暗角 ---------- */
#vignette {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 25;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 52%, rgba(0, 0, 0, 0.35) 100%);
  transition: opacity 0.8s ease;
}
#vignette.white { opacity: 0.34; }   /* 白场段等效强度降至 ~0.12 */

/* ---------- 质感叠加：胶片颗粒（背景图由 JS 注入） ---------- */
#grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 25;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-repeat: repeat;
  animation: grain-jump 0.66s steps(1, end) infinite;
}
@keyframes grain-jump {
  0%    { background-position: 0 0; }
  12.5% { background-position: -38px 22px; }
  25%   { background-position: 24px -40px; }
  37.5% { background-position: -30px -18px; }
  50%   { background-position: 42px 36px; }
  62.5% { background-position: -16px 44px; }
  75%   { background-position: 36px -28px; }
  87.5% { background-position: -44px -36px; }
  100%  { background-position: 0 0; }
}

/* ---------- 冷开场终端层（0:00–0:05） ---------- */
#coldopen {
  position: fixed; inset: 0;
  background: #000;
  z-index: 26;
  display: none;
  pointer-events: none;
  font-family: 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
  color: #9FE8EE;
}
#coldopen::after {   /* 8% CRT 扫描线纹理 */
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.08) 0 1px, transparent 1px 3px);
}
#coldopen .co-view {
  position: absolute; left: 50%; top: 50%;
  width: min(88vw, 1150px);
  height: 22.4em;          /* 14 行 × 1.6em 行高 */
  overflow: hidden;
  font-size: clamp(11px, 1.2vw, 17px);
  line-height: 1.6;
}
#co-lines { position: absolute; left: 0; right: 0; top: 0; }
.co-line { white-space: pre; }
.co-view.dim .co-line { opacity: 0.12; }
.co-view.dim .co-line.hl { opacity: 1; }
.co-line.hl {
  transform-origin: left center;
  color: #dff9fc;
  text-shadow: 0 0 14px rgba(0, 194, 209, 0.8);
}
.co-line.hl span { display: inline-block; white-space: pre; }
.co-cur { color: #9FE8EE; }

/* ---------- 数据大字 overlay ---------- */
#data-layer {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 28;
}
.domtext { position: absolute; left: 50%; transform: translateX(-50%); text-align: center; white-space: nowrap; }

.domtext.chip {
  bottom: 18vh;
  font-size: clamp(15px, 1.7vw, 24px);
  letter-spacing: 0.22em;
  font-variant-numeric: tabular-nums;
  color: #bdf4f9;
  text-shadow: 0 0 18px rgba(0, 194, 209, 0.6);
  border: 1px solid rgba(0, 194, 209, 0.35);
  border-radius: 999px;
  padding: 0.7em 1.8em;
  background: rgba(5, 20, 32, 0.45);
  backdrop-filter: blur(4px);
  animation: chip-in 0.7s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.domtext.chip b { color: #fff; font-weight: 700; }
/* 虚线边框 = 仿真成果（与实线实测严格定级区分） */
.domtext.chip.dashed {
  border-style: dashed;
  border-color: rgba(0, 194, 209, 0.5);
}
.domtext.chip small {
  display: block; margin-top: 0.5em;
  font-size: 0.62em; letter-spacing: 0.2em;
  color: #7fd4de; text-shadow: none; white-space: nowrap;
}
.domtext.chip.note {
  bottom: 15vh;
  font-size: clamp(12px, 1.25vw, 17px);
  letter-spacing: 0.18em;
  color: #8fdde7;
  border-color: rgba(0, 194, 209, 0.22);
  background: rgba(5, 20, 32, 0.32);
  animation: note-in 0.8s ease;
}
@keyframes note-in { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes chip-in {
  from { opacity: 0; transform: translateX(-50%) scale(1.6); letter-spacing: 0.5em; }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}

.domtext.line {
  top: 50%; transform: translate(-50%, -50%);
  font-size: clamp(24px, 3.4vw, 46px);
  font-weight: 600;
  letter-spacing: 0.22em;
  color: #eafcff;
  text-shadow: 0 0 30px rgba(0, 194, 209, 0.7);
  animation: line-in 1.2s ease;
}
/* 长句宣言：允许换行、收紧字号与字距，防止超宽溢出 */
.domtext.line.long {
  white-space: normal;
  max-width: 86vw;
  font-size: clamp(18px, 2.4vw, 34px);
  letter-spacing: 0.16em;
  line-height: 1.7;
}
@keyframes line-in { from { opacity: 0; letter-spacing: 0.6em; } to { opacity: 1; } }

.domtext.tri {
  top: 13vh;
  display: flex; gap: 4vw;
  transform: translateX(-50%);
}
.domtext.tri span {
  font-size: clamp(18px, 2.4vw, 34px);
  letter-spacing: 0.35em;
  color: #0b2b45;
  font-weight: 600;
  opacity: 0;
  transform: scale(1.3);
  transition: opacity 0.18s cubic-bezier(0.2, 1.4, 0.4, 1), transform 0.18s cubic-bezier(0.2, 1.4, 0.4, 1);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
}
.domtext.tri span.stamped { opacity: 1; transform: scale(1); }

.domtext.big {
  top: 50%; transform: translate(-50%, -50%);
  font-size: clamp(30px, 4.6vw, 64px);
  font-weight: 700;
  letter-spacing: 0.2em;
  color: #ffffff;
  text-shadow: 0 0 40px rgba(0, 194, 209, 0.9), 0 0 90px rgba(0, 194, 209, 0.5);
  animation: line-in 1.4s ease;
}

/* 白场段（t≥136 由 film.js 给 #vignette 加 .white）：宣言大字反色为深空蓝墨，白底可读 */
#vignette.white ~ #data-layer .domtext.big {
  color: #0B2B45;
  text-shadow: 0 0 34px rgba(0, 194, 209, 0.55), 0 0 90px rgba(0, 194, 209, 0.28);
}

/* ---------- 入场仪式页：透明底，底下是实时渲染的粒子核心心跳 ---------- */
#intro {
  position: fixed; inset: 0;
  z-index: 50;
  cursor: pointer;
  transition: opacity 1.4s ease;
}
#intro.off { opacity: 0; pointer-events: none; }

#intro .prelude-brand {
  position: absolute;
  top: 6vh; left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  white-space: nowrap;
  color: rgba(150, 200, 210, 0.45);
}

#intro .prelude-cta {
  position: absolute;
  left: 50%; top: 63%;
  transform: translateX(-50%);
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 500;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: #c9f2f7;
  text-shadow: 0 0 22px rgba(0, 194, 209, 0.45);
  animation: prelude-breath 2s ease-in-out infinite;
}
/* 与核心 2s 脉动同频的呼吸 */
@keyframes prelude-breath {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

#intro .prelude-sub {
  position: absolute;
  bottom: 7vh; left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  white-space: nowrap;
  color: rgba(150, 200, 210, 0.4);
}
@media (max-width: 760px) {
  #intro .prelude-sub { font-size: 11px; letter-spacing: 0.12em; }
}

@keyframes core-breathe {
  0%, 100% { transform: scale(1); filter: brightness(0.9); }
  50% { transform: scale(1.08); filter: brightness(1.25); }
}

/* ---------- 右下角控制提示 ---------- */
#hint {
  position: fixed;
  right: 2vw; bottom: 3vh;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: rgba(200, 235, 240, 0.55);
  background: rgba(5, 15, 25, 0.35);
  border: 1px solid rgba(0, 194, 209, 0.15);
  border-radius: 8px;
  padding: 8px 14px;
  z-index: 40;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
}
#hint.on { opacity: 1; }
#hint b { color: rgba(220, 250, 253, 0.85); font-weight: 600; }

/* ---------- 进度条 / 时间码（正片 0–214s，可拖动 seek） ---------- */
#progress {
  position: fixed;
  left: 50%;
  bottom: 3.2vh;
  transform: translateX(-50%);
  width: min(560px, 72vw);
  height: 18px;               /* 命中区放大，视觉轨道由伪元素呈现 */
  z-index: 42;
  cursor: pointer;
  touch-action: none;         /* 拖动 seek 时不触发页面手势 */
  opacity: 0;
  transition: opacity 0.6s ease;
  display: none;
}
#progress.on { opacity: 1; display: block; }
#progress::before {           /* 轨道 */
  content: '';
  position: absolute; left: 0; right: 0; top: 50%;
  height: 3px; margin-top: -1.5px;
  border-radius: 2px;
  background: rgba(150, 200, 210, 0.22);
}
#progress-fill {
  position: absolute; left: 0; top: 50%;
  height: 3px; margin-top: -1.5px;
  width: 0;
  border-radius: 2px;
  background: #00C2D1;
  box-shadow: 0 0 8px rgba(0, 194, 209, 0.7);
  pointer-events: none;
}
#progress-fill::after {       /* 拖动柄 */
  content: '';
  position: absolute; right: -5px; top: 50%;
  width: 9px; height: 9px; margin-top: -4.5px;
  border-radius: 50%;
  background: #d8fbff;
  box-shadow: 0 0 6px rgba(0, 194, 209, 0.9);
}
/* 场界刻度：演示讲解时一眼可见"第几场"位置（点击任意处即跳） */
#progress .prog-tick {
  position: absolute;
  top: 50%;
  width: 2px; height: 9px; margin-top: -4.5px;
  background: rgba(150, 200, 210, 0.55);
  border-radius: 1px;
  pointer-events: none;
}
#timecode {
  position: fixed;
  left: 50%; bottom: 0.8vh;
  transform: translateX(-50%);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(200, 235, 240, 0.6);
  z-index: 42;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
  display: none;
}
#timecode.on { opacity: 1; display: block; }

/* ---------- 触屏控制组（仅触屏设备开演后出现） ---------- */
#touch-ui {
  position: fixed;
  right: 3vw; bottom: 3vh;
  display: none;
  gap: 10px;
  z-index: 44;
  opacity: 0;
  transition: opacity 0.5s ease;
}
#touch-ui.on { display: flex; opacity: 1; }
#touch-ui button {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(0, 194, 209, 0.35);
  background: rgba(5, 15, 25, 0.5);
  color: #d8fbff;
  font-size: 17px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.25s, border-color 0.25s, opacity 0.25s;
}
#touch-ui button:active { background: rgba(0, 194, 209, 0.3); }
#touch-ui #t-sub { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; font-family: ui-monospace, Menlo, monospace; }
#touch-ui #t-sub.off { opacity: 0.4; }

/* ---------- 落版（第 7 场，无限停留） ---------- */
#endcard {
  position: fixed; inset: 0;
  background: rgba(247, 250, 252, 0.93);   /* 半透明白场：透出 canvas 粒子 logo 活体底 */
  z-index: 35;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.6s ease;
}
#endcard.on { opacity: 1; pointer-events: auto; }   /* 落版可交互：链接与再看一遍 */

#endcard .logo-wrap {
  position: relative;
  width: min(24vmin, 200px); height: min(24vmin, 200px);
}
/* DOM 印刷 logo 略降透明度，与粒子残影底形成双层感，避免同构图形重影 */
#endcard .logo { width: 100%; height: 100%; opacity: 0.85; animation: core-breathe 5s ease-in-out infinite; }
#endcard .ec-ring { transform-origin: 100px 100px; animation: ec-spin 12s linear infinite; }
#endcard .ec-ring2 { transform-origin: 100px 100px; animation: ec-spin 18s linear infinite reverse; }
@keyframes ec-spin { to { transform: rotate(360deg); } }
#endcard .ec-pulse { transform-origin: 100px 100px; animation: ec-pulse 2s ease-in-out infinite; }
@keyframes ec-pulse { 0%, 100% { transform: scale(1); opacity: 0.9; } 50% { transform: scale(1.12); opacity: 1; } }

/* 声纳涟漪：每 4s 一圈扩散（scale 0.5→2.2 + 淡出，前 1.6s ease-out），循环无限 —— 它还在听 */
#endcard .ripple {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 194, 209, 0.55);
  opacity: 0;
  transform: scale(0.5);
  pointer-events: none;
}
#endcard.on .ripple { animation: sonar-ripple 4s ease-out infinite; }
@keyframes sonar-ripple {
  0%   { transform: scale(0.5); opacity: 0.55; }
  40%  { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* 最后一嘀（102s）的仪式：两圈错相的更亮涟漪爆发 + logo 核心增亮脉冲 */
#endcard .ping-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(0, 194, 209, 0.9);
  opacity: 0;
  transform: scale(0.45);
  pointer-events: none;
}
#endcard.ping .ping-ring.a { animation: ping-burst 1.3s ease-out 1; }
#endcard.ping .ping-ring.b { animation: ping-burst 1.3s ease-out 0.18s 1; }
@keyframes ping-burst {
  0%   { transform: scale(0.45); opacity: 0.95; }
  100% { transform: scale(2.6); opacity: 0; }
}
#endcard.ping .logo { animation: core-breathe 5s ease-in-out infinite, logo-flash 0.9s ease-out 1; }
@keyframes logo-flash {
  0%   { filter: brightness(1); }
  25%  { filter: brightness(1.55) drop-shadow(0 0 18px rgba(0, 194, 209, 0.55)); }
  100% { filter: brightness(1); }
}

#endcard .lines { text-align: center; display: flex; flex-direction: column; gap: 2.2vh; }
/* 逐行揭示：四行依次淡入上浮，0.5s 间隔 stagger */
#endcard .l1, #endcard .l2, #endcard .l3, #endcard .l4 { opacity: 0; transform: translateY(14px); }
#endcard.on .l1 { animation: ec-line-in 0.9s ease 0.35s forwards; }
#endcard.on .l2 { animation: ec-line-in 0.9s ease 0.85s forwards; }
#endcard.on .l3 { animation: ec-line-in 0.9s ease 1.35s forwards; }
#endcard.on .l4 { animation: ec-line-in 0.9s ease 1.85s forwards; }
@keyframes ec-line-in { to { opacity: 1; transform: translateY(0); } }
#endcard .l1 {
  font-size: clamp(20px, 2.6vw, 36px);
  letter-spacing: 0.3em;
  color: #0b2b45;
  font-weight: 700;
}
#endcard .l2 {
  font-size: clamp(12px, 1.2vw, 16px);
  letter-spacing: 0.24em;
  color: #4a6b80;
}
#endcard .l3 {
  font-size: clamp(13px, 1.3vw, 18px);
  letter-spacing: 0.3em;
  color: #00a5b3;
  font-weight: 600;
}
#endcard .l4 {
  font-size: clamp(13px, 1.3vw, 18px);
  letter-spacing: 0.3em;
  color: #0b2b45;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.25s;
}
#endcard a.l4:hover { color: #00a5b3; }

/* 落版出口按钮：逐行揭示（2.35s 计数器）后再延 0.4s 淡入 */
#endcard .ec-actions {
  display: flex;
  gap: 14px;
  opacity: 0;
  transform: translateY(14px);
}
#endcard.on .ec-actions { animation: ec-line-in 0.9s ease 2.75s forwards; }
#endcard .ec-actions button,
#endcard .ec-actions a {
  font-family: inherit;
  font-size: clamp(13px, 1.3vw, 16px);
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  padding: 12px 30px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.25s, color 0.25s, box-shadow 0.25s;
}
#endcard .ec-actions button {
  border: 1px solid rgba(11, 43, 69, 0.3);
  background: transparent;
  color: #0b2b45;
}
#endcard .ec-actions button:hover { background: rgba(11, 43, 69, 0.06); }
#endcard .ec-actions a {
  border: none;
  background: #0b2b45;
  color: #fff;
}
#endcard .ec-actions a:hover { box-shadow: 0 6px 22px rgba(0, 194, 209, 0.4); }

/* 核证节能量计数器：接在 .l4 逐行揭示（1.85s）后再延 0.5s 淡入（2.35s） */
#endcard .ec-meter {
  opacity: 0;
  transform: translateY(14px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.1em 0.6em;
  max-width: 92vw;
  text-align: center;
}
#endcard.on .ec-meter { animation: ec-line-in 0.9s ease 2.35s forwards; }
#endcard .ec-meter-label {
  font-size: clamp(11px, 1vw, 14px);
  letter-spacing: 0.28em;
  color: #4a6b80;
}
/* 主数字：等宽表格数字防跳动，深空蓝主色 */
#endcard #ec-kwh {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-size: clamp(20px, 2.4vw, 32px);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #0B2B45;
}
#endcard .ec-meter-unit {
  font-size: clamp(11px, 1vw, 14px);
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #4a6b80;
}
#endcard .ec-meter-sub {
  flex-basis: 100%;
  margin-top: 0.5em;
  font-size: clamp(10px, 0.85vw, 12px);
  letter-spacing: 0.18em;
  color: #7d99ab;
}
/* 102s ping 同帧：计数器随涟漪爆发做一次 1.3 倍亮度脉冲
   （作用于内部 span，避免与容器入场动画 ec-line-in 冲突重启） */
#endcard.ping .ec-meter > span { animation: ec-meter-flash 0.9s ease-out 1; }
@keyframes ec-meter-flash {
  0%   { filter: brightness(1); }
  25%  { filter: brightness(1.3); }
  100% { filter: brightness(1); }
}

/* ---------- 静态海报模式（prefers-reduced-motion） ---------- */
#poster {
  position: fixed; inset: 0;
  display: none;
  background:
    radial-gradient(ellipse 60% 45% at 50% 42%, rgba(0, 194, 209, 0.22), transparent 70%),
    radial-gradient(ellipse 90% 70% at 50% 110%, #0e3d60, #0b2b45 70%);
  z-index: 45;
  transition: opacity 0.8s ease;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4vh;
  text-align: center;
}
#poster .poster-title {
  font-size: clamp(34px, 5vw, 64px);
  font-weight: 700;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  color: #d8fbff;
  text-shadow: 0 0 40px rgba(0, 194, 209, 0.6);
}
#poster .poster-sub {
  font-size: clamp(15px, 1.8vw, 24px);
  letter-spacing: 0.2em;
  color: rgba(190, 235, 242, 0.8);
  max-width: 80vw;
}
