/* ПДР Тести (pdrtesty.com) — тренажёр. Фирменные цвета: тёмно-зелёный #17383c (шапка, панель) и салатовый #c9e98a (акцент).
   Цвета контента — через переменные; тёмная тема переопределяет их в @media (prefers-color-scheme: dark). */
:root {
  --forest: #17383c;
  --forest-2: #21494e;
  --lime: #c9e98a;
  --bg: #f4f6f6;
  --surface: #ffffff;
  --surface-2: #f8f9f9;
  --chip: #eceff0;
  --line: #dde3e3;
  --line-2: #c3cdce;
  --line-hover: #8fa5a8;
  --ink: #14272b;
  --text: #2a3a3e;
  --soft: #536569;
  --accent: #1d5359;
  --tint: #e8eeee;
  --primary-bg: #17383c;
  --primary-fg: #ffffff;
  --primary-hover: #24494e;
  --selected-bg: #edf2f2;
  --answered-bg: #e1ebea;
  --answered-line: #afc4c4;
  --answered-fg: #1d4d52;
  --green: #2c7650;
  --green-ink: #1f5a3b;
  --green-bg: #e5f3e9;
  --green-line: #9ccdae;
  --green-fill: #2c7650;
  --red: #a9432f;
  --red-ink: #87331f;
  --red-bg: #fbebe7;
  --red-line: #e3a597;
  --red-fill: #a9432f;
  --focus: #1d6f78;
  --shadow: 0 1px 2px rgba(20, 39, 43, .04), 0 10px 30px rgba(20, 39, 43, .06);
  --header-h: 64px;
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
/* Тёмная тема: атрибут data-theme ставит скрипт в <head> (выбор пользователя или настройка системы). */
:root[data-theme="dark"] {
  --bg: #0d1618;
  --surface: #152124;
  --surface-2: #1a282b;
  --chip: #223236;
  --line: #2a3b3f;
  --line-2: #3b5055;
  --line-hover: #5f7a7f;
  --ink: #eef3f1;
  --text: #d3ddda;
  --soft: #9fb0ac;
  --accent: #c9e98a;
  --tint: #1b2c2f;
  --primary-bg: #c9e98a;
  --primary-fg: #17383c;
  --primary-hover: #d8f2a6;
  --selected-bg: #1e3236;
  --answered-bg: #213a3d;
  --answered-line: #3f6166;
  --answered-fg: #d6e9e6;
  --green: #74cf9c;
  --green-ink: #a6e6c1;
  --green-bg: rgba(116, 207, 156, .12);
  --green-line: rgba(116, 207, 156, .45);
  --green-fill: #2f8a5c;
  --red: #f08f7a;
  --red-ink: #ffb9a9;
  --red-bg: rgba(240, 143, 122, .12);
  --red-line: rgba(240, 143, 122, .45);
  --red-fill: #b9533d;
  --focus: #c9e98a;
  --shadow: none;
    color-scheme: dark;
}
[data-theme="dark"] .site-header { background: #10282b; }
[data-theme="dark"] .sidebar { background: #12292c; }
[data-theme="dark"] .question-image, [data-theme="dark"] .answer-image { filter: brightness(.94); }


* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); font-size: 16px; line-height: 1.5; -webkit-tap-highlight-color: rgba(201, 233, 138, .3); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { text-wrap: balance; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.site-header :focus-visible, .sidebar :focus-visible { outline-color: var(--lime); }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; z-index: 200; top: 8px; left: 8px; padding: 10px 14px; border-radius: 10px; color: var(--forest); background: var(--lime); font-weight: 700; text-decoration: none; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* ---------- Шапка (общая для всех страниц) ---------- */
.site-header {
  position: sticky; z-index: 40; top: 0; display: flex; align-items: center; gap: 22px;
  height: var(--header-h); padding: 0 clamp(16px, 2.6vw, 32px); color: #fff; background: var(--forest);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.brand { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; min-height: 44px; color: #fff; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: var(--forest); background: var(--lime); font-size: 13px; font-weight: 800; letter-spacing: -.3px; }
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: -.5px; }
.brand-name span { color: #a9c0b2; }
.site-nav { display: flex; align-items: center; gap: 2px; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 10px; color: #d3e0d6; font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.site-nav a:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.site-nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .1); }
.header-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.icon-button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid rgba(255, 255, 255, .18); border-radius: 12px; color: #e6eee7; background: transparent; font-size: 24px; line-height: 1; }
.icon-button:hover { background: rgba(255, 255, 255, .08); }
.theme-toggle { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; padding: 0; border: 1px solid rgba(255, 255, 255, .18); border-radius: 12px; color: #e6eee7; background: transparent; cursor: pointer; }
.theme-toggle:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.theme-toggle .i-sun, [data-theme="dark"] .theme-toggle .i-moon { display: none; }
[data-theme="dark"] .theme-toggle .i-sun { display: block; }
.menu-button, .close-sidebar { display: none !important; }

.search-wrap { position: relative; width: 230px; }
.search-box { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 10px 0 12px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 12px; color: #c4d4c9; background: rgba(255, 255, 255, .07); cursor: text; }
.search-box:focus-within { border-color: var(--lime); background: rgba(255, 255, 255, .12); }
.search-icon { flex: 0 0 auto; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: #fff; background: transparent; font-size: 15px; }
.search-box input::placeholder { color: #a9bcb0; }
.search-box input::-webkit-search-cancel-button { filter: invert(1); }
kbd { flex: 0 0 auto; padding: 2px 6px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 6px; color: #b9cabe; font: 600 11px var(--font); }
.search-results { position: absolute; z-index: 60; top: calc(100% + 8px); right: 0; left: 0; min-width: 320px; max-height: min(440px, 70vh); overflow: auto; overscroll-behavior: contain; padding: 6px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: var(--surface); box-shadow: 0 18px 48px rgba(10, 25, 27, .25); }
.search-result { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; }
.search-result:hover, .search-result:focus-visible { background: var(--tint); }
.search-result small { display: block; margin-bottom: 3px; color: var(--accent); font-size: 12px; font-weight: 700; }
.search-result span { display: -webkit-box; overflow: hidden; color: var(--text); font-size: 14px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.search-empty { padding: 14px 12px; color: var(--soft); font-size: 14px; }

.app-header .toolbar-button { border-color: rgba(255, 255, 255, .18); color: #e2ebe4; background: transparent; }
.app-header .toolbar-button:hover:not(:disabled) { color: #fff; border-color: rgba(255, 255, 255, .32); background: rgba(255, 255, 255, .08); }
.app-header .toolbar-button:disabled { opacity: .55; }
.errors-button span { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 8px; color: var(--forest); background: var(--lime); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.errors-button:disabled span { color: #c4d4c9; background: rgba(255, 255, 255, .12); }

/* Переключатель языка: активный — светлый, неактивный — приглушённый, без яркой заливки */
.lang-switch { display: inline-flex; flex: 0 0 auto; padding: 3px; border-radius: 12px; background: rgba(0, 0, 0, .2); }
.lang-switch button, .lang-switch a { display: grid; place-items: center; min-width: 38px; height: 36px; padding: 0 8px; border: 0; border-radius: 9px; color: #a9bcb0; background: transparent; font-size: 13px; font-weight: 700; text-decoration: none; }
.lang-switch button:hover, .lang-switch a:hover { color: #fff; }
.lang-switch button.active, .lang-switch a.active { color: var(--forest); background: #f1f5f2; }

.account-link { display: inline-flex; align-items: center; gap: 8px; max-width: 180px; height: 44px; padding: 0 14px 0 5px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 12px; color: #fff; font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.account-link:hover { background: rgba(255, 255, 255, .08); }
.account-avatar { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 9px; color: var(--forest); background: var(--lime); font-size: 14px; font-weight: 800; }
.account-label { overflow: hidden; text-overflow: ellipsis; }

/* ---------- Каркас: шапка сверху, боковая панель и контент ---------- */
.app-shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: calc(100vh - var(--header-h)); }
.sidebar {
  position: sticky; top: var(--header-h); display: flex; flex-direction: column; gap: 18px;
  height: calc(100vh - var(--header-h)); padding: 22px 18px 18px; overflow-y: auto; overscroll-behavior: contain;
  color: #eef3ec; background: var(--forest); scrollbar-color: #3d5f62 transparent; scrollbar-width: thin;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sidebar-count { color: #b9cabe; font-size: 13px; }
.side-exam { display: grid; gap: 2px; width: 100%; padding: 14px 16px; border: 0; border-radius: 14px; color: var(--forest); background: var(--lime); text-align: left; transition: background-color .15s ease; }
.side-exam strong { font-size: 17px; letter-spacing: -.3px; }
.side-exam small { color: #335128; font-size: 13px; }
.side-exam:hover { background: #d8f2a6; }
.sidebar-section-heading { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 2px -6px; color: #e6eee4; font-size: 14px; font-weight: 700; }
.sidebar-section-heading span:last-child { color: #a9bdb1; font-size: 12px; font-weight: 600; }
.ticket-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.ticket-button {
  position: relative; min-width: 0; height: 40px; border: 1px solid rgba(214, 230, 212, .16); border-radius: 10px;
  color: #d3e0d6; background: rgba(255, 255, 255, .05); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
  transition: background-color .15s ease, color .15s ease;
}
.ticket-button:hover { color: #fff; background: rgba(255, 255, 255, .13); }
.ticket-button.started:not(.active) { border-color: rgba(201, 233, 138, .45); color: #edf6df; }
.ticket-button.complete:not(.active)::after { position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--lime); content: ''; }
.ticket-button.active { border-color: var(--lime); color: var(--forest); background: var(--lime); }
.sidebar-links { display: grid; gap: 2px; margin: 0 -6px; }
.sidebar-links a { display: flex; align-items: center; min-height: 40px; padding: 0 10px; border-radius: 10px; color: #d3e0d6; font-size: 14px; font-weight: 600; text-decoration: none; }
.sidebar-links a:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(218, 233, 221, .14); }
.mini-progress-copy { display: flex; justify-content: space-between; margin-bottom: 8px; color: #c9d7cd; font-size: 13px; }
.mini-progress-copy strong { color: var(--lime); }
.sidebar-footer p { margin: 10px 0 0; color: #a9bdb1; font-size: 12px; }
.progress-track { height: 6px; border-radius: 99px; overflow: hidden; background: var(--chip); }
.sidebar .progress-track { background: rgba(255, 255, 255, .14); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--primary-bg); transition: width .3s ease; }
.sidebar .progress-track span { background: var(--lime); }
.sidebar-backdrop { display: none; }

.page-area { min-width: 0; }
.main-content { max-width: 1240px; margin: 0 auto; padding: 28px clamp(16px, 3vw, 40px) 40px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: start; gap: clamp(20px, 2.6vw, 36px); }
.study-column { min-width: 0; }

/* ---------- Заголовок билета и режимы ---------- */
.app-title { margin: 0 0 14px; color: var(--soft); font-size: 15px; font-weight: 650; letter-spacing: 0; }
.app-title span { color: inherit; }
.ticket-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 20px; align-items: start; }
.heading-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ticket-pill { padding: 4px 10px; border-radius: 99px; color: var(--forest); background: var(--lime); font-size: 13px; font-weight: 800; }
.muted-label { color: var(--soft); font-size: 14px; font-variant-numeric: tabular-nums; }
.ticket-heading h2 { margin: 6px 0 0; color: var(--ink); font-size: clamp(24px, 2.6vw, 30px); font-weight: 800; line-height: 1.2; letter-spacing: -.6px; }
.heading-side { display: flex; align-items: center; gap: 10px; }
.ticket-score { display: grid; grid-template-columns: auto auto; align-items: baseline; column-gap: 4px; min-width: 84px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.ticket-score strong { color: var(--ink); font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ticket-score span { color: var(--soft); font-size: 14px; }
.ticket-score small { grid-column: 1 / -1; color: var(--soft); font-size: 12px; }
.ticket-heading .heading-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ticket-heading .heading-actions:empty { display: none; }
body[data-view="practice"] #ticketPill { display: none; }
body[data-view="test"] .exam-main, body[data-view="exam"] .exam-main, body[data-view="result"] .exam-main { display: none; }
body[data-view="exam"] .app-title, body[data-view="test"] .app-title { display: none; }

.toolbar-button, .primary-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: 12px; color: var(--ink); background: var(--surface); font-size: 15px; font-weight: 700; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.toolbar-button:hover:not(:disabled) { border-color: var(--line-hover); background: var(--surface-2); }
.primary-button { border-color: var(--primary-bg); color: var(--primary-fg); background: var(--primary-bg); }
.primary-button:hover:not(:disabled) { border-color: var(--primary-hover); background: var(--primary-hover); }
.primary-button:disabled, .toolbar-button:disabled { opacity: .5; cursor: not-allowed; }
.toolbar-button b { font-weight: inherit; }
.exam-main { border-color: var(--lime); color: var(--forest); background: var(--lime); }
.exam-main:hover:not(:disabled) { border-color: #d8f2a6; color: var(--forest); background: #d8f2a6; }
.text-button { min-height: 44px; padding: 0; border: 0; color: var(--red); background: transparent; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.text-button:hover { color: var(--red-ink); }

.question-progress { display: flex; align-items: center; gap: 12px; margin: 22px 0 14px; }
.question-progress .progress-track { flex: 1; }
.question-progress > span { min-width: 64px; color: var(--soft); font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- Карточка вопроса ---------- */
.question-card { min-height: 420px; padding: clamp(20px, 3vw, 34px); border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); scroll-margin-top: calc(var(--header-h) + 12px); }
.question-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; }
.topic-chip { display: inline-flex; align-items: center; max-width: 100%; min-height: 32px; padding: 0 10px; overflow: hidden; border-radius: 8px; color: var(--accent); background: var(--tint); font-size: 13px; font-weight: 600; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.topic-chip:hover { background: var(--chip); }
.question-text { max-width: 46em; margin: 0; color: var(--ink); font-size: clamp(19px, 1.9vw, 23px); font-weight: 700; line-height: 1.42; letter-spacing: -.3px; }
.question-image-wrap { display: flex; justify-content: center; margin: 20px 0 6px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.question-image { display: block; max-width: min(100%, 600px); height: auto; max-height: 340px; object-fit: contain; }
.answers-heading { margin: 22px 0 10px; color: var(--soft); font-size: 14px; font-weight: 600; }
.answers-list { display: grid; gap: 10px; }
.answer-option {
  display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 12px 16px 12px 12px;
  border: 1.5px solid var(--line); border-radius: 14px; color: var(--text); background: var(--surface); text-align: left;
  transition: border-color .15s ease, background-color .15s ease;
}
.answer-option:hover:not(:disabled) { border-color: var(--line-hover); background: var(--surface-2); }
.answer-option:disabled { cursor: default; opacity: 1; }
.answer-index { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: var(--ink); background: var(--chip); font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.answer-copy { min-width: 0; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.answer-image { display: block; max-width: 100%; height: auto; max-height: 180px; margin-top: 8px; object-fit: contain; }
.answer-label { display: block; color: var(--soft); font-size: 14px; }
.answer-option.is-selected:not(.is-correct):not(.is-wrong) { border-color: var(--primary-bg); background: var(--selected-bg); box-shadow: inset 0 0 0 1px var(--primary-bg); }
.answer-option.is-selected:not(.is-correct):not(.is-wrong) .answer-index { color: var(--primary-fg); background: var(--primary-bg); }
.answer-option.is-correct { border-color: var(--green-line); color: var(--green-ink); background: var(--green-bg); }
.answer-option.is-correct .answer-index { color: #fff; background: var(--green-fill); }
.answer-option.is-wrong { border-color: var(--red-line); color: var(--red-ink); background: var(--red-bg); }
.answer-option.is-wrong .answer-index { color: #fff; background: var(--red-fill); }

.feedback { margin-top: 14px; border-radius: 14px; }
.feedback.correct { color: var(--green-ink); background: var(--green-bg); }
.feedback.incorrect { color: var(--red-ink); background: var(--red-bg); }
.feedback-head { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 14px; font-size: 16px; list-style: none; }
.feedback-head::-webkit-details-marker { display: none; }
summary.feedback-head { cursor: pointer; }
.feedback-head .feedback-symbol { flex: 0 0 24px; width: 24px; height: 24px; font-size: 13px; }
.feedback.correct .feedback-symbol { background: var(--green-fill); }
.feedback.incorrect .feedback-symbol { background: var(--red-fill); }
.feedback-more { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.feedback-more::after { content: '▾'; text-decoration: none; transition: transform .15s ease; }
.feedback[open] .feedback-more::after { transform: rotate(180deg); }
.feedback .explanation { margin: 0; border-left: 0; border-top: 1px solid currentColor; border-radius: 0 0 14px 14px; border-top-color: color-mix(in srgb, currentColor 18%, transparent); color: var(--text); background: transparent; }
.feedback-box { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; padding: 14px 16px; border-radius: 14px; }
.feedback-box.correct { color: var(--green-ink); background: var(--green-bg); }
.feedback-box.incorrect { color: var(--red-ink); background: var(--red-bg); }
.feedback-symbol { flex: 0 0 26px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: 14px; font-weight: 800; }
.feedback-box.correct .feedback-symbol { background: var(--green-fill); }
.feedback-box.incorrect .feedback-symbol { background: var(--red-fill); }
.feedback-copy strong { display: block; margin-bottom: 2px; font-size: 16px; }
.feedback-copy p { margin: 0; font-size: 15px; line-height: 1.55; }
.expl-lang { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 16px; color: var(--soft); font-size: 14px; }
.expl-lang span { margin-right: 2px; }
.expl-lang button { min-width: 44px; min-height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 9px; color: var(--ink); background: var(--surface); font-size: 13px; font-weight: 800; }
.expl-lang button.active { border-color: var(--primary-bg); color: var(--primary-fg); background: var(--primary-bg); }
.explanation { margin-top: 10px; padding: 14px 16px; border-left: 3px solid var(--line-hover); border-radius: 0 12px 12px 0; color: var(--text); background: var(--surface-2); font-size: 15px; line-height: 1.65; white-space: pre-line; }
.permalink { display: inline-flex; align-items: center; min-height: 44px; margin-top: 6px; color: var(--accent); font-size: 14px; font-weight: 600; text-decoration: none; }
.permalink:hover { text-decoration: underline; }
.loading-state { display: grid; place-content: center; justify-items: center; gap: 10px; min-height: 340px; color: var(--soft); font-size: 15px; text-align: center; }
.loader { width: 28px; height: 28px; border: 3px solid var(--chip); border-top-color: var(--primary-bg); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Статус теста / экзамена внутри карточки (счётчик уже есть над карточкой) */
.test-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: -4px 0 16px; padding: 10px 14px; border-radius: 12px; color: var(--text); background: var(--tint); font-size: 14px; }
.test-status strong { color: var(--ink); }
.test-status > span:last-child:not(:first-child) { display: none; }
.exam-status.danger { color: var(--red-ink); background: var(--red-bg); }
.exam-status.danger strong { color: var(--red-ink); }

/* ---------- Навигация и табло номеров ---------- */
.question-navigation { display: grid; gap: 12px; margin-top: 16px; }
.nav-bar { display: flex; align-items: center; gap: 10px; }
.nav-bar .next { margin-left: auto; }
.nav-bar .finish-test-button { margin-left: auto; }
.nav-bar .finish-test-button + .next { margin-left: 0; }
.abandon-test-button { justify-self: end; }
.nav-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-width: 128px; height: 48px; padding: 0 18px; border: 1px solid var(--line-2); border-radius: 12px; color: var(--ink); background: var(--surface); font-size: 15px; font-weight: 700; transition: background-color .15s ease, border-color .15s ease; }
.nav-button:hover:not(:disabled) { border-color: var(--line-hover); background: var(--surface-2); }
.nav-button.next { border-color: var(--primary-bg); color: var(--primary-fg); background: var(--primary-bg); }
.nav-button.next:hover:not(:disabled) { border-color: var(--primary-hover); background: var(--primary-hover); }
.nav-button:disabled { opacity: .4; cursor: not-allowed; }
.question-navigation.testing .nav-button.next { border-color: var(--line-2); color: var(--ink); background: var(--surface); }
.question-navigation.testing .nav-button.next:hover:not(:disabled) { border-color: var(--line-hover); background: var(--surface-2); }
.finish-test-button { border-color: var(--primary-bg); color: var(--primary-fg); background: var(--primary-bg); }
.finish-test-button:hover:not(:disabled) { color: var(--primary-fg); background: var(--primary-hover) !important; }
.abandon-test-button { min-width: 0; border-color: transparent; color: var(--red); background: transparent; }
.abandon-test-button:hover:not(:disabled) { border-color: var(--red-line); background: var(--red-bg); }

.nav-dots { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; counter-reset: q; }
.question-dot, .exam-number {
  position: relative; display: grid; place-items: center; min-width: 0; height: 40px; padding: 0;
  border: 1px solid var(--line); border-radius: 10px; color: var(--soft); background: var(--surface);
  font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; transition: background-color .15s ease, border-color .15s ease;
}
.question-dot::before { counter-increment: q; content: counter(q); }
.question-dot:hover, .exam-number:hover { border-color: var(--line-hover); color: var(--ink); }
.question-dot.answered { border-color: var(--answered-line); color: var(--answered-fg); background: var(--answered-bg); }
.question-dot.active, .exam-number.current { border-color: var(--primary-bg); color: var(--primary-fg); background: var(--primary-bg); }
.question-dot.selected { box-shadow: 0 0 0 2px var(--primary-bg); }
.exam-number.ok { border-color: var(--green-fill); color: #fff; background: var(--green-fill); }
.exam-number.bad { border-color: var(--red-fill); color: #fff; background: var(--red-fill); }
.exam-number.ok::after, .exam-number.bad::after { position: absolute; top: 2px; right: 5px; font-size: 10px; line-height: 1; content: '✓'; }
.exam-number.bad::after { content: '✕'; }
.exam-number.current { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary-bg); }
.exam-number.ok.current { color: #fff; background: var(--green-fill); }
.exam-number.bad.current { color: #fff; background: var(--red-fill); }

/* Таймер экзамена */
.exam-clock { display: grid; justify-items: end; gap: 1px; padding: 8px 14px; border-radius: 14px; color: #c9d7cd; background: var(--forest); }
.exam-clock small { font-size: 12px; }
.exam-clock strong { color: var(--lime); font-size: 28px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.exam-clock.urgent { background: var(--red-fill); color: #fde6e0; }
.exam-clock.urgent strong { color: #fff; }

/* ---------- Результат ---------- */
.exam-verdict { display: grid; gap: 4px; margin-bottom: 16px; padding: 20px 22px; border-radius: 16px; }
.exam-verdict strong { font-size: clamp(24px, 3vw, 30px); font-weight: 800; letter-spacing: -.5px; }
.exam-verdict strong::before { display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; margin-right: 10px; border-radius: 50%; color: #fff; font-size: .8em; vertical-align: .05em; }
.exam-verdict span { font-size: 16px; }
.exam-verdict.passed { color: var(--green-ink); background: var(--green-bg); }
.exam-verdict.passed strong::before { background: var(--green-fill); content: '✓'; }
.exam-verdict.failed { color: var(--red-ink); background: var(--red-bg); }
.exam-verdict.failed strong::before { background: var(--red-fill); content: '✕'; }
.result-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.result-summary strong { color: var(--ink); font-size: 34px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.result-summary span { color: var(--soft); font-size: 14px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.result-heading { margin: 4px 0 12px; color: var(--ink); font-size: 18px; }
.result-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.result-item { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.result-item h3 { margin: 0 0 10px; color: var(--ink); font-size: 16px; line-height: 1.45; }
.result-item p { margin: 6px 0; padding-left: 22px; font-size: 15px; line-height: 1.5; text-indent: -22px; }
.result-item .result-answer { color: var(--red); }
.result-item .result-answer::before { display: inline-block; width: 22px; text-indent: 0; content: '✕'; }
.result-item .result-correct { color: var(--green); }
.result-item .result-correct::before { display: inline-block; width: 22px; text-indent: 0; content: '✓'; }
.result-item button { min-height: 40px; margin-top: 8px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 10px; color: var(--ink); background: var(--surface); font-size: 14px; font-weight: 700; }
.result-item button:hover { border-color: var(--line-hover); }

/* ---------- Диалоги и уведомления ---------- */
.dialog-backdrop { position: fixed; z-index: 80; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(8, 20, 22, .6); }
.dialog-card { position: relative; width: min(600px, 100%); max-height: min(88vh, 800px); overflow: auto; overscroll-behavior: contain; padding: 28px; border: 1px solid var(--line); border-radius: 20px; color: var(--text); background: var(--surface); box-shadow: 0 24px 70px rgba(10, 25, 27, .3); }
.dialog-card h2 { margin: 0 48px 10px 0; color: var(--ink); font-size: 23px; line-height: 1.25; letter-spacing: -.4px; }
.dialog-card p { margin: 0 0 14px; color: var(--text); font-size: 15px; line-height: 1.6; }
.dialog-card a { color: var(--accent); font-weight: 600; }
.dialog-close { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; color: var(--soft); background: var(--surface); font-size: 24px; }
.dialog-close:hover { color: var(--ink); border-color: var(--line-hover); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.dialog-actions .primary-button { min-height: 50px; padding: 0 22px; font-size: 16px; }
.dialog-user { color: var(--ink) !important; font-weight: 700; }
.dialog-empty { padding: 22px 16px; border: 1px dashed var(--line-2); border-radius: 12px; color: var(--soft); font-size: 15px; text-align: center; }
.history-list { display: grid; gap: 8px; max-height: min(60vh, 540px); overflow: auto; margin-top: 16px; }
.history-entry { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 56px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface); text-align: left; }
.history-entry:hover { border-color: var(--line-hover); background: var(--surface-2); }
.history-entry span { display: grid; gap: 3px; font-size: 15px; }
.history-entry small { color: var(--soft); font-size: 13px; }
.history-entry strong { color: var(--ink); font-size: 16px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.history-entry em { margin-left: 6px; font-size: 13px; font-style: normal; font-weight: 700; }
.history-entry em.pass { color: var(--green); }
.history-entry em.fail { color: var(--red); }
.toast { position: fixed; z-index: 90; right: 20px; bottom: 20px; max-width: min(380px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 12px; color: #fff; background: var(--forest); box-shadow: 0 10px 30px rgba(10, 25, 27, .3); font-size: 15px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: none; }

/* ---------- Правая колонка ---------- */
.insight-column { display: grid; gap: 14px; }
.stats-card, .note-card, .source-card { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.card-overline { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; font-weight: 700; }
.spark-icon { display: none; }
.ready-value { margin: 10px 0 8px; }
.ready-value strong { color: var(--ink); font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.ready-track { height: 10px; }
.ready-track span.low { background: #c7624f; }
.ready-track span.mid { background: #d3a23d; }
.ready-track span.good { background: var(--green-fill); }
.ready-hint { margin: 10px 0 0; color: var(--soft); font-size: 14px; line-height: 1.5; }
.stats-hero { margin: 12px 0 14px; }
.stats-caption { display: block; margin-bottom: 2px; color: var(--soft); font-size: 13px; }
.stats-hero > div:first-child strong { color: var(--ink); font-size: 30px; font-weight: 800; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.stats-total { margin-left: 4px; color: var(--soft); font-size: 13px; }
.stats-divider { height: 1px; margin: 0 0 4px; background: var(--line); }
.stats-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; color: var(--text); font-size: 14px; }
.stats-row strong { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.legend-dot { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; vertical-align: 0; }
.legend-dot.green { background: #5fae80; }
.legend-dot.coral { background: #d47b6a; }
.legend-dot.slate { background: #8fa3a6; }
.note-card { display: flex; gap: 12px; background: var(--tint); }
.note-icon { flex: 0 0 28px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: var(--forest); background: var(--lime); font-weight: 800; }
.note-card h3 { margin: 2px 0 6px; color: var(--ink); font-size: 15px; }
.note-card p { margin: 0; color: var(--text); font-size: 14px; line-height: 1.55; }
.source-label { display: block; margin-bottom: 4px; color: var(--soft); font-size: 13px; font-weight: 600; }
.source-card > strong { color: var(--ink); font-size: 16px; }
.source-card p { margin: 8px 0 4px; color: var(--soft); font-size: 13px; line-height: 1.55; }
.catalog { margin-top: 40px; }

/* ---------- Адаптив ---------- */
@media (max-width: 1360px) {
  .app-header .site-nav { display: none; }
}
@media (max-width: 1240px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 250px; }
}
@media (max-width: 960px) {
  .app-shell { display: block; }
  .menu-button { display: grid !important; }
  .close-sidebar { display: grid !important; }
  .sidebar { position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: min(320px, 88vw); height: 100dvh; padding-top: 16px; transform: translateX(-102%); visibility: hidden; transition: transform .24s ease, visibility 0s linear .24s; box-shadow: 22px 0 50px rgba(8, 20, 22, .3); }
  .sidebar.open { transform: none; visibility: visible; transition: transform .24s ease; }
  .sidebar-backdrop.show { position: fixed; z-index: 65; inset: 0; display: block; background: rgba(8, 20, 22, .5); }
  body.menu-open { overflow: hidden; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .insight-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-button { display: none; }
  .search-wrap { width: 180px; }
  .account-link { width: 44px; padding: 0; justify-content: center; }
  .account-label { display: none; }
}
@media (max-width: 680px) {
  :root { --header-h: 58px; }
  .site-header { gap: 8px; padding: 0 10px; }
  .app-header .brand-name { display: none; }
  .header-tools { gap: 6px; }
  .search-wrap { width: 44px; transition: width .2s ease; }
  .search-box { justify-content: center; padding: 0; }
  .search-box input, .search-box kbd { display: none; }
  .search-wrap.expanded { position: absolute; z-index: 5; top: 7px; right: 10px; left: 10px; width: auto; }
  .search-wrap.expanded .search-box { justify-content: flex-start; padding: 0 12px; background: var(--forest-2); }
  .search-wrap.expanded .search-box input { display: block; }
  .search-results { min-width: 0; }
  .errors-button { min-width: 44px; padding: 0 8px; }
  .errors-button b { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .lang-switch button { min-width: 34px; padding: 0 6px; }
  .main-content { padding: 18px 12px 28px; }
  .app-title { margin-bottom: 10px; font-size: 14px; }
  .ticket-heading { gap: 12px; }
  .ticket-heading h2 { font-size: 24px; }
  .ticket-heading .heading-actions { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px; padding: 2px 12px 6px; scrollbar-width: none; }
  .ticket-heading .heading-actions::-webkit-scrollbar { display: none; }
  .heading-actions > * { flex: 0 0 auto; }
  .ticket-score { min-width: 74px; padding: 6px 10px; }
  .question-progress { margin: 14px 0 12px; }
  .question-card { min-height: 360px; padding: 18px 14px; border-radius: 16px; }
  .question-text { font-size: 19px; }
  .question-image-wrap { margin: 16px -6px 4px; padding: 4px; }
  .answer-option { grid-template-columns: 30px minmax(0, 1fr); gap: 12px; min-height: 58px; padding: 12px 12px 12px 10px; }
  .answer-index { width: 30px; height: 30px; }
  .nav-button { min-width: 0; padding: 0 16px; }
  .question-navigation { gap: 10px; }
  .question-dot, .exam-number { height: 42px; }
  .nav-dots { gap: 5px; }
  .insight-column { grid-template-columns: 1fr; }
  .dialog-card { padding: 22px 16px 18px; border-radius: 18px; }
  .dialog-card h2 { font-size: 20px; }
  .toast { right: 12px; bottom: 12px; left: 12px; max-width: none; }
  /* Экзамен и тест: таймер и статус остаются на виду при прокрутке */
  body[data-view="exam"] .ticket-heading, body[data-view="test"] .ticket-heading { position: sticky; z-index: 20; top: var(--header-h); margin: -18px -12px 0; padding: 10px 12px; background: var(--bg); border-bottom: 1px solid var(--line); }
  body[data-view="exam"] .ticket-heading h2, body[data-view="test"] .ticket-heading h2 { margin-top: 2px; font-size: 17px; letter-spacing: -.2px; }
  body[data-view="exam"] .exam-clock { padding: 6px 12px; }
  body[data-view="exam"] .exam-clock small { display: none; }
  body[data-view="exam"] .exam-clock strong { font-size: 24px; }
}
@media (max-width: 380px) {
  .lang-switch button { min-width: 30px; }
  .question-dot, .exam-number { font-size: 13px; }
}

/* ---------- Упрощённый экран вопроса ---------- */
.question-image { max-height: 300px; }
@media (max-width: 680px) {
  /* Шапка: кнопки 40px, чтобы с темой и языком всё влезало в 360px */
  .site-header { gap: 4px; padding: 0 8px; }
  .header-tools { gap: 4px; }
  .icon-button, .theme-toggle, .search-wrap, .account-link, .errors-button { width: 40px; min-width: 40px; height: 40px; }
  .search-box { height: 40px; }
  .errors-button { min-height: 40px; padding: 0; }
  .account-avatar { width: 28px; height: 28px; flex-basis: 28px; }
  .lang-switch { padding: 2px; }
  .lang-switch button { min-width: 30px; height: 34px; padding: 0 4px; }
  .search-wrap.expanded { width: auto; height: auto; }
  /* Только вопрос, картинка и ответы */
  .app-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .question-meta, .answers-heading { display: none; }
  body[data-view="practice"] .question-progress, body[data-view="practice"] .nav-dots { display: none !important; }
  body[data-view="test"] .test-status { display: none; }
  body[data-view="test"] .insight-column, body[data-view="exam"] .insight-column { display: none; }
  .ticket-heading h2 { font-size: 21px; }
  .heading-line { gap: 4px 8px; }
  .ticket-heading .heading-actions .toolbar-button, .ticket-heading .heading-actions .primary-button { min-height: 40px; padding: 0 14px; font-size: 14px; }
  .question-progress { margin: 10px 0 8px; }
  .question-card { min-height: 0; margin-top: 12px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .test-status { margin: 0 0 12px; padding: 8px 12px; font-size: 14px; }
  .question-text { font-size: 18px; line-height: 1.4; }
  .question-image-wrap { margin: 12px 0 0; padding: 0; border: 0; background: transparent; }
  .question-image { max-height: 210px; border-radius: 10px; }
  .answers-list { gap: 8px; margin-top: 12px; }
  .answer-option { min-height: 52px; padding: 10px 12px 10px 10px; border-radius: 12px; }
  .answer-index { width: 28px; height: 28px; font-size: 14px; }
  .feedback { margin-top: 10px; }
  /* Кнопки перехода — внизу экрана, листать не нужно */
  .question-navigation { margin-top: 14px; }
  .nav-bar { position: fixed; z-index: 30; right: 0; bottom: 0; left: 0; gap: 8px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); box-shadow: 0 -6px 20px rgba(10, 25, 27, .07); }
  .nav-bar .nav-button { height: 50px; }
  .nav-bar .previous { flex: 0 0 52px; min-width: 52px; padding: 0; }
  .nav-bar .previous .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav-bar .next { flex: 1; margin-left: 0; }
  .nav-bar .finish-test-button { order: 3; margin-left: 0; padding: 0 16px; }
  .main-content { padding-bottom: 92px; }
  .toast { bottom: 82px; }
  body[data-view="exam"] .ticket-heading h2, body[data-view="test"] .ticket-heading h2 { display: none; }
  body[data-view="exam"] .ticket-heading, body[data-view="test"] .ticket-heading { align-items: center; padding: 8px 12px; }
}
@media (max-width: 374px) {
  .app-header .brand { display: none; }
}
@media (max-width: 680px) {
  /* Шапка билета в одну строку: «Білет 15  Питання 1 з 20  0/20» */
  .ticket-heading { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; }
  .ticket-heading > div:first-child { display: flex; flex-direction: row-reverse; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 2px 10px; }
  .ticket-heading h2 { margin: 0; }
  .ticket-score { display: flex; align-items: baseline; gap: 3px; min-width: 0; padding: 6px 10px; border-radius: 10px; }
  .ticket-score strong { font-size: 18px; }
  .ticket-score small { display: none; }
  .feedback { scroll-margin-bottom: 84px; }
}
@media (max-width: 680px) {
  .note-card { display: none; }
}

/* ---------- Билеты без прокрутки, «‹ ›», сброс прогресса ---------- */
.ticket-step { display: flex; gap: 6px; }
.step-button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line-2); border-radius: 12px; color: var(--ink); background: var(--surface); font-size: 24px; line-height: 1; }
.step-button:hover:not(:disabled) { border-color: var(--line-hover); background: var(--surface-2); }
.step-button:disabled { opacity: .35; cursor: not-allowed; }
body:not([data-view="practice"]) .ticket-step { display: none; }
.side-reset { align-self: flex-start; min-height: 36px; margin-top: 10px; padding: 0 12px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 10px; color: #f5c4b8; background: transparent; font-size: 13px; font-weight: 700; }
.side-reset:hover { color: #fff; border-color: rgba(245, 196, 184, .6); background: rgba(240, 143, 122, .14); }
/* Все 89 билетов сразу: 9 колонок × 10 рядов, высота клетки подстраивается под экран */
.app-shell { grid-template-columns: 300px minmax(0, 1fr); }
.sidebar { gap: 12px; padding: 16px 16px 14px; }
.side-exam { padding: 11px 14px; }
.sidebar-section-heading { margin: 2px 2px -4px; }
.ticket-grid { grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; }
.ticket-button { height: clamp(26px, 3.7vh, 34px); border-radius: 8px; font-size: 13px; }
.ticket-button.complete:not(.active)::after { top: 3px; right: 3px; width: 5px; height: 5px; }
.sidebar-links { grid-template-columns: 1fr 1fr; gap: 0 4px; }
.sidebar-links a { min-height: 34px; font-size: 13px; }
.sidebar-footer { padding-top: 12px; }
@media (min-width: 961px) and (max-height: 760px) {
  .sidebar-top, .sidebar-footer p { display: none; }
  .ticket-button { height: 24px; font-size: 12px; }
}
@media (max-width: 960px) {
  .ticket-button { height: 36px; }
}
@media (max-width: 680px) {
  .ticket-step { display: none; }
}
@media (min-width: 961px) and (max-height: 760px) {
  .sidebar { gap: 8px; padding-top: 12px; padding-bottom: 10px; }
  .side-exam small { display: none; }
}
/* «Пройти білет заново» — рядом со счётом билета, только в тренировке */
.restart-ticket { gap: 6px; padding: 0 14px; }
.restart-ticket span[aria-hidden] { font-size: 18px; line-height: 1; }
body:not([data-view="practice"]) .restart-ticket { display: none; }
@media (max-width: 680px) {
  .restart-ticket { width: 40px; min-width: 40px; min-height: 36px; height: 36px; padding: 0; }
  .restart-ticket .restart-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---------- Переход к следующему вопросу без прокрутки ---------- */
.feedback-head { flex-wrap: wrap; row-gap: 6px; padding: 6px 8px 6px 14px; }
.feedback-more { min-height: 40px; padding: 0 8px; border: 0; color: inherit; background: transparent; font: inherit; font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.feedback-more::after { display: inline-block; margin-left: 6px; content: '▾'; transition: transform .15s ease; }
.feedback-more[aria-expanded="true"]::after { transform: rotate(180deg); }
.feedback-next { min-height: 44px; margin-left: auto; padding: 0 18px; }
.feedback .explanation { padding: 12px 14px 14px; }
.answers-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }
.kbd-hint { color: var(--soft); font-size: 13px; font-weight: 400; }
@media (hover: none), (max-width: 960px) { .kbd-hint { display: none; } }

/* Навигация прилипает к низу экрана на компьютере: номера вопросов слева, кнопки справа */
@media (min-width: 681px) {
  .question-navigation {
    position: sticky; z-index: 15; bottom: 0;
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px;
    margin: 12px -12px 0; padding: 12px 12px 14px;
    border-top: 1px solid var(--line); background: var(--bg);
  }
  .question-navigation .nav-dots { gap: 4px; }
  .question-navigation .question-dot, .question-navigation .exam-number { height: 34px; font-size: 14px; }
  .question-navigation .nav-button { height: 46px; }
  .nav-bar .previous { min-width: 0; }
  .abandon-test-button { height: 36px !important; justify-self: end; }
}
@media (min-width: 1200px) {
  /* широкий экран: номера и кнопки в одной полосе (в тесте и экзамене — от 1500px, там три кнопки) */
  body[data-view="practice"] .question-navigation, body:not([data-view="practice"]) .question-navigation:has(> .nav-dots[hidden]) { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "dots bar" "dots abandon"; align-items: center; column-gap: 16px; row-gap: 4px; }
  .question-navigation .nav-dots { grid-area: dots; }
  .question-navigation .nav-bar { grid-area: bar; }
  .question-navigation .abandon-test-button { grid-area: abandon; }
  .question-navigation:has(> .nav-dots[hidden]) { grid-template-columns: minmax(0, 1fr); grid-template-areas: "bar" "abandon"; }
  .nav-bar .previous .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav-bar .previous { width: 46px; padding: 0; }
}
@media (max-width: 680px) {
  .feedback-next { display: none; }
}
@media (min-width: 681px) {
  .feedback { scroll-margin-bottom: 130px; }
}
@media (min-width: 1500px) {
  body:not([data-view="practice"]) .question-navigation { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "dots bar" "dots abandon"; align-items: center; column-gap: 16px; row-gap: 4px; }
}
@media (max-width: 680px) {
  .answers-heading { display: none; }
}
@media (min-width: 1200px) and (max-width: 1499px) {
  body:not([data-view="practice"]) .question-navigation > * { grid-area: auto; }
}
@media (min-width: 681px) and (max-width: 1499px) {
  body:not([data-view="practice"]) .question-navigation { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "abandon bar" "dots dots"; align-items: center; }
  body:not([data-view="practice"]) .question-navigation > .nav-bar { grid-area: bar; }
  body:not([data-view="practice"]) .question-navigation > .nav-dots { grid-area: dots; }
  body:not([data-view="practice"]) .question-navigation > .abandon-test-button { grid-area: abandon; justify-self: start; }
}

/* ---------- Одна кнопка «Далі»: подсветка после ответа, номера по результату ---------- */
.nav-button.next.nudge { animation: nudge 1.4s ease-out 1; }
@keyframes nudge {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary-bg) 55%, transparent); }
  100% { box-shadow: 0 0 0 12px transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .nav-button.next.nudge { animation: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-bg) 45%, transparent); }
}
.question-dot.ok { border-color: var(--green-fill); color: #fff; background: var(--green-fill); }
.question-dot.bad { border-color: var(--red-fill); color: #fff; background: var(--red-fill); }
.question-dot.ok::after, .question-dot.bad::after { position: absolute; top: 2px; right: 4px; font-size: 9px; line-height: 1; content: '✓'; }
.question-dot.bad::after { content: '✕'; }
.question-dot.ok:hover, .question-dot.bad:hover { color: #fff; filter: brightness(1.08); }
.question-dot.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary-bg); }
.question-dot.active.ok { color: #fff; background: var(--green-fill); border-color: var(--green-fill); }
.question-dot.active.bad { color: #fff; background: var(--red-fill); border-color: var(--red-fill); }

/* ---------- Вопрос и все ответы на одном экране (компьютер) ---------- */
.modes-menu { position: relative; }
.modes-menu > summary { list-style: none; cursor: pointer; }
.modes-menu > summary::-webkit-details-marker { display: none; }
.modes-menu > summary::after { margin-left: 4px; content: '▾'; }
.modes-pop { position: absolute; z-index: 25; top: calc(100% + 6px); left: 0; display: grid; gap: 6px; min-width: 220px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 16px 40px rgba(10, 25, 27, .18); }
.modes-pop .toolbar-button { justify-content: flex-start; width: 100%; }
body:not([data-view="practice"]) .modes-menu { display: none; }
.study-column { container-type: inline-size; container-name: study; }

@media (min-width: 681px) {
  .main-content { padding-top: 14px; }
  .app-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* Шапка билета — одна строка: «Білет 1 · Питання 9 з 20» … режимы … ‹ › ↺ счёт */
  .ticket-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
  .ticket-heading > div:first-child { display: flex; flex: 1 1 auto; flex-direction: row-reverse; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 2px 12px; min-width: 0; }
  .ticket-heading h2 { margin: 0; font-size: 26px; }
  .ticket-heading .heading-actions { order: 2; grid-column: auto; flex-wrap: nowrap; }
  .ticket-heading .heading-side { order: 3; }
  .ticket-heading .heading-actions .primary-button, .ticket-heading .heading-actions .toolbar-button, .restart-ticket { min-height: 40px; padding: 0 14px; font-size: 14px; }
  .step-button { width: 40px; height: 40px; font-size: 22px; }
  .ticket-score { display: flex; align-items: baseline; gap: 3px; min-width: 0; padding: 6px 12px; }
  .ticket-score strong { font-size: 20px; }
  .ticket-score small { display: none; }
  .exam-clock { grid-auto-flow: column; align-items: baseline; gap: 8px; padding: 6px 14px; }
  .exam-clock strong { font-size: 24px; }
  /* Прогресс-полоса дублирует номера 1–20 в нижней панели */
  .question-progress { display: none !important; }
  .question-card { min-height: 0; margin-top: 12px; padding: 18px 22px; }
  .test-status { margin: 0 0 10px; padding: 6px 12px; }
  .question-meta { margin-bottom: 8px; }
  .topic-chip { min-height: 26px; font-size: 12px; }
  .question-text { font-size: clamp(18px, 1.6vw, 21px); }
  .question-image-wrap { margin: 12px 0 0; padding: 6px; }
  .question-image { max-height: min(340px, 32vh); }
  .answers-heading { margin: 12px 0 8px; font-size: 13px; }
  .answers-list { gap: 6px; }
  .answer-option { min-height: 48px; padding: 6px 12px 6px 8px; gap: 10px; border-radius: 12px; }
  .answer-index { width: 28px; height: 28px; font-size: 14px; }
  .answer-copy { font-size: 15px; line-height: 1.4; }
  .answer-image { max-height: 120px; }
  .feedback { margin-top: 10px; }
  .feedback-head { min-height: 44px; }
  /* Нижняя панель ниже */
  .question-navigation { padding: 8px 12px 10px; }
  .question-navigation .question-dot, .question-navigation .exam-number { height: 32px; }
  .question-navigation .nav-button { height: 42px; }
}
/* Правая колонка со статистикой уходит под вопрос, пока ей не хватает места */
@media (min-width: 961px) and (max-width: 1499px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .insight-column { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}
/* Широкая колонка вопроса: картинка слева, варианты справа */
@container study (min-width: 760px) {
  .question-card:has(> .question-image-wrap) {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); column-gap: 20px;
    grid-template-areas: "status status" "meta meta" "q q" "img head" "img list" "fb fb";
    align-items: start;
  }
  .question-card:has(> .question-image-wrap) > .test-status { grid-area: status; }
  .question-card:has(> .question-image-wrap) > .question-meta { grid-area: meta; }
  .question-card:has(> .question-image-wrap) > .question-text { grid-area: q; }
  .question-card:has(> .question-image-wrap) > .question-image-wrap { grid-area: img; margin-top: 12px; }
  .question-card:has(> .question-image-wrap) > .answers-heading { grid-area: head; }
  .question-card:has(> .question-image-wrap) > .answers-list { grid-area: list; }
  .question-card:has(> .question-image-wrap) > .feedback { grid-area: fb; }
  .question-card:has(> .question-image-wrap) .question-image { max-height: min(360px, 38vh); }
  .question-card:has(> .question-image-wrap) .kbd-hint { display: none; }
}
/* Номера 1–20 в один ряд, когда хватает ширины */
@container study (min-width: 820px) {
  .question-navigation .nav-dots { grid-template-columns: repeat(20, minmax(0, 1fr)); }
}

/* ---------- Разбор ошибок на экране результата ---------- */
.review-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 4px 0 12px; }
.review-head .result-heading { margin: 0; }
.review-head .toolbar-button { min-height: 40px; font-size: 14px; }
.result-list > li { list-style: none; }
.review-item { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.review-item[open] { border-color: var(--line-2); }
.review-item > summary { display: flex; align-items: flex-start; gap: 12px; min-height: 56px; padding: 12px 14px; list-style: none; cursor: pointer; }
.review-item > summary::-webkit-details-marker { display: none; }
.review-item > summary::after { margin-left: auto; padding-left: 8px; color: var(--soft); content: '▾'; transition: transform .15s ease; }
.review-item[open] > summary::after { transform: rotate(180deg); }
.review-mark { flex: 0 0 24px; display: grid; place-items: center; width: 24px; height: 24px; margin-top: 1px; border-radius: 50%; color: #fff; background: var(--red-fill); font-size: 12px; font-weight: 800; }
.review-title { display: grid; gap: 3px; min-width: 0; }
.review-title b { color: var(--ink); font-size: 16px; line-height: 1.4; }
.review-title small { color: var(--red); font-size: 14px; }
.review-body { display: grid; gap: 10px; padding: 0 14px 14px; }
.review-body .question-image-wrap { margin: 0; }
.review-option { cursor: default; }
.review-option:hover { border-color: var(--line); background: var(--surface); }
.review-option.is-correct:hover { border-color: var(--green-line); background: var(--green-bg); }
.review-option.is-wrong:hover { border-color: var(--red-line); background: var(--red-bg); }
.review-body .explanation { margin: 0; }
.review-open { justify-self: start; min-height: 40px; font-size: 14px; }
.return-bar { margin: 0 0 10px; }
.return-bar .toolbar-button { min-height: 40px; font-size: 14px; }

/* Оригинал вопроса на украинском в русской версии */
.q-original { margin: 10px 0 0; font-size: 0.9rem; color: var(--muted, var(--ink)); opacity: .85; }
.q-original summary { cursor: pointer; width: fit-content; }
.q-original p { margin: 8px 0 4px; font-weight: 600; }
.q-original ol { margin: 0; padding-left: 1.4em; }
