@import url('https://fonts.googleapis.com/css2?family=Pacifico&family=Quicksand:wght@300;700&display=swap');

:root {
    --neon-red: #ff3131;
    --neon-green: #39ff14;
    --neon-gold: #ffd700;
    --bg-color: #1f1f1f;
}

body {
    background-color: var(--bg-color);
    color: #fff;
    font-family: 'Quicksand', sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
    text-align: center;
}

h1.neon-title {
    font-family: 'Pacifico', cursive;
    font-size: 3.5rem;
    margin: 20px 0;
    color: #fff;
    text-shadow:
        0 0 5px #fff,
        0 0 10px #fff,
        0 0 20px var(--neon-red),
        0 0 40px var(--neon-red),
        0 0 80px var(--neon-red);
    animation: flicker 2s infinite alternate;
}

h2.neon-subtitle {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.5rem;
    color: #fff;
    text-shadow:
        0 0 5px #fff,
        0 0 10px var(--neon-green),
        0 0 20px var(--neon-green),
        0 0 40px var(--neon-green);
    margin-bottom: 40px;
}

.tree-container {
    position: relative;
    width: 200px;
    height: 300px;
    margin: 0 auto;
    margin-top: 30px;
}

.neon-tree {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: var(--neon-green);
    stroke-width: 5;
    stroke-linecap: round;
    filter: drop-shadow(0 0 5px var(--neon-green)) drop-shadow(0 0 10px var(--neon-green));
    animation: glow-green 1.5s ease-in-out infinite alternate;
}

.star {
    fill: var(--neon-gold);
    stroke: var(--neon-gold);
    filter: drop-shadow(0 0 5px var(--neon-gold)) drop-shadow(0 0 15px var(--neon-gold));
    animation: glow-gold 1.5s ease-in-out infinite alternate;
}

/* Animations */
@keyframes flicker {

    0%,
    19%,
    21%,
    23%,
    25%,
    54%,
    56%,
    100% {
        opacity: 1;
        text-shadow:
            0 0 5px #fff,
            0 0 10px #fff,
            0 0 20px var(--neon-red),
            0 0 40px var(--neon-red),
            0 0 80px var(--neon-red);
    }

    20%,
    24%,
    55% {
        opacity: 0.5;
        text-shadow: none;
    }
}

@keyframes glow-green {
    from {
        filter: drop-shadow(0 0 2px var(--neon-green)) drop-shadow(0 0 5px var(--neon-green));
    }

    to {
        filter: drop-shadow(0 0 5px var(--neon-green)) drop-shadow(0 0 20px var(--neon-green));
    }
}

@keyframes glow-gold {
    from {
        filter: drop-shadow(0 0 2px var(--neon-gold)) drop-shadow(0 0 5px var(--neon-gold));
        transform: scale(1) translateX(-50%);
    }

    to {
        filter: drop-shadow(0 0 5px var(--neon-gold)) drop-shadow(0 0 20px var(--neon-gold));
        transform: scale(1.5) translateX(-32%);
    }
}

/* Snowfall Effect (Simple) */
.snowflake {
    position: fixed;
    top: -10px;
    color: #fff;
    font-size: 1em;
    font-family: Arial;
    text-shadow: 0 0 1px #000;
    user-select: none;
    z-index: -1;
    animation-name: snowflakes-fall, snowflakes-shake;
    animation-duration: 10s, 3s;
    animation-timing-function: linear, ease-in-out;
    animation-iteration-count: infinite, infinite;
    animation-play-state: running, running;
}

@keyframes snowflakes-fall {
    0% {
        top: -10%
    }

    100% {
        top: 100%
    }
}

@keyframes snowflakes-shake {
    0% {
        transform: translateX(0px)
    }

    50% {
        transform: translateX(80px)
    }

    100% {
        transform: translateX(0px)
    }
}

.snowflake:nth-of-type(0) {
    left: 1%;
    animation-delay: 0s, 0s
}

.snowflake:nth-of-type(1) {
    left: 10%;
    animation-delay: 1s, 1s
}

.snowflake:nth-of-type(2) {
    left: 20%;
    animation-delay: 6s, .5s
}

.snowflake:nth-of-type(3) {
    left: 30%;
    animation-delay: 4s, 2s
}

.snowflake:nth-of-type(4) {
    left: 40%;
    animation-delay: 2s, 2s
}

.snowflake:nth-of-type(5) {
    left: 50%;
    animation-delay: 8s, 3s
}

.snowflake:nth-of-type(6) {
    left: 60%;
    animation-delay: 6s, 2s
}

.snowflake:nth-of-type(7) {
    left: 70%;
    animation-delay: 2.5s, 1s
}

.snowflake:nth-of-type(8) {
    left: 80%;
    animation-delay: 1s, 0s
}

.snowflake:nth-of-type(9) {
    left: 90%;
    animation-delay: 3s, 1.5s
}

/* Layout Animation Styles */
body {
    display: flex;
    /* Ensure body works as a flex container/centering wrapper if needed */
    justify-content: center;
    align-items: center;
    /* overflow: hidden;  Keep overflow hidden to avoid scrollbars during animation if possible */
}

.layout-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    /* Constrain max width */
    height: 100vh;
    transition: all 5s ease-in-out;
}

.main-wrapper {
    flex: 1;
    /* Take up full space initially */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 5s ease-in-out;
    width: 100%;
    will-change: flex, max-height, opacity;
}

/* Performance Fix: Stop expensive animations during layout shift */
/* Only pause the moving parts, DONT remove the glow/shadows or it looks like it disappears */
.layout-container.animated .neon-title,
.layout-container.animated .neon-subtitle,
.layout-container.animated .neon-tree,
.layout-container.animated .star,
.layout-container.animated .snowflake {
    animation-play-state: paused !important;
}

/* State when animation triggers */
.layout-container.animated .main-wrapper {
    flex: 0 0 40%;
    /* Shrink to 40% width */
    transform: scale(0.8);
    /* Slightly shrink visually */
}

.wishes-container {
    flex: 0 0 0;
    /* Start with 0 width */
    width: 0;
    opacity: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Center text */
    text-align: center;
    color: #fff;
    transition: all 1.5s ease-in-out;
    padding: 0;
}

.layout-container.animated .wishes-container {
    flex: 0 0 60%;
    /* Grow to 60% */
    width: 60%;
    opacity: 1;
    padding: 20px;
}

.wishes-text {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.5rem;
    line-height: 1.6;
    max-width: 600px;
}

/* Mobile Optimizations */
@media (max-width: 800px) {
    .layout-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .main-wrapper {
        margin-bottom: 20px;
        max-height: 100vh;
        /* Allow it to have height */
        transition: all 2s ease-in-out;
    }

    .layout-container.animated .main-wrapper {
        /* Disappear completely on mobile using max-height trick */
        max-height: 0;
        opacity: 0;
        margin: 0;
        padding: 0;
        overflow: hidden;
        /* Ensure width stays 100% so text doesn't clip horizontally */
        width: 100%;
        flex: 0 0 auto;
    }

    .layout-container.animated .wishes-container {
        flex: 1;
        width: 100%;
        padding: 20px;
        opacity: 1;
        /* Ensure it takes full focus */
        display: flex;
        justify-content: center;
        align-items: center;
    }

    h1.neon-title {
        font-size: 2.5rem;
    }

    h2.neon-subtitle {
        font-size: 1.2rem;
        padding: 0 20px;
        display: block;
        /* Show subtitle on mobile */
    }

    .wishes-text {
        font-size: 1.1rem;
    }

    .tree-container {
        width: 150px;
        height: 225px;
    }
}

/* Mobile Optimizations */
@media (max-width: 600px) {
    h1.neon-title {
        font-size: 2.5rem;
    }

    h2.neon-subtitle {
        font-size: 1.2rem;
        padding: 0 20px;
    }

    .tree-container {
        width: 150px;
        height: 225px;
    }
}