:root {
    --atari-green: #50882e;
    --atari-brown: #C17D4D;
    --atari-white: #E6E6E6;
    --atari-black: #1A1A1A;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Press Start 2P', monospace;
}

body {
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    color: white;
    user-select: none;
    -webkit-user-select: none;
}

#game-container {
    position: relative;
    width: 800px;
    height: 600px;
    max-width: 100%;
    max-height: 100vh;
    background: var(--atari-green);
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: absolute;
    top: 30px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 100px;
    font-size: 32px;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 10;
}

#score-p1 { color: var(--atari-white); }
#score-cpu { color: var(--atari-black); }
#timer { color: #fff; }

.overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    text-align: center;
}

.overlay.active { display: flex; }

.game-title { 
    font-size: 3rem; color: #DAA520; margin-bottom: 20px; 
    line-height: 1.5;
}

.subtitle { color: #fff; margin-bottom: 40px; font-size: 1rem; line-height: 1.5; }
.controls-info { margin-bottom: 30px; font-size: 0.8rem; line-height: 2.5; color: #aaa; }

button {
    font-family: 'Press Start 2P', monospace;
    background: #DAA520;
    color: #000;
    border: 4px solid #fff;
    padding: 15px 30px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.1s;
}

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

/* Touch Controls */
#touch-controls {
    position: absolute;
    bottom: 20px;
    width: 100%;
    display: none; /* Only show on mobile */
    justify-content: space-between;
    padding: 0 40px;
    z-index: 50;
}

@media (max-width: 800px) {
    #touch-controls { display: flex; }
    #ui-layer { font-size: 20px; padding: 0 20px; }
    .game-title { font-size: 2rem; }
}

#joystick {
    position: relative;
    width: 150px;
    height: 150px;
}

.joy-btn {
    position: absolute;
    width: 50px; height: 50px;
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    font-size: 20px;
    display: flex; justify-content: center; align-items: center;
    padding: 0;
}

.btn-up { top: 0; left: 50px; }
.btn-down { bottom: 0; left: 50px; }
.btn-left { top: 50px; left: 0; }
.btn-right { top: 50px; right: 100px; /* modified to make it look like a Dpad */ }

/* Real Dpad Fix */
#joystick {
    width: 160px;
    height: 160px;
}
.btn-up { top: 0; left: 55px; }
.btn-down { bottom: 0; left: 55px; }
.btn-left { top: 55px; left: 0; }
.btn-right { top: 55px; left: 110px; }

.action-btn {
    align-self: center;
    background: rgba(218, 165, 32, 0.8);
    border: 4px solid #fff;
    border-radius: 50%;
    width: 65px; height: 65px;
    padding: 0; font-size: 12px;
}

.block-btn {
    background: rgba(100, 100, 255, 0.8);
}
