/* ===================================================================
   CHÚC MỪNG NGÀY PHỤ NỮ VIỆT NAM 20/10 - DÀNH TẶNG NGƯỜI YÊU
   Thiết kế: Mềm mại, Tinh tế, Sang trọng & Mobile-First
   =================================================================== */

:root {
  /* Bảng màu lãng mạn pastel */
  --primary: #ff4d6d;
  --primary-light: #ff758f;
  --primary-dark: #c9184a;
  --primary-subtle: #fff0f3;
  --primary-border: #ffccd5;
  --accent-gold: #f4a261;
  --accent-cream: #fffaf0;
  
  --text-main: #3b0918;
  --text-sub: #7a2b47;
  --text-light: #a85875;
  
  --bg-gradient: radial-gradient(circle at 50% 15%, #fff0f3 0%, #ffd6e0 45%, #fec5bb 80%, #fcd5ce 100%);
  --paper-bg: #fffdf9;
  --glass-bg: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.65);
  
  --shadow-soft: 0 10px 30px rgba(201, 24, 74, 0.12);
  --shadow-card: 0 16px 36px rgba(164, 19, 60, 0.14), 0 4px 10px rgba(0, 0, 0, 0.04);
  --shadow-float: 0 20px 45px rgba(255, 77, 109, 0.22);
  
  --font-main: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-script: 'Dancing Script', cursive;
  
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-full: 9999px;
}

/* Reset chuẩn & Ẩn hoàn toàn thanh cuộn (scrollbar) trên mọi trình duyệt */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  scrollbar-width: none !important; /* Firefox */
  -ms-overflow-style: none !important; /* IE, Edge */
}

*::-webkit-scrollbar {
  display: none !important; /* Chrome, Safari, Edge, Opera */
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  font-family: var(--font-main);
  color: var(--text-main);
  background: var(--bg-gradient);
  background-attachment: fixed;
  font-size: 16px;
  line-height: 1.5;
  user-select: none;
  -webkit-user-select: none;
}

/* Canvas hiệu ứng hạt & cánh hoa */
#petalCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 2;
}

/* ===================================================================
   NÚT NHẠC NỀN (GÓC TRÊN BÊN PHẢI)
   =================================================================== */
.music-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-soft);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 44px;
}

.music-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  background: #ffffff;
}

.music-icon {
  font-size: 16px;
  line-height: 1;
  transition: transform 0.3s ease;
}

.music-toggle.playing .music-icon {
  animation: musicSpin 3s linear infinite;
}

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

/* Sóng nhạc mini */
.music-waves {
  display: flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 14px;
}

.music-waves span {
  width: 2.5px;
  height: 4px;
  background-color: var(--primary);
  border-radius: 2px;
  transition: height 0.2s ease;
}

.music-toggle.playing .music-waves span:nth-child(1) {
  animation: wavePulse 0.8s ease-in-out infinite alternate;
}
.music-toggle.playing .music-waves span:nth-child(2) {
  animation: wavePulse 0.8s ease-in-out infinite alternate 0.25s;
}
.music-toggle.playing .music-waves span:nth-child(3) {
  animation: wavePulse 0.8s ease-in-out infinite alternate 0.5s;
}

@keyframes wavePulse {
  0% { height: 4px; }
  100% { height: 14px; }
}

/* ===================================================================
   KHUNG CHÍNH (APP CONTAINER - MOBILE FIRST & DESKTOP CENTERED)
   =================================================================== */
.app-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  z-index: 10;
  display: flex;
  flex-direction: column;
}

/* Desktop: tạo khung sang trọng cho máy tính */
@media (min-width: 600px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
  }
  .app-container {
    height: 94vh;
    height: 94dvh;
    border-radius: 36px;
    box-shadow: 0 25px 60px rgba(164, 19, 60, 0.2), 0 0 0 8px rgba(255, 255, 255, 0.4);
    background: var(--bg-gradient);
    border: 1px solid rgba(255, 255, 255, 0.8);
  }
}

/* Cấu trúc từng màn hình */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.96) translateY(12px);
  transition: opacity 0.6s cubic-bezier(0.2, 0.9, 0.3, 1),
              transform 0.6s cubic-bezier(0.2, 0.9, 0.3, 1),
              visibility 0.6s;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.screen::-webkit-scrollbar,
.app-container::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

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

.screen-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 5;
}

/* Huy hiệu nhỏ */
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-full);
  box-shadow: 0 4px 12px rgba(255, 77, 109, 0.1);
  margin-bottom: 24px;
}

/* Nút bấm dùng chung */
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-main);
  border: none;
  border-radius: var(--radius-full);
  box-shadow: 0 8px 24px rgba(201, 24, 74, 0.32);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  touch-action: manipulation;
}

.primary-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 28px rgba(201, 24, 74, 0.45);
}

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

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-full);
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.25s ease;
}

.ghost-btn:hover {
  background: #ffffff;
  color: var(--primary-dark);
}

.pulse-anim {
  animation: btnPulse 2s infinite;
}

@keyframes btnPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(201, 24, 74, 0.32); }
  50% { box-shadow: 0 12px 32px rgba(201, 24, 74, 0.55), 0 0 0 6px rgba(255, 77, 109, 0.2); }
}

.hidden {
  display: none !important;
}

/* ===================================================================
   MÀN 1: HỘP QUÀ 3D HOÀNG GIA CAO CẤP (LUXURY GIFT BOX)
   =================================================================== */
.intro-wrap {
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.luxury-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 20px;
  font-size: 13.5px;
  font-weight: 600;
  color: #780016;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid #d4af37;
  border-radius: var(--radius-full);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.28), inset 0 1px 2px rgba(255, 255, 255, 0.95);
  margin-bottom: 22px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.badge-star {
  font-size: 13px;
  color: #d4af37;
  animation: starPulse 1.8s infinite alternate;
}

@keyframes starPulse {
  0% { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.25); opacity: 1; }
}

.gift-box-wrapper {
  position: relative;
  width: 250px;
  height: 250px;
  margin: 24px auto 18px auto;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1000px;
  animation: luxuryFloat 3.8s ease-in-out infinite;
  touch-action: manipulation;
}

@keyframes luxuryFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(1deg); }
}

/* Hào quang nhiều tầng lung linh */
.gift-aurora {
  position: absolute;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(255, 77, 109, 0.45) 0%, rgba(255, 215, 0, 0.28) 40%, rgba(255, 117, 143, 0) 72%);
  border-radius: 50%;
  filter: blur(16px);
  animation: auroraBreathe 3.2s infinite alternate ease-in-out;
}

@keyframes auroraBreathe {
  0% { transform: scale(0.9); opacity: 0.65; }
  100% { transform: scale(1.2); opacity: 0.98; }
}

/* 2 vòng quỹ đạo bụi sao xoay tròn */
.orbit-ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.orbit-ring-1 {
  width: 240px;
  height: 105px;
  border: 1.5px dashed rgba(255, 215, 0, 0.48);
  transform: rotate(-25deg);
  animation: orbitSpin 14s linear infinite;
}

.orbit-ring-2 {
  width: 260px;
  height: 115px;
  border: 1px dashed rgba(255, 182, 193, 0.42);
  transform: rotate(20deg);
  animation: orbitSpinRev 18s linear infinite;
}

@keyframes orbitSpin {
  0% { transform: rotate(-25deg); }
  100% { transform: rotate(335deg); }
}

@keyframes orbitSpinRev {
  0% { transform: rotate(20deg); }
  100% { transform: rotate(-340deg); }
}

/* Các ngôi sao lấp lánh xung quanh */
.magic-stars {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.m-star {
  position: absolute;
  color: #ffd700;
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.85));
  animation: twinkleStar 2s infinite ease-in-out alternate;
}

.star-1 { top: 12px; left: 18px; font-size: 16px; animation-delay: 0.2s; }
.star-2 { top: 28px; right: 20px; font-size: 14px; animation-delay: 0.7s; }
.star-3 { bottom: 32px; left: 12px; font-size: 18px; animation-delay: 1.2s; }
.star-4 { bottom: 24px; right: 18px; font-size: 15px; animation-delay: 0.4s; }

@keyframes twinkleStar {
  0% { transform: scale(0.6) rotate(0deg); opacity: 0.4; }
  100% { transform: scale(1.3) rotate(45deg); opacity: 1; }
}

/* Khối hộp quà 3D */
.gift-box-3d {
  position: relative;
  width: 170px;
  height: 170px;
  z-index: 10;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gift-box-wrapper:hover .gift-box-3d {
  transform: scale(1.05) rotate(-1deg);
}

/* Cột sáng chiếu từ trong hộp khi mở */
.gift-inner-light {
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 0;
  background: radial-gradient(ellipse at bottom, rgba(255, 255, 255, 1) 0%, rgba(255, 215, 0, 0.85) 35%, rgba(255, 77, 109, 0) 75%);
  filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  z-index: 12;
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* NẮP HỘP QUÀ */
.gift-lid {
  position: absolute;
  top: 0;
  left: -10px;
  width: 190px;
  height: 48px;
  background: linear-gradient(145deg, #ff5e7e 0%, #e01a4f 38%, #a4133c 82%, #590d22 100%);
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(89, 13, 34, 0.45), inset 0 2px 4px rgba(255, 255, 255, 0.45), inset 0 -2px 6px rgba(0, 0, 0, 0.25);
  z-index: 20;
  transform-origin: top left;
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
}

.lid-rim-gold {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4.5px;
  background: linear-gradient(90deg, #aa771c 0%, #ffd700 25%, #fff6cc 50%, #d4af37 75%, #aa771c 100%);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 1px 4px rgba(212, 175, 55, 0.6);
}

.lid-ribbon-v {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 100%;
  background: linear-gradient(90deg, #aa771c 0%, #d4af37 15%, #fff6cc 45%, #ffd700 75%, #8c5d10 100%);
  box-shadow: inset 0 0 4px rgba(0,0,0,0.2), 0 0 8px rgba(255, 215, 0, 0.35);
}

.lid-ribbon-h {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 100%;
  height: 24px;
  background: linear-gradient(180deg, #fff6cc 0%, #ffd700 35%, #d4af37 75%, #8c5d10 100%);
  box-shadow: inset 0 0 4px rgba(0,0,0,0.2);
}

/* NƠ LỤA VÀNG KIM 3D NHIỀU TẦNG */
.luxury-bow {
  position: absolute;
  top: -42px;
  left: 50%;
  transform: translateX(-50%);
  width: 116px;
  height: 52px;
  z-index: 25;
}

.bow-loop {
  position: absolute;
  background: linear-gradient(135deg, #fff8db 0%, #ffd700 30%, #d4af37 70%, #996e14 100%);
  box-shadow: 0 6px 14px rgba(138, 98, 16, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.bow-loop.back-left {
  width: 46px;
  height: 34px;
  left: 4px;
  top: 4px;
  border-radius: 50% 50% 12% 50%;
  transform: rotate(-35deg);
  filter: brightness(0.92);
}

.bow-loop.back-right {
  width: 46px;
  height: 34px;
  right: 4px;
  top: 4px;
  border-radius: 50% 50% 50% 12%;
  transform: rotate(35deg);
  filter: brightness(0.92);
}

.bow-loop.front-left {
  width: 38px;
  height: 28px;
  left: 14px;
  top: 10px;
  border-radius: 50% 50% 10% 50%;
  transform: rotate(-22deg);
}

.bow-loop.front-right {
  width: 38px;
  height: 28px;
  right: 14px;
  top: 10px;
  border-radius: 50% 50% 50% 10%;
  transform: rotate(22deg);
}

.bow-knot {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 25px;
  height: 25px;
  background: radial-gradient(circle, #fff6cc 20%, #ffd700 60%, #b38728 100%);
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3), 0 0 10px rgba(255, 215, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  border: 1.5px solid #ffffff;
}

.knot-jewel {
  font-size: 13px;
  line-height: 1;
  filter: drop-shadow(0 0 4px #ffd700);
  animation: jewelGleam 2.2s infinite alternate ease-in-out;
}

@keyframes jewelGleam {
  0% { transform: scale(0.9); filter: drop-shadow(0 0 2px #ff4d6d); }
  100% { transform: scale(1.15); filter: drop-shadow(0 0 8px #ffd700); }
}

.bow-streamer {
  position: absolute;
  width: 19px;
  height: 54px;
  background: linear-gradient(180deg, #ffd700 0%, #d4af37 60%, #996e14 100%);
  top: 28px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%);
  z-index: 15;
}

.streamer-left {
  left: 32px;
  transform: rotate(-16deg);
  transform-origin: top center;
  animation: streamerSwayLeft 3s ease-in-out infinite alternate;
}

.streamer-right {
  right: 32px;
  transform: rotate(16deg);
  transform-origin: top center;
  animation: streamerSwayRight 3s ease-in-out infinite alternate 0.5s;
}

@keyframes streamerSwayLeft {
  0% { transform: rotate(-14deg); }
  100% { transform: rotate(-20deg); }
}

@keyframes streamerSwayRight {
  0% { transform: rotate(14deg); }
  100% { transform: rotate(20deg); }
}

/* THÂN HỘP QUÀ NHUNG ĐỎ */
.gift-body {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 170px;
  height: 132px;
  background: linear-gradient(145deg, #ff477e 0%, #d90429 35%, #9b0b2e 75%, #500718 100%);
  border-radius: 0 0 16px 16px;
  box-shadow: 0 22px 48px rgba(80, 7, 24, 0.48), inset 0 2px 4px rgba(255, 255, 255, 0.25), inset 0 -4px 12px rgba(0,0,0,0.3);
  border: 1.5px solid rgba(255, 215, 0, 0.45);
  overflow: hidden;
}

.body-bevel-highlight {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.7) 50%, rgba(255,255,255,0.2) 100%);
}

.body-ribbon-vertical {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 100%;
  background: linear-gradient(90deg, #aa771c 0%, #d4af37 15%, #fff6cc 45%, #ffd700 75%, #8c5d10 100%);
  box-shadow: inset 0 0 5px rgba(0,0,0,0.25), 0 0 10px rgba(255, 215, 0, 0.3);
  overflow: hidden;
}

.body-ribbon-horizontal {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 100%;
  height: 24px;
  background: linear-gradient(180deg, #fff6cc 0%, #ffd700 35%, #d4af37 75%, #8c5d10 100%);
  box-shadow: inset 0 0 5px rgba(0,0,0,0.25);
  overflow: hidden;
}

.ribbon-shine {
  position: absolute;
  top: -50%;
  left: -150%;
  width: 200%;
  height: 200%;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,0.6) 50%, transparent 65%);
  animation: ribbonShineSweep 3.5s infinite;
}

@keyframes ribbonShineSweep {
  0%, 25% { transform: translateX(0); }
  70%, 100% { transform: translateX(180%); }
}

/* THẺ QUÀ DÁT VÀNG HOÀNG GIA */
.luxury-tag {
  position: absolute;
  bottom: 14px;
  right: 12px;
  z-index: 15;
  transform: rotate(-7deg);
  transition: transform 0.3s ease;
}

.gift-box-wrapper:hover .luxury-tag {
  transform: rotate(-13deg) scale(1.08);
}

.tag-string {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 2px;
  height: 14px;
  background: linear-gradient(180deg, #ffd700 0%, #aa771c 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.tag-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 12px 5px 12px;
  background: linear-gradient(145deg, #fffcf2 0%, #fef3c7 60%, #fde68a 100%);
  border: 1.5px solid #d4af37;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25), inset 0 1px 2px #ffffff;
}

.tag-crown {
  font-size: 11px;
  line-height: 1;
  margin-bottom: 1px;
}

.tag-title {
  font-family: var(--font-serif);
  font-size: 10.5px;
  font-weight: 700;
  color: #92400e;
  letter-spacing: 0.5px;
}

.tag-sub {
  font-size: 10px;
  font-weight: 700;
  color: #c9184a;
  margin-top: 1px;
}

/* BÓNG ĐỔ TIẾP XÚC 3D */
.gift-contact-shadow {
  position: absolute;
  bottom: 6px;
  width: 170px;
  height: 22px;
  background: radial-gradient(ellipse, rgba(80, 7, 24, 0.45) 0%, rgba(80, 7, 24, 0) 70%);
  border-radius: 50%;
  filter: blur(6px);
  transition: all 0.5s ease;
}

/* HIỆU ỨNG BẬT NẮP BÙNG NỔ KHI BẤM */
.gift-box-wrapper.opened .gift-lid {
  transform: translateY(-110px) rotate(-35deg) scale(1.08);
  opacity: 0.1;
}

.gift-box-wrapper.opened .gift-inner-light {
  height: 220px;
  opacity: 1;
  transform: translateX(-50%) translateY(-110px) scale(2);
}

.gift-box-wrapper.opened .gift-box-3d {
  animation: luxuryBoxBurst 0.75s ease-out forwards;
}

@keyframes luxuryBoxBurst {
  0% { transform: scale(1); }
  35% { transform: scale(1.12) translateY(-6px); }
  100% { transform: scale(0.88) translateY(24px); opacity: 0; }
}

/* HƯỚNG DẪN CHẠM MỞ QUÀ */
.tap-hint-luxury {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(255, 215, 0, 0.6);
  border-radius: var(--radius-full);
  box-shadow: 0 8px 24px rgba(201, 24, 74, 0.18), inset 0 1px 2px #ffffff;
  margin-top: 20px;
  cursor: pointer;
}

.tap-icon {
  font-size: 20px;
  animation: tapIconBounce 1.6s infinite ease-in-out;
}

@keyframes tapIconBounce {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.2) translateY(-3px); }
}

.tap-text-glow {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: 0.4px;
}

.tap-pulse-ring {
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border: 1.5px solid rgba(255, 77, 109, 0.4);
  border-radius: var(--radius-full);
  animation: tapRingExpand 2s infinite;
}

@keyframes tapRingExpand {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1.15); opacity: 0; }
}

/* ===================================================================
   MÀN 2: BÓ HOA NỞ & LỜI CHÚC
   =================================================================== */
.sparkle-title {
  font-family: var(--font-script);
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 6px;
  letter-spacing: 1px;
}

/* Bouquet SVG & blooming animations */
.bouquet-container {
  width: 100%;
  max-width: 320px;
  height: 270px;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bouquet-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 10px 20px rgba(201, 24, 74, 0.16));
}

/* Animation cành hoa mọc lên */
.stem {
  stroke-dasharray: 240;
  stroke-dashoffset: 240;
  animation: growStem 1.2s ease-out forwards;
}
.stem-1 { animation-delay: 0.1s; }
.stem-2 { animation-delay: 0.05s; }
.stem-3 { animation-delay: 0.15s; }
.stem-4 { animation-delay: 0.2s; }
.stem-5 { animation-delay: 0.25s; }

@keyframes growStem {
  to { stroke-dashoffset: 0; }
}

/* Animation lá mọc */
.leaf {
  transform-box: fill-box;
  transform-origin: center bottom;
  transform: scale(0);
  animation: popBloom 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.leaf-1 { animation-delay: 0.4s; }
.leaf-2 { animation-delay: 0.5s; }
.leaf-3 { animation-delay: 0.6s; }
.leaf-4 { animation-delay: 0.7s; }

/* Giấy bọc hoa xuất hiện */
.bouquet-wrap {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: bottom center;
  transform: translateY(20px);
  animation: fadeUp 0.8s ease-out forwards 0.3s;
}

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* Hoa nở bung tỏa từng bông */
.flower {
  transform-box: fill-box;
  transform-origin: center center;
  transform: scale(0);
  animation: popBloom 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.flower-1 { animation-delay: 0.8s; }
.flower-2 { animation-delay: 0.95s; }
.flower-3 { animation-delay: 1.1s; }
.flower-4 { animation-delay: 1.25s; }
.flower-center { animation-delay: 1.4s; }

.baby-breath circle {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
  animation: popBloom 0.6s ease-out forwards 1.6s;
}

@keyframes popBloom {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Lời chúc chính ở Màn 2 */
.greeting-box {
  width: 100%;
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.9s ease-out forwards 2.1s;
  margin-top: 10px;
}

.greeting-main {
  font-family: var(--font-serif);
  font-size: 25px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 10px;
}

.highlight-name {
  color: var(--primary);
  font-family: var(--font-script);
  font-size: 34px;
  display: inline-block;
  padding: 0 4px;
  text-shadow: 0 2px 10px rgba(255, 77, 109, 0.25);
}

.greeting-sub {
  font-size: 14.5px;
  color: var(--text-sub);
  line-height: 1.6;
  margin-bottom: 22px;
  padding: 0 10px;
}

/* ===================================================================
   MÀN 3: LÁ THƯ TAY VIẾT
   =================================================================== */
.letter-wrap {
  padding: 8px 0;
  max-width: 440px;
  width: 100%;
}

.letter-paper {
  position: relative;
  width: 100%;
  background: var(--paper-bg);
  border-radius: var(--radius-md);
  padding: 24px 18px 18px 18px;
  box-shadow: var(--shadow-card), inset 0 0 40px rgba(235, 215, 185, 0.25);
  border: 1px solid rgba(220, 190, 160, 0.4);
  text-align: left;
  margin-bottom: 16px;
}

/* Tem thư 20/10 ở góc */
.letter-stamp {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 44px;
  border: 2px dashed #e07a5f;
  background: #fdf0ed;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: rotate(5deg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.stamp-heart {
  font-size: 13px;
  line-height: 1;
}

.stamp-text {
  font-size: 8.5px;
  font-weight: 700;
  color: #c9184a;
  margin-top: 2px;
}

.letter-header {
  margin-bottom: 12px;
  padding-right: 42px;
}

.letter-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.35;
}

.letter-date {
  font-size: 11.5px;
  font-style: italic;
  color: var(--text-light);
  margin-top: 3px;
}

.letter-body {
  min-height: 140px;
  position: relative;
  font-size: 14px;
  line-height: 1.7;
  color: #44222f;
  letter-spacing: 0.1px;
}

.typewriter-content {
  white-space: pre-wrap;
  display: inline;
}

.typing-cursor {
  display: inline-block;
  color: var(--primary);
  font-weight: 700;
  margin-left: 2px;
  animation: blink 0.8s infinite;
}

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

.letter-footer {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed rgba(200, 150, 160, 0.35);
  display: flex;
  justify-content: flex-end;
}

.letter-sign-wrap {
  text-align: right;
}

.letter-sign-label {
  display: block;
  font-size: 11.5px;
  font-style: italic;
  color: var(--text-light);
}

.letter-signature {
  display: block;
  font-family: var(--font-script);
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 1px;
}

.letter-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  justify-content: center;
}

/* ===================================================================
   MÀN 4: KHUNG ẢNH POLAROID & GALLERY
   =================================================================== */
.gallery-wrap {
  padding: 10px 0;
  width: 100%;
}

.gallery-heading {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 20px;
}

.polaroid-stage {
  position: relative;
  width: 100%;
  max-width: 300px;
  margin: 0 auto 14px auto;
  perspective: 1000px;
}

/* Băng dính Washi Tape trang trí */
.washi-tape {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 24px;
  background: rgba(255, 230, 235, 0.85);
  backdrop-filter: blur(4px);
  border-left: 3px dashed #ffccd5;
  border-right: 3px dashed #ffccd5;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  z-index: 20;
}

.polaroid-card {
  background: #ffffff;
  padding: 12px 12px 18px 12px;
  border-radius: 12px;
  box-shadow: var(--shadow-float);
  transform: rotate(-1.5deg);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  border: 1px solid rgba(255, 220, 230, 0.6);
}

.polaroid-card.switching {
  opacity: 0.4;
  transform: scale(0.95) rotate(0deg);
}

.photo-container {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background: #fdf0f4;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
}

.polaroid-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  display: block;
  transition: transform 0.4s ease;
}

/* Placeholder khi chưa tải ảnh */
.photo-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #fff0f3 0%, #ffccd5 100%);
  color: var(--text-main);
  text-align: center;
}

.ph-icon {
  font-size: 38px;
  margin-bottom: 8px;
}

.ph-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 16px;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.ph-desc {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.5;
}

.ph-code {
  background: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  color: var(--primary);
  font-size: 11px;
}

.polaroid-caption-box {
  padding-top: 14px;
  text-align: center;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.polaroid-caption {
  font-family: var(--font-script);
  font-size: 19px;
  font-weight: 600;
  color: var(--text-sub);
  line-height: 1.35;
}

/* Bộ điều khiển chuyển ảnh */
.gallery-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 6px;
}

.gallery-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--primary-border);
  box-shadow: 0 4px 12px rgba(255, 77, 109, 0.15);
  color: var(--primary-dark);
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gallery-nav-btn:hover {
  background: var(--primary);
  color: #ffffff;
  transform: scale(1.08);
}

.gallery-dots {
  display: flex;
  gap: 8px;
}

.gallery-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(201, 24, 74, 0.25);
  cursor: pointer;
  transition: all 0.3s ease;
}

.gallery-dot.active {
  width: 24px;
  border-radius: 10px;
  background: var(--primary);
}

.swipe-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 20px;
}

/* ===================================================================
   MÀN 5: KẾT THÚC NGỌT NGÀO (FINALE)
   =================================================================== */
.finale-wrap {
  padding: 10px 0;
}

.finale-heart-pulse {
  position: relative;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.heart-big {
  font-size: 64px;
  line-height: 1;
  animation: heartBeat 1.4s ease-in-out infinite;
  filter: drop-shadow(0 10px 20px rgba(255, 77, 109, 0.4));
}

@keyframes heartBeat {
  0% { transform: scale(1); }
  14% { transform: scale(1.15); }
  28% { transform: scale(1); }
  42% { transform: scale(1.18); }
  70% { transform: scale(1); }
}

.heart-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 2px dashed rgba(255, 77, 109, 0.3);
  border-radius: 50%;
  animation: ringRotate 12s linear infinite;
}

@keyframes ringRotate {
  to { transform: rotate(360deg); }
}

.finale-quote {
  font-family: var(--font-script);
  font-size: 34px;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.3;
  margin-bottom: 12px;
  text-shadow: 0 2px 12px rgba(255, 77, 109, 0.2);
}

.finale-subtext {
  font-size: 15px;
  color: var(--text-sub);
  line-height: 1.65;
  margin-bottom: 24px;
  max-width: 340px;
}

.finale-author-badge {
  display: inline-flex;
  flex-direction: column;
  padding: 10px 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  margin-bottom: 28px;
}

.finale-author-badge span {
  font-size: 12px;
  color: var(--text-light);
  font-style: italic;
}

.finale-author-badge strong {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--primary-dark);
  margin-top: 2px;
}

.finale-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 280px;
}

.sparkle-heart-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  background: linear-gradient(135deg, #ff477e 0%, #d90429 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-full);
  box-shadow: 0 8px 24px rgba(217, 4, 41, 0.35);
  cursor: pointer;
  transition: all 0.25s ease;
}

.sparkle-heart-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 28px rgba(217, 4, 41, 0.45);
}

.sparkle-heart-btn:active {
  transform: scale(0.96);
}

.heart-counter {
  background: rgba(255, 255, 255, 0.25);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 13px;
}

.replay-btn {
  width: 100%;
}

.tap-screen-note {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 18px;
  font-style: italic;
}

/* ===================================================================
   TRÁI TIM BAY KHI CHẠM MÀN HÌNH (FLOATING TAP HEARTS)
   =================================================================== */
.floating-heart {
  position: fixed;
  pointer-events: none;
  z-index: 999;
  font-size: 24px;
  animation: floatUpFade 1.2s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
  will-change: transform, opacity;
}

@keyframes floatUpFade {
  0% {
    transform: translate(-50%, -50%) scale(0.4) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% - 60px)) scale(1.2) rotate(var(--rot, 15deg));
    opacity: 0.9;
  }
  100% {
    transform: translate(calc(-50% + var(--dx, 0px) * 1.5), calc(-50% - 130px)) scale(0.9) rotate(calc(var(--rot, 15deg) * 2));
    opacity: 0;
  }
}

/* ===================================================================
   HỖ TRỢ PREFERS-REDUCED-MOTION
   =================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  #petalCanvas {
    display: none;
  }
}
