/* Цвета школы: «Лаванда и ультрамарин» */
:root {
  --bg: #EEE9F8;        /* лавандовый фон */
  --soft: #DCD2F2;      /* мягкий сиреневый */
  --card: #FBFAFE;      /* карточки */
  --ink: #211A3A;       /* основной текст */
  --muted: #5E5578;     /* второстепенный текст */
  --accent: #3D2BE0;    /* ультрамарин — кнопки */
  --accent-dark: #2A1BB5;
  --pop: #E9F06A;       /* лимонный маркер */
  --line: #D6CCEE;
  --ok-bg: #D5F0DF; --ok: #14532D;
  --warn-bg: #FFF1C2; --warn: #6B4E00;
  --bad-bg: #FBDAD6; --bad: #7F1D1D;
  --display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --body: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 16px;
}

* { box-sizing: border-box; }
/* скрытые элементы не показываем, даже если у них задан display */
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.55; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 700; }
h2 { font-size: clamp(20px, 2.6vw, 26px); font-weight: 600; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
.mark { background: var(--pop); padding: 0 .25em; border-radius: 6px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Каркас */
.wrap { max-width: 1080px; margin: 0 auto; padding-inline: 20px; }
main.wrap { padding-block: 32px 64px; display: grid; gap: 32px; }
.stack { display: grid; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* Шапка */
.top { background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding-block: 14px; }
.logo { font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--ink); text-decoration: none; margin-right: auto; }
.logo span { background: var(--pop); padding: 0 6px; border-radius: 6px; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.nav a { color: var(--ink); text-decoration: none; font-size: 15px; }
.nav a:hover { color: var(--accent); }
.nav form { margin: 0; }
.badge { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; text-align: center; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; font: 600 15px var(--body); padding: 12px 20px; border-radius: 12px; text-decoration: none; }
.btn:hover { background: var(--accent-dark); }
.btn.ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.btn.ghost:hover { background: var(--soft); }
.btn.pop { background: var(--pop); color: var(--ink); }
.btn.small { padding: 8px 14px; font-size: 14px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); cursor: pointer; font-size: 15px; }
.linkbtn:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Карточки-блоки */
.box { background: var(--card); border-radius: var(--radius); padding: 20px; display: grid; gap: 12px; align-content: start; }
.box.soft { background: var(--soft); }
.label { font-size: 12px; letter-spacing: .07em; text-transform: uppercase; font-weight: 600; color: var(--muted); }
.chip { display: inline-block; font-size: 13px; font-weight: 600; padding: 3px 12px; border-radius: 99px; background: var(--soft); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.price { font-family: var(--display); font-size: 28px; font-weight: 700; }
.price small { font-family: var(--body); font-size: 15px; font-weight: 500; color: var(--muted); }

/* Сообщения */
.messages { display: grid; gap: 8px; }
.msg { padding: 12px 16px; border-radius: 12px; background: var(--card); }
.msg.success { background: var(--ok-bg); color: var(--ok); }
.msg.warning, .msg.info { background: var(--warn-bg); color: var(--warn); }
.msg.error { background: var(--bad-bg); color: var(--bad); }

/* Главная */
.hero { display: grid; gap: 20px; padding-block: 24px 8px; max-width: 760px; }
.hero p { font-size: 18px; color: var(--muted); max-width: 60ch; }
.features { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 980px) { .features { grid-template-columns: repeat(2, minmax(0, 1fr)); } .features > :last-child { grid-column: 1 / -1; } }
@media (max-width: 560px) { .features { grid-template-columns: 1fr; } }

/* Списки уроков */
.list { display: grid; gap: 8px; }
.item { display: flex; align-items: center; gap: 16px; padding: 14px 18px; background: var(--card); border-radius: 14px; text-decoration: none; color: var(--ink); }
.item:hover { box-shadow: inset 0 0 0 2px var(--soft); }
.item .num { font-family: var(--display); font-weight: 700; font-size: 15px; min-width: 2.2em; height: 2.2em; display: grid; place-items: center; background: var(--soft); border-radius: 10px; }
.item .grow { flex: 1; min-width: 0; }
.item .grow strong { display: block; }

/* Урок */
.video { position: relative; aspect-ratio: 16 / 9; max-width: 100%; border-radius: var(--radius); overflow: hidden; background: var(--ink); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video.empty { display: grid; place-items: center; color: #fff; background: var(--soft); color: var(--muted); }
.prose { max-width: 70ch; white-space: pre-line; }
.pager { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Задания */
.task { background: var(--card); border-radius: var(--radius); padding: 20px; display: grid; gap: 12px; }
.task-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.task-num { font-family: var(--display); font-weight: 700; }
.task-text { white-space: pre-line; max-width: 75ch; }
.task input[type=text], .task textarea, .form input, .form select, .form textarea {
  width: 100%; font: inherit; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--ink); }
.task input[type=text] { max-width: 260px; font-weight: 600; letter-spacing: .05em; }
.task textarea { min-height: 160px; resize: vertical; }
.task input:focus, .task textarea:focus, .form input:focus, .form select:focus, .form textarea:focus { border-color: var(--accent); outline: none; }
.task.ok { box-shadow: inset 4px 0 0 #22A55A; }
.task.partial { box-shadow: inset 4px 0 0 #E0A800; }
.task.bad { box-shadow: inset 4px 0 0 #D64545; }
.answer-line { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 15px; }
.explain { background: var(--bg); border-radius: 12px; padding: 12px 14px; font-size: 15px; white-space: pre-line; }
.student-answer { background: var(--bg); border-radius: 12px; padding: 14px; white-space: pre-wrap; }
.teacher-note { background: var(--pop); border-radius: 12px; padding: 12px 14px; white-space: pre-line; }
.score { font-family: var(--display); font-size: 34px; font-weight: 700; }
.scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.submitbar { position: sticky; bottom: 0; background: var(--bg); padding-block: 14px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }

/* Формы */
.form { display: grid; gap: 16px; max-width: 480px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 15px; }
.field .help { font-size: 13px; color: var(--muted); }
.field .err { font-size: 14px; color: var(--bad); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.errorlist { margin: 0; padding: 0; list-style: none; color: var(--bad); font-size: 14px; }

/* Карточки для повторения */
.study { display: grid; gap: 20px; justify-items: center; }
.flash { perspective: 1200px; width: 100%; max-width: 560px; }
.flash button.card-btn { all: unset; box-sizing: border-box; display: block; width: 100%; cursor: pointer; border-radius: 22px; }
.flash button.card-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.flash .inner { position: relative; min-height: 300px; transition: transform .5s ease; transform-style: preserve-3d; }
.flash.flipped .inner { transform: rotateY(180deg); }
.flash .face { position: absolute; inset: 0; border-radius: 22px; padding: 28px; display: grid; align-content: center; gap: 10px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: auto; }
.flash .front { background: var(--pop); text-align: center; }
.flash .front strong { font-family: var(--display); font-size: clamp(20px, 3.4vw, 28px); line-height: 1.2; }
.flash .back { background: var(--card); transform: rotateY(180deg); font-size: 18px; box-shadow: inset 0 0 0 2px var(--soft); }
.study-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.study-actions .btn { min-width: 160px; }
.btn.know { background: #1F8A4C; }
.btn.know:hover { background: #17703D; }
.btn.dontknow { background: #fff; color: var(--bad); box-shadow: inset 0 0 0 2px #E7A3A3; }
.progress { width: 100%; max-width: 560px; height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.progress b { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
@media (prefers-reduced-motion: reduce) { .flash .inner, .progress b { transition: none; } }

/* Таблицы */
.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }

footer.foot { border-top: 1px solid var(--line); }
footer.foot .wrap { padding-block: 24px 40px; display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 14px; color: var(--muted); }
footer.foot a { color: var(--muted); }

/* ---------- Главная: первый экран — текст и запись слева, фото справа ---------- */
.intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px; align-items: center; padding-block: 8px; }
.intro-text { display: grid; gap: 18px; justify-items: start; }
.lead { font-family: var(--display); font-weight: 500; font-size: clamp(18px, 2.2vw, 22px); color: var(--accent); max-width: 52ch; }
.portrait { position: relative; width: 320px; max-width: 100%; margin-right: 12px; }
.portrait::before { content: ""; position: absolute; inset: 14px -12px -12px 14px; background: var(--pop); border-radius: 26px; }
.portrait img, .portrait-empty { position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; max-width: 100%; object-fit: cover; border-radius: 26px; }
.portrait-empty { display: grid; place-items: center; background: var(--soft); color: var(--muted); font-family: var(--display); font-size: 18px; text-align: center; padding: 16px; }
.portrait-empty.initial { font-size: 96px; color: var(--accent); }
@media (max-width: 820px) {
  .intro { grid-template-columns: 1fr; gap: 24px; }
  .portrait { width: 220px; }
  .portrait::before { inset: 10px -9px -9px 10px; }
}

/* Результаты в цифрах */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.stat { background: var(--accent); color: #fff; border-radius: var(--radius); padding: 20px; display: grid; gap: 4px; align-content: start; }
.stat:nth-child(even) { background: var(--ink); }
.stat-value { font-family: var(--display); font-size: clamp(32px, 5vw, 44px); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 15px; opacity: .85; }

/* О себе */
.about { display: grid; gap: 16px; }
.about-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
@media (max-width: 720px) { .about-grid { grid-template-columns: 1fr; } }
.about-text { background: var(--card); border-radius: var(--radius); padding: 24px 28px; display: flex; flex-direction: column; justify-content: center; font-size: 16.5px; line-height: 1.6; }
.about-text p { margin: 0; }
.about-text p + p { margin-top: 1.4em; }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; align-content: center; grid-auto-rows: 1fr; }
.facts li { background: var(--card); border-radius: 12px; padding: 9px 14px 9px 40px; position: relative; font-weight: 500; font-size: 15px; line-height: 1.4; display: flex; align-items: center; }
.facts li::before { content: ""; position: absolute; left: 14px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 4px; background: var(--pop); box-shadow: inset 0 0 0 2px var(--accent); }

/* Отзывы */
.reviews { columns: 3 280px; column-gap: 16px; }
.review { break-inside: avoid; margin: 0 0 16px; background: var(--card); border-radius: var(--radius); padding: 20px; display: grid; gap: 12px; }
.review-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.review blockquote { margin: 0; font-size: 15px; line-height: 1.6; }
.review img { border-radius: 12px; border: 1px solid var(--line); width: 100%; }

/* Частые вопросы */
.faq { display: grid; gap: 8px; }
.faq details { background: var(--card); border-radius: 14px; padding: 16px 20px; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin-top: 10px; color: var(--muted); }

/* Контакты */
.contacts { background: var(--ink); color: #fff; border-radius: 24px; padding: 28px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; align-items: center; }
.contacts p { color: #CFC7E8; }
@media (max-width: 720px) { .contacts { grid-template-columns: 1fr; padding: 20px; } }
.contact-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.contact { display: grid; gap: 2px; background: rgba(255,255,255,.08); color: #fff; text-decoration: none; border-radius: 14px; padding: 12px 16px; font-weight: 600; overflow-wrap: anywhere; }
.contact:hover { background: var(--accent); }
.contact .label { color: var(--pop); }
.contacts.with-photo { grid-template-columns: 160px minmax(0, 1fr) minmax(0, 1.2fr); }
.contacts-photo { width: 160px; aspect-ratio: 4 / 5; max-width: 100%; object-fit: cover; border-radius: 18px; background: var(--soft); }
@media (max-width: 900px) { .contacts.with-photo { grid-template-columns: 120px minmax(0, 1fr); } .contacts.with-photo .contact-list { grid-column: 1 / -1; } .contacts-photo { width: 120px; } }
.logo { display: grid; line-height: 1.2; }
.logo small { font-family: var(--body); font-weight: 500; font-size: 12px; color: var(--muted); letter-spacing: .02em; }

/* Якоря на разделы главной в шапке */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
main section[id] { scroll-margin-top: 90px; }
.anchors { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-right: auto; }
.anchors a { color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 500; }
.anchors a:hover { color: var(--accent); }
.top .wrap .logo { margin-right: 12px; }
@media (max-width: 900px) {
  /* на узком экране — отдельная строка, которая листается вбок */
  .anchors { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; gap: 18px; padding-bottom: 2px; scrollbar-width: none; margin-right: 0; }
  .anchors::-webkit-scrollbar { display: none; }
  .anchors a { white-space: nowrap; font-size: 14px; }
  .top .wrap .logo { margin-right: auto; }
}
.search { font: inherit; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--ink); width: 100%; max-width: 360px; }
.search:focus { border-color: var(--accent); outline: none; }

/* ---------- Кнопки записи: всегда заметные ---------- */
/* в шапке ссылки тёмные — у кнопок текст должен оставаться белым */
.nav a.btn, .nav a.btn:hover { color: #fff; }
.btn.cta-top { background: var(--accent); padding: 9px 18px; box-shadow: 0 0 0 3px var(--pop); }
.btn.cta-top:hover { background: var(--accent-dark); }
.btn.cta { font-size: 17px; padding: 15px 26px; border-radius: 14px; box-shadow: 0 6px 0 -1px var(--accent-dark), 0 10px 24px -8px rgba(61, 43, 224, .55); transition: transform .12s, box-shadow .12s; }
.btn.cta::after { content: "→"; font-weight: 700; transition: transform .12s; }
.btn.cta:hover { transform: translateY(-1px); }
.btn.cta:hover::after { transform: translateX(3px); }
.btn.cta:active { transform: translateY(3px); box-shadow: 0 2px 0 -1px var(--accent-dark), 0 4px 10px -6px rgba(61, 43, 224, .5); }
@media (prefers-reduced-motion: reduce) { .btn.cta, .btn.cta::after { transition: none; } }

/* ---------- Цены: карточки на всю ширину, как другие блоки ---------- */
.courses { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.course-card { background: var(--card); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.course-card h3 { font-size: 20px; }
.course-bottom { margin-top: auto; padding-top: 18px; display: grid; gap: 16px; border-top: 1px solid var(--line); }
.course-price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.course-price .amount { font-family: var(--display); font-weight: 700; font-size: clamp(34px, 4vw, 42px); line-height: 1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.course-price .per { font-size: 15px; color: var(--muted); }
.course-bottom .btn.cta { width: 100%; justify-content: center; }

/* ---------- Таймер работы ---------- */
.timer { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 72px); z-index: 5; justify-self: end; display: flex; align-items: baseline; gap: 10px; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 14px; box-shadow: 0 8px 20px -10px rgba(33, 26, 58, .6); }
.timer .label { color: #CFC7E8; }
.timer strong { font-family: var(--display); font-size: 22px; font-variant-numeric: tabular-nums; }
.timer.warn { background: #B42318; }
.start-box { max-width: 560px; }
.start-time { font-family: var(--display); font-weight: 700; font-size: 56px; line-height: 1; color: var(--accent); }
.start-time span { font-size: 22px; color: var(--muted); }

/* ---------- Статистика ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.mini-stat { display: grid; gap: 4px; align-content: start; }
.mini-value { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hw-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.hw-cell { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--bg); border: 1px solid var(--line); }
.hw-cell .hw-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-cell .hw-score { font-weight: 700; }
.hw-cell.good { background: var(--ok-bg); border-color: #A8DDBB; }
.hw-cell.mid { background: var(--warn-bg); border-color: #F0D675; }
.hw-cell.low { background: var(--bad-bg); border-color: #F0B0A8; }
.hw-cell.wait { background: #E6E0FA; border-color: var(--soft); }
.hw-cell.none { color: var(--muted); border-style: dashed; }

/* таблица успеваемости */
.grade { display: inline-block; min-width: 64px; text-align: center; padding: 4px 8px; border-radius: 8px; font-weight: 600; font-size: 14px; text-decoration: none; color: var(--ink); font-variant-numeric: tabular-nums; }
.grade.good { background: var(--ok-bg); color: var(--ok); }
.grade.mid { background: var(--warn-bg); color: var(--warn); }
.grade.low { background: var(--bad-bg); color: var(--bad); }
.grade.wait { background: #E6E0FA; color: var(--accent); }
.grade.none { color: var(--muted); font-weight: 400; }
.progress-table th.hw-col { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; max-height: 160px; text-transform: none; letter-spacing: 0; font-size: 12px; }
.progress-table td, .progress-table th { padding: 8px 10px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 99px; background: var(--card); text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14px; }
.tabs a.on { background: var(--accent); color: #fff; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted); align-items: center; }

/* ---------- Проверка по критериям ---------- */
.criteria { display: grid; gap: 10px; background: var(--bg); border-radius: 12px; padding: 14px; }
.crit { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.crit-title { flex: 1 1 260px; font-size: 15px; }
.crit-options { display: flex; gap: 6px; }
.crit-opt input { position: absolute; opacity: 0; pointer-events: none; }
.crit-opt span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: #fff; border: 2px solid var(--line); font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums; }
.crit-opt input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.crit-opt input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.crit-total { font-size: 16px; }
.crit-list { display: grid; gap: 4px; font-size: 14px; }
.crit-list div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 4px; }
.hw-cell.locked, .grade.locked { color: var(--muted); background: transparent; border: 1px dashed var(--line); font-weight: 400; }

/* ---------- Программа по блокам ---------- */
.block-card { background: var(--soft); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; }
.block-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; padding-inline: 4px; }
.block-progress { display: grid; gap: 4px; justify-items: end; min-width: 160px; }
.block-progress strong { font-family: var(--display); font-size: 20px; }
.block-progress .progress { width: 160px; background: var(--card); }
.item.locked { opacity: .6; }
.item.locked .num { background: transparent; border: 1px dashed var(--muted); }
.item .num.done { background: var(--ok-bg); color: var(--ok); }
.ok-text { color: var(--ok); font-weight: 600; }

/* ---------- Живые занятия ---------- */
.live-card { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; grid-template-columns: none; }
.live-card .grow { flex: 1 1 260px; }
.live-when { display: grid; justify-items: center; background: var(--soft); border-radius: 14px; padding: 10px 16px; min-width: 96px; }
.live-date { font-family: var(--display); font-weight: 700; font-size: 18px; }
.live-time { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.live-card.now { box-shadow: inset 0 0 0 2px var(--accent); }
.live-card.now .live-when { background: var(--pop); }

/* ---------- Telegram ---------- */
.tg-box { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.tg-box .grow { flex: 1 1 260px; }

/* Аккаунт внизу кабинета: «Выйти» подальше от меню */
.account { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.account .muted-link { color: var(--muted); text-decoration: underline; font-size: 14px; }
.account .muted-link:hover { color: var(--bad); }

/* «Выйти» — слева в шапке, отдельно от меню */
.logout { margin: 0; padding-right: 16px; border-right: 1px solid var(--line); }
.logout-btn { background: none; border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; font: 500 13px var(--body); color: var(--muted); cursor: pointer; }
.logout-btn::before { content: "← "; }
.logout-btn:hover { color: var(--bad); border-color: #E7A3A3; }

/* ---------- Кабинет ученика: «Что дальше» ---------- */
.next-step { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; padding: 22px 24px; border-radius: 20px; background: var(--accent); color: #fff; text-decoration: none; box-shadow: 0 14px 30px -18px rgba(61, 43, 224, .8); }
.next-step .label { color: #CFC7FF; }
.next-body { display: grid; gap: 6px; flex: 1 1 280px; }
.next-title { font-family: var(--display); font-size: clamp(19px, 2.6vw, 24px); line-height: 1.2; }
.next-text { color: #E4DFFF; font-size: 15px; }
.next-step .btn.cta { background: var(--pop); color: var(--ink); box-shadow: 0 5px 0 -1px #B9C23A; }
.next-step.result { background: var(--ink); }
.next-step.wait, .next-step.done { background: var(--card); color: var(--ink); box-shadow: none; border: 1px solid var(--line); }
.next-step.wait .label, .next-step.done .label { color: var(--muted); }
.next-step.wait .next-text, .next-step.done .next-text { color: var(--muted); }
.next-step.wait .btn.cta, .next-step.done .btn.cta { background: var(--accent); color: #fff; box-shadow: 0 5px 0 -1px var(--accent-dark); }
.course-tile { text-decoration: none; color: var(--ink); }
.course-tile:hover { box-shadow: inset 0 0 0 2px var(--soft); }
.link-more { color: var(--accent); font-weight: 600; font-size: 15px; }
.renew { align-content: center; }
.chip.new { background: var(--accent); color: #fff; }
.box > .chip { justify-self: start; }

/* ---------- Нижнее меню на телефоне ---------- */
.tabbar { display: none; }
@media (max-width: 720px) {
  .top.has-tabs .nav { display: none; }
  .top.has-tabs .wrap { flex-wrap: nowrap; padding-block: 10px; }
  .top.has-tabs .logo { font-size: 14px; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .tabbar a { position: relative; display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; padding-block: 4px; }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
  .tabbar a.on { color: var(--accent); }
  .tab-badge { position: absolute; top: 0; left: 55%; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #D92D20; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
  body:has(.tabbar) { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
  .submitbar { bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }
}

/* Карточка курса в кабинете: переход к программе + оплата */
.course-card-dash { gap: 14px; }
.course-card-dash .course-tile { display: grid; gap: 10px; }
.course-card-dash .course-tile:hover h3 { color: var(--accent); }
.pay-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.pay-row.soon { background: var(--warn-bg); margin: 0 -20px -20px; padding: 14px 20px; border-top: 0; border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- Пометки в тексте ответа и голосовой комментарий ---------- */
.annot { cursor: text; }
.note-mark { background: var(--pop); border-radius: 4px; padding: 0 2px; color: inherit; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.note-mark::after { content: attr(data-n); font-size: 11px; font-weight: 700; color: var(--accent); vertical-align: super; margin-left: 2px; }
.note-list { margin: 0; padding-left: 22px; display: grid; gap: 6px; font-size: 15px; }
.note-list:empty { display: none; }
.note-list q { background: var(--pop); border-radius: 4px; padding: 0 3px; }
.annot-panel { display: grid; gap: 8px; background: var(--bg); border: 2px solid var(--accent); border-radius: 12px; padding: 12px; }
.annot-panel textarea { width: 100%; font: inherit; padding: 10px; border-radius: 10px; border: 2px solid var(--line); }
.annot-quote { font-style: italic; }
.voice { display: grid; gap: 8px; }
.voice audio, .voice-play audio { width: 100%; max-width: 420px; }
.voice-play { display: grid; gap: 6px; background: var(--bg); border-radius: 12px; padding: 12px; }
.voice-upload input { font-size: 13px; }
.voice-rec { color: #B42318; box-shadow: inset 0 0 0 2px #E7A3A3; }

/* ---------- Кабинет преподавателя ---------- */
.t-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.t-side { display: grid; gap: 16px; }
@media (max-width: 820px) { .t-grid { grid-template-columns: 1fr; } }
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; align-items: end; height: 150px; margin-top: 8px; }
.bar-col { display: grid; grid-template-rows: auto 1fr auto; align-items: end; justify-items: center; height: 100%; gap: 4px; }
.bar { width: 100%; max-width: 44px; min-height: 3px; background: var(--accent); border-radius: 6px 6px 2px 2px; }
.bar-col:last-child .bar { background: var(--pop); box-shadow: inset 0 0 0 2px var(--accent); }
.bar-val { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-label { font-size: 12px; color: var(--muted); }
.t-attention { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.t-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: 15px; }
.t-row:last-child { border-bottom: 0; }
.t-row:hover span:first-child { color: var(--accent); }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.quick .box { text-decoration: none; color: var(--ink); gap: 4px; }
.quick .box:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.announce { background: var(--pop); border-radius: var(--radius); padding: 16px 20px; display: grid; gap: 6px; }
.announce .label { color: var(--ink); opacity: .7; }

/* Расшифровка баллов по критериям */
.crit-levels { flex-basis: 100%; list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
.crit-levels li { display: flex; gap: 8px; padding: 4px 8px; border-radius: 8px; }
.crit-levels b { flex: none; width: 1.2em; color: var(--ink); }
.crit:has(input[value="0"]:checked) .crit-levels li[data-v="0"],
.crit:has(input[value="1"]:checked) .crit-levels li[data-v="1"],
.crit:has(input[value="2"]:checked) .crit-levels li[data-v="2"],
.crit:has(input[value="3"]:checked) .crit-levels li[data-v="3"],
.crit:has(input[value="4"]:checked) .crit-levels li[data-v="4"],
.crit:has(input[value="5"]:checked) .crit-levels li[data-v="5"],
.crit:has(input[value="6"]:checked) .crit-levels li[data-v="6"] { background: #fff; color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.crit-notes { margin: 0; padding: 10px 12px 10px 28px; background: var(--warn-bg); color: var(--warn); border-radius: 10px; font-size: 13px; display: grid; gap: 4px; }
.crit-list div > span { display: grid; }
.box.test-score { background: var(--accent); color: #fff; }
.box.test-score .label { color: #CFC7FF; }
.box.test-score .small { color: #E4DFFF; }

/* ---------- Карта по номерам заданий ---------- */
.num-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
.num-cell { display: grid; justify-items: center; gap: 0; padding: 8px 4px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.num-no { font-family: var(--display); font-weight: 700; font-size: 16px; }
.num-pct { font-size: 12px; font-variant-numeric: tabular-nums; }
.num-cell.good { background: var(--ok-bg); border-color: #A8DDBB; color: var(--ok); }
.num-cell.mid { background: var(--warn-bg); border-color: #F0D675; color: var(--warn); }
.num-cell.low { background: var(--bad-bg); border-color: #F0B0A8; color: var(--bad); }

/* ---------- Работа над ошибками ---------- */
.mistake input[type=text] { max-width: 220px; font: inherit; font-weight: 600; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); }
.mistake.ok { box-shadow: inset 4px 0 0 #22A55A; opacity: .75; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.item.locked .pay-note { color: var(--accent); font-weight: 600; }
.chip.free { background: var(--pop); color: var(--ink); }

.sections { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sections .grade { min-width: 0; font-size: 13px; }

/* ---------- Защита заданий от копирования ---------- */
body.protected main { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.protected main input, body.protected main textarea { -webkit-user-select: text; user-select: text; }
.watermark { position: fixed; inset: 0; z-index: 30; pointer-events: none; background-repeat: repeat; }
.print-block { display: none; }
@media print {
  body.protected > *:not(.print-block) { display: none !important; }
  body.protected .print-block { display: block; padding: 40px; font-size: 18px; }
}
.manual-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.manual-grid form { background: var(--bg); border-radius: 12px; padding: 16px; gap: 12px; }
.pending-pay { box-shadow: inset 0 0 0 2px #F0D675; }
.pending-pay .t-row { flex-wrap: wrap; }
