/*
 * Оформление «Теста ЕГЭ за 10 минут».
 *
 * Один файл на обе страницы теста (Mini App в боте и версия для сайта):
 * разметка у них общая, см. app/templates/quick_test/_test_body.html.
 *
 * Палитра намеренно совпадает с прежней версией теста (тёмный фон + amber),
 * чтобы переход не выглядел сменой продукта. Размеры шрифтов подняты:
 * мелкий текст в мини-аппах читается плохо.
 */

:root {
    --qt-bg: #0f1115;
    --qt-surface: #191c23;
    --qt-surface-2: #21252e;
    --qt-border: #2d323d;
    --qt-text: #f3f4f6;
    --qt-muted: #9aa3b2;
    --qt-accent: #f59e0b;
    --qt-accent-strong: #d97706;
    --qt-ok: #22c55e;
    --qt-bad: #ef4444;
}

body.qt-body {
    margin: 0;
    background: var(--qt-bg);
    color: var(--qt-text);
    font-family: 'Nunito', 'Golos Text', system-ui, -apple-system, sans-serif;
    font-size: 17px;
    line-height: 1.55;
    -webkit-tap-highlight-color: transparent;
}

.qt-hidden { display: none !important; }

.qt-shell {
    max-width: 32rem;
    margin: 0 auto;
    padding: 1rem 1rem 2.5rem;
}

/* ------------------------------------------------------------- приглашение */

.qt-invite-card {
    background: var(--qt-surface);
    border: 1px solid var(--qt-border);
    border-radius: 1.5rem;
    overflow: hidden;
}

.qt-invite-card img {
    display: block;
    width: 100%;
    height: auto;
}

.qt-invite-body { padding: 1.25rem; }

.qt-invite-list {
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
    display: grid;
    gap: 0.6rem;
}

.qt-invite-list li {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    color: var(--qt-muted);
    font-size: 1rem;
}

.qt-invite-list li b { color: var(--qt-text); font-weight: 700; }

.qt-invite-list .qt-bullet {
    flex: 0 0 auto;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.16);
    color: var(--qt-accent);
    display: grid;
    place-items: center;
    font-size: 0.9rem;
}

.qt-legal {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--qt-muted);
}

.qt-legal a { color: var(--qt-accent); }

/* ------------------------------------------------------------------ кнопки */

.qt-btn {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    font: inherit;
    font-weight: 800;
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease;
}

.qt-btn:active { transform: scale(0.985); }
.qt-btn[disabled] { opacity: 0.45; cursor: default; }

.qt-btn-primary { background: var(--qt-accent-strong); color: #fff; }
.qt-btn-primary:hover:not([disabled]) { background: var(--qt-accent); }

.qt-btn-ghost {
    background: var(--qt-surface-2);
    color: var(--qt-text);
    border: 1px solid var(--qt-border);
    font-weight: 700;
}

.qt-btn + .qt-btn { margin-top: 0.6rem; }

/* Ссылка, выглядящая кнопкой (переход в бота). */
.qt-btn-link {
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
}

/* ------------------------------------------------------------------ шапка */

.qt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.qt-brand { font-weight: 800; font-size: 1.05rem; }

.qt-timer {
    font-variant-numeric: tabular-nums;
    color: var(--qt-muted);
    font-size: 0.95rem;
}

.qt-progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--qt-muted);
    margin-bottom: 0.35rem;
}

.qt-progress-track {
    height: 0.5rem;
    background: var(--qt-surface-2);
    border-radius: 999px;
    overflow: hidden;
}

.qt-progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--qt-accent-strong), var(--qt-accent));
    transition: width 0.35s ease;
}

.qt-dots {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin: 0.85rem 0 1.25rem;
}

.qt-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 999px;
    background: #39404d;
}

.qt-dot.is-current { background: var(--qt-accent); transform: scale(1.35); }
.qt-dot.is-clean { background: var(--qt-ok); }
.qt-dot.is-fixed { background: var(--qt-accent-strong); }

/* ----------------------------------------------------------------- задание */

.qt-task { animation: qt-fade 0.28s ease; }

@keyframes qt-fade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

.qt-badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
}

.qt-badge-grammar { background: rgba(168, 85, 247, 0.18); color: #d8b4fe; }
.qt-badge-reading { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
.qt-badge-listening { background: rgba(34, 197, 94, 0.18); color: #86efac; }

/* Название раздела — главный ориентир на экране задания, поэтому крупно
   и в цвете раздела. Английская подпись остаётся чипом ниже. */
.qt-section-title {
    font-size: 1.85rem;
    line-height: 1.1;
    font-weight: 900;
    letter-spacing: -0.015em;
    margin: 0 0 0.5rem;
}

.qt-section-title-grammar { color: #d8b4fe; }
.qt-section-title-reading { color: #93c5fd; }
.qt-section-title-listening { color: #86efac; }

.qt-task-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.9rem;
    font-size: 0.9rem;
    color: var(--qt-muted);
}

.qt-instruction { color: var(--qt-muted); margin: 0 0 0.85rem; font-size: 0.98rem; }

.qt-passage {
    background: var(--qt-surface);
    border: 1px solid var(--qt-border);
    border-radius: 1.15rem;
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
    line-height: 1.75;
}

.qt-gap {
    border-bottom: 2px dashed var(--qt-accent);
    padding: 0 0.35rem;
    min-width: 4.5rem;
    display: inline-block;
    text-align: center;
}

.qt-gap.is-filled {
    color: var(--qt-accent);
    font-weight: 700;
    border-bottom-style: solid;
}

.qt-gap.is-active { background: rgba(245, 158, 11, 0.14); }

.qt-prompt {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 1rem;
    padding: 0.85rem 1rem;
    margin-bottom: 0.9rem;
    font-weight: 700;
    white-space: pre-line;
}

.qt-audio {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.28);
    border-radius: 1.15rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.qt-audio-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.7rem;
    font-weight: 700;
    color: #86efac;
}

.qt-audio audio { width: 100%; }

.qt-options { display: grid; gap: 0.55rem; }

.qt-option {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    width: 100%;
    text-align: left;
    background: var(--qt-surface);
    border: 2px solid var(--qt-border);
    border-radius: 1rem;
    padding: 0.85rem 1rem;
    color: var(--qt-text);
    font: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, opacity 0.2s ease;
}

.qt-option:hover:not([disabled]) { border-color: #4b5464; }
.qt-option:active:not([disabled]) { transform: scale(0.99); }

.qt-option-key {
    flex: 0 0 auto;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 0.55rem;
    background: var(--qt-surface-2);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--qt-muted);
}

.qt-option.is-correct {
    border-color: var(--qt-ok);
    background: rgba(34, 197, 94, 0.14);
}

.qt-option.is-correct .qt-option-key { background: var(--qt-ok); color: #05230f; }

.qt-option.is-wrong {
    border-color: var(--qt-bad);
    background: rgba(239, 68, 68, 0.12);
}

.qt-option.is-wrong .qt-option-key { background: var(--qt-bad); color: #2b0707; }

/* Отсеянные варианты гасим, но оставляем видимыми: ученик должен понимать,
   что именно отпало, а не гадать, куда делись кнопки. */
.qt-option.is-out { opacity: 0.35; }

.qt-next-wrap { margin-top: 1.25rem; }

/* ----------------------------------------------------------------- модалка */

.qt-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(5, 7, 12, 0.75);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1rem;
    animation: qt-fade 0.2s ease;
}

@media (min-width: 640px) { .qt-modal { align-items: center; } }

.qt-modal-card {
    width: 100%;
    max-width: 26rem;
    background: var(--qt-surface);
    border: 1px solid var(--qt-border);
    border-radius: 1.6rem;
    padding: 1.25rem;
    text-align: center;
    animation: qt-pop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

@keyframes qt-pop {
    from { opacity: 0; transform: translateY(28px) scale(0.94); }
    to { opacity: 1; transform: none; }
}

.qt-modal-sticker {
    width: 8.5rem;
    height: auto;
    margin: -3.5rem auto 0.25rem;
    display: block;
    filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.45));
}

.qt-modal-title { font-size: 1.25rem; font-weight: 800; margin-bottom: 0.35rem; }
.qt-modal-text { color: var(--qt-muted); margin: 0 0 1rem; }

.qt-hint {
    text-align: left;
    background: rgba(245, 158, 11, 0.09);
    border: 1px solid rgba(245, 158, 11, 0.32);
    border-radius: 1rem;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.qt-hint-label {
    display: block;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--qt-accent);
    font-weight: 800;
    margin-bottom: 0.3rem;
}

.qt-hint p { margin: 0; color: var(--qt-text); }

/* --------------------------------------------------------------- результат */

.qt-score-card {
    background: linear-gradient(160deg, rgba(245, 158, 11, 0.18), rgba(217, 119, 6, 0.06));
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 1.6rem;
    padding: 0 1.25rem 1.5rem;
    text-align: center;
    /* Стикер вылезает за верхнюю границу карточки на 2.5rem — без отступа
       сверху он упирается в край страницы и обрезается. */
    margin: 3rem 0 1.25rem;
}

.qt-score-card img {
    width: 9.5rem;
    height: auto;
    margin: -2.5rem auto 0;
    display: block;
}

.qt-score-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--qt-accent);
    font-weight: 800;
}

.qt-score-value {
    font-size: 4.5rem;
    line-height: 1;
    font-weight: 900;
    margin: 0.25rem 0 0.5rem;
}

.qt-score-desc { margin: 0 0 0.75rem; font-weight: 600; }

.qt-score-meta { color: var(--qt-muted); font-size: 0.95rem; }

.qt-section-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--qt-surface);
    border: 1px solid var(--qt-border);
    border-radius: 1rem;
    padding: 0.8rem 1rem;
    margin-bottom: 0.55rem;
}

.qt-section-score { font-weight: 800; }

.qt-block-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 1.75rem 0 0.75rem;
}

.qt-review-item {
    background: var(--qt-surface);
    border: 1px solid var(--qt-border);
    border-radius: 1.1rem;
    padding: 0.9rem 1rem;
    margin-bottom: 0.6rem;
}

.qt-review-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}

.qt-review-q { font-weight: 700; }

.qt-review-mark { font-size: 1.15rem; }

.qt-review-answers { font-size: 0.95rem; color: var(--qt-muted); }
.qt-review-answers b { color: var(--qt-text); font-weight: 700; }
.qt-review-why { margin: 0.5rem 0 0; font-size: 0.95rem; }

.qt-lock {
    background: var(--qt-surface);
    border: 1px dashed rgba(245, 158, 11, 0.55);
    border-radius: 1.4rem;
    padding: 1.4rem 1.25rem;
    text-align: center;
}

.qt-lock-title { font-size: 1.15rem; font-weight: 800; margin-bottom: 0.4rem; }
.qt-lock-text { color: var(--qt-muted); margin: 0 0 1.1rem; }

/* Обещание промокода на замке — ради него и регистрируются, поэтому
   выделяем цветом акцента, а не гасим как остальной текст замка. */
.qt-lock-bonus {
    color: var(--qt-accent);
    font-weight: 700;
    margin: 0 0 1.1rem;
}

/* --------------------------------------------------- промокод-лид-магнит */

.qt-promo {
    background: linear-gradient(150deg, rgba(34, 197, 94, 0.18), rgba(245, 158, 11, 0.08));
    border: 1px solid rgba(34, 197, 94, 0.45);
    border-radius: 1.4rem;
    padding: 1.4rem 1.25rem;
    margin-top: 1.5rem;
    text-align: center;
}

.qt-promo-title { font-size: 1.15rem; font-weight: 800; }

.qt-promo-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--qt-ok);
    margin: 0.6rem 0 0.5rem;
    /* Код диктуют вслух и переписывают руками — он не должен переноситься
       на середине. */
    word-break: keep-all;
}

.qt-promo-text { color: var(--qt-muted); margin: 0 0 1rem; }

.qt-analysis {
    background: linear-gradient(150deg, rgba(245, 158, 11, 0.16), rgba(217, 119, 6, 0.05));
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 1.3rem;
    padding: 1.15rem;
    margin-bottom: 1rem;
    white-space: pre-line;
}

.qt-transcript {
    background: var(--qt-surface);
    border: 1px solid var(--qt-border);
    border-radius: 1.1rem;
    padding: 0.9rem 1rem;
    margin-top: 0.6rem;
}

.qt-transcript summary { cursor: pointer; font-weight: 700; color: #86efac; }
.qt-transcript div { margin-top: 0.6rem; color: var(--qt-muted); white-space: pre-line; font-size: 0.95rem; }

.qt-share-preview {
    display: block;
    width: 100%;
    max-width: 20rem;
    margin: 0 auto 1rem;
    border-radius: 1.1rem;
    border: 1px solid var(--qt-border);
}

.qt-note { color: var(--qt-muted); font-size: 0.9rem; text-align: center; margin-top: 0.75rem; }

/* ------------------------------------------------- плашка cookie-согласия */

.qt-cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    /* Ниже модалки с реакцией (z-index 60 у .qt-modal): плашка перекрывала
       её кнопку на каждом задании, и ответ было нечем подтвердить. */
    z-index: 50;
    background: var(--qt-surface-2);
    border-top: 1px solid var(--qt-border);
    color: var(--qt-text);
    padding: 1rem 1.1rem;
    font-size: 0.95rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
}

.qt-cookie-banner a { color: var(--qt-accent); }

.qt-cookie-actions {
    display: flex;
    gap: 0.6rem;
}

/* Кнопки в плашке узкие: на всю ширину они закрывают собой полстраницы. */
.qt-cookie-actions .qt-btn {
    width: auto;
    padding: 0.55rem 1.3rem;
    font-size: 0.95rem;
    margin: 0;
}
