@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);
}

/* Game 5 Specifics */
.game5-info {
    width: 100%;
    margin-bottom: 20px;
    font-family: 'Orbitron', sans-serif;
    color: #fff;
    text-shadow: 0 0 5px #00ffff;
    text-align: center;
    font-size: 1.2rem;
}

#game5-stats span {
    color: #00ffff;
    font-weight: bold;
}

.game5-grid {
    position: relative;
    width: 432px;
    height: 648px;
    /* 4 cols x 6 rows x 108px */
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid #333;
    overflow: hidden;
    /* Hide falling spawns */
}

.game5-bubble {
    position: absolute;
    width: 90px;
    /* 108px cell - gap */
    height: 90px;
    border-radius: 50%;
    cursor: pointer;
    transition: top 0.4s ease-in, transform 0.2s;
    box-shadow: inset -5px -5px 10px rgba(0, 0, 0, 0.5), 0 0 5px rgba(255, 255, 255, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.1);
    /* Centering content if needed */
    display: flex;
    justify-content: center;
    align-items: center;
}

.game5-bubble.popping {
    animation: popBubble 0.3s forwards;
}

@keyframes popBubble {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.game5-bubble:hover {
    transform: scale(1.05);
    z-index: 10;
}

/* Bubble Colors */
.game5-bubble.c0,
.game5-particle.c0 {
    background: #ff0000;
    color: #ff0000;
}

/* Red */
.game5-bubble.c1,
.game5-particle.c1 {
    background: #0000ff;
    color: #0000ff;
}

/* Blue */
.game5-bubble.c2,
.game5-particle.c2 {
    background: #00ff00;
    color: #00ff00;
}

/* Green */
.game5-bubble.c3,
.game5-particle.c3 {
    background: #ffff00;
    color: #ffff00;
}

/* Yellow */
.game5-bubble.c4,
.game5-particle.c4 {
    background: #ff00ff;
    color: #ff00ff;
}

/* Purple */
.game5-bubble.c5,
.game5-particle.c5 {
    background: #00ffff;
    color: #00ffff;
}

/* Cyan */
.game5-bubble.c6,
.game5-particle.c6 {
    background: #ffffff;
    color: #ffffff;
}

/* White */

.game5-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 20;
}

.floating-text {
    position: absolute;
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    font-size: 24px;
    pointer-events: none;
    z-index: 30;
    text-shadow: 0 0 5px currentColor;
    animation: floatUp 1s forwards;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(-50px) scale(1.5);
        opacity: 0;
    }
}

/* Extra Juice */
.game5-bubble.highlight {
    filter: brightness(1.5) drop-shadow(0 0 10px #fff);
    transform: scale(1.1);
    z-index: 15;
}

.shake {
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Game 6 Tetris */
.tetris-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 150px;
}

.info-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #333;
    text-align: center;
}

.info-box h3 {
    margin: 0 0 5px 0;
    color: #00ffff;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-box span {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    color: #fff;
    font-weight: bold;
    text-shadow: 0 0 5px currentColor;
}

#next-piece-canvas {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}