/* Платформа «Оценка квалификации» — адаптивные стили (mobile-first) */

:root {
    --primary: #4a3f6b;
    --primary-light: #6b5b95;
    --primary-dark: #3d3356;
    --accent: #e07b4c;
    --accent-hover: #c96a3f;
    --success: #2e9e5b;
    --success-bg: #e6f6ec;
    --error: #d64541;
    --error-bg: #fdecea;
    --warning: #d78100;
    --warning-bg: #fff4e0;
    --info: #2a6fbb;
    --info-bg: #e8f1fb;
    --text: #26243a;
    --text-light: #6d6a85;
    --bg: #f3f3f8;
    --card: #fff;
    --border: #dfdeea;
    --border-light: #ececf4;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 3px rgba(38, 36, 58, .08), 0 4px 16px rgba(38, 36, 58, .06);
    --shadow-2: 0 4px 10px rgba(38, 36, 58, .10), 0 12px 32px rgba(38, 36, 58, .10);
    --shadow-3: 0 12px 24px rgba(38, 36, 58, .18), 0 24px 64px rgba(38, 36, 58, .16);
    --tap: 44px;
    /* геймификация */
    --xp: #8a6203;
    --xp-bg: #fdf6e3;
    --streak: #e2571b;
    --streak-bg: #fdeee6;
    /* градиенты */
    --grad-primary: linear-gradient(135deg, #3d3356, #6b5b95);
    --grad-accent: linear-gradient(135deg, #e07b4c, #d4622f);
    --grad-success: linear-gradient(135deg, #237a46, #2e9e5b);
    --grad-gold: linear-gradient(135deg, #b8860b, #e0a92e);
    /* отступы */
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
    --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;
    /* движение */
    --dur-fast: 120ms;
    --dur: 200ms;
    --dur-slow: 400ms;
    --ease: cubic-bezier(.2, .8, .3, 1);
}

@media (prefers-reduced-motion: reduce) {
    :root { --dur-fast: 1ms; --dur: 1ms; --dur-slow: 1ms; }
    *, *::before, *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 1ms !important;
    }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

a { color: var(--primary-light); }
img { max-width: 100%; }

:focus-visible {
    outline: 3px solid rgba(107, 91, 149, .5);
    outline-offset: 2px;
}

svg.i {
    width: 1.1em; height: 1.1em;
    vertical-align: -0.18em;
    fill: currentColor;
    flex-shrink: 0;
}

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

.topbar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}
.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; min-height: 42px; }
.brand-text { font-weight: 700; font-size: 17px; letter-spacing: .2px; }

.nav-toggle {
    margin-left: auto;
    background: rgba(255,255,255,.12);
    color: #fff;
    border: none;
    border-radius: 10px;
    width: var(--tap); height: var(--tap);
    font-size: 20px;
    cursor: pointer;
    display: block;
}
.nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0 6px;
}
.nav.open { display: flex; }
.nav a {
    color: #fff;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 10px;
    min-height: var(--tap);
    display: flex;
    align-items: center;
}
/* Пункты меню — явные кнопки: рамка, фон, активная страница залита белым */
.nav > a {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.28);
    font-weight: 600;
    gap: 7px;
}
.nav > a:hover, .nav > a:focus { background: rgba(255,255,255,.2); }
.nav > a[aria-current="page"] {
    background: #fff;
    border-color: #fff;
    color: var(--primary);
}
.nav-user {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.18);
    margin-top: 4px;
}
.nav-user-name { display: flex; flex-direction: column; font-size: 14px; }
.nav-user-name small { opacity: .75; font-size: 12px; }

@media (min-width: 900px) {
    .nav-toggle { display: none; }
    .nav {
        display: flex !important;
        flex-direction: row;
        align-items: center;
        width: auto;
        margin-left: auto;
        padding: 0;
    }
    .nav a { padding: 9px 12px; min-height: 0; font-size: 14.5px; white-space: nowrap; }
    .nav-user { border-top: none; margin: 0 0 0 8px; padding: 0 0 0 14px; border-left: 1px solid rgba(255,255,255,.25); }
}

/* ------------------------------------------------------------ основное */

.page {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}
@media (min-width: 700px) { .page { padding: 24px; } }

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 16px;
    transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
@media (min-width: 700px) { .card { padding: 26px; } }
a.card-hover:hover, .card-hover:hover {
    box-shadow: var(--shadow-2);
    transform: translateY(-2px);
}

h1, h2 { color: var(--primary); line-height: 1.25; }
h1 { font-size: 22px; margin-bottom: 14px; }
h2 { font-size: 19px; margin-bottom: 12px; }
h3 { font-size: 16px; margin: 18px 0 10px; color: var(--primary); }
@media (min-width: 700px) { h1 { font-size: 26px; } h2 { font-size: 21px; } }

.muted { color: var(--text-light); }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.page-head h1 { margin-bottom: 0; }
.page-head .spacer { flex: 1; }

.breadcrumbs { font-size: 14px; color: var(--text-light); margin-bottom: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.breadcrumbs a { color: var(--primary-light); text-decoration: none; }

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--tap);
    padding: 10px 18px;
    border: none;
    border-radius: 11px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, transform .05s;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #e9e8f2; color: var(--primary); }
.btn-secondary:hover { background: #dcdaea; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--error); color: #fff; }
.btn-outline { background: transparent; color: inherit; border: 1.5px solid currentColor; }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: 13.5px; border-radius: 9px; }
.btn-full { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* -------------------------------------------------------------- формы */

.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], select, textarea {
    width: 100%;
    min-height: var(--tap);
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(107, 91, 149, .15);
}
.form-row { display: flex; flex-wrap: wrap; gap: 10px; }
.form-row > * { flex: 1 1 180px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; min-height: var(--tap); font-size: 15px; }
.checkbox-label input { width: 20px; height: 20px; }

/* ----------------------------------------------------------- сообщения */

.flashes { margin-bottom: 14px; }
.flash {
    padding: 12px 14px;
    border-radius: 11px;
    margin-bottom: 8px;
    font-size: 14.5px;
    border: 1px solid transparent;
}
.flash-error { background: var(--error-bg); color: #90211e; border-color: #f3c1bf; }
.flash-success { background: var(--success-bg); color: #1a5e36; border-color: #bfe6cd; }
.flash-warning { background: var(--warning-bg); color: #8a5300; border-color: #f2ddb0; }
.flash-info { background: var(--info-bg); color: #1b4a7e; border-color: #c4dcf5; }

.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.badge-green { background: var(--success-bg); color: #1a5e36; }
.badge-red { background: var(--error-bg); color: #90211e; }
.badge-orange { background: var(--warning-bg); color: #8a5300; }
.badge-blue { background: var(--info-bg); color: #1b4a7e; }
.badge-grey { background: #ececf4; color: var(--text-light); }

/* -------------------------------------------------------------- вход */

.login-wrap {
    min-height: calc(100vh - 140px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}
.login-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px 22px;
    width: 100%;
    max-width: 420px;
}
.login-title { text-align: center; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--text-light); font-size: 14px; margin-bottom: 18px; }
.login-links { text-align: center; margin-top: 14px; font-size: 14px; }

/* ---------------------------------------------------- карточки-плитки */

.tile-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .tile-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .tile-grid { grid-template-columns: repeat(3, 1fr); } }

.tile {
    display: block;
    background: var(--card);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: transform .12s, border-color .12s;
}
a.tile:hover { transform: translateY(-2px); border-color: var(--primary-light); box-shadow: var(--shadow-2); }
.tile.disabled { opacity: .55; }
.tile-title { font-weight: 650; margin-bottom: 8px; color: var(--primary); }
.tile-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13.5px; color: var(--text-light); }

.category-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .category-grid { grid-template-columns: repeat(3, 1fr); } }
.category-card {
    text-align: center;
    padding: 18px 10px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border-light);
    background: var(--card);
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: transform .12s, border-color .12s;
}
a.category-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-2); }
.category-card.disabled { opacity: .45; }
.category-count { font-size: 30px; font-weight: 800; color: var(--accent); }
.category-name { font-weight: 650; margin-top: 4px; }
.category-desc { font-size: 12.5px; color: var(--text-light); margin-top: 4px; }

/* ------------------------------------------------------------ KPI/отчёты */

.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
@media (min-width: 700px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .kpi-grid { grid-template-columns: repeat(5, 1fr); } }
.kpi {
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 12px 14px;
}
.kpi-value { font-size: 22px; font-weight: 800; color: var(--primary); word-break: break-word; }
.kpi-label { font-size: 12.5px; color: var(--text-light); margin-top: 2px; }

.report-nav {
    display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px;
    margin-bottom: 14px; -webkit-overflow-scrolling: touch;
}
.report-nav a {
    flex: 0 0 auto;
    padding: 8px 13px;
    border-radius: 999px;
    background: var(--card);
    border: 1.5px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-size: 13.5px;
    white-space: nowrap;
}
.report-nav a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.chart-box { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.chart-box h3 { margin-top: 0; }
.chart-holder { position: relative; height: 280px; }
@media (min-width: 700px) { .chart-holder { height: 340px; } }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.filters .form-group { margin-bottom: 0; flex: 1 1 150px; }
.filters .btn { flex: 0 0 auto; }

/* -------------------------------------------------------------- таблицы */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; box-shadow: var(--shadow); background: var(--card); }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 560px;
}
table.data th, table.data td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}
table.data th {
    background: #f7f7fb;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: var(--text-light);
    position: sticky; top: 0;
}
table.data tr:hover td { background: #fafaff; }
table.data a { text-decoration: none; font-weight: 600; }
td.ok { color: var(--success); font-weight: 700; }
td.fail { color: var(--error); font-weight: 700; }

.pagination { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 38px; min-height: 38px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px; background: var(--card); border: 1px solid var(--border);
    text-decoration: none; color: var(--text); font-size: 14px; padding: 0 8px;
}
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------------------------------------------------------------- тест */

.test-shell { max-width: 860px; margin: 0 auto; }
.test-top {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: 58px; z-index: 30;
    background: var(--bg);
    padding: 8px 0;
}
.question-counter { font-size: 15px; }
.timer {
    font-variant-numeric: tabular-nums;
    font-size: 19px; font-weight: 800;
    background: var(--card);
    border-radius: 10px;
    padding: 7px 13px;
    box-shadow: var(--shadow);
    color: var(--primary);
}
.timer.warning { color: var(--warning); }
.timer.danger { color: var(--error); animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: .4; } }

.questions-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.question-nav-btn {
    width: 38px; height: 38px;
    border-radius: 9px;
    border: 1.5px solid var(--border);
    background: var(--card);
    font-size: 13.5px; font-weight: 600;
    color: var(--text);
    cursor: pointer;
}
.question-nav-btn.answered { background: var(--success-bg); border-color: #9fd7b4; color: #1a5e36; }
.question-nav-btn.skipped { background: var(--warning-bg); border-color: #ecd39c; color: #8a5300; }
.question-nav-btn.marked { box-shadow: inset 0 0 0 2px var(--accent); }
.question-nav-btn.current { background: var(--primary); border-color: var(--primary); color: #fff; }

.question-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.question-text { font-size: 17px; font-weight: 600; margin-bottom: 16px; line-height: 1.45; }

.answer-item {
    display: flex; gap: 12px; align-items: flex-start;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 13px 14px;
    margin-bottom: 9px;
    cursor: pointer;
    background: #fff;
    transition: border-color .1s, background .1s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.answer-item:hover { border-color: var(--primary-light); }
.answer-item.selected { border-color: var(--accent); background: #fdf3ee; }
.answer-number {
    flex: 0 0 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    background: #ececf4;
    font-size: 13px; font-weight: 700;
    color: var(--text-light);
}
.answer-item.selected .answer-number { background: var(--accent); color: #fff; }
.answer-text { font-size: 15.5px; }

.test-controls {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    margin-top: 16px;
    padding-bottom: env(safe-area-inset-bottom);
}
.test-controls .btn { flex: 1 1 130px; }
.test-controls .mark-checkbox { flex: 1 1 100%; }
@media (min-width: 700px) {
    .test-controls .btn { flex: 0 0 auto; }
    .test-controls .mark-checkbox { flex: 0 0 auto; margin-left: auto; }
}

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

.results-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
@media (min-width: 700px) { .results-summary { grid-template-columns: repeat(5, 1fr); } }
.result-item { background: #f7f7fb; border-radius: 12px; padding: 14px; text-align: center; }
.result-value { font-size: 21px; font-weight: 800; color: var(--primary); }
.result-label { font-size: 12.5px; color: var(--text-light); margin-top: 3px; }
.result-item.result-passed { background: var(--success-bg); }
.result-item.result-passed .result-value { color: var(--success); }
.result-item.result-failed { background: var(--error-bg); }
.result-item.result-failed .result-value { color: var(--error); }

/* --------------------------------------------------------------- подвал */

.footer { background: transparent; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
.footer-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between;
    color: var(--text-light); font-size: 12.5px;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 12px; }
.footer-links a { color: var(--text-light); }

/* ---------------------------------------------------------- cookie-баннер */

.cookie-banner {
    position: fixed;
    left: 12px; right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 100;
    background: var(--primary-dark);
    color: #fff;
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,.35);
    padding: 14px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.cookie-banner p { flex: 1 1 260px; font-size: 13.5px; line-height: 1.45; }
.cookie-banner a { color: #ffd9c4; }
@media (min-width: 700px) { .cookie-banner { left: auto; max-width: 560px; } }

/* --------------------------------------------------------------- ошибки */

.error-box { text-align: center; padding: 60px 20px; }
.error-box .error-code { font-size: 44px; font-weight: 800; color: var(--primary-light); margin-bottom: 10px; }
.error-box .error-message { color: var(--text-light); margin-bottom: 22px; font-size: 16px; }

/* --------------------------------------------------------------- разное */

.legal-body { max-width: 760px; line-height: 1.65; }
.legal-body h2 { margin: 18px 0 10px; }
.legal-body p { margin-bottom: 10px; }

.progress-bar { height: 8px; border-radius: 999px; background: #ececf4; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--success); border-radius: 999px; }

.actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list code {
    background: #ececf4; border-radius: 7px; padding: 3px 8px; font-size: 12.5px;
}
details.panel { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 16px; margin-bottom: 10px; }
details.panel summary { cursor: pointer; font-weight: 650; color: var(--primary); min-height: 30px; }

/* ------------------------------------------------------------- чипы */

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 38px; padding: 0 14px;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: 13.5px; font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
    -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: var(--primary-light); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* --------------------------------------------------------- стат-плитки */

.stat {
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 12px 14px;
    min-width: 0;
}
.stat-value {
    font-size: 22px; font-weight: 800; color: var(--primary);
    display: flex; align-items: center; gap: 6px;
    line-height: 1.2;
}
.stat-label { font-size: 12.5px; color: var(--text-light); margin-top: 2px; }
.stat-sub { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.stat-delta { font-size: 12.5px; font-weight: 700; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--error); }
.stat-streak .stat-value { color: var(--streak); }
.stat-xp .stat-value { color: var(--xp); }

/* ------------------------------------------------------ кольцо прогресса */

.ring-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.ring {
    --value: 0;
    --ring-color: var(--primary-light);
    --size: 84px;
    --thick: 9px;
    width: var(--size); height: var(--size);
    border-radius: 50%;
    background: conic-gradient(var(--ring-color) calc(var(--value) * 1%), var(--border-light) 0);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--thick)), #000 calc(100% - var(--thick) + 1px));
    mask: radial-gradient(farthest-side, transparent calc(100% - var(--thick)), #000 calc(100% - var(--thick) + 1px));
}
.ring-center {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center;
}
.ring-center b { font-size: 17px; font-weight: 800; color: var(--text); }
.ring-center small { font-size: 10.5px; color: var(--text-light); }

/* -------------------------------------------------------------- тосты */

.toast-stack {
    position: fixed;
    z-index: 200;
    left: 12px; right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
@media (min-width: 700px) {
    .toast-stack { left: auto; right: 20px; top: 74px; bottom: auto; width: 340px; }
}
.toast {
    pointer-events: auto;
    background: var(--card);
    color: var(--text);
    border-radius: 12px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-2);
    padding: 12px 14px;
    font-size: 14.5px;
    font-weight: 600;
    display: flex; align-items: center; gap: 10px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-color: #bfe6cd; background: var(--success-bg); color: #1a5e36; }
.toast-error { border-color: #f3c1bf; background: var(--error-bg); color: #90211e; }
.toast-info { border-color: #c4dcf5; background: var(--info-bg); color: #1b4a7e; }
.toast-xp { border-color: #ecd39c; background: var(--xp-bg); color: var(--xp); }

/* ------------------------------------------------------------- диалоги */

dialog.modal {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-3);
    padding: 24px 22px;
    width: min(92vw, 440px);
    color: var(--text);
}
dialog.modal::backdrop { background: rgba(38, 36, 58, .45); }
dialog.modal h3 { margin: 0 0 8px; color: var(--primary); font-size: 18px; }
dialog.modal p { color: var(--text-light); font-size: 14.5px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal-hero { text-align: center; padding: 6px 0 2px; }
.modal-hero .modal-icon {
    width: 72px; height: 72px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--grad-gold); color: #fff;
    font-size: 32px; margin-bottom: 12px;
}
.modal-hero .modal-icon svg.i { width: 34px; height: 34px; }
@media (max-width: 699px) {
    dialog.modal.sheet {
        margin: auto 0 0;
        width: 100vw; max-width: 100vw;
        border-radius: 20px 20px 0 0;
        padding-bottom: calc(22px + env(safe-area-inset-bottom));
    }
}

/* ------------------------------------------------------- прогресс-бары */

.progress-lg { height: 12px; }
.progress-bar > span { transition: width var(--dur-slow) var(--ease); }
.progress-line { display: flex; align-items: center; gap: 10px; }
.progress-line .progress-bar { flex: 1; }
.progress-line .progress-caption { font-size: 12.5px; color: var(--text-light); white-space: nowrap; }

