/* ============================================================
   生日祝福网站 — 样式表
   主题：电影院银幕 / 横向滚动 / 投影光晕
   ============================================================ */

/* ---------- CSS 变量 ---------- */
:root {
  --bg-cinema: #0a0808;              /* 电影院暗场 */
  --screen-bg: #e0dedb;              /* 银幕冷白 */
  --text-primary: #2c2218;           /* 主文字 */
  --text-secondary: #5c4e3e;         /* 副文字 */
  --text-dim: #9a8c7e;              /* 暗文字 */
  --gold-accent: #b8934a;            /* 金色强调 */
  --gold-light: #d4b86a;             /* 浅金 */
  --gold-dim: #8a6d3b;              /* 暗金 */
}

/* ---------- 基础重置 ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000;
}

body {
  font-family: 'Noto Sans SC', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--text-primary);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

#viewport-fix {
  position: fixed;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  transform-origin: top left;
  container-type: size;
}

/* 横屏提示 */
#rotate-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.85rem;
  letter-spacing: 2px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}
#rotate-hint.show {
  opacity: 1;
}

/* ===== 粒子背景 Canvas（在光晕之上、银幕之下） ===== */
#particle-canvas {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

/* ===== 电影院背景光晕 — 银幕向外发散的白色光 + 极淡暖色 ===== */
#cinema-bg {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 50%,
      rgba(255, 255, 255, 0.025) 25%,
      rgba(255, 255, 255, 0.012) 42%,
      transparent 58%
    ),
    radial-gradient(ellipse at 50% 50%,
      rgba(255, 220, 180, 0.05) 18%,
      transparent 48%
    ),
    #0a0808;
}

/* ================================================================
   银幕 — 固定居中、横向滚动、投影光晕
   ================================================================ */
#cinema-screen {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 85cqw;
  height: 75cqh;
  z-index: 3;
  background: var(--screen-bg);
  border-radius: 22px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  /* 向外发散的白色光晕 — 投影机灯光溢出 */
  box-shadow:
    0 0 30px 8px rgba(255, 255, 255, 0.18),
    0 0 60px 20px rgba(255, 255, 255, 0.12),
    0 0 100px 40px rgba(255, 255, 255, 0.07),
    0 0 180px 70px rgba(255, 255, 255, 0.04),
    0 0 280px 120px rgba(255, 255, 255, 0.02);
}

#cinema-screen::-webkit-scrollbar { display: none; }
#cinema-screen { scrollbar-width: none; }


#screen-content {
  display: flex;
  flex-direction: row;
  height: 100%;
}

/* ---------- 银幕内的 Section（横向排列） ---------- */
.screen-section {
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px;
  text-align: center;
}

/* 短内容居中（无溢出风险），长内容从顶部开始（可滚动） */
#cover {
  justify-content: center;
  position: relative;
}

/* 问题页、答案页、过渡页统一：文字居中，按钮底部 */
.question-inner,
.answer-inner {
  max-width: none !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.question-text-group,
.answer-text-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

#intro-question .cinema-btn,
#intro-answer .cinema-btn {
  margin-bottom: 40px;
  flex-shrink: 0;
}

.section-inner {
  max-width: 580px;
  width: 100%;
}

/* 内部滚动条 */
.screen-section::-webkit-scrollbar { width: 4px; }
.screen-section::-webkit-scrollbar-track { background: transparent; }
.screen-section::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 2px;
}

/* ---------- 场景标签 ---------- */
.scene-label {
  font-size: 0.78rem;
  color: var(--gold-dim);
  letter-spacing: 6px;
  margin-bottom: 24px;
  text-transform: uppercase;
}

.scene-label-sm {
  font-size: 0.7rem;
  color: var(--gold-dim);
  letter-spacing: 4px;
  margin-bottom: 16px;
}

/* ---------- 银幕标题 ---------- */
.cinema-title {
  font-weight: 500;
  font-size: clamp(1.3rem, 2.6cqw, 2rem);
  color: var(--text-primary);
  margin-bottom: 22px;
  line-height: 1.7;
  letter-spacing: 4px;
}

/* ---------- 自定义字体 ---------- */
@font-face {
  font-family: 'Raillouise';
  src: url('raillouise-font/Raillouise-e97Gx.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

.eng {
  font-family: 'Raillouise', serif;
}

@font-face {
  font-family: 'PingFangXingChenTi';
  src: url('pingfang/PingFangXingChenTi-2.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* ---------- 封面 Section ---------- */
#cover .cover-inner {
  max-width: none;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.cover-text-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  padding: 0 40px;
}

.cover-line-1,
.cover-line-2 {
  font-family: 'Raillouise', serif;
  line-height: 1.6;
  margin: 0;
}

.cover-line-1,
.cover-line-2 {
  font-size: clamp(4rem, 10cqw, 7rem);
}

.cover-line-1 {
  text-align: left;
  padding-left: 10%;
  color: #f0e8d8;
}

.cover-line-2 {
  text-align: right;
  padding-right: 10%;
  color: #d4b86a;
}

.highlight {
  color: var(--gold-accent);
  font-weight: 500;
}

/* ---------- 黑色银幕（封面、数学题、过渡页） ---------- */
.screen-black {
  background: #0a0808 !important;
}

.screen-black .cinema-title,
.screen-black .math-question-large,
.screen-black .subtitle,
.screen-black .subtitle-secondary,
.screen-black .hint-text {
  color: #f0e8d8;
}

.screen-black .scene-label,
.screen-black .scene-label-sm {
  color: var(--gold-dim);
}

.screen-black .highlight {
  color: var(--gold-light);
}


/* ---------- 播放按钮行（封面右下角） ---------- */
.play-row {
  position: absolute;
  bottom: 32px;
  right: 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.play-hint {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 1px;
  font-weight: 300;
}

/* ---------- 播放按钮 ---------- */
.play-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid rgba(200, 164, 75, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: play-glow 2s ease-in-out infinite;
  transition: border-color 0.35s ease, background 0.35s ease;
  flex-shrink: 0;
}

.play-icon {
  font-size: 20px;
  color: #d4b86a;
  margin-left: 2px;
  transition: color 0.35s ease;
}

.play-btn:hover {
  border-color: #e0ce9a;
  background: rgba(200, 164, 75, 0.08);
}

.play-btn:hover .play-icon {
  color: #f0d88a;
}

.play-btn:active {
  transform: scale(0.94);
  animation: none;
}

@keyframes play-glow {
  0%, 100% {
    box-shadow: 0 0 14px rgba(200, 164, 75, 0.20),
                0 0 36px rgba(200, 164, 75, 0.07);
  }
  50% {
    box-shadow: 0 0 24px rgba(200, 164, 75, 0.45),
                0 0 60px rgba(200, 164, 75, 0.22),
                0 0 90px rgba(200, 164, 75, 0.08);
  }
}


/* ---------- 过渡页文字 ---------- */
.transition-line-1,
.transition-line-2 {
  font-family: 'PingFangXingChenTi', 'Noto Sans SC', sans-serif;
  font-size: clamp(1.05rem, 1.8cqw, 1.35rem);
  color: #f0e8d8;
  line-height: 2.4;
  font-weight: 300;
  letter-spacing: 2px;
  margin-bottom: 16px;
  min-height: 1.2em;
}

#intro-transition .cinema-btn {
  margin-top: 12px;
}

#intro-transition .cinema-btn:not(.btn-invisible) {
  animation: btn-appear 0.6s ease;
}

/* ===== Dip to Black 转场遮罩 ===== */
#dip-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #050303;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

#dip-overlay.active {
  opacity: 1;
}

/* ---------- 统一按钮：液态玻璃 + 金色 ---------- */
.cinema-btn {
  font-family: 'PingFangXingChenTi', 'Noto Sans SC', sans-serif;
  font-weight: 400;
  font-size: clamp(0.73rem, 1cqw, 0.85rem);
  letter-spacing: 3px;
  color: #d4b86a;
  border: 1px solid rgba(200, 164, 75, 0.35);
  padding: 13px 32px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.35s ease;
  white-space: nowrap;
  position: relative;

  /* 液态玻璃核心 */
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  /* 深度感 */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 2px 14px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(200, 164, 75, 0.06);
}

/* 玻璃表面的光扫 */
.cinema-btn::before {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 7px;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.07) 0%,
    rgba(255, 255, 255, 0.01) 40%,
    rgba(0, 0, 0, 0.02) 100%);
  pointer-events: none;
  transition: opacity 0.35s ease;
}

/* 内框 */
.cinema-btn::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 4px;
  border: 1px solid rgba(200, 164, 75, 0.10);
  pointer-events: none;
  transition: border-color 0.35s ease;
}

.cinema-btn:hover {
  color: #f0d88a;
  border-color: rgba(212, 184, 106, 0.55);
  background: rgba(200, 164, 75, 0.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    0 4px 22px rgba(0, 0, 0, 0.45),
    0 0 32px rgba(200, 164, 75, 0.16),
    0 0 0 1px rgba(200, 164, 75, 0.12);
}

.cinema-btn:hover::after {
  border-color: rgba(212, 184, 106, 0.22);
}

.cinema-btn:active {
  transform: scale(0.97);
  box-shadow:
    inset 0 1px 4px rgba(0, 0, 0, 0.15),
    0 1px 6px rgba(0, 0, 0, 0.3),
    0 0 12px rgba(180, 147, 74, 0.10);
}

.cinema-btn.small {
  font-size: clamp(0.65rem, 0.85cqw, 0.75rem);
  padding: 9px 22px;
  letter-spacing: 2px;
}

/* ---------- 提示文字 ---------- */
.hint-text {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: 14px;
  letter-spacing: 2px;
  font-weight: 300;
}

/* ---------- 所有横向面板通用 ---------- */
#screen-content > * {
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: start;
}

/* 数学题 */
.math-label {
  font-family: 'PingFangXingChenTi', 'Noto Sans SC', sans-serif;
  font-size: clamp(2rem, 4.5cqw, 3.2rem);
  font-weight: 400;
  color: #b5a08a;
  letter-spacing: 4px;
  margin: 0 0 20px;
  line-height: 1.6;
  min-height: 1.6em;
}

.math-equation {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: clamp(2.6rem, 7cqw, 5rem);
  font-weight: 500;
  color: #f0e8d8;
  letter-spacing: 6px;
  margin: 0;
  line-height: 1.4;
  min-height: 1.4em;
}

/* 打字机光标 */
.typewriter-cursor::after {
  content: '|';
  animation: cursor-blink 0.7s step-end infinite;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* 大号答案 */
.answer-large {
  font-family: 'PingFangXingChenTi', 'Noto Sans SC', sans-serif;
  font-size: clamp(2.8rem, 7cqw, 5rem);
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 5px;
  margin: 0;
  line-height: 2.0;
  animation: answer-pop 0.6s ease;
}

.answer-large strong,
.blink-highlight {
  color: var(--gold-accent);
  font-weight: 700;
  animation: name-glow 2s ease-in-out infinite;
}

@keyframes name-glow {
  0%, 100% {
    text-shadow:
      0 0 8px rgba(184, 147, 74, 0.3),
      0 0 18px rgba(200, 164, 75, 0.15),
      0 0 32px rgba(212, 184, 106, 0.08);
  }
  50% {
    text-shadow:
      0 0 16px rgba(184, 147, 74, 0.55),
      0 0 36px rgba(200, 164, 75, 0.35),
      0 0 60px rgba(212, 184, 106, 0.18);
  }
}

.answer-large strong {
  color: var(--gold-accent);
}

@keyframes answer-pop {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== 版本滑动页：左文右图 + 重影叠片 ===== */
.version-slide {
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  padding: 0;
  gap: 24px;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.version-slide.active {
  opacity: 1;
  transform: translateX(0);
}

/* ---- 固定区域尺寸 ---- */
.version-left,
.version-right {
  height: 62cqh;
}

/* ---- 左半边：标题(顶) + 配文(中) + 按钮(底) ---- */
.version-left {
  width: clamp(260px, 38%, 420px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0 0 10px 0;
  overflow-y: auto;
}

.version-left .version-title {
  text-align: left;
  margin-bottom: 0;
  flex-shrink: 0;
}

/* 标题前的金色装饰点 */
.version-title .caption-title::before {
  content: '· ';
  color: var(--gold-accent);
  font-weight: 700;
}

.version-title .caption-title {
  display: inline-block;
  position: relative;
  font-family: 'PingFangXingChenTi', 'Noto Sans SC', sans-serif;
  font-size: clamp(1rem, 1.8cqw, 1.25rem);
  font-weight: 600;
  color: var(--gold-accent);
  letter-spacing: 4px;
  padding-bottom: 14px;
}

/* 标题下方的渐变金线（宽度 = 标题文字宽度） */
.version-title .caption-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, rgba(184, 147, 74, 0.5), rgba(184, 147, 74, 0.05));
}

/* 配文：垂直居中（填满标题和按钮之间的空间） */
.version-left .photo-caption {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  text-align: left;
  margin: 0;
  max-width: none;
  font-family: 'PingFangXingChenTi', 'Noto Sans SC', sans-serif;
  font-size: clamp(0.95rem, 1.6cqw, 1.15rem);
  color: #4a3728;
}

/* 配文打字机：隐藏光标 */
.photo-caption.typewriter-cursor::after {
  display: none;
}

/* 生僻字字体回退 */
.font-fallback {
  font-family: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
}

.caption-para {
  display: block;
  text-indent: 2em;
}

.version-left .version-next-btn {
  margin-top: auto;
  flex-shrink: 0;
  align-self: center;
}

/* ---- 右半边：照片堆叠 ---- */
.version-right {
  width: clamp(280px, 40%, 440px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* 叠片容器（填满右区域，照片自适应） */
.photo-stack {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

/* 主图（最前层，在固定区域内自适应） */
.photo-main {
  display: block;
  position: relative;
  z-index: 3;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: box-shadow 0.35s ease;
}

.photo-main:hover {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
}

/* 重影层（绝对定位，填满容器，从主图后方偏移露出） */
.photo-ghost {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 4px;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

/* 后一张：略偏右下，半透明 */
.photo-ghost-1 {
  z-index: 2;
  opacity: 0.35;
  transform: translate(22px, 14px) scale(0.93);
}

/* 后两张：更多偏移，更淡 */
.photo-ghost-2 {
  z-index: 1;
  opacity: 0.16;
  transform: translate(40px, 26px) scale(0.86);
}

/* 左右箭头 */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  background: rgba(10, 8, 8, 0.5);
  border: none;
  color: #f0e8d8;
  font-size: 2rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.3s ease, opacity 0.3s ease;
  backdrop-filter: blur(4px);
}

.carousel-arrow:hover {
  background: rgba(10, 8, 8, 0.78);
}

.carousel-prev { left: -44px; }
.carousel-next { right: -44px; }

/* 圆点指示器 + 点击提示 */
.carousel-hint-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.carousel-dots {
  display: flex;
  gap: 8px;
}

.carousel-hint {
  font-size: 0.65rem;
  color: var(--text-primary);
  white-space: nowrap;
}

.carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(200, 164, 75, 0.25);
  cursor: pointer;
  transition: background 0.3s ease;
}

.carousel-dot.active {
  background: rgba(200, 164, 75, 0.8);
}

/* 照片配文 */
.photo-caption {
  font-family: 'PingFangXingChenTi', 'Noto Sans SC', sans-serif;
  font-size: 0.74rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.8;
  letter-spacing: 1px;
  font-weight: 300;
}

.version-next-btn {
  flex-shrink: 0;
}

.version-btn-row {
  display: flex;
  flex-direction: row;
  gap: 16px;
  margin-top: auto;
  flex-shrink: 0;
  align-self: center;
}

.version-btn-row .cinema-btn.small {
  padding: 9px 18px;
}

/* ===== 堆叠布局（上中下）：标题 / 照片网格 / 配文+按钮 ===== */
.version-stacked {
  flex-direction: column !important;
  gap: 0 !important;
  padding: 24px 32px;
}

.version-stacked-top {
  flex: 0 0 auto;
  text-align: center;
  margin-bottom: 6px;
}

.version-stacked-top .version-title {
  text-align: center;
}

.version-stacked-photos {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  padding: 6px 0;
}

.photo-grid {
  display: grid;
  gap: 12px;
  width: 100%;
  height: 100%;
  min-height: 0;
  place-items: center;
}

.photo-grid-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.photo-grid-2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.photo-grid-3 { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr; }
.photo-grid-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

.photo-grid-item {
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  object-fit: contain;
  border-radius: 4px;
  cursor: pointer;
  transition: box-shadow 0.35s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.10);
}

.photo-grid-item:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
}

video.photo-grid-item {
  background: #000;
}

.version-stacked-bottom {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 6px;
}

.version-stacked-bottom .photo-caption {
  flex: 0 0 auto;
  font-size: clamp(0.82rem, 1.3cqw, 1rem);
  color: var(--text-primary);
  margin-bottom: 10px;
  max-width: 600px;
}

.version-stacked-bottom .version-btn-row {
  margin-top: 0;
}

/* ---------- 第三幕：庆祝 ---------- */
/* 过渡页：文字居中，按钮底部 */
#intro-transition .section-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.transition-text-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#intro-transition .cinema-btn {
  margin-bottom: 40px;
  flex-shrink: 0;
}

/* 按钮占位但不可见（避免布局抖动） */
.btn-invisible {
  opacity: 0;
  pointer-events: none;
}

/* ---------- 3D 粒子蛋糕场景（全屏） ---------- */
#cake-scene {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: transparent;
}

#cake-scene canvas {
  display: block;
}

#cake-canvas-container {
  position: absolute;
  inset: 0;
}

/* 按钮叠加层：底部居中 */
#cake-ui-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 48px;
}

#cake-ui-overlay > button {
  pointer-events: auto;
  margin-bottom: 16px;
}

#btn-wish-cake {
  animation: btn-appear 0.6s ease;
}

@keyframes btn-appear {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* 结果页：祝福卡片右侧 */
.cake-result-letter {
  position: absolute;
  right: 6%;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.8s ease;
  max-width: 480px;
  width: 38%;
}

.cake-result-letter .personal-letter {
  max-height: 340px;
  font-size: 1.05rem;
  line-height: 2.4;
}

.cake-result-letter.visible {
  opacity: 1;
}

.personal-letter {
  font-family: 'PingFangXingChenTi', 'Noto Sans SC', sans-serif;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  padding: 28px 28px;
  max-width: 480px;
  max-height: 260px;
  width: 100%;
  overflow-y: auto;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.08);
  font-size: 0.74rem;
  color: var(--text-primary);
  line-height: 2.2;
  font-weight: 300;
}

.personal-letter p {
  margin-bottom: 6px;
}

.personal-letter .signature {
  font-weight: 400;
  font-size: 0.75rem;
  color: #a07830;
  text-align: right;
  margin-top: 14px;
  letter-spacing: 2px;
}

.personal-letter::-webkit-scrollbar { width: 4px; }
.personal-letter::-webkit-scrollbar-track { background: transparent; }
.personal-letter::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 2px;
}




/* ===== 蒙太奇过渡页（银幕内，放映机闪烁 + 快速混剪） ===== */
.montage-section {
  position: relative;
  padding: 24px;
}

.montage-section .montage-inner {
  max-width: none;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 放映机闪烁覆盖层 */
.montage-section::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: rgba(20, 15, 10, 0.5);
  animation: montage-flicker 0.22s steps(1) infinite;
}

@keyframes montage-flicker {
  0%, 100% { opacity: 0; }
  8%  { opacity: 0.05; }
  15% { opacity: 0.02; }
  22% { opacity: 0.06; }
  33% { opacity: 0.01; }
  40% { opacity: 0.04; }
  55% { opacity: 0.03; }
  62% { opacity: 0.07; }
  74% { opacity: 0.01; }
  81% { opacity: 0.05; }
  90% { opacity: 0.02; }
}

.montage-stage {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 90%;
  height: 78%;
}

.montage-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 0.1s ease, transform 0.25s ease-out;
  -webkit-mask-image: radial-gradient(ellipse at center, black 65%, transparent 96%);
  mask-image: radial-gradient(ellipse at center, black 65%, transparent 96%);
}

.montage-stage img.active {
  opacity: 1;
  transform: scale(1);
}

/* ===== 照片回顾总结（全屏） ===== */
#photo-summary {
  position: fixed;
  inset: 0;
  z-index: 9;
  background: transparent;
  display: flex;
  flex-direction: row;
}

#ps-left {
  position: relative;
  flex: 0 0 65%;
  height: 100%;
  overflow: hidden;
}

#ps-photos {
  position: relative;
  width: 100%;
  height: 100%;
}

/* 拍立得相片 */
.ps-polaroid {
  position: absolute;
  background: #fafaf8;
  padding: 7px 7px 22px 7px;
  box-shadow: 3px 4px 16px rgba(0, 0, 0, 0.22), 1px 1px 4px rgba(0, 0, 0, 0.08);
  border-radius: 2px;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.ps-polaroid.landed {
  opacity: 1;
}

.ps-polaroid:hover {
  z-index: 100 !important;
  transform: scale(1.35) !important;
  box-shadow: 6px 8px 28px rgba(0, 0, 0, 0.35);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
}

/* 浮动动画 */
.ps-polaroid.floating {
  animation: ps-float var(--float-dur, 4s) ease-in-out infinite;
  animation-delay: var(--float-delay, 0s);
}

@keyframes ps-float {
  0%, 100% { transform: rotate(var(--rot, 0deg)) translate(0, 0); }
  25% { transform: rotate(calc(var(--rot, 0deg) + 0.5deg)) translate(2px, -3px); }
  50% { transform: rotate(calc(var(--rot, 0deg) - 0.3deg)) translate(-1px, 2px); }
  75% { transform: rotate(calc(var(--rot, 0deg) + 0.4deg)) translate(-2px, -1px); }
}

.ps-polaroid.landscape {
  padding: 7px 7px 16px 7px;
}

.ps-polaroid img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1px;
  pointer-events: none;
}

/* 右半边 */
#ps-right {
  flex: 0 0 35%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.ps-text {
  font-family: 'PingFangXingChenTi', 'Noto Sans SC', sans-serif;
  font-size: clamp(1.1rem, 1.8cqw, 1.4rem);
  color: #f0e8d8;
  line-height: 2.4;
  letter-spacing: 3px;
  text-align: center;
  margin-bottom: 36px;
}

/* ---------- 隐藏类 ---------- */
.hidden { display: none !important; }

/* ---------- 照片灯箱 ---------- */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 2, 2, 0.95);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.lightbox img {
  max-width: 90%;
  max-height: 72cqh;
  border-radius: 6px;
  box-shadow: 0 0 48px rgba(180, 140, 80, 0.12);
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 1001;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.06);
}

#lightbox-caption {
  font-size: 0.88rem;
  color: #b5a592;
  margin-top: 16px;
  text-align: center;
  max-width: 80%;
  line-height: 1.8;
  font-weight: 300;
}

/* 灯箱翻页箭头 */
.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1002;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e0d6c8;
  font-size: 2.4rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  backdrop-filter: blur(6px);
  user-select: none;
}

.lightbox-arrow:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }

/* ---------- 全局音乐控制器 ---------- */
#music-controller {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(20, 15, 10, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 26px;
  padding: 6px;
  backdrop-filter: blur(12px);
  transition: all 0.3s ease;
}

#music-controller:hover {
  border-color: rgba(200, 164, 75, 0.25);
}

#music-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #b5a592;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

#music-toggle:hover {
  background: rgba(200, 164, 75, 0.1);
  color: var(--gold-accent);
}

#music-toggle.playing {
  border-color: var(--gold-accent);
  color: var(--gold-accent);
}


/* ---------- 纸屑容器 ---------- */
#confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 998;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
  80% { opacity: 0.8; }
  100% { transform: translateY(105cqh) rotate(720deg) scale(0.5); opacity: 0; }
}

/* ================================================================
   响应式
   ================================================================ */

@media (max-width: 768px) {
  #cinema-screen {
    width: 92cqw;
    height: 78cqh;
    border-radius: 16px;
    box-shadow:
      0 0 20px 5px rgba(255, 255, 255, 0.15),
      0 0 45px 16px rgba(255, 255, 255, 0.10),
      0 0 80px 35px rgba(255, 255, 255, 0.06),
      0 0 140px 55px rgba(255, 255, 255, 0.03);
  }

  .screen-section {
    padding: 32px 20px;
  }

  .cover-text-group { padding: 0 24px; }
  .cover-line-1,
  .cover-line-2 { font-size: clamp(2.2rem, 6cqw, 3.8rem); }
  .play-btn {
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
  }
  .play-icon { font-size: 17px; }

  .cinema-title {
    font-size: clamp(1rem, 4cqw, 1.4rem);
    letter-spacing: 3px;
  }

  .cinema-btn {
    padding: 11px 24px;
    font-size: 0.7rem;
  }

  .version-slide { gap: 14px; }
  .carousel-arrow { width: 30px; height: 30px; font-size: 1.5rem; }
  .carousel-prev { left: -38px; }
  .carousel-next { right: -38px; }

  .math-equation { font-size: clamp(2rem, 6cqw, 3.5rem); }
  .answer-large { font-size: clamp(2rem, 5.5cqw, 3.6rem); }

  #music-controller {
    bottom: 12px;
    right: 10px;
    padding: 5px;
  }
  #music-toggle { width: 34px; height: 34px; font-size: 13px; }

  .lightbox-close {
    top: 10px; right: 10px;
    width: 36px; height: 36px;
    font-size: 14px;
  }
  .lightbox-arrow { width: 40px; height: 40px; font-size: 2rem; }
  .lightbox-prev { left: 16px; }
  .lightbox-next { right: 16px; }

  .math-box { margin: 0 8px 24px; }

  .cake-result-letter {
    right: 4%;
    width: 50%;
    max-width: none;
  }

  .montage-stage { width: 94%; height: 72%; }

  #photo-summary { flex-direction: column; }
  #ps-left { flex: 0 0 55%; }
  #ps-right { flex: 0 0 45%; padding: 24px; }

  .photo-grid { gap: 8px; }
  .version-stacked-bottom .photo-caption { font-size: 0.78rem; }
}

@media (max-width: 480px) {
  #cinema-screen {
    width: 95cqw;
    height: 80cqh;
    border-radius: 12px;
    box-shadow:
      0 0 14px 4px rgba(255, 255, 255, 0.13),
      0 0 35px 12px rgba(255, 255, 255, 0.08),
      0 0 65px 28px rgba(255, 255, 255, 0.05);
  }

  .screen-section {
    padding: 24px 14px;
  }

  .cover-text-group { padding: 0 16px; }
  .cover-line-1,
  .cover-line-2 { font-size: clamp(1.8rem, 5.5cqw, 3rem); }
  .play-btn {
    bottom: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
  }
  .play-icon { font-size: 15px; }

  .cinema-title { font-size: 0.95rem; letter-spacing: 2px; }

  .cinema-btn {
    padding: 10px 20px;
    font-size: 0.65rem;
    letter-spacing: 2px;
  }

  .carousel-arrow { width: 28px; height: 28px; font-size: 1.3rem; }
  .carousel-prev { left: -36px; }
  .carousel-next { right: -36px; }

  .math-label { font-size: clamp(1.2rem, 3.5cqw, 1.8rem); }
  .math-equation { font-size: clamp(1.6rem, 5cqw, 2.6rem); }
  .answer-large { font-size: clamp(1.6rem, 4.5cqw, 2.6rem); }

  .math-box {
    padding: 22px 12px;
    margin: 0 6px 16px;
  }

  .scene-label { font-size: 0.65rem; letter-spacing: 4px; }
  .scene-label-sm { font-size: 0.6rem; }

  #cake-ui-overlay { padding-bottom: 32px; }
  .cake-result-letter {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    width: 85%;
    max-width: none;
    margin: 24px auto 0;
  }
  .personal-letter { font-size: 0.88rem; padding: 12px 10px; max-height: 180px; max-width: 100%; }
  .lightbox-arrow { width: 36px; height: 36px; font-size: 1.6rem; }
  .lightbox-prev { left: 10px; }
  .lightbox-next { right: 10px; }


  .montage-section { padding: 14px; }
  .montage-stage { width: 96%; height: 68%; }

  #ps-left { flex: 0 0 50%; }
  #ps-right { flex: 0 0 50%; padding: 18px; }
  .ps-text { font-size: 0.95rem; letter-spacing: 2px; }

  .section-inner { max-width: 100%; }
}
