/* --- ГЛОБАЛЬНЫЕ НАСТРОЙКИ ДЛЯ СТРАНИЦЫ ТЕСТА --- */

/* 1. БАЗОВОЕ СОСТОЯНИЕ (Слайды включены) */
.snap-container {
    height: 100dvh; 
    overflow-y: scroll; 
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none; 
    -ms-overflow-style: none;
}
.snap-container::-webkit-scrollbar { display: none; }

.slide {
    height: 100dvh; 
    width: 100%;
    scroll-snap-align: start; 
    scroll-snap-stop: always;
    
    /* ИСПРАВЛЕНИЕ: Запрещаем слайду скроллиться самому по себе.
       Это уберет эффект "двойной прокрутки" и микро-прыжки на шапку. */
    overflow: hidden; 
    
    position: relative;
    display: flex;
    flex-direction: column;
}

/* 2. СОСТОЯНИЕ "ТЕСТ ИДЕТ" (Слайды отключены) */
body.test-in-progress .snap-container {
    scroll-snap-type: none !important; 
    overflow-y: auto !important;
}

body.test-in-progress .slide {
    height: auto !important; 
    min-height: 100dvh;
    scroll-snap-align: none !important;
    scroll-snap-stop: normal !important;
    overflow: visible !important; /* Во время теста разрешаем контенту растягивать слайд */
}

/* 3. УМНОЕ СКРЫТИЕ */
body.test-in-progress #slideTheory, 
body.test-in-progress .slide.text-slide:not(#slideTheory), 
body.test-in-progress .slide.theme-dark-slide {
    display: none !important;
}


/* --- СТИЛИ КОНТЕНТА --- */

/* ИСПРАВЛЕНИЕ: Переносим прокрутку внутрь обертки контента */
.content-wrapper {
    width: 100%;
    max-width: 800px;
    height: 100%; /* На всю высоту слайда */
    
    /* Включаем скролл только здесь */
    overflow-y: auto; 
    padding: 40px 20px;
    
    /* Скрываем скроллбар для красоты */
    scrollbar-width: none; 
    -ms-overflow-style: none;
    
    /* Центрирование */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    /* Если текста мало - центрируем, если много - он идет сверху */
    justify-content: flex-start; 
}
.content-wrapper::-webkit-scrollbar { display: none; }

/* Центрируем контент по вертикали, если он короткий */
.slide.text-slide {
    align-items: center; 
}


/* --- КАРТОЧКИ ТЕСТА --- */

.test-main-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding-top: 20px;
    padding-bottom: 40px;
    width: 100%;
    /* Если контент теста выше экрана, разрешаем скролл внутри wrapper'а */
    flex-grow: 1; 
}

.test-card {
    background: var(--ui-bg);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    max-width: 600px;
    width: 100%;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid var(--guide-lines);
    margin-bottom: 20px;
}

.test-desc {
    margin-bottom: 25px;
    opacity: 0.8;
    line-height: 1.5;
}

/* Селектор уровня */
.level-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.level-option input { display: none; }

.level-box {
    border: 2px solid var(--guide-lines);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-color);
}

.level-box strong {
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: var(--text-color);
}

.level-box span {
    font-size: 0.85rem;
    opacity: 0.6;
}

.level-option input:checked + .level-box {
    border-color: var(--accent);
    background: rgba(211, 47, 47, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.level-box:hover { border-color: var(--text-color); }

/* Инструкции */
.instruction-list {
    text-align: left;
    margin-bottom: 30px;
    padding-left: 20px;
}
.instruction-list li { margin-bottom: 10px; line-height: 1.4; }

/* Экран чтения */
.reading-wrapper {
    width: 100%;
    max-width: 800px;
    height: 100%; /* Занимает всю доступную высоту */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Важно: внутренний скролл у .text-content */
}

.text-content {
    flex: 1;
    overflow-y: auto;
    font-size: 1.2rem;
    line-height: 1.6;
    text-align: left;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 20px;
    white-space: pre-wrap;
    border: 1px solid var(--guide-lines);
    -webkit-overflow-scrolling: touch;
}

.reading-controls {
    flex-shrink: 0;
    text-align: center;
    padding-bottom: 20px;
}

/* Квиз */
.question-text {
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 25px;
    color: var(--accent);
}

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

.answer-btn {
    background: var(--bg-color);
    border: 1px solid var(--guide-lines);
    padding: 15px;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-color);
    transition: background 0.2s;
}
.answer-btn:hover { background: rgba(0,0,0,0.05); }

/* Результаты */
.result-metrics {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 25px 0;
}

.metric-box {
    background: var(--bg-color);
    padding: 15px 25px;
    border-radius: 12px;
    border: 1px solid var(--guide-lines);
}

.metric-val {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

.metric-label {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 5px;
    display: block;
}

.verdict-box {
    background: rgba(0,0,0,0.03);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
}

/* Утилиты */
.hidden { display: none !important; }
.btn-large { padding: 15px 40px; font-size: 1.1rem; }
.action-buttons { display: flex; justify-content: center; gap: 20px; align-items: center; }

/* Адаптив */
@media (max-width: 600px) {
    .level-selector { grid-template-columns: 1fr; gap: 10px; }
    .level-box { flex-direction: row; justify-content: space-between; align-items: center; text-align: left; }
    .level-box strong { margin-bottom: 0; }
    .text-content { font-size: 1rem; }
    .metric-val { font-size: 2rem; }
}

@media (min-width: 601px) {
    .level-selector .level-option:last-child {
        grid-column: 1 / -1;
        width: 50%;
        justify-self: center;
    }
}

/* Общий контейнер кнопок */
.result-actions-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    width: 100%;
}

/* Кнопка ВК */
.btn-vk {
    background-color: #0077FF !important; /* Фирменный цвет ВК */
    color: white !important;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;           /* На мобильном на всю ширину */
    max-width: 300px;      /* Ограничение ширины на ПК */
    padding: 12px 20px;
    border-radius: 50px;   /* Закругленные края */
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-vk:hover {
    transform: scale(1.02);
    background-color: #0066DD !important;
}

/* Контейнер для нижних кнопок */
.secondary-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    align-items: center;
}

/* Поправка для кнопки тренажера, чтобы она не слипалась */
.btn-primary {
    margin: 0 !important;
}