/* ============================================================
   Language Gym — Telegram Mini App
   Mobile-first, нативные переменные Telegram + fallback-тема
   ============================================================ */

/* ---------- 1. Дизайн-токены ---------- */
:root {
  /* Нативные цвета Telegram (с fallback для обычного браузера) */
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #1a1a1a);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --bg-secondary: var(--tg-theme-secondary-bg-color, #f4f4f5);
  --section-bg: var(--tg-theme-section-bg-color, #ffffff);
  --link: var(--tg-theme-link-color, #2481cc);

  /* Семантические цвета статусов */
  --red: #ff453a;
  --red-soft: rgba(255, 69, 58, 0.12);
  --yellow: #ff9f0a;
  --yellow-soft: rgba(255, 159, 10, 0.14);
  --green: #30d158;
  --green-soft: rgba(48, 209, 88, 0.14);

  /* Геометрия и тени */
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --nav-height: 66px;
  --nav-offset: 12px;

  /* Анимации */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Тёмная fallback-тема для обычного браузера (Telegram переопределит сам) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--tg-theme-bg-color, #1c1c1e);
    --text: var(--tg-theme-text-color, #f2f2f7);
    --hint: var(--tg-theme-hint-color, #98989f);
    --bg-secondary: var(--tg-theme-secondary-bg-color, #111113);
    --section-bg: var(--tg-theme-section-bg-color, #2c2c2e);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  }
}

/* ---------- 2. Базовые стили ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg-secondary);
  color: var(--text);
  line-height: 1.45;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* ---------- 3. Каркас приложения и экраны ---------- */
.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--nav-height) + var(--nav-offset) + env(safe-area-inset-bottom, 0px) + 28px);
}

/* Экраны переключаются классом .active */
.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: screen-in 0.3s var(--ease);
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.screen-header {
  margin-bottom: 16px;
}

.screen-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.screen-subtitle {
  margin-top: 4px;
  font-size: 14px;
  color: var(--hint);
}

/* ---------- 4. Нижняя навигация (плавающая панель) ---------- */
.bottom-nav {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--nav-offset) + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  display: flex;
  max-width: 456px;
  margin: 0 auto;
  height: var(--nav-height);
  padding: 6px;
  border-radius: 22px;
  background: color-mix(in srgb, var(--section-bg) 86%, transparent);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow:
    0 10px 34px rgba(0, 0, 0, 0.22),
    inset 0 0 0 1px rgba(128, 128, 128, 0.14);
}

.bottom-nav__item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 16px;
  color: var(--hint);
  transition: color 0.25s ease, transform 0.15s ease;
}

.bottom-nav__item:active {
  transform: scale(0.9);
}

.bottom-nav__item.active {
  color: var(--accent);
}

/* Иконка в "пилюле" — подсвечивается у активной вкладки */
.bottom-nav__icon {
  display: grid;
  place-items: center;
  padding: 4px 13px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.25s var(--ease), transform 0.25s var(--ease);
}

.bottom-nav__icon svg {
  width: 21px;
  height: 21px;
  display: block;
}

.bottom-nav__item.active .bottom-nav__icon {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  transform: translateY(-1px);
}

.bottom-nav__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Бейдж с количеством слов на повторение */
.bottom-nav__badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 26px);
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(255, 69, 58, 0.4);
  transition: transform 0.2s var(--ease), opacity 0.2s;
}

.bottom-nav__badge.hidden-badge {
  transform: scale(0);
  opacity: 0;
}

/* ---------- 5. Дашборд ---------- */
.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--section-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.profile-avatar {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-text);
  background: linear-gradient(135deg, var(--accent), #6c5ce7);
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-subtitle {
  font-size: 13px;
  color: var(--hint);
}

/* Крупный бейдж уровня */
.level-badge {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #6c5ce7);
  color: var(--accent-text);
  box-shadow: 0 4px 14px rgba(36, 129, 204, 0.35);
}

.level-badge__code {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}

.level-badge__label {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Сетка статистики 2×2 */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.stat-card {
  padding: 14px;
  background: var(--section-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-card__icon {
  font-size: 20px;
}

.stat-card__value {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.stat-card__label {
  margin-top: 2px;
  font-size: 12px;
  color: var(--hint);
}

/* Карточка прогресса */
.progress-card {
  margin-top: 14px;
  padding: 16px;
  background: var(--section-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.progress-card__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
}

.progress-card__value {
  font-size: 17px;
  font-weight: 800;
  color: var(--accent);
}

.progress-bar {
  margin-top: 12px;
  height: 10px;
  border-radius: 5px;
  background: var(--bg-secondary);
  overflow: hidden;
}

.progress-bar__fill {
  width: 0; /* анимируется из JS до целевого значения */
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--accent), #6c5ce7);
  transition: width 1s var(--ease);
}

.progress-card__hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--hint);
}

/* ---------- 6. Грамматика (уровни + аккордеоны) ---------- */

/* Легенда статусов под заголовком */
.grammar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--hint);
}

.grammar-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.grammar-legend__dot--red { background: var(--red); }
.grammar-legend__dot--yellow { background: var(--yellow); }
.grammar-legend__dot--green { background: var(--green); }
.grammar-legend__dot--none { background: var(--hint); opacity: 0.55; }

/* Бейдж уровня CEFR в шапке группы: A — зелёный, B — синий, C — фиолетовый */
.level-chip {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
}

.level-chip--a { background: linear-gradient(135deg, #30d158, #28a745); }
.level-chip--b { background: linear-gradient(135deg, var(--accent), #6c5ce7); }
.level-chip--c { background: linear-gradient(135deg, #af52de, #d63384); }

/* Счётчик закреплённых тем справа в шапке уровня */
.grammar-category__count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.grammar-category {
  margin-bottom: 18px;
}

.grammar-category__title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--hint);
}

.grammar-item {
  margin-bottom: 8px;
  background: var(--section-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.grammar-item__head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  text-align: left;
}

.grammar-item__status {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.grammar-item--red .grammar-item__status { background: var(--red); }
.grammar-item--yellow .grammar-item__status { background: var(--yellow); }
.grammar-item--green .grammar-item__status { background: var(--green); }
.grammar-item--none .grammar-item__status { background: var(--hint); opacity: 0.55; }

/* Темы без данных выглядят слегка приглушённо */
.grammar-item--none .grammar-item__name {
  color: var(--hint);
}

.grammar-item__name {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
}

/* Шеврон поворачивается при раскрытии */
.grammar-item__chevron {
  flex-shrink: 0;
  color: var(--hint);
  font-size: 13px;
  transition: transform 0.3s var(--ease);
}

.grammar-item.open .grammar-item__chevron {
  transform: rotate(180deg);
}

/* Плавное раскрытие через max-height */
.grammar-item__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s var(--ease);
}

.grammar-item__content {
  padding: 0 16px 16px;
}

/* Пример ошибки из чата */
.error-example {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  font-size: 14px;
}

.error-example__row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.error-example__row + .error-example__row {
  margin-top: 8px;
}

.error-example__bad {
  color: var(--red);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.error-example__good {
  color: var(--green);
  font-weight: 600;
}

.error-example__why {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(128, 128, 128, 0.3);
  font-size: 13px;
  color: var(--hint);
}

/* Заглушка: пользователь ещё не дошёл до темы, данных нет */
.no-data {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed rgba(128, 128, 128, 0.35);
  background: transparent;
}

.no-data__icon {
  font-size: 20px;
  line-height: 1.2;
}

.no-data__text {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--hint);
}

.no-data__text b {
  color: var(--text);
}

/* Блок теории "как работает правило" внутри аккордеона */
.rule-block {
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent);
}

.rule-block__title {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.rule-block__text {
  font-size: 13.5px;
  line-height: 1.55;
}

/* Кнопка запуска практики под правилом */
.btn--practice {
  margin-top: 12px;
}

/* Кнопка "Практиковать с ботом" — вторичная, в цвет акцента */
.btn--bot {
  margin-top: 8px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

/* Включённый фокус бота на теме */
.btn--bot-active {
  background: var(--green-soft);
  color: var(--green);
}

/* Пояснение под кнопкой бота */
.bot-hint {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--hint);
  text-align: center;
}

/* ---------- 6.1 Словарь: сводка и строки слов ---------- */
.vocab-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.summary-chip {
  padding: 12px 8px;
  text-align: center;
  background: var(--section-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.summary-chip__value {
  font-size: 24px;
  font-weight: 800;
}

.summary-chip--red .summary-chip__value { color: var(--red); }
.summary-chip--yellow .summary-chip__value { color: var(--yellow); }
.summary-chip--green .summary-chip__value { color: var(--green); }

.summary-chip__label {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--hint);
}

/* Перевод под словом в строке словаря */
.word-translation {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--hint);
}

/* Подсказка о дате повторения справа */
.word-hint {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--yellow);
  background: var(--yellow-soft);
  padding: 4px 8px;
  border-radius: 8px;
}

/* Статичная строка словаря (div вместо button) — выравнивание как у кнопки */
div.grammar-item__head {
  cursor: default;
}

/* ---------- 6.2 Учить: выбор списка слов ---------- */
.study-lists {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px;
  text-align: left;
  background: var(--section-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, opacity 0.2s ease;
}

.list-card:active {
  transform: scale(0.97);
}

.list-card__emoji {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 22px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}

.list-card__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.list-card__name {
  font-size: 15px;
  font-weight: 700;
}

.list-card__description {
  font-size: 12px;
  color: var(--hint);
}

.list-card__meta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.list-card__count {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--bg-secondary);
  padding: 4px 10px;
  border-radius: 10px;
  white-space: nowrap;
}

.list-card--done .list-card__count {
  color: var(--green);
  background: var(--green-soft);
}

.list-card__chevron {
  font-size: 20px;
  color: var(--hint);
}

/* ---------- 6.3 Учить: шапка сессии карточек ---------- */
.session-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.btn-back {
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--section-bg);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  transition: transform 0.12s ease;
}

.btn-back:active {
  transform: scale(0.94);
}

.session-header__title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.session-header__counter {
  font-size: 13px;
  color: var(--hint);
}

/* ---------- 6.4 Языки: переход в другие боты ---------- */
.lang-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lang-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  background: var(--section-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.12s ease;
}

.lang-card:active {
  transform: scale(0.97);
}

/* Текущий бот выделен рамкой в цвет акцента */
.lang-card--current {
  box-shadow:
    var(--shadow),
    inset 0 0 0 1.5px var(--accent);
}

.lang-card__flag {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  font-size: 26px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}

.lang-card__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lang-card__name {
  font-size: 15px;
  font-weight: 700;
}

.lang-card__native {
  font-size: 12px;
  color: var(--hint);
}

.lang-card__meta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Чип уровня или призыв открыть бота */
.lang-card__chip {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 10px;
  white-space: nowrap;
  color: var(--accent);
  background: var(--bg-secondary);
}

.lang-card--current .lang-card__chip {
  color: var(--green);
  background: var(--green-soft);
}

.lang-card__chevron {
  font-size: 20px;
  color: var(--hint);
}

/* ---------- 7. Учить (флеш-карты) ---------- */
.flashcard-zone {
  margin-top: 8px;
}

/* Сцена задаёт перспективу для 3D-переворота */
.flashcard-scene {
  perspective: 1200px;
  height: 320px;
}

.flashcard {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.55s var(--ease), opacity 0.4s ease;
  cursor: pointer;
}

/* Переворот по классу .flipped */
.flashcard.flipped {
  transform: rotateY(180deg);
}

/* Анимации "улёта" карточки при оценке */
.flashcard.fly-right {
  transform: translateX(120%) rotate(12deg);
  opacity: 0;
}

.flashcard.fly-left {
  transform: translateX(-120%) rotate(-12deg);
  opacity: 0;
}

/* Появление новой карточки */
.flashcard.enter {
  animation: card-enter 0.35s var(--ease);
}

@keyframes card-enter {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.flashcard__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  border-radius: 20px;
  background: var(--section-bg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.10);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  text-align: center;
}

.flashcard__face--back {
  transform: rotateY(180deg);
}

.flashcard__tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hint);
}

.flashcard__word {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.flashcard__translation {
  font-size: 26px;
  font-weight: 700;
}

.flashcard__transcription {
  font-size: 16px;
  color: var(--accent);
  font-style: italic;
}

.flashcard__example {
  font-size: 14px;
  color: var(--hint);
  font-style: italic;
  max-width: 280px;
}

/* Кнопки под карточкой */
.flashcard-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

/* ---------- 8. Кнопки ---------- */
.btn {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.12s ease, opacity 0.2s ease;
}

.btn:active {
  transform: scale(0.96);
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-text);
}

.btn--ghost {
  padding: 10px 16px;
  background: var(--bg-secondary);
  color: var(--accent);
  font-size: 14px;
}

.btn--later {
  background: var(--red-soft);
  color: var(--red);
}

.btn--known {
  background: var(--green-soft);
  color: var(--green);
}

/* Кнопка на всю ширину */
.btn--block {
  display: block;
  width: 100%;
  margin-top: 14px;
}

/* ---------- 9. Экран "все слова разобраны" ---------- */
.vocab-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 24px;
  text-align: center;
  animation: screen-in 0.4s var(--ease);
}

.vocab-done__emoji {
  font-size: 64px;
  animation: bounce-in 0.6s var(--ease);
}

@keyframes bounce-in {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.vocab-done__title {
  font-size: 24px;
  font-weight: 800;
}

.vocab-done__text {
  font-size: 15px;
  color: var(--hint);
}

.vocab-done .btn--primary {
  margin-top: 14px;
  min-width: 200px;
}

/* ---------- 10. Модалка практики (bottom sheet) ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  animation: fade-in 0.25s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal__sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 18px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  border-radius: 24px 24px 0 0;
  background: var(--bg);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
  animation: sheet-up 0.35s var(--ease);
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal__title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.modal__close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--hint);
  font-size: 14px;
  transition: transform 0.12s ease;
}

.modal__close:active {
  transform: scale(0.9);
}

/* Вопрос и варианты ответа */
.practice-progress {
  font-size: 12px;
  font-weight: 600;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.practice-question {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}

.practice-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.practice-option {
  padding: 14px 16px;
  text-align: left;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.14);
  transition: transform 0.12s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.practice-option:active {
  transform: scale(0.98);
}

/* Результат ответа: верный — зелёный, неверный — красный */
.practice-option.correct {
  background: var(--green-soft);
  color: var(--green);
  box-shadow: inset 0 0 0 1.5px var(--green);
}

.practice-option.wrong {
  background: var(--red-soft);
  color: var(--red);
  box-shadow: inset 0 0 0 1.5px var(--red);
}

.practice-option:disabled {
  cursor: default;
}

/* Экран результата */
.practice-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 0 6px;
  text-align: center;
}

.practice-result__emoji {
  font-size: 56px;
  animation: bounce-in 0.6s var(--ease);
}

.practice-result__title {
  font-size: 24px;
  font-weight: 800;
}

.practice-result__text {
  font-size: 14px;
  color: var(--hint);
}

/* ---------- 11. Тост-уведомление ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-height) + var(--nav-offset) + env(safe-area-inset-bottom, 0px) + 16px);
  z-index: 150;
  max-width: 90%;
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--section-bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
