/* ============================================================
   七夕银河红包雨 · 女朋友端样式
   ============================================================ */

:root {
  --bg-deep: #050516;
  --bg-nebu: #1a0b2e;
  --gold: #ffd98a;
  --gold-soft: #f5c86a;
  --pink: #ff9ecb;
  --text: #f3eaff;
  --text-dim: rgba(243, 234, 255, 0.62);
  --red: #c8163a;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--sans);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

body {
  height: 100vh;
  height: 100dvh;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- 银河画布 ---------- */
#galaxy-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ---------- 中央游戏区域 ---------- */
#app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 600px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
}

/* ---------- 顶部进度 HUD ---------- */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  pointer-events: none;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 18px 10px;
  background: linear-gradient(to bottom, rgba(5, 5, 22, 0.75), transparent);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
#hud.show { opacity: 1; transform: translateY(0); }
#hud.hidden { display: none; }

.hud-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.hud-title {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.35em;
  color: var(--text-dim);
}
.hud-amount {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255, 217, 138, 0.45);
}
.hud-amount i {
  font-style: normal;
  font-size: 13px;
  color: var(--text-dim);
  text-shadow: none;
}
.hud-amount {
  /* 运行时隐藏金额进度（最终总计在终章显示） */
  display: none !important;
}
.hud-amount.bump { animation: amountBump 0.5s ease; }
@keyframes amountBump {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.hud-stars {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  letter-spacing: 0.1em;
}
.hud-stars span { color: rgba(255, 255, 255, 0.22); transition: color 0.5s, text-shadow 0.5s; }
.hud-stars span.done {
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 217, 138, 0.95), 0 0 22px rgba(255, 180, 90, 0.5);
}
.hud-stars span.current { color: var(--pink); text-shadow: 0 0 10px rgba(255, 158, 203, 0.8); }

/* ---------- 剧情屏幕 ---------- */
#stage {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 26px calc(env(safe-area-inset-bottom, 0px) + 24px);
  opacity: 1;
  transition: opacity 0.55s ease;
}
#stage.fade-out { opacity: 0; }
#stage.hidden { display: none; }

.screen {
  width: 100%;
  max-width: 460px;
  text-align: center;
  opacity: 1;
  animation: screenIn 0.8s ease;
}
@keyframes screenIn {
  0% { transform: translateY(14px); }
  100% { transform: translateY(0); }
}

.line {
  font-family: var(--serif);
  font-size: clamp(22px, 6.2vw, 32px);
  letter-spacing: 0.14em;
  line-height: 2;
  color: var(--text);
  text-shadow: 0 0 18px rgba(180, 140, 255, 0.35);
  opacity: 1;
  animation: lineIn 1.1s ease;
  text-wrap: balance;          /* 长句均匀断成两行，不出现孤字 */
  overflow-wrap: anywhere;
}
.line.small { font-size: clamp(17px, 4.4vw, 22px); color: var(--text-dim); letter-spacing: 0.2em; }
.line.big { font-size: clamp(30px, 9vw, 46px); color: var(--gold); text-shadow: 0 0 24px rgba(255, 217, 138, 0.55); }
.line.heart { color: var(--pink); }
@keyframes lineIn {
  0% { transform: translateY(10px); filter: blur(4px); }
  100% { transform: translateY(0); filter: blur(0); }
}
.line + .line { margin-top: 14px; }
.line.delay-1 { animation-delay: 0.9s; }
.line.delay-2 { animation-delay: 1.9s; }
.line.delay-3 { animation-delay: 3.1s; }

/* ---------- 歌词式逐句堆积（v2：全可见、无滚动、无跳动） ---------- */
.lyrics {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);           /* 固定居中：不做任何动态位移 → 无跳动 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2.4vw, 18px);
  padding: 10px 18px;
  max-height: 86vh;
  overflow: hidden;
  pointer-events: none;
}
.lyrics.fade-out { opacity: 0; transition: opacity 0.5s ease; }
.ly-line {
  font-family: var(--serif);
  font-size: 20px;                        /* 实际字号由 JS 按字数计算，保证单行 */
  letter-spacing: 0.1em;
  line-height: 1.55;
  text-align: center;
  white-space: nowrap;                    /* 一句一行，永不折行 */
  transition: opacity 0.8s ease, filter 0.8s ease;
}
.ly-line.cur {
  color: var(--text);
  text-shadow: 0 0 18px rgba(180, 140, 255, 0.4);
}
.ly-line.old {
  opacity: 0.35;
  color: var(--text-dim);
  text-shadow: none;
}
.ly-line.last-big {
  color: var(--pink) !important;
  text-shadow: 0 0 26px rgba(255, 158, 203, 0.6);
}
.ly-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(12px) scale(0.86);
  filter: blur(4px);
  animation: charIn 0.5s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
.ly-char.sp { width: 0.5em; }
@keyframes charIn {
  0% { opacity: 0; transform: translateY(12px) scale(0.86); filter: blur(4px); }
  70% { filter: blur(0); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* 开场文字排成一排 */
.intro-lines {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.9em;
}
.intro-lines .line { margin-top: 0; }

.sub { text-wrap: balance;
  margin-top: 18px;
  font-size: 15px;
  letter-spacing: 0.22em;
  color: var(--text-dim);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  margin-top: 34px;
  padding: 15px 44px;
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  color: #2b1600;
  background: linear-gradient(150deg, #ffe3a1, #f5c86a 55%, #e8a94a);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(255, 200, 110, 0.55), 0 6px 18px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  opacity: 1;
  animation: btnIn 0.5s ease;
}
@keyframes btnIn { from { transform: translateY(10px); } to { transform: translateY(0); } }
.btn:hover { transform: scale(1.05); box-shadow: 0 0 34px rgba(255, 200, 110, 0.75); }
.btn:active { transform: scale(0.96); }
.btn.now { animation: btnIn 0.4s ease; }
.btn:disabled { opacity: 0.45 !important; pointer-events: none; }

.btn-ghost {
  display: inline-block;
  margin-top: 26px;
  padding: 12px 36px;
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.24em;
  color: var(--gold);
  background: transparent;
  border: 1px solid rgba(255, 217, 138, 0.55);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
}
.btn-ghost:hover { background: rgba(255, 217, 138, 0.12); box-shadow: 0 0 18px rgba(255, 217, 138, 0.3); }
.btn-ghost:active { transform: scale(0.96); }

/* 开屏底部的小链接（音乐） */
.music-opts {
  margin-top: 40px;
  display: flex;
  justify-content: center;
  gap: 22px;
  opacity: 1;
  animation: btnIn 0.5s ease 0.2s;
}
.link-btn {
  font-size: 13px;
  letter-spacing: 0.12em;
  color: rgba(243, 234, 255, 0.5);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
  transition: color 0.25s;
}
.link-btn:hover { color: var(--gold); }

/* ---------- 等待页（红包穿越银河） ---------- */
.pulse-star {
  margin: 0 auto 26px;
  width: 18px;
  height: 18px;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 217, 138, 0.9);
  animation: pulseStar 1.8s ease-in-out infinite;
}
@keyframes pulseStar {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.7); opacity: 1; }
}

/* ---------- 红包雨 ---------- */
#rain {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  touch-action: none;
}
#rain.hidden { display: none; }

.packet {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  transition: opacity 0.26s ease, filter 0.26s ease;
}
.packet.is-clearing {
  opacity: 0 !important;
  filter: blur(4px) brightness(2);
  transform: scale(0.3) !important;
  transition: opacity 0.26s ease, filter 0.26s ease, transform 0.26s ease;
}
  -webkit-user-select: none;
}
.packet .p-body {
  width: var(--s);
  height: calc(var(--s) * 1.32);
  border-radius: calc(var(--s) * 0.16);
  background: linear-gradient(160deg, #d2153a 0%, #a10f28 55%, #7a0b1e 100%);
  border: 2px solid rgba(246, 201, 110, 0.75);
  box-shadow: 0 0 16px rgba(255, 90, 100, 0.4), inset 0 -8px 16px rgba(0, 0, 0, 0.35), inset 0 6px 10px rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.16s ease;
}
.packet .p-glyph {
  font-family: var(--serif);
  font-size: calc(var(--s) * 0.36);
  color: #ffd98a;
  text-shadow: 0 0 10px rgba(255, 217, 138, 0.7);
  pointer-events: none;
}
.packet .p-glyph.txt { font-size: calc(var(--s) * 0.26); letter-spacing: 0.08em; }

/* 目标红包：金边更亮 + 呼吸光晕 */
.packet.is-target .p-body {
  border-color: #ffe3a1;
  box-shadow: 0 0 24px rgba(255, 215, 130, 0.8), 0 0 56px rgba(255, 160, 80, 0.35), inset 0 -8px 16px rgba(0, 0, 0, 0.3);
  animation: targetPulse 1.5s ease-in-out infinite;
}
@keyframes targetPulse {
  0%, 100% { box-shadow: 0 0 22px rgba(255, 215, 130, 0.75), 0 0 48px rgba(255, 160, 80, 0.3); }
  50% { box-shadow: 0 0 34px rgba(255, 225, 160, 1), 0 0 74px rgba(255, 170, 90, 0.55); }
}

@media (hover: hover) {
  .packet:hover .p-body { transform: scale(1.14); }
}
.packet:active .p-body { transform: scale(1.2); }

/* ---------- 特效层 ---------- */
#fx-layer {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

/* +¥7 金额 */
.fx-amount {
  position: absolute;
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 700;
  white-space: nowrap;               /* +¥ 和数字永不折行错位 */
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255, 217, 138, 0.9), 0 2px 6px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%) scale(0.2);
  opacity: 0;
  transition: transform 0.9s cubic-bezier(0.22, 1.2, 0.36, 1), opacity 0.9s ease, left 0.9s cubic-bezier(0.5, 0, 0.3, 1), top 0.9s cubic-bezier(0.5, 0, 0.3, 1);
}
.fx-amount.pop { transform: translate(-50%, -50%) scale(1.25); opacity: 1; transition: transform 0.35s cubic-bezier(0.22, 1.4, 0.36, 1), opacity 0.3s; }
.fx-amount.fly { transform: translate(-50%, -50%) scale(0.42); opacity: 0.2; }

/* 抢到后的短语卡 */
.fx-phrase {
  position: absolute;
  inset: 0;  display: flex;
  align-items: center;
  justify-content: center;
}
.fx-phrase span {
  font-family: var(--serif);
  font-size: clamp(36px, 11vw, 58px);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: #ffe9c9;
  text-shadow: 0 0 26px rgba(255, 200, 130, 0.65), 0 0 60px rgba(255, 158, 203, 0.35);
  animation: phraseIn 1.7s ease both;
}
@keyframes phraseIn {
  0% { opacity: 0; transform: scale(0.7); filter: blur(8px); }
  30% { opacity: 1; transform: scale(1.06); filter: blur(0); }
  45% { transform: scale(1); }
  82% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.04); }
}

/* 每轮开场提示 */
.round-toast {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  font-family: var(--serif);
  font-size: clamp(20px, 5.5vw, 26px);
  letter-spacing: 0.3em;
  color: var(--text);
  text-shadow: 0 0 16px rgba(180, 140, 255, 0.5);
  white-space: nowrap;
  animation: toastIn 2s ease both;
}
@keyframes toastIn {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
  25% { opacity: 1; transform: translateX(-50%) translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

/* 假红包「是空的」浮字 */
.fx-empty {
  position: absolute;
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.12em;
  color: var(--pink);
  white-space: nowrap;
  transform: translate(-50%, -100%);
  text-shadow: 0 0 12px rgba(255, 158, 203, 0.8), 0 1px 4px rgba(0,0,0,0.5);
  pointer-events: none;
  animation: emptyFloat 1.2s ease both;
}
@keyframes emptyFloat {
  0% { opacity: 0; transform: translate(-50%, -80%) scale(0.7); }
  20% { opacity: 1; transform: translate(-50%, -100%) scale(1.05); }
  35% { transform: translate(-50%, -105%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -140%); }
}

/* ---------- 音乐开关 ---------- */
#music-toggle {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: calc(env(safe-area-inset-right, 0px) + 12px);
  z-index: 50;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 217, 138, 0.35);
  background: rgba(10, 6, 32, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
#music-toggle:hover { transform: scale(1.1); box-shadow: 0 0 14px rgba(255, 217, 138, 0.35); }
#music-toggle.playing { box-shadow: 0 0 16px rgba(255, 217, 138, 0.45); border-color: rgba(255, 217, 138, 0.7); }

/* 换音乐（♪） */
#music-pick {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: calc(env(safe-area-inset-right, 0px) + 62px);
  z-index: 50;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 158, 203, 0.35);
  background: rgba(10, 6, 32, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 18px;
  color: var(--pink);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
#music-pick:hover { transform: scale(1.1); box-shadow: 0 0 14px rgba(255, 158, 203, 0.4); }

/* ---------- 暗角 + 闪光 ---------- */
#vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.45) 100%);
}
.fx-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 235, 200, 0.55), transparent 60%);
  animation: flashFade 0.7s ease-out both;
  pointer-events: none;
}
@keyframes flashFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* 烟花画布：覆盖 fx-layer 全屏 */
.fx-fireworks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 30;
}

/* ---------- 断线提示 ---------- */
#conn-banner {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  transform: translateX(-50%);
  z-index: 60;
  padding: 9px 22px;
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--text);
  background: rgba(30, 14, 50, 0.85);
  border: 1px solid rgba(255, 158, 203, 0.4);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  animation: connPulse 2s ease-in-out infinite;
}
#conn-banner.hidden { display: none; }
@keyframes connPulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

/* ---------- 照片 ---------- */
.photo-view {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 30px) 30px calc(env(safe-area-inset-bottom, 0px) + 30px);
  cursor: pointer;
}
.photo-frame {
  max-width: 100%;
  max-height: 62vh;
  max-height: 62dvh;
  padding: 10px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 10px;
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(255, 200, 130, 0.2);
  transform: rotate(-1.2deg);
  animation: photoIn 1s ease both;
}
@keyframes photoIn {
  from { opacity: 0; transform: rotate(-1.2deg) scale(0.86) translateY(16px); }
  to { opacity: 1; transform: rotate(-1.2deg) scale(1) translateY(0); }
}
.photo-frame img {
  display: block;
  max-width: 100%;
  max-height: calc(62dvh - 20px);
  border-radius: 4px;
}
.photo-caption { text-wrap: balance;
  margin-top: 24px;
  font-family: var(--serif);
  font-size: clamp(18px, 5vw, 24px);
  letter-spacing: 0.2em;
  color: var(--text);
  text-shadow: 0 0 14px rgba(180, 140, 255, 0.4);
  animation: lineIn 1s ease 0.5s both;
}
.photo-hint {
  margin-top: 16px;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: rgba(243, 234, 255, 0.4);
  animation: lineIn 1s ease 1.4s both;
}
.photo-dots {
  margin-top: 14px;
  display: flex;
  gap: 8px;
}
.photo-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
}
.photo-dots i.on { background: var(--gold); box-shadow: 0 0 8px rgba(255, 217, 138, 0.8); }

/* ---------- 隐藏彩蛋大星星 ---------- */
.egg-star {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  font-size: 46px;
  color: #fff;
  text-shadow: 0 0 24px rgba(255, 255, 255, 0.95), 0 0 70px rgba(255, 158, 203, 0.75), 0 0 120px rgba(140, 120, 255, 0.5);
  animation: eggPulse 2.6s ease-in-out infinite;
}
@keyframes eggPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.22); }
}

/* ---------- 我们的故事（时间节点） ---------- */
.memory-view {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.mem-date {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.3em;
  color: var(--gold);
  border: 1px solid rgba(255, 217, 138, 0.5);
  border-radius: 999px;
  padding: 5px 18px;
  margin-bottom: 22px;
  text-shadow: 0 0 10px rgba(255, 217, 138, 0.5);
}
.memory-view .photo-frame { margin-bottom: 22px; }
.mem-title { text-wrap: balance;
  font-family: var(--serif);
  font-size: clamp(28px, 8vw, 40px);
  letter-spacing: 0.26em;
  text-indent: 0.26em;
  color: var(--text);
  text-shadow: 0 0 20px rgba(255, 158, 203, 0.45);
  margin-bottom: 16px;
  animation: lineIn 1s ease 0.3s both;
}
.mem-text { text-wrap: balance;
  font-size: clamp(15px, 4.2vw, 18px);
  line-height: 2;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  max-width: 30em;
  animation: lineIn 1s ease 0.7s both;
}
.tap-hint {
  margin-top: 44px;
  font-size: 12px;
  letter-spacing: 0.34em;
  color: rgba(243, 234, 255, 0.35);
  animation: connPulse 2s ease-in-out infinite;
}

/* ---------- 加载 / 错误 ---------- */
.boot-star {
  font-size: 30px;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255, 217, 138, 0.8);
  animation: pulseStar 1.6s ease-in-out infinite;
}

/* ---------- 小屏优化 ---------- */
@media (max-width: 360px) {
  .line { font-size: 20px; }
  .btn { padding: 13px 34px; font-size: 16px; }
  .hud-stars { gap: 7px; font-size: 11px; }
}

/* ---------- 电脑端 ---------- */
@media (min-width: 640px) {
  #app { box-shadow: none; }
  .packet { cursor: pointer; }
}

/* ---------- 结尾心跳 + 心电图（v2：P-QRS-T 逼真波形 + 双照轮播） ---------- */
.heartbeat {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 0 20px;
}
.ecg {
  width: min(92vw, 560px);
  height: 96px;
  overflow: visible;
}
/* 底层暗红轨迹（余晖感） */
.ecg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(255, 111, 156, 0.08), transparent 70%);
}
.ecg-line {
  fill: none;
  stroke: #ff6f9c;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(255, 111, 156, 0.9)) drop-shadow(0 0 16px rgba(255, 111, 156, 0.45)) drop-shadow(0 0 30px rgba(255, 90, 140, 0.2));
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: ecgDraw 2.4s linear infinite;
}
@keyframes ecgDraw {
  0% { stroke-dashoffset: 100; }
  72% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 0; }
}
.beat-core {
  position: relative;
  width: clamp(120px, 34vw, 148px);
  height: clamp(120px, 34vw, 148px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 158, 203, 0.8);
  box-shadow: 0 0 34px rgba(255, 111, 156, 0.55), 0 0 70px rgba(255, 111, 156, 0.2), inset 0 0 22px rgba(255, 111, 156, 0.3);
  background: rgba(255, 111, 156, 0.08);
  overflow: visible;
  animation: heartBeat 1.15s cubic-bezier(0.2, 0.8, 0.3, 1) infinite;
}
/* 双照片交叉轮播 */
.beat-core .ph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  opacity: 0;
  animation: photoCycle 8s ease-in-out infinite;
}
.beat-core .ph1 { animation-delay: 0s; }
.beat-core .ph2 { animation-delay: 4s; }
@keyframes photoCycle {
  0% { opacity: 0; }
  4% { opacity: 1; }
  46% { opacity: 1; }
  50% { opacity: 0; }
  100% { opacity: 0; }
}
.beat-core.has-photo .ph1 { opacity: 1; }
.beat-emoji { font-size: 64px; line-height: 1; filter: drop-shadow(0 0 16px rgba(255,111,156,0.9)); }
/* 真实心跳节律：咚-咚-(歇) */
@keyframes heartBeat {
  0% { transform: scale(1); }
  10% { transform: scale(1.22); }
  22% { transform: scale(1); }
  34% { transform: scale(1.14); }
  52% { transform: scale(1); }
  100% { transform: scale(1); }
}
/* 心跳光环扩散（双层） */
.beat-core::after,
.beat-core::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 158, 203, 0.55);
  animation: beatRipple 1.15s ease-out infinite;
  pointer-events: none;
}
.beat-core::before { animation-delay: 0.35s; border-color: rgba(255, 217, 138, 0.35); }
@keyframes beatRipple {
  0% { transform: scale(1); opacity: 0.75; }
  60% { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}
.beat-rhythm { display: flex; gap: 7px; height: 6px; align-items: center; }
.beat-rhythm i {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255, 158, 203, 0.85);
  animation: rhythmDot 1.15s ease-in-out infinite;
}
.beat-rhythm i:nth-child(2) { animation-delay: 0.12s; }
.beat-rhythm i:nth-child(3) { animation-delay: 0.24s; }
@keyframes rhythmDot {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  15% { opacity: 1; transform: scale(1.3); }
  40% { opacity: 0.3; transform: scale(0.9); }
}
.heartbeat .sub { letter-spacing: 0.34em; }

/* 曲目切换提示（顶部） */
#track-toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translate(-50%, -10px);
  z-index: 60;
  padding: 8px 18px;
  background: rgba(20, 12, 40, 0.85);
  border: 1px solid rgba(255, 217, 138, 0.45);
  border-radius: 999px;
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 0.1em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
}
#track-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
