:root {
    --bg-color: #050510;
    --neon-green: #39ff14;
    --neon-pink: #ff00ff;
    --neon-blue: #00ffff;
    --glass-bg: rgba(20, 20, 40, 0.6);
    --glass-border: rgba(0, 255, 255, 0.3);
    --text-color: #e0e0e0;
    --font-arcade: 'Press Start 2P', monospace;
}

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

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(57, 255, 20, 0.05), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(255, 0, 255, 0.05), transparent 25%);
    color: var(--text-color);
    font-family: var(--font-arcade);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.game-container {
    position: relative;
    box-shadow:
        0 0 20px rgba(0, 255, 255, 0.2),
        0 0 40px rgba(255, 0, 255, 0.1),
        inset 0 0 100px rgba(0, 0, 0, 0.9);
    border: 4px solid var(--neon-blue);
    border-radius: 8px;
    overflow: hidden;
    transform: perspective(1000px) rotateX(1deg);
    /* Slight arcade cabinet tilt */
    transition: transform 0.3s ease;
}

/* CRT Screen Effect */
.game-container::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    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));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

/* CRT Vignette */
.game-container::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: radial-gradient(circle, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.6) 100%);
    z-index: 2;
    pointer-events: none;
}

canvas {
    display: block;
    background: radial-gradient(circle at center, #1a1a2e 0%, #000000 100%);
    filter: contrast(1.1) brightness(1.1) saturate(1.2);
    /* Enhance game colors */
}

@keyframes flicker {
    0% {
        opacity: 0.95;
    }

    50% {
        opacity: 0.85;
    }

    100% {
        opacity: 0.92;
    }
}

.ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.score-board {
    position: absolute;
    top: 30px;
    left: 30px;
    font-size: 20px;
    color: var(--neon-green);
    text-shadow: 0 0 10px var(--neon-green);
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-left: 4px solid var(--neon-green);
    clip-path: polygon(0 0, 100% 0, 95% 100%, 0 100%);
    /* Cyberpunk slant */
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    transition: opacity 0.5s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

h1 {
    font-size: 64px;
    color: var(--neon-pink);
    text-shadow:
        0 0 10px var(--neon-pink),
        0 0 20px var(--neon-pink),
        4px 4px 0px #000;
    margin-bottom: 40px;
    text-align: center;
    line-height: 1.2;
    animation: textPulse 2s infinite alternate;
}

@keyframes textPulse {
    0% {
        text-shadow: 0 0 10px var(--neon-pink);
    }

    100% {
        text-shadow: 0 0 25px var(--neon-pink), 0 0 50px var(--neon-pink);
    }
}

p {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--neon-blue);
    letter-spacing: 2px;
}

.key-highlight {
    color: #fff;
    background-color: var(--neon-green);
    box-shadow: 0 0 15px var(--neon-green);
    color: black;
    padding: 4px 10px;
    border-radius: 4px;
    display: inline-block;
    font-weight: bold;
    animation: bounce 1s infinite alternate;
}

@keyframes bounce {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-4px);
    }
}

/* AI Control Panel - Glassmorphism */
.ai-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 10px;
    padding: 15px 20px;
    color: white;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    pointer-events: auto;
    width: 220px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    max-height: 400px;
    /* Approximate max height */
}

.ai-controls.collapsed {
    max-height: 50px;
    /* Only header visible */
    width: 180px;
    background: rgba(10, 10, 20, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
}

.ai-controls:hover:not(.collapsed) {
    border-color: var(--neon-blue);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--glass-border);
}

.ai-controls.collapsed .panel-header {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.ai-controls h3 {
    margin: 0;
    color: var(--neon-blue);
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 1px;
    white-space: nowrap;
}

.toggle-btn {
    background: none;
    border: 1px solid var(--neon-blue);
    color: var(--neon-blue);
    font-size: 14px;
    width: 20px;
    height: 20px;
    padding: 0;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
    /* Override generic button margin */
}

.toggle-btn:hover {
    background: var(--neon-blue);
    color: #000;
}

.panel-content {
    opacity: 1;
    transition: opacity 0.2s ease;
}

.ai-controls.collapsed .panel-content {
    opacity: 0;
    pointer-events: none;
}

/* Premium Buttons */
button:not(.toggle-btn) {
    background: transparent;
    border: 2px solid var(--neon-pink);
    color: var(--neon-pink);
    padding: 10px 15px;
    cursor: pointer;
    font-family: var(--font-arcade);
    font-size: 10px;
    width: 100%;
    margin-top: 10px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

button::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: var(--neon-pink);
    z-index: -1;
    transition: width 0.3s ease;
}

button:hover {
    color: #fff;
    box-shadow: 0 0 15px var(--neon-pink);
}

button:hover::before {
    width: 100%;
}

button:active {
    transform: scale(0.95);
}

#trainBtn {
    border-color: var(--neon-blue);
    color: var(--neon-blue);
}

#trainBtn::before {
    background: var(--neon-blue);
}

#trainBtn:hover {
    box-shadow: 0 0 15px var(--neon-blue);
}

#loadBtn {
    border-color: var(--neon-green);
    color: var(--neon-green);
}

#loadBtn::before {
    background: var(--neon-green);
}

#loadBtn:hover {
    box-shadow: 0 0 15px var(--neon-green);
}

.model-display {
    font-size: 10px;
    margin-bottom: 10px;
    color: #888;
    text-align: right;
}

#modelName {
    color: #fff;
}