/* ==========================================================
   20/10 SURPRISE - CHÚC MỪNG CÔNG CHÚA NHỎ 💖
   Giao diện chuẩn 100% theo video TikTok Dr.Gifter
   ========================================================== */

:root {
  --primary-pink: #ff6b8b;
  --dark-pink: #d94a6b;
  --soft-pink: #ffe6ee;
  --light-pink: #fff0f5;
  --border-pink: #ffb8cd;
  
  --text-main: #4d384b;
  --text-muted: #886786;
  --text-pink: #e04f76;
  
  --font-main: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-handwrite: 'Dancing Script', cursive;
  --font-title: 'Quicksand', sans-serif;
  
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-full: 9999px;

  --shadow-card: 0 15px 40px rgba(230, 100, 130, 0.22);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  font-family: var(--font-main);
  background: linear-gradient(135deg, #ffeef2 0%, #fff4f7 50%, #fbe8f2 100%);
  color: var(--text-main);
}

/* Background Sakura Canvas */
#bgCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* ==========================================================
   NÚT QUAY LẠI TRANG TRƯỚC (FLOATING BACK BUTTON)
   ========================================================== */
.btn-back {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid #ffccd8;
  backdrop-filter: blur(12px);
  padding: 8px 18px 8px 14px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--dark-pink);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 107, 139, 0.2);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-15px);
}

.btn-back.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
}

.btn-back:hover {
  background: #fff0f5;
  border-color: var(--primary-pink);
  transform: translateX(-3px);
  box-shadow: 0 8px 25px rgba(255, 107, 139, 0.32);
}

/* ==========================================================
   TRÌNH PHÁT NHẠC NỔI (FLOATING MUSIC PLAYER)
   ========================================================== */
.floating-music {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.9);
  border: 1.5px solid #ffccd8;
  backdrop-filter: blur(12px);
  padding: 6px 14px 6px 8px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 25px rgba(255, 107, 139, 0.22);
  transition: all 0.3s ease;
}

.floating-music:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(255, 107, 139, 0.32);
}

.music-disc {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle, #3d3036 35%, #181114 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.floating-music.playing .music-disc {
  animation: spinDisc 3.5s linear infinite;
}

@keyframes spinDisc {
  100% { transform: rotate(360deg); }
}

.disc-inner {
  width: 14px;
  height: 14px;
  background: var(--primary-pink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.disc-inner i {
  font-size: 7px;
  color: #fff;
}

.music-text {
  display: flex;
  flex-direction: column;
}

.music-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.music-eq {
  display: flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 10px;
}

.music-eq span {
  width: 2.5px;
  height: 3px;
  background: var(--primary-pink);
  border-radius: 2px;
}

.floating-music.playing .music-eq span:nth-child(1) { animation: eqAnim 0.8s infinite alternate 0.1s; }
.floating-music.playing .music-eq span:nth-child(2) { animation: eqAnim 0.8s infinite alternate 0.3s; }
.floating-music.playing .music-eq span:nth-child(3) { animation: eqAnim 0.8s infinite alternate 0.2s; }
.floating-music.playing .music-eq span:nth-child(4) { animation: eqAnim 0.8s infinite alternate 0.4s; }

@keyframes eqAnim {
  0% { height: 3px; }
  100% { height: 10px; }
}

.music-toggle-btn {
  width: 28px;
  height: 28px;
  background: #ffe6ee;
  color: var(--primary-pink);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.music-toggle-btn:hover {
  background: var(--primary-pink);
  color: #fff;
}

/* ==========================================================
   CẤU TRÚC STAGE (SCREEN STAGES)
   ========================================================== */
.screen-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  transform: scale(0.96);
  padding: 20px;
}

.screen-stage.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
}

/* ==========================================================
   STAGE 0: TRANG BÌA MỞ ĐẦU (ROMANTIC LANDING / WELCOME PAGE)
   ========================================================== */
.welcome-container {
  max-width: 450px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  perspective: 1200px;
}

.welcome-card {
  background: rgba(255, 255, 255, 0.94);
  border: 3px solid #ffd1dc;
  border-radius: var(--radius-lg);
  padding: 34px 26px 26px;
  box-shadow: 0 20px 50px rgba(230, 100, 130, 0.28);
  backdrop-filter: blur(16px);
  text-align: center;
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0.2, 1), box-shadow 0.3s ease;
  will-change: transform;
}

.welcome-card::before {
  content: '';
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  height: 190px;
  background: radial-gradient(circle, rgba(255, 182, 193, 0.5) 0%, rgba(254, 202, 87, 0.2) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* BƯỚM 3D VỖ CÁNH BAY LƯỢN */
.welcome-butterfly {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 32px;
  height: 32px;
  pointer-events: none;
  z-index: 10;
  transform-style: preserve-3d;
  animation: butterflyFly 4.5s ease-in-out infinite alternate;
}

.butterfly-body {
  position: absolute;
  top: 8px;
  left: 14px;
  width: 4px;
  height: 16px;
  background: #593342;
  border-radius: 4px;
}

.welcome-butterfly .wing {
  position: absolute;
  width: 16px;
  height: 20px;
  background: linear-gradient(135deg, #ff6b8b 0%, #ffd32a 100%);
  border-radius: 14px 14px 3px 14px;
  box-shadow: 0 0 10px rgba(255, 107, 139, 0.7);
}

.welcome-butterfly .wing-left {
  left: 0;
  top: 6px;
  transform-origin: right center;
  animation: flapLeft 0.16s ease-in-out infinite alternate;
}

.welcome-butterfly .wing-right {
  left: 16px;
  top: 6px;
  transform-origin: left center;
  border-radius: 14px 14px 14px 3px;
  animation: flapRight 0.16s ease-in-out infinite alternate;
}

@keyframes flapLeft {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(65deg); }
}

@keyframes flapRight {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(-65deg); }
}

@keyframes butterflyFly {
  0% { transform: translate(0, 0) rotate(5deg) scale(0.9); }
  33% { transform: translate(-12px, -8px) rotate(-8deg) scale(1.05); }
  66% { transform: translate(8px, -15px) rotate(12deg) scale(0.95); }
  100% { transform: translate(-4px, 4px) rotate(-3deg) scale(1); }
}

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #fff0f5 0%, #ffe4ec 100%);
  border: 1.5px solid #ffccd8;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--dark-pink);
  letter-spacing: 1px;
  box-shadow: 0 4px 14px rgba(255, 107, 139, 0.2);
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
  animation: badgeGlowPulse 2.5s infinite alternate;
}

@keyframes badgeGlowPulse {
  0% { box-shadow: 0 4px 14px rgba(255, 107, 139, 0.2); }
  100% { box-shadow: 0 6px 20px rgba(255, 107, 139, 0.45); }
}

/* TIÊU ĐỀ LÃNG MẠN VỚI HIỆU ỨNG ÁNH SÁNG CHUYỂN ĐỘNG */
.welcome-title {
  font-family: var(--font-title);
  font-size: 1.7rem;
  font-weight: 800;
  background: linear-gradient(120deg, #d94a6b 0%, #ff477e 25%, #ff9f43 50%, #ff6b8b 75%, #d94a6b 100%);
  background-size: 250% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: titleShimmer 4s linear infinite;
  line-height: 1.35;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}

@keyframes titleShimmer {
  0% { background-position: 0% center; }
  100% { background-position: 250% center; }
}

.welcome-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}

/* GỢI Ý NGỌT NGÀO KÈM BÀN TAY CHỈ DẪN CHẠM THỬ (CHARMS GUIDE HINT) */
.charms-guide-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 238, 245, 0.96) 100%);
  border: 1.5px dashed #ff8fa3;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  color: #ff3366;
  box-shadow: 0 4px 14px rgba(255, 107, 139, 0.18);
  margin: 6px auto 6px;
  cursor: pointer;
  user-select: none;
  position: relative;
  z-index: 3;
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  animation: hintFloat 2.5s ease-in-out infinite alternate;
}

.charms-guide-hint:hover {
  background: #fff0f5;
  border-color: #ff4d6d;
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 18px rgba(255, 107, 139, 0.32);
}

.charms-guide-hint.hidden {
  opacity: 0;
  transform: translateY(-8px) scale(0.85);
  pointer-events: none;
}

.guide-hand-tap {
  display: inline-block;
  font-size: 1.05rem;
  animation: handTapBounce 1.1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  transform-origin: center bottom;
}

@keyframes handTapBounce {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(3px) scale(0.9);
  }
}

@keyframes hintFloat {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-4px);
  }
}

/* BONG BÓNG BIỂU TƯỢNG TƯƠNG TÁC (CHARMS BAR) */
.welcome-charms-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 6px auto 6px;
  position: relative;
  z-index: 2;
}

.charm-bubble {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid #ffccd8;
  box-shadow: 0 4px 12px rgba(255, 107, 139, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.18rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: charmBob 3s ease-in-out infinite alternate;
  user-select: none;
}

/* Vòng sóng năng lượng lan tỏa mời gọi bấm */
.charm-bubble::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 107, 139, 0.5);
  opacity: 0;
  animation: charmPulseRing 2.4s ease-out infinite;
  pointer-events: none;
}

.charm-bubble:nth-child(1) { animation-delay: 0s; }
.charm-bubble:nth-child(1)::after { animation-delay: 0s; }

.charm-bubble:nth-child(2) { animation-delay: 0.4s; }
.charm-bubble:nth-child(2)::after { animation-delay: 0.48s; }

.charm-bubble:nth-child(3) { animation-delay: 0.8s; }
.charm-bubble:nth-child(3)::after { animation-delay: 0.96s; }

.charm-bubble:nth-child(4) { animation-delay: 1.2s; }
.charm-bubble:nth-child(4)::after { animation-delay: 1.44s; }

.charm-bubble:nth-child(5) { animation-delay: 1.6s; }
.charm-bubble:nth-child(5)::after { animation-delay: 1.92s; }

@keyframes charmPulseRing {
  0% {
    transform: scale(0.95);
    opacity: 0.75;
  }
  60% {
    transform: scale(1.35);
    opacity: 0;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

.charm-bubble:hover {
  transform: scale(1.3) translateY(-4px) !important;
  background: #fff0f5;
  border-color: #ff6b8b;
  box-shadow: 0 8px 22px rgba(255, 107, 139, 0.45);
}

.charm-bubble:active {
  transform: scale(0.9) !important;
}

.charm-bubble.popped {
  transform: scale(0) !important;
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

@keyframes charmBob {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}

/* HIỆU ỨNG CHỮ LÃNG MẠN BAY LÊN KHI CHẠM NỔ BONG BÓNG */
.floating-charm-toast {
  position: fixed;
  z-index: 999999;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 18px;
  border-radius: 999px;
  border: 1.5px solid #ff758f;
  box-shadow: 0 10px 28px rgba(255, 71, 87, 0.35), 0 0 18px rgba(255, 182, 193, 0.6);
  color: #ff3366;
  font-family: var(--font-main), sans-serif;
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  animation: charmFloatUp 1.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  user-select: none;
}

@keyframes charmFloatUp {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.6);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -24px) scale(1.1);
  }
  40% {
    transform: translate(-50%, -36px) scale(1);
  }
  75% {
    opacity: 1;
    transform: translate(-50%, -58px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -85px) scale(0.85);
  }
}

/* HỘP QUÀ 3D NỔI BẬT & SINH ĐỘNG */
.gift-box-wrapper {
  position: relative;
  width: 220px;
  height: 195px;
  margin: 14px auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 800px;
  z-index: 2;
}

/* VÒNG HÀO QUANG NĂNG LƯỢNG LAN TỎA */
.gift-pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 107, 139, 0.4);
  border-radius: 50%;
  pointer-events: none;
  animation: auraRingExpand 3s cubic-bezier(0.2, 0.8, 0.4, 1) infinite;
}

.gift-pulse-ring.ring-1 {
  width: 140px;
  height: 140px;
}

.gift-pulse-ring.ring-2 {
  width: 140px;
  height: 140px;
  animation-delay: 1.5s;
}

@keyframes auraRingExpand {
  0% {
    transform: translate(-50%, -50%) scale(0.85);
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.65);
    opacity: 0;
  }
}

.gift-glow-effect {
  position: absolute;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(255, 107, 139, 0.4) 0%, rgba(254, 202, 87, 0.25) 50%, transparent 75%);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: glowPulse 2.5s ease-in-out infinite alternate;
  pointer-events: none;
}

/* BONG BÓNG GỢI Ý NHÚN NHẢY */
.gift-mystery-bubble {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  border: 1.5px solid #ffb3c6;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--dark-pink);
  box-shadow: 0 4px 14px rgba(255, 107, 139, 0.28);
  white-space: nowrap;
  z-index: 10;
  pointer-events: auto;
  cursor: pointer;
  animation: mysteryBubbleFloat 2.2s ease-in-out infinite alternate;
  transition: all 0.2s ease;
}

.gift-mystery-bubble:hover {
  transform: translateX(-50%) scale(1.08);
  background: #fff0f5;
  border-color: #ff6b8b;
}

.gift-mystery-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0 6px;
  border-style: solid;
  border-color: #ffb3c6 transparent transparent transparent;
}

@keyframes mysteryBubbleFloat {
  0% { transform: translateX(-50%) translateY(0); }
  100% { transform: translateX(-50%) translateY(-6px); }
}

.gift-sparkles-floating {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.g-sparkle {
  position: absolute;
  font-size: 1.15rem;
  opacity: 0.85;
  user-select: none;
  animation: sparkleFloat 3s ease-in-out infinite alternate;
}

.g-sparkle.s1 { top: 10px; left: 16px; animation-delay: 0s; }
.g-sparkle.s2 { top: 12px; right: 18px; animation-delay: 0.6s; font-size: 1.25rem; }
.g-sparkle.s3 { bottom: 25px; left: 12px; animation-delay: 1.2s; font-size: 1.1rem; }
.g-sparkle.s4 { bottom: 20px; right: 15px; animation-delay: 1.8s; font-size: 1.05rem; }
.g-sparkle.s5 { top: 48%; left: 0px; animation-delay: 2.3s; font-size: 1.1rem; }

/* HỘP QUÀ LẮC LƯ NHẢY VUI NHỘN NHƯ CÓ BẤT NGỜ BÊN TRONG */
.gift-box-3d {
  position: relative;
  width: 140px;
  height: 135px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
  animation: giftPlayfulJiggle 3.8s ease-in-out infinite;
}

.gift-box-3d:hover {
  transform: scale(1.12) rotate(-3deg);
  filter: drop-shadow(0 14px 26px rgba(255, 71, 126, 0.5));
}

.gift-box-3d:active {
  transform: scale(0.97);
}

@keyframes giftPlayfulJiggle {
  0%, 78%, 100% { transform: translateY(0) rotate(0deg); }
  81% { transform: translateY(-11px) rotate(-6deg) scale(1.06); }
  84% { transform: translateY(-3px) rotate(5deg) scale(1.04); }
  87% { transform: translateY(-8px) rotate(-4deg) scale(1.05); }
  90% { transform: translateY(-2px) rotate(3deg) scale(1.02); }
  93% { transform: translateY(0) rotate(0deg); }
}

/* TIA SÁNG LÓE LÊN KHI MỞ HỘP QUÀ */
.gift-light-ray {
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(255, 234, 167, 0.85) 0%, rgba(255, 107, 139, 0.45) 45%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
  z-index: 1;
}

.gift-lid {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 154px;
  height: 36px;
  background: linear-gradient(135deg, #ff4772 0%, #ff6b8b 50%, #e03860 100%);
  border-radius: 8px 8px 4px 4px;
  box-shadow: 0 6px 18px rgba(255, 71, 114, 0.35);
  z-index: 5;
  transform-origin: top left;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
}

.gift-bow {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 26px;
}

.bow-left, .bow-right {
  position: absolute;
  width: 25px;
  height: 24px;
  background: linear-gradient(135deg, #ffd32a 0%, #feca57 50%, #ff9f43 100%);
  box-shadow: 0 3px 8px rgba(254, 202, 87, 0.5);
}

.bow-left {
  left: 3px;
  border-radius: 50% 50% 10% 50%;
  transform: rotate(-25deg);
}

.bow-right {
  right: 3px;
  border-radius: 50% 50% 50% 10%;
  transform: rotate(25deg);
}

.bow-center {
  position: absolute;
  left: 50%;
  top: 6px;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffeaa7 0%, #ffd32a 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  z-index: 2;
}

.lid-ribbon {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 100%;
  background: linear-gradient(180deg, #ffd32a 0%, #feca57 100%);
  box-shadow: 0 0 8px rgba(254, 202, 87, 0.6);
}

.gift-body {
  position: absolute;
  top: 47px;
  left: 50%;
  transform: translateX(-50%);
  width: 136px;
  height: 86px;
  background: linear-gradient(135deg, #e83a62 0%, #ff6082 50%, #d42950 100%);
  border-radius: 0 0 16px 16px;
  box-shadow: 0 12px 28px rgba(232, 58, 98, 0.35);
  position: relative;
  overflow: hidden;
}

.body-ribbon-v {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 100%;
  background: linear-gradient(180deg, #ffd32a 0%, #feca57 100%);
  box-shadow: 0 0 8px rgba(254, 202, 87, 0.4);
}

.body-ribbon-h {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 100%;
  height: 20px;
  background: linear-gradient(90deg, #ffd32a 0%, #feca57 50%, #ffd32a 100%);
  box-shadow: 0 0 8px rgba(254, 202, 87, 0.4);
}

.gift-tag {
  position: absolute;
  top: 12px;
  right: 8px;
  background: #fffdf9;
  border: 1px solid #ffd1dc;
  padding: 4px 8px;
  border-radius: 6px;
  transform: rotate(12deg);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.25;
  z-index: 2;
}

.gift-tag .tag-to {
  color: var(--dark-pink);
}

.gift-tag .tag-from {
  color: var(--text-muted);
  font-size: 0.6rem;
}

/* TRẠNG THÁI KHI MỞ HỘP QUÀ */
.gift-box-3d.opened {
  animation: none;
}

.gift-box-3d.opened .gift-lid {
  transform: translateX(-50%) translateY(-56px) rotate(-34deg);
  opacity: 0.95;
}

.gift-box-3d.opened .gift-light-ray {
  transform: translateX(-50%) translateY(-24px) scale(1.5);
  opacity: 1;
}

.welcome-action-wrap {
  position: relative;
  z-index: 2;
  margin-top: 8px;
}

.gift-instruction {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--text-pink);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-open-gift {
  width: 100%;
  background: linear-gradient(135deg, #ff477e 0%, #ff6b8b 50%, #ff85a2 100%);
  border: none;
  border-radius: var(--radius-full);
  padding: 14px 24px;
  color: #fff;
  font-family: var(--font-main);
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 25px rgba(255, 71, 126, 0.45);
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-open-gift::before {
  content: '';
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-20deg);
  animation: shimmerSweep 3s infinite;
}

.btn-open-gift:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 30px rgba(255, 71, 126, 0.6);
}

.btn-open-gift:active {
  transform: translateY(1px) scale(0.98);
}

.btn-gift-icon {
  font-size: 1.35rem;
  animation: pulseGiftIcon 1.5s infinite alternate;
}

.welcome-footer-note {
  margin-top: 16px;
  font-size: 0.74rem;
  color: #a4859a;
  font-weight: 600;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 1;
}

@keyframes glowPulse {
  0% { transform: translate(-50%, -50%) scale(0.85); opacity: 0.55; }
  100% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.95; }
}

@keyframes sparkleFloat {
  0% { transform: translateY(0) scale(0.9); }
  100% { transform: translateY(-8px) scale(1.15); }
}

@keyframes pulseGiftIcon {
  0% { transform: scale(1); }
  100% { transform: scale(1.22); }
}

@keyframes shimmerSweep {
  0% { left: -75%; }
  100% { left: 125%; }
}

/* ==========================================================
   STAGE 1: MÀN HÌNH KHÓA MẬT MÃ TÌNH YÊU (LOVE PASSCODE)
   ========================================================== */
.lock-container {
  max-width: 380px;
  width: 100%;
  margin: 0 auto;
}

.lock-card {
  background: rgba(255, 255, 255, 0.94);
  border: 3px solid #ffd1dc;
  border-radius: var(--radius-lg);
  padding: 32px 24px 28px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
  text-align: center;
  position: relative;
  animation: cardFloat 4s ease-in-out infinite alternate;
}

.lock-card.shake {
  animation: lockShake 0.5s ease-in-out;
}

@keyframes lockShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-12px); }
  40%, 80% { transform: translateX(12px); }
}

.lock-card.unlocked {
  transform: scale(1.08);
  box-shadow: 0 0 50px rgba(255, 107, 139, 0.6);
}

.lock-icon-wrap {
  width: 65px;
  height: 65px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #ffeef2 0%, #ffccd8 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-pink);
  font-size: 1.6rem;
  box-shadow: 0 6px 18px rgba(255, 107, 139, 0.25);
  transition: all 0.3s ease;
}

.lock-card.unlocked .lock-icon-wrap {
  background: linear-gradient(135deg, #a8e6cf 0%, #56ab2f 100%);
  color: #fff;
  transform: scale(1.15);
}

.lock-title {
  font-family: var(--font-title);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--dark-pink);
  margin-bottom: 6px;
}

.lock-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 22px;
}

/* Passcode Dots (Hearts) - Linh hoạt với mọi độ dài mật mã (4 hoặc 8 số) */
.passcode-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.dot-heart {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px dashed #ffb8cd;
  background: #fff8fa;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 0.95rem;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dot-heart.filled {
  border-style: solid;
  border-color: var(--primary-pink);
  background: #ffe3eb;
  color: var(--primary-pink);
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(255, 107, 139, 0.35);
}

.lock-msg {
  font-size: 0.85rem;
  color: var(--text-pink);
  font-weight: 700;
  min-height: 22px;
  margin-bottom: 20px;
  transition: all 0.2s ease;
}

/* Keypad Grid (3 columns) */
.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 18px;
  max-width: 260px;
  margin: 0 auto;
}

.key-btn {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  border-radius: 50%;
  border: 1.5px solid #ffe3eb;
  background: #ffffff;
  color: var(--text-main);
  font-family: var(--font-title);
  font-size: 1.45rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 107, 139, 0.12);
  transition: all 0.15s ease;
  user-select: none;
}

.key-btn:hover {
  background: #fff0f5;
  border-color: var(--primary-pink);
  transform: scale(1.06);
}

.key-btn:active {
  transform: scale(0.92);
  background: var(--soft-pink);
}

.key-btn.key-action {
  font-size: 1.15rem;
  color: var(--primary-pink);
  background: #fff8fa;
}

/* ==========================================================
   STAGE 1: MÀN HÌNH GHÉP ẢNH 3x3 (PUZZLE SCREEN)
   ========================================================== */
.puzzle-container {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
}

.puzzle-card {
  background: rgba(255, 255, 255, 0.94);
  border: 3px solid #ffd1dc;
  border-radius: var(--radius-lg);
  padding: 24px 22px 28px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
  text-align: center;
  position: relative;
  animation: cardFloat 4s ease-in-out infinite alternate;
}

@keyframes cardFloat {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}

.puzzle-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.puzzle-header .heart-deco {
  font-size: 1.4rem;
  animation: pulseDeco 1.5s infinite;
}

@keyframes pulseDeco {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.puzzle-title {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--dark-pink);
  letter-spacing: 1px;
}

/* Board */
.puzzle-board-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 330px;
  margin: 0 auto 20px;
  border-radius: var(--radius-md);
  padding: 8px;
  background: #ffffff;
  box-shadow: inset 0 2px 8px rgba(255, 107, 139, 0.15), 0 8px 20px rgba(0,0,0,0.06);
}

.puzzle-board {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 5px;
  border-radius: calc(var(--radius-md) - 6px);
  overflow: hidden;
}

/* Mảnh ghép */
.puzzle-tile {
  width: 100%;
  height: 100%;
  background-size: 300% 300%;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.puzzle-tile:hover {
  transform: scale(0.97);
  box-shadow: 0 4px 12px rgba(255, 107, 139, 0.35);
}

.puzzle-tile.selected {
  outline: 3.5px solid var(--primary-pink);
  outline-offset: -2px;
  transform: scale(1.04);
  z-index: 10;
  box-shadow: 0 8px 20px rgba(255, 77, 109, 0.5);
  animation: selectedBlink 1s infinite alternate;
}

@keyframes selectedBlink {
  from { outline-color: #ff4d6d; }
  to { outline-color: #ffd166; }
}

/* Overlay hoàn thành */
.puzzle-success-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.9);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 20;
}

.puzzle-success-overlay.show {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.success-badge {
  font-family: var(--font-title);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--dark-pink);
  margin-bottom: 8px;
}

.success-content p {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.btn-continue-gift {
  margin-top: 14px;
  background: linear-gradient(135deg, var(--primary-pink), var(--dark-pink));
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  padding: 10px 22px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-continue-gift:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 22px rgba(255, 71, 87, 0.55);
}

/* Progress bar & Actions */
.puzzle-footer {
  width: 100%;
}

.puzzle-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 8px;
  padding: 0 6px;
}

.progress-label {
  color: var(--text-muted);
}

.progress-percent {
  color: var(--dark-pink);
  font-size: 1rem;
}

.progress-bar-track {
  width: 100%;
  height: 12px;
  background: #ffe4ec;
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
  margin-bottom: 18px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff9ebb 0%, #ff5c8a 100%);
  border-radius: var(--radius-full);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(255, 92, 138, 0.4);
}

.puzzle-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.btn-hint {
  border: none;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  color: var(--primary-pink);
  border: 1.5px solid #ffccd8;
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
  transition: all 0.25s ease;
}

.btn-hint:hover {
  background: #fff0f5;
  border-color: var(--primary-pink);
  transform: translateY(-2px);
}

.puzzle-motivate-tag {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--dark-pink);
  background: #fff0f5;
  border: 1.5px dashed #ffb8cd;
  padding: 6px 18px;
  border-radius: var(--radius-full);
}

/* ==========================================================
   STAGE 3: CÂU HỎI TÌNH YÊU (LOVE QUIZ)
   ========================================================== */
.quiz-container {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
}

.quiz-card {
  background: rgba(255, 255, 255, 0.94);
  border: 3px solid #ffd1dc;
  border-radius: var(--radius-lg);
  padding: 30px 24px 28px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: cardFloat 4s ease-in-out infinite alternate;
}

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.quiz-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #fff0f5 0%, #ffe4ec 100%);
  border: 1.5px solid #ffccd8;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--dark-pink);
  letter-spacing: 0.8px;
}

.quiz-counter {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-pink);
  background: #fff8fa;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1.5px solid #ffd1dc;
}

.quiz-progress-track {
  width: 100%;
  height: 8px;
  background: #ffe3ec;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 20px;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff85a2 0%, #ff477e 100%);
  border-radius: var(--radius-full);
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 8px rgba(255, 71, 126, 0.4);
}

.quiz-question-box {
  margin-bottom: 20px;
  position: relative;
}

.quiz-deco-heart {
  font-size: 1.6rem;
  margin-bottom: 6px;
  animation: pulseGiftIcon 1.5s infinite alternate;
}

.quiz-question-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 800;
  color: #382534;
  line-height: 1.4;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.quiz-opt-btn {
  background: #ffffff;
  border: 2px solid #ffd1dc;
  border-radius: var(--radius-md);
  padding: 13px 18px;
  font-family: var(--font-main);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  box-shadow: 0 4px 14px rgba(255, 107, 139, 0.08);
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.quiz-opt-btn:hover {
  background: #fff5f8;
  border-color: #ff85a2;
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 8px 20px rgba(255, 107, 139, 0.2);
}

.quiz-opt-btn:active {
  transform: scale(0.98);
}

.quiz-opt-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffe6ee;
  color: var(--dark-pink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.quiz-opt-text {
  flex-grow: 1;
}

/* Đúng: Xanh lá pastel nổi bật */
.quiz-opt-btn.correct-opt {
  background: #eafaf1 !important;
  border-color: #2ecc71 !important;
  color: #27ae60 !important;
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(46, 204, 113, 0.35);
}

.quiz-opt-btn.correct-opt .quiz-opt-letter {
  background: #2ecc71;
  color: #ffffff;
}

/* Sai: Rung lắc đỏ tươi */
.quiz-opt-btn.wrong-opt {
  background: #fdf0f0 !important;
  border-color: #e74c3c !important;
  color: #c0392b !important;
  animation: optShake 0.45s ease-in-out;
  box-shadow: 0 6px 18px rgba(231, 76, 60, 0.25);
}

.quiz-opt-btn.wrong-opt .quiz-opt-letter {
  background: #e74c3c;
  color: #ffffff;
}

@keyframes optShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.quiz-feedback {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-pink);
  min-height: 24px;
  transition: all 0.25s ease;
}

/* ==========================================================
   STAGE 4: CÂY TRÁI TIM & BỨC THƯ TÌNH (LOVE TREE)
   ========================================================== */
#stageSurprise {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  padding: 0;
}

.tree-canvas-wrapper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#treeCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.surprise-content-wrapper {
  position: relative;
  z-index: 5;
  width: 100%;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30px 45px;
  gap: 30px;
  pointer-events: none;
}

/* ----------------------------------------------------------
   BỨC THƯ TÌNH (LETTER CARD) - BÊN TRÁI
   ---------------------------------------------------------- */
.letter-card-wrapper {
  flex: 0 1 450px;
  max-width: 460px;
  width: 100%;
  pointer-events: auto;
  transition: opacity 1.1s cubic-bezier(0.16, 1, 0.3, 1), transform 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}

.letter-card-wrapper.stage-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateX(-60px);
  pointer-events: none;
}

.letter-card-wrapper.stage-revealed {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

.letter-card {
  background: rgba(255, 255, 255, 0.95);
  border: 3px solid #ffd1dc;
  border-radius: var(--radius-lg);
  padding: 28px 26px 22px;
  box-shadow: 0 20px 50px rgba(255, 107, 137, 0.25);
  backdrop-filter: blur(16px);
  position: relative;
}

.bunny-mascot {
  position: absolute;
  bottom: 12px;
  right: 18px;
  font-size: 1.6rem;
  animation: bunnyHop 2s infinite ease-in-out;
}

@keyframes bunnyHop {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.08); }
}

.letter-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.letter-title {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--dark-pink);
}

.letter-body-area {
  min-height: 220px;
  max-height: 48vh;
  overflow-y: auto;
  padding-right: 6px;
  margin-bottom: 18px;
}

.letter-body-area::-webkit-scrollbar {
  width: 5px;
}
.letter-body-area::-webkit-scrollbar-thumb {
  background: #ffb8cd;
  border-radius: 10px;
}

.letter-salutation {
  font-family: var(--font-handwrite);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--dark-pink);
  margin-bottom: 8px;
}

.typewriter-text {
  display: inline;
  font-size: 0.98rem;
  line-height: 1.7;
  color: #4a3e4d;
  white-space: pre-wrap;
  word-break: break-word;
}

.typewriter-blinker {
  display: inline-block;
  font-weight: 800;
  color: var(--primary-pink);
  animation: blinkPipe 0.7s infinite;
}

@keyframes blinkPipe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.letter-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-top: 1.5px dashed #ffd1dc;
  padding-top: 14px;
}

.letter-sign-wrap {
  display: flex;
  flex-direction: column;
}

.sign-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.sign-name {
  font-family: var(--font-handwrite);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark-pink);
}

.btn-view-love {
  background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
  color: #ffffff;
  border: none;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
  transition: all 0.25s ease;
  animation: pulseViewBtn 2s infinite;
}

@keyframes pulseViewBtn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.btn-view-love:hover {
  transform: translateY(-2px) scale(1.08);
}

/* ----------------------------------------------------------
   XẤP ẢNH XẾP CHỒNG (PHOTO DECK) - BÊN PHẢI (CÓ THỂ KÉO)
   ---------------------------------------------------------- */
.photo-deck-wrapper {
  flex: 0 1 310px;
  max-width: 320px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  margin-left: auto;
  transition: opacity 1.1s cubic-bezier(0.16, 1, 0.3, 1), transform 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}

.photo-deck-wrapper.stage-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateX(60px) scale(0.92);
  pointer-events: none;
}

.photo-deck-wrapper.stage-revealed {
  opacity: 1;
  visibility: visible;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}

.deck-hint-pill {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--dark-pink);
  background: rgba(255, 255, 255, 0.92);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 16px rgba(255, 107, 139, 0.22);
  border: 1px solid #ffd1dc;
  animation: floatHint 2s infinite ease-in-out alternate;
  white-space: nowrap;
}

@keyframes floatHint {
  from { transform: translateY(0); }
  to { transform: translateY(-4px); }
}

.photo-deck {
  position: relative;
  width: 280px;
  height: 380px;
  perspective: 1000px;
  user-select: none;
  touch-action: none;
}

.deck-card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
  background: #ffffff;
  padding: 10px 10px 34px 10px; /* Khung ảnh Polaroid với mép trắng dưới */
  box-shadow: 0 14px 35px rgba(230, 100, 130, 0.22);
  border: 4px solid #ffffff;
  cursor: grab;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease, box-shadow 0.3s ease;
  user-select: none;
  touch-action: none;
  will-change: transform;
}

.deck-card.dragging {
  cursor: grabbing !important;
  transition: none !important;
  z-index: 100 !important;
}

/* Các lớp thẻ xếp chồng 6 tầng chuẩn Polaroid */
.deck-card.card-6 { transform: translateY(20px) rotate(-8deg) scale(0.85); z-index: 1; opacity: 0.76; }
.deck-card.card-5 { transform: translateY(16px) rotate(6deg) scale(0.88); z-index: 2; opacity: 0.82; }
.deck-card.card-4 { transform: translateY(12px) rotate(-6deg) scale(0.91); z-index: 3; opacity: 0.88; }
.deck-card.card-3 { transform: translateY(8px) rotate(4deg) scale(0.94); z-index: 4; opacity: 0.93; }
.deck-card.card-2 { transform: translateY(4px) rotate(-3deg) scale(0.97); z-index: 5; opacity: 0.97; }
.deck-card.card-1 { transform: translateY(0px) rotate(0deg) scale(1); z-index: 10; opacity: 1; cursor: grab; }

.deck-card.card-1:hover:not(.dragging) {
  transform: translateY(-5px) rotate(1deg) scale(1.02);
  box-shadow: 0 22px 45px rgba(230, 100, 130, 0.38);
}

.deck-card.swiped {
  transform: translateY(-100px) rotate(-20deg) scale(0.7);
  opacity: 0;
  pointer-events: none;
}

.card-inner {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 12px;
  pointer-events: none;
  user-select: none;
}

.deck-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #ffe6ee;
  pointer-events: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-select: none;
}

/* ==========================================================
   MODAL PHÓNG TO ẢNH (LIGHTBOX NHƯ GIÂY 00:36)
   ========================================================== */
.modal-lightbox {
  position: fixed;
  inset: 0;
  z-index: 3500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 15, 25, 0.7);
  backdrop-filter: blur(8px);
}

.lightbox-card {
  position: relative;
  z-index: 2;
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 12px 12px 18px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0,0,0,0.35);
  transform: scale(0.85);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-lightbox.active .lightbox-card {
  transform: scale(1);
}

.lightbox-close-btn {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 34px;
  height: 34px;
  background: #ff4d6d;
  color: #ffffff;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(255, 77, 109, 0.4);
  transition: transform 0.2s ease;
}

.lightbox-close-btn:hover {
  transform: scale(1.15) rotate(90deg);
}

.lightbox-img-wrap {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  overflow: hidden;
  background: #ffeef2;
}

.lightbox-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lightbox-caption {
  font-family: var(--font-handwrite);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--dark-pink);
  margin-top: 12px;
}

/* ==========================================================
   MODAL XEM ẢNH GỐC & CELEBRATE MODAL
   ========================================================== */
.modal-preview, .modal-celebrate {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-preview.active, .modal-celebrate.active {
  opacity: 1;
  visibility: visible;
}

.preview-backdrop, .celebrate-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(40, 25, 35, 0.6);
  backdrop-filter: blur(8px);
}

.preview-box, .celebrate-box {
  position: relative;
  z-index: 2;
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
  transform: scale(0.88);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-preview.active .preview-box,
.modal-celebrate.active .celebrate-box {
  transform: scale(1);
}

.preview-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: #ffeef2;
  color: var(--dark-pink);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-title {
  font-family: var(--font-title);
  font-size: 1.3rem;
  color: var(--dark-pink);
  margin-bottom: 14px;
}

.preview-img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 280px;
  margin: 0 auto 12px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 3px solid #ffccd8;
}

.preview-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Celebrate Box */
.celebrate-emoji {
  font-size: 3rem;
  margin-bottom: 10px;
  animation: pulseDeco 1.2s infinite;
}

.celebrate-title {
  font-family: var(--font-title);
  font-size: 1.6rem;
  color: var(--dark-pink);
  margin-bottom: 12px;
}

.celebrate-msg {
  font-size: 1rem;
  color: var(--text-main);
  line-height: 1.6;
  margin-bottom: 16px;
}

.celebrate-hearts {
  font-size: 1.4rem;
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
}

.btn-celebrate-close {
  background: linear-gradient(135deg, #ff758f 0%, #ff4d6d 100%);
  color: #fff;
  border: none;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  padding: 12px 30px;
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 77, 109, 0.4);
  transition: all 0.25s ease;
}

.btn-celebrate-close:hover {
  transform: scale(1.05);
}

/* ==========================================================
   RESPONSIVE (ĐIỆN THOẠI & MÁY TÍNH BẢNG)
   ========================================================== */
@media (max-width: 900px) {
  #stageSurprise {
    overflow-y: auto;
    position: relative;
    height: auto;
    min-height: 100vh;
  }
  
  .tree-canvas-wrapper {
    position: fixed;
    inset: 0;
  }

  .surprise-content-wrapper {
    flex-direction: column-reverse;
    justify-content: center;
    padding: 70px 16px 40px;
    gap: 35px;
    min-height: 100vh;
  }

  .letter-card-wrapper {
    max-width: 100%;
    width: 100%;
  }

  .photo-deck-wrapper {
    max-width: 100%;
  }

  .photo-deck {
    width: 250px;
    height: 330px;
  }
}

@media (max-width: 480px) {
  .lock-card {
    padding: 26px 18px 22px;
  }
  .key-btn {
    width: 58px;
    height: 58px;
    font-size: 1.35rem;
  }
  .puzzle-card {
    padding: 20px 14px 22px;
  }
  .puzzle-title {
    font-size: 1.5rem;
  }
  .puzzle-board-wrapper {
    max-width: 290px;
    padding: 6px;
  }
  .letter-card {
    padding: 24px 18px 20px;
  }
  .letter-title {
    font-size: 1.2rem;
  }
  .photo-deck {
    width: 230px;
    height: 300px;
  }
  .floating-music {
    top: 12px;
    right: 12px;
    padding: 4px 10px 4px 6px;
  }
  .music-name {
    font-size: 0.7rem;
  }
}
