@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&family=Outfit:wght@300;400;500;600&family=Playfair+Display:ital,wght@0,400..900;1,400..900&display=swap');

:root {
  --bg-primary: #fff8f5;
  --text-primary: #4a2e2b;
  --text-secondary: #7c6260;
  --accent-rose: #e5a99e;
  --accent-pink: #ff758f;
  --accent-red: #b33939;
  --accent-gold: #d4af37;
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(229, 169, 158, 0.3);
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-cursive: 'Great Vibes', cursive, sans-serif;
  --font-sans: 'Outfit', system-ui, -apple-system, sans-serif;
  --shadow-premium: 0 20px 40px rgba(74, 46, 43, 0.08), 0 5px 15px rgba(74, 46, 43, 0.04);
  --shadow-polaroid: 0 10px 25px rgba(74, 46, 43, 0.15);
}

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

html,
body {
  width: 100%;
  overflow-x: hidden;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  scroll-behavior: smooth;
}

/* Hide scrollbar entirely */
::-webkit-scrollbar {
  display: none;
}

/* Envelope Intro Screen */
#envelope-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #faf5f0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: opacity 1s cubic-bezier(0.77, 0, 0.175, 1), visibility 1s;
  overflow: hidden;
}

.lock-bg-vectors {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.vector-blob {
  position: absolute;
  width: 800px;
  height: 800px;
  opacity: 0.6;
  filter: blur(40px);
}

.v-top-left {
  top: -200px;
  left: -200px;
  animation: float 20s infinite ease-in-out;
}

.v-bottom-right {
  bottom: -200px;
  right: -200px;
  animation: float 25s infinite ease-in-out reverse;
}

.vector-sparkle {
  position: absolute;
  width: 60px;
  height: 60px;
  opacity: 0.8;
  animation: pulseBig 4s infinite alternate;
}

.v-sparkle-1 {
  top: 20%;
  left: 15%;
}

.v-sparkle-2 {
  bottom: 25%;
  right: 20%;
}

#envelope-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-title {
  color: #fff;
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 300;
  margin-bottom: 3rem;
  text-align: center;
  letter-spacing: 2px;
  animation: pulseLight 3s infinite ease-in-out;
  padding: 0 20px;
}

.envelope-wrapper {
  position: relative;
  width: 320px;
  height: 220px;
  cursor: pointer;
  perspective: 1000px;
}

.envelope {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: #a83c4c;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}

.envelope::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(0, 0, 0, 0.15) 100%);
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  z-index: 2;
}

/* Envelope Flap */
.flap {
  position: absolute;
  top: 0;
  width: 0;
  height: 0;
  border-left: 160px solid transparent;
  border-right: 160px solid transparent;
  border-top: 120px solid #bd4656;
  transform-origin: top;
  z-index: 5;
  transition: transform 0.6s ease-in-out;
}

/* Pocket inside */
.pocket {
  position: absolute;
  bottom: 0;
  width: 0;
  height: 0;
  border-left: 160px solid #9e3645;
  border-right: 160px solid #9e3645;
  border-top: 110px solid transparent;
  border-bottom: 110px solid #9e3645;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  z-index: 4;
}

/* Letter preview sliding out */
.letter-preview {
  position: absolute;
  bottom: 10px;
  left: 15px;
  width: 290px;
  height: 190px;
  background-color: #fff9f5;
  border-radius: 4px;
  z-index: 3;
  padding: 20px;
  box-sizing: border-box;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.1) 0.3s;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.letter-preview p {
  font-family: var(--font-cursive);
  font-size: 1.8rem;
  color: var(--accent-red);
  margin-bottom: 5px;
}

.letter-preview span {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

/* Wax Seal */
.seal {
  position: absolute;
  top: 95px;
  left: calc(50% - 25px);
  width: 50px;
  height: 50px;
  background: radial-gradient(circle at 30% 30%, #e02f4a 0%, #9e142b 100%);
  border-radius: 50%;
  z-index: 6;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.2);
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
  animation: pulseSeal 2s infinite ease-in-out;
}

.seal::after {
  content: "♥";
  color: #fff;
  font-size: 1.6rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Opened Envelope State */
.envelope-wrapper.open .flap {
  transform: rotateX(180deg);
  z-index: 1;
  /* behind letter */
}

.envelope-wrapper.open .letter-preview {
  transform: translateY(-120px) scale(1.05);
  z-index: 4;
}

.envelope-wrapper.open .seal {
  transform: scale(0);
  opacity: 0;
}

/* Background floating canvas */
#canvas-hearts {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
}

/* Header & Floating controls */
header {
  width: 100%;
  padding: 2rem;
  display: flex;
  justify-content: flex-end;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  pointer-events: none;
}

.music-toggle {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-premium);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.music-toggle:hover {
  transform: scale(1.1);
  background-color: #fff;
  border-color: var(--accent-pink);
}

.music-toggle svg {
  width: 24px;
  height: 24px;
  fill: var(--accent-red);
  transition: fill 0.3s;
}

.music-toggle.muted svg {
  fill: var(--text-secondary);
}

/* Animated Music Note particles when playing */
.music-toggle.playing::before {
  content: "♪";
  position: absolute;
  font-size: 14px;
  color: var(--accent-pink);
  animation: floatNote 1.5s infinite linear;
}

.music-toggle.playing::after {
  content: "♫";
  position: absolute;
  font-size: 14px;
  color: var(--accent-red);
  animation: floatNote 2s infinite linear 0.7s;
}

/* Main Container */
main {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
}

/* Hero Section */
.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  position: relative;
  overflow: visible;
  padding: 1rem 0;
}


.hero-subtitle {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  color: var(--accent-red);
  margin-bottom: 0.5rem;
}

.hero-heart {
  position: absolute;
  opacity: 0;
  user-select: none;
  filter: drop-shadow(0 2px 4px rgba(247, 149, 167, 0.3));
}

.page-section.animate-in .hero-heart {
  animation: floatHeroHeart 6s infinite ease-in-out;
}

.heart-1 {
  left: 8%;
  top: 15%;
  animation-duration: 5s;
  animation-delay: 0s;
  font-size: 1.8rem;
}

.heart-2 {
  right: 10%;
  top: 35%;
  animation-duration: 7s;
  animation-delay: 1.2s;
  font-size: 1.4rem;
}

.heart-3 {
  left: 22%;
  bottom: 5%;
  animation-duration: 6s;
  animation-delay: 2.5s;
  font-size: 1.2rem;
}

.heart-4 {
  right: 28%;
  top: 10%;
  animation-duration: 8s;
  animation-delay: 0.5s;
  font-size: 2rem;
}

.heart-5 {
  left: 45%;
  top: 55%;
  animation-duration: 5.5s;
  animation-delay: 1.8s;
  font-size: 1.6rem;
}

.heart-6 {
  right: 5%;
  bottom: 20%;
  animation-duration: 6.5s;
  animation-delay: 3s;
  font-size: 1.3rem;
}

@keyframes floatHeroHeart {

  0%,
  100% {
    transform: translateY(0) scale(1) rotate(0deg);
    opacity: 0.8;
  }

  50% {
    transform: translateY(-20px) scale(1.1) rotate(5deg);
    opacity: 0.4;
  }
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 3.5rem;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.2;
  opacity: 0;
}

.page-section.animate-in .hero-subtitle {
  animation: fadeInDown 1.2s ease-out both;
}

.page-section.animate-in .hero-title {
  animation: fadeInUp 1.2s ease-out 0.4s both;
}

#page-1 .next-page-btn {
  opacity: 0;
}

#page-1.animate-in .next-page-btn {
  animation: fadeInUp 1s ease-out 1s both;
}

.hero-title #hero-title-highlight,
.hero-title #anniversary-highlight {
  font-family: var(--font-cursive);
  color: var(--accent-pink);
  font-size: 4.5rem;
  display: inline-block;
  transform: rotate(-3deg);
  margin-left: 10px;
}

.scroll-indicator {
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: bounce 2s infinite;
}

.scroll-indicator::after {
  content: "↓";
  font-size: 1.2rem;
}

/* Memory Counter Container */
.counter-box {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: var(--shadow-premium);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
  text-align: center;
}

.counter-item {
  flex: 1;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.counter-num {
  font-family: var(--font-serif);
  font-size: 3rem;
  font-weight: 600;
  color: var(--accent-red);
}

.counter-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  font-weight: 500;
}

.counter-divider {
  width: 1px;
  height: 60px;
  background-color: var(--accent-rose);
  opacity: 0.5;
}

@media (max-width: 600px) {
  .counter-divider {
    display: none;
  }

  .counter-item {
    flex: 1 1 100%;
  }
}

#live-days {
  display: inline-block;
  animation: pulseBig 2s infinite alternate;
  text-shadow: 0 5px 15px rgba(204, 0, 51, 0.3);
}

/* The Love Letter Card */
.letter-wrapper {
  position: relative;
  width: 100%;
  max-width: 800px;
  display: flex;
  justify-content: center;
}

.letter-card {
  background: #fffdfc;
  background-image:
    linear-gradient(to right, transparent 30px, rgba(255, 117, 143, 0.3) 30px, rgba(255, 117, 143, 0.3) 32px, transparent 32px),
    linear-gradient(rgba(229, 169, 158, 0.15) 1px, transparent 1px);
  background-size: 100% 100%, 100% 2.8rem;
  background-position: 0 0, 0 0;
  /* Snap grid to top */
  line-height: 2.8rem;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 2.8rem 3.5rem;
  /* Strict multiple of 2.8rem */
  box-shadow: var(--shadow-premium);
  position: relative;
  transform: rotate(-0.5deg);
  transition: transform 0.3s;
  width: 800px;
  max-width: 100%;
  height: 600px;
  /* Static height prevents layout jumping */
  overflow-y: auto;
  /* Allows scrolling if text overflows */
  background-attachment: local;
  /* Makes the background lines scroll with the text! */
}

/* Custom scrollbar for the letter to keep it looking cute */
.letter-card::-webkit-scrollbar {
  width: 8px;
}

.letter-card::-webkit-scrollbar-track {
  background: transparent;
  margin: 1rem 0;
}

.letter-card::-webkit-scrollbar-thumb {
  background: rgba(255, 117, 143, 0.3);
  border-radius: 4px;
}

.letter-card::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 117, 143, 0.6);
}

.letter-card:hover {
  transform: rotate(0deg);
}

.letter-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(to top, rgba(255, 253, 252, 1) 0%, rgba(255, 253, 252, 0) 100%);
  pointer-events: none;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  transition: opacity 0.5s ease;
  z-index: 5;
}

.scroll-hint {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  text-align: center;
  color: var(--accent-red);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  letter-spacing: 1px;
  animation: pulseLight 2s infinite alternate;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 10;
}

.letter-salutation {
  font-family: var(--font-cursive);
  font-size: 2.6rem;
  color: var(--accent-red);
  margin-top: 0;
  margin-bottom: 2.8rem;
  line-height: 2.8rem;
}

.letter-body {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--text-primary);
  display: block;
  text-align: justify;
  margin-top: 0.4rem;
  /* Single offset for the whole body */
  line-height: 2.8rem;
}

.letter-body p {
  text-indent: 2.5rem;
  margin: 0 0 2.8rem 0;
  /* Space between paras is exactly 1 line */
  line-height: 2.8rem;
  /* Lock to grid */
}

.letter-body p:last-child {
  margin-bottom: 0;
}

.letter-body strong {
  color: var(--accent-red);
  font-weight: 500;
}

.letter-body span.highlight {
  background-color: rgba(255, 117, 143, 0.1);
  padding: 0 5px;
  border-radius: 4px;
  border-bottom: 1px dashed var(--accent-pink);
}

.letter-signature {
  font-family: var(--font-cursive);
  font-size: 2.6rem;
  color: var(--accent-red);
  text-align: right;
  margin-top: 2.8rem;
  line-height: 2.8rem;
}

.letter-signature span {
  font-family: var(--font-sans);
  font-size: 1rem;
  display: block;
  color: var(--text-secondary);
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 1.5;
  margin-top: 0;
  /* Ensures it stays tight under Yours but without overlapping */
}

@media (max-width: 600px) {
  .letter-card {
    padding: 2.8rem 1.5rem 2.8rem 2.5rem;
    font-size: 1.05rem;
  }

  .letter-salutation {
    font-size: 2rem;
  }

  .letter-signature {
    font-size: 2rem;
  }
}

/* Polaroid Memory Gallery */
.gallery-section {
  display: flex;
  flex-direction: column;
  gap: 3rem;
  align-items: center;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  text-align: center;
}

.section-title span {
  font-family: var(--font-cursive);
  color: var(--accent-pink);
  font-size: 2.8rem;
}

.polaroid-grid {
  display: flex;
  flex-wrap: nowrap;
  flex-direction: row;
  gap: 1rem;
  width: 100%;
  justify-content: center;
}

.polaroid-wrapper {
  display: flex;
  justify-content: center;
}

.polaroid {
  background: white;
  padding: 10px 10px 30px 10px;
  box-shadow: var(--shadow-polaroid);
  border-radius: 2px;
  width: 100%;
  max-width: 280px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.polaroid:nth-child(even) {
  transform: rotate(3deg);
}

.polaroid:nth-child(odd) {
  transform: rotate(-3deg);
}

.polaroid:hover {
  transform: scale(1.08) rotate(0deg) translateY(-10px);
  box-shadow: 0 15px 35px rgba(74, 46, 43, 0.25);
  z-index: 5;
}

.polaroid-img-container {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  overflow: hidden;
  background-color: #faf7f5;
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
}

.polaroid-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.polaroid:hover .polaroid-img-container img {
  transform: scale(1.05);
}

.polaroid-caption {
  font-family: var(--font-cursive);
  font-size: 1.6rem;
  color: var(--text-primary);
  margin-top: 15px;
  text-align: center;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Proposal Section */
.proposal-section {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 6rem 3rem;
  text-align: center;
  box-shadow: var(--shadow-premium);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
  overflow: hidden;
  position: relative;
}

.proposal-question {
  font-family: var(--font-serif);
  font-size: 3rem;
  color: var(--text-primary);
  max-width: 800px;
  line-height: 1.5;
  text-align: center;
}

.proposal-question span {
  font-family: var(--font-cursive);
  color: var(--accent-red);
  font-size: 4.5rem;
  display: block;
  margin-top: 10px;
}

.button-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2.5rem;
  height: 80px;
  width: 100%;
}

.btn {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  padding: 15px 35px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-yes {
  background-color: var(--accent-pink);
  color: white;
  animation: heartbeat 1.5s infinite;
}

.btn-yes:hover {
  background-color: var(--accent-red);
  transform: scale(1.15);
  box-shadow: 0 6px 20px rgba(255, 117, 143, 0.4);
}

.btn-no {
  background-color: #b0a8a6;
  /* Little dark grey */
  color: var(--text-secondary);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.btn-no.dodge {
  position: absolute;
  z-index: 99;
  transition: top 0.2s cubic-bezier(0.25, 0.8, 0.25, 1), left 0.2s cubic-bezier(0.25, 0.8, 0.25, 1), transform 0.2s;
}

/* Celebration Overlay / Modal */
#celebration-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(255, 215, 226, 0.85);
  /* Lighter Aesthetic Pink background */
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s cubic-bezier(0.77, 0, 0.175, 1), visibility 0.8s;
  padding: 20px;
}

#celebration-modal.active {
  opacity: 1;
  visibility: visible;
}

#canvas-confetti {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2001;
}

.celebration-card {
  background: white;
  border-radius: 24px;
  width: 100%;
  max-width: 550px;
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  z-index: 2002;
  transform: scale(0.8) translateY(30px);
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

#celebration-modal.active .celebration-card {
  transform: scale(1) translateY(0);
}

.celebration-heart {
  font-size: 4rem;
  color: var(--accent-pink);
  animation: pulseBig 1s infinite alternate ease-in-out;
}

.celebration-title {
  font-family: var(--font-cursive);
  font-size: 3.5rem;
  color: var(--accent-red);
  line-height: 1;
}

.celebration-message {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--text-primary);
  line-height: 1.6;
}

@media (max-width: 768px) {
  .celebration-card {
    padding: 1.5rem 1rem;
    max-width: 95%;
    gap: 1rem;
  }

  .celebration-title {
    font-size: 1.8rem;
  }

  .celebration-message {
    font-size: 1rem;
  }
}

/* Love Coupon Card styling */
.love-coupon {
  border: 2px dashed var(--accent-rose);
  background-color: var(--bg-primary);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1rem;
  position: relative;
  width: 100%;
  max-width: 400px;
  overflow: hidden;
}

.love-coupon::before,
.love-coupon::after {
  content: "";
  position: absolute;
  top: calc(50% - 10px);
  width: 20px;
  height: 20px;
  background-color: white;
  border-radius: 50%;
  border: 2px solid var(--accent-rose);
}

.love-coupon::before {
  left: -12px;
}

.love-coupon::after {
  right: -12px;
}

.coupon-tag {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent-pink);
  letter-spacing: 2px;
  margin-bottom: 5px;
}

.coupon-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.coupon-code {
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: bold;
  background-color: white;
  border: 1px solid var(--accent-rose);
  padding: 5px 15px;
  border-radius: 4px;
  display: inline-block;
  color: var(--accent-red);
  letter-spacing: 1px;
}

.btn-close {
  margin-top: 1rem;
  background-color: var(--text-primary);
  color: white;
  padding: 10px 25px;
  font-size: 0.95rem;
}

.btn-close:hover {
  background-color: #000;
  transform: translateY(-2px);
}

/* Animations */
@keyframes pulseSeal {
  0% {
    transform: scale(1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  }

  50% {
    transform: scale(1.06);
    box-shadow: 0 6px 16px rgba(224, 47, 74, 0.5);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  }
}

@keyframes pulseLight {
  0% {
    opacity: 0.75;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
  }

  50% {
    opacity: 1;
    text-shadow: 0 0 25px rgba(255, 255, 255, 0.4);
  }

  100% {
    opacity: 0.75;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
  }
}

@keyframes floatNote {
  0% {
    transform: translate(0, 0) scale(0.5);
    opacity: 0;
  }

  10% {
    opacity: 1;
  }

  90% {
    opacity: 0.8;
  }

  100% {
    transform: translate(var(--dx, 25px), -50px) rotate(30deg) scale(1.2);
    opacity: 0;
  }
}

@keyframes heartbeat {
  0% {
    transform: scale(1);
  }

  14% {
    transform: scale(1.08);
  }

  28% {
    transform: scale(1);
  }

  42% {
    transform: scale(1.08);
  }

  70% {
    transform: scale(1);
  }
}

@keyframes pulseBig {
  0% {
    transform: scale(1);
  }

  100% {
    transform: scale(1.15);
  }
}

@keyframes bounce {

  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(-10px);
  }

  60% {
    transform: translateY(-5px);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* PIN Modal Styles */
#pin-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 1;
  transition: opacity 0.3s;
  overflow: hidden;
}

#pin-modal.unlocked {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.lockscreen-bg {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 1;
  overflow: hidden;
}

.ls-heart {
  position: absolute;
  font-size: 1.5rem;
  opacity: 0.5;
  animation: floatLockHeart 6s infinite ease-in-out;
  pointer-events: none;
}

.lsh-1 {
  top: 10%;
  left: 10%;
  animation-delay: 0s;
}

.lsh-2 {
  top: 70%;
  left: 15%;
  animation-delay: 1s;
  font-size: 2rem;
}

.lsh-3 {
  top: 20%;
  right: 15%;
  animation-delay: 2s;
}

.lsh-4 {
  top: 80%;
  right: 10%;
  animation-delay: 0.5s;
  font-size: 1.2rem;
}

.lsh-5 {
  top: 45%;
  left: 50%;
  animation-delay: 1.5s;
  font-size: 2.5rem;
  opacity: 0.3;
}

@keyframes floatLockHeart {

  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-15px) rotate(10deg);
  }
}

.lsh-5 {
  left: 90%;
  animation-duration: 14s;
}

@keyframes floatUp {
  0% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }

  10% {
    opacity: 0.6;
  }

  90% {
    opacity: 0.6;
  }

  100% {
    transform: translateY(-20vh) rotate(360deg);
    opacity: 0;
  }
}

.pin-card-container {
  position: relative;
  z-index: 10;
  perspective: 1000px;
}

.pin-card-inner {
  display: flex;
  gap: 4rem;
  align-items: center;
  justify-content: center;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
}

.mobile-flip-text {
  display: none;
}

@media (max-width: 768px) {
  .pin-card-container {
    width: 300px;
    height: 480px;
  }

  .pin-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    gap: 0;
  }

  .pin-card-front,
  .pin-card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .pin-card-front {
    cursor: pointer;
  }

  .pin-card-back {
    transform: rotateY(180deg);
  }

  .pin-card-inner.flipped {
    transform: rotateY(180deg);
  }

  .mobile-flip-text {
    display: block;
    margin-top: 20px;
    font-family: var(--font-sans);
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    animation: pulseLight 2s infinite;
  }
}

.pin-image-section {
  width: 320px;
  background: white;
  padding: 15px 15px 60px 15px;
  border-radius: 2px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .pin-image-section {
    width: 250px;
    padding: 12px 12px 45px 12px;
    border-radius: 2px;
  }
}

.pin-image-section img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
  .pin-image-section img {
    height: 250px;
  }
}

.pin-polaroid-caption {
  font-family: var(--font-cursive);
  font-size: 2rem;
  color: var(--text-primary);
  text-align: center;
  margin-top: 20px;
}

@media (max-width: 768px) {
  .pin-polaroid-caption {
    font-size: 1.5rem;
    margin-top: 15px;
  }
}

.pin-keypad-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  padding: 3rem;
  border-radius: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.pin-title {
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: 1px;
}

.pin-hint {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.7);
  padding: 6px 18px;
  border-radius: 20px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

#pin-modal.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.pin-display {
  display: flex;
  gap: 15px;
  margin-bottom: 2.5rem;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--text-secondary);
  transition: all 0.2s;
}

.pin-dot.filled {
  background-color: var(--accent-red);
  border-color: var(--accent-red);
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.pin-btn {
  width: 65px;
  height: 65px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
  font-size: 1.6rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

.pin-btn:hover {
  background: #fff;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.pin-btn:active {
  transform: scale(0.95);
}

.pin-clear,
.pin-close {
  font-size: 1.2rem;
  background: rgba(255, 117, 143, 0.15);
  color: var(--accent-red);
}

.pin-error {
  color: #ff4d4d;
  margin-top: 15px;
  font-size: 0.9rem;
}

.shake {
  animation: shakeError 0.4s;
}

@keyframes shakeError {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-10px);
  }

  50% {
    transform: translateX(10px);
  }

  75% {
    transform: translateX(-10px);
  }
}

/* Live Counter Styles */
.live-timer .time-blocks {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.time-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.time-block span {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--accent-red);
}

.time-block small {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 1px;
}

@keyframes float {
  0% {
    transform: translateY(0px) rotate(0deg);
  }

  50% {
    transform: translateY(-30px) rotate(5deg);
  }

  100% {
    transform: translateY(0px) rotate(0deg);
  }
}

@keyframes pulseBig {
  0% {
    transform: scale(0.8);
    opacity: 0.5;
  }

  100% {
    transform: scale(1.2);
    opacity: 1;
  }
}

.hidden {
  display: none !important;
}

/* Pagination Styles */
.pages-container {
  width: 100%;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.page-section {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding-bottom: 80px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(30px) scale(0.98);
  transition: opacity 0.6s ease, transform 0.6s ease, visibility 0.6s;
  overflow-y: auto;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-direction: column;
}

.page-section.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.page-content {
  max-width: 800px;
  width: 90%;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: auto 0;
  /* Vertically centers the content within the flex container safely */
}

.next-page-btn {
  margin-top: 1.5rem;
  background: var(--accent-red);
  color: #fff;
  border: none;
  padding: 12px 30px;
  border-radius: 30px;
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(204, 0, 51, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

.next-page-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(204, 0, 51, 0.4);
}

/* Polaroid Gallery Styles */
.polaroid-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  padding: 2rem 1rem;
  width: 100%;
}

.polaroid-wrapper {
  perspective: 1000px;
  flex: 1 1 0;
  min-width: 0;
}

.letter-content {
  background: white;
  color: var(--text-primary);
  padding: 40px;
  border-radius: 4px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  background-image: repeating-linear-gradient(transparent, transparent 29px, rgba(0, 0, 0, 0.1) 30px);
  line-height: 30px;
}

@media (max-width: 768px) {
  .letter-content {
    padding: 20px;
    background-image: repeating-linear-gradient(transparent, transparent 29px, rgba(0, 0, 0, 0.1) 30px);
  }
}

.polaroid {
  background: white;
  padding: 10px 10px 30px 10px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  transform: rotate(calc(var(--rot, -3) * 1deg));
  transition: transform 0.3s;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
}

.polaroid:hover {
  transform: scale(1.05) rotate(0deg);
  z-index: 10;
}

.polaroid-wrapper:nth-child(even) .polaroid {
  --rot: 4;
}

.polaroid-wrapper:nth-child(3n) .polaroid {
  --rot: -2;
}

.polaroid-img-container {
  width: 100%;
  display: flex;
  justify-content: center;
}

.polaroid-img-container img {
  display: block;
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.polaroid-caption {
  font-family: var(--font-cursive);
  text-align: center;
  margin-top: 15px;
  font-size: 1.5rem;
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .polaroid-grid {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 1rem 0;
    overflow-x: hidden;
  }

  .polaroid {
    padding: 15px 15px 40px 15px;
    width: 280px;
    max-width: 100%;
  }

  .polaroid-caption {
    font-size: 1.4rem;
    margin-top: 15px;
  }
}

/* Proposal Page (Page 5) Styles */
.proposal-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 60vh;
  position: relative;
  padding: 2rem 0;
}

.proposal-question {
  font-family: var(--font-cursive);
  font-size: 1.8rem;
  /* Decreased size */
  font-weight: 400;
  /* Unbolded */
  text-align: center;
  color: var(--text-primary);
  margin-bottom: 2.5rem;
  line-height: 1.4;
}

.proposal-question span {
  display: block;
}

@media (max-width: 768px) {
  .proposal-question {
    font-size: 2.6rem;
    margin-bottom: 2rem;
    padding: 0 10px;
    line-height: 1.3;
  }

  .proposal-question span {
    font-size: 2.6rem !important;
  }

  .proposal-section {
    min-height: 50vh;
  }

  .button-group {
    gap: 15px;
  }

  .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
  }
}

.button-group {
  display: flex;
  gap: 20px;
  margin-top: 2rem;
  z-index: 10;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  padding: 12px 30px;
  border-radius: 30px;
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-yes {
  background: var(--accent-red);
  color: white;
  box-shadow: 0 5px 15px rgba(204, 0, 51, 0.3);
}

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

.btn-no {
  background: #908886;
  /* Overriding light grey with darker grey */
  color: #ffffff;
  transition: all 0.2s ease-out;
  position: relative;
}

.btn-close {
  background: var(--text-secondary);
  color: white;
}

/* Letter Box Styles */
.letter-box-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.3s;
}

.letter-box-container:hover {
  transform: scale(1.05) translateY(-5px);
}

.envelope-icon {
  width: 300px;
  height: 300px;
  margin: 0 auto 1.5rem auto;
  display: block;
  filter: drop-shadow(0 15px 15px rgba(204, 0, 51, 0.2));
  transition: transform 0.3s;
}

.letter-box-container p {
  font-family: var(--font-serif);
  color: var(--accent-red);
  font-size: 1.2rem;
  font-weight: 600;
}

/* Typewriter Cursor */
.typewriter-cursor {
  display: inline-block;
  width: 8px;
  height: 1.2em;
  background-color: var(--text-primary);
  vertical-align: text-bottom;
  animation: blink 0.8s step-end infinite;
  margin-left: 2px;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

/* Loader Styles */
#loader-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.8s ease;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  position: relative;
}

.loading-heart-svg {
  width: 120px;
  height: 120px;
  animation: pulseHeart 1.5s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
  overflow: visible;
  z-index: 2;
}

@keyframes pulseHeart {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }

  50% {
    transform: scale(1.15);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 0.8;
  }
}

@keyframes ripple {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -50%) scale(2.5);
    opacity: 0;
  }
}

.loader-text {
  font-family: var(--font-cursive);
  font-size: 2.2rem;
  color: var(--accent-red);
  font-weight: 500;
  letter-spacing: 1px;
  animation: pulseLight 2s infinite alternate;
}

.loading-bar-container {
  width: 250px;
  height: 6px;
  background: var(--glass-border);
  border-radius: 10px;
  overflow: hidden;
}

.loading-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-red);
  border-radius: 10px;
  transition: width 2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Watermark --- */
.watermark {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: var(--text-color, #4a4a4a);
  opacity: 0.5;
  text-decoration: none;
  font-family: var(--font-sans, sans-serif);
  z-index: 1000;
  transition: opacity 0.3s ease;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.watermark:hover {
  opacity: 1;
}