/* ==========================================================
   Birthday3D · 展示页
   ========================================================== */
body.view {
  height: 100vh; height: 100dvh; overflow: hidden;
  background: #070508;
  --accent: #f2d39b;
  --accent-soft: rgba(242, 211, 155, 0.22);
  --bg-a: #191007;
  --bg-b: #070508;
}

body.view[data-theme="pink"] { --accent: #ffc0d5; --accent-soft: rgba(255, 168, 198, 0.22); --bg-a: #1e0c15; }
body.view[data-theme="goldStrawberry"] { --accent: #ffd9a8; --accent-soft: rgba(255, 190, 140, 0.22); --bg-a: #1d0f0a; }
body.view[data-theme="crystal"] { --accent: #a9e3ff; --accent-soft: rgba(150, 216, 255, 0.22); --bg-a: #0a1524; }

#stage { position: fixed; inset: 0; }
#gl, #fw { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#gl { touch-action: none; }
#fw { pointer-events: none; }

.bg-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 45% at 50% 62%, var(--accent-soft), transparent 70%),
    radial-gradient(80% 60% at 50% 0%, rgba(255, 255, 255, 0.05), transparent 70%),
    linear-gradient(180deg, var(--bg-a) 0%, var(--bg-b) 55%, #050407 100%);
  transition: background 1.2s ease;
}

/* ---------- HUD ---------- */
.hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  padding: calc(16px + var(--safe-t)) 18px 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  pointer-events: none; opacity: 0; transition: opacity 1s ease 0.3s;
}
.hud.on { opacity: 1; }
.hud-to { pointer-events: auto; }
.hud-to small {
  display: block; font-size: 9.5px; letter-spacing: 0.42em; color: var(--ink-faint);
  text-transform: uppercase; margin-bottom: 6px;
}
.hud-to b {
  font-family: var(--serif); font-weight: 500; font-size: 16px; letter-spacing: 0.16em;
  color: var(--ink); opacity: 0.92;
}
.hud-actions { display: flex; gap: 9px; pointer-events: auto; }
.hud-actions .icon-btn { width: 38px; height: 38px; }
.icon-btn.spin svg { animation: spin 3.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 声音波纹 */
.sound-wave { display: flex; align-items: flex-end; gap: 2.5px; height: 14px; }
.sound-wave i { width: 2px; background: currentColor; border-radius: 2px; animation: wave 1s ease-in-out infinite; opacity: 0.85; }
.sound-wave i:nth-child(1) { height: 5px; animation-delay: 0s; }
.sound-wave i:nth-child(2) { height: 11px; animation-delay: 0.18s; }
.sound-wave i:nth-child(3) { height: 7px; animation-delay: 0.36s; }
.sound-wave i:nth-child(4) { height: 13px; animation-delay: 0.54s; }
@keyframes wave { 0%, 100% { transform: scaleY(0.5); } 50% { transform: scaleY(1); } }
.sound-wave.paused i { animation-play-state: paused; opacity: 0.35; }

/* ---------- 倒计时 chip ---------- */
.chip {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(64px + var(--safe-b)); z-index: 25;
  padding: 8px 16px; border-radius: 999px;
  font-size: 11.5px; letter-spacing: 0.16em; color: var(--ink-dim);
  background: rgba(10, 8, 14, 0.5); border: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  opacity: 0; transition: opacity 0.8s; white-space: nowrap;
}
.chip.on { opacity: 1; }
.chip b { color: var(--accent); font-weight: 500; }

/* ---------- 底部提示 ---------- */
.hint {
  position: fixed; left: 0; right: 0; bottom: calc(26px + var(--safe-b)); z-index: 25;
  text-align: center; font-size: 11px; letter-spacing: 0.2em; color: var(--ink-faint);
  opacity: 0; transition: opacity 0.9s; pointer-events: none;
}
.hint.on { opacity: 1; }
.hint span { display: inline-block; animation: breathe 3.4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

/* ---------- 解锁 ---------- */
.lock {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(70% 50% at 50% 40%, var(--accent-soft), transparent 72%), #06050a;
  transition: opacity 0.9s var(--ease), visibility 0.9s;
}
.lock.gone { opacity: 0; visibility: hidden; }
.lock-inner { width: min(360px, 88vw); text-align: center; padding-bottom: 4vh; }
.lock-kicker {
  font-size: 9.5px; letter-spacing: 0.46em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 22px;
}
.lock-seal {
  width: 72px; height: 72px; margin: 0 auto 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.12), transparent 70%);
  box-shadow: 0 0 40px -8px var(--accent-soft), inset 0 0 26px -10px rgba(255, 255, 255, 0.4);
  color: var(--accent); font-size: 26px;
  animation: sealFloat 5s ease-in-out infinite;
}
@keyframes sealFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.lock-title { font-size: 25px; line-height: 1.5; margin: 0 0 10px; letter-spacing: 0.06em; }
.lock-title em { font-style: normal; color: var(--accent); }
.lock-sub { font-size: 12.5px; color: var(--ink-dim); letter-spacing: 0.1em; margin: 0 0 30px; }
.lock-hint { font-size: 11px; color: var(--ink-faint); letter-spacing: 0.08em; margin-top: 18px; min-height: 16px; }

.pin { display: flex; justify-content: center; gap: 16px; margin-bottom: 30px; }
.pin i {
  width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  transition: all 0.28s var(--ease);
}
.pin i.on { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 16px var(--accent); transform: scale(1.12); }
.pin.err { animation: shake 0.45s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
}

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.keypad button {
  height: 54px; border-radius: 16px; font-size: 21px; font-family: var(--serif);
  color: var(--ink); background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: transform 0.12s, background 0.2s;
}
.keypad button:active { transform: scale(0.94); background: rgba(255, 255, 255, 0.12); }
.keypad button.ghost { background: transparent; border-color: transparent; font-size: 13px; letter-spacing: 0.1em; color: var(--ink-faint); font-family: var(--sans); }
.keypad button.ghost svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.6; }

/* ---------- 揭示卡 ---------- */
.reveal {
  position: fixed; inset: 0; z-index: 40; display: flex;
  align-items: center; justify-content: center; padding: 26px;
  pointer-events: none; opacity: 0; transition: opacity 0.9s var(--ease);
}
.reveal.on { opacity: 1; pointer-events: auto; }
.reveal-card {
  max-width: 460px; width: 100%; text-align: center;
  padding: 30px 26px 26px; border-radius: 24px;
  background: linear-gradient(180deg, rgba(22, 17, 28, 0.72), rgba(10, 8, 14, 0.82));
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 30px 90px -30px rgba(0, 0, 0, 0.9);
  transform: translateY(14px) scale(0.985); transition: transform 1s var(--ease);
}
.reveal.on .reveal-card { transform: translateY(0) scale(1); }
.reveal-kicker { font-size: 9px; letter-spacing: 0.5em; color: var(--accent); opacity: 0.8; margin-bottom: 16px; }
.reveal h1 { font-size: 27px; margin: 0 0 6px; letter-spacing: 0.08em; }
.reveal .sub { font-size: 12px; color: var(--ink-dim); letter-spacing: 0.16em; margin-bottom: 20px; }
.reveal p.wish {
  font-family: var(--serif); font-size: 15px; line-height: 2; color: rgba(247, 241, 232, 0.86);
  margin: 0 0 24px; white-space: pre-wrap; letter-spacing: 0.04em;
  max-height: 34vh; overflow-y: auto;
}
.reveal .go {
  font-size: 11px; letter-spacing: 0.28em; color: var(--ink-faint);
  display: inline-flex; align-items: center; gap: 8px;
}
.reveal .go::after { content: ''; width: 22px; height: 1px; background: currentColor; opacity: 0.5; }

/* ---------- 照片大图 ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(4, 3, 6, 0.78); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  opacity: 0; visibility: hidden; transition: opacity 0.4s var(--ease), visibility 0.4s;
}
.lightbox.on { opacity: 1; visibility: visible; }
.lb-card {
  width: min(420px, 100%); max-height: 88vh; overflow-y: auto;
  background: linear-gradient(180deg, #1a1420, #0d0a12);
  border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 22px;
  box-shadow: 0 40px 120px -30px #000;
  transform: scale(0.94); transition: transform 0.45s var(--ease);
}
.lightbox.on .lb-card { transform: scale(1); }
.lb-img { width: 100%; display: block; border-radius: 22px 22px 0 0; max-height: 54vh; object-fit: cover; }
.lb-body { padding: 20px 22px 24px; }
.lb-idx { font-size: 9.5px; letter-spacing: 0.4em; color: var(--accent); opacity: 0.75; margin-bottom: 10px; }
.lb-text { font-family: var(--serif); font-size: 15.5px; line-height: 1.95; color: rgba(247, 241, 232, 0.9); margin: 0; white-space: pre-wrap; }
.lb-actions { display: flex; gap: 10px; margin-top: 20px; }
.lb-actions .btn { flex: 1; height: 42px; font-size: 13px; }
.lb-nav { display: flex; gap: 10px; }

/* ---------- 加载 / 状态页 ---------- */
.loader {
  position: fixed; inset: 0; z-index: 85; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 22px;
  background: #06050a; transition: opacity 0.7s var(--ease), visibility 0.7s;
}
.loader.gone { opacity: 0; visibility: hidden; }
.ring {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent); animation: spin 1.1s linear infinite;
}
.loader p { font-size: 11px; letter-spacing: 0.3em; color: var(--ink-faint); }

.state-page {
  position: fixed; inset: 0; z-index: 95; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 30px;
  background: #06050a; text-align: center;
}
.state-page .big { font-family: var(--serif); font-size: 22px; letter-spacing: 0.1em; }
.state-page .small { font-size: 12.5px; line-height: 1.9; color: var(--ink-dim); letter-spacing: 0.06em; max-width: 320px; }
.state-page a.btn { margin-top: 12px; }

/* 竖屏微调 */
@media (max-width: 480px) {
  .lock-title { font-size: 22px; }
  .reveal h1 { font-size: 23px; }
  .keypad button { height: 50px; }
  .hint { font-size: 10px; letter-spacing: 0.12em; }
}
