/* =========================================================
   Библиотека
   ========================================================= */
.page-title { font-size: var(--fs-xl); font-weight: 800; margin: var(--s2) 0 var(--s4); }
.class-card { padding: var(--s4); }
.class-head { display: flex; align-items: center; gap: var(--s1); }
.class-toggle {
  flex: 1; display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border: 0; border-radius: var(--r-sm);
  background: none; text-align: left; cursor: pointer;
}
.class-toggle:hover { background: var(--canvas); }
.class-toggle h2 { font-size: var(--fs-md); }
.chev { display: inline-block; color: var(--muted); transition: transform .2s var(--ease); }
.class-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }

.lesson-list { display: flex; flex-direction: column; gap: 6px; margin-top: var(--s3); }
.lesson-item {
  display: flex; align-items: center; gap: 4px; padding-right: 4px;
  border-radius: var(--r-md); background: var(--canvas);
  transition: background-color .15s var(--ease);
}
.lesson-item:hover { background: var(--primary-soft-2); }
.lesson-open {
  flex: 1; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border: 0; border-radius: var(--r-md);
  background: none; text-align: left; font-size: 15.5px; cursor: pointer;
}
.lesson-open b { flex: 1; }
.lesson-open .muted { font-size: var(--fs-sm); }
.badge { background: var(--ok); color: #fff; border-radius: var(--r-pill); padding: 2px 10px; font-size: 14px; font-weight: 800; }
.add-row {
  justify-content: center; padding: 12px; border: 1.5px dashed var(--line);
  border-radius: var(--r-md); background: none; color: var(--primary);
  font-weight: 800; cursor: pointer;
}
.add-row:hover { background: var(--primary-soft); }
.empty-state { text-align: center; padding: var(--s6) var(--s4); }
.empty-state p { color: var(--muted); }

/* =========================================================
   Урок и редактор
   ========================================================= */
.lesson-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-bottom: var(--s3); }
.title-input {
  width: 100%; padding: 4px 0; margin: var(--s2) 0;
  font-size: var(--fs-xl); font-weight: 800;
  background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
}
.title-input:hover { border-bottom-color: var(--line); }
.title-input:focus { border-bottom-color: var(--primary); outline: none; }

.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); align-items: start; }
.preview-pane { display: none; }
@media (min-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .preview-pane {
    display: block; position: sticky; top: 76px;
    max-height: calc(100vh - 92px); overflow: auto;
    padding: 0 var(--s4) var(--s4);
    border: 1.5px dashed var(--line); border-radius: var(--r-lg);
  }
}
.preview-label {
  position: sticky; top: 0; z-index: 2; padding: var(--s3) 0 var(--s2);
  background: var(--canvas); font-size: var(--fs-sm); font-weight: 800; color: var(--muted);
}

.block { padding: var(--s4) var(--s5) var(--s5); scroll-margin-top: 90px; }
.block-head { display: flex; align-items: center; gap: var(--s1); }
.block-toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  padding: 4px; border: 0; border-radius: var(--r-sm); background: none;
  text-align: left; cursor: pointer;
}
.block-toggle:hover { background: var(--canvas); }
.block-icon {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px;
  background: var(--primary-soft); border-radius: var(--r-sm); font-size: 16px;
}
.block-name { font-weight: 800; white-space: nowrap; }
.block-summary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); color: var(--muted); }
.block-body { margin-top: var(--s4); }

.insert { display: flex; justify-content: center; margin: -8px 0; }
.insert-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px dashed var(--line); background: var(--canvas); color: var(--primary);
  font-size: 18px; font-weight: 800; line-height: 1; cursor: pointer;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.insert-btn:hover { border-color: var(--primary); background: var(--surface); }

.picker-head { display: flex; align-items: center; gap: var(--s2); }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--s2); margin-top: var(--s3); }
.type-btn {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); font-size: 14.5px; font-weight: 700; text-align: left; cursor: pointer;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.type-btn:hover { border-color: var(--primary); background: var(--primary-soft); }

/* Редактор форматированного текста */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 6px; }
.tb {
  min-width: 36px; height: 36px; padding: 0 10px;
  border: 0; border-radius: var(--r-sm); background: var(--canvas);
  font-size: var(--fs-sm); cursor: pointer;
}
.tb:hover { background: var(--primary-soft-2); }
.tb-select { width: auto; height: 36px; padding: 0 8px; font-size: var(--fs-sm); }
.tb-color { width: 40px; height: 36px; padding: 2px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: none; cursor: pointer; }
.rte {
  min-height: 120px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  line-height: 1.55; overflow-wrap: anywhere;
}
.rte:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft-2); outline: none; }
.rte-heading { min-height: 52px; font-size: var(--fs-lg); font-weight: 800; line-height: 1.25; }

/* Слайды в редакторе */
.slides { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--s3); }
.slide-edit { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3); border-radius: var(--r-md); background: var(--canvas); }
.slide-add { justify-content: center; align-items: flex-start; min-height: 170px; border: 2px dashed var(--line); background: none; }
.slide-thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--r-sm); background: #1d1a3a10; }
.slide-thumb.empty { display: grid; place-items: center; color: var(--muted); font-size: var(--fs-sm); }

.q-images { margin-top: var(--s3); }
.q-image-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: 6px 0; }
.q-image-name { flex: 1; min-width: 160px; font-size: 14.5px; }
.thumb { width: 72px; height: 48px; object-fit: cover; border-radius: var(--r-sm); }

/* =========================================================
   Облачный режим: вход, коды классов, результаты
   ========================================================= */
.loading { text-align: center; padding: var(--s6) 0; }

.auth { max-width: 480px; margin: 0 auto; }
.auth-card { padding: var(--s5); }
.auth-tabs { margin-bottom: var(--s4); }
.auth-tabs button { flex: 1; }
.join-form .btn-check, .auth-card form .btn-row { margin-top: var(--s4); }
.form-error { margin: var(--s2) 0 0; color: var(--bad); font-size: var(--fs-sm); font-weight: 700; }
.form-error:empty { display: none; }
.form-info { margin: var(--s2) 0 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--ok-soft); color: var(--ok); font-size: var(--fs-sm); font-weight: 700; }
.center-row { justify-content: center; margin-top: var(--s3); }

.class-cloud {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  margin-top: var(--s2); padding: var(--s2) 8px 0; font-size: var(--fs-sm);
}
.code {
  padding: 2px 10px; border-radius: var(--r-sm); background: var(--canvas);
  font: 700 15.5px/1.4 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em;
}

.sync { font-size: 14px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.sync.saving { color: var(--primary); }
.sync.offline, .sync.error { color: var(--bad); }

.table-wrap { overflow-x: auto; padding: 0; }
.results-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.results-table th, .results-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.results-table thead th { position: sticky; top: 0; background: var(--surface); font-size: 14px; color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.results-table th[scope="row"] { text-align: left; font-weight: 800; position: sticky; left: 0; background: var(--surface); }
.results-table thead th:first-child { text-align: left; left: 0; z-index: 1; }
.results-table tbody tr:last-child > * { border-bottom: 0; }
.score { font-weight: 800; }
.score.hi { color: var(--ok); }
.score.lo { color: var(--bad); }
.score.none { color: var(--muted); font-weight: 400; }
.score.avg { background: var(--canvas); }
.small { font-size: 14px; }

@media (max-width: 600px) {
  .sync { display: none; } /* на телефоне статус сохранения не помещается; ошибки всё равно приходят уведомлением */
}

/* =========================================================
   Список класса (учитель) и печать карточек с кодами
   ========================================================= */
.code-input { font: 700 20px/1.3 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; }
.roster-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.roster-table th, .roster-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.roster-table thead th { font-size: 14px; color: var(--muted); }
.roster-table tbody tr:last-child > * { border-bottom: 0; }
.roster-table .num { width: 32px; text-align: center; }
.roster-name { min-width: 160px; padding: 6px 10px; border-color: transparent; background: transparent; font-weight: 700; }
.roster-name:hover { border-color: var(--line); }
.roster-actions { white-space: nowrap; text-align: right; }
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.check-row input { width: 20px; height: 20px; accent-color: var(--primary); }
.print-cards { display: none; }

@media print {
  body * { visibility: hidden; }
  .print-cards, .print-cards * { visibility: visible; }
  .print-cards { display: grid; position: absolute; inset: 0; grid-template-columns: repeat(2, 1fr); gap: 8mm; padding: 8mm; }
  .print-card { border: 1.5px dashed #888; border-radius: 4mm; padding: 6mm; break-inside: avoid; color: #000; }
  .print-class { font-size: 11pt; color: #555; }
  .print-name { font-size: 16pt; font-weight: 800; margin: 2mm 0; }
  .print-code { font: 700 22pt ui-monospace, Menlo, Consolas, monospace; letter-spacing: .15em; }
  .print-site { font-size: 9pt; color: #555; margin-top: 2mm; word-break: break-all; }
}

/* =========================================================
   Кабинет ученика
   ========================================================= */
.cab-class { margin-top: -8px; }
.house-tag { font-weight: 800; }
.house-tag::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 50%; background: var(--house); }
.rank-tabs { width: fit-content; margin-bottom: var(--s3); }
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rank-row {
  display: flex; align-items: center; gap: var(--s3); padding: 10px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
.rank-row.me { border: 2px solid var(--primary); background: #f5f3fe; }
.rank-pos { width: 32px; text-align: center; font-size: 18px; font-weight: 800; color: var(--muted); }
.rank-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rank-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 800; }
/* Полоса прогресса (общая) */
.meter { height: 12px; border-radius: var(--r-pill); background: #1d1a3a14; overflow: hidden; }
.meter-fill { height: 100%; border-radius: var(--r-pill); background: var(--primary); transition: width .5s var(--ease); }
.rank-main .meter { height: 10px; }
.rank-coins { font-size: 18px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.me-tag { padding: 1px 8px; border-radius: var(--r-pill); background: var(--primary); color: #fff; font-size: 12px; }
.lvl-tag, .gem-tag { padding: 2px 8px; border-radius: 8px; font-size: 13px; font-weight: 700; }
.gem-tag { background: #cffafe; color: #0e7490; }

@media (max-width: 600px) {
  .rank-row { padding: 8px 10px; gap: var(--s2); }
  .rank-coins { font-size: 15.5px; }
  .roster-name { min-width: 120px; }
}

/* Рейтинг за четверть в кабинете: разметка и цвета банка, без отступов страницы банка */
.bank-app.bank-embed { max-width: none; margin: 0; padding: 0; }
.bank-app .student.is-me { outline: 3px solid var(--primary); outline-offset: 2px; }
.bank-app .student-name .me-tag { margin-left: 8px; vertical-align: middle; }

/* Локальный режим: демонстрация кабинета */
.demo-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3);
  margin-bottom: var(--s4); padding: var(--s3) var(--s4);
  background: var(--warn-bg); color: var(--warn-ink); border: 1px solid #f0d58a; border-radius: var(--r-md); font-size: var(--fs-sm);
}
.demo-bar p { margin: 0; flex: 1 1 300px; }
.demo-pick { display: flex; align-items: center; gap: var(--s2); font-weight: 800; white-space: nowrap; }
.demo-select { width: auto; min-width: 140px; }

/* Вкладка «Классы» */
.class-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); }
.class-row-main h2 { font-size: var(--fs-md); }
.class-row-main p { margin: 2px 0 0; }

/* Уроки у учителя: карточки классов */
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--s3); margin-top: var(--s3); }
.class-tile {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: var(--s4) var(--s5) var(--s4) var(--s4);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
  text-align: left; cursor: pointer; transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.class-tile:hover { border-color: var(--primary); transform: translateY(-1px); }
.class-tile-name { font-size: var(--fs-md); font-weight: 800; }
.class-tile-arrow { position: absolute; right: var(--s4); top: 50%; transform: translateY(-50%); color: var(--primary); font-weight: 800; }
.class-card-title { font-size: var(--fs-md); margin-bottom: var(--s2); }

/* =========================================================
   «🏫 Классы» в шапке, страница класса, плашки уроков, типы уроков
   ========================================================= */
.top-nav { display: flex; gap: 4px; margin-left: var(--s3); }
.top-nav-item {
  padding: 6px 14px; border: 0; border-radius: var(--r-md);
  background: var(--primary-soft); color: var(--primary); font-weight: 800; cursor: pointer; white-space: nowrap;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.top-nav-item:hover { background: var(--primary-soft-2); }
.top-nav-item[aria-current="page"] { background: var(--primary); color: #fff; }

main.bank-width { padding-bottom: 0; }
#bank-root { padding-top: 0; }

.codes-info {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3);
  margin: var(--s2) 0 var(--s4); padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); font-size: var(--fs-sm);
}
.codes-text { flex: 1 1 260px; color: var(--muted); }

.class-tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: var(--s4); width: fit-content; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.class-tab { padding: 8px 18px; border: 0; border-radius: 9px; background: none; font-weight: 800; color: var(--muted); cursor: pointer; }
.class-tab:hover { color: var(--ink); background: var(--canvas); }
.class-tab[aria-selected="true"] { background: var(--primary); color: #fff; }

.lesson-cards { display: flex; flex-direction: column; gap: var(--s2); }
.lesson-card {
  display: flex; align-items: center; gap: var(--s2); padding: 4px 8px 4px 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow);
  transition: border-color .15s var(--ease);
}
.lesson-card:hover { border-color: var(--primary); }
.add-lesson { margin-top: var(--s1); }
.class-section + .class-section { margin-top: var(--s5); }

.kind-tag { display: inline-block; padding: 1px 9px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.kind-reading    { background: #dbeafe; color: #1d4ed8; }
.kind-listening  { background: #ede9fe; color: #6d28d9; }
.kind-vocabulary { background: #fef3c7; color: #b45309; }
.kind-grammar    { background: #dcfce7; color: #15803d; }
.kind-writing    { background: #fce7f3; color: #be185d; }
.kind-speaking   { background: #ffedd5; color: #c2410c; }
.kind-revision   { background: #ccfbf1; color: #0f766e; }
.kind-test       { background: #fee2e2; color: #b91c1c; }

.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); margin: var(--s2) 0; }
.title-row .title-input { flex: 1 1 320px; margin: 0; }
.kind-field { display: flex; align-items: center; gap: var(--s2); }
.kind-field .field-label { margin: 0; white-space: nowrap; }
.kind-select { width: auto; min-width: 130px; }

@media (max-width: 600px) {
  .top-nav { margin-left: var(--s1); }
  .top-nav-item { padding: 6px 10px; }
  .class-tabs { width: 100%; }
  .class-tab { flex: 1; padding: 8px 10px; }
}

/* «Классы»: карточки классов с управлением */
.class-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--s3); }
.class-card-item {
  display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.class-card-open {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: var(--s2) var(--s5) var(--s2) var(--s2);
  border: 0; border-radius: var(--r-md); background: none; text-align: left; cursor: pointer;
}
.class-card-open:hover { background: var(--canvas); }
.class-card-item .codes-info { margin: 0; padding: 8px 10px; background: var(--canvas); border: 0; font-size: 13px; }
.class-card-actions { display: flex; align-items: center; gap: 4px; }

/* Модули — раскрывающиеся разделы уроков */
.modules { display: flex; flex-direction: column; gap: var(--s2); }
.module { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.module-none { background: transparent; box-shadow: none; border-style: dashed; }
.module-head { display: flex; align-items: center; gap: 4px; padding: 4px 8px 4px 4px; }
.module-toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 0; border-radius: var(--r-md); background: none; text-align: left; cursor: pointer;
}
.module-toggle:hover { background: var(--canvas); }
.module-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.module-title { flex: 1; min-width: 0; font-size: var(--fs-md); font-weight: 800; overflow-wrap: anywhere; }
.module-body { display: flex; flex-direction: column; gap: var(--s2); padding: 0 var(--s3) var(--s3) var(--s5); }
.module-body .lesson-card { box-shadow: none; }
.module-empty { margin: 0; }
@media (max-width: 600px) {
  .class-cards { grid-template-columns: 1fr; }
  .module-body { padding-left: var(--s3); }
}

/* Заголовок раздела: стрелка «назад» перед названием, кнопки справа */
.page-head { display: flex; align-items: center; gap: var(--s2) var(--s3); flex-wrap: wrap; margin: var(--s2) 0 var(--s4); }
.page-head .page-title, .page-head .lesson-heading { flex: 1 1 auto; min-width: 0; margin: 0; }
.page-head-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.back-btn { flex: none; min-width: 40px; min-height: 40px; padding: 0; font-size: 20px; line-height: 1; }
.title-row .back-btn { align-self: center; }

/* Четыре вкладки страницы класса */
.class-tabs { flex-wrap: wrap; }
@media (max-width: 600px) {
  .class-tab { flex: 1 1 40%; }
}

/* Срок сдачи урока */
.deadline-tag { display: inline-block; padding: 1px 9px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--canvas); color: var(--muted); border: 1px solid var(--line); }
.deadline-tag.overdue { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.deadline-tag.done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.heading-tags { display: inline-flex; gap: 6px; margin-left: 10px; vertical-align: middle; font-size: var(--fs-base); }
.deadline-input { width: auto; min-width: 150px; }

/* =========================================================
   Flashcards
   ========================================================= */
/* Редактор колоды */
.fc-editor-head { display: flex; align-items: center; gap: var(--s3); }
.fc-input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }
.fc-preview { display: grid; gap: 6px; margin-top: var(--s3); max-height: 320px; overflow: auto; }
.fc-row { display: grid; grid-template-columns: 28px 1fr 1fr; gap: var(--s3); align-items: center; padding: 8px 10px 8px 14px; background: var(--canvas); border-radius: var(--r-md); }
.fc-num { color: var(--muted); font-size: 13px; }
.fc-side { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fc-side-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.fc-term { font-weight: 700; border-right: 2px solid var(--line); padding-right: var(--s3); }
.fc-thumb { width: 44px; height: 44px; flex: none; object-fit: cover; border-radius: 8px; background: var(--surface); }
.fc-img-btn { min-width: 32px; min-height: 32px; font-size: 15px; opacity: .55; }
.fc-img-btn.has-img, .fc-row:hover .fc-img-btn, .fc-img-btn:focus-visible { opacity: 1; }

/* Страница колоды */
.fc-section { margin: var(--s4) 0 var(--s6); }
.fc-mode-title { font-size: var(--fs-md); margin-bottom: var(--s3); }
.fc-stage { overflow: hidden; padding: 12px 8px 20px; margin: 0 -8px -20px; } /* место под тень и «улёт» карточки */
.fc-slide { max-width: 720px; margin: 0 auto; will-change: transform; touch-action: pan-y; }
.fc-slide.dragging { cursor: grabbing; }
.fc-card { display: block; width: 100%; height: 320px; padding: 0; border: 0; background: none; cursor: pointer; perspective: 1400px; transition: transform .2s var(--ease); -webkit-user-select: none; user-select: none; }
.fc-card:hover { transform: translateY(-4px); }
.fc-card:hover .fc-face { box-shadow: 0 14px 34px #2e385633; }
.fc-slide.dragging .fc-card { transform: none; }
.fc-inner { position: relative; width: 100%; height: 100%; transition: transform .45s var(--ease); transform-style: preserve-3d; }
.fc-card.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; display: grid; place-items: center; padding: var(--s5);
  background: var(--surface); border-radius: 20px; box-shadow: 0 6px 24px #2e385626; backface-visibility: hidden;
  font-size: 34px; font-weight: 700; text-align: center; overflow-wrap: anywhere;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  transition: box-shadow .2s var(--ease);
}
.fc-img { max-width: 80%; max-height: 170px; object-fit: contain; border-radius: 12px; pointer-events: none; }
.fc-back { transform: rotateY(180deg); font-size: 28px; font-weight: 600; color: #2e3856; }
.fc-card:focus-visible { outline: none; }
.fc-card:focus-visible .fc-face { outline: 3px solid var(--focus); outline-offset: 3px; }
.fc-nav { display: flex; align-items: center; justify-content: center; gap: var(--s4); margin-top: var(--s3); }
.fc-arrow { min-width: 48px; min-height: 44px; border-radius: var(--r-pill); font-size: 22px; }
.fc-counter { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 64px; text-align: center; }
.fc-tip { text-align: center; }

.fc-learn { max-width: var(--learn-width); margin: 0 auto; }
.fc-first { font-weight: 700; color: var(--ok); }
.fc-progress { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s4); }
.fc-progress .meter-fill { background: #4255ff; }
.fc-center { text-align: center; }
.fc-start { padding: 10px 28px; font-size: var(--fs-base); }
.fc-qstage { overflow: hidden; padding: 12px 8px 20px; margin: 0 -8px -20px; }
.fc-qcard { padding: var(--s4); background: var(--surface); border-radius: 20px; box-shadow: 0 6px 24px #2e385620; will-change: transform; }
.fc-question { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: var(--s2) var(--s2) var(--s4); }
.fc-q-img { max-width: 100%; max-height: 180px; object-fit: contain; border-radius: 12px; }
.fc-opt-img { width: 36px; height: 36px; flex: none; object-fit: cover; border-radius: 6px; }
.fc-question b { font-size: 28px; }
.fc-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.fc-option {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-align: left;
  border: 2px solid var(--line); border-radius: var(--r-md); background: var(--surface); font: inherit; font-weight: 600; cursor: pointer;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.fc-option:hover:not(:disabled) { border-color: #4255ff; }
.fc-option:disabled { cursor: default; }
.fc-option.ok { border-color: var(--ok); background: var(--ok-soft); }
.fc-option.no { border-color: var(--bad); background: var(--bad-soft); }
.fc-key { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--canvas); color: var(--muted); font-size: 13px; font-weight: 800; }
.fc-next { margin-top: var(--s3); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.fc-hint { margin: 0; color: var(--bad); font-weight: 700; flex: 1; }
.fc-finish { text-align: center; }
.fc-mistakes { list-style: none; padding: 0; margin: var(--s2) auto var(--s4); max-width: 360px; text-align: left; }
.fc-mistakes li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.fc-mistakes b { color: var(--bad); }
.fc-perfect { font-weight: 800; color: var(--ok); }
@media (max-width: 600px) {
  .fc-card { height: 240px; }
  .fc-face { font-size: 26px; }
  .fc-back { font-size: 22px; }
  .fc-options { grid-template-columns: 1fr; }
}

.fc-img-broken { display: inline-grid; place-items: center; background: var(--warn-bg); color: var(--warn-ink); font-size: 14px; border-radius: 8px; }
span.fc-img { width: 120px; height: 80px; font-size: 24px; }
span.fc-q-img { width: 90px; height: 60px; }


/* =========================================================
   Плашка урока: шапка (название, тип, срок) и части «Flashcards» / «Задания»
   ========================================================= */
.lesson-card { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px; }
.lesson-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 36px; padding: 0 2px 0 4px; }
.lesson-card-name { font-size: var(--fs-base); font-weight: 800; overflow-wrap: anywhere; }
/* Состояние части у ученика: процент пройденного или «✓ Done 7/12» */
.status-pill { flex: none; padding: 2px 10px; border-radius: var(--r-pill); font-size: 13px; font-weight: 700; white-space: nowrap; }
.status-pill.progress { background: var(--surface); color: var(--primary); border: 1px solid var(--primary-soft-2); }
.status-pill.done { background: var(--ok-soft); color: var(--ok); }
.status-pill.done b { font-weight: 800; }

.fc-icon { background: #4255ff; color: #fff; }
.fc-title-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; margin-right: 8px; vertical-align: -6px; border-radius: 9px; background: #4255ff; color: #fff; }


/* =========================================================
   Урок = Flashcards + Homework + Test: карточки элементов в один ряд
   Обводка: Flashcards — фиолетовая, Homework — синяя, Test — красная; закрытый Test — серый.
   ========================================================= */
:root { --el-cards: #7c4dff; --el-hw: #2f6fed; --el-test: #e5484d; --el-locked: #a8a6b8; }
.lesson-elements { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.lesson-elements.n1 { grid-template-columns: minmax(0, 1fr); }
.lesson-elements.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.el-card {
  --el: var(--el-cards);
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0;
  padding: 10px 12px; border: 2px solid var(--el); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); text-align: left; font: inherit; cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.el-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px color-mix(in srgb, var(--el) 22%, transparent); }
.el-card.el-hw { --el: var(--el-hw); }
.el-card.el-test { --el: var(--el-test); }
.el-card.is-locked { --el: var(--el-locked); color: var(--muted); background: var(--canvas); cursor: not-allowed; }
.el-card.is-locked:hover { transform: none; box-shadow: none; }
.el-card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.el-icon { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 8px; color: var(--el); background: color-mix(in srgb, var(--el) 12%, transparent); }
.el-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.el-meta { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.el-status { min-height: 22px; }
.el-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.el-title-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: #fff; background: var(--el-cards); }
.el-title-icon.el-hw { background: var(--el-hw); }
.el-title-icon.el-test { background: var(--el-test); }
.el-title-sep { color: var(--muted); font-weight: 400; }

.status-pill { display: inline-flex; align-items: center; gap: 4px; }
.status-pill.locked { background: var(--canvas); color: var(--muted); border: 1px solid var(--line); }
.status-pill.open { background: #fdecec; color: var(--el-test); font-variant-numeric: tabular-nums; }

/* Задания: баллы и таймер вверху карточки */
.task-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin: -4px 0 6px; }
.meta-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--r-pill); background: var(--canvas); color: var(--muted); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.task-timer[data-ends-at] { background: #fdecec; color: var(--el-test); }
.task-card.timed-out { opacity: .6; }
.task-list { display: flex; flex-direction: column; gap: var(--s3); }
.runner.locked .task-card, .task-list.locked .task-card, .task-card.locked { pointer-events: none; }

/* «Завершить» и предупреждение про первую попытку */
.finish-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin: var(--s4) 0; padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.finish-note { display: flex; align-items: center; gap: 8px; flex: 1 1 260px; margin: 0; color: var(--warn-ink); font-size: 14px; }
.finish-note .icon { flex: none; }
.result-panel { margin-top: var(--s3); }
.result-head { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.result-head .title-2 { color: var(--ink); }
.result-score { font-size: 18px; margin: var(--s2) 0; }
.result-score b { font-size: 28px; }
.breakdown { list-style: none; margin: 0; padding: 0; }
.breakdown li { display: flex; justify-content: space-between; gap: var(--s3); padding: 6px 0; border-top: 1px solid var(--line); }
.breakdown .ok { color: var(--ok); font-weight: 700; } .breakdown .part { color: var(--warn-ink); font-weight: 700; } .breakdown .no { color: var(--bad); font-weight: 700; }
.center { text-align: center; }

/* Test */
.test-page .card + .card { margin-top: var(--s3); }
.test-settings { display: flex; flex-direction: column; gap: var(--s4); }
.setting-row { display: flex; flex-direction: column; gap: 6px; }
.test-status { display: flex; flex-direction: column; gap: var(--s2); }
.test-status.open { border: 2px solid var(--el-test); }
.test-clock { font-size: 48px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--el-test); line-height: 1; }
.test-timer { position: sticky; top: 8px; z-index: 5; display: flex; align-items: center; gap: 8px; width: fit-content; margin: 0 0 var(--s3) auto; padding: 8px 14px; border-radius: var(--r-pill); background: var(--el-test); color: #fff; box-shadow: var(--shadow); font-variant-numeric: tabular-nums; }
.step-nav { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s3); }
.step-count { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.test-wait { display: flex; flex-direction: column; align-items: center; gap: var(--s2); }
.test-wait-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--canvas); color: var(--muted); }
.form-card { display: flex; flex-direction: column; gap: var(--s4); max-width: 560px; }

/* Редактор: «ручка» перетаскивания, баллы и таймер задания */
.drag-handle { display: grid; place-items: center; width: 24px; flex: none; color: var(--muted); cursor: grab; touch-action: none; }
.drag-handle:hover { color: var(--primary); }
.block-ghost { opacity: .4; }
.block-icon .icon { color: var(--primary); }
.task-settings { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s2) var(--s4); margin-top: var(--s3); padding-top: var(--s3); border-top: 1px dashed var(--line); }
.inline-field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.inline-field .input { width: 150px; }
.task-settings .field-hint { flex: 1 1 100%; margin: 0; }

/* Картинки в блоке «Текст» */
.text-images { display: flex; flex-wrap: wrap; gap: var(--s3); margin: var(--s3) 0; }
.text-images figure { margin: 0; flex: 1 1 220px; max-width: 100%; }
.text-images img { display: block; max-width: 100%; max-height: 360px; border-radius: var(--r-md); }
.text-images figcaption { font-size: 13px; color: var(--muted); margin-top: 4px; }
.text-images-edit { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.text-image-row { display: flex; align-items: center; gap: 8px; }
.text-image-row .thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; flex: none; }

/* Шапка: логотип и «Классы» с иконками */
.logo { display: flex; align-items: center; gap: 8px; }
.logo-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--primary); color: #fff; }
.top-nav-item { display: inline-flex; align-items: center; gap: 6px; }
.deadline-tag { display: inline-flex; align-items: center; gap: 4px; }
.codes-icon { display: inline-grid; color: var(--primary); }
.chev { display: inline-grid; transition: transform .15s var(--ease); }
.class-tabs { margin-bottom: var(--s4); }
.module-title, .class-tile-name { font-size: 17px; font-weight: 700; }

/* Медали в рейтинге: 1–3 — значки вместо эмодзи */
.medal { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 13px; font-weight: 800; color: #fff; }
.medal-1 { background: #e0a800; } .medal-2 { background: #9aa3b2; } .medal-3 { background: #c47a3c; }

@media (max-width: 600px) {
  .lesson-elements { gap: 6px; }
  .el-card { padding: 8px; }
  .el-name { font-size: 13px; }
  .el-icon { width: 24px; height: 24px; }
  .el-meta { font-size: 11px; }
  .test-clock { font-size: 36px; }
}
.setting-row .segmented { align-self: flex-start; }

/* =========================================================
   Единая шкала заголовков для существующих элементов:
   надписи — overline, разделы — H2, карточки и блоки — H3
   ========================================================= */
.rank-subhead, .preview-label, .bank-app .rank-subhead { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fc-mode-title, .finish h2, .empty-state h2, .card > h2 { font-size: 20px; font-weight: 700; line-height: 1.3; }
.module-title, .class-tile-name, .lesson-card-name, .block-name, .fc-editor-head b, .class-card-title { font-size: 17px; font-weight: 700; line-height: 1.35; }
.page-title { margin: 0; }

/* =========================================================
   Flashcards: серия, огоньки, дрожание, поощрение
   ========================================================= */
.fc-progress-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 28px; }
.fc-streak { position: relative; display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-pill); background: #fff1e6; color: #e8590c; font-size: 13px; }
.fc-streak.hot { background: #ffe3cc; color: #d9480f; box-shadow: 0 0 0 2px #ffc9a3; }
.fc-streak.bump { animation: streak-bump .35s var(--spring); }
@keyframes streak-bump { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
.flame-spark { position: absolute; left: 50%; top: 50%; color: #f76707; pointer-events: none; animation: flame-up var(--d, .8s) ease-out forwards; }
@keyframes flame-up {
  0% { transform: translate(-50%, -50%) scale(.6); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2) rotate(15deg); opacity: 0; }
}
.fc-qcard.shake { animation: card-shake .42s ease-in-out; }
@keyframes card-shake {
  0%, 100% { transform: translateX(0); } 15% { transform: translateX(-10px) rotate(-1deg); } 35% { transform: translateX(9px) rotate(1deg); }
  55% { transform: translateX(-6px); } 75% { transform: translateX(4px); }
}
.fc-praise { font-size: 26px; font-weight: 800; color: var(--el-cards, #7c4dff); margin: 0 0 4px; }
.coins-earned { display: inline-flex; align-items: center; gap: 6px; margin: 6px auto; padding: 4px 14px; border-radius: var(--r-pill); background: #fef3c7; color: #92400e; font-weight: 700; }
.result-panel .coins-earned { margin: 4px 0 8px; }
@media (prefers-reduced-motion: reduce) { .fc-qcard.shake, .fc-streak.bump { animation: none; } }

/* =========================================================
   Прогресс учеников по уроку
   ========================================================= */
.progress-page .segmented { margin-bottom: var(--s4); }
.progress-icon { background: var(--primary) !important; }
.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.progress-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.progress-table th, .progress-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.progress-table th { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--canvas); }
.progress-table th.group { font-size: 13px; color: var(--ink); }
.progress-table .name { text-align: left; font-weight: 600; position: sticky; left: 0; background: var(--surface); }
.progress-table th.name { background: var(--canvas); }
.progress-table th.el-cards-col { color: var(--el-cards); }
.progress-table th.el-hw-col { color: var(--el-hw); background: #eef4ff; }
.progress-table th.el-test-col { color: var(--el-test); background: #fff1f1; }
.progress-table td.total { background: var(--canvas); }
.progress-table .ok { color: var(--ok); font-weight: 700; } .progress-table .no { color: var(--bad); font-weight: 700; }
.task-stats { list-style: none; margin: var(--s3) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); }
.task-stat-head { display: flex; justify-content: space-between; gap: var(--s2); margin-bottom: 6px; }
.task-stat-bar { display: flex; align-items: center; gap: var(--s3); }
.task-stat-bar .meter { flex: 1; }
.task-stat-bar .meter-fill { background: var(--el-hw); }
.task-stat-bar .meter-fill.low { background: var(--bad); }
.task-stat-pct { min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
.status-row { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* Задания: меньше расстояния между блоками и поля карточек */
.task-list { gap: var(--s2); }
.task-list > .task-card { margin: 0; }
.task-card { padding: var(--s3) var(--s4); }
.task-card .task-meta { margin: 0 0 4px; }
.fc-first { margin-top: var(--s2); }
.class-card-top { display: flex; align-items: flex-start; gap: 4px; }
.class-card-top > .btn { margin-top: 6px; } /* на одной линии с названием класса */
.class-card-top .class-card-open { flex: 1; min-width: 0; padding-right: var(--s2); }
.class-card-item .class-card-actions { gap: var(--s2); }
.classes > .page-title { margin-bottom: var(--s5); } /* отступ после заголовка «Классы» */

/* Flashcards — заучивание: плашка-место теста, ввод ответа */
.fc-qcard { display: flex; flex-direction: column; } /* высота — по содержимому вопроса */
.fc-qcard.fc-intro { min-height: 240px; }
.fc-qcard.fc-intro { align-items: center; justify-content: center; gap: var(--s3); text-align: center; }
.fc-intro-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: #f3eeff; color: var(--el-cards); }
.fc-intro-text { max-width: 440px; margin: 0; font-size: 17px; color: var(--ink); }
.fc-intro .fc-first { margin: 0; }
.fc-phase { font-weight: 700; color: var(--el-cards); font-size: 13px; }
.fc-type-row { display: flex; gap: var(--s2); }
.fc-type-input { flex: 1; height: 48px; font-size: 18px; }
.fc-type-input.ok { border-color: var(--ok); background: var(--ok-soft); }
.fc-type-input.no { border-color: var(--bad); background: var(--bad-soft); }
.fc-right-answer { margin: 6px 0 0; color: var(--ok); font-weight: 700; }
.fc-type-row + .fc-right-answer { margin-top: 8px; }
.fc-qcard .fc-next { justify-content: flex-end; padding-top: var(--s3); } /* «Дальше» — справа */
.fc-qcard .fc-next:empty { display: none; }
.progress-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-bottom: var(--s4); }
.progress-tabs .segmented { margin: 0; }
.progress-table td.words { white-space: normal; min-width: 200px; font-weight: 400; font-size: 13px; position: static; }
.lesson-coins { flex: none; padding: 2px 10px; border-radius: var(--r-pill); background: #fef3c7; color: #92400e; font-weight: 800; font-variant-numeric: tabular-nums; }
.duration-input { width: 140px; }
/* Условие задания и баллы — одна строка */
.task-card .task-meta { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); margin: 0 0 var(--s2); }
.task-meta .task-prompt { flex: 1; min-width: 0; margin: 0; }
.task-meta-pills { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: none; margin-left: auto; }
.test-preview { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px dashed var(--line); } .test-preview > .title-2 { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.el-bottom { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; min-height: 24px; }
.el-bottom .el-meta { flex: 1 1 auto; min-width: 0; }
.el-bottom .el-status { flex: none; min-height: 0; }

/* Тест: «Завершить» справа, предупреждение — слева */
.finish-bar.finish-right { flex-direction: row-reverse; }
.finish-bar.finish-right .finish-note { justify-content: flex-start; }

/* Flashcards: карточка компактнее, у плашки заучивания — больше нижнее поле */
.fc-slide { max-width: var(--learn-width); }
.fc-card { height: 250px; }
.fc-face { font-size: 28px; padding: var(--s4); }
.fc-back { font-size: 23px; }
.fc-img { max-height: 130px; }
.fc-qcard { padding-bottom: var(--s6); }
@media (max-width: 600px) { .fc-card { height: 210px; } .fc-face { font-size: 24px; } .fc-back { font-size: 20px; } }

/* =========================================================
   Интервальное повторение (SM-2): оценки, статусы слов, раздел Interval Learning
   ========================================================= */
:root { --el-review: #0e9f8e; --g-again: #c92a47; --g-hard: #c25e00; --g-good: #2f6fed; --g-easy: #12804f; }
.grade-pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--r-pill); font-size: 13px; font-weight: 800; white-space: nowrap; color: #fff; }
.grade-pill.g-again { background: var(--g-again); }
.grade-pill.g-hard { background: var(--g-hard); }
.grade-pill.g-good { background: var(--g-good); }
.grade-pill.g-easy { background: var(--g-easy); }
.grade-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-weight: 600; color: var(--ink); }
.fc-qcard .fc-next:has(.grade-note) { justify-content: flex-start; }
.fc-soft-hint { margin: 8px 0 0; padding: 8px 12px; border-radius: var(--r-md); background: var(--warn-bg); color: var(--warn-ink); font-weight: 600; }

.grade-summary { margin: var(--s3) auto var(--s4); max-width: 560px; text-align: left; }
.grade-counts { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2) var(--s3); margin-bottom: var(--s3); }
.grade-count { display: inline-flex; align-items: center; gap: 6px; }
.grade-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; }
.grade-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto 92px; align-items: center; gap: var(--s2) var(--s3); padding: 7px 2px; border-bottom: 1px solid var(--line); }
.gl-word { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.gl-att { font-variant-numeric: tabular-nums; white-space: nowrap; }
.gl-next { text-align: right; color: var(--muted); }

.srs-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.srs-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--canvas); color: var(--muted); border: 1px solid var(--line); }
.srs-chip b { font-weight: 800; font-variant-numeric: tabular-nums; }
.srs-chip.st-new { background: #f3eeff; color: var(--el-cards); border-color: #e2d8ff; }
.srs-chip.st-learning { background: #fff4e5; color: var(--g-hard); border-color: #ffe0b8; }
.srs-chip.st-due { background: #e6f7f4; color: var(--el-review); border-color: #bfeae2; }
.srs-chip.st-review { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.srs-intro-note { max-width: 460px; margin: 0; }
.srs-intro-icon { background: #e6f7f4 !important; color: var(--el-review) !important; }
.el-title-icon.el-review { background: var(--el-review); }

.interval-page .srs-session { margin-top: var(--s3); }
.srs-dash { display: flex; flex-direction: column; gap: var(--s3); margin-top: var(--s4); }
.srs-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s2); }
.srs-stat { display: flex; flex-direction: column; gap: 2px; padding: var(--s3) var(--s4); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.srs-stat b { font-size: 28px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.srs-stat span { font-size: 13px; color: var(--muted); }
.srs-stat.st-due b { color: var(--el-review); }
.srs-stat.st-new b { color: var(--el-cards); }
.srs-stat.st-learning b { color: var(--g-hard); }
.srs-stat.st-review b { color: var(--ok); }
.srs-forecast .title-3 { margin: 0 0 var(--s3); }
.srs-bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--s2); align-items: end; height: 120px; }
.srs-bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.srs-bar-fill { width: 100%; max-width: 44px; min-height: 3px; border-radius: 8px 8px 3px 3px; background: var(--el-review); opacity: .85; }
.srs-bar-fill.zero { opacity: .25; }
.srs-bar-n { font-size: 13px; font-weight: 800; min-height: 18px; }
.srs-words, .srs-help { padding: 0; }
.srs-words > summary, .srs-help > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); cursor: pointer; list-style: none; }
.srs-words > summary::-webkit-details-marker, .srs-help > summary::-webkit-details-marker { display: none; }
.srs-words > summary::after, .srs-help > summary::after { content: '▾'; color: var(--muted); margin-left: var(--s2); transition: transform .2s; }
.srs-words:not([open]) > summary::after, .srs-help:not([open]) > summary::after { transform: rotate(-90deg); }
.srs-words > summary .muted { margin-left: auto; }
.srs-table td.srs-back { font-weight: 400; color: var(--muted); }
.srs-table td.srs-lessons { white-space: normal; min-width: 140px; text-align: left; font-size: 13px; color: var(--muted); }
.srs-overdue { color: var(--bad); font-weight: 700; }
.srs-today { color: var(--el-review); font-weight: 700; }
.srs-help > :not(summary) { margin-left: var(--s4); margin-right: var(--s4); }
.srs-help-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.srs-help-list li { display: flex; align-items: baseline; gap: var(--s2); }
.srs-help-list .grade-pill { min-width: 58px; justify-content: center; }
.srs-help > :last-child { padding-bottom: var(--s3); }
@media (max-width: 700px) {
  .srs-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .srs-stat.st-due { grid-column: 1 / -1; }
  .grade-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .gl-att, .gl-next { grid-column: auto; }
}


/* =========================================================
   Единая ширина страниц
   Все страницы и разделы — один контейнер --page-width (1120 px, поля 16 px);
   шапка выровнена по нему же. Учебные колонки (карточки, заучивание, карусель) —
   одна ширина --learn-width по центру.
   ========================================================= */
:root { --page-width: 1120px; --learn-width: 720px; }
main, main.wide, main.bank-width, main.seating-width, #bank-root, #bank-root.seating-width, .bank-app { max-width: var(--page-width); }
.app-header { padding-left: max(var(--s4), calc((100% - var(--page-width)) / 2 + var(--s4))); padding-right: max(var(--s4), calc((100% - var(--page-width)) / 2 + var(--s4))); }
.app-nav { max-width: var(--page-width); padding: 0 var(--s4); }

/* Отступ после заголовков разделов («Мои уроки», «Рейтинг класса», «Классы» …) */
main h1.page-title, .bank-app h1.page-title { margin-bottom: var(--s5); }
.page-head { margin: var(--s2) 0 var(--s5); }
.page-head .page-title { margin: 0; }

/* Ввод ответа: правильный вариант — в строке ввода, справа */
.fc-type-field { position: relative; flex: 1; display: flex; }
.fc-type-field .fc-type-input { flex: 1; }
.fc-type-field.has-answer .fc-type-input { padding-right: calc(var(--answer-w, 40%) + 20px); }
.fc-inline-answer { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 3px 10px; border-radius: var(--r-pill); background: var(--ok-soft); color: var(--ok); font-weight: 800; font-size: 16px; pointer-events: none; }



/* =========================================================
   Interval Learning: ученик — одна колонка; учитель — обзор по ученикам
   ========================================================= */
.srs-dash-narrow { max-width: var(--learn-width); margin-left: auto; margin-right: auto; width: 100%; }
.srs-dash-narrow .srs-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.srs-dash-narrow .srs-stat { padding: var(--s3); }
.srs-dash-narrow .srs-stat b { font-size: 24px; }
.srs-teacher-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin: var(--s4) 0 var(--s2); }
.class-interval > .muted.small { margin: 0 0 var(--s2); }
.srs-row-link { cursor: pointer; }
.srs-row-link:hover td { background: var(--primary-soft); }
.link-btn { padding: 0; border: 0; background: none; color: var(--primary); font: inherit; font-weight: 700; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.srs-student-head { display: flex; align-items: center; gap: var(--s2); margin: var(--s3) 0; }
.srs-student-head .title-2 { margin: 0; }
.srs-student .srs-dash { margin-top: 0; }

/* =========================================================
   Антисписывание
   ========================================================= */
.runner.protected, .runner.protected * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.runner.protected input, .runner.protected textarea, .runner.protected [contenteditable="true"] { -webkit-user-select: text; user-select: text; }
.ac-notice { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 var(--s3); padding: 10px 14px; border-radius: var(--r-md); background: var(--warn-bg); color: var(--warn-ink); font-size: 14px; font-weight: 600; }
.ac-notice .icon { flex: none; margin-top: 2px; }
.progress-table td.ac-flag { color: var(--bad); font-weight: 700; white-space: normal; min-width: 120px; }
.ac-live-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s2); }
.ac-live-head .title-3 { margin: 0; display: inline-flex; align-items: center; gap: 6px; }
.ac-table { width: auto; }
.ac-table td { text-align: left; }

/* =========================================================
   Test: верхняя панель — таблица лидеров и таймер
   ========================================================= */
.test-topbar { position: sticky; top: 64px; z-index: 6; display: flex; align-items: center; justify-content: flex-end; gap: var(--s2); flex-wrap: wrap; margin: 0 0 var(--s3); pointer-events: none; }
.test-topbar > * { pointer-events: auto; }
.test-topbar .test-timer { position: static; margin: 0; }
.test-board { display: flex; align-items: center; gap: var(--s3); margin-right: auto; padding: 6px 8px 6px 14px; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); font-size: 14px; max-width: 100%; }
.tb-me { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.tb-label, .tb-unit { color: var(--muted); }
.tb-points { font-size: 18px; font-weight: 800; color: var(--el-test); font-variant-numeric: tabular-nums; }
.tb-rank { margin-left: 4px; padding: 1px 8px; border-radius: var(--r-pill); background: #fdecec; color: var(--el-test); font-weight: 700; }
.tb-top { display: flex; gap: 4px; margin: 0; padding: 0 0 0 var(--s3); list-style: none; border-left: 1px solid var(--line); }
.tb-top li { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 3px; border-radius: var(--r-pill); white-space: nowrap; }
.tb-top li.me { background: var(--primary-soft-2); }
.tb-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.tb-pts { font-variant-numeric: tabular-nums; }
.tb-medal { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; font-weight: 800; color: #fff; }
.tb-medal.m1 { background: #e0a100; } .tb-medal.m2 { background: #9aa3b5; } .tb-medal.m3 { background: #c7773a; }
.test-submitted .test-topbar { position: static; justify-content: flex-start; }
.test-reveal { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.test-reveal-clock { font-variant-numeric: tabular-nums; color: var(--el-test); }
@media (max-width: 700px) {
  .test-topbar { top: 56px; }
  .test-board { flex-wrap: wrap; border-radius: var(--r-lg); gap: 6px var(--s2); }
  .tb-top { border-left: 0; padding-left: 0; flex-wrap: wrap; }
}

/* Правильные ответы после теста */
.answer-key { margin-top: var(--s3); }
.answer-key .result-head { margin-bottom: var(--s2); }
.key-item { padding: var(--s3) 0; border-top: 1px solid var(--line); }
.key-item .title-3 { margin: 0 0 6px; font-size: 16px; }
.key-text { margin: 0; line-height: 1.8; }
.key-list { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 4px; }
.key-ans { padding: 1px 8px; border-radius: 6px; background: var(--ok-soft); color: var(--ok); }
.srs-table th.srs-lessons { text-align: left; }
.srs-dash > .card, .srs-dash > details.card { margin: 0; }

/* Flashcards: подзаголовки «Карточки» и «Заучивание» — на ширине карточки и плашки */
.flashcards .fc-mode-title { max-width: var(--learn-width); margin-left: auto; margin-right: auto; }
.lp-sort { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.srs-quad { white-space: nowrap; font-variant-numeric: tabular-nums; }
.srs-quad .q-new { color: var(--el-cards); font-weight: 700; } .srs-quad .q-learning { color: var(--g-hard); font-weight: 700; } .srs-quad .q-review { color: var(--ok); font-weight: 700; }
.srs-days-title { margin: var(--s5) 0 var(--s2); }
.progress-table th.srs-day-head, .progress-table td.srs-day { padding-left: 6px; padding-right: 6px; min-width: 38px; }
.progress-table th.srs-day-head.today { color: var(--el-review); }
.progress-table td.srs-day { color: var(--line); }
.progress-table td.srs-day.has { color: var(--ink); font-weight: 800; background: #e6f7f4; }
.srs-overview .table-card + .muted { margin-top: var(--s2); }

/* Interval Learning → «Все слова»: столбцы по ширине содержимого, ровные поля */
.srs-table { width: 100%; border-collapse: collapse; }
.srs-table th, .srs-table td { width: 1%; white-space: nowrap; padding: 9px 14px; text-align: left; }
.srs-table th:first-child, .srs-table td:first-child { padding-left: 16px; }
.srs-table th:last-child, .srs-table td:last-child { padding-right: 16px; }
.srs-table th.srs-lessons, .srs-table td.srs-lessons { width: auto; min-width: 120px; white-space: normal; }
.srs-table td.srs-back { white-space: normal; min-width: 90px; }
.srs-words > summary .srs-sort-note { margin-left: auto; }
.srs-words > summary .srs-sort-note + .muted { margin-left: var(--s3); }

/* =========================================================
   Flashcards: озвучка и картинки
   ========================================================= */
.fc-tools { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--s3) var(--s5); margin: var(--s3) 0; padding: var(--s3); border-radius: var(--r-md); background: var(--canvas); }
.fc-tts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); flex: 1 1 380px; }
.fc-tts .inline-field { flex-direction: row; align-items: center; gap: 8px; }
.fc-tts .inline-field .input { width: auto; }
.fc-auto-img { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; flex: 0 1 300px; }
.fc-auto-img .field-hint { margin: 0; }
.fc-slide { position: relative; }
.fc-say-box { position: absolute; top: 10px; right: 10px; z-index: 3; }
.fc-say { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); color: var(--primary); }
.fc-say:hover { background: var(--primary-soft); }
.fc-question { position: relative; }
.fc-say.fc-say-inline { position: absolute; top: 0; right: 0; width: 36px; height: 36px; }
.fc-credit { position: absolute; left: 12px; right: 12px; bottom: 8px; font-size: 10px; line-height: 1.2; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; opacity: .8; }

/* Окно выбора картинки */
.img-picker { width: min(880px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: var(--s4); border: 0; border-radius: var(--r-lg); box-shadow: 0 20px 60px #1d1b3a40; color: var(--ink); background: var(--surface); }
.img-picker::backdrop { background: #0f172a8f; }
.img-picker-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s2); }
.img-picker-head .title-3 { margin: 0; }
.img-search-row { display: flex; gap: var(--s2); margin-bottom: var(--s2); }
.img-search-row .input { flex: 1; }
.img-tabs { margin-bottom: var(--s2); }
.img-status { margin: 0 0 var(--s2); min-height: 1.4em; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s2); max-height: 56vh; overflow: auto; padding: 2px; }
.img-grid.busy { opacity: .5; pointer-events: none; }
.img-option { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 2px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: pointer; text-align: left; transition: border-color .15s, transform .15s; }
.img-option:hover, .img-option:focus-visible { border-color: var(--primary); transform: translateY(-1px); }
.img-option img { width: 100%; height: 120px; object-fit: contain; background: var(--canvas); border-radius: 8px; }
.img-credit { font-size: 11px; line-height: 1.25; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.img-license { margin: var(--s2) 0 0; }

/* Плашки Flashcards / Homework / Test: при масштабировании текст не выходит за границы —
   название переносится под иконку, количество заданий и статус — на следующую строку. */
.el-card { width: 100%; overflow: hidden; }
.el-card-top { flex-wrap: wrap; row-gap: 4px; width: 100%; }
.el-name { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; min-width: 0; line-height: 1.25; }
.el-bottom { flex-wrap: wrap; row-gap: 4px; width: 100%; }
.el-bottom .el-meta, .el-meta { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.el-bottom .el-status { max-width: 100%; }
.el-status .status-pill { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.lesson-elements > .el-card { container-type: inline-size; }
@container (max-width: 110px) {
  .el-card-top { gap: 4px; }
  .el-icon { width: 20px; height: 20px; border-radius: 6px; }
  .el-icon .icon { width: 13px; height: 13px; }
  .el-name { font-size: 12px; }
  .el-meta { font-size: 11px; }
}
@media (max-width: 420px) { .lesson-elements > .el-card { padding: 6px; } }

/* Общее модальное окно (копирование урока и др.) */
.app-dialog { width: min(460px, calc(100vw - 24px)); padding: var(--s4); border: 0; border-radius: var(--r-lg); box-shadow: 0 20px 60px #1d1b3a40; color: var(--ink); background: var(--surface); }
.app-dialog::backdrop { background: #0f172a8f; }
.app-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.app-dialog-head .title-3 { margin: 0; }
.app-dialog .field { display: flex; flex-direction: column; gap: 4px; margin: var(--s3) 0 0; }
.app-dialog .field .input { width: 100%; }
.app-dialog-actions { justify-content: flex-end; margin-top: var(--s4); }

/* Прогресс учеников */
.lp-mode-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.lp-mode-row .lp-sort { margin-left: 0; display: inline-flex; align-items: center; gap: 6px; }
.input.input-sm { height: 34px; padding: 0 10px; font-size: 14px; width: auto; }
.ac-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 1px 8px; border-radius: var(--r-pill); background: var(--bad-soft); color: var(--bad); font-size: 12px; font-weight: 700; white-space: nowrap; vertical-align: middle; cursor: help; }
.task-stat-x { padding: 0; }
.task-stat-x > details > summary { list-style: none; cursor: pointer; padding: var(--s2) 0; position: relative; padding-right: 26px; }
.task-stat-x > details > summary::-webkit-details-marker { display: none; }
.task-stat-x > details > summary::after { content: '▾'; position: absolute; right: 4px; top: 12px; color: var(--muted); transition: transform .2s; }
.task-stat-x > details:not([open]) > summary::after { transform: rotate(-90deg); }
.task-stat-x > details > summary:hover .task-stat-head b { color: var(--primary); }
.task-expand { display: flex; flex-direction: column; gap: var(--s3); margin: 0 0 var(--s3); padding: var(--s3); border-radius: var(--r-md); background: var(--canvas); }
.task-full { padding: var(--s3); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.tf-prompt { margin: 0 0 6px; font-weight: 600; }
.tf-q { margin: 0 0 4px; font-weight: 700; }
.tf-opts { margin: 0; padding-left: 1.2em; }
.tf-opts li.ok { color: var(--ok); font-weight: 700; }
.ta-table { background: var(--surface); border-radius: var(--r-md); overflow: hidden; }
.ta-table td.ta-answer { white-space: normal; text-align: left; min-width: 200px; }
.ta-list { margin: 0; padding-left: 1.1em; }
.ta-essay { white-space: pre-wrap; max-height: 220px; overflow: auto; }

/* =========================================================
   Ударный режим (streak) и виджеты кабинета ученика
   ========================================================= */
.dash-widgets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); margin: 0 0 var(--s5); }
.dash-widgets > .card { margin: 0; }
[data-clickable] { cursor: pointer; transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
[data-clickable]:hover { transform: translateY(-2px); box-shadow: 0 8px 22px #2e385622; }
[data-clickable]:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
@media (max-width: 760px) { .dash-widgets { grid-template-columns: 1fr; } }

.streak-widget { position: relative; display: flex; align-items: center; gap: var(--s4); padding: var(--s4) var(--s5); text-align: left; overflow: visible;
  background: linear-gradient(135deg, #fff7ed 0%, #ffffff 65%); border: 2px solid #ffd8a8; }
.streak-widget.todo { border-color: #ffa94d; }
.streak-widget.saved { border-color: #74c0fc; background: linear-gradient(135deg, #e7f5ff 0%, #ffffff 65%); }
.streak-widget.done { border-color: #ffc078; }
.srs-streak-box { max-width: var(--learn-width); margin: 0 auto var(--s3); }
.sw-flame { position: relative; flex: none; display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; font-size: 44px; line-height: 1;
  background: radial-gradient(circle, #ffe8cc 0%, #fff4e6 60%, transparent 70%); animation: flicker 1.8s ease-in-out infinite; }
.sw-flame.out { filter: grayscale(1) opacity(.45); animation: none; }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.07) rotate(2deg); } }
.sw-main { min-width: 0; flex: 1; }
.sw-count { display: flex; align-items: baseline; gap: 8px; }
.sw-count b { font-size: 40px; font-weight: 900; line-height: 1; color: #e8590c; font-variant-numeric: tabular-nums; }
.sw-count span { font-size: 15px; font-weight: 800; color: #d9480f; text-transform: uppercase; letter-spacing: .04em; }
.sw-msg { margin: 6px 0 4px; font-weight: 600; color: var(--ink); }
.streak-widget.saved .sw-msg { color: #1864ab; }
.sw-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s3); }
.sw-freeze { font-size: 13px; font-weight: 700; color: #1c7ed6; }
.sw-freeze.used { color: var(--muted); font-weight: 600; }
.streak-widget.compact { padding: var(--s3) var(--s4); gap: var(--s3); }
.streak-widget.compact .sw-flame { width: 58px; height: 58px; font-size: 36px; }
.streak-widget.compact .sw-count b { font-size: 32px; }
/* Серия: зажглась / выросла / сгорела */
.streak-widget.sw-ignite .sw-flame { animation: ignite 1s var(--spring) 1, flicker 1.8s ease-in-out 1s infinite; }
.streak-widget.sw-grow .sw-flame { animation: grow-pop .8s var(--spring) 1, flicker 1.8s ease-in-out .8s infinite; }
.streak-widget.sw-grow .sw-count b, .streak-widget.sw-ignite .sw-count b { animation: count-pop .7s var(--spring); }
.streak-widget.sw-burn .sw-flame { animation: burn-out 1.4s ease-in forwards; }
@keyframes ignite { 0% { transform: scale(0) rotate(-30deg); filter: brightness(2); } 60% { transform: scale(1.4) rotate(8deg); } 100% { transform: scale(1); } }
@keyframes grow-pop { 0% { transform: scale(1); } 35% { transform: scale(1.45); filter: drop-shadow(0 0 14px #ff922b); } 100% { transform: scale(1); } }
@keyframes count-pop { 0% { transform: translateY(8px); opacity: .2; } 100% { transform: none; opacity: 1; } }
@keyframes burn-out { 0% { transform: scale(1); } 30% { transform: scale(1.2); filter: hue-rotate(-30deg) brightness(1.3); } 100% { transform: scale(.6) translateY(6px); filter: grayscale(1) opacity(.4); } }
.sw-smoke, .fs-smoke { position: absolute; left: 50%; top: 10%; font-size: 26px; pointer-events: none; animation: smoke-up 1.4s ease-out forwards; }
@keyframes smoke-up { 0% { transform: translate(-50%, 0) scale(.6); opacity: 0; } 30% { opacity: .9; } 100% { transform: translate(-50%, -48px) scale(1.4); opacity: 0; } }
.flame-spark.big { font-size: 20px; }

/* Огоньки в заучивании */
.fc-streak .fs-flame { display: inline-block; font-size: 16px; line-height: 1; }
.fc-streak.ignite { animation: chip-ignite .7s var(--spring); }
.fc-streak.ignite .fs-flame { animation: ignite .7s var(--spring); }
.fc-streak.bump { animation: streak-bump .45s var(--spring); }
.fc-streak.bump .fs-flame { animation: grow-pop .5s var(--spring); }
.fc-streak.burn { background: #f1f3f5; color: var(--muted); box-shadow: none; animation: card-shake .4s; }
.fc-streak.burn .fs-flame { animation: burn-out 1.2s ease-in forwards; }
.fs-plus { position: absolute; right: -6px; top: -4px; font-size: 13px; font-weight: 900; color: #e8590c; pointer-events: none; animation: plus-up .9s ease-out forwards; }
.fs-smoke { font-size: 18px; top: -4px; left: 14px; }
@keyframes chip-ignite { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.25); opacity: 1; box-shadow: 0 0 0 6px #ffc9a366; } 100% { transform: scale(1); } }
@keyframes plus-up { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-22px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .sw-flame, .streak-widget .sw-flame, .fc-streak, .fc-streak .fs-flame { animation: none !important; }
  .sw-smoke, .fs-smoke, .fs-plus { display: none; }
}

/* Виджет рейтинга класса */
.rating-widget { display: flex; flex-direction: column; gap: 8px; padding: var(--s3) var(--s4); text-align: left; }
.rw-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.rw-place { padding: 2px 10px; border-radius: var(--r-pill); background: var(--primary-soft-2); color: var(--primary); font-weight: 800; font-size: 13px; white-space: nowrap; }
.rw-me { display: flex; align-items: baseline; gap: 8px; }
.rw-me b { font-size: 30px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.rw-coin { font-size: 24px; align-self: center; }
.rw-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.rw-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: var(--s2); padding: 4px 8px; border-radius: 10px; border: 2px solid transparent; }
.rw-row.me { border-color: var(--primary); background: var(--primary-soft); }
.rw-row.self { margin-top: 4px; }
.rw-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rw-coins { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Interval Learning: шкала и таблица по урокам */
.srs-barcard { padding: var(--s3) var(--s4); }
.srs-stack { display: flex; height: 16px; border-radius: var(--r-pill); overflow: hidden; background: #e9ecef; gap: 2px; }
.srs-seg { display: block; min-width: 6px; }
.seg-learning { background: #fd7e14; } .seg-review { background: #2f9e44; } .seg-new { background: #ced4da; }
.srs-legend { display: flex; flex-wrap: wrap; gap: 4px var(--s4); margin-top: 10px; font-size: 14px; }
.srs-leg { display: inline-flex; align-items: center; gap: 6px; }
.srs-leg i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.srs-bar-pct { margin: 6px 0 0; }
.srs-cap-note { margin: 0; max-width: 460px; }
.srs-day-done { margin: 0; font-weight: 800; color: #e8590c; }
.srs-chip.st-new { background: #f1f3f5; color: #868e96; border-color: #e9ecef; }
.srs-chip.st-learning { background: #fff4e6; color: #d9480f; border-color: #ffd8a8; }
.srs-chip.st-review { background: #ebfbee; color: #2b8a3e; border-color: #b2f2bb; }
.srs-table tbody.srs-group + tbody.srs-group tr.srs-group-head th { border-top: 8px solid var(--surface); }
.srs-table tr.srs-group-head th { padding: 8px 16px; text-align: left; background: var(--primary-soft); color: var(--ink); font-size: 14px; font-weight: 800; }
.srs-table tr.srs-group-head th span + span { margin-left: 8px; font-weight: 600; }
.srs-table td.srs-status { width: auto; }

/* Название сайта: LlamaLang (Coiny): «Llama» — тёмно-фиолетовым, «Lang» — фирменным фиолетовым; рядом логотип-лама */
.logo { display: flex; align-items: center; gap: 8px; }
.logo-img { width: 40px; height: 40px; flex: none; object-fit: contain; filter: drop-shadow(0 2px 4px #6d4aff33); }
.logo-text { font-family: 'Coiny', system-ui, sans-serif; font-weight: 400; font-size: 24px; line-height: 1; letter-spacing: 0; white-space: nowrap; padding-top: 3px; }
.logo-llama { color: #3b1f8c; }
.logo-lang { color: var(--primary); }

/* Flashcards: карточка выше; автор и лицензия картинки — в кнопке «i» */
.fc-card { height: 340px; }
.fc-img { max-height: 190px; }
@media (max-width: 600px) { .fc-card { height: 280px; } .fc-img { max-height: 150px; } }
.fc-info-box { position: absolute; right: 12px; bottom: 12px; z-index: 3; }
.fc-info-wrap { position: relative; display: inline-block; }
.fc-info { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font: italic 700 14px/1 Georgia, 'Times New Roman', serif; cursor: pointer; box-shadow: var(--shadow); }
.fc-info:hover, .fc-info[aria-expanded="true"] { color: var(--primary); border-color: var(--primary); }
.fc-info-tip { position: absolute; right: 0; bottom: calc(100% + 6px); width: max-content; max-width: min(320px, 70vw); padding: 8px 10px; border-radius: var(--r-md);
  background: var(--ink); color: #fff; font-size: 12px; line-height: 1.35; text-align: left; box-shadow: 0 8px 24px #0003; }
.fc-info-tip b { color: #fff; }

/* Виджет «Рейтинг класса» — компактный, в две колонки */
.rating-widget { gap: 6px; padding: var(--s3) var(--s4); }
.rw-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s3); align-items: center; }
.rw-list { gap: 2px; }
.rw-row { padding: 3px 8px; font-size: 14px; }
.rw-row.self { margin-top: 2px; }
.rw-me { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 120px; padding: var(--s2) var(--s3);
  border-radius: var(--r-md); background: #fff8e1; text-align: center; }
.rw-me b { font-size: 30px; font-weight: 900; line-height: 1.05; }
.rw-me .rw-coin { font-size: 22px; }
.rw-me .rw-place { margin-top: 4px; }
.rw-hidden { margin: 0; }
@media (max-width: 420px) { .rw-body { grid-template-columns: 1fr; } .rw-me { flex-direction: row; gap: 6px; min-width: 0; } }

/* Виджет серии: без градиента; монеты — второй колонкой на ПК */
.streak-widget, .streak-widget.saved { background: var(--surface); }
.dash-widgets.single { grid-template-columns: 1fr; }
.sw-coins { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 150px;
  padding: var(--s2) var(--s4); margin-left: auto; border-left: 1px solid var(--line); text-align: center; }
.sw-coins b { font-size: 32px; font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; }
.sw-coin { font-size: 24px; }
@media (max-width: 640px) {
  .streak-widget { flex-wrap: wrap; }
  .sw-coins { flex-direction: row; gap: 6px; width: 100%; min-width: 0; margin: 0; padding: var(--s2) 0 0; border-left: 0; border-top: 1px solid var(--line); justify-content: flex-start; }
  .sw-coins b { font-size: 22px; }
}

/* Vocab revision: уроки с неизученными словами */
.srs-todo-box { max-width: var(--learn-width); margin: var(--s3) auto 0; }
.srs-todo { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3) var(--s4); border: 1px dashed #c9bdfc; background: var(--primary-soft); }
.srs-todo-text { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-weight: 600; color: var(--ink); }
.srs-todo-text .icon { flex: none; margin-top: 2px; color: var(--primary); }
.srs-todo-list { display: flex; flex-wrap: wrap; gap: 6px; }
.srs-todo-btn { background: var(--surface); max-width: 100%; }
.srs-todo-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.srs-todo-n { margin-left: 6px; padding: 0 8px; border-radius: var(--r-pill); background: var(--primary-soft-2); font-size: 12px; font-weight: 800; }

/* Flashcards → «Заучивание»: неверный ввод — красный текст и кружок с крестиком, поле без красной заливки */
.fc-type-field .fc-type-input.no { background: var(--surface); border-color: var(--line); color: var(--bad); }
.fc-type-field.wrong .fc-type-input { padding-left: 40px; }
.fc-wrong-mark { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--bad); color: #fff; pointer-events: none; }

/* Vocab revision: шкала менее насыщенная */
.seg-learning { background: #ffc078; }
.seg-review { background: #8ce99a; }
.seg-new { background: #dee2e6; }
.srs-leg i.seg-learning { background: #ffc078; } .srs-leg i.seg-review { background: #8ce99a; }

/* Мобильная версия: «Назад» и Flashcards / Homework / Test — в одной строке, название урока — второй строкой */
@media (max-width: 640px) {
  .page-head { flex-wrap: nowrap; align-items: flex-start; }
  .page-head .back-btn { flex: none; }
  .page-head .page-title { flex: 1 1 auto; min-width: 0; }
  .el-title { row-gap: 2px; }
  .el-title .el-title-sep { display: none; }
  .el-title .el-title-lesson { flex-basis: 100%; font-size: 16px; font-weight: 600; color: var(--muted); overflow-wrap: anywhere; }
  .page-head-actions { flex: none; }
}

/* Test, телефон: таймер над таблицей лидеров (без наложения) */
@media (max-width: 640px) {
  .runner .test-topbar > .test-timer { float: none; position: sticky; top: 60px; display: flex; width: fit-content; margin: 0 0 var(--s2) auto; }
  .runner .test-topbar > .test-board { clear: both; }
}

/* ===== Единое расстояние между карточками (--gap) ===== */
:root { --gap: 16px; }
.lesson-list { gap: var(--gap); }
.test-page .card + .card { margin-top: var(--gap); }
.dash-widgets { gap: var(--gap); margin-bottom: var(--gap); }
/* Vocabulary: виджет, карточка заданий, неизученные слова, шкала, все слова — одинаковые промежутки */
.interval-page { display: flex; flex-direction: column; gap: var(--gap); }
.interval-page > .page-head { margin-bottom: 0; }
.interval-page > * { margin-top: 0 !important; margin-bottom: 0 !important; }
.interval-page .srs-session { margin: 0; }
.interval-page .srs-session .fc-qstage { padding: 0; margin: 0; overflow: visible; }
.interval-page .srs-dash { margin: 0 auto; width: 100%; gap: var(--gap); }
.interval-page .srs-todo-box:empty { display: none; }
.interval-page .srs-streak-box { margin: 0 auto; width: 100%; }
.interval-page .srs-todo-box { margin: 0 auto; width: 100%; }

/* Flashcards: переворот по вертикали; на обороте картинка слева (треть), слово справа */
.fc-card.flipped .fc-inner { transform: rotateX(180deg); }
.fc-back { transform: rotateX(180deg); }
.fc-back:has(.fc-img) { flex-direction: row; align-items: center; justify-content: flex-start; gap: var(--s4); text-align: left; }
.fc-back:has(.fc-img) .fc-img { flex: 0 0 33%; width: 33%; max-width: 33%; max-height: 85%; object-fit: contain; }
.fc-back:has(.fc-img) .fc-text { flex: 1; text-align: center; }

/* ===== Виджет серии v2: «🔥 4 days streak» · «🪙 coins», ниже кнопка «12 words to repeat today» ===== */
.streak-widget.v2 { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--line); }
.streak-widget.v2.todo { border-color: #ffd8a8; }
.streak-widget.v2.saved { border-color: #a5d8ff; }
.streak-widget.v2 .sw-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.sw-streak { display: inline-flex; align-items: center; gap: 6px; font-size: 18px; font-weight: 700; color: #d9480f; }
.sw-streak b { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.streak-widget.v2 .sw-flame { width: auto; height: auto; font-size: 24px; background: none; }
.sw-coins2 { display: inline-flex; align-items: center; gap: 6px; font-size: 18px; }
.sw-coins2 b { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.sw-go { width: 100%; min-height: 40px; padding: 8px 14px; border: 0; border-radius: var(--r-md); background: var(--primary); color: #fff; font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; text-align: center; }
.sw-go:hover:not(:disabled) { filter: brightness(1.08); }
.sw-go:disabled { opacity: .6; cursor: default; }
.sw-go.done { margin: 0; background: var(--canvas); color: var(--muted); cursor: default; }
.sw-saved { margin: 0; font-size: 13px; font-weight: 600; color: #1864ab; }
.dash-widgets.single .streak-widget.v2 { max-width: none; }

/* Vocabulary: неизученные слова — бледно-оранжевая плашка */
.srs-todo { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px var(--s2); padding: 10px var(--s3); border: 1px solid #ffd8a8; background: #fff4e6; }
.srs-todo-text { margin: 0; font-weight: 700; color: #d9480f; align-items: center; }
.srs-todo-text .icon { color: #f08c00; margin-top: 0; }
.srs-todo-list { display: contents; }
.srs-todo-btn { background: var(--surface); border-color: #ffd8a8; }

/* Шкала: подписи по центру */
.srs-legend { justify-content: center; }
.interval-page .card { margin-top: 0; margin-bottom: 0; }

/* Страница входа: приветствие на белом фоне */
/* Страница входа: светло-фиолетовый фон с кругами разных размеров и оттенков */
body.auth-page { background: #f1ecff; }
body.auth-page::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(circle at 8% 22%, #d9ccff 0 70px, transparent 71px),
    radial-gradient(circle at 92% 14%, #c7b3ff 0 110px, transparent 111px),
    radial-gradient(circle at 84% 78%, #e3d9ff 0 150px, transparent 151px),
    radial-gradient(circle at 14% 82%, #b9a2fb 0 46px, transparent 47px),
    radial-gradient(circle at 26% 52%, #e9e1ff 0 26px, transparent 27px),
    radial-gradient(circle at 70% 40%, #d3c4ff 0 18px, transparent 19px),
    radial-gradient(circle at 60% 92%, #cbb8ff 0 34px, transparent 35px),
    radial-gradient(circle at 40% 10%, #e0d5ff 0 22px, transparent 23px),
    radial-gradient(circle at 96% 50%, #ab8ef8 0 14px, transparent 15px),
    radial-gradient(circle at 4% 56%, #c4b0ff 0 12px, transparent 13px),
    radial-gradient(circle at 33% 95%, #dccfff 0 60px, transparent 61px);
}
body.auth-page main { position: relative; }
@media (max-width: 600px) {
  body.auth-page::before { background-size: 160% 100%; background-position: center; }
}
.welcome { display: flex; flex-direction: column; align-items: center; gap: var(--s2); margin: var(--s3) 0 var(--s4); text-align: center; }
.welcome-img { width: 200px; height: 200px; object-fit: contain; }
.welcome-title { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 0; line-height: 1.1; font-weight: 400; }
.welcome-to { font-family: 'Momo Signature', 'Pacifico', cursive; font-size: 34px; color: #e0ac1a; }
.welcome-name { font-family: 'Coiny', system-ui, sans-serif; font-size: 46px; letter-spacing: 0; }
body.auth-page .auth-card { box-shadow: 0 8px 30px #2e38561a; }
@media (max-width: 480px) { .welcome-img { width: 150px; height: 150px; } .welcome-to { font-size: 28px; } .welcome-name { font-size: 38px; } }

/* Виджет серии: крупнее дни и монеты (вместе с эмодзи); строка «N words to repeat today» — со значком */
.sw-streak { font-size: 22px; gap: 8px; }
.sw-streak b { font-size: 34px; line-height: 1; }
.streak-widget.v2 .sw-flame { font-size: 34px; }
.sw-coins2 { font-size: 22px; gap: 8px; }
.sw-coins2 > span[aria-hidden] { font-size: 30px; line-height: 1; }
.sw-coins2 b { font-size: 34px; line-height: 1; }
.sw-todo { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; font-weight: 500; color: var(--ink); }
.sw-todo .icon { flex: none; color: var(--primary); }
.sw-todo.done { color: var(--muted); }
.sw-todo.done .icon { color: var(--ok); }
@media (max-width: 480px) { .sw-streak b, .sw-coins2 b { font-size: 28px; } .streak-widget.v2 .sw-flame, .sw-coins2 > span[aria-hidden] { font-size: 28px; } }

/* ===== Виджет серии: верх — две равные половины (без видимой границы), всё по центру ===== */
.streak-widget.v2 { font-family: 'Nunito', 'Inter', system-ui, sans-serif; border: 2px solid #ffa94d; gap: 0; padding: var(--s3) var(--s4); }
.streak-widget.v2.todo, .streak-widget.v2.done, .streak-widget.v2.saved { border-color: #ffa94d; }
.streak-widget.v2 .sw-top { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 0; }
.streak-widget.v2 .sw-streak, .streak-widget.v2 .sw-coins2 { justify-content: center; text-align: center; font-size: 19px; font-weight: 800; gap: 7px; }
.streak-widget.v2 .sw-streak b, .streak-widget.v2 .sw-coins2 b { font-size: 29px; font-weight: 900; line-height: 1; }
.streak-widget.v2 .sw-flame, .streak-widget.v2 .sw-coin-emoji { font-size: 28px; line-height: 1; }
.streak-widget.v2 .sw-coins2 { color: #92400e; }
.streak-widget.v2 .sw-coins2 b { color: #92400e; }
.streak-widget.v2 .sw-todo { flex-direction: column; justify-content: center; align-items: center; gap: 2px; margin: var(--s4) 0 var(--s2); text-align: center; font-size: 16px; font-weight: 700; }
.sw-todo-line { display: inline-flex; align-items: center; gap: 8px; }
.sw-todo-cta { font-weight: 800; color: var(--primary); }
.streak-widget.v2 .sw-saved { text-align: center; }
@media (max-width: 480px) {
  .streak-widget.v2 .sw-streak, .streak-widget.v2 .sw-coins2 { font-size: 16px; gap: 5px; }
  .streak-widget.v2 .sw-streak b, .streak-widget.v2 .sw-coins2 b { font-size: 24px; }
  .streak-widget.v2 .sw-flame, .streak-widget.v2 .sw-coin-emoji { font-size: 22px; }
}

/* Виджет серии: крупнее дни и монеты; цвет серии и обводки — как у огонька 🔥; при 0 дней — серый */
.streak-widget.v2 { border: 1.5px solid #f76707; }
.streak-widget.v2.todo, .streak-widget.v2.done, .streak-widget.v2.saved { border-color: #f76707; }
.streak-widget.v2 .sw-streak, .streak-widget.v2 .sw-coins2 { font-size: 22px; gap: 8px; }
.streak-widget.v2 .sw-streak b, .streak-widget.v2 .sw-coins2 b { font-size: 36px; }
.streak-widget.v2 .sw-flame, .streak-widget.v2 .sw-coin-emoji { font-size: 36px; }
.streak-widget.v2 .sw-streak, .streak-widget.v2 .sw-streak b { color: #f76707; }
.streak-widget.v2 .sw-streak.zero, .streak-widget.v2 .sw-streak.zero b { color: #868e96; }
.streak-widget.v2 .sw-todo { margin: var(--s3) 0 var(--s1); }
@media (max-width: 480px) {
  .streak-widget.v2 .sw-streak, .streak-widget.v2 .sw-coins2 { font-size: 17px; gap: 6px; }
  .streak-widget.v2 .sw-streak b, .streak-widget.v2 .sw-coins2 b { font-size: 28px; }
  .streak-widget.v2 .sw-flame, .streak-widget.v2 .sw-coin-emoji { font-size: 28px; }
}
