/* ============================================================
 *  模板：生日 · 午夜（黑金）
 *
 *  原来的「生日 · 六幕」是粉紫渐变 + 糖果色蛋糕 + 彩虹标题，像一张
 *  热闹的电子贺卡。这一版把它做成**一份黑金邀请函**：黑曜石纸面、
 *  香槟金细线、象牙白衬线字、大留白、克制的动效。
 *
 *  高级感不是加更多东西，是**减**：
 *    · 一套色 —— 黑 + 金 + 象牙，彩色只留给照片和彩带
 *    · 两套字 —— 标题/信走衬线（宋体），说明/按钮走细无衬线
 *    · 三条线 —— 描边统一 1px 香槟金，透明度只在 .07 / .16 / .4 三档
 *    · 一个动作 —— 进场统一「浮起 + 去模糊」，不做花哨的位移
 *
 *  ── 改这个文件时要知道的三件事 ──
 *
 *  1. 调色板仍然走 css/base.css 那套「通道值」，所以引擎、固定控件、
 *     粒子特效会一起换肤。这里只**覆盖同名变量**，不动变量名 ——
 *     tools/check-editor.js 会去 base.css 里确认那些变量还在。
 *
 *  2. 状态类（.in / .on / .show / .broken / .blown-out / .opened /
 *     .beat）是 JS 在切，选择器一个都不能改名，改了就静悄悄地不生效。
 *
 *  3. `.stage` 的阴影里必须保留一条 rgba(var(--rose-rgb), …)：
 *     tools/check-apply.js 靠它验证「改主题 → 派生色跟着变」。
 *
 *  六幕之外的东西（导航点、音乐按钮、大图查看、二维码卡）在这里也
 *  重写了一遍 —— 它们的骨架在 base.css，这里只换气质。
 * ============================================================ */

:root {
  /* ---------- 底色 / 字色 ---------- */
  --ink-rgb: 8, 7, 10;             /* 黑曜石，带一点暖 */
  --cream-rgb: 244, 238, 227;      /* 象牙白，不用纯白（纯白刺眼，像屏幕） */

  /* ---------- 品牌色：全金属系 ----------
   * 这是这一版最大的一次「减法」：原来的玫瑰/丁香/天蓝是糖果色，
   * 彩带一撒就是生日派对纸屑。现在整组收进金—铜—香槟—象牙这一段，
   * 撒出来的是金箔，而不是彩色纸片。
   * 通道名一个都没改 —— 引擎、粒子、编辑器主题靠它们工作。 */
  --rose-rgb: 196, 138, 106;       /* 铜玫瑰 */
  --rose-soft-rgb: 226, 190, 160;  /* 香槟粉 */
  --rose-mid-rgb: 210, 158, 124;   /* 浅铜 */
  --gold-rgb: 212, 175, 111;       /* 香槟金，不是亮黄 */
  --lilac-rgb: 168, 158, 140;      /* 暖灰褐 */
  --sky-rgb: 178, 146, 112;        /* 古铜（原来是冷灰绿，混进金色彩带里发青） */

  /* ---------- 背景 ---------- */
  --ink-2: #0b090d;
  --ink-3: #120e12;
  --bg-deep: #050406;
  --bg-glow-1: #241a15;
  --bg-glow-2: #161a21;
  --bg-glow-3: #1d1412;

  /* ---------- 卡片 / 面板 ---------- */
  --card-top: #14110f;
  --card-bottom: #090807;
  --panel: rgba(10, 9, 11, 0.92);
  --scrim: rgba(4, 3, 4, 0.97);
  --card-light: #f7f2e8;
  --card-light-ink: #1a1512;

  /* ---------- 高光 / 光晕 ---------- */
  --spec: rgba(255, 248, 232, 0.18);
  --title-mid: #ecd6ac;
  --title-glow: rgba(212, 175, 111, 0.2);
  --badge-glow: rgba(212, 175, 111, 0.24);
  --heart-glow: rgba(212, 150, 118, 0.3);

  /* ---------- 蛋糕：象牙 / 香槟 / 亚麻，三层都提亮，靠金线分层 ---------- */
  --cake-1a: #ece2cf;  --cake-1b: #d8cbb2;  --cake-1c: #b8a98c;
  --cake-2a: #f4e5c6;  --cake-2b: #dfc694;  --cake-2c: #b99c68;
  --cake-3a: #f9f4e8;  --cake-3b: #e7ddca;  --cake-3c: #c9bca4;
  --frosting: #fffbf1;
  --wick: #5a4630;
  --smoke: rgba(200, 196, 206, 0.45);

  /* ---------- 火苗：暖白芯 + 琥珀边，别烧成霓虹 ---------- */
  --flame-core: #fffdf4;
  --flame-mid: #ffe2a0;
  --flame-outer: #d9a05a;
  --flame-edge: rgba(200, 120, 50, 0.55);
  --flame-glow-1: rgba(255, 200, 120, 0.7);
  --flame-glow-2: rgba(226, 160, 90, 0.42);
  --flame-halo: rgba(240, 190, 120, 0.26);
  --wish-glow: rgba(212, 175, 111, 0.35);
  --blow-grad-a: rgba(212, 175, 111, 0.16);
  --blow-shadow: rgba(0, 0, 0, 0.5);

  /* ---------- 彩带 / 漂浮粒子：把糖果色换成金属色 ----------
   * js/effects.js 读这几个通道值，所以「换肤换到粒子」是自动的。 */
  --fx-mint-rgb: 186, 178, 150;    /* 淡香槟 */
  --fx-peach-rgb: 208, 160, 118;   /* 古铜 */
  --fx-butter-rgb: 236, 216, 168;  /* 淡金 */
  --fx-white-rgb: 255, 250, 240;   /* 象牙 */

  /* ---------- 字体 ---------- */
  /* 中文衬线走系统字体：iPhone 是宋体-简，Windows 是宋体，安卓多数是
   * Noto Serif —— 都没有时落回系统衬线，气质不至于崩成无衬线。
   * 拉丁字母排在最前，于是大写小字会用到 Georgia 的优雅字形。 */
  --font-title: Georgia, "Songti SC", "Noto Serif CJK SC", "Noto Serif SC",
    "Source Han Serif SC", "STSong", "SimSun", "Times New Roman", serif;
  --font-kai: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", "SimSun", serif;

  /* ---------- 尺度与节奏 ---------- */
  --pad: clamp(22px, 5.6vw, 44px);
  /* 封面双线画框的 inset。音乐钮和底部提示都挂在它上面 ——
   * 桌面端要把框往里收，那两样东西必须跟着收，否则就跑到框外面去了。 */
  --cover-inset: clamp(14px, 4vw, 26px);
  --ease-luxe: cubic-bezier(0.16, 0.84, 0.22, 1);

  /* ---------- 描边与分隔线：三条档位，全站只用这三档 ---------- */
  --line-1: rgba(var(--gold-rgb), 0.07);
  --line-2: rgba(var(--gold-rgb), 0.16);
  --line-3: rgba(var(--gold-rgb), 0.4);
  --paper-ink: #2f2519;
  --paper-ink-soft: #4a3b2a;
  --paper-line: rgba(150, 112, 56, 0.22);
}

/* ============================================================
 *  纸面：底色、暗角、胶片颗粒
 * ============================================================ */

body {
  background:
    radial-gradient(140% 90% at 8% -10%, #241a15 0%, transparent 52%),
    radial-gradient(110% 80% at 96% 8%, #171b22 0%, transparent 50%),
    radial-gradient(120% 90% at 50% 112%, #1d1412 0%, transparent 58%),
    linear-gradient(180deg, #08070a 0%, #070608 44%, #050406 100%);
  background-attachment: fixed;
}

/* 会缓慢漂移的暖光。比原来暗得多 —— 高级感的底色是「黑得干净」。 */
body::before {
  background:
    radial-gradient(34% 28% at 18% 20%, rgba(var(--gold-rgb), 0.1), transparent 70%),
    radial-gradient(32% 26% at 84% 66%, rgba(var(--lilac-rgb), 0.07), transparent 70%),
    radial-gradient(28% 24% at 52% 98%, rgba(var(--rose-rgb), 0.06), transparent 70%);
  filter: blur(28px);
  animation: drift 34s ease-in-out infinite alternate;
}

/* 暗角 + 颗粒。这一层是「像印刷品而不是像网页」的关键，但必须
 * pointer-events:none，否则它会把封面的点击吃掉（检查脚本会红）。 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background-image:
    radial-gradient(125% 95% at 50% 42%, transparent 34%, rgba(0, 0, 0, 0.42) 82%, rgba(0, 0, 0, 0.62) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.42'/%3E%3C/svg%3E");
  background-size: cover, 180px 180px;
  opacity: 0.34;
  mix-blend-mode: normal;
}

/* 背景粒子压淡一档：它们现在是「空气里的金尘」，不是贴纸 */
#bg-fx { opacity: 0.5; }

/* 彩带落到内容**后面**。
 * base.css 里 #burst-fx 是 z-index:90，压在所有文字、按钮、火漆印上面 ——
 * 那就不是「低调的庆祝」，是纸屑撒在屏幕上。#app 是 z-index:2，
 * 这里放到 1，彩带就从「挡住字」变成「落在卡片背后」，一下有了景深。 */
#burst-fx { z-index: 1; }

/* ============================================================
 *  进场：浮起 + 去模糊，慢、轻、错开
 * ============================================================ */

[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  filter: blur(12px);
  transition:
    opacity 1.05s var(--ease-luxe),
    transform 1.05s var(--ease-luxe),
    filter 1.05s var(--ease-luxe);
  transition-delay: calc(var(--d, 0) * 130ms + 80ms);
}
.scene.in [data-reveal] {
  opacity: 1;
  transform: none;
  filter: blur(0);
}

/* ============================================================
 *  各幕共用的零件
 * ============================================================ */

.kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 3vw, 16px);
  font-family: var(--font-title);
  font-size: clamp(9px, 2.5vw, 10.5px);
  font-weight: 400;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  color: rgba(var(--gold-rgb), 0.62);
}
.kicker::before,
.kicker::after {
  content: "";
  width: clamp(16px, 5.5vw, 28px);
  height: 1px;
  flex: none;
  background: linear-gradient(90deg, transparent, rgba(var(--gold-rgb), 0.45));
}
.kicker::after {
  background: linear-gradient(90deg, rgba(var(--gold-rgb), 0.45), transparent);
}

.section-title {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 500;
  font-size: clamp(24px, 6.2vw, 31px);
  line-height: 1.3;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  color: var(--cream);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
/* 标题下的一小截金线。原来这里放的是 ✦，但同一个菱形在眉心、徽章、
 * 火漆印、页码上各出现一次 —— 一个符号出现四次就不再是符号。 */
.section-title::after {
  content: "";
  display: block;
  width: 18px;
  height: 1px;
  margin: clamp(12px, 2.4vh, 16px) auto 0;
  background: linear-gradient(90deg, transparent, rgba(var(--gold-rgb), 0.55), transparent);
}

.section-sub {
  margin: 0;
  font-size: clamp(11px, 3vw, 12.5px);
  font-weight: 300;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  color: var(--muted);
}

.next-btn {
  margin-top: 4px;
  padding: 12px 30px;
  border-radius: 999px;
  border: 1px solid rgba(var(--gold-rgb), 0.26);
  background: rgba(var(--cream-rgb), 0.025);
  backdrop-filter: blur(10px);
  color: rgba(var(--cream-rgb), 0.82);
  font-size: 11.5px;
  font-weight: 300;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
  transition:
    transform 0.5s var(--ease-luxe),
    background 0.5s var(--ease-luxe),
    border-color 0.5s var(--ease-luxe),
    color 0.5s var(--ease-luxe);
}
.next-btn::after {
  content: "↓";
  margin-left: 8px;
  font-size: 10px;
  color: rgba(var(--gold-rgb), 0.6);
  animation: bob 2.6s ease-in-out infinite;
}
.next-btn:hover {
  background: rgba(var(--gold-rgb), 0.08);
  border-color: rgba(var(--gold-rgb), 0.5);
  color: var(--cream);
}

/* ============================================================
 *  1. 封面
 * ============================================================ */

#s-cover {
  justify-content: center;
  gap: clamp(18px, 3.4vh, 28px);
}

/* 邀请函的双线画框 */
#s-cover::before,
#s-cover::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
#s-cover::before {
  inset: var(--cover-inset);
  border: 1px solid var(--line-2);
}
#s-cover::after {
  inset: calc(var(--cover-inset) + 6px);
  border: 1px solid var(--line-1);
}

.cover-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 3vh, 24px);
  transition:
    opacity 0.9s var(--ease-luxe),
    transform 1.1s var(--ease-luxe),
    filter 1.1s var(--ease-luxe);
}
#s-cover.opened .cover-inner {
  opacity: 0.12;
  transform: translateY(-38px) scale(0.965);
  filter: blur(4px);
}

/* 顶上那枚「徽章」：一圈细金线，中间一颗菱形 —— 不做 emoji 蛋糕 */
.cover-badge {
  order: -2;
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 40%, rgba(var(--gold-rgb), 0.1), transparent 72%);
  border: 1px solid rgba(var(--gold-rgb), 0.34);
  box-shadow:
    0 0 34px rgba(var(--gold-rgb), 0.14),
    inset 0 0 18px rgba(var(--gold-rgb), 0.07);
  animation: floaty 7s ease-in-out infinite;
}
.cover-badge::before {
  content: "✦";
  font-family: var(--font-title);
  font-size: 13px;
  line-height: 1;
  color: rgba(var(--gold-rgb), 0.88);
  filter: drop-shadow(0 0 8px rgba(var(--gold-rgb), 0.45));
}
.cover-badge::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1px solid var(--line-1);
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* 英文小字眉心：HAPPY BIRTHDAY */
.cover-inner::before {
  content: "HAPPY BIRTHDAY";
  order: -1;
  font-family: var(--font-title);
  font-size: clamp(8.5px, 2.4vw, 10px);
  letter-spacing: 0.56em;
  text-indent: 0.56em;
  color: rgba(var(--gold-rgb), 0.66);
}

.cover-title {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 500;
  font-size: clamp(40px, 13vw, 72px);
  line-height: 1.22;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  /* 香槟金箔：以象牙白为底，只在中间过一层金 —— 整段纯金会发土 */
  background: linear-gradient(
    96deg,
    #f9f4e9 0%,
    #f4ead6 26%,
    #e3c89a 44%,
    #f6efe0 56%,
    #f9f4e9 74%,
    #f9f4e9 100%
  );
  background-size: 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 2px 26px rgba(var(--gold-rgb), 0.18))
    drop-shadow(0 1px 0 rgba(0, 0, 0, 0.45));
  animation: titleIn 1.8s var(--ease-luxe) both, shimmer 16s linear 2.2s infinite;
}
@keyframes titleIn {
  from {
    opacity: 0;
    filter: blur(14px) drop-shadow(0 0 0 transparent);
    letter-spacing: 0.4em;
    transform: scale(1.04);
  }
  to {
    opacity: 1;
    filter: blur(0) drop-shadow(0 2px 26px rgba(var(--gold-rgb), 0.18))
      drop-shadow(0 1px 0 rgba(0, 0, 0, 0.45));
    letter-spacing: 0.18em;
    transform: scale(1);
  }
}
@keyframes shimmer {
  from { background-position: 240% 0; }
  to { background-position: -60% 0; }
}

.cover-sub {
  margin: 0;
  font-family: var(--font-title);
  font-size: clamp(12px, 3.4vw, 14px);
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: rgba(var(--cream-rgb), 0.66);
}

#who {
  font-family: var(--font-title);
  font-size: clamp(9.5px, 2.6vw, 10.5px);
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  color: rgba(var(--gold-rgb), 0.68);
}

.start-btn {
  position: relative;
  margin-top: 6px;
  padding: 15px 44px;
  border-radius: 999px;
  border: 1px solid rgba(var(--gold-rgb), 0.42);
  background: linear-gradient(135deg, rgba(var(--gold-rgb), 0.1), rgba(var(--gold-rgb), 0.025));
  color: var(--cream);
  font-size: clamp(11.5px, 3.2vw, 13px);
  font-weight: 300;
  letter-spacing: 0.36em;
  text-indent: 0.36em;
  backdrop-filter: blur(12px);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.5),
    0 0 0 6px rgba(var(--gold-rgb), 0.035),
    inset 0 1px 0 rgba(255, 248, 232, 0.1);
  transition:
    transform 0.5s var(--ease-luxe),
    box-shadow 0.5s var(--ease-luxe),
    background 0.5s var(--ease-luxe);
  animation: pulseGlow 3.6s ease-in-out infinite;
}
.start-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(var(--gold-rgb), 0.18), rgba(var(--gold-rgb), 0.05));
}
.start-btn:active { transform: scale(0.975); }
@keyframes pulseGlow {
  0%, 100% {
    box-shadow:
      0 18px 44px rgba(0, 0, 0, 0.5),
      0 0 0 6px rgba(var(--gold-rgb), 0.03),
      0 0 34px rgba(var(--gold-rgb), 0.1);
  }
  55% {
    box-shadow:
      0 18px 44px rgba(0, 0, 0, 0.5),
      0 0 0 12px rgba(var(--gold-rgb), 0.02),
      0 0 52px rgba(var(--gold-rgb), 0.18);
  }
}

.cover-hint {
  margin: 0;
  font-size: 10px;
  font-weight: 300;
  letter-spacing: 0.2em;
  color: var(--faint);
}

.scroll-hint {
  position: absolute;
  /* 跟着画框走：原来写死 26px，桌面端画框收到 54px 时，这行字就落到框外、
   * 又被暗角压住 —— 看起来像没对齐的残留 */
  bottom: calc(var(--cover-inset) + 22px);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 9.5px;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: var(--faint);
  animation: bob 3s ease-in-out infinite;
}
.scroll-hint::before {
  content: "";
  width: 1px;
  height: 24px;
  background: linear-gradient(180deg, transparent, rgba(var(--gold-rgb), 0.5));
}

/* ============================================================
 *  2. 照片轮播
 * ============================================================ */

#s-carousel { gap: clamp(12px, 2.4vh, 20px); }

/* 画框外面再套一圈细线，像装裱的卡纸 */
.frame {
  position: relative;
  width: min(88vw, 404px);
  padding: 0;
}
.frame::before {
  content: "";
  position: absolute;
  inset: -14px;
  border: 1px solid rgba(var(--gold-rgb), 0.1);
  pointer-events: none;
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 2px;
  overflow: hidden;
  background: #0b0908;
  box-shadow:
    0 34px 74px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(var(--gold-rgb), 0.18),
    0 0 70px rgba(var(--rose-rgb), 0.1);
  touch-action: pan-y;
  cursor: grab;
}
.stage:active { cursor: grabbing; }
/* 照片四周的压边，让亮部不至于「漏」到框外 */
.stage > .slide-wrap-guard { display: none; }

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.1s var(--ease-luxe);
  will-change: opacity;
}
.slide.on { opacity: 1; }

/* 这一条是这次顺带修掉的老毛病：
 * 原来 `.slide img{height:100%}` 里的 100% 找不到确定高度，
 * 于是竖构图的照片撑满、横构图的照片只剩中间一条（上下露黑底）。
 * 把外层的 .ph 撑成绝对定位，百分比高度才有参照物。 */
.slide .ph {
  position: absolute;
  inset: 0;
}
.slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: var(--ox, 50%) var(--oy, 50%);
  filter: saturate(0.94) contrast(1.04) brightness(0.97);
}
.slide.on img { animation: kenburns 13s ease-out both; }
@keyframes kenburns {
  from { transform: scale(1.01); }
  to   { transform: scale(1.1); }
}

/* 照片自身的上暗下暗，压住亮部、给说明文字留气口 */
.slide::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6, 5, 6, 0.28) 0%, transparent 26%, transparent 62%, rgba(6, 5, 6, 0.4) 100%);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.45);
}
.slide.broken::after {
  content: "🖼️  这张照片没加载出来";
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, var(--card-top), var(--card-bottom));
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.1em;
  box-shadow: none;
}

.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(var(--cream-rgb), 0.18);
  background: rgba(var(--ink-rgb), 0.42);
  backdrop-filter: blur(8px);
  color: rgba(var(--cream-rgb), 0.8);
  font-size: 15px;
  z-index: 3;
  transition:
    background 0.4s var(--ease-luxe),
    border-color 0.4s var(--ease-luxe),
    color 0.4s var(--ease-luxe),
    opacity 0.4s;
  opacity: 0.5;
}
.nav-arrow:hover {
  background: rgba(var(--ink-rgb), 0.72);
  border-color: rgba(var(--gold-rgb), 0.45);
  color: var(--cream);
  opacity: 1;
}
.nav-arrow:active { transform: translateY(-50%) scale(0.92); }
#prevBtn { left: -9px; }
#nextBtn { right: -9px; }

.caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  margin-top: 20px;
  min-height: 54px;
}
#capText {
  margin: 0;
  font-family: var(--font-title);
  font-size: clamp(14px, 3.8vw, 16px);
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  color: rgba(var(--cream-rgb), 0.9);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.7s var(--ease-luxe), transform 0.7s var(--ease-luxe);
}
#capText.show { opacity: 1; transform: none; }
#capCount {
  font-family: var(--font-title);
  font-size: 9.5px;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: rgba(var(--gold-rgb), 0.55);
  font-variant-numeric: tabular-nums;
}

.progress {
  width: min(52vw, 170px);
  height: 1px;
  border-radius: 0;
  background: rgba(var(--cream-rgb), 0.12);
  overflow: hidden;
}
#capBar {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, rgba(var(--gold-rgb), 0.15), rgb(var(--gold-rgb)));
}

.dots {
  display: flex;
  align-items: center;
  gap: 11px;
}
.dot {
  width: 4px;
  height: 4px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(var(--cream-rgb), 0.26);
  transform: rotate(45deg);
  transition: all 0.55s var(--ease-luxe);
}
.dot.on {
  width: 4px;
  border-radius: 0;
  background: rgb(var(--gold-rgb));
  box-shadow: 0 0 6px rgba(var(--gold-rgb), 0.65);
}

/* ============================================================
 *  3. 祝福信：一封真的信，不是一块玻璃
 * ============================================================ */

#s-letter { gap: clamp(14px, 3vh, 24px); }

.paper {
  position: relative;
  width: min(92vw, 540px);
  padding: clamp(32px, 7vw, 52px) clamp(24px, 6vw, 46px) clamp(38px, 8vw, 54px);
  border-radius: 2px;
  background:
    radial-gradient(130% 100% at 18% 0%, #fbf6ea 0%, #f4ebda 52%, #ebdfc8 100%);
  border: 1px solid rgba(176, 138, 82, 0.42);
  box-shadow:
    0 44px 90px rgba(0, 0, 0, 0.66),
    0 2px 0 rgba(255, 252, 244, 0.06),
    inset 0 0 70px rgba(126, 96, 48, 0.08);
  text-align: left;
}
/* 信纸里的一道内框 */
.paper::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid var(--paper-line);
  pointer-events: none;
}
/* 纸的纤维感：叠一层极淡的噪点 */
.paper::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

#letterBody {
  position: relative;
  z-index: 1;
  min-height: 11em;
  font-family: var(--font-title);
  font-size: clamp(14.5px, 3.8vw, 16px);
  line-height: 2;
  letter-spacing: 0.06em;
  color: var(--paper-ink);
  word-break: break-word;
}
#letterBody .line { white-space: pre-wrap; }

.caret {
  display: inline-block;
  width: 1px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -0.16em;
  background: rgba(154, 112, 54, 0.85);
  animation: blink 1.05s steps(2, start) infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

#letterSign {
  position: relative;
  z-index: 1;
  margin-top: 34px;
  padding-right: 6px;
  text-align: right;
  font-family: var(--font-kai);
  font-size: clamp(13.5px, 3.6vw, 15px);
  letter-spacing: 0.18em;
  color: #7d5c31;
  opacity: 0;
  transform: translateX(14px);
  transition: opacity 1s var(--ease-luxe), transform 1s var(--ease-luxe);
}
#letterSign.in { opacity: 1; transform: none; }

/* 火漆印：半压在信纸右下角上。纯装饰，pointer-events:none。
 * 颜色压到暗赤陶（#6d3a34 系）而不是亮玫瑰红 —— 亮红会在黑金页面里
 * 变成第二个「彩色焦点」，那种红像贴纸。 */
#letterSign::after {
  content: "✦";
  position: absolute;
  right: 0;
  bottom: -30px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-title);
  font-size: 10px;
  color: rgba(240, 220, 186, 0.8);
  text-indent: 0;
  background: radial-gradient(circle at 34% 28%, #6d3a34 0%, #4a2320 58%, #2c1413 100%);
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.5),
    inset 0 1px 2px rgba(255, 190, 180, 0.16),
    inset 0 -2px 4px rgba(0, 0, 0, 0.4);
  transform: rotate(-7deg);
  pointer-events: none;
}

/* ============================================================
 *  4. 照片墙
 * ============================================================ */

#s-wall {
  justify-content: flex-start;
  padding-top: calc(var(--pad) + 58px);
}

.wall {
  --wall-gap: 8px;
  width: min(92vw, 680px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--wall-gap);
}
/* 用 flex + 百分比宽度而不是 grid：最后一行不满时**居中**，
 * 不会留下「3+3+2，右边空一格」那种像没做完的缺口。
 * 8 张照片是最常见的数量，grid 三列刚好会碰上这个缺口。 */
.cell,
.wall > * {
  width: calc((100% - var(--wall-gap) * 2) / 3);
}
@media (min-width: 640px) {
  .wall { --wall-gap: 10px; }
  .cell,
  .wall > * { width: calc((100% - var(--wall-gap) * 3) / 4); }
}
/* 正好 8 张时，最后两张放大成半幅 —— 与其留一个「缺一格」的空档，
 * 不如让它们看起来是特意排版的一对。其它张数不受影响。 */
@media (max-width: 639px) {
  .wall > .cell:nth-child(7):nth-last-child(2),
  .wall > .cell:nth-child(8):nth-last-child(1) {
    width: calc((100% - var(--wall-gap)) / 2);
  }
}

.cell {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 1px;
  overflow: hidden;
  background: #0b0908;
  /* 黑底上一大片黑色投影等于没有，只剩一圈金线在撑形体 —— 那才是相框 */
  box-shadow: 0 0 0 1px rgba(var(--gold-rgb), 0.22);
  transition:
    transform 0.6s var(--ease-luxe),
    box-shadow 0.6s var(--ease-luxe);
}
.cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.95) contrast(1.03) brightness(0.97);
  transition: transform 0.9s var(--ease-luxe), filter 0.6s var(--ease-luxe);
}
.cell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 248, 232, 0.05);
}
.cell:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(var(--gold-rgb), 0.55),
    0 18px 36px rgba(0, 0, 0, 0.55);
}
.cell:hover img { transform: scale(1.06); }
.cell:active { transform: scale(0.985); }
.cell.broken::after {
  content: "🖼️";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: linear-gradient(150deg, var(--card-top), var(--card-bottom));
  box-shadow: none;
}

/* ============================================================
 *  5. 许愿 / 吹蜡烛
 * ============================================================ */

.cake-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(18px, 4vh, 30px);
}
/* 蛋糕背后的一团暖光，把主体从黑底里托起来 */
.cake-wrap::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 44%;
  width: min(100vw, 420px);
  height: 360px;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(var(--gold-rgb), 0.11), transparent 74%);
  pointer-events: none;
}

.cake {
  position: relative;
  width: min(64vw, 250px);
  height: 278px;
  filter: drop-shadow(0 22px 30px rgba(0, 0, 0, 0.5));
}

.cake .layer {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 3px;
  box-shadow:
    inset 0 -12px 22px rgba(0, 0, 0, 0.14),
    inset 0 2px 0 rgba(255, 252, 244, 0.5),
    0 4px 14px rgba(0, 0, 0, 0.26);
}
/* 每层顶边上的一排金珠（糖珠）。放在「顶边」而不是底边，
 * 是因为上层会盖住下层的底边 —— 这是当初三层的 ::before 只有
 * 最下面那层看得见的原因。压到 0.22：那排亮点一清楚，
 * 「免费矢量蛋糕」的味道就出来了。 */
.cake .layer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -2px;
  height: 5px;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 243, 219, 0.9) 0 1px, transparent 1.5px) 0 0 / 8px 5px repeat-x,
    linear-gradient(180deg, rgba(var(--gold-rgb), 0.5), rgba(var(--gold-rgb), 0.05));
  opacity: 0.22;
}
/* 只有最上一层需要「顶面」：下面几层都被上面那层盖住了 */
.cake .layer.l3::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -5px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(50% 100% at 50% 55%, #fffdf6 0%, rgba(255, 251, 242, 0.6) 55%, transparent 100%);
  opacity: 0.75;
}
/* 三层的渐变都带一层左右暗边 —— 不然就是三个纯色方块 */
.layer.l1 {
  width: 100%;
  height: 74px;
  bottom: 18px;
  background-image:
    linear-gradient(90deg, rgba(60, 44, 28, 0.24), transparent 14%, transparent 86%, rgba(60, 44, 28, 0.28)),
    linear-gradient(180deg, var(--cake-1a), var(--cake-1b) 72%, var(--cake-1c));
}
.layer.l2 {
  width: 78%;
  height: 60px;
  bottom: 92px;
  background-image:
    linear-gradient(90deg, rgba(60, 44, 28, 0.22), transparent 14%, transparent 86%, rgba(60, 44, 28, 0.26)),
    linear-gradient(180deg, var(--cake-2a), var(--cake-2b) 72%, var(--cake-2c));
}
.layer.l3 {
  width: 56%;
  height: 50px;
  bottom: 152px;
  background-image:
    linear-gradient(90deg, rgba(60, 44, 28, 0.2), transparent 14%, transparent 86%, rgba(60, 44, 28, 0.24)),
    linear-gradient(180deg, var(--cake-3a), var(--cake-3b) 72%, var(--cake-3c));
}

/* 深色石盘 + 金边 */
.cake .plate {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 4px;
  width: 116%;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(50% 100% at 50% 36%, #2b2523 0%, #15100e 70%, #0b0807 100%);
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(var(--gold-rgb), 0.16),
    inset 0 1px 0 rgba(var(--gold-rgb), 0.38);
}

.candles {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 202px;
  display: flex;
  gap: 20px;
}

.candle {
  position: relative;
  width: 5px;
  height: 50px;
  border-radius: 2px;
  /* 纯色，不要斜纹：5px 宽的斜纹只会被读成「糖果棒」 */
  background: linear-gradient(180deg, #f6eede, #eadfc8);
  box-shadow:
    inset -1px 0 2px rgba(0, 0, 0, 0.22),
    0 2px 8px rgba(0, 0, 0, 0.35);
}
.candle::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 1.5px;
  height: 6px;
  background: var(--wick);
}

.flame {
  position: absolute;
  top: -20px;
  left: 50%;
  width: 9px;
  height: 15px;
  margin-left: -4.5px;
  border-radius: 50% 50% 46% 46% / 62% 62% 38% 38%;
  background: radial-gradient(
    circle at 50% 74%,
    var(--flame-core) 0 22%,
    var(--flame-mid) 42%,
    var(--flame-outer) 74%,
    var(--flame-edge) 100%
  );
  box-shadow:
    0 0 9px var(--flame-glow-1),
    0 0 20px var(--flame-glow-2);
  transform-origin: 50% 90%;
  animation: flicker 1.8s ease-in-out infinite;
}
.flame::after {
  content: "";
  position: absolute;
  inset: -34% -78% 20% -78%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--flame-halo), transparent 70%);
}
@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(-1.5deg); opacity: 1; }
  25% { transform: scale(1.05, 0.95) rotate(1.4deg); opacity: 0.94; }
  50% { transform: scale(0.95, 1.06) rotate(-0.8deg); opacity: 1; }
  75% { transform: scale(1.02, 0.98) rotate(2deg); opacity: 0.96; }
}

.smoke {
  position: absolute;
  top: -18px;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: var(--smoke);
  filter: blur(3px);
  opacity: 0;
}

.cake.blown-out .flame { animation: blowOut 0.6s var(--ease-luxe) forwards; }
@keyframes blowOut {
  0% { transform: scale(1); opacity: 1; }
  35% { transform: scale(1.35, 0.5) translateX(3px); opacity: 0.8; }
  100% { transform: scale(0.2, 0.1) translateX(6px); opacity: 0; }
}
.cake.blown-out .smoke { animation: smokeUp 2.8s ease-out 0.3s forwards; }
@keyframes smokeUp {
  0% { opacity: 0; transform: translateY(0) scale(0.6); }
  25% { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-60px) scale(2.4); }
}

.blow-btn {
  position: relative;
  z-index: 1;
  padding: 13px 34px;
  border-radius: 999px;
  border: 1px solid rgba(var(--gold-rgb), 0.36);
  background: linear-gradient(135deg, var(--blow-grad-a), rgba(var(--rose-rgb), 0.06));
  color: rgba(var(--cream-rgb), 0.9);
  font-size: clamp(12px, 3.4vw, 13px);
  font-weight: 300;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.45);
  transition:
    transform 0.45s var(--ease-luxe),
    opacity 0.6s var(--ease-luxe),
    background 0.45s var(--ease-luxe);
}
.blow-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(var(--gold-rgb), 0.2), rgba(var(--rose-rgb), 0.08));
}
.blow-btn:active:not(:disabled) { transform: scale(0.975); }
.blow-btn:disabled { opacity: 0.3; cursor: default; }

.wish-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  transition: opacity 1.1s var(--ease-luxe), transform 1.1s var(--ease-luxe);
}
.wish-done.in { opacity: 1; transform: none; }
.wish-done h3 {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 500;
  font-size: clamp(19px, 5.4vw, 25px);
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  color: var(--cream);
  background: linear-gradient(96deg, #f9f4e9, #e3c89a 46%, #f6efe0 74%, #f9f4e9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 20px rgba(var(--gold-rgb), 0.26));
}
.wish-done p {
  margin: 0;
  font-size: 11.5px;
  font-weight: 300;
  letter-spacing: 0.22em;
  color: var(--muted);
}

/* ============================================================
 *  6. 结尾
 * ============================================================ */

#s-finale { gap: clamp(14px, 2.8vh, 22px); }

.heart-btn {
  position: relative;
  width: clamp(92px, 24vw, 122px);
  height: clamp(92px, 24vw, 122px);
  padding: 0;
  border: 0;
  background: none;
  display: grid;
  place-items: center;
  transition: transform 0.4s var(--ease-luxe);
}
.heart-btn:active { transform: scale(0.92); }
.heart-btn svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 12px 36px rgba(var(--gold-rgb), 0.24));
  animation: heartPulse 3.2s ease-in-out infinite;
}
/* 描一条细边，让它像一枚压印出来的徽章，而不是一块渐变色块 */
.heart-btn svg path {
  stroke: rgba(255, 248, 232, 0.28);
  stroke-width: 0.6;
}
/* 三档金箔：浅金 → 香槟 → 深金。
 *
 * 必须 !important：模板 HTML 里那三个 <stop> 写的是**内联** style
 * （`style="stop-color: var(--gold)"`），内联样式优先级高于这张表里的
 * 任何选择器。不加 !important，金箔根本不生效 —— 页面上唯一一块饱和色
 * 就还是原来那条 gold→rose→lilac 的珊瑚渐变。 */
.heart-btn #hg stop:nth-child(1) { stop-color: #fdf0cd !important; }
.heart-btn #hg stop:nth-child(2) { stop-color: #ddb268 !important; }
.heart-btn #hg stop:nth-child(3) { stop-color: #9c6f2e !important; }
@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.06); }
  26% { transform: scale(1); }
  40% { transform: scale(1.03); }
}
.heart-btn.beat svg { animation: none; }
.heart-btn.beat { animation: heartPop 0.7s var(--ease-luxe); }
@keyframes heartPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.finale-title {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 500;
  font-size: clamp(30px, 8.6vw, 44px);
  line-height: 1.25;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  background: linear-gradient(96deg, #f9f4e9 0%, #f3e6cd 30%, #e0c397 50%, #f5eddf 70%, #f9f4e9 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 2px 24px rgba(var(--gold-rgb), 0.18));
  animation: shimmer 18s linear infinite;
}

.secret {
  display: none;
  width: min(86vw, 440px);
  padding: 20px 24px;
  border-radius: 1px;
  border: 1px solid var(--line-2);
  background: rgba(var(--cream-rgb), 0.025);
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.42);
}
/* 没点亮之前整块收起来。原来只把 opacity 设 0，它仍然占着约 160px 的
 * 高度 —— 「轻触这颗心」和落款之间就空出一个不知道为什么的空洞。 */
.secret.in {
  display: block;
  animation: secretIn 1.1s var(--ease-luxe) both;
}
@keyframes secretIn {
  from { opacity: 0; transform: translateY(14px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
.secret .line {
  display: block;
  font-family: var(--font-title);
  font-size: clamp(13.5px, 3.8vw, 15px);
  line-height: 2.1;
  letter-spacing: 0.12em;
  color: rgba(var(--cream-rgb), 0.82);
}

#s-finale .section-sub {
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: rgba(var(--gold-rgb), 0.62);
}

.replay-btn {
  padding: 11px 28px;
  border-radius: 999px;
  border: 1px solid rgba(var(--cream-rgb), 0.18);
  background: transparent;
  color: rgba(var(--cream-rgb), 0.6);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  transition: all 0.45s var(--ease-luxe);
}
.replay-btn:hover {
  color: var(--cream);
  border-color: rgba(var(--gold-rgb), 0.45);
  background: rgba(var(--gold-rgb), 0.06);
}

/* ============================================================
 *  固定控件：导航、音乐、提示、二维码、大图查看
 * ============================================================ */

#navDots { gap: 16px; }

/* 导航点改成一根竖线 —— 点是小圆点，线是「页码」 */
.navdot {
  gap: 12px;
  opacity: 0.38;
  transition: opacity 0.5s var(--ease-luxe);
}
.navdot i {
  width: 1px;
  height: 12px;
  border-radius: 0;
  background: rgba(var(--gold-rgb), 0.42);
  transition: all 0.5s var(--ease-luxe);
}
.navdot span {
  font-family: var(--font-title);
  font-size: 9.5px;
  letter-spacing: 0.26em;
  color: rgba(var(--gold-rgb), 0.7);
}
.navdot.on { opacity: 1; }
.navdot.on i {
  height: 26px;
  background: linear-gradient(180deg, rgba(var(--gold-rgb), 0.25), rgb(var(--gold-rgb)));
  transform: none;
  box-shadow: 0 0 12px rgba(var(--gold-rgb), 0.45);
}

/* 音乐钮挪进画框：原来 top/right 14px 落在双线框外面，框线从圆里穿过去，
 * 一眼就是「层没对齐」。inset + 10px 正好把 40px 的圆放进线内。 */
#musicBtn {
  top: calc(var(--cover-inset) + 10px);
  right: calc(var(--cover-inset) + 10px);
  width: 40px;
  height: 40px;
  border: 1px solid rgba(var(--gold-rgb), 0.24);
  background: rgba(var(--ink-rgb), 0.5);
  backdrop-filter: blur(12px);
  color: rgba(var(--cream-rgb), 0.6);
  transition: all 0.45s var(--ease-luxe);
}
#musicBtn:hover {
  color: var(--cream);
  border-color: rgba(var(--gold-rgb), 0.5);
}
#musicBtn .bars { gap: 2.5px; height: 13px; }
#musicBtn .bars i { width: 2px; height: 4px; border-radius: 0; }
#musicBtn.on {
  color: rgb(var(--gold-rgb));
  border-color: rgba(var(--gold-rgb), 0.55);
  box-shadow: 0 0 22px rgba(var(--gold-rgb), 0.18);
}
@keyframes eq {
  0%, 100% { height: 3px; }
  50% { height: 13px; }
}

#hint {
  border: 1px solid rgba(var(--gold-rgb), 0.28);
  background: rgba(8, 7, 10, 0.92);
  backdrop-filter: blur(14px);
  color: rgba(var(--cream-rgb), 0.82);
  font-size: 11px;
  letter-spacing: 0.08em;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}
#hint code {
  background: rgba(var(--cream-rgb), 0.09);
  border-radius: 2px;
  font-size: 10.5px;
}

#qrCard {
  border-radius: 2px;
  border: 1px solid rgba(176, 138, 82, 0.5);
  background: var(--card-light);
  color: var(--card-light-ink);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
  padding: 14px;
}
#qrCard img { width: 128px; height: 128px; }
#qrCard p {
  font-family: var(--font-title);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: #4a3b2a;
}

#lightbox {
  background: rgba(4, 3, 4, 0.97);
  backdrop-filter: blur(18px);
}
#lbImg {
  border-radius: 2px;
  box-shadow:
    0 40px 90px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(var(--gold-rgb), 0.22);
}
#lbCap {
  font-family: var(--font-title);
  font-size: 13px;
  letter-spacing: 0.2em;
  color: rgba(var(--cream-rgb), 0.66);
}
#lbClose, #lbPrev, #lbNext {
  border: 1px solid rgba(var(--cream-rgb), 0.16);
  background: rgba(var(--cream-rgb), 0.05);
  color: rgba(var(--cream-rgb), 0.82);
  transition: background 0.35s, border-color 0.35s;
}
#lbClose:hover, #lbPrev:hover, #lbNext:hover {
  background: rgba(var(--gold-rgb), 0.12);
  border-color: rgba(var(--gold-rgb), 0.4);
}

/* ============================================================
 *  窄屏 / 宽屏 / 降级
 * ============================================================ */

@media (max-width: 400px) {
  :root { --cover-inset: 12px; }
  .wall { --wall-gap: 6px; }
  .nav-arrow { display: none; }
  .candles { gap: 17px; }
}

/* ============================================================
 *  矮屏（iPhone SE / 老安卓，667 高左右）
 *
 *  轮播和照片墙在 390×844 是舒服的，但到 667 高就会比一屏多出几十像素。
 *  这里有 scroll-snap-stop: always，多出来的那截会让人「划不动、也看不全」，
 *  所以矮屏要主动缩一档，而不是指望用户去抠。
 * ============================================================ */

@media (max-height: 730px) and (max-width: 899px) {
  #s-carousel { gap: 10px; }
  .frame { width: min(74vw, 330px); }
  .caption { margin-top: 12px; min-height: 46px; }
  #capText { font-size: 14px; }

  #s-wall { padding-top: calc(var(--pad) + 34px); gap: 10px; }
  /* 矮屏用 4 列：8 张照片正好两行，比「3+3+2 爬出屏幕」干净 */
  .wall { --wall-gap: 7px; }
  .cell,
  .wall > * { width: calc((100% - var(--wall-gap) * 3) / 4); }
  .wall > .cell:nth-child(7):nth-last-child(2),
  .wall > .cell:nth-child(8):nth-last-child(1) {
    width: calc((100% - var(--wall-gap) * 3) / 4);
  }
}

@media (min-width: 900px) {
  /* 桌面端不能只是「手机版放大」：画框往里收，字往上抬一档 */
  :root { --cover-inset: clamp(40px, 6vh, 72px); }
  .cover-title { font-size: clamp(64px, 7vw, 104px); }
  .paper { width: min(76vw, 520px); }
  #letterBody { font-size: 17px; }
  /* 420px 宽的 4:5 画框是 525px 高，在 720p 的笔记本上会把「继续」挤出屏幕。
   * 用 vh 兜一个上限：矮屏自动窄一档，宽屏还是原来的大小。 */
  .frame { width: min(80vw, 420px, 46vh); }
  #prevBtn { left: -54px; }
  #nextBtn { right: -54px; }
  .nav-arrow { opacity: 0.62; }
}

@media (prefers-reduced-motion: reduce) {
  /* 通配规则会把动画压到 0.001ms，transform 会停起始帧 ——
   * 推近停在 1.01 倍、进场停在模糊上，都比不动更怪，所以这里给静止值。 */
  .slide.on img { animation: none; transform: scale(1.03); }
  [data-reveal] { filter: none; }
  .cover-title { animation: none; }
  .start-btn { animation: none; }
  .heart-btn svg { animation: none; }
  body::before { animation: none; }
  .scroll-hint { animation: none; }
}
