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

body {
    overflow: hidden;
    background: #0a0a0a;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
}

#gameCanvas {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
}

/* Start Screen */
#startScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a0a 100%);
    z-index: 100;
}

#startScreen h1 {
    font-size: 72px;
    color: #00ff88;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.5),
                 0 0 40px rgba(0, 255, 136, 0.3);
    margin-bottom: 10px;
    letter-spacing: 4px;
}

#startScreen .subtitle {
    font-size: 16px;
    color: #888;
    margin-bottom: 40px;
}

#nameInput {
    width: 300px;
    padding: 14px 20px;
    font-size: 20px;
    border: 2px solid #333;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    text-align: center;
    outline: none;
    transition: border-color 0.3s;
    margin-bottom: 20px;
}

#nameInput:focus {
    border-color: #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

#nameInput::placeholder {
    color: #555;
}

#playBtn {
    width: 300px;
    padding: 14px 40px;
    font-size: 22px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: #000;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    letter-spacing: 2px;
}

#playBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

#playBtn:active {
    transform: scale(0.98);
}

.controls-info {
    margin-top: 30px;
    color: #666;
    font-size: 14px;
    text-align: center;
    line-height: 2;
}

.controls-info span {
    color: #00ff88;
}

/* Death Screen */
#deathScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
}

#deathScreen.visible {
    display: flex;
}

#deathScreen h2 {
    font-size: 48px;
    color: #ff4444;
    text-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
    margin-bottom: 10px;
}

#deathScreen .death-info {
    font-size: 18px;
    color: #ccc;
    margin-bottom: 10px;
}

#deathScreen .death-score {
    font-size: 32px;
    color: #ffcc00;
    margin-bottom: 30px;
}

#respawnBtn {
    padding: 14px 40px;
    font-size: 20px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #ff4444, #cc3333);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    letter-spacing: 2px;
}

#respawnBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
}

/* HUD */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 50;
    display: none;
}

#hud.visible {
    display: block;
}

#scoreDisplay {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
}

#pingDisplay {
    position: absolute;
    bottom: 20px;
    right: 20px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

/* Leaderboard */
#leaderboard {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 200px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    padding: 12px;
    backdrop-filter: blur(5px);
}

#leaderboard h3 {
    color: #fff;
    font-size: 14px;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

#leaderboard .lb-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 3px;
}

#leaderboard .lb-entry.self {
    color: #00ff88;
    font-weight: bold;
    background: rgba(0, 255, 136, 0.1);
}

#leaderboard .lb-rank {
    width: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
}

#leaderboard .lb-entry.self .lb-rank {
    color: rgba(0, 255, 136, 0.6);
}

#leaderboard .lb-name {
    flex: 1;
    margin-left: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#leaderboard .lb-score {
    margin-left: 8px;
    font-variant-numeric: tabular-nums;
}

/* Player count */
#playerCount {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

/* Mobile Controls */
#mobileControls {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

@media (hover: none) and (pointer: coarse) {
    #mobileControls {
        display: block;
    }
}

#joystickZone {
    position: absolute;
    bottom: 30px;
    left: 30px;
    width: 150px;
    height: 150px;
    pointer-events: auto;
    touch-action: none;
}

#joystickBase {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

#joystickStick {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    position: absolute;
}

#boostBtn {
    position: absolute;
    bottom: 50px;
    right: 50px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
    font-size: 36px;
    pointer-events: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    transition: background 0.1s, transform 0.1s;
}

#boostBtn:active, #boostBtn.active {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
    transform: scale(0.95);
}

