/* =========================================================================
   ENGLISH HUB — layout and components (Student Dashboard)
   Фиолетово-белая система по спецификации GLM; наполнение — под ENGLISH HUB.
   ========================================================================= */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--text-body);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; color: var(--ink); }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(139,92,246,.35); }

/* ---------- Иконки ---------- */
.ico {
  width: 20px; height: 20px; flex: 0 0 auto;
  fill: none; stroke: currentColor;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.ico.sm { width: 16px; height: 16px; }
.ico.xs { width: 14px; height: 14px; }
.ico-fill { width: 20px; height: 20px; flex: 0 0 auto; fill: currentColor; stroke: none; }
.ico-fill.sm { width: 16px; height: 16px; }

/* ---------- Каркас ---------- */
.page { max-width: var(--page-max); margin: 0 auto; padding: 0 28px 40px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--sidebar-w); gap: 24px; align-items: start; }
.content { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.sidebar { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ---------- Верхняя панель ---------- */
.topbar {
  position: relative;
  display: flex; align-items: center; gap: 20px;
  height: var(--topbar-h);
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: .02em;
  flex-shrink: 0;
}
.logo .ico { width: 26px; height: 26px; color: var(--ink); }
.mainnav { display: flex; align-items: center; gap: 4px; margin: 0 auto; }
.mainnav a {
  padding: 8px 13px; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 500; color: var(--text-body);
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}
.mainnav a:hover { background: var(--bg-tile); color: var(--ink); }
.mainnav a.active { background: var(--ink); color: var(--on-accent); }
.mainnav a.active:hover { background: var(--nav-active-hover); }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-page); border: 1px solid var(--border);
  color: var(--text-body);
  transition: background .15s ease, border-color .15s ease;
  position: relative;
}
.icon-btn:hover { background: var(--bg-tile); }
.icon-btn.bare { border-color: transparent; background: transparent; }
.icon-btn.bare:hover { background: var(--bg-tile); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.accent { background: var(--lilac-bg); border-color: transparent; color: var(--purple); }
.icon-btn.accent:hover { background: var(--lilac-hover); }
.icon-btn .dot {
  position: absolute; top: 9px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--purple); border: 2px solid var(--bg-page);
}
.burger { display: none; }

/* ---------- Аватары ---------- */
.avatar {
  border-radius: 50%; display: grid; place-items: center;
  font-weight: 600; flex-shrink: 0; overflow: hidden;
  line-height: 1;
}
.avatar-40 { width: 40px; height: 40px; font-size: 15px; }
.avatar-32 { width: 32px; height: 32px; font-size: 13px; }
.avatar-24 { width: 24px; height: 24px; font-size: 10px; }
.avatar.purple { background: var(--purple); color: var(--on-accent); }
.avatar.lilac   { background: var(--lilac-bg); color: var(--purple); }
.avatar.yellow  { background: var(--yellow-bg); color: var(--yellow-dark); }
.avatar.gray    { background: var(--avatar-gray); color: var(--text-gray); }

/* ---------- Карточки ---------- */
.card {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-hover); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2 { font-family: var(--font-display); font-size: var(--fs-h2); font-weight: 700; color: var(--ink); }
.sidebar .card-head h2 { font-size: var(--fs-h2-sm); }
.pager { display: flex; gap: 8px; }
.ghost-link { font-size: 13px; font-weight: 500; color: var(--purple-light); }
.ghost-link:hover { text-decoration: underline; }

/* ---------- Герой ---------- */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 6px; }
.hero h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: var(--fs-display); line-height: 1.2; color: var(--ink);
  max-width: 640px;
}
.hero h1 .soft { color: var(--text-gray); }
.hero-sub { color: var(--text-gray); font-size: var(--fs-body); margin-top: 8px; }
.btn-cta {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--bg-page); border: 1px solid var(--border); border-radius: var(--radius-full);
  padding: 8px 8px 8px 20px;
  font-size: 14px; font-weight: 600; color: var(--ink);
  transition: box-shadow .15s ease, border-color .15s ease;
}
.btn-cta:hover { border-color: var(--border-hover); box-shadow: var(--shadow-hover); }
.cta-chip { width: 28px; height: 28px; border-radius: 50%; background: var(--purple); display: grid; place-items: center; color: var(--on-accent); }
.cta-chip .ico { width: 14px; height: 14px; }

/* ---------- Курсы (плитки) ---------- */
.course-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tile { background: var(--bg-tile); border-radius: var(--radius-tile); padding: 14px; display: flex; flex-direction: column; }
a.tile { color: inherit; text-decoration: none; }
a.tile:hover { box-shadow: var(--shadow-hover); }
a.tile:hover .cta-chip { background: var(--purple-light); }
.cover {
  height: 124px; border-radius: 10px; overflow: hidden; margin-bottom: 12px;
  display: flex; align-items: flex-end; padding: 14px; position: relative;
}
.cover::after {
  content: ""; position: absolute; top: -30px; right: -30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,.28);
}
.cover.c1 { background: linear-gradient(135deg, var(--lilac-bg), var(--lavender)); }
.cover.c2 { background: linear-gradient(135deg, var(--yellow-bg), #F7E9B8); }
.cover.c3 { background: linear-gradient(135deg, var(--ink), #26262C); }
.cover-title { font-family: var(--font-display); font-weight: 700; font-size: 17px; line-height: 1.15; position: relative; }
.cover.c1 .cover-title, .cover.c2 .cover-title { color: var(--ink); }
.cover.c3 .cover-title { color: var(--on-accent); }
.tile-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.level { font-size: 14px; font-weight: 600; color: var(--purple-light); }
.tile-desc {
  font-size: 13px; line-height: 1.5; color: var(--text-gray);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-top: 1px solid var(--divider);
  margin-top: 12px; padding-top: 12px;
}
.tile-info { text-align: right; font-size: 11px; line-height: 1.6; color: var(--text-muted); flex-shrink: 0; white-space: nowrap; }

.badge { display: inline-block; font-size: 12px; font-weight: 500; padding: 5px 12px; border-radius: var(--radius-full); white-space: nowrap; }
.badge.lilac { background: var(--lilac-bg); color: var(--purple); }
.badge.yellow { background: var(--yellow-bg); color: var(--yellow-dark); }
.badge.gray { background: var(--track); color: var(--text-gray); }
.track { flex: 1; height: 6px; border-radius: var(--radius-full); background: var(--track); overflow: hidden; }
.fill { height: 100%; border-radius: var(--radius-full); background: var(--purple-light); }

/* ---------- Сайдбар: активность ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-gray); margin-bottom: 14px; }
.legend .li { display: inline-flex; align-items: center; gap: 6px; }
.legend .li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.legend .li.purple::before { background: var(--purple-light); }
.legend .li.lavender::before { background: var(--lavender); }
.legend .li.yellow::before { background: var(--yellow); }
.chart { display: flex; align-items: flex-end; justify-content: space-between; height: 126px; padding: 0 4px; }
.bar { width: 26px; border-radius: var(--radius-full); }
.bar.purple { background: var(--purple-light); }
.bar.lavender { background: var(--lavender); }
.bar.yellow { background: var(--yellow); }

/* ---------- Сайдбар: ментор ---------- */
.mentor-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.mentor-row .who { min-width: 0; flex: 1; }
.mentor-row b { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.mentor-row small { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.follow {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--lilac-bg); color: var(--purple);
  font-size: 13px; font-weight: 500;
  padding: 7px 14px; border-radius: var(--radius-full); flex-shrink: 0;
  transition: background .15s ease;
}
.follow:hover { background: var(--lilac-hover); }
.follow .ico { width: 14px; height: 14px; }

/* ---------- Пустые состояния ---------- */
.empty { text-align: center; padding: var(--space-5) var(--space-4); color: var(--text-gray); font-size: var(--fs-sm); }
.empty .ico { opacity: .6; margin: 0 auto 8px; }
.empty .btn-link { color: var(--purple-light); font-weight: 600; }
.empty .btn-link:hover { text-decoration: underline; }
.btn-link { background: none; border: none; color: var(--purple-light); font-weight: 600; cursor: pointer; padding: 0; font-size: var(--fs-body); }

/* ---------- Демо-бейдж ---------- */
.demo-badge {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  background: var(--lilac-bg); color: var(--purple);
  border: 1px solid var(--lavender);
  border-radius: var(--radius-full);
  padding: 4px 12px; font-size: 12px; font-weight: 600;
}

/* ---------- Раздел «в разработке» ---------- */
.soon-card { padding: var(--space-7) var(--space-5); text-align: center; }
.soon-card .ico { width: 40px; height: 40px; color: var(--purple-light); margin: 0 auto 12px; }
.soon-card h2 { font-family: var(--font-display); font-size: var(--fs-h1); margin-bottom: 8px; }
.soon-card p { color: var(--text-gray); margin-bottom: 20px; }

/* ---------- Страница входа ---------- */
.login-wrap { max-width: 440px; margin: 8vh auto; padding: var(--space-5); }
.login-card { background: var(--bg-page); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--space-6); box-shadow: var(--shadow-hover); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: var(--space-2); }
.login-brand .logo { font-size: 18px; }
.login-brand .brand-sub { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-gray); margin-top: 2px; }
.login-card .muted { color: var(--text-gray); font-size: var(--fs-sm); margin: 0 0 var(--space-4); }
.login-card label { display: block; font-size: var(--fs-sm); color: var(--text-gray); margin: var(--space-4) 0 var(--space-2); }
.login-card input {
  width: 100%; min-height: 44px; padding: 0 var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius-input);
  font-family: var(--font-body); font-size: var(--fs-body); color: var(--ink);
  background: var(--bg-page);
}
.login-card input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--lilac-bg); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-5);
  border: none; border-radius: var(--radius-btn);
  font-family: var(--font-body); font-size: var(--fs-body); font-weight: 600;
  cursor: pointer; transition: background .15s ease;
}
.btn-primary { background: var(--purple); color: var(--on-accent); }
.btn-primary:hover { background: var(--purple-light); }
.btn-block { width: 100%; }
.err { color: var(--purple); font-size: var(--fs-sm); margin-top: var(--space-3); }

/* ---------- Вспомогательные ---------- */
.hidden { display: none !important; }
[data-mode="real"] .demo-only { display: none !important; }
[data-mode="demo"] .empty-only { display: none !important; }

/* ---------- Планшет ---------- */
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
  .sidebar .card.mentors { grid-column: 1 / -1; }
  .course-grid { display: flex; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; }
  .tile { flex: 0 0 calc(50% - 8px); min-width: 300px; }
  .hero h1 { font-size: 30px; }
}

/* ---------- Сворачивание верхней навигации (8 пунктов не влезают) ---------- */
@media (max-width: 1239px) {
  .mainnav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-page); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-hover);
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 8px 16px 16px; margin: 0;
  }
  .mainnav.open { display: flex; }
  .mainnav a { width: 100%; text-align: left; border-radius: var(--radius-btn); padding: 12px 14px; }
  .burger { display: grid; }
}

/* ---------- Мобильный ---------- */
@media (max-width: 720px) {
  .page { padding: 0 16px 32px; }
  .topbar { gap: 12px; }
  .topbar-right { gap: 6px; }
  .topbar-right .icon-btn[aria-label="Поиск"] { display: none; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hero h1 { font-size: 24px; }
  .card { padding: 16px; }
  .sidebar { grid-template-columns: 1fr; }
  .tile { flex: 0 0 260px; min-width: 260px; }
}

/* =========================================================================
   My Courses + Course View (спека GLM, 27.11.2026)
   ========================================================================= */

/* ---------- Заголовок раздела ---------- */
.pagehead { margin-bottom: 32px; }
.pagehead h1 { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-display); line-height: 1.15; color: var(--ink); }
.pagehead .subline { margin-top: 8px; font-size: var(--fs-h3); color: var(--text-gray); }

/* ---------- Сетка курсов ---------- */
.courses-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.course-card {
  display: flex; flex-direction: column;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.course-card:hover { border-color: var(--lavender); box-shadow: 0 8px 24px rgba(16,16,20,.08); transform: translateY(-2px); }
.cover { height: 148px; position: relative; flex-shrink: 0; }
.cover svg { width: 100%; height: 100%; display: block; }
.cover-badge {
  position: absolute; top: 16px; left: 16px;
  background: var(--lilac-bg); color: var(--purple);
  font-size: 11px; font-weight: 600;
  padding: 4px 12px; border-radius: var(--radius-full);
}
.course-body { padding: 16px; display: flex; flex-direction: column; flex: 1; }
.course-title { font-family: var(--font-display); font-weight: 700; font-size: 18px; line-height: 1.2; color: var(--ink); margin: 0 0 8px; }
.course-desc {
  font-size: 13px; line-height: 1.5; color: var(--text-gray);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.course-progress { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
.progress-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.progress-row .stage { font-size: 12px; font-weight: 600; color: var(--text-body); }
.progress-row .count { font-size: 12px; color: var(--text-muted); }
.btn-card {
  margin-top: 12px; width: 100%; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--purple); color: var(--on-accent);
  font-size: 13px; font-weight: 600; border-radius: var(--radius-btn);
  transition: background .15s ease;
}
.btn-card:hover { background: var(--purple-hover); }

/* ---------- Empty (нет курсов) ---------- */
.empty-course {
  max-width: 320px; margin: 0 auto; padding: 32px 24px; text-align: center;
  background: var(--bg-tile); border-radius: var(--radius-card);
}
.empty-course .ico { width: 96px; height: 96px; color: var(--lavender); margin: 0 auto 16px; }
.empty-course h3 { font-family: var(--font-display); font-size: 18px; margin-bottom: 8px; }
.empty-course p { font-size: 13px; color: var(--text-gray); margin: 0; }

/* ---------- Карта умений «I can…» ---------- */
.card-sm { padding: 16px; }
.skill-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.skill-head h2 { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); }
.counter {
  background: var(--lilac-bg); color: var(--purple);
  font-size: 11px; font-weight: 600;
  padding: 4px 12px; border-radius: var(--radius-full); white-space: nowrap;
}
.skill-sub { margin: 4px 0 12px; font-size: 12px; color: var(--text-muted); }
.skills { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.skills li { display: flex; align-items: flex-start; gap: 10px; padding: 6px 8px; border-radius: var(--radius-tile); font-size: 13px; line-height: 1.4; }
.skills .mk { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; margin-top: 1px; }
.skills .mk .ico { width: 12px; height: 12px; stroke-width: 3; }
.skills li.done { color: var(--ink); font-weight: 500; }
.skills li.done .mk { background: var(--purple); color: var(--on-accent); }
.skills li.next { color: var(--text-gray); }
.skills li.next .mk { border: 1.5px solid var(--lavender); background: var(--bg-page); }
.skills li.todo { color: var(--text-muted); }
.skills li.todo .mk { border: 1.5px solid var(--border); background: var(--bg-page); }
.skill-footer { margin-top: 12px; }
.skill-footer .track { margin-bottom: 8px; }
.skill-footer p { font-size: 12px; color: var(--text-muted); margin: 0; }

/* ---------- Course view: шапка курса ---------- */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: var(--purple-light);
  margin-bottom: 16px;
}
.back-link:hover { text-decoration: underline; }
.back-link .ico { width: 14px; height: 14px; }
.course-head { display: flex; align-items: center; gap: 16px; }
.mini-cover { width: 64px; height: 64px; border-radius: var(--radius-tile); overflow: hidden; flex-shrink: 0; }
.mini-cover svg { width: 100%; height: 100%; display: block; }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.course-head h1 { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-display); line-height: 1.15; color: var(--ink); }
.course-sub { margin: 4px 0 0; font-size: 13px; color: var(--text-gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-progress-row { display: flex; align-items: center; gap: 16px; margin: 16px 0 24px; max-width: 520px; }
.course-progress-row .track { flex: 1; }
.course-progress-row .count { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ---------- Course view: модули (аккордеон) ---------- */
.modules { display: flex; flex-direction: column; gap: 12px; }
.module { background: var(--bg-page); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 8px 16px; }
.mod-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 8px; border-radius: var(--radius-tile); cursor: pointer;
  user-select: none;
}
.mod-head:hover { background: var(--bg-tile); }
.mod-mark {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
}
.mod-mark .ico { width: 12px; height: 12px; stroke-width: 3; }
.module.done .mod-mark { background: var(--purple); color: var(--on-accent); }
.module.current .mod-mark { background: var(--purple); color: var(--on-accent); }
.module.future .mod-mark { border: 1.5px solid var(--border); color: var(--text-muted); }
.mod-titles { min-width: 0; }
.mod-kicker { font-size: 11px; color: var(--text-muted); letter-spacing: .02em; }
.mod-title { font-size: 15px; font-weight: 600; line-height: 1.3; margin-top: 2px; }
.module.done .mod-title { color: var(--text-gray); }
.module.future .mod-title { color: var(--text-muted); }
.module.current .mod-title { color: var(--ink); }
.mod-meta { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.mini-track { width: 72px; height: 6px; border-radius: var(--radius-full); background: var(--track); overflow: hidden; }
.mini-track .fill { height: 100%; }
.mod-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.mod-count.current { color: var(--text-gray); }
.mod-chevron { width: 16px; height: 16px; color: var(--text-muted); transition: transform .15s ease; flex-shrink: 0; }
.module.open .mod-chevron { transform: rotate(180deg); }
.mod-body { display: none; padding: 4px 8px 12px; }
.module.open .mod-body { display: block; }

/* ---------- Course view: уроки ---------- */
.lesson { display: flex; align-items: center; gap: 12px; padding: 12px 8px; border-radius: var(--radius-tile); }
.lesson + .lesson { border-top: 1px solid var(--border); }
a.lesson:hover { background: var(--bg-tile); }
.lesson.locked { cursor: default; }
.lesson .mk { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; }
.lesson .mk .ico { width: 12px; height: 12px; stroke-width: 3; }
.lesson.ls-done .mk { background: var(--purple); color: var(--on-accent); }
.lesson.ls-done .lesson-title { color: var(--text-body); }
.lesson.ls-progress .mk { border: 1.5px solid var(--purple); position: relative; }
.lesson.ls-progress .mk::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--purple); }
.lesson.ls-progress .lesson-title { color: var(--ink); font-weight: 600; }
.lesson.ls-next .mk { border: 1.5px solid var(--lavender); }
.lesson.ls-next .lesson-title { color: var(--ink); font-weight: 600; }
.lesson.ls-future .mk { border: 1.5px solid var(--border); }
.lesson.ls-future .lesson-title { color: var(--text-muted); }
.lesson-title { font-size: 13px; flex: 1; min-width: 0; }
.lesson-dur { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.btn-small {
  display: inline-flex; align-items: center; justify-content: center;
  height: 32px; padding: 0 16px;
  background: var(--purple); color: var(--on-accent);
  font-size: 12px; font-weight: 600; border-radius: var(--radius-btn);
  white-space: nowrap; transition: background .15s ease;
}
.btn-small:hover { background: var(--purple-hover); }

/* ---------- Адаптив новых экранов ---------- */
@media (max-width: 1080px) {
  .sidebar .skill-card { grid-column: 1 / -1; }
  .courses-grid { grid-template-columns: repeat(2, 1fr); }
  .skills { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 24px; }
}
@media (max-width: 720px) {
  .pagehead { margin-bottom: 24px; }
  .pagehead h1 { font-size: 28px; }
  .pagehead .subline { font-size: 14px; }
  .courses-grid { grid-template-columns: 1fr; gap: 16px; }
  .cover { height: 132px; }
  .btn-card { height: 44px; }
  .skills { grid-template-columns: 1fr; }
  .course-head h1 { font-size: 28px; }
  .mini-cover { width: 48px; height: 48px; }
  .course-sub { white-space: normal; }
  .course-progress-row { flex-wrap: wrap; margin-bottom: 16px; }
  .course-progress-row .track { flex-basis: 100%; order: 2; }
  .course-progress-row .count { order: 1; }
  .mod-meta .mini-track { display: none; }
  .mod-head { flex-wrap: wrap; row-gap: 8px; }
  .mod-titles { flex: 1 1 calc(100% - 36px); }
  .mod-meta { flex-basis: calc(100% - 36px); margin-left: 36px; }
  .mod-meta .mod-chevron { margin-left: auto; }
  .lesson.ls-progress, .lesson.ls-next { flex-wrap: wrap; row-gap: 8px; }
  .lesson.ls-progress .lesson-title, .lesson.ls-next .lesson-title { flex: 1 1 calc(100% - 32px); }
  .lesson.ls-progress .lesson-dur, .lesson.ls-next .lesson-dur { order: 2; }
  .lesson.ls-progress .badge, .lesson.ls-next .badge { order: 3; margin-left: 32px; }
  .lesson.ls-progress .btn-small { order: 4; margin-left: 32px; height: 40px; }
}

/* =========================================================================
   Lesson Page (спека GLM, 27.11.2026)
   ========================================================================= */

/* Одна колонка 760px без сайдбара */
.layout.lesson { display: block; }
.layout.lesson .content { max-width: 760px; margin: 0 auto; }

/* ---------- Шапка урока ---------- */
.lesson-crumbs { margin-bottom: 8px; font-size: 12px; color: var(--text-muted); }
.lesson-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lesson-title-row h1 { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-display); line-height: 1.15; color: var(--ink); }
.lesson-goal { margin-top: 8px; font-family: var(--font-display); font-weight: 600; font-size: 28px; color: var(--ink); }
.lesson-meta { margin-top: 8px; font-size: 13px; color: var(--text-gray); }
.lesson-session {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 20px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-card);
}
.session-line { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text-body); }
.session-line .ico { width: 16px; height: 16px; color: var(--text-muted); }
.btn-connect {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 16px;
  background: var(--bg-page); border: 1px solid var(--border); border-radius: var(--radius-btn);
  font-size: 13px; font-weight: 600; color: var(--ink);
  transition: background .15s ease;
}
.btn-connect .ico { width: 16px; height: 16px; color: var(--purple); }
.btn-connect:hover { background: var(--bg-tile); }
.session-caption { width: 100%; font-size: 11px; color: var(--text-muted); }

/* ---------- Секции ---------- */
.lesson-sections { display: flex; flex-direction: column; gap: 16px; margin-top: 32px; }
.lesson-card { padding: 16px; }
.lesson-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.lesson-card-head h2 { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); }
.counter.gray { background: var(--track); color: var(--text-gray); }
.lesson-card .counter { font-size: 11px; font-weight: 600; padding: 4px 12px; border-radius: var(--radius-full); white-space: nowrap; }

/* ---------- Слова ---------- */
.word-row {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center;
  min-height: 44px; padding: 0 8px; border-radius: var(--radius-tile);
}
.word-row + .word-row { border-top: 1px solid var(--border); }
.word-row:hover { background: var(--bg-tile); }
.w-en { font-size: 15px; font-weight: 600; color: var(--ink); }
.w-ipa { font-size: 13px; color: var(--text-muted); }
.w-ru { font-size: 13px; color: var(--text-gray); text-align: right; }

/* ---------- Фразы ---------- */
.phrase-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 8px; border-radius: var(--radius-tile); }
.phrase-row + .phrase-row { border-top: 1px solid var(--border); }
.phrase-row:hover { background: var(--bg-tile); }
.ph-num {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; margin-top: 1px;
  border: 1.5px solid var(--border); font-size: 11px; color: var(--text-muted);
}
.ph-en { font-size: 15px; font-weight: 600; color: var(--ink); }
.ph-ru { font-size: 13px; color: var(--text-gray); }

/* ---------- Упражнения ---------- */
.exercise-rows { display: flex; flex-direction: column; gap: 8px; }
.exercise {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-tile); border-radius: var(--radius-tile); padding: 12px 16px;
  transition: background .15s ease;
}
.exercise:hover { background: var(--track); }
.ex-ico { width: 18px; height: 18px; color: var(--purple); flex-shrink: 0; }
.ex-body { flex: 1; min-width: 0; }
.ex-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.ex-sub { font-size: 12px; color: var(--text-muted); }
.ex-status { font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.ex-status.active { color: var(--purple); }

/* ---------- Практика ---------- */
.practice-plate { background: var(--bg-tile); border-radius: var(--radius-tile); padding: 8px 12px; font-size: 12px; color: var(--text-body); margin-bottom: 12px; }
.practice-desc { font-size: 13px; line-height: 1.5; color: var(--text-gray); margin: 0 0 12px; }
.practice-plan { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.practice-plan li { position: relative; padding-left: 16px; font-size: 13px; color: var(--text-body); }
.practice-plan li::before { content: ""; position: absolute; left: 0; top: 7px; width: 4px; height: 4px; border-radius: 50%; background: var(--purple-light); }
.btn-practice {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; height: 48px;
  background: var(--purple); color: var(--on-accent);
  font-size: 15px; font-weight: 600; border-radius: var(--radius-btn);
  transition: background .15s ease;
}
.btn-practice:hover { background: var(--purple-hover); }
.practice-caption { display: block; text-align: center; margin-top: 8px; font-size: 11px; color: var(--text-muted); }

/* ---------- Упражнения (интерактив) ---------- */
.exercise-items { display: flex; flex-direction: column; gap: 10px; }
.exercise-item { background: var(--bg-tile); border-radius: var(--radius-tile); padding: 12px; }
.ex-prompt { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.ex-options { display: flex; flex-wrap: wrap; gap: 8px; }
.ex-option {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-full);
  background: var(--bg-page); font-size: 13px; color: var(--text-body);
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.ex-option:hover { border-color: var(--purple-light); color: var(--purple); }
.exercise-item.is-done .ex-option { pointer-events: none; opacity: .55; }
.exercise-item.is-done .ex-option.is-picked { opacity: 1; border-color: var(--purple); color: var(--purple); background: var(--lilac-bg); }
.ex-form { display: flex; gap: 8px; }
.ex-input {
  flex: 1 1 auto; min-width: 0; height: 38px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-input);
  font: inherit; font-size: 13px; color: var(--ink); background: var(--bg-page);
}
.ex-input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--lilac-bg); }
.ex-feedback { margin-top: 8px; font-size: 13px; line-height: 1.4; color: var(--text-gray); }
.exercise-item.is-correct .ex-feedback { color: var(--purple); }
.exercise-item.is-wrong .ex-feedback { color: var(--yellow-dark); }
.ex-bonus {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: var(--radius-full);
  background: var(--lilac-bg); color: var(--purple); font-size: 11px; font-weight: 700;
}

/* ---------- Домашка: сдача ---------- */
.hw-title { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.hw-instructions { font-size: 13px; color: var(--text-gray); margin-bottom: 12px; }
.hw-my-text {
  font-size: 13px; color: var(--text-body); background: var(--bg-tile);
  border-radius: var(--radius-tile); padding: 10px 12px; margin-bottom: 10px;
  white-space: pre-wrap;
}
.hw-audio { width: 100%; margin-bottom: 10px; }
.hw-review {
  font-size: 13px; color: var(--text-body); background: var(--bg-tile);
  border-radius: var(--radius-tile); padding: 10px 12px;
}
.hw-form { display: flex; flex-direction: column; gap: 10px; }
.hw-text {
  width: 100%; resize: vertical; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-input);
  font: inherit; font-size: 13px; color: var(--ink); background: var(--bg-page);
}
.hw-text:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--lilac-bg); }
.hw-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hw-record.is-recording { background: var(--yellow); color: var(--ink); }
.hw-record.is-recording:hover { background: var(--yellow); }
.hw-rec-ico { font-size: 14px; }
.hw-status { min-height: 16px; font-size: 12px; color: var(--text-muted); }
.hw-status.is-rec { color: var(--purple); }
.hw-status.is-err { color: var(--yellow-dark); }
.th-audio-player { width: 100%; margin-top: 6px; }

/* ---------- Домашка ---------- */
.lesson-badges { display: flex; align-items: center; gap: 8px; }
.homework-list { display: flex; flex-direction: column; gap: 10px; }
.homework-item { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text-body); }
.hw-mark { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; border: 1.5px solid var(--lavender); margin-top: 1px; }

/* ---------- Аудио ---------- */
.audio-rows { display: flex; flex-direction: column; gap: 4px; }
.audio-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--radius-tile); }
.audio-row:hover { background: var(--bg-tile); }
.play-btn {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--purple); color: var(--on-accent);
  transition: background .15s ease;
}
.play-btn .ico-fill { width: 12px; height: 12px; }
.play-btn:hover { background: var(--purple-hover); }
.audio-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; color: var(--ink); }
.audio-dur { font-size: 12px; color: var(--text-muted); }

/* ---------- Sticky-бар (мобильный) ---------- */
.lesson-sticky { display: none; }

/* ---------- Адаптив Lesson Page ---------- */
@media (max-width: 720px) {
  .lesson-title-row h1 { font-size: 28px; }
  .lesson-goal { font-size: 18px; }
  .lesson-session { flex-direction: column; align-items: stretch; gap: 10px; }
  .btn-connect { width: 100%; justify-content: center; }
  .session-caption { text-align: center; }
  .word-row { grid-template-columns: 1fr auto; }
  .w-ru { grid-column: 1 / -1; text-align: left; font-size: 12px; }
  .lesson-card .btn-practice { display: none; }
  .lesson-sticky {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--bg-page); border-top: 1px solid var(--border); padding: 12px 16px;
  }
  .lesson-sticky .btn-practice { height: 44px; }
  #content-lesson { padding-bottom: 88px; }
}

/* =========================================================================
   Live Lessons (спека GLM, 29.11.2026)
   ========================================================================= */

/* Одна колонка 760px без сайдбара */
.layout.live,
.layout.progress { display: block; }
.layout.live .content,
.layout.progress .content { max-width: 760px; margin: 0 auto; }
.live-pagehead { margin-bottom: 24px; }

/* ---------- Hero «Ближайшее занятие» ---------- */
.live-hero {
  background: var(--lilac-bg);
  border-radius: var(--radius-card);
  padding: 24px;
}
.live-hero-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.live-kicker { font-size: 12px; font-weight: 600; color: var(--purple); }
.live-now {
  display: none; align-items: center; gap: 6px;
  background: var(--bg-page); color: var(--purple);
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: var(--radius-full);
}
.live-now-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--purple); }
#content-live[data-state="ongoing"] .live-kicker { display: none; }
#content-live[data-state="ongoing"] .live-now { display: inline-flex; }

.live-people { display: flex; align-items: center; gap: 8px; min-width: 0; }
.avatar-stack { display: flex; align-items: center; }
.avatar-stack .avatar { border: 2px solid var(--bg-page); }
.avatar-stack .avatar + .avatar { margin-left: -8px; }
.live-people-label { font-size: 12px; color: var(--text-gray); white-space: nowrap; }

.live-date { margin-top: 12px; font-size: 15px; font-weight: 600; color: var(--ink); }
.live-topic {
  margin-top: 4px;
  font-family: var(--font-display); font-weight: 700;
  font-size: 28px; line-height: 1.15; color: var(--ink);
}
.live-course { margin-top: 8px; font-size: 13px; color: var(--text-gray); }

.live-actions { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.btn-live {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 24px;
  background: var(--purple); color: var(--on-accent);
  font-size: 15px; font-weight: 600; border-radius: var(--radius-btn);
  transition: background .15s ease;
}
.btn-live .ico { width: 16px; height: 16px; }
.btn-live:hover { background: var(--purple-hover); }
.btn-live:disabled { background: var(--bg-tile); color: var(--text-muted); cursor: default; }
.live-ghost { font-size: 13px; font-weight: 500; color: var(--purple-light); }
.live-ghost:hover { text-decoration: underline; }
.live-caption { margin-top: 8px; font-size: 11px; color: var(--text-gray); }

/* ---------- Секции «Дальше» / «Прошедшие» ---------- */
.live-section { margin-top: 16px; }
.live-h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: 18px; color: var(--ink); margin-bottom: 8px;
}
.live-card {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 8px 16px;
}
.live-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  column-gap: 16px; row-gap: 2px;
  align-items: center;
  padding: 10px 8px;
  border-radius: var(--radius-tile);
  transition: background .15s ease;
}
.live-row + .live-row { border-top: 1px solid var(--border); }
.live-row:hover { background: var(--bg-tile); }
.live-date-tile {
  grid-row: 1 / span 2;
  width: 48px; height: 48px; border-radius: var(--radius-tile);
  background: var(--bg-tile);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
}
.live-dow { font-size: 11px; line-height: 1; color: var(--text-muted); }
.live-dnum { font-size: 15px; font-weight: 600; line-height: 1.1; color: var(--ink); }
.live-info { min-width: 0; }
.live-topic-sm { display: block; font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--ink); }
.live-sub { display: block; margin-top: 2px; font-size: 12px; color: var(--text-muted); }
.live-time { font-size: 13px; font-weight: 600; color: var(--text-body); white-space: nowrap; }

.live-row.past { grid-template-columns: 48px minmax(0, 1fr) auto auto; }
.live-row.past .live-dnum { color: var(--text-muted); }
.live-row.past .live-topic-sm { font-weight: 500; color: var(--text-gray); }
.live-row.past .live-time { font-weight: 400; color: var(--text-muted); }
.live-open { font-size: 13px; font-weight: 500; color: var(--purple-light); white-space: nowrap; }
.live-open:hover { text-decoration: underline; }

.live-more {
  display: inline-flex; align-items: center;
  margin-top: 8px; padding: 2px 0;
  font-size: 13px; font-weight: 500; color: var(--purple-light);
}
.live-more:hover { text-decoration: underline; }

/* ---------- Пустое состояние ---------- */
.live-empty {
  background: var(--bg-tile);
  border-radius: var(--radius-card);
  padding: 24px;
  font-size: 13px;
  color: var(--text-muted);
}

/* focus-visible по спеке Live Lessons */
#content-live a:focus-visible,
#content-live button:focus-visible { box-shadow: 0 0 0 2px rgba(124,58,237,.35); }

/* ---------- Адаптив Live Lessons ---------- */
@media (max-width: 720px) {
  .live-hero { padding: 16px; }
  .live-people { display: none; }
  .live-actions { flex-direction: column; align-items: stretch; gap: 12px; }
  .btn-live { width: 100%; height: 44px; }
  .live-ghost { text-align: center; }
  .live-row { grid-template-columns: 40px minmax(0, 1fr) auto; column-gap: 12px; }
  .live-date-tile { width: 40px; height: 40px; border-radius: 10px; }
  .live-time { grid-column: 2; grid-row: 2; }
  .live-row.past { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .live-row.past .live-time { grid-column: 2; grid-row: 2; }
  .live-row.past .live-open { grid-column: 3; grid-row: 1 / span 2; }
}

/* =========================================================================
   Progress (спека GLM, 29.11.2026)
   ========================================================================= */
#content-progress { padding-bottom: 24px; }
.progress-pagehead { margin-bottom: 24px; }

/* ---------- Баллы · Серия · Звание ---------- */
.progress-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.pstat {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
}
.pstat-top { display: flex; align-items: center; gap: 10px; }
.pstat-icon {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  color: var(--on-accent);
}
.pstat-icon .ico { width: 20px; height: 20px; }
.pstat-icon.purple { background: var(--purple); }
.pstat-icon.yellow { background: var(--yellow); }
.pstat-icon.lavender { background: var(--lavender); }
.pstat-label { font-size: 15px; font-weight: 500; color: var(--text-body); }
.pstat-value {
  margin-top: 12px;
  font-family: var(--font-display); font-weight: 700;
  font-size: 28px; line-height: 1.1; color: var(--ink);
}
.pstat-value.sm { font-size: 18px; }
.pstat-caption { margin-top: 4px; font-size: 12px; color: var(--text-gray); }
.pstat-trend { color: var(--purple-light); }
.pstat-track { margin-top: 8px; }
.pstat-track .track { height: 6px; }

/* ---------- Секции ---------- */
.progress-section { margin-top: 16px; }
.progress-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 8px;
}
.progress-head h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: 18px; color: var(--ink);
}
.progress-sub { margin: -2px 0 8px; font-size: 12px; color: var(--text-muted); }
.progress-note { font-size: 12px; color: var(--text-muted); text-align: right; }

/* ---------- Достижения ---------- */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ach {
  background: var(--bg-tile);
  border-radius: var(--radius-tile);
  padding: 16px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 8px;
}
.ach-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.ach-icon .ico { width: 20px; height: 20px; }
.ach.open .ach-icon { background: var(--purple); color: var(--on-accent); }
.ach.closed .ach-icon { background: var(--track); color: var(--text-muted); }
.ach.closed .ach-icon .ico { width: 18px; height: 18px; }
.ach-name { font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--ink); }
.ach.closed .ach-name { color: var(--text-gray); }
.ach-cond { font-size: 11px; line-height: 1.35; color: var(--text-muted); }

/* ---------- I can… ---------- */
.ican-card {
  padding: 16px;
  display: grid; grid-template-columns: 1fr; gap: 16px;
}
.ican-group { min-width: 0; }
.ican-group-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 4px;
}
.ican-kicker { font-size: 12px; color: var(--text-muted); }
.ican-count { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.ican-list { display: flex; flex-direction: column; gap: 2px; }
.ican-list li { padding: 5px 0; }

/* ---------- Активность ---------- */
.activity-chart {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; height: 145px; padding: 0 4px;
}
.activity-col {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 6px; height: 100%; flex: 1; min-width: 0;
}
.activity-bar { width: 26px; border-radius: var(--radius-full); background: var(--purple-light); flex: 0 0 auto; }
.activity-col.current .activity-bar { background: var(--purple); }
.activity-week { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ---------- Пустые состояния ---------- */
.progress-empty-view { display: flex; flex-direction: column; gap: 12px; }
.progress-empty {
  background: var(--bg-tile);
  border-radius: var(--radius-tile);
  padding: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

/* focus-visible по спеке */
#content-progress a:focus-visible,
#content-progress button:focus-visible { box-shadow: 0 0 0 2px rgba(124,58,237,.35); }

/* ---------- Адаптив Progress ---------- */
@media (max-width: 1080px) {
  .ican-card { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .progress-stats { grid-template-columns: 1fr; gap: 12px; }
  .ach-grid { grid-template-columns: 1fr 1fr; }
  .ican-card { grid-template-columns: 1fr; }
  .activity-chart { gap: 8px; }
  .activity-bar { width: 20px; }
  .progress-head { flex-wrap: wrap; row-gap: 2px; }
  .progress-note { font-size: 11px; }
}

/* =========================================================================
   Library (спека GLM, 29.11.2026)
   ========================================================================= */
.layout.library { display: block; }
.layout.library .content { max-width: 760px; margin: 0 auto; }
#content-library { padding-bottom: 40px; }
.library-pagehead { margin-bottom: 24px; }

/* ---------- Табы разделов ---------- */
.lib-tabs { display: flex; gap: 8px; }
.lib-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-full);
  font-size: 14px; font-weight: 600; color: var(--text-body);
  transition: background .15s ease, color .15s ease;
}
.lib-tab:hover { background: var(--bg-tile); }
.lib-tab.is-active { background: var(--ink); color: var(--on-accent); }
.lib-tab-count { font-size: 13px; opacity: .65; font-weight: 600; }

/* ---------- Поиск ---------- */
.lib-search { position: relative; margin-top: 16px; }
.lib-input {
  width: 100%; height: 44px; border-radius: var(--radius-full);
  border: 1px solid var(--border); background: var(--bg-page);
  padding: 0 40px 0 44px;
  font-family: var(--font-body); font-size: 14px; color: var(--ink);
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.lib-input::placeholder { color: var(--text-muted); }
.lib-input:focus { border-color: var(--purple-light); box-shadow: 0 0 0 3px rgba(139,92,246,.15); }
.lib-search-ico {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-muted); pointer-events: none;
}
.lib-clear {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; color: var(--text-muted);
}
.lib-clear .ico { width: 16px; height: 16px; }
.lib-clear:hover { color: var(--ink); }

/* ---------- Фильтры Модуль → Урок ---------- */
.lib-filters { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.lib-filter-line { display: flex; align-items: center; gap: 8px; }
.lib-chips {
  display: flex; gap: 8px; min-width: 0; flex: 1;
  overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
}
.lib-chips::-webkit-scrollbar { display: none; }
.lib-chip {
  flex: 0 0 auto; padding: 6px 12px; border-radius: var(--radius-full);
  border: 1px solid var(--border); background: var(--bg-page);
  font-size: 12px; font-weight: 500; color: var(--text-body);
  white-space: nowrap; transition: background .15s ease;
}
.lib-chip:hover { background: var(--bg-tile); }
.lib-chip.is-active { background: var(--lilac-bg); color: var(--purple); border-color: transparent; }
.lib-reset {
  flex: 0 0 auto; padding: 6px 2px;
  font-size: 13px; font-weight: 500; color: var(--purple-light);
}
.lib-reset:hover { text-decoration: underline; }

/* ---------- Строка результата ---------- */
.lib-found { margin-top: 12px; font-size: 13px; color: var(--text-gray); }

/* ---------- Список ---------- */
.lib-list { margin-top: 12px; }
.lib-row {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 8px; border-radius: var(--radius-tile);
  border-bottom: 1px solid var(--border);
  transition: background .15s ease;
}
.lib-row:last-child { border-bottom: 0; }
.lib-row:hover { background: var(--bg-tile); }
.lib-body { flex: 1 1 auto; min-width: 0; }
.lib-line1 { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }

/* Слова */
.lib-word .lib-body { padding-right: 64px; }
.lib-en { font-size: 15px; font-weight: 600; color: var(--ink); }
.lib-ipa { font-size: 13px; color: var(--text-muted); }
.lib-ru { margin-top: 2px; font-size: 13px; color: var(--text-body); }
.lib-example { margin-top: 2px; font-size: 12px; font-style: italic; color: var(--text-muted); }

/* Фразы */
.lib-num {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid var(--border); display: grid; place-items: center;
  font-size: 11px; color: var(--text-muted); margin-top: 1px;
}
.lib-phrase .lib-body { padding-right: 64px; }
.lib-phrase .lib-ru { color: var(--text-gray); }

/* Аудио */
.lib-audio-title { font-size: 14px; font-weight: 500; color: var(--ink); }
.lib-audio-sub { margin-top: 2px; font-size: 12px; color: var(--text-muted); }
.lib-dur { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.lib-track {
  margin-top: 8px; height: 2px; border-radius: var(--radius-full);
  background: var(--track); overflow: hidden; opacity: 0; transition: opacity .15s ease;
}
.lib-track span { display: block; height: 100%; width: 0; background: var(--purple-light); }
.lib-row.lib-audio.is-playing { background: var(--bg-tile); }
.lib-row.lib-audio.is-playing .lib-track,
.lib-row.lib-audio.is-paused .lib-track { opacity: 1; }
.lib-audio .lib-dur { flex-shrink: 0; align-self: flex-start; margin-top: 2px; }
.lib-audio .lib-tag { margin-left: auto; }

/* Тег урока */
.lib-tag {
  padding: 4px 12px; border-radius: var(--radius-full);
  background: var(--lilac-bg); color: var(--purple);
  font-size: 11px; font-weight: 600; white-space: nowrap;
  transition: background .15s ease;
}
.lib-tag:hover { background: var(--lilac-hover); }
.lib-word .lib-tag { position: absolute; top: 12px; right: 8px; }
.lib-phrase .lib-tag { position: absolute; top: 12px; right: 8px; }

/* ---------- Пустые состояния ---------- */
.lib-empty {
  margin-top: 12px; background: var(--bg-tile); border-radius: var(--radius-card);
  padding: 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted);
}
.lib-empty .ico { width: 24px; height: 24px; color: var(--text-muted); }
.lib-empty-title { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); }
.lib-empty-sub { font-size: 13px; color: var(--text-gray); }
.lib-empty .lib-reset { margin-top: 4px; }

/* ---------- focus-visible (по спеке Library) ---------- */
#content-library .lib-tab:focus-visible,
#content-library .lib-chip:focus-visible,
#content-library .lib-clear:focus-visible,
#content-library .lib-reset:focus-visible,
#content-library .lib-tag:focus-visible,
#content-library .lib-row:focus-visible,
#content-library .play-btn:focus-visible { box-shadow: 0 0 0 2px rgba(139,92,246,.35); }

/* ---------- Адаптив Library ---------- */
@media (max-width: 1080px) {
  .lib-word .lib-body { padding-right: 72px; }
}
@media (max-width: 720px) {
  .lib-tabs { gap: 6px; }
  .lib-tab { flex: 1; justify-content: center; padding: 8px 10px; }
  .lib-word .lib-body,
  .lib-phrase .lib-body { padding-right: 0; }
  .lib-word .lib-tag,
  .lib-phrase .lib-tag { position: static; margin: 8px 0 0; }
  .lib-audio .lib-tag { margin-left: 0; }
  .lib-row.lib-audio { flex-wrap: wrap; }
}

/* =========================================================================
   Dual-label (вариант В): EN-имя + всегда видимая короткая RU-подпись.
   Для курса «с нуля»: английское название + ясность «что есть что».
   Не меняет дизайн-систему; только содержимое меток.
   ========================================================================= */
/* ---------- Навигация ---------- */
.mainnav a {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 13px;
}
.mainnav .nav-en { font-size: 13px; font-weight: 500; line-height: 1.2; }
.mainnav .nav-ru { font-size: 10px; font-weight: 500; line-height: 1.2; opacity: .72; white-space: nowrap; }
.mainnav a.active .nav-ru { opacity: .85; }
@media (max-width: 1239px) {
  .mainnav a { align-items: flex-start; text-align: left; padding: 12px 14px; }
}

/* ---------- Library ---------- */
.lib-name-ru { margin-top: 4px; }
.lib-tab-ru { font-size: 11px; font-weight: 500; opacity: .8; }
.lib-tab.is-active .lib-tab-ru { opacity: .9; }

/* dual-label: не даём табам вылезать за ширину, равные пилюли на мобильном */
.lib-tab { min-width: 0; }
.lib-tab > span { min-width: 0; }
@media (max-width: 720px) { .lib-tab { flex-wrap: wrap; } }

/* =========================================================================
   Buddy — диалог-тренажёр «диалог с компьютером» (спека GLM v2, 30.11.2026)
   ========================================================================= */

.layout.buddy { display: block; }
.layout.buddy .content { max-width: 720px; margin: 0 auto; }

.buddy-pagehead { margin-bottom: 24px; }

/* панель занятия */
.buddy-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.buddy-select {
  height: 44px; border: 1px solid var(--border); border-radius: var(--radius-input);
  background: var(--bg-page); padding: 0 12px; min-width: 240px; max-width: 100%;
  font-family: var(--font-body); font-size: 14px; color: var(--text-body);
  outline: none; cursor: pointer;
}
.buddy-select:focus { border-color: var(--purple); box-shadow: 0 0 0 3px var(--lilac-bg); }
.buddy-direction { display: flex; gap: 8px; }
.buddy-chip {
  padding: 6px 14px; border-radius: var(--radius-full);
  border: 1px solid var(--border); background: var(--bg-page);
  font-size: 12px; font-weight: 500; color: var(--text-body);
  cursor: pointer; white-space: nowrap; transition: background .15s ease;
}
.buddy-chip:hover { background: var(--bg-tile); }
.buddy-chip.is-active { background: var(--lilac-bg); color: var(--purple); border-color: transparent; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 16px; border-radius: var(--radius-btn);
  border: 1px solid var(--border); background: transparent;
  font-family: var(--font-body); font-size: 14px; font-weight: 600; color: var(--ink);
  cursor: pointer; transition: background .15s ease;
}
.btn-ghost:hover { background: var(--bg-tile); }
.btn-ghost .ico { width: 16px; height: 16px; }
.btn-lilac {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 20px; border-radius: var(--radius-btn); border: none;
  background: var(--lilac-bg); color: var(--purple);
  font-family: var(--font-body); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s ease;
}
.btn-lilac:hover { background: var(--lilac-hover); }

.buddy-voice { flex-basis: 100%; }
.buddy-voice summary {
  font-size: 12px; color: var(--text-muted); cursor: pointer; user-select: none;
  list-style: none; display: inline-flex; align-items: center; gap: 4px;
}
.buddy-voice summary::-webkit-details-marker { display: none; }
.buddy-voice summary::before { content: "›"; font-size: 14px; transition: transform .15s ease; }
.buddy-voice[open] summary::before { transform: rotate(90deg); }
.buddy-voice .buddy-select { width: 100%; min-width: 0; }
.buddy-voice-row { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.buddy-voice-row .buddy-select { flex: 1; min-width: 0; }
.buddy-voice-test { flex-shrink: 0; }
.buddy-voice-caption { margin-top: 6px; font-size: 12px; color: var(--text-muted); }

/* табы режимов */
.buddy-tabs { display: flex; gap: 8px; margin-top: 16px; }
.buddy-tab {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; border-radius: var(--radius-full); border: none; background: none;
  font-size: 14px; font-weight: 600; color: var(--text-body); cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.buddy-tab:hover { background: var(--bg-tile); }
.buddy-tab.is-active { background: var(--ink); color: var(--on-accent); }

/* область */
.buddy-stage { margin-top: 16px; }
.buddy-card { background: var(--bg-page); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px; }

/* диалог */
.buddy-goal { font-size: 13px; color: var(--text-gray); margin-bottom: 8px; }
.buddy-hint { text-align: center; font-size: 12px; color: var(--text-gray); margin-bottom: 12px; }
.buddy-chat { display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow-y: auto; }
.bubble-row { display: flex; align-items: flex-end; gap: 8px; }
.bubble-row.user { justify-content: flex-end; }
.bubble-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
}
.bubble-avatar.buddy { background: var(--purple); color: var(--on-accent); }
.bubble-avatar.user { background: var(--avatar-gray); color: var(--text-body); }
.bubble-avatar .ico { width: 16px; height: 16px; }
.bubble {
  max-width: 75%; padding: 10px 14px; border-radius: 14px;
  font-size: 15px; line-height: 1.4; color: var(--ink);
}
.bubble.buddy { background: var(--lilac-bg); border-bottom-left-radius: 4px; }
.bubble.user { background: var(--bg-tile); border-bottom-right-radius: 4px; }
.buddy-speak {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; color: var(--text-muted);
}
.buddy-speak .ico { width: 16px; height: 16px; }
.buddy-speak:hover { color: var(--purple); }
.bubble-reaction {
  font-size: 13px; font-style: italic; color: var(--text-gray);
  margin-left: 36px; line-height: 1.4;
}
.buddy-choices { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.buddy-choice {
  text-align: left; padding: 12px 16px; border-radius: var(--radius-tile);
  border: 1px solid var(--border); background: var(--bg-tile);
  font-size: 15px; font-weight: 500; color: var(--ink); cursor: pointer;
  transition: background .15s ease;
}
.buddy-choice:hover:not(:disabled) { background: #F1F2F6; }
.buddy-choice:disabled { opacity: .55; cursor: default; }
.buddy-choice.is-correct { border-color: var(--purple-light); background: var(--lilac-bg); }
.buddy-choice.is-wrong { opacity: .55; }
.buddy-finished { margin-top: 12px; display: flex; justify-content: center; }

/* тренажёр: карточки и тест */
.buddy-progress { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.buddy-score { font-size: 12px; color: var(--text-muted); text-align: right; margin-bottom: 8px; }
.buddy-flashcard {
  background: var(--bg-tile); border-radius: var(--radius-card);
  padding: 32px; min-height: 180px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; cursor: pointer;
}
.fc-word { font-size: 18px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.fc-sub { margin-top: 10px; font-size: 13px; color: var(--text-gray); }
.fc-tap { margin-top: 12px; font-size: 13px; color: var(--text-muted); }
.buddy-card-actions { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }
.buddy-play {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--purple); color: var(--on-accent);
  display: grid; place-items: center;
}
.buddy-play .ico { width: 16px; height: 16px; }
.buddy-play:hover { background: var(--purple-hover); }
.buddy-empty {
  background: var(--bg-tile); border-radius: var(--radius-tile);
  padding: 16px; text-align: center; font-size: 13px; color: var(--text-muted);
}
.quiz-ask { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.quiz-phrase { font-size: 18px; font-weight: 600; color: var(--ink); margin-bottom: 12px; line-height: 1.4; }
.buddy-result { text-align: center; padding: 24px 16px; }
.buddy-result-title { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); }
.buddy-result-sub { margin: 6px 0 16px; font-size: 13px; color: var(--text-muted); }

/* focus */
#content-buddy .buddy-tab:focus-visible,
#content-buddy .buddy-chip:focus-visible,
#content-buddy .buddy-choice:focus-visible,
#content-buddy .btn-ghost:focus-visible,
#content-buddy .btn-lilac:focus-visible,
#content-buddy .buddy-speak:focus-visible,
#content-buddy .buddy-play:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(139,92,246,.35); }

/* адаптив */
@media (max-width: 720px) {
  .buddy-panel { flex-direction: column; align-items: stretch; }
  .buddy-select { width: 100%; min-width: 0; }
  .buddy-direction { width: 100%; }
  .buddy-chip { flex: 1; justify-content: center; }
  .buddy-restart { width: 100%; justify-content: center; }
  .buddy-pagehead h1 { font-size: 28px; }
  .buddy-card { padding: 12px; }
  .bubble { max-width: 85%; }
}

/* =========================================================================
   Tests — контрольные тестирования (SPEC-TESTS.md, 30.11.2026)
   ========================================================================= */
.layout.tests { display: block; }
.layout.tests .content { max-width: 860px; margin: 0 auto; }
.layout.settings { display: block; }
.layout.settings .content { max-width: 680px; margin: 0 auto; }
.tests-pagehead { margin-bottom: 24px; }

/* сводка */
.tests-summary {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 12px;
  font-size: 13px; color: var(--text-gray);
}
.tests-summary b { color: var(--ink); }
.tests-note { font-size: 12px; color: var(--text-muted); }

/* список */
.tests-list { display: flex; flex-direction: column; gap: 10px; }
.test-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-card);
  background: var(--bg-page);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.test-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-hover); }
.test-card.is-locked { background: var(--bg-tile); }
.test-card.is-locked:hover { border-color: var(--border); box-shadow: none; }
.test-card.is-final { background: var(--lilac-bg); border-color: transparent; }

.test-num {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-tile); color: var(--ink);
  font-size: 15px; font-weight: 700;
}
.test-card.is-passed .test-num { background: var(--purple); color: var(--on-accent); }
.test-card.is-final .test-num { background: var(--purple); color: var(--on-accent); }
.test-num .ico { width: 20px; height: 20px; }

.test-info { flex: 1 1 auto; min-width: 0; }
.test-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.test-sub { margin-top: 2px; font-size: 12px; color: var(--text-muted); }
.test-side {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
}
.test-card.is-locked .test-side { opacity: .7; }
.test-side .btn-small[disabled] { cursor: default; opacity: .55; background: var(--track); color: var(--text-muted); }

/* прохождение */
.test-back { margin-bottom: 4px; }
.test-stage {
  padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-card);
  background: var(--bg-page);
}
.test-run-top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 10px;
}
.test-run-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.test-run-meta { font-size: 12px; color: var(--text-muted); }
.test-stage .track { margin-bottom: 24px; }

.test-question { text-align: center; padding: 12px 0 20px; }
.test-q-dir { font-size: 12px; color: var(--text-muted); }
.test-q-word {
  margin-top: 6px;
  font-family: var(--font-display); font-weight: 700;
  font-size: var(--fs-display); line-height: 1.2; color: var(--ink);
  overflow-wrap: anywhere;
}
.test-q-sentence {
  margin-top: 6px; font-size: 20px; font-weight: 600; line-height: 1.5;
  color: var(--ink); overflow-wrap: anywhere;
}
.test-blank { color: var(--purple); border-bottom: 2px solid var(--purple); padding: 0 8px; }
.test-q-text {
  margin-top: 6px; font-size: 20px; font-weight: 600; line-height: 1.45;
  color: var(--ink); overflow-wrap: anywhere;
}
.test-question-reading { padding-top: 4px; }
.test-reading {
  padding: 16px; margin-bottom: 20px;
  background: var(--bg-tile); border-radius: var(--radius-tile);
}
.test-reading-title {
  margin-bottom: 6px;
  font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--ink);
}
.test-reading p { margin: 0; font-size: 13px; line-height: 1.65; color: var(--text-body); }

/* аудирование */
.test-listen {
  padding: 16px; margin-bottom: 20px;
  background: var(--bg-tile); border-radius: var(--radius-tile);
}
.test-listen-main { display: flex; align-items: center; gap: 12px; }
.test-listen-ico {
  flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: var(--radius-full); background: var(--lilac-bg); color: var(--purple);
}
.test-listen-ico .ico { width: 18px; height: 18px; }
.test-listen-info { flex: 1 1 auto; min-width: 0; }
.test-listen-title {
  font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--ink);
}
.test-listen-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.test-audio-play .ico { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }
.test-audio-toggle {
  margin-top: 12px; padding: 0; border: 0; background: none;
  font-size: 12px; color: var(--purple); text-decoration: underline;
  cursor: pointer;
}
.test-audio-script {
  margin-top: 10px; padding: 12px 14px;
  background: var(--bg-page); border-radius: var(--radius-tile);
  font-size: 13px; line-height: 1.65; color: var(--text-body);
}

/* ввод перевода */
.test-input,
.test-textarea {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-input);
  padding: 12px 14px; background: var(--bg-page);
  font-family: var(--font-body); font-size: 15px; color: var(--ink);
}
.test-input { height: 48px; }
.test-textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.test-input:focus,
.test-textarea:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--lilac-bg); }
.test-input:disabled { background: var(--bg-tile); color: var(--text-gray); }

/* сборка фразы */
.test-build-answer {
  display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start;
  min-height: 54px; padding: 10px;
  border: 1px dashed var(--border); border-radius: var(--radius-tile);
}
.test-build-empty { padding: 4px 2px; font-size: 13px; color: var(--text-muted); }
.test-build-bank { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.test-word {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-full);
  background: var(--bg-page); font-size: 13px; color: var(--text-body);
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.test-word:hover:not(:disabled) { background: var(--bg-tile); border-color: var(--border-hover); }
.test-word.is-used { opacity: .3; }
.test-word-picked { background: var(--lilac-bg); border-color: transparent; color: var(--purple); font-weight: 600; }
.test-word:disabled { cursor: default; }

/* рассказ о себе */
.test-hints { margin: 0 0 12px; padding-left: 18px; font-size: 13px; color: var(--text-gray); }
.test-hints li { margin: 2px 0; }
.test-model {
  margin-top: 10px; padding: 12px 14px;
  background: var(--lilac-bg); border-radius: var(--radius-tile);
  font-size: 13px; line-height: 1.55; color: var(--text-body);
}
.test-note { margin: 8px 0 0; font-size: 12px; color: var(--text-muted); }

.test-options { display: flex; flex-direction: column; gap: 8px; }
.test-option {
  width: 100%; min-height: 46px; padding: 10px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-btn);
  background: var(--bg-page); color: var(--text-body);
  font-size: 14px; text-align: left;
  transition: background .15s ease, border-color .15s ease;
}
.test-option:hover:not(:disabled) { background: var(--bg-tile); border-color: var(--border-hover); }
.test-option.is-correct { background: var(--lilac-bg); border-color: var(--purple); color: var(--purple); font-weight: 600; }
.test-option.is-wrong { background: var(--yellow-bg); border-color: var(--yellow); color: var(--yellow-dark); font-weight: 600; }
.test-option.is-dim { opacity: .5; }
.test-option:disabled { cursor: default; }

.test-feedback {
  display: flex; align-items: center; gap: 8px;
  min-height: 24px; margin-top: 12px; font-size: 13px;
}
.test-feedback.ok { color: var(--purple); }
.test-feedback.bad { color: var(--yellow-dark); }
.test-feedback .ico { width: 16px; height: 16px; }

.test-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.test-actions .btn { min-width: 140px; }

/* результат */
.test-result { text-align: center; padding: 32px 24px; }
.test-result-ring {
  width: 132px; height: 132px; margin: 0 auto 16px; border-radius: 50%;
  border: 6px solid var(--lilac-bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.test-result.ok .test-result-ring { border-color: var(--purple); }
.test-result.bad .test-result-ring { border-color: var(--yellow); }
.test-result-score { font-family: var(--font-display); font-weight: 700; font-size: 30px; color: var(--ink); line-height: 1.1; }
.test-result-percent { font-size: 12px; color: var(--text-muted); }
.test-result-title { font-family: var(--font-display); font-size: 22px; color: var(--ink); }
.test-result-sub { margin-top: 4px; font-size: 13px; color: var(--text-gray); }
.test-points-earned { margin-top: 12px; font-size: 14px; font-weight: 600; color: var(--purple); }
.test-points-earned.muted { color: var(--text-muted); font-weight: 500; }
.test-result .test-actions { justify-content: center; }

/* строка теста в конце модуля (Course View) */
.module-test {
  display: flex; align-items: center; gap: 10px;
  margin-top: 8px; padding: 12px 14px;
  border: 1px dashed var(--border); border-radius: var(--radius-tile);
  background: var(--bg-tile);
  transition: border-color .15s ease, background .15s ease;
}
a.module-test:hover { border-color: var(--purple-light); background: var(--lilac-bg); }
.module-test .mt-ico { display: grid; place-items: center; color: var(--purple); }
.module-test .mt-ico .ico { width: 18px; height: 18px; }
.mt-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.mt-points {
  padding: 2px 8px; border-radius: var(--radius-full);
  background: var(--lilac-bg); color: var(--purple);
  font-size: 11px; font-weight: 700;
}
.mt-status { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.module-test.mt-passed .mt-ico { color: var(--purple-light); }
.module-test.mt-locked { opacity: .6; }

/* focus */
#content-tests .test-option:focus-visible,
#content-tests .btn:focus-visible,
#content-tests .btn-small:focus-visible,
#content-tests .back-link:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(139,92,246,.35); }

/* адаптив */
@media (max-width: 720px) {
  .tests-pagehead h1 { font-size: 28px; }
  .test-card { flex-wrap: wrap; gap: 12px; padding: 14px; }
  .test-info { flex: 1 1 calc(100% - 56px); }
  .test-side { width: 100%; justify-content: space-between; padding-left: 56px; }
  .test-stage { padding: 18px 14px; }
  .test-q-word { font-size: 28px; }
  .test-q-sentence,
  .test-q-text { font-size: 17px; }
  .test-reading { padding: 14px; }
  .test-listen-main { flex-wrap: wrap; }
  .test-listen-info { flex: 1 1 100%; }
  .test-actions .btn { flex: 1 1 auto; }
  .module-test { flex-wrap: wrap; }
  .mt-status { width: 100%; margin-left: 28px; }
}

/* =========================================================================
   Progress: блок «Как начисляются баллы» (SPEC-TESTS.md §6)
   ========================================================================= */
.points-rules {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.points-rule {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-tile);
  background: var(--bg-tile);
  font-size: 13px; color: var(--text-body);
}
.points-rule.is-key { background: var(--lilac-bg); color: var(--purple); font-weight: 600; }
.points-val { font-weight: 700; color: var(--ink); white-space: nowrap; }
.points-rule.is-key .points-val { color: var(--purple); }
.points-ranks { margin-top: 12px; font-size: 12px; color: var(--text-muted); }

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

/* =========================================================================
   Settings (SPEC-SETTINGS.md)
   ========================================================================= */
.avatar-64 { width: 64px; height: 64px; font-size: 22px; }

.settings-pagehead { margin-bottom: 24px; }
.settings-card { margin-bottom: 16px; padding: var(--space-5); }
.settings-card .card-head { margin-bottom: 16px; }

.settings-profile { display: flex; align-items: center; gap: 16px; }
.settings-profile-info { flex: 1 1 auto; min-width: 0; }
.settings-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.settings-name-input {
  flex: 1 1 200px; max-width: 280px;
  height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-input);
  font-family: var(--font-body); font-size: var(--fs-body); font-weight: 600; color: var(--ink);
  background: var(--bg-page);
}
.settings-name-input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--lilac-bg); }
.settings-profile-sub { margin-top: 6px; font-size: 13px; color: var(--text-gray); }

.settings-rows { display: flex; flex-direction: column; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--divider);
}
.settings-row:first-child { padding-top: 0; }
.settings-row:last-child { border-bottom: 0; padding-bottom: 0; }
.settings-row-info { min-width: 0; }
.settings-row-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.settings-row-desc { margin-top: 2px; font-size: 12px; color: var(--text-muted); }

/* switch */
.switch {
  flex: 0 0 auto; position: relative; width: 46px; height: 26px;
  border: none; border-radius: var(--radius-full); cursor: pointer;
  background: var(--track); transition: background .15s ease;
}
.switch .switch-knob {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--bg-page);
  box-shadow: 0 1px 2px rgba(16,16,20,.2);
  transition: transform .15s ease;
}
.switch[aria-checked="true"] { background: var(--purple); }
.switch[aria-checked="true"] .switch-knob { transform: translateX(20px); }
.switch:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--lilac-bg); }

/* озвучка */
.settings-voice-row { display: flex; align-items: flex-end; gap: 12px; }
.settings-field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-width: 0; }
.settings-label { font-size: 12px; font-weight: 600; color: var(--text-gray); }
.settings-select {
  height: 42px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-input);
  font-family: var(--font-body); font-size: 14px; color: var(--ink); background: var(--bg-page);
}
.settings-select:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--lilac-bg); }
.settings-speak { flex: 0 0 auto; }
.settings-rate-field { margin-top: 16px; }
.settings-rate-row { display: flex; align-items: center; gap: 14px; }
.settings-rate-row input[type="range"] { flex: 1 1 auto; accent-color: var(--purple); }
.settings-rate-val { flex: 0 0 auto; width: 46px; text-align: right; font-size: 13px; font-weight: 600; color: var(--ink); }
.settings-note { font-size: 12px; color: var(--text-muted); }

.settings-danger { color: #B42318; }
.settings-danger:hover { background: #FEF3F2; }

.settings-foot { margin-top: 24px; text-align: center; font-size: 12px; color: var(--text-muted); }

@media (max-width: 720px) {
  .settings-pagehead h1 { font-size: 28px; }
  .settings-profile { align-items: flex-start; }
  .settings-name-row { align-items: flex-start; flex-direction: column; }
  .settings-name-input { max-width: none; width: 100%; }
  .settings-voice-row { flex-wrap: wrap; }
  .settings-speak { width: 100%; }
  .settings-row { align-items: flex-start; }
  .settings-row .btn { flex: 0 0 auto; }
}

/* =========================================================================
   Materials — допматериалы (SPEC-MATERIALS.md)
   ========================================================================= */
.materials { margin-top: 28px; }
.materials-card .card-head { align-items: baseline; gap: 10px; }
.mat-head-note { font-size: 12px; color: var(--text-muted); }

.mat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px;
}
.mat-card {
  display: flex; flex-direction: column; overflow: hidden; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-card);
  background: var(--bg-page); transition: box-shadow .15s ease, border-color .15s ease;
}
.mat-card:hover { box-shadow: var(--shadow-hover); border-color: var(--border-hover); }
.mat-card:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--lilac-bg); }
.mat-thumb {
  position: relative; height: 132px;
  background-size: cover; background-position: center;
  display: grid; place-items: center;
}
.mat-play {
  width: 48px; height: 48px; display: grid; place-items: center;
  border-radius: var(--radius-full); background: rgba(255,255,255,.92); color: var(--purple);
  box-shadow: 0 2px 8px rgba(16,16,20,.18);
}
.mat-play .ico { width: 20px; height: 20px; }
.mat-dur {
  position: absolute; right: 10px; bottom: 10px; padding: 3px 8px;
  border-radius: var(--radius-full); background: rgba(16,16,20,.72); color: #fff;
  font-size: 11px; font-weight: 600;
}
.mat-body { display: flex; flex-direction: column; gap: 6px; padding: 14px; flex: 1 1 auto; }
.mat-tags { display: flex; gap: 6px; }
.mat-topic, .mat-module {
  padding: 3px 8px; border-radius: var(--radius-full); font-size: 11px; font-weight: 600;
}
.mat-topic { background: var(--lilac-bg); color: var(--purple); }
.mat-module { background: var(--track); color: var(--text-gray); }
.mat-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--ink); line-height: 1.3; }
.mat-desc { font-size: 12px; line-height: 1.5; color: var(--text-gray); }
.mat-foot {
  margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--divider);
}
.mat-status { font-size: 11px; font-weight: 600; }
.mat-status.is-new { color: var(--purple); }
.mat-status.is-watched { color: var(--text-gray); }
.mat-status.is-done { color: var(--text-muted); }
.mat-action { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--purple); }
.mat-action .ico { width: 14px; height: 14px; }

/* модал */
.modal-open { overflow: hidden; }
.mat-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.mat-modal-backdrop { position: absolute; inset: 0; background: rgba(16,16,20,.44); }
.mat-modal-panel {
  position: relative; z-index: 1; width: 100%; max-width: 640px; max-height: 90vh; overflow: auto;
  background: var(--bg-page); border-radius: var(--radius-card); padding: 24px;
  box-shadow: 0 20px 60px rgba(16,16,20,.24);
}
.mat-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--bg-page);
  cursor: pointer; color: var(--text-gray);
}
.mat-close:hover { border-color: var(--border-hover); color: var(--ink); }
.mat-close .ico { width: 16px; height: 16px; }

.mat-head { padding-right: 40px; margin-bottom: 16px; }
.mat-head-title { margin: 10px 0 4px; font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--ink); }
.mat-head-desc { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-gray); }
.mat-video { position: relative; border-radius: var(--radius-tile); overflow: hidden; background: #101014; aspect-ratio: 16/9; }
.mat-video video { width: 100%; height: 100%; display: block; object-fit: contain; }
.mat-hint { margin-top: 12px; font-size: 12px; color: var(--text-muted); }
.mat-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.mat-quiz-note { margin-top: 10px; font-size: 12px; color: var(--text-muted); }

.mat-quiz-head { padding-right: 0; }
.mat-quiz-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.mat-quiz-head .track { margin-top: 10px; }
.mat-q-text { font-size: 18px; font-weight: 600; color: var(--ink); line-height: 1.4; margin-bottom: 14px; }
.mat-q-options { display: flex; flex-direction: column; gap: 8px; }
.mat-option {
  text-align: left; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-tile);
  background: var(--bg-page); font-family: var(--font-body); font-size: 14px; color: var(--text-body);
  cursor: pointer; transition: background .15s ease, border-color .15s ease;
}
.mat-option:hover:not(:disabled) { border-color: var(--border-hover); background: var(--bg-tile); }
.mat-option.is-correct { border-color: var(--purple); background: var(--lilac-bg); color: var(--purple); }
.mat-option.is-wrong { border-color: #F2C41C; background: var(--yellow-bg); color: var(--yellow-dark); }
.mat-option.is-dim { opacity: .55; }
.mat-option:disabled { cursor: default; }
.mat-feedback { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; }
.mat-feedback .ico { width: 16px; height: 16px; }
.mat-feedback.ok { color: var(--purple); }
.mat-feedback.bad { color: var(--yellow-dark); }

.mat-result { text-align: center; padding: 24px 0 8px; }
.mat-result-score { font-family: var(--font-display); font-weight: 700; font-size: 40px; color: var(--ink); }
.mat-result-percent { font-size: 14px; color: var(--text-gray); margin-top: 2px; }
.mat-result-title { margin-top: 8px; font-size: 18px; font-weight: 600; color: var(--ink); }
.mat-points-earned { margin-top: 10px; font-size: 15px; font-weight: 700; color: var(--purple); }
.mat-points-earned.muted { color: var(--text-muted); font-weight: 500; }

/* toast */
.eh-toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 200;
  transform: translateX(-50%) translateY(12px);
  padding: 11px 18px; border-radius: var(--radius-full);
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(16,16,20,.28);
  opacity: 0; transition: opacity .3s ease, transform .3s ease;
}
.eh-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .mat-grid { grid-template-columns: 1fr; }
  .mat-modal-panel { padding: 18px; }
  .mat-head-title { font-size: 19px; }
  .mat-actions .btn { flex: 1 1 auto; }
}

/* =========================================================================
   Teacher Dashboard (SPEC API §4)
   ========================================================================= */
[data-role="student"] .teacher-only { display: none !important; }

.layout.teacher { display: block; }
.layout.teacher .content { max-width: 860px; margin: 0 auto; }

.teacher-pagehead { margin-bottom: 24px; }

.teacher-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px;
}
.tstat {
  padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius-card);
  background: var(--bg-page);
}
.tstat-value { font-family: var(--font-display); font-weight: 700; font-size: 30px; color: var(--ink); }
.tstat-label { font-size: 12px; color: var(--text-gray); margin-top: 2px; }

.teacher-card { margin-bottom: 16px; padding: var(--space-5); }
.teacher-card .card-head { margin-bottom: 16px; }

.teacher-forms { display: flex; flex-direction: column; gap: 16px; }
.teacher-form {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-tile);
  background: var(--bg-tile);
}
.tf-row { display: flex; gap: 12px; flex-wrap: wrap; }
.tf-field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 180px; min-width: 0; }
.tf-label { font-size: 12px; font-weight: 600; color: var(--text-gray); }
.tf-input, .tf-select {
  height: 42px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-input);
  font-family: var(--font-body); font-size: 14px; color: var(--ink); background: var(--bg-page);
}
.tf-select { padding-right: 8px; }
.tf-input:focus, .tf-select:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--lilac-bg); }
.teacher-form .btn { align-self: flex-start; }

.tc-module { padding: 12px 0; border-bottom: 1px solid var(--divider); }
.tc-module:first-child { padding-top: 0; }
.tc-module:last-child { border-bottom: 0; }
.tc-module-title { font-weight: 700; font-size: 15px; color: var(--ink); }
.tc-lesson { display: flex; align-items: center; gap: 8px; padding: 6px 0 6px 16px; font-size: 13px; color: var(--text-body); }
.tc-lesson-empty { color: var(--text-muted); }
.tc-lesson-title::before { content: "·"; color: var(--text-muted); margin-right: 8px; }

.tc-students { display: flex; flex-direction: column; }
.tc-student { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--divider); }
.tc-student:last-child { border-bottom: 0; }
.tc-student-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.tc-student-points { margin-left: auto; font-size: 12px; color: var(--text-gray); }

/* домашки */
.th-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--divider); }
.th-row:last-child { border-bottom: 0; }
.th-info { flex: 1 1 auto; min-width: 0; }
.th-title { font-weight: 600; font-size: 14px; color: var(--ink); }
.th-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.th-subs-title { margin-top: 16px; margin-bottom: 8px; font-weight: 700; font-size: 13px; color: var(--text-gray); }
.th-sub { border: 1px solid var(--border); border-radius: var(--radius-tile); padding: 12px; margin-bottom: 8px; background: var(--bg-tile); }
.th-sub.is-reviewed { opacity: .8; }
.th-sub-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.th-sub-name { font-weight: 600; font-size: 13px; color: var(--ink); }
.th-sub-status { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--text-muted); }
.th-sub.is-reviewed .th-sub-status { color: var(--purple); }
.th-answer { font-size: 13px; color: var(--text-body); white-space: pre-wrap; }
.th-audio { font-size: 13px; color: var(--text-gray); }
.th-review { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.th-review .tf-input { flex: 1 1 200px; }
.th-score { flex: 0 0 70px; }
.th-feedback { margin-top: 8px; font-size: 12px; color: var(--text-gray); }
.th-feedback .counter { margin-left: 4px; }

/* ошибки дня */
.ta-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--divider); }
.ta-row:last-child { border-bottom: 0; }
.ta-info { flex: 1 1 auto; min-width: 0; }
.ta-prompt { font-size: 13px; font-weight: 600; color: var(--ink); }
.ta-answer { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.counter.warn { background: var(--yellow-bg); color: var(--yellow-dark); }

@media (max-width: 720px) {
  .teacher-stats { grid-template-columns: 1fr 1fr; }
  .teacher-pagehead h1 { font-size: 28px; }
  .tf-row { flex-direction: column; }
  .teacher-form .btn { align-self: stretch; }
}





/* ---------- Материалы урока: презентация + раздатка ---------- */
.attach-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.attach-card {
  display: flex; flex-direction: column; gap: 4px; padding: 14px;
  border: 1px solid var(--border); border-radius: var(--radius-tile); background: var(--bg-page);
  text-decoration: none; color: var(--ink); transition: background .12s ease, border-color .12s ease;
}
.attach-card:hover { background: var(--bg-tile); border-color: var(--purple); }
.attach-ico { font-size: 20px; }
.attach-title { font-weight: 600; font-size: 15px; }
.attach-sub { font-size: 12px; color: var(--text-muted); }

/* ---------- Этап 5 real: повторение ошибок ---------- */
.repeat-list { display: flex; flex-direction: column; gap: 10px; }
.repeat-item { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-tile); background: var(--bg-page); }
.repeat-item.needs-review { border-color: var(--purple); }
.repeat-q { font-weight: 600; font-size: 14px; color: var(--ink); }
.repeat-a, .repeat-wrong, .repeat-meta { font-size: 13px; color: var(--text-gray); margin-top: 4px; }
.repeat-wrong { color: var(--yellow-dark); }
.repeat-meta { font-size: 12px; color: var(--text-muted); }

/* ---------- PWA offline ---------- */
.offline-banner {
  position: sticky; top: 0; z-index: 60; padding: 8px 14px; text-align: center;
  background: var(--yellow); color: var(--ink); font-size: 13px; font-weight: 600;
}
.offline-banner.hidden { display: none; }
