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

:root {
  --bg-deep: #0a0e27;
  --bg-mid: #141a3d;
  --neon-cyan: #4ff6ff;
  --neon-pink: #ff6ec7;
  --neon-purple: #a78bfa;
  --neon-gold: #ffd166;
  --soft: #fff0f6;
  --text-main: #eaf0ff;
  --text-dim: #9aa7d0;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, var(--bg-mid) 0%, var(--bg-deep) 65%);
  color: var(--text-main);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

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

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

/* ============ 场景切换 ============ */
.scene {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column; align-items: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  overflow-y: auto;
}
.scene.active {
  display: flex;
  animation: scene-in .5s ease both;
}
@keyframes scene-in {
  from { opacity: 0; transform: translateY(24px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.scene-title {
  font-size: 26px; letter-spacing: 2px; margin-bottom: 6px;
  text-shadow: 0 0 18px rgba(79, 246, 255, .5);
}
.scene-desc { color: var(--text-dim); font-size: 14px; margin-bottom: 20px; }
.scene-footer { height: 80px; display: flex; align-items: center; justify-content: center; }

.hidden { display: none !important; }

/* ============ 按钮 ============ */
.btn-neon {
  position: relative;
  padding: 13px 34px;
  font-size: 16px; letter-spacing: 2px;
  color: var(--neon-cyan);
  background: rgba(79, 246, 255, .06);
  border: 1px solid rgba(79, 246, 255, .55);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(79, 246, 255, .25), inset 0 0 14px rgba(79, 246, 255, .12);
  animation: pulse 2s ease-in-out infinite;
}
.btn-neon:active { transform: scale(.95); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 14px rgba(79,246,255,.25), inset 0 0 14px rgba(79,246,255,.12); }
  50% { box-shadow: 0 0 26px rgba(79,246,255,.55), inset 0 0 20px rgba(79,246,255,.2); }
}

.btn-ghost {
  padding: 10px 26px; font-size: 15px;
  color: var(--neon-pink);
  background: transparent;
  border: 1px solid rgba(255, 110, 199, .5);
  border-radius: 999px; cursor: pointer;
}
.btn-ghost:active { transform: scale(.95); }

/* ============ 场景 0：开场 ============ */
.intro-wrap {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; text-align: center;
}

.orbit { position: relative; width: 140px; height: 140px; }
.orbit-ring {
  position: absolute; inset: 0;
  border: 1.5px dashed rgba(167, 139, 250, .55);
  border-radius: 50%;
  animation: spin 14s linear infinite;
}
.orbit-ring::before, .orbit-ring::after {
  content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%;
  background: var(--neon-cyan); box-shadow: 0 0 12px var(--neon-cyan);
  top: -4px; left: 50%;
}
.orbit-ring::after { background: var(--neon-pink); box-shadow: 0 0 12px var(--neon-pink); top: auto; bottom: -4px; }
.orbit-emoji {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 62px;
  filter: drop-shadow(0 0 18px rgba(255, 209, 102, .6));
  animation: floaty 3s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.neon-title {
  font-size: clamp(34px, 9vw, 54px);
  letter-spacing: 6px;
  color: #fff;
  text-shadow:
    0 0 8px var(--neon-cyan),
    0 0 22px var(--neon-cyan),
    0 0 42px var(--neon-purple),
    0 0 70px var(--neon-pink);
  animation: neon-flicker 4s infinite;
}
@keyframes neon-flicker {
  0%, 18%, 22%, 25%, 53%, 57%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: .72; }
}
.neon-sub {
  font-size: 15px; letter-spacing: 4px; color: var(--neon-gold);
  text-shadow: 0 0 12px rgba(255, 209, 102, .7);
}
.hint-text { font-size: 13px; color: var(--text-dim); letter-spacing: 3px; }

/* ============ 场景 1：拆礼物 ============ */
.gift-grid {
  width: 100%; max-width: 420px;
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.gift-box {
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 40px;
  background: linear-gradient(160deg, rgba(255,110,199,.14), rgba(79,246,255,.10));
  border: 1px solid rgba(255, 110, 199, .4);
  border-radius: 18px;
  cursor: pointer;
  transition: transform .25s, box-shadow .25s, opacity .4s;
  box-shadow: 0 0 12px rgba(255, 110, 199, .18);
  animation: gift-bob 2.4s ease-in-out infinite;
}
.gift-box small { font-size: 12px; color: var(--text-dim); }
.gift-box:nth-child(2n) { animation-delay: .4s; border-color: rgba(79,246,255,.4); box-shadow: 0 0 12px rgba(79,246,255,.18); }
.gift-box:nth-child(3n) { animation-delay: .8s; }
.gift-box:active { transform: scale(.92); }
.gift-box.opened { opacity: .35; animation: none; pointer-events: none; }
.gift-box.shake { animation: gift-shake .5s; }
@keyframes gift-bob { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-6px);} }
@keyframes gift-shake {
  0%,100% { transform: rotate(0);} 20% { transform: rotate(-8deg);} 40% { transform: rotate(8deg);}
  60% { transform: rotate(-6deg);} 80% { transform: rotate(6deg);}
}

/* 礼物弹窗 */
.modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 8, 24, .72);
  backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .3s;
}
.modal.show { opacity: 1; }
.modal-card {
  width: min(84vw, 340px);
  padding: 30px 24px;
  text-align: center;
  background: linear-gradient(165deg, #1b2350, #10142e);
  border: 1px solid rgba(167, 139, 250, .5);
  border-radius: 22px;
  box-shadow: 0 0 40px rgba(167, 139, 250, .35);
  transform: scale(.8);
  transition: transform .35s cubic-bezier(.34, 1.56, .64, 1);
}
.modal.show .modal-card { transform: scale(1); }
.modal-emoji { font-size: 54px; margin-bottom: 10px; animation: floaty 2.6s ease-in-out infinite; }
.modal-title { font-size: 18px; color: var(--neon-gold); letter-spacing: 2px; margin-bottom: 12px; }
.modal-msg { font-size: 15px; line-height: 1.8; color: var(--text-main); margin-bottom: 22px; }

/* ============ 场景 2：答题 ============ */
.quiz-progress { display: flex; gap: 8px; margin-bottom: 18px; }
.quiz-progress i {
  width: 26px; height: 6px; border-radius: 3px;
  background: rgba(255,255,255,.15);
  transition: background .3s, box-shadow .3s;
}
.quiz-progress i.done { background: var(--neon-cyan); box-shadow: 0 0 8px var(--neon-cyan); }
.quiz-progress i.current { background: var(--neon-pink); box-shadow: 0 0 8px var(--neon-pink); }

.quiz-card {
  width: 100%; max-width: 420px;
  background: rgba(20, 26, 61, .75);
  border: 1px solid rgba(79, 246, 255, .3);
  border-radius: 20px;
  padding: 24px 20px;
  box-shadow: 0 0 24px rgba(79, 246, 255, .12);
}
.quiz-q { font-size: 17px; line-height: 1.6; margin-bottom: 18px; }
.quiz-opt {
  display: block; width: 100%;
  margin-bottom: 12px; padding: 13px 16px;
  font-size: 15px; text-align: left;
  color: var(--text-main);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 14px; cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s;
}
.quiz-opt:active { transform: scale(.98); }
.quiz-opt.right { border-color: var(--neon-cyan); background: rgba(79,246,255,.14); box-shadow: 0 0 14px rgba(79,246,255,.3); }
.quiz-opt.wrong { border-color: #ff5577; background: rgba(255,85,119,.14); animation: gift-shake .4s; }
.quiz-tip { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.quiz-feedback { min-height: 22px; font-size: 13px; color: var(--neon-gold); margin-top: 6px; text-align: center; }

/* ============ 场景 3：相册 ============ */
.album-track {
  display: flex;
  width: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 16px;
  padding: 8px 10vw 18px;
  scrollbar-width: none;
}
.album-track::-webkit-scrollbar { display: none; }
.photo-card {
  flex: 0 0 78vw; max-width: 340px;
  scroll-snap-align: center;
  background: #fff;
  border-radius: 16px;
  padding: 10px 10px 44px;
  transform: rotate(var(--tilt, 0deg));
  box-shadow: 0 8px 30px rgba(0,0,0,.5), 0 0 18px rgba(167,139,250,.25);
  position: relative;
}
.photo-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; display: block; }
.photo-card figcaption {
  position: absolute; bottom: 12px; left: 0; right: 0;
  text-align: center; font-size: 13px; color: #333; padding: 0 12px;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", cursive;
}
.photo-card::before {
  content: "🩷"; position: absolute; top: -10px; left: 50%; transform: translateX(-50%) rotate(-6deg);
  font-size: 22px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4));
}
.album-dots { display: flex; gap: 8px; margin-bottom: 8px; }
.album-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.2); transition: background .3s, transform .3s; }
.album-dots i.on { background: var(--neon-pink); transform: scale(1.3); box-shadow: 0 0 8px var(--neon-pink); }

/* ============ 场景 4：蛋糕许愿 ============ */
.cake-stage { position: relative; width: 260px; height: 300px; display: flex; align-items: flex-end; justify-content: center; }
.cake { position: relative; cursor: pointer; transition: transform .2s; }
.cake:active { transform: scale(.97); }

.candles { display: flex; gap: 26px; justify-content: center; position: relative; z-index: 3; margin-bottom: -4px; }
.candle { position: relative; width: 8px; height: 34px; border-radius: 3px;
  background: repeating-linear-gradient(45deg, #ff9ecb 0 4px, #fff 4px 8px); }
.flame {
  position: absolute; top: -16px; left: 50%; width: 12px; height: 17px;
  transform: translateX(-50%);
  background: radial-gradient(circle at 50% 75%, #fff 0 25%, var(--neon-gold) 45%, #ff8c42 80%);
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  box-shadow: 0 0 16px rgba(255, 209, 102, .9), 0 0 34px rgba(255, 140, 66, .5);
  transform-origin: 50% 100%;
  animation: flick .35s ease-in-out infinite alternate;
  transition: opacity .5s, transform .5s;
}
@keyframes flick {
  from { transform: translateX(-50%) scale(1) rotate(-3deg); }
  to { transform: translateX(-50%) scale(1.12, .92) rotate(3deg); }
}
.candle.out .flame { opacity: 0; transform: translateX(-50%) scale(.3); }
.candle.out::after {
  content: ""; position: absolute; top: -26px; left: 50%; width: 4px; height: 18px;
  background: linear-gradient(to top, rgba(180,180,200,.55), transparent);
  border-radius: 2px; animation: smoke 1.4s ease-out forwards;
}
@keyframes smoke { to { opacity: 0; transform: translateY(-14px) scaleX(2); } }

.cake-top {
  width: 190px; height: 34px; margin: 0 auto;
  background: linear-gradient(#ffe3f1, #ffb3d9);
  border-radius: 16px 16px 6px 6px; position: relative; z-index: 2;
}
.cake-drip {
  position: absolute; top: 26px; left: 0; right: 0; height: 14px;
  background:
    radial-gradient(circle at 12px 0, #ffb3d9 8px, transparent 9px),
    radial-gradient(circle at 44px 0, #ffb3d9 10px, transparent 11px),
    radial-gradient(circle at 78px 0, #ffb3d9 7px, transparent 8px),
    radial-gradient(circle at 112px 0, #ffb3d9 10px, transparent 11px),
    radial-gradient(circle at 148px 0, #ffb3d9 8px, transparent 9px),
    radial-gradient(circle at 178px 0, #ffb3d9 9px, transparent 10px);
}
.cake-body { width: 220px; margin: 0 auto; position: relative; z-index: 1; }
.cake-layer {
  height: 46px; border-radius: 8px;
  background: linear-gradient(#7a5cff, #5a3fd6);
  box-shadow: inset 0 -6px 0 rgba(0,0,0,.18);
}
.cake-layer + .cake-layer { height: 56px; width: 220px; background: linear-gradient(#4ff6ff, #2bb8c4); }
.cake-layer::after {
  content: ""; position: absolute; left: 12px; right: 12px; top: 50%; height: 3px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.5) 0 8px, transparent 8px 18px);
}
.cake-plate { width: 260px; height: 12px; margin: 0 auto; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(167,139,250,.5), rgba(167,139,250,.1)); }

.blow-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); pointer-events: none; }
.blow-ring-bg { fill: none; stroke: rgba(255,255,255,.1); stroke-width: 3; }
.blow-ring-fg {
  fill: none; stroke: var(--neon-gold); stroke-width: 3; stroke-linecap: round;
  stroke-dasharray: 289; stroke-dashoffset: 289;
  filter: drop-shadow(0 0 6px var(--neon-gold));
}

.wish-msg {
  margin-top: 18px; text-align: center; font-size: 17px; line-height: 1.9;
  color: var(--neon-gold); text-shadow: 0 0 14px rgba(255,209,102,.6);
  animation: wish-in .8s ease both;
}
@keyframes wish-in { from { opacity: 0; transform: translateY(14px) scale(.9);} to { opacity: 1; } }

/* ============ 场景 5：花火大会 ============ */
.fw-space { flex: 1; min-height: 40vh; }
.finale-text {
  position: absolute; left: 0; right: 0; top: 42%;
  text-align: center;
  font-size: clamp(26px, 7.5vw, 44px);
  letter-spacing: 4px;
  color: #fff;
  text-shadow:
    0 0 10px var(--neon-gold),
    0 0 28px var(--neon-pink),
    0 0 60px var(--neon-purple);
  animation: finale-in 1.4s cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes finale-in {
  from { opacity: 0; transform: scale(.5); letter-spacing: 20px; filter: blur(8px); }
  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: 26px;
  background: rgba(6, 8, 24, .55); backdrop-filter: blur(3px);
}
.end-banner-text {
  font-size: clamp(22px, 6vw, 34px); letter-spacing: 3px; text-align: center;
  color: #fff;
  text-shadow: 0 0 10px var(--neon-pink), 0 0 30px var(--neon-pink), 0 0 60px var(--neon-purple);
  animation: banner-pop .7s cubic-bezier(.34, 1.56, .64, 1) both;
}
@keyframes banner-pop { from { opacity: 0; transform: scale(.6);} to { opacity: 1; transform: scale(1);} }

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

.game-hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 14px 22px; pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.hud-cell { display: flex; flex-direction: column; align-items: center; min-width: 72px; }
.hud-label { font-size: 10px; letter-spacing: 3px; color: var(--text-dim); }
.hud-val {
  font-size: 26px; font-weight: 700; color: #fff;
  text-shadow: 0 0 14px rgba(79, 246, 255, .6);
}
.hud-time .hud-val { color: var(--neon-gold); text-shadow: 0 0 14px rgba(255, 209, 102, .7); }
.hud-cell:first-child { align-items: flex-start; }
.hud-cell:last-child { align-items: flex-end; }

.game-combo {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%);
  font-size: 22px; font-weight: 700; letter-spacing: 3px;
  color: var(--neon-pink);
  text-shadow: 0 0 16px rgba(255, 110, 199, .8);
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.game-combo.show { opacity: 1; }

.game-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 14px;
}
#game-start { background: rgba(10, 14, 39, .35); backdrop-filter: blur(2px); }
.gs-emoji { font-size: 62px; animation: floaty 3s ease-in-out infinite; filter: drop-shadow(0 0 20px rgba(255,209,102,.6)); }
.gs-title {
  font-size: clamp(30px, 5vw, 44px); letter-spacing: 6px; color: #fff;
  text-shadow: 0 0 10px var(--neon-cyan), 0 0 30px var(--neon-purple), 0 0 60px var(--neon-pink);
}
.gs-sub { font-size: 14px; color: var(--text-dim); letter-spacing: 1px; }
.gs-hint { font-size: 12px; color: var(--text-dim); letter-spacing: 2px; margin-top: 6px; }

.cd-num { font-size: clamp(70px, 14vw, 120px); font-weight: 800; color: #fff; text-shadow: 0 0 30px var(--neon-cyan), 0 0 70px var(--neon-pink); }
.cd-pop { animation: cd-pop .55s cubic-bezier(.22, 1.4, .36, 1) both; }
@keyframes cd-pop { from { opacity: 0; transform: scale(2.2); } 60% { opacity: 1; transform: scale(.92); } to { transform: scale(1); } }

.game-card {
  width: min(88vw, 380px);
  padding: 30px 26px;
  background: linear-gradient(165deg, rgba(27,35,80,.96), rgba(16,20,46,.96));
  border: 1px solid rgba(167, 139, 250, .5);
  border-radius: 22px;
  box-shadow: 0 0 46px rgba(167, 139, 250, .4);
  backdrop-filter: blur(6px);
}
.card-in { animation: card-in .6s cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(40px) scale(.85); } to { opacity: 1; transform: none; } }
.gc-head { font-size: 24px; font-weight: 800; letter-spacing: 4px; color: var(--neon-cyan); text-shadow: 0 0 16px rgba(79,246,255,.7); margin-bottom: 4px; }
.gc-label { font-size: 10px; letter-spacing: 3px; color: var(--text-dim); margin-top: 14px; }
.gc-score { font-size: 48px; font-weight: 800; color: #fff; text-shadow: 0 0 20px rgba(255,255,255,.5); line-height: 1.1; font-variant-numeric: tabular-nums; margin-bottom: 14px; }
.gc-title {
  display: inline-block;
  font-size: 19px; letter-spacing: 2px; color: var(--neon-gold);
  padding: 8px 18px; margin-bottom: 20px;
  border: 1px dashed rgba(255, 209, 102, .55); border-radius: 999px;
  text-shadow: 0 0 12px rgba(255, 209, 102, .6);
  animation: card-in .6s .25s cubic-bezier(.34, 1.56, .64, 1) both;
}
.gc-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.gc-btns .btn-neon { font-size: 14px; padding: 11px 22px; }
.gc-btns .btn-ghost { font-size: 14px; padding: 11px 22px; }

/* ============ 桌面端微调 ============ */
@media (min-width: 700px) {
  .gift-grid { grid-template-columns: repeat(3, 1fr); max-width: 480px; }
  .photo-card { flex-basis: 340px; }
}
