:root {
    --bg-color: #0f172a;
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --accent: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text-main: #f8fafc;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Outfit', sans-serif; user-select: none; }

body { background-color: var(--bg-color); overflow: hidden; color: var(--text-main); }

canvas { display: block; position: absolute; top: 0; left: 0; z-index: 1; cursor: crosshair; }

#lobbyScreen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #0f172a url('lobby_bg.jpg') center/cover no-repeat;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 100;
    overflow-y: auto;
    padding-top: 50px;
    color: white;
    transform: none; /* Reset transform from .overlay */
    border-radius: 0; /* Reset border-radius from .overlay */
    border: none;
}

#ui-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10;
    pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; padding: 40px;
}

.header { display: flex; justify-content: space-between; align-items: center; }
.game-title { font-size: 3rem; font-weight: 900; letter-spacing: 2px; text-shadow: 0 0 25px var(--primary-glow); }
.game-title.lg { font-size: 4rem; margin-bottom: 20px; }
.game-title span { color: var(--primary); }

.score-board {
    font-size: 2.2rem; font-weight: 900; background: rgba(15, 23, 42, 0.85);
    padding: 10px 30px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4); backdrop-filter: blur(8px); text-align: center;
}
.team-blue { color: #3b82f6; text-shadow: 0 0 10px rgba(59, 130, 246, 0.5); }
.team-red { color: #ef4444; text-shadow: 0 0 10px rgba(239, 68, 68, 0.5); }
.score-subtext { font-size: 0.8rem; color: #94a3b8; margin-top: -5px; letter-spacing: 1px; }

.player-hud { display: flex; flex-direction: column; align-items: center; gap: 15px; margin-bottom: 20px; position: relative; }

.health-bar-container {
    width: 400px; height: 28px; background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255,255,255,0.15); border-radius: 14px; overflow: hidden;
    position: relative; box-shadow: 0 0 20px rgba(0,0,0,0.5); backdrop-filter: blur(4px);
}
.health-bar-fill {
    width: 100%; height: 100%; background: linear-gradient(90deg, #10b981, #34d399);
    transition: width 0.15s ease-out, background 0.2s; border-radius: 10px;
}

.ammo-container { display: flex; gap: 12px; }
.ammo-slot {
    width: 45px; height: 14px; background: rgba(255, 255, 255, 0.1);
    border-radius: 7px; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.ammo-slot.active { background: #f59e0b; box-shadow: 0 0 12px rgba(245, 158, 11, 0.7); transform: scale(1.05); }

.super-circle-container {
    width: 65px; height: 65px; border-radius: 50%; background: rgba(0, 0, 0, 0.6);
    border: 3px solid rgba(250, 204, 21, 0.3); overflow: hidden; position: absolute;
    right: -75px; top: -18px; box-shadow: 0 0 10px rgba(0,0,0,0.5); transition: all 0.3s;
    display: flex; justify-content: center; align-items: center;
}
.super-circle-fill {
    width: 100%; height: 100%; border-radius: 50%; position: absolute;
    background: conic-gradient(#fde047 0%, #333 0%); transition: background 0.2s;
}
.super-circle-inner {
    width: 45px; height: 45px; border-radius: 50%; background: #1e293b;
    z-index: 10; display: flex; justify-content: center; align-items: center;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}
#superText { font-size: 0.8rem; font-weight: bold; color: white; text-shadow: 0px 0px 4px black; }
.super-ready { box-shadow: 0 0 25px rgba(250, 204, 21, 1); animation: pulseSuper 1s infinite alternate; border-color: #fde047; }
@keyframes pulseSuper { from { filter: brightness(1); } to { filter: brightness(1.3); } }

/* In-game Overlays */
.center-msg {
    position: absolute; top: 25%; left: 50%; transform: translate(-50%, -50%);
    font-size: 5rem; font-weight: 900; color: white;
    text-shadow: 0 5px 20px rgba(0,0,0,0.8), 0 0 30px var(--warning);
    pointer-events: none; opacity: 1; transition: opacity 0.5s ease-out; z-index: 100; text-align: center;
}
.spectate-msg {
    position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%);
    font-size: 1.5rem; color: var(--warning); font-weight: bold;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8); pointer-events: none; letter-spacing: 2px;
}
.respawn-msg {
    position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%);
    font-size: 2.5rem; color: #fff; font-weight: bold;
    text-shadow: 0 5px 15px rgba(0,0,0,0.8); pointer-events: none;
}
.hidden { display: none !important; opacity: 0; }

.overlay {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: rgba(15, 23, 42, 0.95); padding: 50px; border-radius: 30px;
    text-align: center; border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 30px 60px rgba(0,0,0,0.6); pointer-events: auto;
    display: flex; flex-direction: column; align-items: center; gap: 30px; backdrop-filter: blur(15px); z-index: 200;
}
.overlay h2 { font-size: 5rem; letter-spacing: 8px; margin-bottom: 20px; font-weight: 900; }
.text-victory { background: -webkit-linear-gradient(#fde047, #f59e0b); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 0 30px #eab308); }
.text-lose { background: -webkit-linear-gradient(#ef4444, #991b1b); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 0 30px #dc2626); }

.lobby-container { display: flex; flex-direction: column; gap: 30px; max-height: 55vh; overflow-y: auto; padding: 10px;}
.selection-section h3 { margin-bottom: 15px; color: #cbd5e1; letter-spacing: 2px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 5px;}
.card-grid { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.card {
    background: rgba(255,255,255,0.05); border: 2px solid rgba(255,255,255,0.1);
    padding: 15px; border-radius: 16px; cursor: pointer; transition: all 0.2s; width: 140px;
    position: relative; overflow: hidden;
}
.card:hover { background: rgba(255,255,255,0.1); transform: translateY(-3px); }
.card.selected {
    border-color: var(--primary); background: rgba(59, 130, 246, 0.15);
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.4); transform: scale(1.05);
}
.card.locked { filter: grayscale(0.9) brightness(0.7); cursor: not-allowed; opacity: 0.7; }
.card.locked::after {
    content: '🔒'; position: absolute; top: 10px; right: 10px; font-size: 1.2rem;
}
.card-icon { width: 50px; height: 50px; border-radius: 50%; margin: 0 auto 10px auto; box-shadow: inset 0 -5px rgba(0,0,0,0.3); }
.card h4 { margin-bottom: 5px; font-size: 0.9rem; }
.card p { font-size: 0.7rem; color: #94a3b8; }

/* Lobby Header - Auth & Trophies */
.lobby-header {
    width: 100%; display: flex; justify-content: space-between; align-items: flex-start;
    padding-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,0.05); margin-bottom: 10px;
}
.auth-section { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.auth-section input {
    background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.2);
    padding: 8px 15px; border-radius: 8px; color: white; font-weight: bold; width: 180px;
}
.auth-buttons { display: flex; gap: 8px; }
.user-info { display: flex; align-items: center; gap: 15px; background: rgba(255,255,255,0.1); padding: 5px 15px; border-radius: 10px; }
.user-info span { font-weight: 900; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.admin-badge {
    background: linear-gradient(135deg, #fde047, #f59e0b);
    color: #451a03;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 900;
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.6);
    letter-spacing: 0.5px;
}

.sm-btn { padding: 8px 15px; font-size: 0.8rem; border-radius: 8px; margin: 0; box-shadow: none; }
.sm-btn.accent { background: linear-gradient(135deg, var(--accent), #059669); }
.sm-btn.danger { background: linear-gradient(135deg, var(--danger), #dc2626); }

.trophy-road-container { flex-grow: 1; margin-left: 40px; display: flex; flex-direction: column; gap: 10px; }
.trophy-count { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.5rem; color: #fde047; }
.trophy-bar-bg {
    width: 100%; height: 20px; background: rgba(0,0,0,0.4); border-radius: 10px; position: relative;
    border: 1px solid rgba(255,255,255,0.1);
}
.trophy-bar-fill {
    width: 0%; height: 100%; background: linear-gradient(90deg, #fde047, #f59e0b);
    border-radius: 10px; transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.trophy-milestone { position: absolute; top: -5px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.milestone-mark { width: 4px; height: 30px; background: rgba(255,255,255,0.3); border-radius: 2px; }
.milestone-label { font-size: 0.6rem; font-weight: bold; text-align: center; margin-top: 5px; line-height: 1.2; color: #94a3b8; }

button {
    padding: 18px 50px; font-size: 1.5rem; font-weight: 800; color: white;
    background: linear-gradient(135deg, var(--primary), #2563eb); border: none;
    border-radius: 15px; cursor: pointer; transition: all 0.2s; text-transform: uppercase;
    box-shadow: 0 8px 25px var(--primary-glow); margin-top: 10px;
}
button:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 12px 30px rgba(59, 130, 246, 0.7); }
button:active { transform: translateY(2px); }
