:root {
  --bg: #0e1030;
  --surface: #1b1e42;
  --surface-2: #2a2e54;
  --face: #3b4066;
  --border: #2e3360;
  --text: #f2f3fa;
  --muted: #a6adcd;
  --primary: #7b86ff;
  --primary-dark: #5c68ee;
  --primary-soft: #262b57;
  --lavender: #b9b6ff;
  --green: #37d18e;
  --green-soft: #16342a;
  --red: #ff5f61;
  --red-soft: #3a1b25;
  --amber: #f5a623;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 34px rgba(0, 0, 0, 0.45);
  --radius: 14px;

  /* производные, чтобы обе темы жили на одних правилах */
  --hover: #353a68;
  --hover-border: #4b5187;
  --face-text: var(--text);
  --face-sub: #d7dbf0;
  --face-divider: rgba(255, 255, 255, 0.25);
  --track-off: #4a4f7d;
  --track-on: #4255ff;
  --seg-fill: #8b93bd;
  --ok-text: #6ee7b5;
  --no-text: #ff9b9d;
  --on-green: #06301f;
  --disabled-bg: #3d4372;
  --disabled-text: #9aa1c4;
  --danger-border: #59283a;
  --badge-rus: #6fd3ff;
  --badge-eng: #f08a48;
  --backdrop: rgba(4, 5, 20, 0.65);
  --dot: var(--lavender);
  --dot-hover: #d8d6ff;
  --pinyin: #b9b6ff;
}

/* ---------- Светлая тема ---------- */
:root[data-theme='light'] {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef0f8;
  --face: #ffffff;
  --border: #e1e5f0;
  --text: #1f2333;
  --muted: #6b7286;
  --primary: #4255ff;
  --primary-dark: #2f40e0;
  --primary-soft: #e8ebff;
  --lavender: #ddd9ff;
  --green: #12a668;
  --green-soft: #e6f7ef;
  --red: #e5484d;
  --red-soft: #fdecec;
  --amber: #cf7a1c;
  --shadow: 0 2px 8px rgba(30, 45, 80, 0.08);
  --shadow-lg: 0 12px 30px rgba(30, 45, 80, 0.16);

  --hover: #e3e7f4;
  --hover-border: #b9c1de;
  --face-text: #1f2333;
  --face-sub: #4a5163;
  --face-divider: rgba(20, 25, 50, 0.15);
  --track-off: #c3c8dc;
  --track-on: #4255ff;
  --seg-fill: #9aa2c2;
  --ok-text: #0c7a47;
  --no-text: #b3262a;
  --on-green: #ffffff;
  --disabled-bg: #c8cde0;
  --disabled-text: #7d849b;
  --danger-border: #f0c4c6;
  --badge-rus: #1a7fa8;
  --badge-eng: #e8742e;
  --backdrop: rgba(20, 28, 55, 0.45);
  --dot: #8f8bd8;
  --dot-hover: #6f6ac4;
  --pinyin: #5a54c4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
    Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Шапка ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
}
/* «Панда» — тёмно-графитовым (в тёмной теме — светлым, иначе не видно),
   «вед» — оранжевым из логотипа */
.logo-panda { color: #f2f3fa; }
:root[data-theme='light'] .logo-panda { color: #2b2f3a; }
.logo-ved { color: #e8742e; }
.logo-icon {
  height: 38px;
  width: 38px;
  display: block;
}
.topnav { display: flex; gap: 8px; align-items: center; }
.nav-link {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
}
.nav-link:hover { background: var(--bg); color: var(--text); }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 16px;
  line-height: 1;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.theme-toggle:hover { background: var(--hover); }
/* Тот же размер, что у иконки аккаунта рядом, — кружки читаются как пара. */
.theme-toggle svg { width: 19px; height: 19px; display: block; }
.nav-cta { background: var(--primary); color: #fff; }
.nav-cta:hover { background: var(--primary-dark); color: #fff; }

/* Кнопка «+» с выпадающим меню */
.create-wrap { position: relative; }
.create-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.create-btn:hover { background: var(--primary-dark); }
.create-btn.is-open { transform: rotate(45deg); }

.create-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  min-width: 210px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}
.create-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.create-item:hover { background: var(--surface-2); }
.create-item.danger { color: var(--red); }
.create-item.danger .ico { color: var(--red); }

/* Меню «Другое» на странице набора */
.menu-wrap { position: relative; }
.more-btn { font-size: 18px; line-height: 1; }
.more-menu { top: calc(100% + 8px); }
.create-item .ico {
  display: inline-flex;
  width: 22px;
  justify-content: center;
  color: var(--muted); /* серые контурные иконки — как папки в панели слева */
  flex: none;
}
.create-item .ico svg { width: 20px; height: 20px; display: block; }

.app {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

/* На большом мониторе даём списку больше места — влезает лишняя колонка
   карточек. Дальше не расширяем: строки текста станут неудобно длинными. */
@media (min-width: 1600px) {
  .app { max-width: 1200px; }
}

/* ---------- Боковая панель с папками ---------- */
.sidebar { display: none; }

@media (min-width: 760px) {
  /* Отступ на body: и шапка, и подвал сдвигаются, содержимое остаётся по центру */
  body { padding-left: 72px; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 55;
    width: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 84px 0 20px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
  }
}

.side-list { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.side-sep { width: 34px; height: 1px; background: var(--border); margin: 4px 0; flex: none; }
.side-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: none;
  border-radius: 12px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.side-btn svg { width: 22px; height: 22px; display: block; }
.side-btn:hover { background: var(--surface-2); color: var(--text); }
.side-btn.is-on { background: var(--primary-soft); color: var(--primary); }

/* Подсказка с названием папки. Живёт в <body>, иначе её обрезает
   прокручиваемая панель. */
.side-tip {
  position: fixed;
  z-index: 80;
  transform: translateY(-50%);
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #1c1f33;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
}
.side-tip.is-on { opacity: 1; }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ---------- Типографика и общие ---------- */
h1 { font-size: 28px; margin: 0 0 4px; }
h2 { font-size: 20px; margin: 28px 0 14px; }
.subtitle { color: var(--muted); margin: 0 0 22px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
/* Ряд кнопок вверху библиотеки. Снизу отступ такой же, как зазор между
   кнопками внутри ряда: на телефоне они переносятся на отдельные строки,
   и без этого нижняя кнопка липла к следующему блоку. */
.lib-actions { margin-bottom: 12px; }
.spacer { flex: 1; }

/* ---------- Кнопки ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { background: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: var(--disabled-bg); border-color: var(--disabled-bg); color: var(--disabled-text); cursor: not-allowed; }
.btn-danger { color: var(--red); border-color: var(--danger-border); }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- Поля ввода ---------- */
input[type='checkbox'] { accent-color: var(--primary); width: 18px; height: 18px; }
input[type='number'] {
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  background: var(--surface-2);
  color: var(--text);
}
input[type='text'], input[type='number'], input[type='password'], textarea, select {
  font: inherit;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  background: var(--surface);
  color: var(--text);
}
input[type='text']:focus, input[type='password']:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea { resize: vertical; min-height: 80px; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }

/* ---------- Главная ---------- */
.continue-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.continue-main { flex: 1; min-width: 0; }
.continue-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; }
.continue-card h3 { margin: 0 0 6px; font-size: 22px; }
.continue-card .desc { color: var(--muted); margin: 0; font-size: 14px; }
.continue-art { font-size: 56px; line-height: 1; opacity: 0.5; flex: none; }

.recent-list { display: flex; flex-direction: column; gap: 10px; }
.recent-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}
.recent-row:hover { border-color: var(--hover-border); }
.recent-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary); /* синяя контурная иконка набора */
  font-size: 15px;
  flex: none;
}
.recent-ico svg { width: 18px; height: 18px; display: block; }

/* Контурная папка — как в панели слева, но синеватая */
.folder-ico {
  display: inline-flex;
  align-items: center;
  flex: none;
  color: var(--primary);
  opacity: 0.85;
}
.folder-ico svg { width: 16px; height: 16px; display: block; }
.meta-folder { display: inline-flex; align-items: center; gap: 6px; }
.crumb .folder-ico svg { width: 15px; height: 15px; }
.lib-folder .folder-ico svg { width: 18px; height: 18px; }

/* Кнопка с контурной иконкой набора */
.btn-with-ico { display: inline-flex; align-items: center; gap: 8px; }
.btn-ico { display: inline-flex; flex: none; }
.btn-ico svg { width: 16px; height: 16px; display: block; }
.mode-btn .ico svg { width: 15px; height: 15px; display: block; }
.recent-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.recent-title { font-weight: 700; font-size: 15px; }
.recent-sub { color: var(--muted); font-size: 13px; }
.lang-badge.inline { position: static; top: auto; right: auto; }

@media (max-width: 560px) {
  .continue-art { display: none; }
}

/* ---------- Библиотека: поиск и папки ---------- */
.lib-tools { margin: 20px 0 12px; }
.lib-tools-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.lib-tabs { margin: 18px 0 4px; }

/* Поле «Найти карточки» с лупой */
.search-box { position: relative; flex: 1; min-width: 240px; }
.search-box input {
  width: 100%;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  padding: 14px 48px 14px 18px;
  background: var(--surface-2);
  color: var(--text);
}
.search-box input::placeholder { color: var(--muted); font-weight: 600; }
.search-box input:focus { outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.search-lens {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  display: inline-flex;
}
.search-lens svg { width: 18px; height: 18px; display: block; }

/* Кнопка и меню сортировки */
.sort-btn { border-radius: 999px; background: var(--surface-2); border-color: transparent; color: var(--primary); }
.sort-menu { left: 0; right: auto; top: calc(100% + 8px); }
.create-item.is-current { color: var(--primary); }

/* Вкладка «Папки»: широкие карточки */
.folders-view { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.fold-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, transform 0.1s;
}
.fold-card:hover { border-color: var(--hover-border); transform: translateY(-1px); }
.fold-count { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.fold-name { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 800; }
.fold-name .folder-ico svg { width: 20px; height: 20px; }
.lib-search {
  width: 100%;
  font: inherit;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--surface);
  color: var(--text);
}
.lib-search::placeholder { color: var(--muted); }
.lib-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.lib-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.chip:hover { color: var(--text); }
.chip.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }

.lib-folder {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  margin: 24px 0 12px;
}
.lib-folder:first-child { margin-top: 6px; }
.lib-folder .ico { font-size: 15px; }
.lib-folder-count { font-size: 13px; font-weight: 500; color: var(--muted); }
.folder-empty {
  font-size: 14px;
  margin: 0 0 6px;
  padding: 16px 18px;
  border: 1px dashed var(--border);
  border-radius: 12px;
}

/* ---------- Страница папки ---------- */
.fld-head { margin-bottom: 20px; }
.fld-title-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.fld-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
}
.fld-icon svg { width: 28px; height: 28px; display: block; }
.fld-title { font-size: 30px; font-weight: 800; margin: 0; }

.fld-tools { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.fld-search { flex: 1; min-width: 220px; }

.fld-list { display: flex; flex-direction: column; }
.fld-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 8px;
  border-bottom: 1px solid var(--border);
}
.fld-row:last-child { border-bottom: none; }
.fld-row-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  padding: 12px 10px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
}
.fld-row-main:hover { background: var(--surface-2); }

/* Теги в папке */
.fld-tags { margin: 2px 0 16px; }
.chip-x { margin-left: 8px; opacity: 0.7; }
.chip-x:hover { opacity: 1; }
.chip-add { font-size: 15px; padding: 5px 12px; }
.tag-suggest-wrap { width: 100%; margin-top: 6px; }
.tag-suggest-title { font-size: 13px; font-weight: 700; margin: 10px 0 8px; }
.tag-suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-dialog input.folder-input { text-align: left; font-size: 16px; }

a.lib-folder { text-decoration: none; color: var(--text); }
a.lib-folder:hover .lib-folder-count { color: var(--primary); }

/* ---------- Карточки наборов в библиотеке ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.set-card .hits { font-size: 13px; color: var(--primary); margin: 8px 0 0; font-weight: 600; }

/* Языковая пара — в правом верхнем углу карточки набора */
.lang-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid currentColor;
}
.lang-badge.ch-rus { color: var(--badge-rus); }
.lang-badge.ch-eng { color: var(--badge-eng); }
.set-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
}
.set-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.set-card h3 { margin: 0 0 6px; font-size: 17px; }
.set-card .count {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
  align-self: flex-start;
}
.set-card .desc { color: var(--muted); font-size: 14px; flex: 1; }
.set-card .card-actions { display: flex; gap: 8px; margin-top: 14px; }

.empty {
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
}

/* ---------- Редактор ---------- */
.editor-head {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap; /* на телефоне «Создать» переносится, а не вылезает за экран */
  margin-bottom: 20px;
}
.editor-head h1 { flex: 1 1 auto; min-width: 0; }
@media (max-width: 520px) {
  .editor-head h1 { font-size: 20px; order: -1; width: 100%; }
  .editor-head .spacer { flex: 1; }
}
.card-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-row .card-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 12px;
}
.card-row .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card-row .fields-pinyin { margin-top: 12px; max-width: calc(50% - 7px); }

/* Чтение под иероглифами */
/* Пиньинь — обычным цветом текста, а не выделенным. В тёмной теме это
   светлый цвет: буквальный чёрный там был бы не виден.
   В словаре у чтений свой цвет — там он отделяет их от русского текста. */
.pinyin { color: var(--text); font-size: 15px; font-weight: 500; letter-spacing: 0.2px; margin-top: 4px; }
.pinyin-lg { font-size: 20px; }
.save-state { color: var(--muted); font-size: 13px; }

/* ---------- Модальное окно ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
}
.modal h2 { margin-top: 0; }
.modal.modal-sm { max-width: 460px; padding: 32px 28px 24px; }

/* Окно создания папки */
.folder-dialog { display: flex; flex-direction: column; align-items: center; }
.folder-icon { color: var(--muted); margin-bottom: 20px; }
.folder-icon svg { width: 46px; height: 46px; display: block; }
input.folder-input {
  width: 100%;
  font: inherit;
  font-size: 19px;
  font-weight: 600;
  text-align: center;
  border: none;
  border-radius: 12px;
  padding: 16px 18px;
  background: var(--surface-2);
  color: var(--text);
}
input.folder-input::placeholder { color: var(--muted); font-weight: 600; }
input.folder-input:focus { outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.folder-hint { color: var(--red); font-size: 13px; font-weight: 600; margin: 10px 0 0; min-height: 18px; }
.folder-actions { display: flex; justify-content: flex-end; gap: 10px; width: 100%; margin-top: 16px; }
.folder-actions .btn { border-radius: 999px; padding: 11px 22px; }

/* ---------- Страница модуля: шапка ---------- */
.set-head { margin-bottom: 22px; }
.set-head-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: 8px;
}
.crumb:hover { color: var(--text); }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  background: var(--surface-2);
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}
.pill:hover { background: var(--hover); }
.pill-icon { padding: 10px 12px; }

/* Кнопка-закладка: сохранить набор в папку */
.bookmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: none;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.bookmark svg { width: 18px; height: 18px; display: block; fill: none; }
.bookmark:hover { color: var(--text); border-color: var(--hover-border); }
.bookmark.is-on { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.bookmark.is-on svg { fill: currentColor; }

/* Диалог выбора папки */
.folder-list { display: flex; flex-direction: column; gap: 10px; max-height: 46vh; overflow: auto; }
.folder-rows { display: flex; flex-direction: column; gap: 10px; }
.folder-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.folder-row:hover { background: var(--hover); }
.folder-row.is-on { background: var(--primary-soft); color: var(--primary); }
.folder-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: none;
  border: 2px solid var(--muted);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}
.folder-row.is-on .folder-mark { border-color: var(--primary); background: var(--primary); color: #fff; }
.folder-add .folder-mark { border: none; font-size: 20px; font-weight: 400; }
.folder-row.is-loaded { opacity: 0.75; cursor: default; }
.loaded-label {
  align-self: flex-start;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  flex: none;
}
.folder-row.is-loaded .folder-mark { border-color: var(--green); background: var(--green); color: #fff; }
.preview-btn { flex: none; }
.preview-btn svg { width: 18px; height: 18px; display: block; }
.folder-row.is-loaded .preview-btn { pointer-events: auto; }
.preview-list { max-height: 48vh; overflow: auto; }
.prev-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.prev-row:last-child { border-bottom: none; }
.prev-term { flex: 1; min-width: 0; }
.prev-def { flex: 1.4; color: var(--muted); }
.folder-new { display: none; }
.folder-new.is-open { display: block; }
.set-title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.4px;
  margin: 0 0 6px;
}
.set-sub { color: var(--muted); margin: 0; font-size: 14px; }

/* ---------- Сетка режимов ---------- */
.modes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 22px 0 26px;
}
/* Содержимое прижато к левому краю, а не отцентровано: при центрировании
   каждая плитка ставила иконку по своей ширине подписи, и в столбце иконки
   стояли вразнобой. Слева они выстраиваются в ровную линию, подписи тоже. */
.mode-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  background: var(--surface-2);
  border: none;
  border-radius: 12px;
  padding: 18px 16px;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  transition: background 0.15s, transform 0.1s;
}
.mode-btn:hover:not(:disabled) { background: var(--hover); transform: translateY(-1px); }
.mode-btn .ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: #fff;
  font-size: 14px;
  line-height: 1;
  flex: none;
}
.mode-btn:disabled { opacity: 0.45; cursor: not-allowed; }
/* Счётчик к повторению уводим к правому краю: иначе он висел бы вплотную
   к подписи и ломал ровную колонку из иконок и слов. */
.mode-btn .soon {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---------- Просмотрщик карточек ---------- */
.fc { display: flex; flex-direction: column; }
.ico-svg { display: inline-flex; flex: none; }
.ico-svg svg { width: 18px; height: 18px; display: block; }
/* Запасной размер для иконок, вставленных прямо в элемент вместо текстового
   знака (✕, ⋯, ◀, ▶, ✓): 1em — тот же размер, что был у глифа, и он
   по-прежнему настраивается через font-size самого элемента. Любое правило
   с классом (.ico-svg svg, .account-btn svg и т. п.) перебивает это
   по приоритету, поэтому уже настроенные иконки не съезжают. */
button svg, a svg, .mark svg, .chip-x svg, .folder-mark svg { width: 1em; height: 1em; display: block; }
/* Крупная иконка на итоговых экранах — там, где раньше стояло эмодзи
   размером со шрифт заголовка. Обводку делаем тоньше: на таком размере
   штрих в 1.7 выглядел бы жирным. */
.big-ico { display: inline-flex; justify-content: center; }
.big-ico svg { width: 1em; height: 1em; stroke-width: 1.1; }

/* Шапка и бейджи — только в полноэкранном режиме */
.fc-fs-head, .fc-badges, .fc-close { display: none; }

.fc-shell {
  position: relative;
  background: var(--face);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 440px;
}
.fc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; /* на сверхузких экранах иконки переносятся, а не режутся */
  row-gap: 4px;
  padding: 14px 18px;
}
.fc-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: none;
  border: none;
  padding: 4px 6px;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.9;
}
.fc-link:hover { opacity: 1; text-decoration: underline; }
.fc-speak {
  display: inline-flex;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  opacity: 0.75;
  padding: 4px 6px;
  border-radius: 8px;
}
.fc-speak:hover { opacity: 1; }
/* Словарь, анимация черт, озвучка и звезда — по ним попадают пальцем,
   поэтому крупнее прочих иконок интерфейса. */
.fc-speak svg { width: 27px; height: 27px; display: block; flex: none; }

.fc-face {
  color: var(--face-text);
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  padding: 28px 32px 48px;
  font-size: 42px;
  font-weight: 500;
  line-height: 1.35;
  /* Оболочка карточки обрезает содержимое, а крупный шрифт легко перерастает
     её высоту на длинном определении — пусть лучше прокручивается. */
  overflow-y: auto;
  /* Обязательно вместе с прокруткой: без этого браузер считает горизонтальное
     движение пальца попыткой прокрутить это поле, забирает жест себе — и свайп
     «знаю / ещё изучаю» перестаёт срабатывать. pan-y оставляет браузеру только
     вертикаль, горизонталь достаётся нам. */
  touch-action: pan-y;
  cursor: pointer;
  user-select: none;
}
.fc-hint-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--pinyin);
  letter-spacing: 1px;
}

.fc-tip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--lavender);
  color: #1b1c3d;
  font-size: 14px;
  font-weight: 600;
  padding: 14px 16px;
}
/* Внутри полосы лежит кнопка «Показать подсказку». Цвет наследуем от полосы:
   у .fc-link он завязан на --text, а тот в тёмной теме почти белый и на
   лавандовом фоне не читался бы. */
.fc-tip .fc-link { color: inherit; opacity: 1; font-size: 15px; }
.fc-tip .fc-link:hover { text-decoration: underline; }

/* Нижняя панель управления */
.fc-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 4px 12px;
}
.fc-track { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--muted); }
.fc-center { flex: 1; display: flex; align-items: center; justify-content: center; gap: 14px; }
.fc-right { display: flex; align-items: center; gap: 6px; }

.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track {
  position: absolute;
  inset: 0;
  background: var(--track-off);
  border-radius: 999px;
  transition: background 0.15s;
  pointer-events: none;
}
.switch .track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
}
.switch input:checked + .track { background: var(--track-on); }
.switch input:checked + .track::after { transform: translateX(18px); }

.fc-grade {
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 74px;
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.fc-grade .mark { font-size: 18px; line-height: 1; }
.fc-grade .label { font-size: 14px; font-weight: 600; white-space: nowrap; }
.fc-grade.no { color: var(--red); }
.fc-grade.no:hover { background: var(--red-soft); border-color: var(--red); }
.fc-grade.yes { color: var(--green); }
.fc-grade.yes:hover { background: var(--green-soft); border-color: var(--green); }
.fc-count { font-size: 14px; font-weight: 700; color: var(--muted); min-width: 62px; text-align: center; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  font-size: 17px;
  cursor: pointer;
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-btn.is-on { background: var(--surface-2); color: var(--text); }

.fc-progress { height: 3px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.fc-progress > span { display: block; height: 100%; width: 0; background: var(--text); transition: width 0.25s; }

/* Навигация ◀▶ — видна, когда прогресс не отслеживается */
.fc .fc-grade, .fc.is-track .fc-nav { display: none; }
.fc.is-track .fc-grade { display: inline-flex; }
/* Сенсорный экран: оценка свайпом, кнопки «Знаю» / «Ещё изучаю» не нужны.
   Сроки возврата карточки перенесены в подсказку под ней (js/views/set.js). */
.fc.is-touch.is-track .fc-grade { display: none; }
/* Пиньинь на карточке — заодно с лицевой стороной. Правило точечное:
   тот же класс используют списки и словарь, их размер трогать незачем. */
.fc-face .pinyin { font-size: 22px; }
.fc-face .pinyin-lg { font-size: 30px; }
.fc-nav {
  width: 74px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}
.fc-nav:hover:not(:disabled) { background: var(--hover); }
.fc-nav:disabled { opacity: 0.35; cursor: not-allowed; }

/* Итоговый экран внутри карточки */
.fc-done { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.fc-done .big { font-size: 46px; }
.fc-done .score { font-size: 17px; color: var(--face-sub); font-weight: 600; }
.fc-done .row { justify-content: center; margin-top: 6px; }
/* На итоговом экране кнопки скрываем, но место сохраняем — панель не «прыгает». */
.fc.is-done .fc-center { visibility: hidden; }
.fc.is-done .fc-tip { display: none; }

/* ---------- Полноэкранный режим ---------- */
.fc-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--bg);
  padding: 18px 24px 20px;
  display: flex;
  overflow: auto;
}
.fc-overlay .fc { flex: 1; max-width: 1400px; margin: 0 auto; width: 100%; }
.fc.is-fs .fc-fs-head { display: block; text-align: center; margin-bottom: 18px; }
.fc.is-fs .fc-fs-head .num { font-size: 15px; font-weight: 800; }
.fc.is-fs .fc-fs-head .name { font-size: 13px; font-weight: 700; letter-spacing: 0.6px; color: var(--muted); margin-top: 4px; }
.fc.is-fs .fc-badges { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.fc.is-fs .fc-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 18px;
  right: 24px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}
.fc.is-fs .fc-close:hover { background: var(--hover); }
.fc.is-fs .fc-shell { flex: 1; }
.fc.is-fs .fc-count, .fc.is-fs .fc-btn-fs, .fc.is-fs .fc-btn-settings { display: none; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
}
/* Счётчики «знаю» и «ещё изучаю» — вдвое крупнее подписи рядом: во время
   занятия смотрят именно на них, а не на слова. */
.badge .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  height: 52px;
  padding: 0 16px;
  border-radius: 999px;
  border: 2px solid currentColor;
  font-size: 26px;
}
.badge.learning { color: var(--amber); }
.badge.known { color: var(--green); }

body.no-scroll { overflow: hidden; }

/* Окно «Как пишется» */
.play-ico { color: var(--primary); }
.play-ico svg { width: 17px; height: 17px; }
/* синяя иконка анимации в ряду серых */
.fc-anim { color: var(--primary); opacity: 0.9; }
.fc-anim:hover { opacity: 1; }
.hw-dialog { display: flex; flex-direction: column; align-items: center; }
.hw-dialog h2, .hw-dialog > .muted { align-self: flex-start; }
.hw-chips { justify-content: center; margin-bottom: 12px; }
.hw-chip { font-size: 17px; padding: 6px 14px; }
.hw-box {
  width: 240px;
  height: 240px;
  background: var(--surface-2);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none; /* обводка пальцем не должна прокручивать страницу */
}
.hw-box svg { display: block; }
.hw-status { font-size: 13px; margin: 10px 0 0; min-height: 18px; text-align: center; }

/* Свайп: рамка по периметру и надпись, проявляющиеся по мере движения пальца.
   Прозрачность обоих слоёв берётся из переменной --swipe, которую ставит
   js/views/set.js: 0 — палец только тронул карточку, 1 — отпустишь и
   засчитается. Поэтому чёткость надписи заодно показывает, хватит ли хода. */
/* Колода: под верхней карточкой виден край следующей. Когда верхняя улетает,
   нижняя поднимается на её место — смена видна по движению, а не только
   по смене текста. Стопка нарисована псевдоэлементом: лишнего узла в разметке
   не нужно, а «уехать» вместе с карточкой она не может — лежит на колоде. */
.fc-deck { position: relative; display: flex; flex-direction: column; min-height: 0; }
.fc-deck::before {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  top: 12px;
  bottom: -9px;
  background: var(--face);
  border: 1px solid var(--border);
  border-radius: 16px;
  z-index: 0;
}
.fc-deck > .fc-shell { position: relative; z-index: 1; }
.fc.is-fs .fc-deck { flex: 1; }
.fc.is-fs .fc-deck > .fc-shell { flex: 1; }
/* На итоговом экране колода ни к чему — карточек больше нет. */
.fc.is-done .fc-deck::before { display: none; }

/* Подсказка про свайп: всплывает над карточкой один раз за всё время
   и сама уходит через пять секунд. Касания не перехватывает — если человек
   сразу потянет карточку, подсказка не помешает. */
.fc-swipe-hint {
  position: absolute;
  left: 12px;
  right: 12px;
  /* Под рядом иконок, в пустой части карточки: снизу подсказка накрывала бы
     тумблеры и «Показать подсказку». */
  top: 56px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--text);
  color: var(--face);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.25s, transform 0.25s;
}
.fc-swipe-hint.is-on { opacity: 0.94; transform: translateY(0); }
.fc-swipe-hint .ico-svg { flex: none; }

.fc-shell { touch-action: pan-y; }
.fc-swipe {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  border: 3px solid currentColor;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none; /* слой лежит поверх карточки, но не мешает нажимать */
}
.fc-swipe span {
  padding: 0 28px;
  font-size: 40px;
  font-weight: 800;
  line-height: 1.1;
}
/* Надпись у того края, к которому тянут: «Знаю» справа, «Ещё изучаю» слева. */
.fc-swipe.yes { justify-content: flex-end; text-align: right; color: var(--green); }
.fc-swipe.no { justify-content: flex-start; color: var(--amber); }
.fc-shell.swipe-yes .fc-swipe.yes { opacity: var(--swipe, 0); }
.fc-shell.swipe-no .fc-swipe.no { opacity: var(--swipe, 0); }

/* «Выучено N из M» на карточках наборов */
.set-prog { margin-top: 10px; }
.set-prog-text { display: block; font-size: 13px; font-weight: 700; color: var(--green); margin-bottom: 5px; }
.set-prog-bar { height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.set-prog-bar > span { display: block; height: 100%; background: var(--green); }

/* Тумблеры в шапке карточки */
/* Ряд тумблеров внизу карточки, над полосой с подсказкой. */
.fc-toggles {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}
.fc-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.switch-sm { width: 32px; height: 18px; }
.switch-sm .track::after { width: 12px; height: 12px; }
.switch-sm input:checked + .track::after { transform: translateX(14px); }

/* Спрятанные иероглифы — мерцающие точки */
.fc-masked {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  min-height: 1.2em;
}
.fc-masked .dot {
  color: var(--dot);
  font-size: 1.5em;
  line-height: 0.8;
  animation: dot-blink 1.4s ease-in-out infinite;
}
.fc-masked .gap { width: 14px; }
.fc-masked:hover .dot { color: var(--dot-hover); }
@keyframes dot-blink {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

/* Звёздочка на карточке */
.fc-star {
  display: inline-flex;
  background: none;
  border: none;
  color: var(--text);
  line-height: 1;
  cursor: pointer;
  opacity: 0.75;
  padding: 4px 6px;
  border-radius: 8px;
  transition: opacity 0.15s, color 0.15s;
}
.fc-star svg { width: 27px; height: 27px; display: block; flex: none; }
.fc-star:hover { opacity: 1; }
.fc-star.is-on { opacity: 1; color: var(--amber); }
.fc-star.is-on svg path { fill: currentColor; }

/* Обе стороны карточки сразу */
.fc-split { width: 64px; height: 1px; background: var(--face-divider); }
.fc-back-text { font-size: 22px; color: var(--face-sub); }

/* ---------- Настройки просмотрщика ---------- */
.settings { position: relative; }
.settings-close {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}
.settings-close:hover { background: var(--hover); }
.settings-sep { height: 1px; background: var(--border); margin: 6px 0; }

.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }
.settings .settings-row + .settings-row { border-top: 1px solid var(--border); }
.settings .label { max-width: 74%; }

.switch.is-off { opacity: 0.4; }
.switch input:disabled { cursor: not-allowed; }

.link-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 0;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--red); display: block; }

.keys-list { display: none; padding: 4px 0 10px; }
.keys-list.is-open { display: block; }
.keys-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; font-size: 14px; }
.keys-row .key {
  min-width: 74px;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 13px;
  font-weight: 700;
}
.settings-row .label { font-weight: 600; font-size: 15px; }
.settings-row .label small { display: block; font-weight: 500; font-size: 13px; color: var(--muted); margin-top: 2px; }
.seg { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; flex: none; }
.seg button {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border: none;
  background: none;
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.seg button.is-on { background: var(--primary); color: #fff; }

/* ---------- Режим обучения (общий каркас) ---------- */
.study-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
/* Прогресс отрезками, как в оригинале */
.seg-track { flex: 1; display: flex; gap: 8px; }
.seg {
  flex: 1;
  height: 9px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.seg > span { display: block; height: 100%; width: 0; background: var(--seg-fill); transition: width 0.3s; }
.seg-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  flex: none;
}
.seg-num.done { background: var(--green); color: var(--on-green); }
.seg-num.left { background: var(--surface-2); color: var(--text); }

.prompt-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.choices-label { color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.choice.dim { opacity: 0.45; }
.choice.reveal {
  border: 2px dashed var(--green);
  color: var(--green);
  background: transparent;
  opacity: 1;
}
.unsure {
  display: block;
  margin: 16px 0 0 auto;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
}
.unsure:hover { text-decoration: underline; }

/* Нижняя полоса с результатом ответа */
.answer-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 16px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.answer-bar-text { font-size: 15px; font-weight: 600; }
.answer-bar.ok .answer-bar-text { color: var(--green); }
.answer-bar.no .answer-bar-text { color: var(--text); }

.study-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.prompt-label { color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.prompt-text { font-size: 26px; font-weight: 600; margin-bottom: 24px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 16px;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}
.choice:hover { border-color: var(--primary); background: var(--primary-soft); }
.choice.correct { border-color: var(--green); background: var(--green-soft); color: var(--ok-text); }
.choice.wrong { border-color: var(--red); background: var(--red-soft); color: var(--no-text); }
.choice:disabled { cursor: default; }
.choice .num {
  display: inline-block;
  width: 22px; height: 22px; line-height: 22px;
  text-align: center;
  background: var(--bg);
  border-radius: 6px;
  font-size: 12px; font-weight: 700;
  margin-right: 8px;
  color: var(--muted);
}

.answer-form { display: flex; gap: 10px; margin-top: 4px; }
.answer-form input { flex: 1; }
.feedback { margin-top: 18px; padding: 14px; border-radius: 10px; font-weight: 600; }
.feedback.ok { background: var(--green-soft); color: var(--ok-text); }
.feedback.no { background: var(--red-soft); color: var(--no-text); }
.feedback small { display: block; font-weight: 500; margin-top: 4px; color: inherit; opacity: 0.85; }

.result-screen { text-align: center; padding: 40px 20px; }
.result-screen .big { font-size: 56px; margin-bottom: 8px; }
.result-screen .score { font-size: 22px; font-weight: 700; margin-bottom: 18px; }

/* ---------- Тест ---------- */
.test-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 22px; }
.test-head-mid { flex: 1; text-align: center; }
.test-head-mid .num { font-size: 15px; font-weight: 800; }
.test-head-mid .name { font-size: 13px; font-weight: 700; letter-spacing: 0.6px; color: var(--muted); margin-top: 4px; }
.test-head-right { display: flex; align-items: center; gap: 8px; }
.test-head-right .icon-btn { text-decoration: none; }

.test-list { display: flex; flex-direction: column; gap: 18px; }
.test-q {
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 22px 24px;
}
.test-q.missed { border-color: var(--amber); }
.test-q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.test-q-num { font-size: 13px; font-weight: 600; color: var(--muted); }
.test-q-prompt { font-size: 22px; font-weight: 500; line-height: 1.35; margin-bottom: 26px; }
.test-q .choice.picked { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.test-q .choice:disabled { cursor: default; }
.test-q .verdict { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.test-q .verdict.ok { color: var(--green); }
.test-q .verdict.no { color: var(--amber); }
.test-answer { font-size: 15px; line-height: 1.6; }
.test-answer .right { color: var(--green); }

/* Блок «Подбор» внутри теста */
.mq { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.mq-rows { display: flex; flex-direction: column; gap: 10px; }
.mq-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: stretch;
  cursor: pointer;
}
.mq-term {
  display: flex;
  align-items: center;
  background: var(--surface);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
}
.mq-slot {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--muted);
}
.mq-slot.filled { border-style: solid; border-color: var(--primary); color: var(--text); }
.mq-row.over .mq-slot { border-color: var(--primary); background: var(--primary-soft); }
.mq-row.reviewed { cursor: default; }
.mq-row.reviewed.ok .mq-slot { border-color: var(--green); color: var(--green); }
.mq-row.reviewed.no .mq-slot { border-color: var(--red); color: var(--red); }
.mq-right { font-size: 13px; color: var(--green); }
.mq-pool { display: flex; flex-direction: column; gap: 10px; }
.mq-chip {
  font: inherit;
  font-size: 14px;
  text-align: left;
  background: var(--surface);
  color: var(--text);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: grab;
}
.mq-chip:hover { border-color: var(--hover-border); }
.mq-chip.picked { border-color: var(--primary); background: var(--primary-soft); }

@media (max-width: 720px) {
  .mq { grid-template-columns: 1fr; }
}

.test-foot { margin: 26px 0 10px; }
.test-foot-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.test-foot-text { font-size: 17px; font-weight: 700; }

.test-verdict { font-size: 26px; margin: 0 0 22px; }
.test-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-bottom: 8px; }
.test-stats { display: flex; align-items: center; gap: 22px; }
.donut { position: relative; width: 96px; height: 96px; flex: none; }
.donut svg { width: 100%; height: 100%; display: block; }
.donut-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
}
.test-stat-rows { display: flex; flex-direction: column; gap: 12px; }
.test-stat { display: flex; align-items: center; gap: 14px; font-size: 15px; font-weight: 700; }
.test-stat.ok { color: var(--green); }
.test-stat.no { color: var(--amber); }
.test-stat .pillnum {
  min-width: 42px;
  text-align: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
}
.test-next { display: flex; flex-direction: column; gap: 12px; }
.next-card {
  display: block;
  text-align: left;
  font: inherit;
  background: var(--surface-2);
  border: none;
  border-radius: 14px;
  padding: 16px 18px;
  cursor: pointer;
  text-decoration: none;
}
.next-card:hover { background: var(--hover); }
.next-card b { display: block; color: var(--primary); font-size: 15px; margin-bottom: 6px; }
.next-card small { color: var(--muted); font-size: 13px; line-height: 1.5; }

@media (max-width: 720px) {
  .test-summary { grid-template-columns: 1fr; }
}

/* ---------- Подбор (игра) ---------- */
.match-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding: 14px 20px 20px;
}
.match-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.match-title { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; }
/* Как у кнопок режимов: иконка не должна упираться в края плашки. */
.match-title .ico svg { width: 15px; height: 15px; display: block; }
.match-title .ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #06b6d4;
  color: #fff;
  font-size: 14px;
}
.match-timer { font-size: 15px; font-weight: 800; }
.match-overlay .icon-btn { text-decoration: none; }
.match-intro { text-align: center; margin: auto; max-width: 520px; }
.match-board {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;
  gap: 14px;
  min-height: 0;
}
.match-tile {
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 18px 14px;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: grab;
  user-select: none;
  font-weight: 500;
  transition: opacity 0.25s, transform 0.1s, border-color 0.1s, background 0.1s;
}
.match-tile:hover { border-color: var(--hover-border); }
.match-tile.selected { border-color: var(--primary); background: var(--primary-soft); }
.match-tile.dragging { opacity: 0.5; }
.match-tile.dropzone { border-color: var(--primary); border-style: dashed; }
.match-tile.wrong { animation: shake 0.3s; border-color: var(--red); }
/* Совпавшая пара гаснет, но место в сетке остаётся пустым — как в оригинале. */
.match-tile.gone { opacity: 0; transform: scale(0.9); pointer-events: none; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@media (max-width: 720px) {
  .modes { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  /* Шапка не должна выталкивать кнопку «+» за край экрана */
  .topbar { padding: 10px 14px; gap: 8px; }
  .logo { font-size: 17px; gap: 6px; }
  .logo-icon { width: 30px; height: 30px; }
  .topnav { gap: 4px; }
  .nav-link { padding: 6px 8px; font-size: 13px; }
  /* Те же пропорции, что на компьютере (36/36/40): два равных кружка и
     чуть более крупный акцентный «+». Раньше было 32/36/34 — у «аккаунта»
     правила не было вовсе, и три кнопки не совпадали.
     Кнопка аккаунта уменьшается ниже, рядом со своим базовым правилом. */
  .theme-toggle { width: 32px; height: 32px; }
  .theme-toggle svg { width: 17px; height: 17px; }
  .create-btn { width: 36px; height: 36px; font-size: 20px; }
}

@media (max-width: 620px) {
  /* Полноэкранная карточка на телефоне: крупные зоны нажатия */
  .fc-overlay { padding: 10px 10px 14px; }
  .fc.is-fs .fc-fs-head { margin-bottom: 10px; }
  .fc.is-fs .fc-shell { border-radius: 12px; }
  .fc-face { font-size: 45px; padding: 16px 14px 30px; }
  .fc-grade { height: 54px; flex: 1; min-width: 0; }
  .fc-grade .mark { font-size: 22px; }
  .fc-nav { height: 54px; flex: 1; }
  .fc-center { gap: 10px; }
  .fc-toggles { gap: 10px; }
  .fc-toggle { font-size: 12px; }
  .fc-tip { font-size: 12px; padding: 10px 10px; gap: 6px; }
}

@media (max-width: 560px) {
  .card-row .fields, .choices { grid-template-columns: 1fr; }
  h1 { font-size: 24px; }
  .app { padding: 20px 16px 48px; }
  .set-title { font-size: 26px; }
  .fc-shell { min-height: 340px; }
  .fc-face { font-size: 33px; padding: 20px 18px 36px; }
  .fc-controls { flex-wrap: wrap; row-gap: 10px; }
  .fc-center { order: -1; width: 100%; flex: 1 0 100%; }
  .fc-track { flex: 1; }
  .fc-center { gap: 8px; }
  .fc-grade { min-width: 0; padding: 0 10px; gap: 6px; }
  .fc-grade .label { font-size: 13px; }
  .fc-count { min-width: 0; }
  .fc-nav { width: 62px; }
  .fc-overlay { padding: 14px 14px 16px; }
  .fc.is-fs .fc-close { top: 10px; right: 12px; }
}

/* --- Словарь --- */
/* Ширина — от родителя, не от экрана. Было min(560px, 92vw): 92 % экрана
   не помещались внутрь модалки, у которой есть свои отступы, и правый край
   статьи вместе с кнопкой «Назад» уходил за границу телефона. */
.dict-dialog { width: 100%; max-width: 560px; }
.dict-dialog h2 { font-size: 26px; }
.dict-body {
  max-height: min(52vh, 460px);
  overflow-y: auto;
  padding-right: 6px;
  font-size: 15px;
  line-height: 1.55;
  /* Страховка: длинное слово или ссылка не должны распирать статью вширь. */
  overflow-wrap: break-word;
}
.dict-body p.dm { margin: 4px 0; }
.dict-body .dm2 { padding-left: 16px; }
.dict-body .dm3 { padding-left: 32px; }
.dict-body .dm4 { padding-left: 48px; }
.dict-body .dl { color: var(--muted); font-style: italic; }
.dict-body .dc { color: var(--pinyin); }
.dict-body .dex { color: var(--muted); }
.dict-body .dcom { color: var(--muted); }
.dict-body .dsec { font-weight: 700; }
.dict-body .dref {
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}
.dict-body .dref:hover { text-decoration-style: solid; }
.dict-body hr.dsep { border: 0; height: 1px; background: var(--border); margin: 12px 0; }

/* разбор по иероглифам и примеры в окне словаря */
.dict-sec {
  margin: 18px 0 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.dict-char-row { display: flex; align-items: baseline; gap: 12px; padding: 5px 0; }
.dict-char {
  flex: none;
  font-size: 24px;
  line-height: 1.2;
  background: none;
  border: 0;
  padding: 0;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}
.dict-char:hover { color: var(--primary); }
.dict-char-row .pinyin { flex: none; color: var(--pinyin); font-size: 14px; }
.dict-char-gloss { color: var(--muted); font-size: 14px; }
.dict-ex { padding: 6px 0; }
.dict-ex + .dict-ex { border-top: 1px dashed var(--border); }
.dict-ex-zh { font-size: 16px; }
.dict-ex-ru { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* проверка набора по словарю */
.chk-row { padding: 10px 0; border-top: 1px solid var(--border); }
.chk-row:first-child { border-top: 0; }
.chk-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.chk-term { font-size: 18px; font-weight: 600; }
.chk-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--amber);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}
.chk-detail { color: var(--muted); font-size: 14px; margin: 4px 0 6px; }
.chk-fix { font-size: 13px; padding: 5px 12px; }
.chk-done { color: var(--green); font-weight: 600; font-size: 14px; }
.chk-ok { color: var(--green); font-weight: 600; font-size: 16px; }

/* сгенерированный пиньинь у примеров */
.dict-body .dpy, .dict-ex-py { color: var(--pinyin); font-size: 13px; font-style: normal; }
.dict-ex-py { margin-top: 1px; }

/* ---------- Аккаунт ---------- */
.account-wrap { position: relative; }
.account-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  cursor: pointer;
  transition: background 0.15s;
}
.account-btn:hover { background: var(--hover); }
.account-btn.is-guest { background: var(--surface-2); color: var(--muted); }
.account-btn svg { width: 19px; height: 19px; display: block; }
/* На телефоне — заодно с кнопкой темы, до 32 px. Правило стоит здесь, а не
   в общем мобильном блоке выше: медиазапрос не повышает приоритет, и базовые
   36 px, объявленные строкой выше, перебили бы его. */
@media (max-width: 620px) {
  .account-btn { width: 32px; height: 32px; }
  .account-btn svg { width: 17px; height: 17px; }
}
.account-menu { min-width: 240px; }
.account-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.account-head .muted { font-size: 13px; }

/* Рассказ про набор «Основное» — на первой и пятой звёздочке */
.star-hint { text-align: center; }
.star-hint h2 { margin: 14px 0 10px; font-size: 20px; }
.star-hint p { margin: 0 0 10px; line-height: 1.55; }
.star-hint-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--amber);
}
.star-hint-ico svg { width: 26px; height: 26px; display: block; }

/* Предложение завести аккаунт — после того, как гость создал набор */
.signup-offer { text-align: center; }
.signup-offer h2 { margin: 14px 0 10px; font-size: 20px; }
.signup-offer p { margin: 0 0 10px; line-height: 1.55; }
.signup-offer-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
}
.signup-offer-ico svg { width: 26px; height: 26px; display: block; }
.signup-offer-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
}
.signup-offer-login { margin: 14px 0 0; }
.signup-offer-login .link-btn { font-size: 14px; }

.sync-status { font-size: 13px; color: var(--muted); white-space: nowrap; }
.sync-status.is-bad { color: var(--red); }

/* ---------- Вход и регистрация ---------- */
.auth-page { display: flex; justify-content: center; padding: 40px 0; }
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 26px; }
.auth-form { display: flex; flex-direction: column; gap: 4px; }
.auth-form .btn { margin-top: 8px; }
.auth-error {
  color: var(--red);
  font-size: 14px;
  margin: 6px 0 0;
}
.auth-note { font-size: 13px; margin: 18px 0 0; text-align: center; }
.auth-note a { color: var(--primary); }

@media (max-width: 620px) {
  .sync-status { display: none; }
}

/* подсказка под полем формы: что именно не так */
.field-note {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--red);
}
input.is-bad, input.is-bad:focus {
  border-color: var(--red);
  background: var(--red-soft);
}

/* ссылка «Забыли пароль?» и удачное сообщение в формах входа */
.auth-link {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px 0 0;
}
.auth-link:hover { color: var(--primary); }
.auth-ok {
  color: var(--green);
  font-size: 14px;
  line-height: 1.45;
  margin: 6px 0 0;
}

/* сроки повторения под кнопками «Ещё изучаю» и «Знаю» */
.fc-grade .label { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.fc-when { font-size: 11px; font-weight: 600; opacity: 0.65; }

/* «К повторению» на карточке набора */
.due-note { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.due-note.is-now { color: var(--green); font-weight: 600; }

/* окно «набор изменён на другом устройстве» */
.conflict-rows {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.conflict-row + .conflict-row { margin-top: 6px; }
.conflict-row { font-size: 14px; }
.conflict-actions { display: flex; flex-direction: column; gap: 8px; }

/* согласие при регистрации и страница политики */
.auth-agree { margin: 10px 0 2px; }
.agree-line { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.45; cursor: pointer; }
.agree-line input { margin-top: 2px; flex: none; }
.agree-line a { color: var(--primary); }

.doc { max-width: 720px; }
.doc h1 { font-size: 28px; margin: 0 0 6px; }
.doc-block { margin-top: 26px; }
.doc-block h2 { font-size: 17px; margin: 0 0 8px; }
.doc-block p { margin: 0 0 8px; line-height: 1.6; color: var(--text); }
/* ---------- «О проекте»: живые иллюстрации ---------- */
.about-lead { font-size: 15px; line-height: 1.6; }
.about-caption { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 8px 0 4px; text-align: center; }

/* Демонстрационная карточка — настоящая, её можно перевернуть */
.about-card {
  max-width: 380px;
  margin: 16px auto 4px;
  background: var(--face);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.about-card-top { display: flex; justify-content: flex-end; gap: 14px; padding: 12px 16px 0; color: var(--muted); }
.about-ico-blue { color: var(--primary); }
.about-card-face {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  padding: 10px 16px 18px;
}
.about-card-term { font-size: 46px; font-weight: 500; line-height: 1.2; }
.about-card-back { font-size: 26px; font-weight: 500; color: var(--face-text); }
.about-card-toggles { border-top: 1px solid var(--border); }
.about-card-tip {
  background: var(--lavender);
  color: #1b1c3d;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 10px;
}

/* Плитки режимов — те же, что на странице набора, только не нажимаются */
.about-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 6px; }
.about-mode { cursor: default; }

/* Свайп: карточка ездит сама по кругу, надписи проявляются вместе с рамкой */
.about-swipe { display: flex; justify-content: center; padding: 18px 0 6px; overflow: hidden; }
.about-swipe-card {
  position: relative;
  width: 190px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--face);
  border: 3px solid var(--border);
  border-radius: 14px;
  animation: about-swipe 6s ease-in-out infinite;
}
/* Демонстрационная карточка узкая, и надпись налезала бы на слово. Гасим слово
   ровно в те моменты, когда надпись видна, — заодно похоже на смещение внимания. */
.about-swipe-word {
  font-size: 42px;
  color: var(--face-text);
  animation: about-word 6s ease-in-out infinite;
}
@keyframes about-word {
  0%, 8%    { opacity: 1; }
  22%, 30%  { opacity: 0.12; }
  44%, 52%  { opacity: 1; }
  66%, 74%  { opacity: 0.12; }
  90%, 100% { opacity: 1; }
}
.about-swipe-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
  font-weight: 800;
  opacity: 0;
  white-space: nowrap;
}
.about-swipe-label.yes { right: 12px; color: var(--green); animation: about-label-yes 6s ease-in-out infinite; }
.about-swipe-label.no { left: 12px; color: var(--amber); animation: about-label-no 6s ease-in-out infinite; }

@keyframes about-swipe {
  0%, 8%    { transform: translateX(0) rotate(0); border-color: var(--border); }
  22%, 30%  { transform: translateX(64px) rotate(1.6deg); border-color: var(--green); }
  44%, 52%  { transform: translateX(0) rotate(0); border-color: var(--border); }
  66%, 74%  { transform: translateX(-64px) rotate(-1.6deg); border-color: var(--amber); }
  90%, 100% { transform: translateX(0) rotate(0); border-color: var(--border); }
}
@keyframes about-label-yes {
  0%, 8%   { opacity: 0; }
  22%, 30% { opacity: 1; }
  44%, 100% { opacity: 0; }
}
@keyframes about-label-no {
  0%, 52%  { opacity: 0; }
  66%, 74% { opacity: 1; }
  90%, 100% { opacity: 0; }
}
/* Кому анимация мешает — показываем спокойную карточку без движения. */
@media (prefers-reduced-motion: reduce) {
  .about-swipe-card, .about-swipe-label, .about-swipe-word { animation: none; }
}

.about-hw { margin: 14px auto 0; width: 200px; height: 200px; }

/* Разбор слова по иероглифам */
.about-breakdown {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 6px;
  padding: 16px 12px;
  background: var(--surface-2);
  border-radius: 14px;
}
.about-whole { font-size: 28px; }
.about-eq { color: var(--muted); font-size: 18px; }
.about-part { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; }
.about-part b { font-size: 24px; font-weight: 500; }
.about-part-read { color: var(--pinyin); font-size: 13px; font-weight: 600; }
.about-part-mean { color: var(--muted); font-size: 12px; }

.doc-list { margin: 4px 0 8px; padding-left: 22px; }
.doc-list li { margin-bottom: 6px; line-height: 1.6; color: var(--text); }
.doc-list li::marker { color: var(--muted); }
.doc-foot { margin-top: 32px; }
/* Видно только пока в политику не подставили данные оператора. */
.doc-warn {
  margin: 16px 0 0; padding: 12px 14px; line-height: 1.6;
  background: var(--red-soft); border: 1px solid var(--danger-border);
  border-radius: 10px; color: var(--text);
}
.doc-warn strong { color: var(--red); }
.footer-link { color: var(--muted); text-decoration: underline; margin-left: 10px; }
.footer-link:hover { color: var(--text); }

/* «Я ответил правильно» на полосе разбора ответа */
.answer-bar-mine {
  background: none;
  border: none;
  color: var(--primary);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
}
.answer-bar-mine:hover { background: var(--primary-soft); }
.answer-bar-counted { color: var(--green); font-weight: 700; font-size: 14px; white-space: nowrap; }

/* ---------- Цвет иероглифов по тонам ---------- */
:root {
  --tone1: #ff5a52;   /* ā — красный */
  --tone2: #35c46a;   /* á — зелёный */
  --tone3: #5b8cff;   /* ǎ — синий */
  --tone4: #c96bff;   /* à — фиолетовый */
  --tone5: #a6adcd;   /* нейтральный — серый */
}
:root[data-theme='light'] {
  --tone1: #e02020;
  --tone2: #00a03e;
  --tone3: #1a5fe0;
  --tone4: #9b30c9;
  --tone5: #8a90a6;
}
.tone1 { color: var(--tone1); }
.tone2 { color: var(--tone2); }
.tone3 { color: var(--tone3); }
.tone4 { color: var(--tone4); }
.tone5 { color: var(--tone5); }

/* Подпись под карточкой: что значит цвет */
.tone-legend {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 600;
  margin-top: 10px;
}
.tone-legend span { white-space: nowrap; }
