@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: #0b0b0b;
    /* Slightly lighter black for modern feel */
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: #000;
}

.bg-scroller {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    font-size: 20rem;
    font-weight: 900;
    color: rgba(180, 50, 255, 0.4);
    /* Brighter/More opaque purple */
    white-space: nowrap;
    z-index: 1;
    pointer-events: none;
    font-family: 'Orbitron', sans-serif;
}

.container {
    position: relative;
    z-index: 10;
    perspective: 1000px;
    width: 100%;
    text-align: center;
    /* Will be animated horizontally */
}

.demo-text {
    font-size: 5rem;
    font-weight: 900;
    white-space: nowrap;
    text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff, 0 0 40px #00ffff;
    letter-spacing: 2px;
}



.char {
    display: inline-block;
    position: relative;
    transform-style: preserve-3d;
}

/* Navigation Menu */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    padding: 1rem 0;
}

.navbar ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 0;
    margin: 0;
    align-items: center;
    /* Ensure vertical center alignment */
}

.navbar li a {
    color: #fff;
    text-decoration: none;
    display: block;
    transition: all 0.3s ease;
    line-height: 0;
    /* Removing extra height from text line-height */
}

.navbar li a svg {
    width: 72px;
    /* Increased from 48px (~50% bigger) */
    height: 72px;
    filter: drop-shadow(0 0 2px #00ffff);
    transition: all 0.3s ease;
}

.navbar li a:hover svg {
    color: #00ffff;
    transform: scale(1.1);
    filter: drop-shadow(0 0 10px #00ffff) drop-shadow(0 0 20px #00ffff);
}

.navbar li a.active svg {
    color: #ff00ff;
    /* Magenta for active state */
    transform: scale(1.1);
    filter: drop-shadow(0 0 10px #ff00ff) drop-shadow(0 0 20px #ff00ff);
}

.nav-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #fff;
    transition: all 0.3s ease;
    line-height: 0;
}

.nav-btn svg {
    width: 72px;
    /* Matched size */
    height: 72px;
    filter: drop-shadow(0 0 2px #00ffff);
    transition: all 0.3s ease;
}

.nav-btn:hover svg {
    color: #00ffff;
    transform: scale(1.1);
    filter: drop-shadow(0 0 10px #00ffff) drop-shadow(0 0 20px #00ffff);
}

/* Games Navigation */
.games-nav {
    position: absolute;
    top: 110px;
    /* moved down 10px */
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 0 1rem;
    z-index: 500;
}

.games-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    padding: 0;
    margin: 0;
}

.game-btn {
    display: block;
    color: #fff;
    transition: transform 0.3s ease;
    line-height: 0;
}

.game-btn svg {
    filter: drop-shadow(0 0 5px rgba(0, 255, 255, 0.5));
    transition: all 0.3s ease;
}

.game-btn:hover {
    transform: scale(1.1);
}

.game-btn:hover svg,
.game-btn.active svg {
    filter: drop-shadow(0 0 15px #ff00ff);
    color: #ff00ff;
    transform: scale(1.1);
}

.game-btn text {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
}

/* Sound Hint & Wrapper */
.sound-wrapper {
    position: relative;
    display: inline-flex;
    justify-content: center;
    width: fit-content;
}

.sound-hint {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    /* Width to prevent wrapping too aggressively */
    text-align: center;
    font-size: 0.8rem;
    color: #00ffff;
    white-space: nowrap;
    text-shadow: 0 0 5px #00ffff;
    animation: blink 1s infinite alternate;
    pointer-events: none;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .demo-text {
        font-size: 2rem;
        letter-spacing: 2px;
    }

    .navbar ul {
        gap: 1.5rem;
    }

    .navbar li a svg {
        width: 64px;
        /* Large mobile icons */
        height: 64px;
    }

    .nav-btn svg {
        width: 64px;
        height: 64px;
    }
}

/* Game 2 Specifics */
#game2-canvas {
    background: #111;
    border: 2px solid #00ffff;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
    display: block;
    margin-bottom: 20px;
    max-width: 100%;
}

.game2-btn {
    background: rgba(0, 255, 255, 0.2);
    border: 2px solid #00ffff;
    color: #00ffff;
    width: 60%;
    /* Roughly half container width */
    height: 50px;
    /* Same as game1 height approx */
    border-radius: 5px;
    font-size: 24px;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    text-shadow: 0 0 5px #00ffff;
    transition: all 0.2s;
    user-select: none;
}


.game2-btn:active {
    background: rgba(0, 255, 255, 0.5);
    transform: scale(0.98);
}

/* Game 3 Specifics */
.game3-info {
    width: 100%;
    margin-bottom: 20px;
    font-family: 'Orbitron', sans-serif;
    color: #fff;
    text-shadow: 0 0 5px #00ffff;
}

#game3-message {
    font-size: 1.5rem;
    margin-bottom: 10px;
    min-height: 30px;
}

#game3-stats {
    font-size: 1.2rem;
    color: #00ffff;
}

.game3-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(80px, 1fr));
    /* Force min width per column */
    /* Rows will size based on content */
    gap: 15px;
    width: 100%;
    max-width: 1000px;
    /* Reducing slightly to ensure it fits with minmax on smaller headers */
    margin: 0 auto;

    /* Center tracks within the grid container */
    justify-content: center;
    align-content: center;
}

.game3-square {
    background: #000;
    border: 2px solid #333;
    /* Dim default border */
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.1);
    aspect-ratio: 1 / 1;
    width: 100%;
    /* Fill the grid cell */
}

.game3-square:hover {
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Colors */
.game3-square.green {
    background: #00ff00;
    border-color: #00ff00;
    box-shadow: 0 0 15px #00ff00;
}

.game3-square.blue {
    background: #0088ff;
    border-color: #0088ff;
    box-shadow: 0 0 15px #0088ff;
}

.game3-square.red {
    background: #ff0000;
    border-color: #ff0000;
    box-shadow: 0 0 15px #ff0000;
}

.game3-square.yellow {
    background: #ffff00;
    border-color: #ffff00;
    box-shadow: 0 0 15px #ffff00;
}

.game3-square.purple {
    background: #ff00ff;
    border-color: #ff00ff;
    box-shadow: 0 0 15px #ff00ff;
}

/* Hidden State - All look the same */
.game3-square.hidden {
    background: #000 !important;
    border: 2px solid #00ffff !important;
    /* Neon outline as requested */
    box-shadow: 0 0 5px #00ffff !important;
}

/* Correctly Revealed */
/* .game3-square.revealed uses base color styles */

/* Wrong Choice (Game Over blink?) */
.game3-square.wrong {
    background: #ff0000 !important;
    box-shadow: 0 0 20px #ff0000 !important;
    animation: shake 0.5s;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }

    100% {
        transform: translateX(0);
    }
}

/* Game 4 Specifics */
#game4-canvas {
    background: #000;
    border: 2px solid #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
    display: block;
    max-width: 100%;
    margin: 0 auto 20px auto;
}

.game4-info {
    width: 100%;
    margin-bottom: 10px;
    font-family: 'Orbitron', sans-serif;
    color: #fff;
    text-shadow: 0 0 5px #00ffff;
    text-align: center;
    font-size: 1.2rem;
}

.game4-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    width: 100%;
    margin-top: 10px;
}

.control-btn {
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid #00ffff;
    color: #00ffff;
    width: 120px;
    height: 60px;
    border-radius: 5px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 0 10px #00ffff;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    touch-action: manipulation;
}

.control-btn:active {
    background: rgba(0, 255, 255, 0.4);
    transform: scale(0.95);
}