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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
}

.screen {
    display: none;
    width: 100%;
    max-width: 900px;
    animation: fadeIn 0.5s ease-in;
}

.screen.active {
    display: block;
}

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

.login-container, .waiting-container, .results-container {
    background: white;
    padding: 50px 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.login-container h1 {
    font-size: 48px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-container .subtitle {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

#nicknameInput, #providerInput {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    margin-bottom: 20px;
    transition: border-color 0.3s;
}

#nicknameInput:focus, #providerInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.checkbox-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    color: #555;
    font-size: 14px;
}

.checkbox-container input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.btn-primary {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.timer { display: flex; justify-content: center; margin-bottom: 30px; }
.timer-circle {
    width: 130px; height: 130px; border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex; justify-content: center; align-items: center;
    color: white; font-size: 44px; font-weight: bold;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

#playerCount { font-size: 18px; font-weight: bold; margin-bottom: 20px; color: #667eea; }
.players-list { background: #f5f5f5; border-radius: 10px; padding: 20px; margin-bottom: 20px; max-height: 200px; overflow-y: auto; }
.player-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; background: white; border-radius: 8px; margin-bottom: 8px; }
.player-item .nickname { font-weight: bold; }
.player-item .ping { background: #667eea; color: white; padding: 4px 12px; border-radius: 20px; font-size: 14px; }
.info { color: #999; font-size: 14px; }

/* RACE SCREEN */
.race-header { background: white; padding: 20px; border-radius: 10px 10px 0 0; display: flex; justify-content: space-between; align-items: center; }
.timer-display { font-size: 24px; font-weight: bold; color: #667eea; font-family: monospace; }
.race-track { background: #f9f9f9; border-radius: 0 0 10px 10px; padding: 20px; margin-bottom: 20px; border: 3px solid #ddd; min-height: 280px; }
.race-container { position: relative; width: 100%; height: 240px; border-top: 2px dashed #999; border-bottom: 2px dashed #999; overflow: hidden; }

.racer {
    position: absolute; left: 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
    transition: left 0.1s linear;
}
.racer-name { font-size: 11px; font-weight: bold; background: rgba(0, 0, 0, 0.7); color: white; padding: 2px 6px; border-radius: 4px; }
.racer-ping { font-size: 10px; background: rgba(102, 126, 234, 0.8); color: white; padding: 1px 5px; border-radius: 4px; }

.race-stats { background: white; padding: 20px; border-radius: 10px; margin-bottom: 20px; }
.stats-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }
.stat-card { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 15px; border-radius: 10px; text-align: center; }
.stat-card .nickname { font-weight: bold; margin-bottom: 5px; }

/* TABLES */
.results-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); }
.results-table thead { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.results-table th, .results-table td { padding: 12px 15px; text-align: left; }
.results-table td { border-bottom: 1px solid #eee; }
.results-container .btn-primary { max-width: 250px; margin: 0 auto; display: block; }

/* СТИЛИ ДЛЯ ТАБЛИЦЫ ТОП-10 */
.top10-section {
    margin-top: 35px;
    border-top: 2px dashed #eee;
    padding-top: 25px;
    text-align: left;
}

.top10-section h3 {
    font-size: 18px;
    color: #4a5568;
    margin-bottom: 15px;
    text-align: center;
    letter-spacing: 0.5px;
}

.top10-table-wrapper {
    max-height: 250px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.top10-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #f8fafc;
}

.top10-table th {
    background: #edf2f7;
    color: #4a5568;
    position: sticky;
    top: 0;
    font-weight: 600;
    padding: 10px;
}

.top10-table td {
    padding: 10px;
    border-bottom: 1px solid #e2e8f0;
    color: #4a5568;
}

.top10-table tbody tr:hover {
    background: #f1f5f9;
}

.top-ping {
    background: #e2e8f0;
    color: #4a5568;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
}

