:root {
    --bg-color-day: #f0f0f0;
    --text-color-day: #333;
    --container-bg-day: #e0e0e0;
    --menu-bg-day: #333;
    --menu-text-day: white;
    --box-bg-day: #CC0000;
    --box-ready-bg-day: green;
    --button-border-color: black;
    --icon-color: #333;
    --highlight-bg-day: #555;
}

.night-mode {
    --bg-color-day: #333;
    --text-color-day: #eee;
    --container-bg-day: #222;
    --menu-bg-day: #111;
    --menu-text-day: #eee;
    --box-bg-day: #990000;
    --box-ready-bg-day: #006400;
    --button-border-color: #ccc;
    --icon-color: #eee;
    --highlight-bg-day: #777;
}

/* Common Styles for Menu Bar */
.menu-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--menu-bg-day);
    padding: 15px 0;
    z-index: 1000;
}

/* Menu entrance animation */
.menu-bar.menu-animated ul li {
    opacity: 0;
    transform: translateY(-6px);
    display: inline-block;
}

@keyframes nav-item-in {
    from { opacity: 0; transform: translateY(-10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* When animated, each menu item will animate in with a small stagger based on --i */
.menu-bar.menu-animated ul li.animate {
    animation: nav-item-in 420ms cubic-bezier(.2,.9,.2,1) both;
    animation-delay: calc(var(--i, 0) * 80ms);
}

.menu-bar ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    justify-content: center;
}

.menu-bar li {
    margin: 0 25px;
}

.menu-bar a {
    color: var(--menu-text-day);
    text-decoration: none;
    font-size: 20px;
    font-family: sans-serif;
    padding-bottom: 5px; /* Add some space for the bar */
    position: relative; /* For pseudo-element positioning */
    transition: color 0.3s ease-out; /* Add color transition */
}

.menu-bar a:hover {
    color: #aaa; /* Slightly fade the text color on hover */
}

.menu-bar a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px; /* Make the bar thicker */
    background-color: var(--menu-underline-color, currentColor);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.9s cubic-bezier(0.22, 0.1, 0.12, 1),
                background-color 0.25s ease-out; /* Smooth color updates */
}

.menu-bar a.active::after,
.menu-bar a:hover::after {
    transform: scaleX(1);
}

.page-container {
    max-width: 600px;
    margin: 50px auto;
    padding: 30px;
    background-color: var(--container-bg-day);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    color: var(--text-color-day);
    opacity: 1;
}

/* --- General Button Hover Effect --- */
.button-hover {
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}

.button-hover:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .menu-bar li {
        margin: 0 10px;
    }

    .menu-bar a {
        font-size: 16px;
    }

    .page-container {
        margin: 20px 10px;
        padding: 20px;
    }
}

/* --- High-Quality Fade-in Animations --- */

.anim-fade-in {
    animation-duration: 1.8s;
    animation-fill-mode: both;
    animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

.anim-fade-in.subtle { animation-name: fade-in-subtle; }
.anim-fade-in.up { animation-name: fade-in-up; }
.anim-fade-in.down { animation-name: fade-in-down; }
.anim-fade-in.blur { animation-name: fade-in-blur; }
.anim-fade-in.zoom { animation-name: fade-in-zoom; }
.anim-fade-in.pixelated { animation-name: fade-in-pixelated; animation-duration: 2s; }

@keyframes fade-in-subtle {
    from {
        opacity: 0;
        transform: scale(calc(var(--final-scale, 1) * 0.95));
    }
    to {
        opacity: 1;
        transform: scale(var(--final-scale, 1));
    }
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(calc(var(--final-scale, 1) * 0.95));
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(var(--final-scale, 1));
    }
}

@keyframes fade-in-down {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(calc(var(--final-scale, 1) * 0.95));
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(var(--final-scale, 1));
    }
}

@keyframes fade-in-blur {
    from {
        opacity: 0;
        filter: blur(15px);
        transform: scale(calc(var(--final-scale, 1) * 1.1));
    }
    to {
        opacity: 1;
        filter: blur(0);
        transform: scale(var(--final-scale, 1));
    }
}

@keyframes fade-in-zoom {
    from {
        opacity: 0;
        transform: scale(calc(var(--final-scale, 1) * 0.9));
    }
    to {
        opacity: 1;
        transform: scale(var(--final-scale, 1));
    }
}

@keyframes fade-in-pixelated {
    from {
        filter: blur(40px);
        opacity: 0;
        transform: scale(calc(var(--final-scale, 1) * 0.9));
    }
    to {
        filter: blur(0);
        opacity: 1;
        transform: scale(var(--final-scale, 1));
    }
}

/* Dotted Underline Style */
.underline-dotted .menu-bar a::after {
    background-image: linear-gradient(to right, var(--menu-underline-color, currentColor) 33%, transparent 0%);
    background-position: bottom;
    background-size: 6px 3px;
    background-repeat: repeat-x;
    background-color: transparent; /* Override solid color */
}

/* Dashed Underline Style */
.underline-dashed .menu-bar a::after {
    transform-origin: left;
    transition: transform 0.7s cubic-bezier(0.22, 0.1, 0.12, 1);
    background-image: none;
    background-color: var(--menu-underline-color, currentColor);
}

body.fast-performance-mode,
.fast-performance-mode * {
    transition: none !important;
    animation: none !important;
}