:root {
  /* Цвета флага Аргентины: celeste, белый, солнце (Sol de Mayo) */
  --flag-celeste: #74acdf;
  --flag-white: #ffffff;
  --flag-sun: #f6b40e;

  --bg: #f3f8fd;
  --surface: #ffffff;
  --text: #0f2236;
  --muted: #5b6b7d;
  --border: #dbe7f3;
  --accent: var(--flag-celeste);
  --accent-text: #0b2540;
  --accent-strong: #1d6aa8;
  --accent-soft: #e2effa;
  --sun: var(--flag-sun);
  --stress: rgba(214, 150, 0, .45); /* пометка ударения — еле заметная */
  --danger: #c62828;
  --on-danger: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
  --radius: 18px;
  --nav-h: 60px; /* меню админки */
  --tabbar-h: 72px; /* меню сайта: плашка 62 + отступ снизу 10 */
  color-scheme: light;
}

/* Тёмная тема: по системе (если не выбрана светлая вручную) или по выбору пользователя */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c141d;
    --surface: #15202c;
    --text: #eef4fa;
    --muted: #93a4b6;
    --border: #23344a;
    --accent: var(--flag-celeste);
    --accent-text: #0b2540;
    --accent-strong: #95c4ee;
    --accent-soft: #1a3048;
    --stress: rgba(246, 180, 14, .38);
    --danger: #ff8a80;
    --on-danger: #3b0a07;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c141d;
  --surface: #15202c;
  --text: #eef4fa;
  --muted: #93a4b6;
  --border: #23344a;
  --accent: var(--flag-celeste);
  --accent-text: #0b2540;
  --accent-strong: #95c4ee;
  --accent-soft: #1a3048;
  --stress: rgba(246, 180, 14, .38);
  --danger: #ff8a80;
  --on-danger: #3b0a07;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* Зум страницы выключен (решение владельца): двойное касание не приближает. */
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px calc(32px + env(safe-area-inset-bottom));
}

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: env(safe-area-inset-top) 0 12px;
  background: var(--bg);
}

.header::before {
  content: "";
  display: block;
  height: 14px;
  margin: 0 -16px 12px;
  background: linear-gradient(var(--flag-celeste) 0 33.3%, var(--flag-white) 0 66.6%, var(--flag-celeste) 0);
}

.header__top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: transform .15s;
}

.icon-btn:active { transform: scale(.94); }

.icon-btn svg { width: 22px; height: 22px; color: var(--text); }

.icon-btn[aria-current="page"] { border-color: var(--accent); background: var(--accent-soft); }

.icon-btn:focus-visible {
  outline: 3px solid var(--accent-strong);
  outline-offset: 2px;
}

.brand {
  flex: 1;
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
}

/* ---------- Нижнее меню админки (текстовые вкладки) ---------- */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.bottom-nav__inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 560px;
  margin: 0 auto;
}

.nav-item {
  position: relative;
  min-height: var(--nav-h);
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: color .2s;
}

.nav-item[aria-current="page"] { color: var(--accent-strong); font-weight: 750; }

.nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 25%;
  right: 25%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--accent);
}

.nav-item:focus-visible { outline-offset: -3px; }

.nav-hidden .bottom-nav { display: none; }

.has-nav .app { padding-bottom: calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)); }

.has-nav:not(.nav-hidden) .bottom-bar {
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: 12px;
}

.has-nav:not(.nav-hidden) .toast { bottom: calc(var(--nav-h) + 84px + env(safe-area-inset-bottom)); }

/* ---------- Нижнее меню сайта ---------- */
/* Форма — как в VOZI: плавающая плашка 62px со скруглением 18, иконки без подписей,
   в центре вырез под круглую кнопку «Практика». Контур выреза — маска, её путь
   считает app.js (updateNavMask) по фактической ширине, чтобы скругления не растягивались. */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  padding: 0 12px calc(10px + env(safe-area-inset-bottom));
  pointer-events: none; /* клики мимо плашки уходят к странице */
}

.tabbar__inner {
  position: relative;
  max-width: 536px;
  margin: 0 auto;
}

.tabbar__bar {
  display: flex;
  height: 62px;
  border-radius: 18px; /* пока маска не посчитана */
  background-color: rgba(29, 106, 168, .9);
  /* выпуклость: светлая кромка сверху, мягкое затемнение к низу */
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .2) 0%, rgba(255, 255, 255, .04) 42%, rgba(0, 0, 0, .12) 100%);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  pointer-events: auto;
}

.tabbar__gap { flex: none; width: 104px; } /* под вырез — иконки не заезжают под кнопку */

.tab-item {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, .6);
  cursor: pointer;
  transition: color .2s;
  -webkit-tap-highlight-color: transparent;
}

.tab-item svg { position: relative; width: 28px; height: 28px; }

/* Матовая подложка: постоянно под выбранной вкладкой, вспыхивает под пальцем на остальных. */
.tab-item::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 57px;
  height: 47px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .34);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}

.tab-item[aria-current="page"] { color: #fff; }
.tab-item[aria-current="page"]::before,
.tab-item:active::before { opacity: 1; }

.tab-item:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }

/* Круглая кнопка «Практика»: центр совпадает с центром выреза (12px над кромкой плашки). */
.tab-fab {
  position: absolute;
  left: 50%;
  top: -43px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background-color: #0b2540;
  background-image: linear-gradient(160deg, rgba(255, 255, 255, .18) 0%, rgba(255, 255, 255, 0) 55%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
  color: #fff;
  transform: translateX(-50%);
  transition: transform .15s;
  pointer-events: auto;
}

.tab-fab::before { width: 46px; height: 46px; border-radius: 50%; }
.tab-fab:active { transform: translateX(-50%) scale(.95); }
.tab-fab svg { width: 26px; height: 26px; }

/* В «Практике» круглая кнопка — плей/пауза: пока идёт отсчёт, на ней пауза */
.tab-fab__pause,
.tab-fab[data-mode="pause"] .tab-fab__play { display: none; }
.tab-fab[data-mode="pause"] .tab-fab__pause { display: block; }

/* ■ и ▶| рядом с круглой кнопкой — чуть меньше значков разделов */
.tab-ctl svg { width: 24px; height: 24px; }

/* Во время отсчёта из практики не уйти: «Список» и «Профиль» бледные и не нажимаются */
.tab-item:disabled { opacity: .35; cursor: default; }
.tab-item:disabled::before { opacity: 0; }
.tab-fab:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 2px; }

/* Высота меню (--tabbar-h) + выступ круглой кнопки над плашкой (43px). */
.has-tabbar .app { padding-bottom: calc(var(--tabbar-h) + 43px + 32px + env(safe-area-inset-bottom)); }

.has-tabbar .bottom-bar {
  bottom: calc(var(--tabbar-h) + 43px + env(safe-area-inset-bottom));
  padding-bottom: 12px;
}

.has-tabbar .toast { bottom: calc(var(--tabbar-h) + 43px + 84px + env(safe-area-inset-bottom)); }

button:focus-visible,
.field__input:focus-visible {
  outline: 3px solid var(--accent-strong);
  outline-offset: 2px;
}

.panel { padding-top: 8px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.field { display: grid; gap: 6px; }

.field__hint {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.field__input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  resize: vertical;
  transition: border-color .2s;
}

.field__input:focus { border-color: var(--accent); outline: none; }

.field__input[aria-invalid="true"] { border-color: var(--danger); }

.form__error {
  margin: -4px 0 0;
  font-size: 13px;
  color: var(--danger);
}

.btn-primary {
  min-height: 50px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform .1s, opacity .2s;
}

.btn-primary:active { transform: scale(.98); }

.list-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 28px 4px 12px;
}

.list-title { margin: 0; font-size: 18px; font-weight: 700; }

.badge {
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--sun);
  color: #3d2a00;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 14px 8px 14px 16px;
  animation: appear .25s ease-out;
}

@keyframes appear {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.item__text { flex: 1; min-width: 0; }

.item__ru,
.item__es {
  margin: 0;
  overflow-wrap: anywhere;
}

.item__ru {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--muted);
}

.item {
  border-left: 4px solid var(--accent);
}

.item__es {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: -.01em;
  color: var(--accent-strong);
}

.btn-delete {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}

.btn-delete:hover { color: var(--danger); }

.btn-delete[data-confirm="true"] {
  background: var(--danger);
  color: #fff;
}

.btn-delete svg { width: 20px; height: 20px; }

.list-status {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
}

.list-status p { margin: 0; }

.list-more {
  display: grid;
  margin-top: 12px;
}

/* Исходный глагол — мелко в правом верхнем углу фразы. */
.item { position: relative; }
.item--base { padding-top: 24px; }

.item__base {
  position: absolute;
  top: 6px;
  right: 12px;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.list-status .btn-secondary { padding: 0 24px; }

/* ---------- Загрузка и вход ---------- */

.boot {
  margin: 0;
  padding: 64px 16px;
  text-align: center;
  color: var(--muted);
}

.auth { padding-top: 8px; }

.auth__text {
  margin: -6px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.form__ok {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 600;
}

.auth__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
}

.link-btn {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-strong);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.link-btn:focus-visible,
.btn-ghost:focus-visible {
  outline: 3px solid var(--accent-strong);
  outline-offset: 2px;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-ghost {
  min-height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-ghost:disabled {
  opacity: .6;
  cursor: default;
}

/* ---------- Перенос фраз из браузера ---------- */

.migrate {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 16px;
  border-left: 4px solid var(--sun);
}

.migrate__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
}

.migrate .btn-row,
.form .btn-row { max-width: none; width: 100%; }

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}

.btn-block {
  display: block;
  width: 100%;
  max-width: 528px;
  margin: 0 auto;
}

#panel-training { padding-bottom: 0; }

.placeholder {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}

.placeholder__icon { font-size: 40px; margin-bottom: 8px; }

.placeholder .btn-secondary { margin-top: 12px; padding: 0 24px; }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Тренировка ---------- */

.item__time {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.card-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

.time-pickers {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 8px;
}

.time-pickers__sep {
  padding-bottom: 12px;
  font-size: 28px;
  font-weight: 700;
  color: var(--muted);
}

.select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 60px;
  padding-right: 36px;
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  text-align-last: center;
  resize: none;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

.btn-secondary {
  min-height: 50px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform .1s;
}

.btn-secondary:active { transform: scale(.98); }

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 10px;
  max-width: 528px;
  margin: 0 auto;
}

/* Практика: «Закончить», «Другое», «Практиковать» */
.btn-row--three { grid-template-columns: 1fr 1fr 1.3fr; gap: 8px; }
.btn-row--three > button { min-width: 0; padding: 0 4px; font-size: clamp(13px, 4.2vw, 16px); }

.round-info {
  margin: 4px 4px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.phrase-card {
  position: relative;
  padding: 22px 20px;
  border-top: 4px solid var(--accent);
}

.phrase-card__base {
  position: absolute;
  top: 4px;
  right: 14px;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.phrase-card__es {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.015em;
  color: var(--accent-strong);
  overflow-wrap: anywhere;
}

.phrase-card__ru {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.phrase-card__es { transition: filter .2s; }

/* Скрытая испанская фраза: место сохраняется, слова не читаются */
.phrase-card__es.is-concealed {
  filter: blur(10px);
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

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

.phrase-card__foot .time-chip { margin: 0; }

.reveal-btn__shut { display: none; }
.reveal-btn[aria-pressed="true"] .reveal-btn__open { display: none; }
.reveal-btn[aria-pressed="true"] .reveal-btn__shut { display: block; }
.reveal-btn[aria-pressed="false"] { border-color: var(--accent); background: var(--accent-soft); }
.reveal-btn[aria-pressed="false"] svg { color: var(--accent-strong); }

.time-chip {
  display: inline-block;
  margin: 14px 0 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

/* Разделы практики: полоса из четырёх вкладок, выбранная залита голубым. */
.segments {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.segments__item {
  min-height: 40px;
  padding: 0 2px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}

.segments__item[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 750;
}

.segments__item:disabled { opacity: .45; cursor: default; }

/* Лица под карточкой: сетка 5 × 2, всё помещается без прокрутки. */
.persons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 18px;
}

.person-chip {
  display: grid;
  place-items: center;
  align-content: center;
  min-width: 0;
  min-height: 46px;
  padding: 4px 1px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.15;
  cursor: pointer;
  transition: background-color .2s, border-color .2s;
}

.person-chip__es { font-size: clamp(10.5px, 3.3vw, 13px); font-weight: 750; letter-spacing: -.02em; }
.person-chip__ru { font-size: 11px; color: var(--muted); }

.person-chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.person-chip[aria-pressed="true"] .person-chip__ru { color: var(--accent-text); }

/* «Больше» на карточке — рядом с глазиком */
.more-btn {
  min-height: 44px;
  margin-left: auto;
  padding: 0 14px;
  border: 1.5px dashed var(--accent-strong);
  border-radius: 12px;
  background: none;
  color: var(--accent-strong);
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.more-btn[aria-pressed="true"] {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.more-btn:disabled { opacity: .45; cursor: default; }

/* «Глагол N из M» и переключатель групп ar / er / ir — одной строкой над карточкой. */
.practice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 8px;
}

.practice-row .round-info { margin: 0 4px; }

.endings { display: flex; gap: 4px; }

.endings__item {
  min-width: 46px;
  min-height: 36px;
  padding: 0 8px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.endings__item[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

/* Карточка глагола крупнее: выше, текст больше; низ карточки прижат книзу. */
.phrase-card--verb {
  display: flex;
  flex-direction: column;
  min-height: 220px;
}

.phrase-card--verb .phrase-card__es { margin-top: 10px; font-size: 32px; }
.phrase-card--verb .phrase-card__ru { font-size: 17px; }
.phrase-card--verb .phrase-card__foot { margin-top: auto; padding-top: 14px; }

/* Маленький кружок таймера справа в шапке (вместо шестерёнки, только в «Практике»).
   Отрицательные поля — чтобы шапка не становилась выше строки с кнопкой темы. */
.timer {
  position: relative;
  flex: none;
  width: 54px;
  height: 54px;
  margin: -5px 0;
}

.timer[hidden] { display: none; }

.timer__ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer__track,
.timer__bar {
  fill: none;
  stroke-width: 10;
}

.timer__track { stroke: var(--accent-soft); }

.timer__bar {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .25s linear;
}

.timer[data-state="running"] .timer__bar { stroke: var(--sun); }

.timer__value {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.timer[data-state="paused"] .timer__value { color: var(--muted); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 20;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  animation: toast-in .25s ease-out;
}

/* Своя анимация: общая appear затирает translateX(-50%) и тост на миг уезжает вправо. */
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Профиль ---------- */

.profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  border-top: 4px solid var(--accent);
}

.profile__avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 24px;
  font-weight: 800;
}

.profile__info { min-width: 0; }

.profile__nick,
.profile__email {
  margin: 0;
  overflow-wrap: anywhere;
}

.profile__nick {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1.2;
}

.profile__email {
  margin-top: 2px;
  font-size: 14px;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.stat { padding: 18px 14px; }

.stat__value {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.02em;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}

.stat__label {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.3;
  color: var(--muted);
}

/* ---------- Настройки ---------- */

.page-title {
  margin: 4px 4px 12px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.settings-list { overflow: hidden; }

.setting + .setting { border-top: 1px solid var(--border); }

.setting__row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 0 16px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.setting__row:active { background: var(--accent-soft); }

.setting__row:focus-visible { outline-offset: -3px; }

.setting__label { flex: none; }

.setting__value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-weight: 500;
  font-size: 15px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setting__chevron {
  flex: none;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform .2s;
}

.setting__row[aria-expanded="true"] .setting__chevron { transform: rotate(45deg); }

.setting__row--danger { color: var(--danger); }

.setting__body { padding-top: 0; }

.field__status {
  font-size: 12px;
  color: var(--muted);
}

.field__status[data-state="free"] { color: var(--accent-strong); font-weight: 600; }

.field__status[data-state="taken"],
.field__status[data-state="invalid"] { color: var(--danger); }

.btn-danger {
  min-height: 50px;
  border: 0;
  border-radius: 14px;
  background: var(--danger);
  color: var(--on-danger);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn-danger:disabled { opacity: .6; cursor: default; }

/* ---------- Окно выбора времени и карандаш у таймера ---------- */

.dialog {
  width: min(calc(100% - 32px), 400px);
  padding: 0;
  color: var(--text);
}

.dialog::backdrop { background: rgba(5, 12, 20, .55); }

.dialog[open] { animation: appear .2s ease-out; }

/* Кнопка выбора времени накрывает весь кружок */
.timer__edit {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.timer__edit:focus-visible { outline-offset: 2px; }

/* ---------- Список: «Глаголы для практики» ---------- */

.cv { padding: 0; overflow: hidden; border-top: 4px solid var(--accent); }

.cv__head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 12px;
  width: 100%;
  min-height: 64px;
  padding: 14px 16px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cv__title { font-size: 17px; font-weight: 800; }
.cv__summary { grid-column: 1; font-size: 13px; color: var(--muted); }
.cv__chevron { grid-row: 1 / span 2; grid-column: 2; width: 22px; height: 22px; color: var(--accent-strong); transition: transform .2s; }
.cv__head[aria-expanded="true"] .cv__chevron { transform: rotate(180deg); }

.cv__body { padding: 0 16px 16px; }

.cv__tools {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.cv__hint { flex: 1; margin: 0; font-size: 13px; color: var(--muted); }
.cv__tools .btn-ghost { flex: none; }

.cv__list { margin: 0; padding: 0; list-style: none; }
.cv__list li + li { border-top: 1px solid var(--border); }

.cv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 6px 0;
  cursor: pointer;
}

.cv-item__box {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent-strong);
  cursor: pointer;
}

.cv-item__text { flex: 1; min-width: 0; display: grid; }
.cv-item__es { font-weight: 750; overflow-wrap: anywhere; }
.cv-item__ru { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }

.cv-item__time {
  flex: none;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* «Практиковать»: какой из двух списков крутится в практике */
.cv + .cv { margin-top: 12px; }
.cv__use { padding: 0 16px 14px; }
.cv__use-btn { width: 100%; }
.cv__use-btn.is-active:disabled {
  opacity: 1;
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-text);
}

/* Свой список внутри карточки: форма и фразы без второй рамки вокруг формы */
#own-section .form.card { border: 0; box-shadow: none; padding: 0; background: none; }
#own-section .list-head { margin-top: 20px; }

/* Лица в практике своего списка — видны, но не нажимаются */
.person-chip:disabled { opacity: .45; cursor: default; }

/* Прежние разделы — видны, но пока не нажимаются */
.legacy-title { margin-top: 24px; }
.legacy { opacity: .45; pointer-events: none; user-select: none; }

/* -ar / -er / -ir без отмеченных глаголов */
.endings__item:disabled { opacity: .4; cursor: default; }

/* ---------- Список: выбор встроенный / свой ---------- */

.sources {
  display: grid;
  gap: 10px;
}

#own-section { margin-top: 14px; }

/* Блок — горизонтальный: слева название и пояснение, справа кнопка. */
.source {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto; /* текст сжимается, а не выталкивает карточку за экран */
  grid-template-areas: "title btn" "text btn";
  align-items: center;
  gap: 2px 12px;
  padding: 14px 12px 14px 16px;
  border: 1.5px solid var(--border);
  transition: border-color .2s, background-color .2s;
}

.source--active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.source__title {
  grid-area: title;
  margin: 0;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.25;
}

.source__text {
  grid-area: text;
  align-self: start;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--muted);
}

.source__btn {
  grid-area: btn;
  width: clamp(100px, 32vw, 132px);
  min-height: 44px;
  padding: 4px 6px;
  font-size: clamp(11.5px, 3.6vw, 13px);
  line-height: 1.2;
}

/* «Личные местоимения»: заголовок со стрелкой и раскрывающийся выбор времён. */
.source--tenses { grid-template-areas: "title btn" "text btn" "tenses tenses"; }

.source__head {
  grid-area: title;
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.tenses-toggle {
  width: 44px;
  height: 44px;
  margin: -10px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.tenses-toggle svg { width: 20px; height: 20px; transition: transform .2s; }
.tenses-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

.tenses {
  grid-area: tenses;
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.tenses[hidden] { display: none; }

.tenses__title {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.tenses__title + .tense { margin-top: -4px; }

.tense {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}

.tense__info { margin: 0; min-width: 0; font-size: 14px; line-height: 1.3; }
.tense__name { font-weight: 700; }
.tense__example { color: var(--muted); font-size: 12.5px; }

.switch.switch--sm {
  width: 64px;
  height: 36px;
  padding: 0;
}

.switch.switch--sm .switch__knob { top: 4px; left: 4px; width: 28px; height: 28px; }
.switch.switch--sm[aria-checked="true"] .switch__knob { transform: translateX(28px); }
.switch.switch--sm[aria-checked="false"] { filter: grayscale(1); opacity: .6; }
.switch.switch--sm[aria-disabled="true"] { cursor: not-allowed; opacity: 1; }

/* Маленький тумблер (времена и местоимения в блоках «Местоимения + …»); зона нажатия — 44px по высоте. */
.switch.switch--xs { width: 40px; height: 24px; padding: 0; }
.switch.switch--xs::after { content: ""; position: absolute; inset: -10px -4px; }
.switch.switch--xs .switch__knob { top: 3px; left: 3px; width: 18px; height: 18px; }
.switch.switch--xs[aria-checked="true"] .switch__knob { transform: translateX(16px); }
.switch.switch--xs[aria-checked="false"] { filter: grayscale(1); opacity: .6; }
.switch.switch--xs[aria-disabled="true"] { cursor: not-allowed; opacity: 1; }

/* Ударная гласная: бледно-жёлтый штрих над буквой (сама буква не меняется). */
.stress { position: relative; }

.stress::after {
  content: "\00B4";
  position: absolute;
  left: 50%;
  top: .1em;
  transform: translateX(-35%);
  font-weight: 400;
  line-height: 1;
  color: var(--stress);
  pointer-events: none;
}

/* Изменяемая часть глагола. */
.ending {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.source--active .source__btn:disabled {
  opacity: 1;
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-text);
}

/* ---------- Профиль: уровни ---------- */

.section-title {
  margin: 24px 4px 10px;
  font-size: 18px;
  font-weight: 700;
}

/* Уровни — одной карточкой в рамке цвета флага: заголовок с галочкой, под ним уровни через линии. */
.levels-box {
  margin-top: 24px;
  overflow: hidden;
  background: var(--surface);
  border: 2px solid var(--flag-celeste);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 6px 6px 6px 16px;
}

.section-head .section-title { margin: 0; }

.levels {
  display: grid;
  border-top: 1px solid var(--border);
}

.level + .level { border-top: 1px solid var(--border); }

.level {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
}

.level__info { flex: 1; min-width: 0; }

.level__title,
.level__meta { margin: 0; }

.level__title { font-weight: 700; line-height: 1.25; }

.level__meta {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}

/* Переключатель-«таблетка»: выключен — кружок слева, подпись справа;
   включён — кружок справа (ярче), подпись слева. */
.switch {
  --g1: #4fb0c8;
  --g2: #4a7fc0;
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 116px;
  height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--g1), var(--g2));
  color: #fff;
  font: inherit;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25);
  transition: filter .2s;
}

.switch__label { position: relative; z-index: 1; }

.switch__knob {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
  transition: transform .2s;
}

.switch[aria-checked="true"] { justify-content: flex-start; }

.switch[aria-checked="true"] .switch__knob {
  background: rgba(255, 255, 255, .85);
  transform: translateX(70px);
}

.switch:disabled { cursor: progress; filter: saturate(.7); }

.switch[aria-disabled="true"] { cursor: not-allowed; opacity: .55; }

.switch:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 2px; }

.level--closed .level__title { color: var(--muted); }

.lv-a00 { --g1: #48b99a; --g2: #2f9a83; }
.lv-a0 { --g1: #45c2bd; --g2: #3aa0b4; }
.lv-a1 { --g1: #4fb3c9; --g2: #4a80c2; }
.lv-a2 { --g1: #6f92f0; --g2: #5a6fe2; }
.lv-b1 { --g1: #9b92e3; --g2: #7d66e6; }
.lv-b2 { --g1: #d493f0; --g2: #a886e0; }
.lv-c1 { --g1: #e6a6d8; --g2: #c97bc6; }

/* ---------- Достижения (рейтинг в профиле) ---------- */

.leaders { padding: 6px; }

.leaders__list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.leader {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 12px;
  font-variant-numeric: tabular-nums;
}

.leader--me { background: var(--accent-soft); }

.leader__place { font-weight: 700; color: var(--muted); text-align: center; }
.leader__place--medal { font-size: 20px; }
.leader__nick { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.leader__phrases { font-size: 14px; color: var(--muted); text-align: right; }
.leader__time { min-width: 64px; font-weight: 700; color: var(--accent-strong); text-align: right; white-space: nowrap; }

.leader-gap { padding: 0 10px; color: var(--muted); text-align: center; line-height: 1; }

.leaders__status {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 18px 10px;
  text-align: center;
  color: var(--muted);
}

.leaders__status p { margin: 0; }
.leaders__status .btn-secondary { padding: 0 24px; }

/* ---------- Плашка «Вышла новая версия» (update.js) ---------- */

.update-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 8px 8px 8px 16px;
  border-radius: 14px;
  background: var(--sun);
  color: #3d2a00;
  font-size: 15px;
  font-weight: 700;
  animation: appear .25s ease-out;
}

.update-bar__text { flex: 1; min-width: 0; }

.update-bar__btn {
  flex: none;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: #3d2a00;
  color: #fff;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.update-bar__btn:disabled { opacity: .7; cursor: progress; }

.update-bar__btn:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 2px; }

/* Во время отсчёта таймера не отвлекаем — покажется после паузы. */
.practice-running .update-bar { display: none; }
