:root {
    --bg-color: #0f172a;
    --star-color: #fbbf24;
    --light-1: #ff3b30;
    --light-2: #ffcc00;
    --light-3: #4cd964;
    --light-4: #5ac8fa;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: radial-gradient(circle at bottom, #1e293b 0%, #0f172a 100%);
    font-family: 'Mountains of Christmas', cursive;
}

/* --- Night Sky & Stars --- */
.night-sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0.8;
    animation: twinkle 3s infinite ease-in-out;
}

@keyframes twinkle {

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

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

/* --- Main Scene --- */
.scene-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 10;
    padding-bottom: 20px;
}

/* --- Tree & Lights --- */
/* --- Tree & Lights --- */
.tree-container {
    position: relative;
    width: 600px;
    /* Much larger tree */
    max-width: 90vw;
    z-index: 20;
    margin-bottom: -50px;
    /* Pull bottom elements up slightly */
    display: flex;
    justify-content: center;
}

.tree-img {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.5));
}

/* The Shining Star on Top */
.star-glow {
    position: absolute;
    top: 0%;
    /* Adjusted for larger tree */
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    /* Larger glow */
    height: 60px;
    background: radial-gradient(circle, #fff 10%, #ffcc00 60%, transparent 70%);
    border-radius: 50%;
    box-shadow: 0 0 30px #ffcc00, 0 0 60px #ffcc00;
    animation: starPulse 2s infinite alternate;
    z-index: 25;
}

.star-glow::before {
    /* Star shape core */
    content: '★';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffd700;
    font-size: 45px;
    /* Larger star */
    text-shadow: 0 0 10px #fff;
}

@keyframes starPulse {
    from {
        transform: translateX(-50%) scale(1);
        filter: brightness(1);
    }

    to {
        transform: translateX(-50%) scale(1.2);
        filter: brightness(1.3);
    }
}

/* Random lights positioning container */
.lights-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.light {
    position: absolute;
    width: 12px;
    /* Slight larger lights for bigger tree */
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 5px currentColor;
    animation: lightFlash 1.5s infinite alternate;
}

@keyframes lightFlash {
    0% {
        opacity: 0.4;
        transform: scale(0.8);
    }

    100% {
        opacity: 1;
        transform: scale(1.2);
        box-shadow: 0 0 15px currentColor;
    }
}

/* --- Manger (Pesebre) --- */
.manger-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    /* Center horizontally relative to scene */
    transform: translateX(-20%);
    /* Tune to be "Next" to trunk, maybe slightly left or right. User said "al lado del tronco". */
    width: 80px;
    /* Smaller */
    opacity: 0.9;
    z-index: 10;
    /* Lower than tree (20) so branches cover it */
    transition: opacity 0.5s;
}

.manger-container:hover {
    opacity: 1;
    transform: translateX(-20%) scale(1.05);
}

.manger-img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(255, 200, 100, 0.3));
}

/* --- Sleigh Animation --- */
.sleigh-container {
    position: absolute;
    top: 15%;
    /* Sky level */
    left: -300px;
    /* Start off-screen */
    width: 200px;
    z-index: 5;
    /* Animation will be handled by JS to manage classes and reset */
}

.sleigh-img {
    width: 100%;
    height: auto;
    transform: rotate(-5deg);
    /* Slight tilt up */
}

/* Magic Trail */
.trail {
    position: absolute;
    top: 50%;
    right: 0;
    width: 100px;
    /* Length of trail */
    height: 2px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.8));
    transform-origin: right center;
    transform: translateY(10px) rotate(-5deg);
    box-shadow: 0 0 10px white, 0 0 20px gold;
    opacity: 0;
    transition: opacity 0.5s;
}

.flying .trail {
    opacity: 0.8;
}

/* Animation Classes */
.fly-across {
    animation: flyPass 15s linear forwards;
    /* Slow pass */
}

@keyframes flyPass {
    0% {
        transform: translateX(0) translateY(0);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateX(calc(100vw + 400px)) translateY(-50px);
        opacity: 0;
    }
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    /* Blur effect */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.8s ease-out;
}

.modal-content {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 215, 0, 0.5);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 80%;
    width: 400px;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.2);
    color: #fff;
    transform: scale(1);
    transition: transform 0.3s;
}

.modal-content h1 {
    font-size: 2.5rem;
    color: #ffcc00;
    margin-top: 0;
    font-family: 'Playfair Display', serif;
    /* Elegant font */
    text-shadow: 0 0 10px rgba(255, 204, 0, 0.5);
    letter-spacing: 1px;
}

.modal-content p {
    font-size: 1.2rem;
    line-height: 1.6;
    font-family: 'Lato', sans-serif;
    /* Legible font */
    font-weight: 400;
}

#start-btn {
    background: linear-gradient(45deg, #ff3b30, #ff0000);
    border: none;
    padding: 12px 30px;
    color: white;
    font-family: 'Lato', sans-serif;
    /* Legible button */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 0 20px rgba(255, 59, 48, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

#start-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(255, 59, 48, 0.6);
}

.modal-hidden {
    opacity: 0;
    pointer-events: none;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .tree-container {
        width: 90vw;
        /* Full width on mobile */
        margin-bottom: -30px;
    }

    .star-glow {
        width: 40px;
        height: 40px;
    }

    .star-glow::before {
        font-size: 30px;
    }

    .manger-container {
        width: 60px;
        /* Even smaller on mobile */
        transform: translateX(-10%);
        /* Adjust centering close to trunk */
        bottom: 10px;
    }

    .modal-content h1 {
        font-size: 2rem;
    }

    .modal-content p {
        font-size: 1rem;
    }
}

/* --- Looping Message --- */
#message-container {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 30;
    pointer-events: none;
    transition: opacity 1s, transform 1s;
    text-align: center;
    width: 100%;
}

.christmas-msg {
    font-size: 5rem;
    color: #ffd700;
    /* Gold */
    text-shadow: 0 0 20px #ff0000, 0 0 40px #ff3b30;
    margin: 0;
    font-family: 'Mountains of Christmas', cursive;
    letter-spacing: 5px;
    animation: pulseMsg 2s infinite;
}

.message-hidden {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.8);
    /* Slight drop and shrink */
}

.message-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

@keyframes pulseMsg {

    0%,
    100% {
        transform: scale(1);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.1);
        filter: brightness(1.2);
    }
}

@media (max-width: 768px) {
    .christmas-msg {
        font-size: 3rem;
        /* Smaller on mobile */
    }
}