.test-controls {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.test-control-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-primary);
    padding: 0;
    flex-shrink: 0;
}

.test-control-btn:active {
    transform: scale(0.92);
}

/* Текстовые кнопки в прогресс-баре: «Ошибка в вопросе» / «Меню» —
   ширина по содержанию, не круглые иконки. */
.test-control-btn-wide {
    height: 36px;
    padding: 0 16px;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.test-control-btn-wide:active {
    transform: scale(0.95);
}

.font-scale-btn {
    width: 26px;
    height: 30px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    color: var(--text-primary);
    padding: 0;
    flex-shrink: 0;
}

.font-scale-btn:active {
    transform: scale(0.9);
}


/* ─────────────────────────────────────────────────────────────
   0. ШАПКА ПРОГРЕССА (progress-section, см. oge_ege.js
   _buildProgressSectionHtml) — прогресс-бар + номер вопроса +
   вариант + таймер + кнопки шрифта/ошибки/меню в одну строку.
   ───────────────────────────────────────────────────────────── */

.oge-ege-progress-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.oge-ege-progress-bar-wrap {
    width: 45%;
    flex: 1 1 120px;
}

.oge-ege-question-label {
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
}

.oge-ege-variant-label {
    font-size: 14px;
    font-weight: 500;
    color: #888;
    white-space: nowrap;
}

.oge-ege-timer-label {
    min-width: 80px;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
}

.oge-ege-mobile-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.oge-ege-mobile-bar {
    width: 50px;
    flex-shrink: 0;
}

.oge-ege-mobile-qlabel {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.oge-ege-mobile-variant {
    font-size: 14px;
    font-weight: 500;
    color: #888;
    white-space: nowrap;
    flex-shrink: 0;
}

.oge-ege-mobile-timer {
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.oge-ege-mobile-controls-row {
    width: 100%;
}

.oge-ege-mobile-controls-row .test-controls {
    width: 100%;
    justify-content: flex-end;
}

.oge-ege-mobile-controls-row .test-control-btn-wide {
    padding: 0 12px;
    font-size: 13px;
}


#timerDisplay {
    transition: color 0.3s ease;
    font-weight: 600;
}

#timerDisplay.timer-warning { color: var(--warning-color); }
#timerDisplay.timer-danger {
    color: var(--error-color);
    animation: timerPulse 1s infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.7; }
}

#questionNumber {
    color: var(--text-secondary);
}
.question-item {
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: border-color 0.2s ease;
}

.question-item:hover:not(.has-result) {
    border-color: var(--primary-purple-light);
}

.question-item .question-text {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: calc(15px * var(--content-font-scale, 1));
    line-height: 1.4;
}

.q-content {
    flex: 1;
    min-width: 0;
    color: var(--text-primary);
    text-align: justify;
}

.q-content p,
.oge-ege-group-source-text p,
.oge-ege-match-passage p {
    margin-bottom: 0.8em;
    text-indent: 1.5em;
}

.oge-ege-group-source-text p {
    text-align: justify;
}

.q-content p:last-child,
.oge-ege-group-source-text p:last-child,
.oge-ege-match-passage p:last-child {
    margin-bottom: 0;
}

.oge-ege-match-passage {
    margin-top: 10px;
    margin-bottom: 16px;
    text-align: justify;
}

.section-title {
    font-size: calc(15px * var(--content-font-scale, 1));
    margin: 0 0 10px;
}

.oge-ege-question-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 10px 0;
    border-radius: 4px;
}

.q-content table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: calc(15px * var(--content-font-scale, 1));
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
}

.q-content table td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
    white-space: normal;
}

.q-content table tr:first-child td {
    font-weight: 700;
    background: rgba(102, 126, 234, 0.08);
}

.q-answer-area {
    margin-top: 10px;
}


/* ─────────────────────────────────────────────────────────────
   3. TEXT (input_type='text')
   ───────────────────────────────────────────────────────────── */

.oge-ege-text-input {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 6px 10px;
    margin-left: 8px;
    min-width: 160px;
    font-size: calc(var(--font-size-base) * var(--content-font-scale, 1));
    font-family: var(--font-family);
    outline: none;
    transition: border-color 0.2s ease;
}

.oge-ege-text-input:focus {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.oge-ege-text-input.correct-input {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.05);
    color: var(--success-color);
}

.oge-ege-text-input.incorrect-input {
    border-color: var(--error-color);
    background: rgba(239, 68, 68, 0.05);
    color: var(--error-color);
}

.oge-ege-text-input:disabled {
    cursor: not-allowed;
    opacity: 0.8;
}


/* ─────────────────────────────────────────────────────────────
   4. RADIO / CHECKBOX (input_type='radio'|'checkbox')
   ───────────────────────────────────────────────────────────── */

.oge-ege-choice-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.oge-ege-choice-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: calc(var(--font-size-base) * var(--content-font-scale, 1));
    transition: border-color 0.2s ease, background 0.2s ease;
}

.oge-ege-choice-item:hover {
    border-color: var(--primary-purple-light);
    background: var(--bg-tertiary);
}

.oge-ege-choice-item input {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-purple);
}

.oge-ege-choice-item span {
    text-align: justify;
}

.question-item.has-result .oge-ege-choice-item {
    pointer-events: none;
}

/* Точечная подсветка результата — красится КОНКРЕТНЫЙ вариант, а не
   весь вопрос целиком (см. oge_ege_question_renderer.js::showAnswerResult).
   Правильный(е) вариант(ы) — всегда зелёным. То, что выбрал пользователь
   и оказалось неверным — красным. Невыбранные неправильные варианты —
   не трогаем, остаются нейтральными. */
.oge-ege-choice-item.choice-correct {
    background: #D1FAE5;
    border-color: var(--success-color);
}

.oge-ege-choice-item.choice-incorrect {
    background: #FEE2E2;
    border-color: var(--error-color);
}


/* ─────────────────────────────────────────────────────────────
   5. SELECT_MATCH — "клик-клик-пара"
   ───────────────────────────────────────────────────────────── */

.oge-ege-match-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
    margin-top: 10px;
}

/* Когда у всех пар слева пустой текст (см. _renderSelectMatch —
   answers.pairs только с буквами, без описания: сам пропуск уже показан
   в тексте отрывка выше) — колонка визуально не нужна, растягиваем
   правую на всю ширину. Сами .oge-ege-match-left-item ОСТАЮТСЯ в DOM
   (display:none только на колонку-обёртку) — на них завязаны
   _markResult/_showSingleHintForMatch, вырезать из разметки нельзя. */
.oge-ege-match-container.oge-ege-match-no-left {
    grid-template-columns: 1fr;
}

.oge-ege-match-container.oge-ege-match-no-left .oge-ege-match-left {
    display: none;
}

.oge-ege-match-container.oge-ege-match-no-right {
    grid-template-columns: 1fr;
}

.oge-ege-match-column {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Подписи колонок ("ГРАММАТИЧЕСКИЕ ОШИБКИ" / "ПРЕДЛОЖЕНИЯ" и т.п., см.
   _parseMatchQuestionMeta в oge_ege_question_renderer.js) — жирным
   капслоком с подчёркиванием, как в оригинальном интерфейсе ФИПИ. */
.oge-ege-match-column-title {
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: underline;
    font-size: calc(14px * var(--content-font-scale, 1));
    margin-bottom: 6px;
}

/* Раскладка "заголовки сверху → тексты под ними" (см. _renderSelectMatch,
   isHeadingsMatch) — только для настоящих заданий на соответствие
   заголовков/текстов (напр. №10), где у options есть реальный текст с
   сервера. True/False/Not stated и "Расстановка терминов" по-прежнему
   идут через .oge-ege-match-container (двухколоночная раскладка выше). */
.oge-ege-match-stack {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    margin-top: 10px;
}

.oge-ege-match-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Заголовки (1-8 и т.п.) — в 2 колонки, как на bank.fipi.ru, чтобы не
   растягивать короткие фразы на всю ширину карточки. */
.oge-ege-match-block.oge-ege-match-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 24px;
}

.oge-ege-match-block.oge-ege-match-right .oge-ege-match-right-item {
    font-weight: 700;
}

@media (max-width: 600px) {
    .oge-ege-match-block.oge-ege-match-right {
        grid-template-columns: 1fr;
    }
}

/* Плоский справочный список — БЕЗ рамок-коробок и круглых бейджей (были
   раньше — убраны по правке "убрать блоки, это лишнее"), точно как на
   bank.fipi.ru: буква/номер жирным инлайн + текст, никаких кликов (сам
   ответ даётся ниже отдельной таблицей с select'ами, см.
   .oge-ege-match-table). border-left прозрачный по умолчанию — под него
   садится цветной акцент после проверки (.correct-question/.incorrect-question
   ниже), без него текст "прыгал" бы вправо на 3px при появлении рамки. */
.oge-ege-match-left-item,
.oge-ege-match-right-item {
    padding: 4px 0 4px 10px;
    border-left: 3px solid transparent;
    cursor: default;
    font-size: calc(14px * var(--content-font-scale, 1));
    line-height: 1.5;
}

/* Фидбэк верно/неверно (см. showAnswerResult → _markResult) — только на
   ЛЕВОЙ колонке (правая — чистый справочник вариантов, её саму никогда не
   красим целиком; при ошибке правильный вариант справа помечается только
   маленьким тегом .oge-ege-match-reveal-tag). .correct-question/
   .incorrect-question у app.css задают фон на всю карточку — здесь
   переопределяем более специфичным селектором на лёгкий акцент, чтобы не
   получилась та же тяжёлая коробка, от которой отказались. */
.oge-ege-match-left-item.correct-question,
.oge-ege-match-left-item.incorrect-question {
    border-radius: 0;
    box-shadow: none;
}

.oge-ege-match-left-item.correct-question {
    border-left-color: var(--success-color);
    background: rgba(16, 185, 129, 0.06);
}

.oge-ege-match-left-item.incorrect-question {
    border-left-color: var(--error-color);
    background: rgba(239, 68, 68, 0.06);
}

/* ─── Таблица ответов "буква сверху → select снизу" (стиль ФИПИ) ─── */

.oge-ege-match-answer-hint {
    margin-top: 14px;
    font-size: calc(13px * var(--content-font-scale, 1));
    color: var(--text-secondary);
}

/* Скроллящаяся обёртка вокруг .oge-ege-match-table — саму таблицу
   не сжать бесконечно (не меньше ширины select'ов), поэтому при
   6-8+ колонках (группы соответствий) она может быть шире карточки;
   без этой обёртки html/body (overflow-x:clip в app.css) просто
   обрезают лишнее и часть колонок становится невидимой. */
.oge-ege-match-table-scroll {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.oge-ege-match-table {
    margin-top: 8px;
    border-collapse: collapse;
}

.oge-ege-match-table th,
.oge-ege-match-table td {
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    text-align: center;
}

.oge-ege-match-table th {
    font-weight: 700;
    background: var(--bg-tertiary);
}

.oge-ege-match-table select {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 4px 6px;
    min-width: 50px;
    font-size: calc(var(--font-size-base) * var(--content-font-scale, 1));
    font-family: var(--font-family);
    background: white;
}

.oge-ege-match-table select:focus {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.oge-ege-match-table select.correct-input {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.08);
    color: var(--success-color);
}

.oge-ege-match-table select.incorrect-input {
    border-color: var(--error-color);
    background: rgba(239, 68, 68, 0.08);
    color: var(--error-color);
}

.oge-ege-match-table select:disabled {
    cursor: not-allowed;
    opacity: 0.85;
}

@media (max-width: 600px) {
    .oge-ege-match-container {
        grid-template-columns: 1fr;
    }

    .oge-ege-match-table th,
    .oge-ege-match-table td {
        padding: 4px 6px;
    }

    .oge-ege-match-table select {
        min-width: 32px;
        padding: 2px 4px;
        font-size: 13px;
    }
}

.oge-ege-match-target-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-left: auto;
    border-radius: 999px;
    border: 2px solid var(--primary-purple);
    background: white;
    color: var(--primary-purple);
    font-size: calc(11px * var(--content-font-scale, 1));
    font-weight: 700;
    flex-shrink: 0;
}


/* ─────────────────────────────────────────────────────────────
   6. GROUP_TEXT — двухпанельный layout (текст слева, вопросы справа)
   ───────────────────────────────────────────────────────────── */

.oge-ege-group-layout {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.oge-ege-group-text-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    font-size: calc(14px * var(--content-font-scale, 1));
    line-height: 1.6;
    color: var(--text-primary);
    /* Текст всегда сверху, вопросы ниже — на всех разрешениях, не только
       мобильных (раньше был двухпанельный grid 55/45 на широких экранах,
       из-за чего единый текст с заданиями читался неудобно). Текст может
       быть длинным — ограничиваем высоту со скроллом внутри панели,
       чтобы не приходилось листать всю страницу мимо вопросов. */
    max-height: 45vh;
    overflow-y: auto;
}

.oge-ege-group-questions-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}


/* ─────────────────────────────────────────────────────────────
   7. ESSAY (задание 27 — развёрнутый ответ)
   ───────────────────────────────────────────────────────────── */

.oge-ege-essay-textarea {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: calc(var(--font-size-base) * var(--content-font-scale, 1));
    font-family: var(--font-family);
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease;
}

.oge-ege-essay-textarea:focus {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}


/* ─────────────────────────────────────────────────────────────
   8. CORRECT-ANSWER-LINE / HINT-LINE
   Общий hints.css сейчас (проверено) не содержит эти классы —
   определяем самостоятельно, не завися от общего файла.
   Цвета — по образцу english_oge.css: неверный ответ — красный,
   подсказка — фиолетовый (для визуальной консистентности с
   остальным сайтом, раз уж переменные те же).
   ───────────────────────────────────────────────────────────── */

.correct-answer-line {
    margin-top: 6px;
    font-size: calc(14px * var(--content-font-scale, 1));
    color: var(--error-color);
    line-height: 1.3;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.correct-answer-line.hint-visible {
    opacity: 1;
    transform: translateY(0);
}

.hint-line {
    margin-top: 6px;
    font-size: calc(14px * var(--content-font-scale, 1));
    color: var(--primary-purple);
    line-height: 1.3;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.hint-line.hint-visible {
    opacity: 1;
    transform: translateY(0);
}


/* ─────────────────────────────────────────────────────────────
   9. КНОПКИ ПРОВЕРИТЬ / ДАЛЕЕ
   ───────────────────────────────────────────────────────────── */

.oge-ege-nav-buttons {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
}

.oge-ege-nav-buttons .btn {
    flex: 1;
}

#ogeEgeCheckBtn {
    background: linear-gradient(135deg, #6B7280 0%, #4B5563 100%);
}


/* ─────────────────────────────────────────────────────────────
   10. МЕНЮ ВЫБОРА ВАРИАНТА
   Карточки по духу .section-card из английского движка (тень,
   подъём на hover, приглушение + плашка для заблокированных),
   но на независимых классах oge-ege-* — везде свои эквиваленты,
   без .btn-small/.section-*.

   ВАЖНО (фикс бага): раньше здесь стилизовался класс
   .oge-ege-variant-btn как САМА карточка — но oge_ege.js
   реально рендерит .oge-ege-variant-card (карточка) +
   .oge-ege-variant-number + .btn-small (кнопка) — то есть ни
   карточка, ни кнопка не попадали под эти правила вообще,
   отсюда неоформленный вид. Ниже — стили под реальную разметку
   (btn-small в oge_ege.js переименован в oge-ege-variant-btn).
   ───────────────────────────────────────────────────────────── */

.oge-ege-variants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.oge-ege-variant-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg) var(--spacing-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: center;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* Кликабельна вся карточка (role="button" в разметке) — кнопка внутри
   (.oge-ege-variant-btn) теперь <span>, чисто визуальный элемент. */
.oge-ege-variant-card:hover:not(.variant-locked) {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-purple-light);
}

.oge-ege-variant-card:active:not(.variant-locked) {
    transform: translateY(-1px);
}

.oge-ege-variant-card:focus-visible {
    outline: 2px solid var(--primary-purple);
    outline-offset: 2px;
}

.oge-ege-variant-number {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.oge-ege-variant-btn {
    display: block;
    width: 100%;
    padding: 10px 12px;
    background: var(--primary-gradient);
    color: white;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: var(--font-family);
    font-weight: 600;
    /* чисто визуальный элемент — клики обрабатывает карточка целиком,
       поэтому pointer-events выключены, чтобы курсор/тап всегда попадал
       на карточку, а не "терялся" на span поверх неё */
    pointer-events: none;
}

/* Заблокированный вариант (не открывается даже регистрацией — это
   осознанное персональное/групповое ограничение админа) — приглушаем
   карточку целиком + иконка замка в углу. */
.oge-ege-variant-card.variant-locked {
    cursor: not-allowed;
    opacity: 0.65;
}

.oge-ege-variant-card.variant-locked::before {
    content: '🔒';
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 15px;
    line-height: 1;
}

.oge-ege-variant-card.variant-locked .oge-ege-variant-btn {
    background: var(--text-muted);
}

/* "Доступно после регистрации" / "Зарегистрироваться" — НЕ тупик,
   поэтому карточку не приглушаем (в отличие от variant-locked), а
   наоборот выделяем лёгким акцентом + другим цветом кнопки, чтобы
   визуально отличалось от обычного "Начать тест". */
.oge-ege-variant-card.variant-unlock-hint {
    background: var(--light-gradient);
    border-color: var(--primary-purple-light);
}

.oge-ege-variant-card.variant-unlock-hint .oge-ege-variant-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
}

/* "Оформить подписку" — тот же принцип, но акцент под подписку/оплату. */
.oge-ege-variant-card.variant-subscribe-hint {
    background: var(--light-gradient);
    border-color: var(--warning-color);
}

.oge-ege-variant-card.variant-subscribe-hint .oge-ege-variant-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

@media (max-width: 600px) {
    .oge-ege-variants-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: var(--spacing-md);
    }

    .oge-ege-variant-card {
        padding: var(--spacing-md) var(--spacing-sm);
    }
}


/* ─────────────────────────────────────────────────────────────
   11. КАРТОЧКА ТЕСТА — внутренний отступ
   (app.css .card задаёт только фон/тень/радиус, без padding)
   ───────────────────────────────────────────────────────────── */

#app .card {
    padding: var(--spacing-xl);
    max-width: 900px;
    margin: var(--spacing-lg) auto;
}

@media (max-width: 767px) {
    .container {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    #app .card {
        padding: 8px;
        margin: 2px;
        max-width: 100%;
    }
}

/* Правый вариант, куда пользователь ОШИБОЧНО указал — те же токены,
   что .incorrect-question слева (app.css), для полной визуальной
   симметрии лево/право. */
.oge-ege-match-right-item.match-user-incorrect {
    background: #FEE2E2;
    border-color: var(--error-color);
}

.oge-ege-match-reveal-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border: 2px solid var(--success-color);
    border-radius: 999px;
    background: white;
    color: var(--success-color);
    font-size: calc(11px * var(--content-font-scale, 1));
    font-weight: 700;
    white-space: nowrap;
}

/* Жирный ярлык "Задание №N. <действие>" перед заданием (как на сайте
   ФИПИ) — строится в OgeEgeBase._buildTaskLabelHtml(), не хранится
   в БД как текст. */
.oge-ege-task-label {
    font-size: calc(14px * var(--content-font-scale, 1));
    margin-bottom: 8px;
    color: var(--text-secondary, #555);
}

/* ─────────────────────────────────────────────────────────────
   Групповая страница (1-3 и 22-26 на одном экране) — см.
   OgeEgeQuestionRendererAdapter.renderGroupScreen() в oge_ege.js.
   Общий текст группы сверху один раз, ниже — блок на каждое
   под-задание со своей кнопкой "Проверить".
   ───────────────────────────────────────────────────────────── */

.oge-ege-group-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Общий текст группы — как на сайте ФИПИ (курсив, светлая подложка).
   Используется здесь ОДИН раз на всю страницу — не путать со старым
   .oge-ege-group-source-text внутри двухпанельного _buildGroupTextLayout
   (тот путь теперь не используется для группы 1-3/22-26, но класс тот
   же самый, стили общие). */
.oge-ege-group-page > .oge-ege-group-source-text {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px 20px;
    font-style: italic;
    font-size: calc(15px * var(--content-font-scale, 1));
    line-height: 1.5;
    border: 1px solid var(--border-color);
}

.oge-ege-group-subquestion {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
}

.oge-ege-group-check-btn {
    margin-top: 12px;
}

.oge-ege-group-subquestion.oge-ege-result-correct,
.card.oge-ege-result-correct {
    border-color: var(--success-color);
    box-shadow: 0 0 0 1px var(--success-color);
}

.oge-ege-group-subquestion.oge-ege-result-incorrect,
.card.oge-ege-result-incorrect {
    border-color: var(--error-color);
    box-shadow: 0 0 0 1px var(--error-color);
}

/* Режим экзамена — ответ зафиксирован, но верно/неверно не показываем,
   поэтому нейтральный фиолетовый вместо зелёного/красного. Тот же паттерн
   (border-color + box-shadow), что у result-correct/result-incorrect выше,
   просто цвет из общей палиты app.css. */
.oge-ege-group-subquestion.oge-ege-result-exam,
.card.oge-ege-result-exam {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 1px var(--primary-purple);
}

/* ===== ЭКРАН "СТАТИСТИКА" =====
   Классы те же, что у english_statistics.js (stats-summary/stats-section/
   variant-card/...) — но english_app.css на странице oge_ege не
   подключён, поэтому дублируем нужный layout здесь. summary-item/
   summary-value/summary-label НЕ дублируем — они уже есть в общем
   app.css и одинаковы для обоих движков. */
.stats-section {
    margin-top: 20px;
}

.stats-section h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.stats-summary {
    display: flex;
    justify-content: space-around;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 0;
}

.variant-card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px 16px;
    margin-bottom: 10px;
}

.variant-header {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.variant-title {
    font-weight: 600;
    color: var(--text-primary);
}

.variant-attempts {
    font-size: 14px;
    color: var(--text-secondary);
}

@media (max-width: 767px) {
    .stats-summary { justify-content: center; }
    .variant-header { gap: 8px; }
}

/* ===== ЭКРАН "СТАТИСТИКА" — расширенный layout поверх .card ===== */
.oge-ege-stats-page {
    max-width: 1100px !important;
    width: 100%;
    margin: 20px auto;
    padding: 28px;
}

.oge-ege-stat-header-row {
    position: relative;
    text-align: center;
    padding: 4px 0 4px 0;
    min-height: 40px;
}

.oge-ege-stat-menu-btn {
    position: absolute;
    right: 0;
    top: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    white-space: nowrap;
}

.oge-ege-stat-menu-btn:hover {
    background: var(--hover-gradient);
}

.oge-ege-stat-header-center {
    margin: 0 auto;
    max-width: 640px;
}

.oge-ege-stat-hero {
    display: flex;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
    padding: 20px 0 28px 0;
    margin-bottom: 8px;
}

.oge-ege-stat-ring {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.6s ease;
}

.oge-ege-stat-ring-inner {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.oge-ege-stat-ring-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.oge-ege-stat-ring-value-of {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
}

.oge-ege-stat-ring-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    text-align: center;
    padding: 0 8px;
    line-height: 1.3;
}

.oge-ege-stat-hero-row {
    flex: 1;
    min-width: 260px;
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    padding: 20px 8px;
}

.oge-ege-stat-hero-cell {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.oge-ege-stat-hero-cell-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--primary-purple);
    line-height: 1;
}

.oge-ege-stat-hero-cell-of {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
}

.oge-ege-stat-hero-cell-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.oge-ege-stat-hero-divider {
    width: 1px;
    align-self: stretch;
    background: var(--border-color);
}

.oge-ege-stat-info-note {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--primary-purple-light);
    border-radius: var(--border-radius-sm);
    padding: 14px 18px;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.oge-ege-stat-info-title {
    font-weight: 600;
    margin-bottom: 6px;
}

.oge-ege-stat-info-list {
    margin: 0;
    padding-left: 22px;
    line-height: 1.6;
}
.oge-ege-kes-toggle-header {
    display: flex;
    background: var(--primary-purple-lightest);
}

#oge-ege-kes-toggle-arrow {
    font-size: 18px;
    color: var(--primary-purple);
}

.oge-ege-stat-variants-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.oge-ege-stat-variant-card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 16px 20px;
    background: var(--bg-primary);
    width: 100%;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.oge-ege-stat-variant-clickable {
    cursor: pointer;
}

.oge-ege-stat-variant-clickable:hover,
.oge-ege-stat-variant-clickable:focus-visible {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-purple-light);
    outline: none;
}

.oge-ege-stat-variant-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.oge-ege-stat-variant-title {
    font-weight: 700;
    color: var(--text-primary);
}

.oge-ege-stat-variant-score {
    font-weight: 700;
    color: var(--primary-purple);
}

.oge-ege-stat-variant-score-of {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.oge-ege-stat-variant-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.oge-ege-stat-variant-expand {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
}

.oge-ege-results-header {
    position: relative;
    padding-right: 190px;
}

.oge-ege-results-header-actions {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
}

.oge-ege-mini-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 500;
    color: white;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    white-space: nowrap;
}

.oge-ege-mini-btn:hover {
    background: var(--hover-gradient);
}

@media (max-width: 600px) {
    .oge-ege-results-header {
        position: static;
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding-right: 0;
    }
    .oge-ege-results-header-actions {
        position: static;
        justify-content: flex-end;
    }
}

@media (max-width: 767px) {
    .oge-ege-stats-page { padding: 16px; margin: 0; }
    .oge-ege-stat-header-row {
        display: flex;
        align-items: center;
        gap: 8px;
        text-align: left;
        min-height: 0;
        padding: 0;
    }
    .oge-ege-stat-menu-btn {
        order: 2;
        position: static;
        margin-bottom: 0;
        flex-shrink: 0;
    }
    .oge-ege-stat-header-center {
        order: 1;
        flex: 1;
        min-width: 0;
        max-width: 100%;
        text-align: center;
    }
    .oge-ege-stat-hero { gap: 20px; padding: 12px 0 20px 0; flex-direction: column; }
    .oge-ege-stat-ring { width: 120px; height: 120px; }
    .oge-ege-stat-ring-inner { width: 96px; height: 96px; }
    .oge-ege-stat-ring-value { font-size: 24px; }
    .oge-ege-stat-hero-row { width: 100%; padding: 16px 4px; }
    .oge-ege-stat-hero-cell-value { font-size: 24px; }
}

.kes-progress-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 6px 0;
}

.kes-progress-item.kes-progress-child {
    padding: 4px 0 4px 24px;
}

.kes-code {
    min-width: 46px;
    font-size: 12px;
    color: #888;
    font-weight: 600;
    flex-shrink: 0;
}

.kes-title {
    flex: 0 0 auto;
    max-width: 420px;
    font-weight: 600;
}

.kes-progress-child .kes-title {
    font-size: 13px;
    color: #555;
    font-weight: 400;
}

.progress-container {
    flex: 1;
    min-width: 100px;
}

.progress-bar-bg {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.kes-score {
    min-width: 90px;
    text-align: right;
    font-weight: 600;
}

@media (max-width: 600px) {
    .kes-progress-item {
        flex-wrap: wrap;
        row-gap: 4px;
    }

    .kes-code {
        min-width: 34px;
        font-size: 11px;
    }

    .kes-title {
        flex: 1 1 auto;
        max-width: 100%;
        min-width: 0;
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .progress-container {
        flex-basis: 100%;
        order: 3;
        min-width: 0;
    }

    .kes-score {
        min-width: auto;
        font-size: 12px;
        margin-left: auto;
    }
}
