* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

body {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a0b2e 0%, #4a0e2e 50%, #2b0a3d 100%);
  color: #fff;
  overflow-x: hidden;
}

#hearts {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* Nav */
.nav {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 1rem;
}

.nav a {
  color: #ffb3d1;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all 0.25s ease;
  font-size: 0.95rem;
}

.nav a:hover {
  background: #ff4d8d;
  color: #fff;
  transform: translateY(-2px);
}

/* Hero / pages */
.hero, .page {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
  text-align: center;
}

.hero {
  padding-top: 12vh;
}

.big-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  background: linear-gradient(90deg, #ff9ec7, #ffd1e3, #ff4d8d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: float 3s ease-in-out infinite;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.2rem);
  margin-bottom: 1rem;
  color: #ffd1e3;
}

.subtitle {
  color: #e8b8d0;
  font-size: 1.15rem;
  margin-bottom: 1.5rem;
}

.subtitle.small {
  font-size: 0.95rem;
  opacity: 0.75;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.btn {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.9rem 2.2rem;
  background: linear-gradient(90deg, #ff4d8d, #ff77b0);
  color: #fff;
  text-decoration: none;
  border: none;
  border-radius: 999px;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(255, 77, 141, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: scale(1.06);
  box-shadow: 0 12px 40px rgba(255, 77, 141, 0.6);
}

/* Flip cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  margin: 2rem 0;
}

.card {
  height: 180px;
  perspective: 800px;
  cursor: pointer;
  position: relative;
}

.card .front, .card .back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  border-radius: 18px;
  backface-visibility: hidden;
  transition: transform 0.6s ease;
}

.card .front {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 3rem;
  color: #ff77b0;
  font-weight: bold;
}

.card .back {
  background: linear-gradient(135deg, #ff4d8d, #b03a8e);
  transform: rotateY(180deg);
  font-size: 1.05rem;
  line-height: 1.4;
}

.card.flipped .front { transform: rotateY(180deg); }
.card.flipped .back { transform: rotateY(360deg); }

/* Polaroid wall */
.polaroid-wall {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 2rem;
  margin: 2.5rem 0;
}

.polaroid {
  background: #fffdf8;
  border-radius: 4px;
  padding: 0.9rem 0.9rem 1.2rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  position: relative;
  cursor: pointer;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.polaroid:nth-child(odd) { transform: rotate(-2.5deg); }
.polaroid:nth-child(even) { transform: rotate(2deg); }
.polaroid:nth-child(3n) { transform: rotate(-1.2deg); }

.polaroid:hover {
  transform: rotate(0deg) scale(1.05);
  box-shadow: 0 18px 45px rgba(255, 77, 141, 0.35);
  z-index: 5;
}

.tape {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 90px;
  height: 26px;
  background: rgba(255, 214, 232, 0.75);
  border-left: 2px dashed rgba(255, 255, 255, 0.6);
  border-right: 2px dashed rgba(255, 255, 255, 0.6);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.polaroid-photo {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f3e9ec;
  overflow: hidden;
  font-size: 2rem;
  color: #c98aa8;
}

.photo-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.photo-fallback small { font-size: 0.65rem; padding: 0 4px; }

.polaroid-photo img,
.polaroid-photo video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.sound-hint {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  pointer-events: none;
}

.polaroid-caption {
  padding: 0.9rem 0.3rem 0;
  text-align: center;
  font-family: 'Segoe Print', 'Comic Sans MS', cursive;
}

.polaroid-caption h3 {
  color: #8a2b52;
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
}

.polaroid-caption p {
  color: #9c6b7d;
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Typewriter + days counter */
.typewriter {
  min-height: 1.8em;
  color: #ffd1e3;
  font-size: 1.25rem;
  margin-bottom: 0.8rem;
}

.typewriter::after {
  content: '|';
  animation: blink 0.8s step-end infinite;
  color: #ff77b0;
}

@keyframes blink { 50% { opacity: 0; } }

.days-counter {
  color: #ff9ec7;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
  min-height: 1.5em;
}

/* Burst hearts on tap */
.burst-heart {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  font-size: 1.3rem;
  transform: translate(-50%, -50%);
  animation: burst 0.9s ease-out forwards;
}

@keyframes burst {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.4); }
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  padding: 1.5rem;
}

.lightbox img {
  max-width: 95vw;
  max-height: 90vh;
  border-radius: 14px;
  box-shadow: 0 20px 80px rgba(255, 77, 141, 0.4);
  animation: pop 0.3s ease;
}

/* Open When envelopes */
.open-when-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
  margin: 2rem 0;
}

.envelope {
  height: 190px;
  perspective: 800px;
  cursor: pointer;
  position: relative;
}

.env-front, .env-back {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.2rem;
  border-radius: 18px;
  backface-visibility: hidden;
  transition: transform 0.6s ease;
}

.env-front {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 2rem;
}

.env-front span {
  font-size: 1.05rem;
  color: #ffd1e3;
  font-weight: 600;
}

.env-back {
  background: #fff8f0;
  color: #5a2a3a;
  transform: rotateY(180deg);
  font-size: 0.95rem;
  line-height: 1.5;
  overflow-y: auto;
}

.envelope.open .env-front { transform: rotateY(180deg); }
.envelope.open .env-back { transform: rotateY(360deg); }

/* Music player */
.music-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 50;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  background: linear-gradient(135deg, #ff4d8d, #b03a8e);
  color: #fff;
  box-shadow: 0 8px 25px rgba(255, 77, 141, 0.5);
  transition: transform 0.2s ease;
}

.music-btn:hover { transform: scale(1.1); }

.music-btn.playing { animation: spin 4s linear infinite; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Letter */
.letter {
  background: #fff8f0;
  color: #5a2a3a;
  border-radius: 14px;
  padding: 2.5rem;
  max-width: 620px;
  margin: 2rem auto;
  text-align: left;
  line-height: 1.8;
  font-size: 1.08rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  transform: rotate(-0.5deg);
}

.letter p { margin-bottom: 1.1rem; }
.letter .sign { text-align: right; font-weight: bold; color: #c92a6d; }

/* Quiz */
.quiz-page { padding-top: 8vh; }

.quiz-buttons {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 2rem;
  position: relative;
  min-height: 80px;
}

.btn.no {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

.hidden { display: none; }

.celebration {
  font-size: 3rem;
  margin-top: 1.5rem;
  animation: pop 0.6s ease;
}

@keyframes pop {
  0% { transform: scale(0); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
