/* ============================================================
   Курс истории · стили по макету v8
   Системные шрифты: system-ui — интерфейс, Georgia — текст урока,
   ui-monospace — JSON и служебные подписи (ТЗ §2.6).
   Темы: html[data-theme="light|dark"], значение хранится в cookie.
   Брейкпоинты (ТЗ §17): до 640 — мобильный, 640–1024 — планшет, от 1024 — десктоп.
   v9: инлайн-стили шаблонов вынесены в классы (компонентные + утилиты в конце
   файла); инлайновыми остались только динамические значения (ширины прогрессов).
   ============================================================ */

:root {
  --bg-base: #F7F5F0; --bg-card: #FFFFFF; --bg-inset: #EEEAE0;
  --text: #1A1A1A; --text-muted: #6E6659; --text-faint: #6E6759;
  --accent: #7B2E2E; --accent-hover: #62201F; --accent-soft: #F0E4E4; --on-accent: #FFFFFF;
  --success: #1B5E20; --success-soft: #E6F0E6;
  --warning: #8F5B00; --warning-soft: #FBF0DE;
  --info: #1E4C7A; --info-soft: #E3ECF4;
  --danger: #B3261E; --danger-soft: #FBE7E5;
  --border: #E4DECF; --shadow: 0 1px 2px rgba(26,20,15,0.04), 0 8px 24px -12px rgba(26,20,15,0.12);
}
html[data-theme="dark"] {
  --bg-base: #17151F; --bg-card: #211E2A; --bg-inset: #100E17;
  --text: #F5F1E8; --text-muted: #B8B0A0; --text-faint: #948DA6;
  --accent: #C97070; --accent-hover: #DB8686; --accent-soft: #2E2028; --on-accent: #251112;
  --success: #4CAF50; --success-soft: #1E3320;
  --warning: #E5A741; --warning-soft: #3A2E15;
  --info: #6FA0D6; --info-soft: #1C2C3D;
  --danger: #E5766D; --danger-soft: #3A1F1D;
  --border: #3A3444; --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px -12px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
body {
  margin: 0; background: var(--bg-base); color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column;
}
main { flex: 1 0 auto; width: 100%; }
h1, h2, h3, h4 { font-family: inherit; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; }
button { font-family: inherit; }
img { max-width: 100%; }
::selection { background: var(--accent-soft); color: var(--accent); }

/* якорные секции не должны прилипать к верхней кромке (аудит UX §10) */
[id] { scroll-margin-top: 24px; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace; font-size: 15px; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- контейнеры ---------- */
.container { width: 100%; margin: 0 auto; padding: 24px 20px 48px; }
.container--sm { max-width: 560px; }
.container--md { max-width: 720px; }
.container--lg  { max-width: 800px; }
.container--xl { max-width: 1040px; }
.container--admin { max-width: 1160px; }

.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow); overflow: hidden;
}
.card--pad { padding: 26px; }
.card--flat { box-shadow: none; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  font-size: 18px; font-weight: 600; cursor: pointer; white-space: nowrap;
  text-decoration: none; transition: background .15s, border-color .15s, opacity .15s;
}
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn--secondary:hover { background: var(--bg-inset); }
.btn--ghost { background: transparent; color: var(--accent); }
.btn--danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn--sm { height: 34px; padding: 0 14px; font-size: 16px; border-radius: 8px; }
.btn--block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; cursor: default; pointer-events: none; }

/* ---------- формы ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 16px; font-weight: 600; color: var(--text-muted); }
.field input, .field select, .field textarea {
  border-radius: 10px; border: 1px solid var(--border); background: var(--bg-inset);
  padding: 0 14px; font-size: 18px; color: var(--text); font-family: inherit; width: 100%;
}
.field input, .field select { height: 44px; }
.field textarea {
  padding: 12px 14px; line-height: 1.6; resize: vertical;
  font-family: inherit; font-size: 17px;
}
/* моноширинный — только для JSON-редактора админки (аудит UX §11) */
.field textarea[data-json-area] {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace; font-size: 16px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; background: var(--bg-card);
}
.field__hint { font-size: 15px; color: var(--text-faint); }
.field__row-link { display: flex; justify-content: space-between; align-items: center; }
.field__row-link a { font-size: 16px; color: var(--accent); font-weight: 600; text-decoration: none; }
.field--w110 { width: 110px; }
.field--w120 { width: 120px; }
.field--w160 { width: 160px; }
.field--w260 { width: 260px; }
.field--w280 { width: 280px; }

/* показать/скрыть пароль (аудит 4.8) — кнопку добавляет app.js */
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 46px; }
.pass-eye { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: none; background: none; border-radius: 8px; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.pass-eye:hover { color: var(--text); }
.pass-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pass-eye svg { width: 18px; height: 18px; }

.check { display: flex; align-items: flex-start; gap: 9px; font-size: 16px; color: var(--text-muted); line-height: 1.5; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }
.check a { color: var(--accent); font-weight: 600; }

.alert { border-radius: 10px; padding: 12px 14px; font-size: 16px; line-height: 1.5; margin-bottom: 16px; }
.alert--danger { background: var(--danger-soft); color: var(--danger); }
.alert--success { background: var(--success-soft); color: var(--success); }
.alert--info { background: var(--info-soft); color: var(--info); }
.alert--warning { background: var(--warning-soft); color: var(--warning); }
.alert ul { margin: 0; padding-left: 18px; }
.alert a { color: inherit; font-weight: 700; }

/* поисковые контролы админки (вынос инлайн-стилей, аудит UX) */
.search-input {
  height: 38px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-inset);
  padding: 0 14px; font-size: 16px; color: var(--text); font-family: inherit;
}
.search-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: var(--bg-card); }
.search-input--w280 { width: 280px; max-width: 100%; }
.search-select {
  height: 38px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-inset);
  padding: 0 10px; font-size: 16px; color: var(--text); font-family: inherit;
}
.btn--h38 { height: 38px; }

/* ---------- бейджи, аватар ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 15px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--muted { background: var(--bg-inset); color: var(--text-muted); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; flex-shrink: 0;
}
.avatar--sm { width: 30px; height: 30px; font-size: 15px; }
.avatar-link { text-decoration: none; }

/* круглая иконка статусных экранов (вынос инлайн-стилей) */
.icon-circle { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.icon-circle--success { background: var(--success-soft); color: var(--success); }
.icon-circle--danger { background: var(--danger-soft); color: var(--danger); }
.icon-circle--warning { background: var(--warning-soft); color: var(--warning); }
.icon-circle--info { background: var(--info-soft); color: var(--info); }
.icon-circle--neutral { background: var(--bg-inset); color: var(--text-muted); }

/* ---------- вкладки настроек ---------- */
.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 20px;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
/* тени-подсказки горизонтального скролла (аудит 2.1) — общие для всех
   горизонтально прокручиваемых зон: вкладок, таблиц и меню шапок */
.tabs, .admin-table-wrap, .topbar--admin .nav, .topbar--landing .nav {
  background:
    linear-gradient(90deg, var(--bg-card) 40%, rgba(255,255,255,0)) left / 32px 100%,
    linear-gradient(270deg, var(--bg-card) 40%, rgba(255,255,255,0)) right / 32px 100%,
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.22), transparent) left / 12px 100%,
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.22), transparent) right / 12px 100%;
  background-repeat: no-repeat;
  background-attachment: local, local, scroll, scroll;
}
.tab {
  padding: 12px 4px; margin-right: 22px; font-size: 18px; font-weight: 600; color: var(--text-muted);
  border-bottom: 2px solid transparent; cursor: pointer; background: none; border-top: none;
  border-left: none; border-right: none; white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center; gap: 5px; min-height: 44px;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.divider { height: 1px; background: var(--border); border: none; margin: 0; }
.divider--sp { margin: 22px 0; }

/* ---------- шапка ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; border-bottom: 1px solid var(--border); background: var(--bg-card);
  gap: 12px;
}
.topbar__left { display: flex; align-items: center; gap: 28px; min-width: 0; }
.topbar__right { display: flex; align-items: center; gap: 14px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; color: inherit; text-decoration: none; white-space: nowrap; }
.logo__mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; flex-shrink: 0;
}
.logo__mark--admin { background: var(--text); color: var(--bg-base); }
.nav { display: flex; gap: 20px; }
.nav a { font-size: 18px; font-weight: 600; color: var(--text-muted); text-decoration: none; padding: 10px 0; }
.nav a.active { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.topbar--admin .nav { overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.topbar--admin .nav::-webkit-scrollbar { display: none; }
.nav__count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px;
  padding: 0 5px; margin-left: 6px; border-radius: 999px; background: var(--accent);
  color: var(--on-accent); font-size: 13px; font-weight: 700; line-height: 1;
}
.topbar__link { font-size: 16px; font-weight: 600; color: var(--text-muted); text-decoration: none; padding: 10px 2px; }
.topbar__login { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; font-size: 16px; font-weight: 600; color: var(--text-muted); text-decoration: none; }

/* ---------- переключатель темы ---------- */
.theme-toggle {
  display: inline-flex; align-items: center; background: var(--bg-inset); border-radius: 999px;
  padding: 3px; gap: 2px; border: 1px solid var(--border);
}
.theme-toggle button {
  width: 30px; height: 30px; border-radius: 50%; border: none; background: transparent;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-faint);
  padding: 0; position: relative;
}
/* увеличенная зона нажатия — кнопки меньше 44px (аудит UX §1) */
.theme-toggle button::after { content: ''; position: absolute; inset: -8px -2px; }
.theme-toggle button.active { background: var(--bg-card); color: var(--accent); box-shadow: var(--shadow); cursor: default; }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle--sm { padding: 2px; }
.theme-toggle--sm button { width: 26px; height: 26px; }
.theme-toggle--sm svg { width: 14px; height: 14px; }

/* ---------- подвал ---------- */
footer.site-footer {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px; flex-wrap: wrap; gap: 12px; border-top: 1px solid var(--border);
  background: var(--bg-card);
}
footer.site-footer .links { display: flex; gap: 18px; flex-wrap: wrap; }
footer.site-footer .links a { font-size: 16px; color: var(--text-muted); text-decoration: none; }
footer.site-footer .copy { font-size: 15px; color: var(--text-faint); }
footer.site-footer .right { display: flex; align-items: center; gap: 16px; }

/* ---------- таблицы админки ---------- */
table.admin-table { width: 100%; border-collapse: collapse; font-size: 16px; }
table.admin-table th {
  text-align: left; padding: 10px 16px; color: var(--text-muted); font-weight: 600; font-size: 15px;
  text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.admin-table tr:last-child td { border-bottom: none; }
.admin-table-wrap { overflow-x: auto; }   /* мобильный — горизонтальный скролл (ТЗ §17) */
.table-pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-size: 15px; color: var(--text-faint); gap: 10px; flex-wrap: wrap; }
.table-pagination a { color: var(--accent); text-decoration: none; font-weight: 600; padding: 10px; display: inline-block; }
.table-pagination .pg-current { font-weight: 700; color: var(--text); padding: 10px; display: inline-block; }

/* шапки и секции карточек админки (вынос инлайн-стилей) */
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 18px; margin: 0; }
.card-head .sub { font-weight: 400; color: var(--text-faint); font-size: 15px; }
.card-pad-top { padding: 16px 20px 0; }
.entity-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.entity-head h1 { font-weight: 700; font-size: 19px; overflow-wrap: anywhere; margin: 0; }
.entity-sect { padding: 18px 22px; border-bottom: 1px solid var(--border); }
.entity-sect--last { border-bottom: none; }
.block-label .sub { font-weight: 400; color: var(--text-faint); text-transform: none; }
.msg-box {
  margin-top: 8px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-inset); font-size: 17px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
}
.diag-h { font-size: 16px; margin: 18px 0 8px; }

/* ---------- вопросы теста ---------- */
.q-option {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 18px; cursor: pointer; min-height: 44px; position: relative;
}
.q-option:hover { background: var(--bg-inset); }
.q-option input { position: absolute; opacity: 0; pointer-events: none; }
.q-option .mark { width: 18px; height: 18px; border: 2px solid var(--text-faint); flex-shrink: 0; }
.q-option.radio .mark { border-radius: 50%; }
.q-option.checkbox .mark { border-radius: 5px; }
.q-option.selected, .q-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.q-option.selected .mark, .q-option:has(input:checked) .mark { border-color: var(--accent); background: var(--accent); }
.q-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.q-image { max-width: 100%; height: auto; border-radius: 10px; display: block; margin-bottom: 14px; margin-top: 14px; }

.quiz-head { font-weight: 700; font-size: 19px; margin: 0; }
.quiz-note { font-size: 15px; color: var(--text-faint); margin-top: 3px; }
.quiz-meta { font-size: 15px; color: var(--text-muted); margin-top: 8px; }
.quiz-question { font-size: 20px; font-weight: 600; margin-top: 14px; line-height: 1.4; }
.quiz-options { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.quiz-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; }
.quiz-actions--wrap { flex-wrap: wrap; }
.quiz-lead { font-size: 16px; color: var(--text-muted); margin-top: 14px; line-height: 1.5; }
.quiz-hint { font-size: 14px; color: var(--text-faint); text-align: center; margin-top: 8px; }

.quiz-cancel { display: flex; justify-content: center; margin-top: 14px; }
.quiz-cancel button {
  background: none; border: none; color: var(--text-faint); font-size: 15px; cursor: pointer;
  padding: 10px 8px; text-decoration: underline; text-underline-offset: 2px;
}
.quiz-cancel button:hover { color: var(--danger); }

.progressbar { height: 5px; border-radius: 99px; background: var(--bg-inset); overflow: hidden; }
.progressbar > span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }

/* сегментный прогресс вопросов: отвеченные сегменты кликабельны (аудит UX §3) */
.q-progress { display: flex; gap: 3px; }
.q-progress span, .q-progress a { flex: 1; height: 5px; border-radius: 3px; background: var(--bg-inset); }
.q-progress a { position: relative; display: block; }
.q-progress a::after { content: ''; position: absolute; inset: -13px -1px; } /* зона нажатия */
.q-progress a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.q-progress .done { background: var(--accent); }
.q-progress a.done:hover { background: var(--accent-hover); }
.q-progress .cur { outline: 2px solid var(--accent); outline-offset: 1px; background: var(--accent); }

/* ---------- результат теста и разбор ответов ---------- */
.result-head { display: flex; align-items: center; gap: 16px; }
.result-circle {
  width: 64px; height: 64px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 23px; font-weight: 800; flex-shrink: 0;
}
.result-head__title { font-weight: 700; font-size: 20px; margin: 0; }
.result-head__meta { font-size: 16px; color: var(--text-muted); margin-top: 2px; }
.result-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.review-list { display: flex; flex-direction: column; gap: 8px; }
.review-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.review-item__q { display: flex; align-items: flex-start; gap: 8px; font-size: 16px; }
.review-item__q svg { flex-shrink: 0; margin-top: 2px; }
.review-item__a { font-size: 15px; color: var(--text-muted); margin-top: 6px; margin-left: 23px; }

/* ---------- модалка ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,16,12,.45); display: none;
  align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal-backdrop.open { display: flex; }
body.modal-open { overflow: hidden; }
.modal-card { background: var(--bg-card); border-radius: 14px; box-shadow: var(--shadow); border: 1px solid var(--border); padding: 22px; width: 300px; max-width: 100%; }
.modal-card h3 { font-size: 19px; margin-bottom: 6px; }
.modal-card p { font-size: 16px; color: var(--text-muted); line-height: 1.5; margin-bottom: 16px; }
.modal-card .row { display: flex; gap: 8px; flex-wrap: wrap; /* кнопки не помещаются в ряд — переносятся, а не вылезают за модалку */ }
.modal-form { flex: 1 1 auto; display: flex; min-width: 0; }

/* ---------- сессии ---------- */
.device-combo { display: flex; align-items: center; gap: 6px; font-size: 16px; flex-wrap: wrap; }
.device-combo .sep { color: var(--text-faint); }
.device-combo .badge { margin-left: 6px; }

/* ---------- переключатель класса ---------- */
.grade-switch {
  height: 32px; padding: 0 30px 0 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-inset); font-size: 16px; font-weight: 700; color: var(--text); cursor: pointer;
  font-family: inherit; appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E6659' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 14px;
}
.grade-switch:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
html[data-theme="dark"] .grade-switch {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B8B0A0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

.grade-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grade-cell {
  text-align: center; padding: 12px 0; border-radius: 9px; border: 1px solid var(--border);
  font-size: 18px; cursor: pointer; background: none; color: inherit; font-family: inherit; min-height: 44px;
  text-decoration: none; display: flex; align-items: center; justify-content: center; width: 100%;
}
.grade-cell.current { border: 2px solid var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.grade-cell.picked { outline: 2px solid var(--accent); outline-offset: 1px; font-weight: 700; }
.grade-cell.selectable:hover { background: var(--bg-inset); }
.grade-cell.locked { color: var(--text-faint); background: var(--bg-inset); cursor: not-allowed; text-decoration: line-through; opacity: .6; }

/* ---------- краткие факты урока ---------- */
.fact-box {
  display: flex; flex-direction: column; gap: 5px; background: var(--bg-inset); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; font-size: 16px; color: var(--text-muted); line-height: 1.6;
}
.fact-box b { color: var(--text); }
.fact-box--inline { flex-direction: row; flex-wrap: wrap; gap: 6px 18px; }

/* ---------- слайдер презентации (эталон pptx-slider → pres-slider, ТЗ §5) ---------- */
.pres-slider { width: 100%; -webkit-user-select: none; user-select: none; }
.pres-slider__frame {
  position: relative; width: 100%; aspect-ratio: 16/9; overflow: hidden; border-radius: 12px;
  background: #18181b; touch-action: pan-y; cursor: grab;
}
.pres-slider__frame:active { cursor: grabbing; }
.pres-slider__frame:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pres-slider__track { display: flex; height: 100%; will-change: transform; }
.pres-slider__track.animate { transition: transform .35s cubic-bezier(.22,.61,.36,1); }
.pres-slider__slide { flex: 0 0 100%; height: 100%; }
.pres-slider__slide img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  -webkit-user-drag: none; pointer-events: none;
}
.pres-slider__controls { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.pres-slider__btn {
  width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--bg-inset); color: var(--text);
  cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0;
}
.pres-slider__btn:disabled { opacity: .3; cursor: default; }
.pres-slider__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pres-slider__btn svg { width: 17px; height: 17px; }
.pres-slider__dots { display: flex; align-items: center; gap: 6px; max-width: 220px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px; }
.pres-slider__dots::-webkit-scrollbar { display: none; }
.pres-slider__dot {
  width: 8px; height: 8px; border-radius: 99px; background: var(--border); border: none; cursor: pointer;
  padding: 0; flex-shrink: 0; transition: width .2s, background .2s; position: relative;
}
.pres-slider__dot::after { content: ''; position: absolute; inset: -12px -3px; } /* увеличенная зона нажатия (аудит 2.2) */
.pres-slider__dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pres-slider__dot.active { width: 22px; background: var(--accent); }
.pres-slider__counter { text-align: center; margin-top: 8px; font-size: 15px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.copy-protect { -webkit-user-select: none; user-select: none; }
@media (prefers-reduced-motion: reduce) {
  .pres-slider__track.animate { transition: none; }
  .pres-slider__dot { transition: none; }
}

/* ---------- видео урока ---------- */
video.lesson-video::-internal-media-controls-download-button { display: none; }
video.lesson-video { width: 100%; border-radius: 12px; background: #18181b; aspect-ratio: 16/9; display: block; }
.video-note { font-size: 14px; color: var(--text-faint); margin-top: 6px; display: flex; align-items: center; gap: 5px; }

/* ---------- текст урока ---------- */
.lesson-text {
  font-family: Georgia, 'Noto Serif', 'Times New Roman', serif;
  font-size: 19px; line-height: 1.75; margin-top: 16px; color: var(--text);
}
.lesson-text p { margin: 0 0 1em; }
.lesson-text p:last-child { margin-bottom: 0; }

.lesson-title { font-size: 24px; margin-top: 16px; }

/* карточка «раздел проверяется тестом» */
.section-test {
  margin-top: 24px; display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); flex-wrap: wrap;
}
.section-test__txt { flex: 1; min-width: 160px; font-size: 16px; color: var(--text-muted); }

/* переходы между уроками (аудит 4.1) */
.lesson-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.lesson-nav__pos { font-size: 15px; color: var(--text-muted); text-align: center; flex: 1; }

/* ---------- список уроков ---------- */
.block-label { font-size: 15px; font-weight: 700; color: var(--text-muted); letter-spacing: .05em; text-transform: uppercase; }
.lesson-list { border: 1px solid var(--border); border-radius: 12px; margin-top: 10px; overflow: hidden; background: var(--bg-card); }
.lesson-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; min-height: 44px;
}
.lesson-row:last-child { border-bottom: none; }
.lesson-row:hover { background: var(--bg-inset); }
.lesson-row__title { flex: 1; font-size: 18px; }
.lesson-row svg { flex-shrink: 0; }
.test-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; background: var(--bg-inset); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.test-row:last-child { border-bottom: none; }
.test-row__body { flex: 1; min-width: 160px; }
.test-row__title { font-size: 18px; font-weight: 600; }
.test-row__meta { font-size: 15px; color: var(--text-muted); margin-top: 2px; }
.course-test {
  margin-top: 22px; display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border: 2px solid var(--accent); border-radius: 12px; background: var(--accent-soft); flex-wrap: wrap;
}
.course-test .test-row__title, .course-test .test-row__meta { color: var(--accent); }

/* ---------- личный кабинет ---------- */
.account-title { font-size: 28px; }
.account-sub { font-size: 18px; color: var(--text-muted); margin-top: 4px; }
.account-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.account-grid { display: flex; gap: 20px; margin-top: 20px; }
.panel { border: 1px solid var(--border); border-radius: 14px; padding: 20px; background: var(--bg-card); }
.panel__label { font-size: 14px; font-weight: 700; color: var(--text-muted); letter-spacing: .04em; text-transform: uppercase; }
.continue-panel { flex: 2; display: flex; gap: 18px; align-items: center; }
.continue-thumb {
  width: 160px; aspect-ratio: 16/10; border-radius: 10px; background: var(--bg-inset); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.continue-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.continue-title { font-weight: 700; font-size: 20px; margin-top: 4px; }
.continue-meta { font-size: 16px; color: var(--text-muted); margin-top: 2px; }
.ring-panel { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.weak-panel { margin-top: 20px; }
.weak-item { margin-bottom: 12px; }
.weak-item:last-child { margin-bottom: 0; }
.weak-item__head { display: flex; justify-content: space-between; font-size: 16px; margin-bottom: 5px; gap: 10px; }
.weak-item__val { font-weight: 700; }
.weak-bar { height: 6px; border-radius: 99px; background: var(--bg-inset); }
.weak-bar > span { display: block; height: 100%; border-radius: 99px; }
.weak-bar .bar-success { background: var(--success); }
.weak-bar .bar-warning { background: var(--warning); }
.weak-bar .bar-danger { background: var(--danger); }

/* ---------- статистика изучения разделов (ТЗ §12) ---------- */
.stats-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.sec-stat { padding: 12px 0; border-bottom: 1px solid var(--border); }
.sec-stat:last-of-type { border-bottom: none; padding-bottom: 0; }
.sec-stat__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.sec-stat__title { font-size: 16px; font-weight: 600; }
.sec-stat__count { font-size: 15px; color: var(--text-muted); white-space: nowrap; }
.sec-stat__test {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-top: 8px; padding-left: 14px; font-size: 15px;
}
.sec-stat__test > a { color: var(--text-muted); text-decoration: none; }
.sec-stat__test > a:hover { color: var(--accent); }
.sec-stat__res { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sec-stat__raw { color: var(--text-faint); }
.sec-stat__delta { font-weight: 700; }
.sec-stat__delta.delta-up { color: var(--success); }
.sec-stat__delta.delta-down { color: var(--danger); }

/* ---------- настройки ---------- */
.settings-head { display: flex; align-items: center; gap: 14px; padding: 22px 26px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.settings-user { flex: 1; min-width: 180px; }
.settings-user__email { font-weight: 700; font-size: 19px; overflow-wrap: anywhere; }
.settings-user__since { font-size: 15px; color: var(--text-faint); }
.sect-title { font-weight: 700; font-size: 19px; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; flex-wrap: wrap; margin-bottom: 0.5rem;
}
.settings-row--flat { background: var(--bg-inset); border: none; }
.sr-main { font-size: 18px; }
.sr-note { font-size: 15px; color: var(--text-faint); margin-top: 2px; }
.settings-panel { padding: 24px 26px; }
.verify-card { max-width: 360px; box-shadow: none; }
.top-dashed { border-top: 1px dashed var(--border); padding-top: 10px; }
.sess-list { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.sess-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.sess-row:last-child { border-bottom: none; }
.sess-row__link { font-size: 16px; color: var(--danger); font-weight: 600; text-decoration: none; background: none; border: none; cursor: pointer; padding: 8px 0; }

.stat-list { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.stat-row { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 10px; text-decoration: none; color: inherit; flex-wrap: wrap; }
.stat-row:last-child { border-bottom: none; }
a.stat-row:hover { background: var(--bg-inset); }
.stat-list > :last-child { border-bottom: none; }
/* свёрнутые прежние попытки теста (аудит UX §9) */
.stat-more { border-bottom: 1px solid var(--border); }
.stat-more summary {
  list-style: none; cursor: pointer; padding: 10px 16px; font-size: 15px; font-weight: 600;
  color: var(--accent); display: flex; align-items: center; gap: 8px; min-height: 44px;
}
.stat-more summary::-webkit-details-marker { display: none; }
.stat-more summary::before {
  content: ''; width: 7px; height: 7px; flex-shrink: 0;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); margin-top: -3px; transition: transform .15s;
}
.stat-more[open] summary::before { transform: rotate(-135deg); margin-top: 3px; }
.stat-row--sub { background: var(--bg-inset); padding-left: 32px; }
@media (prefers-reduced-motion: reduce) {
  .stat-more summary::before { transition: none; }
}

/* ---------- лендинг ---------- */
.hero { padding: 56px 48px; display: flex; gap: 48px; align-items: center; }
.hero__kicker { font-size: 15px; font-weight: 700; letter-spacing: .08em; color: var(--accent); text-transform: uppercase; margin-bottom: 12px; }
.hero__title { font-size: 43px; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
.hero__lead { margin-top: 16px; font-size: 19px; color: var(--text-muted); line-height: 1.6; max-width: 460px; }
.hero__actions { display: flex; gap: 12px; margin-top: 26px; align-items: center; flex-wrap: wrap; }
.hero__micro { margin-top: 14px; font-size: 16px; color: var(--text-muted); }
.hero__micro b { color: var(--text); }
.hero__img { flex: 1; min-width: 0; }
.hero__img img { width: 100%; height: auto; display: block; border-radius: 14px; border: 1px solid var(--border); background: #F7F3EC; }
.hero__preview {
  flex: 1; aspect-ratio: 16/9; border-radius: 14px;
  background: linear-gradient(135deg, #7B2E2E, #3d1717);
  display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.55); font-size: 16px;
}
.hero > div:first-child { flex: 1; }
.section-head { padding: 8px 48px 20px; }
.section-head h2 { font-size: 25px; }
.section-head p { font-size: 16px; color: var(--text-muted); margin-top: 6px; max-width: 640px; line-height: 1.6; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.features--grid4 { grid-template-columns: repeat(4, 1fr); }
.feature { background: var(--bg-card); padding: 24px 28px; }
.feature__icon {
  width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.feature__icon svg { width: 26px; height: 26px; }
.feature__title { font-weight: 700; font-size: 18px; }
.feature__desc { font-size: 16px; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }
/* Обратный отсчёт до экзаменов — опциональный блок лендинга (ТЗ §15).
   Появляется, только если в config.php заданы будущие даты. */
.exam-countdown {
  margin: 8px 48px 0; padding: 22px 26px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg-inset); display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.exam-countdown__lead { flex: 1; min-width: 260px; }
.exam-countdown__lead h2 { font-size: 22px; }
.exam-countdown__lead p { font-size: 16px; color: var(--text-muted); line-height: 1.6; margin-top: 6px; max-width: 460px; }
.exam-countdown__items { display: flex; gap: 12px; flex-wrap: wrap; }
.exam-tile {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 20px; min-width: 116px; text-align: center;
}
.exam-tile__num { font-size: 34px; font-weight: 800; line-height: 1.1; color: var(--accent); }
.exam-tile__unit { font-size: 14px; color: var(--text-muted); }
.exam-tile__label { font-size: 15px; font-weight: 700; margin-top: 6px; }

.program { padding: 32px 48px; }
.program h2 { font-size: 25px; margin-bottom: 6px; }
.program__lead { font-size: 16px; color: var(--text-muted); margin-bottom: 16px; max-width: 640px; line-height: 1.6; }
.program__note { font-size: 15px; color: var(--text-faint); margin-bottom: 14px; }
.program__box { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.program__section { padding: 14px 18px; font-size: 16px; font-weight: 700; color: var(--text-muted); background: var(--bg-inset); }
.program__row { padding: 12px 18px; font-size: 16px; display: flex; justify-content: space-between; border-top: 1px solid var(--border); gap: 10px; }
.landing-block { padding: 0 48px 32px; font-size: 16px; color: var(--text-muted);  line-height: 1.6; }
.landing-block h2 { font-size: 25px; color: var(--text); margin-bottom: 8px; }

/* «Как проходит обучение» — 4 шага */
.steps { padding: 8px 48px 36px; }
.steps h2 { font-size: 25px; }
.steps__sub { font-size: 16px; color: var(--text-muted); margin-top: 6px; max-width: 640px; line-height: 1.6; }
.steps__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 20px; }
.step-card { border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card); padding: 20px; }
.step-num {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; margin-bottom: 12px;
}
.step-card__title { font-weight: 700; font-size: 18px; }
.step-card__desc { font-size: 15px; color: var(--text-muted); margin-top: 6px; line-height: 1.55; }

/* мини-блок фактов «О проекте» */
.fact-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.fact-tile { background: var(--bg-inset); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.fact-tile b { display: block; font-size: 18px; color: var(--text); }
.fact-tile span { display: block; font-size: 14px; color: var(--text-muted); margin-top: 3px; line-height: 1.4; }

/* FAQ — аккордеон, работает и без JS */
.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-list details { border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); }
.faq-list summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 15px 18px; font-size: 17px; font-weight: 600; color: var(--text); min-height: 44px;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: ''; width: 9px; height: 9px; flex-shrink: 0;
  border-right: 2px solid var(--text-faint); border-bottom: 2px solid var(--text-faint);
  transform: rotate(45deg); transition: transform .15s; margin-top: -4px;
}
.faq-list details[open] summary { color: var(--accent); }
.faq-list details[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.faq-a { padding: 0 18px 16px; font-size: 16px; color: var(--text-muted); line-height: 1.6; }
.faq-a a { color: var(--accent); font-weight: 600; }

/* финальный призыв к действию — фирменная плашка, одинаковая в обеих темах */
.cta-plate {
  background: linear-gradient(135deg, #7B2E2E, #3d1717); color: #fff;
  padding: 40px 48px; display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
}
.cta-plate__title { font-size: 28px; font-weight: 800; letter-spacing: -0.01em; }
.cta-plate__sub { font-size: 16px; color: rgba(255,255,255,.75); margin-top: 8px; line-height: 1.6; }
.cta-plate__btn { background: #fff; color: #7B2E2E; border-color: transparent; }
.cta-plate__btn:hover { background: #F0E4E4; }

/* ---------- карточки авторизации (узкие, ТЗ §17) ---------- */
.auth-wrap { display: flex; justify-content: center; padding: 48px 16px; }
.auth-card { width: 100%; max-width: 400px; padding: 32px; }
.auth-card h1, .auth-card h2 { font-size: 28px; }
.auth-card .sub { font-size: 16px; color: var(--text-muted); margin-top: 6px; }
.auth-card form, .auth-stack { display: flex; flex-direction: column; gap: 16px; margin-top: 22px; }
.auth-logo { text-decoration: none; display: inline-block; margin-bottom: 18px; }
.auth-alt { text-align: center; font-size: 16px; color: var(--text-muted); }
.auth-alt a { color: var(--accent); font-weight: 600; text-decoration: none; }
.auth-alt a.link-quiet { color: var(--text-muted); font-weight: 400; }
/* статусные экраны («Проверьте почту», «Пароль изменён») — типографика center-card */
.status-title { font-size: 23px; margin-top: 16px; }

/* ---------- мобильный таб-бар (ТЗ §17) ---------- */
.rp-bottomnav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  justify-content: space-around; align-items: center;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); background: var(--bg-card);
}
.rp-bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 13px;
  color: var(--text-muted); text-decoration: none; min-width: 44px; min-height: 44px; justify-content: center;
}
.rp-bottomnav a.active { color: var(--accent); }
.rp-bottomnav svg { width: 20px; height: 20px; }

/* ---------- прочее ---------- */
.float-theme { position: absolute; top: 14px; right: 16px; z-index: 10; }
.breadcrumbs { font-size: 15px; color: var(--text-faint); margin-bottom: 14px; }
.breadcrumbs a { color: inherit; text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.empty-state { padding: 26px; text-align: center; }
.empty-state b { font-size: 16px; }
.empty-state div { font-size: 15px; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }
.center-card { padding: 48px 32px; text-align: center; }
.center-card h1, .center-card h2 { font-size: 23px; margin-top: 16px; }
.center-card h1 + p, .center-card p { font-size: 16px; color: var(--text-muted); margin-top: 8px; line-height: 1.5; }
.stub-body { font-size: 18px; color: var(--text-muted); line-height: 1.7; margin-top: 14px; }
.stub-body a { color: var(--accent); font-weight: 600; }

.kv-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.kv-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.kv-table tr:last-child td { border-bottom: none; }
.kv-table td:first-child { color: var(--text-muted); width: 40%; }
.ok-yes { color: var(--success); font-weight: 700; }
.ok-no { color: var(--danger); font-weight: 700; }

/* ============================================================
   Утилиты (v9): замена инлайн-стилей шаблонов.
   Идут после компонентов, поэтому побеждают при равной специфичности.
   ============================================================ */
.ta-center { text-align: center; }
.mt-2 { margin-top: 2px; } .mt-3 { margin-top: 3px; } .mt-4 { margin-top: 4px; }
.mt-6 { margin-top: 6px; } .mt-8 { margin-top: 8px; } .mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; } .mt-14 { margin-top: 14px; } .mt-16 { margin-top: 16px; }
.mt-18 { margin-top: 18px; } .mt-20 { margin-top: 20px; } .mt-22 { margin-top: 22px; }
.mt-24 { margin-top: 24px; } .mt-26 { margin-top: 26px; }
.mb-0 { margin-bottom: 0; } .mb-4 { margin-bottom: 4px; } .mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; } .mb-10 { margin-bottom: 10px; } .mb-12 { margin-bottom: 12px; }
.mb-14 { margin-bottom: 14px; } .mb-16 { margin-bottom: 16px; }
.txt-13 { font-size: 13px; } .txt-14 { font-size: 14px; } .txt-15 { font-size: 15px; }
.txt-16 { font-size: 16px; } .txt-17 { font-size: 17px; } .txt-18 { font-size: 18px; }
.txt-19 { font-size: 19px; } .txt-20 { font-size: 20px; } .txt-21 { font-size: 21px; }
.txt-23 { font-size: 23px; } .txt-24 { font-size: 24px; } .txt-25 { font-size: 25px; }
.txt-26 { font-size: 26px; } .txt-28 { font-size: 28px; } .txt-30 { font-size: 30px; }
.w-400 { font-weight: 400; } .w-600 { font-weight: 600; } .w-700 { font-weight: 700; } .w-800 { font-weight: 800; }
.lh-140 { line-height: 1.4; } .lh-150 { line-height: 1.5; } .lh-155 { line-height: 1.55; }
.lh-160 { line-height: 1.6; } .lh-170 { line-height: 1.7; }
.c-text { color: var(--text); } .c-accent { color: var(--accent); }
.c-success { color: var(--success); } .c-warning { color: var(--warning); } .c-danger { color: var(--danger); }
.hstack { display: flex; align-items: center; gap: 10px; }
.hstack--between { justify-content: space-between; }
.hstack--start { align-items: flex-start; }
.hstack--end { align-items: flex-end; }
.hstack--baseline { align-items: baseline; }
.hstack--wrap { flex-wrap: wrap; }
.vstack { display: flex; flex-direction: column; }
.gap-3 { gap: 3px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-9 { gap: 9px; }
.gap-12 { gap: 12px; } .gap-14 { gap: 14px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.grow { flex: 1; }
.minw-0 { min-width: 0; }
.minw-160 { min-width: 160px; }
.minw-180 { min-width: 180px; }
.minw-220 { min-width: 220px; }
.nowrap { white-space: nowrap; }
.wrap-any { overflow-wrap: anywhere; }
.d-contents { display: contents; }
.link { color: var(--accent); font-weight: 600; text-decoration: none; }
.link-quiet { color: var(--text-muted); text-decoration: none; }

/* ============================================================
   Адаптив (ТЗ §17): мобильный до 640, планшет 640–1024, десктоп 1024+
   ============================================================ */
/* планшет и уже: hero в колонку — двух колонок при 641–900 не хватает (аудит UX §8);
   шапке лендинга разрешаем перенос, иначе меню и кнопки входа наезжают друг на друга */
@media (max-width: 900px) {
  .hero { flex-direction: column; gap: 28px; padding: 40px 32px; }
  .hero__title { font-size: 36px; }
  .hero__img, .hero__preview { width: 100%; }
  .topbar--landing { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .desktop-only { display: none !important; }
  .topbar { padding: 12px 16px; }
  .topbar .nav, .topbar .topbar__link { display: none; }  /* шапка: логотип, тема, аватар */
  /* у админки таб-бара нет — навигация остаётся в шапке со скроллом (ТЗ §17) */
  .topbar--admin { flex-wrap: wrap; }
  .topbar--admin .nav { display: flex; overflow-x: auto; max-width: 100%; }
  .container { padding: 16px 14px 48px; }
  body.has-tabbar .container { padding-bottom: 96px; }   /* запас только под таб-бар (аудит UX §7) */
  body.has-tabbar .rp-bottomnav { display: flex; }
  /* подвал на страницах кабинета не должен уезжать под фиксированный таб-бар */
  body.has-tabbar footer.site-footer { padding-bottom: max(84px, calc(60px + env(safe-area-inset-bottom))); }
  .hero { flex-direction: column; padding: 32px 20px; gap: 24px; }
  .hero__title { font-size: 33px; }
  .hero__preview, .hero__img { width: 100%; }
  .features, .features--grid4 { grid-template-columns: 1fr; }
  .program { padding: 24px 20px; }
  .exam-countdown { margin: 8px 20px 0; padding: 18px 16px; }
  .exam-countdown__items { width: 100%; }
  .exam-tile { flex: 1; min-width: 0; padding: 12px 10px; }
  .landing-block { padding: 0 20px 24px; }
  .section-head { padding: 8px 20px 16px; }
  .steps { padding: 8px 20px 28px; }
  .steps__grid { grid-template-columns: 1fr; }
  .fact-tiles { grid-template-columns: repeat(2, 1fr); }
  .cta-plate { padding: 28px 20px; }
  .account-grid { flex-direction: column; }   /* одноколоночные карточки */
  .continue-panel { flex-direction: column; align-items: stretch; }
  .continue-thumb { width: 100%; aspect-ratio: 16/8; }
  .card--pad { padding: 18px 16px; }
  .auth-wrap { padding: 56px 12px 24px; }  /* сверху — место под плавающий переключатель темы */
  .auth-card { padding: 26px 20px; }
  .settings-head { padding: 18px 16px; }
  .settings-panel { padding: 18px 16px; }
  .hide-mobile { display: none !important; }
  /* тач-таргеты: маленькие кнопки и переключатель класса подрастают (аудит UX §1) */
  .btn--sm { height: 42px; }
  .grade-switch { height: 42px; }
  /* урок на мобильном: видео на всю ширину под шапкой, факты — колонкой (ТЗ §17, макет F3) */
  .lesson-container { display: flex; flex-direction: column; }
  .lesson-container > .video-wrap { order: -1; margin: -16px -14px 0; }
  .lesson-container > .video-wrap .lesson-video { border-radius: 0; }
  .lesson-container > .video-wrap .video-note { padding: 6px 14px 0; }
  .fact-box--inline { flex-direction: column; gap: 5px; }
  /* --- дополнения аудита --- */
  .tabs { padding: 0 14px; }                       /* вкладки настроек умещаются (аудит 2.1) */
  .tab { margin-right: 14px; font-size: 16px; }
  .pres-slider__dots { pointer-events: none; }     /* точки — индикатор; листание свайпом/стрелками (аудит 2.2) */
  .topbar--admin .topbar__link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; } /* «На сайт» видна (аудит 1.1) */
  .topbar--landing { flex-wrap: wrap; }            /* меню лендинга остаётся на мобильном (аудит 2.6) */
  .topbar--landing .nav { display: flex; order: 3; width: 100%; overflow-x: auto; gap: 16px; scrollbar-width: none; }
  .topbar--landing .nav::-webkit-scrollbar { display: none; }
  .topbar--landing .nav a { font-size: 16px; padding: 8px 0; white-space: nowrap; }
}
@media (min-width: 641px) {
  .mobile-only { display: none !important; }
}
@media (min-width: 641px) and (max-width: 1024px) {
  /* планшет: карточки фич и шагов — 2×2 (контент-документ, §2) */
  .features--grid4 { grid-template-columns: repeat(2, 1fr); }
  .steps__grid { grid-template-columns: repeat(2, 1fr); }
}
