/* ╔══════════════════════════════════════════════════════════════╗
   ║   style.css — Exact OpenWhen Birthday Letter Edition         ║
   ║   Dedicated Kraft Envelope, Date Lock & Passcode Gate        ║
   ╚══════════════════════════════════════════════════════════════╝ */

/* ========== 1. DESIGN TOKENS & RESET ========== */

:root {
  /* Warm Linen Canvas */
  --bg-collection: #f5f2ee;
  --bg-collection-card: #ffffff;
  --text-main: #332f2b;
  --text-subtle: #79716b;
  --text-muted: #a8a29e;

  /* Kraft Paper Colors */
  --kraft-bg: #c9a77c;
  --kraft-dark: #b89366;
  --kraft-light: #d8b88f;
  --kraft-crease: rgba(70, 50, 30, 0.22);

  /* Blue & Accents */
  --blue-openwhen: #2563eb;
  --blue-sky: #38bdf8;
  --blue-ice: #e0f2fe;

  /* Typography */
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-cursive: 'Caveat', 'Cedarville Cursive', cursive;
  --font-mono: 'Space Mono', 'Geist Mono', monospace;

  /* Shadows */
  --shadow-kraft: 0 14px 32px rgba(60, 45, 30, 0.2), 0 3px 8px rgba(60, 45, 30, 0.12);
  --shadow-kraft-hover: 0 20px 44px rgba(60, 45, 30, 0.3), 0 6px 14px rgba(60, 45, 30, 0.18);
  --shadow-letter: 0 15px 35px rgba(0, 0, 0, 0.25), 0 3px 10px rgba(0, 0, 0, 0.15);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.35);
}

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

html,
body {
  min-height: 100%;
  width: 100%;
}

body.openwhen-body {
  font-family: var(--font-sans);
  background-color: var(--bg-collection);
  color: var(--text-main);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: inherit;
}

/* ═════════════════════════════════════════════════════════════
   2. STATE 1: BIRTHDAY KRAFT ENVELOPE LANDING PAGE
   ═════════════════════════════════════════════════════════════ */

.collection-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-collection);
  background-image: radial-gradient(#d6cec5 0.75px, transparent 0.75px);
  background-size: 24px 24px;
  position: relative;
  animation: fade-in 0.5s ease-out;
}

/* Topbar */
.collection-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  z-index: 10;
  gap: 12px;
}

.openwhen-logo {
  font-family: var(--font-cursive);
  font-size: 1.4rem;
  font-weight: 700;
  color: #574e46;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.collection-banner {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: #615951;
  background: #eae4dc;
  border: 1px solid #d8cfc4;
  padding: 5px 16px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.collection-music-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #dcd3c8;
  padding: 6px 14px;
  border-radius: 50px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: #4a4036;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s, background 0.2s;
  flex-shrink: 0;
}

.collection-music-btn:hover {
  transform: scale(1.05);
  background: #fdfbf7;
}

/* Main Collection Area */
.collection-main.single-birthday-main {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 30px 24px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Headline */
.collection-header {
  margin-bottom: 40px;
}

.collection-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(3rem, 7vw, 4.4rem);
  font-weight: 400;
  color: #3b352f;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.collection-subtitle {
  font-family: var(--font-sans);
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  color: var(--text-subtle);
  margin-top: 8px;
  font-weight: 400;
}

/* Single Envelope Centered Wrapper */
.single-envelope-wrapper {
  width: 100%;
  max-width: 440px;
  margin: 10px auto 40px;
}

/* ─── REALISTIC KRAFT PAPER ENVELOPE (EXACT SCREENSHOT RECREATION) ─── */
.kraft-envelope-card {
  position: relative;
  aspect-ratio: 1.42 / 1;
  background: linear-gradient(135deg, var(--kraft-bg) 0%, var(--kraft-dark) 100%);
  border-radius: 16px;
  box-shadow: var(--shadow-kraft);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.35s var(--ease-out-back), box-shadow 0.35s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.kraft-envelope-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-kraft-hover);
}

/* Diagonal Physical Crease Lines */
.envelope-fold-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.fold-triangle {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  clip-path: polygon(0 0, 100% 0, 50% 58%);
  background: linear-gradient(180deg, var(--kraft-light) 0%, var(--kraft-bg) 100%);
  box-shadow: 0 4px 10px var(--kraft-crease);
  border-bottom: 1px solid var(--kraft-crease);
}

.kraft-envelope-card::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  top: 0;
  clip-path: polygon(0 100%, 100% 100%, 50% 55%);
  background: linear-gradient(0deg, var(--kraft-dark) 0%, var(--kraft-bg) 100%);
  opacity: 0.6;
  pointer-events: none;
}

.envelope-text-content {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 90%;
}

.env-line-when {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.35rem;
  color: #4a3e33;
  margin-bottom: 2px;
}

.env-line-topic {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.55rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}

.env-badge-ready {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffffff;
  background: var(--blue-openwhen);
  padding: 4px 14px;
  border-radius: 50px;
  margin-top: 12px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
  animation: pulse-soft 2s ease-in-out infinite;
}

/* Signoff at bottom right */
.collection-signoff {
  margin-top: auto;
  align-self: flex-end;
  text-align: right;
  display: flex;
  flex-direction: column;
}

.signoff-from {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-subtle);
}

.signoff-name {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.8rem;
  color: #3b352f;
  margin-top: 2px;
}

/* ─── GATE MODAL (COUNTDOWN & PASSCODE UNLOCK) ─── */
.gate-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 25, 20, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade-in 0.3s ease-out;
}

.gate-modal-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 32px 28px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-modal);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.gate-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 1.1rem;
  color: var(--text-subtle);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1ede8;
}

.gate-lock-icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
}

.gate-modal-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: #2b231b;
  margin-bottom: 6px;
}

.gate-modal-desc {
  font-size: 0.9rem;
  color: var(--text-subtle);
  line-height: 1.5;
  margin-bottom: 20px;
}

.countdown-gate-box {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.countdown-pill {
  background: #f5f2ee;
  border: 1px solid #e2ddd5;
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 62px;
  display: flex;
  flex-direction: column;
}

.countdown-pill span {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--blue-openwhen);
  line-height: 1.1;
}

.countdown-pill small {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
}

.passcode-input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.passcode-input {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1.5px solid #dcd3c8;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  background: #faf8f5;
  transition: border-color 0.2s;
  min-width: 0;
}

.passcode-input:focus {
  border-color: var(--blue-openwhen);
  background: #ffffff;
}

.passcode-submit-btn {
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--blue-openwhen);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.2s, transform 0.2s;
}

.passcode-submit-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.passcode-error {
  color: #dc2626;
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.passcode-hint-text {
  font-size: 0.78rem;
  color: var(--text-muted);
}


/* ═════════════════════════════════════════════════════════════
   3. STATE 2: LETTER VIEW (EXACT SCENIC SCRAPBOOK VIEW)
   ═════════════════════════════════════════════════════════════ */

.letter-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  animation: fade-in 0.6s ease-out;
}

/* Scenic Landscape Backdrop */
.scenic-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(180deg, #5b7582 0%, #768a8d 35%, #8f9b87 60%, #3e532b 85%, #2a3c1e 100%);
}

.scenic-sky {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60%;
  background:
    radial-gradient(ellipse at 30% 25%, rgba(255, 235, 205, 0.45) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 35%, rgba(220, 200, 180, 0.35) 0%, transparent 50%);
}

.scenic-clouds {
  position: absolute;
  top: 5%;
  left: -10%;
  right: -10%;
  height: 55%;
  background-image:
    radial-gradient(circle at 20% 40%, rgba(255, 255, 255, 0.25) 0%, transparent 40%),
    radial-gradient(circle at 50% 30%, rgba(240, 230, 210, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 75% 45%, rgba(255, 255, 255, 0.2) 0%, transparent 45%);
  filter: blur(15px);
  opacity: 0.85;
}

.scenic-trees {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 45%;
  background: linear-gradient(0deg, #1b2613 0%, #2b3b20 40%, #445932 75%, transparent 100%);
  mask-image: radial-gradient(ellipse at center bottom, black 65%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse at center bottom, black 65%, transparent 100%);
}

/* Letter Top Bar */
.letter-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  pointer-events: none;
  gap: 8px;
}

.letter-topbar>* {
  pointer-events: auto;
}

.letter-back-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #333333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s, background 0.2s;
  flex-shrink: 0;
}

.letter-back-btn:hover {
  transform: scale(1.08);
  background: #ffffff;
}

.letter-top-banner {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: #ffffff;
  background: rgba(30, 40, 30, 0.75);
  padding: 6px 16px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}

.letter-music-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.9);
  padding: 6px 14px;
  border-radius: 50px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: #1e293b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
  flex-shrink: 0;
}

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

.mini-eq {
  display: flex;
  gap: 2px;
  height: 10px;
  align-items: flex-end;
}

.mini-eq span {
  width: 2.5px;
  height: 3px;
  background: var(--blue-openwhen);
  border-radius: 1px;
}

.mini-eq.playing span {
  animation: eq-dance 0.6s ease-in-out infinite alternate;
}

.mini-eq span:nth-child(2) {
  animation-delay: 0.2s;
}

.mini-eq span:nth-child(3) {
  animation-delay: 0.4s;
}

/* Letter Stage Container */
.letter-stage-container {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 76px 16px 80px;
}

.scrapbook-stage {
  position: relative;
  max-width: 550px;
  width: 100%;
  margin-bottom: 30px;
}

/* Backdrop Kraft Envelope in the Background on Right */
.backdrop-kraft-envelope {
  position: absolute;
  top: 90px;
  right: -55px;
  width: 300px;
  height: 390px;
  background: linear-gradient(135deg, var(--kraft-bg) 0%, var(--kraft-dark) 100%);
  border-radius: 8px;
  transform: rotate(14deg);
  z-index: 1;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.backdrop-flap-open {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 145px;
  background: #e8d8c3;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.backdrop-pocket {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70%;
  background: linear-gradient(0deg, var(--kraft-dark) 0%, var(--kraft-bg) 100%);
}

/* Main Stationery Paper Sheet */
.stationery-paper {
  position: relative;
  background: #ffffff;
  border-radius: 4px;
  box-shadow: var(--shadow-letter);
  z-index: 2;
  overflow: hidden;
  width: 100%;
  padding-bottom: 20px;

  /* Ruled Paper Texture */
  background-image: repeating-linear-gradient(0deg,
      transparent,
      transparent 29px,
      #edf2f7 29px,
      #edf2f7 30px);
}

.stationery-content {
  padding: 48px 40px 24px;
}

.letter-greeting {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 500;
  color: #2d3748;
  margin-bottom: 20px;
  line-height: 1.6;
}

.letter-paragraphs {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.85;
  color: #2d3748;
}

.letter-p {
  margin-bottom: 16px;
}

.letter-p strong {
  font-weight: 700;
  color: #1a202c;
}

.letter-love {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: #2d3748;
  margin-top: 24px;
  margin-bottom: 8px;
}

.letter-signature-block {
  margin-top: 4px;
}

.handwritten-sig {
  font-family: var(--font-cursive);
  font-size: 2.2rem;
  font-weight: 700;
  color: #1e293b;
  display: inline-block;
  transform: rotate(-3deg);
}

/* Scrapbook Footer Decorations */
.scrapbook-footer-decorations {
  position: relative;
  margin-top: 20px;
  padding: 0 16px 20px;
  min-height: 170px;
}

/* Torn Kraft Banner */
.torn-kraft-banner {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 90px;
  background: var(--kraft-bg);
  clip-path: polygon(0 40%, 15% 30%, 30% 45%, 45% 20%, 60% 40%, 75% 25%, 90% 45%, 100% 30%, 100% 100%, 0 100%);
  z-index: 1;
}

/* 35mm Filmstrip Roll */
.filmstrip-roll {
  position: absolute;
  bottom: 16px;
  left: 14px;
  width: 68%;
  background: #18181b;
  border-radius: 4px;
  padding: 6px 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  z-index: 3;
  transform: rotate(-1deg);
}

.filmstrip-sprockets {
  display: flex;
  justify-content: space-between;
  padding: 2px 4px;
}

.filmstrip-sprockets span {
  width: 8px;
  height: 6px;
  background: #ffffff;
  border-radius: 1px;
}

.filmstrip-frames {
  display: flex;
  gap: 8px;
  padding: 4px 0;
}

.film-frame {
  flex: 1;
  position: relative;
}

.film-img-box {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #27272a;
  border-radius: 2px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.film-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.film-img-box:hover img {
  transform: scale(1.08);
}

.film-placeholder {
  font-size: 1.4rem;
}

.film-number {
  position: absolute;
  bottom: -4px;
  right: 2px;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: #a1a1aa;
}

/* Ribbon Bow & Heart Patch */
.ribbon-bow {
  position: absolute;
  top: -16px;
  right: -8px;
  font-size: 1.8rem;
  z-index: 5;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.heart-patch {
  position: absolute;
  bottom: -10px;
  right: 12px;
  font-size: 1.4rem;
  z-index: 5;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Overlapping Polaroid */
.scrapbook-polaroid {
  position: absolute;
  bottom: -15px;
  right: 8px;
  width: 155px;
  z-index: 4;
  transform: rotate(7deg);
  transition: transform 0.3s var(--ease-out-back);
  cursor: pointer;
}

.scrapbook-polaroid:hover {
  transform: rotate(0deg) scale(1.06) translateY(-6px);
  z-index: 10;
}

.polaroid-frame {
  background: #ffffff;
  padding: 8px 8px 24px 8px;
  border-radius: 3px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  border: 1px solid #e2e8f0;
}

.polaroid-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f1f5f9;
  border-radius: 2px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.polaroid-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.polaroid-emoji {
  font-size: 2.2rem;
}

.polaroid-caption {
  font-family: var(--font-cursive);
  font-size: 0.95rem;
  color: #334155;
  text-align: center;
  margin-top: 6px;
  line-height: 1.1;
}

/* ═════════════════════════════════════════════════════════════
   INTERACTIVE CAKE CARD — "MAKE A WISH" (versi diperbagus)
   ═════════════════════════════════════════════════════════════ */

.openwhen-cake-card {
  max-width: 480px;
  width: 100%;
  margin-top: 24px;
}

.cake-interactive-box {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-letter);
}

.cake-top-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--blue-openwhen);
  margin-bottom: 20px;
}

/* ─── Cake Scene: dua tingkat kue + lilin + glow + piring ─── */
.cake-scene {
  position: relative;
  width: 220px;
  height: 150px;
  margin: 0 auto 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  max-width: 100%;
}

.cake-glow {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 90px;
  background: radial-gradient(ellipse, rgba(253, 224, 71, 0.45) 0%, transparent 70%);
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.cake-glow.out {
  opacity: 0;
}

.cake-candles {
  position: relative;
  display: flex;
  gap: 16px;
  align-items: flex-end;
  height: 40px;
  margin-bottom: -4px;
  z-index: 3;
}

.candle {
  position: relative;
  width: 7px;
  height: 30px;
  border-radius: 3px;
  background: repeating-linear-gradient(180deg, #2563eb 0 6px, #38bdf8 6px 12px);
}

.candle .flame {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: 9px;
  height: 14px;
  background: radial-gradient(ellipse at 50% 90%, #ffffff, #fde047 35%, #ea580c 85%, transparent 100%);
  border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%;
  animation: flame-flicker 0.15s ease-in-out infinite alternate;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.candle.out .flame {
  opacity: 0;
  transform: translateX(-50%) scaleY(0);
}

.candle .smoke span {
  position: absolute;
  bottom: 100%;
  left: 50%;
  width: 4px;
  height: 4px;
  background: #94a3b8;
  border-radius: 50%;
  opacity: 0;
}

.candle.out .smoke span {
  animation: smoke-rise 1.4s ease-out forwards;
}

.candle.out .smoke span:nth-child(2) {
  animation-delay: 0.15s;
}

.cake-tier {
  position: relative;
  border-radius: 10px 10px 4px 4px;
  z-index: 2;
}

.cake-tier-top {
  width: 110px;
  height: 40px;
  background: linear-gradient(180deg, #fde7ef 0%, #fbcfe1 100%);
  border: 1px solid #f4b8cf;
}

.cake-frosting-top {
  position: absolute;
  top: -9px;
  left: -6px;
  right: -6px;
  height: 18px;
  background: #ffffff;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.cake-tier-bottom {
  width: 165px;
  height: 52px;
  margin-top: -6px;
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
  border: 1px solid #93c5fd;
}

.cake-frosting-bottom {
  position: absolute;
  top: -8px;
  left: -6px;
  right: -6px;
  height: 16px;
  background: #eff6ff;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.cake-sprinkles span {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 2px;
}

.cake-sprinkles span:nth-child(1) {
  top: 8px;
  left: 12px;
  background: #f472b6;
  transform: rotate(20deg);
}

.cake-sprinkles span:nth-child(2) {
  top: 20px;
  left: 36px;
  background: #fbbf24;
  transform: rotate(-15deg);
}

.cake-sprinkles span:nth-child(3) {
  top: 12px;
  left: 64px;
  background: #34d399;
  transform: rotate(40deg);
}

.cake-sprinkles span:nth-child(4) {
  top: 26px;
  left: 94px;
  background: #f472b6;
  transform: rotate(-30deg);
}

.cake-sprinkles span:nth-child(5) {
  top: 10px;
  left: 122px;
  background: #38bdf8;
  transform: rotate(10deg);
}

.cake-sprinkles span:nth-child(6) {
  top: 22px;
  left: 144px;
  background: #fbbf24;
  transform: rotate(-20deg);
}

.cake-plate {
  width: 195px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(ellipse, #e2e8f0 0%, transparent 75%);
  margin-top: 4px;
}

/* ─── Tombol Tekan & Tahan untuk Meniup ─── */
.cake-blow-btn {
  position: relative;
  overflow: hidden;
  padding: 12px 24px;
  border-radius: 50px;
  background: var(--blue-openwhen);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  transition: transform 0.15s;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.cake-blow-btn:active {
  transform: scale(0.97);
}

.blow-btn-progress {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.28);
  width: 0%;
  transition: width 0.05s linear;
}

.blow-btn-content {
  position: relative;
  z-index: 1;
}

.cake-hint {
  font-size: 0.78rem;
  color: var(--text-subtle);
  margin-top: 8px;
}

.wish-reveal-box {
  margin-top: 16px;
  padding: 14px;
  background: var(--blue-ice);
  border-radius: 8px;
  border: 1px dashed var(--blue-openwhen);
  animation: fade-in 0.5s ease forwards;
}

.wish-reveal-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue-openwhen);
  margin-bottom: 6px;
}

.wish-reveal-box p {
  font-family: var(--font-cursive);
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e3a8a;
}

/* Letter Bottom Bar */
.letter-bottombar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(20, 28, 20, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 100;
  gap: 8px;
}

.bottom-left-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.85);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}

.status-dot {
  color: #4ade80;
  font-size: 0.65rem;
  flex-shrink: 0;
}

.made-with-text {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}

/* Lightbox Modal */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox-close-btn {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  color: #000000;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-box {
  max-width: 90vw;
  max-height: 85vh;
  text-align: center;
}

.lightbox-box img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: 4px;
}

.lightbox-box p {
  color: #ffffff;
  font-family: var(--font-cursive);
  font-size: 1.4rem;
  margin-top: 10px;
}

/* Animations */
@keyframes flame-flicker {
  0% {
    transform: scale(1) rotate(-1deg);
  }

  100% {
    transform: scale(0.95, 1.05) rotate(1deg);
  }
}

@keyframes smoke-rise {
  0% {
    opacity: 0.6;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-40px) scale(2);
  }
}

@keyframes eq-dance {
  0% {
    height: 3px;
  }

  100% {
    height: 10px;
  }
}

@keyframes pulse-soft {

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

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

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ─── TYPEWRITER ANIMATION & CURSOR ─── */
.letter-p {
  margin-bottom: 16px;
  min-height: 1.5em;
  transition: opacity 0.4s ease;
}

.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--blue-openwhen);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink-cursor 0.7s infinite;
}

@keyframes blink-cursor {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

/* ═════════════════════════════════════════════════════════════
   4. SCROLL-DOWN POLAROID MEMORY GALLERY SECTION
   ═════════════════════════════════════════════════════════════ */

.polaroid-gallery-section {
  max-width: 860px;
  width: 100%;
  margin-top: 60px;
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gallery-header {
  text-align: center;
  margin-bottom: 36px;
}

.gallery-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--blue-openwhen);
  background: #ffffff;
  padding: 4px 14px;
  border-radius: 50px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: inline-block;
  margin-bottom: 10px;
}

.gallery-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(2.2rem, 5vw, 3rem);
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  line-height: 1.2;
}

.gallery-subtitle {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 6px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.polaroids-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 36px 28px;
  width: 100%;
  padding: 10px;
}

/* Individual Polaroid Card */
.polaroid-card-item {
  position: relative;
  background: #ffffff;
  padding: 12px 12px 30px 12px;
  border-radius: 4px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35), 0 3px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transform: rotate(var(--rot, 0deg)) translateY(40px);
  opacity: 0;
  transition: transform 0.6s var(--ease-out-back), opacity 0.6s ease, box-shadow 0.3s ease;
}

.polaroid-card-item.revealed {
  opacity: 1;
  transform: rotate(var(--rot, 0deg)) translateY(0);
}

.polaroid-card-item:hover {
  transform: rotate(0deg) scale(1.06) translateY(-8px) !important;
  box-shadow: 0 22px 45px rgba(0, 0, 0, 0.5), 0 6px 16px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

/* Washi Tape at Top */
.polaroid-washi-tape {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(var(--tape-rot, -2deg));
  width: 70px;
  height: 24px;
  background: rgba(147, 197, 253, 0.7);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  z-index: 5;
  clip-path: polygon(5% 0, 95% 0, 100% 100%, 0 100%);
}

.polaroid-card-item:nth-child(2n) .polaroid-washi-tape {
  background: rgba(253, 224, 71, 0.7);
}

.polaroid-card-item:nth-child(3n) .polaroid-washi-tape {
  background: rgba(167, 243, 208, 0.7);
}

/* Polaroid Image Container */
.polaroid-card-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f1f5f9;
  border-radius: 2px;
  overflow: hidden;
}

.polaroid-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.polaroid-card-item:hover .polaroid-card-photo img {
  transform: scale(1.08);
}

/* Polaroid Caption & Date Badge */
.polaroid-card-meta {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.polaroid-card-caption {
  font-family: var(--font-cursive);
  font-size: 1.15rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.25;
}

.polaroid-card-date {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--blue-openwhen);
  background: var(--blue-ice);
  padding: 2px 8px;
  border-radius: 50px;
}

/* ═════════════════════════════════════════════════════════════
   5. RESPONSIVE — TABLET (≤1024px)
   Diletakkan sebelum breakpoint mobile supaya mobile tetap
   menang di ukuran yang lebih kecil (mobile-first override).
   ═════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .collection-main.single-birthday-main {
    padding: 26px 20px 50px;
  }

  .single-envelope-wrapper {
    max-width: 380px;
  }

  .backdrop-kraft-envelope {
    width: 220px;
    height: 290px;
    right: -40px;
  }

  .scrapbook-stage {
    max-width: 480px;
  }

  .stationery-content {
    padding: 40px 32px 20px;
  }

  .polaroids-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px 22px;
  }

  .cake-scene {
    transform: scale(0.92);
    margin-bottom: 8px;
  }
}

/* Small tablets / large phones in landscape */
@media (max-width: 900px) {
  .collection-topbar {
    padding: 14px 20px;
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .collection-banner {
    order: 3;
    width: 100%;
    justify-content: center;
    white-space: normal;
    text-align: center;
  }
}

/* ═════════════════════════════════════════════════════════════
   6. RESPONSIVE — MOBILE (≤680px)
   ═════════════════════════════════════════════════════════════ */
@media (max-width: 680px) {
  .collection-topbar {
    padding: 14px 18px;
  }

  .collection-main.single-birthday-main {
    padding: 20px 18px 40px;
  }

  .collection-banner {
    font-size: 0.62rem;
    padding: 4px 10px;
    letter-spacing: 0.05em;
  }

  .collection-title {
    font-size: clamp(2.4rem, 11vw, 3.2rem);
  }

  .single-envelope-wrapper {
    max-width: 100%;
  }

  .gate-modal-card {
    padding: 26px 20px;
  }

  .countdown-pill {
    min-width: 56px;
    padding: 7px 8px;
  }

  .countdown-pill span {
    font-size: 1.15rem;
  }

  .passcode-input-group {
    flex-direction: column;
  }

  .passcode-submit-btn {
    width: 100%;
  }

  .backdrop-kraft-envelope {
    display: none;
  }

  .letter-stage-container {
    padding: 68px 12px 76px;
  }

  .letter-top-banner {
    font-size: 0.6rem;
    max-width: 55vw;
    padding: 6px 12px;
  }

  .letter-music-btn .music-label {
    display: none;
  }

  .stationery-content {
    padding: 32px 20px 16px;
  }

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

  .filmstrip-roll {
    width: 60%;
  }

  .scrapbook-polaroid {
    width: 125px;
    right: 4px;
  }

  .scrapbook-footer-decorations {
    padding: 0 10px 16px;
  }

  .openwhen-cake-card {
    margin-top: 18px;
  }

  .cake-interactive-box {
    padding: 20px 16px;
  }

  .cake-scene {
    transform: scale(0.85);
    margin-bottom: 4px;
  }

  .polaroid-gallery-section {
    margin-top: 44px;
  }

  .polaroids-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .letter-topbar {
    padding: 0 14px;
  }

  .letter-bottombar {
    padding: 0 14px;
  }

  .bottom-left-status {
    font-size: 0.62rem;
    max-width: 60vw;
  }

  .made-with-text {
    display: none;
  }

  .lightbox-overlay {
    padding: 16px;
  }

  .lightbox-close-btn {
    top: 12px;
    right: 12px;
  }
}

/* ═════════════════════════════════════════════════════════════
   7. RESPONSIVE — SMALL PHONES (≤380px)
   ═════════════════════════════════════════════════════════════ */
@media (max-width: 380px) {
  .openwhen-logo {
    font-size: 1.15rem;
  }

  .collection-title {
    font-size: 2.1rem;
  }

  .collection-subtitle {
    font-size: 0.85rem;
  }

  .env-line-when {
    font-size: 1.1rem;
  }

  .env-line-topic {
    font-size: 1.25rem;
  }

  .signoff-name {
    font-size: 1.4rem;
  }

  .countdown-gate-box {
    gap: 6px;
  }

  .countdown-pill {
    min-width: 48px;
    padding: 6px 4px;
  }

  .countdown-pill span {
    font-size: 1rem;
  }

  .letter-top-banner {
    max-width: 46vw;
    font-size: 0.55rem;
    padding: 6px 10px;
  }

  .stationery-content {
    padding: 26px 14px 14px;
  }

  .handwritten-sig {
    font-size: 1.8rem;
  }

  .filmstrip-roll {
    width: 56%;
    left: 8px;
  }

  .scrapbook-polaroid {
    width: 100px;
  }

  .polaroid-caption {
    font-size: 0.8rem;
  }

  .cake-scene {
    transform: scale(0.72);
  }

  .cake-blow-btn {
    padding: 11px 18px;
    font-size: 0.82rem;
  }

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

/* ═════════════════════════════════════════════════════════════
   8. TOUCH DEVICES — larger tap targets, no hover-reliant UI
   ═════════════════════════════════════════════════════════════ */
@media (hover: none) and (pointer: coarse) {

  .kraft-envelope-card,
  .letter-back-btn,
  .letter-music-btn,
  .collection-music-btn,
  .cake-blow-btn,
  .passcode-submit-btn,
  .gate-modal-close,
  .lightbox-close-btn {
    min-height: 44px;
  }

  .passcode-input {
    min-height: 44px;
  }
}