/* ==========================================
   VALENTINE — CINEMATIC LOVE LETTER
   Dark romantic aesthetic, candlelit warmth
   ========================================== */

:root {
  --bg-void: #080305;
  --bg-deep: #0d0507;
  --bg-warm: #140a0c;
  --rose: #c9445a;
  --rose-light: #e8788a;
  --rose-pale: #f2a5b3;
  --rose-glow: rgba(201, 68, 90, 0.2);
  --rose-deep: #8a2a3a;
  --amber: #d4a574;
  --amber-soft: rgba(212, 165, 116, 0.15);
  --cream: #fdf6ee;
  --cream-warm: #f8ead8;
  --cream-dark: #f0dcc6;
  --ink: #3d2b1f;
  --ink-light: #6b5344;
  --white-soft: rgba(255, 255, 255, 0.87);
  --white-muted: rgba(255, 255, 255, 0.42);
  --white-ghost: rgba(255, 255, 255, 0.12);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-void);
  color: var(--white-soft);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ---- PARTICLE CANVAS ---- */
#particleCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---- AMBIENT GLOW LAYER ---- */
.ambient-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
  background:
    radial-gradient(ellipse 600px 600px at 20% 80%, rgba(201, 68, 90, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 500px 500px at 80% 20%, rgba(212, 165, 116, 0.04) 0%, transparent 70%);
  transition: opacity 2s ease;
}

/* ==========================================
   LOADING SCREEN
   ========================================== */
.loader-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-void);
  transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 1.2s;
}

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

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
}

/* Heart SVG drawing animation */
.loader-heart-wrap {
  position: relative;
  width: 120px;
  height: 110px;
  overflow: visible;
}

.loader-heart-svg {
  position: relative;
  z-index: 2;
  overflow: visible;
  display: block;
}

.heart-trace {
  stroke-dasharray: 320;
  stroke-dashoffset: 320;
  animation: traceHeart 2.4s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

.heart-fill-path {
  opacity: 0;
  animation: heartFillIn 1s ease 2s forwards;
}

@keyframes traceHeart {
  to { stroke-dashoffset: 0; }
}

@keyframes heartFillIn {
  to { opacity: 1; }
}

/* Pulsing glow behind heart */
.loader-heart-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 160px;
  height: 160px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 68, 90, 0.15) 0%, transparent 70%);
  animation: pulseGlow 2.4s ease-in-out infinite;
  z-index: 1;
}

@keyframes pulseGlow {
  0%, 100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.3; }
  50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.7; }
}

/* Progress line */
.loader-progress {
  width: 160px;
}

.loader-line-track {
  width: 100%;
  height: 1px;
  background: var(--white-ghost);
  border-radius: 1px;
  overflow: hidden;
  position: relative;
}

.loader-line-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--rose), var(--rose-light));
  border-radius: 1px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px var(--rose-glow);
}

.loader-whisper {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.85rem;
  font-style: italic;
  letter-spacing: 2px;
  color: var(--white-muted);
  font-weight: 300;
  opacity: 0;
  animation: fadeWhisper 1.5s ease 0.5s forwards;
}

@keyframes fadeWhisper {
  to { opacity: 1; }
}

/* ==========================================
   SCREENS
   ========================================== */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 1.4s;
  z-index: 1;
}

.screen.active {
  opacity: 1;
  visibility: visible;
}

/* ==========================================
   ENVELOPE SCREEN
   ========================================== */
.envelope-screen {
  background: transparent;
}

/* Radiance behind envelope */
.envelope-radiance {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(201, 68, 90, 0.12) 0%,
    rgba(201, 68, 90, 0.05) 40%,
    transparent 70%
  );
  filter: blur(40px);
  animation: radiancePulse 5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes radiancePulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
}

/* Light rays behind envelope */
.envelope-light-rays {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.3;
}

.light-ray {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  background: linear-gradient(to top, transparent, rgba(212, 165, 116, 0.08), transparent);
  transform-origin: bottom center;
}

.ray-1 { height: 280px; transform: translate(-50%, -100%) rotate(-30deg); animation: rayPulse 6s ease-in-out infinite; }
.ray-2 { height: 320px; transform: translate(-50%, -100%) rotate(-10deg); animation: rayPulse 6s ease-in-out 1s infinite; }
.ray-3 { height: 350px; transform: translate(-50%, -100%) rotate(8deg); animation: rayPulse 6s ease-in-out 2s infinite; }
.ray-4 { height: 300px; transform: translate(-50%, -100%) rotate(25deg); animation: rayPulse 6s ease-in-out 0.5s infinite; }
.ray-5 { height: 260px; transform: translate(-50%, -100%) rotate(42deg); animation: rayPulse 6s ease-in-out 3s infinite; }

@keyframes rayPulse {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.8; }
}

.envelope-hint {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.8rem;
  font-style: italic;
  letter-spacing: 5px;
  text-transform: lowercase;
  color: var(--white-muted);
  margin-bottom: 40px;
  animation: hintBreath 3s ease-in-out infinite;
  transition: opacity 0.6s ease;
  z-index: 3;
}

@keyframes hintBreath {
  0%, 100% { opacity: 0.2; transform: translateY(0); }
  50% { opacity: 0.6; transform: translateY(-3px); }
}

/* ---- ENVELOPE ---- */
.envelope-wrapper {
  perspective: 1200px;
  cursor: pointer;
  position: relative;
  z-index: 3;
}

.envelope-wrapper:hover .envelope {
  transform: translateY(-6px);
}

.envelope-wrapper:hover .envelope-shadow {
  transform: translateY(8px) scaleX(1.05);
  opacity: 0.4;
}

.envelope {
  position: relative;
  width: 320px;
  height: 210px;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Floating shadow beneath */
.envelope-shadow {
  position: absolute;
  bottom: -20px;
  left: 10%;
  width: 80%;
  height: 30px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.4) 0%, transparent 70%);
  filter: blur(10px);
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  z-index: 0;
}

.envelope-back {
  position: absolute;
  inset: 0;
  background: linear-gradient(155deg, #d9a89f 0%, #c4837a 40%, #b8726b 100%);
  border-radius: 8px;
  box-shadow:
    0 25px 70px rgba(0, 0, 0, 0.6),
    0 0 100px rgba(201, 68, 90, 0.08),
    inset 0 1px 0 rgba(255,255,255,0.1);
}

.envelope-letter-peek {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 78%;
  height: 48%;
  background: linear-gradient(180deg, var(--cream) 0%, var(--cream-warm) 100%);
  border-radius: 4px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 18px;
  z-index: 1;
  transition: transform 1s cubic-bezier(0.23, 1, 0.32, 1);
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.envelope-letter-peek span {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-style: italic;
  font-weight: 400;
  color: var(--ink-light);
  letter-spacing: 3px;
}

.envelope.opened .envelope-letter-peek {
  transform: translateX(-50%) translateY(var(--peek-rise, -70px));
  z-index: 5;
}

.envelope-front {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60%;
  background: linear-gradient(165deg, #c9857e 0%, #b8726b 60%, #a8665f 100%);
  border-radius: 0 0 8px 8px;
  z-index: 2;
  overflow: hidden;
}

/* Front stays above letter peek until envelope opens */
.envelope.opened .envelope-front {
  z-index: 1;
}

.envelope-front-fold {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg,
    transparent 47%,
    rgba(255,255,255,0.05) 48%,
    rgba(255,255,255,0.05) 52%,
    transparent 53%
  );
}

.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 54%;
  background: linear-gradient(185deg, #be7a73 0%, #c9857e 100%);
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  transform-origin: top center;
  transition: transform 1.2s cubic-bezier(0.23, 1, 0.32, 1);
  z-index: 3;
}

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

.wax-seal {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  transition: opacity 0.6s ease 0.2s, transform 0.6s ease 0.2s;
}

.envelope.opened .wax-seal {
  opacity: 0;
  transform: translateX(-50%) scale(0.3) rotate(30deg);
}

/* ==========================================
   LETTER SCREEN
   ========================================== */
.letter-screen {
  background: transparent;
  overflow: hidden;
}

.letter-scroll-container {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 68, 90, 0.2) transparent;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.letter-scroll-container::-webkit-scrollbar {
  width: 3px;
}

.letter-scroll-container::-webkit-scrollbar-track {
  background: transparent;
}

.letter-scroll-container::-webkit-scrollbar-thumb {
  background: rgba(201, 68, 90, 0.25);
  border-radius: 3px;
}

/* ---- LETTER PAPER ---- */
.letter-paper {
  max-width: 600px;
  margin: 80px auto 0;
  padding: 56px 50px;
  background: linear-gradient(175deg, var(--cream) 0%, var(--cream-warm) 50%, var(--cream-dark) 100%);
  border-radius: 4px;
  position: relative;
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.5),
    0 4px 0 rgba(0,0,0,0.03),
    0 0 0 1px rgba(0,0,0,0.04),
    inset 0 0 80px rgba(200, 170, 130, 0.06);
}

/* Lined paper texture */
.letter-paper::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 31px,
      rgba(180, 160, 140, 0.1) 31px,
      rgba(180, 160, 140, 0.1) 32px
    );
  border-radius: 4px;
  pointer-events: none;
}

/* Red margin */
.letter-paper::after {
  content: '';
  position: absolute;
  top: 0;
  left: 64px;
  width: 1px;
  height: 100%;
  background: rgba(200, 80, 80, 0.12);
  pointer-events: none;
}

.letter-ornament {
  position: absolute;
  color: var(--rose);
  opacity: 0;
  transition: opacity 1.5s ease;
}

.letter-screen.active .letter-ornament {
  opacity: 1;
}

.letter-ornament.top-left { top: 8px; left: 8px; }
.letter-ornament.top-right { top: 8px; right: 8px; }
.letter-ornament.bottom-left { bottom: 8px; left: 8px; }
.letter-ornament.bottom-right { bottom: 8px; right: 8px; }

.letter-date {
  display: block;
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--ink-light);
  margin-bottom: 28px;
  letter-spacing: 1.5px;
}

.letter-greeting {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.4rem;
  font-weight: 300;
  color: var(--rose);
  margin-bottom: 32px;
  line-height: 1.15;
  letter-spacing: 0.5px;
}

.letter-body p {
  font-family: 'Lora', serif;
  font-size: 1.05rem;
  line-height: 2.05;
  color: var(--ink);
  margin-bottom: 24px;
  font-weight: 400;
}

.letter-closing {
  margin-top: 40px;
  font-style: italic;
}

.letter-signature {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--rose);
  display: inline-block;
  margin-top: 10px;
}

/* ---- ANIMATION FOR LETTER LINES ---- */
.anim-line {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1), transform 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.anim-line.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- SCROLL INDICATOR ---- */
.scroll-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 70px auto 90px;
  color: var(--white-muted);
}

.scroll-indicator-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, transparent, var(--white-muted), transparent);
}

.scroll-indicator span {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  letter-spacing: 4px;
  text-transform: lowercase;
  font-style: italic;
}

.scroll-indicator svg {
  animation: scrollBounce 2.5s ease-in-out infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); opacity: 0.3; }
  50% { transform: translateY(10px); opacity: 0.7; }
}

/* ==========================================
   MEMORIES SECTION
   ========================================== */
.memories-section {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 40px 80px;
  display: flex;
  flex-direction: column;
  gap: 140px;
}

.memory-block {
  display: flex;
  align-items: center;
  gap: 60px;
  opacity: 0;
  transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1), transform 1.2s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Alternate direction via data attribute */
.memory-block[data-direction="left"] {
  flex-direction: row;
  transform: translateX(-60px) translateY(30px);
}

.memory-block[data-direction="right"] {
  flex-direction: row-reverse;
  transform: translateX(60px) translateY(30px);
}

.memory-block.visible {
  opacity: 1;
  transform: translateX(0) translateY(0);
}

.memory-image-wrapper {
  flex: 0 0 380px;
  position: relative;
}

/* Offset decorative border */
.memory-image-border {
  position: absolute;
  inset: -10px;
  border: 1px solid rgba(201, 68, 90, 0.1);
  border-radius: 6px;
  pointer-events: none;
  transition: all 0.6s ease;
}

.memory-block.visible .memory-image-border {
  inset: -12px;
  border-color: rgba(201, 68, 90, 0.18);
}

.memory-image {
  width: 100%;
  height: 260px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(201, 68, 90, 0.05);
}

.memory-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1), filter 0.8s ease;
  filter: grayscale(20%) contrast(1.04) brightness(0.95);
  will-change: transform;
}

.memory-image:hover img {
  transform: scale(1.08);
  filter: grayscale(0%) contrast(1.06) brightness(1);
}

/* Vignette overlay */
.memory-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 50%, rgba(8, 3, 5, 0.35) 100%),
    radial-gradient(ellipse at center, transparent 50%, rgba(8, 3, 5, 0.15) 100%);
  pointer-events: none;
}

.memory-text {
  flex: 1;
  position: relative;
  padding-left: 24px;
}

.memory-text-accent {
  position: absolute;
  left: 0;
  top: 4px;
  width: 2px;
  height: 0;
  background: linear-gradient(to bottom, var(--rose), transparent);
  transition: height 1s cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
}

.memory-block.visible .memory-text-accent {
  height: 80%;
}

.memory-text h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.7rem;
  font-weight: 300;
  color: var(--rose-light);
  margin-bottom: 14px;
  letter-spacing: 1px;
}

.memory-text p {
  font-family: 'Lora', serif;
  font-size: 0.95rem;
  line-height: 1.9;
  color: var(--white-muted);
  font-weight: 400;
}

/* Reverse block text alignment */
.memory-block[data-direction="right"] .memory-text {
  text-align: right;
  padding-left: 0;
  padding-right: 24px;
}

.memory-block[data-direction="right"] .memory-text-accent {
  left: auto;
  right: 0;
}

/* ==========================================
   FINAL SECTION
   ========================================== */
.final-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  position: relative;
}

.final-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center,
    transparent 30%,
    rgba(8, 3, 5, 0.5) 100%
  );
  pointer-events: none;
}

.final-content {
  text-align: center;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1), transform 1.5s cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
  z-index: 1;
}

.final-content.visible {
  opacity: 1;
  transform: translateY(0);
}

.final-heart-svg {
  margin-bottom: 28px;
  filter: drop-shadow(0 0 20px rgba(201, 68, 90, 0.3));
  animation: heartFloat 3s ease-in-out infinite;
  overflow: visible;
  display: block;
}

@keyframes heartFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.05); }
}

.final-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 4rem;
  font-weight: 300;
  color: #fff;
  margin-bottom: 20px;
  letter-spacing: 3px;
  text-shadow: 0 0 80px rgba(201, 68, 90, 0.25);
}

.final-divider {
  margin-bottom: 24px;
  opacity: 0.6;
}

.final-message {
  font-family: 'Lora', serif;
  font-size: 1.05rem;
  line-height: 2.3;
  color: var(--white-muted);
  max-width: 400px;
  margin: 0 auto;
}

/* ==========================================
   MUSIC BUTTON
   ========================================== */
.music-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--white-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  transition: all 0.4s ease;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.music-btn:hover {
  background: rgba(201, 68, 90, 0.1);
  border-color: rgba(201, 68, 90, 0.25);
  color: var(--white-soft);
}

.music-btn .music-icon-off {
  display: none;
}

.music-btn.playing .music-icon-on {
  display: none;
}

.music-btn.playing .music-icon-off {
  display: block;
}

.music-btn.playing {
  border-color: rgba(201, 68, 90, 0.35);
  color: var(--rose-light);
}

/* ==========================================
   RESPONSIVE — TABLET (max 768px)
   ========================================== */
@media (max-width: 768px) {
  /* Envelope */
  .envelope {
    width: 270px;
    height: 180px;
  }

  .envelope-radiance {
    width: 320px;
    height: 320px;
  }

  .light-ray {
    display: none;
  }

  .envelope-hint {
    font-size: 0.75rem;
    letter-spacing: 4px;
    margin-bottom: 32px;
  }

  /* Letter */
  .letter-paper {
    margin: 32px 16px 0;
    padding: 40px 30px;
    max-width: 100%;
  }

  .letter-paper::after {
    left: 38px;
  }

  .letter-ornament svg {
    width: 50px;
    height: 50px;
  }

  .letter-greeting {
    font-size: 1.8rem;
    margin-bottom: 24px;
  }

  .letter-body p {
    font-size: 0.95rem;
    line-height: 1.9;
    margin-bottom: 20px;
  }

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

  .letter-closing {
    margin-top: 32px;
  }

  /* Scroll indicator */
  .scroll-indicator {
    margin: 50px auto 60px;
  }

  .scroll-indicator-line {
    height: 30px;
  }

  /* Memories */
  .memories-section {
    padding: 0 20px 60px;
    gap: 80px;
    max-width: 100%;
  }

  .memory-block {
    gap: 36px;
  }

  .memory-block[data-direction="left"],
  .memory-block[data-direction="right"] {
    flex-direction: column;
    transform: translateY(36px);
  }

  .memory-block[data-direction="right"] .memory-text {
    text-align: left;
    padding-right: 0;
    padding-left: 20px;
  }

  .memory-block[data-direction="right"] .memory-text-accent {
    left: 0;
    right: auto;
  }

  .memory-text {
    padding-left: 20px;
  }

  .memory-image-wrapper {
    flex: none;
    width: 100%;
    max-width: 100%;
  }

  .memory-image {
    height: 240px;
    border-radius: 6px;
  }

  .memory-image-border {
    inset: -6px;
  }

  .memory-block.visible .memory-image-border {
    inset: -8px;
  }

  .memory-text h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
  }

  .memory-text p {
    font-size: 0.9rem;
    line-height: 1.8;
  }

  /* Final */
  .final-section {
    min-height: 80vh;
    padding: 60px 24px;
  }

  .final-title {
    font-size: 2.8rem;
    letter-spacing: 2px;
  }

  .final-message {
    font-size: 0.95rem;
    line-height: 2.1;
    padding: 0 12px;
  }

  /* Music button — safe area aware */
  .music-btn {
    bottom: max(20px, env(safe-area-inset-bottom, 20px));
    right: 20px;
    width: 44px;
    height: 44px;
  }
}

/* ==========================================
   RESPONSIVE — MOBILE (max 480px)
   ========================================== */
@media (max-width: 480px) {
  /* Loader */
  .loader-heart-wrap {
    width: 90px;
    height: 82px;
  }

  .loader-heart-svg {
    width: 90px;
    height: 82px;
  }

  .loader-heart-pulse {
    width: 120px;
    height: 120px;
  }

  .loader-progress {
    width: 130px;
  }

  .loader-whisper {
    font-size: 0.75rem;
    letter-spacing: 1.5px;
  }

  .loader-content {
    gap: 28px;
  }

  /* Envelope */
  .envelope {
    width: 230px;
    height: 154px;
  }

  .envelope-shadow {
    bottom: -14px;
    height: 20px;
  }

  .wax-seal svg {
    width: 34px;
    height: 34px;
  }

  .envelope-letter-peek span {
    font-size: 0.85rem;
    letter-spacing: 2px;
  }

  .envelope-hint {
    font-size: 0.7rem;
    margin-bottom: 28px;
  }

  .envelope-radiance {
    width: 260px;
    height: 260px;
  }

  /* Letter */
  .letter-paper {
    margin: 20px 12px 0;
    padding: 32px 22px;
    border-radius: 3px;
  }

  /* Hide red margin line on small screens — it overlaps text */
  .letter-paper::after {
    display: none;
  }

  .letter-ornament svg {
    width: 36px;
    height: 36px;
  }

  .letter-ornament.top-left { top: 6px; left: 6px; }
  .letter-ornament.top-right { top: 6px; right: 6px; }
  .letter-ornament.bottom-left { bottom: 6px; left: 6px; }
  .letter-ornament.bottom-right { bottom: 6px; right: 6px; }

  .letter-date {
    font-size: 0.78rem;
    margin-bottom: 20px;
  }

  .letter-greeting {
    font-size: 1.5rem;
    margin-bottom: 22px;
  }

  .letter-body p {
    font-size: 0.88rem;
    line-height: 1.85;
    margin-bottom: 18px;
  }

  .letter-closing {
    margin-top: 28px;
  }

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

  /* Scroll indicator */
  .scroll-indicator {
    margin: 40px auto 50px;
    gap: 10px;
  }

  .scroll-indicator span {
    font-size: 1rem;
    letter-spacing: 3px;
  }

  .scroll-indicator-line {
    height: 24px;
  }

  /* Memories */
  .memories-section {
    padding: 0 16px 40px;
    gap: 64px;
  }

  .memory-block {
    gap: 20px;
  }

  .memory-image {
    height: 200px;
  }

  .memory-image-border {
    inset: -5px;
    border-radius: 5px;
  }

  .memory-block.visible .memory-image-border {
    inset: -7px;
  }

  .memory-text {
    padding-left: 16px;
  }

  .memory-block[data-direction="right"] .memory-text {
    padding-left: 16px;
  }

  .memory-text h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
  }

  .memory-text p {
    font-size: 0.85rem;
    line-height: 1.75;
  }

  .memory-text-accent {
    width: 1.5px;
  }

  /* Final */
  .final-section {
    min-height: 70vh;
    padding: 50px 20px;
  }

  .final-heart-svg {
    width: 44px;
    height: 40px;
    margin-bottom: 20px;
  }

  .final-title {
    font-size: 2.2rem;
    margin-bottom: 16px;
    letter-spacing: 2px;
  }

  .final-divider {
    margin-bottom: 18px;
  }

  .final-message {
    font-size: 0.88rem;
    line-height: 2;
    padding: 0 8px;
  }

  /* Music button */
  .music-btn {
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
    right: 16px;
    width: 40px;
    height: 40px;
  }
}

/* ==========================================
   RESPONSIVE — VERY SMALL (max 360px)
   ========================================== */
@media (max-width: 360px) {
  .envelope {
    width: 200px;
    height: 134px;
  }

  .wax-seal svg {
    width: 30px;
    height: 30px;
  }

  .letter-paper {
    margin: 16px 8px 0;
    padding: 26px 18px;
  }

  .letter-ornament svg {
    width: 28px;
    height: 28px;
  }

  .letter-greeting {
    font-size: 1.3rem;
  }

  .letter-body p {
    font-size: 0.82rem;
    line-height: 1.8;
  }

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

  .memories-section {
    padding: 0 12px 32px;
    gap: 52px;
  }

  .memory-image {
    height: 170px;
  }

  .memory-text h3 {
    font-size: 1.15rem;
  }

  .memory-text p {
    font-size: 0.8rem;
  }

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

  .final-message {
    font-size: 0.82rem;
  }

  .loader-heart-wrap {
    width: 72px;
    height: 66px;
  }

  .loader-heart-svg {
    width: 72px;
    height: 66px;
  }

  .loader-progress {
    width: 110px;
  }
}

/* ==========================================
   TOUCH DEVICE REFINEMENTS
   ========================================== */
@media (hover: none) and (pointer: coarse) {
  /* Replace hover with active/tap feedback */
  .envelope-wrapper:hover .envelope {
    transform: none;
  }

  .envelope-wrapper:hover .envelope-shadow {
    transform: none;
    opacity: initial;
  }

  .envelope-wrapper:active .envelope {
    transform: translateY(-4px) scale(0.98);
    transition: transform 0.15s ease;
  }

  .envelope-wrapper:active .envelope-shadow {
    transform: translateY(6px) scaleX(1.03);
    opacity: 0.3;
  }

  /* Disable hover zoom on touch — it sticks after tap */
  .memory-image:hover img {
    transform: none;
    filter: grayscale(20%) contrast(1.04) brightness(0.95);
  }

  /* Larger tap target for music button */
  .music-btn {
    width: 46px;
    height: 46px;
  }

  .music-btn:active {
    transform: scale(0.92);
  }
}

/* ==========================================
   LANDSCAPE MOBILE
   ========================================== */
@media (max-height: 500px) and (orientation: landscape) {
  .envelope {
    width: 200px;
    height: 134px;
  }

  .envelope-hint {
    margin-bottom: 16px;
    font-size: 0.65rem;
  }

  .envelope-radiance {
    width: 200px;
    height: 200px;
  }

  .loader-heart-wrap {
    width: 70px;
    height: 64px;
  }

  .loader-heart-svg {
    width: 70px;
    height: 64px;
  }

  .loader-content {
    gap: 16px;
  }

  .final-section {
    min-height: 100vh;
    padding: 40px 20px;
  }

  .final-title {
    font-size: 2rem;
  }
}
