/* ============================================================
   生日网站样式 —— 「午夜手帐 / Midnight Keepsake」
   墨蓝纸面 · 象牙文字 · 黄铜点缀 · 宋体标题 · 细线编辑排版
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --ink-0: #1b1428;
  --ink-1: #241a36;
  --ink-2: #2e2244;
  --ink-3: #3c2c58;
  --paper: #fff4e6;
  --text-main: #f7eadf;
  --text-dim: #c0acb9;

  --brass: #e9b96e;
  --brass-soft: #f6d49e;
  --blush: #f3a8c0;
  --rose: #e88aa9;
  --vermilion: #d96a5a;

  --hairline: rgba(255, 240, 228, .15);
  --hairline-strong: rgba(255, 240, 228, .3);

  /* 兼容旧变量名 */
  --bg-deep: var(--ink-0);
  --bg-mid: var(--ink-2);
  --neon-cyan: var(--brass-soft);
  --neon-pink: var(--vermilion);
  --neon-purple: #8b8577;
  --neon-gold: var(--brass-soft);
  --gold-soft: var(--brass-soft);
  --soft: var(--paper);

  --font-ui: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-display: "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
  --font-mono: "SF Mono", "Cascadia Mono", "Consolas", "Menlo", monospace;

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

html { height: 100%; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background:
    radial-gradient(ellipse 90% 62% at 50% -12%, #563d70 0%, transparent 62%),
    radial-gradient(ellipse 75% 50% at 12% 18%, rgba(243, 168, 192, .22), transparent 62%),
    radial-gradient(ellipse 70% 45% at 88% 28%, rgba(233, 185, 110, .17), transparent 62%),
    radial-gradient(ellipse 80% 40% at 50% 104%, rgba(243, 168, 192, .14), transparent 64%),
    linear-gradient(180deg, #33264a 0%, var(--ink-0) 78%);
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  user-select: none;
  -webkit-user-select: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
}

/* 柔和暗角，保留呼吸感 */
body::before {
  content: "";
  position: fixed; inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse 100% 80% at 50% 40%, transparent 58%, rgba(18, 11, 26, .28) 100%);
}

/* 纸张颗粒 */
body::after {
  content: "";
  position: fixed; inset: 0;
  z-index: 2;
  pointer-events: none;
  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='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

@supports (height: 100dvh) {
  body { height: 100dvh; }
  #app { height: 100dvh; }
}

canvas#bg-particles, canvas#fx-layer {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
canvas#bg-particles { z-index: 0; opacity: .55; }
canvas#fx-layer { z-index: 50; }

#app { position: relative; z-index: 10; height: 100%; }

::selection { background: rgba(233, 185, 110, .3); color: var(--paper); }
:focus-visible { outline: 1px solid var(--brass); outline-offset: 4px; }

/* ============ 场景 ============ */
.scene {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column; align-items: center;
  padding:
    max(24px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.scene.active {
  display: flex;
  animation: scene-in .45s var(--ease-out) both;
}
@keyframes scene-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.scene-title {
  position: relative;
  width: 100%; max-width: 420px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 27px;
  letter-spacing: 2px;
  line-height: 1.4;
  color: var(--paper);
  text-align: left;
}
/* 章节号：只用数字，避免模板化的英文小标题 */
.scene-title::before {
  display: block;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: .3em;
  color: var(--brass);
}
#scene-gifts .scene-title::before { content: "01"; }
#scene-quiz .scene-title::before { content: "02"; }
#scene-cake .scene-title::before { content: "05"; }
#scene-fireworks .scene-title::before { content: "06"; }
.scene-title::after {
  content: "";
  display: block;
  width: 38px; height: 1px;
  margin-top: 14px;
  background: linear-gradient(90deg, rgba(233, 185, 110, .75), transparent);
}
.scene-desc {
  width: 100%; max-width: 420px;
  margin-top: 12px; margin-bottom: 24px;
  color: var(--text-dim);
  font-size: 12.5px;
  letter-spacing: .5px;
  text-align: left;
}
/* 仪式感场景：标题与内容一起居中 */
#scene-cake .scene-title, #scene-cake .scene-desc,
#scene-fireworks .scene-title, #scene-fireworks .scene-desc { text-align: center; }
#scene-cake .scene-title::after,
#scene-fireworks .scene-title::after { margin-left: auto; margin-right: auto; }
.scene-footer { height: 80px; display: flex; align-items: center; justify-content: center; }

.hidden { display: none !important; }

/* ============ 按钮 ============ */
.btn-neon {
  appearance: none;
  padding: 12px 30px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .14em;
  color: #3d2717;
  background: linear-gradient(180deg, #f9ddb0, var(--brass));
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 999px;
  cursor: pointer;
  box-shadow:
    0 12px 28px -16px rgba(233, 185, 110, .9),
    inset 0 1px 0 rgba(255, 255, 255, .6);
  transition: transform .18s, box-shadow .28s, filter .28s;
}
@media (hover: hover) and (pointer: fine) {
  .btn-neon:hover {
    filter: brightness(1.06);
    box-shadow:
      0 16px 34px -14px rgba(233, 185, 110, 1),
      inset 0 1px 0 rgba(255, 255, 255, .7);
  }
}
.btn-neon:active { transform: translateY(1px) scale(.99); }
.btn-neon:disabled { opacity: .45; cursor: default; }

.btn-ghost {
  appearance: none;
  padding: 9px 2px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  letter-spacing: .1em;
  color: var(--blush);
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(243, 168, 192, .45);
  border-radius: 0;
  cursor: pointer;
  transition: color .25s, border-color .25s;
}
@media (hover: hover) and (pointer: fine) {
  .btn-ghost:hover { color: #ffd7e4; border-color: var(--blush); }
}
.btn-ghost:active { transform: translateY(1px); }

/* ============ 场景 0：开场（扉页式） ============ */
.intro-wrap {
  flex: 1; width: 100%; max-width: 820px;
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center;
  text-align: left;
  padding: 5vh 0 3vh;
}

.orbit { position: relative; width: 64px; height: 64px; margin-bottom: 30px; flex: none; }
.orbit-ring {
  position: absolute; inset: 0;
  border: 1px solid rgba(255, 240, 228, .26);
  border-radius: 50%;
}
.orbit-ring::before {
  content: "";
  position: absolute; top: -2.5px; left: 50%;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--blush);
  transform: translateX(-50%);
}
.orbit-ring::after {
  content: "";
  position: absolute; inset: 6px;
  border: 1px dashed rgba(233, 185, 110, .34);
  border-radius: 50%;
  animation: spin 36s linear infinite;
}
.orbit-emoji {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .4));
  animation: floaty 4s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.neon-title {
  max-width: 12em;
  margin-bottom: 22px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(38px, 7.4vw, 76px);
  letter-spacing: .04em;
  line-height: 1.2;
  color: var(--paper);
  text-shadow: 0 2px 40px rgba(0, 0, 0, .55);
  animation: intro-reveal 1s var(--ease-out) both;
}
@keyframes intro-reveal {
  from { opacity: 0; transform: translateY(10px); letter-spacing: .12em; }
  to { opacity: 1; transform: none; letter-spacing: .04em; }
}
.neon-sub {
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .42em;
  text-transform: uppercase;
  color: var(--brass);
}
.hint-text {
  margin-bottom: 44px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .28em;
  color: var(--text-dim);
}
.intro-wrap .btn-neon { align-self: flex-start; }

/* ============ 场景 1：拆礼物 ============ */
.gift-grid {
  width: 100%; max-width: 420px;
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.gift-box {
  position: relative;
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(165deg, rgba(243, 168, 192, .16), rgba(233, 185, 110, .09) 62%, rgba(255, 255, 255, .02));
  border: 1px solid rgba(243, 168, 192, .3);
  border-radius: 14px;
  cursor: pointer;
  box-shadow:
    0 16px 32px -26px rgba(0, 0, 0, .95),
    inset 0 1px 0 rgba(255, 255, 255, .14);
  animation: gift-bob 3s ease-in-out infinite;
  transition: border-color .3s, background .3s, opacity .35s, box-shadow .3s;
}
.gift-box::before {
  content: "";
  position: absolute; top: 9px; right: 9px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(255, 244, 230, .5);
}
.gift-box:nth-child(2n) {
  animation-delay: .5s;
  border-color: rgba(233, 185, 110, .32);
}
.gift-box:nth-child(3n) { animation-delay: 1s; }
.gift-emoji {
  font-size: 38px;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .35));
}
.gift-box small {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: .14em;
  color: var(--text-dim);
}
@media (hover: hover) and (pointer: fine) {
  .gift-box:hover {
    border-color: rgba(243, 168, 192, .65);
    box-shadow: 0 20px 38px -24px rgba(243, 168, 192, .6), inset 0 1px 0 rgba(255, 255, 255, .2);
  }
}
.gift-box:active { transform: scale(.97); }
.gift-box.opened { opacity: .38; animation: none; pointer-events: none; }
.gift-box.shake { animation: gift-shake .5s; }
@keyframes gift-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes gift-shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-5deg); } 40% { transform: rotate(5deg); }
  60% { transform: rotate(-3deg); } 80% { transform: rotate(3deg); }
}

/* 礼物弹窗 */
.modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: rgba(27, 20, 40, .82);
  opacity: 0; transition: opacity .3s;
}
.modal.show { opacity: 1; }
.modal-card {
  position: relative;
  width: min(84vw, 340px);
  padding: 34px 28px 30px;
  text-align: center;
  background: linear-gradient(165deg, #fff7ec, #f8e4da);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 18px;
  box-shadow:
    0 40px 80px -34px rgba(0, 0, 0, .7),
    0 0 70px -22px rgba(243, 168, 192, .65);
  transform: translateY(10px);
  transition: transform .38s var(--ease-out);
}
.modal.show .modal-card { transform: none; }
.modal-card::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(243, 168, 192, .85), transparent);
}
.modal-emoji {
  width: 70px; height: 70px;
  margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  background: rgba(243, 168, 192, .16);
  border: 1px solid rgba(217, 106, 90, .3);
  border-radius: 50%;
}
.modal-title {
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .28em;
  color: #b06a4a;
}
.modal-msg {
  margin-bottom: 26px;
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.95;
  color: #3d2f2a;
}
.modal-card .btn-ghost { color: #b0685f; border-color: rgba(176, 104, 95, .4); }

/* ============ 场景 2：答题 ============ */
.quiz-progress {
  width: 100%; max-width: 420px;
  display: flex; gap: 6px;
  margin-bottom: 22px;
}
.quiz-progress i {
  width: 26px; height: 2px;
  background: rgba(255, 240, 228, .16);
  transition: background .35s;
}
.quiz-progress i.done { background: rgba(233, 185, 110, .75); }
.quiz-progress i.current { background: var(--paper); }

.quiz-card {
  counter-reset: opt;
  width: 100%; max-width: 420px;
  padding: 26px 24px 22px;
  background: linear-gradient(165deg, rgba(255, 240, 228, .075), rgba(243, 168, 192, .035));
  border: 1px solid rgba(255, 240, 228, .18);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}
.quiz-q {
  margin-bottom: 18px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.75;
  letter-spacing: .3px;
  color: var(--paper);
}
.quiz-opt {
  counter-increment: opt;
  display: flex; align-items: baseline; gap: 14px;
  width: 100%; padding: 14px 2px;
  font-family: var(--font-ui);
  font-size: 14px;
  text-align: left;
  color: var(--text-main);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  cursor: pointer;
  transition: color .22s, padding-left .25s, background .22s;
}
.quiz-opt::before {
  content: counter(opt, upper-alpha);
  flex: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--brass);
}
.quiz-opt:last-of-type { border-bottom: none; }
@media (hover: hover) and (pointer: fine) {
  .quiz-opt:hover { color: var(--paper); padding-left: 8px; background: rgba(255, 240, 228, .035); }
}
.quiz-opt:active { background: rgba(255, 240, 228, .05); }
.quiz-opt.right { color: var(--brass-soft); background: rgba(233, 185, 110, .07); }
.quiz-opt.wrong { color: #d98a76; background: rgba(217, 106, 90, .08); animation: gift-shake .4s; }
.quiz-tip {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .14em;
  color: var(--text-dim);
}
.quiz-feedback {
  min-height: 20px;
  margin-top: 10px;
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--brass-soft);
  text-align: center;
}

/* ============ 场景 3：关于你的特别档案 ============ */
.dossier {
  flex: 1; width: 100%; max-width: 520px;
  display: flex; flex-direction: column;
}
.dossier-head { text-align: left; padding: 12px 0 22px; }
.dossier .scene-title { max-width: none; text-align: left; font-size: 25px; letter-spacing: 5px; }
.dossier .scene-title::before { content: "03"; }
.dossier .scene-title::after {
  margin-left: 0; margin-right: auto;
  background: linear-gradient(90deg, rgba(233, 185, 110, .7), transparent);
}
.dossier-kicker {
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .4em;
  color: var(--brass);
}
.dossier-progress {
  display: inline-block;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .3em;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.dossier-body { flex: none; }
.dossier .scene-footer { margin-top: 10px; }

.dossier-chapter { animation: dz-in .55s var(--ease-out) both; }
@keyframes dz-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; } }
.dz-label {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .3em;
  color: var(--text-dim);
}
.dz-label::before {
  content: "";
  width: 16px; height: 1px; flex: none;
  background: rgba(233, 185, 110, .7);
}

/* 第一章 */
.dz-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 7.8vw, 44px);
  letter-spacing: .1em;
  color: var(--paper);
  animation: dz-in .55s .08s ease both;
}
.dz-code {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .22em;
  color: var(--brass);
  border: 1px solid rgba(233, 185, 110, .3);
  border-radius: 999px;
  animation: dz-in .55s .2s ease both;
}
.dz-tags { display: flex; gap: 8px; justify-content: flex-start; flex-wrap: wrap; margin: 20px 0 6px; }
.dz-tags span {
  padding: 5px 11px;
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--text-main);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  animation: dz-in .45s ease both;
}
.dz-tags span:nth-child(2) { animation-delay: .3s; }
.dz-tags span:nth-child(3) { animation-delay: .4s; }
.dz-fields { margin-top: 22px; text-align: left; }
.dz-field {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
  animation: dz-in .45s ease both;
}
.dz-field:nth-child(1) { animation-delay: .45s; }
.dz-field:nth-child(2) { animation-delay: .55s; }
.dz-field:nth-child(3) { animation-delay: .65s; }
.dz-field dt {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .24em;
  color: var(--text-dim);
}
.dz-field dd {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: .08em;
  color: var(--brass-soft);
}

/* 第二章 */
.dz-obs {
  position: relative;
  display: block; width: 100%;
  padding: 16px 18px;
  margin-bottom: 10px;
  text-align: left;
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.7;
  background: linear-gradient(165deg, rgba(255, 240, 228, .11), rgba(243, 168, 192, .055));
  border: 1px solid rgba(255, 240, 228, .22);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .28s, background .28s;
  animation: dz-in .45s ease both;
}
.dz-obs:nth-child(2) { animation-delay: .08s; }
.dz-obs:nth-child(3) { animation-delay: .16s; }
.dz-obs:nth-child(4) { animation-delay: .24s; }
@media (hover: hover) and (pointer: fine) {
  .dz-obs:hover { border-color: rgba(233, 185, 110, .38); background: rgba(255, 240, 228, .035); }
}
.dz-obs .dz-obs-tag {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .26em;
  color: var(--brass);
}
.dz-obs .dz-obs-hint { font-size: 11.5px; color: var(--text-dim); }
.dz-obs.revealed { border-color: rgba(233, 185, 110, .34); background: rgba(233, 185, 110, .04); }
.dz-obs.revealed .dz-obs-text { animation: dz-in .4s ease both; }
.dz-pick { margin-top: 22px; animation: dz-in .45s .2s ease both; }
.dz-pick-q {
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .18em;
  color: var(--text-dim);
}
.dz-pick-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.dz-chip {
  padding: 8px 14px;
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--text-main);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  cursor: pointer;
  transition: color .25s, border-color .25s, background .25s;
}
@media (hover: hover) and (pointer: fine) {
  .dz-chip:hover { border-color: var(--hairline-strong); }
}
.dz-chip.picked {
  color: var(--brass-soft);
  border-color: rgba(233, 185, 110, .6);
  background: rgba(233, 185, 110, .07);
}
.dz-pick-fb {
  margin-top: 14px;
  font-size: 12px;
  letter-spacing: .05em;
  color: var(--brass-soft);
  animation: dz-in .45s ease both;
}

/* 第三章 */
.dz-quote {
  position: relative;
  padding: 6px 0 6px 20px;
  margin-bottom: 20px;
  border-left: 1px solid rgba(233, 185, 110, .45);
  font-family: var(--font-display);
  font-size: clamp(17px, 4.4vw, 20px);
  line-height: 2;
  letter-spacing: .04em;
  color: var(--text-main);
  animation: dz-quote 1s var(--ease-out) both;
}
.dz-quote:nth-child(2) { animation-delay: .8s; }
.dz-quote:nth-child(3) { animation-delay: 1.6s; }
.dz-quote:nth-child(4) { animation-delay: 2.4s; }
@keyframes dz-quote {
  from { opacity: 0; transform: translateY(10px); filter: blur(2px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}

/* 第四章 */
.dz-envelope {
  position: relative;
  width: min(100%, 360px);
  margin: 28px 0 0;
  padding: 40px 22px;
  text-align: center;
  background: linear-gradient(165deg, rgba(255, 240, 228, .11), rgba(243, 168, 192, .075));
  border: 1px solid rgba(243, 168, 192, .42);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color .3s, background .3s;
  animation: dz-in .55s ease both;
}
@media (hover: hover) and (pointer: fine) {
  .dz-envelope:hover { border-color: rgba(233, 185, 110, .6); background: rgba(233, 185, 110, .035); }
}
.dz-envelope:active { transform: translateY(1px); }
.dz-envelope-icon {
  display: block;
  margin-bottom: 16px;
  font-size: 40px;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .35));
  animation: floaty 4s ease-in-out infinite;
}
.dz-envelope-hint {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .22em;
  color: var(--text-dim);
}
.dz-letter {
  position: relative;
  width: min(100%, 400px);
  margin: 12px 0 0;
  padding: 34px 30px 30px;
  color: #2f2a22;
  background: linear-gradient(170deg, #fff8ec, #f3e6d2);
  border-radius: 12px;
  box-shadow: 0 34px 70px -34px rgba(0, 0, 0, .9);
  animation: dz-letter-open .65s var(--ease-out) both;
}
@keyframes dz-letter-open {
  from { opacity: 0; transform: translateY(18px) scaleY(.9); }
  to { opacity: 1; transform: none; }
}
.dz-letter::before {
  content: ""; position: absolute; inset: 7px;
  border: 1px solid rgba(160, 132, 86, .28);
  pointer-events: none;
}
.dz-letter-greeting {
  margin-bottom: 16px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .08em;
}
.dz-letter-body {
  margin-bottom: 18px;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 16px;
  line-height: 2.2;
  white-space: pre-line;
}
.dz-letter-sign {
  padding-right: 104px;
  text-align: right;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: .06em;
  color: #6b6353;
}
.dz-stamp {
  position: absolute; right: 18px; bottom: 16px;
  width: 78px; height: 78px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1.5px solid rgba(217, 106, 90, .72);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .16em;
  color: rgba(217, 106, 90, .85);
  transform: rotate(-10deg);
  mix-blend-mode: multiply;
  animation: dz-stamp .45s .7s cubic-bezier(.34, 1.56, .64, 1) both;
}
.dz-stamp small {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: .08em;
  font-weight: 400;
}
@keyframes dz-stamp {
  from { opacity: 0; transform: rotate(-10deg) scale(1.8); }
  to { opacity: 1; transform: rotate(-10deg) scale(1); }
}

/* ============ 场景 4：蛋糕许愿 ============ */
.cake-stage {
  position: relative; width: 260px; height: 300px;
  display: flex; align-items: flex-end; justify-content: center;
}
.cake-stage::before {
  content: "";
  position: absolute; left: 50%; bottom: 0;
  width: 320px; height: 320px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(226, 184, 120, .1), transparent 68%);
  pointer-events: none;
}
.cake { position: relative; z-index: 1; cursor: pointer; transition: transform .2s var(--ease-out); }
.cake:active { transform: scale(.98); }

.candles { display: flex; gap: 26px; justify-content: center; position: relative; z-index: 3; margin-bottom: -4px; }
.candle {
  position: relative; width: 7px; height: 32px; border-radius: 1px;
  background: repeating-linear-gradient(45deg, #cf9c8b 0 4px, #f1ead9 4px 8px);
}
.flame {
  position: absolute; top: -15px; left: 50%;
  width: 11px; height: 16px;
  transform: translateX(-50%);
  background: radial-gradient(circle at 50% 75%, #fff 0 22%, #f0cf91 46%, #cf8a4a 82%);
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  box-shadow: 0 0 14px rgba(224, 178, 106, .55);
  transform-origin: 50% 100%;
  animation: flick .4s ease-in-out infinite alternate;
  transition: opacity .5s, transform .5s;
}
@keyframes flick {
  from { transform: translateX(-50%) scale(1) rotate(-2deg); }
  to { transform: translateX(-50%) scale(1.08, .94) rotate(2deg); }
}
.candle.out .flame { opacity: 0; transform: translateX(-50%) scale(.3); }
.candle.out::after {
  content: "";
  position: absolute; top: -24px; left: 50%;
  width: 3px; height: 16px;
  border-radius: 2px;
  background: linear-gradient(to top, rgba(190, 185, 175, .45), transparent);
  animation: smoke 1.4s ease-out forwards;
}
@keyframes smoke { to { opacity: 0; transform: translateY(-12px) scaleX(2); } }

.cake-top {
  position: relative; z-index: 2;
  width: 190px; height: 34px; margin: 0 auto;
  background: linear-gradient(#f2e5d0, #e2c9a5);
  border-radius: 4px 4px 1px 1px;
}
.cake-drip {
  position: absolute; top: 26px; left: 0; right: 0; height: 14px;
  background:
    radial-gradient(circle at 12px 0, #e2c9a5 8px, transparent 9px),
    radial-gradient(circle at 44px 0, #e2c9a5 10px, transparent 11px),
    radial-gradient(circle at 78px 0, #e2c9a5 7px, transparent 8px),
    radial-gradient(circle at 112px 0, #e2c9a5 10px, transparent 11px),
    radial-gradient(circle at 148px 0, #e2c9a5 8px, transparent 9px),
    radial-gradient(circle at 178px 0, #e2c9a5 9px, transparent 10px);
}
.cake-body { position: relative; z-index: 1; width: 220px; margin: 0 auto; }
.cake-layer {
  height: 46px; border-radius: 2px;
  background: linear-gradient(#7c5563, #63424e);
}
.cake-layer + .cake-layer {
  width: 220px; height: 56px;
  background: linear-gradient(#c08a63, #a5724f);
}
.cake-layer::after {
  content: "";
  position: absolute; left: 12px; right: 12px; top: 50%;
  height: 1px;
  background: repeating-linear-gradient(90deg, rgba(241, 234, 217, .45) 0 6px, transparent 6px 16px);
}
.cake-plate {
  width: 260px; height: 10px; margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(214, 190, 150, .3), rgba(214, 190, 150, .04));
}

.blow-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); pointer-events: none; }
.blow-ring-bg { fill: none; stroke: rgba(255, 240, 228, .12); stroke-width: 2; }
.blow-ring-fg {
  fill: none; stroke: var(--brass); stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 289; stroke-dashoffset: 289;
}

.wish-msg {
  margin-top: 22px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 2;
  letter-spacing: .08em;
  color: var(--paper);
  text-shadow: 0 2px 24px rgba(0, 0, 0, .6);
  animation: wish-in .7s var(--ease-out) both;
}
@keyframes wish-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ============ 场景 5：花火大会 ============ */
.fw-space { flex: 1; min-height: 40vh; position: relative; }
#scene-fireworks::after {
  content: "";
  position: absolute; left: 8%; right: 8%; bottom: 84px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 240, 228, .16) 40%, rgba(233, 185, 110, .22) 60%, transparent);
  pointer-events: none;
}
.finale-text {
  position: absolute; left: 0; right: 0; top: 42%;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 7.4vw, 44px);
  letter-spacing: .1em;
  color: var(--paper);
  text-shadow: 0 2px 30px rgba(0, 0, 0, .75), 0 0 60px rgba(233, 185, 110, .18);
  animation: finale-in 1.2s var(--ease-out) both;
}
@keyframes finale-in {
  from { opacity: 0; transform: scale(.94); letter-spacing: .3em; filter: blur(6px); }
  to { opacity: 1; transform: scale(1); filter: blur(0); }
}

/* ============ 结尾横幅 ============ */
.end-banner {
  position: fixed; inset: 0; z-index: 70;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 30px;
  background: rgba(27, 20, 40, .88);
}
.end-banner-text {
  padding: 0 24px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(23px, 6vw, 34px);
  letter-spacing: .1em;
  line-height: 1.6;
  color: var(--paper);
  animation: banner-pop .8s var(--ease-out) both;
}
@keyframes banner-pop {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ============ 小游戏：接蛋糕大作战 ============ */
#scene-game { padding: 0; overflow: hidden; touch-action: none; }
.game-wrap { position: relative; width: 100%; height: 100%; touch-action: none; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.game-hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: max(16px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 30px max(24px, env(safe-area-inset-left));
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, rgba(27, 20, 40, .74) 0%, rgba(27, 20, 40, .28) 60%, transparent 100%);
}
.hud-cell { display: flex; flex-direction: column; align-items: center; min-width: 70px; }
.hud-label {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: .3em;
  color: rgba(145, 139, 124, .95);
}
.hud-val {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--paper);
}
.hud-time .hud-val { color: var(--brass-soft); }
.hud-cell:first-child { align-items: flex-start; }
.hud-cell:last-child { align-items: flex-end; }

.game-combo {
  position: absolute; top: 66px; left: 50%; z-index: 2;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .3em;
  color: var(--brass-soft);
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
.game-combo.show { opacity: 1; }

.game-overlay {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 16px;
}
#game-start {
  background:
    radial-gradient(ellipse 55% 40% at 28% 22%, rgba(243, 168, 192, .26), transparent 68%),
    radial-gradient(ellipse 55% 42% at 74% 72%, rgba(233, 185, 110, .2), transparent 68%),
    linear-gradient(170deg, rgba(74, 50, 96, .84), rgba(35, 25, 52, .95));
}
.gs-emoji {
  position: relative;
  font-size: 46px;
  margin: 0 0 26px;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, .4));
  animation: floaty 4s ease-in-out infinite;
}
.gs-emoji::before {
  content: "";
  position: absolute; inset: -16px;
  border: 1px solid rgba(255, 240, 228, .18);
  border-radius: 50%;
}
.gs-emoji::after {
  content: "";
  position: absolute; inset: -32px;
  border: 1px dashed rgba(233, 185, 110, .22);
  border-radius: 50%;
}
.gs-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 5vw, 42px);
  letter-spacing: .12em;
  color: var(--paper);
}
.gs-title::before {
  content: "04";
  display: block;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: .3em;
  color: var(--brass);
}
.gs-sub {
  padding: 0 20px;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--text-dim);
}
.gs-hint {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .2em;
  color: var(--text-dim);
  opacity: .85;
}

.cd-num {
  font-family: var(--font-display);
  font-size: clamp(72px, 14vw, 116px);
  font-weight: 700;
  color: var(--paper);
  letter-spacing: .06em;
}
.cd-pop { animation: cd-pop .55s var(--ease-out) both; }
@keyframes cd-pop {
  from { opacity: 0; transform: scale(1.35); }
  to { opacity: 1; transform: scale(1); }
}
#game-countdown { pointer-events: none; }

.game-card {
  position: relative;
  width: min(88vw, 380px);
  padding: 34px 30px 30px;
  background: linear-gradient(165deg, #453062, #2c2040);
  border: 1px solid rgba(243, 168, 192, .28);
  border-radius: 16px;
  box-shadow:
    0 50px 100px -46px rgba(0, 0, 0, .95),
    0 0 80px -30px rgba(243, 168, 192, .4);
}
.game-card::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(233, 185, 110, .65), transparent);
}
.card-in { animation: card-in .55s var(--ease-out) both; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.gc-head {
  margin-bottom: 18px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .4em;
  color: var(--brass);
}
.gc-label {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: .3em;
  color: var(--text-dim);
}
.gc-score {
  margin: 6px 0 18px;
  font-family: var(--font-display);
  font-size: 54px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: .04em;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
}
.gc-title {
  display: inline-block;
  padding: 10px 0;
  margin-bottom: 22px;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: .12em;
  color: var(--brass-soft);
  animation: card-in .55s .2s var(--ease-out) both;
}
.gc-btns { display: flex; gap: 20px; justify-content: center; align-items: center; flex-wrap: wrap; }
.gc-btns .btn-neon { font-size: 12px; padding: 11px 20px; }
.gc-btns .btn-ghost { font-size: 12px; }

/* ============ 桌面端：编辑式宽版排版 ============ */
@media (min-width: 900px) {
  #scene-intro, #scene-gifts, #scene-quiz, #scene-dossier {
    align-items: flex-start;
    padding-left: 10vw;
    padding-right: 10vw;
  }
  .intro-wrap { max-width: 720px; }
  #scene-gifts, #scene-quiz { justify-content: center; }
  #scene-gifts .scene-footer,
  #scene-quiz .scene-footer,
  #scene-dossier .scene-footer { align-self: flex-start; }
  #scene-gifts .scene-title, #scene-quiz .scene-title,
  #scene-gifts .scene-desc, #scene-quiz .scene-desc { max-width: 700px; }
  .gift-grid { max-width: 700px; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
  .quiz-progress, .quiz-card { max-width: 700px; }
  .dossier { max-width: 700px; }
  /* 右侧超大描边数字，填充宽屏留白 */
  #scene-gifts::before, #scene-quiz::before, #scene-dossier::before {
    position: absolute; right: 6vw; top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-display);
    font-size: 21vw; line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1px rgba(255, 240, 228, .09);
    pointer-events: none;
  }
  #scene-gifts::before { content: "01"; }
  #scene-quiz::before { content: "02"; }
  #scene-dossier::before { content: "03"; }
  /* 右侧装订线，给宽屏留白一个结构 */
  #scene-gifts::after, #scene-quiz::after, #scene-dossier::after {
    content: "";
    position: absolute; top: 16%; bottom: 16%; right: 10vw;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(255, 240, 228, .14) 28%, rgba(255, 240, 228, .14) 72%, transparent);
    pointer-events: none;
  }
}

/* ============ 移动端 ============ */
@media (max-width: 480px) {
  .scene {
    padding:
      max(20px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(20px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }
  .scene-title { font-size: 22px; letter-spacing: 1px; }
  .scene-desc { font-size: 12px; margin-bottom: 18px; }
  .scene-footer { height: 72px; }
  #scene-gifts, #scene-quiz, #scene-cake { justify-content: center; }
  .btn-neon { padding: 12px 24px; font-size: 12px; }
  .btn-ghost { font-size: 12px; }

  .intro-wrap { padding: 2vh 0; }
  .orbit { width: 44px; height: 44px; margin-bottom: 26px; }
  .orbit-emoji { font-size: 18px; }
  .neon-title { font-size: clamp(32px, 9.6vw, 46px); margin-bottom: 18px; }
  .neon-sub { font-size: 9px; letter-spacing: .34em; }
  .hint-text { margin-bottom: 34px; }

  .gift-grid { gap: 10px; }
  .gift-emoji { font-size: 30px; }
  .gift-box small { font-size: 7.5px; }
  .modal-card { width: min(86vw, 340px); padding: 28px 22px 26px; }

  .quiz-card { padding: 22px 18px 18px; }
  .quiz-q { font-size: 16px; }
  .quiz-opt { font-size: 13.5px; padding: 13px 2px; }

  .dossier-head { padding: 4px 0 18px; }
  .dossier .scene-title { font-size: 22px; letter-spacing: 3px; }
  .dz-name { font-size: clamp(30px, 8.6vw, 38px); }
  .dz-obs { padding: 14px 15px; font-size: 13.5px; }
  .dz-quote { font-size: 16px; line-height: 1.95; }
  .dz-letter { padding: 28px 22px 26px; }
  .dz-letter-body { font-size: 15px; line-height: 2.1; }
  .dz-letter-sign { padding-right: 86px; font-size: 12.5px; }
  .dz-stamp { width: 68px; height: 68px; font-size: 12px; right: 14px; bottom: 14px; }

  .wish-msg { font-size: 16px; }

  .game-hud { padding-top: max(14px, env(safe-area-inset-top)); padding-left: 18px; padding-right: 18px; }
  .hud-val { font-size: 23px; }
  .hud-label { font-size: 8px; }
  .hud-cell { min-width: 58px; }
  .game-combo { font-size: 10px; top: 60px; }
  .gs-emoji { font-size: 46px; }
  .gs-title { letter-spacing: .08em; }
  .game-card { width: min(90vw, 360px); padding: 28px 20px 24px; }
  .gc-head { font-size: 9px; }
  .gc-score { font-size: 46px; }
  .gc-title { font-size: 14px; }
  .gc-btns { gap: 16px; }
  .gc-btns .btn-neon, .gc-btns .btn-ghost { font-size: 11.5px; }
}

@media (max-height: 700px) {
  .cake-stage { transform: scale(.9); transform-origin: bottom center; margin-bottom: -12px; }
}

@media (max-height: 640px) {
  .cake-stage { transform: scale(.78); transform-origin: bottom center; margin-bottom: -24px; }
  .scene-footer { height: 64px; }
  .scene-title { font-size: 20px; }
  .dz-quote { font-size: 15px; line-height: 1.9; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .scene { padding-top: 10px; padding-bottom: 10px; }
  .intro-wrap { padding: 0; }
  .orbit { width: 40px; height: 40px; margin-bottom: 16px; }
  .orbit-emoji { font-size: 16px; }
  .neon-title { font-size: 32px; margin-bottom: 12px; }
  .hint-text { margin-bottom: 22px; }
  .scene-title { font-size: 18px; }
  .scene-title::before { margin-bottom: 8px; }
  .scene-desc { margin-bottom: 10px; }
  .cake-stage { transform: scale(.6); transform-origin: bottom center; margin-bottom: -48px; }
  .scene-footer { height: 56px; }
  .gift-grid { max-width: 380px; }
  #game-start { padding-bottom: 72px; }
  .gs-emoji { font-size: 36px; }
  .gs-title { font-size: 26px; }
  .gs-hint { margin-top: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
