/* 🚀 Космическая тема PRO - Улучшенная контрастность */

/* Фоновое видео */
#bgVideo {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
}

/* Затемнение для видео */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(10, 14, 39, 0.7) 0%, rgba(26, 26, 62, 0.8) 50%, rgba(45, 27, 78, 0.9) 100%);
    z-index: -3;
    pointer-events: none;
}

/* Плавная загрузка страницы */
body {
    animation: pageLoad 1s ease-out;
}

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

/* Анимированный заголовок */
h1 {
    background: linear-gradient(45deg, #00d4ff, #ff00ff, #ffff00, #00d4ff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Экраны с эффектом появления */
.load-screen, .setup-screen {
    background: rgba(20, 20, 60, 0.95);
    border: 3px solid #00d4ff;
    box-shadow: 0 0 50px rgba(0, 212, 255, 0.7);
    animation: screenAppear 0.6s ease-out;
    backdrop-filter: blur(10px);
}

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

.load-screen h2, .setup-screen h2 {
    color: #ffff00;
    text-shadow: 0 0 15px #ffff00;
    animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 0 0 15px #ffff00; }
    to { text-shadow: 0 0 25px #ffff00, 0 0 35px #ffff00; }
}

/* Анимация для тем */
.theme-option {
    background: rgba(45, 27, 78, 0.7);
    border: 3px solid #667eea;
    color: #ffffff;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.theme-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.theme-option:hover::before {
    left: 100%;
}

.theme-option:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
}

.theme-option.selected {
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.3);
    box-shadow: 0 0 40px rgba(0, 212, 255, 1);
    animation: selectedPulse 2s infinite;
}

@keyframes selectedPulse {
    0%, 100% { box-shadow: 0 0 40px rgba(0, 212, 255, 1); }
    50% { box-shadow: 0 0 60px rgba(0, 212, 255, 1); }
}

/* Кнопки с эффектами */
.file-input-label, .btn, .team-btn, .answer-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.file-input-label::before, .btn::before, .team-btn::before, .answer-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.file-input-label:hover::before, .btn:hover::before, .team-btn:hover::before, .answer-btn:hover::before {
    width: 300px;
    height: 300px;
}

.file-input-label {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 0 25px rgba(102, 126, 234, 0.6);
}

.file-input-label:hover {
    transform: scale(1.05);
    box-shadow: 0 0 35px rgba(102, 126, 234, 0.8);
}

.btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 0 25px rgba(240, 147, 251, 0.6);
}

.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 35px rgba(240, 147, 251, 0.8);
}

/* Анимированные статус-сообщения */
.status-message {
    animation: slideInFromTop 0.5s ease-out;
}

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

.status-message.success {
    background: rgba(0, 255, 136, 0.2);
    border-color: #00ff88;
    color: #00ff88;
    animation: successPulse 1s ease-in-out;
}

@keyframes successPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.status-message.error {
    background: rgba(255, 68, 68, 0.2);
    border-color: #ff4444;
    color: #ff4444;
    animation: errorShake 0.5s ease-in-out;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Анимированные счетчики команд с подложкой */
.team-score {
    background: rgba(20, 20, 60, 0.85);
    border: 3px solid #667eea;
    box-shadow: 0 0 25px rgba(102, 126, 234, 0.4);
    transition: all 0.4s ease;
    animation: teamAppear 0.6s ease-out;
}

/* Названия команд с подложкой */
.team-score h3 {
    background: rgba(10, 10, 40, 0.7);
    padding: 8px 15px;
    border-radius: 10px;
    display: inline-block;
}

@keyframes teamAppear {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.team-score.active {
    background: rgba(240, 147, 251, 0.9);
    border-color: #f093fb;
    box-shadow: 0 0 40px rgba(240, 147, 251, 1);
    animation: activeTeamGlow 1.5s ease-in-out infinite alternate;
}

@keyframes activeTeamGlow {
    from { box-shadow: 0 0 40px rgba(240, 147, 251, 1); }
    to { box-shadow: 0 0 60px rgba(240, 147, 251, 1); }
}

.team-score .score {
    color: #00ff88;
    text-shadow: 0 0 20px #00ff88;
    transition: all 0.3s ease;
    animation: scoreGlow 2s ease-in-out infinite alternate;
}

@keyframes scoreGlow {
    from { text-shadow: 0 0 20px #00ff88; }
    to { text-shadow: 0 0 30px #00ff88, 0 0 40px #00ff88; }
}

/* Названия категорий с подложкой */
.category-name {
    background: rgba(20, 20, 60, 0.85) !important;
    border: 2px solid #667eea !important;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.5);
}

/* Анимированные ячейки вопросов - больше прозрачности */
.question-cell {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.65), rgba(118, 75, 162, 0.75));
    border: 2px solid rgba(102, 126, 234, 0.6);
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.question-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.question-cell:hover::before {
    left: 100%;
}

.question-cell:hover {
    transform: translateY(-3px) scale(1.05);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.85), rgba(118, 75, 162, 0.9));
    box-shadow: 0 0 25px rgba(102, 126, 234, 0.6);
}

.question-cell.used {
    background: #2d2d5e;
    border-color: #555;
    animation: usedFade 0.5s ease-out;
}

@keyframes usedFade {
    to {
        opacity: 0.4;
        transform: scale(0.95);
    }
}

/* Модальное окно с продвинутой анимацией */
.modal-content {
    background: linear-gradient(135deg, #1a1a3e 0%, #2d1b4e 100%);
    border: 3px solid #00d4ff;
    box-shadow: 0 0 60px rgba(0, 212, 255, 0.8);
    animation: modalAppear 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(15px);
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal h2 {
    color: #ffff00;
    text-shadow: 0 0 20px #ffff00;
    animation: modalTitlePulse 2s infinite;
}

@keyframes modalTitlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Кнопки выбора команды - ТЁМНЫЕ с контрастом */
.team-btn {
    background: linear-gradient(135deg, rgba(45, 27, 78, 0.95), rgba(26, 26, 62, 0.95));
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0,0,0,.8), 0 0 15px rgba(102, 126, 234, 0.6);
    border: 3px solid #667eea;
    box-shadow: 0 0 25px rgba(102, 126, 234, 0.7);
    transition: all .3s ease;
    font-weight: bold;
}
.team-btn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95), rgba(118, 75, 162, 0.95));
    box-shadow: 0 0 35px rgba(102, 126, 234, 0.9);
    border-color: #f093fb;
}

/* Кнопки вариантов ответа - ТЁМНЫЕ с контрастом */
.answer-btn {
    background: rgba(45, 27, 78, 0.95);
    border: 3px solid #667eea;
    color: #ffffff;
    text-shadow: 0 2px 6px rgba(0,0,0,.7);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.answer-btn:hover {
    background: rgba(102, 126, 234, 0.95);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.7);
    border-color: #f093fb;
}

.answer-btn.correct {
    background: #00ff88;
    border-color: #00ff88;
    color: #000;
    text-shadow: none;
    animation: correctAnswer 0.6s ease-out;
}

@keyframes correctAnswer {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.answer-btn.wrong {
    background: #ff4444;
    border-color: #ff4444;
    color: #fff;
    animation: wrongAnswer 0.5s ease-out;
}

@keyframes wrongAnswer {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Финальный экран с эффектами */
.final-screen h2 {
    animation: finalTitleBounce 1s ease-out;
}

@keyframes finalTitleBounce {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(-50px);
    }
    60% {
        transform: scale(1.1) translateY(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.final-team {
    background: rgba(45, 27, 78, 0.7);
    border: 2px solid #667eea;
    transition: all 0.4s ease;
}

.final-team:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
}

.final-team.winner {
    background: rgba(240, 147, 251, 0.6);
    border: 3px solid #f093fb;
    box-shadow: 0 0 50px rgba(240, 147, 251, 1);
    animation: winnerGlow 2s ease-in-out infinite;
}

@keyframes winnerGlow {
    0%, 100% {
        box-shadow: 0 0 50px rgba(240, 147, 251, 1);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 70px rgba(240, 147, 251, 1);
        transform: scale(1.02);
    }
}

/* Дополнительные частицы для эффекта */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 10% 20%, rgba(0, 212, 255, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(240, 147, 251, 0.1) 0%, transparent 20%);
    pointer-events: none;
    z-index: -1;
    animation: particleFloat 20s ease-in-out infinite;
}

@keyframes particleFloat {
    0%, 100% { transform: translateY(0) translateX(0); }
    33% { transform: translateY(-30px) translateX(20px); }
    66% { transform: translateY(20px) translateX(-20px); }
}