/* ========== 星轨情书 · 设计令牌 ========== */
:root {
  --bg: #05070f;
  --bg-soft: #0a0e1c;
  --ink: #f2ede3;
  --ink-dim: rgba(242, 237, 227, 0.55);
  --gold: #d4af77;
  --gold-soft: rgba(212, 175, 119, 0.35);
  --nebula: #5b4f9e;
  --rose: #e8a0a0;
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "SimSun", Georgia, serif;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* 预览层注入的 AI 水印一律隐藏 */
[data-aigc-mark],
p[data-aigc-mark] {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  pointer-events: none !important;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ========== 背景层 ========== */
#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.nebula {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: screen;
  animation: nebula-drift 24s ease-in-out infinite alternate;
}

.nebula-a {
  width: 55vmax;
  height: 55vmax;
  top: -15%;
  right: -10%;
  background: radial-gradient(circle, var(--nebula) 0%, transparent 70%);
}

.nebula-b {
  width: 45vmax;
  height: 45vmax;
  bottom: -10%;
  left: -15%;
  background: radial-gradient(circle, #2a4a6b 0%, transparent 70%);
  animation-delay: -12s;
  opacity: 0.28;
}

@keyframes nebula-drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-4%, 6%) scale(1.08); }
}

/* ========== 进度轨 ========== */
.rail {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rail-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(242, 237, 227, 0.25);
  cursor: pointer;
  transition: all 0.4s var(--ease-out);
  border: none;
  padding: 0;
}

.rail-dot.active {
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold-soft), 0 0 20px var(--gold-soft);
  transform: scale(1.35);
}

/* ========== 面板布局 ========== */
main { position: relative; z-index: 1; }

.panel {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  position: relative;
}

.chapter-inner {
  width: min(720px, 100%);
  position: relative;
}

.chapter-inner.narrow { width: min(560px, 100%); }

/* ========== 开场 ========== */
.hero { text-align: center; }

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.45em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 28px;
  font-weight: 400;
}

.hero-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(56px, 14vw, 120px);
  line-height: 1.1;
  letter-spacing: 0.12em;
  color: var(--ink);
}

.hero-title .line {
  display: block;
  background: linear-gradient(135deg, #fff8ee 0%, var(--gold) 55%, #a8885a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 28px rgba(212, 175, 119, 0.25));
}

.hero-sub {
  margin-top: 28px;
  font-size: clamp(14px, 3.5vw, 18px);
  color: var(--ink-dim);
  letter-spacing: 0.2em;
  font-family: var(--font-serif);
}

.scroll-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 0.15em;
}

.mouse {
  width: 22px;
  height: 36px;
  border: 1.5px solid rgba(242, 237, 227, 0.4);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  padding-top: 7px;
}

.mouse i {
  width: 3px;
  height: 7px;
  background: var(--gold);
  border-radius: 2px;
  animation: wheel 1.6s ease-in-out infinite;
}

@keyframes wheel {
  0%   { opacity: 1; transform: translateY(0); }
  80%  { opacity: 0; transform: translateY(10px); }
  100% { opacity: 0; transform: translateY(10px); }
}

/* ========== 章节通用 ========== */
.ch-index {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.35em;
  color: var(--gold);
  border: 1px solid var(--gold-soft);
  padding: 6px 16px;
  border-radius: 999px;
  margin-bottom: 28px;
}

.ch-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(32px, 7vw, 52px);
  line-height: 1.35;
  letter-spacing: 0.06em;
  margin-bottom: 40px;
}

/* ========== 信笺卡片 ========== */
.letter-card {
  background: linear-gradient(160deg, rgba(255, 252, 245, 0.07) 0%, rgba(255, 252, 245, 0.03) 100%);
  border: 1px solid rgba(212, 175, 119, 0.25);
  border-radius: 4px;
  padding: clamp(28px, 5vw, 44px);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.2),
    0 24px 60px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}

.letter-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.6;
}

.letter-card p {
  font-family: var(--font-serif);
  font-size: clamp(15px, 3.8vw, 18px);
  color: rgba(242, 237, 227, 0.88);
  margin-bottom: 1.1em;
  text-align: justify;
}

.letter-card p:last-child { margin-bottom: 0; }

.letter-card .sign {
  text-align: right;
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.08em;
  opacity: 0.85;
}

.letter-card .hl {
  color: var(--gold);
  font-weight: 600;
}

/* ========== 首屏天数 ========== */
.day-badge {
  margin-top: 36px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: min(300px, 88vw);
  padding: 22px 48px 18px;
  border: 1.5px solid rgba(212, 175, 119, 0.45);
  border-radius: 999px;
  background: rgba(212, 175, 119, 0.07);
  box-shadow:
    0 0 0 6px rgba(212, 175, 119, 0.04),
    0 0 32px rgba(212, 175, 119, 0.08);
  font-size: 15px;
  letter-spacing: 0.12em;
  color: rgba(242, 237, 227, 0.88);
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
}

.day-line {
  display: block;
}

.day-badge strong {
  color: var(--gold);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px var(--gold-soft);
  vertical-align: -2px;
  margin: 0 2px;
}

.day-from {
  display: block;
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.2em;
}

/* ========== 轨道装饰 ========== */
.orbit-deco {
  position: absolute;
  right: -40px;
  top: -60px;
  width: 160px;
  height: 160px;
  pointer-events: none;
  opacity: 0.7;
}

.orbit {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(212, 175, 119, 0.3);
  border-radius: 50%;
  animation: spin 18s linear infinite;
}

.orbit.o2 {
  inset: 24px;
  border-color: rgba(212, 175, 119, 0.2);
  animation-duration: 12s;
  animation-direction: reverse;
}

.orbit i {
  position: absolute;
  top: -3px;
  left: 50%;
  width: 6px;
  height: 6px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--gold);
}

.orbit.o2 i {
  width: 4px;
  height: 4px;
  background: var(--rose);
  box-shadow: 0 0 6px var(--rose);
}

.core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  background: radial-gradient(circle, #fff 0%, var(--gold) 60%, transparent 70%);
  border-radius: 50%;
  box-shadow: 0 0 20px var(--gold);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 拍立得（已移除照片，样式保留备用） ========== */

.whisper {
  text-align: center;
  margin-top: 36px;
  font-family: var(--font-serif);
  font-size: clamp(16px, 4vw, 22px);
  color: var(--gold);
  letter-spacing: 0.2em;
  opacity: 0.9;
}

/* ========== 三颗星 · 时间轴 ========== */
.timeline {
  list-style: none;
  position: relative;
  padding: 8px 0 8px 36px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 16px;
  bottom: 16px;
  width: 1px;
  background: linear-gradient(180deg, var(--gold-soft), rgba(212, 175, 119, 0.05));
}

.tl-item {
  position: relative;
  padding: 0 0 36px;
}

.tl-item:last-child { padding-bottom: 0; }

.tl-star {
  position: absolute;
  left: -36px;
  top: 8px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, var(--gold) 55%, transparent 70%);
  box-shadow: 0 0 12px var(--gold), 0 0 28px var(--gold-soft);
  animation: pulse-ring 2.8s ease-in-out infinite;
}

.tl-date {
  display: block;
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--gold);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.tl-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(20px, 4.5vw, 26px);
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.tl-desc {
  font-size: clamp(14px, 3.5vw, 16px);
  color: var(--ink-dim);
  line-height: 1.7;
}

/* ========== 生日星愿 ========== */
.birthday { text-align: center; }

.cake-box {
  padding: 20px 0 8px;
}

.cake {
  position: relative;
  width: 120px;
  height: 140px;
  margin: 0 auto 28px;
}

.cake .flame {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 12px;
  height: 18px;
  margin-left: -6px;
  background: radial-gradient(circle at 50% 70%, #fff6c8 0%, #f0c14a 40%, #e87a3a 70%, transparent 75%);
  border-radius: 50% 50% 40% 40%;
  transform-origin: 50% 100%;
  animation: flicker 0.9s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 10px rgba(240, 193, 74, 0.85));
}

.cake .wick {
  position: absolute;
  top: 26px;
  left: 50%;
  width: 2px;
  height: 14px;
  margin-left: -1px;
  background: #c4b8a4;
}

.cake .tier {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 6px 6px 4px 4px;
  background: linear-gradient(180deg, #f3e6d4 0%, #e8d4b8 100%);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.06);
}

.cake .t3 { top: 40px; width: 48px; height: 22px; }
.cake .t2 { top: 62px; width: 72px; height: 26px; }
.cake .t1 { top: 88px; width: 100px; height: 32px; }

.cake.is-lit .flame { animation-duration: 0.55s; }

@keyframes flicker {
  from { transform: scaleY(1) scaleX(1) rotate(-3deg); opacity: 1; }
  to   { transform: scaleY(1.15) scaleX(0.9) rotate(3deg); opacity: 0.9; }
}

.solar, .lunar {
  font-family: var(--font-serif);
  letter-spacing: 0.12em;
}

.solar {
  color: var(--ink);
  font-size: 16px;
  margin-bottom: 6px;
}

.lunar {
  color: var(--gold);
  font-size: 15px;
  margin-bottom: 20px;
}

.wish {
  font-family: var(--font-serif);
  font-size: clamp(15px, 3.8vw, 18px);
  color: rgba(242, 237, 227, 0.88);
  line-height: 1.9;
  margin-bottom: 28px;
}

.wish-btn {
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0.18em;
  color: var(--bg);
  background: linear-gradient(135deg, #e8c98a, var(--gold));
  border: none;
  padding: 14px 32px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 24px var(--gold-soft);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s;
}

.wish-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 40px var(--gold-soft);
}

.wish-burst {
  margin-top: 20px;
  font-family: var(--font-serif);
  font-size: clamp(16px, 4vw, 20px);
  color: var(--gold);
  letter-spacing: 0.16em;
  text-shadow: 0 0 20px var(--gold-soft);
  animation: burst-in 0.7s var(--ease-out);
}

@keyframes burst-in {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

.finale-days {
  margin-top: -32px;
  margin-bottom: 40px;
  font-size: 13px;
  color: var(--ink-dim);
  letter-spacing: 0.14em;
}

.finale-days strong {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* ========== 承诺 ========== */
.promise {
  text-align: center;
  padding: 40px 24px;
  position: relative;
}

.promise-ring {
  width: 72px;
  height: 72px;
  margin: 0 auto 32px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  box-shadow:
    0 0 20px var(--gold-soft),
    inset 0 0 20px var(--gold-soft);
  animation: pulse-ring 3s ease-in-out infinite;
}

@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.08); opacity: 0.75; }
}

.promise p {
  font-family: var(--font-serif);
  font-size: clamp(16px, 4vw, 20px);
  color: rgba(242, 237, 227, 0.88);
  margin-bottom: 1em;
}

.promise .vow {
  margin-top: 28px;
  font-size: clamp(20px, 5vw, 28px);
  color: var(--gold);
  letter-spacing: 0.12em;
  text-shadow: 0 0 24px var(--gold-soft);
}

/* ========== 终章 ========== */
.finale { text-align: center; }

.finale-label {
  font-size: 11px;
  letter-spacing: 0.5em;
  color: var(--gold);
  margin-bottom: 32px;
}

.particle-stage {
  width: min(900px, 100%);
  margin-bottom: 36px;
}

#loveText {
  width: 100%;
  height: auto;
  display: block;
}

.finale-name {
  font-family: var(--font-serif);
  font-size: clamp(28px, 6vw, 44px);
  letter-spacing: 0.2em;
  background: linear-gradient(135deg, #fff 0%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 16px;
}

.finale-date {
  font-size: 14px;
  color: var(--ink-dim);
  letter-spacing: 0.25em;
  margin-bottom: 48px;
}

.replay {
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0.2em;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--gold-soft);
  padding: 14px 36px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.35s var(--ease-out);
}

.replay:hover {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
  box-shadow: 0 0 30px var(--gold-soft);
}

/* ========== 背景音乐 ========== */
.music-btn {
  position: fixed;
  left: 18px;
  bottom: 22px;
  z-index: 60;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 119, 0.35);
  background: rgba(10, 14, 28, 0.78);
  color: var(--gold);
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.35s var(--ease-out), box-shadow 0.35s, background 0.35s, transform 0.25s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: grid;
  place-items: center;
  overflow: visible;
}

.music-btn:hover {
  transform: scale(1.06);
  border-color: var(--gold);
  box-shadow: 0 0 24px var(--gold-soft);
}

.music-btn:active { transform: scale(0.96); }

/* 播放态：金环 + 呼吸光晕（无文字） */
.music-btn.is-on {
  border-color: var(--gold);
  background: radial-gradient(circle at 35% 30%, rgba(212, 175, 119, 0.28), rgba(10, 14, 28, 0.85) 70%);
  box-shadow:
    0 0 0 0 rgba(212, 175, 119, 0.45),
    0 0 28px rgba(212, 175, 119, 0.45),
    0 8px 24px rgba(0, 0, 0, 0.35);
  animation: music-breathe 2.4s ease-in-out infinite;
}

.music-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 119, 0.55);
  opacity: 0;
  pointer-events: none;
}

.music-btn.is-on .music-pulse {
  animation: music-ring 1.8s ease-out infinite;
}

.music-btn.is-on .music-pulse::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 119, 0.3);
  animation: music-ring 1.8s ease-out 0.9s infinite;
}

@keyframes music-breathe {
  0%, 100% {
    box-shadow:
      0 0 0 0 rgba(212, 175, 119, 0.4),
      0 0 22px rgba(212, 175, 119, 0.35),
      0 8px 24px rgba(0, 0, 0, 0.35);
  }
  50% {
    box-shadow:
      0 0 0 8px rgba(212, 175, 119, 0.08),
      0 0 36px rgba(212, 175, 119, 0.55),
      0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

@keyframes music-ring {
  0% { transform: scale(0.85); opacity: 0.85; }
  100% { transform: scale(1.45); opacity: 0; }
}

/* 均衡器条 */
.eq {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 18px;
  width: 22px;
  position: relative;
  z-index: 1;
}

.eq i {
  display: block;
  width: 3px;
  height: 5px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.45;
  transform-origin: center bottom;
  transition: height 0.2s;
}

.music-btn.is-on .eq i {
  opacity: 1;
  box-shadow: 0 0 6px rgba(212, 175, 119, 0.8);
  animation: eq-bar 0.9s ease-in-out infinite;
}

.music-btn.is-on .eq i:nth-child(1) { animation-delay: 0s; }
.music-btn.is-on .eq i:nth-child(2) { animation-delay: 0.15s; }
.music-btn.is-on .eq i:nth-child(3) { animation-delay: 0.3s; }
.music-btn.is-on .eq i:nth-child(4) { animation-delay: 0.45s; }

@keyframes eq-bar {
  0%, 100% { height: 5px; }
  50% { height: 16px; }
}

/* 播放时全页氛围增强 */
body.bgm-playing .nebula-a { opacity: 0.48; animation-duration: 16s; }
body.bgm-playing .nebula-b { opacity: 0.38; animation-duration: 18s; }
body.bgm-playing .rail-dot.active {
  box-shadow: 0 0 12px var(--gold), 0 0 28px var(--gold-soft);
}
body.bgm-playing .hero-title .line {
  filter: drop-shadow(0 0 32px rgba(212, 175, 119, 0.4));
}

#bgm { display: none; }

/* ========== 入场动画 ========== */
.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition:
    opacity 1s var(--ease-out),
    transform 1s var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.delay-1 { transition-delay: 0.12s; }
.delay-2 { transition-delay: 0.24s; }
.delay-3 { transition-delay: 0.36s; }
.delay-4 { transition-delay: 0.48s; }
.delay-5 { transition-delay: 0.6s; }

/* ========== 响应式 ========== */
@media (max-width: 640px) {
  .rail { right: 10px; gap: 12px; }
  .orbit-deco { display: none; }
  .panel { padding: 72px 20px; }
  .day-badge { padding: 18px 28px 14px; min-width: min(260px, 90vw); }
  .timeline { padding-left: 30px; }
  .tl-star { left: -30px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .nebula, .orbit, .promise-ring, .mouse i { animation: none; }
}
