/* style.css */

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { background-color: var(--color-bg, #000); width: 100vw; height: 100vh; overflow: hidden; font-family: sans-serif; color: white; }
.scene { position: relative; width: 100%; height: 100%; touch-action: none; user-select: none; background-color: var(--color-bg); perspective: 1000px; overflow: hidden;}

/* --- EXISTING COSMIC BURST STYLES --- */
.sky { position: absolute; inset: 0; background: radial-gradient(ellipse at bottom, var(--color-sky-light), var(--color-sky-dark)); opacity: 0; transform: scale(0.01); transform-origin: center center; pointer-events: none; overflow: hidden; }
.scene.unlocked .sky { opacity: 1; transform: scale(1); transition: opacity var(--burst-duration) ease-out, transform var(--burst-duration) cubic-bezier(0.1, 0.9, 0.2, 1); pointer-events: auto; }

/* THE LIVING WORLD CANVAS (300vw x 300vh) */
.sky-layer { position: absolute; width: 300vw; height: 300vh; left: -100vw; top: -100vh; will-change: transform; }
.sky-orbit-container { position: absolute; top: 50%; left: 50%; width: 300vmax; height: 300vmax; transform: translate(-50%, -50%) rotate(0deg); animation: cosmic-orbit var(--orbit-duration) linear infinite; pointer-events: none; }
@keyframes cosmic-orbit { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }

.nebula { position: absolute; inset: 0; background: radial-gradient(circle at 30% 40%, var(--color-nebula), transparent 50%), radial-gradient(circle at 70% 60%, var(--color-nebula), transparent 50%); opacity: 0.8; pointer-events: none; }
.stars-layer { position: absolute; inset: 0; pointer-events: none; }
.star { position: absolute; background-color: #ffffff; border-radius: 50%; box-shadow: 0 0 3px 1px rgba(255, 255, 255, 0.2); animation: twinkle linear infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0.1; transform: scale(0.7); } 50% { opacity: 1; transform: scale(1.1); } }

/* CINEMATIC MORPH MESSAGE */
.morph-message { position: fixed; top: 50%; left: 50%; width: 90vw; transform: translate(-50%, -50%); color: rgba(255, 255, 255, 0.95); font-family: serif; font-size: clamp(1.2rem, 4vw, 1.8rem); text-align: center; letter-spacing: 2px; line-height: 1.4; pointer-events: none; z-index: 100; opacity: 0; filter: blur(20px); }
.morph-message.show { animation: morph-blur-anim 5s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
@keyframes morph-blur-anim { 0% { opacity: 0; filter: blur(20px); transform: translate(-50%, -50%) scale(1.1); } 20% { opacity: 1; filter: blur(0px); transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; filter: blur(0px); transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; filter: blur(15px); transform: translate(-50%, -50%) scale(0.95); } }

/* LIVING MOON */
.moon-wrapper { position: absolute; width: var(--moon-size); height: var(--moon-size); opacity: 0; pointer-events: none; animation: moon-drift 120s ease-in-out infinite alternate; }
.scene.unlocked .moon-wrapper { opacity: 1; transition: opacity 4s ease-out 1.5s; }
.moon-wrapper.glow { filter: brightness(1.5) drop-shadow(0 0 40px rgba(255,255,255,0.6)); }
.moon-svg { width: 100%; height: 100%; filter: drop-shadow(0 0 15px rgba(252, 253, 254, 0.8)); }
@keyframes moon-drift { 0% { margin-top: 0; margin-left: 0; transform: scale(1); } 100% { margin-top: 5vh; margin-left: -5vw; transform: scale(1.05); } }

/* Interaction Singularity */
.interactive-layer { position: absolute; inset: 0; display: flex; justify-content: center; align-items: center; z-index: 10; }
.circle-container { position: relative; width: 80px; height: 80px; cursor: pointer; display: flex; justify-content: center; align-items: center; transform: scale(calc(1 + (var(--charge) * 0.4))); transition: transform 0.1s linear, filter 0.1s linear; }
.breathing-circle { width: 25px; height: 25px; background-color: var(--color-glow); border-radius: 50%; box-shadow: 0 0 15px 2px rgba(255, 255, 255, 0.8), 0 0 40px 10px rgba(255, 255, 255, 0.3); animation: breathe 4s ease-in-out infinite; filter: brightness(calc(1 + (var(--charge) * 1.5))); }
.scene.charging .breathing-circle { animation-play-state: paused; }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 0.7; } 50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 25px 5px rgba(255, 255, 255, 0.9), 0 0 60px 20px rgba(255, 255, 255, 0.4); } }
.charge-ring { position: absolute; inset: -20px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.4); transform: scale(calc(0.5 + (var(--charge) * 0.5))); opacity: var(--charge); box-shadow: 0 0 20px rgba(255, 255, 255, 0.5); pointer-events: none; }
.scene.imploding .circle-container { transform: scale(0.01) !important; filter: brightness(10) blur(2px) !important; transition: transform var(--implosion-delay) cubic-bezier(0.5, 0, 0.1, 1), filter var(--implosion-delay) ease-in !important; }
.scene.unlocked .interactive-layer { opacity: 0; pointer-events: none; transition: opacity 0.2s; }

/* Burst Particles */
.burst-container { position: absolute; inset: 0; pointer-events: none; z-index: 15; overflow: hidden; }
.burst-particle { position: absolute; top: 50%; left: 50%; background-color: #ffffff; border-radius: 50%; transform: translate(-50%, -50%) scale(1); opacity: var(--start-opacity); box-shadow: 0 0 2px rgba(255,255,255,0.8); animation: particle-fly var(--fly-duration) cubic-bezier(0.1, 0.9, 0.2, 1) forwards; }
@keyframes particle-fly { 0% { transform: translate(-50%, -50%) scale(1); opacity: var(--start-opacity); } 100% { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0); opacity: 0; } }
.shockwave-ring { position: absolute; top: 50%; left: 50%; border: 3px solid rgba(255, 255, 255, 0.8); border-radius: 50%; transform: translate(-50%, -50%) scale(0); opacity: 1; box-shadow: 0 0 30px var(--color-glow), inset 0 0 30px var(--color-glow); animation: expand-ring 1.5s cubic-bezier(0.1, 0.8, 0.2, 1) forwards; }
@keyframes expand-ring { 0% { transform: translate(-50%, -50%) scale(0); opacity: 1; border-width: 4px; } 100% { transform: translate(-50%, -50%) scale(150vw); opacity: 0; border-width: 0px; } }
.core-bloom { position: absolute; top: 50%; left: 50%; width: 20px; height: 20px; border-radius: 50%; background: var(--color-glow); transform: translate(-50%, -50%) scale(0); filter: blur(30px); animation: expand-bloom 3s cubic-bezier(0.1, 0.9, 0.3, 1) forwards; }
@keyframes expand-bloom { 0% { transform: translate(-50%, -50%) scale(0); opacity: 1; } 40% { transform: translate(-50%, -50%) scale(20); opacity: 0.5; } 100% { transform: translate(-50%, -50%) scale(80); opacity: 0; } }


/* ==================================================
   ORIGINAL 3D FROSTED PAPER ENVELOPE
   ================================================== */
.envelope-wrapper { position: absolute; top: 50%; left: 50%; margin-top: 20px; width: var(--env-width); max-width: 90vw; height: var(--env-height); z-index: 25; opacity: 0; transform: translate(-50%, -50%) scale(var(--env-start-scale)); pointer-events: none; perspective: 1500px; }
.scene.envelope-revealing .envelope-wrapper { opacity: 1; transform: translate(-50%, -50%) scale(1); transition: opacity var(--env-duration) ease-out, transform var(--env-duration) cubic-bezier(0.2, 0.8, 0.2, 1); }
.scene.envelope-settled .envelope-wrapper { opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto; }
.envelope-wrapper.dissolve-envelope { opacity: 0 !important; transform: translate(-50%, -50%) scale(1.3) !important; transition: all 1s ease-in-out !important; pointer-events: none !important; }

.envelope-card { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); will-change: transform; cursor: grab; }
.envelope-card:active { cursor: grabbing; }

.env-face { 
    position: absolute; inset: 0; border-radius: 6px; 
    backface-visibility: hidden; -webkit-backface-visibility: hidden; 
    /* overflow: hidden; HAS BEEN REMOVED to prevent GPU bounding box clipping */
    display: flex; 
    background: rgba(240, 245, 255, 0.08); 
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); 
    border: 1px solid rgba(255, 255, 255, 0.15); 
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.05), 0 15px 40px rgba(0, 0, 0, 0.6); 
}

.env-front { transform: rotateY(0deg); }
.env-back { transform: rotateY(180deg); flex-direction: column; padding: 24px; justify-content: center; }

.paper-noise { position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0.3; mix-blend-mode: overlay; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.env-flap { position: absolute; top: 0; left: 0; width: 100%; height: 55%; clip-path: polygon(0 0, 100% 0, 50% 100%); z-index: 10; background: linear-gradient(to bottom, rgba(255,255,255,0.08), transparent); border-bottom: 1px solid rgba(255,255,255,0.2); }
.wax-seal { position: absolute; top: 55%; left: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; z-index: 11; transition: transform 0.2s ease; background: #fdfbf7; border: 1px solid rgba(255,255,255,0.8); box-shadow: inset 0 -2px 6px rgba(0,0,0,0.2), 0 4px 10px rgba(0,0,0,0.4); cursor: pointer;}
.wax-seal:hover { transform: translate(-50%, -50%) scale(1.15); }

.scene.envelope-settled .wax-seal { animation: wax-pulse var(--env-pulse) infinite ease-in-out; }
@keyframes wax-pulse { 0%, 100% { box-shadow: inset 0 -2px 6px rgba(0,0,0,0.2), 0 0 5px rgba(253, 251, 247, 0.4); filter: brightness(1); } 50% { box-shadow: inset 0 -2px 6px rgba(0,0,0,0.2), 0 0 20px 4px rgba(253, 251, 247, 0.8); filter: brightness(1.2); } }

.env-scribble { position: absolute; top: 45%; left: 15%; font-family: "Comic Sans MS", cursive, sans-serif; font-size: 1.1rem; color: rgba(255,255,255,0.7); transform: rotate(-5deg); z-index: 5; }
.env-stamp { position: absolute; top: 30px; right: 20px; width: 35px; height: 45px; border: 1px solid rgba(200, 160, 255, 0.4); border-radius: 2px; background: rgba(200, 160, 255, 0.1); z-index: 5; transform: rotate(3deg); display: flex; flex-direction: column; align-items: center; padding: 3px; }
.stamp-inner { width: 100%; height: 60%; background: rgba(200, 160, 255, 0.2); margin-top: 2px; position: relative; }
.stamp-inner::after { content: '❁'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: rgba(255,255,255,0.6); font-size: 14px; }
.env-doodles { position: absolute; bottom: 15px; left: 15px; width: 40px; height: 50px; border-left: 1px solid rgba(255,255,255,0.3); border-bottom: 1px solid transparent; border-radius: 0 0 0 15px; z-index: 5; }
.env-doodles::after { content: '♡'; position: absolute; top: -10px; left: -8px; color: rgba(255,255,255,0.5); font-size: 16px; transform: rotate(-15deg); }

.back-content { position: relative; z-index: 5; color: rgba(255,255,255,0.9); font-family: "Brush Script MT", "Lucida Handwriting", cursive; font-size: 1.1rem; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.hw-title { margin-bottom: 12px; }
.hw-address-block { margin-bottom: 15px; text-align: left; line-height: 1.4; }
.hw-pin { letter-spacing: 1px; margin-bottom: auto; }
.hw-sender { text-align: right; margin-top: 15px; width: 100%; }

.directional-guide { position: absolute; bottom: 12%; left: 50%; transform: translateX(-50%); opacity: 0; pointer-events: none; transition: opacity 0.8s ease; z-index: 15; color: rgba(255,255,255,0.8); display: flex; align-items: center; justify-content: center; width: 100%; }
.directional-guide.visible { opacity: 1; }
.guide-c-text { display: block; font-family: cursive; font-size: 0.9rem; opacity: 0.6; animation: drift-h 3s infinite alternate ease-in-out; }
@keyframes drift-h { 0% { transform: translateX(-5px); } 100% { transform: translateX(5px); } }

/* ==================================================
   PURE GLOWING ARROW HINT OVERLAY
   ================================================== */
/* The container is now completely invisible, just centering the items */
.flip-hint-overlay { 
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); 
    display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px;
    pointer-events: none; opacity: 0; transition: opacity 0.4s ease; z-index: 30; 
}
.flip-hint-overlay.visible { opacity: 1; }

.flip-hint-text { 
    font-family: cursive; font-size: 0.85rem; color: #ffffff; 
    text-shadow: 0 0 10px rgba(255,255,255,0.8), 0 0 20px rgba(200, 220, 255, 0.6); 
    opacity: 0.9; letter-spacing: 2px;
}

/* The Pure CSS Arrow with a cosmic double-glow */
.glowing-arrow {
    width: 22px; 
    height: 22px;
    border-top: 4px solid #ffffff;
    border-left: 4px solid #ffffff;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 1)) drop-shadow(0 0 15px rgba(200, 220, 255, 0.8));
}

/* Default animation (Swipe Left to reveal back) */
.flip-hint-overlay.visible .glowing-arrow { 
    animation: glow-swipe-left 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite; 
}
@keyframes glow-swipe-left { 
    0% { transform: translateX(15px) rotate(-45deg); opacity: 0; } 
    30% { opacity: 1; } 
    70% { opacity: 1; } 
    100% { transform: translateX(-20px) rotate(-45deg); opacity: 0; } 
}

/* Reverse animation (Swipe Right to return to front) */
.flip-hint-overlay.reverse-hint .glowing-arrow { 
    animation: glow-swipe-right 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite; 
}
@keyframes glow-swipe-right { 
    /* rotate(135deg) points the chevron to the right */
    0% { transform: translateX(-15px) rotate(135deg); opacity: 0; } 
    30% { opacity: 1; } 
    70% { opacity: 1; } 
    100% { transform: translateX(20px) rotate(135deg); opacity: 0; } 
}

/* ==================================================
   CONSTELLATION THREAD STYLES
   ================================================== */
.thread-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10; pointer-events: none; }
line, path { stroke: rgba(200, 220, 255, 0.4); stroke-width: 1.5; stroke-dasharray: 1000; stroke-dashoffset: 1000; transition: stroke-dashoffset 2s ease-in-out; }
line.drawn, path.drawn { stroke-dashoffset: 0; filter: drop-shadow(0 0 4px rgba(200,220,255,0.8)); }

.star-node { position: absolute; width: 40px; height: 40px; transform: translate(-50%, -50%); z-index: 20; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 1s ease; }
.star-node.locked { opacity: 0.2; pointer-events: none; }
.star-node.active { opacity: 1; pointer-events: auto; cursor: pointer; }
.star-node.completed { opacity: 0.6; pointer-events: auto; cursor: pointer; }

.star-core { width: 6px; height: 6px; background: #fff; border-radius: 50%; box-shadow: 0 0 10px 2px rgba(255,255,255,0.8); transition: all 0.3s; }
.star-node.active .star-core { animation: star-pulse 2s infinite; box-shadow: 0 0 20px 4px rgba(255,255,255,1); }
.star-core.tense { background: #ffcccc; box-shadow: 0 0 10px 2px rgba(255,100,100,0.8); }
.star-node.active .star-core.tense { animation: tense-pulse 0.5s infinite; }
.star-core.large { width: 10px; height: 10px; }
.star-core.brightest { width: 14px; height: 14px; box-shadow: 0 0 30px 10px rgba(255,255,255,1); }

.star-node.trigger-star .star-core { width: 12px; height: 12px; background: #eef8ff; box-shadow: 0 0 15px 5px rgba(100, 200, 255, 0.8); animation: special-twinkle 1.5s ease-in-out infinite alternate !important; }
@keyframes special-twinkle { 0% { transform: scale(0.8); box-shadow: 0 0 10px 2px rgba(100, 200, 255, 0.5); } 100% { transform: scale(1.3); box-shadow: 0 0 25px 8px rgba(150, 220, 255, 1); background: #fff; } }
@keyframes star-pulse { 0%, 100% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(1.5); opacity: 1; } }
@keyframes tense-pulse { 0%, 100% { transform: scale(1); opacity: 0.5; } 50% { transform: scale(1.2); opacity: 1; } }

/* Holograms */
.hologram { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.8); opacity: 0; pointer-events: none; transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); z-index: 30; }
.star-node.bloomed .hologram { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }
.holo-content { background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02)); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.15); border-radius: 16px; padding: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); color: #eef; text-align: center; }
.holo-highlight { color: #fff; text-shadow: 0 0 10px rgba(255,255,255,0.5); margin-top: 10px; font-size: 1.2rem; }

.holo-compact .holo-content { width: 220px; }
.h-dates { font-family: monospace; color: #aab; font-size: 0.8rem; margin-bottom: 4px; }
.moon-placeholders { font-size: 1.5rem; margin: 10px 0; color: #fff; text-shadow: 0 0 8px #fff; }
.holo-narrow .holo-content { width: 180px; border-color: rgba(255,100,100,0.3); }
.tense-content h4 { color: #ffcccc; margin-bottom: 5px; }
.holo-cue { display: block; margin-top: 15px; font-size: 0.75rem; color: #888; text-transform: uppercase; letter-spacing: 1px; }

/* Mirror */
.satellites { position: absolute; inset: -30px; animation: spin 10s linear infinite; opacity: 0; transition: opacity 0.5s; }
.star-node.active .satellites { opacity: 1; }
.sat { position: absolute; width: 4px; height: 4px; background: #fff; border-radius: 50%; box-shadow: 0 0 5px #fff; }
.s-1 { top: 0; left: 50%; } .s-2 { bottom: 10px; left: 10px; } .s-3 { bottom: 10px; right: 10px; }
@keyframes spin { 100% { transform: rotate(360deg); } }

.holo-flip { width: 240px; height: 180px; perspective: 1000px; }
.holo-inner { width: 100%; height: 100%; transition: transform 0.8s; transform-style: preserve-3d; }
.star-node.flipped .holo-inner { transform: rotateY(180deg); }
.holo-front, .holo-back { position: absolute; inset: 0; backface-visibility: hidden; background: rgba(255,255,255,0.08); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.2); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.holo-back { transform: rotateY(180deg); }
.holo-actions { display: flex; gap: 10px; margin-top: 20px; }
.holo-actions button { padding: 8px 20px; border-radius: 20px; border: 1px solid #fff; background: transparent; color: #fff; cursor: pointer; transition: 0.3s; }
.holo-actions button:hover { background: #fff; color: #000; }
.photo-zone { display: flex; gap: 10px; margin-bottom: 15px; }
.photo-p { width: 40px; height: 50px; border: 1px dashed rgba(255,255,255,0.5); font-size: 0.6rem; display: flex; align-items: center; justify-content: center; color: #aaa; }
.mirror-p { border-color: #fff; box-shadow: inset 0 0 10px rgba(255,255,255,0.2); color: #fff; }

/* Shelter */
.holo-wide .holo-content { width: 280px; }
.calm h3 { font-weight: normal; border-bottom: 1px solid rgba(255,255,255,0.2); padding-bottom: 10px; margin-bottom: 10px; }
.btn-ack { margin-top: 15px; background: rgba(255,255,255,0.1); border: none; color: #fff; padding: 10px; border-radius: 6px; cursor: pointer; }

/* Petals */
.holo-petals { width: 220px; height: 120px; }
.petal-card { position: absolute; inset: 0; background: rgba(255,255,255,0.05); backdrop-filter: blur(15px); border: 1px solid rgba(255,255,255,0.15); border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 20px; text-align: center; font-size: 0.9rem; transition: all 0.5s ease; opacity: 0; transform: translateY(20px) scale(0.9); }
.petal-card.active { opacity: 1; transform: translateY(0) scale(1); z-index: 2; pointer-events: auto; cursor: pointer; }
.petal-card.viewed { opacity: 0; transform: translateY(-20px) scale(0.9); z-index: 1; }
.petal-hint { position: absolute; bottom: -30px; left: 50%; transform: translateX(-50%); font-size: 0.7rem; color: #aaa; opacity: 0; transition: opacity 0.5s; width: max-content;}
.star-node.bloomed .petal-hint { opacity: 1; }

/* Atlas */
.atlas-ring { position: absolute; inset: -80px; border-radius: 50%; opacity: 0; pointer-events: none; transition: opacity 0.5s; }
.star-node.bloomed .atlas-ring { opacity: 1; pointer-events: auto; }
.atlas-node { position: absolute; width: 30px; height: 30px; background: rgba(255,255,255,0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.3s; border: 1px solid rgba(255,255,255,0.2); }
.atlas-node.revealed { background: rgba(255,255,255,0.9); color: #000; box-shadow: 0 0 15px #fff; }
.atlas-label { position: absolute; top: -20px; font-size: 0.7rem; color: #fff; opacity: 0; transition: 0.3s; text-shadow: 0 0 4px #000; pointer-events: none; }
.atlas-node.revealed .atlas-label { opacity: 1; }

/* Date Cluster */
.date-cluster { position: absolute; left: 64%; top: 58%; width: 15%; height: 15%; z-index: 15; opacity: 0; pointer-events: none; transition: opacity 1s; }
.date-cluster.active { opacity: 1; pointer-events: auto; }
.date-node { position: absolute; width: 12px; height: 12px; background: rgba(255,255,255,0.2); border-radius: 50%; transform: translate(-50%, -50%); transition: 0.4s; pointer-events: auto; }
.date-node::after { content: attr(data-date); position: absolute; top: -15px; left: 50%; transform: translateX(-50%); font-size: 0.6rem; opacity: 0; color: #fff; white-space: nowrap; pointer-events: none; }
.date-node.lit { background: #fff; box-shadow: 0 0 10px #fff; transform: translate(-50%, -50%) scale(1.5); }
.date-node.lit::after { opacity: 1; }
.date-message { position: absolute; bottom: -40px; left: 50%; transform: translateX(-50%); width: 250px; text-align: center; font-style: italic; color: #bbb; opacity: 0; transition: 1s; font-size: 0.8rem; pointer-events: none; }
.date-cluster.completed .date-message { opacity: 1; }

/* Promise */
.holo-ceremony .holo-content { width: 300px; padding: 40px 20px; background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05)); border: 1px solid rgba(255,255,255,0.4); box-shadow: 0 0 50px rgba(255,255,255,0.2); }
.finale .cue { display: block; font-size: 0.8rem; color: #ddd; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 2px; }
.finale h2 { font-weight: normal; margin-bottom: 10px; font-size: 1.2rem; }
.finale h1 { font-family: serif; font-size: 1.8rem; text-shadow: 0 0 15px #fff; }
.tulip-petals { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: 16px; }
.petal { position: absolute; bottom: -10px; width: 8px; height: 12px; background: rgba(255,180,200,0.6); border-radius: 50% 50% 0 0; animation: float-up 4s ease-in infinite; opacity: 0; }
@keyframes float-up { 0% { transform: translateY(0) rotate(0deg); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-200px) rotate(45deg); opacity: 0; } }

/* Responsive Overrides */
.holo-content { max-width: 85vw; box-sizing: border-box; }
.holo-content h1 { font-size: clamp(1.4rem, 4vw, 1.8rem); }
.holo-content h2 { font-size: clamp(1rem, 3vw, 1.2rem); }
.holo-content p, .holo-content h4 { font-size: clamp(0.85rem, 2vw, 1rem); }
@media (max-width: 768px) { .date-cluster { width: 40%; height: 25%; } .date-node::after { font-size: 0.5rem; } .holo-wide .holo-content, .holo-compact .holo-content, .holo-ceremony .holo-content { width: auto; min-width: 250px; } }
@media (prefers-reduced-motion: reduce) { .breathing-circle, .star, .sky-orbit-container, .guide-c-text, .big-swipe-arrow { animation: none !important; } .sky { transition-duration: 1s; } }




/* ==================================================
   MULTI-NOTE SYSTEM & ENVELOPE OPENING MECHANICS
   ================================================== */
/* Allow components to extend outside the envelope safely when opened */

.paper-noise { border-radius: inherit; } /* Keep noise clipped to corners */

/* Animate the flap up and dissolve the wax seal */
.envelope-card.opened .env-flap {
    transform: rotateX(180deg);
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 10; /* Ensures flap stays above the note */
}
.envelope-card.opened .wax-seal {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
    transition: all 0.4s ease;
    pointer-events: none;
}

/* ==================================================
   MULTI-NOTE SYSTEM & LUXURY STATIONERY
   ================================================== */
/* Allow components to extend outside the envelope safely when opened */
.envelope-card.opened .env-face { overflow: visible !important; }
.paper-noise { border-radius: inherit; } 

.envelope-card.opened .env-flap {
    transform: rotateX(180deg);
    transition: transform 0.9s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 10; 
    pointer-events: none; /* FIX: Prevents the rotated flap from blocking your finger */
}

.envelope-card.opened .wax-seal {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
    transition: all 0.5s ease;
    pointer-events: none;
}

/* The Pocket & Stack Illusion */
/* The Pocket & Stack Illusion (Fixed Bounds) */
.notes-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 4; 
    /* FIX: Top mask expanded from -150% to -500% to ensure infinite rising headroom */
    clip-path: inset(-500% -20% 45% -20%); 
    pointer-events: none;
}

.note-stack-bg {
    position: absolute; top: 15%; left: 5%; width: 90%; height: 150%;
    background: #EAE3D9; border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.4);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    transition: transform 1s ease; opacity: 0;
}
.envelope-card.opened .note-stack-bg { opacity: 1; }
.envelope-card.opened .stack-1 { transform: translateY(0px) scale(0.96) rotate(-1deg); z-index: 1; }
.envelope-card.opened .stack-2 { transform: translateY(4px) scale(0.94) rotate(1.5deg); z-index: 2; }
.envelope-card.opened .stack-3 { transform: translateY(8px) scale(0.92) rotate(-0.5deg); z-index: 3; }


/* --- Moonlit Ivory Stationery UX --- */

/* The Stack Illusion (Adjusted for Ivory tones) */
.note-stack-bg {
    position: absolute; top: 15%; left: 5%; width: 90%; height: 150%;
    background: #E8E0D5; /* Slightly darker/cooler ivory for depth */
    border-radius: 4px;
    border-top: 1px solid rgba(255,255,255,0.6);
    box-shadow: inset 0 0 20px rgba(180, 190, 220, 0.15), 0 -2px 10px rgba(0,0,0,0.1);
    transition: transform 1s ease; opacity: 0;
}
.envelope-card.opened .note-stack-bg { opacity: 1; }
.envelope-card.opened .stack-1 { transform: translateY(0px) scale(0.96) rotate(-1deg); z-index: 1; }
.envelope-card.opened .stack-2 { transform: translateY(4px) scale(0.94) rotate(1.5deg); z-index: 2; }
.envelope-card.opened .stack-3 { transform: translateY(8px) scale(0.92) rotate(-0.5deg); z-index: 3; }

/* The Main Note (Added GPU stabilization) */
.love-note {
    position: absolute; top: 12%; left: 5%; width: 90%; height: 160%;
    background: linear-gradient(135deg, #F9F6F0 0%, #EAE3D8 100%);
    border-radius: 4px 4px 6px 6px;
    border-top: 1px solid rgba(255,255,255,0.95);
    border-left: 1px solid rgba(255,255,255,0.7);
    border-right: 1px solid rgba(200, 210, 230, 0.3);
    box-shadow: 
        0 -15px 40px rgba(0,0,0,0.45), 
        0 -2px 15px rgba(200, 220, 255, 0.25), 
        inset 0 0 40px rgba(170, 190, 220, 0.12), 
        inset 0 0 8px rgba(100, 80, 70, 0.05);
    transform: translateY(100%) rotate(-3deg);
    pointer-events: auto; display: flex; flex-direction: column;
    z-index: 5; overflow: hidden;
    will-change: transform; /* FIX: Forces dedicated compositing layer to prevent tearing */
}

/* Luxurious Settle Animation */
.love-note.revealed {
    animation: note-emerge 1.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes note-emerge {
    0% { transform: translateY(100%) rotate(-3deg); }
    70% { transform: translateY(-70%) rotate(0.5deg); } /* Slight overshoot */
    100% { transform: translateY(-68%) rotate(0deg); } /* Gentle settle */
}

/* Faint Moonlight Wash Overlay */
.note-moonlight-wash {
    position: absolute; inset: 0; pointer-events: none; z-index: 1;
    background: linear-gradient(180deg, rgba(220, 235, 255, 0.15) 0%, transparent 35%);
}

/* Authentic Paper Grain */
.note-paper-texture {
    position: absolute; inset: 0; pointer-events: none; z-index: 0; opacity: 0.35; mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* --- Typography & Layout --- */
.note-content-inner {
    position: relative; z-index: 3; 
    padding: 35px 28px 25px 28px; /* Tighter padding to reduce dead space */
    display: flex; flex-direction: column; 
    height: 100%; 
    box-sizing: border-box;
}

.note-greeting {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.35rem; color: #2C2621; /* Deeper ink color */
    font-style: italic; 
    margin-bottom: 15px; /* Pulled closer to the body text */
    letter-spacing: 0.5px;
    text-shadow: 0 1px 1px rgba(255,255,255,0.6);
}

/* The wrapper handles the fade-out mask illusion */
.note-body-wrapper {
    position: relative;
    flex-grow: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Soft gradient mask fading to transparent at the bottom */
    -webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
    transition: -webkit-mask-image 0.5s ease, mask-image 0.5s ease;
}

/* Removes the mask when reading is complete */
.note-body-wrapper.scrolled-bottom {
    -webkit-mask-image: linear-gradient(to bottom, black 100%, black 100%);
    mask-image: linear-gradient(to bottom, black 100%, black 100%);
}

.note-body {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 0.95rem; color: #332D28; /* High contrast, realistic dark sepia */
    line-height: 1.7; /* Tighter vertical rhythm */
    white-space: pre-wrap; 
    padding-right: 5px; 
    padding-bottom: 30px; /* Buffer for the tap hint to clear the bottom */
    flex-grow: 1;
    overflow-y: auto; 
    min-height: 0; 
    touch-action: pan-y; 
    text-shadow: 0 1px 1px rgba(255,255,255,0.4);
    
    /* Completely hide digital scrollbars */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}
.note-body::-webkit-scrollbar { 
    display: none; /* Chrome/Safari */
}

/* Suspense section: Zeroed out bottom spacing to sit flush with the hint */
.note-suspense {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.1rem; 
    color: #5A3A3A; 
    font-style: italic; 
    text-align: center; 
    margin-top: 0px; 
    margin-bottom: 0px; /* Forced to absolute zero */
    padding: 0px 0 0 0; /* Removed bottom padding */
    position: relative;
}

/* ==================================================
   READING UX & PROGRESSION LOCK (UPDATED)
   ================================================== */

.scene.envelope-settled .envelope-wrapper.reading-mode {
    transform: translate(-50%, 22vh) scale(0.95);
    transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.love-note.revealed {
    animation: note-emerge 1.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes note-emerge {
    0% { transform: translateY(100%) rotate(-3deg); }
    70% { transform: translateY(-112%) rotate(0.5deg); } 
    100% { transform: translateY(-110%) rotate(0deg); } 
}

.love-note.dismissed {
    animation: note-drift-away 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: none;
}
@keyframes note-drift-away {
    0% { transform: translateY(-110%) rotate(0deg); opacity: 1; filter: blur(0px); }
    100% { transform: translateY(-135%) rotate(3deg); opacity: 0; filter: blur(5px); }
}

/* The new subtle handwritten marginalia cue */
.note-edge-cue {
    position: absolute; 
    bottom: 18px; 
    right: 28px;
    font-family: 'Brush Script MT', 'Lucida Handwriting', cursive;
    font-size: 0.9rem; 
    color: #8B7366;
    opacity: 0.8; 
    pointer-events: none; 
    transition: opacity 0.8s ease;
    z-index: 10;
}
.note-edge-cue.hidden { opacity: 0; }

/* Actions wrapper: Removed all top spacing */
.note-actions {
    position: relative; 
    margin-top: 0px; 
    padding-top: 0px; /* Forced to absolute zero */
    padding-bottom: 0px; /* Keeps space at the very bottom of the paper */
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
}

/* The elegant cursive trigger - now with the breathing effect */
.note-tap-hint {
    font-family: 'Brush Script MT', 'Lucida Handwriting', cursive;
    font-size: 1.15rem;
    font-weight: bold;
    color: #8C8C8C; 
    text-align: center;
    cursor: pointer;
    pointer-events: auto; 
    transition: color 0.3s ease;
    transform-origin: center center;
    animation: text-breathe 3s infinite ease-in-out;
    line-height: 1; 
}

/* Darker graphite grey on hover (removed scale here so it doesn't fight the animation) */
.note-tap-hint:hover {
    color: #555555; 
}

/* The Restored Breathing Effect */
@keyframes text-breathe {
    0%, 100% { 
        transform: scale(1); 
        opacity: 0.6; 
        text-shadow: none; 
    }
    50% { 
        transform: scale(1.08); /* The physical breathing expansion */
        opacity: 1; 
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.7); /* Soft graphite glow */
    }
}
@media (prefers-reduced-motion: reduce) { 
    .scene.envelope-settled .envelope-wrapper.reading-mode { transition-duration: 0.1s; }
    .love-note.revealed { animation: none; transform: translateY(-110%) rotate(0deg); }
    .love-note.dismissed { animation: none; opacity: 0; }
}

/* ==================================================
   KEEPSAKE PHOTOS & CINEMATIC REVEAL
   ================================================== */

/* The Physical Photo Thumbnails */
.keepsake-photos {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 25px 0;
    padding: 10px;
}

.keepsake-thumb {
    position: relative;
    width: 110px;
    height: 130px;
    background: #FDFCF9;
    padding: 6px 6px 20px 6px; /* Polaroid/print style bottom margin */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.08);
    transform: rotate(var(--rot)) translateZ(0);
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s ease;
    will-change: transform;
}

.keepsake-thumb:hover {
    transform: rotate(calc(var(--rot) * 0.5)) scale(1.05) translateY(-5px) !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15), 0 5px 10px rgba(0,0,0,0.1);
    z-index: 10;
}

/* Faded/Flattened state to indicate it has been touched/viewed */
.keepsake-thumb.viewed {
    opacity: 0.85;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    transform: rotate(calc(var(--rot) * 1.2)) scale(0.98);
}
.keepsake-thumb.viewed::after {
    content: '♡';
    position: absolute;
    bottom: 3px;
    right: 8px;
    font-size: 10px;
    color: #8C8C8C;
    opacity: 0.5;
}

.thumb-inner {
    width: 100%;
    height: 100%;
    background: #EAE3D8;
    overflow: hidden;
}

.thumb-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.2) contrast(0.95); /* Softens the digital edge of uploaded photos */
}

.note-closing-text {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 0.95rem; 
    color: #332D28;
    line-height: 1.7;
    text-align: center;
    margin-top: 10px;
    white-space: pre-wrap;
}

/* Locked Continuation Cue */
.note-tap-hint.locked {
    opacity: 0.2;
    pointer-events: none;
    animation: none;
    filter: grayscale(1);
}

/* Global Cinematic Viewer */
.cinematic-viewer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.cinematic-viewer.active {
    pointer-events: auto;
    opacity: 1;
}

.cinematic-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 8, 5, 0.7); /* Deep, warm romantic dimming */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.cinematic-image-wrapper {
    position: relative;
    z-index: 2;
    max-width: 85vw;
    max-height: 80vh;
    padding: 10px;
    background: #FDFCF9;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    /* Morph-blur starting state */
    opacity: 0;
    filter: blur(20px);
    transform: scale(1.1);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.cinematic-viewer.active .cinematic-image-wrapper {
    /* Morph-blur settled state */
    opacity: 1;
    filter: blur(0px);
    transform: scale(1) rotate(-1deg); /* Slight organic tilt */
}

.cinematic-image {
    display: block;
    max-width: 100%;
    max-height: calc(80vh - 20px);
    object-fit: contain;
}

.cinematic-hint {
    position: absolute;
    bottom: 5vh;
    z-index: 2;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-style: italic;
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
    letter-spacing: 2px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.8s ease 0.4s; /* Delayed fade in */
}

.cinematic-viewer.active .cinematic-hint {
    opacity: 1;
    transform: translateY(0);
}

/* ==================================================
   MAGICAL TEXT REVEAL (MORPH-BLUR)
   ================================================== */

.magical-reveal-container {
    margin-top: 30px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px; /* Generous breathing room for emotional pacing */
}

.magical-line {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.05rem; 
    color: #4A3A35; /* Deeper, richer ink color */
    line-height: 1.6;
    text-align: center;
    margin: 0;
    
    /* The Morph-Blur Start State */
    opacity: 0;
    filter: blur(12px);
    transform: translateY(18px) scale(0.96);
    
    /* Cinematic easing: starts smooth, settles slowly */
    transition: 
        opacity 1.4s cubic-bezier(0.2, 0.8, 0.2, 1),
        filter 1.4s cubic-bezier(0.2, 0.8, 0.2, 1),
        transform 1.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    
    will-change: opacity, filter, transform;
}

.magical-line.revealed {
    /* The Morph-Blur Settled State */
    opacity: 1;
    filter: blur(0px);
    transform: translateY(0) scale(1);
}

/* Fallback for users with device-level motion sensitivity enabled */
@media (prefers-reduced-motion: reduce) {
    .magical-line {
        filter: none !important;
        transform: none !important;
        transition: opacity 1s ease !important;
    }
}

/* ==================================================
   NOTE 3: THE FINALE THRESHOLD (FIXED LAYOUT)
   ================================================== */

.finale-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    flex-grow: 1; /* Takes up all available space in the note */
    padding-bottom: 10px; /* Safe buffer from the bottom edge */
    box-sizing: border-box;
}

/* This wrapper perfectly centers the text in the available vertical space */
.finale-text-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* The Main Morph-Blur Text */
.finale-main-text {
    font-family: 'Georgia', 'Times New Roman', serif;
    /* Responsive sizing: scalable on mobile, capped at 1.35rem on desktop */
    font-size: clamp(1.1rem, 4.5vw, 1.35rem); 
    color: #2C2621;
    line-height: 1.8;
    text-align: center;
    max-width: 95%; /* Prevents text from hitting the absolute edges */
    margin: 0;
    
    /* Initial Hidden State */
    opacity: 0;
    filter: blur(20px);
    transform: translateY(25px) scale(0.95);
}

/* Triggered when the note finishes rising out of the envelope */
.love-note.revealed .finale-main-text {
    animation: finale-morph-reveal 3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards 1.2s;
}

@keyframes finale-morph-reveal {
    0% { opacity: 0; filter: blur(20px); transform: translateY(25px) scale(0.95); }
    40% { opacity: 1; filter: blur(0px); transform: translateY(-2px) scale(1.01); }
    100% { opacity: 1; filter: blur(0px); transform: translateY(0) scale(1); }
}

/* The Magical CTA / Whispered Invitation */
.magical-cta {
    /* margin-top: auto pushes the CTA to the bottom, right above the padding */
    margin-top: auto; 
    flex-shrink: 0; /* Prevents the CTA from being crushed on tiny screens */
    
    font-family: 'Georgia', 'Times New Roman', serif;
    font-style: italic;
    font-size: 1.15rem;
    color: #7A6A63; 
    letter-spacing: 2px;
    cursor: pointer;
    padding: 15px 25px; /* Generous touch target for mobile */
    
    /* Hidden initially, untappable until revealed */
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

.love-note.revealed .magical-cta {
    animation: 
        cta-soft-emerge 2s ease-out forwards 3.5s,
        cta-moonlight-shimmer 4s ease-in-out infinite 5.5s;
}

@keyframes cta-soft-emerge {
    0% { opacity: 0; transform: translateY(10px); pointer-events: none; }
    100% { opacity: 0.85; transform: translateY(0); pointer-events: auto; }
}

@keyframes cta-moonlight-shimmer {
    0%, 100% { opacity: 0.85; text-shadow: 0 0 0px rgba(255, 255, 255, 0); transform: scale(1); }
    50% { opacity: 1; text-shadow: 0 0 12px rgba(255, 255, 255, 0.8), 0 0 25px rgba(200, 220, 255, 0.5); transform: scale(1.04); color: #4A3A35; }
}

/* Hover deepens the connection before the click */
.magical-cta:hover {
    color: #2C2621;
    text-shadow: 0 0 15px rgba(255, 255, 255, 1), 0 0 30px rgba(200, 220, 255, 0.8);
    transition: all 0.4s ease;
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
    .finale-main-text { filter: none !important; transform: none !important; }
    .love-note.revealed .finale-main-text { animation: simple-fade 2s ease forwards 1s; }
    .love-note.revealed .magical-cta { animation: simple-fade 2s ease forwards 2.5s; }
    @keyframes simple-fade { to { opacity: 1; pointer-events: auto; } }
}

/* ==================================================
   NOTE 3: THE FINALE SANCTUARY
   ================================================== */

/* The Layout Container */
.finale-sanctuary {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 30px 20px;
    box-sizing: border-box;
    
    /* FIX: Allow vertical scrolling if the screen is too small */
    overflow-y: auto; 
    
    /* Hide digital scrollbars for a clean paper look */
    scrollbar-width: none; 
    -ms-overflow-style: none; 
}
.finale-sanctuary::-webkit-scrollbar {
    display: none;
}

/* The Poetic Composition */
.finale-poem {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    
    /* FIX: Safely centers the text when there is room, but allows scrolling when cramped */
    margin-top: auto; 
    margin-bottom: 40px; 
    
    /* Morph-Blur Starting State */
    opacity: 0;
    filter: blur(15px);
    transform: translateY(15px) scale(0.96);
}

/* The Reveal Animation */
.love-note.revealed .finale-poem {
    animation: poem-materialize 3.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards 1s;
}

@keyframes poem-materialize {
    0% { opacity: 0; filter: blur(15px); transform: translateY(15px) scale(0.96); }
    50% { opacity: 1; filter: blur(2px); transform: translateY(-2px) scale(1.01); }
    100% { opacity: 1; filter: blur(0px); transform: translateY(0) scale(1); }
}

/* Typography Rules */
.poem-line {
    font-family: 'Baskerville', 'Palatino Linotype', 'Georgia', serif;
    font-size: clamp(1.05rem, 4.5vw, 1.25rem);
    color: #3D342E; 
    line-height: 1.9;
    text-align: center;
    letter-spacing: 0.5px;
    display: block; 
    width: 100%;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4); 
}

.poem-spacer {
    height: 22px; 
    display: block;
}

.poem-emphasis {
    font-style: italic;
    font-size: 1.08em; 
    color: #2A221E; 
    letter-spacing: 0.8px;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.7); 
}

/* ==================================================
   THE HIGHLIGHTED MAGICAL CTA
   ================================================== */

.whisper-cta {
    margin-top: auto; /* Works with the poem's margin to balance the layout */
    margin-bottom: 10px;
    
    font-family: 'Baskerville', 'Palatino Linotype', 'Georgia', serif;
    font-style: italic;
    font-size: 1.1rem;
    font-weight: bold; /* Added weight for CTA prominence */
    color: #3D342E; /* Darker, clearer ink color */
    letter-spacing: 2px;
    cursor: pointer;
    
    /* FIX: Highlight CTA Styling (Frosted moonlit button) */
    padding: 14px 32px;
    background: linear-gradient(135deg, rgba(255,255,255,0.7), rgba(255,255,255,0.3));
    border: 1px solid rgba(140, 126, 119, 0.3);
    border-radius: 40px; /* Elegant pill shape */
    box-shadow: 0 4px 15px rgba(0,0,0,0.05), inset 0 0 10px rgba(255,255,255,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    
    /* Hidden initially */
    opacity: 0;
    pointer-events: none;
    transform: translateY(15px);
}

/* Appears only after the poem is fully read */
.love-note.revealed .whisper-cta {
    animation: 
        cta-emerge 2s ease-out forwards 4.5s,
        cta-glow-pulse 4s ease-in-out infinite 6.5s;
}

@keyframes cta-emerge {
    0% { opacity: 0; transform: translateY(15px); pointer-events: none; }
    100% { opacity: 0.9; transform: translateY(0); pointer-events: auto; }
}

/* A soft, breathing button glow */
@keyframes cta-glow-pulse {
    0%, 100% { 
        box-shadow: 0 4px 15px rgba(0,0,0,0.05), inset 0 0 10px rgba(255,255,255,0.6); 
    }
    50% { 
        box-shadow: 0 4px 25px rgba(200, 220, 255, 0.4), inset 0 0 15px rgba(255,255,255,0.9); 
        transform: scale(1.02); 
    }
}

/* Intimate hover reaction */
.whisper-cta:hover {
    background: rgba(255,255,255,0.95);
    color: #1A1512;
    box-shadow: 0 6px 25px rgba(200, 220, 255, 0.7);
    transform: translateY(-2px) scale(1.02);
    transition: all 0.4s ease;
}

/* Reduced Motion Safety */
@media (prefers-reduced-motion: reduce) {
    .finale-poem { filter: none !important; transform: none !important; }
    .love-note.revealed .finale-poem { animation: simple-fade 2s ease forwards 0.5s; }
    .love-note.revealed .whisper-cta { animation: simple-fade 2s ease forwards 2s; }
    @keyframes simple-fade { to { opacity: 1; pointer-events: auto; } }
}

/* ==================================================
   STAR 1 CINEMATIC JOURNEY & TYPOGRAPHY 5
   ================================================== */

/* Warp Canvas & Flash Transition */
/* Warp Canvas: Removed mix-blend-mode so it acts as a solid deep-space backdrop */
#warp-canvas { position: absolute; inset: 0; z-index: 21; pointer-events: none; opacity: 0; transition: opacity 0.8s ease; }
#warp-canvas.active { opacity: 1; }
#warp-canvas.blurred-reading { filter: blur(2.5px) brightness(0.95); transition: filter 2s ease; }

/* The Prototype's Deep Space Nebula */
#deep-space-nebula {
    position: absolute; top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(28, 48, 110, 0.4) 0%, rgba(6, 14, 38, 0) 60%),
                radial-gradient(circle at 30% 70%, rgba(65, 30, 90, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 75% 25%, rgba(20, 65, 110, 0.25) 0%, transparent 50%);
    z-index: 22; opacity: 0; pointer-events: none; mix-blend-mode: screen;
    transition: opacity 2s ease; transform-origin: center;
}
#deep-space-nebula.living { opacity: 1; animation: nebula-drift 60s linear infinite; }

/* Flash Overlay (Bumped z-index to 23 to cover the nebula) */
#flash-overlay-s1 { position: absolute; inset: 0; background: #ffffff; z-index: 23; opacity: 0; pointer-events: none; transition: opacity 0.5s ease-out; }

/* The lock-on camera movement */
#star-1.centering {
    transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1), top 0.8s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* The Physical Star Travel */
#star-1.traveling { transition: transform 1.5s cubic-bezier(0.5, 0, 0.2, 1), opacity 1.2s ease-in; transform: translate(-50%, -50%) scale(80); opacity: 0 !important; pointer-events: none; z-index: 99; }
#sky-bg.blurred-reading { filter: blur(3px) brightness(0.85); transition: filter 2s ease; }

/* Reading Scene Environment */
#content-scene-s1 { position: absolute; inset: 0; z-index: 25; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 1.5s ease; }
#content-scene-s1.active { opacity: 1; pointer-events: auto; }

/* Premium Frosted Glass Card */
.story-card-s1 {
    width: 90%; max-width: 650px; height: 85vh; overflow-y: auto; padding: 50px 40px;
    background: rgba(12, 22, 45, 0.25);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(163, 194, 255, 0.2); border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3), inset 0 0 25px rgba(255,255,255,0.06);
    scrollbar-width: none; scroll-behavior: smooth;
}
.story-card-s1::-webkit-scrollbar { display: none; }

/* Typography 5 (Spectral) Application */
.story-title-s1 {
    font-family: 'Spectral', serif; font-weight: 300; font-size: clamp(2rem, 6vw, 3rem);
    letter-spacing: 4px; text-align: center; margin-bottom: 40px; color: #ffffff;
    text-shadow: 0 0 15px rgba(163, 194, 255, 0.4);
}
.story-p-s1 {
    font-family: 'Spectral', serif; font-weight: 300; font-size: clamp(1.05rem, 2.8vw, 1.2rem);
    line-height: 1.8; letter-spacing: 0.5px; margin-bottom: 30px; color: #c2d4ec;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.story-p-s1:last-of-type { font-style: italic; color: #ffffff; margin-top: 40px; text-align: center; }

/* Ink-in-Water Word Reveal */
.ink-word { display: inline-block; opacity: 0; filter: blur(12px); transform: scale(1.08); color: rgba(255,255,255,0.3); will-change: opacity, filter, transform, color; }
.ink-word.reveal { animation: ink-bloom 1.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
@keyframes ink-bloom {
    0% { opacity: 0; filter: blur(12px); transform: scale(1.08); color: rgba(255,255,255,0.2); }
    40% { opacity: 0.7; filter: blur(4px); transform: scale(1.02); color: rgba(200, 220, 255, 0.8); }
    100% { opacity: 1; filter: blur(0px); transform: scale(1); color: inherit; }
}

/* Continue Journey CTA */
.cta-wrapper-s1 {
    text-align: center;
    margin-top: 60px;
    margin-bottom: 20px;
    position: sticky;
    bottom: 16px;
    z-index: 3;
    padding-top: 16px;
    background: linear-gradient(to top, rgba(12, 22, 45, 0.96), rgba(12, 22, 45, 0));
}

.whisper-cta-s1 {
    font-family: 'Spectral', serif;
    font-style: italic;
    font-size: 1.1rem;
    font-weight: 400;
    color: #ffffff;
    letter-spacing: 2px;
    padding: 12px 30px;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(163, 194, 255, 0.2), rgba(163, 194, 255, 0.05));
    border: 1px solid rgba(163, 194, 255, 0.4);
    border-radius: 40px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2), inset 0 0 10px rgba(255,255,255,0.1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);

    /* Initially hidden */
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) scale(0.98);
    transition: opacity 0.45s ease, transform 0.45s ease, background 0.4s ease, box-shadow 0.4s ease;
    touch-action: manipulation;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

/* Continue Journey CTA */
.cta-wrapper-s1 { text-align: center; margin-top: 60px; margin-bottom: 20px; }

.whisper-cta-s1 {
    font-family: 'Spectral', serif;
    font-style: italic;
    font-size: 0.95rem;
    font-weight: 400;
    color: #ffffff;
    letter-spacing: 1.6px;
    padding: 10px 22px;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(163, 194, 255, 0.2), rgba(163, 194, 255, 0.05));
    border: 1px solid rgba(163, 194, 255, 0.4);
    border-radius: 36px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2), inset 0 0 10px rgba(255,255,255,0.1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);

    /* Initially hidden */
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) scale(0.98);
    transition: opacity 0.45s ease, transform 0.45s ease, background 0.4s ease, box-shadow 0.4s ease;
    min-height: 42px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.whisper-cta-s1.reveal {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.whisper-cta-s1:hover,
.whisper-cta-s1:focus-visible {
    background: rgba(163, 194, 255, 0.3);
    box-shadow: 0 6px 25px rgba(163, 194, 255, 0.4);
    transform: translateY(-2px) scale(1.02);
    outline: none;
}

@media (max-width: 600px) {
    .story-card-s1 { padding: 40px 25px; width: 95%; height: 90vh; }
    .cta-wrapper-s1 { margin-top: 44px; margin-bottom: 16px; }
    .whisper-cta-s1 { font-size: 0.92rem; padding: 10px 18px; }
}


/* ==================================================
   STAR 2: KEEPSAKE CARDS (VARIANT C: VELVET FOCUS)
   ================================================== */

/* Sky Heartbeat Animation */
.sky-heartbeat {
    animation: cosmic-beat 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes cosmic-beat {
    0% { transform: scale(1); filter: brightness(1); }
    15% { transform: scale(1.04); filter: brightness(1.4); }
    30% { transform: scale(1); filter: brightness(1); }
    45% { transform: scale(1.02); filter: brightness(1.2); }
    100% { transform: scale(1); filter: brightness(1); }
}

/* Scene Container */
#content-scene-s2 {
    position: absolute; inset: 0; z-index: 25;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 1.5s ease;
    perspective: 1200px;
}
#content-scene-s2.active { opacity: 1; pointer-events: auto; }

/* Stage & Dots */
.progress-dots-s2 {
    display: flex; gap: 8px; margin-bottom: 30px;
    opacity: 0; transition: opacity 0.5s ease;
    z-index: 30;
}
#content-scene-s2.active .progress-dots-s2 { opacity: 1; }
.dot-s2 { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.2); transition: 0.4s ease; }
.dot-s2.active { background: #fff; transform: scale(1.5); box-shadow: 0 0 8px rgba(255,255,255,0.8); }
.dot-s2.completed { background: rgba(255,255,255,0.5); }

#stage-s2 {
    position: relative; width: 260px; height: 380px;
    transform-style: preserve-3d;
}

/* The Card Wrapper */
.card-container-s2 {
    position: absolute; inset: 0;
    transform-style: preserve-3d; 
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.5s ease, filter 0.5s ease;
    pointer-events: none;
}

.card-inner-s2 {
    position: relative; width: 100%; height: 100%;
    transform-style: preserve-3d; 
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Base Card Face (Variant C: Velvet Stack Background) */
.card-face-s2 {
    position: absolute; inset: 0;
    backface-visibility: hidden; -webkit-backface-visibility: hidden;
    border-radius: 20px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 30px; text-align: center; overflow: hidden;
    
    background: rgba(5, 8, 15, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    transition: background 0.6s ease, border 0.6s ease, box-shadow 0.6s ease;
}

.card-back-s2 { transform: rotateY(180deg); }

/* Typography & Content */
.content-front-s2 { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; }
.symbol-art-s2 { font-size: 5rem; filter: drop-shadow(0 0 20px rgba(255,255,255,0.2)); transition: transform 0.6s ease; }
.symbol-label-s2 { margin-top: 20px; font-family: 'Spectral', serif; font-size: 0.85rem; letter-spacing: 3px; text-transform: uppercase; color: rgba(255,255,255,0.7); opacity: 0; transform: translateY(10px); transition: all 0.6s ease; }

.content-back-s2 { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; }
.emotion-text-s2 { font-family: 'Spectral', serif; font-size: 1.5rem; font-style: italic; font-weight: 300; line-height: 1.4; color: #fdfbf7; letter-spacing: 1px; text-shadow: 0 2px 5px rgba(0,0,0,0.8); }
.emotion-icon-s2 { margin-top: 20px; font-size: 1.2rem; opacity: 0.8; }

.card-hint-s2 { position: absolute; bottom: 20px; font-family: 'Spectral', serif; font-size: 0.75rem; font-style: italic; color: rgba(255,255,255,0.6); opacity: 0; transition: opacity 0.4s; }

/* STATE 1: Stacked (Translucent, dim) */
.card-container-s2.is-stacked { opacity: 0.3; filter: grayscale(50%); }

/* STATE 2: Focused (Comes forward, opaque velvet background) */
.card-container-s2.is-focused { pointer-events: auto; cursor: pointer; opacity: 1; filter: grayscale(0%); z-index: 50 !important; }
.card-container-s2.is-focused .card-face-s2 {
    background: #060a14; /* Solid Navy/Black */
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 30px 60px rgba(0,0,0,0.9), inset 0 0 40px rgba(0,0,0,1);
}
.card-container-s2.is-focused .symbol-art-s2 { transform: scale(1.1); filter: drop-shadow(0 0 30px rgba(255,255,255,0.6)); }
.card-container-s2.is-focused .symbol-label-s2 { opacity: 1; transform: translateY(0); }
.card-container-s2.is-focused .card-front-s2 .card-hint-s2 { opacity: 1; animation: pulse-hint-s2 2s infinite; }

/* STATE 3: Flipped (Maintains opaque velvet background) */
.card-container-s2.is-flipped { pointer-events: auto; cursor: pointer; opacity: 1; filter: grayscale(0%); z-index: 50 !important; }
.card-container-s2.is-flipped .card-face-s2 {
    background: #060a14;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 30px 60px rgba(0,0,0,0.9), inset 0 0 40px rgba(0,0,0,1);
}
.card-container-s2.is-flipped .card-inner-s2 { transform: rotateY(180deg); }
.card-container-s2.is-flipped .card-back-s2 .card-hint-s2 { opacity: 1; animation: pulse-hint-s2 2s infinite; animation-delay: 1s; }

/* STATE 4: Dismissed */
.card-container-s2.is-dismissed { pointer-events: none; opacity: 0 !important; transform: translateY(-120%) rotate(15deg) scale(0.8) !important; }

@keyframes pulse-hint-s2 { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }



#content-scene-s3 { 
    position: absolute; inset: 0; z-index: 25; 
    display: flex; align-items: center; justify-content: center; 
    opacity: 0; pointer-events: none; transition: opacity 1.5s ease; 
}
#content-scene-s3.active { 
    opacity: 1; pointer-events: auto; 
}


    /* =========================================================
       STAR 3 HOLOGRAM CONTAINER (Replaces your existing s3-hologram)
       ========================================================= */
    .s3-container {
        position: relative;
        z-index: 10;
        width: 100vw;
        max-width: 500px; /* Widened slightly for mobile comfort */
        height: 70vh;
        min-height: 550px;
        max-height: 750px;
        perspective: 1500px;
    }

    .s3-hologram-card {
        width: 100%;
        height: 100%;
        position: relative;
        transform-style: preserve-3d;
        transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .s3-hologram-card.is-flipped {
        transform: rotateY(180deg);
    }

    /* Shared Frosted Glass Styling for Faces */
    .s3-face {
        position: absolute;
        inset: 0;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        background: var(--color-hologram-bg);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border: 1px solid var(--color-glass-border);
        border-radius: 24px;
        box-shadow: 
            0 30px 60px rgba(0, 0, 0, 0.6), 
            inset 0 0 30px rgba(163, 194, 255, 0.05);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    /* Highlight sheen across the glass */
    .s3-face::before {
        content: '';
        position: absolute; inset: 0;
        background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 40%, transparent 60%, rgba(255,255,255,0.02) 100%);
        pointer-events: none;
        z-index: 1;
    }

    /* --- FRONT FACE --- */
    .s3-face-front {
        transform: rotateY(0deg);
        padding: 40px 20px;
        text-align: center;
    }
    
    .s3-question {
        font-size: 2rem;
        font-style: italic;
        font-weight: 300;
        margin-bottom: 40px;
        text-shadow: 0 0 20px rgba(255,255,255,0.4);
        z-index: 2;
    }

    .s3-btn-reveal {
        background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
        border: 1px solid rgba(255,255,255,0.3);
        color: white;
        font-family: 'Spectral', serif;
        font-size: 1.1rem;
        letter-spacing: 1px;
        padding: 14px 32px;
        border-radius: 40px;
        cursor: pointer;
        transition: all 0.4s ease;
        box-shadow: 0 8px 20px rgba(0,0,0,0.3);
        z-index: 2;
    }

    .s3-btn-reveal:hover, .s3-btn-reveal:focus {
        background: rgba(255,255,255,0.9);
        color: #060a14;
        box-shadow: 0 0 25px rgba(255,255,255,0.6);
        transform: translateY(-2px);
        outline: none;
    }

    /* --- BACK FACE (THE MEMORY ORBIT) --- */
    /* Removed background panel and overflow hidden for a seamless free-floating orbit */
    .s3-face-back {
        transform: rotateY(180deg);
        padding: 30px 10px;
        display: flex;
        flex-direction: column;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border: none !important;
        box-shadow: none !important;
        overflow: visible !important; /* Prevents CTA clipping */
    }
    .s3-face-back::before {
        display: none !important; /* Remove sheen from back panel */
    }

    /* =========================================================
       MEMORY ORBIT COMPONENT CORE
       ========================================================= */
    .s3-memory-orbit-viewport {
        flex: 1;
        width: 100%;
        position: relative;
        perspective: 1000px;
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: none; /* Capture all gestures cleanly */
        z-index: 5;
        margin-top: 10px;
    }

    /* The invisible track holding the 3D items */
    .s3-memory-orbit-track {
        position: relative;
        width: 180px; /* Scaled down slightly for mobile */
        height: 260px;
        transform-style: preserve-3d;
    }
    @media (min-width: 400px) {
        .s3-memory-orbit-track {
            width: 200px;
            height: 280px;
        }
    }

    /* Individual Memory Card (Premium Transparent Glass UI) */
    .s3-memory-card {
        position: absolute;
        inset: 0;
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.03); /* Transparent frosted base */
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        padding: 8px;
        padding-bottom: 24px; /* Classic polaroid/keepsake ratio */
        box-shadow: 0 15px 35px rgba(0,0,0,0.2), inset 0 0 15px rgba(255, 255, 255, 0.05);
        cursor: grab;
        will-change: transform, opacity, z-index;
    }

    .s3-memory-card:active {
        cursor: grabbing;
    }

    /* The actual photo area */
    .s3-photo-art {
        width: 100%;
        height: 100%;
        border-radius: 10px;
        overflow: hidden;
        position: relative;
    }

    .s3-photo-art::after {
        content: '';
        position: absolute;
        inset: 0;
        box-shadow: inset 0 0 20px rgba(0,0,0,0.4);
        pointer-events: none;
    }

    /* Tap hint icon on the active card */
    .s3-expand-hint {
        position: absolute;
        bottom: -15px;
        left: 50%;
        transform: translateX(-50%);
        width: 30px;
        height: 30px;
        background: rgba(255,255,255,0.15);
        backdrop-filter: blur(4px);
        border: 1px solid rgba(255,255,255,0.3);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    }
    
    /* Only show hint on the currently active top card */
    .s3-memory-card[data-active="true"] .s3-expand-hint {
        opacity: 1;
        animation: soft-bounce 2s infinite ease-in-out;
    }

    .s3-expand-hint svg {
        width: 14px; height: 14px; fill: white;
    }

    @keyframes soft-bounce {
        0%, 100% { transform: translate(-50%, 0); }
        50% { transform: translate(-50%, -4px); }
    }

    /* --- UI Overlay (Captions & Progress) --- */
    .s3-orbit-ui {
        min-height: 140px; /* Changed from fixed height to flexible min-height */
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-end; /* Stack to the bottom */
        z-index: 10;
        text-align: center;
        padding-bottom: 15px;
    }

    .s3-orbit-caption {
        font-size: 1.3rem;
        font-style: italic;
        font-weight: 300;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-shadow: 0 2px 8px rgba(0,0,0,0.8);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    /* Swiping instruction fades out once interacted */
    .s3-swipe-instruction {
        font-size: 0.8rem;
        color: var(--color-starlight);
        letter-spacing: 2px;
        text-transform: uppercase;
        margin-top: 5px;
        opacity: 0.7;
        transition: opacity 0.5s ease;
    }
    .s3-swipe-instruction.hidden { opacity: 0; }

    .s3-orbit-progress {
        display: flex;
        gap: 6px;
        margin-top: 15px;
    }

    .s3-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: rgba(255,255,255,0.2);
        transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .s3-dot.active {
        background: white;
        transform: scale(1.5);
        box-shadow: 0 0 10px rgba(255,255,255,0.8);
    }

    /* --- Completion State CTA --- */
    .s3-btn-continue {
        display: none;
        background: rgba(255, 255, 255, 0.05);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border: 1px solid var(--color-accent);
        color: var(--color-accent);
        font-family: 'Spectral', serif;
        font-size: 1rem;
        letter-spacing: 1px;
        padding: 12px 28px;
        border-radius: 30px;
        cursor: pointer;
        transition: all 0.3s ease;
        margin-top: 20px;
        animation: fadeIn 0.8s ease forwards;
        box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    }

    .s3-btn-continue:hover {
        background: var(--color-accent);
        color: #000;
        box-shadow: 0 0 20px rgba(200, 160, 255, 0.4);
    }

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


    /* =========================================================
       LIGHTBOX EXPANDED VIEW
       ========================================================= */
    .s3-lightbox {
        position: fixed;
        inset: 0;
        z-index: 9999;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.5s ease;
    }

    .s3-lightbox.active {
        pointer-events: auto;
        opacity: 1;
    }

    .s3-lightbox-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(4, 6, 12, 0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        cursor: pointer;
    }

    .s3-lightbox-content {
        position: relative;
        z-index: 2;
        width: 85vw;
        max-width: 500px;
        height: 65vh;
        max-height: 700px;
        background: #fff;
        padding: 10px;
        padding-bottom: 60px; /* Polaroid style large bottom */
        border-radius: 12px;
        box-shadow: 0 30px 80px rgba(0,0,0,0.8);
        transform: scale(0.9) translateY(20px);
        transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .s3-lightbox.active .s3-lightbox-content {
        transform: scale(1) translateY(0);
    }

    .s3-lightbox-image {
        width: 100%;
        height: 100%;
        border-radius: 6px;
        background-size: cover;
        background-position: center;
    }

    .s3-lightbox-caption {
        position: absolute;
        bottom: 15px;
        left: 0;
        width: 100%;
        text-align: center;
        color: #1a1a1a;
        font-family: 'Spectral', serif;
        font-style: italic;
        font-size: 1.2rem;
    }

    .s3-lightbox-close {
        position: absolute;
        top: -40px;
        right: 0;
        color: white;
        font-family: sans-serif;
        font-size: 1rem;
        letter-spacing: 2px;
        text-transform: uppercase;
        cursor: pointer;
        opacity: 0.6;
        transition: opacity 0.3s;
    }
    
    .s3-lightbox-close:hover { opacity: 1; }

    /* Accessibility Focus */
    :focus-visible {
        outline: 2px solid var(--color-starlight);
        outline-offset: 4px;
    }

    /* Reduced Motion */
    @media (prefers-reduced-motion: reduce) {
        .ambient-stars, .s3-expand-hint { animation: none !important; }
        .s3-hologram-card, .s3-memory-card, .s3-lightbox-content { transition-duration: 0.1s !important; }
    }

/* ==================================================
   STAR 4: SPECIAL DATES & SHELTER CONFESSION
   ================================================== */

/* Interacted Golden Core */
#star-4.s4-interacted .star-core {
    animation: none;
    transform: scale(1.5);
    box-shadow: 0 0 20px 4px rgba(250, 235, 215, 0.8);
    background-color: #faebd7;
}

/* Premium Cinematic Hologram Upgrade */
.s4-premium-hologram {
    background: rgba(10, 15, 30, 0.75) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(250, 235, 215, 0.2) !important;
    box-shadow: 0 30px 60px rgba(0,0,0,0.8), inset 0 0 30px rgba(250, 235, 215, 0.05) !important;
    border-radius: 20px !important;
    padding: 40px 30px !important;
}

.s4-premium-hologram h3 {
    color: #faebd7 !important;
    font-family: 'Spectral', serif !important;
    font-size: 1.8rem;
    border-bottom: 1px solid rgba(250, 235, 215, 0.3) !important;
    padding-bottom: 15px !important;
    margin-bottom: 20px !important;
    text-shadow: 0 0 15px rgba(250, 235, 215, 0.4);
}

.s4-text-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 25px;
}

.s4-text-stack p {
    font-family: sans-serif;
    font-size: 1.05rem;
    color: #e2e8f0;
    font-weight: 300;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.s4-btn-ack {
    background: linear-gradient(135deg, rgba(250, 235, 215, 0.15), rgba(250, 235, 215, 0.05)) !important;
    border: 1px solid rgba(250, 235, 215, 0.4) !important;
    color: #faebd7 !important;
    border-radius: 30px !important;
    padding: 12px 30px !important;
    font-weight: 300;
    letter-spacing: 1px;
    transition: all 0.4s ease !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3) !important;
}

.s4-btn-ack:hover {
    background: rgba(250, 235, 215, 0.9) !important;
    color: #03050a !important;
    box-shadow: 0 0 25px rgba(250, 235, 215, 0.6) !important;
    transform: translateY(-2px);
}

/* Scattered Date Stars (The Memories) */
.s4-date-wrapper {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 5;
    pointer-events: none;
}

.s4-date-star {
    width: 4px;
    height: 4px;
    background-color: #fff;
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 0px 0px transparent;
    transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 1.5s cubic-bezier(0.4, 0, 0.2, 1), transform 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.s4-date-wrapper.revealing .s4-date-star {
    opacity: 1;
    transform: scale(1.5);
    box-shadow: 0 0 10px 2px rgba(226, 232, 240, 0.6);
    animation: s4-memory-twinkle 4s infinite alternate ease-in-out;
}

@keyframes s4-memory-twinkle {
    0% { opacity: 0.6; transform: scale(1.2); box-shadow: 0 0 6px 1px rgba(226, 232, 240, 0.6); }
    100% { opacity: 1; transform: scale(1.6); box-shadow: 0 0 12px 2px rgba(226, 232, 240, 0.8); }
}

.s4-date-label {
    position: absolute;
    font-family: 'Spectral', serif;
    font-style: italic;
    font-size: 1.15rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    color: #f8fafc;
    opacity: 0;
    white-space: nowrap;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8), 0 0 12px rgba(255, 255, 255, 0.2);
    transition: opacity 2s cubic-bezier(0.25, 0.1, 0.25, 1), transform 2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.s4-date-wrapper.revealing .s4-date-label { opacity: 0.85; }

/* Smart Label Positioning Logic */
.pos-top-right .s4-date-label { top: -20px; left: 12px; transform: translate(5px, 5px); }
.pos-top-right.revealing .s4-date-label { transform: translate(0, 0); }
.pos-top-left .s4-date-label { top: -20px; right: 12px; transform: translate(-5px, 5px); }
.pos-top-left.revealing .s4-date-label { transform: translate(0, 0); }
.pos-bottom-right .s4-date-label { bottom: -20px; left: 12px; transform: translate(5px, -5px); }
.pos-bottom-right.revealing .s4-date-label { transform: translate(0, 0); }
.pos-bottom-left .s4-date-label { bottom: -20px; right: 12px; transform: translate(-5px, -5px); }
.pos-bottom-left.revealing .s4-date-label { transform: translate(0, 0); }





/* totheend