:root {
    --primary: #4361ee;
    --primary-dark: #3a0ca3;
    --secondary: #f72585;
    --success: #4cc9f0;
    --danger: #f94144;
    --warning: #f8961e;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --light-gray: #e9ecef;
    --radius: 16px;
    --radius-sm: 8px;
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(135deg, #f5f7ff 0%, #eef2ff 100%);
    color: var(--dark);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Кнопка возврата к обучению */
.return-header {
    padding: 0 0 15px 0;
    max-width: 100%;
    margin: 0 auto;
}

.btn-return {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    color: var(--primary);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid var(--primary);
    box-shadow: var(--shadow);
    font-size: 0.95rem;
}

.btn-return:hover {
    background: var(--primary);
    color: white;
    transform: translateX(-5px);
    box-shadow: var(--shadow-hover);
}

.btn-return i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.btn-return:hover i {
    transform: translateX(-3px);
}

/* Хедер теста */
.test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.test-progress {
    flex: 1;
    max-width: 500px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--light-gray);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    width: 10%;
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    border-radius: 5px;
    transition: width 0.3s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    color: var(--gray);
    font-size: 0.9rem;
}

.score-display {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.score-display i {
    color: #ffd700;
}

/* Секция теста */
.test-section {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 3rem;
}

.test-title {
    text-align: center;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.test-title i {
    color: var(--secondary);
}

.test-subtitle {
    text-align: center;
    color: var(--gray);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* Контейнер вопросов */
.questions-container {
    margin: 2rem 0;
}

.question-card {
    background: var(--light);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    border-left: 5px solid var(--primary);
    animation: fadeIn 0.5s ease;
}

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

.question-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.question-number {
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.question-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark);
    line-height: 1.5;
    flex: 1;
}

/* Варианты ответов - ВСЕГДА на разных строках */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.option {
    padding: 1rem 1.5rem;
    background: white;
    border: 2px solid var(--light-gray);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: block;
    text-align: left;
    width: 100%;
}

.option:hover {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.05);
    transform: translateX(5px);
}

.option.selected {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.1);
}

.option.correct {
    border-color: var(--success);
    background: rgba(76, 201, 240, 0.1);
}

.option.incorrect {
    border-color: var(--danger);
    background: rgba(249, 65, 68, 0.1);
}

.option input {
    display: none;
}

.option-check {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray);
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
    margin-right: 1rem;
    position: relative;
}

.option.selected .option-check {
    background: var(--primary);
    border-color: var(--primary);
}

.option.selected .option-check::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.8rem;
}

.option-text {
    display: inline-block;
    vertical-align: middle;
    font-size: 1rem;
    line-height: 1.5;
    width: calc(100% - 40px);
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Панель управления */
.test-controls {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--light-gray);
}

.btn {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    text-decoration: none;
    min-width: 140px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(67, 97, 238, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: rgba(67, 97, 238, 0.05);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #38b6ff);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 201, 240, 0.3);
}

/* Результаты теста */
.results-container {
    animation: fadeIn 0.8s ease;
}

.result-card {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.05), rgba(247, 37, 133, 0.05));
    border-radius: var(--radius);
}

.result-icon {
    font-size: 4rem;
    color: #ffd700;
    margin-bottom: 1rem;
}

#result-title {
    color: var(--primary-dark);
    margin-bottom: 2rem;
}

.score-circle {
    margin: 2rem auto;
    position: relative;
    width: 120px;
    height: 120px;
}

.circle-progress {
    position: relative;
}

.circle-progress svg {
    transform: rotate(-90deg);
}

.circle-bg {
    fill: none;
    stroke: var(--light-gray);
    stroke-width: 8;
}

.circle-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 339;
    stroke-dashoffset: 339;
    transition: stroke-dashoffset 1s ease;
}

.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-dark);
}

.result-details {
    max-width: 400px;
    margin: 2rem auto;
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--light-gray);
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--gray);
}

.detail-value {
    color: var(--primary-dark);
    font-weight: 600;
}

.detail-value.expert {
    color: var(--success);
}

.detail-value.advanced {
    color: var(--primary);
}

.detail-value.intermediate {
    color: var(--warning);
}

.detail-value.beginner {
    color: var(--danger);
}

.result-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

/* Практические задания */
.practical-tasks {
    margin-top: 2rem;
}

.section-title {
    text-align: center;
    color: var(--primary-dark);
    margin-bottom: 2rem;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.section-title i {
    color: var(--secondary);
}

.tasks-container {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.task-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border-left: 5px solid var(--primary);
    transition: transform 0.3s ease;
}

.task-card:hover {
    transform: translateY(-5px);
}

.task-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light-gray);
}

.task-number {
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: bold;
    font-size: 1.1rem;
}

.task-title {
    flex: 1;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--dark);
}

/* Задание 1: Вопрос-ответ */
.simple-task {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.simple-question {
    background: var(--light);
    padding: 1rem;
    border-radius: var(--radius-sm);
}

.simple-question p {
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: var(--primary-dark);
}

.answer-input {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid var(--light-gray);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.answer-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

.answer-input.correct {
    border-color: var(--success);
    background: rgba(76, 201, 240, 0.1);
}

.answer-input.incorrect {
    border-color: var(--danger);
    background: rgba(249, 65, 68, 0.1);
}

/* Задание 2: Верно/Неверно */
.true-false-task {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.tf-question {
    background: var(--light);
    padding: 1rem;
    border-radius: var(--radius-sm);
}

.tf-question p {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

.tf-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.tf-btn {
    flex: 1;
    padding: 0.8rem;
    border: 2px solid var(--light-gray);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.tf-btn:hover {
    transform: translateY(-2px);
}

.tf-btn.selected-true {
    border-color: var(--success);
    background: rgba(76, 201, 240, 0.1);
    color: var(--success);
}

.tf-btn.selected-false {
    border-color: var(--danger);
    background: rgba(249, 65, 68, 0.1);
    color: var(--danger);
}

/* Задание 3: Подбери пару */
.matching-simple {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.match-left, .match-right {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.match-item {
    padding: 1rem;
    background: var(--light);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    font-weight: 600;
    transition: all 0.3s ease;
    user-select: none;
}

.match-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.match-item.selected {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.1);
}

.match-item.correct {
    border-color: var(--success);
    background: rgba(76, 201, 240, 0.1);
}

.match-item.incorrect {
    border-color: var(--danger);
    background: rgba(249, 65, 68, 0.1);
}

.match-instructions {
    text-align: center;
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    font-style: italic;
}

/* Фидбек заданий */
.task-feedback {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    display: none;
    font-size: 1rem;
    line-height: 1.5;
}

.task-feedback.show {
    display: block;
    animation: fadeIn 0.5s ease;
}

.task-feedback.success {
    background: rgba(76, 201, 240, 0.1);
    border-left: 4px solid var(--success);
    color: #0c5460;
}

.task-feedback.error {
    background: rgba(249, 65, 68, 0.1);
    border-left: 4px solid var(--danger);
    color: #721c24;
}

/* Кнопка проверки */
.btn-check {
    background: linear-gradient(135deg, var(--success), #38b6ff);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-check:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 201, 240, 0.3);
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .test-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .test-progress {
        width: 100%;
    }
    
    .test-title {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .section-title {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .test-section {
        padding: 1rem;
    }
    
    .question-card {
        padding: 1.5rem;
    }
    
    .question-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .test-controls {
        flex-direction: column;
    }
    
    .result-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        min-width: unset;
    }
    
    .option {
        padding: 1rem;
    }
    
    .option-text {
        font-size: 0.95rem;
        line-height: 1.4;
    }
    
    .tasks-container {
        grid-template-columns: 1fr;
    }
    
    .matching-simple {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .tf-options {
        flex-direction: column;
    }

    .btn-return {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .question-text {
        font-size: 1.1rem;
    }
    
    .option {
        padding: 0.8rem;
    }
    
    .option-text {
        font-size: 0.9rem;
    }
    
    .task-card {
        padding: 1rem;
    }
    
    .task-title {
        font-size: 1.1rem;
    }

    .return-header {
        padding: 0 0 10px 0;
    }
    
    .btn-return {
        width: 100%;
        justify-content: center;
    }
}
