/* ==========================================================
   final.css - Scene 5: Final Scene with Particle Heart & AB.jpg
   Tối ưu layout an toàn, chống bị che chữ bởi banner hosting (Somee)
   ========================================================== */

#scene-final {
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Khoảng đệm an toàn phía dưới (tối thiểu 85px) chống che bởi banner hosting hoặc thanh điều hướng mobile */
  padding: 20px 16px max(85px, env(safe-area-inset-bottom, 20px) + 65px) 16px;
  z-index: 25;
  overflow: hidden;
}

/* Background starfield in final scene */
.final-starfield {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* Container for AB photo and final greeting (nằm trên lớp hạt trái tim) */
.final-content-wrapper {
  position: relative;
  z-index: 30; /* Nằm trên canvas (z-index 15 ở scene này) để hạt không che mặt */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 92vw;
  margin-top: 10px;
  opacity: 0;
  transform: scale(0.9) translateY(15px);
  transition:
    opacity 1.2s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: auto;
}

.final-content-wrapper.revealed {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* Photo AB Card Frame - Tỷ lệ hợp lý không chiếm quá nhiều chiều cao */
.final-photo-card {
  position: relative;
  width: min(68vw, 240px);
  max-height: min(34vh, 250px);
  border-radius: 18px;
  padding: 5px;
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.7),
    rgba(255, 105, 180, 0.5),
    rgba(255, 255, 255, 0.8)
  );
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.85),
    0 0 25px rgba(255, 215, 0, 0.5),
    0 0 50px rgba(255, 105, 180, 0.3);
  border: 1.5px solid rgba(255, 255, 255, 0.65);
  animation: finalCardGlow 4s ease-in-out infinite alternate;
}

.final-photo-inner {
  width: 100%;
  height: 100%;
  max-height: inherit;
  border-radius: 13px;
  overflow: hidden;
  position: relative;
  background: #0d111d;
}

/* 
   =====================================
   IMG: /img/final/AB.jpg
   FINAL SCENE
   Đây là ảnh xuất hiện gần cuối video
   ===================================== 
*/
.final-photo-img {
  width: 100%;
  max-height: min(32vh, 238px);
  object-fit: cover;
  object-position: center 20%;
  display: block;
  border-radius: 12px;
}

@keyframes finalCardGlow {
  0% {
    box-shadow:
      0 16px 40px rgba(0, 0, 0, 0.85),
      0 0 22px rgba(255, 200, 100, 0.4),
      0 0 45px rgba(255, 105, 180, 0.25);
  }
  100% {
    box-shadow:
      0 18px 45px rgba(0, 0, 0, 0.92),
      0 0 32px rgba(255, 220, 120, 0.65),
      0 0 65px rgba(255, 105, 180, 0.45);
  }
}

/* Final Text: "Tường Duy ❤️" */
.final-text-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(20px, 5.5vw, 28px);
  font-weight: 700;
  color: #fff4d1;
  letter-spacing: 1.5px;
  margin-top: 4px;
  text-shadow:
    0 0 12px rgba(255, 215, 0, 0.9),
    0 0 24px rgba(255, 105, 180, 0.75);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: finalTextPulse 3s ease-in-out infinite alternate;
}

.final-text-title span.heart-symbol {
  color: #ff4d6d;
  display: inline-block;
  animation: heartSymbolBeat 1.4s ease-in-out infinite;
}

/* Lời chúc phía dưới - Luôn nằm cao hơn đáy màn hình để không bị che */
.final-subtext {
  font-size: clamp(12px, 3.4vw, 14px);
  color: #ffeaa7;
  letter-spacing: 0.5px;
  font-weight: 400;
  text-align: center;
  max-width: 90vw;
  line-height: 1.5;
  text-shadow:
    0 1px 4px rgba(0, 0, 0, 0.8),
    0 0 10px rgba(255, 215, 0, 0.4);
}

@keyframes finalTextPulse {
  0% {
    opacity: 0.88;
    transform: scale(0.98);
  }
  100% {
    opacity: 1;
    transform: scale(1.02);
    text-shadow:
      0 0 18px rgba(255, 225, 120, 1),
      0 0 35px rgba(255, 120, 180, 0.9);
  }
}

@keyframes heartSymbolBeat {
  0%,
  100% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.25);
  }
  50% {
    transform: scale(1.1);
  }
  70% {
    transform: scale(1.2);
  }
}
