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

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    color: white;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeIn 1s ease-in;
}

.title {
    font-family: 'Orbitron', sans-serif;
    font-size: 3.5em;
    font-weight: 900;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(78, 205, 196, 0.3);
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.8;
}

.auth-section {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.auth-form {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-form h3 {
    margin-bottom: 20px;
    font-family: 'Orbitron', sans-serif;
    color: #4ecdc4;
}

.auth-form input {
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    text-align: center;
}

.auth-form button {
    width: 100%;
    padding: 15px;
    margin: 15px 0;
    border: none;
    border-radius: 10px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.auth-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.switch-auth {
    color: #4ecdc4;
    cursor: pointer;
    margin-top: 15px;
}

.switch-auth:hover {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

.game-section {
    animation: slideUp 0.5s ease-out;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.player-info {
    display: flex;
    gap: 20px;
    font-weight: 500;
}

.logout-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.logout-btn:hover {
    background: #ff5252;
}

.game-controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
}

.primary-btn, .secondary-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.primary-btn:hover, .secondary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.game-area {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 30px;
    min-height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

.waiting-room, .game-canvas, .leaderboard {
    text-align: center;
    width: 100%;
}

.loading {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #4ecdc4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

.cancel-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
}

#racerCanvas {
    background: #000;
    border-radius: 10px;
    border: 3px solid #4ecdc4;
    box-shadow: 0 0 30px rgba(78, 205, 196, 0.3);
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.player1-info, .player2-info {
    text-align: center;
}

.timer {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5em;
    color: #ffd700;
}

.leaderboard h3 {
    margin-bottom: 20px;
    color: #ffd700;
}

#leaderboardList {
    margin-bottom: 20px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: background 0.3s ease;
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

.leaderboard-item.you {
    background: rgba(78, 205, 196, 0.3);
    border: 1px solid #4ecdc4;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-weight: 500;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: #4ecdc4;
    color: white;
}

.notification.error {
    background: #ff6b6b;
    color: white;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Адаптивность */
@media (max-width: 768px) {
    .title {
        font-size: 2.5em;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-controls {
        flex-direction: column;
    }
    
    #racerCanvas {
        width: 100%;
        height: auto;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
    }
}