:root {
  --bg: #0e1030;
  --surface: #1b1e42;
  --surface-2: #2a2e54;
  --face: #3b4066;
  --border: #2e3360;
  --text: #f2f3fa;
  --muted: #a6adcd;
  --primary: #7b86ff;
  --on-primary: #0e1030;   /* текст на кнопках основного цвета: 5.9:1 */
  --primary-dark: #5c68ee;
  --primary-soft: #262b57;
  --count-text: #98a2ff;
  --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;
  --badge-hsk30: #3ddc97;
  --badge-hsk20: #86a396;
  --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: #646b80;
  --primary: #4255ff;
  --on-primary: #ffffff;
  --primary-dark: #2f40e0;
  --primary-soft: #e8ebff;
  --count-text: #394be0;
  --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;
  --badge-hsk30: #0b8250;
  --badge-hsk20: #496c5b;
  --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;
}

/* ---------- Шапка ---------- */
/* Общий вид текстовых ссылок. Компоненты навигации задают свой вид ниже. */
a:where([href]) {
  color: var(--primary);
  text-decoration-line: underline;
  text-underline-offset: 2px;
  text-decoration-skip-ink: auto;
}
a:where([href]):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.topbar {
  display: flex;
  align-items: center;
  /* Слева бургер и лого вплотную друг к другу, всё остальное — направо.
     При space-between лого уезжало на середину шапки и висело в пустоте. */
  justify-content: flex-start;
  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 {
  --secondary-circle: 36px;
  --profile-circle: 44px;
  --circle-gap: 12px;
  display: flex;
  gap: var(--circle-gap);
  align-items: center;
  margin-left: auto;
}
.topnav > .create-wrap,
.topnav > .account-wrap { flex: none; line-height: 0; }
.topnav > .create-wrap nav,
.topnav > .account-wrap nav,
.topnav .create-menu { line-height: normal; }
.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); }
/* Отступ измеряется между видимыми окружностями, область нажатия — 44 px. */
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: var(--secondary-circle);
  height: var(--secondary-circle);
  padding: 0;
  font-size: 16px;
  line-height: 1;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.topnav .theme-toggle::after,
.topnav .create-btn::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}
.theme-toggle:hover { background: var(--hover); }
.language-picker { position: relative; flex: none; }
.language-picker.theme-toggle, .language-picker summary { list-style: none; padding: 0; font-size: 12px; font-weight: 600; text-decoration: none; }
.language-picker summary::-webkit-details-marker { display: none; }
.language-picker[open] summary { color: var(--primary); }
.language-picker[open] summary { border-color: var(--primary); }
.language-picker nav {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 155px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.language-picker a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
}
.language-picker small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}
.language-picker a[aria-current] { color: var(--primary); background: var(--primary-soft); }
.language-picker a[aria-current]::after { content: "✓"; }
.language-picker a:hover, .language-picker a:focus-visible { background: var(--surface-2); }
.theme-toggle svg { width: 19px; height: 19px; display: block; }
.nav-cta { background: var(--primary); color: var(--on-primary); }
.nav-cta:hover { background: var(--primary-dark); color: var(--on-primary); }

/* Бургер слева в шапке: разделы сайта */
.burger-wrap { position: relative; margin-right: 6px; }
.burger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: none;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.burger-btn:hover { background: var(--hover); }
.burger-btn.is-open { background: var(--hover); border-color: var(--border); }
.burger-btn svg { width: 21px; height: 21px; display: block; }
/* Меню от левого края — кнопка стоит первой в шапке */
.burger-menu { left: 0; right: auto; min-width: 250px; }
.burger-menu .create-item { text-decoration: none; }

/* Keep the header menu inside the visible viewport, above the mobile tabs. */
.topbar .burger-wrap > .create-menu.burger-menu {
  --menu-clearance: 88px;
  max-height: calc(100vh - var(--menu-clearance));
  max-height: calc(var(--vv-h, 100dvh) - var(--menu-clearance) - env(safe-area-inset-bottom, 0px));
  min-width: min(250px, calc(100vw - 24px));
  overflow-y: auto;
  overscroll-behavior-y: contain;
}
.topbar .burger-menu > .create-item { flex: none; }
html:has(.topbar .burger-wrap > [aria-expanded="true"]),
html:has(.topbar details.burger-wrap[open]) {
  overflow-y: hidden;
}
@media (max-width: 900px) {
  .topbar .burger-wrap > .create-menu.burger-menu { --menu-clearance: 148px; }
}

/* Кнопка «+» с выпадающим меню */
.create-wrap { position: relative; }
.create-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--secondary-circle, 36px);
  height: var(--secondary-circle, 36px);
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
.create-btn::before {
  content: "";
  width: 14px;
  height: 14px;
  background: currentColor;
  clip-path: polygon(6px 0, 8px 0, 8px 6px, 14px 6px, 14px 8px, 8px 8px,
    8px 14px, 6px 14px, 6px 8px, 0 8px, 0 6px, 6px 6px);
}
.create-btn:hover { background: var(--primary-dark); }
.create-btn.is-open::before, .create-wrap[open] > .create-btn::before { 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;
  text-decoration: none;
  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; }

/* Страница никогда не шире экрана: иначе всё «приклеенное» (панель занятия,
   нижнее меню) считает себя по ширине страницы и уезжает вправо. */
html, body { max-width: 100%; overflow-x: clip; }

.app {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 24px 60px;
  /* Ничто внутри не должно раздвигать страницу шире экрана: на телефоне
     одна широкая сетка растягивала весь viewport, и полноэкранные
     карточки вместе с крестиком уезжали за правый край. */
  overflow-x: hidden;
  overflow-x: clip;
}
/* Экран приложения рисуют скрипты. Пока их нет, подвал оказался бы на первом
   экране и потом прыгнул вниз — оставляем под экран целый viewport. На
   статичных страницах (без id) содержимое есть сразу, им это не нужно. */
main#app { min-height: 100vh; }
/* Занятия (заучивание, тест, подбор): без подвала и без запаса под экран —
   внизу и так панель ответа, а подвал под ней выглядел дыркой. */
body.is-study .footer { display: none; }
body.is-study main#app { min-height: 0; }
/* И без нижней панели разделов: у занятия свой крестик выхода, а на телефоне
   320×568 панель закрывала четвёртый вариант ответа в заучивании (22.10.2026). */
body.is-study .tabbar { display: none !important; }

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

/* ---------- Боковая панель с папками ---------- */
/* Нижняя панель разделов. Появляется там, где до шапки тянуться неудобно —
   на телефоне и планшете. Три главных адреса, дальше человек идёт сам. */
.tabbar { display: none; }

@media (max-width: 900px) {
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    /* Не к низу страницы, а к низу видимой части: в Safari низ страницы
       уходит под панель браузера, и подписи оказывались наполовину скрыты. */
    bottom: var(--vv-b, 0px);
    z-index: 58;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border);
    /* Вырез под кнопку «домой» у айфона: без этого подписи лезут под неё */
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .tabbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 9px 4px 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    /* «Создать» — кнопка, а не ссылка; выглядеть должна так же */
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
  }
  .tabbar-item.is-on { color: var(--primary); }
  /* Четыре пункта: подпись в одну строку, на узком телефоне чуть мельче */
  .tabbar-item > span:last-child { white-space: nowrap; }
  @media (max-width: 420px) { .tabbar-item { font-size: 11px; padding-left: 2px; padding-right: 2px; } }  /* 16.11: 10 → 11 px — мелко */
  .tabbar-ico { display: block; line-height: 0; }
  .tabbar-ico svg { width: 24px; height: 24px; display: block; }
  /* Место под панель, чтобы она не накрывала конец страницы и подвал */
  body { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }
}

body:has(> .sidebar) { --folder-rail-width: 88px; }

/* На планшете панель папок слева уже видна — панель разделов начинается за ней */
@media (min-width: 760px) and (max-width: 900px) {
  body:has(> .sidebar) .tabbar { left: var(--folder-rail-width); }
}

.sidebar { display: none; }

@media (min-width: 760px) {
  /* Место под папки требуется только в приложении. Шапка общая во всю ширину. */
  body:has(> .sidebar) { padding-left: var(--folder-rail-width); }
  body:has(> .sidebar) > .topbar { margin-left: calc(-1 * var(--folder-rail-width)); z-index: 56; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 55;
    width: var(--folder-rail-width);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 80px 0 12px;
    scrollbar-width: thin;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
  }
}

.side-list { width: 100%; flex: none; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.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-cap {
  flex-direction: column;
  gap: 4px;
  width: calc(100% - 8px);
  min-height: 53px;
  height: auto;
  padding: 5px 2px;
}
.side-cap {
  max-width: 100%;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-align: center;
}
.side-folder-icon { position: relative; }
.side-folder-number {
  position: absolute;
  top: -3px;
  left: 16px;
  min-width: 15px;
  padding: 1px 3px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  line-height: 12px;
  text-align: center;
}
.side-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 0; }
.side-btn.is-on .side-cap { color: var(--text); }
.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;
  max-width: min(26rem, calc(100vw - 116px));
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  overflow-wrap: anywhere;
  line-height: 1.4;
  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 {
  color: var(--muted);
  font-size: 13px;
  padding: 34px 22px 26px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.footer-grid {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* 4 колонки на русском, 3 на английском */
  gap: 20px 30px;
  align-items: start;
}
/* Название стоит своей строкой над колонками: описание из подвала убрано,
   и отдельная колонка под одно слово смотрелась бы полупустой. */
.footer-name { grid-column: 1 / -1; font-size: 16px; font-weight: 700; color: var(--text); }
.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 2px;
}
.footer-col a { color: var(--muted); text-decoration: none; padding: 4px 0; line-height: 1.3; }
.footer-col a:hover { color: var(--text); }
.footer-col a:focus-visible { color: var(--text); outline: 2px solid var(--primary); outline-offset: 2px; }
.footer-tail {
  max-width: 1080px;
  margin: 26px auto 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  line-height: 1.6;
}
.footer-legal { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

@media (max-width: 900px) {
  .footer-grid { gap: 20px 24px; }
}
@media (min-width: 760px) {
  .footer-grid:has(> .footer-col ~ .footer-col ~ .footer-col):not(:has(> .footer-col ~ .footer-col ~ .footer-col ~ .footer-col)) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    row-gap: 14px;
  }
  .footer-grid:has(> .footer-col ~ .footer-col ~ .footer-col):not(:has(> .footer-col ~ .footer-col ~ .footer-col ~ .footer-col)) > .footer-col:last-child {
    grid-column: span 2;
    display: block;
    columns: 2;
    column-gap: 24px;
  }
  .footer-grid > .footer-col:last-child .footer-head { display: block; column-span: all; }
  .footer-grid > .footer-col:last-child a { display: block; break-inside: avoid; margin-bottom: 8px; }
}
/* Телефон: два столбца и всё сжатее — иначе подвал длиннее самой страницы */
@media (max-width: 759px) {
  .footer { padding: 24px 18px 20px; font-size: 12.5px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 18px 18px; }
  .footer-col { gap: 6px; }
  .footer-name { font-size: 15px; }
  .footer-tail { margin-top: 18px; padding-top: 12px; }
  /* Колонок три, а столбца два: последняя осталась бы одна, с пустотой
     справа. Растягиваем её и раскладываем ссылки в два ряда. */
  .footer-col:last-child {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 18px;
  }
  .footer-col:last-child .footer-head { grid-column: 1 / -1; }
}

/* ---------- Типографика и общие ---------- */
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;
  /* Кнопкой бывает и <a>: без этой строки браузер подчеркнёт её, и в одном
     ряду с настоящей <button> она выглядит иначе. */
  text-decoration: none;
  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: var(--on-primary); 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; }
/* На сенсорных экранах маленькие кнопки — не ниже 40 px, иначе палец промахивается
   (▶ в «по-китайски», «Открыть в приложении», «Учить карточками →», «Проверить себя») */
@media (pointer: coarse) {
  .btn-sm { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
  .btn-sm:not(:empty) { min-width: 40px; }
  /* Ещё мелочь для пальца (проверка приложения № 32, 16.11): фильтры уровней,
     «Наборы / Папки», метки в папке, подсказка, «Не знаю», пароль, галочки */
  .hsk-tag, .chip, .fc-link, .auth-link { min-height: 40px; display: inline-flex; align-items: center; }
  .unsure { min-height: 40px; display: flex; align-items: center; width: fit-content; }
  .pass-eye { min-height: 40px; padding-left: 10px; padding-right: 10px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  /* Поле мельче 16 px iPhone при нажатии увеличивает вместе со всей страницей */
  input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], select, textarea { font-size: 16px; }
}
.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'], :where(.auth-form) input[type='email'], 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, :where(.auth-form) input[type='email']: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: var(--on-primary); }

.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;
  white-space: nowrap; /* «HSK 3.0» в узкой строке не должен ломаться пополам */
}
.lang-badge.ch-rus { color: var(--badge-rus); }
.lang-badge.ch-eng { color: var(--badge-eng); }
/* Стандарт экзамена важнее языковой пары. Различаем не оттенком, а заливкой:
   на белой карточке «яркий» и «блёклый» зелёный оба вынужденно тёмные, иначе
   текст не прочитать, — и рядом они сливаются. Действующий 3.0 — залитый
   зелёный значок, старый 2.0 — только контур. Пишем после пар, чтобы перебить. */
.lang-badge.hsk-30 {
  color: var(--on-green);
  background: var(--badge-hsk30);
  border-color: var(--badge-hsk30);
}
.lang-badge.hsk-20 { color: var(--badge-hsk20); }
.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, .set-card .deck-title { margin: 0 0 6px; font-size: 17px; }
.set-card .count {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--count-text);
  background: var(--primary-soft);
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
  align-self: flex-start;
}
.set-card .set-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.set-card .set-top .count { margin-bottom: 0; }
.set-card .set-top .lang-badge:first-of-type { margin-left: auto; } /* значки — к правому краю */
.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); }
/* Крошке разрешено сжиматься: рядом в ряду лежат кнопки, и без min-width:0
   она распирала бы ряд вместо того, чтобы обрезать длинное имя папки. */
.crumb { flex: 0 1 auto; min-width: 0; }
.crumb-root, .crumb-sep, .crumb-tail { white-space: nowrap; }
.crumb-tail { overflow: hidden; text-overflow: ellipsis; }
.crumb .folder-ico, .crumb-back { flex: none; }
.crumb-back { display: none; }        /* стрелка нужна только на узком экране */

/* На телефоне путь целиком не помещается: имя папки бывает длинным и с
   собственными разделителями, из-за чего крошка ломалась на четыре строки.
   Оставляем стрелку назад и имя папки одной строкой. Когда папки нет,
   крошка остаётся прежней — прятать в ней нечего. */
@media (max-width: 640px) {
  .crumb.has-tail .crumb-root,
  .crumb.has-tail .crumb-sep,
  .crumb.has-tail .folder-ico { display: none; }
  .crumb.has-tail .crumb-back { display: inline-flex; }
  /* Отдельная строка: в общем ряду кнопки оставляли крошке около сотни
     пикселей, и от имени папки виднелась пара слогов. */
  .set-head-top { flex-wrap: wrap; }
  .set-head-top .crumb.has-tail { flex: 1 0 100%; }
}
.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; }

/* ---------- Сетка режимов ---------- */
/* «Начать учить» над плитками режимов (js/views/set.js) */
.start-cta { margin: 22px 0 0; }
.start-cta-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; max-width: 520px; padding: 16px 22px; border-radius: 16px;
  font-size: 20px; font-weight: 700; line-height: 1.2; text-align: left;
}
.start-cta-sub { font-size: 14px; font-weight: 500; opacity: .85; }
.start-cta + .modes { margin-top: 14px; }
@media (max-width: 620px) { .start-cta-btn { max-width: none; } }

.modes {
  display: grid;
  /* minmax(0, …): плитка не шире своей колонки даже с длинной подписью */
  grid-template-columns: repeat(4, minmax(0, 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 { min-width: 0; overflow: hidden; }
.mode-btn > span:not(.ico):not(.soon) { min-width: 0; }
/* Надпись справа («новые», «нет одиночных») на узкой плитке наезжала на название —
   теперь переносится под него (16.11.2026, проверка на телефоне) */
.mode-btn { flex-wrap: wrap; row-gap: 4px; }
.mode-btn > span:not(.ico):not(.soon) { min-width: auto; }
.mode-btn .soon { white-space: nowrap; }
.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, .fc-fs-settings { 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; }
/* Подпись под значком: «Словарь», «Черты», «Звук», «Отметить» (12.11.2026) */
.fc-ico-lbl { flex-direction: column; align-items: center; gap: 2px; min-width: 48px; }
.fc-ico-text { font-size: 11px; font-weight: 600; line-height: 1.1; color: var(--muted); white-space: nowrap; }
.fc-anim .fc-ico-text { color: var(--primary); }
.fc-star.is-on .fc-ico-text { color: var(--amber); }

.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;
  flex-wrap: wrap;
  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; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; max-width: 100%; margin-left: auto; }

.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(--no-text); }
.fc-grade.no:hover { background: var(--red-soft); border-color: var(--red); }
.fc-grade.yes { color: var(--ok-text); }
.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); }
/* Значок с подписью рядом: «↺ Назад», «⤨ Перемешать» под карточкой (12.11.2026) */
.icon-btn.icon-btn-text { width: auto; padding: 0 12px 0 9px; gap: 6px; border-radius: 18px; font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; }
.icon-btn.icon-btn-text svg { width: 17px; height: 17px; flex: none; }
.icon-btn.icon-btn-text.is-on { color: var(--primary); background: var(--primary-soft, var(--surface-2)); }

.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; }
/* Сенсорный экран: кнопки «Знаю» / «Ещё изучаю» показываем и здесь, свайп
   остаётся вторым способом. 22.10.2026: раньше на телефоне кнопок не было —
   только свайп и подсказка на 3 секунды. По своему счётчику за 19–21.10
   10 карточек перевернули 75 человек, а оценили 10 — 30: остальные листали
   карточку туда-обратно, не понимая, как перейти к следующей. */
/* Пиньинь на карточке — заодно с лицевой стороной. Правило точечное:
   тот же класс используют списки и словарь, их размер трогать незачем. */
.fc-face .pinyin { font-size: 22px; }
.fc-face .pinyin-lg { font-size: 30px; }
/* «пиньинь» на месте скрытого чтения: нажать — показать на этой карточке (16.11.2026) */
.pinyin-peek { margin-top: 8px; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); background: transparent; border: 1px dashed var(--border); border-radius: 999px; padding: 6px 14px; min-height: 36px; cursor: pointer; }
.pinyin-peek:hover { color: var(--primary); border-color: var(--primary); }
/* «Слушать»: предложение включить перевод сразу (после 3 нажатий «Показать перевод») */
.ls-tr-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--primary-soft, rgba(66,85,255,.08)); font-size: 14px; }
.ls-tr-hint[hidden] { display: none; }
.ls-tr-hint span { flex: 1 1 200px; }
/* 28.10.2026: слово из 1–2 иероглифов — крупно, из 3–4 — чуть меньше.
   Раньше на телефоне 爱 было 33px при пиньине 30px: знак терялся
   на пустой карточке, а запомнить надо именно его. */
.fc-face .fc-zh-l { font-size: 96px; line-height: 1.15; }
.fc-face .fc-zh-m { font-size: 64px; line-height: 1.2; }
.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-next { margin: 4px 0 2px; font-size: 14px; color: var(--muted); text-align: center; max-width: 360px; line-height: 1.45; }
.fc-next-link { display: inline-block; margin-top: 6px; font-weight: 600; }
.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; }

/* ---------- Полноэкранный режим ---------- */
/* Экран занятия занимает ровно то, что человек видит. Обычного inset: 0
   мало: на телефоне достаточно случайно свести два пальца при листании
   карточек, и браузер увеличивает масштаб — видимая область становится
   меньше страницы, а приклеенная к странице панель уезжает за правый край.
   Переменные --vv-* обновляет js/utils.js по visualViewport; пока их нет
   (старый браузер, статичная страница) значения по умолчанию дают inset: 0. */
.fc-overlay {
  position: fixed;
  left: var(--vv-l, 0px);
  top: var(--vv-t, 0px);
  width: var(--vv-w, 100%);
  height: var(--vv-h, 100dvh);
  /* Пинч двумя пальцами внутри занятия — это почти всегда случайность */
  touch-action: pan-y;
  z-index: 90;
  background: var(--bg);
  padding: 18px 24px calc(20px + env(safe-area-inset-bottom, 0px));
  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,
.fc.is-fs .fc-fs-settings {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  z-index: 2;
}
.fc.is-fs .fc-close { right: 24px; }      /* крестик справа, как на всех экранах занятий */
/* Тот же круглый крестик на всех экранах занятий: заучивание, тест, подбор, прописи */
.study-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.study-close:hover { background: var(--hover); }
.study-close svg { width: 18px; height: 18px; display: block; }
.fc.is-fs .fc-fs-settings { left: 24px; }
/* С 22.10.2026 шестерёнка во весь экран — внутри карточки слева (.fc-gear),
   угловая скрыта. В обычном виде параметры — в нижнем ряду, в карточке не нужны. */
.fc.is-fs .fc-fs-settings { display: none; }
.fc-gear { display: none; }
.fc.is-fs .fc-gear { display: inline-flex; }
.fc.is-fs .fc-fs-settings svg { width: 20px; height: 20px; display: block; }
.fc.is-fs .fc-close:hover,
.fc.is-fs .fc-fs-settings: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; }

/* ---------- Прописи ---------- */
.wr-overlay { padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; }
.wr-progress { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.wr-progress-fill { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 4px; transition: width 0.3s; }
.wr-count { font-size: 13px; font-weight: 700; color: var(--muted); min-width: 52px; text-align: left; }
.wr-stage { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 520px; margin: 0 auto; }
.wr-title { align-self: flex-start; font-size: 22px; margin: 6px 0 12px; }
.wr-hint { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; width: 100%; margin-bottom: 14px; }
.wr-boxes { display: flex; gap: 6px; margin-bottom: 8px; min-height: 34px; }
.wr-box {
  width: 30px; height: 38px; border-radius: 6px;
  border: 2px solid var(--primary); background: var(--primary-soft);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--text);
}
.wr-box.is-done { background: var(--primary); color: var(--on-primary); }
.wr-box.is-now { box-shadow: 0 0 0 3px var(--primary-soft); }
.wr-pinyin { font-size: 22px; font-weight: 500; }
.wr-meaning { color: var(--muted); font-size: 16px; margin-top: 2px; }
.wr-speak { color: var(--primary); flex: none; }
/* Клетка 米字格: крест и диагонали, как в прописях */
.wr-grid {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(var(--border), var(--border)) center / 100% 1px no-repeat,
    linear-gradient(var(--border), var(--border)) center / 1px 100% no-repeat,
    linear-gradient(to top right, transparent calc(50% - 0.5px), var(--border), transparent calc(50% + 0.5px)),
    linear-gradient(to top left, transparent calc(50% - 0.5px), var(--border), transparent calc(50% + 0.5px)),
    var(--surface);
  touch-action: none;
}
.wr-grid svg { display: block; position: relative; }
.wr-status { min-height: 20px; margin: 12px 0 0; font-size: 14px; text-align: center; }
.wr-tools { display: flex; gap: 22px; justify-content: center; margin-top: 18px; }
.wr-btn {
  width: 60px; height: 60px; border-radius: 20px; border: none; cursor: pointer;
  background: var(--primary); color: var(--on-primary);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px -10px var(--primary);
  transition: transform 0.1s;
}
.wr-btn:active { transform: scale(0.94); }
.wr-btn.is-on { background: var(--text); color: var(--bg); box-shadow: none; }
.wr-btn svg { width: 26px; height: 26px; }
.wr-summary { text-align: center; margin: auto; max-width: 420px; }
.wr-trophy { color: var(--primary); }
.wr-trophy svg { width: 56px; height: 56px; }
@media (max-width: 480px) {
  .wr-title { font-size: 20px; }
}

/* Окно «Как пишется» */
.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; min-height: 0; }
/* Во весь экран карточка занимает то, что осталось между шапкой и кнопками,
   и сжимается вместе с экраном. 22.10.2026: с min-height 340/440 px на низких
   экранах (iPhone SE в Safari с панелями, телефон боком, окно браузера на
   ноутбуке) карточка не помещалась и ложилась поверх кнопок «Знаю / Ещё изучаю». */
@media (max-height: 700px) {
  .fc.is-fs .fc-top { padding-top: 8px; padding-bottom: 4px; }
  .fc.is-fs .fc-face { gap: 8px; padding-top: 6px; padding-bottom: 14px; }
  .fc.is-fs .fc-badges { margin-bottom: 8px; }
}
/* На итоговом экране колода ни к чему — карточек больше нет. */
.fc.is-done .fc-deck::before { display: none; }

/* Подсказка про свайп: всплывает над карточкой один раз за всё время
   и сама уходит через пять секунд. Касания не перехватывает — если человек
   сразу потянет карточку, подсказка не помешает. */
.fc-swipe-hint {
  /* Окно внизу карточки (12.11.2026: по центру оно закрывало перевод на
     обороте первой карточки). Нажатия проходят насквозь — карточку можно
     сразу трогать. */
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 4;
  width: min(300px, calc(100% - 28px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 16px;
  border-radius: 16px;
  background: var(--text);
  color: var(--face);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 8px) scale(0.96);
  transition: opacity 0.25s, transform 0.25s;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.fc-swipe-hint.is-on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.fc-swipe-demo { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 6px; }
.fc-swipe-side { font-size: 14px; font-weight: 700; opacity: 0.85; white-space: nowrap; }
.fc-swipe-hand { font-size: 34px; line-height: 1; display: inline-block; animation: fc-swipe-hand 1.4s ease-in-out infinite; }
.fc-swipe-text { font-size: 16px; font-weight: 700; line-height: 1.3; }
@keyframes fc-swipe-hand {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-26px) rotate(-12deg); }
  75% { transform: translateX(26px) rotate(12deg); }
}
@media (prefers-reduced-motion: reduce) { .fc-swipe-hand { animation: 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);
}
/* Первый экран пробного занятия. Человек согласился «попробовать» и ждёт
   карточек, а видел четыре переключателя и два счётчика раньше, чем понял,
   что карточку надо перевернуть: в данных это давало уход за 3 секунды.
   Пока он не перевернул ни одной карточки, настройки убраны, остаётся слово
   и подсказка. После первого переворота всё возвращается — ничего не пропало
   насовсем, и нажимать ради этого некуда. */
.fc.is-novice .fc-toggles,
.fc.is-novice .fc-tip,
.fc.is-novice .fc-track { display: none; }

/* Сама подсказка: под словом, приглушённая — это указание, а не часть карточки. */
.fc-novice-tip {
  margin: 14px 0 2px;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.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;
  /* Без этого значок встаёт по базовой линии текста и съезжает вверх-влево
     от центра круга: у кнопки есть собственные отступы, а svg — строчный. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  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: var(--on-primary); }

/* ---------- Режим обучения (общий каркас) ---------- */
.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(--ok-text);
  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(--ok-text); }
.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;
  left: var(--vv-l, 0px);
  top: var(--vv-t, 0px);
  width: var(--vv-w, 100%);
  height: var(--vv-h, 100dvh);
  touch-action: pan-y;
  z-index: 90;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding: 14px 20px calc(20px + env(safe-area-inset-bottom, 0px));
}
.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: 14px 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column; /* слово, под ним пиньинь — а не в одну строку */
  gap: 4px;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow-wrap: anywhere;
  line-height: 1.3;
  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 > div:first-child { font-size: 17px; }
.match-tile > .pinyin { font-size: 13px; color: var(--muted); margin: 0; }
/* Телефон: две колонки, планшет — три; четыре узких столбика не читались */
@media (max-width: 900px) { .match-board { grid-template-columns: repeat(3, 1fr); gap: 10px; } }
@media (max-width: 560px) {
  .match-board { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .match-tile { padding: 10px 8px; font-size: 14px; border-radius: 12px; }
  .match-tile > div:first-child { font-size: 16px; }
  .match-tile > .pinyin { font-size: 12px; }
}
.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, minmax(0, 1fr)); gap: 10px; }
  /* Мельче и плотнее, чтобы «Повторение 68» уместилось в полэкрана целиком */
  .mode-btn { padding: 12px 10px; gap: 8px; font-size: 13px; }
  .mode-btn .ico { width: 24px; height: 24px; }
}

/* На телефоне и планшете «Библиотека» есть в нижней панели — в шапке
   ссылка лишняя и только теснит кнопки. */
@media (max-width: 900px) {
  .topnav .nav-link { display: none; }
}
@media (min-width: 760px) and (max-width: 900px) {
  .topnav .nav-public { display: inline-flex; padding-inline: 8px; }
}
.topnav .nav-public { white-space: nowrap; }
@media (max-width: 620px) {
  /* Шапка не должна выталкивать кнопку «+» за край экрана */
  .topbar { padding: 10px 14px; gap: 8px; }
  .logo { font-size: 17px; gap: 6px; }
  .logo-icon { width: 30px; height: 30px; }
  .topnav { --secondary-circle: 32px; }
  .nav-link { padding: 6px 8px; font-size: 13px; }
  .theme-toggle svg { width: 17px; height: 17px; }
}

@media (max-width: 599px) {
  .topbar .topnav > .create-wrap { display: none; }
}
@media (max-width: 420px) {
  .topbar { padding-inline: 8px; gap: 3px; }
  .topbar .burger-wrap { margin-right: 0; }
  .topbar .logo { gap: 4px; }
}
@media (max-width: 350px) {
  .topbar .logo-icon { width: 27px; height: 27px; }
  .topbar .logo-text { font-size: 16px; }
}

@media (max-width: 620px) {
  /* Полноэкранная карточка на телефоне: крупные зоны нажатия */
  .fc-overlay { padding: 10px 10px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .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-face .fc-zh-l { font-size: 80px; }
  .fc-face .fc-zh-m { font-size: 52px; }
  .fc-controls { 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 calc(16px + env(safe-area-inset-bottom, 0px)); }
  .fc.is-fs .fc-close { top: 10px; right: 12px; }
  .fc.is-fs .fc-fs-settings { top: 10px; left: 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: var(--profile-circle, 44px);
  height: var(--profile-circle, 44px);
  font-size: 15px;
  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 { color: var(--primary); }
.account-btn svg { width: 22px; height: 22px; display: block; }
.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; }

/* Подсказка в редакторе «Удалять по одному не обязательно» (13.11.2026):
   мини-карточка, палец нажимает звёздочку, она загорается, слово — в «Основное».
   Круг 3,2 с. */
.zv-demo { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 4px; }
.zv-demo-card {
  position: relative;
  width: 200px;
  height: 104px;
  border-radius: 14px;
  background: var(--face);
  color: var(--face-text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.zv-demo-zi { font-size: 30px; font-weight: 700; line-height: 1.1; }
.zv-demo-py { font-size: 14px; color: var(--face-sub); }
.zv-demo-star {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 24px;
  height: 24px;
  color: var(--face-text);
  opacity: 0.75;
  animation: zv-star 3.2s ease-in-out infinite;
}
.zv-demo-star svg { width: 24px; height: 24px; display: block; }
.zv-demo-star svg path { fill: transparent; animation: zv-star-fill 3.2s ease-in-out infinite; }
.zv-demo-hand {
  position: absolute;
  top: 20px;
  right: 6px;
  font-size: 30px;
  line-height: 1;
  pointer-events: none;
  animation: zv-hand 3.2s ease-in-out infinite;
}
.zv-demo-plus {
  font-size: 13px;
  font-weight: 700;
  color: var(--amber);
  opacity: 0;
  animation: zv-plus 3.2s ease-in-out infinite;
}
@keyframes zv-hand {
  0%   { transform: translate(-110px, 60px); opacity: 0; }
  10%  { transform: translate(-110px, 60px); opacity: 1; }
  38%  { transform: translate(0, 0) scale(1); }
  44%  { transform: translate(0, 2px) scale(0.86); }
  52%  { transform: translate(0, 0) scale(1); opacity: 1; }
  80%  { transform: translate(14px, 18px); opacity: 0; }
  100% { transform: translate(14px, 18px); opacity: 0; }
}
@keyframes zv-star {
  0%, 43%  { color: var(--face-text); opacity: 0.75; transform: scale(1); }
  47%      { color: var(--amber); opacity: 1; transform: scale(1.3); }
  55%, 90% { color: var(--amber); opacity: 1; transform: scale(1); }
  100%     { color: var(--face-text); opacity: 0.75; transform: scale(1); }
}
@keyframes zv-star-fill {
  0%, 43%  { fill: transparent; }
  47%, 90% { fill: currentColor; }
  100%     { fill: transparent; }
}
@keyframes zv-plus {
  0%, 48%  { opacity: 0; transform: translateY(6px); }
  56%, 86% { opacity: 1; transform: translateY(0); }
  100%     { opacity: 0; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .zv-demo-hand, .zv-demo-plus, .zv-demo-star, .zv-demo-star svg path { animation: none; }
  .zv-demo-star { color: var(--amber); opacity: 1; }
  .zv-demo-star svg path { fill: currentColor; }
  .zv-demo-plus { opacity: 1; }
}

/* Предложение завести аккаунт — после того, как гость создал набор */
.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:empty { display: none; }
.sync-status.is-bad { color: var(--red); }

/* ---------- Вход и регистрация ---------- */
.auth-page { display: flex; justify-content: center; padding: 12px 0 40px; }
.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);
}
/* подсказка об опечатке в почте (js/pochta.js): не ошибка, а вопрос */
.field-note.is-hint { color: var(--text); }
.field-fixes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.field-fix {
  font: inherit;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--red);
  background: var(--red-soft);
  color: var(--text);
  cursor: pointer;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: left;
}
.field-fix-ghost {
  border-color: var(--border);
  background: transparent;
  color: var(--muted);
}

/* ссылка «Забыли пароль?» и удачное сообщение в формах входа */
.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); }

/* Надпись на время запуска. Проявляется с задержкой: при обычной загрузке
   экран успевает отрисоваться раньше, и мигания не возникает. */
.boot-note {
  padding: 64px 0;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  opacity: 0;
  animation: boot-note-in 0.35s ease 0.7s forwards;
}
@keyframes boot-note-in { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .boot-note { animation-duration: 0.01s; }
}

/* ---------- Таблица сравнения (страница про HSK) ---------- */
/* Прокрутка внутри обёртки: на узком экране вбок уезжает таблица,
   а не вся страница. */
.cmp-wrap { overflow-x: auto; margin: 4px 0 10px; -webkit-overflow-scrolling: touch; }
.cmp {
  width: 100%;
  min-width: 380px;
  border-collapse: collapse;
  font-size: 15px;
}
.cmp th, .cmp td { padding: 11px 14px; text-align: center; }
.cmp thead th { vertical-align: bottom; padding-bottom: 14px; }
.cmp tbody th {
  text-align: left;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.cmp tbody tr + tr th, .cmp tbody tr + tr td { border-top: 1px solid var(--border); }
/* Строки по уровням отделены от итоговых: это другой разрез данных. */
.cmp tbody tr.cmp-level:first-of-type th,
.cmp tbody tr.cmp-level:first-of-type td { border-top: 2px solid var(--border); }
.cmp-name { display: block; font-size: 17px; font-weight: 700; }
.cmp-note { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; opacity: 0.75; }
/* Старый стандарт приглушён, новый выделен: так видно, куда всё движется.
   Красный и зелёный из исходной таблицы не берём — в приложении эти цвета
   заняты тонами, и читатель принял бы их за подсказку по чтению. */
.cmp td.cmp-old, .cmp th.cmp-old { color: var(--muted); }
.cmp td.cmp-new, .cmp th.cmp-new { color: var(--primary); font-weight: 700; background: var(--surface-2); }
.cmp thead th.cmp-new { border-radius: 10px 10px 0 0; }
.cmp tbody tr:last-child td.cmp-new { border-radius: 0 0 10px 10px; }
/* На телефоне таблица помещается целиком: прокрутка вбок остаётся
   на самый узкий случай, но обычно до неё дело не доходит. */
@media (max-width: 470px) {
  .cmp { min-width: 0; font-size: 14px; }
  .cmp th, .cmp td { padding: 10px 6px; }
  .cmp-name { font-size: 15px; }
  .cmp-note { font-size: 11px; }
}
/* 30.10.2026: в таблицах фраз первая колонка — целые фразы, им можно переноситься */
.cmp.cmp-perenos tbody th { white-space: normal; }

/* ---------- Словники HSK: страницы со списками слов ---------- */
/* Четыре колонки в 720 пикселей не помещаются, поэтому этим страницам
   отдано чуть больше ширины. */
.doc-wide { max-width: 880px; }
/* Хлебные крошки над заголовком: список, а не строка с стрелками, — так
   их читает и чтец экрана, и поисковик (плюс BreadcrumbList в разметке). */
.crumbs ol {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 0;
  font-size: 13px;
  color: var(--muted);
}
.crumbs li + li::before { content: '›'; margin: 0 7px; color: var(--muted); opacity: 0.7; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--primary); text-decoration: underline; }
.crumbs [aria-current] { color: var(--text); }
/* На телефоне и планшете дорожка в одну строку, как у крупных магазинов:
   не переносится, а прокручивается вбок; полоса прокрутки спрятана. */
@media (max-width: 900px) {
  /* 16.11.2026: в одну строку длинная дорожка («… › HSK 3.0 · китайский → русский»)
     обрезалась у края, и было не видно, что её можно прокрутить, — переносим */
  .crumbs ol {
    flex-wrap: wrap;
    overflow-x: visible;
    white-space: normal;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-right: -16px;
    padding-right: 16px;
  }
  .crumbs ol::-webkit-scrollbar { display: none; }
  .crumbs li { flex: 0 1 auto; min-width: 0; }
}
.set-head > .crumbs ol, .fld-head > .crumbs ol { margin-bottom: 6px; }
.voc-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.voc { width: 100%; min-width: 460px; border-collapse: collapse; font-size: 15px; }
/* Шапка липнет к верху: в списке на две с половиной тысячи строк без неё
   через экран уже не помнишь, где чтение, а где перевод. */
.voc thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.voc td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: baseline; }
.voc tbody tr:hover td { background: var(--surface-2); }
.voc-num { width: 46px; text-align: right; font-size: 13px; color: var(--muted); }
.voc thead .voc-num { text-align: right; }
.voc-term { font-size: 22px; white-space: nowrap; }
.voc-py { white-space: nowrap; color: var(--muted); }
/* Строка, на которую пришли по ссылке, не должна прятаться под шапкой */
.voc tbody tr { scroll-margin-top: 90px; }
.voc tbody tr:target { background: var(--primary-soft); }

/* Таблица 214 ключей (/tablica-klyuchej/). От словника отличается тем, что
   в строке два знака — сам ключ и его форма внутри иероглифа, — и оба должны
   читаться крупно: мелкий 亻 от 彳 на телефоне не отличить. */
.kl-table { min-width: 520px; }
.kl-znak { font-size: 26px; font-weight: 400; white-space: nowrap; text-align: left; }
.kl-var { font-size: 22px; white-space: nowrap; color: var(--muted); }
.kl-st { width: 52px; text-align: right; color: var(--muted); font-size: 13px; }
/* Пометка у полусотни ключей, которые стоит выучить первыми: в справочнике
   на 214 строк глазу нужна зацепка, иначе все строки одинаковые. */
.kl-often {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  white-space: nowrap;
}

/* Переход в сервис под вводкой статьи. Внизу статьи такая кнопка тоже есть,
   но до низа длинной статьи доходят единицы — этот ряд ловит остальных. */
.blog-cta { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.doc > p > a.btn {
  display: inline-block;
  max-width: 100%;
  line-height: 1.4;
  text-align: center;
}
/* Плашка над кнопками: отправляет к соседней странице тех, кто пришёл
   из поиска не за этой статьёй (пример — полная таблица ключей). */
.blog-plashka {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--text);
  font-size: 15px;
}
.blog-plashka a { color: var(--primary); font-weight: 600; white-space: nowrap; }

/* Навигация по частям словника. Уровень разбит на страницы по 100 слов,
   и этот ряд — оглавление уровня, одинаковое на каждой его странице. */
#sp-knopki { display: flex; flex-wrap: wrap; gap: 8px; }
.voc-jump > summary { width: fit-content; padding: 10px 14px; border-radius: 10px; color: var(--primary); background: var(--primary-soft); font-weight: 600; cursor: pointer; }
.voc-jump[open] > summary { margin-bottom: 10px; }
@media (max-width: 900px) {
  html:has(.tabbar) { scroll-padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px) + var(--vv-b, 0px)); }
}
.voc-parts { display: flex; flex-wrap: wrap; gap: 8px; }
/* Кнопки тем на словниках и страницах тем: за ними идёт текст,
   и без отступа он прилипает к последнему ряду кнопок. */
.voc-temy, .tema-nav { margin: 4px 0 14px; }
/* Блог: оглавление и дата у статьи */
.blog-date { font-size: 13px; margin: 0 0 10px; }
.blog-list { display: flex; flex-direction: column; gap: 22px; margin-top: 22px; }
.blog-item h2 { margin: 2px 0 6px; font-size: 19px; }
.blog-item h2 a { color: var(--text); text-decoration: none; }
.blog-item h2 a:hover { color: var(--primary); }
/* Обложка статьи в списке блога — как в приложении (16.11.2026, tools/oblozhki_bloga.py) */
.blog-oblozhka { display: block; margin: 10px 0 10px; }
.blog-oblozhka img { display: block; width: 100%; height: auto; border-radius: 14px; border: 1px solid rgba(20, 24, 48, .08); box-shadow: 0 4px 14px rgba(20, 24, 48, .08); transition: transform .15s ease, box-shadow .15s ease; }
.blog-oblozhka:hover img { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(20, 24, 48, .14); }
/* На широком экране обложка слева, текст справа — во всю ширину она слишком крупная */
@media (min-width: 761px) {
  .blog-item:has(.blog-oblozhka) { display: grid; grid-template-columns: 280px 1fr; column-gap: 22px; align-items: start; }
  .blog-item:has(.blog-oblozhka) > .blog-oblozhka { grid-column: 1; grid-row: 1 / span 3; margin: 4px 0 0; }
  .blog-item:has(.blog-oblozhka) > :not(.blog-oblozhka) { grid-column: 2; }
}
.blog-item p { margin: 0; color: var(--muted); line-height: 1.55; }
.blog-item .blog-date { margin: 0; }
/* Статьи: схемы и скриншоты */
.st-fig { margin: 16px 0 18px; }
.st-fig svg { display: block; width: 100%; height: auto; max-width: 720px; margin: 0 auto; font-family: inherit; }
.st-shot img {
  display: block; max-width: 100%; height: auto; margin: 0 auto;
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
.st-fig figcaption { margin-top: 8px; }
.st-h3 { font-size: 15px; margin: 14px 0 6px; }
/* Таблица ключей: иероглифы крупнее текста */
.st-keys th[scope="row"], .st-keys td:last-child { font-size: 18px; letter-spacing: 2px; }
/* Статьи: вопросы-ответы и анимация черт */
/* Частые вопросы: ответы свёрнуты, раскрываются нажатием. Содержимое
   лежит в разметке целиком — поисковики читают его и в свёрнутом виде. */
.faq { display: grid; gap: 8px; margin: 0; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0 16px;
  transition: border-color 0.15s, background 0.15s;
}
.faq-item[open] { border-color: var(--primary); }
.faq-item > summary {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  font-weight: 700;
  line-height: 1.45;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
.faq-item > summary::-webkit-details-marker { display: none; }
/* Плюс справа: в раскрытом виде поворачивается в минус */
.faq-item > summary::after {
  content: '+';
  margin-left: auto;
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--primary);
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  transition: transform 0.18s, background 0.15s;
}
.faq-item[open] > summary::after { content: '−'; background: var(--primary); color: var(--on-primary); }
.faq-item > summary:hover::after { background: var(--hover); }
.faq-item[open] > summary:hover::after { background: var(--primary); }
.faq-answer { padding: 0 0 16px; line-height: 1.6; color: var(--text); }
.faq-answer p { margin: 0 0 8px; }
.faq-answer p:last-child { margin-bottom: 0; }
.st-anim { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin: 14px 0 4px; }
.st-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.st-cell > div:first-child {
  width: 120px; height: 120px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.st-cell svg { display: block; }
.st-cap { font-size: 20px; color: var(--muted); }
.st-anim-rules .st-cell > div:first-child { width: 88px; height: 88px; }
.st-anim-rules .st-cap { font-size: 16px; }
.doc .cmp th, .doc .cmp td { text-align: left; }
.doc .cmp thead th { font-size: 13px; }
/* Соседние уровни: строка ссылок с ключевыми словами в анкорах */
.voc-levels { display: flex; flex-wrap: wrap; gap: 6px 10px; font-weight: 600; line-height: 1.6; }
.voc-levels a { color: var(--primary); text-decoration: none; }
.voc-levels a:hover { text-decoration: underline; }
.voc-part {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  white-space: nowrap;
}
a.voc-part:hover { color: var(--text); border-color: var(--muted); }
.voc-part.is-on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.voc-note { margin: 0 0 12px; font-size: 13px; line-height: 1.6; }
.voc-nav { display: flex; justify-content: space-between; gap: 14px; margin-top: 28px; font-weight: 600; }
/* Телефон: четыре узких столбца не читаются. Строка становится сеткой из
   двух столбцов: слева иероглиф, под ним пиньинь, справа перевод на всю
   оставшуюся ширину. Разметка та же, меняется только отображение. */
@media (max-width: 640px) {
  .voc { font-size: 16px; min-width: 0; }
  .voc thead { display: none; }
  .voc tbody tr {
    display: grid;
    grid-template-columns: minmax(96px, 38%) 1fr;
    column-gap: 12px;
    align-items: center;
    padding: 10px 2px;
    border-bottom: 1px solid var(--border);
  }
  .voc tbody tr:last-child { border-bottom: none; }
  .voc tbody td { display: block; padding: 0; border: none; }
  .voc tbody td.voc-num { display: none; }
  .voc-term { grid-column: 1; grid-row: 1; font-size: 26px; line-height: 1.2; }
  .voc-py { grid-column: 1; grid-row: 2; font-size: 14px; white-space: normal; }
  .voc tbody td:last-child { grid-column: 2; grid-row: 1 / span 2; line-height: 1.4; }

  /* Таблица ключей: колонок шесть, а не четыре, и правила выше раскладывают
     её вкривь. Слева — сам ключ, под ним форма внутри знака и чтение;
     справа — значение. Номер ключа оставляем: по нему ищут в словаре.
     Число черт на телефоне прячем: оно есть в заголовке раздела, а в узкой
     строке только отнимает место. */
  .kl-table tbody tr { grid-template-columns: minmax(104px, 40%) 1fr; }
  .kl-table tbody td.voc-num {
    display: block;
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    text-align: left;
  }
  .kl-table .kl-znak { grid-column: 1; grid-row: 2; font-size: 30px; line-height: 1.1; }
  .kl-table .kl-var { grid-column: 1; grid-row: 3; font-size: 20px; }
  /* У 154 ключей формы внутри знака нет. На широком экране там стоит
     прочерк, на телефоне он занял бы целую строку сетки — прячем. */
  .kl-table .kl-var-net { display: none; }
  .kl-table .kl-st { display: none; }
  .kl-table tbody td:nth-child(5) { grid-column: 1; grid-row: 4; font-size: 14px; color: var(--muted); }
  .kl-table tbody td:last-child { grid-column: 2; grid-row: 1 / span 4; align-self: center; }
}

.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); }
.doc a:not(.btn):not(.lang-badge) { color: var(--primary); }
/* Лист снизу: «Создать набор» / «Создать папку» по плюсу в нижней панели.
   На телефоне выезжает от нижнего края, как привычно, на широком экране —
   обычное окно по центру. */
.sheet { display: flex; flex-direction: column; gap: 10px; }
.sheet-handle {
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  margin: -6px auto 8px;
}
.sheet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: none;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.sheet-item:hover { background: var(--hover); }
.sheet-item .ico { display: inline-flex; width: 24px; color: var(--primary); }
.sheet-item .ico svg { width: 22px; height: 22px; }
@media (max-width: 900px) {
  .modal-backdrop.is-sheet { align-items: flex-end; padding: 0; }
  .modal-backdrop.is-sheet .modal {
    max-width: none;
    border-radius: 22px 22px 0 0;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    animation: sheet-up 0.22s ease-out;
  }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Готовая библиотека HSK (страница #/hsk) ---------- */
.hsk-page .about-lead { margin: 0 0 6px; }
.hsk-sec-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 8px; }
.hsk-sec-head h2 { margin: 0; }
.hsk-sec-sum { font-size: 13px; }
.hsk-page .doc-block p { color: var(--muted); font-size: 14px; }
/* Список учебников (/uchebniki): заголовок, строка со счётом, кнопка — с воздухом между ними */
.uch-book { margin-top: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.uch-book:last-of-type { border-bottom: 0; }
.uch-book h2 { font-size: 19px; margin: 0 0 4px; }
.uch-book .uch-book-sum { margin: 0 0 14px; }
.uch-book .uch-book-act { margin: 0; }
.hsk-links a { font-weight: 600; }
.hsk-grid { margin-top: 14px; }
/* Карточка здесь не ведёт никуда целиком — действия только у кнопок */
.hsk-card { cursor: default; }
.hsk-card:hover { transform: none; }
.hsk-card .desc { margin: 0; }
.hsk-card.is-loaded { border-color: var(--green); }
.hsk-top-line { display: inline-flex; align-items: center; gap: 8px; }
/* Метка прижата к правому краю строки */
.hsk-card .loaded-label { font-size: 12px; margin-left: auto; align-self: center; line-height: 1; white-space: nowrap; }
.hsk-card .hsk-top-line .count { line-height: 1.4; white-space: nowrap; flex: none; }
.hsk-card .set-top .hsk-top-line { flex: 1 1 auto; }
.hsk-card .card-actions { flex-wrap: wrap; }
/* Теги-фильтры: те же значки, что на карточках. Выключенный — контур,
   включённый — зелёная заливка, как у значка действующего стандарта. */
.hsk-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
/* В своей библиотеке ряд тегов стоит над папками-чипами */
.lib-tools + .hsk-tags, .hsk-tags + .lib-chips { margin-top: 0; }
.hsk-tags + .lib-chips { margin-top: 12px; }
.hsk-tag {
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 6px 12px;
  color: var(--badge-hsk20);
  background: transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.hsk-tag:hover { color: var(--badge-hsk30); border-color: var(--badge-hsk30); }
.hsk-tag.is-empty { opacity: 0.4; cursor: default; }
.hsk-tag.is-empty:hover { color: var(--badge-hsk20); border-color: currentColor; }
.hsk-tag.is-on {
  color: var(--on-green);
  background: var(--badge-hsk30);
  border-color: var(--badge-hsk30);
}
.hsk-empty { margin: 18px 0; font-size: 14px; }
/* Страница одного набора: список слов целиком, без прокрутки внутри */
.hsk-back { margin: 0 0 14px; font-size: 14px; }
.hsk-back a { color: var(--primary); font-weight: 600; text-decoration: none; }
/* Значки на странице набора лежат вне карточки, и правила .set-card на них
   не действуют — повторяем: ряд с зазорами и пилюля счётчика. */
.hsk-one-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.hsk-one-top .count {
  font-size: 12px;
  font-weight: 700;
  color: var(--count-text);
  background: var(--primary-soft);
  padding: 3px 10px;
  border-radius: 20px;
  margin-right: 4px;
}
.hsk-one-actions { margin: 14px 0 6px; }
/* Пояснение под кнопкой набора: что уже открыто и что даёт учётная запись.
   Мельче основного текста — это подпись к кнопке, а не абзац статьи. */
.hsk-one-note { margin: 0 0 14px; font-size: 13px; line-height: 1.6; max-width: 62ch; }
.hsk-words { margin-top: 18px; border-top: 1px solid var(--border); }
.hsk-words .prev-row { padding: 9px 2px; font-size: 15px; }
.hsk-words .prev-def { flex: 1.6; }
.hsk-foot { margin-top: 28px; font-size: 13px; line-height: 1.6; }
/* Телефон и планшет: наборы раздела (и папки в своей библиотеке) — лентой в два ряда, как «Недавние»
   у Квизлета. Видны два столбца и край третьего — подсказка, что ленту
   можно промотать вправо. Лента выходит за правое поле страницы до самого
   края экрана, чтобы обрезанная карточка не упиралась в отступ. */
@media (max-width: 900px) {
  .hsk-grid, .lib-grid {
    display: grid;
    grid-auto-flow: column;
    grid-template-columns: none; /* иначе первый столбец возьмёт ширину из .grid */
    grid-template-rows: 1fr 1fr;
    grid-auto-columns: 44%;
    gap: 10px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 0;
    margin-right: -16px;
    padding: 4px 16px 8px 0;
    scrollbar-width: none;
  }
  .hsk-grid::-webkit-scrollbar, .lib-grid::-webkit-scrollbar { display: none; }
  .hsk-grid > .set-card, .lib-grid > .set-card { scroll-snap-align: start; padding: 14px; min-width: 0; }
  /* Раздел с одним-двумя наборами — один ряд, иначе под ним пустота */
  .hsk-grid.is-short, .lib-grid.is-short { grid-template-rows: 1fr; }
  .hsk-grid .set-card h3, .lib-grid .set-card h3, .hsk-grid .set-card .deck-title { font-size: 16px; }
  .hsk-grid .set-card .set-top, .lib-grid .set-card .set-top { gap: 5px; margin-bottom: 8px; }
  .hsk-grid .set-card .card-actions, .lib-grid .set-card .card-actions { gap: 6px; }
  /* В узкой карточке кнопки одна под другой на всю ширину */
  .hsk-grid .set-card .card-actions > *, .lib-grid .set-card .card-actions > * { flex: 1 1 100%; text-align: center; }
  /* Верх карточки всегда в две строки — счётчик, под ним значки. Иначе
     «1000 карточек» переносит значки, а «300 карточек» нет, и соседние
     карточки в ленте выглядят по-разному. */
  .hsk-grid .set-card .set-top, .lib-grid .set-card .set-top { display: block; }
  .hsk-grid .set-card .hsk-top-line, .lib-grid .set-card .hsk-top-line { display: flex; width: 100%; margin: 0 0 6px; gap: 6px; }
  /* В узкой карточке счётчик и метка на одной строке помещаются мельче */
  .hsk-grid .set-card .hsk-top-line .count, .lib-grid .set-card .hsk-top-line .count { font-size: 11px; padding: 3px 8px; }
  .hsk-grid .set-card .loaded-label, .lib-grid .set-card .loaded-label { font-size: 11px; }
  .hsk-grid .set-card .set-top .count, .lib-grid .set-card .set-top .count { margin: 0; }
  .hsk-grid .set-card .set-top .lang-badge, .lib-grid .set-card .set-top .lang-badge { display: inline-block; margin: 0 4px 0 0; }
  /* В своей библиотеке счётчик лежит в set-top сам, без обёртки */
  .lib-grid .set-card .set-top > .count { display: block; width: max-content; margin: 0 0 6px; }
  .hsk-grid .set-card .desc, .lib-grid .set-card .desc { display: block; font-size: 13px; line-height: 1.45; }
  .hsk-grid .set-card .card-actions, .lib-grid .set-card .card-actions { margin-top: auto; padding-top: 10px; }
  .hsk-long { display: none; }
}
.hsk-short { display: none; }
@media (max-width: 900px) { .hsk-short { display: inline; } }
@media (min-width: 561px) and (max-width: 900px) {
  .hsk-grid, .lib-grid { margin-right: -24px; padding-right: 24px; }
}
/* Телефон: полтора столбца — одна карточка целиком и половина следующей.
   В карточке такой ширины помещается и полная подпись кнопки. */
@media (max-width: 560px) {
  .hsk-grid, .lib-grid { grid-auto-columns: calc((100% - 10px) / 1.5); }
  .hsk-long { display: inline; }
  .hsk-short { display: none; }
}

/* ---------- «О проекте»: живые иллюстрации ---------- */
.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); }

/* Контакты: адрес почты — главное на странице, поэтому он крупный
   и в отдельной рамке, а не строчкой в тексте. */
.contact-card {
  margin: 20px 0 4px; padding: 18px 20px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px;
}
.contact-card p { margin: 10px 0 0; }
.contact-mail {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 22px; font-weight: 700; color: var(--primary);
  word-break: break-all;
}
.contact-mail-ico { width: 1.1em; height: 1.1em; flex: none; }
@media (max-width: 470px) {
  .contact-card { padding: 14px 16px; }
  .contact-mail { font-size: 18px; }
}

.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(--ok-text); 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; }

/* ================= Главная для гостей (js/views/landing.js) =================
   Яркая страница на цветах тонов — они уже есть в палитре и заодно намекают
   на главную особенность приложения. Все демонстрации живые, картинок нет. */
.lp { max-width: 1080px; margin: 0 auto; }
.lp h1, .lp h2 { letter-spacing: -0.5px; }

/* --- Первый экран --- */
.lp-hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 40px;
  align-items: center;
  padding: 40px 0 56px;
}
.lp-eyebrow {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--primary);
}
.lp-title { margin: 0 0 18px; font-size: 52px; line-height: 1.08; font-weight: 800; }
.lp-accent {
  background: linear-gradient(100deg, var(--tone1), var(--tone4) 55%, var(--tone3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lp-lead { margin: 0 0 26px; font-size: 18px; line-height: 1.6; color: var(--muted); max-width: 30em; }
.lp-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.lp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 15px 26px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.lp-btn-main {
  background: linear-gradient(120deg, var(--primary), var(--tone4));
  color: var(--on-primary);
  box-shadow: 0 10px 26px -10px var(--primary);
}
.lp-btn-main:hover { transform: translateY(-2px); box-shadow: 0 16px 32px -12px var(--primary); }
.lp-btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.lp-btn-ghost:hover { background: var(--hover); transform: translateY(-2px); }
.lp-note { margin: 16px 0 0; font-size: 13px; color: var(--muted); }

/* Стопка карточек: две сзади намекают, что их много */
.lp-hero-art { position: relative; min-height: 300px; display: flex; align-items: center; justify-content: center; }
.lp-card {
  position: absolute;
  width: 260px;
  height: 280px;
  border-radius: 22px;
  background: var(--face);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.lp-card-back { transform: rotate(-9deg) translateY(10px); opacity: 0.45; }
.lp-card-mid { transform: rotate(-4deg) translateY(4px); opacity: 0.7; }
.lp-card-front {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  animation: lp-float 6s ease-in-out infinite;
  overflow: hidden;               /* уходящее слово не вылезает за края */
}
/* Содержимое карточки живёт отдельным слоем: сама карточка покачивается
   через transform, и если бы смена слов двигала тот же элемент, два
   движения дрались бы за одно свойство. */
.lp-card-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.lp-card-face.is-out  { opacity: 0; transform: translateY(-16px); }
/* Следующее слово ставится вниз мгновенно, без перехода, — иначе оно
   доехало бы туда на глазах, вместо того чтобы появиться уже снизу. */
.lp-card-face.is-next { opacity: 0; transform: translateY(16px); transition: none; }
@keyframes lp-float {
  0%, 100% { transform: translateY(0) rotate(1.5deg); }
  50%      { transform: translateY(-12px) rotate(-1.5deg); }
}
.lp-card-term { font-size: 52px; font-weight: 500; }
.lp-card-py { font-size: 20px; color: var(--face-sub); }
.lp-card-def { font-size: 17px; color: var(--face-sub); opacity: 0.85; }

/* --- Числа --- */
.lp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 64px; }
.lp-stat {
  padding: 22px 18px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid currentColor;
}
.lp-stat-num { display: block; font-size: 28px; font-weight: 800; color: currentColor; }
.lp-stat-label { display: block; margin-top: 6px; font-size: 13px; line-height: 1.4; color: var(--muted); }

/* Цвета тонов как тема разделов */
.lp-tone1 { color: var(--tone1); }
.lp-tone2 { color: var(--tone2); }
.lp-tone3 { color: var(--tone3); }
.lp-tone4 { color: var(--tone4); }

/* --- Возможности --- */
.lp-features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-bottom: 64px; }
.lp-feature {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 30px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
/* Цветное свечение в углу — источник цвета берётся из класса тона */
.lp-feature::before {
  content: '';
  position: absolute;
  top: -70px;
  right: -70px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.14;
  filter: blur(30px);
  pointer-events: none;
}
.lp-feature.is-wide { grid-column: span 2; flex-direction: row; align-items: center; }
.lp-feature.is-wide .lp-feature-text { flex: 1; }
.lp-feature h2 { margin: 0 0 10px; font-size: 23px; color: var(--text); }
.lp-feature p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--muted); }
.lp-demo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 22px;
  border-radius: 16px;
  background: var(--bg);
  min-height: 130px;
}
.lp-feature.is-wide .lp-demo { flex: 1; min-width: 280px; }

/* Тона */
.lp-tone-word { font-size: 46px; letter-spacing: 6px; }
.lp-tone-legend { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%; }
.lp-tone-chip {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 12px;
  font-weight: 700;
}

/* Словарь */
.lp-dict-whole { font-size: 40px; width: 100%; text-align: center; }
.lp-dict-parts { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.lp-dict-part { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--text); }
.lp-dict-part b { font-size: 26px; font-weight: 500; }
.lp-dict-py { font-size: 13px; color: var(--lavender); font-weight: 600; }
.lp-dict-mean { font-size: 12px; color: var(--muted); }

/* Порядок черт */
.lp-demo-hw { padding: 10px; }
.lp-hw { width: 190px; height: 190px; }

/* Расписание */
.lp-demo-srs { gap: 10px; }
.lp-srs-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  animation: lp-pop 3.5s ease-in-out infinite;
}
.lp-srs-step b { font-size: 19px; }
.lp-srs-step small { font-size: 10px; color: var(--muted); }
@keyframes lp-pop {
  0%, 60%, 100% { transform: translateY(0); border-color: var(--border); }
  30%           { transform: translateY(-7px); border-color: currentColor; }
}

/* Свайп */
.lp-demo-swipe { overflow: hidden; }
.lp-swipe-card {
  position: relative;
  width: 170px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--face);
  border: 3px solid var(--border);
  animation: lp-swipe 6s ease-in-out infinite;
}
.lp-swipe-word { font-size: 36px; color: var(--face-text); animation: lp-swipe-word 6s ease-in-out infinite; }
.lp-swipe-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  font-weight: 800;
  white-space: nowrap;
  opacity: 0;
}
.lp-swipe-label.yes { right: 10px; color: var(--green); animation: lp-yes 6s ease-in-out infinite; }
.lp-swipe-label.no { left: 10px; color: var(--amber); animation: lp-no 6s ease-in-out infinite; }
@keyframes lp-swipe {
  0%, 8%    { transform: translateX(0) rotate(0); border-color: var(--border); }
  22%, 30%  { transform: translateX(52px) rotate(2deg); border-color: var(--green); }
  44%, 52%  { transform: translateX(0) rotate(0); border-color: var(--border); }
  66%, 74%  { transform: translateX(-52px) rotate(-2deg); border-color: var(--amber); }
  90%, 100% { transform: translateX(0) rotate(0); border-color: var(--border); }
}
@keyframes lp-swipe-word {
  0%, 8%, 44%, 52%, 90%, 100% { opacity: 1; }
  22%, 30%, 66%, 74%          { opacity: 0.12; }
}
@keyframes lp-yes { 0%, 8% { opacity: 0; } 22%, 30% { opacity: 1; } 44%, 100% { opacity: 0; } }
@keyframes lp-no  { 0%, 52% { opacity: 0; } 66%, 74% { opacity: 1; } 90%, 100% { opacity: 0; } }

/* Два стандарта: уровни выкладываются на полку слева направо. Действующий
   HSK 3.0 залит зелёным, старый 2.0 — только контуром, теми же цветами,
   какими помечены наборы в библиотеке. */
.lp-demo-hsk { flex-direction: column; align-items: stretch; justify-content: center; gap: 14px; }
.lp-std { display: flex; align-items: center; gap: 10px; }
.lp-std-tag {
  flex: none;
  min-width: 58px;
  padding: 4px 7px;
  border-radius: 6px;
  border: 1px solid currentColor;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-align: center;
  white-space: nowrap;
}
.lp-std-new .lp-std-tag { color: var(--on-green); background: var(--badge-hsk30); border-color: var(--badge-hsk30); }
.lp-std-old .lp-std-tag { color: var(--badge-hsk20); }
.lp-std-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.lp-std-chip {
  min-width: 26px;
  padding: 5px 7px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  /* Стартовое состояние — то же, что и в начале ленты: без него первый
     кадр до запуска анимации мигал бы готовым уровнем. */
  opacity: 0;
  animation: lp-shelf 6s ease-in-out infinite;
}
.lp-std-new .lp-std-chip { color: var(--on-green); background: var(--badge-hsk30); border-color: var(--badge-hsk30); }
.lp-std-old .lp-std-chip { color: var(--badge-hsk20); }

@keyframes lp-shelf {
  0%        { opacity: 0; transform: translateY(8px) scale(0.9); }
  8%, 82%   { opacity: 1; transform: translateY(0) scale(1); }
  95%, 100% { opacity: 0; transform: translateY(-6px) scale(0.96); }
}

/* --- Текст о сайте (12.11.2026): уровни HSK, первые статьи, темы ---
   Обычный читаемый текст, без карточек: ссылки на страницы сайта. */
.lp-text { max-width: 760px; margin: 0 auto 44px; padding: 0 4px; }
.lp-text h2 { margin: 30px 0 10px; font-size: 23px; color: var(--text); }
.lp-text h2:first-child { margin-top: 0; }
.lp-text p { margin: 0 0 12px; font-size: 16px; line-height: 1.65; color: var(--muted); }
.lp-text a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }

/* --- Заключение --- */
.lp-outro {
  text-align: center;
  padding: 52px 30px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 90, 82, 0.16), transparent 55%),
    radial-gradient(circle at 80% 30%, rgba(201, 107, 255, 0.16), transparent 55%),
    var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 40px;
}
.lp-outro h2 { margin: 0 0 12px; font-size: 32px; }
.lp-outro p { margin: 0 auto 26px; max-width: 34em; font-size: 16px; line-height: 1.6; color: var(--muted); }
.lp-outro .lp-cta { justify-content: center; }

/* Кому анимации мешают — показываем спокойную страницу */
@media (prefers-reduced-motion: reduce) {
  .lp-card-front, .lp-srs-step, .lp-std-chip,
  .lp-swipe-card, .lp-swipe-word, .lp-swipe-label { animation: none; }
  /* Уровни без анимации должны остаться видимыми — иначе полка окажется пустой */
  .lp-std-chip { opacity: 1; }
  /* Смену карточек в этом случае не заводит и сам скрипт, см. landing.js. */
  .lp-card-face { transition: none; }
}

@media (max-width: 900px) {
  .lp-hero { grid-template-columns: 1fr; gap: 24px; padding: 24px 0 40px; }
  .lp-hero-art { min-height: 260px; order: -1; }
  .lp-title { font-size: 36px; }
  .lp-lead { font-size: 16px; }
  .lp-stats { grid-template-columns: repeat(2, 1fr); margin-bottom: 44px; }
  .lp-features { grid-template-columns: 1fr; margin-bottom: 44px; }
  .lp-feature.is-wide { grid-column: span 1; flex-direction: column; align-items: stretch; }
  .lp-feature { padding: 24px; }
  .lp-feature h2 { font-size: 20px; }
  .lp-outro { padding: 38px 22px; }
  .lp-outro h2 { font-size: 25px; }
  .lp-btn { flex: 1; min-width: 200px; }
}

/* 28.10.2026: на телефоне стопка карточек занимала полэкрана, и кнопка
   «Взять готовый HSK 3.0» уходила под нижнее меню. Стопка поменьше —
   обе кнопки в первом экране. */
@media (max-width: 560px) {
  .lp-hero { gap: 12px; padding-top: 8px; }
  .lp-hero-art { min-height: 200px; }
  .lp-card { width: 200px; height: 200px; }
  .lp-card-term { font-size: 44px; }
  .lp-card-py { font-size: 18px; }
}

/* Карта сайта для людей (/karta-sajta/): разделы списком, части словников — мелкими номерами в строке уровня */
.karta-list { list-style: none; margin: 0; padding: 0; }
.karta-list li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 15px; line-height: 1.5; }
.karta-list li:last-child { border-bottom: 0; }
.karta-parts { color: var(--muted); font-size: 13px; margin-left: 8px; }
.karta-part { display: inline-block; min-width: 20px; padding: 0 4px; margin-left: 2px; text-align: center; border-radius: 6px; background: var(--surface-2, rgba(66, 85, 255, 0.08)); text-decoration: none; }
.karta-page .doc-block h2 { font-size: 19px; margin-bottom: 10px; }

/* ================= Тарифы (/oplata/) =================
   Оформление в духе главной для гостей: крупный заголовок с цветным
   акцентом, три карточки с выделенным средним тарифом, мягкие тени.
   Цвета — из общей палитры, своих значений тут нет. */
.pay { max-width: 1040px; }
.pay-hero { padding: 6px 0 26px; text-align: center; }
.pay-eyebrow { margin: 0 0 12px; font-size: 13px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--primary); }
.pay-title { margin: 0 0 14px; font-size: 44px; line-height: 1.1; font-weight: 800; letter-spacing: -0.5px; }
.pay-accent { background: linear-gradient(100deg, var(--tone1), var(--tone4) 55%, var(--tone3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pay-lead { margin: 0 auto 16px; max-width: 46em; font-size: 17px; line-height: 1.6; color: var(--muted); }
.pay-trial { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 8px 16px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; font-weight: 600; }
.tar-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone2, #37c26b); flex: none; }
.pay-sec { margin-top: 34px; }
.pay-sec > h2 { font-size: 22px; margin: 0 0 14px; letter-spacing: -0.3px; }

/* --- Карточки тарифов --- */
.tarify { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.tar-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 20px 20px;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.tar-card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.55); }
/* Средний тариф — тот, который выбирают чаще: рамка цветом и лента сверху */
.tar-card.is-best { border-color: var(--primary); box-shadow: 0 20px 44px -24px var(--primary); }
.tar-ribbon {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  white-space: nowrap; padding: 4px 12px; border-radius: 999px;
  background: linear-gradient(120deg, var(--primary), var(--tone4));
  color: var(--on-primary); font-size: 11px; font-weight: 800; letter-spacing: 0.4px; text-transform: uppercase;
}
.tar-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.tar-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.tar-tag { font-size: 10px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; color: var(--on-primary); background: var(--primary); border-radius: 999px; padding: 3px 9px; }
.tar-price { display: flex; align-items: baseline; gap: 7px; margin: 12px 0 2px; }
.tar-price b { font-size: 34px; font-weight: 800; letter-spacing: -1px; }
.tar-unit { font-size: 13px; color: var(--muted); }
.tar-sub { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.tar-trial { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--text); }
.tar-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 7px; }
.tar-list li { position: relative; padding-left: 22px; font-size: 14px; line-height: 1.45; }
.tar-list li::before { content: '✓'; position: absolute; left: 0; top: 0; color: var(--primary); font-weight: 800; }
.tar-for { flex: 1; margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.tar-btn {
  display: block; padding: 13px 18px; border-radius: 12px; text-align: center;
  font-size: 15px; font-weight: 700; text-decoration: none;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}
.tar-btn:hover { background: var(--hover); transform: translateY(-1px); }
/* Ссылки внутри .doc подкрашены общим правилом — кнопкам это не нужно */
.doc .tarify a.tar-btn { color: var(--text); text-decoration: none; }
.doc .tarify a.tar-btn.tar-btn-main { color: var(--on-primary); }
.tar-btn-main { background: linear-gradient(120deg, var(--primary), var(--tone4)); color: var(--on-primary); border-color: transparent; box-shadow: 0 10px 24px -12px var(--primary); }
.tar-btn-main:hover { background: linear-gradient(120deg, var(--primary), var(--tone4)); box-shadow: 0 16px 30px -14px var(--primary); }
.tar-note { font-size: 13px; margin-top: 14px; }

/* --- Промокод --- */
.promo-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 22px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
.promo-box h2 { margin: 0 0 4px; font-size: 20px; }
.promo-box p { margin: 0; font-size: 14px; }
.promo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.promo-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.promo-input { min-width: 190px; padding: 12px 16px; font: inherit; letter-spacing: 1px; text-transform: uppercase; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }
.promo-input::placeholder { letter-spacing: 1px; color: var(--muted); }
.promo-input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

/* --- Бесплатно / по подписке --- */
.tar-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tar-col { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 20px; }
.tar-col-pay { border-color: var(--primary); }
.tar-col h3 { display: flex; align-items: center; gap: 10px; font-size: 16px; margin: 0 0 12px; }
.tar-ico { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 9px; font-size: 13px; font-weight: 800; flex: none; }
.tar-ico-free { background: var(--surface-2); color: var(--text); }
.tar-ico-pay { background: linear-gradient(120deg, var(--primary), var(--tone4)); color: var(--on-primary); }
.tar-plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.tar-plain li { position: relative; padding-left: 20px; font-size: 14px; line-height: 1.5; color: var(--text); }
.tar-plain li::before { content: ''; position: absolute; left: 4px; top: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.tar-col-free .tar-plain li::before { background: var(--muted); }

@media (max-width: 860px) {
  .tarify { grid-template-columns: 1fr; gap: 22px; }
  .tar-cols { grid-template-columns: 1fr; }
  .pay-title { font-size: 32px; }
  .pay-lead { font-size: 16px; }
  .promo-box { flex-direction: column; align-items: stretch; }
  .promo { flex-direction: column; align-items: stretch; }
  .promo .btn { width: 100%; }
}

/* Экран «занятия по подписке» вместо занятия (js/dostup.js) */
.pay-wall-box { max-width: 560px; margin: 24px auto 0; padding: 26px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; text-align: center; }
.pay-wall-box h1 { margin: 0 0 10px; font-size: 26px; }
.pay-wall-text { margin: 0 0 18px; color: var(--muted); line-height: 1.6; }
.pay-wall-actions { justify-content: center; gap: 10px; flex-wrap: wrap; }
.pay-wall-note { margin: 16px 0 0; font-size: 13px; }

/* Свои цвета тонов в настройках набора (js/tsveta.js) */
.tone-row { align-items: flex-start; }
.tone-pick { display: grid; gap: 8px; margin: 12px 0 10px; }
.tone-pick-item { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; cursor: pointer; }
.tone-pick-item input[type='color'] {
  width: 34px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 8px;
  background: none; cursor: pointer;
}
.tone-pick-item input[type='color']::-webkit-color-swatch-wrapper { padding: 2px; }
.tone-pick-item input[type='color']::-webkit-color-swatch { border: none; border-radius: 6px; }
.tone-pick-name { font-weight: 600; font-size: 14px; }
.tone-pick-ex { font-size: 17px; font-weight: 700; justify-self: end; }
.tone-alpha-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.tone-alpha { flex: 1; min-width: 120px; accent-color: var(--primary); }
.tone-alpha-val { min-width: 46px; font-weight: 600; }

/* Пробное занятие (js/proba.js): полоса над режимами и окно с выбором. */
.proba-bar {
  display: flex;
  align-items: center;
  gap: 12px 16px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  background: var(--primary-soft);
}
.proba-bar-text { flex: 1 1 280px; margin: 0; font-size: 14px; line-height: 1.45; }
.proba-offer-actions { justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
@media (max-width: 520px) {
  .proba-bar .btn { width: 100%; }
  .proba-offer-actions .btn { flex: 1 1 100%; }
}

/* ---------- Интерактивы в статьях блога (js/stati-ia.js) ----------
   Блок виден только когда скрипт запустился (.is-ready): без JavaScript
   на странице не остаётся пустых рамок с кнопками, которые ничего не делают. */
.ia { display: none; margin: 16px 0 20px; padding: 16px 18px; border: 1px solid var(--border);
  border-radius: 14px; background: var(--surface); }
.ia.is-ready { display: block; }
.ia-title { margin: 0 0 10px; font-weight: 700; font-size: 16px; }
.ia-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.ia-chip.is-on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.ia-note { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.ia-input { width: 100%; max-width: 360px; padding: 10px 12px; font-size: 18px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg); color: var(--text); }
.ia-out { margin-top: 8px; }
.ia-big { font-size: 30px; line-height: 1.3; margin: 6px 0; font-weight: 600; word-break: break-all; }
.ia-read { margin: 0 0 10px; font-size: 18px; color: var(--pinyin, var(--muted)); }
.ia-rules { margin: 4px 0 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.ia-bad { color: var(--muted); text-decoration: line-through; }
/* слоги и тоны */
.ia-tones { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.ia-tone { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text);
  cursor: pointer; font: inherit; }
.ia-tone:hover:not(:disabled) { border-color: var(--primary); }
.ia-tone:disabled { cursor: default; opacity: .6; }
.ia-tone-n { font-size: 12px; color: var(--muted); }
.ia-tone-p { font-size: 18px; font-weight: 700; }
.ia-tone-z { font-size: 34px; line-height: 1.2; }
.ia-tone-r { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.25; }
@media (max-width: 520px) { .ia-tones { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* таблица слогов пиньиня: шире статьи, прокручивается вбок внутри рамки;
   согласные слева и гласные сверху закреплены, чтобы не терять, где ты */
.ia-py-now { margin: 4px 0 0; font-size: 15px; color: var(--muted); }
.ia-py-now b { color: var(--text); font-size: 18px; }
.ia-py-wrap { margin-top: 14px; max-height: 70vh; overflow: auto; border: 1px solid var(--border);
  border-radius: 12px; background: var(--bg); -webkit-overflow-scrolling: touch; }
.ia-py-wrap:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ia-py { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.ia-py th, .ia-py td { padding: 2px; border-bottom: 1px solid var(--border); text-align: center; white-space: nowrap; }
.ia-py thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); padding: 6px 4px;
  color: var(--muted); font-weight: 600; }
.ia-py-ini { position: sticky; left: 0; z-index: 1; background: var(--surface); padding: 0 8px;
  color: var(--muted); font-weight: 700; border-right: 1px solid var(--border); }
.ia-py thead .ia-py-corner { left: 0; z-index: 3; }
.ia-py .ia-py-gr { border-left: 2px solid var(--border); }
.ia-py-cell { min-width: 44px; min-height: 32px; padding: 4px 6px; border: 1px solid transparent; border-radius: 8px;
  background: none; color: var(--text); font: inherit; cursor: pointer; }
.ia-py-cell:hover { border-color: var(--primary); }
.ia-py-cell.is-on { background: var(--primary); color: var(--on-primary); }
/* мини-тренажёр: карточка прямо в статье */
.ia-mini-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 190px; margin: 6px 0 10px; padding: 18px; border: 1px solid var(--border);
  border-radius: 16px; background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; }
.ia-mini-card:hover { border-color: var(--primary); }
.ia-mini-card .ia-zh { font-size: 64px; line-height: 1.1; }
.ia-mini-card.is-long .ia-zh { font-size: 44px; }
.ia-mini-card.is-xlong .ia-zh { font-size: 32px; }
.ia-mini-back { display: none; flex-direction: column; align-items: center; gap: 2px; }
.ia-mini-card.is-flipped .ia-mini-back { display: flex; }
.ia-mini-card.is-flipped .ia-mini-hint { display: none; }
.ia-mini-p { font-size: 22px; font-weight: 700; color: var(--pinyin, var(--primary)); }
.ia-mini-r { font-size: 17px; }
.ia-mini-hint { font-size: 13px; color: var(--muted); }
.ia-mini-btns .btn { flex: 1 1 0; }
.ia-mini-btns[hidden] { display: none; }
/* угадай тон на слух */
.ia-ear .ia-ear-play { margin: 6px 0 4px; }
.ia-ear-res { margin: 10px 0 8px; font-size: 17px; }
.ia-ear-res span[lang] { font-size: 26px; margin: 0 4px; }
.ia-ear-res.is-ok { color: var(--ok-text); }
.ia-ear-res.is-no { color: var(--no-text); }
/* разговорник */
.ia-phrases { display: grid; gap: 8px; margin-top: 10px; }
.ia-phrase { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px;
  align-items: baseline; text-align: left; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; }
.ia-phrase:hover { border-color: var(--primary); }
.ia-phrase .ia-zh { grid-row: 1 / span 2; font-size: 28px; }
.ia-phrase-p { font-weight: 700; color: var(--primary); }
.ia-phrase-r { color: var(--muted); font-size: 14px; }
.ia.is-hidden .ia-phrase:not(.is-open) .ia-phrase-r { visibility: hidden; }
/* тест */
.ia-q { font-size: 18px; margin: 4px 0 10px; }
.ia-q .ia-zh { font-size: 30px; }
.ia-count { font-size: 13px; margin: 0; }
.ia-answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ia-answer { padding: 10px; font-size: 15px; white-space: normal; }
.ia-answer.is-ok { background: var(--green-soft); border-color: var(--green); color: var(--text); }
.ia-answer.is-no { background: var(--red-soft); border-color: var(--red); color: var(--text); }
.ia-next { margin-top: 10px; }
@media (max-width: 420px) { .ia-answers { grid-template-columns: 1fr; } }

/* Разбор уровня на странице словника (tools/urovni.py) */
.lvl-words li { margin: 10px 0; }
.lvl-words b span[lang] { font-size: 1.15em; }
.lvl-ex { color: var(--muted); font-size: 0.95em; }

/* Соцсети (tools/socseti.py): ряд значков в подвале и кнопки на /kontakty/ */
.footer-soc { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: -8px; }
.footer-soc-head { font-size: 12px; color: var(--muted); margin-right: 2px; }
.soc-link { display: inline-flex; width: 22px; height: 22px; color: var(--muted); border-radius: 6px; }
.soc-link svg { width: 100%; height: 100%; display: block; }
.soc-link:hover, .soc-link:focus-visible { color: var(--primary); }
.soc-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 4px; }
.soc-btn { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; }
.soc-btn svg { width: 28px; height: 28px; color: var(--primary); flex: none; }
.soc-btn:hover { border-color: var(--primary); }

/* Видео «как занимаются карточками» (tools/video.py) — рядом с кнопкой */
.demo-video { display: flex; align-items: center; gap: 16px; margin: 14px 0 18px; }
.demo-video video { width: 150px; height: auto; flex: none; border-radius: 18px; border: 1px solid var(--border);
  background: var(--surface-2); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); }
.demo-video figcaption { font-size: 15px; line-height: 1.5; color: var(--muted); }
.demo-video figcaption b { color: var(--text); }
@media (max-width: 520px) {
  .demo-video { gap: 12px; }
  .demo-video video { width: 118px; border-radius: 14px; }
  .demo-video figcaption { font-size: 14px; }
}
/* Крупное видео с телефона — в статье о мобильном приложении */
.demo-video-big video { width: 240px; }
@media (max-width: 520px) { .demo-video-big { flex-direction: column; align-items: flex-start; } .demo-video-big video { width: 220px; } }

/* Горизонтальное видео 16:9 — запись приложения на компьютере, во всю ширину статьи */
.demo-video-wide { margin: 18px 0 22px; }
.demo-video-wide video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); }
.demo-video-wide figcaption { margin-top: 10px; font-size: 15px; line-height: 1.5; color: var(--muted); }
.demo-video-wide figcaption b { color: var(--text); }
@media (max-width: 520px) { .demo-video-wide figcaption { font-size: 14px; } }

/* ---------- Подбор репетитора: анкета /repetitor-kitajskogo/ (js/repetitor.js) ---------- */
.rep-free { display: inline-block; margin: 4px 0 6px; padding: 10px 16px; border-radius: 12px; font-size: 18px;
  color: var(--ok-text); background: color-mix(in srgb, var(--tone2) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone2) 40%, transparent); }
.rep-free-step { margin: -6px 0 14px; font-size: 16px; padding: 8px 14px; }
.rep-box { margin: 18px 0 26px; padding: 22px; border: 1px solid var(--border); border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow); }
.rep-progress { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.rep-progress span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .25s; }
.rep-step { margin: 10px 0 4px; font-size: 14px; color: var(--muted); }
.rep-q { margin: 6px 0 16px; font-size: 22px; line-height: 1.3; }
.rep-options { display: grid; gap: 10px; }
.rep-options-row { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.rep-option { padding: 14px 16px; text-align: left; font: inherit; font-size: 16px; color: var(--text); cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; transition: border-color .15s, background .15s; }
.rep-option:hover, .rep-option:focus-visible { border-color: var(--primary); outline: none; }
.rep-option.is-on { border-color: var(--primary); background: var(--primary-soft); }
.rep-back { margin-top: 14px; }
.rep-contact { display: grid; gap: 14px; }
.rep-field { display: grid; gap: 6px; }
.rep-label { font-size: 14px; font-weight: 600; color: var(--text); }
.rep-field input[type=text] { padding: 12px 14px; font: inherit; font-size: 16px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; }
.rep-field input[type=text]:focus { border-color: var(--primary); outline: none; }
.rep-radio { display: flex; align-items: center; gap: 6px; padding: 10px 12px; font-size: 15px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.rep-consent { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.rep-consent input { margin-top: 3px; flex: none; }
.rep-error { min-height: 1em; margin: 0; font-size: 14px; color: var(--red); }
.rep-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; }
.rep-actions .rep-back { margin-top: 0; }
.rep-done { margin: 0 0 16px; color: var(--muted); }
.rep-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
@media (max-width: 520px) { .rep-box { padding: 16px; } .rep-q { font-size: 19px; } }

/* Плашка «Подобрать репетитора» в статьях блога (tools/stati.py, блок_репетитора) */
.rep-cta { display: flex; align-items: center; gap: 16px; margin: 26px 0 8px; padding: 18px 20px; border-radius: 16px;
  background: var(--primary-soft); border: 1px solid var(--border); }
.rep-cta-text { flex: 1; }
.rep-cta-text b { display: block; font-size: 17px; margin-bottom: 4px; color: var(--text); }
.rep-cta-text span { font-size: 15px; color: var(--muted); }
.rep-cta-text .rep-cta-free { display: block; margin-bottom: 4px; font-weight: 700; color: var(--ok-text); }
.rep-cta .btn { flex: none; white-space: nowrap; }
@media (max-width: 520px) { .rep-cta { flex-direction: column; align-items: stretch; } }

/* Плашка внизу экрана в статьях блога на телефоне (js/blog-niz.js) */
.blog-niz {
  position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); z-index: 50;
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  animation: blog-niz-in .25s ease-out;
}
.blog-niz[hidden] { display: none; }
.blog-niz-text { flex: 1; min-width: 0; line-height: 1.3; }
.blog-niz-text b { display: block; font-size: 15px; color: var(--text); }
.blog-niz-text span { display: block; font-size: 13px; color: var(--muted); }
.blog-niz .btn { flex: none; padding: 9px 14px; }
.blog-niz-x {
  flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent;
  color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer;
}
body.has-niz { padding-bottom: 150px; }
@keyframes blog-niz-in { from { transform: translateY(120%); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .blog-niz { animation: none; } }
@media (min-width: 769px) { .blog-niz { display: none !important; } }

/* Блок «Попробуйте сами» в конце статьи блога (tools/stati.py, блок_в_конце) */
.blog-poprobuj { display: flex; align-items: center; gap: 16px; margin: 26px 0 8px; padding: 18px 20px; border-radius: 16px;
  background: var(--surface-2); border: 1px solid var(--border); }
.blog-poprobuj-text { flex: 1; }
.blog-poprobuj-text b { display: block; font-size: 17px; margin-bottom: 4px; color: var(--text); }
.blog-poprobuj-text span { font-size: 15px; color: var(--muted); }
.blog-poprobuj .btn { flex: none; white-space: nowrap; }
@media (max-width: 520px) { .blog-poprobuj { flex-direction: column; align-items: stretch; } }

/* Таблица цветов в статье «Цвета на китайском» (tools/stati.py, таблица_цветов) */
.cv-tab .cv-sw { display: inline-block; width: 18px; height: 18px; margin-right: 8px; vertical-align: -3px;
  border-radius: 4px; border: 1px solid var(--border); }
.cv-tab .cv-zh { font-size: 18px; }

/* Таблица сравнения иероглифов (tools/stati.py, «Китайский или японский») — знаки крупнее */
.cmp.zh-big td { font-size: 22px; line-height: 1.3; }
/* Таблица, где иероглиф — в первой колонке («Китайский для детей»): знак крупнее */
.cmp.zh-first tbody th { font-size: 26px; font-weight: 400; }

/* Кнопка набора в середине статьи (tools/stati.py, блок_в_середине) */
.blog-seredina { display: flex; align-items: center; gap: 12px; margin: 22px 0; padding: 12px 16px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border); }
.blog-seredina span { flex: 1; font-size: 15px; color: var(--muted); line-height: 1.4; }
.blog-seredina .btn { flex: none; white-space: nowrap; }
@media (max-width: 520px) { .blog-seredina { flex-direction: column; align-items: stretch; } .blog-seredina .btn { text-align: center; } }
/* Ссылка в набор под тренажёром статьи (js/stati-ia.js, шагДальше) */
.ia-dalshe { margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed var(--border); font-size: 15px; font-weight: 600; }

/* Статичные страницы наборов (/biblioteka-hsk/, /nabory-po-temam/,
   /nabory-po-uchebnikam/ — tools/biblioteka.py, podborki.py): на телефоне
   списком в один столбец, а не лентой вбок. 18.10.2026, Вебвизор: в ленте
   видны HSK 1 и 2, а HSK 3–6 прятались за правым краем. В приложении
   (/hsk, своя библиотека) лента остаётся. */
@media (max-width: 900px) {
  .hsk-grid.is-spisok {
    grid-auto-flow: row;
    grid-template-rows: none;
    grid-template-columns: 1fr 1fr;
    grid-auto-columns: auto;
    overflow: visible;
    scroll-snap-type: none;
    margin-right: 0;
    padding: 4px 0 0;
  }
  .hsk-grid.is-spisok .set-card .card-actions > * { flex: 1 1 0; }
}
@media (max-width: 560px) {
  .hsk-grid.is-spisok { grid-template-columns: 1fr; grid-auto-columns: auto; }
  .hsk-grid.is-spisok .set-card .desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}

/* Строка-кнопка набора в таблице слов (tools/knopki_nabora.py) */
.voc tbody tr.voc-cta td { padding: 14px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.voc tbody tr.voc-cta:hover td { background: var(--surface-2); }
.voc-cta .btn { margin-right: 12px; }
.voc-cta span { font-size: 13px; color: var(--muted); }
/* На телефоне строки таблицы — сетка из двух столбцов: кнопке — вся ширина */
@media (max-width: 640px) {
  .voc tbody tr.voc-cta { display: block; padding: 6px 0; }
  .voc tbody tr.voc-cta td { display: block; grid-column: auto; border-radius: 12px; border: none; text-align: center; }
  .voc-cta .btn { display: block; margin: 0 0 6px; }
  .voc-cta span { display: block; }
}

/* Шпаргалка «Коротко» в начале статьи (tools/stati.py, КОРОТКО_ЦИФРЫ) */
.blog-korotko { margin: 18px 0 8px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.blog-korotko > b { display: block; margin-bottom: 8px; font-size: 15px; }
.blog-korotko ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; }
.blog-korotko li { white-space: nowrap; font-size: 15px; }
.bk-n { display: inline-block; min-width: 2.2em; color: var(--muted); font-variant-numeric: tabular-nums; }
.bk-z { font-size: 19px; }
.bk-p { color: var(--muted); }
.blog-korotko p { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
@media (max-width: 420px) { .blog-korotko ul { grid-template-columns: 1fr 1fr; } .blog-korotko li { font-size: 14px; } .blog-korotko li.bk-wide { grid-column: 1 / -1; } }

/* Кнопка «Учить эти слова карточками» в списке слов набора (js/views/hsk.js) */
.hsk-words-cta { padding: 12px 0; border-bottom: 1px solid var(--border); text-align: center; }
@media (max-width: 560px) { .hsk-words-cta .btn { width: 100%; } }

/* Пока человек печатает (js/utils.js, класс pechataet), нижнее меню и плашка
   внизу экрана скрыты: иначе они поднимаются над клавиатурой и закрывают поле */
html.pechataet .tabbar, html.pechataet .blog-niz { display: none !important; }
html.pechataet body { padding-bottom: 0; }

/* Таблица цветов на телефоне — целиком на экране, без прокрутки вбок
   (4 столбца с отступами по 14 точек не помещались в 343 точки) */
@media (max-width: 480px) {
  .cmp.cv-tab th, .cmp.cv-tab td { padding: 9px 5px; font-size: 14px; }
  .cmp.cv-tab .cv-zh { font-size: 17px; }
  .cmp.cv-tab .cv-sw { width: 14px; height: 14px; margin-right: 5px; }
  .cmp.cv-tab tbody th { text-align: left; white-space: normal; }
}

/* Форма регистрации: польза и напоминание о наборе (js/views/auth.js) */
.auth-plus { list-style: none; margin: 0 0 18px; padding: 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.auth-plus li { position: relative; padding-left: 22px; margin: 4px 0; }
.auth-plus li::before { content: '✓'; position: absolute; left: 2px; top: 0; color: var(--primary); font-weight: 700; }
.auth-plus .auth-plus-nabor { color: var(--text); font-weight: 600; }
/* На телефоне форма целиком в экране, кнопка без прокрутки */
@media (max-width: 600px) {
  .auth-page { padding: 0 0 16px; }
  .auth-card { padding: 18px 16px; }
  .auth-card h1 { font-size: 22px; }
  .auth-card > p.muted { margin-bottom: 10px !important; }
  .auth-plus { margin-bottom: 10px; font-size: 13px; }
  .auth-plus li { margin: 2px 0; }
  .app:has(> .auth-page) { padding-top: 8px; }
  .auth-form label.field { margin-bottom: 8px; }
  .auth-form label.field input { padding-top: 9px; padding-bottom: 9px; }
  .auth-agree { margin: 2px 0 0; font-size: 13px; }
}
/* Запас прокрутки для короткой формы, пока открыта клавиатура. */
@media (pointer: coarse) {
  .auth-page:has(input[autocomplete="new-password"]:focus):has(.auth-agree) {
    padding-bottom: max(16px, calc(100dvh - var(--vv-h, 100dvh)));
  }
}
/* Низкий экран: из списка пользы — только набор, с которого пришли */
@media (max-width: 600px) and (max-height: 620px) {
  .auth-plus li:not(.auth-plus-nabor) { display: none; }
  .auth-card { padding-top: 14px; }
}
@media (max-width: 600px) and (max-height: 500px) {
  .auth-plus { display: none; }
}
/* Пароль с кнопкой «Показать» */
.pass-wrap { position: relative; display: block; }
.pass-wrap input { width: 100%; padding-right: 92px; }
/* 28.10.2026: поле лежит в подписи с мелким шрифтом и получало 13px — iPhone
   на таком поле приближает всю страницу. Не меньше 16px, как у почты. */
.pass-wrap input { font-size: 16px; }
.pass-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none;
  color: var(--primary); font: inherit; font-size: 14px; font-weight: 600; padding: 6px 8px; cursor: pointer; }

/* Оплата: галочка автопродления, ошибка, блок «Ваша подписка» (js/oplata.js) */
.tar-avto { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); font-size: 14px; line-height: 1.5; cursor: pointer; }
.tar-avto[hidden] { display: none; }
.tar-avto input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }
.tar-oshibka { margin: 12px 0 0; color: var(--red); font-weight: 600; font-size: 14px; }
.pay-moi { background: var(--surface); border: 1px solid var(--primary); border-radius: 18px; padding: 18px 20px; }
.pay-moi p { margin: 0 0 10px; line-height: 1.55; }
.pay-moi .btn { margin-top: 4px; }
.tar-btn.is-busy { opacity: 0.6; pointer-events: none; }
.pay-spasibo { text-align: center; padding-top: 30px; }


/* Карточки статей с картинками (12.11.2026: «О проекте»; на /po-kitajski/ те же
   правила стоят в самой странице) */
.pk-arts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 8px 0 22px; }
.pk-art { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); text-decoration: none; color: var(--text); }
.pk-art:hover { border-color: var(--primary); }
.pk-art img { width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; display: block; }
.pk-art span { padding: 10px 12px 12px; font-weight: 600; line-height: 1.3; }

/* ---------- Режим «Слушать» (js/views/listen.js, 12.11.2026) ---------- */
.ls-overlay { position: fixed; left: var(--vv-l, 0px); top: var(--vv-t, 0px); width: var(--vv-w, 100%); height: var(--vv-h, 100dvh);
  z-index: 90; background: var(--bg); overflow-y: auto; padding: 14px 20px calc(20px + env(safe-area-inset-bottom, 0px)); }
.ls-wrap { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.ls-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ls-title { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; min-width: 0; }
.ls-title .ico svg { width: 16px; height: 16px; display: block; }
.ls-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 22px 18px 18px; text-align: center; }
.ls-count { font-size: 13px; }
.ls-term { font-size: 64px; line-height: 1.2; margin: 10px 0 4px; word-break: break-word; }
.ls-py { font-size: 20px; color: var(--pinyin, var(--muted)); min-height: 1.4em; }
.ls-tr { margin-top: 12px; font: inherit; font-size: 18px; color: var(--text); background: none; border: 0; padding: 6px 10px; border-radius: 10px; cursor: pointer; }
.ls-tr.is-hidden { color: var(--primary); border: 1px dashed var(--border); font-size: 15px; }
.ls-controls { display: flex; align-items: center; justify-content: center; gap: 14px; }
.ls-nav { width: 52px; height: 52px; font-size: 22px; border-radius: 50%; }
.ls-play { min-width: 170px; min-height: 52px; font-size: 17px; border-radius: 26px; }
.ls-msg { text-align: center; margin: 0; font-size: 14px; }
.ls-settings { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.ls-row { display: flex; gap: 10px; flex-wrap: wrap; }
.ls-select { flex: 1; min-width: 140px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; }
.ls-range { display: grid; grid-template-columns: 180px 1fr 60px; align-items: center; gap: 10px; font-size: 15px; }
.ls-range b { text-align: right; }
.ls-check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.ls-check input { margin-top: 4px; width: 18px; height: 18px; }
.ls-check small { display: block; font-size: 13px; }
.ls-len { font-size: 14px; color: var(--muted); }
@media (max-width: 420px) { .ls-term { font-size: 52px; } .ls-range { grid-template-columns: 1fr 1fr 54px; font-size: 14px; } }

/* «Подбор» строкой под плитками режимов (12.11.2026: его место занял «Слушать») */
.modes-extra { display: flex; align-items: center; gap: 10px; margin: -4px 0 18px; padding: 10px 14px; border-radius: 12px;
  border: 1px dashed var(--border); color: var(--muted); text-decoration: none; font-size: 14px; }
.modes-extra:hover { border-color: var(--primary); color: var(--text); }
.modes-extra b { color: var(--text); font-weight: 600; }
.modes-extra .ico svg { width: 16px; height: 16px; display: block; color: #06b6d4; }
.modes-extra-arrow { margin-left: auto; }

/* Метка «Новинка» на плитке режима (12.11.2026): яркая, блик пробегает дважды */
:is(.mode-btn, .word-search-draw) .novinka { position: relative; overflow: hidden; flex: none; margin-left: 8px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: #fff;
  background: linear-gradient(90deg, #ec4899, #a855f7 55%, #6366f1); box-shadow: 0 0 0 0 rgba(236, 72, 153, .55);
  animation: novinka-puls 1.6s ease-out .4s 2; }
:is(.mode-btn, .word-search-draw) .novinka::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .85), transparent); transform: skewX(-20deg);
  animation: novinka-blik 1.6s ease-in-out .4s 2; }
.mode-btn.has-novinka .soon { margin-left: auto; }
@keyframes novinka-blik { 0% { left: -60%; } 60%, 100% { left: 130%; } }
@keyframes novinka-puls { 0% { box-shadow: 0 0 0 0 rgba(236, 72, 153, .55); } 100% { box-shadow: 0 0 0 10px rgba(236, 72, 153, 0); } }
@media (prefers-reduced-motion: reduce) { :is(.mode-btn, .word-search-draw) .novinka, :is(.mode-btn, .word-search-draw) .novinka::after { animation: none; } }
.ls-remix { flex: 1; min-width: 140px; }

/* ✕ на форме входа и регистрации (12.11.2026) */
.auth-card { position: relative; }
.auth-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; color: var(--muted); text-decoration: none; }
.auth-close:hover { background: var(--hover); color: var(--text); }
.auth-close svg { width: 18px; height: 18px; display: block; }

/* Предложение пуш-напоминаний на экране итога (12.11.2026, js/push.js) */
.push-offer { margin: 14px auto 4px; max-width: 420px; padding: 14px 16px; border-radius: 14px; text-align: left;
  background: var(--primary-soft, rgba(123, 134, 255, .12)); border: 1px solid var(--border); font-size: 15px; }
.push-offer b { display: block; margin-bottom: 6px; color: var(--text); }
.push-offer p { margin: 0 0 10px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.push-offer .row { display: flex; gap: 10px; flex-wrap: wrap; }
.push-offer .push-err { color: var(--red, #e5484d); margin: 8px 0 0; }
.push-offer .push-err:empty { display: none; }

/* 12.11.2026 (Елена): на телефоне все шесть плиток режимов — на первом экране,
   над нижним меню (проверено на 360×640, 375×667, 390×664 и шире). */
@media (max-width: 620px) {
  .set-head .crumbs { margin-bottom: 4px; }
  .set-title { margin: 2px 0 0; font-size: 28px; }
  .set-sub { margin: 2px 0 0; font-size: 14px; }
  .proba-bar { margin: 10px 0 0; padding: 10px 12px; gap: 8px 12px; }
  .proba-bar-text { font-size: 13px; line-height: 1.4; flex-basis: 100%; }
  .proba-bar-more { display: none; }
  .proba-bar .btn { padding-top: 8px; padding-bottom: 8px; }
  .start-cta { margin-top: 12px; }
  .start-cta-btn { padding: 11px 16px; font-size: 18px; }
  .start-cta-sub { font-size: 13px; }
  .start-cta + .modes { margin-top: 10px; }
  .modes { gap: 8px; margin: 12px 0 18px; }
  .mode-btn { padding: 13px 12px; gap: 10px; }
}
@media (max-width: 380px) { .mode-btn { font-size: 14px; gap: 8px; padding-left: 10px; padding-right: 10px; } .mode-btn .soon { display: none; } }

/* Высота обычной однострочной плитки. Оставляем место для второй строки
   внутри неё; при увеличенном тексте все ряды растут одинаково. */
.modes { grid-auto-rows: 1fr; }
.modes .mode-btn .soon { white-space: normal; line-height: 1.1; }
.modes .mode-btn:disabled { padding-block: 0; }
.modes .mode-btn {
  min-height: 62px;
  padding-block: 3px;
  align-content: center;
  row-gap: 1px;
}
@media (max-width: 720px) { .modes .mode-btn { min-height: 48px; } }
@media (max-width: 620px) { .modes .mode-btn { min-height: 50px; } }

/* Поиск и прослушивание используют одну раскладку. На тесной плитке
   метка занимает вторую строку под названием, счётчик остаётся справа. */
.modes .has-novinka {
  container-type: inline-size;
  display: grid;
  grid-template-columns: max-content max-content minmax(0, 1fr) max-content;
  column-gap: 4px;
  padding-inline: 8px;
}
.has-novinka > .ico { grid-area: 1 / 1; }
.has-novinka > span:nth-child(2) { grid-area: 1 / 2; }
.has-novinka > .novinka {
  grid-area: 1 / 3;
  justify-self: start;
  margin: 0;
  padding: 2px 4px;
  letter-spacing: 0;
  font-size: 9px;
  line-height: 1.25;
  white-space: nowrap;
}
.modes .has-novinka > .soon {
  grid-area: 1 / 4;
  display: block;
  white-space: nowrap;
}
@container (max-width: 198px) {
  .has-novinka > .ico { grid-row: 1 / span 2; }
  .has-novinka > span:nth-child(2) { grid-column: 2 / 4; }
  .has-novinka > .novinka { grid-area: 2 / 2 / 3 / 4; }
  .has-novinka > .soon { grid-row: 1 / span 2; }
}

/* Экран итога занятия на телефоне (12.11.2026): с предложением пуш-напоминаний
   он не помещался в карточку — заголовок обрезало, кнопки уходили вниз. */
@media (max-width: 620px) {
  .fc.is-done .fc-center { display: none; }
  .fc.is-done .fc-face { justify-content: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .fc-done { gap: 8px; padding: 6px 0 10px; }
  .fc-done .big { font-size: 32px; }
  .fc-done .score { font-size: 15px; }
  .fc-done .push-offer { margin-top: 6px; padding: 12px 14px; }
  .fc-done .push-offer p { margin-bottom: 8px; }
  .fc.is-done .fc-top, .fc.is-done .fc-novice-tip { display: none; }
  .fc-done > div:nth-child(2) { font-size: 24px; line-height: 1.25; }
  .fc-done .fc-next { font-size: 13px; }
}
/* Итог виден и на компьютере в пробе: подсказка «нажмите на карточку» там лишняя */
.fc.is-done .fc-novice-tip { display: none; }

/* «Слушать», 13.11.2026: значения ползунков больше не вылезают за край на
   телефоне; полоса прослушивания и скорость — как в аудиокнигах */
.ls-range { grid-template-columns: minmax(0, 1fr) minmax(80px, 1.1fr) auto; }
.ls-range > span { min-width: 0; }
.ls-range b { white-space: nowrap; min-width: 3.4em; }
@media (max-width: 420px) { .ls-range { grid-template-columns: minmax(0, 1fr) minmax(64px, 0.9fr) auto; font-size: 14px; gap: 8px; } }
.ls-progress { display: flex; flex-direction: column; gap: 4px; padding: 0 4px; }
.ls-seek { width: 100%; accent-color: var(--primary); height: 22px; }
.ls-times { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ls-left { text-align: center; font-size: 13px; color: var(--muted); }
.ls-controls { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 8px; }
.ls-controls .ls-play { min-width: 0; padding-inline: 8px; }
.ls-nav { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--text); }
.ls-nav span { font-size: 10px; line-height: 1.2; }
.ls-word-range { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.ls-word-range .ls-row { align-items: end; margin-top: 8px; }
.ls-word-range label { display: grid; gap: 4px; flex: 1 1 72px; font-size: 13px; }
.ls-word-range input { box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; }
.ls-word-range button { min-height: 44px; }
.ls-word-range [role="status"] { display: block; margin-top: 6px; font-size: 13px; }
.ls-word-range [role="status"]:empty { display: none; }
.ls-speed { width: 52px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
@media (max-width: 380px) { .ls-speed { width: 44px; } .ls-nav { width: 46px; } }

/* ---------- Цель дня, серия, «Мой прогресс» (js/zanyatiya.js, 15.11.2026) ----------
   Те же классы и вид, что в приложении «Пандавед» для Android (prilozhenie/css/prilozhenie.css). */
.pv-den {
  display: flex; align-items: center; gap: 12px; width: 100%;
  margin: 4px 0 16px; padding: 10px 14px; text-align: left;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 16px; cursor: pointer; font: inherit;
}
.pv-den-krug {
  --p: 0; flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--border) 0);
}
.pv-den-krug span {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); font-weight: 800; font-size: 15px;
}
.pv-den-tekst { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.pv-den-tekst b { font-size: 15px; }
.pv-den-tekst .muted { font-size: 13px; }
.pv-den-strelka { font-size: 24px; color: var(--muted); }

.pv-progress h3 { margin: 20px 0 8px; font-size: 16px; }
.pv-progress-verh { display: flex; gap: 12px; }
.pv-progress-verh > div {
  flex: 1; display: flex; flex-direction: column; align-items: center; padding: 10px;
  background: var(--primary-soft); border-radius: 14px;
}
.pv-progress-verh b { font-size: 24px; }
.pv-nedelya { display: flex; justify-content: space-between; margin-top: 14px; }
.pv-nedelya-den { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pv-nedelya-den i {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-style: normal; font-weight: 800; border: 2px solid var(--border); color: var(--on-primary);
}
.pv-nedelya-den.is-da i { background: var(--primary); border-color: var(--primary); }
.pv-nedelya-den.is-segodnya small { font-weight: 800; color: var(--text); }
.pv-nedelya-den small { color: var(--muted); font-size: 12px; }
.pv-mel { font-size: 13px; margin: 0 0 8px; }
.pv-uroven {
  display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 10px;
  padding: 6px 0; color: var(--text); text-decoration: none;
}
.pv-uroven-imya { font-weight: 700; font-size: 14px; }
.pv-uroven-polosa { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.pv-uroven-polosa i { display: block; height: 100%; background: var(--green); border-radius: 4px; }
.pv-uroven-chislo { font-size: 13px; color: var(--muted); white-space: nowrap; }
.pv-vsego { margin: 8px 0 0; font-weight: 700; }
.pv-celi { display: flex; gap: 8px; flex-wrap: wrap; }
.pv-celi .btn { min-width: 56px; }
.pv-napom-stroka { display: flex; align-items: center; gap: 10px; margin-top: 10px; text-align: left; }
.pv-napom-stroka input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary); }
.pv-chas {
  font: inherit; padding: 6px 8px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.pv-tost {
  position: fixed; left: 50%; bottom: 96px; z-index: 9999; transform: translate(-50%, 20px);
  padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg);
  font-weight: 700; opacity: 0; transition: opacity .3s, transform .3s; max-width: 90vw; text-align: center;
}
.pv-tost.is-on { opacity: 1; transform: translate(-50%, 0); }
.pv-chasy { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pv-chas-stroka { display: flex; align-items: center; gap: 2px; }
.pv-chas-ubrat { min-width: 26px; padding: 4px 6px; }
.pv-chas-dobavit { white-space: nowrap; }
.pv-progress { position: relative; }
.pv-progress h2 { font-size: 20px; margin-bottom: 10px; }
.pv-progress h3 { margin: 12px 0 6px; font-size: 15px; }
.pv-progress-verh > div { flex-direction: row; justify-content: center; align-items: baseline; gap: 6px; padding: 6px 8px; }
.pv-progress-verh b { font-size: 20px; }
.pv-progress .pv-nedelya { margin-top: 8px; }
.pv-progress .pv-nedelya-den { gap: 2px; }
.pv-progress .pv-nedelya-den i { width: 24px; height: 24px; font-size: 13px; }
.pv-progress .pv-nedelya-den small { font-size: 11px; }
.pv-progress .pv-uroven { grid-template-columns: 52px 1fr auto; padding: 2px 0; gap: 8px; }
.pv-progress .pv-uroven-imya { font-size: 13px; }
.pv-progress .pv-uroven-chislo { font-size: 12px; }
.pv-progress .pv-vsego { margin-top: 4px; font-size: 13px; }
.pv-progress h3 .pv-napom-stroka { margin: 0; font-size: 15px; }
.pv-progress h3 .pv-napom-stroka small { font-weight: 400; font-size: 12px; }
.pv-progress .pv-mel { margin: 6px 0 0; }
.pv-progress .row { margin-top: 12px !important; }
.pv-progress .pv-uroven { grid-template-columns: 58px 1fr auto; }
.pv-progress .pv-uroven-imya { white-space: nowrap; }
.pv-progress .pv-niz { display: flex; gap: 8px; justify-content: space-between; margin-top: 12px; }
.pv-progress .pv-niz .btn { flex: 1; white-space: nowrap; padding-left: 10px; padding-right: 10px; }
.modal:has(.pv-progress) { padding-top: 16px; padding-bottom: 16px; }

/* Первый экран «С чего начнём?» (js/zanyatiya.js; как в приложении) */
.pv-start { text-align: center; }
.pv-start h2 { margin: 8px 0 14px; }
.pv-start h3 { margin: 18px 0 8px; font-size: 16px; }
.pv-start .pv-celi { justify-content: center; }
.pv-start-spisok { display: flex; flex-direction: column; gap: 8px; }
.pv-start-vybor {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px;
  border: 2px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
}
.pv-start-vybor b { font-size: 16px; }
.pv-start-vybor .muted { font-size: 13px; }
.pv-start-vybor:hover { border-color: var(--primary); }
.pv-start-vybor.is-on { border-color: var(--primary); background: var(--primary-soft); }
.pv-start-dalshe { width: 100%; margin-top: 18px; }
.pv-start-propusk { width: 100%; margin-top: 8px; }
.pv-start-vhod { margin: 12px 0 0; font-size: 14px; }
.pv-start-vhod a { font-weight: 700; color: var(--primary); }

/* Баннер «Выбор учебников» справа от наборов HSK 3.0 на русском (js/zanyatiya.js; как в приложении) */
.pv-uchebniki {
  display: flex; flex-direction: column; justify-content: center; gap: 8px;
  padding: 16px; border-radius: 16px; text-decoration: none; min-width: 0;
  background: linear-gradient(135deg, #8b3dff 0%, #6a1fd8 100%); color: #fff;
  box-shadow: 0 6px 18px rgba(106, 31, 216, .35); scroll-snap-align: start;
}
.pv-uchebniki b { font-size: 20px; line-height: 1.2; }
.pv-uchebniki span { font-size: 14px; opacity: .92; }
.pv-uchebniki:active { transform: scale(.98); }
.pv-uchebniki, .pv-uchebniki:hover, .pv-uchebniki b, .pv-uchebniki span { color: #fff !important; text-decoration: none !important; }
/* На компьютере наборы — сеткой, а не лентой: баннер у каждого набора растягивал
   раздел на несколько экранов, а ниже и так есть раздел «Наборы по учебникам». */
@media (min-width: 901px) { .pv-uchebniki { display: none !important; } }

/* Звезда на карточке сборника «Избранное» (js/views/library.js) — как закрашенная звезда карточек слов */
.set-zvezda { display: inline-flex; margin-left: auto; color: var(--amber); line-height: 0; }
.set-zvezda svg { width: 22px; height: 22px; }
.set-zvezda svg path { fill: currentColor; }
/* В карточке набора — в правом верхнем углу; верхней строке оставляем место под неё */
.set-card .set-zvezda { position: absolute; top: 12px; right: 12px; margin: 0; }
.set-card:has(.set-zvezda) .set-top { padding-right: 28px; }

/* Набор можно загрузить до прокрутки примеров, разделителей и предпросмотра. */
.import-dialog .modal { padding-top: 0; }
.import-toolbar {
  position: sticky; top: 0; z-index: 1; background: var(--surface);
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 0;
}
.import-toolbar h2 { flex: 1; margin: 0; font-size: 20px; }
/* A landscape keyboard can leave only one line of the dialog visible.
   Reserve space beside the editable text and keep the action in that line. */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .import-dialog .modal { padding-inline-end: 132px; }
  .import-dialog .import-submit {
    position: fixed;
    top: calc(var(--vv-t, 0px) + min(32px, max(0px, (var(--vv-h, 100dvh) - 40px) / 2)));
    right: max(12px, calc((100% - 620px) / 2 + 12px), env(safe-area-inset-right));
    z-index: 2;
  }
}
@media (max-width: 900px) {
  .lp-hero-art { order: 0; }
}
@media (max-width: 560px) {
  .lp-hero-text { display: flex; flex-direction: column; }
  .lp-hero-text .lp-lead, .lp-hero-text .lp-note { order: 1; }
  .lp-hero-text .lp-cta { margin-bottom: 12px; }
  .import-dialog { align-items: flex-start; padding: 8px; }
  .import-dialog .modal { padding-inline: 14px; }
}

/* Кнопка «Наверх» для страниц сайта. */
#page-top-button {
  position: fixed; right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(12px + max(var(--page-top-clearance, 0px), env(safe-area-inset-bottom, 0px), var(--vv-b, 0px)));
  z-index: 45; display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  color: var(--text); box-shadow: var(--shadow-lg); cursor: pointer;
}
#page-top-button::before {
  content: ""; width: 10px; height: 10px; border: solid currentColor;
  border-width: 2.5px 2.5px 0 0; transform: translateY(2px) rotate(-45deg);
}
#page-top-button:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
#page-top-button[hidden], html.pechataet #page-top-button { display: none; }
@media print { #page-top-button { display: none; } }

/* Shared saved-deck action. Reserve space for badges on narrow cards. */
.deck-remove-host { position: relative; }
.deck-remove-host .set-top,
.deck-remove-host .continue-meta { padding-inline-end: 44px; min-height: 36px; }
.deck-remove-host.fld-row { padding-inline-end: 48px; }
.deck-remove-button, .deck-remove-close {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 12px; background: transparent; color: var(--muted);
  cursor: pointer; padding: 0;
}
.deck-remove-button { position: absolute; inset-block-start: 5px; inset-inline-end: 5px; }
.deck-remove-button svg { display: block; width: 19px; height: 19px; pointer-events: none; }
.deck-remove-button:hover, .deck-remove-close:hover { background: var(--surface-2); color: var(--text); }
.deck-remove-button:focus-visible, .deck-remove-dialog button:focus-visible {
  outline: 2px solid var(--primary); outline-offset: -2px;
}
.deck-remove-dialog {
  box-sizing: border-box; width: min(420px, calc(100% - 32px)); max-height: 90dvh;
  padding: 24px; overflow: auto; margin: auto; border: 1px solid var(--border);
  border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.deck-remove-dialog::backdrop { background: rgba(7, 10, 30, .65); }
.deck-remove-dialog h2 { margin: 0; padding-inline-end: 34px; overflow-wrap: anywhere; }
.deck-remove-dialog p { margin: 12px 0 20px; color: var(--muted); }
.deck-remove-dialog .row { justify-content: flex-end; }
.deck-remove-dialog .deck-remove-yes { background: #ae2536; color: white; border-color: #ae2536; }
.deck-remove-close { position: absolute; inset-block-start: 8px; inset-inline-end: 8px; font-size: 26px; }
.set-card.deck-remove-host:has(.set-zvezda) .set-top { padding-inline-end: 44px; }
.set-card.deck-remove-host .set-zvezda { position: static; margin-inline-start: auto; }

/* Поиск слов: форма остаётся на месте, прокручивается только выдача. */
.modal-backdrop:has(.word-search-panel) {
  inset: auto;
  top: var(--vv-t, 0px);
  left: var(--vv-l, 0px);
  width: var(--vv-w, 100%);
  height: var(--vv-h, 100dvh);
  padding: clamp(8px, 2.5vh, 20px);
}
.modal:has(> .word-search-panel) {
  height: min(560px, 100%);
  max-height: 100%;
  overflow: hidden;
  padding: clamp(12px, 2.5vw, 24px);
}
.word-search-panel {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
}
.word-search-panel h2 { margin: 0; padding-inline-end: 40px; }
.word-search-panel form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}
.word-search-field label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.word-search-input { position: relative; }
.word-search-input input { padding-inline-end: 46px; min-height: 44px; }
.word-search-clear { position: absolute; inset-inline-end: 0; top: 50%; transform: translateY(-50%); }
.word-search-clear[hidden] { display: none; }
.word-search-clear, .word-search-actions .icon-btn { width: 44px; height: 44px; flex: none; }
.word-search-actions { display: flex; align-items: center; flex: none; }
.word-search-output { overflow: auto; overscroll-behavior: contain; overflow-wrap: anywhere; }
.word-search-output > [role=status] { margin: 0 0 8px; }

.word-search-panel:has(.word-search-draw) { grid-template-rows: auto auto auto minmax(0, 1fr); }
.word-search-panel:has(.word-search-draw[aria-expanded="true"]) { grid-template-rows: auto auto minmax(0, 1fr); }
.word-search-panel [hidden] { display: none; }
.btn.word-search-draw {
  --draw-color: color-mix(in srgb, var(--primary) 50%, #9a9a9a);
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-self: start;
  gap: 6px 8px;
  max-width: 100%;
  min-height: 44px;
  background: var(--draw-color, var(--primary));
  border-color: var(--draw-color, var(--primary));
  color: #fff;
}
@supports (color: hsl(from red h calc(s * .5) l)) {
  .btn.word-search-draw { --draw-color: hsl(from var(--primary) h calc(s * .5) l); }
}
.btn.word-search-draw:hover {
  background: color-mix(in srgb, var(--draw-color, var(--primary)) 90%, white);
}
.word-search-draw .novinka { margin-left: 0; }
.handwriting-drawer { overflow: auto; overscroll-behavior: contain; overflow-anchor: none; }
.handwriting-panel { display: grid; gap: 10px; }
.handwriting-pad {
  display: block; box-sizing: border-box; width: min(100%, 230px); height: auto; margin-inline: auto;
  aspect-ratio: 1; touch-action: none; user-select: none; cursor: crosshair; color: var(--text);
  border: 1px solid var(--border); border-radius: 14px; background-color: var(--surface);
  background-image: linear-gradient(90deg, transparent 49.6%, var(--border) 50%, transparent 50.4%),
    linear-gradient(0deg, transparent 49.6%, var(--border) 50%, transparent 50.4%);
}
.handwriting-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.handwriting-actions .btn { min-height: 44px; }
.handwriting-panel [role=status] { margin: 0; color: var(--muted); }
.handwriting-word-panel {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.handwriting-word-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.handwriting-word { font-size: 25px; overflow-wrap: anywhere; }
.handwriting-word-row .btn { min-height: 44px; padding: 6px 10px; }
.handwriting-word-panel .handwriting-definition { margin-top: 4px; overflow-wrap: anywhere; }
.handwriting-result {
  display: grid; width: 100%; grid-template-columns: 40px minmax(0, 1fr); align-items: center;
  gap: 12px; padding: 10px 4px; border: 0; border-block-start: 1px solid var(--border);
  background: transparent; color: var(--text); text-align: start; font: inherit; cursor: pointer;
}
.handwriting-result:hover { background: var(--surface2, var(--surface)); }
.handwriting-result:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.handwriting-result > strong { text-align: center; font-size: 26px; }
.handwriting-result > span { overflow-wrap: anywhere; }
.handwriting-gloss { display: block; }
@media (max-height: 620px) {
  .handwriting-pad { width: min(100%, 185px); }
}
