@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;700&display=swap');

:root {
    --red: #db202c;
    --neon-blue: #00f2ff;
    --dark-bg: #0b0d12;
}

body {
    background-color: var(--dark-bg);
    color: #e0e0e0;
    font-family: 'Oswald', sans-serif;
    margin: 0;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Фон Изнанки */
.ash-container {
    position: fixed;
    width: 100%; height: 100%;
    background: radial-gradient(circle at center, #1a1f2b 0%, #050505 100%);
    z-index: -1;
}

/* Эффект частиц пепла (через CSS анимацию) */
.ash-container::after {
    content: "";
    position: absolute;
    top: -100%; left: 0; width: 100%; height: 200%;
    background-image: url('https://www.transparenttextures.com/patterns/stardust.png');
    animation: drift 20s linear infinite;
    opacity: 0.3;
}

@keyframes drift {
    from { transform: translateY(0); }
    to { transform: translateY(50%); }
}

.main-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Секция квиза */
.quiz-section {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    padding: 20px;
}

#game-container {
    width: 100%;
    max-width: 600px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid var(--red);
    box-shadow: 0 0 30px rgba(219, 32, 44, 0.2);
    padding: 40px;
    position: relative;
}

/* Логотип */
.logo {
    font-size: 4rem;
    color: var(--red);
    text-shadow: 0 0 15px var(--red);
    margin: 0;
    line-height: 0.8;
}
.sub-logo { 
    letter-spacing: 4px; 
    font-size: 0.9rem; 
    margin-bottom: 30px; 
    color: #666; 
}

/* Таймер */
#timer-bar {
    width: 100%;
    height: 4px;
    background: #222;
    margin-bottom: 15px;
}
#timer-progress {
    height: 100%;
    background: var(--neon-blue);
    width: 100%;
    transition: width 1s linear, background-color 0.3s;
    box-shadow: 0 0 10px var(--neon-blue);
}

#timer-progress.warning {
    background-color: #ff0000 !important;
    box-shadow: 0 0 15px #ff0000;
    animation: pulse-red 0.5s infinite alternate;
}

@keyframes pulse-red {
    from { opacity: 1; }
    to { opacity: 0.5; }
}

/* Кнопки ответов */
.btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 30px;
}

button {
    background: transparent;
    border: 1px solid #444;
    color: white;
    padding: 15px;
    cursor: pointer;
    font-family: inherit;
    text-transform: uppercase;
    transition: 0.2s;
    font-size: 0.9rem;
}

button:hover {
    border-color: var(--red);
    box-shadow: inset 0 0 10px rgba(219, 32, 44, 0.5);
    color: var(--red);
}

/* Анимация правильного ответа */
.btn-ans.correct {
    background-color: #2ecc71 !important;
    border-color: #2ecc71 !important;
    color: #000 !important;
    animation: glow-green 0.5s ease-in-out;
}

@keyframes glow-green {
    0% { box-shadow: 0 0 5px #2ecc71; }
    50% { box-shadow: 0 0 20px #2ecc71; }
    100% { box-shadow: 0 0 5px #2ecc71; }
}

/* Эффект неправильного ответа */
.btn-ans.wrong {
    background-color: #db202c !important;
    border-color: #db202c !important;
    color: #fff !important;
    animation: shake 0.3s linear;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Правая панель лидеров */
.leaderboard-sidebar {
    width: 320px;
    background: rgba(15, 15, 15, 0.9);
    border-left: 1px solid #333;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.side-title {
    color: var(--red);
    text-align: center;
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-size: 1.4rem;
    text-shadow: 0 0 10px rgba(219, 32, 44, 0.5);
}

/* НОВЫЕ СТИЛИ ДЛЯ ТАБЛИЦЫ ЛИДЕРОВ */
#leaderboard-list {
    flex: 1;
    overflow-y: auto;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    table-layout: fixed; /* Фиксируем ширину колонок */
}

.leaderboard-table thead {
    position: sticky;
    top: 0;
    background: rgba(15, 15, 15, 0.95);
    z-index: 1;
}

/* Распределение ширины колонок */
.leaderboard-table th:nth-child(1), 
.leaderboard-table td:nth-child(1) { width: 45px; text-align: center; }

.leaderboard-table th:nth-child(2), 
.leaderboard-table td:nth-child(2) { text-align: left; padding-left: 10px; }

.leaderboard-table th:nth-child(3), 
.leaderboard-table td:nth-child(3) { width: 70px; text-align: right; padding-right: 20px; }

.leaderboard-table th {
    color: #888;
    padding: 15px 5px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--red);
}

.leaderboard-table td {
    padding: 14px 5px;
    border-bottom: 1px solid rgba(219, 32, 44, 0.1);
    vertical-align: middle;
}

.leaderboard-table tr:hover {
    background: rgba(219, 32, 44, 0.1);
}

/* Стили для ячеек */
.leaderboard-table .rank {
    font-weight: bold;
    color: var(--red);
    font-size: 1.1rem;
}

.leaderboard-table .name {
    color: #e0e0e0;
    font-weight: 500;
    white-space: nowrap;      /* Не переносим имя */
    overflow: hidden;         /* Скрываем лишнее */
    text-overflow: ellipsis;  /* Ставим три точки если имя очень длинное */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leaderboard-table .score {
    color: var(--neon-blue);
    font-weight: bold;
    font-size: 1.1rem;
    text-shadow: 0 0 8px rgba(0, 242, 255, 0.5);
}

/* Топ-3 особые стили */
.leaderboard-table tbody tr:nth-child(1) .rank {
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.leaderboard-table tbody tr:nth-child(1) .name {
    color: #FFD700;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
}

.leaderboard-table tbody tr:nth-child(2) .rank {
    color: #C0C0C0;
}

.leaderboard-table tbody tr:nth-child(3) .rank {
    color: #CD7F32;
}

/* Сообщения об ошибках */
.no-data, .error-message {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
}

.error-message {
    color: var(--red);
}

/* Реклама */
.ad-slot {
    width: 240px;
    height: 600px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(219, 32, 44, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ad-label {
    color: #333;
    font-size: 0.7rem;
    letter-spacing: 2px;
    transform: rotate(-90deg);
}

/* Инпут */
input {
    width: 100%;
    padding: 15px;
    box-sizing: border-box;
    background: #000;
    border: 1px solid #333;
    color: white;
    margin-bottom: 20px;
    font-family: inherit;
    font-size: 1rem;
}

input:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 10px rgba(219, 32, 44, 0.3);
}

/* Ошибка авторизации */
.error {
    color: var(--red);
    margin-top: 10px;
    font-size: 0.9rem;
}

/* Неоновый текст */
.neon-text { 
    text-shadow: 0 0 10px var(--red); 
    color: var(--red); 
}

/* Статистика в хедере квиза */
.quiz-header {
    margin-bottom: 30px;
}

.stats {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.9rem;
    color: #888;
}

/* Вопрос */
#question-text {
    font-size: 1.4rem;
    line-height: 1.5;
    margin: 20px 0;
    color: #fff;
}

/* Экран результатов */
#result-screen {
    text-align: center;
}

#result-screen h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

#final-score {
    font-size: 1.3rem;
    margin: 30px 0;
    color: var(--neon-blue);
}

#result-screen button {
    margin: 10px;
    min-width: 200px;
}

/* Скроллбар для сайдбара */
.leaderboard-sidebar::-webkit-scrollbar {
    width: 8px;
}

.leaderboard-sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

.leaderboard-sidebar::-webkit-scrollbar-thumb {
    background: var(--red);
    border-radius: 4px;
}

.leaderboard-sidebar::-webkit-scrollbar-thumb:hover {
    background: #ff0000;
}

/* Адаптивность */
@media (max-width: 1200px) {
    .ad-slot {
        display: none;
    }
}

@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }
    
    .leaderboard-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid #333;
        max-height: 300px;
    }
    
    #game-container {
        padding: 20px;
    }
    
    .logo {
        font-size: 2.5rem;
    }
    
    .btn-grid {
        grid-template-columns: 1fr;
    }
}