:root {
  --love-pink: #ff8fb1;
  --love-red: #ff4d6d;
  --love-lavender: #b088f9;
  --love-bg1: #ffe0ea;
  --love-bg2: #fff0f5;
  --love-dark: #4a2c2a;
}

body.love-bg {
  min-height: 100vh;
  background: radial-gradient(circle at 20% 10%, var(--love-bg1), var(--love-bg2)),
              linear-gradient(120deg, #ffe5ef 0%, #fbe9ff 100%);
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  color: var(--love-dark);
}

.great-vibes {
  font-family: 'Great Vibes', cursive;
}

.text-love {
  color: var(--love-red);
}

.bg-love {
  background: linear-gradient(90deg, var(--love-pink), var(--love-red));
}

.btn-love {
  background: linear-gradient(90deg, var(--love-pink), var(--love-red));
  color: white;
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  box-shadow: 0 8px 20px rgba(255, 77, 109, 0.25);
}
.btn-love:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.btn-outline-love {
  border: 1px solid var(--love-red);
  color: var(--love-red);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  transition: all 0.3s ease;
}

.btn-outline-love:hover {
  background: var(--love-red);
  color: white;
  transform: translateY(-1px);
}

.love-progress {
  background-color: #f9d9e5;
  border-radius: 999px;
  overflow: hidden;
  height: 14px;
}
.love-progress .progress-bar {
  background: linear-gradient(90deg, var(--love-pink), var(--love-red));
}

/* Heart shape using CSS */
.heart-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 12px;
  transition: transform 0.2s ease, filter 0.2s ease;
}
.heart-btn:hover {
  transform: scale(1.15);
}

.heart-svg {
  width: 32px;
  height: auto;
  fill: var(--love-red);
  filter: drop-shadow(0 4px 8px rgba(255, 77, 109, 0.3));
  transition: fill 0.3s ease, filter 0.3s ease;
}

.heart-btn:hover .heart-svg {
  fill: #ff1a4d;
  filter: drop-shadow(0 6px 12px rgba(255, 77, 109, 0.5));
}

/* Remove old heart-shape styles */
.heart-shape {
  display: none;
}

/* Envelope */
.envelope {
  width: min(520px, 92vw);
  height: 320px;
  background: #fff;
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  border: 2px solid #ffe1ea;
}
.envelope-top {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(180deg, #ffd3e1, #fff);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.envelope-body {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 70%;
  background: #fff;
  border-radius: 24px;
}

/* Typing */
.typing-container {
  max-width: 900px;
  padding: 0 1rem;
}
.cursor {
  display: inline-block;
  color: var(--love-red);
  margin-left: 6px;
  animation: blink 0.9s steps(1) infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}

/* Floating hearts background */
.floating-hearts {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 90%, rgba(255, 143, 177, 0.25), transparent 60%),
    radial-gradient(circle at 80% 10%, rgba(176, 136, 249, 0.25), transparent 60%);
}

/* Aesthetic Envelope */
.envelope-wrapper {
  position: relative;
  width: 280px;
  height: 180px;
  perspective: 1000px;
  cursor: pointer;
}

.envelope-new {
  position: relative;
  width: 100%;
  height: 100%;
  background: #fff;
  border-radius: 0 0 15px 15px;
  transform-style: preserve-3d;
}

.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffc2d1;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top;
  z-index: 3;
  border-radius: 15px 15px 0 0;
  transition: transform 0.6s ease;
}

.envelope-front {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  /* Adjust clip-path to allow more space for text */
  clip-path: polygon(0 40%, 50% 80%, 100% 40%, 100% 100%, 0 100%);
  background: linear-gradient(135deg, #ffffff 0%, #fff0f5 100%);
  z-index: 2;
  border-radius: 0 0 15px 15px;
  border: 1px solid #ffe1ea;
  display: flex;
  align-items: flex-end; /* Align text towards the bottom */
  justify-content: center;
  padding-bottom: 25px; /* Add padding to keep text within visible area */
}

.envelope-paper {
  position: absolute;
  top: 10px;
  left: 10%;
  width: 80%;
  height: 80%;
  background: white;
  z-index: 1;
  transition: transform 0.6s ease;
  box-shadow: 0 0 10px rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
}

.heart-seal {
  font-size: 2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.envelope-text {
  font-family: 'Great Vibes', cursive;
  font-size: 1.8rem;
  color: var(--love-red);
  transform: rotate(-2deg);
  text-shadow: 1px 1px 0px rgba(255,255,255,0.5);
  pointer-events: none;
}

.tracking-widest {
  letter-spacing: 0.2em;
}

#open-btn {
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#open-btn:hover {
  transform: scale(1.05) translateY(-3px);
  box-shadow: 0 15px 30px rgba(255, 77, 109, 0.4);
}

/* Responsive tweaks */
@media (max-width: 575px) {
  .heart-shape { width: 24px; height: 24px; }
  .heart-shape::before,
  .heart-shape::after { width: 24px; height: 24px; }
  .heart-shape::before { top: -12px; }
}

.glass-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 30px;
  padding: 2.5rem;
  box-shadow: 0 15px 35px rgba(255, 77, 109, 0.12);
  max-height: 85vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--love-pink) transparent;
}

.glass-card::-webkit-scrollbar {
  width: 6px;
}
.glass-card::-webkit-scrollbar-thumb {
  background-color: var(--love-pink);
  border-radius: 20px;
}
.glass-card::-webkit-scrollbar-track {
  background: transparent;
}

/* Polaroid Style for Letter */
.polaroid-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1; /* Move to 1 to be above body background but behind glass-card */
  overflow: hidden;
  pointer-events: none;
}

.polaroid-item {
  position: absolute;
  background: white;
  padding: 10px 10px 30px 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  border-radius: 2px;
  width: 160px; /* Slightly larger */
  transform: rotate(var(--rotation));
  opacity: 0.9;
  z-index: 1;
}

.polaroid-item img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  display: block;
  background: #f0f0f0; /* Fallback color */
}

.glass-card {
  position: relative;
  z-index: 10; /* Ensure it's above polaroids */
}

#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.fade-in {
  animation: fadeIn 0.8s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.hearts-panel {
  width: min(420px, 92vw);
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 24px;
  padding: 1.5rem;
}

.glass-input {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 77, 109, 0.2);
  border-radius: 15px;
  padding: 12px;
  color: var(--love-dark);
  transition: all 0.3s ease;
}

.glass-input:focus {
  background: rgba(255, 255, 255, 0.6);
  border-color: var(--love-red);
  box-shadow: 0 0 15px rgba(255, 77, 109, 0.15);
  outline: none;
}

.btn-love:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
