:root {
    --bg-dark: #0f0c29;
    --bg-mid: #302b63;
    --bg-light: #24243e;
    --neon-blue: #00f3ff;
    --neon-pink: #ff0055;
    --neon-purple: #9d00ff;
    --neon-yellow: #ffff00;
    --text-main: #ffffff;
    --glass-bg: rgba(20, 20, 40, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Rajdhani', sans-serif;
    user-select: none;
}

/* Disable selection for mobile */

body {
    background: linear-gradient(135deg, var(--bg-dark), var(--bg-mid), var(--bg-light));
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    touch-action: none;
    /* Prevent browser scrolling on mobile swipe */
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    padding: 2rem;
}

.hidden {
    display: none !important;
}

.active {
    display: flex;
    flex-direction: column;
}

.overlay-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 100;
    min-width: 350px;
}

/* Auth Modals */
.auth-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.auth-tab {
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding-bottom: 5px;
    font-family: 'Orbitron', sans-serif;
    transition: 0.3s;
}

.auth-tab.active {
    color: var(--neon-blue);
    border-bottom: 2px solid var(--neon-blue);
    text-shadow: 0 0 10px var(--neon-blue);
}

.auth-form {
    gap: 1rem;
    align-items: center;
}

.btn-small {
    padding: 0.8rem 2rem;
    font-size: 1rem;
    margin-top: 10px;
}

h1.neon-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    font-weight: 900;
    text-align: center;
    color: #fff;
    text-shadow: 0 0 10px var(--neon-blue), 0 0 20px var(--neon-blue), 0 0 40px var(--neon-purple);
    margin-bottom: 0.5rem;
    animation: pulse 2s infinite alternate;
}

@keyframes pulse {
    0% {
        transform: scale(0.98);
        opacity: 0.9;
        text-shadow: 0 0 10px var(--neon-blue), 0 0 20px var(--neon-blue);
    }

    100% {
        transform: scale(1.02);
        opacity: 1;
        text-shadow: 0 0 20px var(--neon-blue), 0 0 40px var(--neon-purple), 0 0 60px var(--neon-blue);
    }
}

.subtitle {
    text-align: center;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
    letter-spacing: 2px;
}

.user-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
}

.level-badge {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--neon-yellow);
    text-shadow: 0 0 5px var(--neon-yellow);
    margin-bottom: 5px;
}

.xp-bar {
    width: 200px;
    height: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.xp-fill {
    width: 0%;
    height: 100%;
    background: var(--neon-yellow);
    box-shadow: 0 0 10px var(--neon-yellow);
    transition: width 0.3s ease;
}

.login-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    max-width: 300px;
    padding: 1rem 1.5rem;
    font-size: 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--neon-blue);
    border-radius: 50px;
    color: #fff;
    outline: none;
    transition: all 0.3s ease;
    text-align: center;
    margin-bottom: 10px;
    user-select: text;
}

input:focus {
    border-color: var(--neon-pink);
    box-shadow: inset 0 0 15px rgba(255, 0, 85, 0.3);
}

.neon-btn {
    position: relative;
    padding: 1rem 3rem;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    background: transparent;
    border: 2px solid var(--neon-blue);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px var(--neon-blue), inset 0 0 10px var(--neon-blue);
}

.neon-btn:hover {
    background: var(--neon-blue);
    color: #000;
    box-shadow: 0 0 20px var(--neon-blue), 0 0 40px var(--neon-blue);
    transform: translateY(-3px);
}

/* Game Area */
#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#landscapeOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.top-bar {
    position: absolute;
    top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    max-width: 1200px;
    padding: 0.5rem 2rem;
    z-index: 10;
    font-size: 1.5rem;
    border-radius: 50px;
}

.team-score {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
    font-family: 'Orbitron', sans-serif;
}

.blue-team {
    color: var(--neon-blue);
    text-shadow: 0 0 10px var(--neon-blue);
}

.red-team {
    color: var(--neon-pink);
    text-shadow: 0 0 10px var(--neon-pink);
}

.timer {
    font-size: 2rem;
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 10px #fff;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(0, 0, 0, 0.5);
    background: radial-gradient(circle at center, #111, #000);
}

/* In-game HUD */
#stamina-ui {
    position: absolute;
    top: 80px;
    left: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stamina-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Orbitron', sans-serif;
}

.stamina-bar {
    width: 150px;
    height: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
}

.stamina-fill {
    width: 100%;
    height: 100%;
    background: #00ff00;
    box-shadow: 0 0 10px #00ff00;
    transition: width 0.1s linear, background 0.3s;
    border-radius: 4px;
}

#emoji-hints {
    position: absolute;
    top: 80px;
    right: 20px;
    z-index: 10;
    display: flex;
    gap: 5px;
    font-size: 1rem;
    opacity: 0.8;
    font-family: 'Orbitron', sans-serif;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 10px;
}

/* Mobile On-Screen Controls (Joystick & Buttons) */
#mobile-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    z-index: 50;
    pointer-events: none;
}

#joystick-zone {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(0, 243, 255, 0.3);
    pointer-events: auto;
}

#joystick-knob {
    position: absolute;
    top: 50px;
    left: 50px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 243, 255, 0.6);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.8);
    pointer-events: none;
    transition: 0.05s ease-out;
}

#action-buttons {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 15px;
    pointer-events: auto;
}

.mobile-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.mobile-btn:active {
    transform: scale(0.9);
}

#btn-kick {
    border-color: var(--neon-pink);
    color: var(--neon-pink);
    text-shadow: 0 0 5px var(--neon-pink);
    box-shadow: inset 0 0 10px rgba(255, 0, 85, 0.3);
}

#btn-dash {
    border-color: var(--neon-yellow);
    color: var(--neon-yellow);
    text-shadow: 0 0 5px var(--neon-yellow);
    box-shadow: inset 0 0 10px rgba(255, 255, 0, 0.3);
}

.goal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    opacity: 1;
    transition: opacity 0.5s ease;
}

h2.neon-text-goal {
    font-family: 'Orbitron', sans-serif;
    font-size: 8rem;
    color: #fff;
    text-shadow: 0 0 30px #ffff00, 0 0 60px #ffaa00, 0 0 100px #ff0000;
    animation: zoomPulse 0.5s ease-out forwards;
}

@keyframes zoomPulse {
    0% {
        transform: scale(0.1);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Desktop Chat vs Mobile Chat */
.chat-container {
    position: absolute;
    left: 20px;
    bottom: 20px;
    width: 300px;
    height: 200px;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    z-index: 15;
    background: rgba(20, 20, 40, 0.8);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 0.5rem;
    padding-right: 0.5rem;
    font-size: 0.9rem;
}

.chat-messages p {
    margin-bottom: 0.3rem;
    animation: fadeIn 0.3s ease;
}

.chat-messages .sender {
    font-weight: 700;
    color: var(--neon-blue);
    margin-right: 5px;
}

.chat-messages .sender.system {
    color: var(--neon-pink);
}

.chat-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.chat-input-wrapper input {
    flex: 1;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.3rem 0.5rem;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    outline: none;
    font-size: 0.9rem;
}

.icon-btn {
    padding: 0 1rem;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8rem;
}

.status-message {
    margin-top: 1rem;
    font-size: 1.2rem;
    color: var(--neon-pink);
    min-height: 24px;
    text-align: center;
}

#endGameMessage {
    font-size: 1.5rem;
    margin: 1rem 0 2rem 0;
}

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: var(--neon-blue);
    border-radius: 2px;
}

/* Responsive / Mobile Adjustments */
@media screen and (max-width: 900px) {
    .chat-container {
        display: none;
    }

    /* Hide chat on mobile gameplay to save space */
    .top-bar {
        top: 5px;
        padding: 0.2rem 1rem;
        font-size: 1rem;
    }

    .timer {
        font-size: 1.5rem;
    }

    .team-score {
        font-size: 1rem;
    }

    #emoji-hints {
        display: none;
    }

    /* Hide emoji hints keyboard on mobile */
    .mobile-only {
        display: flex !important;
    }
}

@media screen and (min-width: 901px) {
    #mobile-controls {
        display: none !important;
    }

    #landscapeOverlay {
        display: none !important;
    }
}