/* ============ Дизайн-система «Зефир» — учебный портал ============
   Белая основа + пастельные акценты, всё мягкое и скруглённое.
   Имена классов сохранены 1:1 с прежней версией — JS не меняется.
   Сайдбар свёрнут до иконок и раскрывается при наведении.
   Шрифты локальные (/learning/fonts/*.woff2); без них работает системный стек. */

@font-face { font-family:'Unbounded'; font-weight:700; font-display:swap; src:url('/learning/fonts/unbounded-700.woff2') format('woff2'); }
@font-face { font-family:'Unbounded'; font-weight:800; font-display:swap; src:url('/learning/fonts/unbounded-800.woff2') format('woff2'); }
@font-face { font-family:'Onest'; font-weight:400; font-display:swap; src:url('/learning/fonts/onest-400.woff2') format('woff2'); }
@font-face { font-family:'Onest'; font-weight:600; font-display:swap; src:url('/learning/fonts/onest-600.woff2') format('woff2'); }
@font-face { font-family:'Onest'; font-weight:700; font-display:swap; src:url('/learning/fonts/onest-700.woff2') format('woff2'); }
@font-face { font-family:'Onest'; font-weight:800; font-display:swap; src:url('/learning/fonts/onest-800.woff2') format('woff2'); }

:root {
  --bg: #FFFFFF;
  --bg-soft: #FAF8FD;
  --panel: #ffffff;
  --ink: #403A5C;
  --ink-2: #736C93;
  --ink-3: #ABA5C4;
  --line: #EFEBF6;
  --line-2: #E7E1F1;

  /* пастельный градиент — главный акцент (персик → зефир → лаванда) */
  --g1: #F2A97E;
  --g2: #E98AB4;
  --g3: #9F86DC;
  --grad: linear-gradient(120deg, var(--g1), var(--g2) 55%, var(--g3));
  --grad-soft: linear-gradient(120deg, #FFF3EA 0%, #FCE9F2 45%, #F0EBFC 100%);
  /* углублённый вариант градиента — фон под белым текстом (кнопки, бейджи):
     чистая пастель #F2A97E…#9F86DC даёт контраст ~2:1, белый текст тонет */
  --grad-strong: linear-gradient(120deg, #DE8148, #D9679C 55%, #8A6BD2);
  /* тёмный дуэт того же градиента — для текста, которому нужен контраст */
  --grad-text: linear-gradient(90deg, #A94F86, #7C63CE);

  --brand: #E98AB4;
  --brand-dark: #A9578F;
  --brand-soft: #FCEFF6;
  --lav: #9F86DC;
  --lav-dark: #6C55C8;
  --lav-soft: #F1EDFC;
  /* те же два цвета «числами» — для полупрозрачных свечений: rgba(var(--brand-rgb),.4).
     Цветовая гамма урока (public/js/lessonbg.js) переопределяет всю группу выше на
     контейнере урока, и свечения перекрашиваются вместе с ней, а не остаются розовыми. */
  --brand-rgb: 233,138,180;
  --lav-rgb: 159,134,220;
  --accent: #F0B562;
  --ok: #4CAF87;
  --ok-soft: #E9F7F1;
  --err: #E07070;
  --err-soft: #FDEFEF;
  --warn-soft: #FFF4E3;

  --side-bg: #FFFFFF;
  --side-ink: #736C93;
  --side-w: 76px;
  --side-w-open: 252px;
  --dark: #403A5C;

  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(64,58,92,.05), 0 12px 32px -20px rgba(64,58,92,.16);
  --shadow-lg: 0 24px 60px -20px rgba(64,58,92,.25);
  --shadow-pink: 0 14px 32px -18px rgba(var(--brand-rgb),.45);
  --font: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-display: 'Unbounded', 'Onest', -apple-system, sans-serif;

  /* Единственная ручка размера текста УРОКА. Все размеры внутри .lesson-blocks
     считаются как calc(var(--lesson-fs) * k), где k — прежний размер / 16px.
     Здесь, вне урока, переменная равна 16px — значит интерфейс (формы, кнопки,
     карточки) остаётся ровно таким, каким был. Крупнее делаем только урок:
     ниже .lesson-blocks переопределяет --lesson-fs. */
  --lesson-fs: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
#app { height: 100%; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.3; font-family: var(--font-display); font-weight: 700; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
p { margin: .4em 0; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { color: var(--lav-dark); text-decoration: underline; }
img, video { max-width: 100%; }
audio { width: 100%; }

@keyframes shine { 0% { transform: translateX(-120%) skewX(-20deg); } 100% { transform: translateX(340%) skewX(-20deg); } }
@keyframes pulseDot { 0%,100% { box-shadow: 0 0 0 0 rgba(var(--brand-rgb),.55); } 50% { box-shadow: 0 0 0 9px rgba(var(--brand-rgb),0); } }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.boot-splash {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; color: var(--ink-3); font-size: 15px;
}

/* мягкая пастельная плашка-маркер (бывшее «лезвие», теперь без скоса) */
.blade {
  display: inline-block; width: 22px; height: 10px; border-radius: 99px;
  background: var(--grad); flex: 0 0 22px;
}
.blade.muted { background: var(--line-2); }

/* ============ Каркас: сворачиваемый сайдбар + контент ============ */

.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 100;
  width: var(--side-w); overflow: hidden;
  background: var(--side-bg); color: var(--side-ink);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transition: width .28s cubic-bezier(.4,0,.2,1), box-shadow .28s ease;
}
.sidebar:hover, .sidebar:focus-within {
  width: var(--side-w-open);
  box-shadow: 0 28px 70px -28px rgba(64,58,92,.35);
}
/* подписи и «объёмные» блоки проявляются при раскрытии */
.sidebar .label {
  opacity: 0; transform: translateX(-8px); min-width: 0;
  transition: opacity .18s ease .06s, transform .22s ease .06s;
}
.sidebar:hover .label, .sidebar:focus-within .label { opacity: 1; transform: none; }

/* Игровой бейдж вместо «Портала»: аватар + имя + уровень (или белое сердечко) */
.player-card {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 12px 12px; padding: 9px 10px;
  border-radius: 16px; text-decoration: none; color: var(--ink);
  background: linear-gradient(135deg, #FFF3EA, #FCE9F2 55%, #F0EBFC);
  border: 1.5px solid var(--line-2);
  box-shadow: 0 1px 2px rgba(64,58,92,.05);
  white-space: nowrap; overflow: hidden; flex: 0 0 auto;
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.player-card:hover {
  text-decoration: none; border-color: var(--brand);
  box-shadow: var(--shadow-pink); transform: translateY(-1px);
}
.player-av { position: relative; flex: 0 0 40px; width: 40px; height: 40px; }
.player-av .avatar { box-shadow: 0 0 0 2px #fff, 0 3px 8px -2px rgba(64,58,92,.35); }
.player-lvl {
  position: absolute; right: -5px; bottom: -5px;
  min-width: 20px; height: 20px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 10.5px; line-height: 1;
  color: #fff; background: var(--grad-strong);
  border: 2px solid #fff; border-radius: 99px;
  box-shadow: 0 2px 6px -1px rgba(64,58,92,.4);
}
.player-lvl.heart { font-size: 12px; padding: 0 3px; }
.player-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.player-name {
  font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis;
}
.player-rank {
  font-size: 11px; font-weight: 700; letter-spacing: .01em;
  background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent;
  overflow: hidden; text-overflow: ellipsis;
}

/* единый стиль иконок: тонкая линия, приглушённый оттенок */
.ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; flex: 0 0 22px; color: inherit;
}
.ico svg { width: 100%; height: 100%; stroke-width: 1.8; }

.sidebar-nav { flex: 1; padding: 6px 14px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: var(--radius-sm);
  color: var(--side-ink); font-size: 14.5px; font-weight: 600; cursor: pointer;
  border: 0; background: none; text-align: left; width: 100%;
  font-family: var(--font); white-space: nowrap;
  transition: background .18s ease, color .18s ease;
}
.sidebar-item .ico { color: var(--ink-3); transition: color .18s ease; }
.sidebar-item:hover { background: var(--bg-soft); text-decoration: none; color: var(--ink); }
.sidebar-item:hover .ico { color: var(--ink-2); }
.sidebar-item.active { background: var(--lav-soft); color: var(--lav-dark); font-weight: 700; }
.sidebar-item.active .ico { color: var(--lav-dark); }

/* счётчик ДЗ: в свёрнутом виде — точка в углу иконки, в раскрытом — плашка справа */
.nav-badge {
  position: absolute; top: 5px; right: 7px;
  font-family: var(--font-display); font-size: 10px; font-weight: 700; line-height: 1;
  color: #fff; background: linear-gradient(120deg, #D9679C, #8A6BD2);
  padding: 4px 7px; border-radius: 99px;
}
.sidebar:hover .nav-badge, .sidebar:focus-within .nav-badge { position: static; margin-left: auto; }

.sidebar-foot { padding: 12px 14px 14px; border-top: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
.sidebar-user { display: flex; align-items: center; gap: 11px; margin-bottom: 8px; padding-left: 5px; color: var(--ink); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 38px;
  background: var(--grad-strong); color: #fff; font-family: var(--font-display);
  font-weight: 700; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}
.avatar.photo { background: none; overflow: hidden; }
.avatar.photo img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.main { flex: 1; min-width: 0; margin-left: var(--side-w); padding: 30px 40px 80px; }
.main-inner { max-width: 1080px; margin: 0 auto; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ============ Компоненты ============ */

.card {
  background: var(--panel); border: 1.5px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 22px; margin-bottom: 16px;
}
.card.tight { padding: 13px 16px; }
.card-title { font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px; border-radius: 99px;
  font-size: 14px; font-weight: 700; font-family: var(--font);
  border: 1.5px solid var(--line-2); background: var(--panel); color: var(--ink);
  cursor: pointer; transition: all .18s ease;
  white-space: nowrap; user-select: none;
}
.btn:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.btn:disabled { opacity: .5; cursor: default; pointer-events: none; }
.btn-primary {
  position: relative; overflow: hidden;
  background: var(--grad-strong); border-color: transparent; color: #fff;
  box-shadow: var(--shadow-pink);
}
.btn-primary:hover { background: var(--grad-strong); color: #fff; filter: brightness(1.05) saturate(1.05); }
.btn-primary::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 36%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
  animation: shine 3.2s ease-in-out infinite;
}
.btn-ghost { border-color: transparent; background: transparent; color: var(--brand-dark); }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-danger { color: var(--err); }
.btn-danger:hover { background: var(--err-soft); border-color: var(--err); color: var(--err); }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-sm { padding: 5px 13px; font-size: 13px; }
.btn-icon { padding: 6px 11px; }

.field { margin-bottom: 15px; }
.field > label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-2); margin-bottom: 6px;
}
/* Поля ввода: вне урока это прежние 14.5px (--lesson-fs = 16px), а внутри
   .lesson-blocks — поле для ответа ученика, оно растёт вместе с текстом урока. */
.input, textarea.input, select.input {
  width: 100%; padding: 11px 15px; font-size: calc(var(--lesson-fs) * .90625); font-family: var(--font);
  border: 1.5px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--bg-soft); color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: var(--ink-3); }
.input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(var(--brand-rgb),.16); }
textarea.input { resize: vertical; min-height: 84px; }
.input-row { display: flex; gap: 10px; align-items: center; }
.hint { font-size: calc(var(--lesson-fs) * .78125); color: var(--ink-2); margin-top: 5px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-display); font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 5px 11px; border-radius: 99px;
  background: var(--brand-soft); color: var(--brand-dark);
}
.badge.ok { background: var(--ok-soft); color: #2E8A65; }
.badge.err { background: var(--err-soft); color: #C05B5B; }
.badge.warn { background: var(--warn-soft); color: #B07A2A; }
.badge.muted { background: #F3F0F9; color: var(--ink-2); }
.badge.comment { background: #FFF0DA; color: #B0761F; }

/* карточка проверенного ДЗ с непрочитанным комментарием учителя — тёплый ободок */
.card.has-new-comment {
  border-color: #F0B562;
  box-shadow: 0 0 0 1px #F0B562, 0 14px 32px -20px rgba(240,181,98,.5);
}

.tag {
  display: inline-flex; font-family: var(--font-display); font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; padding: 6px 13px; border-radius: 99px;
  background: #F3F0F9; color: var(--ink-2); cursor: pointer; border: 1.5px solid transparent;
  transition: all .18s ease;
}
.tag:hover { border-color: var(--brand); color: var(--brand-dark); }
.tag.active { background: var(--grad-strong); color: #fff; border-color: transparent; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-family: var(--font-display); font-size: 10px; text-transform: uppercase;
  letter-spacing: .12em; color: var(--ink-2); font-weight: 700;
  padding: 9px 10px; border-bottom: 1.5px solid var(--line);
}
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--bg-soft); }

/* Журнал занятий: прокрутка внутри секции (ползунок), чтобы страница ученика не
   растягивалась, когда занятий накопилось много. По горизонтали — тоже (узкий экран). */
.journal-scroll { max-height: 360px; overflow: auto; overscroll-behavior: contain; }
.journal-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.journal-scroll::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 2px solid var(--panel); }
.journal-scroll::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* ---------- план обучения ученика (кабинет ученика, только учитель) ---------- */
.plan-bar { height: 10px; border-radius: 99px; background: #F3EAE3; overflow: hidden; }
.plan-bar-fill {
  height: 100%; border-radius: 99px; min-width: 0; transition: width .3s ease;
  background: linear-gradient(90deg,#F2A97E,#E98AB4,#9F86DC);
}
.plan-bar-label { font-size: 12px; color: var(--ink-2); margin-top: 5px; }
.plan-list { display: flex; flex-direction: column; }
.plan-topic { padding: 11px 0; border-bottom: 1px solid var(--line); }
.plan-topic:last-child { border-bottom: 0; }
.plan-topic-head { display: flex; align-items: center; gap: 11px; }
.plan-check {
  flex: 0 0 22px; width: 22px; height: 22px; border-radius: 7px; cursor: pointer;
  border: 1.5px solid var(--line-2); background: #fff; color: #fff;
  font-size: 13px; font-weight: 800; line-height: 1; display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, border-color .15s ease;
}
.plan-check:hover { border-color: var(--brand); }
.plan-check.on { background: var(--ok); border-color: var(--ok); }
.plan-topic-text { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.plan-topic-text.done { text-decoration: line-through; color: var(--ink-3); font-weight: 500; }
.plan-topic-tools { display: flex; gap: 2px; opacity: 0; transition: opacity .15s ease; }
.plan-topic:hover .plan-topic-tools, .plan-topic-tools:focus-within { opacity: 1; }
.plan-topic-tools .btn { padding: 4px 7px; }
.plan-elements { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0 2px 33px; }
.plan-el {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
  padding: 4px 6px 4px 11px; border-radius: 99px; font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--line-2); background: var(--bg-soft); color: var(--ink);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.plan-el:hover { border-color: var(--brand); }
.plan-el.done { text-decoration: line-through; color: #2E8A65; background: var(--ok-soft); border-color: transparent; }
.plan-el-text { line-height: 1.2; }
.plan-el-x {
  border: 0; background: transparent; cursor: pointer; color: var(--ink-3); font-size: 11px;
  line-height: 1; padding: 2px; border-radius: 50%;
}
.plan-el-x:hover { color: var(--err); }
.plan-archive-body { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.plan-archive-item { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-soft); }
.plan-archive-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-bottom: 8px; }
.plan-archive-topics { display: flex; flex-direction: column; gap: 4px; }
.plan-archive-topic { font-size: 13.5px; line-height: 1.4; }

.tabs { display: flex; gap: 8px; border-bottom: 0; margin-bottom: 20px; flex-wrap: wrap; }
.tabs .tab {
  padding: 9px 17px; font-family: var(--font-display); font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2);
  border: 1.5px solid var(--line-2); background: #fff; cursor: pointer;
  border-radius: 99px; margin-bottom: 0;
}
.tabs .tab:hover { border-color: var(--brand); color: var(--brand-dark); }
.tabs .tab.active { color: #fff; background: var(--grad-strong); border-color: transparent; }

.empty { text-align: center; color: var(--ink-2); padding: 38px 16px; font-size: 14px; }
.empty .big { font-size: 34px; margin-bottom: 8px; }

/* Модалка */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(64,58,92,.35); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal {
  background: #fff; border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 540px; max-height: 90vh; overflow: auto; padding: 26px 28px;
}
.modal.wide { max-width: 780px; }
.modal h3 { margin-bottom: 16px; }
.modal-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* Тосты — белые, с пастельной цветовой меткой */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #fff; color: var(--ink); padding: 12px 19px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); font-size: 14px; max-width: 380px;
  border: 1px solid var(--line); border-left: 4px solid var(--g2);
  animation: toast-in .18s ease-out;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
/* Предупреждение: не ошибка, но учитель обязан заметить (напр. «ушёл весь урок»). */
.toast.warn { border-left-color: var(--accent); background: var(--warn-soft); }

/* ============ Логин ============ */

.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #FFF0E4 0%, #FBE3EF 48%, #EAE3FB 100%);
  padding: 20px; position: relative; overflow: hidden;
}
.auth-wrap::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle 300px at 12% 18%, rgba(255,255,255,.55), transparent 70%),
    radial-gradient(circle 360px at 88% 82%, rgba(255,255,255,.45), transparent 70%);
}
.auth-card {
  position: relative;
  background: #fff; border-radius: 28px;
  box-shadow: 0 30px 80px -24px rgba(124,99,206,.35);
  width: 100%; max-width: 440px; padding: 38px 38px 32px;
}
.auth-logo { text-align: center; font-size: 40px; margin-bottom: 6px; }
.auth-card h1 { text-align: center; font-size: 19px; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--ink-2); font-size: 14px; margin-bottom: 24px; }

/* ============ Блоки урока (плеер и конструктор) ============ */

/* Крупный шрифт урока: одна переменная тянет за собой весь текст внутри —
   и то, что размер задаёт явно (ниже через calc), и то, что просто наследует
   (словарь, подписи). Интерфейса вокруг это не касается. */
.lesson-blocks {
  display: flex; flex-direction: column; gap: 16px;
  --lesson-fs: 20px; font-size: var(--lesson-fs);
}
.block-text { font-size: var(--lesson-fs); line-height: 1.65; }
.block-text ul { margin: .3em 0; padding-left: 22px; }
.block-heading-1 { font-family: var(--font-display); font-size: calc(var(--lesson-fs) * 1.3125); font-weight: 700; margin: 10px 0 0; }
.block-heading-2 {
  font-family: var(--font-display); font-size: calc(var(--lesson-fs) * .9375); font-weight: 700; margin: 6px 0 0;
  background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.block-image { text-align: center; }
.block-image img { border-radius: var(--radius-sm); max-height: 480px; }
.block-image .caption { font-size: calc(var(--lesson-fs) * .8125); color: var(--ink-2); margin-top: 5px; }

/* Аудиоблок — мягкая карточка «Зефир»: нативный плеер сидит в пастельной обёрке
   (а не голым серым прямоугольником), и подсветка текущего блока/пульс аккуратно
   её обнимают — скругление совпадает (var(--radius)). */
.block-audio {
  background: var(--grad-soft); border: 1.5px solid var(--line-2);
  border-radius: var(--radius); padding: 13px 15px;
}
.block-audio audio { display: block; border-radius: 99px; }
/* в онлайн-классе учителю сверху нужна полоса под кнопку «показать», чтобы она не
   наезжала на громкость/меню плеера (нативные контролы жмутся к правому краю) */
/* (кнопка «показать» больше не накладывается на аудио — шапка блока обычной строкой) */

/* Постраничный просмотр PDF в уроке (pdfview.js): страница целиком + листание */
.pdf-view {
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--bg-soft);
}
.pdf-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line);
}
.pdf-name { font-weight: 600; font-size: 14px; }
.pdf-counter {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px;
  min-width: 62px; text-align: center; color: var(--ink-2);
}
.pdf-stage {
  display: flex; justify-content: center; padding: 14px;
  max-height: min(78vh, 820px); overflow: auto;
}
.pdf-canvas {
  max-width: 100%; height: auto; border-radius: 6px;
  box-shadow: var(--shadow); background: #fff;
}

/* живой общий рисунок на картинке (онлайн-класс) */
.anno-canvas { position: absolute; z-index: 2; touch-action: none; pointer-events: none; }
.anno-tools {
  position: absolute; z-index: 4; display: flex; gap: 5px; align-items: center;
  padding: 4px; background: rgba(255,255,255,.92); backdrop-filter: blur(5px);
  border-radius: 99px; box-shadow: var(--shadow);
}
.anno-tools .anno-extra { display: none; gap: 5px; align-items: center; }
.anno-tools.open .anno-extra { display: flex; }
.anno-btn {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-2);
  background: #fff; cursor: pointer; font-size: 13px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; transition: all .15s ease;
}
.anno-btn:hover { border-color: var(--brand); }
.anno-btn.on { background: var(--brand-soft); border-color: var(--brand); }
.anno-swatch { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-2); cursor: pointer; padding: 0; }
.anno-swatch.sel { outline: 2px solid var(--ink); outline-offset: 1px; }
/* ---------- единая шапка блока: название слева, действия «⋯» справа ----------
   Обычная строка НАД содержимым (просьба Танюшки: ничего не перекрывать). */
.block-head-row { display: flex; align-items: center; gap: 10px; min-height: 30px; }
.block-titled > .block-head-row { margin-bottom: 7px; }
.ex-box > .block-head-row { margin-bottom: 6px; padding-top: 4px; }
.block-title {
  font-family: var(--font-display); font-weight: 700; font-size: var(--lesson-fs);
  color: var(--ink); line-height: 1.3; min-width: 0; text-align: left;
}
.block-title.embed::before { content: '🎮 '; font-size: calc(var(--lesson-fs) * 1.125); }
.block-menu-btn {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  opacity: .55; transition: opacity .15s ease, border-color .15s ease, color .15s ease;
}
.block-menu-btn:hover, .block-menu-btn.open { opacity: 1; border-color: var(--brand); color: var(--ink); }
/* всплывающее меню действий блока */
.menu-pop {
  position: fixed; z-index: 700; min-width: 248px; padding: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
}
.menu-pop .menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: transparent; cursor: pointer; border-radius: 9px;
  padding: 9px 11px; font-family: var(--font); font-size: 13.5px; font-weight: 600; color: var(--ink);
}
.menu-pop .menu-item:hover { background: var(--brand-soft); }
.menu-pop .menu-item.danger { color: var(--err); }
.menu-pop .menu-item.danger:hover { background: var(--err-soft); }
.menu-pop .menu-item:disabled { opacity: .45; cursor: default; background: transparent; }
.menu-pop .menu-ico { flex: 0 0 20px; text-align: center; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 8px; }
/* форматирование текста: подсветка хайлайтером в блоке «Текст» */
.block-text mark { background: #FFF3B0; color: inherit; padding: 0 2px; border-radius: 3px; }
.block-text u { text-underline-offset: 2px; }
.block-divider { border: 0; height: 2px; background: repeating-linear-gradient(90deg, var(--line-2) 0 14px, transparent 14px 26px); margin: 8px 0; border-radius: 99px; }
/* этап урока — именованный заголовок-разделитель */
.block-stage {
  display: flex; align-items: center; gap: 12px; margin: 14px 0 2px; padding: 10px 16px;
  background: var(--grad-soft); border: 1px solid var(--line-2); border-radius: 99px;
}
.block-stage-dot { flex: 0 0 12px; width: 12px; height: 12px; border-radius: 50%; background: var(--grad-strong); }
.block-stage-name { font-family: var(--font-display); font-weight: 700; font-size: calc(var(--lesson-fs) * .9375); color: var(--ink); }

.ex-box {
  background: var(--panel); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow); position: relative;
}
.ex-box::before {
  content: ''; position: absolute; left: 22px; top: 0; width: 46px; height: 4px;
  background: var(--grad); border-radius: 0 0 4px 4px;
}
.ex-instruction {
  font-family: var(--font-display); font-size: calc(var(--lesson-fs) * .6875); font-weight: 700; color: var(--ink-2);
  margin-bottom: 12px; text-transform: uppercase; letter-spacing: .14em; padding-top: 4px;
}
.ex-question { font-weight: 700; margin-bottom: 13px; font-size: calc(var(--lesson-fs) * 1.03125); }
/* «Выбор варианта» с несколькими вопросами: разделяем вопросы */
.choice-q + .choice-q { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line-2); }
.choice-q-num { color: var(--brand-dark); font-weight: 800; }
/* панель форматирования над полем «Текст» в конструкторе */
.text-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.text-toolbar .btn { min-width: 30px; padding: 5px 9px; }
.ex-options { display: flex; flex-direction: column; gap: 9px; }
.ex-option {
  display: flex; align-items: flex-start; gap: 11px; padding: 12px 15px;
  border: 1.5px solid var(--line-2); border-radius: var(--radius-sm); cursor: pointer;
  transition: all .18s ease; font-size: calc(var(--lesson-fs) * .9375); background: #fff;
}
.ex-option:hover { border-color: var(--brand); transform: translateX(3px); }
.ex-option.selected {
  border-color: var(--brand); background: var(--brand-soft); font-weight: 700;
  box-shadow: 0 8px 22px -12px rgba(var(--brand-rgb),.55);
}
.ex-option.right { border-color: var(--ok); background: var(--ok-soft); }
.ex-option.wrong { border-color: var(--err); background: var(--err-soft); }
.ex-option input { margin-top: 3px; accent-color: var(--brand); }

.gap-input {
  /* Пустые пропуски одной длины (min-width — единый базовый размер), высота — в одну
     строку; заполненный пропуск растёт в ДЛИНУ под слово, а высота не меняется. */
  display: inline-block; width: auto; min-width: 88px; box-sizing: border-box;
  vertical-align: middle; white-space: nowrap;
  padding: 4px 12px; margin: 0 4px; font-size: calc(var(--lesson-fs) * .9375); font-weight: 600; font-family: var(--font);
  border: 1.5px solid var(--line-2); border-bottom: 2.5px solid var(--brand); background: var(--brand-soft);
  border-radius: 10px; outline: none; text-align: center; color: var(--ink);
}
/* Слоты-пропуски (span: «банк слов» и «перенести слово») — фиксируем высоту, чтобы
   пустой пропуск был такой же высоты, как заполненный (растёт только длина). */
span.gap-input {
  display: inline-flex; align-items: center; justify-content: center;
  /* высота пустого слота = высоте заполненного: строка (0.9375em * 1.2) + поля 8px
     + рамки 4px. Считаем от --lesson-fs, иначе при крупном шрифте пустой слот
     окажется ниже заполненного. */
  min-height: calc(var(--lesson-fs) * 1.125 + 12px); line-height: 1.2;
}
.gap-input:focus { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.15); }
.gap-input.right { border-color: var(--ok); background: var(--ok-soft); color: #2E8A65; font-weight: 700; }
.gap-input.wrong { border-color: var(--err); background: var(--err-soft); color: #C05B5B; font-weight: 700; }
/* свободный пропуск (учитель оценит вручную): пунктирная рамка — сигнал «пиши свободно» */
.gap-input.gap-free { border-style: dashed; }
.gap-input::placeholder { color: var(--ink-3); opacity: .7; font-weight: 400; }
.gap-slot-hint { color: var(--ink-3); font-style: italic; font-weight: 400; }
.gap-text { line-height: 2.4; font-size: var(--lesson-fs); }

.word-bank {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; padding: 12px;
  background: var(--bg-soft); border-radius: var(--radius-sm); border: 1.5px solid var(--line);
}
.word-chip {
  padding: 6px 16px; background: #fff; border: 1.5px solid var(--line-2); border-radius: 99px;
  font-size: calc(var(--lesson-fs) * .875); font-weight: 600; cursor: pointer; user-select: none; transition: all .18s ease;
}
.word-chip:hover { border-color: var(--brand); color: var(--brand-dark); transform: translateY(-1px); }
.word-chip.used { opacity: .35; }
.word-chip.selected { background: var(--grad-strong); color: #fff; border-color: transparent; }

/* teacherHint: у учителя в классе клик по слову подсвечивает зелёным верное место —
   пропуск, колонку или картинку (ученик этого не видит). !important — перебить
   инлайновую рамку колонок; box-shadow даёт «свечение» и лёгкий импульс. */
.hint-target {
  border-color: var(--ok) !important;
  border-style: solid !important;
  box-shadow: 0 0 0 2px var(--ok-soft), 0 0 16px -3px rgba(88,189,143,.7);
  animation: hint-pulse .55s ease;
}
@keyframes hint-pulse { from { box-shadow: 0 0 0 6px rgba(88,189,143,.45); } }

.match-grid { display: flex; flex-direction: column; gap: 10px; }
.match-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: center; }
.match-left {
  padding: 12px 15px; background: var(--bg-soft); border-radius: var(--radius-sm);
  font-size: calc(var(--lesson-fs) * .9375); font-weight: 600; border: 1.5px solid var(--line);
}
/* правая колонка «Соответствий»: карточки-варианты, их двигают и соединяют кликом */
.match-right {
  padding: 12px 15px; background: #fff; border-radius: var(--radius-sm);
  font-size: calc(var(--lesson-fs) * .9375); font-weight: 600; border: 1.5px solid var(--line-2);
  cursor: grab; user-select: none;
  display: flex; align-items: center; gap: 10px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.match-right:hover { border-color: var(--brand); }
.match-right.selected {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: 0 8px 22px -12px rgba(var(--brand-rgb),.55);
}
.match-right.dragging { opacity: .45; cursor: grabbing; }
.match-right.drag-over { border-color: var(--lav); background: var(--lav-soft); }
.match-right .grip { color: var(--ink-3); font-size: calc(var(--lesson-fs) * .875); flex: 0 0 auto; }
.match-left.pair-target { cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.match-left.pair-target:hover { border-color: var(--brand); background: var(--brand-soft); }

.ex-check-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.ex-result { font-family: var(--font-display); font-size: calc(var(--lesson-fs) * .8125); font-weight: 700; }
.ex-result.ok { color: var(--ok); }
.ex-result.partial { color: #B07A2A; }
.ex-result.err { color: var(--err); }

.ex-review-line { display: flex; gap: 9px; align-items: baseline; font-size: calc(var(--lesson-fs) * .875); margin: 4px 0; }
.ex-review-line .mark { flex: 0 0 18px; }

/* ============ Геймификация ============ */

.xp-card {
  margin: 0 14px 12px; padding: 14px 15px;
  background: #F7F4FD; border: 1px solid var(--line-2);
  border-radius: 16px;
  opacity: 0; transition: opacity .2s ease .05s;
}
.sidebar:hover .xp-card, .sidebar:focus-within .xp-card { opacity: 1; }
.xp-card .xp-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
  font-family: var(--font-display); font-size: 10px; font-weight: 700; letter-spacing: .14em;
  color: var(--ink-2); text-transform: uppercase;
}
.xp-card .xp-head { gap: 8px; }
.xp-card .xp-num {
  white-space: nowrap;
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.xp-bar { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; position: relative; }
.xp-bar > i {
  display: block; height: 100%; border-radius: 99px; background: var(--grad);
  position: relative; overflow: hidden; transition: width .4s ease;
}
.xp-bar > i::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: shine 2.6s ease-in-out infinite;
}
.xp-card .streak-line { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.xp-card .streak-line b { font-family: var(--font-display); font-size: 11px; color: #B0722F; }

.rank-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-display); font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; padding: 5px 11px; border-radius: 99px;
  background: var(--grad-strong); color: #fff;
}
.streak-gems { display: flex; gap: 4px; }
.streak-gems i {
  width: 14px; height: 14px; transform: rotate(45deg); border-radius: 4px;
  background: var(--line-2); display: inline-block;
}
.streak-gems i.on { background: linear-gradient(120deg, #F6C58F, var(--g2)); }

.xp-chip {
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent;
  white-space: nowrap;
}
.live-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--g2); animation: pulseDot 1.8s ease-out infinite; flex: 0 0 14px; }

/* hero-карта (главные страницы) — светлая пастель с мягкими бликами */
.hero-card {
  position: relative; overflow: hidden; color: var(--ink);
  border-radius: calc(var(--radius) + 6px);
  background: var(--grad-soft);
  border: 1.5px solid rgba(var(--lav-rgb),.16);
  padding: 28px 34px; margin-bottom: 24px;
}
.hero-card::before {
  content: ''; position: absolute; right: -70px; top: -80px; width: 230px; height: 230px;
  border-radius: 50%; background: rgba(255,255,255,.6); pointer-events: none;
}
.hero-card::after {
  content: ''; position: absolute; left: -50px; bottom: -90px; width: 190px; height: 190px;
  border-radius: 50%; background: rgba(255,255,255,.45); pointer-events: none;
}
.hero-card > * { position: relative; z-index: 1; }
.hero-card .kicker {
  font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: .16em;
  color: var(--brand-dark); text-transform: uppercase; margin-bottom: 10px;
}
.hero-card h1, .hero-card h2 { color: var(--ink); }

/* ============ Конструктор ============ */

.editor-block {
  position: relative; border: 1.5px solid var(--line); border-radius: var(--radius);
  background: #fff; padding: 16px 18px; transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow);
}
.editor-block:hover { border-color: var(--lav); }
.editor-block.dragging { opacity: .4; }
.editor-block-head {
  display: flex; align-items: center; gap: 9px; margin-bottom: 10px;
  font-family: var(--font-display); font-size: 10px; color: var(--ink-3); font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em;
}
.editor-block-tools { margin-left: auto; display: flex; gap: 3px; opacity: 0; transition: opacity .15s; }
.editor-block:hover .editor-block-tools, .editor-block:focus-within .editor-block-tools { opacity: 1; }
/* поле «Название» в шапке блока конструктора: обычный текст, не капс шапки */
.editor-title-input {
  flex: 1; min-width: 140px; width: auto; padding: 6px 11px; height: auto;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  text-transform: none; letter-spacing: 0;
}
/* «⋯» в конструкторе видна всегда (в отличие от стрелок, прячущихся до наведения) */
.editor-block-head .block-menu-btn { opacity: .5; }
.editor-block-head .block-menu-btn:hover, .editor-block-head .block-menu-btn.open { opacity: 1; }
.drag-handle { cursor: grab; color: var(--ink-3); padding: 0 4px; }
.add-block-menu { display: flex; flex-wrap: wrap; gap: 8px; }
.add-block-menu .btn { font-weight: 600; }
.save-indicator { font-size: 13px; color: var(--ink-2); }
.save-indicator.saved { color: var(--ok); }

/* конструктор: материалы урока + боковая панель этапов */
.editor-layout { display: flex; gap: 20px; align-items: flex-start; }
.editor-main { flex: 1; min-width: 0; }
.editor-stages {
  position: sticky; top: 16px; flex: 0 0 224px; width: 224px;
  display: flex; flex-direction: column; gap: 6px;
  max-height: calc(100vh - 40px); overflow-y: auto;
  padding: 14px 12px; background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.editor-stages-head {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); padding: 0 4px 6px;
}
.editor-stages-empty { font-size: 12px; color: var(--ink-3); line-height: 1.45; padding: 2px 4px 8px; }
.editor-stage-item { display: flex; align-items: center; gap: 4px; }
.editor-stage-go {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; text-align: left; cursor: pointer;
  padding: 8px 9px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  font-family: var(--font); font-size: 13px; font-weight: 600; line-height: 1.2;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.editor-stage-go:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.editor-stage-num {
  flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 11px; color: #fff; background: var(--grad-strong);
}
.editor-stage-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-stage-add { width: 100%; margin-top: 6px; border-style: dashed; justify-content: center; }
@media (max-width: 900px) {
  .editor-layout { flex-direction: column; }
  .editor-stages { position: static; width: auto; flex: none; max-height: none; order: -1; }
}

/* ============ Фон и цвета урока: диалог выбора (конструктор) ============ */

.bg-preview {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background-color: var(--bg-soft); padding: 16px 18px; margin-bottom: 18px; min-height: 128px;
}
/* в предпросмотре текст урока мельче настоящего: важно показать цвета, а не размер */
.bg-preview .lesson-blocks { gap: 10px; --lesson-fs: 15px; }
.bg-preview .block-stage { margin: 0; }
.bg-preview-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bg-preview-ex {
  align-self: flex-start; padding: 8px 16px; border-radius: 99px;
  background: #fff; border: 1.5px solid var(--line-2);
  font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: .06em;
}
.bg-sec-head {
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 10px;
}
.bg-tiles {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.bg-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 6px 6px 8px; cursor: pointer; color: var(--ink-2);
  border: 1.5px solid var(--line-2); border-radius: var(--radius-sm); background: #fff;
  font-family: var(--font); transition: border-color .15s ease, box-shadow .15s ease;
}
.bg-tile:hover { border-color: var(--lav); }
.bg-tile.active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(var(--brand-rgb),.25); color: var(--ink); }
.bg-tile-swatch {
  display: block; width: 100%; height: 46px; border-radius: 10px;
  border: 1px solid var(--line); background-color: #fff;
}
.bg-tile-swatch.empty {
  background-image: linear-gradient(135deg, transparent 46%, #E0D8EE 46%, #E0D8EE 54%, transparent 54%);
}
.bg-tile-label { font-size: 11px; font-weight: 700; }
/* плитка цветовой гаммы: светлая заливка + насыщенная полоска акцента поверх неё
   (два слоя одного background-image — та же пара, что урок покажет на плашке этапа) */
.bg-tile-swatch.pal {
  background-size: 56% 12px, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}
.bg-tile-note { font-size: 9.5px; line-height: 1.25; text-align: center; color: var(--ink-3); }
.bg-controls { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; margin-bottom: 14px; }
.bg-ctl { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.bg-range { width: 150px; accent-color: var(--brand); }

/* ============ Фон урока: отрисовка (public/js/lessonbg.js) ============
   Вуаль — вторым слоем background-image, а не ::before: у прокручиваемого
   контейнера (материал в классе) псевдоэлемент уехал бы вместе с содержимым.
   background-attachment по умолчанию (scroll) держит фон на месте при прокрутке. */

.lesson-bg {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--lbg-veil, transparent), var(--lbg-veil, transparent)),
    var(--lbg-image, none);
  background-size: auto, var(--lbg-size, cover);
  background-position: center, center;
  background-repeat: repeat, var(--lbg-repeat, no-repeat);
}
/* «белая подложка под текстом»: блоки урока на полупрозрачном листе — с фотографией
   под тёмным текстом одной вуали мало */
.lesson-bg.lbg-sheet .lesson-blocks {
  background: rgba(255,255,255,.82);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: 0 1px 2px rgba(64,58,92,.06);
}
/* фон на обычной странице: предпросмотр в конструкторе и домашнее задание */
.lesson-bg-stage.lesson-bg {
  padding: 18px; border-radius: var(--radius); border: 1px solid var(--line);
}
/* фон в конструкторе — под карточками блоков (учитель видит то же, что ученик) */
.editor-main > .lesson-bg {
  padding: 16px 16px 6px; border-radius: var(--radius); border: 1px solid var(--line);
}

/* ============ Онлайн-класс (светлая тема, тёмные только видео-плитки) ============ */

.classroom { display: flex; height: 100vh; background: #F4F1FA; overflow: hidden; }
.class-material {
  /* background-color, а не сокращённое background: иначе оно затирало бы
     background-image фона урока (.lesson-bg объявлен выше по файлу) */
  flex: 1; min-width: 0; overflow-y: auto; background-color: var(--bg);
  padding: 26px 30px 120px;
}
.class-material .lesson-blocks { max-width: 780px; margin: 0 auto; }

/* вкладки урок / домашнее задание (плашка сверху) */
.class-tabs {
  position: sticky; top: -26px; z-index: 6;
  display: flex; gap: 6px; justify-content: center; flex-wrap: wrap;
  max-width: 960px; margin: 0 auto 20px; padding: 6px;
  background: rgba(255,255,255,.86); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 99px; box-shadow: var(--shadow);
}
.class-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 20px; border: 0; border-radius: 99px; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 12.5px; letter-spacing: .03em;
  background: transparent; color: var(--ink-2); white-space: nowrap;
  transition: background .16s ease, color .16s ease;
}
.class-tab .class-tab-ico { font-size: 15px; }
.class-tab:hover { color: var(--brand-dark); background: var(--brand-soft); }
.class-tab.active { background: var(--grad-strong); color: #fff; box-shadow: var(--shadow-pink); }

/* тело: список этапов уехал в правую колонку — материал занимает освободившееся место */
.class-material-body { display: flex; gap: 22px; max-width: 900px; margin: 0 auto; align-items: flex-start; }
.class-material-body > .lesson-blocks { flex: 1; min-width: 0; max-width: none; margin: 0; }

.class-stages {
  position: sticky; top: 44px; flex: 0 0 196px; width: 196px;
  display: flex; flex-direction: column; gap: 5px;
  max-height: calc(100vh - 90px); overflow-y: auto;
  padding: 12px 10px; background: #FBF9FE;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
/* этапы в правой колонке (вместо чата): обычный поток, тянутся на всю высоту */
.class-side .class-stages.side {
  position: static; flex: 1 1 auto; width: auto; min-height: 0;
  max-height: none; overflow-y: auto; background: #fff; box-shadow: var(--shadow);
}
.class-stages-title {
  font-family: var(--font-display); font-size: 10px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); padding: 2px 8px 6px;
}
.class-stage-item {
  display: flex; align-items: center; gap: 9px; text-align: left; cursor: pointer;
  padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--ink);
  font-family: var(--font); font-size: 13px; font-weight: 600; line-height: 1.2;
  transition: background .15s ease;
}
.class-stage-item:hover { background: var(--brand-soft); color: var(--brand-dark); }
.class-stage-item.active { background: var(--lav-soft); color: var(--lav-dark); }
.class-stage-num {
  flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 11px; color: #fff;
  background: var(--grad-strong);
}
.class-stage-txt { overflow: hidden; text-overflow: ellipsis; }
/* Последний пункт списка этапов — ДЗ к уроку (только у учителя): отделён чертой,
   кружок без градиента (там эмодзи 🏠). */
.class-stage-hw { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.class-stage-hw .class-stage-num { background: transparent; font-size: 15px; }

/* показываем блоки только активной вкладки — правило метит ТОЛЬКО основную ленту
   материала (не панель «Домашние задания»: там блоки назначенного ДЗ несут
   data-section="homework" и прятались бы целиком) */
.class-material[data-section="lesson"] .class-material-body > .lesson-blocks > [data-section="homework"] { display: none; }
.class-material[data-section="homework"] .class-material-body > .lesson-blocks > [data-section="lesson"] { display: none; }

/* панель «Домашние задания» ученика (у учителя — вместо блоков урока) */
.class-hw-panel { flex: 1; min-width: 0; max-width: 780px; margin: 0 auto; }
.class-hw-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--ink); margin-bottom: 12px;
}
.class-hw-empty { color: var(--ink-2); font-size: 14px; padding: 18px 4px; line-height: 1.5; }
.class-hw-list { display: flex; flex-direction: column; gap: 8px; }
.class-hw-item {
  display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer;
  padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease;
}
.class-hw-item:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.class-hw-item-main { flex: 1; min-width: 0; }
.class-hw-item-title { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-hw-item-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.class-hw-chevron { font-size: 22px; color: var(--ink-3); line-height: 1; }
.class-hw-back { display: inline-block; font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.class-hw-detail-head { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--ink); }
.class-hw-detail-sub { font-size: 12.5px; color: var(--ink-2); margin: 2px 0 12px; }
.class-hw-comment {
  font-size: 13px; color: var(--ink-2); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px;
}
/* «Показать ученику» в панели ДЗ — живёт в шапке блока (не поверх содержимого) */
.class-hw-show { opacity: .7; white-space: nowrap; }
.class-hw-show:hover { opacity: 1; }

/* показанное учителем задание — оверлей поверх класса у ученика */
.hw-push {
  position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center;
  background: rgba(58,52,85,.45); backdrop-filter: blur(3px); padding: 20px;
}
.hw-push-card {
  width: min(680px, 96vw); max-height: 88vh; overflow-y: auto;
  background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 18px 20px;
}
.hw-push-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px;
  font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--ink);
}
.hw-push-close {
  border: 0; background: var(--bg-soft); cursor: pointer; border-radius: 50%;
  width: 30px; height: 30px; font-size: 15px; color: var(--ink-2); flex: 0 0 auto;
}
.hw-push-close:hover { background: var(--err); color: #fff; }
.class-side {
  width: 352px; flex: 0 0 352px; color: var(--ink);
  background: #FBFAFE; border-left: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px; gap: 12px;
}
.class-topbar {
  display: flex; align-items: center; gap: 10px; padding: 13px 15px;
  background: #fff; border: 1px solid var(--line);
  color: var(--ink); font-size: 14px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.videos { display: flex; flex-direction: column; gap: 9px; position: relative; }
.video-tile {
  position: relative; background: #3A3455; border-radius: var(--radius-sm); overflow: hidden;
  aspect-ratio: 4/3; border: 1px solid var(--line-2);
}
/* border-radius: inherit — сам <video> тоже скругляем: overflow:hidden на плитке
   не обрезает аппаратно-ускоренное видео в части браузеров (было «квадратное видео
   поверх скруглённой плитки» при включении камеры). */
.video-tile video { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.video-tile .video-label {
  position: absolute; left: 10px; bottom: 8px; font-size: 12px; color: #fff;
  background: rgba(58,52,85,.6); padding: 3px 10px; border-radius: 99px;
}
.video-tile.local {
  position: absolute; right: 10px; top: 10px; width: 100px; aspect-ratio: 4/3;
  border: 2px solid rgba(255,255,255,.85); z-index: 2; border-radius: 10px;
}
.video-tile .video-off {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #9C93BC; font-size: 30px;
}
/* мик/камера/демонстрация — компактной плашкой поверх видео (внизу по центру) */
.call-overlay {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  z-index: 3; display: flex; gap: 8px; padding: 6px;
  background: rgba(32,22,44,.42); backdrop-filter: blur(6px);
  border-radius: 99px;
}
.call-overlay .call-btn {
  width: 38px; height: 38px; font-size: 15px;
  background: rgba(255,255,255,.94); border-color: transparent; box-shadow: none;
}
.call-overlay .call-btn:hover { background: #fff; }
.call-overlay .call-btn.off { background: var(--err); color: #fff; }

.call-controls { display: flex; justify-content: center; align-items: center; gap: 9px; flex-wrap: wrap; }
.call-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line-2);
  cursor: pointer; background: #fff; color: var(--ink); font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center; transition: all .18s ease;
  box-shadow: var(--shadow); flex: 0 0 auto;
}
.call-btn:hover { background: var(--lav-soft); border-color: var(--lav); }
.call-btn.off { background: var(--err); border-color: transparent; color: #fff; }
.call-btn.hangup {
  background: linear-gradient(95deg, #DC6B6B, #B75F9C); border: 0; width: auto; color: #fff;
  border-radius: 99px; padding: 0 20px;
  font-family: var(--font-display); font-size: 12px; font-weight: 700; letter-spacing: .06em;
}
.call-btn.hangup:hover { filter: brightness(1.06); background: linear-gradient(95deg, #DC6B6B, #B75F9C); }
.conn-status { font-size: 12px; color: var(--ink-2); text-align: center; }

/* всплывающий чат: иконка со счётчиком в панели + плавающая карточка */
.chat-toggle { position: relative; }
.chat-toggle.active { background: var(--lav-soft); border-color: var(--lav); }
.chat-badge {
  position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 99px; background: var(--err); color: #fff; font-size: 10px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px #fff;
}
.chat-pop {
  position: fixed; right: 20px; bottom: 20px; z-index: 300;
  width: min(360px, 94vw); height: min(64vh, 520px);
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.chat-pop-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid var(--line);
  font-family: var(--font-display); font-weight: 700; font-size: 13.5px; color: var(--ink);
}
.chat-pop-close {
  border: 0; background: var(--bg-soft); cursor: pointer; border-radius: 50%;
  width: 26px; height: 26px; font-size: 13px; color: var(--ink-2); flex: 0 0 auto;
}
.chat-pop-close:hover { background: var(--err); color: #fff; }
.chat-log { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.chat-msg .from { font-weight: 800; color: var(--lav-dark); margin-right: 7px; }
.chat-msg.mine .from {
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.chat-img-link { display: block; margin-top: 5px; }
.chat-img { max-width: 100%; max-height: 200px; border-radius: 10px; border: 1px solid var(--line); display: block; }
.chat-input-row { display: flex; align-items: center; padding: 9px; gap: 7px; border-top: 1px solid var(--line); }
.chat-input-row .input { background: var(--bg-soft); border-color: var(--line-2); color: var(--ink); }
.chat-input-row .input:focus { box-shadow: none; border-color: var(--brand); background: #fff; }

.sync-badge {
  position: fixed; left: calc((100% - 352px) / 2); transform: translateX(-50%); bottom: 22px; z-index: 50;
  background: rgba(255,255,255,.94); backdrop-filter: blur(8px); color: var(--ink);
  border: 1px solid var(--line); border-radius: 99px; padding: 9px 15px;
  display: flex; gap: 10px; align-items: center;
  box-shadow: var(--shadow-lg); font-size: 13.5px;
}
.block-current { outline: 2.5px solid transparent; outline-offset: 4px; border-radius: var(--radius);
  box-shadow: 0 0 0 2.5px var(--g2), 0 18px 44px -18px rgba(var(--brand-rgb),.4); }

/* Учитель нажал «показать» — блок пульсирует у ученика, чтобы тот его заметил. */
.block-point { border-radius: var(--radius); animation: pointPulse 1.4s ease 3; }
@keyframes pointPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--brand-rgb),0); }
  50% { box-shadow: 0 0 0 7px rgba(var(--brand-rgb),.4), 0 0 0 2.5px var(--g2); }
}

.answer-feed { font-size: 13px; margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.answer-feed .item { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--bg-soft); border-radius: 10px; padding: 6px 11px; }

/* ручная отметка свободных пропусков (учитель, в классе) — ✓/✗ прямо у пропуска */
.free-mark-inline { display: inline-flex; gap: 3px; margin: 0 4px; vertical-align: middle; }
.free-mark-btn {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 1.5px solid var(--line-2); background: #fff; font-size: 11px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.free-mark-btn.ok.on { background: var(--ok); border-color: transparent; color: #fff; }
.free-mark-btn.err.on { background: var(--err); border-color: transparent; color: #fff; }

/* зелёная подсказка-ответ для учителя (наведение на пропуск) */
.reveal-pop {
  position: fixed; transform: translate(-50%, calc(-100% - 8px)); z-index: 9999;
  background: #E9FBF0; color: #1E7A4B; border: 1px solid var(--ok);
  font-weight: 700; font-size: 13px; padding: 4px 10px; border-radius: 8px;
  box-shadow: var(--shadow-lg); pointer-events: none; white-space: nowrap; max-width: 340px;
  overflow: hidden; text-overflow: ellipsis;
}
.has-reveal { cursor: help; }
.gap-input.has-reveal:hover,
select.has-reveal:hover { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok-soft); }

/* клик по слову в тексте урока → перевод и «в словарь» (учитель в классе) */
.wt-on .block-text, .wt-on .ex-question { cursor: help; }
.wt-pop {
  position: fixed; z-index: 9998; width: min(320px, 92vw);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 10px;
  display: flex; flex-direction: column; gap: 9px;
}
.wt-head { display: flex; align-items: center; gap: 8px; }
.wt-word {
  flex: 1; min-width: 0; font-weight: 800; font-size: 15px; color: var(--ink);
  overflow-wrap: anywhere;
}
.wt-speak {
  flex: 0 0 auto; width: 28px; height: 28px; border: 0; border-radius: 8px;
  background: var(--bg-soft); cursor: pointer; font-size: 14px; line-height: 1;
}
.wt-speak:hover { background: var(--brand-soft); }
.wt-close {
  flex: 0 0 auto; width: 24px; height: 24px; border: 0; border-radius: 50%;
  background: var(--bg-soft); cursor: pointer; font-size: 12px; color: var(--ink-2);
}
.wt-close:hover { background: var(--err); color: #fff; }
.wt-row { display: flex; gap: 7px; align-items: stretch; }
.wt-row .input { flex: 1; min-width: 0; }
.wt-row .btn { flex: 0 0 auto; white-space: nowrap; }

/* кубик: плавающая плашка с результатом броска (видна всем в классе) */
.dice-pop {
  position: fixed; z-index: 300; left: calc((100% - 352px) / 2); transform: translateX(-50%);
  bottom: 86px;
  background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
  border: 1.5px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-lg); padding: 12px 20px;
  display: flex; align-items: center; gap: 14px;
  animation: toast-in .18s ease-out;
}
.dice-pop .die { font-size: 46px; line-height: 1; }
.dice-pop .die.rolling { animation: diceShake .45s ease infinite; }
.dice-pop .who { font-size: 13.5px; color: var(--ink-2); max-width: 240px; }
.dice-pop .who b { color: var(--ink); }
@keyframes diceShake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-14deg) translateY(-2px); }
  75% { transform: rotate(12deg) translateY(1px); }
}

/* перетаскивание уроков и учебников в папки/книги */
.drop-ok { outline: 2.5px dashed var(--lav); outline-offset: 3px; }
.shelf-card.drop-ok, .crumb-link.drop-ok { background: var(--lav-soft); border-radius: 12px; }

/* ============ Библиотека уроков: полки-карточки ============ */

/* хлебные крошки */
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; margin-bottom: 2px; }
.crumbs .crumb-link { color: var(--ink-2); font-weight: 600; padding: 2px 6px; border-radius: 8px; }
.crumbs .crumb-link:hover { color: var(--brand-dark); background: var(--brand-soft); text-decoration: none; }
.crumbs .crumb-sep { color: var(--ink-3); }
.crumbs b { color: var(--ink); font-family: var(--font-display); font-weight: 700; }

.shelf-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 20px 16px; margin-bottom: 22px;
}
.shelf-card {
  position: relative; display: flex; flex-direction: column; gap: 9px;
  text-decoration: none; color: inherit; cursor: pointer; border-radius: 12px;
}
.shelf-card:hover { text-decoration: none; }
.shelf-card:hover .book-cover, .shelf-card:hover .sheet-cover, .shelf-card:hover .folder-cover {
  transform: translateY(-4px); box-shadow: var(--shadow-lg);
}
.shelf-card.shelf-dragging { opacity: .4; }

/* подпись под обложкой */
.shelf-label { padding: 0 3px; min-width: 0; }
.shelf-title {
  font-family: var(--font-display); font-weight: 700; font-size: 13.5px; line-height: 1.25; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.shelf-meta { font-size: 11.5px; color: var(--ink-2); margin-top: 3px; }
.shelf-date { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.shelf-place {
  font-size: 11px; color: var(--brand-dark); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* общий контейнер обложки */
.book-cover, .sheet-cover, .folder-cover {
  position: relative; aspect-ratio: 3 / 4; overflow: hidden;
  box-shadow: var(--shadow); transition: transform .16s ease, box-shadow .16s ease;
  background: var(--cover, var(--grad-soft));
}
.book-cover > img, .sheet-cover > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-glyph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 42px; filter: drop-shadow(0 3px 6px rgba(64,58,92,.25));
}

/* УЧЕБНИК — книга: корешок слева + «страницы» справа */
.book-cover { border-radius: 4px 12px 12px 4px; }
.book-cover::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 10px; z-index: 2;
  background: linear-gradient(90deg, rgba(0,0,0,.28), rgba(0,0,0,.04) 65%, rgba(255,255,255,.18));
  border-radius: 4px 0 0 4px;
}
.book-cover::after {
  content: ''; position: absolute; right: 0; top: 4px; bottom: 4px; width: 5px; z-index: 2;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.55) 0 1px, rgba(64,58,92,.10) 1px 2px);
  border-radius: 0 3px 3px 0;
}

/* ОТДЕЛЬНЫЙ УРОК — лист-раздатка: бумага, линовка, загнутый уголок */
.sheet-cover { border-radius: 10px; background: var(--cover, linear-gradient(160deg,#FFFDF8,#F4EFFA)); }
.sheet-cover:not(.has-img)::before {
  content: ''; position: absolute; left: 15px; right: 12px; top: 26px; bottom: 14px;
  background: repeating-linear-gradient(180deg, transparent 0 15px, rgba(var(--lav-rgb),.30) 15px 16px);
}
.sheet-cover::after {
  content: ''; position: absolute; top: 0; right: 0; z-index: 3;
  border-style: solid; border-width: 20px 20px 0 0;
  border-color: rgba(255,255,255,.92) transparent transparent transparent;
  filter: drop-shadow(-2px 2px 2px rgba(64,58,92,.14));
}

/* ПАПКА / РАЗДЕЛ — контейнер: язычок-вкладка сверху, без цифр и символов на иконке */
.folder-cover { border-radius: 4px 14px 14px 14px; background: var(--cover, var(--grad-soft)); }
.folder-cover::before {
  /* «язычок» папки — приподнятая вкладка слева сверху */
  content: ''; position: absolute; top: 0; left: 0; width: 50%; height: 20px; z-index: 2;
  background: rgba(255,255,255,.30); border-radius: 4px 12px 0 0;
}
.folder-cover::after {
  /* передняя створка папки — светлый блик по верхнему краю «кармана» */
  content: ''; position: absolute; left: 0; right: 0; top: 20px; height: 60%; z-index: 1;
  background: linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,0));
  border-radius: 12px 12px 0 0;
}

/* панель инструментов поверх обложки (по наведению) */
.shelf-tools {
  position: absolute; top: 6px; left: 6px; right: 6px; z-index: 5;
  display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end;
  opacity: 0; transform: translateY(-4px); transition: opacity .15s ease, transform .15s ease;
}
.shelf-card:hover .shelf-tools, .shelf-card:focus-within .shelf-tools { opacity: 1; transform: none; }
.shelf-tool {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 6px;
  border: 0; border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,.94); color: var(--ink);
  font-family: var(--font-display); font-weight: 700; font-size: 11px; line-height: 1;
  box-shadow: 0 2px 6px rgba(64,58,92,.22);
}
.shelf-tool:hover { background: #fff; color: var(--brand-dark); }
.shelf-tool.danger:hover { color: var(--err); }

/* «Полка» в окне выбора материала (смена урока в классе, запуск занятия) —
   те же карточки, что в библиотеке, но компактнее и со своим скроллом,
   чтобы поиск и хлебные крошки оставались на месте */
.picker-shelf { max-height: 56vh; overflow: auto; padding: 8px 6px 6px; margin-top: 6px; }
.picker-shelf .shelf-grid {
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 14px 12px; margin-bottom: 6px;
}
.picker-shelf .cover-glyph { font-size: 34px; }
.picker-shelf .shelf-title { font-size: 12.5px; }

/* ============ Расписание по неделям ============ */
.sched-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.sched-range { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--ink); margin-left: 4px; }
.sched-grid { display: grid; grid-template-columns: repeat(7, minmax(118px, 1fr)); gap: 10px; min-width: 840px; }
.sched-col { display: flex; flex-direction: column; gap: 6px; border-radius: var(--radius-sm); padding: 5px 4px; }
.sched-col.today { background: var(--lav-soft); outline: 1.5px solid var(--lav); outline-offset: -1px; }
.sched-dayhead { display: flex; flex-direction: column; margin-bottom: 4px; padding: 2px 4px; }
.sched-dow { font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--ink-2); }
.sched-dow.weekend { color: var(--brand); }
.sched-date { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.sched-col.today .sched-date { color: var(--lav-dark); }
.sched-chip {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--brand-soft); border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: 9px; padding: 7px 9px;
}
.sched-chip:hover { border-color: var(--brand); }
.sched-chip.skipped { background: #F5F3F9; border-left-style: dashed; }
.sched-chip.skipped .sched-who { text-decoration: line-through; color: var(--ink-3); }
.sched-chip.readonly { cursor: default; }
.sched-chip.readonly:hover { border-color: var(--line); }
.sched-time {
  font-family: var(--font-display); font-weight: 700; font-size: 11.5px; color: var(--ink-2);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.sched-who {
  font-weight: 700; font-size: 12.5px; margin-top: 2px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sched-tag {
  font-family: var(--font); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: #B07A2A; background: var(--warn-soft); padding: 1px 6px; border-radius: 99px;
}
.sched-tag.off { color: var(--ink-3); background: #ECE8F3; }
.sched-add { width: 100%; color: #B4A6BE; border-style: dashed; margin-top: 2px; }

/* сегмент «постоянный / разовый» */
.seg { display: flex; background: var(--bg-soft); border: 1.5px solid var(--line-2); border-radius: 99px; padding: 3px; }
.seg-btn {
  flex: 1; border: 0; background: transparent; cursor: pointer; padding: 8px 16px; border-radius: 99px;
  font-family: var(--font-display); font-size: 12px; font-weight: 700; color: var(--ink-2);
}
.seg-btn.active { background: var(--grad-strong); color: #fff; }

/* ============ Мобильная адаптация ============ */

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar {
    position: static; width: 100%; height: auto;
    flex-direction: row; align-items: center; overflow-x: auto; overflow-y: hidden;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .sidebar:hover, .sidebar:focus-within { width: 100%; box-shadow: none; }
  /* на тачскрине hover нет — подписи видны всегда */
  .sidebar .label { opacity: 1; transform: none; }
  .player-card { margin: 6px 8px; padding: 6px 8px; flex: 0 0 auto; }
  .player-rank { display: none; }
  .sidebar-nav { flex-direction: row; padding: 6px; align-items: center; }
  .sidebar-item { white-space: nowrap; padding: 8px 11px; }
  .nav-badge { position: static; margin-left: 6px; }
  .sidebar-foot { border-top: 0; padding: 6px 10px; margin-left: auto; display: flex; align-items: center; }
  .sidebar-foot .label { display: none; }
  .xp-card { display: none; }
  /* на тачскрине hover нет — инструменты карточек показываем всегда */
  .shelf-tools { opacity: 1; transform: none; }
  .shelf-grid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 16px 12px; }
  .main { margin-left: 0; padding: 18px 14px 80px; }
  .hero-card { padding: 22px 20px; }
  .classroom { flex-direction: column; }
  .class-material { order: 2; padding: 14px 12px 120px; }
  .class-side { order: 1; width: 100%; flex: 0 0 auto; flex-direction: row; flex-wrap: wrap; align-items: stretch; border-left: 0; border-bottom: 1px solid var(--line); }
  /* этапы (в правой колонке): на узком экране — горизонтальной лентой во всю ширину */
  .class-tabs { top: -14px; }
  .class-material-body { flex-direction: column; gap: 12px; max-width: none; }
  .class-material-body > .lesson-blocks { max-width: none; }
  .class-side .class-stages.side {
    flex: 1 1 100%; width: 100%; flex-direction: row; flex-wrap: nowrap;
    max-height: none; overflow-x: auto; overflow-y: hidden; box-shadow: none;
  }
  .class-stages-title { display: none; }
  .class-stage-item { white-space: nowrap; }
  .class-stage-txt { max-width: 120px; }
  .sync-badge { left: 50%; }
  .dice-pop { left: 50%; }
  .videos { flex: 0 0 46%; }
  .chat-pop { right: 8px; left: 8px; width: auto; bottom: 8px; height: min(60vh, 440px); }
  .match-row { grid-template-columns: 1fr; gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-primary::after, .xp-bar > i::after { animation: none; display: none; }
  .live-dot { animation: none; }
  /* сигнал «показать блок» — статичной обводкой вместо пульса */
  .block-point { animation: none; box-shadow: 0 0 0 2.5px var(--g2); }
  .dice-pop .die.rolling { animation: none; }
  .sidebar, .sidebar .label { transition: none; }
}

/* печать / прочее */
::selection { background: #F7DFEC; }
.muted { color: var(--ink-3); }
.small { font-size: calc(var(--lesson-fs) * .8125); }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.w100 { width: 100%; }

/* ============ Мой словарь и тренажёр слов ============ */

.dict-hero { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.dict-hero-left { flex: 1 1 280px; min-width: 240px; }
.dict-hero-sub { font-size: 14.5px; color: var(--ink-2); max-width: 420px; }
.dict-hero-tiles { display: flex; gap: 12px; flex-wrap: wrap; }
.dict-tile {
  background: rgba(255,255,255,.65); border: 1px solid rgba(64,58,92,.1);
  border-radius: 16px; padding: 14px 18px; min-width: 122px;
}
.dict-tile-label {
  font-family: var(--font-display); font-size: 10px; font-weight: 700;
  letter-spacing: .14em; color: var(--ink-2); margin-bottom: 7px; text-transform: uppercase;
}
.dict-tile-num { font-family: var(--font-display); font-weight: 800; font-size: 26px; }
.dict-tile-num.accent { color: #2E8A65; }
.dict-hero-cta { display: flex; flex-direction: column; gap: 9px; align-items: stretch; max-width: 250px; }
.dict-train-btn { font-family: var(--font-display); letter-spacing: .08em; padding: 14px 28px; font-size: 14px; }
.dict-xp-note { font-size: 12px; color: var(--ink-2); line-height: 1.45; }

/* прочность слова: 5 точек */
.dict-strength { display: inline-flex; gap: 3.5px; align-items: center; }
.dict-strength i {
  width: 8px; height: 8px; border-radius: 50%;
  background: #EDE7F4; border: 1px solid rgba(64,58,92,.08);
}
.dict-strength i.on { background: linear-gradient(120deg, #F2A97E, #E98AB4); border-color: transparent; }

/* фильтры и список слов */
.dict-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.dict-chip {
  border: 1.5px solid var(--line-2); background: #fff; color: var(--ink);
  border-radius: 99px; padding: 7px 15px; font-size: 13px; font-weight: 700;
  font-family: var(--font); cursor: pointer; transition: all .15s ease;
}
.dict-chip:hover { border-color: var(--brand); color: var(--brand-dark); }
.dict-chip.on { background: var(--grad-strong); border-color: transparent; color: #fff; }
.dict-list { display: flex; flex-direction: column; gap: 8px; }
.dict-pager {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-top: 16px; flex-wrap: wrap;
}
.dict-pager:empty { display: none; }
.dict-pager-info {
  font-size: 12.5px; color: var(--ink-2); font-weight: 600;
  font-variant-numeric: tabular-nums; text-align: center; min-width: 150px;
}
.dict-pager .btn[disabled] { opacity: .45; cursor: default; }
.dict-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
}
.dict-row.tight { padding: 8px 12px; }
.dict-row-main { flex: 1; min-width: 0; }
.dict-word { font-weight: 800; font-size: 15.5px; }
.dict-trans { font-size: 13px; color: var(--ink-2); margin-top: 1px; }
.dict-row-side { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.dict-src {
  font-size: 11px; color: var(--ink-3); max-width: 180px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* карточка-ссылка на дашборде */
.dict-promo {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s;
}
/* глобальный a:hover подчёркивает и перекрашивает ссылки — карточке это не идёт */
.dict-promo:hover { border-color: var(--brand); text-decoration: none; color: inherit; }
.dict-promo-ico {
  width: 44px; height: 44px; border-radius: 14px; flex: 0 0 44px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; background: var(--brand-soft);
}

/* тренажёр */
.trainer-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.trainer-count { font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--ink-2); }
.trainer-progress {
  height: 8px; border-radius: 99px; background: #F0EAF6; overflow: hidden; margin-bottom: 22px;
}
.trainer-progress i {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #F2A97E, #E98AB4, #9F86DC);
  transition: width .3s ease;
}
.trainer-card { max-width: 580px; margin: 0 auto; padding: 26px 28px; }
.trainer-card .kicker {
  font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: .16em;
  color: var(--brand-dark); text-transform: uppercase; margin-bottom: 12px;
}
.trainer-word {
  font-family: var(--font-display); font-weight: 800; font-size: 30px;
  margin-bottom: 20px; line-height: 1.25; overflow-wrap: anywhere;
}
.trainer-say { font-size: 18px; vertical-align: middle; }
.trainer-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .trainer-opts { grid-template-columns: 1fr; } }
.trainer-opt {
  padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line-2);
  background: #fff; font-size: 15.5px; font-weight: 600; font-family: var(--font);
  color: var(--ink); cursor: pointer; text-align: center; transition: all .15s ease;
  overflow-wrap: anywhere;
}
.trainer-opt:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
.trainer-opt:disabled { cursor: default; opacity: .82; }
.trainer-opt.ok { border-color: var(--ok); background: var(--ok-soft); color: #2E8A65; opacity: 1; font-weight: 800; }
.trainer-opt.err { border-color: var(--err); background: var(--err-soft); color: #C05B5B; opacity: 1; }
.trainer-type { display: flex; gap: 10px; flex-wrap: wrap; }
.trainer-input { flex: 1 1 220px; font-size: 16px; }
.trainer-input.ok { border-color: var(--ok); background: var(--ok-soft); }
.trainer-input.err { border-color: var(--err); background: var(--err-soft); }
.trainer-feedback { min-height: 10px; }
.trainer-verdict { margin-top: 16px; font-weight: 800; font-size: 15.5px; }
.trainer-verdict.ok { color: #2E8A65; }
.trainer-verdict.err { color: #C05B5B; }
.trainer-next { margin-top: 14px; display: flex; justify-content: flex-end; }

/* итог тренировки */
.trainer-ring {
  width: 128px; height: 128px; border-radius: 50%; margin: 6px auto 0;
  display: flex; align-items: center; justify-content: center;
}
.trainer-ring-in {
  width: 100px; height: 100px; border-radius: 50%; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.trainer-ring-in b { font-family: var(--font-display); font-size: 24px; font-weight: 800; }
.trainer-ring-in span { font-size: 11.5px; color: var(--ink-2); }
.trainer-xp {
  display: inline-block; margin-top: 10px; padding: 8px 18px; border-radius: 99px;
  font-family: var(--font-display); font-weight: 800; font-size: 17px; color: #fff;
  background: var(--grad-strong); animation: trainer-xp-pop .5s ease;
}
@keyframes trainer-xp-pop {
  0% { transform: scale(.6); opacity: 0; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
.trainer-mark {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 26px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
}
.trainer-mark.ok { background: var(--ok-soft); color: #2E8A65; }
.trainer-mark.err { background: var(--err-soft); color: #C05B5B; }
.trainer-result-list {
  display: flex; flex-direction: column; gap: 7px; margin-top: 18px; text-align: left;
}

@media (prefers-reduced-motion: reduce) {
  .trainer-xp { animation: none; }
  .trainer-progress i { transition: none; }
}

/* ============ Словарь ученика глазами учителя (кабинет + модалка в классе) ============ */

.dict-add { margin-bottom: 16px; }
.dict-add-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.dict-add-row .input { flex: 1 1 180px; min-width: 0; }
.dict-add-row2 { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.dict-add-lang { flex: 0 0 210px; max-width: 210px; }
@media (max-width: 560px) { .dict-add-lang { flex: 1 1 160px; max-width: none; } }

.dict-teacher-stat { margin-bottom: 12px; }

/* строка словаря у учителя переиспользует .dict-row; добавляем колонку инструментов */
.dict-row-tools { display: flex; gap: 6px; flex: 0 0 auto; }

/* список в модалке урока — со скроллом, чтобы окно не разрасталось */
.dict-teacher-scroll { max-height: 46vh; overflow-y: auto; padding-right: 4px; }
/* 40px padding оверлея + 56px padding .modal — иначе на телефоне горизонтальный скролл */
.dict-modal-body { min-width: min(560px, calc(100vw - 96px)); }

/* ============ Тренажёр: выбор 5 слов и этапы ============ */

/* индикатор пройденных этапов */
.trainer-steps { display: flex; gap: 7px; justify-content: center; margin: 0 0 18px; }
.trainer-step {
  width: 30px; height: 6px; border-radius: 99px; background: #EDE7F4; transition: background .2s;
}
.trainer-step.done { background: linear-gradient(90deg, #F2A97E, #E98AB4); }
.trainer-step.now { background: #9F86DC; }
.trainer-substep { text-align: center; margin-bottom: 12px; }

/* экран выбора слов */
.train-picked { display: flex; flex-direction: column; gap: 7px; }
.train-picked-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff;
}
.train-setup-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; justify-content: center; }
.train-choose { display: flex; flex-direction: column; gap: 6px; max-height: 44vh; overflow-y: auto; padding-right: 4px; }
.train-choice {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; width: 100%;
  border: 1.5px solid var(--line-2); border-radius: var(--radius-sm); background: #fff;
  font-family: var(--font); font-size: 14px; color: var(--ink); cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s;
}
.train-choice:hover { border-color: var(--brand); }
.train-choice.on { border-color: var(--ok); background: var(--ok-soft); }
.train-choice-check {
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line-2); font-weight: 800; color: #2E8A65; font-size: 13px;
}
.train-choice.on .train-choice-check { background: var(--ok); border-color: var(--ok); color: #fff; }

/* этап 1: карточки-переворот */
.flash-card {
  perspective: 1000px; width: 100%; max-width: 380px; height: 200px; margin: 0 auto 16px;
  cursor: pointer;
}
.flash-inner {
  position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d;
}
.flash-card.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  border-radius: var(--radius); border: 1.5px solid var(--line); box-shadow: var(--shadow); padding: 20px;
}
.flash-front { background: #fff; }
.flash-back { background: var(--grad-soft); transform: rotateY(180deg); }
.flash-word { font-family: var(--font-display); font-weight: 800; font-size: 30px; overflow-wrap: anywhere; text-align: center; }
.flash-trans { font-family: var(--font-display); font-weight: 700; font-size: 24px; color: var(--brand-dark); text-align: center; overflow-wrap: anywhere; }
.flash-controls { display: flex; gap: 10px; justify-content: center; }
.flash-yes { border-color: var(--ok); color: #2E8A65; font-weight: 800; }
.flash-yes:hover { background: var(--ok-soft); border-color: var(--ok); color: #2E8A65; }
.flash-no { border-color: var(--err); color: #C05B5B; font-weight: 800; }
.flash-no:hover { background: var(--err-soft); border-color: var(--err); color: #C05B5B; }
@media (prefers-reduced-motion: reduce) { .flash-inner { transition: none; } }

/* этап 2: сопоставление */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-col { display: flex; flex-direction: column; gap: 8px; }
.match-item {
  padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line-2); background: #fff;
  font-size: 15px; font-weight: 600; font-family: var(--font); color: var(--ink);
  cursor: pointer; text-align: center; transition: all .15s ease; overflow-wrap: anywhere;
}
.match-item:hover:not(.done) { border-color: var(--brand); background: var(--brand-soft); }
.match-item.sel { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.18); }
.match-item.done { border-color: var(--ok); background: var(--ok-soft); color: #2E8A65; cursor: default; opacity: .85; }
.match-item.bad { border-color: var(--err); background: var(--err-soft); color: #C05B5B; }

/* этап 5: ввод по буквам прямо в пропуски (первая буква — подсказка) */
.first-input { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.first-cell {
  width: 44px; height: 54px; border-radius: 12px; padding: 0; text-align: center;
  font-family: var(--font-display); font-weight: 800; font-size: 24px; text-transform: none;
  border: 1.5px solid var(--line-2); background: #fff; color: var(--ink);
}
.first-cell.first-known {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--grad-soft); border-color: transparent; color: var(--brand-dark);
}
.first-box:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(var(--brand-rgb),.16); outline: none; }
.first-box.ok { border-color: var(--ok); background: var(--ok-soft); color: #2E8A65; }
.first-box.err { border-color: var(--err); background: var(--err-soft); color: #C05B5B; }
.first-gap { width: 16px; }

/* пара, открывшаяся сама после двух ошибок (этап «Сопоставь») */
.match-item.auto { border-color: var(--line-2); background: var(--panel-2); color: var(--ink-2); }

/* ---------- рукописный ввод иероглифов (письменные этапы, китайский) ---------- */
/* Пока в карточке пишут от руки, выделять в ней нечего: на айпэде перо, вылезшее
   за клетку, иначе тянет системное выделение текста и меню «Скопировать/Найти».
   Поля ввода исключаем — там выделение нужно (в смешанном этапе рядом бывает
   обычный текстовый ответ). */
.hz-writing {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.hz-writing input, .hz-writing textarea { -webkit-user-select: auto; user-select: auto; }
.hz-field { margin: 4px 0 18px; -webkit-touch-callout: none; }
.hz-hint { text-align: center; margin-bottom: 10px; }
.hz-row { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.hz-sep { font-size: 20px; color: var(--ink-2); font-weight: 700; }
.hz-cell {
  width: 132px; height: 132px; border-radius: 16px; background: #fff; cursor: crosshair;
  border: 1.5px solid var(--line-2); box-shadow: inset 0 0 0 6px rgba(var(--lav-rgb),.05);
  touch-action: none; -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-user-drag: none;
}
.hz-cell:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(var(--brand-rgb),.16); }
.hz-cell.ok { border-color: var(--ok); background: var(--ok-soft); cursor: default; }
.hz-cell.err { border-color: var(--err); background: var(--err-soft); cursor: default; }
/* готовый иероглиф-подсказка (этап «по началу слова») */
.hz-known {
  display: inline-flex; align-items: center; justify-content: center; cursor: default;
  background: var(--grad-soft); border-color: transparent; color: var(--brand-dark);
  line-height: 1;
}
.hz-tools { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
@media (max-width: 560px) {
  .hz-cell { width: 108px; height: 108px; }
}

/* ---------- вкладка «Игры» ---------- */
.games-intro { color: var(--ink-2); font-size: 14px; margin: -4px 0 16px; }
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.game-card {
  display: flex; flex-direction: column; background: var(--panel);
  border: 1.5px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; text-decoration: none; color: var(--ink);
  transition: transform .18s, box-shadow .18s;
}
.game-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); text-decoration: none; }
.game-cover {
  background: var(--grad-soft); display: flex; align-items: center; justify-content: center;
  height: 120px; border-bottom: 1.5px solid var(--line);
}
.game-emoji { font-size: 52px; line-height: 1; transition: transform .25s; }
.game-card:hover .game-emoji { transform: scale(1.15) rotate(-6deg); }
.game-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.game-title { font-family: var(--font-display); font-weight: 800; font-size: 16px; }
.game-subtitle {
  font-weight: 700; font-size: 12px; letter-spacing: .03em;
  background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.game-desc { color: var(--ink-2); font-size: 13px; line-height: 1.5; flex: 1; }
.game-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.game-tag {
  background: var(--lav-soft); color: var(--lav-dark); border-radius: 999px;
  padding: 3px 10px; font-size: 11px; font-weight: 700;
}
.game-play { align-self: flex-start; margin-top: 6px; }
.game-topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.game-topbar-title { font-family: var(--font-display); font-weight: 800; font-size: 15px; flex: 1; text-align: center; }
.game-frame {
  width: 100%; height: calc(100vh - 148px); height: calc(100dvh - 148px);
  min-height: 480px; border: 1.5px solid var(--line);
  border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); display: block;
}
/* на узких экранах над фреймом больше «шапки» (горизонтальный сайдбар + перенос топбара),
   а 100vh больше видимого вьюпорта из-за адресной строки — берём dvh и больший запас */
@media (max-width: 860px) {
  .game-frame { height: calc(100vh - 235px); height: calc(100dvh - 235px); min-height: 420px; }
}

/* ============ Живой фон интерфейса ученика («сияние») ============
   Каркас рисует main.js (buildShell) и только ученику: .shell.student > .aurora.
   Пять пастельных пятен под сильным размытием + медленно вращающийся конический
   перелив + плёночное зерно (оно съедает бандинг, неизбежный на широких
   градиентах). Слой один: position: fixed — не скроллится, pointer-events: none —
   не перехватывает клики.
   z-index: -1, и это важно: фон в потоке (например у .shell) рисуется ПОВЕРХ
   отрицательного слоя и закрыл бы его — поэтому базовый градиент живёт внутри
   самой .aurora, а не на каркасе.
   Анимируем только transform: работа уходит на композитор, перерисовки нет. */

.aurora {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background:
    radial-gradient(120% 72% at 50% -16%, rgba(255,255,255,.85), rgba(255,255,255,0) 62%),
    linear-gradient(155deg, #FFFDFB 0%, #FFFCFE 32%, #FDFCFF 66%, #FBFDFF 100%);
}
.aurora i {
  position: absolute; display: block; border-radius: 50%;
  filter: blur(60px); opacity: .15; will-change: transform;
}
.aurora i:nth-child(1) {
  width: 56vmax; height: 56vmax; left: -17vmax; top: -20vmax;
  background: radial-gradient(circle at 50% 50%, #FFC28C, rgba(255,194,140,0) 68%);
  animation: aurora-1 33s ease-in-out infinite alternate;
}
.aurora i:nth-child(2) {
  width: 50vmax; height: 50vmax; right: -15vmax; top: -13vmax;
  background: radial-gradient(circle at 50% 50%, #F79CC8, rgba(247,156,200,0) 68%);
  animation: aurora-2 27s ease-in-out infinite alternate;
}
.aurora i:nth-child(3) {
  width: 62vmax; height: 62vmax; left: -13vmax; bottom: -26vmax;
  background: radial-gradient(circle at 50% 50%, #A98BEE, rgba(169,139,238,0) 68%);
  animation: aurora-3 39s ease-in-out infinite alternate;
}
.aurora i:nth-child(4) {
  width: 46vmax; height: 46vmax; right: -11vmax; bottom: -17vmax;
  background: radial-gradient(circle at 50% 50%, #7FE0D0, rgba(127,224,208,0) 70%);
  opacity: .12; animation: aurora-4 31s ease-in-out infinite alternate;
}
.aurora i:nth-child(5) {
  width: 48vmax; height: 48vmax; left: 26%; top: 10%;
  background: radial-gradient(circle at 50% 50%, #9CC7FA, rgba(156,199,250,0) 70%);
  opacity: .13; animation: aurora-5 45s ease-in-out infinite alternate;
}
/* перелив: один конический круг, который просто крутится по часовой.
   Маска обязательна: в центре конического градиента все оттенки сходятся в одну
   мутно-серую точку — а это ровно середина экрана, где лежит контент. */
.aurora::after {
  content: ''; position: absolute; inset: -35%;
  background: conic-gradient(from 90deg at 50% 50%,
    rgba(255,205,150,.34), rgba(247,156,200,.34) 22%, rgba(169,139,238,.34) 45%,
    rgba(127,224,208,.3) 66%, rgba(156,199,250,.32) 84%, rgba(255,205,150,.34) 100%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, rgba(0,0,0,0) 6%, #000 42%);
  mask-image: radial-gradient(circle at 50% 50%, rgba(0,0,0,0) 6%, #000 42%);
  filter: blur(56px); opacity: .14; will-change: transform;
  animation: aurora-spin 78s linear infinite;
}
/* зерно: .aurora — свой контекст наложения (z-index ≠ auto), так что soft-light
   смешивается только с фоном и не трогает контент страницы */
.aurora::before {
  content: ''; position: absolute; inset: 0; z-index: 2;
  opacity: .26; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes aurora-1 {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(13vw, 9vh, 0) scale(1.14); }
  100% { transform: translate3d(5vw, 20vh, 0) scale(.94); }
}
@keyframes aurora-2 {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(-11vw, 14vh, 0) scale(.9); }
  100% { transform: translate3d(-4vw, 26vh, 0) scale(1.16); }
}
@keyframes aurora-3 {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(16vw, -12vh, 0) scale(1.1); }
  100% { transform: translate3d(4vw, -24vh, 0) scale(.92); }
}
@keyframes aurora-4 {
  0%   { transform: translate3d(0, 0, 0) scale(.95); }
  50%  { transform: translate3d(-14vw, -9vh, 0) scale(1.2); }
  100% { transform: translate3d(-3vw, -20vh, 0) scale(1); }
}
@keyframes aurora-5 {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(-18vw, 12vh, 0) scale(1.25); }
  100% { transform: translate3d(12vw, -8vh, 0) scale(.9); }
}
@keyframes aurora-spin { to { transform: rotate(360deg); } }

/* Бумага поверх сияния. Фон намеренно почти белый, поэтому отделить плашки тоном
   нельзя — перепад держат кромка и тень, а карточки берём СПЛОШНЫМ белым: любая
   альфа на таком фоне даёт ту же белизну, но съедает чёткость края.
   Кромка — холодно-лиловая, а не белая: белая на светлом фоне не видна вовсе.
   backdrop-filter — только на сайдбаре (он один на экран); карточек бывает много,
   а под сплошным белым размывать всё равно нечего. */
.shell.student > .sidebar {
  background: rgba(255,255,255,.9);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  backdrop-filter: blur(22px) saturate(1.3);
  border-right-color: rgba(103,80,168,.13);
}
.shell.student > .sidebar:hover, .shell.student > .sidebar:focus-within {
  background: rgba(255,255,255,.97);
}
.shell.student .card {
  background: #fff;
  border-color: rgba(103,80,168,.13);
  box-shadow: 0 2px 4px rgba(64,58,92,.06), 0 18px 40px -24px rgba(103,80,168,.5);
}
/* hero остаётся единственной цветной плашкой — на выбеленном фоне она читается
   как акцент, а не как продолжение фона; вуаль лежит поверх сплошного белого. */
.shell.student .hero-card {
  background:
    linear-gradient(120deg, rgba(255,232,214,.88), rgba(252,221,238,.76) 45%, rgba(233,225,252,.88)),
    #fff;
  border-color: rgba(var(--lav-rgb),.24);
  box-shadow: 0 2px 6px rgba(64,58,92,.06), 0 24px 52px -26px rgba(103,80,168,.55);
}
.shell.student .player-card { background: rgba(255,255,255,.8); }

@media (max-width: 860px) {
  /* на телефоне режем самое дорогое: перелив и лишние пятна, размытие мельче */
  .aurora::after, .aurora i:nth-child(5) { display: none; }
  .aurora i { filter: blur(44px); }
  .shell.student > .sidebar { background: rgba(255,255,255,.9); }
}
@media (prefers-reduced-motion: reduce) {
  .aurora i, .aurora::after { animation: none; }
}

/* ============ Личный чат учитель ↔ ученик (#/chat) ============ */

.dm-page {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - 158px);
  min-height: 430px;
}
.dm-page.single { grid-template-columns: minmax(0, 1fr); }
.dm-page.single .dm-threads { display: none; }

.dm-threads { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px; }
.dm-thread {
  display: flex; gap: 11px; align-items: center; text-align: left;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 11px 13px; cursor: pointer; font: inherit; color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.dm-thread:hover { border-color: var(--line-2); box-shadow: 0 10px 26px -18px rgba(64,58,92,.35); }
.dm-thread.active { border-color: var(--brand); box-shadow: 0 10px 26px -18px rgba(var(--brand-rgb),.55); }
.dm-thread-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dm-thread-name { font-weight: 800; font-size: 14px; }
.dm-thread-last { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-unread {
  background: var(--grad-strong); color: #fff; font-weight: 800; border-radius: 99px;
  min-width: 22px; height: 22px; display: inline-flex; align-items: center;
  justify-content: center; font-size: 12px; padding: 0 7px; flex: none;
}

.dm-panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden;
}
.dm-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex: none; }
.dm-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; background: var(--bg-soft); }
.dm-day {
  align-self: center; font-size: 11.5px; font-weight: 700; color: var(--ink-2);
  background: #fff; border: 1px solid var(--line); border-radius: 99px;
  padding: 3px 12px; margin: 12px 0 6px;
}
.dm-row { display: flex; align-items: flex-end; gap: 4px; margin-top: 5px; }
.dm-row.mine { justify-content: flex-end; }
.dm-bubble {
  max-width: 74%; background: #fff; border: 1px solid var(--line);
  border-radius: 16px 16px 16px 6px; padding: 9px 13px 6px; font-size: 14px;
  white-space: pre-wrap; word-break: break-word; line-height: 1.4;
}
.dm-row.mine .dm-bubble {
  background: var(--grad-strong); color: #fff; border: none;
  border-radius: 16px 16px 6px 16px;
}
.dm-row.mine .dm-bubble a { color: #fff; }
.dm-meta { font-size: 10.5px; opacity: .62; margin-top: 3px; text-align: right; }
.dm-tools { display: none; gap: 1px; flex: none; padding-bottom: 4px; }
.dm-row:hover .dm-tools { display: flex; }
.dm-tool { border: none; background: transparent; cursor: pointer; font-size: 13px; opacity: .55; padding: 3px 4px; }
.dm-tool:hover { opacity: 1; }
.dm-input-row { display: flex; gap: 9px; padding: 11px 12px; border-top: 1px solid var(--line); align-items: flex-end; flex: none; }
.dm-input { resize: none; max-height: 130px; line-height: 1.35; flex: 1; }
.dm-back { display: none; }

@media (max-width: 900px) {
  .dm-page { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 132px); }
  /* телефон: либо список, либо открытая переписка (кнопка «←» возвращает) */
  .dm-page.thread-open .dm-threads { display: none; }
  .dm-page:not(.thread-open):not(.single) .dm-panel { display: none; }
  /* «←» только когда есть куда возвращаться: у ученика с единственным учителем
     списка собеседников нет вовсе (.single) */
  .dm-page.thread-open:not(.single) .dm-back { display: inline-flex; }
}

/* ============ Материалы (#/materials) ============ */

.mat-card { margin-bottom: 14px; }
.mat-head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; cursor: pointer; font: inherit; color: inherit;
  padding: 0; text-align: left; flex-wrap: wrap;
}
.mat-caret { color: var(--ink-3); font-size: 13px; width: 16px; flex: none; }
.mat-title { font-weight: 800; font-size: 15px; }
.mat-meta { color: var(--ink-2); font-size: 12.5px; margin-right: auto; }
.mat-files { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.mat-file {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px;
}
.mat-file-ico { font-size: 18px; flex: none; }
.mat-file-name { flex: 1; min-width: 120px; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat-file-size { color: var(--ink-2); font-size: 12px; flex: none; }
.mat-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.mat-access-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; }
.mat-access-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 9px;
  border-radius: 10px; cursor: pointer; font-size: 14px;
}
.mat-access-row:hover { background: var(--bg-soft); }
.mat-access-row input { width: 17px; height: 17px; accent-color: var(--brand); }

/* ============ ДЗ: выбор упражнений и правка задания (Танюшка №1–6) ============ */

/* Широченная модалка: окно назначения ДЗ с полным рендером блоков и редактор блока */
.modal.modal-max { max-width: 1040px; }

/* Окно назначения ДЗ: карточки блоков с галочками, содержимое — как у ученика */
.hw-pick-list {
  display: flex; flex-direction: column; gap: 16px;
  max-height: 56vh; overflow: auto;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  background: var(--bg-soft);
}
.hw-pick-group { display: flex; flex-direction: column; gap: 10px; }
.hw-pick-group-head {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 10.5px; font-weight: 700;
  letter-spacing: .1em; color: #736C93; padding: 2px 2px 0;
}
.hw-pick-block {
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; overflow: hidden; transition: border-color .15s, box-shadow .15s;
}
.hw-pick-block.on { border-color: var(--brand); box-shadow: 0 0 0 1.5px rgba(233,138,180,.35); }
.hw-pick-head {
  display: flex; align-items: center; gap: 10px; padding: 9px 13px;
  cursor: pointer; background: var(--bg-soft); border-bottom: 1px solid var(--line);
  font-size: 13.5px; font-weight: 600;
}
.hw-pick-block.on .hw-pick-head { background: var(--brand-soft); }
.hw-pick-head input { width: 18px; height: 18px; accent-color: var(--brand); flex: 0 0 18px; }
.hw-pick-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-pick-body { padding: 12px 16px; --lesson-fs: 15px; }
.hw-pick-body .lesson-blocks, .hw-pick-body { pointer-events: auto; }

/* Класс, режим «Отправить ДЗ»: галочка в шапке блока + клик по всему блоку */
.hw-pick-tick {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-display); font-size: 10.5px; font-weight: 700;
  letter-spacing: .08em; color: #736C93; white-space: nowrap;
}
.hw-pick-tick input { width: 18px; height: 18px; accent-color: var(--brand); }
/* весь блок — одна «галочка»: клики ловит контейнер, интерактив внутри выключен */
.class-material.picking .class-material-body [data-block-id] { cursor: pointer; }
.class-material.picking .class-material-body [data-block-id] * { pointer-events: none; }
.class-material.picking .class-material-body [data-block-id]:hover {
  outline: 2px dashed var(--brand); outline-offset: 3px; border-radius: var(--radius);
}
.block-picked {
  outline: 2.5px solid var(--brand) !important; outline-offset: 4px;
  border-radius: var(--radius);
}

/* плавающая панель отправки собранного ДЗ (выше плашки «БЛОК N / M», чтобы не наезжали) */
.hw-send-bar {
  position: fixed; left: calc((100% - 352px) / 2); bottom: 74px; transform: translateX(-50%);
  z-index: 900; display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1.5px solid var(--brand); border-radius: 99px;
  box-shadow: var(--shadow-lg); padding: 10px 18px; white-space: nowrap;
}

/* Конструктор: тело блока — плеер «как у ученика» */
.editor-block-body { --lesson-fs: 16px; }
.editor-block-body > .empty { padding: 10px; }

/* ============ Режим «Изменить положение»: перетаскивание блока (Танюшка №7) ============ */
/* Выбранный блок светится розовым по контуру, тянется вверх/вниз (и между разделами
   конструктора); розовая черта показывает, куда он встанет. Панель — Сохранить/Отмена. */
body.repos-on { user-select: none; -webkit-user-select: none; }
.repos-item > * { pointer-events: none; } /* клики не проваливаются в плееры и кнопки */
.repos-item:not(.repos-picked) { opacity: .88; }
.repos-picked {
  cursor: grab; touch-action: none; position: relative; z-index: 40;
  border-radius: var(--radius); opacity: 1;
  box-shadow: 0 0 0 3px rgba(233,138,180,.7), 0 0 22px 4px rgba(233,138,180,.35);
  animation: repos-pulse 1.6s ease-in-out infinite;
}
.repos-picked.repos-dragging {
  cursor: grabbing; z-index: 60; animation: none;
  box-shadow: 0 0 0 3px rgba(233,138,180,.95), 0 18px 44px -12px rgba(64,58,92,.35),
    0 0 28px 6px rgba(233,138,180,.45);
}
@keyframes repos-pulse {
  50% { box-shadow: 0 0 0 3px rgba(233,138,180,.4), 0 0 30px 9px rgba(233,138,180,.55); }
}
/* розовая черта-указатель места вставки */
.repos-indicator {
  position: fixed; z-index: 950; height: 6px; border-radius: 99px; pointer-events: none;
  background: linear-gradient(90deg,#F2A97E,#E98AB4,#9F86DC);
  box-shadow: 0 0 12px rgba(233,138,180,.7);
}
/* плавающая панель Сохранить/Отмена (bottom как у .hw-send-bar — выше плашки «БЛОК N/M») */
.repos-bar {
  position: fixed; left: 50%; bottom: 74px; transform: translateX(-50%);
  z-index: 940; display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1.5px solid var(--brand); border-radius: 99px;
  box-shadow: var(--shadow-lg); padding: 9px 12px 9px 20px; white-space: nowrap;
  max-width: calc(100vw - 20px);
}
.repos-bar-hint { font-weight: 700; font-size: 13.5px; }
@media (max-width: 640px) { .repos-bar-hint { display: none; } }
/* в конструкторе на время режима гасим «+» между блоками, панели добавления и этапы */
body.repos-on .editor-insert, body.repos-on .editor-add,
body.repos-on .editor-stages { opacity: .15; pointer-events: none; }
body.repos-on .editor-block-tools { display: none; }
