* {
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 20px;
    color: #333;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background-color: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    display: none;
}

.container.visible {
    display: block;
    animation: fadeIn 0.5s ease;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 2.2em;
    font-weight: 700;
    line-height: 1.2;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1.1em;
    font-weight: 300;
}

/* Стили для регистрации */
.student-info {
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 20px;
    display: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.student-info.visible {
    display: block;
    animation: fadeIn 0.8s;
}

.student-info h3 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 1.6em;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

input,
select {
    width: 100%;
    padding: 15px;
    border: 2px solid #ced4da;
    border-radius: 12px;
    font-size: 1em;
    transition: all 0.3s;
}

input:focus,
select:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.continue-btn {
    width: 100%;
    padding: 18px;
    font-size: 1.1em;
    background: linear-gradient(145deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
}

.continue-btn:hover {
    background: linear-gradient(145deg, #2980b9, #1f618d);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(52, 152, 219, 0.3);
}

.error-message {
    color: #dc3545;
    font-size: 0.9em;
    margin-top: 8px;
    display: none;
    font-weight: 500;
    align-items: center;
    gap: 5px;
}

/* Выбор типа теста */
.difficulty-selector {
    margin: 40px 0;
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.difficulty-selector.visible {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: fadeIn 0.8s;
}

.difficulty-title {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 1.4em;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.difficulty-options {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.difficulty-card {
    flex: 1;
    min-width: 280px;
    max-width: 350px;
    padding: 30px 25px;
    border-radius: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s ease;
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.difficulty-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
}

.header-title-container {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.school-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 50%;
    border: 3px solid #3498db;
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
    background-color: white;
    padding: 5px;
    transition: all 0.3s ease;
}

.school-logo:hover {
    transform: rotate(10deg) scale(1.05);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}

.header-text {
    flex: 1;
    min-width: 300px;
    text-align: center;
}

/* Адаптивность для логотипа */
@media (max-width: 768px) {
    .header-title-container {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .school-logo {
        width: 70px;
        height: 70px;
    }

    .header-text {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .school-logo {
        width: 60px;
        height: 60px;
    }
}

/* Цвета для разных типов тестов */
.difficulty-card.easy {
    background: linear-gradient(145deg, #f8fff9, #e9f7ea);
    border-color: #28a745;
}

.difficulty-card.easy::before {
    background: linear-gradient(90deg, #28a745, #20c997);
}

.difficulty-card.medium {
    background: linear-gradient(145deg, #fff9f0, #fef5e7);
    border-color: #fd7e14;
}

.difficulty-card.medium::before {
    background: linear-gradient(90deg, #fd7e14, #ffc107);
}

.difficulty-card.hard {
    background: linear-gradient(145deg, #fff0f0, #fdeded);
    border-color: #dc3545;
}

.difficulty-card.hard::before {
    background: linear-gradient(90deg, #dc3545, #e83e8c);
}

.difficulty-card.fire_safety {
    background: linear-gradient(145deg, #fff4e6, #ffe8cc);
    border-color: #fd7e14;
}

.difficulty-card.fire_safety::before {
    background: linear-gradient(90deg, #fd7e14, #ff922b);
}

.difficulty-card.anti_terror {
    background: linear-gradient(145deg, #e3f2fd, #bbdefb);
    border-color: #1c7ed6;
}

.difficulty-card.anti_terror::before {
    background: linear-gradient(90deg, #1c7ed6, #339af0);
}

/* НОВЫЕ СТИЛИ ДЛЯ ПЕРВОЙ МЕДИЦИНСКОЙ ПОМОЩИ */
.difficulty-card.first_aid {
    background: linear-gradient(145deg, #fff0f5, #ffe4e8);
    border-color: #e64980;
}

.difficulty-card.first_aid::before {
    background: linear-gradient(90deg, #e64980, #f06595);
}

/* НОВЫЕ СТИЛИ ДЛЯ БЕЗОПАСНОСТИ ДОРОЖНОГО ДВИЖЕНИЯ */
.difficulty-card.road_safety {
    background: linear-gradient(145deg, #f3f0ff, #e5dbff);
    border-color: #7950f2;
}

.difficulty-card.road_safety::before {
    background: linear-gradient(90deg, #7950f2, #845ef7);
}

@keyframes cardSelect {
    0% {
        transform: translateY(0) scale(1);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }

    50% {
        transform: translateY(-12px) scale(1.05);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    }

    100% {
        transform: translateY(-10px) scale(1.03);
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    }
}

.difficulty-icon {
    font-size: 3em;
    margin-bottom: 20px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.difficulty-card-title {
    font-size: 1.3em;
    font-weight: 700;
    margin-bottom: 15px;
    color: #2c3e50;
}

.difficulty-card-subtitle {
    font-size: 0.95em;
    color: #6c757d;
    margin-bottom: 10px;
    font-weight: 500;
}

.difficulty-card-desc {
    font-size: 0.9em;
    color: #6c757d;
    line-height: 1.5;
    margin-top: auto;
}

/* Таймер и прогресс */
.quiz-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    flex-wrap: wrap;
    gap: 15px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.quiz-header.visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.timer-container {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
    color: #2c3e50;
}

.timer {
    font-size: 1.6em;
    font-weight: 700;
    color: #2c3e50;
    font-family: 'Courier New', monospace;
    background: white;
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
    min-width: 100px;
    text-align: center;
}

.question-counter {
    font-size: 1.1em;
    color: #6c757d;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.question-counter span {
    color: #2c3e50;
    font-weight: 800;
}

/* Контейнер вопросов */
.questions-container {
    margin-bottom: 40px;
    display: none;
}

.questions-container.visible {
    display: block;
}

.question-container {
    margin-bottom: 40px;
    display: none;
    animation: fadeIn 0.5s;
}

.question-container.active {
    display: block;
}

.question {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 25px;
    color: #2c3e50;
    line-height: 1.5;
    padding: 25px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    border-left: 6px solid #3498db;
}

.options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.option {
    padding: 18px;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1em;
    position: relative;
    display: flex;
    align-items: center;
}

.option:hover {
    background-color: #e3f2fd;
    border-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.1);
}

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

.option-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(145deg, #3498db, #2980b9);
    color: white;
    border-radius: 50%;
    margin-right: 15px;
    font-weight: 700;
    font-size: 1em;
    flex-shrink: 0;
}

.option.selected .option-number {
    background: linear-gradient(145deg, #28a745, #218838);
}

/* Кнопки навигации */
.navigation-buttons {
    display: none;
    justify-content: space-between;
    margin-top: 40px;
    flex-wrap: wrap;
    gap: 15px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.navigation-buttons.visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.nav-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 150px;
}

.prev-btn {
    background: linear-gradient(145deg, #6c757d, #495057);
    color: white;
}

.prev-btn:hover:not(:disabled) {
    background: linear-gradient(145deg, #5a6268, #343a40);
    transform: translateY(-2px);
}

.next-btn {
    background: linear-gradient(145deg, #3498db, #2980b9);
    color: white;
}

.next-btn:hover {
    background: linear-gradient(145deg, #2980b9, #1f618d);
    transform: translateY(-2px);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Результаты */
.result-container {
    display: none;
    text-align: center;
    padding: 20px 0;
}

.result-container.visible {
    display: block;
    animation: fadeIn 0.5s;
}

.result-title {
    font-size: 1.8em;
    color: #2c3e50;
    margin-bottom: 30px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.result-content {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    margin-bottom: 40px;
    justify-content: center;
}

.result-card {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
    padding: 25px;
    border-radius: 20px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.score-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    margin: 0 auto 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 2.5em;
    font-weight: 800;
    color: white;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.score-circle.excellent {
    background: linear-gradient(145deg, #28a745, #20c997);
}

.score-circle.good {
    background: linear-gradient(145deg, #ffc107, #fd7e14);
}

.score-circle.average {
    background: linear-gradient(145deg, #ff6b6b, #ee5a24);
}

.score-circle.poor {
    background: linear-gradient(145deg, #dc3545, #c82333);
}

.level {
    font-size: 1.6em;
    font-weight: 700;
    margin: 20px 0;
    padding: 15px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.result-stats {
    text-align: left;
    margin-top: 20px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
    flex-wrap: wrap;
}

.stat-label {
    color: #6c757d;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-value {
    color: #2c3e50;
    font-weight: 700;
}

/* Обзор ответов */
.answers-review {
    margin: 40px 0;
    text-align: left;
    display: none;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.5s ease;
}

.answers-review.visible {
    display: block;
    max-height: 5000px;
    opacity: 1;
    animation: fadeIn 0.5s;
}

.answers-review h3 {
    color: #2c3e50;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(145deg, #3498db, #2980b9);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.answers-review h3:hover {
    background: linear-gradient(145deg, #2980b9, #1f618d);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.answer-correct-icon {
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #28a745;
}

.answer-incorrect-icon {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #dc3545;
}

#answers-list {
    display: none;
}

#answers-list.expanded {
    display: block;
    animation: fadeIn 0.5s;
}

.answer-item {
    margin-bottom: 25px;
    padding: 25px;
    border-radius: 15px;
    background: white;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
}

.answer-correct {
    border-left: 6px solid #28a745;
    background: linear-gradient(145deg, #f1f9f3, #e8f5e9);
}

.answer-incorrect {
    border-left: 6px solid #dc3545;
    background: linear-gradient(145deg, #fdf2f2, #fce8e8);
}

.explanation {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    border-left: 4px solid #3498db;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    font-size: 0.95em;
    line-height: 1.6;
}

.explanation strong {
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 1.1em;
}

/* Кнопки действий */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.action-btn {
    padding: 18px 35px;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    min-width: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.send-results-btn {
    background: linear-gradient(145deg, #3498db, #2980b9);
    color: white;
}

.send-results-btn:hover {
    background: linear-gradient(145deg, #2980b9, #1f618d);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(52, 152, 219, 0.3);
}

.restart-btn {
    background: linear-gradient(145deg, #6c757d, #495057);
    color: white;
}

.restart-btn:hover {
    background: linear-gradient(145deg, #5a6268, #343a40);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(108, 117, 125, 0.3);
}

.results-sent {
    background: linear-gradient(145deg, #28a745, #20c997);
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin: 20px auto;
    max-width: 500px;
    display: none;
    font-weight: 600;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Рейтинговая таблица */
.ranking-container {
    margin-top: 50px;
    display: none;
}

.ranking-container.visible {
    display: block;
    animation: fadeIn 0.5s;
}

.ranking-title {
    font-size: 1.6em;
    color: #2c3e50;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.ranking-table-container {
    overflow-x: auto;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 700px;
}

th {
    background: linear-gradient(145deg, #2c3e50, #34495e);
    color: white;
    padding: 18px 15px;
    text-align: center;
    font-weight: 600;
    position: sticky;
    top: 0;
    white-space: nowrap;
}

td {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
    white-space: nowrap;
}

tr:hover {
    background-color: #f8f9fa;
}

tr.current-user {
    background: linear-gradient(145deg, #e3f2fd, #bbdefb) !important;
    font-weight: 700;
}

.rank-badge {
    display: inline-block;
    width: 35px;
    height: 35px;
    line-height: 35px;
    border-radius: 50%;
    color: white;
    font-weight: 700;
    text-align: center;
}

.rank-1 {
    background: linear-gradient(145deg, #FFD700, #FFA500);
}

.rank-2 {
    background: linear-gradient(145deg, #C0C0C0, #A9A9A9);
}

.rank-3 {
    background: linear-gradient(145deg, #CD7F32, #A0522D);
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        max-height: 0;
        opacity: 0;
    }

    to {
        max-height: 5000px;
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

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

    .container {
        padding: 20px;
        border-radius: 15px;
    }

    h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 1em;
    }

    .student-info {
        padding: 20px;
    }

    .student-info h3 {
        font-size: 1.4em;
    }

    .difficulty-card {
        min-width: 100%;
        max-width: 100%;
    }

    .difficulty-card-title {
        font-size: 1.2em;
    }

    .quiz-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 15px;
    }

    .timer-container,
    .question-counter {
        justify-content: center;
    }

    .question {
        font-size: 1.1em;
        padding: 20px;
    }

    .option {
        padding: 15px;
        font-size: 0.95em;
    }

    .result-title {
        font-size: 1.5em;
    }

    .result-card {
        min-width: 100%;
    }

    .score-circle {
        width: 140px;
        height: 140px;
        font-size: 2em;
    }

    .level {
        font-size: 1.4em;
    }

    .action-btn {
        min-width: 100%;
        padding: 15px;
    }

    .nav-btn {
        min-width: 140px;
        padding: 12px 25px;
    }

    .ranking-title {
        font-size: 1.3em;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 1.5em;
    }

    .difficulty-icon {
        font-size: 2.5em;
        height: 60px;
    }

    .difficulty-card-title {
        font-size: 1.1em;
    }

    .difficulty-card-desc {
        font-size: 0.85em;
    }

    .timer {
        font-size: 1.4em;
        min-width: 80px;
        padding: 8px 15px;
    }

    .question {
        font-size: 1em;
        padding: 15px;
    }

    .option {
        padding: 12px;
        font-size: 0.9em;
    }

    .option-number {
        width: 28px;
        height: 28px;
        margin-right: 10px;
    }

    .nav-btn {
        min-width: 120px;
        padding: 10px 20px;
        font-size: 0.9em;
    }

    .action-btn {
        font-size: 1em;
    }

    .result-title {
        font-size: 1.3em;
    }

    .score-circle {
        width: 120px;
        height: 120px;
        font-size: 1.8em;
    }

    .level {
        font-size: 1.2em;
        padding: 12px;
    }

    .stat-item {
        flex-direction: column;
        gap: 5px;
    }
}