* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: #5a2a3a;
  background: linear-gradient(180deg, #fff0f5 0%, #ffe4ec 50%, #fff6e9 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  font-size: 20px; /* chữ to, dễ đọc */
  line-height: 1.6;
}

.hidden { display: none !important; }

/* ---------- Màn hình hộp quà ---------- */
.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 24px;
  text-align: center;
  transition: opacity .6s ease;
}
.screen.fade-out { opacity: 0; }

.intro-text {
  font-size: 1.35rem;
  font-weight: 700;
}

.gift {
  position: relative;
  width: 150px;
  height: 150px;
  animation: wiggle 2s ease-in-out infinite;
}
.gift-box {
  position: absolute; bottom: 0; left: 10px;
  width: 130px; height: 100px;
  background: #ff6b8b;
  border-radius: 8px;
  background-image:
    linear-gradient(90deg, transparent 55px, #ffd166 55px, #ffd166 75px, transparent 75px);
}
.gift-lid {
  position: absolute; top: 22px; left: 0;
  width: 150px; height: 34px;
  background: #ff4d74;
  border-radius: 8px;
  background-image:
    linear-gradient(90deg, transparent 65px, #ffd166 65px, #ffd166 85px, transparent 85px);
  z-index: 2;
}
.gift-lid::before, .gift-lid::after {
  content: "";
  position: absolute; top: -28px;
  width: 36px; height: 30px;
  border: 8px solid #ffd166;
  border-radius: 50% 50% 0 50%;
}
.gift-lid::before { left: 38px; transform: rotate(-20deg); }
.gift-lid::after  { right: 38px; transform: scaleX(-1) rotate(-20deg); }

@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-6deg); }
  40% { transform: rotate(6deg); }
  60% { transform: rotate(-3deg); }
  80% { transform: rotate(0); }
}

/* Nút to, dễ bấm */
.big-btn {
  font-family: inherit;
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #ff6b8b, #ff4d74);
  border: none;
  border-radius: 999px;
  padding: 20px 36px;
  min-height: 64px;
  box-shadow: 0 8px 20px rgba(255, 77, 116, .4);
  cursor: pointer;
  animation: pulse 1.6s ease-in-out infinite;
}
.big-btn:active { transform: scale(.96); }
.big-btn.small { font-size: 1.1rem; padding: 16px 30px; animation: none; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 8px 20px rgba(255, 77, 116, .4); }
  50% { box-shadow: 0 8px 32px rgba(255, 77, 116, .75); }
}

/* ---------- Lời chúc chữ chạy ---------- */
.hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 32px 22px;
  gap: 24px;
}

.type-title {
  font-family: 'Dancing Script', cursive;
  font-size: 3rem;
  line-height: 1.25;
  color: #e63e6d;
  min-height: 2.5em;
}
.type-message {
  font-size: 1.2rem;
  white-space: pre-line;
  min-height: 6em;
}

/* Con trỏ nhấp nháy khi đang viết */
.typing::after {
  content: "|";
  margin-left: 2px;
  color: #e63e6d;
  animation: blink .8s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.scroll-hint {
  font-size: 1.05rem;
  opacity: 0;
  transition: opacity 1s ease;
}
.scroll-hint.show { opacity: 1; }
.arrow {
  display: inline-block;
  font-size: 2rem;
  animation: bounce 1.4s ease-in-out infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(10px); }
}

/* ---------- Ảnh ---------- */
.gallery {
  display: flex;
  flex-direction: column;
  gap: 48px;
  padding: 0 18px 48px;
  max-width: 560px;
  margin: 0 auto;
}

.photo-card {
  background: #fff;
  padding: 12px 12px 18px;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(90, 42, 58, .15);
}
.photo-card:nth-child(odd)  { transform: rotate(-1.5deg); }
.photo-card:nth-child(even) { transform: rotate(1.5deg); }
.photo-card img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}
.photo-card figcaption {
  font-family: 'Dancing Script', cursive;
  font-size: 1.7rem;
  text-align: center;
  margin-top: 12px;
  color: #c2335b;
  line-height: 1.3;
}

/* Hiệu ứng hiện dần khi cuộn tới */
.reveal {
  opacity: 0;
  translate: 0 40px;
  transition: opacity 1s ease, translate 1s ease;
}
.reveal.visible { opacity: 1; translate: 0 0; }

/* ---------- Kết ---------- */
.ending {
  text-align: center;
  padding: 40px 24px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.ending-text {
  font-size: 1.25rem;
  white-space: pre-line;
}
.signature {
  font-family: 'Dancing Script', cursive;
  font-size: 2rem;
  color: #e63e6d;
}

/* ---------- Tim rơi ---------- */
#hearts {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}
.heart {
  position: absolute;
  top: -40px;
  color: #ff6b8b;
  animation: fall linear forwards;
  user-select: none;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(360deg); opacity: .2; }
}

/* ---------- Nút nhạc ---------- */
.music-btn {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #fff;
  font-size: 1.6rem;
  box-shadow: 0 6px 16px rgba(90, 42, 58, .25);
  z-index: 60;
  cursor: pointer;
}
.music-btn.playing { animation: spin-soft 3s ease-in-out infinite; }
@keyframes spin-soft {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  .gift, .big-btn, .arrow { animation: none; }
}
