/* BASE STYLING */
:root {
  --primary-bg: #130720;
  --primary-color: #f5d2a9;
  --accent-pink: #ff9bb5;
  --accent-lilac: #cda5f6;
  --text-color: #f8ece5;
  --panel-bg: rgba(255, 255, 255, 0.07);
  --panel-border: rgba(245, 210, 169, 0.18);
  --shadow-color: rgba(0, 0, 0, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: radial-gradient(circle at 20% 10%, rgba(255, 143, 177, 0.14), transparent 16%),
              radial-gradient(circle at 88% 5%, rgba(212, 165, 247, 0.12), transparent 15%),
              linear-gradient(180deg, #190b24 0%, #0c0414 48%, #08020a 100%);
  color: var(--text-color);
  font-family: 'Montserrat', sans-serif;
  overflow-x: hidden;
  line-height: 1.7;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 40%);
  pointer-events: none;
  z-index: 0;
}

button {
  font: inherit;
  outline: none;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
}

button:focus-visible {
  outline: 3px solid rgba(245, 210, 169, 0.9);
  outline-offset: 4px;
}

h1, h2, .title, .main-title, .closing-title, .sub-title-elegant {
  font-family: 'Playfair Display', serif;
  font-weight: 400;
}

.subtitle, .signature, .hero-badge {
  font-family: 'Montserrat', sans-serif;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  font-size: 0.82rem;
  opacity: 0.85;
}

canvas#stardust {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

.screen-center {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 22px;
  background: rgba(8, 2, 18, 0.96);
  z-index: 100;
  transition: opacity 0.9s ease, visibility 0.9s ease;
}

.intro-content {
  width: min(100%, 480px);
  max-width: 480px;
  padding: 38px 32px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 36px;
  background: linear-gradient(180deg, rgba(18, 9, 33, 0.96), rgba(20, 11, 41, 0.88));
  box-shadow: 0 28px 88px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(20px);
}

.subtitle {
  color: rgba(255, 220, 185, 0.88);
  margin-bottom: 18px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.title {
  font-size: clamp(3rem, 6vw, 4.6rem);
  margin-bottom: 22px;
  line-height: 1.02;
  background: linear-gradient(135deg, #ffd3d9 0%, #ffdbaa 45%, #ffe9d8 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.intro-copy {
  font-size: 1rem;
  line-height: 1.9;
  color: rgba(244, 233, 225, 0.96);
  margin: 0 auto 32px;
  max-width: 460px;
}

.intro-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.music-note {
  margin-top: 16px;
  color: rgba(245, 233, 225, 0.82);
  font-size: 0.96rem;
  letter-spacing: 0.8px;
}

.surprise-hint {
  margin-top: 18px;
  color: rgba(255, 239, 228, 0.92);
  font-size: 0.98rem;
  line-height: 1.8;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.envelope-container {
  margin: 0 auto 28px;
  width: 180px;
  height: 120px;
  perspective: 900px;
}

.envelope {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s ease;
}

.envelope-flap,
.envelope-body {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(245, 210, 169, 0.55));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18), 0 18px 40px rgba(0,0,0,0.14);
}

.envelope-flap {
  top: 0;
  height: 55%;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  transform-origin: bottom center;
  transform: rotateX(0deg);
  z-index: 2;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 60%, 0 100%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 210, 169, 0.62));
}

.envelope-body {
  bottom: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(243, 204, 255, 0.3));
}

.envelope-body::before {
  content: '';
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 18px;
  height: 1px;
  background: rgba(255, 255, 255, 0.45);
}

.letter {
  position: absolute;
  top: 30%;
  left: 13%;
  width: 74%;
  height: 50%;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 16px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  transform: translateY(10px);
  opacity: 0;
  visibility: hidden;
  padding: 14px 16px;
  font-size: 0.9rem;
  color: #2b0e26;
  line-height: 1.5;
  transition: transform 0.7s ease, opacity 0.7s ease, visibility 0s linear 0.7s;
}

.envelope.opened .letter {
  visibility: visible;
  transition-delay: 0s;
}

.envelope.opened .envelope-flap {
  transform: rotateX(-180deg);
}

.envelope.opened .letter {
  transform: translateY(-50px);
  opacity: 1;
}

.elegant-btn,
.music-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  padding: 14px 30px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease, color 0.3s ease;
  letter-spacing: 1px;
}

.elegant-btn {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 248, 242, 0.98);
}

.primary-btn {
  background: linear-gradient(135deg, rgba(255, 176, 188, 0.95), rgba(255, 210, 175, 0.96));
  color: #1a0617;
  box-shadow: 0 18px 40px rgba(255, 182, 200, 0.2);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 248, 242, 0.9);
}

.music-btn,
.small-btn {
  background: rgba(255, 255, 255, 0.14);
  color: var(--primary-color);
  min-width: 56px;
  padding: 12px 18px;
}

.elegant-btn:hover,
.music-btn:hover,
.secondary-btn:hover,
.small-btn:hover,
.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 45px rgba(255, 181, 206, 0.22);
}

.primary-btn:hover {
  background: linear-gradient(135deg, rgba(255, 195, 211, 1), rgba(255, 225, 190, 1));
}

.secondary-btn {
  animation: glowPulse 3.6s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 255, 255, 0); }
  50% { box-shadow: 0 0 20px rgba(255, 189, 229, 0.18); }
}

.elegant-btn:not(.primary-btn):not(.secondary-btn):hover {
  background: var(--primary-color);
  color: #1a0617;
}

.music-btn.active {
  background: rgba(245, 210, 169, 0.32);
}

.hidden {
  display: none;
  opacity: 0;
  visibility: hidden;
  height: 0;
  overflow: hidden;
}

section {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 58px 24px;
  position: relative;
  z-index: 1;
}

.hero-section {
  background: radial-gradient(circle at top, rgba(255, 143, 177, 0.16), transparent 24%),
              radial-gradient(circle at left, rgba(212, 165, 247, 0.14), transparent 20%),
              linear-gradient(180deg, rgba(31, 10, 41, 0.94), rgba(7, 2, 18, 0.98));
}

.hero-panel {
  max-width: 760px;
  width: 100%;
  padding: 44px 36px;
  border-radius: 36px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(245, 210, 169, 0.16);
  backdrop-filter: blur(22px);
  box-shadow: 0 42px 110px rgba(0, 0, 0, 0.3);
}

.hero-badge {
  display: inline-flex;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  color: rgba(248, 236, 229, 0.92);
  margin-bottom: 22px;
  letter-spacing: 1px;
}

.main-title {
  font-size: clamp(2.8rem, 5vw, 4.4rem);
  margin-bottom: 22px;
  letter-spacing: -0.04em;
  line-height: 1.04;
}

.hero-note {
  font-size: 1.05rem;
  line-height: 1.9;
  color: rgba(248, 236, 229, 0.92);
  max-width: 680px;
  margin: 0 auto 32px;
}

.hero-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 24px;
}

.scroll-hint {
  color: rgba(248, 236, 229, 0.7);
  font-size: 0.95rem;
  letter-spacing: 0.4px;
}

.scroll-hint span {
  display: inline-block;
  margin-left: 8px;
  animation: bounce 1.6s ease-in-out infinite;
}

.special-btn,
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  padding: 14px 28px;
  border-radius: 999px;
  border: 1px solid rgba(245, 210, 169, 0.5);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  letter-spacing: 1px;
  font-weight: 500;
}

.special-btn:hover,
.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 35px rgba(255, 181, 206, 0.14);
  background: rgba(255, 255, 255, 0.18);
}

.special-btn {
  background: linear-gradient(135deg, rgba(255, 115, 173, 0.22), rgba(245, 210, 169, 0.24));
  color: var(--text-color);
}

.share-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary-color);
}

.special-btn:hover,
.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(255, 181, 206, 0.18);
}

.photo-section {
  padding: 28px 24px 44px;
}

.photo-card {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
  position: relative;
}

.toggle-photo-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-color);
  border: 1px solid rgba(245, 210, 169, 0.3);
  font-size: 0.9rem;
  transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  z-index: 2;
}

.toggle-photo-btn:hover,
.toggle-photo-btn:focus-visible {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.15);
}

.photo-card.collapsed .photo-frame,
.photo-card.collapsed .photo-caption {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.4s ease, max-height 0.4s ease, margin-bottom 0.4s ease;
}

.photo-card.collapsed .photo-frame {
  margin-bottom: 0;
  padding: 0;
  height: 0;
  overflow: hidden;
}

.photo-card.collapsed .photo-caption {
  margin-top: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  display: block;
}

.photo-frame {
  position: relative;
  width: min(100%, 480px);
  margin: 0 auto 24px;
  border-radius: 38px;
  overflow: hidden;
  border: 1px solid rgba(245, 210, 169, 0.18);
  box-shadow: 0 35px 90px rgba(0, 0, 0, 0.22);
  transition: opacity 0.4s ease, max-height 0.4s ease, margin-bottom 0.4s ease;
}

.photo-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.12), transparent 20%),
              radial-gradient(circle at 70% 80%, rgba(255, 189, 229, 0.08), transparent 25%);
}

.photo-img {
  width: 100%;
  display: block;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  filter: saturate(1.05) contrast(1.08);
}

.photo-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255, 189, 229, 0.24), transparent 30%),
              radial-gradient(circle at 70% 80%, rgba(212, 165, 247, 0.18), transparent 25%);
  pointer-events: none;
}

.photo-halo {
  position: absolute;
  inset: -24px;
  border-radius: 48px;
  background: radial-gradient(circle at center, rgba(255, 197, 214, 0.18), transparent 48%);
  filter: blur(14px);
  opacity: 0.85;
}

.photo-caption {
  margin-top: 14px;
  color: rgba(248, 236, 229, 0.88);
  font-size: 1rem;
  line-height: 1.8;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.divider {
  width: 76px;
  height: 2px;
  margin: 26px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0));
}

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 150;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 18px;
  border-radius: 4px;
  opacity: 0.95;
  animation: confetti 2.2s ease-out forwards;
}

@keyframes confetti {
  to {
    transform: translate3d(var(--tx), 260px, 0) rotate(720deg);
    opacity: 0;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(22, 7, 34, 0.95);
  color: var(--text-color);
  padding: 12px 24px;
  border-radius: 999px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  z-index: 200;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.content-box {
  width: 100%;
  padding: 44px 38px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(245, 210, 169, 0.16);
  border-radius: 32px;
  backdrop-filter: blur(20px);
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.22);
}

.content-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quote-card {
  padding: 34px 30px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(245, 210, 169, 0.1);
  border-radius: 26px;
  color: rgba(248, 236, 229, 0.96);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.quote-card h2 {
  font-size: 1.6rem;
  margin-bottom: 18px;
  color: var(--primary-color);
}

.quote-card p {
  font-size: 1rem;
  line-height: 1.95;
}

.story-text {
  font-size: clamp(1rem, 1.05vw, 1.25rem);
  line-height: 1.95;
}

.last-message {
  padding-top: 12px;
}

.closing-title {
  font-size: clamp(3rem, 5vw, 4.2rem);
  margin-top: 20px;
}

.signature {
  margin-top: 24px;
  color: rgba(248, 236, 229, 0.72);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translate(-50%, 0); }
  40% { transform: translate(-50%, -10px); }
  60% { transform: translate(-50%, -5px); }
}

.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: all 1.1s cubic-bezier(0.5, 0, 0, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .screen-center {
    padding: 18px;
  }
  .intro-content {
    padding: 32px 22px;
  }
  .title {
    font-size: clamp(2.3rem, 8vw, 3.4rem);
  }
  .intro-copy {
    font-size: 0.98rem;
    margin-bottom: 24px;
  }
  .hero-panel {
    padding: 32px 22px;
  }
  .main-title {
    font-size: 2.3rem;
  }
  .hero-note {
    font-size: 1rem;
  }
  .intro-actions,
  .hero-actions,
  .content-grid {
    gap: 12px;
  }
  .elegant-btn,
  .music-btn,
  .special-btn,
  .share-btn {
    min-width: 120px;
    padding: 12px 22px;
  }
  .content-box {
    padding: 28px 20px;
  }
  .quote-card {
    padding: 28px 22px;
  }
  .hero-actions {
    gap: 10px;
  }
  section {
    padding: 40px 18px;
  }
  .closing-title {
    font-size: 2.6rem;
  }
}

@media (max-width: 520px) {
  .hero-panel,
  .content-box,
  .intro-content {
    border-radius: 26px;
  }
  .hero-note,
  .story-text,
  .intro-copy {
    font-size: 0.95rem;
  }
  .scroll-hint {
    font-size: 0.88rem;
  }
  section {
    padding: 34px 16px;
  }
  .music-note {
    margin-top: 16px;
  }
  .intro-actions,
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .intro-actions button,
  .hero-actions button {
    width: 100%;
  }
  .elegant-btn,
  .music-btn,
  .special-btn,
  .share-btn {
    width: 100%;
    min-width: auto;
    padding: 14px 20px;
  }
  .photo-frame {
    width: 100%;
  }
  .toggle-photo-btn {
    position: relative;
    top: 0;
    right: 0;
    width: 100%;
    margin-bottom: 16px;
  }
  .photo-card {
    padding: 0 0 24px;
  }
}

