:root {
    --bg-color: #fdfbf7;
    --paper-color: #f5f1e8;
    --text-color: #4a4a4a;
    --accent-color: #d4a5a5;
    --tree-color: #8b5a2b;
    --heart-color: #dea5a4;
    --font-hand: 'Dancing Script', cursive;
    --font-serif: 'Playfair Display', serif;
    --font-typewriter: 'Courier Prime', monospace;
}

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

.hidden {
    display: none !important;
}

html {
    height: 100%;
}

body {
    background: var(--bg-color);
    position: relative;
    color: var(--text-color);
    font-family: var(--font-serif);
    height: 100vh;
    overflow: hidden;
}

/* Background Effects */
/* Global Lock Screen */
#global-lock {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #fdfbf7 0%, #ffe6e6 100%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease;
}

#lock-content {
    text-align: center;
    animation: float 3s ease-in-out infinite;
}

#lock-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--accent-color);
}

#lock-input {
    padding: 10px 15px;
    font-family: var(--font-typewriter);
    font-size: 1.2rem;
    border: 2px solid var(--accent-color);
    border-radius: 20px;
    outline: none;
    text-align: center;
    margin-bottom: 0px;
    width: 200px;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s;
}

#lock-input:focus {
    box-shadow: 0 0 15px rgba(212, 165, 165, 0.5);
    width: 220px;
}

.shake {
    animation: shake 0.4s ease-in-out;
}

/* Dynamic Sakura Rain Canvas */
#sakura-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

@keyframes floatBackground {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 0 1000px;
    }

    /* Floating UP/Down */
}

#app-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: opacity 0.5s ease, transform 0.5s ease;
    opacity: 0;
    pointer-events: none;
    /* CRITICAL FIX: Allow the VIEW to scroll, not the BODY */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.view.active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.view.hidden {
    transform: scale(0.95);
}

/* Tree View Layout */
.tree-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

.tree-section {
    flex: 3;
    position: relative;
    height: 100%;
    /* Flex center for Intro text */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Sidebar */
.sidebar-section {
    flex: 1;
    height: 100%;
    background: transparent;
    /* Fixed: was causing white column */
    border-left: none;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 50px;
    position: relative;
    z-index: 10;
    /* Ensure clicks work */
}

/* Intro Text */
#intro {
    position: relative;
    z-index: 10;
    text-align: center;
    transition: opacity 1s;
    margin-bottom: 20vh;
    /* Shift up slightly visually */
    pointer-events: none;
}

#intro h1 {
    font-family: var(--font-hand);
    font-size: 3.5rem;
    margin-bottom: 10px;
    /* Dark Gold/Brown for Light Theme Contrast */
    background: linear-gradient(90deg, #8B4513 0%, #b8860b 20%, #8B4513 40%, #8B4513 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 5s linear infinite;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

#intro p {
    font-family: var(--font-typewriter);
    font-size: 1.2rem;
    margin-top: 10px;
}

.gift-label {
    font-family: var(--font-serif);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #8B4513;
    border-bottom: 1px solid rgba(139, 69, 19, 0.3);
    padding-bottom: 5px;
    margin-bottom: 10px;
    display: inline-block;
}

.author-credit {
    font-family: var(--font-typewriter);
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.6;
    margin-top: 15px;
    font-style: italic;
}

#treeCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    /* Wind Animation 🌬️ */
    transform-origin: bottom center;
    /* Wind Animation MOVED TO WRAPPER */
    /* animation: treeSway 8s ease-in-out infinite; */
    will-change: transform;
    /* Ensure it is block level */
    display: block;
}

#tree-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Wind Animation Here - affects canvas AND glows */
    transform-origin: bottom center;
    animation: treeSway 8s ease-in-out infinite;
    pointer-events: none;
    /* Let clicks pass through wrapper */
}

#treeCanvas {
    pointer-events: auto;
    /* Re-enable pointer events on canvas */
}

#leaf-glows-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Glows shouldn't block clicks */
    z-index: 6;
    /* Above treeCanvas (z-index 5) */
}

.leaf-glow {
    position: absolute;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 182, 193, 0.4) 0%, rgba(255, 105, 180, 0.2) 50%, rgba(255, 20, 147, 0) 70%);
    transform: translate(-50%, -50%);
    animation: pulseGlow 1.5s infinite ease-in-out;
    pointer-events: none;
    mix-blend-mode: screen;
}

@keyframes pulseGlow {
    0% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.6;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.8);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.6;
    }
}

@keyframes treeSway {

    0%,
    100% {
        transform: rotate(0deg) scaleX(1);
    }

    25% {
        transform: rotate(0.6deg) scaleX(1.008);
    }

    50% {
        transform: rotate(-0.3deg) scaleX(0.995);
    }

    75% {
        transform: rotate(0.4deg) scaleX(1.005);
    }
}

/* Wind Gust Streaks (Natural Physics) */
.wind-gust {
    position: absolute;
    width: 200px;
    height: 80px;
    background: none;
    border-radius: 0;
    pointer-events: none;
    z-index: 4;
    /* Horizontal Traversal Only */
    animation: windGust var(--gust-duration, 8s) linear infinite;
    animation-delay: var(--gust-delay, 0s);
    opacity: 0;
    will-change: transform, opacity;
}

.wind-gust svg {
    display: block;
    width: 100%;
    height: 100%;
    /* Compound Organic Motion: Floating + Gentle Rotation */
    animation:
        floatY var(--float-duration, 4s) ease-in-out infinite,
        rotateGust var(--gust-duration, 8s) ease-in-out infinite;
}

.wind-gust path {
    /* Ice/Cloud White (Semi-transparent) */
    fill: rgba(255, 255, 255, 0.6);
    stroke: none;
    filter: drop-shadow(0 4px 8px rgba(255, 255, 255, 0.2));
}

@keyframes windGust {
    0% {
        transform: translateX(-300px);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateX(calc(100vw + 300px));
        opacity: 0;
    }
}

@keyframes floatY {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(var(--float-amount, -30px));
    }
}

@keyframes rotateGust {
    0% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(var(--rot-amount, 5deg));
    }

    100% {
        transform: rotate(0deg);
    }
}

/* Clue Buttons (Tags) */
.clue-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    width: 100%;
}

.clue-container h2 {
    font-family: var(--font-hand);
    font-size: 2.2rem;
    color: var(--accent-color);
    margin-bottom: 30px;
    text-shadow: 2px 2px 0 #fff;
    transform: rotate(-5deg);
}

.clue-btn {
    position: relative;
    width: 180px;
    height: 60px;
    /* Slightly taller */
    background: #fff;
    border: 2px solid #e6c3c3;
    /* Soft pink border */
    border-radius: 12px;
    /* Rounded card look */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0 15px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy hover */
    transform-origin: center;
    overflow: hidden;
    /* Contain inner glows */
}

/* REMOVED ::before and ::after (Vertical Line & Dot) */


.clue-btn:hover {
    transform: rotate(3deg) scale(1.05);
    background: #fff0f5;
    box-shadow: 0 8px 20px rgba(212, 165, 165, 0.4);
}

.clue-btn .wax-seal {
    width: 30px;
    height: 30px;
    background: #d4a5a5;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-family: var(--font-serif);
    font-weight: bold;
    font-size: 1rem;
    margin-right: 15px;
    box-shadow: inset 0 -2px 5px rgba(0, 0, 0, 0.1), 1px 1px 3px rgba(0, 0, 0, 0.2);
    border: 2px solid #fff;
}

.clue-btn .label {
    font-family: var(--font-typewriter);
    font-size: 1.1rem;
    color: var(--text-color);
}

/* Postcard/Views */
.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 5px;
    font-family: var(--font-typewriter);
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-color);
    z-index: 100;
    padding: 10px 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.back-btn:hover {
    background: #fff;
}

.postcard-container,
.scroll-container,
.date-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.postcard {
    width: 600px;
    height: 400px;
    background: #fdfbf7;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: rotate(-2deg);
    padding: 20px;
    display: flex;
    position: relative;
    border: 1px solid #e0e0e0;
}

.postcard-front {
    width: 100%;
    height: 100%;
    border-right: 1px solid #ddd;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-image: radial-gradient(circle, #f0f0f0 1px, transparent 1px);
    background-size: 10px 10px;
}

.postcard-title {
    font-family: var(--font-hand);
    font-size: 3rem;
    color: var(--accent-color);
    margin-bottom: 20px;
}

.postcard-text {
    font-family: var(--font-typewriter);
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 80%;
}

.stamp {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 80px;
    height: 90px;
    border: 2px dashed #ccc;
    background: #e6e6e6;
}

.postmark {
    position: absolute;
    top: 30px;
    right: 80px;
    width: 100px;
    height: 100px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    transform: rotate(-15deg);
}

/* Polaroid Frame */
.polaroid-frame {
    background: #fff;
    padding: 15px 15px 40px 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    transform: rotate(-2deg);
    margin-bottom: 20px;
    transition: transform 0.3s ease;
    width: 250px;
    flex-shrink: 0;
    z-index: 10;
}

.polaroid-frame:hover {
    transform: rotate(0deg) scale(1.05);
    z-index: 15;
}

.polaroid-img {
    width: 100%;
    height: 200px;
    background: #eee;
    object-fit: cover;
    border: 1px solid #ccc;
}

.polaroid-caption {
    font-family: var(--font-hand);
    font-size: 1.2rem;
    color: #555;
    margin-top: 15px;
    text-align: center;
}

/* Scroll View */
.paper-scroll {
    background: #fffdf5;
    padding: 40px;
    width: 400px;
    min-height: 500px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    border-radius: 5px;
    position: relative;
    transform: rotate(1deg);
}

.paper-scroll::before,
.paper-scroll::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 20px;
    background: #e8e1d5;
    border-radius: 10px;
}

.paper-scroll::before {
    top: -10px;
}

.paper-scroll::after {
    bottom: -10px;
}

.scroll-title {
    font-family: var(--font-serif);
    font-size: 2rem;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--accent-color);
    display: inline-block;
}

.scroll-text {
    font-family: var(--font-hand);
    font-size: 1.5rem;
    line-height: 1.5;
}

/* Footer Dock Container - Holds Badge & Player */
#footer-dock {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    z-index: 10000;
    pointer-events: none;
    /* Let clicks pass through empty areas if any */
}

/* Footer Badge Styles - Restored Handwritten Font */
.footer-badge {
    position: relative;
    /* Static within flex container */
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-family: var(--font-hand);
    /* Restored */
    font-size: 1.5rem;
    /* Restored size */
    color: var(--accent-color);
    /* Restored size */
    color: var(--accent-color);
    /* transform: rotate(-2deg); REMOVED per feedback - Straighten tag */
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.85);
    /* Slight background for readability */
    backdrop-filter: blur(4px);
    padding: 5px 0;
    margin-bottom: -5px;
    /* Slight overlap with player */
    z-index: 2;
    border-radius: 15px 15px 0 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.footer-badge .badge-text {
    font-size: 1.4rem;
    /* Specific size */
}

.footer-badge .badge-icon {
    font-size: 1.6rem;
    animation: pulse 2s infinite;
}

/* Music Player — Styled & Stacked */
#custom-music-player {
    position: relative;
    /* Static within flex container */
    width: 100%;
    max-width: 100%;
    padding: 10px 15px;
    gap: 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center the inner content container */
}

/* Container for controls to ensure they are centered and horizontal */
#custom-music-player .player-content-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 600px;
    /* Limit width on large screens for aesthetics */
}

/* REINFORCED BUTTON STYLES - Ensure specificity */
#custom-music-player .control-btn {
    background: rgba(255, 182, 193, 0.2);
    border: 1px solid rgba(255, 182, 193, 0.4);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--accent-color);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

#custom-music-player .control-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 182, 193, 0.4);
}

#custom-music-player .control-btn:active {
    transform: scale(0.95);
}

/* Cuter Control Buttons */
.control-btn {
    background: rgba(255, 182, 193, 0.2);
    /* Soft pink bg */
    border: 1px solid rgba(255, 182, 193, 0.4);
    border-radius: 50%;
    /* Round */
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--accent-color);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.control-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 182, 193, 0.4);
}

.control-btn:active {
    transform: scale(0.95);
}

.badge-icon {
    font-size: 2rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* --- Magic Particles: Falling Sakura Petals 🌸 --- */
/* Legacy falling petal CSS removed in favor of Canvas */

/* --- RESPONSIVE DESIGN --- */
/* Major Breakpoint: Switch to Vertical Layout for Tablets and Mobile */
@media (max-width: 1080px) {

    /* Stack Layout */
    .tree-layout {
        flex-direction: column;
    }

    .tree-section {
        flex: auto;
        height: 60vh;
        width: 100%;
    }

    #intro h1 {
        font-size: 2.2rem;
        /* reduced from 3rem for better fit */
        margin-top: 60px;
        /* Prevent overlap with fixed Our Story button */
    }

    #intro p {
        font-size: 1.1rem;
    }

    #intro {
        margin-bottom: 5vh;
    }

    /* ALLOW SCROLLING ON MOBILE */
    body {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Sidebar at Bottom */
    .sidebar-section {
        flex: 1;
        width: 100%;
        border-left: none;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        padding-top: 20px;
        overflow-x: hidden;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding-bottom: 170px;
        background: transparent;
    }

    .clue-container {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        /* Auto-fit grid */
        gap: 15px;
        padding: 10px 20px;
        width: 100%;
        max-width: 600px;
        /* Readability constraint */
    }

    .clue-container h2 {
        display: none;
    }

    .clue-btn {
        width: 100%;
        /* Fill grid cell */
        min-width: auto;
        height: 60px;
        /* Larger touch target */
        flex-shrink: 0;
        transform: none !important;
        margin-bottom: 0;
        justify-content: center;
        /* Center content */
    }

    .clue-btn::before {
        display: none;
    }

    .clue-btn .wax-seal {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
        margin-right: 10px;
    }

    .clue-btn .label {
        font-size: 1rem;
        text-align: left;
    }

    /* View Scaling - Ensure footer doesn't cover content */
    .postcard,
    .paper-scroll,
    .date-card {
        width: 90%;
        max-width: 500px;
        height: auto;
        min-height: 60vh;
        padding: 20px;
        padding-bottom: 80px;
        transform: none !important;
        margin: 0 auto;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    .postcard-front {
        padding: 20px;
    }


    /* REINSTATED LAYOUT RULES - Crucial for Tree Visibility */
    .tree-layout {
        flex-direction: column;
    }

    .tree-section {
        flex: auto;
        height: 60vh;
        /* Ensure non-zero height on mobile */
        width: 100%;
    }

    /* Bottom padding so content isn't hidden behind stacked dock */
    /* Reduced bottom padding to prevent huge gaps */
    .story-timeline,
    .tree-section {
        padding-bottom: 80px;
    }
}

/* Small Mobile Adjustments */
@media (max-width: 400px) {
    .clue-container {
        grid-template-columns: 1fr;
        /* Stack vertically */
        max-width: 100%;
    }

    #intro h1 {
        font-size: 2.2rem;
    }

    .tree-section {
        height: 70vh;
        min-height: 600px;
        /* Force minimum space (User wanted BIGGER) */
        flex: 1;
        display: flex;
        align-items: flex-end;
        /* FIX: Use flex-start or safe center to avoid cropping top */
        justify-content: flex-end;
        position: relative;
        /* FIX: Allow overflow so tree isn't clipped if 600px > screen */
        overflow: visible;
    }

    #treeCanvas {
        width: 100%;
        height: 100%;
        min-height: 600px;
        /* Ensure Canvas has size even if parent fails */
        display: block;
    }
}


/* --- HINTS FEATURE --- */
.hint-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: 2px dashed #ccc;
    padding: 8px 15px;
    border-radius: 20px;
    font-family: var(--font-typewriter);
    cursor: pointer;
    margin-top: 20px;
    color: #888;
    transition: all 0.3s;
}

.hint-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: #fff8f8;
}

.hints-container {
    width: 100%;
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.hint-card {
    background: #fff;
    padding: 10px;
    border: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    font-family: var(--font-hand);
    font-size: 1.1rem;
    width: 90%;
    text-align: center;
    animation: fadeIn 0.5s;
    position: relative;
}

.hint-card::before {
    content: '💡';
    position: absolute;
    top: -10px;
    left: -10px;
    font-size: 1.2rem;
}

.hint-card img {
    max-width: 100px;
    border: 3px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: rotate(-2deg);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tree Instruction Styles */
#tree-instruction {
    position: absolute;
    bottom: 140px;
    /* MOVED UP above footer */
    left: 0;
    width: 100%;
    text-align: center;
    font-family: var(--font-typewriter);
    font-size: 1.1rem;
    color: #000;
    /* BLACK TEXT */
    opacity: 0;
    /* Hidden initially */
    pointer-events: none;
    transition: opacity 2s ease;
    z-index: 50;
    /* Above footer elements */
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8);
    font-weight: bold;
}

/* Password Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #fffafa;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: popIn 0.3s ease;
    font-family: var(--font-body);
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.lock-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.modal h2 {
    font-family: var(--font-title);
    color: var(--accent-color);
    margin-bottom: 15px;
}

.modal p {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

#password-input {
    width: 100%;
    padding: 10px;
    font-size: 1rem;
    border: 2px solid #eee;
    border-radius: 5px;
    margin-bottom: 10px;
    outline: none;
    text-align: center;
}

#password-input:focus {
    border-color: var(--accent-color);
}

/* Holo Effect Animation */
@keyframes holo-glow {
    0% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.5), 0 0 20px rgba(255, 0, 255, 0.3);
    }

    50% {
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.8), 0 0 40px rgba(0, 255, 255, 0.6);
        transform: scale(1.1);
    }

    100% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.5), 0 0 20px rgba(255, 0, 255, 0.3);
    }
}

@keyframes holo-border {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

#our-story-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: #fff;
    border: none;
    border-radius: 9999px;
    padding: 12px 24px;
    font-family: var(--font-hand);
    font-size: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    /* overflow: hidden; */
    /* Conflict with glow? No */
}

/* Cute & Pretty Button Style */
#our-story-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    background: transparent;
    /* Handled by ::after */
    color: #fff;
    border: none;
    border-radius: 9999px;
    padding: 12px 24px;
    font-family: var(--font-hand);
    font-size: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* The Soft Glowing Border */
#our-story-btn::before {
    content: "";
    position: absolute;
    inset: -3px;
    /* Slightly larger for border */
    z-index: -2;
    /* Soft Pastel Gradient */
    background: linear-gradient(45deg, #ff9a9e, #fecfef, #f6d365, #fda085, #ff9a9e);
    background-size: 300% 300%;
    border-radius: 9999px;
    animation: pastel-flow 6s ease infinite, soft-pulse 2s ease-in-out infinite alternate;
}

/* The Inner Background (Glassy) */
#our-story-btn::after {
    content: "";
    position: absolute;
    inset: 1px;
    /* Cover the center, leave border visible */
    z-index: -1;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    border-radius: 9999px;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.5);
}

@keyframes pastel-flow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes soft-pulse {
    0% {
        box-shadow: 0 0 10px rgba(255, 182, 193, 0.5);
        transform: scale(1);
    }

    100% {
        box-shadow: 0 0 20px rgba(255, 223, 186, 0.8), 0 0 10px rgba(255, 182, 193, 0.6);
        transform: scale(1.02);
    }
}

#unlock-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 20px;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s;
}

#unlock-btn:hover {
    transform: scale(1.05);
}

#password-error {
    color: #d9534f;
    font-size: 0.9rem;
    margin-top: -5px;
    margin-bottom: 10px;
    animation: shake 0.4s ease-in-out;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #aaa;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.clue-btn.locked {
    opacity: 0.9;
}

.clue-btn.locked .wax-seal {
    background: #555 !important;
}

/* Our Story Feature - Magical Button */
#our-story-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--accent-color);
    border-radius: 30px;
    padding: 10px 20px;
    font-family: var(--font-hand);
    font-size: 1.2rem;
    color: var(--accent-color);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: pulseBtn 3s infinite;
}

@keyframes pulseBtn {
    0% {
        box-shadow: 0 0 0 0 rgba(212, 165, 165, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(212, 165, 165, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(212, 165, 165, 0);
    }
}

#our-story-btn:hover {
    transform: scale(1.05) translateY(-2px);
    background: #fff;
    box-shadow:
        0 10px 20px rgba(212, 165, 165, 0.4),
        0 0 15px rgba(255, 215, 0, 0.2);
    /* Gold glow */
}


#our-story-btn .icon {
    font-size: 1.4rem;
}

/* Story View */
#story-view {
    background: linear-gradient(135deg, #1a0b2e 0%, #4a1c40 100%);
    color: #fff;
    /* overflow-y: auto; Removed - inherited from .view */
    /* position: relative; Removed - inherited absolute from .view */
}

.stars-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image:
        radial-gradient(2px 2px at 20px 30px, #eee, rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 40px 70px, #fff, rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 50px 160px, #ddd, rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 90px 40px, #fff, rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 130px 80px, #fff, rgba(0, 0, 0, 0));
    background-repeat: repeat;
    background-size: 200px 200px;
    animation: twinkle 5s infinite linear;
    opacity: 0.3;
}

@keyframes twinkle {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-200px);
    }
}

.story-content-wrapper {
    width: 100%;
    max-width: 1600px;
    /* Widen container heavily */
    z-index: 2;
    position: relative;
    padding-bottom: 120px;
    /* Space for footer */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- ZIG-ZAG TIMELINE for Our Story --- */
.story-timeline {
    position: relative;
    width: 100%;
    /* FORCE WIDTH */
    max-width: 1400px;
    /* WIDENED from 900px */
    margin: 0 auto;
    padding: 40px 20px;
}

/* Central Line */
.story-timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background: rgba(255, 215, 0, 0.3);
    transform: translateX(-50%);
    border-radius: 2px;
}

.timeline-item {
    position: relative;
    width: 100%;
    margin-bottom: 60px;
    display: flex;
    justify-content: center;
    opacity: 0;
    /* Animated in via JS */
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.timeline-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline-content {
    width: 48%;
    /* WIDENED from 45% */
    position: relative;
}

/* Zig-Zag Logic */
.timeline-item:nth-child(odd) {
    justify-content: flex-start;
    /* Left side */
}

.timeline-item:nth-child(even) {
    justify-content: flex-end;
    /* Right side */
}

.timeline-item:nth-child(odd) .timeline-content {
    margin-right: 51%;
    /* Reduced gap from 55% */
    /* Push to left */
    text-align: right;
}

.timeline-item:nth-child(even) .timeline-content {
    margin-left: 51%;
    /* Reduced gap from 55% */
    /* Push to right */
    text-align: left;
}

/* Connector Dot */
.timeline-item::after {
    content: '♥';
    /* Cute heart dot */
    position: absolute;
    left: 50%;
    top: 20px;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    background: #fff;
    border: 2px solid gold;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    z-index: 2;
    font-size: 0.8rem;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

/* Mobile Zig-Zag Adjustments */
@media (max-width: 768px) {
    .story-timeline::before {
        left: 20px;
        /* Move line to left */
    }

    .timeline-item {
        justify-content: flex-end !important;
        /* Always align content to right */
        padding-left: 40px;
    }

    .timeline-item:nth-child(odd) .timeline-content,
    .timeline-item:nth-child(even) .timeline-content {
        width: 100%;
        margin: 0;
        text-align: left;
    }

    .timeline-item::after {
        left: 20px;
        /* Move dot to line */
    }
}

.story-header {
    text-align: center;
    margin-bottom: 60px;
    animation: fadeIn 1s ease;
}

.story-header h1 {
    font-family: var(--font-title);
    font-size: 3.5rem;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 100, 0.5);
    margin-bottom: 10px;
}

.story-header p {
    font-family: var(--font-typewriter);
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
}

.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 60px;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    width: 100%;
}

.story-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.story-text-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    padding: 25px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.story-date {
    font-family: var(--font-typewriter);
    color: #ffd700;
    margin-bottom: 5px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.story-title {
    font-family: var(--font-hand);
    font-size: 2rem;
    margin-bottom: 15px;
    color: #fff;
}

.story-desc {
    font-family: var(--font-typewriter);
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
}

.story-polaroid {
    background: #fff;
    padding: 15px 15px 50px 15px;
    transform: rotate(-2deg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 300px;
    width: 90%;
    transition: transform 0.3s ease;
}

.story-polaroid:hover {
    transform: rotate(0deg) scale(1.02);
    z-index: 10;
}

.story-polaroid img {
    width: 100%;
    height: auto;
    border: 1px solid #ddd;
    display: block;
}

.story-polaroid .caption {
    font-family: var(--font-hand);
    color: #333;
    text-align: center;
    margin-top: 15px;
    font-size: 1.4rem;
}

.story-music {
    animation: fadeInUp 1s ease 0.5s backwards;
    text-align: center;
}

.spotify-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(45deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
    /* Pink/Gold Theme */
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    text-decoration: none;
    font-family: var(--font-body);
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(255, 154, 158, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.spotify-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 154, 158, 0.6);
}

/* --- Magical Overhaul: Light Magic Redesign ✨ --- */
/* Body styles handled via :root vars at top of file */

/* --- Cute Floating Cloud Player (Light Mode) ☁️ --- */



/* Vinyl/Orb (now Cute Icon) */
.vinyl-record {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    /* Pastel Pink Gradient */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(255, 105, 180, 0.3);
    animation: pulseRecord 3s infinite ease-in-out;
    position: relative;
}

.vinyl-grooves {
    display: none;
    /* Hide for cute icon look */
}

.vinyl-label {
    font-size: 1.5rem;
    color: #fff;
    z-index: 2;
}

/* Player Controls (Light Theme) */
.player-controls {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}




/* Sparkle Trail Effect */
.sparkle {
    position: fixed;
    width: 4px;
    height: 4px;
    background: #ffd700;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 10px #ffd700, 0 0 20px #fff;
    animation: sparkleAnim 1s ease-out forwards;
    z-index: 9998;
}

@keyframes sparkleAnim {
    0% {
        transform: scale(0) translate(0, 0);
        opacity: 1;
    }

    100% {
        transform: scale(1.5) translate(var(--tx), var(--ty));
        opacity: 0;
    }
}

/* Magical Particles (Fireflies) - Global */
.firefly {
    position: fixed;
    left: 50%;
    top: 50%;
    width: 4px;
    height: 4px;
    margin: -2px 0 0 -2px;
    pointer-events: none;
    border-radius: 50%;
    background: rgba(255, 215, 0, 0.8);
    /* Golden glow */
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
    animation: drift 10s alternate infinite;
    z-index: 1;
    /* Behind content but above bg */
}

.firefly::before,
.firefly::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    transform-origin: -10vw;
}

.firefly::before {
    background: rgba(255, 255, 255, 0.4);
    opacity: 0.4;
    animation: drift 10s alternate infinite;
}

.firefly::after {
    background: rgba(255, 255, 255, 0.4);
    opacity: 0.4;
    animation: drift 10s alternate infinite;
    animation-delay: -5s;
}

@keyframes drift {
    100% {
        transform: rotate(360deg);
        opacity: 0;
    }
}

@keyframes floatParticle {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-10vh) scale(1.5);
        opacity: 0;
    }
}

/* 3D Tilt Effect for Photos */
.tilt-effect {
    transition: transform 0.1s;
    /* Faster for tilt */
    transform-style: preserve-3d;
}

.vinyl-record.spinning {
    animation: spin 4s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

.vinyl-grooves {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 2px solid #333;
    border-radius: 50%;
}

.vinyl-label {
    font-size: 1.2rem;
    z-index: 2;
}

.player-controls {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

/* --- Constellation Journey Redesign --- */
/* The previous #story-timeline and .story-item rules were removed here */

/* Glassmorphism Card - Cinematic */
.story-text-card {
    width: 100%;
    /* Fill the 85% container */
    background: rgba(255, 255, 255, 0.03);
    /* Extremely subtle glass */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 20px;
    /* Softer corners */
    padding: 40px 50px;
    box-shadow:
        0 15px 40px rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    /* Inner rim */
    color: #f0f0f0;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    position: relative;
    overflow: visible;
    /* Allow flourishes outside */
}

.story-text-card:hover {
    transform: translateY(-5px);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(255, 215, 0, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

/* Cinematic Typography */
.story-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 3.5rem;
    /* Huge, cinematic title */
    font-weight: 500;
    background: linear-gradient(135deg, #fff 0%, #ffd700 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.story-date {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(255, 215, 0, 0.8);
    margin-bottom: 10px;
    display: block;
}

.story-desc {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 300;
}

/* Image Handling — True Polaroid Frame 📸 */
.story-polaroid {
    position: relative;
    background: #fff;
    padding: 15px 15px 60px 15px;
    transform: rotate(-2deg);
    max-width: 400px;
    margin: 10px auto;
    border-radius: 4px;
    overflow: visible;
    border: none;
    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.35),
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 0 40px rgba(0, 0, 0, 0.02);
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.story-polaroid:hover {
    transform: rotate(0deg) scale(1.04);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.45),
        0 5px 15px rgba(0, 0, 0, 0.2);
}

.story-polaroid img {
    display: block;
    width: 100%;
    border: 1px solid #eee;
}

.story-polaroid .caption {
    font-family: var(--font-hand);
    color: #5d4037;
    text-align: center;
    margin-top: 12px;
    font-size: 1.3rem;
    letter-spacing: 0.5px;
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
}

/* --- Magic Ripple Effect --- */
.magic-ripple {
    position: fixed;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.6) 0%, rgba(255, 182, 193, 0.4) 100%);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: rippleExpand 0.8s ease-out forwards;
    z-index: 9999;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

@keyframes rippleExpand {
    0% {
        width: 10px;
        height: 10px;
        opacity: 1;
    }

    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    #story-timeline::before {
        left: 20px;
    }

    .story-item {
        width: auto;
        margin-left: 60px;
        /* Clear the line */
        margin-right: 20px;
        margin-bottom: 80px;
    }

    .story-item::after {
        left: -53px;
        /* Re-align star to line */
    }

    .story-item::before {
        left: -52px;
    }

    .story-text-card {
        padding: 25px 20px;
    }

    .story-title {
        font-size: 2.2rem;
    }
}

/* Mobile "No Scroll" Optimization - REVERTED & FIXED */
@media (max-width: 480px) {

    html,
    body {
        /* Revert to hidden to prevent double scrollbars */
        overflow: hidden !important;
        height: 100%;
    }

    /* FORCE CANVAS TO FILL CONTAINER */
    #treeCanvas {
        width: 100%;
        height: 100%;
        display: block;
    }

    .tree-layout {
        /* Allow content to grow */
        height: auto;
        min-height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        /* Ensure not clipped */
        overflow: visible;
    }

    /* Fix Overlap on Mobile */
    .story-content-wrapper {
        padding-top: 70px;
    }

    #intro {
        flex: 0 0 auto;
        margin-bottom: 0.5rem;
        padding-top: max(1rem, env(safe-area-inset-top));
    }

    #intro h1 {
        font-size: 1.8rem;
        margin-bottom: 0;
    }

    #intro p {
        font-size: 0.9rem;
        margin-bottom: 0;
    }

    .tree-section {
        flex: 1 1 auto;
        /* Grow to fill available space */
        height: auto;
        width: 100%;
        overflow: visible;
        display: flex;
        align-items: flex-end;
        padding-bottom: 0;
    }

    .sidebar-section {
        flex: 0 0 auto;
        width: 100%;
        border: none;
        padding-top: 5px;
        padding-bottom: 120px;
        /* Enhanced space for stacked dock */
        background: transparent;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
    }

    .clue-container {
        padding: 5px 15px;
        gap: 8px;
        grid-template-columns: 1fr 1fr;
        /* 2x2 grid */
        max-width: 100%;
    }

    .clue-btn {
        height: 48px;
        font-size: 0.9rem;
        padding: 0 5px;
    }

    /* Hide scrollbars */
    ::-webkit-scrollbar {
        display: none;
    }
}

/* FORCE OVERRIDE FOR MOBILE OVERLAP */
@media screen and (max-width: 768px) {
    .story-content-wrapper {
        padding-top: 100px !important;
    }

    .back-btn {
        z-index: 9999 !important;
        background: rgba(255, 255, 255, 0.95) !important;
    }
}