/* ═══════════════════════════════════════════════════════════
   A Magical Birthday Journey — for Fathima Sana 🌙
   Theme: Arabian Nights · Islamic elegance · moonlit palace
   ═══════════════════════════════════════════════════════════ */

:root {
  --emerald: #0e6b52;
  --emerald-light: #17a97f;
  --royal: #1a2c6b;
  --night: #0b1026;
  --night-2: #141a3d;
  --gold: #d4af37;
  --gold-bright: #ffd76a;
  --champagne: #f3e3c3;
  --ivory: #fffaf0;
  --purple: #5b3d8f;
  --pink: #f2b8c6;
  --font-head: 'Scheherazade New', serif;
  --font-display: 'Marcellus', serif;
  --font-body: 'Cormorant Garamond', serif;
  --font-script: 'Great Vibes', cursive;
}

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

html, body {
  height: 100%;
  font-family: var(--font-body);
  color: var(--ivory);
  background: linear-gradient(180deg, var(--night) 0%, var(--night-2) 55%, #1c1440 100%);
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body { min-height: 100dvh; cursor: default; }

/* ── ambient sky ─────────────────────────────── */
.sky-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }

.moon {
  position: absolute; top: 7%; right: 10%;
  width: clamp(70px, 12vw, 130px); height: clamp(70px, 12vw, 130px);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffef5, var(--champagne) 60%, #d8c48f);
  box-shadow: 0 0 60px 20px rgba(243, 227, 195, 0.35), 0 0 140px 60px rgba(243, 227, 195, 0.12);
  pointer-events: auto; cursor: pointer;
  transition: box-shadow 0.6s ease, transform 0.6s ease;
  animation: moonFloat 9s ease-in-out infinite;
}
.moon:hover, .moon.glowing {
  box-shadow: 0 0 90px 35px rgba(255, 215, 106, 0.5), 0 0 200px 90px rgba(255, 215, 106, 0.18);
  transform: scale(1.06);
}
@keyframes moonFloat { 50% { translate: 0 -10px; } }

.mosque-silhouette {
  position: absolute; bottom: 0; left: 0; right: 0; height: 26vh;
  background:
    radial-gradient(ellipse 90px 130px at 15% 100%, #05081a 99%, transparent),
    radial-gradient(ellipse 140px 190px at 50% 100%, #05081a 99%, transparent),
    radial-gradient(ellipse 90px 130px at 85% 100%, #05081a 99%, transparent),
    linear-gradient(transparent 55%, #05081a 56%);
  opacity: 0.9;
}
.mosque-silhouette::before, .mosque-silhouette::after {
  content: ''; position: absolute; bottom: 40%; width: 8px; height: 55%;
  background: #05081a; border-radius: 4px 4px 0 0;
}
.mosque-silhouette::before { left: 7%; }
.mosque-silhouette::after { right: 7%; }

.dunes {
  position: absolute; bottom: 0; left: 0; right: 0; height: 12vh;
  background: radial-gradient(ellipse 130% 190% at 50% 210%, #1a1230, transparent);
}

.clouds span {
  position: absolute; top: 12%; width: 220px; height: 40px; border-radius: 40px;
  background: rgba(255, 255, 255, 0.05); filter: blur(8px);
  animation: drift 60s linear infinite;
}
.clouds span:nth-child(2) { top: 25%; animation-duration: 85s; animation-delay: -30s; }
.clouds span:nth-child(3) { top: 6%; animation-duration: 110s; animation-delay: -60s; }
@keyframes drift { from { left: -260px; } to { left: 110%; } }

#fx-canvas { position: fixed; inset: 0; z-index: 3; pointer-events: none; }

/* ── pages ───────────────────────────────────── */
.page {
  position: relative; z-index: 2; display: none;
  min-height: 100dvh; padding: clamp(16px, 4vw, 48px);
  padding-bottom: 90px;
  flex-direction: column; align-items: center; justify-content: center;
  animation: pageIn 0.9s ease both;
}
.page.active { display: flex; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(24px) scale(0.99); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

.hidden { display: none !important; }

/* ── typography ──────────────────────────────── */
.arabic-accent { font-family: var(--font-head); color: var(--gold-bright); letter-spacing: 0.5px; }
.hero-name {
  font-family: var(--font-script); font-weight: 400;
  font-size: clamp(2.6rem, 9vw, 5.5rem);
  background: linear-gradient(120deg, var(--gold-bright), var(--champagne), var(--gold-bright));
  background-size: 200%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 5s linear infinite;
  text-align: center; line-height: 1.2; padding: 0.1em 0.2em;
}
.hero-name.giant { font-size: clamp(3rem, 12vw, 7rem); }
@keyframes shimmer { to { background-position: 200%; } }

.hb-title { font-family: var(--font-display); font-size: clamp(1.6rem, 5vw, 3rem); text-align: center; color: var(--champagne); letter-spacing: 4px; text-transform: uppercase; }
.section-title { font-size: clamp(1.8rem, 5vw, 2.8rem); text-align: center; margin-bottom: 12px; }
.salam { font-size: clamp(1.4rem, 4vw, 2rem); text-align: center; }
.lead { font-size: clamp(1.1rem, 2.6vw, 1.4rem); text-align: center; line-height: 1.7; margin: 14px 0; }
.soft { opacity: 0.82; }
.center { text-align: center; justify-content: center; }
.quote { font-style: italic; color: var(--pink); text-align: center; font-size: 1.2rem; margin-top: 18px; min-height: 1.6em; }
.hint { font-size: 0.95rem; opacity: 0.55; margin-top: 20px; }
.big-emoji { font-size: clamp(2rem, 6vw, 3.4rem); text-align: center; }

/* ── shared components ───────────────────────── */
.glass {
  background: rgba(20, 26, 61, 0.55);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 22px;
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.card { padding: clamp(24px, 5vw, 52px); max-width: 640px; width: 100%; }

.btn-gold, .btn-ghost {
  font-family: var(--font-display); font-size: 1.05rem;
  padding: 13px 30px; margin: 10px 6px; border-radius: 40px; cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s, background 0.25s;
  -webkit-tap-highlight-color: transparent;
}
.btn-gold {
  border: none; color: #241a05;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold) 60%, #b8860b);
  box-shadow: 0 6px 26px rgba(212, 175, 55, 0.45);
}
.btn-gold:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 10px 34px rgba(255, 215, 106, 0.6); }
.btn-gold.big { font-size: 1.25rem; padding: 16px 42px; }
.btn-ghost {
  background: transparent; color: var(--champagne);
  border: 1px solid rgba(212, 175, 55, 0.5);
}
.btn-ghost:hover { background: rgba(212, 175, 55, 0.14); transform: translateY(-2px); }

.back-btn {
  position: absolute; top: 18px; left: 18px; z-index: 5;
  background: rgba(20, 26, 61, 0.7); color: var(--champagne);
  border: 1px solid rgba(212, 175, 55, 0.4); border-radius: 30px;
  padding: 8px 18px; cursor: pointer; font-family: var(--font-display);
}
.back-btn:hover { background: rgba(212, 175, 55, 0.2); }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

input[type="password"], input[type="text"] {
  font-family: var(--font-body); font-size: 1.1rem;
  padding: 12px 20px; border-radius: 30px;
  border: 1px solid rgba(212, 175, 55, 0.5);
  background: rgba(11, 16, 38, 0.8); color: var(--ivory);
  outline: none; min-width: 220px;
}
input:focus { border-color: var(--gold-bright); box-shadow: 0 0 14px rgba(212, 175, 55, 0.4); }

/* ── music dock ──────────────────────────────── */
.music-dock {
  position: fixed; bottom: 14px; left: 50%; translate: -50% 0; z-index: 50;
  display: flex; gap: 8px; align-items: center;
  background: rgba(11, 16, 38, 0.8); border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 40px; padding: 8px 16px; backdrop-filter: blur(10px);
}
.dock-btn {
  background: none; border: none; color: var(--gold-bright);
  font-size: 1.15rem; cursor: pointer; padding: 4px 8px;
}
#musicVolume { width: 80px; accent-color: var(--gold); }

/* ── loading ─────────────────────────────────── */
.loading-inner { text-align: center; }
.loading-lantern { font-size: 4rem; animation: sway 2.4s ease-in-out infinite; transform-origin: top center; }
@keyframes sway { 0%, 100% { rotate: -8deg; } 50% { rotate: 8deg; } }
.loading-title { font-family: var(--font-head); font-size: clamp(1.4rem, 4.5vw, 2.2rem); color: var(--champagne); margin: 24px 0; }
.dots i { animation: blink 1.4s infinite; font-style: normal; }
.dots i:nth-child(2) { animation-delay: 0.25s; }
.dots i:nth-child(3) { animation-delay: 0.5s; }
@keyframes blink { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
.loading-bar { width: min(320px, 70vw); height: 6px; margin: 0 auto; border-radius: 6px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.loading-fill { height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); transition: width 0.2s linear; }

/* ── countdown ───────────────────────────────── */
.countdown { display: flex; gap: clamp(8px, 3vw, 22px); justify-content: center; margin: 30px 0; }
.cd-cell {
  display: flex; flex-direction: column; align-items: center;
  background: rgba(11, 16, 38, 0.75); border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 16px; padding: clamp(10px, 3vw, 20px) clamp(12px, 3.5vw, 26px);
  min-width: clamp(64px, 18vw, 110px);
}
.cd-cell span { font-family: var(--font-display); font-size: clamp(1.8rem, 7vw, 3.2rem); color: var(--gold-bright); }
.cd-cell label { font-size: 0.85rem; letter-spacing: 2px; text-transform: uppercase; opacity: 0.7; }

body.shake { animation: shake 0.7s ease; }
@keyframes shake {
  10%, 50%, 90% { transform: translate(-4px, 2px); }
  30%, 70% { transform: translate(4px, -2px); }
}

/* ── cake ────────────────────────────────────── */
.cake-stage { perspective: 900px; margin: 24px 0; }
.cake-stage-gap { margin-top: 48px; }
.cake { position: relative; width: min(340px, 82vw); animation: cakeIn 1.2s ease both; }
@keyframes cakeIn { from { opacity: 0; transform: scale(0.6) translateY(60px); } }
.tier { position: relative; margin: 0 auto; border-radius: 14px 14px 10px 10px;
  background: linear-gradient(180deg, #fdf3e0 0 18%, var(--emerald) 18% 30%, #fdf3e0 30%);
  box-shadow: inset 0 -14px 22px rgba(0,0,0,0.18), 0 6px 16px rgba(0,0,0,0.35);
  border-bottom: 4px solid var(--gold);
}
.tier-3 { width: 45%; height: 64px; z-index: 3; }
.tier-2 { width: 68%; height: 74px; z-index: 2; margin-top: -8px; }
.tier-1 { width: 92%; height: 88px; z-index: 1; margin-top: -8px; }
.cake-plate { width: 100%; height: 20px; margin-top: -4px; border-radius: 50%; background: radial-gradient(ellipse at 50% 40%, var(--gold-bright), #8a6d1d); box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.candles { position: absolute; top: -46px; left: 0; right: 0; display: flex; justify-content: center; gap: 10px; z-index: 5; }
.candle { width: 8px; height: 40px; border-radius: 4px; background: repeating-linear-gradient(45deg, var(--pink), var(--pink) 5px, var(--ivory) 5px, var(--ivory) 10px); position: relative; }
.flame {
  position: absolute; top: -16px; left: 50%; translate: -50% 0;
  width: 12px; height: 17px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 50% 75%, #fff7d0, #ffb52e 55%, #ff7300);
  box-shadow: 0 0 14px 4px rgba(255, 180, 60, 0.65);
  animation: flicker 0.35s ease-in-out infinite alternate;
  transform-origin: bottom center;
}
@keyframes flicker { from { scale: 1 1; rotate: -3deg; } to { scale: 0.92 1.08; rotate: 3deg; } }
.flame.out { animation: puff 0.6s ease forwards; }
@keyframes puff { to { opacity: 0; scale: 0.2 2.2; translate: -50% -20px; filter: blur(4px); } }

/* ── hub ─────────────────────────────────────── */
.hub-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px; width: min(860px, 100%); margin-top: 20px;
}
.hub-tile {
  font-family: var(--font-display); color: var(--ivory);
  background: rgba(20, 26, 61, 0.6); border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 18px; padding: 22px 10px; font-size: 1.7rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.hub-tile span { font-size: 0.95rem; color: var(--champagne); }
.hub-tile em { font-size: 0.75rem; font-style: normal; color: var(--gold-bright); opacity: 0.8; }
.hub-tile:hover { transform: translateY(-5px); border-color: var(--gold-bright); box-shadow: 0 12px 30px rgba(212, 175, 55, 0.25); }
.hub-tile.locked { opacity: 0.55; filter: grayscale(0.4); }
.hub-tile.unlocked-now { animation: unlockPulse 1.4s ease infinite; opacity: 1; filter: none; }
@keyframes unlockPulse { 50% { box-shadow: 0 0 30px rgba(255, 215, 106, 0.6); } }

/* ── greeting cards ──────────────────────────── */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; width: min(900px, 100%); margin-top: 18px; }
.gift-card {
  position: relative; border-radius: 16px; padding: 24px 18px; text-align: center;
  background: linear-gradient(160deg, var(--night-2), #23194d);
  border: 1.5px solid rgba(212, 175, 55, 0.5);
  transition: transform 0.3s;
}
.gift-card .emoji { font-size: 2.6rem; }
.gift-card h4 { font-family: var(--font-display); color: var(--gold-bright); margin: 10px 0; }
.gift-card.shake-wrong { animation: shake 0.5s ease; }
.gift-card.opened { border-color: var(--emerald-light); }
.gift-card .letter-body {
  font-size: 1.05rem; line-height: 1.7; text-align: left;
  background: linear-gradient(160deg, var(--ivory), var(--champagne));
  color: #3a2c10; border-radius: 10px; padding: 16px; margin-top: 12px;
  border: 1px solid var(--gold);
  box-shadow: inset 0 0 30px rgba(212, 175, 55, 0.2);
  animation: unfold 0.9s ease both; transform-origin: top;
}
@keyframes unfold { from { opacity: 0; transform: scaleY(0.1) rotateX(60deg); } }
.gift-card .hint-line { font-size: 0.85rem; opacity: 0.6; margin-top: 8px; }
.gift-card input { min-width: 0; width: 100%; margin: 8px 0; }

.letter-paper {
  background: linear-gradient(160deg, var(--ivory), var(--champagne));
  color: #3a2c10; border: 1.5px solid var(--gold); border-radius: 14px;
  padding: clamp(20px, 5vw, 40px); max-width: 620px; margin: 20px auto;
  font-size: 1.15rem; line-height: 1.9;
  box-shadow: 0 16px 50px rgba(0,0,0,0.5), inset 0 0 40px rgba(212, 175, 55, 0.18);
  animation: unfold 1.1s ease both;
}
.letter-paper.big { font-size: 1.2rem; }
.signature-line { margin-top: 26px; font-style: italic; }
.signature { font-family: var(--font-script); font-size: 2.2rem; color: var(--emerald); overflow: hidden; white-space: nowrap; width: 0; animation: write 3s steps(30) 0.5s forwards; }
@keyframes write { to { width: 100%; } }

/* ── timeline ────────────────────────────────── */
.timeline { position: relative; width: min(680px, 100%); margin-top: 26px; padding-left: 34px; }
.timeline::before { content: ''; position: absolute; left: 12px; top: 0; bottom: 0; width: 3px; border-radius: 3px; background: linear-gradient(var(--gold), var(--purple)); }
.tl-item { position: relative; margin-bottom: 30px; opacity: 0; transform: translateX(30px); transition: 0.7s ease; }
.tl-item.visible { opacity: 1; transform: none; }
.tl-item::before { content: '◆'; position: absolute; left: -30px; top: 2px; color: var(--gold-bright); font-size: 1rem; }
.tl-item h4 { font-family: var(--font-display); color: var(--gold-bright); font-size: 1.25rem; }
.tl-item p { opacity: 0.85; line-height: 1.6; }

/* ── storybook ───────────────────────────────── */
.book { width: min(560px, 100%); }
.book-page {
  min-height: 320px; border-radius: 6px 18px 18px 6px;
  background: linear-gradient(100deg, #e8dcc0, var(--ivory) 12%);
  color: #3a2c10; padding: clamp(24px, 5vw, 44px);
  border-left: 10px solid #7a5c1e;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55), inset -30px 0 40px -30px rgba(0,0,0,0.25);
  font-size: 1.15rem; line-height: 1.9; margin-bottom: 16px;
}
.book-page.turning { animation: pageTurn 0.6s ease; }
@keyframes pageTurn { 0% { transform: perspective(900px) rotateY(0); } 50% { transform: perspective(900px) rotateY(-70deg); opacity: 0.3; } 100% { transform: none; } }
.book-page h3 { font-family: var(--font-head); color: var(--emerald); margin-bottom: 12px; }

/* ── starry sky / lanterns ───────────────────── */
.star-field, .lantern-field {
  position: relative; width: min(880px, 100%); height: min(52vh, 460px);
  border-radius: 20px; border: 1px solid rgba(212, 175, 55, 0.25);
  background: radial-gradient(ellipse at 60% 20%, rgba(91, 61, 143, 0.25), transparent 60%), rgba(5, 8, 26, 0.6);
  overflow: hidden; margin-top: 18px;
}
.sky-star {
  position: absolute; background: none; border: none; cursor: pointer;
  color: var(--champagne); font-size: 0.9rem; padding: 6px;
  animation: twinkle 2.6s ease-in-out infinite;
  transition: transform 0.3s, text-shadow 0.3s;
}
.sky-star:hover { transform: scale(1.7); text-shadow: 0 0 14px var(--gold-bright); }
.sky-star.connected { color: var(--gold-bright); text-shadow: 0 0 18px var(--gold-bright); }
@keyframes twinkle { 50% { opacity: 0.35; } }

.float-lantern {
  position: absolute; bottom: -70px; background: none; border: none; cursor: pointer;
  font-size: 2.4rem; animation: rise linear infinite;
  filter: drop-shadow(0 0 12px rgba(255, 180, 60, 0.7));
  transition: transform 0.3s;
}
.float-lantern:hover { transform: scale(1.25); }
@keyframes rise { from { translate: 0 0; } to { translate: 0 calc(-52vh - 140px); } }

/* ── gifts ───────────────────────────────────── */
.gifts-grid, .daily-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 16px; width: min(760px, 100%); margin-top: 22px; }
.gift-box, .daily-box {
  font-size: 2.6rem; padding: 26px 10px; border-radius: 16px; cursor: pointer;
  background: rgba(20, 26, 61, 0.6); border: 1px solid rgba(212, 175, 55, 0.35);
  color: var(--ivory); font-family: var(--font-body);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform 0.25s;
}
.gift-box small, .daily-box small { font-size: 0.85rem; opacity: 0.75; }
.gift-box:hover:not(.opened) { transform: translateY(-5px) rotate(-2deg); }
.gift-box.opened { border-color: var(--emerald-light); animation: pop 0.5s ease; }
.daily-box.locked { opacity: 0.45; cursor: not-allowed; }
@keyframes pop { 40% { transform: scale(1.15); } }
.gift-note { font-size: 0.98rem; line-height: 1.5; color: var(--champagne); }

/* ── wish tree ───────────────────────────────── */
.tree-stage { position: relative; width: min(480px, 92vw); height: 380px; margin-top: 10px; }
.tree-trunk {
  position: absolute; bottom: 0; left: 50%; translate: -50%;
  width: 26px; height: 150px; border-radius: 10px;
  background: linear-gradient(90deg, #5a3d16, #8a6428, #5a3d16);
}
.tree-leaf {
  position: absolute; background: none; border: none; cursor: pointer; font-size: 1.6rem;
  filter: drop-shadow(0 0 6px rgba(255, 215, 106, 0.8));
  animation: leafGlow 2.8s ease-in-out infinite; transition: transform 0.25s;
}
.tree-leaf:hover { transform: scale(1.5) rotate(15deg); }
@keyframes leafGlow { 50% { filter: drop-shadow(0 0 16px var(--gold-bright)); opacity: 0.85; } }

/* ── oasis ───────────────────────────────────── */
.oasis {
  position: relative; width: min(760px, 100%); min-height: 300px; margin-top: 20px;
  display: flex; gap: 20px; align-items: flex-end; justify-content: center; flex-wrap: wrap;
  border-radius: 20px; padding: 30px;
  background: radial-gradient(ellipse at 50% 120%, rgba(138, 100, 40, 0.3), transparent 70%), rgba(5, 8, 26, 0.5);
  border: 1px solid rgba(212, 175, 55, 0.25);
}
.camel { position: absolute; top: 18px; right: 26px; font-size: 2.6rem; opacity: 0.8; }
.oasis-item {
  font-size: 3rem; background: rgba(20, 26, 61, 0.55); color: var(--champagne);
  border: 1px solid rgba(212, 175, 55, 0.4); border-radius: 18px;
  padding: 22px 26px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; align-items: center;
  font-family: var(--font-body); transition: transform 0.3s;
}
.oasis-item span { font-size: 0.95rem; }
.oasis-item:hover { transform: translateY(-6px); }
.lamp.rubbing { animation: rub 0.4s ease 3; }
@keyframes rub { 25% { rotate: -8deg; } 75% { rotate: 8deg; } }
.carpet.flying { animation: fly 2.6s ease-in-out; }
@keyframes fly {
  20% { transform: translate(-40px, -80px) rotate(-8deg); }
  50% { transform: translate(60px, -160px) rotate(6deg); }
  80% { transform: translate(-20px, -60px) rotate(-4deg); }
}

/* ── train journey ───────────────────────────── */
.train-scene {
  position: relative; width: min(880px, 100%); height: min(38vh, 320px);
  margin-top: 18px; border-radius: 20px; overflow: hidden;
  background: linear-gradient(180deg, #0b1030 0%, #1a1440 55%, #241a4d 100%);
  border: 1px solid rgba(212, 175, 55, 0.25);
}
.train-moon {
  position: absolute; top: 10%; left: 12%;
  width: 46px; height: 46px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffef5, var(--champagne) 60%, #d8c48f);
  box-shadow: 0 0 40px 14px rgba(243, 227, 195, 0.3);
}
.train-stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 20%, #fff, transparent),
    radial-gradient(1px 1px at 40% 35%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 65% 15%, #fff, transparent),
    radial-gradient(1px 1px at 80% 30%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 90% 45%, #fff, transparent),
    radial-gradient(1px 1px at 30% 50%, #fff, transparent);
  opacity: 0.8; animation: twinkle 3s ease-in-out infinite alternate;
}
.train-track {
  position: absolute; bottom: 14%; left: 0; right: 0; height: 6px;
  background: repeating-linear-gradient(90deg, var(--gold) 0 18px, transparent 18px 34px);
  opacity: 0.7;
}
.train-track::before {
  content: ''; position: absolute; top: -3px; left: 0; right: 0; height: 3px;
  background: rgba(212, 175, 55, 0.5);
}
.train {
  position: absolute; bottom: 15%; left: -20%; font-size: clamp(2.2rem, 6vw, 3.4rem);
  white-space: nowrap; animation: trainMove 9s linear infinite;
  filter: drop-shadow(0 0 12px rgba(255, 215, 106, 0.5));
}
@keyframes trainMove { from { left: -25%; } to { left: 115%; } }
.train-cars {
  position: absolute; bottom: 15%; left: -20%; font-size: clamp(1.6rem, 4vw, 2.4rem);
  white-space: nowrap; animation: trainMove 9s linear infinite;
  animation-delay: -0.01s;
  margin-left: clamp(3.2rem, 8vw, 4.8rem);
}

/* ── palace door ─────────────────────────────── */
.door-stage { perspective: 1100px; margin: 24px 0; }
.palace-door {
  display: flex; width: min(300px, 76vw); height: 340px;
  border-radius: 150px 150px 0 0; overflow: hidden;
  border: 5px solid var(--gold); box-shadow: 0 0 50px rgba(212, 175, 55, 0.35);
}
.door-half {
  flex: 1; background:
    repeating-linear-gradient(0deg, transparent 0 46px, rgba(212, 175, 55, 0.35) 46px 50px),
    linear-gradient(160deg, #14522e, var(--emerald), #0a3d24);
  transition: transform 1.6s cubic-bezier(0.7, 0, 0.3, 1);
}
.door-half.left { transform-origin: left; border-right: 2px solid var(--gold); }
.door-half.right { transform-origin: right; }
.palace-door.open .left { transform: rotateY(-105deg); }
.palace-door.open .right { transform: rotateY(105deg); }
.palace-door.open { background: radial-gradient(circle, var(--gold-bright), rgba(255, 215, 106, 0.15) 70%); }

/* ── checklist / secret room ─────────────────── */
.checklist { list-style: none; margin: 18px auto; max-width: 380px; font-size: 1.15rem; line-height: 2.1; }
.checklist li::before { content: '○ '; color: var(--gold); }
.checklist li.done::before { content: '● '; color: var(--emerald-light); }

/* ── finale ──────────────────────────────────── */
.finale { text-align: center; max-width: 680px; }
.blessing p { font-size: clamp(1.1rem, 2.8vw, 1.35rem); line-height: 1.9; margin: 12px 0; opacity: 0.92; }
.ameen { font-family: var(--font-head); font-size: 1.6rem !important; color: var(--gold-bright); }

/* ── modal & toast ───────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(5, 8, 26, 0.75); display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(6px); }
.modal-box { position: relative; max-width: 520px; width: 100%; max-height: 82vh; overflow-y: auto; padding: clamp(24px, 5vw, 40px); animation: pageIn 0.4s ease; text-align: center; }
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; color: var(--champagne); font-size: 1.3rem; cursor: pointer; }
.modal-box .photo-large { font-size: 5rem; margin: 10px 0; }

.toast {
  position: fixed; top: 22px; left: 50%; translate: -50% 0; z-index: 100;
  background: rgba(11, 16, 38, 0.92); border: 1px solid var(--gold);
  color: var(--champagne); padding: 12px 26px; border-radius: 30px;
  font-size: 1.05rem; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: toastIn 0.4s ease; max-width: 88vw; text-align: center;
}
@keyframes toastIn { from { opacity: 0; translate: -50% -20px; } }

/* ── typewriter caret ────────────────────────── */
.typing::after { content: '❘'; animation: blink 0.8s infinite; color: var(--gold); }

/* ── golden crown easter egg ─────────────────── */
.crown-drop { position: fixed; z-index: 95; font-size: 4rem; left: 50%; translate: -50%; animation: crownFall 1.6s ease forwards; }
@keyframes crownFall { from { top: -80px; } to { top: 12vh; } }

/* ── accessibility & responsive ──────────────── */
:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }

@media (max-width: 560px) {
  .music-dock { padding: 6px 10px; }
  #musicVolume { width: 56px; }
  .back-btn { top: 10px; left: 10px; padding: 6px 14px; }
  .polaroid { width: 150px; }
  .polaroid .photo { height: 118px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
  #fx-canvas { display: none; }
}
