:root {
    --neon-blue: #00f3ff;
    --neon-pink: #ff00ff;
    --text-color: #fff;
}

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

body {
    background-color: #000;
    color: var(--text-color);
    font-family: 'Orbitron', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    touch-action: none;
    /* Prevent scroll/zoom on mobile */
    user-select: none;
}

/* Responsive Text for Mobile */
@media (max-width: 600px) {
    h1 {
        font-size: 2rem;
    }

    .score-board,
    .speed-indicator,
    .level-indicator {
        font-size: 1rem;
    }

    #level-up-flash {
        font-size: 3rem;
    }

    .overlay input {
        width: 80%;
        font-size: 1rem;
    }

    #mobile-warning {
        display: block !important;
    }
}

#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

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

.score-board,
.speed-indicator,
.level-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--neon-blue);
    text-shadow: 0 0 10px var(--neon-blue);
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 5px;
    border: 1px solid var(--neon-blue);
}

.level-indicator {
    left: auto;
    right: 20px;
    top: 80px;
    /* Moved down to avoid User Icon */
    color: #ffd700;
    border-color: #ffd700;
    text-shadow: 0 0 10px #ffd700;
}

.speed-indicator {
    top: 70px;
    color: var(--neon-pink);
    text-shadow: 0 0 10px var(--neon-pink);
    border-color: var(--neon-pink);
}

#level-up-flash {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 50px #ffd700;
    animation: flash 1s ease-out forwards;
    z-index: 100;
}

@keyframes flash {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    backdrop-filter: blur(5px);
}

.hidden {
    display: none !important;
}

h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--neon-blue);
    text-transform: uppercase;
    text-shadow: 0 0 20px var(--neon-blue);
    text-align: center;
}

.key {
    display: inline-block;
    padding: 5px 10px;
    background: #333;
    border-radius: 4px;
    border: 1px solid #666;
    margin: 0 5px;
}

button {
    margin-top: 30px;
    padding: 15px 40px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    background: transparent;
    color: var(--neon-pink);
    border: 2px solid var(--neon-pink);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.3);
}

button:hover {
    background: var(--neon-pink);
    color: #fff;
    box-shadow: 0 0 30px var(--neon-pink);
    transform: scale(1.05);
}

#mobile-warning {
    display: none;
    /* Hidden on desktop */
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    text-align: center;
    background: rgba(255, 0, 85, 0.9);
    border: 1px solid #ff0055;
    color: #fff;
    padding: 10px;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: bold;
    z-index: 9999;
    /* Max Z-index */
    pointer-events: none;
}

/* --- Social Features --- */

/* User Icon */
.user-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #00f3ff;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    z-index: 100;
    /* Clickable above overlay */
    overflow: hidden;
    transition: all 0.3s ease;
}

.user-icon:hover {
    box-shadow: 0 0 15px #00f3ff;
    transform: scale(1.1);
}

.user-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Inputs */
.overlay input {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #00f3ff;
    color: #fff;
    padding: 15px;
    font-size: 1.2rem;
    font-family: 'Orbitron', sans-serif;
    margin: 15px 0;
    text-align: center;
    width: 60%;
    border-radius: 10px;
}

.overlay input:focus {
    outline: none;
    box-shadow: 0 0 20px #00f3ff;
}

.error-text {
    color: #ff0055;
    font-size: 1rem;
    text-shadow: 0 0 5px #ff0055;
}

/* Leaderboard List */
#leaderboard-list {
    width: 80%;
    max-width: 600px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #00f3ff;
    border-radius: 10px;
    margin: 20px 0;
    padding: 10px;
    max-height: 50vh;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    /* Tech look */
}

/* Scrollbar */
#leaderboard-list::-webkit-scrollbar {
    width: 8px;
}

#leaderboard-list::-webkit-scrollbar-track {
    background: #111;
}

#leaderboard-list::-webkit-scrollbar-thumb {
    background: #00f3ff;
    border-radius: 4px;
}

.leaderboard-row {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid rgba(0, 243, 255, 0.2);
    font-size: 1.1rem;
}

.leaderboard-row.header {
    color: #00f3ff;
    font-weight: bold;
    border-bottom: 2px solid #00f3ff;
    margin-bottom: 5px;
}

.leaderboard-row.me {
    background: rgba(0, 243, 255, 0.15);
    border: 1px solid #00f3ff;
}

.leaderboard-row span {
    flex: 1;
    text-align: center;
}

.leaderboard-row span:nth-child(2) {
    flex: 2;
    /* Bigger name column */
    text-align: left;
    padding-left: 20px;
}

#pause-btn {
    position: absolute;
    top: 20px;
    right: 80px; /* Left of User Icon (which is at right: 20px) */
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--neon-blue);
    color: #fff;
    cursor: pointer;
    z-index: 100;
    margin-top: 0; /* Reset default button margin */
}

#pause-btn:hover {
    background: var(--neon-blue);
    color: #000;
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--neon-blue);
}

/* Pause Screen Specifics */
#pause-screen h1 {
    color: #ffd700; /* Gold */
    text-shadow: 0 0 20px #ffd700;
}