/* ============================================================================
   components.css — компоненты, собранные ТОЛЬКО из токенов (tokens.css).
   Поменяешь токен → поменяются все компоненты. Подключать после base.css.
   ============================================================================ */

/* ---- РАСКЛАДКА ----------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* Вертикальный ритм: одинаковые отступы между детьми */
.stack > * + * { margin-top: var(--space-4); }
.stack-sm > * + * { margin-top: var(--space-2); }
.stack-lg > * + * { margin-top: var(--space-6); }

/* ---- ВЕРХНЯЯ ПАНЕЛЬ (синяя) — по стандартам app-bar -----------------------
   Высота 48px (компактный стандарт), контролы — тап-зона 40px, иконки 22-24px. */
.topbar {
  position: sticky; top: 0; z-index: var(--z-topbar);
  background: #3e6898;
  color: var(--color-on-dark);
  box-shadow: 0 2px 6px rgba(27, 67, 116, 0.25);
}
.topbar__inner {
  display: flex; align-items: center; justify-content: flex-end;   /* контролы — к правому краю */
  gap: var(--space-1);
  height: 48px; position: relative;
  width: 100%; padding-inline: clamp(12px, 4vw, 20px);
}
/* Лого «на стыке»: центр на нижней грани панели (синяя часть на панели, белая свисает ниже). */
.topbar__logo { position: absolute; left: clamp(12px, 4vw, 20px); bottom: 0; transform: translateY(50%); z-index: 2; }
.topbar__logo img { height: 56px; width: auto; display: block; }   /* крупнее; центр на грани панели → половина на панели, половина ниже */

/* Контролы панели — единый размер: круглая тап-зона 40px */
.topbar__actions { display: flex; align-items: center; gap: 4px; }
.topbar__btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: none; border: 0; padding: 0; cursor: pointer; color: #fff;
  transition: background var(--transition-fast);
}
.topbar__btn:hover { background: rgba(255, 255, 255, 0.14); }
.topbar__btn img { height: 24px; width: auto; display: block; }

/* Иконка темы. ВНИМАНИЕ: в этой SVG классы и фигуры ПЕРЕПУТАНЫ —
   .ti-moon рисует СОЛНЦЕ (диск + лучи), .ti-sun рисует МЕСЯЦ (+звёздочка).
   Логика (п.1/11): горит значок ТЕКУЩЕЙ темы; неактивный — единый приглушённый цвет (солнце=луна). */
.theme-ico { width: 30px; height: 30px; display: block; --ti-off: #9AA7B8; }
.ti-moon, .ti-sun { transition: fill var(--transition-fast); }
.ti-moon { fill: #FFD964; }            /* СОЛНЦЕ — активно в светлой теме */
.ti-sun  { fill: var(--ti-off); }      /* месяц — приглушён */
[data-theme="dark"] .ti-moon { fill: var(--ti-off); }   /* солнце приглушено */
[data-theme="dark"] .ti-sun  { fill: #FDE68A; }         /* МЕСЯЦ — активен в тёмной теме */

/* Войти / Выйти */
.topbar__login {
  height: 32px; padding: 0 16px; border: 0; border-radius: var(--radius-full);
  background: #fff; color: #2f5e96; font: 600 14px/1 var(--font-base); cursor: pointer;
  transition: background var(--transition-fast);
}
.topbar__login:hover { background: #e8eef7; }
.topbar__logout {
  height: 32px; padding: 0 12px; border: 0; background: none;
  color: #fff; font: 500 14px/1 var(--font-base); cursor: pointer; opacity: 0.92;
}
.topbar__logout:hover { opacity: 1; text-decoration: underline; }

/* Панель в разделах: «‹ Назад + заголовок» слева, тема справа */
.topbar--section .topbar__inner { justify-content: space-between; }
.topbar__back { display: inline-flex; align-items: center; gap: 6px; color: #fff; text-decoration: none;
  font: 400 15px/1 var(--font-base); min-width: 0; }   /* без жирного (п.3) */
.topbar__back:hover { text-decoration: none; opacity: 0.9; }
/* Стрелка — SVG (детерминированно центрируется с названием через align-items:center; п.2). */
.topbar__chev { flex: none; display: block; }
.topbar__back-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1; }

/* ---- КНОПКИ -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 0 var(--space-5);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background var(--transition-fast), border-color var(--transition-fast), opacity var(--transition-fast);
  user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn--block { width: 100%; }

.btn--primary   { background: var(--color-primary); color: var(--color-on-primary); }
.btn--primary:hover   { background: var(--color-primary-hover); }

.btn--secondary { background: var(--color-surface); color: var(--color-primary); border-color: var(--color-border-strong); }
.btn--secondary:hover { background: var(--color-surface-alt); }

.btn--ghost     { background: transparent; color: var(--color-primary); }
.btn--ghost:hover     { background: var(--color-primary-soft); }

.btn--danger    { background: var(--color-danger); color: #fff; }
.btn--danger:hover    { background: var(--color-danger-hover); }

.btn--sm { min-height: var(--tap-min); padding: 0 var(--space-4); font-size: var(--text-sm); }

/* ---- ПОЛЯ ВВОДА --------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field__label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text); }

.input {
  width: 100%;
  min-height: var(--control-height);
  padding: 0 var(--space-4);
  font-size: var(--text-base);   /* 16px — iOS не зумит при фокусе */
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input::placeholder { color: var(--color-text-faint); }
.input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-focus-ring); }

/* Состояние ошибки */
.field--error .input { border-color: var(--color-danger); }
.field__error { font-size: var(--text-sm); color: var(--color-danger); }
.field__hint  { font-size: var(--text-sm); color: var(--color-text-muted); }

/* ---- КАРТОЧКА ------------------------------------------------------------ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}

/* ---- ЗНАЧКИ / ЧИПЫ ------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs); font-weight: var(--weight-medium);
  border-radius: var(--radius-full);
  background: var(--color-surface-alt); color: var(--color-text-muted);
}
.badge--primary { background: var(--color-primary-soft); color: var(--color-primary-hover); }
.badge--learned { background: var(--color-learned-soft); color: var(--color-learned); }
.badge--danger  { background: var(--color-danger-soft);  color: var(--color-danger); }

/* ---- БОЛЬШИЕ КНОПКИ ГЛАВНОГО ЭКРАНА ------------------------------------- */
/* «Выбери уровень» / «Аудиокниги» / «Словарь» — крупные карточки-кнопки. */
.tile {
  display: flex; align-items: center; gap: var(--space-4);
  width: 100%;
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer; text-align: left;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
}
.tile:hover { box-shadow: var(--shadow-md); border-color: var(--color-border-strong); text-decoration: none; }
.tile:active { transform: translateY(1px); }
.tile__icon {
  flex: none; display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: var(--radius-md);
  background: var(--color-primary-soft); color: var(--color-primary-hover);
  font-size: var(--text-xl);
}
.tile__body { flex: 1; min-width: 0; }
.tile__title { font-size: var(--text-lg); font-weight: var(--weight-bold); color: var(--color-text); }
.tile__meta  { font-size: var(--text-sm); color: var(--color-text-muted); }
.tile__progress { flex: none; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-primary); }

/* ---- МОДАЛКА / BOTTOM-SHEET --------------------------------------------- */
/* Оверлей */
.overlay {
  position: fixed; inset: 0; z-index: var(--z-overlay);
  background: rgba(15, 23, 42, 0.45);
}

/* База окна. На ТЕЛЕФОНЕ — выезжающий снизу лист (bottom-sheet). */
.modal {
  position: fixed; z-index: var(--z-modal);
  left: 0; right: 0; bottom: 0;
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  padding: var(--space-4);                                              /* телефон — 16px */
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0));
  max-height: 90vh; overflow-y: auto;
}
.modal__handle {   /* «ручка» листа сверху (только мобайл) */
  width: 40px; height: 4px; border-radius: var(--radius-full);
  background: var(--color-border-strong);
  margin: 0 auto var(--space-4);
}
.modal__title { font-size: var(--text-xl); font-weight: var(--weight-bold); margin-bottom: var(--space-4); }

/* На ПЛАНШЕТЕ/ПК — центр-окно */
@media (min-width: 640px) {
  .modal {
    left: 50%; top: 50%; right: auto; bottom: auto;
    transform: translate(-50%, -50%);
    width: min(440px, calc(100vw - var(--space-6)));
    border-radius: var(--radius-lg);
    padding: 20px;                                                      /* десктоп — 20px */
  }
  .modal__handle { display: none; }
}

/* ---- ВКЛАДКИ (Вход / Регистрация) -------------------------------------- */
.tabs { display: flex; gap: var(--space-1); padding: var(--space-1); background: var(--color-surface-alt); border-radius: var(--radius-md); }
.tabs__item {
  flex: 1; min-height: var(--tap-min); border: 0; background: transparent;
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text-muted);
}
.tabs__item[aria-selected="true"] { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }

/* ---- УВЕДОМЛЕНИЕ (пустой словарь и т.п.) -------------------------------- */
.note {
  padding: var(--space-4);
  background: var(--color-primary-soft);
  border-radius: var(--radius-md);
  color: var(--color-primary-hover);
  font-size: var(--text-sm);
}

/* ===========================================================================
   ГЛАВНЫЙ ЭКРАН — кнопки разделов. ЕДИНЫЙ компонент `.mtile`.
   Три кнопки отличаются ТОЛЬКО двумя свойствами: --c (цвет) и --grad (градиент
   круга) + иконка. Всё остальное (размеры, отступы, текст, тинт фона, тень) —
   общее, выводится из одного источника. Меняешь правило один раз → меняется во всех.

   Адаптив (best practice — intrinsic sizing, без медиа-костылей):
   • пропорции кнопки зафиксированы `aspect-ratio: 526/110` (как в Figma);
   • .mtile — container (container-type: inline-size), все внутренние размеры в cqw
     (1cqw = 1% ширины кнопки) → при ЛЮБОЙ ширине экрана вид идентичен, на 526px
     совпадает с Figma до пикселя: круг 110=20.91cqw · отступ 16=3.04cqw ·
     заголовок 30=5.70cqw · подпись 26=4.94cqw;
   • цвет, тинт и тень — из одного --c через color-mix.
   =========================================================================== */
.home { max-width: 442px; margin-inline: auto; padding-inline: clamp(14px, 4vw, 20px); }  /* 442−2·20=402 → кнопка 526×0.765 (−15%, затем −10%) */

/* «Статистика» — цветной SVG-значок; зона ховера только над значком */
.stat-head {
  display: flex; align-items: center; justify-content: center;
  margin: var(--space-6) auto var(--space-5); background: none; border: 0; padding: 6px;
  cursor: pointer; width: max-content; text-decoration: none; font: inherit;
}
.stat-head img { width: 44px; height: auto; display: block; transition: transform var(--transition-fast); }   /* чётное (п.7) */
.stat-head:hover img { transform: scale(1.07); }

.mtiles { display: flex; flex-direction: column; gap: clamp(16px, 4vw, 24px); align-items: center; }

/* Координаты — БУКВАЛЬНО из HTML.txt, переведены в cqw (1cqw = ширина/100; при 526px = 5.26px).
   Каждый элемент стоит на своей координате Figma, без центрирования «на глаз».
     круг 110×110 @0,0       → 20.912cqw
     заголовок @126,16  30px → left 23.954 / top 3.042 / size 5.703 cqw
     подпись   @126,61  26px → left 23.954 / top 11.597 / size 4.943 cqw
     иконки (ширина): курс 84.89=16.139 · книги 70.2=13.346 · словарь 65.3=12.414 cqw */
.mtile {
  --c: #3E9FED;                 /* единственный «рычаг» цвета (перекрывается модификатором) */
  --grad: linear-gradient(90deg, var(--c), var(--c));
  --shd: 13, 104, 175;          /* rgb тени (перекрывается модификатором) */
  container-type: inline-size;
  position: relative; display: block;
  width: min(402px, 100%); aspect-ratio: 526 / 110;   /* эталон 526→402 (−15%, затем −10%); cqw внутри ужимаются сами */
  margin: 0; padding: 0; border: 0; appearance: none; -webkit-appearance: none;  /* button == a */
  border-radius: 999px;
  outline: 2px solid var(--c); outline-offset: -2px;   /* как Figma (не съедает высоту → круг заподлицо) */
  background: color-mix(in srgb, var(--c) 10%, var(--color-surface));
  box-shadow: 0 5px 10px rgba(var(--shd), 0.15);     /* тень точно из HTML.txt */
  overflow: hidden; cursor: pointer; text-decoration: none; font: inherit; text-align: left;
  transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}
.mtile:hover { background: color-mix(in srgb, var(--c) 13%, var(--color-surface)); box-shadow: 0 6px 14px rgba(var(--shd), 0.18); text-decoration: none; }   /* мягче, чуть заметнее обычной */
.mtile:active { transform: translateY(1px); }

.mtile__text { display: contents; }   /* обёртка не мешает абсолютному позиционированию по HTML.txt */

.mtile__circle {
  position: absolute; left: 0; top: 0; width: 20.912cqw; height: 20.912cqw;
  border-radius: 50%; background: var(--grad); display: grid; place-items: center;
}
.mtile__circle img { display: block; object-fit: contain; }
.mtile--course .mtile__circle img { width: 16.139cqw; }   /* 84.89 */
.mtile--books  .mtile__circle img { width: 13.346cqw; }   /* 70.2 */
.mtile--words  .mtile__circle img { width: 12.414cqw; }   /* 65.3 */

.mtile__title { position: absolute; left: 23.954cqw; top: 3.042cqw;  font: 400 5.703cqw/1 'Lato', var(--font-base); color: #2F323B; white-space: nowrap; }
.mtile__sub   { position: absolute; left: 23.954cqw; top: 11.597cqw; font: 400 4.943cqw/1 'Lato', var(--font-base); color: #606671; white-space: nowrap; }
[data-theme="dark"] .mtile__title { color: #EAECEF; }
[data-theme="dark"] .mtile__sub   { color: #AAB1BB; }

/* Единственное различие кнопок: цвет + градиент круга. */
.mtile--course { --c: #3E9FED; --grad: linear-gradient(90deg, #1D8EEA, #65B2F1); --shd: 13, 104, 175; }
.mtile--books  { --c: #F6943F; --grad: linear-gradient(90deg, #F5821F, #F9AE6E); --shd: 173, 98, 33; }
.mtile--words  { --c: #06AF88; --grad: linear-gradient(90deg, #019875, #01C698); --shd: 5, 155, 146; }

/* Прогресс справа на кнопке (п.5/6): % + тонкая полоска цветом кнопки. */
.mtile__prog { position: absolute; right: 5.5cqw; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: flex-end; gap: 1.4cqw; width: 19cqw; }
.mtile__pct { font: 400 4.2cqw/1 'Lato', var(--font-base); color: #606671; }
.mtile__bar { width: 100%; height: 2.2cqw; background: rgba(0, 0, 0, 0.08); border-radius: 999px; overflow: hidden; }
.mtile__bar-fill { display: block; height: 100%; background: var(--c); border-radius: 999px; }
[data-theme="dark"] .mtile__pct { color: #AAB1BB; }
[data-theme="dark"] .mtile__bar { background: rgba(255, 255, 255, 0.12); }

/* ---- СПИСОК АУДИОКНИГ ---------------------------------------------------- */
.page { max-width: 760px; margin-inline: auto; padding: var(--space-4) var(--container-pad) var(--space-8); }   /* отступ от панели до фильтров */
.page__head { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-4) 0 var(--space-2); }
.page__back { font-size: 28px; line-height: 1; color: var(--color-text); text-decoration: none; padding: 0 var(--space-2); }
.page__back:hover { text-decoration: none; color: var(--color-primary); }
.page__title { font-size: var(--text-xl); font-weight: var(--weight-bold); }

.filters { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.levelbar { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.lvl {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 var(--space-3);
  border-radius: var(--radius-full); border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text-muted);
  font-size: var(--text-sm); font-weight: var(--weight-medium); text-decoration: none;
}
.lvl:hover { text-decoration: none; background: var(--color-hover); border-color: var(--color-border); color: var(--color-accent-ink); }
.lvl--on { background: var(--color-active); color: var(--color-accent-ink); border-color: var(--color-accent); font-weight: var(--weight-bold); }
.lvl--on:hover { background: var(--color-active); color: var(--color-accent-ink); }
.accents { display: flex; gap: var(--space-2); }
.flag { display: inline-flex; padding: 4px; border-radius: var(--radius-sm); border: 2px solid transparent; opacity: .55; }
.flag:hover { opacity: 1; background: var(--color-hover); }
.flag--on { opacity: 1; border-color: var(--color-accent); background: var(--color-hover); }
.flag img { width: 28px; height: 20px; display: block; border-radius: 2px; }

.levelrow { display: flex; align-items: baseline; justify-content: space-between; padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); margin-bottom: var(--space-2); }
.levelrow__name { font-size: var(--text-lg); font-weight: 400; }   /* без жирного (п.3) */
.levelrow__count { font-size: var(--text-sm); color: var(--color-text-muted); }

.booklist { display: flex; flex-direction: column; }
.bookcard {
  display: flex; gap: var(--space-4); align-items: stretch;   /* side тянется на всю высоту: флаг вверху, прогресс внизу (п.9) */
  padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--color-border);
  text-decoration: none; color: var(--color-text);
}
.bookcard:hover { text-decoration: none; background: var(--color-surface-alt); }
.bookcard__poster { flex: none; width: 56px; height: 78px; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--color-surface-alt); display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.bookcard__poster img { width: 100%; height: 100%; object-fit: cover; }
.bookcard__noposter { font-size: 26px; }
.bookcard__body { flex: 1; min-width: 0; }
.bookcard__title { font-size: var(--text-lg); font-weight: 400; }   /* без жирного (п.3, «везде») */
.bookcard__meta { font-size: var(--text-sm); color: var(--color-text-muted); }
.bookcard__author { font-size: var(--text-sm); color: var(--color-text); margin-top: var(--space-2); }
.bookcard__pub { font-size: var(--text-sm); color: var(--color-text-muted); }
.bookcard__side { flex: none; display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: var(--space-2); }   /* флаг вверху, % внизу (п.9) */
.bookcard__flag { width: 26px; height: 19px; border-radius: 2px; }
.bookcard__pct { font-size: var(--text-sm); color: var(--color-text-muted); }

/* ---- РЕЖИМ ЧТЕНИЯ (порт движка админ-ридера) ---------------------------- */
.read-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 1.5em;
  max-width: 1100px; margin: 0 auto; padding: var(--space-4) var(--container-pad) 96px; align-items: start; }
.player-sidebar { position: sticky; top: calc(48px + 0.8em); align-self: start;
  padding: 0.8em 0.9em; border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); display: flex; flex-direction: column; gap: 0.7em; }
.player-sidebar .player-controls { display: flex; gap: 0.4em; }
.player-sidebar #player-status { font-family: monospace; font-size: 0.85em; color: var(--color-text-muted); }
.player-sidebar .page__back { font-size: 0.9em; color: var(--color-primary); text-decoration: none; padding: 0; }
.read-main { min-width: 0; }
@media (max-width: 800px) {
  .read-layout { grid-template-columns: 1fr; }
  .player-sidebar { position: sticky; top: 48px; z-index: 40; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.6em; }
}

.reader { max-width: 720px; margin: 0 auto; font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.15em; line-height: 1.75; color: var(--color-text); }
.reader .heading { text-align: center; margin: 1.5em 0; }
.reader .heading-title { font-size: 2em; font-weight: 400; margin: 1em 0 0.3em; line-height: 1.2; }   /* без жирного (п.3) */
.reader .heading-author { font-size: 1.05em; font-style: italic; color: var(--color-text-muted); margin: 0 0 2.5em; }
.reader .heading-chapter { font-size: 1.5em; font-weight: 700; margin: 2em 0 1em; }
.reader .paragraph { margin: 0; text-indent: 1.2em; }
.reader .paragraph.brk-double { margin-top: 1.75em; }

.reader .sentence { cursor: pointer; padding: 0.05em 0.15em; border-radius: 3px; }
.reader .sentence:hover { background: rgba(37, 99, 235, 0.08); }
.reader .sentence.active { background: rgba(255, 220, 100, 0.45); }
[data-theme="dark"] .reader .sentence:hover { background: rgba(96, 165, 250, 0.14); }
[data-theme="dark"] .reader .sentence.active { background: rgba(255, 220, 100, 0.20); }
.reader .sentence .w { transition: background 60ms; padding: 0 1px; border-radius: 2px; }
.reader .sentence.active .w { cursor: pointer; }
.reader .sentence.active .w:hover { background: rgba(0, 130, 200, 0.15); }
.reader.wh-on .sentence.active .w.active { background: rgba(255, 150, 30, 0.85); color: #000; }
.reader .w.selected { background: rgba(255, 150, 30, 0.85); color: #000; }
/* Уже выделенное/подсвеченное слово: наведение НЕ меняет цвет (как в админке). */
.reader .sentence.active .w.selected:hover,
.reader.wh-on .sentence.active .w.active:hover { background: rgba(255, 150, 30, 0.85); }
[data-theme="dark"] .reader .sentence.active .w.selected:hover,
[data-theme="dark"] .reader.wh-on .sentence.active .w.active:hover { background: rgba(255, 180, 50, 0.7); }
[data-theme="dark"] .reader.wh-on .sentence.active .w.active { background: rgba(255, 180, 50, 0.7); color: #000; }
[data-theme="dark"] .reader .w.selected { background: rgba(255, 180, 50, 0.7); color: #000; }

.reader .w-learned { color: var(--color-learned); }   /* слово на изучении (ур.1-3) — зелёное (§12) */
[data-theme="dark"] .reader .w-learned { color: #34D399; }
.reader.lang-en .content-ru { display: none; }
.reader.lang-ru .content-en { display: none; }
.reader.lang-ru .w { background: transparent !important; cursor: default !important; padding: 0 !important; }

/* Полоса перевода предложения (п.13): тап по предложению → его перевод в светло-голубой
   полосе под верхней панелью. Заменяет ненужный пользователю тумблер EN/RU. */
.sentence-tr {
  position: fixed; top: 48px; left: 0; right: 0; z-index: 900;
  padding: 10px clamp(12px, 4vw, 20px);
  background: var(--color-primary-soft); color: var(--color-text);
  border-bottom: 1px solid var(--color-border); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  font-family: var(--font-base); font-size: var(--text-sm); line-height: 1.45;
}
.sentence-tr[hidden] { display: none; }

.lang-toggle { display: inline-flex; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.lang-toggle .lang-link { padding: 0.3em 0.8em; font-size: 0.9em; color: var(--color-text); background: transparent; border: none; cursor: pointer; }
.lang-toggle .lang-link.active { background: var(--color-primary); color: #fff; cursor: default; }
.btn-pp { background: transparent; border: 1px solid var(--color-border-strong); color: var(--color-text);
  width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1em; cursor: pointer; padding: 0; }
.btn-pp:hover:not(:disabled) { background: var(--color-surface-alt); }
.btn-pp:disabled { opacity: 0.4; cursor: default; }
.settings-toggle { font-size: 0.85em; color: var(--color-text-muted); cursor: pointer; user-select: none; }
.settings-toggle input { vertical-align: middle; margin-right: 0.2em; }

/* ---- ПЛАШКА «ИЗУЧИТЬ» + КАРТОЧКА СЛОВА ---------------------------------- */
.study-badge {
  position: fixed; z-index: 1100;
  background: var(--color-primary); color: #fff; border: 0;
  border-radius: var(--radius-full); padding: 6px 16px;
  font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer;
  box-shadow: var(--shadow-md); white-space: nowrap;
}
.study-badge:hover { background: var(--color-primary-hover); }
.study-badge--in { background: var(--color-learned); }   /* слово уже в словаре */
.study-badge--in:hover { background: var(--color-learned); filter: brightness(0.95); }

/* .word-card использует .overlay + .modal из дизайн-системы (bottom-sheet на телефоне).
   Скролл (п.4): карточка — flex-колонка; слово/транскрипция/строка-форма/перевод и кнопка
   зафиксированы, прокручивается ТОЛЬКО блок примеров. «Изучить» всегда внизу. */
.word-card { max-width: 440px; display: flex; flex-direction: column; max-height: 90vh; overflow: hidden; }
.word-card > .modal__handle,
.word-card > .wc-head,
.word-card > .wc-ipas,
.word-card > .wc-note,
.word-card > .wc-tr,
.word-card > .btn { flex: none; }
.word-card > .wc-examples { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin-bottom: var(--space-4); }
.word-card > .btn { margin-top: auto; }   /* прижать «Изучить» к низу, если контента мало */
.wc-close { position: absolute; top: 10px; right: 14px; background: none; border: 0; font-size: 24px; line-height: 1; color: var(--color-text-muted); cursor: pointer; }
.wc-head { display: flex; align-items: baseline; gap: 6px; font-size: var(--text-xl); font-weight: var(--weight-bold); margin-bottom: var(--space-3); padding-right: 28px; }
.wc-rank { font-size: var(--text-xs); color: var(--color-text-faint); cursor: help; }
.wc-chip { margin-left: auto; align-self: center; font-size: var(--text-xs); font-weight: var(--weight-medium);
  color: var(--color-accent-ink); background: var(--color-hover); border-radius: var(--radius-full); padding: 3px 10px; white-space: nowrap; }
.wc-flag { width: 21px; height: 15px; border-radius: 2px; flex: none; display: block; }
.wc-note { font-size: var(--text-sm); color: var(--color-text-muted); margin-bottom: var(--space-3); line-height: 1.4; }
.wc-ipas { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-3); color: var(--color-text-muted); }
.wc-ipa { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-base); }
.wc-spk { background: none; border: 0; cursor: pointer; font-size: 18px; padding: 2px; line-height: 1; }
.wc-tr { font-size: var(--text-base); color: var(--color-text); margin-bottom: var(--space-4); line-height: 1.5; }
.wc-tr.wc-muted { color: var(--color-text-faint); }
.wc-examples { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-5); }
.wc-ex { background: var(--color-surface-alt); border-radius: var(--radius-md); padding: var(--space-3); }
.wc-ex-label { font-size: var(--text-xs); color: var(--color-text-faint); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.wc-ex-item + .wc-ex-item { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--color-border); }
.wc-ex-en { font-size: var(--text-base); }
.wc-ex-ru { font-size: var(--text-sm); color: var(--color-text-muted); margin-top: 2px; }

/* ---- СЛОВАРЬ (список слов) ---------------------------------------------- */
.lvl b { font-weight: var(--weight-bold); margin-left: 2px; }
.vocab { display: flex; flex-direction: column; }
.vocab__row { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--space-3); align-items: baseline;
  padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--color-border); }
.vocab__main { display: flex; align-items: baseline; gap: var(--space-2); }
.vocab__word { font-size: var(--text-lg); font-weight: var(--weight-medium); }
.vocab__ipa { font-size: var(--text-sm); color: var(--color-text-muted); }
.vocab__tr { grid-column: 1; font-size: var(--text-sm); color: var(--color-text-muted); }
.vocab__lvl { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: var(--text-xs);
  color: var(--color-primary); white-space: nowrap; }

/* ---- ТРЕНИРОВКА СЛОВ ---------------------------------------------------- */
.train { max-width: 560px; margin-inline: auto; padding: var(--space-4) var(--container-pad) var(--space-8); }
.train__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.train__lvl { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-primary); }
.train__close { font-size: 28px; line-height: 1; color: var(--color-text-muted); text-decoration: none; }
.train__close:hover { color: var(--color-text); text-decoration: none; }
.train__progress { height: 6px; background: var(--color-surface-alt); border-radius: var(--radius-full); overflow: hidden; }
.train__bar { height: 100%; width: 0; background: var(--color-primary); transition: width var(--transition-fast); }
.train__counter { text-align: center; font-size: var(--text-sm); margin: var(--space-2) 0 var(--space-5); }

.train__card { display: flex; flex-direction: column; gap: var(--space-4); }
.train__q { text-align: center; color: var(--color-text-muted); font-size: var(--text-sm); }
.train__tr { text-align: center; font-size: var(--text-xl); font-weight: var(--weight-medium); line-height: 1.4;
  background: var(--color-surface-alt); border-radius: var(--radius-lg); padding: var(--space-5) var(--space-4); }
.train__answer { text-align: center; color: var(--color-success); font-size: var(--text-base); }

.input--ok { border-color: var(--color-success) !important; box-shadow: 0 0 0 3px rgba(22,163,74,0.25) !important; }
.input--bad { border-color: var(--color-danger) !important; box-shadow: 0 0 0 3px rgba(220,38,38,0.22) !important; }

.train__assess { display: flex; gap: var(--space-3); }
.assess-btn { flex: 1; min-height: var(--control-height); border: 0; border-radius: var(--radius-md);
  font-size: var(--text-base); font-weight: var(--weight-medium); color: #fff; cursor: pointer; }
.assess-btn:disabled { opacity: 0.6; }
.assess-btn.a-green { background: #16A34A; }
.assess-btn.a-orange { background: #D97706; }
.assess-btn.a-grey { background: #64748B; }
.assess-btn.a-red { background: #DC2626; }
.train__done { text-align: center; }

/* ---- УТИЛИТЫ (минимум; всё остальное — компоненты) ---------------------- */
.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.row { display: flex; align-items: center; gap: var(--space-3); }
.row--between { justify-content: space-between; }
