:root {
    --bg-color: #050505;
    --red-color: #ff2a2a;
    --blue-color: #2a75ff;
    --yellow-color: #ffcc00;
    --green-color: #00ff66;
    --text-color: #ffffff;
    --font-main: 'Orbitron', sans-serif;
    --glow-spread: 15px;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-left: 2px solid #222;
    border-right: 2px solid #222;
    background-color: var(--bg-color);
}

#gameCanvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    /* Canvas styling is handled mostly in JS for the neon effect */
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    /* Let clicks pass through to canvas if needed */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2vh 5vw;
}

#title {
    font-size: clamp(1rem, 5vw, 2.5rem);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    white-space: nowrap;
}

#score-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
    max-width: 400px;
    /* Reduced max-width since they are full width now */
    gap: 8px;
    margin: 0 auto;
    /* Center it horizontally */
}

.score-bar {
    width: 100%;
    height: 30px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    position: relative;
    overflow: hidden;
    border-style: solid;
    border-width: 3px;
    transition: transform 0.3s ease;
    /* add smooth transition for re-ordering */
}

.score-bar.hidden {
    display: none !important;
}

.score-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    /* Updated by JS */
    transition: width 0.1s ease-out;
}

#red-bar-container {
    border-color: var(--red-color);
    box-shadow: inset 0 0 10px rgba(255, 42, 42, 0.3), 0 0 5px rgba(255, 42, 42, 0.5);
}

#blue-bar-container {
    border-color: var(--blue-color);
    box-shadow: inset 0 0 10px rgba(42, 117, 255, 0.3), 0 0 5px rgba(42, 117, 255, 0.5);
}

#yellow-bar-container {
    border-color: var(--yellow-color);
    box-shadow: inset 0 0 10px rgba(255, 204, 0, 0.3), 0 0 5px rgba(255, 204, 0, 0.5);
}

#green-bar-container {
    border-color: var(--green-color);
    box-shadow: inset 0 0 10px rgba(0, 255, 102, 0.3), 0 0 5px rgba(0, 255, 102, 0.5);
}

#red-fill {
    background: linear-gradient(90deg, transparent, var(--red-color));
    box-shadow: 0 0 var(--glow-spread) var(--red-color);
}

#blue-fill {
    background: linear-gradient(90deg, transparent, var(--blue-color));
    box-shadow: 0 0 var(--glow-spread) var(--blue-color);
}

#yellow-fill {
    background: linear-gradient(90deg, transparent, var(--yellow-color));
    box-shadow: 0 0 var(--glow-spread) var(--yellow-color);
}

#green-fill {
    background: linear-gradient(90deg, transparent, var(--green-color));
    box-shadow: 0 0 var(--glow-spread) var(--green-color);
}

.score-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    font-size: 0.8rem;
    /* Make font slightly smaller to fit YELLOW */
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
    z-index: 10;
}

#cta-container {
    width: 100%;
    margin-top: 15px;
    /* Adds space between score bars and this text */
    text-align: center;
    min-height: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

#cta-text {
    font-size: clamp(0.6rem, 1.5vw, 0.9rem);
    /* Make it even smaller */
    color: var(--text-color);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
    font-weight: bold;
    letter-spacing: 1px;
}

#cta-text::after {
    content: "";
    animation: ctaCycle 18s infinite;
}

@keyframes ctaCycle {

    0%,
    30% {
        content: "Which color is going to win? Let me know below! 👇";
        opacity: 1;
    }

    33% {
        content: "Which color is going to win? Let me know below! 👇";
        opacity: 0;
    }

    36%,
    63% {
        content: "Like & Subscribe for more chaotic simulations! ❤️";
        opacity: 1;
    }

    66% {
        content: "Like & Subscribe for more chaotic simulations! ❤️";
        opacity: 0;
    }

    69%,
    96% {
        content: "What should the next game mode be? Comment your ideas! 💬";
        opacity: 1;
    }

    100% {
        content: "What should the next game mode be? Comment your ideas! 💬";
        opacity: 0;
    }
}

#winner-announcement {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(3rem, 8vw, 6rem);
    text-align: center;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    pointer-events: auto;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px 40px;
    border-radius: 10px;
    border: 2px solid white;
}

#winner-announcement.hidden {
    display: none;
}

.mode-select-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.mode-btn {
    background: transparent;
    border: 3px solid white;
    color: white;
    font-size: clamp(1rem, 3vw, 2rem);
    font-family: inherit;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    transition: all 0.2s ease;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.8);
}

#winner-announcement .subtext {
    font-size: 1.5rem;
    display: block;
    margin-top: 10px;
    opacity: 0.8;
}

#start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: auto;
    /* Make the entire overlay area block clicks */
    background: rgba(0, 0, 0, 0.5);
    padding: 30px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

#start-overlay.hidden {
    display: none;
}

#start-overlay h1 {
    font-size: clamp(3rem, 8vw, 6rem);
    cursor: default;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.9);
    margin-bottom: 10px;
}

#start-overlay .subtext {
    font-size: 1.5rem;
    opacity: 0.8;
}

#footer {
    position: absolute;
    bottom: 20px;
    font-size: 1rem;
    opacity: 0.5;
    letter-spacing: 1px;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
        text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
    }

    50% {
        transform: translateY(-120px);
        text-shadow: 0 0 20px rgba(255, 255, 255, 1);
    }

    100% {
        transform: translateY(0px);
        text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
    }
}