:root {
    --neon-cyan: #00e5ff;
    --neon-pink: #ff00ff;
    --crt-green: #33ff00;
    --neon-yellow: #ffff00;
    --neon-red: #ff3333;
    /* For Space Shooter */
    --neon-green-blue: #33ffcc;
    /* For Block Match */
    --neon-orange: #ff9900;
    /* For Breaker */
    --neon-purple: #bf00ff;
    /* For Jump */
}

body {
    margin: 0;
    overflow: hidden;
    background-color: #050011;
    font-family: 'Courier New', Courier, monospace;
    color: #fff;
    user-select: none;
}

/* --- SHARED UI --- */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    box-sizing: border-box;
}

h1 {
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-align: center;
    margin-top: 20px;
    opacity: 0.9;
    text-shadow: 0 0 10px var(--neon-pink);
}

/* --- ROCK UI --- */
#rock-ui {
    display: none;
    height: 100%;
    flex-direction: column;
    justify-content: space-between;
}

.score-container {
    text-align: center;
    margin-bottom: 80px;
}

#rock-score {
    font-size: 6rem;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 0 30px rgba(0, 229, 255, 0.5);
}

#rock-score.bump {
    transform: scale(1.2);
}

#achievement {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(20, 0, 40, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 25px 40px;
    text-align: center;
    border-radius: 16px;
    opacity: 0;
    transition: all 0.5s;
    min-width: 300px;
}

#achievement.show {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1);
}

/* --- DODGE UI (Used as generic game over screen) --- */
#dodge-ui {
    display: none;
    width: 100%;
    height: 100%;
}

#game-over-screen {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(0, 0, 0, 0.9);
    padding: 40px;
    border: 2px solid var(--neon-cyan);
    z-index: 20;
    pointer-events: auto;
}

button {
    background: var(--neon-pink);
    color: white;
    border: none;
    padding: 15px 30px;
    font-family: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    margin-top: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

button:hover {
    background: #d500f9;
}

/* --- SNAKE UI --- */
#snake-ui {
    display: none;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 2px, 3px 100%;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.9);
}

.crt-text {
    color: var(--crt-green);
    text-shadow: 0 0 5px var(--crt-green);
    font-family: 'Courier New', Courier, monospace;
}

#snake-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid var(--crt-green);
    box-shadow: 0 0 20px var(--crt-green), inset 0 0 20px var(--crt-green);
    background-color: #001100;
}

/* --- PONG UI --- */
#pong-ui {
    display: none;
    width: 100%;
    height: 100%;
}

#pong-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.pong-text {
    color: var(--neon-yellow);
    text-shadow: 0 0 10px var(--neon-yellow);
}

#pong-result {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(0, 0, 0, 0.9);
    padding: 40px;
    border: 2px solid var(--neon-yellow);
    z-index: 20;
    pointer-events: auto;
}

#pong-result button {
    background-color: var(--neon-yellow);
    color: #000;
}

/* --- SHOOTER UI (NEW) --- */
#shooter-ui {
    display: none;
    width: 100%;
    height: 100%;
}

#shooter-canvas {
    position: absolute;
    top: 0;
    left: 0;
}

.shooter-text {
    color: var(--neon-red);
    text-shadow: 0 0 10px var(--neon-red);
}

/* --- BLOCK MATCH UI (NEW) --- */
#blockmatch-ui {
    display: none;
    width: 100%;
    height: 100%;
}

#blockmatch-grid {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: grid;
    border: 2px solid var(--neon-green-blue);
    box-shadow: 0 0 15px var(--neon-green-blue);
    pointer-events: auto;
}

.match-tile {
    width: 60px;
    /* Increased size */
    height: 60px;
    /* Increased size */
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 36px;
    /* Adjusted emoji size */
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s, box-shadow 0.1s;
}

.match-tile:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px var(--neon-green-blue);
}

.match-tile.selected {
    border: 3px solid var(--neon-yellow);
    box-shadow: 0 0 20px var(--neon-yellow);
    transform: scale(1.05);
}

.match-tile.swapping {
    transition: transform 0.3s ease-in-out;
    z-index: 10;
}

.match-tile.matched {
    animation: shrink 0.3s forwards;
}

.match-tile.falling {
    animation: fall 0.5s ease-in forwards;
}

@keyframes shrink {
    from {
        transform: scale(1);
        opacity: 1;
    }

    to {
        transform: scale(0);
        opacity: 0;
    }
}

@keyframes fall {
    from {
        transform: translateY(-150px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#blockmatch-score {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    color: var(--neon-green-blue);
    text-shadow: 0 0 10px var(--neon-green-blue);
}

/* --- BREAKER UI (NEW) --- */
#breaker-ui {
    display: none;
    width: 100%;
    height: 100%;
}

#breaker-canvas {
    position: absolute;
    top: 0;
    left: 0;
}

.breaker-text {
    color: var(--neon-orange);
    text-shadow: 0 0 10px var(--neon-orange);
}

/* --- JUMP UI (NEW) --- */
#jump-ui {
    display: none;
    width: 100%;
    height: 100%;
}

#jump-canvas {
    position: absolute;
    top: 0;
    left: 0;
}

.jump-text {
    color: var(--neon-purple);
    text-shadow: 0 0 10px var(--neon-purple);
}

/* --- GAME SELECTOR UI --- */
#game-selector {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 0, 17, 0.95);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}

#game-selector h2 {
    font-size: 3rem;
    color: #fff;
    text-shadow: 0 0 20px var(--neon-cyan);
    margin-bottom: 40px;
    letter-spacing: 5px;
    text-transform: uppercase;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 900px;
    padding: 20px;
}

.game-btn {
    width: 100%;
    height: 100px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1rem;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.2);
    transition: all 0.3s;
    cursor: pointer;
    text-transform: uppercase;
}

.game-btn:hover {
    background: var(--neon-cyan);
    color: #000;
    transform: scale(1.05);
    box-shadow: 0 0 30px var(--neon-cyan);
}

/* Game Specific Button Colors */
.btn-rock {
    border-color: var(--neon-pink);
    color: var(--neon-pink);
}

.btn-rock:hover {
    background: var(--neon-pink);
    box-shadow: 0 0 30px var(--neon-pink);
}

.btn-dodge {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.btn-dodge:hover {
    background: var(--neon-cyan);
    box-shadow: 0 0 30px var(--neon-cyan);
}

.btn-snake {
    border-color: var(--crt-green);
    color: var(--crt-green);
}

.btn-snake:hover {
    background: var(--crt-green);
    box-shadow: 0 0 30px var(--crt-green);
}

.btn-pong {
    border-color: var(--neon-yellow);
    color: var(--neon-yellow);
}

.btn-pong:hover {
    background: var(--neon-yellow);
    box-shadow: 0 0 30px var(--neon-yellow);
}

.btn-shooter {
    border-color: var(--neon-red);
    color: var(--neon-red);
}

.btn-shooter:hover {
    background: var(--neon-red);
    box-shadow: 0 0 30px var(--neon-red);
}

.btn-block {
    border-color: var(--neon-green-blue);
    color: var(--neon-green-blue);
}

.btn-block:hover {
    background: var(--neon-green-blue);
    box-shadow: 0 0 30px var(--neon-green-blue);
}

.btn-breaker {
    border-color: var(--neon-orange);
    color: var(--neon-orange);
}

.btn-breaker:hover {
    background: var(--neon-orange);
    box-shadow: 0 0 30px var(--neon-orange);
}

.btn-jump {
    border-color: var(--neon-purple);
    color: var(--neon-purple);
}

.btn-jump:hover {
    background: var(--neon-purple);
    box-shadow: 0 0 30px var(--neon-purple);
}

.btn-snow {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.btn-snow:hover {
    background: var(--neon-cyan);
    box-shadow: 0 0 30px var(--neon-cyan);
}

.btn-waste {
    border-color: #ff0055;
    color: #ff0055;
    background: rgba(255, 0, 85, 0.05);
}

.btn-waste:hover {
    background: #ff0055;
    color: #fff;
    box-shadow: 0 0 30px #ff0055;
    animation: glitch 1s infinite;
}

#snow-canvas {
    position: absolute;
    top: 0;
    left: 0;
}

.snow-text {
    color: var(--neon-cyan);
    text-shadow: 0 0 10px var(--neon-cyan);
}

/* BACK BUTTON */
#back-to-menu {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 200;
    pointer-events: auto;
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
    padding: 8px 16px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.6;
    transition: 0.3s;
    display: none;
    /* Hidden by default */
}

#back-to-menu:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 10px #fff;
}

/* --- GAME INFO SECTION (SEO Content) --- */
.game-info-section {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #050011;
    padding: 40px;
    box-sizing: border-box;
    color: #ccc;
    line-height: 1.6;
}

.game-info-section h2 {
    color: var(--neon-cyan);
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-shadow: 0 0 10px var(--neon-cyan);
}

.game-info-section h3 {
    color: #fff;
    margin-top: 30px;
}

.game-info-section p {
    max-width: 800px;
    margin-bottom: 20px;
}

/* Allow scrolling for this section */
body.scrollable {
    overflow: auto;
}

@keyframes glitch {
    0% {
        transform: translate(0);
    }

    20% {
        transform: translate(-2px, 2px);
    }

    40% {
        transform: translate(-2px, -2px);
    }

    60% {
        transform: translate(2px, 2px);
    }

    80% {
        transform: translate(2px, -2px);
    }

    100% {
        transform: translate(0);
    }
}

/* --- SNOW BROS SPECIFIC UI --- */
.arcade-hud {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 800px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px 30px;
    background: rgba(0, 10, 40, 0.85);
    border: 3px solid #00e5ff;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.3), inset 0 0 20px rgba(0, 229, 255, 0.2);
    font-family: 'Courier New', Courier, monospace;
    z-index: 100;
}

.hud-item {
    text-align: center;
}

.hud-label {
    font-size: 0.8rem;
    color: #00e5ff;
    margin-bottom: 5px;
    letter-spacing: 2px;
    text-shadow: 0 0 5px #00e5ff;
}

.hud-value {
    font-size: 1.8rem;
    color: #fff;
    font-weight: bold;
    text-shadow: 2px 2px 0px #000;
}

.center-hud .hud-value {
    color: #ffff00;
    text-shadow: 0 0 10px #ffff00;
}

.lives-container {
    color: #ff3333;
    letter-spacing: 5px;
}

.controls-hint {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.6);
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    letter-spacing: 1px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Lame Bird Button */
.btn-bird {
    border-color: var(--neon-yellow);
    color: var(--neon-yellow);
}

.btn-bird:hover {
    background: var(--neon-yellow);
    box-shadow: 0 0 30px var(--neon-yellow);
    color: #000;
}