:root {
  --primary-color: #ff6584;
  --primary-dark: #e84a6c;
  --secondary-color: #6c5ce7;
  --accent-gold: #ffbe76;
  --bg-gradient: linear-gradient(135deg, #fff0f5 0%, #ffe4e9 50%, #f3e8ff 100%);
  --card-bg: rgba(255, 255, 255, 0.92);
  --text-main: #2d3436;
  --text-muted: #636e72;
  --shadow-soft: 0 10px 30px rgba(255, 101, 132, 0.15);
  --shadow-hover: 0 20px 40px rgba(255, 101, 132, 0.25);
  --border-radius: 24px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  color: var(--text-main);
  overflow-x: hidden;
  position: relative;
  line-height: 1.7;
}

/* Floating background icons */
.floating-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.floating-item {
  position: absolute;
  font-size: 1.5rem;
  opacity: 0.6;
  animation: floatUp 8s linear infinite;
  user-select: none;
}

@keyframes floatUp {
  0% {
    transform: translateY(105vh) rotate(0deg) scale(0.8);
    opacity: 0;
  }
  15% {
    opacity: 0.7;
  }
  90% {
    opacity: 0.7;
  }
  100% {
    transform: translateY(-10vh) rotate(360deg) scale(1.2);
    opacity: 0;
  }
}

/* Container */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  position: relative;
  z-index: 1;
}

/* Music Toggle Button */
.music-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
}

.music-toggle button {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 101, 132, 0.3);
  padding: 10px 18px;
  border-radius: 50px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.music-toggle button:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 20px rgba(255, 101, 132, 0.25);
  background: #ffffff;
}

.music-toggle button.playing {
  background: var(--primary-color);
  color: white;
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 3rem 1rem 2rem;
}

.badge {
  display: inline-block;
  background: #ffe3ec;
  color: var(--primary-dark);
  padding: 6px 20px;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  box-shadow: 0 2px 10px rgba(255, 101, 132, 0.15);
  animation: pulse 2s infinite;
  letter-spacing: 0.5px;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.main-title {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(2.3rem, 6vw, 3.8rem);
  font-weight: 800;
  color: #2c2033;
  margin-bottom: 1.2rem;
  line-height: 1.25;
  letter-spacing: -0.5px;
}

.highlight-name {
  color: var(--primary-color);
  position: relative;
  display: inline-block;
  text-shadow: 0 2px 10px rgba(255, 101, 132, 0.2);
  background: linear-gradient(120deg, #ff6584, #e84a6c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  color: var(--text-muted);
  max-width: 650px;
  margin: 0 auto 2.5rem;
  font-weight: 400;
}

/* Buttons */
.cta-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 14px 28px;
  border-radius: 50px;
  cursor: pointer;
  border: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  box-shadow: 0 8px 25px rgba(255, 101, 132, 0.4);
}

.btn-primary:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 12px 30px rgba(255, 101, 132, 0.6);
}

.btn-secondary {
  background: white;
  color: var(--primary-dark);
  border: 2px solid rgba(255, 101, 132, 0.2);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
  background: #fff5f7;
  transform: translateY(-4px);
  border-color: var(--primary-color);
}

/* Birthday Cake Section */
.cake-section {
  margin: 3.5rem 0;
}

.cake-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border-radius: var(--border-radius);
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.cake-card h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: #3b233a;
  margin-bottom: 0.5rem;
}

.cake-card .hint {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.cake-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 1rem 0;
  user-select: none;
}

/* Candle & Flame */
.candle {
  position: relative;
  width: 14px;
  height: 48px;
  background: repeating-linear-gradient(
    45deg,
    #fff,
    #fff 6px,
    #ff6584 6px,
    #ff6584 12px
  );
  border-radius: 4px;
  margin-bottom: -4px;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.wick {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 8px;
  background: #444;
}

.flame {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 24px;
  background: radial-gradient(ellipse at bottom, #fff 0%, #ffeb3b 50%, #ff5722 100%);
  border-radius: 50% 50% 35% 35% / 60% 60% 40% 40%;
  box-shadow: 0 0 20px #ff9800, 0 0 40px #ffeb3b;
  animation: flicker 0.8s infinite alternate;
  cursor: pointer;
  transition: opacity 0.5s ease;
}

@keyframes flicker {
  0% { transform: translateX(-50%) rotate(-2deg) scale(1); }
  50% { transform: translateX(-50%) rotate(2deg) scale(1.08); }
  100% { transform: translateX(-50%) rotate(-1deg) scale(0.95); }
}

.flame.extinguished {
  opacity: 0;
  pointer-events: none;
}

/* Cake Visual Layers */
.cake {
  position: relative;
  width: 160px;
  z-index: 2;
}

.layer {
  position: relative;
  background: #ffb8c6;
  border-radius: 12px;
}

.layer-top {
  height: 38px;
  width: 130px;
  margin: 0 auto;
  background: #ffa8ba;
  border-bottom: 4px solid #f38da3;
}

.layer-bottom {
  height: 48px;
  width: 160px;
  background: #f794a8;
  margin-top: 3px;
  border-bottom: 5px solid #e0758c;
}

.frosting {
  display: flex;
  justify-content: space-around;
  width: 130px;
  margin: -10px auto 0;
  position: relative;
  z-index: 4;
}

.frosting span {
  width: 16px;
  height: 14px;
  background: #ffffff;
  border-radius: 50%;
  display: block;
}

.wish-msg {
  display: none;
  margin-top: 1.5rem;
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary-dark);
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Envelope & Letter Section */
.letter-section {
  margin: 4.5rem 0 5rem;
  text-align: center;
  position: relative;
  z-index: 25;
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  color: #2c2033;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 2.5rem;
}

.envelope-wrapper {
  perspective: 1200px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 480px;
  margin-bottom: 3.5rem;
  position: relative;
  z-index: 30;
}

.envelope {
  position: relative;
  width: 340px;
  height: 230px;
  background: #e8869b;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 15px 35px rgba(0,0,0,0.15);
  transition: transform 0.4s ease;
}

.envelope:hover {
  transform: translateY(-5px);
}

.envelope .front {
  position: absolute;
  width: 0;
  height: 0;
  z-index: 3;
}

.envelope .flap {
  border-left: 170px solid transparent;
  border-right: 170px solid transparent;
  border-top: 130px solid #f397ab;
  top: 0;
  left: 0;
  transform-origin: top;
  transition: transform 0.6s 0.3s ease, z-index 0.2s 0.4s;
  z-index: 5;
}

.envelope .pocket {
  border-left: 170px solid #e07b90;
  border-right: 170px solid #e07b90;
  border-bottom: 130px solid #d46c82;
  border-top: 100px solid transparent;
  bottom: 0;
  left: 0;
  border-radius: 0 0 12px 12px;
}

.envelope .letter {
  position: absolute;
  top: 10px;
  left: 15px;
  width: 310px;
  height: 210px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  padding: 22px 20px;
  text-align: left;
  z-index: 2;
  transition: transform 0.6s ease, height 0.6s 0.4s;
  box-sizing: border-box;
  overflow: hidden;
}

/* Styled scrollbar for the letter */
.envelope .letter::-webkit-scrollbar {
  width: 5px;
}

.envelope .letter::-webkit-scrollbar-track {
  background: #fff0f5;
  border-radius: 10px;
}

.envelope .letter::-webkit-scrollbar-thumb {
  background: #ff6584;
  border-radius: 10px;
}

.letter-content {
  opacity: 0.95;
  transition: opacity 0.5s ease;
}

.letter-content h4 {
  font-family: 'Caveat', cursive, sans-serif;
  font-size: 1.8rem;
  color: var(--primary-dark);
  margin-bottom: 0.4rem;
  line-height: 1.2;
}

.greeting-highlight {
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.letter-content p {
  font-size: 0.93rem;
  color: #4a4a4a;
  line-height: 1.65;
  margin-bottom: 0.75rem;
}

.letter-footer {
  margin-top: 1rem;
  border-top: 1px dashed #ffd1dc;
  padding-top: 0.6rem;
  font-size: 0.9rem !important;
}

.letter-sender {
  display: inline-block;
  font-family: 'Caveat', cursive, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 6px;
  letter-spacing: 0.5px;
}

.heart-stamp {
  font-size: 1.6rem;
  display: inline-block;
  margin-bottom: 2px;
}

/* Open Envelope State */
.envelope.open .flap {
  transform: rotateX(180deg);
  z-index: 1;
}

.envelope.open .letter {
  transform: translateY(-210px);
  height: 380px;
  min-height: 380px;
  max-height: 380px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.22);
}

/* Polaroid Gallery Section */
.gallery-section {
  margin: 5rem 0 3rem;
  text-align: center;
  position: relative;
  z-index: 5;
  clear: both;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  padding: 1rem;
}

.polaroid-card {
  background: #ffffff;
  padding: 16px 16px 24px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  cursor: pointer;
}

.polaroid-card:hover {
  transform: translateY(-10px) scale(1.03) !important;
  box-shadow: 0 20px 35px rgba(255, 101, 132, 0.25);
  z-index: 10;
}

.tilt-left {
  transform: rotate(-3deg);
}

.tilt-right {
  transform: rotate(3deg);
}

.pin {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.3rem;
  z-index: 5;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.img-box {
  width: 100%;
  height: 250px;
  overflow: hidden;
  border-radius: 4px;
  background: #f8f9fa;
}

.img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.polaroid-card:hover .img-box img {
  transform: scale(1.08);
}

.polaroid-card .caption {
  font-family: 'Caveat', cursive, sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #3b233a;
  margin-top: 15px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 3rem 1rem 1rem;
  border-top: 1px solid rgba(255, 101, 132, 0.2);
  margin-top: 3rem;
}

.footer p {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Mobile Responsive */
@media (max-width: 600px) {
  .envelope {
    width: 310px;
    height: 210px;
  }
  .envelope .letter {
    width: 280px;
    padding: 18px 14px;
  }
  .envelope .flap {
    border-left-width: 155px;
    border-right-width: 155px;
  }
  .envelope .pocket {
    border-left-width: 155px;
    border-right-width: 155px;
  }
  .envelope.open .letter {
    transform: translateY(-205px);
    height: 350px;
    min-height: 350px;
    max-height: 350px;
    overflow-y: auto;
    z-index: 50;
  }
  .envelope-wrapper {
    min-height: 460px;
    margin-bottom: 3rem;
  }
  .gallery-section {
    margin-top: 4.5rem;
  }
}
