:root {
    --bg-color: #050510;
    --grid-color: #1a1a2e;
    --p1-color: #00f3ff;
    /* Cyan */
    --p1-glow: rgba(0, 243, 255, 0.6);
    --p2-color: #ff0055;
    /* Magenta */
    --p2-glow: rgba(255, 0, 85, 0.6);
    --text-color: #ffffff;
    --font-main: 'Orbitron', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    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%;
    /* CRT Scanline effect */
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    background-color: rgba(10, 10, 20, 0.9);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    border: 2px solid #333;
}

/* Scoreboard */
#ui-layer {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    z-index: 10;
}

.scoreboard {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(1px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 8px;
    min-width: 200px;
}

.score-header {
    color: #888;
    font-size: 0.8rem;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.score-name {
    margin-right: 15px;
    font-weight: bold;
}

.score-val {
    color: #fff;
    font-family: monospace;
}


.timer {
    font-size: 1.5rem;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.5);
    padding-top: 10px;
}

/* Screens (Start / Game Over) */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    transition: opacity 0.3s;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
}

h1 {
    font-size: 4rem;
    color: #fff;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    margin-bottom: 40px;
    text-align: center;
}

.controls-info {
    display: flex;
    gap: 50px;
    align-items: center;
    margin-bottom: 60px;
}

.control-group {
    text-align: center;
}

.control-group h2 {
    color: var(--p1-color);
    margin-bottom: 15px;
    text-shadow: 0 0 10px var(--p1-glow);
}

.control-group:last-child h2 {
    color: var(--p2-color);
    text-shadow: 0 0 10px var(--p2-glow);
}

.vs {
    font-size: 2rem;
    font-weight: bold;
    color: #555;
}

p {
    font-size: 1.1rem;
    margin: 5px 0;
    color: #ccc;
}

.btn-neon {
    background: transparent;
    color: #fff;
    font-family: var(--font-main);
    font-size: 1.5rem;
    padding: 15px 40px;
    border: 2px solid #fff;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.btn-neon:hover {
    background: #fff;
    color: #000;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

/* LOBBY STYLES */
.lobby-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    width: 100%;
    max-width: 600px;
}

.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.input-group label {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

input[type="text"] {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #555;
    color: #fff;
    padding: 15px;
    font-family: var(--font-main);
    font-size: 1.2rem;
    text-align: center;
    width: 100%;
    border-radius: 4px;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--p1-color);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
}

.lobby-actions {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 20px;
}

.action-box {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.action-box h3 {
    margin-bottom: 10px;
    color: var(--p1-color);
}

.action-box p {
    font-size: 0.8rem;
    margin-bottom: 20px;
}

.vs-divider {
    display: flex;
    align-items: center;
    font-weight: bold;
    color: #555;
}

.status-msg {
    height: 30px;
    margin-top: 10px;
    color: #ffaa00;
}

/* Waiting Screen */
.highlight {
    color: var(--p1-color);
    font-weight: bold;
    font-family: monospace;
    font-size: 1.5rem;
    margin: 0 10px;
}

.btn-small {
    padding: 5px 10px;
    background: #333;
    border: 1px solid #555;
    color: #fff;
    cursor: pointer;
    font-family: var(--font-main);
}

.btn-small:hover {
    background: #555;
}

#connected-players-list {
    margin: 30px 0;
    width: 100%;
    max-width: 400px;
}

.player-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    border-left: 4px solid #fff;
}

.player-item.ready {
    border-color: #0f0;
}

/* My HUD */
.my-hud {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 300px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 15px;
    backdrop-filter: blur(1px);
    border-left: 4px solid #fff;
    /* Dynamic color later? */
}

.my-hud.hidden {
    display: none;
}

.hud-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 15px;
    /* Ensure spacing */
}

.hud-row:last-child {
    margin-bottom: 0;
}

.hud-label {
    font-size: 0.9rem;
    color: #888;
    width: 80px;
    /* Increased to avoid wrap/overlap */
    flex-shrink: 0;
    /* Prevent shrinking */
}

.hud-bar-container {
    flex: 1;
    height: 10px;
    /* Smaller height to fit better */
    background: #222;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 2px;
}

.hud-bar-fill {
    height: 100%;
    width: 100%;
    background: #0f0;
    box-shadow: 0 0 10px #0f0;
    transition: width 0.2s;
}

.hud-status {
    color: #fff;
    font-weight: bold;
    text-transform: uppercase;
    text-shadow: 0 0 5px currentColor;
}