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

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #1e3c72 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 40px;
    animation: fadeIn 0.5s ease-in;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: #1e3c72;
    margin-bottom: 10px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    color: #666;
    font-style: italic;
    font-size: 1.1em;
}

/* Главная страница - сетка тестов */
.tests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.test-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f4f8 100%);
    border: 3px solid #2a5298;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.test-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: rotate(45deg);
    transition: all 0.5s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 0;
}

.test-card:hover::before {
    animation: shine 0.5s ease;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
        opacity: 0;
    }
}

.test-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(42, 82, 152, 0.4);
    border-color: #ffd700;
}

.test-card img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 2px solid #2a5298;
}

.test-card h3 {
    color: #1e3c72;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.test-card p {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 15px;
}

.question-count-selector {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #e0e0e0;
}

.question-count-selector label {
    display: block;
    margin-bottom: 8px;
    color: #1e3c72;
    font-weight: bold;
    font-size: 0.9em;
}

.question-count-selector input[type="radio"] {
    margin-right: 5px;
    transform: scale(1.3);
    accent-color: #2a5298;
}

.question-count-selector .radio-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.start-test-btn {
    margin-top: 15px;
    background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1em;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(42, 82, 152, 0.4);
    font-weight: bold;
    width: 100%;
    position: relative;
    z-index: 1;
}

.start-test-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(42, 82, 152, 0.5);
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #1e3c72;
}

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

/* Прогресс-бар */
.progress-container {
    margin-bottom: 30px;
}

.progress-bar {
    width: 100%;
    height: 35px;
    background-color: #e0e0e0;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    width: 0%;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1e3c72;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Контейнер вопроса */
.question-container {
    margin-bottom: 30px;
    animation: slideIn 0.4s ease-out;
}

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

.question-number {
    color: #1e3c72;
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 10px;
}

.question-text {
    font-size: 1.3em;
    margin-bottom: 25px;
    color: #333;
    line-height: 1.6;
    font-weight: 500;
}

.answers {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.answer-option {
    display: flex;
    align-items: center;
    padding: 18px;
    background: #f8f9fa;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.answer-option:hover {
    background: #e8f4f8;
    border-color: #2a5298;
    transform: translateX(8px);
    box-shadow: 0 4px 12px rgba(42, 82, 152, 0.3);
}

.answer-option input[type="radio"] {
    margin-right: 15px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: #2a5298;
    transform: scale(1.2);
}

.answer-option label {
    cursor: pointer;
    flex: 1;
    font-size: 1.1em;
    color: #333;
    line-height: 1.5;
}

.answer-option.selected {
    background: #e8f4f8;
    border-color: #2a5298;
    box-shadow: 0 4px 12px rgba(42, 82, 152, 0.3);
}

.answer-option.correct {
    background: #d4edda;
    border-color: #28a745;
}

.answer-option.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
}

.answer-result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.answer-result.correct {
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.answer-result.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #dc3545;
}

/* Кнопки */
.button-container {
    text-align: center;
    margin-top: 30px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
    color: white;
    border: none;
    padding: 18px 45px;
    font-size: 1.2em;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(42, 82, 152, 0.4);
    font-weight: bold;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(42, 82, 152, 0.5);
}

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

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.restart-btn {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #1e3c72;
}

.restart-btn:hover {
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5);
}

/* Результаты */
.results-container {
    display: none;
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f4f8 100%);
    border-radius: 15px;
    animation: fadeIn 0.5s ease-in;
}

.results-container.show {
    display: block;
}

.results-header {
    text-align: center;
    margin-bottom: 30px;
}

.score {
    font-size: 3.5em;
    color: #2a5298;
    font-weight: bold;
    margin: 10px 0;
}

.score-text {
    font-size: 1.4em;
    color: #666;
    margin-bottom: 10px;
}

.score-grade {
    font-size: 1.6em;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 10px;
    display: inline-block;
    margin-top: 15px;
}

.score-grade.excellent {
    background: #d4edda;
    color: #155724;
}

.score-grade.good {
    background: #fff3cd;
    color: #856404;
}

.score-grade.needs-work {
    background: #f8d7da;
    color: #721c24;
}

.results-details {
    margin-top: 30px;
}

.result-item {
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 10px;
    border-left: 5px solid;
    animation: slideIn 0.4s ease-out;
}

.result-item.correct {
    background: #d4edda;
    border-color: #28a745;
}

.result-item.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
}

.result-question {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 1.1em;
}

.result-answer {
    font-size: 1em;
    color: #666;
}

.correct-answer {
    color: #28a745;
    font-weight: bold;
}

/* Загрузка */
.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.2em;
    color: #666;
    display: none;
}

.loading.show {
    display: block;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    .tests-grid {
        grid-template-columns: 1fr;
    }

    .question-text {
        font-size: 1.1em;
    }

    .btn {
        padding: 15px 30px;
        font-size: 1em;
        width: 100%;
    }

    .button-container {
        flex-direction: column;
    }
}

