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

:root {
  --primary: #ff5c8a;
  --primary-dark: #e0436f;
  --secondary: #ffd6e0;
  --bg: #fff5f7;
  --text: #4a2c3a;
  --accent: #ffb6c1;
  --gold: #ffd700;
}

html, body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  scroll-behavior: smooth;
}

.heart-font {
  font-family: 'Dancing Script', cursive;
}

/* ============ MUSIC TOGGLE ============ */
.music-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: var(--primary);
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(255, 92, 138, 0.3);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.music-toggle.playing {
  animation: music-bounce 1s ease-in-out infinite;
}

@keyframes music-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

/* ============ FLOATING HEARTS BG ============ */
.hearts-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}

.floating-heart {
  position: absolute;
  bottom: -10%;
  font-size: 1.5rem;
  opacity: 0.5;
  animation: floatUp linear infinite;
  color: var(--primary);
}

@keyframes floatUp {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.4;
  }
  100% {
    transform: translateY(-110vh) rotate(360deg);
    opacity: 0;
  }
}

/* ============ INTRO SCREEN ============ */
.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  z-index: 1;
}

.intro {
  background: linear-gradient(160deg, #ffe3eb 0%, #ffc6d9 50%, #ffb0c8 100%);
  padding: 24px;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.intro.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.envelope {
  width: 140px;
  height: 100px;
  position: relative;
  margin-bottom: 10px;
  cursor: pointer;
  animation: bounce 2.4s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.envelope-body {
  width: 100%;
  height: 100%;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(255, 92, 138, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.envelope-flap {
  position: absolute;
  top: -1px;
  left: 0;
  width: 100%;
  height: 50%;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 10px 10px 0 0;
  z-index: 2;
}

.envelope-heart {
  font-size: 2.4rem;
  z-index: 1;
}

.intro-title {
  font-family: 'Dancing Script', cursive;
  font-size: 2.6rem;
  color: var(--primary-dark);
  font-weight: 700;
}

.intro-sub {
  font-size: 1.05rem;
  color: var(--text);
  opacity: 0.8;
}

.btn-open {
  margin-top: 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 14px 36px;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: 50px;
  box-shadow: 0 8px 20px rgba(255, 92, 138, 0.4);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

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

/* ============ MAIN CONTENT ============ */
.main {
  position: relative;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.main.visible {
  opacity: 1;
}

.hidden {
  display: none;
}

.section-title {
  font-family: 'Dancing Script', cursive;
  font-size: 2.2rem;
  color: var(--primary-dark);
  text-align: center;
  margin-bottom: 6px;
}

.section-sub {
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.7;
  margin-bottom: 24px;
}

/* ============ HERO ============ */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  background: linear-gradient(180deg, #fff5f7 0%, #ffe3eb 100%);
  gap: 16px;
}

.hero-photo {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  overflow: hidden;
  border: 6px solid #fff;
  box-shadow: 0 12px 35px rgba(255, 92, 138, 0.35);
  animation: pop-in 0.8s ease;
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}

@keyframes pop-in {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.hero-title {
  font-family: 'Dancing Script', cursive;
  font-size: 2.4rem;
  color: var(--primary-dark);
  line-height: 1.3;
}

.heart-pulse {
  display: inline-block;
  animation: pulse 1.2s ease-in-out infinite;
  margin-left: 6px;
}

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

.hero-sub {
  font-size: 1.1rem;
  color: var(--text);
  opacity: 0.85;
}

.scroll-hint {
  margin-top: 30px;
  font-size: 0.85rem;
  opacity: 0.5;
  animation: bobbing 2s ease-in-out infinite;
}

@keyframes bobbing {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ============ COUNTER ============ */
.counter-section {
  padding: 70px 20px;
  text-align: center;
}

.counter-grid {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.counter-box {
  background: #fff;
  border-radius: 18px;
  padding: 18px 22px;
  min-width: 90px;
  box-shadow: 0 6px 20px rgba(255, 92, 138, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.counter-num {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary);
}

.counter-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.6;
}

.counter-extra {
  margin-top: 22px;
  font-size: 1rem;
  opacity: 0.85;
}

#totalDays {
  font-weight: 700;
  color: var(--primary-dark);
}

/* ============ LETTER ============ */
.letter-section {
  padding: 60px 20px;
  background: linear-gradient(180deg, #ffe3eb 0%, #fff5f7 100%);
}

.letter-card {
  max-width: 600px;
  margin: 0 auto;
  background: #fff;
  border-radius: 22px;
  padding: 28px 24px;
  box-shadow: 0 10px 30px rgba(255, 92, 138, 0.18);
  font-size: 1rem;
  line-height: 1.8;
  position: relative;
}

.letter-card::before {
  content: '💕';
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(255, 92, 138, 0.25);
}

.letter-card p {
  margin-bottom: 14px;
}

.signature {
  font-family: 'Dancing Script', cursive;
  font-size: 1.4rem;
  color: var(--primary-dark);
  text-align: right;
  margin-top: 6px;
}

/* ============ GALLERY ============ */
.gallery-section {
  padding: 60px 20px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-width: 600px;
  margin: 0 auto;
}

.gallery-item {
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  box-shadow: 0 6px 16px rgba(255, 92, 138, 0.15);
}

.gallery-item.big {
  grid-column: span 2;
  aspect-ratio: 16 / 11;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  transition: transform 0.4s ease;
}

.gallery-item:active img {
  transform: scale(1.06);
}

/* ============ REASONS ============ */
.reasons-section {
  padding: 60px 20px;
  background: linear-gradient(180deg, #fff5f7 0%, #ffe3eb 100%);
}

.reasons-list {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reason-card {
  background: #fff;
  border-radius: 14px;
  padding: 16px 18px;
  font-size: 0.98rem;
  box-shadow: 0 4px 14px rgba(255, 92, 138, 0.12);
  border-left: 4px solid var(--primary);
}

/* ============ QUIZ ============ */
.quiz-section {
  padding: 60px 20px;
  background: linear-gradient(180deg, #ffe3eb 0%, #fff5f7 100%);
}

.quiz-list {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.quiz-card {
  background: #fff;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 6px 20px rgba(255, 92, 138, 0.15);
}

.quiz-question {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--text);
}

.quiz-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quiz-option {
  flex: 1 1 auto;
  background: var(--secondary);
  border: none;
  border-radius: 50px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--primary-dark);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, color 0.2s ease;
}

.quiz-option:active {
  transform: scale(0.97);
}

.quiz-card.answered .quiz-option {
  opacity: 0.55;
}

.quiz-card.answered .quiz-option.selected {
  background: var(--primary);
  color: #fff;
  opacity: 1;
}

.quiz-answer {
  margin-top: 12px;
  font-size: 0.95rem;
  color: var(--primary-dark);
  font-weight: 500;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.4s ease, margin-top 0.4s ease;
}

.quiz-card.answered .quiz-answer {
  max-height: 100px;
  opacity: 1;
}

/* ============ FINAL ============ */
.final-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  gap: 14px;
  background: linear-gradient(160deg, #ffb0c8 0%, #ff8aab 100%);
  color: #fff;
}

.final-heart {
  font-size: 4rem;
  animation: pulse 1.4s ease-in-out infinite;
}

.final-title {
  font-family: 'Dancing Script', cursive;
  font-size: 2.6rem;
}

.final-sub {
  font-size: 1.1rem;
  opacity: 0.95;
}

.btn-confetti {
  margin-top: 16px;
  background: #fff;
  color: var(--primary-dark);
  border: none;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 50px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  cursor: pointer;
  font-family: inherit;
}

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

/* ============ FINALE OVERLAY ============ */
.final-section {
  position: relative;
  overflow: hidden;
}

.final-section.shaking {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-6px, 2px); }
  40% { transform: translate(6px, -2px); }
  60% { transform: translate(-4px, 1px); }
  80% { transform: translate(4px, -1px); }
}

.finale-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  background: linear-gradient(160deg, #ff8aab 0%, #e0436f 100%);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.finale-overlay.show {
  visibility: visible;
}

.finale-photo {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: scale(0.4);
  animation: word-pop 0.7s cubic-bezier(.34,1.56,.64,1) forwards;
  animation-delay: 0s;
}

.finale-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}

.finale-overlay.show .finale-photo {
  animation-play-state: running;
}

.finale-overlay.show {
  opacity: 1;
}

.finale-message {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  padding: 0 16px;
}

.finale-word {
  font-family: 'Dancing Script', cursive;
  font-weight: 700;
  font-size: 2.8rem;
  color: #fff;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.7), 0 4px 12px rgba(0,0,0,0.2);
  opacity: 0;
  transform: scale(0.3) rotate(-8deg);
  animation: word-pop 0.7s cubic-bezier(.34,1.56,.64,1) forwards;
  animation-delay: calc(var(--d) + 0.3s);
  animation-play-state: paused;
}

.finale-overlay.show .finale-word {
  animation-play-state: running;
}

@keyframes word-pop {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-8deg);
  }
  60% {
    opacity: 1;
    transform: scale(1.15) rotate(3deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.finale-big {
  font-size: 4rem;
  color: #fff200;
}

.finale-name {
  font-size: 4rem;
  background: linear-gradient(90deg, #fff, #ffd6e0, #fff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.finale-message .finale-word:last-child {
  font-size: 2.2rem;
  width: 100%;
}

.finale-sub-msg {
  font-size: 1.1rem;
  color: #fff;
  opacity: 0;
  font-weight: 500;
  letter-spacing: 1px;
  animation: fade-in-up 0.8s ease forwards;
  animation-delay: 1.2s;
  animation-play-state: paused;
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.finale-overlay.show .finale-sub-msg {
  animation-play-state: running;
}

.finale-tap-hint {
  margin-top: 6px;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.8);
  opacity: 0;
  animation: fade-in-up 0.8s ease forwards;
  animation-delay: 1.9s;
  animation-play-state: paused;
}

.finale-overlay.show .finale-tap-hint {
  animation-play-state: running;
}

.final-heart.boom {
  animation: heart-boom 0.8s ease-out;
}

@keyframes heart-boom {
  0% { transform: scale(1); }
  30% { transform: scale(1.8); filter: drop-shadow(0 0 30px #fff); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* ============ CONFETTI CANVAS ============ */
#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
}

/* ============ RESPONSIVE (tablet/desktop) ============ */
@media (min-width: 700px) {
  .intro-title {
    font-size: 3.4rem;
  }

  .hero-title {
    font-size: 3.2rem;
  }

  .section-title {
    font-size: 2.8rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .gallery-item.big {
    grid-column: span 3;
  }

  .final-title {
    font-size: 3.4rem;
  }
}
