/* GLOBAL RESET */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(to top left, #fce4ec, #e1bee7);
  font-family: "Poppins", sans-serif;
  overflow-x: hidden;
}

/* Locked Scroll Until Envelope Opens */
body.locked {
  overflow: hidden;
}

/* Floating Flowers Background */
.flowers {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
  display: none;
}

.flowers span {
  position: absolute;
  font-size: 30px;
  opacity: 0.25;
  animation: floatUp 12s linear infinite;
}

@keyframes floatUp {
  from {
    transform: translateY(110vh) rotate(0deg);
  }
  to {
    transform: translateY(-10vh) rotate(360deg);
  }
}

/* Intro Container */
.container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px;
}

/* Envelope */
.envelope {
  position: relative;
  width: 420px;
  max-width: 90%;
  height: 280px;
  background: white;
  border-radius: 18px;
  cursor: pointer;
  overflow: hidden;
  border: 3px solid #c2185b;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
  transition: transform 0.8s ease;
}

/* Heart Seal */
.envelope::after {
  content: "❤️";
  position: absolute;
  bottom: 25px;
  font-size: 42px;
  left: 50%;
  transform: translateX(-50%);
}

/* Envelope Flap */
.flap {
  position: absolute;
  width: 100%;
  height: 60%;
  background: linear-gradient(to bottom, #f8bbd0, #f48fb1);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top;
  transition: transform 1s ease;
}

/* Envelope Front Text */
.front {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  color: #6a1b9a;
  font-size: clamp(16px, 4vw, 20px);
  padding: 10px;
  text-align: center;
}

.front span {
  margin-top: 15px;
  font-size: clamp(14px, 3.5vw, 16px);
  color: #c2185b;
}

/* Envelope Open Animation */
.envelope.open {
  transform: scale(1.05);
}

.envelope.open .flap {
  transform: rotateX(180deg);
}

/* Message Under Envelope */
.message {
  margin-top: 25px;
  font-size: clamp(18px, 4vw, 1.5rem);
  color: white;
  font-weight: bold;
}

/* Hidden Utility */
.hidden {
  display: none;
}

/* Book */
.book {
  position: relative;
  margin: 60px auto;
  width: 90%;
  max-width: 650px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 25px;
  padding: 45px 35px;
  text-align: center;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.25);
  z-index: 10;
  animation: popUp 0.8s ease;
}

/* Book Entrance Animation */
@keyframes popUp {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Pages */
.page {
  display: none;
  animation: fadeIn 0.6s ease;
}

.page.active {
  display: block;
}

/* Page Fade */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Typography */
h1 {
  color: #c2185b;
  margin-bottom: 15px;
  font-size: clamp(20px, 5vw, 32px);
}

.page p {
  font-size: clamp(14px, 4vw, 18px);
  line-height: 1.6;
}

/* Images Inside Pages */
.page img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 15px;
  margin-top: 20px;
  border: 3px solid #c2185b;
}

/* Lists */
.page ul {
  text-align: left;
  margin-top: 20px;
  padding-left: 25px;
  font-size: 1.1rem;
  line-height: 1.8;
}

/* Character Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-top: 20px;
}

.card {
  background: rgba(255, 182, 193, 0.35);
  padding: 15px;
  border-radius: 15px;
  font-weight: bold;
  text-align: center;
  color: #6a1b9a;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.card img {
  width: 100%;
  border-radius: 12px;
  margin-bottom: 10px;
}

/* Small Note */
.small-note {
  margin-top: 20px;
  font-size: 1rem;
  opacity: 0.85;
  font-style: italic;
}

/* Navigation Buttons */
.nav {
  margin-top: 25px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.nav button {
  flex: 1;
  background: #c2185b;
  border: none;
  color: white;
  font-size: 22px;
  padding: 12px 20px;
  border-radius: 15px;
  cursor: pointer;
  transition: 0.2s ease;
}

.nav button:hover {
  transform: scale(1.05);
}

/* Music Toggle */
#music-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  z-index: 100;
}

/* Back Button */
.back-btn {
  display: inline-block;
  margin-top: 20px;
  padding: 12px 22px;
  background: #0288d1;
  color: white;
  border-radius: 18px;
  text-decoration: none;
  font-weight: bold;
  transition: 0.25s ease;
}

.back-btn:hover {
  transform: scale(1.05);
}

/* ========================= */
/* MOBILE RESPONSIVE SECTION */
/* ========================= */

@media (max-width: 600px) {
  .envelope {
    height: 200px;
  }

  .book {
    padding: 30px 20px;
    margin: 40px auto;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .flowers span {
    font-size: 20px;
    opacity: 0.2;
  }

  .nav button {
    font-size: 20px;
  }

  .message {
    font-size: 1.2rem;
  }
}
