/* Тренажёр тестирования — та же палитра, что и на витрине sarmatbroker.kz */

:root {
    --brand: #1257c7;
    --brand-dark: #0e4099;
    --brand-soft: #eaf1fd;
    --brand-line: #c9dcfa;

    --ink: #0b1b33;
    --text: #3a4a63;
    --muted: #6e7f99;

    --bg: #ffffff;
    --alt: #f4f8fd;
    --line: #e3eaf4;

    --red: #d64545;
    --red-soft: #fdecec;
    --green: #17a06a;
    --green-soft: #e8f7f0;

    --radius: 14px;
    --wrap: 1000px;
    --shadow: 0 2px 4px rgba(11, 27, 51, .04), 0 12px 28px rgba(11, 27, 51, .07);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3 { margin: 0; color: var(--ink); font-weight: 700; line-height: 1.25; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.main { padding: 28px 20px 60px; }

.h1 { font-size: 30px; margin-bottom: 10px; }
.h2 { font-size: 21px; margin-bottom: 12px; }
.h3 { font-size: 16px; margin: 18px 0 8px; color: var(--muted); font-weight: 600; }
.lead { color: var(--muted); margin-bottom: 24px; max-width: 70ch; }
.note { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.lnk { color: var(--brand); border-bottom: 1px solid var(--brand-line); }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ── Кнопки ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: inherit;
    font-weight: 600;
    padding: 11px 22px;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.btn_primary { background: var(--brand); color: #fff; }
.btn_primary:hover { background: var(--brand-dark); }
.btn_ghost { background: transparent; border-color: var(--brand-line); color: var(--brand); }
.btn_ghost:hover { background: var(--brand-soft); }

/* ── Шапка ──────────────────────────────────────────────────────────────── */
.hdr { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 20; }

.hdr__in {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 14px;
    padding-bottom: 14px;
}

.logo { display: flex; align-items: center; gap: 12px; }

.logo__mark {
    width: 40px; height: 40px;
    flex: 0 0 auto;
    display: grid; place-items: center;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    letter-spacing: .5px;
}

.logo__txt { display: flex; flex-direction: column; line-height: 1.2; }
.logo__txt b { color: var(--ink); font-size: 16px; }
.logo__txt i { color: var(--muted); font-size: 12px; font-style: normal; }

.hdr__links { display: flex; align-items: center; gap: 16px; }
.hdr__links a { color: var(--brand); font-size: 14px; font-weight: 600; white-space: nowrap; }
.hdr__exit { color: var(--muted) !important; }
.hdr__exit:hover { color: var(--red) !important; }

/* Метка раздела, который сдаётся отдельно от общего билета */
.badge {
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand);
    font: 600 12px/1.4 inherit;
    font-style: normal;
    letter-spacing: .2px;
}

.mode_alt { background: var(--ink); border-color: var(--ink); }
.mode_alt b, .mode_alt span { color: #fff; }
.mode_alt span { opacity: .8; }

/* ── Форма входа ────────────────────────────────────────────────────────── */
.gate-body { display: grid; place-items: center; min-height: 100vh; background: var(--alt); padding: 20px; }

.gate {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 36px 32px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.gate h1 { font-size: 20px; }
.gate p { color: var(--muted); font-size: 14px; margin-bottom: 6px; }

.gate input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font: inherit;
    text-align: center;
}

.gate input:focus { outline: none; border-color: var(--brand); }
.gate__err { color: var(--red); font-size: 14px; }
.btn_wide { width: 100%; }

.tabs { border-top: 1px solid var(--line); background: var(--alt); }
.tabs__in { display: flex; gap: 4px; }

.tab {
    padding: 13px 18px;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab:hover { color: var(--ink); }
.tab.is-on { color: var(--brand); border-bottom-color: var(--brand); background: #fff; }

/* ── Учебник ────────────────────────────────────────────────────────────── */
.block { margin-bottom: 40px; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}

.card:hover { border-color: var(--brand-line); box-shadow: var(--shadow); transform: translateY(-1px); }
.card b { color: var(--ink); font-size: 15px; line-height: 1.35; }
.card span { color: var(--muted); font-size: 13px; }
.card__todo { color: var(--red); font-size: 12px; font-style: normal; }
.card__changed { color: #b07a12; font-size: 12px; font-style: normal; }

.crumbs { display: flex; gap: 8px; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.crumbs a { color: var(--brand); }

.article { max-width: 76ch; }

/* Учебный материал: HTML из статьи темы */
.prose { margin-top: 18px; }
.prose h2 { font-size: 19px; margin: 26px 0 10px; }
.prose h3 { font-size: 16px; margin: 20px 0 8px; color: var(--ink); font-weight: 700; }
.prose p { margin-bottom: 12px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose b, .prose strong { color: var(--ink); }

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 15px;
}

.prose th, .prose td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--alt); color: var(--ink); font-weight: 600; }

.prose blockquote {
    margin: 0 0 16px;
    padding: 12px 16px;
    border-left: 3px solid var(--brand);
    background: var(--brand-soft);
    border-radius: 0 8px 8px 0;
    color: var(--ink);
}

.prose .norm {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

/* Справка об изменениях законодательства на странице темы */
.changed {
    margin-top: 32px;
    padding: 22px 24px;
    border: 1px solid #f0d9a8;
    border-left: 4px solid #d99b1c;
    border-radius: var(--radius);
    background: #fdf8ec;
}

.changed h2 { font-size: 17px; margin-bottom: 8px; color: #8a6110; }
.changed__lead { color: #7d6231; font-size: 14px; margin-bottom: 14px; }
.changed .prose p { margin-bottom: 10px; }
.changed .prose ul { margin-bottom: 10px; }
.changed .prose b { color: #6b4c0d; }

.cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 32px;
    padding: 20px 24px;
    border: 1px solid var(--brand-line);
    border-radius: var(--radius);
    background: var(--brand-soft);
}

.cta b { display: block; color: var(--ink); }
.cta span { color: var(--muted); font-size: 14px; }

/* ── Выбор теста ────────────────────────────────────────────────────────── */
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 40px; }

.mode {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s;
}

.mode:hover { border-color: var(--brand-line); box-shadow: var(--shadow); }
.mode b { color: var(--ink); font-size: 18px; }
.mode span { color: var(--muted); font-size: 14px; }
.mode_primary { background: var(--brand); border-color: var(--brand); }
.mode_primary b, .mode_primary span { color: #fff; }
.mode_primary span { opacity: .85; }

.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

.stat {
    flex: 1 1 120px;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-align: center;
}

.stat b { display: block; color: var(--ink); font-size: 26px; }
.stat span { color: var(--muted); font-size: 13px; }

.weak { margin: 0; padding: 0; list-style: none; }
.weak li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.weak a { color: var(--brand); }
.weak span { color: var(--red); font-size: 13px; white-space: nowrap; }

.tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }

.ticket {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    transition: border-color .15s, background .15s;
}

.ticket:hover { border-color: var(--brand); background: var(--brand-soft); }
.ticket b { color: var(--ink); font-size: 20px; }
.ticket span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 14px;
    transition: border-color .15s, background .15s;
}

.chip:hover { border-color: var(--brand); background: var(--brand-soft); }
.chip i { color: var(--muted); font-style: normal; font-size: 12px; }

/* ── Прохождение теста ──────────────────────────────────────────────────── */
.runner { max-width: 760px; margin: 0 auto; }

.run__bar { height: 4px; background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 20px; }
.run__bar i { display: block; height: 100%; background: var(--brand); transition: width .25s; }

.run__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; font-size: 13px; }
.run__pos { color: var(--ink); font-weight: 600; }
.run__topic { color: var(--muted); }
.run__mode { margin-left: auto; padding: 3px 10px; border-radius: 999px; background: var(--alt); color: var(--muted); }

.run__q { font-size: 19px; line-height: 1.45; color: var(--ink); margin-bottom: 20px; }

.run__opts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }

.opt {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    font: inherit;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.opt:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
.opt:disabled { cursor: default; }

.opt__key {
    flex: 0 0 auto;
    width: 24px; height: 24px;
    display: grid; place-items: center;
    border-radius: 6px;
    background: var(--alt);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.opt__txt { flex: 1; }

.opt.is-picked { border-color: var(--brand); background: var(--brand-soft); }
.opt.is-picked .opt__key { background: var(--brand); color: #fff; }
.opt.is-right { border-color: var(--green); background: var(--green-soft); }
.opt.is-right .opt__key { background: var(--green); color: #fff; }
.opt.is-wrong { border-color: var(--red); background: var(--red-soft); }
.opt.is-wrong .opt__key { background: var(--red); color: #fff; }

.run__fb { padding: 14px 18px; border-radius: 12px; margin-bottom: 18px; }
.run__fb b { display: block; margin-bottom: 4px; }
.run__fb p { font-size: 15px; }
.run__fb i { display: block; margin-top: 8px; font-style: normal; font-size: 13px; color: var(--muted); }
.run__fb.is-right { background: var(--green-soft); }
.run__fb.is-right b { color: var(--green); }
.run__fb.is-wrong { background: var(--red-soft); }
.run__fb.is-wrong b { color: var(--red); }

.run__nav { display: flex; justify-content: space-between; gap: 12px; }
.run__nav_end { justify-content: flex-start; margin-top: 28px; }

/* ── Результат ──────────────────────────────────────────────────────────── */
.res { text-align: center; padding: 32px 24px; border-radius: var(--radius); margin-bottom: 32px; }
.res.is-pass { background: var(--green-soft); }
.res.is-fail { background: var(--red-soft); }

.res__verdict { font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; }
.res.is-pass .res__verdict { color: var(--green); }
.res.is-fail .res__verdict { color: var(--red); }

.res__score { font-size: 54px; font-weight: 800; color: var(--ink); line-height: 1.1; margin: 6px 0; }
.res__score s { text-decoration: none; color: var(--muted); font-weight: 400; }
.res__sub { color: var(--muted); font-size: 14px; }

.fixes { display: flex; flex-direction: column; gap: 14px; }

.fix { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); }
.fix__topic { display: inline-block; margin-bottom: 8px; padding: 3px 10px; border-radius: 999px; background: var(--alt); color: var(--muted); font-size: 12px; }
.fix__q { color: var(--ink); font-weight: 600; margin-bottom: 12px; }
.fix__bad, .fix__good { font-size: 15px; margin-bottom: 6px; padding-left: 14px; border-left: 3px solid; }
.fix__bad { border-color: var(--red); }
.fix__good { border-color: var(--green); }
.fix__bad span, .fix__good span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.fix__why { margin-top: 10px; font-size: 15px; color: var(--text); }
.fix__ref { margin-top: 6px; font-size: 13px; color: var(--muted); }
.fix__link { display: inline-block; margin-top: 12px; color: var(--brand); font-size: 14px; font-weight: 600; }

.err { padding: 24px; border: 1px solid var(--red); border-radius: var(--radius); background: var(--red-soft); }
.err b { display: block; color: var(--red); margin-bottom: 6px; }
.err p { margin-bottom: 14px; }

/* ── Подвал ─────────────────────────────────────────────────────────────── */
.ftr { border-top: 1px solid var(--line); background: var(--alt); padding: 24px 0; }
.ftr p { color: var(--muted); font-size: 13px; max-width: 80ch; }
.ftr p + p { margin-top: 8px; }

@media (max-width: 640px) {
    .h1 { font-size: 24px; }
    .run__q { font-size: 17px; }
    .res__score { font-size: 42px; }
    .hdr__in { padding-top: 10px; padding-bottom: 10px; }
    .logo__txt i { display: none; }
}
