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

body {
    font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    background-color: #f5f5f5;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    cursor: crosshair;
    background-color: #f5f5f5;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#leaderboard {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 20px;
    border-radius: 20px;
    min-width: 200px;
    pointer-events: all;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

#leaderboard h3 {
    margin-bottom: 15px;
    font-size: 20px;
    text-align: center;
    color: #6366f1;
    font-weight: 600;
}

#leaderboard-list {
    list-style: none;
    font-size: 16px;
}

#leaderboard-list li {
    margin: 8px 0;
    padding: 5px 10px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.05);
    transition: all 0.2s ease;
}

#leaderboard-list li:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: translateX(5px);
}

#score-display {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 24px;
    font-weight: 600;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

#minimap {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-radius: 15px;
    padding: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

#minimapCanvas {
    display: block;
    border-radius: 10px;
}

#start-menu, #game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.98);
    color: #333;
    padding: 50px;
    border-radius: 30px;
    text-align: center;
    z-index: 100;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    min-width: 400px;
}

#start-menu h1 {
    font-size: 56px;
    margin-bottom: 10px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

#game-over h2 {
    font-size: 42px;
    margin-bottom: 20px;
    color: #ef4444;
    font-weight: 700;
}

#playerName {
    width: 100%;
    padding: 18px 25px;
    font-size: 18px;
    border: 2px solid #e5e7eb;
    border-radius: 15px;
    margin-bottom: 25px;
    text-align: center;
    background: #f9fafb;
    font-family: 'Fredoka', sans-serif;
    font-weight: 400;
    transition: all 0.3s ease;
}

#playerName:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: white;
}

#playerName::placeholder {
    color: #9ca3af;
    opacity: 1;
}

.mode-btn, #createRoomBtn, #joinRoomBtn, #startGameBtn, #respawnBtn {
    padding: 18px 35px;
    font-size: 18px;
    border: none;
    border-radius: 15px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    margin: 8px;
    font-family: 'Fredoka', sans-serif;
    position: relative;
    overflow: hidden;
}

.mode-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-width: 180px;
}

.mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}

.mode-btn:active {
    transform: translateY(0);
}

#createRoomBtn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

#joinRoomBtn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    width: 100%;
}

#startGameBtn, #respawnBtn {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

#game-mode-selection {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 25px 0;
    flex-wrap: wrap;
}

#multiplayer-options {
    margin: 25px 0;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#roomCode {
    width: 100%;
    max-width: 400px;
    padding: 12px;
    font-size: 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    margin: 8px 0;
    background: #f9fafb;
    font-family: monospace;
    transition: all 0.3s ease;
    resize: vertical;
    min-height: 80px;
}

#roomCode:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: white;
}

.or-divider {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 400px;
    margin: 20px 0;
}

.or-divider::before,
.or-divider::after {
    content: '';
    flex: 1;
    height: 2px;
    background: #e5e7eb;
}

.or-divider span {
    padding: 0 20px;
    color: #9ca3af;
    font-weight: 600;
    font-size: 14px;
}

.room-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
    gap: 15px;
}

.join-room {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 400px;
}

#roomCode {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-family: 'Fredoka', sans-serif;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

#roomCode:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#roomCode::placeholder {
    color: #9ca3af;
}

#joinRoomBtn {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(67, 233, 123, 0.3);
}

#joinRoomBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(67, 233, 123, 0.4);
}

#room-info {
    background: rgba(99, 102, 241, 0.05);
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
    border: 2px solid rgba(99, 102, 241, 0.1);
}

#room-info p {
    margin: 8px 0;
    font-size: 18px;
    color: #4b5563;
}

#currentRoomCode {
    font-weight: 700;
    color: #6366f1;
    font-size: 24px;
    letter-spacing: 2px;
}

#controls-info {
    margin-top: 35px;
    padding-top: 25px;
    border-top: 2px solid #e5e7eb;
}

#controls-info p {
    margin: 8px 0;
    font-size: 16px;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#controls-info p::before {
    content: '•';
    color: #6366f1;
    font-size: 20px;
}

#finalScore {
    font-size: 36px;
    color: #6366f1;
    font-weight: 700;
}

/* Animations */
@keyframes blob {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.mode-btn:hover {
    animation: blob 2s infinite;
}

/* Responsive design */
@media (max-width: 768px) {
    #start-menu, #game-over {
        padding: 30px;
        min-width: 320px;
        width: 90%;
    }
    
    #start-menu h1 {
        font-size: 42px;
    }
    
    #leaderboard {
        font-size: 14px;
        min-width: 160px;
        padding: 15px;
    }
    
    #game-mode-selection {
        flex-direction: column;
        align-items: center;
    }
    
    .mode-btn {
        width: 100%;
        max-width: 250px;
    }
    
    #minimap {
        bottom: 100px;
    }
}

/* Custom scrollbar for leaderboard */
#leaderboard-list::-webkit-scrollbar {
    width: 6px;
}

#leaderboard-list::-webkit-scrollbar-track {
    background: rgba(99, 102, 241, 0.05);
    border-radius: 3px;
}

#leaderboard-list::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 3px;
}

#leaderboard-list::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}