:root {
    --focus-ring: 0 0 0 4px rgb(32 91 212 / 14%);
    --motion-fast: 150ms;
    --radius-card: 18px;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --border: #dfe3e8;
    --text: #132348;
    --muted: #5c6672;
    --accent: #205bd4;
    --accent-soft: #e8f0ff;
    --link-text: #174da6;
    --link-hover: #103c85;
    --link-active: #0c306d;
    --link-active-bg: #dbe7ff;
    --success: #176c3b;
    --success-soft: #e6f5ec;
    --warning: #795300;
    --warning-soft: #fdf3dd;
    --danger: #b3261e;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
}

/* Общий выбор ребёнка: список накладывается на страницу, переход остаётся обычной ссылкой. */
.ui-child-identity { display: flex; align-items: center; gap: 20px; min-width: 0; text-align: left; }
.ui-child-identity__avatar { flex: none; width: 80px; height: 80px; object-fit: cover; border-radius: 50%; background: var(--accent-soft); }
.ui-child-identity__text { display: grid; min-width: 0; gap: 2px; line-height: 1.4; }
.ui-child-identity__text strong { font-size: 22px; font-weight: 700; overflow-wrap: anywhere; color: var(--text); }
.ui-child-identity__text > span { font-size: 16px; color: var(--muted); }
.ui-child-picker { position: relative; min-width: 0; }
.ui-child-picker > summary { display: flex; align-items: center; gap: 14px; min-height: 80px; padding: 0 8px 0 0; border-radius: var(--radius); color: var(--text); cursor: pointer; list-style: none; }
.ui-child-picker > summary::-webkit-details-marker { display: none; }
.ui-child-picker > summary::marker { content: ''; }
.ui-child-picker > summary:hover { background: var(--accent-soft); }
.ui-child-picker > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; box-shadow: var(--focus-ring); }
.ui-child-picker__chevron { flex: none; width: 20px; height: 20px; transition: transform var(--motion-fast) ease; }
.ui-child-picker[open] > summary .ui-child-picker__chevron { transform: rotate(180deg); }
.ui-child-picker__list { position: absolute; z-index: 30; top: calc(100% - 2px); left: 80px; width: min(440px, calc(100vw - 48px)); max-height: min(440px, 65dvh); overflow-y: auto; padding: 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 5px 18px rgb(19 35 72 / 10%); }
.ui-child-picker__list > a { display: flex; align-items: center; gap: 14px; min-height: 80px; padding: 10px 12px; border-radius: var(--radius); color: var(--text); text-decoration: none; }
.ui-child-picker__list .ui-child-identity { flex: 1; gap: 16px; }
.ui-child-picker__list .ui-child-identity__avatar { width: 60px; height: 60px; }
.ui-child-picker__list .ui-child-identity__text strong { font-size: 18px; }
.ui-child-picker__list > a[aria-current], .ui-child-picker__list > a:hover { background: var(--accent-soft); }
.ui-child-picker__list > a:active { background: var(--link-active-bg); }
.ui-child-picker__list > a:focus-visible { outline-offset: -2px; }
.ui-child-picker__check { flex: none; color: var(--accent); width: 24px; height: 24px; }
@media (max-width: 600px) {
    .ui-child-identity { gap: 14px; }
    .ui-child-identity__avatar { width: 64px; height: 64px; }
    .ui-child-identity__text strong { font-size: 18px; }
    .ui-child-identity__text > span { font-size: 14px; }
    .ui-child-picker { width: 100%; }
    .ui-child-picker > summary { min-height: 64px; padding-right: 0; }
    .ui-child-picker > summary > .ui-child-identity { flex: 1; }
    .ui-child-picker__list { left: -14px; width: calc(100% + 28px); max-width: calc(100vw - 24px); }
    .ui-child-picker__list .ui-child-identity { gap: 14px; }
    .ui-child-picker__list .ui-child-identity__avatar { width: 54px; height: 54px; }
    .ui-child-picker__list .ui-child-identity__text strong { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .ui-child-picker__chevron { transition: none; } }

/* Вариант общей шапки для утверждённого кабинета: порядок разметки совпадает с Tab. */
@media (max-width: 800px) {
    .app-header--family .app-brand { margin-right: auto; }
    .app-header--family .app-account { margin-left: 0; }
    .app-header--family .app-mobile-menu .app-dropdown { right: 0; left: auto; }
}

/* Проверка обычного урока: общие кнопки, раскрытие и окна, отдельная колонка на компьютере. */
.review-panel { min-width: 0; min-height: 0; overflow-y: auto; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--bg); scrollbar-gutter: stable; }
.review-panel h2 { margin: 0 0 12px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.review-panel__title { margin: 0 0 14px; font-size: 20px; line-height: 1.35; }
.review-panel__count, .review-panel__hint { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 14px 0 8px; overflow-wrap: anywhere; }
.review-panel progress { display: block; width: 100%; height: 6px; border: 0; border-radius: 4px; overflow: hidden; accent-color: var(--accent); margin-bottom: 16px; }
.review-panel progress::-webkit-progress-bar { background: var(--border); }
.review-panel progress::-webkit-progress-value { background: var(--accent); }
.review-panel__step { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.review-panel__step h4 { margin: 0; font-size: 17px; line-height: 1.4; }
.review-panel__step p { font-size: 15px; line-height: 1.5; }
.review-panel__role { color: var(--muted); font-weight: 600; }
.review-panel__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.review-panel .button { font-size: 14px; padding: 10px; min-height: 44px; overflow-wrap: anywhere; }
.review-panel__next { width: 100%; margin: 14px 0; }
.review-status { display: inline-block; max-width: 100%; padding: 5px 10px; border: 1px solid var(--border); border-radius: 20px; font-size: 13px; line-height: 1.4; font-weight: 600; color: var(--muted); background: var(--surface); }
.review-status--checked { color: var(--success); background: var(--success-soft); border-color: var(--success); }
.review-status--changed { color: var(--warning); background: var(--warning-soft); border-color: var(--warning); }
.review-plan-item { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 0 12px 12px; }
.review-plan-item .button { margin-left: auto; }
.review-summary { color: var(--text); font-weight: 600; }
.review-replies { display: grid; gap: 8px; margin-top: 14px; }
.review-replies .button { justify-content: flex-start; text-align: left; }
.review-answer, .review-change__before { margin-top: 14px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg); overflow-wrap: anywhere; }
.review-answer h5 { margin: 0 0 12px; font-size: 15px; }
.review-answer .math, .review-change__before .math { max-width: 100%; overflow-x: auto; }
.review-changes { margin-bottom: 14px; }
.review-change { width: 100%; margin-bottom: 8px; text-align: left; }
.review-steps ol { list-style: none; padding: 0; display: grid; gap: 8px; }
.review-steps .button { width: 100%; justify-content: flex-start; text-align: left; }
.review-steps [aria-current=step] { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.review-panel__error { color: var(--danger); font-size: 15px; }
.review-ai { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.review-variants__head, .review-variants__foot { flex-shrink: 0; padding: 16px 20px; }
.review-variants__head h2 { font-size: 20px; }
.review-variants__body { min-height: 0; padding: 0 20px 20px; overflow-y: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.review-variants__body > p { grid-column: 1 / -1; margin: 0; color: var(--muted); }
.review-variant { min-width: 0; }
.review-variant__answer { padding: 12px; background: var(--success-soft); border-radius: var(--radius); }
.review-variant__answer > p { display: inline; }
.review-panel__narrow { font-size: 14px; }
.review-demo-layout { max-width: 400px; }
.review-demo-layout .review-panel__narrow { display: none; }
@media (min-width: 900px) {
    .lesson-page .workspace.workspace--review { grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; max-width: 1440px; padding: 12px 16px; }
    .workspace--review .review-panel__narrow { display: none; }
    .workspace--review .chat { width: 100%; }
}
@media (min-width: 900px) and (max-width: 1100px) {
    .lesson-page .workspace.workspace--review { grid-template-columns: minmax(0, 1fr) 330px; gap: 12px; }
}
@media (max-width: 899px) {
    .lesson-page .workspace.workspace--review { height: auto; }
    .workspace--review .chat { height: 70dvh; }
    .review-variants__body { grid-template-columns: minmax(0, 1fr); }
}

/* Каталог почты: предпросмотр использует настоящий макет, список — общие ссылки и кнопки. */
.mail-catalog { display: grid; gap: 24px; min-width: 0; }
.mail-catalog__item { display: flex; align-items: center; gap: 8px; }
.mail-catalog__item > .ui-link { flex: 1; }
.mail-catalog__item > .iconbutton { flex-shrink: 0; }
.mail-catalog__preview { width: 100%; height: 1000px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--bg); }
@media (min-width: 900px) { .mail-catalog { grid-template-columns: 320px minmax(0, 1fr); align-items: start; } }

/* Профиль: одна колонка на телефоне, выбор аватарки доступен с клавиатуры. */
.profile-page { max-width: 760px; margin: 0 auto; padding: 24px 20px 48px; }
.profile-page a:not(.ui-link):not(.button) { color: var(--accent); }
.profile-heading, .profile-summary { display: flex; align-items: center; gap: 18px; margin: 24px 0; }
.profile-heading h1 { font-size: 28px; }
.profile-heading > div { min-width: 0; overflow-wrap: anywhere; }
.profile-heading p, .profile-summary p { margin: 4px 0; }
.profile-summary > div { min-width: 0; overflow-wrap: anywhere; }
.profile-summary h3 { font-size: 20px; }
.profile-avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--accent-soft); }
.profile-avatar-button { position: relative; display: block; flex: 0 0 88px; width: 88px; height: 88px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.profile-avatar-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; }
.profile-avatar-edit { position: absolute; bottom: 0; right: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: white; border: 2px solid var(--surface); }
.profile-avatar-dialog { width: min(640px, calc(100% - 24px)); max-height: calc(100dvh - 40px); padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); overflow: auto; }
.profile-avatar-dialog:not([open]) { display: none; }
.profile-avatar-dialog::backdrop { background: rgb(27 31 36 / 45%); }
.profile-form { display: grid; gap: 28px; }
.profile-form fieldset { min-width: 0; margin: 0; padding: 20px 0 0; border: 0; border-top: 1px solid var(--border); }
.profile-form legend { padding: 0 10px 0 0; font-weight: 650; font-size: 22px; }
.profile-form label { display: block; margin-top: 14px; }
.profile-form input:not([type=radio]) { display: block; width: 100%; min-height: 48px; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.profile-form input[type=file] { font-size: 15px; }
.profile-help { color: var(--muted); font-size: 15px; margin: 8px 0; }
.profile-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.profile-form .profile-preset { display: flex; position: relative; flex-direction: column; align-items: center; margin: 0; padding: 10px 4px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; font-size: 14px; }
.profile-preset:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.profile-preset:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
.profile-preset input { position: absolute; top: 6px; left: 6px; accent-color: var(--accent); }
.profile-preset img { border-radius: 50%; object-fit: cover; }
.profile-style { display: flex; flex-wrap: wrap; gap: 20px; }
.profile-style label { min-height: 44px; display: flex; align-items: center; gap: 8px; }
.profile-form button { justify-self: start; }
.profile-family { margin-top: 40px; border-top: 1px solid var(--border); padding-top: 24px; }
.profile-status { color: var(--success); }
.profile-error { color: var(--danger); }
.profile-details dt { margin-top: 24px; color: var(--muted); font-size: 15px; }
.profile-details dd { margin: 4px 0 0; overflow-wrap: anywhere; }
@media (min-width: 600px) { .profile-presets { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
/* График условия сохраняет масштаб клеток на телефоне и без JavaScript. */
.function-graph { display: block; width: 100%; max-width: 360px; height: auto; margin: 12px auto; background: var(--surface); }
.function-graph__grid { fill: none; stroke: var(--border); stroke-width: 1; }
.function-graph__axis { fill: none; stroke: var(--text); stroke-width: 1.5; }
.function-graph__line { stroke: var(--accent); stroke-width: 2.5; }
.function-graph__label { fill: var(--text); font: 12px sans-serif; text-anchor: middle; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    /* Крупнее обычного: читает школьник, и формулы должны быть видны без прищуривания. */
    font: 19px/1.6 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

h1, h2, h3 {
    margin: 0;
    line-height: 1.3;
}

code {
    background: #eef1f5;
    border-radius: 4px;
    padding: 1px 5px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: .92em;
}

/* --- Шапка ------------------------------------------------------------ */

.topbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.topbar__title h1 {
    font-size: 19px;
}

.topbar__source {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.topbar__progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.progressbar {
    width: 220px;
    height: 8px;
    border-radius: 999px;
    background: #e6e9ee;
    overflow: hidden;
}

.progressbar__fill {
    display: block;
    height: 100%;
    background: var(--success);
    transition: width .3s ease;
}

.topbar__counter {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
}

/* --- Рабочая область --------------------------------------------------- */

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 16px 24px 20px;
    max-width: 1040px;
    margin: 0 auto;
    height: calc(100dvh - 72px);
    min-height: 0;
}

@media (max-width: 1000px) {
    .workspace {
        grid-template-columns: minmax(0, 1fr);
        padding: 12px;
        height: auto;
    }
}

.chat {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    min-height: 0;
    /* Колонка чата по центру своей области: длинные строки читать тяжело. */
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
}

.chat__list {
    list-style: none;
    margin: 0;
    padding: 2px 2px 6px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.message {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: var(--shadow);
    max-width: 100%;
    overflow-wrap: anywhere;
}

.message--learner {
    background: var(--accent-soft);
    border-color: #c9dbff;
    margin-left: auto;
    max-width: 80%;
}

.message--system {
    background: var(--success-soft);
    border-color: #bfe3cd;
    text-align: center;
    font-size: 14px;
}

.message__role {
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 6px;
}

.message__body > *:first-child {
    margin-top: 0;
}

.message__body > *:last-child {
    margin-bottom: 0;
}

.message__body h3 {
    font-size: 16px;
    margin: 4px 0 10px;
}

/* --- Карточка задания -------------------------------------------------- */

.taskcard {
    margin-top: 12px;
    border: 1px solid #c9dbff;
    border-radius: var(--radius);
    background: #fbfcff;
    padding: 14px 16px;
}

.taskcard__instruction {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* Буква в формуле — не украшение: «при n = 3» не должно стать «при N = 3» рядом с выражением 9 − 9n. */
.taskcard__instruction .math {
    text-transform: none;
    letter-spacing: normal;
}

.taskcard__expression {
    font-size: 22px;
    margin: 6px 0;
}

/* Данные задания — крупной строкой под выражением, а не в подписи: «при n = −9», «с основанием −2»
   (отзыв методиста 02.10.2026). Длинные данные переносятся между значениями. */
.taskcard__given {
    margin: 0 0 6px;
    font-size: 22px;
    line-height: 1.5;
    text-align: center;
}

/* Условие текстовой задачи — обычным текстом, а не заглавными буквами подписи. */
.taskcard__condition {
    margin: 0 0 8px;
    font-size: 17px;
    line-height: 1.5;
}

.taskcard__meta {
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--muted);
}

/* --- Ввод ответа ------------------------------------------------------- */

.composer {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px 16px 16px;
    flex-shrink: 0;
    max-height: 62%;
    overflow-y: auto;
}

.composer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.composer__tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.composer__tools {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.iconbutton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.iconbutton:hover:not(:disabled) {
    background: #f1f3f7;
    color: var(--text);
}

.iconbutton:disabled {
    opacity: .5;
    cursor: default;
}

.iconbutton svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Маленький значок, но достаточное место для касания и фокуса. */
.math-copyable { position: relative; padding-inline-end: 44px; }
span.math-copyable { display: inline-block; max-width: 100%; vertical-align: baseline; }
.math-copy-button { position: absolute; inset-inline-end: 0; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; }
.math-copy-button svg { width: 16px; height: 16px; }
.math-copy-button.math-copy-button--done, .math-copy-button.math-copy-button--done:hover:not(:disabled) { color: var(--success); }
.math-copy-status { display: block; font: 12px/1.4 var(--font-body, sans-serif); color: var(--text); white-space: normal; }

.iconbutton[aria-pressed="true"] {
    background: var(--accent-soft);
    border-color: #c9dbff;
    color: var(--accent);
}

/* Второстепенное действие значком рядом с главной кнопкой — как .button--outline: синяя рамка. */
.iconbutton--outline {
    border-color: var(--accent);
    border-radius: 10px;
    background: var(--surface);
    color: var(--accent);
    transition: background-color var(--motion-fast);
}

.iconbutton--outline:hover:not(:disabled) {
    background: var(--accent-soft);
    color: var(--accent);
}

.iconbutton--outline:active:not(:disabled) {
    filter: brightness(.94);
}

.tab {
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    border-radius: 999px;
    padding: 6px 14px;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.tab:hover {
    background: #f1f3f7;
}

.tab--active {
    background: var(--accent-soft);
    border-color: #c9dbff;
    color: var(--accent);
    font-weight: 600;
}

.composer__pane--hidden {
    display: none;
}

.composer__input {
    width: 100%;
    font: inherit;
    font-size: 18px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.composer__input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.composer__hint {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.composer__mathfield {
    display: block;
    width: 100%;
    font-size: 22px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.composer__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.composer__status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    color: var(--muted);
}

/* Пока ответ в пути, движение должно быть там, куда смотрит ученик: в кнопке и в строке
   состояния. Курсор тоже переключается на «занято» — иначе непонятно, зависло или думает. */
.composer__pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0;
    transition: opacity .15s;
}

.composer__status--busy .composer__pulse {
    opacity: 1;
    animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(.7); opacity: .45; }
    50% { transform: scale(1); opacity: 1; }
}

.spinner {
    display: none;
    width: 15px;
    height: 15px;
    margin-right: 8px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.button--loading .spinner {
    display: inline-block;
}

.button--loading {
    /* Кнопка остаётся видимо активной: гашение на треть читается как «сломалось». */
    opacity: 1;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.button[data-send] {
    display: inline-flex;
    align-items: center;
}

body.is-busy,
body.is-busy .button,
body.is-busy .iconbutton,
body.is-busy .composer__input,
body.is-busy .tab {
    cursor: progress;
}

@media (prefers-reduced-motion: reduce) {
    .spinner,
    .composer__status--busy .composer__pulse {
        animation: none;
    }
}

.button {
    font: inherit;
    font-size: 15px;
    padding: 9px 16px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.button:hover:not(:disabled) {
    background: #f1f3f7;
}

.button:disabled {
    opacity: .55;
    cursor: default;
}

.button--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}

.button--primary:hover:not(:disabled) {
    background: #2159d6;
}

.button--ghost {
    background: transparent;
    color: var(--muted);
}

.button--pressed {
    background: var(--accent-soft);
    border-color: #c9dbff;
    color: var(--accent);
    font-weight: 600;
}

/* --- Панель рукописного ввода ------------------------------------------ */

/* Обычно панель встроена в форму; в развёрнутом виде занимает весь экран,
   и «Распознать» остаётся под рукой, чтобы не искать её после закрытия. */
.inkstage__bar {
    display: none;
}

.inkstage--full {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    padding: 14px 18px 18px;
}

.inkstage--full .inkstage__bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.inkstage--full .inkstage__title {
    font-weight: 600;
    margin-right: auto;
}

.inkstage--full .inkpad {
    flex: 1;
    min-height: 0;
}

.inkstage--full .inkpad__canvas {
    height: 100%;
}

/* На весь экран помещается несколько строк, поэтому и линовка построчная. */
.inkstage--full .inkpad {
    background: repeating-linear-gradient(to bottom,
        transparent 0 88px, #d7dee8 88px 89px, transparent 89px 96px), #fff;
}

/* Одна широкая строка с базовой линией: мышью пишут мелко и криво, а крупная запись
   по линии заметно повышает долю верно распознанных выражений. */
.inkpad {
    position: relative;
    border: 1px dashed #bcc4d0;
    border-radius: 10px;
    background:
        linear-gradient(to bottom, transparent calc(72% - 1px), #b9c4d4 72%, transparent calc(72% + 1px)),
        linear-gradient(to bottom, transparent calc(30% - 1px), #e4e9f0 30%, transparent calc(30% + 1px)),
        #fff;
    overflow: hidden;
}

/* Курсор-карандаш: точка письма — остриё грифеля, поэтому hotspot стоит в (2, 22),
   то есть в самом кончике, а не в середине картинки. */
.inkpad__canvas {
    display: block;
    width: 100%;
    height: 220px;
    touch-action: none;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M2.2 21.8l1.6-5.2L15.9 4.5l3.6 3.6L7.4 20.2z" fill="%23f2c14e" stroke="%235d4d17" stroke-width="1" stroke-linejoin="round"/><path d="M2.2 21.8l1.6-5.2 3.6 3.6z" fill="%23333" stroke="%235d4d17" stroke-width="1" stroke-linejoin="round"/><path d="M15.9 4.5l1.9-1.9a1.7 1.7 0 012.4 0l1.2 1.2a1.7 1.7 0 010 2.4l-1.9 1.9z" fill="%23d95f5f" stroke="%235d4d17" stroke-width="1" stroke-linejoin="round"/></svg>') 2 22, crosshair;
}

/* Ластик: рабочий угол резинки стоит в точке указателя. */
.inkpad__canvas--erasing {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 26 26"><g transform="rotate(-45 13 13)"><rect x="5" y="9" width="16" height="9" rx="2" fill="%23f3a9a0" stroke="%238a4a42" stroke-width="1.2"/><rect x="5" y="9" width="7" height="9" rx="2" fill="%23ffffff" stroke="%238a4a42" stroke-width="1.2"/></g></svg>') 4 21, cell;
}

.inkpad__placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    color: var(--muted);
    pointer-events: none;
    font-size: 15px;
}

.inkpad__placeholder--hidden {
    display: none;
}

.inkpad__controls {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.inkpad__result {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid #c9dbff;
    border-radius: 10px;
    background: #fbfcff;
}

.inkpad__result-label {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

.inkpad__confidence {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.inkpad__confidence--low {
    color: var(--warning);
}

.inkpad__warning {
    margin: 8px 0 0;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--warning-soft);
    color: var(--warning);
    font-size: 13px;
}

.inkpad__notice {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--warning-soft);
    color: var(--warning);
    font-size: 13px;
}

/* --- Редактор фото: рамка вокруг задания --------------------------------- */

.photo-editor__bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.photo-editor__bar > :first-child {
    justify-self: start;
}

.photo-editor__done {
    justify-self: end;
}

/* Кнопки страницы крупные (.app-page .button, ниже в файле): в полосе редактора — компактнее,
   чтобы на экране 360 px поместился заголовок. Отсюда и корень .photo-editor в правилах. */
.photo-editor .photo-editor__bar .button {
    gap: 6px;
    min-height: 44px;
    padding: 8px 14px;
    font-size: 16px;
}

.photo-editor__title {
    margin: 0;
    overflow: hidden;
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    text-overflow: ellipsis;
}

@media (max-width: 400px) {
    .photo-editor .photo-editor__bar .button {
        padding: 8px 10px;
        font-size: 15px;
    }

    .photo-editor__title {
        font-size: 16px;
    }
}

/* Сцена забирает касания себе: страница не прокручивается и не приближается, пока двигают рамку. */
.photo-editor__stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: var(--text);
    touch-action: none;
    overscroll-behavior: contain;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    cursor: crosshair;
}

.photo-editor__image {
    position: absolute;
    top: 0;
    left: 0;
    max-width: none;
    max-height: none;
    transform-origin: 0 0;
    pointer-events: none;
    -webkit-user-drag: none;
}

.photo-editor__image:not([src]) {
    display: none;
}

/* Затемнение вокруг рамки — её же тень: отдельных слоёв нет, и двигать приходится одну рамку. */
.photo-editor__frame {
    position: absolute;
    top: 0;
    left: 0;
    box-sizing: border-box;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgb(19 35 72 / 50%), 0 0 0 100vmax rgb(19 35 72 / 58%);
    cursor: move;
    outline: none;
}

.photo-editor__frame[hidden] {
    display: none;
}

.photo-editor__frame:focus-visible {
    box-shadow: 0 0 0 1px rgb(19 35 72 / 50%), 0 0 0 4px var(--accent), 0 0 0 100vmax rgb(19 35 72 / 58%);
}

.photo-editor__handle {
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid var(--accent);
    border-radius: 4px;
    background: #fff;
}

/* Видимая ручка маленькая, а ловит палец на 44 × 44 точки. */
.photo-editor__handle::before {
    content: '';
    position: absolute;
    inset: -13px;
}

.photo-editor__handle--nw { top: -10px; left: -10px; cursor: nwse-resize; }
.photo-editor__handle--ne { top: -10px; right: -10px; cursor: nesw-resize; }
.photo-editor__handle--se { right: -10px; bottom: -10px; cursor: nwse-resize; }
.photo-editor__handle--sw { bottom: -10px; left: -10px; cursor: nesw-resize; }
.photo-editor__handle--n,
.photo-editor__handle--s { left: 50%; width: 28px; height: 10px; margin-left: -14px; cursor: ns-resize; }
.photo-editor__handle--n { top: -6px; }
.photo-editor__handle--s { bottom: -6px; }
.photo-editor__handle--e,
.photo-editor__handle--w { top: 50%; width: 10px; height: 28px; margin-top: -14px; cursor: ew-resize; }
.photo-editor__handle--e { right: -6px; }
.photo-editor__handle--w { left: -6px; }

.photo-editor__handle--n::before,
.photo-editor__handle--s::before { inset: -17px -8px; }
.photo-editor__handle--e::before,
.photo-editor__handle--w::before { inset: -8px -17px; }

.photo-editor__frame--small .photo-editor__handle--n,
.photo-editor__frame--small .photo-editor__handle--s,
.photo-editor__frame--small .photo-editor__handle--e,
.photo-editor__frame--small .photo-editor__handle--w {
    display: none;
}

.photo-editor__frame--active .photo-editor__handle {
    background: var(--accent-soft);
}

.photo-editor__status {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    margin: 0;
    color: #fff;
    font-size: 15px;
    pointer-events: none;
}

.photo-editor__status[hidden] {
    display: none;
}

.photo-editor__hint {
    margin: 0;
    padding: 8px 16px 0;
    font-size: 13px;
    text-align: center;
    color: var(--muted);
}

.photo-editor__hint-mouse {
    display: none;
}

@media (pointer: fine) {
    .photo-editor__hint-touch {
        display: none;
    }

    .photo-editor__hint-mouse {
        display: inline;
    }
}

.photo-editor__tools {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 12px max(10px, env(safe-area-inset-bottom));
}

/* Общий .button объявлен ниже и перебил бы одиночный класс: правила редактора — с его корнем. */
.photo-editor .photo-editor__tools .photo-editor__tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 56px;
    padding: 6px 2px;
    font-size: 13px;
    line-height: 1.2;
}

.photo-editor .photo-editor__tool .ui-icon {
    width: 20px;
    height: 20px;
}

@media (min-width: 701px) {
    .photo-editor__tools {
        display: flex;
        justify-content: center;
        gap: 8px;
    }

    .photo-editor .photo-editor__tools .photo-editor__tool {
        flex-direction: row;
        gap: 6px;
        min-height: 44px;
        padding: 8px 16px;
        font-size: 15px;
    }
}

/* Телефон лёжа: подсказку прячем, чтобы снимку осталось место. */
@media (max-height: 560px) {
    .photo-editor__hint {
        display: none;
    }
}

/* Снимок перетаскивают на страницу: поле ввода показывает, куда он попадёт. */
.composer--drop {
    outline: 2px dashed var(--accent);
    outline-offset: 4px;
}

/* --- План темы по запросу ---------------------------------------------- */

.lesson-plan {
    width: min(680px, calc(100% - 24px));
    max-height: calc(100dvh - 24px);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    box-shadow: var(--shadow);
    overscroll-behavior: contain;
}

.lesson-plan::backdrop {
    background: color-mix(in srgb, var(--text) 35%, transparent);
}

.lesson-plan__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 1;
}

.lesson-plan__head h2 {
    font-size: 19px;
}

.lesson-plan__content {
    display: grid;
    gap: 16px;
    padding: 16px;
}

.lesson-plan__status {
    font-size: 14px;
    color: var(--danger);
    margin: 8px 0 0;
}

.lesson-plan__status:empty {
    margin: 0;
}

body:has(.lesson-plan[open]) {
    overflow: hidden;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
}

.panel__title {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    margin-bottom: 10px;
}

.panel__empty {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

/* Один компонент плана: существующие список бесед и кнопки, компоновка по данным урока. */
.lesson-stage-plan { display:flex; flex-direction:column; gap:12px; min-height:0; }
.lesson-stage-plan .panel__title, .lesson-stage-plan__title { margin:0; }
.lesson-stage-plan__title { color:var(--muted); font-size:14px; }
.lesson-stage-plan__list { flex:1; min-height:0; overflow-y:auto; scrollbar-gutter:stable; }
.lesson-stage-plan__guide { display:flex; align-items:center; gap:14px; width:100%; padding:12px 0 0; border:0; border-top:1px solid var(--border); background:transparent; color:var(--text); font:inherit; font-size:16px; line-height:1.5; text-align:left; cursor:pointer; border-radius:8px; }
.lesson-stage-plan__guide:hover { background:var(--accent-soft); }
.lesson-stage-plan__guide:focus-visible { outline:2px solid var(--accent); outline-offset:4px; }
.lesson-stage-plan__guide img { object-fit:contain; flex-shrink:0; width:88px; height:104px; }
.lesson-stage-plan__guide [data-lesson-encouragement] { margin:0; font-size:16px; color:var(--text); }
.homework-chat-entry__open.homework-chat-entry__open--status { position:relative; padding-right:42px; }
.homework-chat-entry__status { position:absolute; right:12px; top:14px; width:20px; height:20px; color:var(--muted); }
.homework-chat-entry__status--complete { color:var(--success); }
[data-stage-plan-dialog] .skills { margin-top:12px; }
.mobile-chat-help { display:none; }
.chat-waiting__dots { display:flex; align-items:center; gap:6px; height:20px; }
.chat-waiting__dots > svg { width:7px; height:7px; color:var(--muted); animation:chat-waiting-bounce 1.2s ease-in-out infinite; }
.chat-waiting__dots > svg:nth-child(2) { animation-delay:.15s; }
.chat-waiting__dots > svg:nth-child(3) { animation-delay:.3s; }
.chat-waiting__status { margin:6px 0 0; color:var(--muted); font-size:14px; }
@keyframes chat-waiting-bounce { 0%,60%,100% { transform:translateY(0); } 30% { transform:translateY(-5px); } }
@media(prefers-reduced-motion:reduce) { .chat-waiting__dots > svg { animation:none; } }
@media(min-width:1024px) {
    /* Пустая левая колонка уравновешивает шаги: центрируется сама беседа.
       1624 = чат 920 + две колонки по 304 + промежутки и внешние отступы. */
    .lesson-page .workspace.workspace--stages { grid-template-columns:minmax(240px,1fr) minmax(0,920px) minmax(240px,1fr); gap:24px; max-width:1624px; }
    .workspace--stages .chat { grid-column:2; width:100%; max-width:none; margin:0; }
    .workspace--stages .lesson-stage-plan { grid-column:3; padding-left:24px; border-left:1px solid var(--border); }
}
@media(max-width:1023px) { .lesson-stage-plan { display:none; } }
@media(max-width:600px) {
    .mobile-chat-help { display:block; margin:8px 0 0; text-align:center; color:var(--muted); font-size:14px; }
}

.skills {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skill {
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 14px;
}

.skill--current {
    border-color: #c9dbff;
    background: var(--accent-soft);
}

.skill--locked {
    color: var(--muted);
}

.skill--mastered {
    color: var(--success);
}

.skill__head {
    display: flex;
    gap: 8px;
    align-items: baseline;
}

.skill__paragraph {
    font-size: 12px;
    color: var(--muted);
    min-width: 34px;
}

.skill__title {
    font-weight: 500;
}

.skill__formula {
    margin-top: 4px;
    font-size: 14px;
    color: var(--muted);
}

.skill__count {
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted);
}

.gaps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gap {
    border-left: 3px solid var(--warning);
    padding: 2px 0 2px 10px;
    font-size: 14px;
}

.gap--resolved {
    border-left-color: var(--success);
    color: var(--muted);
}

.gap__status {
    display: block;
    font-size: 12px;
    color: var(--muted);
}

/* --- Математика -------------------------------------------------------- */

.math[data-display="true"] {
    display: block;
    margin: 12px 0;
    text-align: center;
    font-size: 1.1em;
    overflow-x: auto;
    overflow-y: hidden;
}

.math-rejected {
    background: #fdecea;
    color: var(--danger);
}

.katex {
    font-size: 1.08em;
}

.katex-display {
    margin: .4em 0;
}

/* --- Каталог тем: утверждённый макет 02 ------------------------------ */

/* Содержимое выровнено по краям шапки: та же ширина 1280 px и те же боковые отступы. */
.topics {
    max-width: 1280px;
    margin: 0 auto;
    padding: 22px 18px 36px;
}

.topics__heading h1 {
    font-size: clamp(28px, 3.4vw, 40px);
    letter-spacing: -.02em;
}

.topics__subtitle {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: clamp(17px, 1.6vw, 20px);
}

.topics__guest {
    max-width: 760px;
    margin: 12px 0 0;
    color: var(--muted);
}

/* Продолжение занятия. На телефоне кнопка во всю ширину под текстом, как на макете. */
.topics-resume {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 14px 16px;
    margin-top: 20px;
    padding: 16px;
    border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
    border-radius: var(--radius);
    background: var(--accent-soft);
}

.topics-resume__icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    /* Плитка чуть темнее фона блока, чтобы значок не терялся, как на макете. */
    background: color-mix(in srgb, var(--accent) 12%, var(--accent-soft));
    color: var(--accent);
}

.topics-resume__icon svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.topics-resume__text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.topics-resume__label {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
}

.topics-resume__title {
    margin: 2px 0 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}

.topics-resume__detail {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.4;
}

.app-page .topics-resume__action {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 48px;
    font-weight: 600;
}

.topics-resume__action svg,
.topiccard__chevron {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.topics-course {
    margin-top: 28px;
}

.topics-course__title {
    margin-bottom: 14px;
    font-size: 21px;
}

.topiclist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

/* Вся карточка — одна ссылка. Начатая тема выделена рамкой и словом, а не только цветом. */
.topiccard {
    display: flex;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s;
}

.topiccard:hover {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.topiccard--started {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
    background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface));
}

.topiccard__link {
    flex: 1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 14px;
    min-width: 0;
    padding: 16px 12px 16px 16px;
    color: inherit;
    text-decoration: none;
    border-radius: inherit;
}

.topiccard__body {
    display: grid;
    gap: 1px;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Плашка справа от названия, как на макете. Если не помещается, одна переходит на новую
   строку и встаёт слева: space-between ставит единственный элемент строки в её начало. */
.topiccard__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 10px;
}

.topiccard__title {
    font-size: 17px;
    font-weight: 650;
    line-height: 1.3;
}

.topiccard__chapter {
    color: var(--muted);
    font-size: 14px;
}

.topiccard__summary {
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.topiccard__badge {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.topiccard--done .topiccard__badge {
    background: var(--success-soft);
    color: var(--success);
}

/* Текст и знак начинаются сверху карточки, стрелка стоит посередине высоты, как на макете. */
.topiccard__chevron {
    align-self: center;
    color: var(--muted);
}

/* Знак темы: математика шрифтами KaTeX, как в уроке. Буквы курсивом, цифры и скобки прямо. */
.topic-icon {
    display: grid;
    place-items: center;
    align-self: start;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
    font: 23px/1 KaTeX_Main, "Times New Roman", serif;
    white-space: nowrap;
}

.topic-icon i {
    font-family: KaTeX_Math, "Times New Roman", serif;
    font-style: italic;
}

.topic-icon sup {
    position: relative;
    top: -.5em;
    font-size: .62em;
    vertical-align: baseline;
}

.topic-icon svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.topic-icon__chart {
    stroke-width: 3.4;
}

.topics .parent-link {
    margin-top: 28px;
}

@media (min-width: 720px) {
    .topics-resume {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 24px;
        margin-top: 28px;
        padding: 20px 24px;
    }

    .topics-resume__icon {
        width: 72px;
        height: 72px;
    }

    .topics-resume__icon svg {
        width: 36px;
        height: 36px;
    }

    .topics-resume__label {
        font-size: 15px;
    }

    .topics-resume__title {
        font-size: 20px;
    }

    .topics-resume__detail {
        font-size: 17px;
    }

    .app-page .topics-resume__action {
        grid-column: auto;
        width: auto;
        min-width: 190px;
        padding: 14px 26px;
    }

    .topics-course {
        margin-top: 40px;
    }

    .topics-course__title {
        margin-bottom: 18px;
        font-size: 26px;
    }

    .topiclist {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px 20px;
    }

    .topiccard__link {
        gap: 20px;
        padding: 22px 18px 22px 22px;
    }

    .topiccard__title {
        font-size: 19px;
    }

    .topiccard__chapter,
    .topiccard__summary {
        font-size: 15px;
    }

    .topic-icon {
        width: 64px;
        height: 64px;
        font-size: 30px;
    }

    .topic-icon svg {
        width: 34px;
        height: 34px;
    }
}

/* Отступы по бокам те же, что у шапки на компьютере. */
@media (min-width: 801px) {
    .topics {
        padding: 36px 32px 56px;
    }
}

/* Нижняя строка: справка и документы, спокойно и по краям содержимого. */
.app-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.app-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0 22px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 6px 18px;
}

.app-footer a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--muted);
    font-size: 14px;
    text-decoration: none;
}

.app-footer a:hover {
    color: var(--accent);
    text-decoration: underline;
}

@media (min-width: 801px) {
    .app-footer nav {
        padding: 8px 32px;
    }
}

/* Текст только для чтения с экрана: например, состояние темы словами. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* Отчёт и выдача ссылки: сначала узкий экран, затем более плотная сводка. */
.parent-report { font-size: 16px; }
.report {
    width: min(100%, 800px);
    margin: 0 auto;
    padding: 24px 16px 40px;
    overflow-wrap: anywhere;
}
.report-heading { margin-bottom: 24px; }
.report h1 { font-size: clamp(26px, 5vw, 34px); }
.report h2, .parent-link h2 { font-size: 22px; }
.report h3 { font-size: 18px; }
.report p { margin: 8px 0; }
.report-eyebrow {
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 10px;
}
.report-muted, .report-footer { color: var(--muted); font-size: 14px; }
.report-card, .parent-link {
    min-width: 0;
    padding: 20px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.report-section { margin: 28px 0; }
.report-topic-heading { display: flex; flex-wrap: wrap; align-items: start; gap: 10px; }
.report-topic-heading h3 { flex: 1 1 200px; }
.report-status {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 2px 10px;
    border-radius: 16px;
    font-size: 13px;
}
.report-mastery { color: var(--success); font-weight: 600; }
.report-stats { display: grid; gap: 12px; margin: 20px 0; }
.report-stats > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 8px;
}
.report-stats dt { font-size: 14px; }
.report-stats dd { margin: 0; color: var(--accent); font-size: 24px; font-weight: 650; white-space: nowrap; }
.report-skills, .report-items { list-style: none; margin: 16px 0 0; padding: 0; }
.report-skills li, .report-items li { min-width: 0; padding: 14px 0; border-top: 1px solid var(--border); }
.report-skill-title, .report-skill-state { display: block; }
.report-skill-state { color: var(--muted); font-size: 14px; margin: 3px 0 8px; }
.report-skill-state--mastered { color: var(--success); }
.report-formula { display: block; max-width: 100%; overflow-x: auto; padding: 4px 0; }
.report-gap-status { color: var(--warning); font-size: 14px; }
.report-resolved { padding-left: 20px; }
.report-resolved li { padding: 4px 0; }
.report-empty { padding: 8px 12px; border-left: 3px solid var(--border); }
.report-footer { margin-top: 24px; }
.report-footer p + p { margin-top: 16px; }
.parent-link { margin-top: 28px; font-size: 16px; }
.parent-link label { display: block; margin-top: 14px; font-size: 14px; }
.parent-link input {
    width: 100%;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 16px;
    background: var(--bg);
    color: var(--text);
}
.parent-link-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.parent-link .button { min-height: 44px; white-space: normal; text-align: left; }
.parent-link input:focus-visible, .parent-link .button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#parent-link-message { min-height: 1.6em; font-size: 14px; color: var(--muted); }
@media (min-width: 600px) {
    .report { padding-top: 40px; }
    .report-card, .parent-link { padding: 24px; }
    .report-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Общий SVG-компонент. Декоративные значки скрыты от чтения и не перехватывают нажатие. */
.ui-icon { display: inline-block; width: 1em; height: 1em; flex: 0 0 auto; vertical-align: -.15em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
:is(.ui-link, .profile-back):has(> .ui-icon) { gap: .4em; }
/* Брендовый значок (Telegram, MAX): цветной SVG из /icons/brand картинкой <img alt="">, а не маской —
   градиенты и цвета бренда сохраняются. Рядом всегда есть текстовая подпись. */
.brand-icon { display: inline-block; width: 1em; height: 1em; flex: 0 0 auto; vertical-align: -.15em; pointer-events: none; }
.ui-link:has(> .brand-icon) { gap: .4em; }

/* Текстовая ссылка: явное подключение, без влияния на кнопки, карточки и меню. */
.ui-link, .ui-text-links a[href]:not(.button) {
    padding: 2px 4px;
    color: var(--link-text);
    font-weight: 650;
    text-decoration: none;
    border-radius: 3px;
    overflow-wrap: anywhere;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}
.ui-link:visited, .ui-text-links a[href]:not(.button):visited { color: var(--link-text); }
.ui-link--action { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 8px; }
@media (hover: hover) {
    .ui-link[href]:hover, .ui-text-links a[href]:not(.button):hover { color: var(--link-hover); background-color: var(--accent-soft); }
}
.ui-link[href]:focus-visible, .ui-text-links a[href]:not(.button):focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; background-color: var(--accent-soft); }
.ui-link[href]:active, .ui-text-links a[href]:not(.button):active { color: var(--link-active); background-color: var(--link-active-bg); }
.ui-link[aria-disabled=true] { color: var(--muted); cursor: default; }
/* Действие без перехода в виде ссылки («Изменить», «Показать решение целиком»): та же ссылка на кнопке. */
button.ui-link { padding: 2px 4px; border: 0; background: none; font: inherit; font-weight: 650; text-align: left; cursor: pointer; }
button.ui-link.ui-link--action { padding: 6px 8px; }
@media (hover: hover) {
    button.ui-link:hover:not(:disabled) { color: var(--link-hover); background-color: var(--accent-soft); }
}
button.ui-link:focus-visible { background-color: var(--accent-soft); }
button.ui-link:active:not(:disabled) { color: var(--link-active); background-color: var(--link-active-bg); }
button.ui-link:disabled { color: var(--muted); cursor: default; }
@media (prefers-reduced-motion: no-preference) {
    .ui-link, .ui-text-links a[href]:not(.button) { transition: color var(--motion-fast), background-color var(--motion-fast); }
}

/* Крупные цели касания и явный фокус для клавиатуры. */
.tab, .button, summary { min-height: 44px; min-width: 44px; }
/* Общий disclosure сохраняет native details без JavaScript; меню шапки — отдельный тип. */
details:not([data-app-menu]) > summary { position: relative; display: flex; align-items: center; min-height: 56px; margin: 0; padding: 12px 60px 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 16px; line-height: 1.45; font-weight: 600; list-style: none; cursor: pointer; overflow-wrap: anywhere; transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease; }
details:not([data-app-menu]) > summary::-webkit-details-marker { display: none; }
details:not([data-app-menu]) > summary::marker { content: ''; }
details:not([data-app-menu]) > summary::after { content: ''; position: absolute; right: 12px; top: calc(50% - 16px); width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); }
details:not([data-app-menu]) > summary::before { content: ''; position: absolute; z-index: 1; right: 18px; top: calc(50% - 10px); width: 20px; height: 20px; background-color: var(--accent); -webkit-mask: url('/icons/chevron-down.svg') center / contain no-repeat; mask: url('/icons/chevron-down.svg') center / contain no-repeat; transform: rotate(0); transition: transform 200ms ease; }
details:not([data-app-menu])[open] > summary { background: var(--accent-soft); }
details:not([data-app-menu])[open] > summary::after { background: var(--surface); }
details:not([data-app-menu])[open] > summary::before { transform: rotate(180deg); }
details:not([data-app-menu])[data-disclosure-state=closed] > summary { background: var(--surface); }
details:not([data-app-menu])[data-disclosure-state=closed] > summary::after { background: var(--accent-soft); }
details:not([data-app-menu])[data-disclosure-state=closed] > summary::before { transform: rotate(0); }
details:not([data-app-menu]) > summary:hover { background: var(--accent-soft); border-color: var(--accent); }
details:not([data-app-menu]) > summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; box-shadow: var(--focus-ring); }
details[data-disclosure-animating] { box-sizing: border-box; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.composer__input::placeholder { color: var(--muted); opacity: 1; }
math-field::part(virtual-keyboard-toggle), math-field::part(menu-toggle) {
    min-width: 40px; min-height: 40px; width: 40px; height: 40px;
}
.taskcard__instruction p, .taskcard__given p, .taskcard__condition p { margin: 0; }
.topbar__progress { flex-wrap: wrap; min-width: 0; }
.topbar__counter { white-space: normal; }

/* Общая оболочка внутренних экранов: эталон от 27 сентября 2026. */
.app-page { font-size: 17px; line-height: 1.55; }
.ui-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.ui-shell > main { flex: 1; width: 100%; }
.ui-shell > header, .ui-shell > footer { flex-shrink: 0; }
.app-header { font-size: 17px; line-height: 1.55; }
.app-header { background: var(--surface); border-bottom: 1px solid var(--border); position: relative; z-index: 20; }
.app-header__inner { max-width: 1280px; margin: auto; min-height: 76px; padding: 8px 32px; display: flex; align-items: center; gap: 42px; }
.app-brand { display: inline-flex; align-items: center; flex-shrink: 0; color: var(--text); text-decoration: none; line-height: 1; border-radius: 8px; }
.app-brand img { display: block; width: 175px; height: 60px; }
.app-brand:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.brand-entry { max-width: 1160px; width: 100%; margin: 0 auto; padding: 16px 20px 0; }
.brand-students { display: flex; justify-content: center; gap: 20px; margin: 0 0 20px; }
.brand-students img { width: 110px; height: 124px; max-width: 42%; object-fit: contain; }
.brand-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; clear: both; }
.profile-form .brand-choices label { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 0; padding: 18px 6px 12px; border: 2px solid var(--border); border-radius: 12px; cursor: pointer; font-size: 14px; }
.profile-form .brand-choices input { position: absolute; top: 8px; left: 8px; width: auto; min-height: 0; margin: 0; accent-color: var(--accent); }
.brand-choices label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.brand-choices label:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
@media (max-width: 600px) { .brand-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.app-links { display: flex; align-items: stretch; gap: 10px; align-self: stretch; }
.app-links a { display: flex; align-items: center; gap: 9px; padding: 0 17px; color: var(--muted); font-weight: 550; text-decoration: none; border-bottom: 3px solid transparent; }
/* Значки разделов и меню — линии текущего цвета текста, как на макетах 02–04. */
.app-links svg, .app-dropdown svg, .app-mobile-menu summary svg, .app-account__chevron { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-account__chevron { width: 18px; height: 18px; color: var(--muted); }
.app-links a[aria-current=page] { color: var(--accent); border-bottom-color: var(--accent); }
.app-links a:hover { background: var(--accent-soft); border-radius: 8px 8px 0 0; }
.app-account { margin-left: auto; position: relative; min-width: 0; }
.app-account summary { display: flex; align-items: center; gap: 12px; padding: 4px 8px; border-radius: 12px; color: var(--text); list-style: none; font-size: 15px; }
.app-account summary::-webkit-details-marker, .app-mobile-menu summary::-webkit-details-marker { display: none; }
.app-account summary:hover, .app-account[open] summary { background: var(--bg); }
.app-account img { object-fit: cover; border-radius: 50%; flex-shrink: 0; }
.app-account [data-account-name] { max-width: 230px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.app-dropdown { position: absolute; top: calc(100% + 10px); right: 0; width: 280px; max-width: calc(100vw - 32px); padding: 10px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 12px 40px rgb(19 35 72 / 12%); }
.app-dropdown a, .app-dropdown button { display: flex; align-items: center; gap: 12px; min-height: 46px; width: 100%; padding: 10px 14px; border: 0; border-radius: 9px; color: var(--text); background: transparent; text-align: left; text-decoration: none; font: inherit; cursor: pointer; }
.app-dropdown a:hover, .app-dropdown button:hover { background: var(--accent-soft); }
.app-dropdown a[aria-current=page] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.app-dropdown__identity { display: grid; gap: 2px; padding: 10px 14px 15px; margin-bottom: 6px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.app-dropdown__identity span { color: var(--muted); font-size: 14px; }
.app-dropdown form { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
.app-mobile-menu { display: none; position: relative; }
.app-signin { margin-left: auto; text-decoration: none; color: var(--accent); padding: 10px 18px; min-height: 44px; border-radius: 10px; background: var(--accent-soft); }
.app-page .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; padding: 12px 20px; font: inherit; border-radius: 10px; }
.app-page .button--primary { background: var(--accent); color: white; border-color: var(--accent); }
.lesson-page [hidden] { display: none !important; }
.lesson-toolbar { max-width: 1160px; margin: 14px auto 0; border: 1px solid var(--border); border-radius: 14px; padding: 12px 20px; }
.lesson-toolbar .topbar__source { max-width: 600px; }
.lesson-page .workspace { max-width: 1200px; height: calc(var(--lesson-viewport, 100dvh) - var(--lesson-chrome, 170px) - 14px); min-height: 440px; padding: 16px 24px; }
.lesson-page .chat { max-width: 1120px; position: relative; }
.lesson-page .chat__list { gap: 18px; padding: 4px 6px 12px; overscroll-behavior: contain; }
.message__delivery { margin: 0; font-size: 13px; color: var(--muted); }
/* Пока сообщение отправляется, подписи нет: ход запроса пишет строка под полем ввода. */
.message__delivery:empty { display: none; }

/* Лента переписки с кнопкой «вниз», как в мессенджере (docs/design/chat-scroll-analysis.md). Одна
   для всех чатов: кнопка висит поверх нижнего края ленты и не сдвигает ни переписку, ни поле ввода. */
.chat-scroll { position: relative; min-width: 0; min-height: 0; }
.chat > .chat-scroll { display: flex; flex-direction: column; flex: 1 1 auto; }
.chat-scroll__jump { position: absolute; right: 12px; bottom: 12px; z-index: 3; }
.chat-scroll__jump[hidden] { display: none; }
.chat-scroll__jump:not([hidden]) { animation: chat-scroll-in var(--motion-fast) ease-out; }
/* Круглая кнопка-значок поверх содержимого: белая, с тенью, чтобы читалась на любом фоне. */
.iconbutton--float { width: 48px; height: 48px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); box-shadow: 0 2px 10px rgb(16 24 40 / 16%); transition: background-color var(--motion-fast), color var(--motion-fast); }
.iconbutton--float:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.iconbutton--float:active:not(:disabled) { filter: brightness(.94); }
.iconbutton--float svg { width: 24px; height: 24px; stroke-width: 2; }
/* Сколько новых сообщений ниже — кружок над кнопкой, как в мессенджере. */
.chat-scroll__count { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; line-height: 22px; text-align: center; white-space: nowrap; box-shadow: 0 0 0 2px var(--surface); }
.chat-scroll__count[hidden] { display: none; }
@keyframes chat-scroll-in { from { opacity: 0; transform: translateY(8px) scale(.9); } }
/* Образец в /dev/lesson-chat: лента своей высоты, чтобы было что прокручивать. */
.lesson-chat-demo__scroll { height: 360px; }
@media (prefers-reduced-motion: reduce) {
    .chat-scroll__jump:not([hidden]) { animation: none; }
    .iconbutton--float { transition: none; }
}
@media (max-width: 600px) {
    .chat-scroll__jump { right: 8px; bottom: 8px; }
    .iconbutton--float { width: 44px; height: 44px; }
}
.lesson-page .taskcard { border-radius: 13px; background: #f3f7ff; }
.lesson-page .composer { border-radius: 16px; background: var(--surface); flex-shrink: 0; }
.lesson-page .composer:not(:has([data-input-mode="handwriting"][aria-selected="true"])) { max-height: none; overflow: visible; }
.lesson-page .composer__input { font-size: 17px; }
.lesson-page.is-busy, .lesson-page.is-busy .tab { cursor: auto; }
.lesson-page.is-busy .composer__input { cursor: text; }
.lesson-page.is-busy .button:not(:disabled), .lesson-page.is-busy .iconbutton:not(:disabled) { cursor: pointer; }
@media (max-width: 800px) {
    .lesson-toolbar { margin: 8px 10px 0; padding: 10px 12px; gap: 10px; }
    .lesson-toolbar .topbar__title { flex: 1 1 100%; }
    .lesson-toolbar .topbar__source { display: none; }
    .lesson-toolbar .topbar__progress { margin-left: 0; flex: 1; }
    .lesson-toolbar .progressbar { width: 100px; }
    .lesson-toolbar .topbar__counter { font-size: 12px; }
    .lesson-page .workspace { padding: 10px; }
}
.profile-dashboard { max-width: 1180px; margin: auto; padding: 36px 28px 64px; }
.profile-page-title { margin-bottom: 28px; }
.profile-page-title h1 { font-size: clamp(28px, 3.4vw, 40px); letter-spacing: -.7px; }
.app-eyebrow { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.profile-hero { display: flex; align-items: center; gap: 28px; padding: 32px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface); }
.profile-hero__avatar { position: relative; flex-shrink: 0; display: block; width: 120px; height: 120px; }
.profile-hero__avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.profile-hero__avatar > span { position: absolute; bottom: 0; right: 0; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: white; border: 3px solid white; }
.profile-hero__identity { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.profile-hero__identity h2 { font-size: clamp(23px, 2.6vw, 30px); letter-spacing: -.4px; }
.profile-handle { color: var(--muted); margin: 7px 0; }
.profile-grade { display: inline-block; margin: 0 0 18px; padding: 4px 12px; border-radius: 8px; background: var(--bg); font-size: 14px; }
.profile-hero__identity .button { display: flex; width: fit-content; }
.profile-address { width: 290px; flex-shrink: 0; background: #f0f5ff; border-radius: 14px; padding: 24px; overflow-wrap: anywhere; }
.profile-address h3 { font-size: 17px; }
.profile-address p { color: var(--muted); font-size: 14px; margin-bottom: 0; }
.profile-address .profile-address__name { color: var(--text); font-weight: 700; font-size: 27px; margin: 12px 0; }
.profile-columns { display: grid; grid-template-columns: 1.25fr 1fr; gap: 22px; margin-top: 22px; }
.profile-surface { min-width: 0; padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; }
.profile-surface h2 { font-size: 22px; }
.profile-facts { margin: 20px 0; }
.profile-facts > div { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.profile-facts dt { color: var(--muted); }
.profile-facts dd { margin: 0; overflow-wrap: anywhere; }
.profile-member { display: flex; align-items: center; gap: 14px; padding: 16px; margin-top: 20px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); text-decoration: none; }
.profile-member:hover { background: var(--accent-soft); border-color: var(--accent); }
.profile-member img { object-fit: cover; border-radius: 50%; flex-shrink: 0; }
.profile-member > span:not(:last-child) { display: grid; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.profile-member > span > span { font-size: 14px; color: var(--muted); }
.profile-member > span:last-child { margin-left: auto; font-size: 24px; color: var(--muted); }
.profile-topic-link { display: flex; justify-content: space-between; align-items: center; gap: 16px; color: var(--accent); background: var(--accent-soft); border-radius: 12px; padding: 18px 20px; text-decoration: none; }
.profile-topic-link > span:first-child { display: grid; gap: 3px; }
.profile-topic-link > span > span { font-size: 14px; color: var(--muted); }
.profile-back { display: inline-flex; align-items: center; padding: 9px 14px; min-height: 44px; margin-bottom: 12px; text-decoration: none; border-radius: 9px; color: var(--accent); background: var(--accent-soft); }
.profile-settings { max-width: 820px; }
.profile-settings .profile-form:not(dialog) > fieldset { padding: 22px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.profile-settings .profile-form:not(dialog) legend { float: left; width: 100%; margin: 0 0 14px; padding: 0; font-size: 21px; }
.profile-settings .profile-form:not(dialog) fieldset > .profile-help:first-of-type { clear: both; }
@media (max-width: 800px) {
    .app-header__inner { gap: 14px; padding: 7px 18px; min-height: 68px; }
    .app-brand img { width: 157.5px; height: 54px; }
    .app-links { display: none; }
    .app-mobile-menu { display: block; }
    .app-mobile-menu summary { display: grid; place-items: center; padding: 6px; list-style: none; color: var(--text); }
    .app-mobile-menu summary svg { width: 26px; height: 26px; }
    .app-account { margin-left: auto; }
    .app-account [data-account-name], .app-account__chevron { display: none; }
    .app-account summary { padding: 2px; }
    .app-mobile-menu .app-dropdown { left: 0; right: auto; }
    .profile-dashboard { padding: 24px 18px 40px; }
    .profile-hero { flex-wrap: wrap; padding: 24px; gap: 20px; }
    .profile-address { width: 100%; }
    .profile-columns { grid-template-columns: 1fr; }
    .profile-surface { padding: 22px; }
}
@media (max-width: 480px) {
    .profile-hero { flex-direction: column; align-items: center; text-align: center; }
    .profile-hero__identity .button { width: 100%; }
    .profile-hero__identity { width: 100%; }
    .profile-address { text-align: left; padding: 20px; }
    .profile-facts > div { grid-template-columns: 85px 1fr; gap: 12px; }
    .profile-settings { padding: 24px 18px 40px; }
}
.lesson-login {
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.lesson-login h2 { margin: 0; font-size: 1.1rem; }
.lesson-login p { margin: 8px 0; }
.lesson-login [data-login-status]:empty { display: none; }
.lesson-login__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Общий вход и личные режимы: ограниченный блок по утверждённым макетам v2. */
.access-page {
    --access-navy: var(--text);
    --access-blue: var(--accent);
    --access-muted: var(--muted);
    --access-border: var(--border);
    background: var(--bg);
    color: var(--access-navy);
    font: 16px/1.4 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    min-height: 100dvh;
    padding: 40px 16px;
}
.access-page [hidden] { display: none !important; }
.access-card { width: 100%; max-width: 480px; margin: 0 auto; overflow: hidden; }
.ui-card.access-card { padding: 0; }
.access-header { min-height: 80px; margin: 0 10px; padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #e9eff9; }
.access-header > a { display: inline-flex; align-items: center; min-height: 44px; }
.access-header img { display: block; width: 168px; height: auto; }
.access-page a:not(.ui-link):not(.button) { color: var(--access-blue); }
.access-help { gap: 8px; white-space: nowrap; font-size: 14px; text-decoration: none; }
.access-help > span { border: 1.6px solid currentColor; width: 19px; height: 19px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 14px; line-height: 1; }
.access-content { padding: 18px 26px 26px; }
.access-content h1 { font-size: 28px; font-weight: 750; line-height: 1.2; letter-spacing: -.7px; margin: 0; }
.access-content h2 { font-size: 21px; }
.access-intro { color: var(--access-muted); margin: 6px 0 18px; line-height: 1.4; }
/* Почта входа под заголовком: видно, в какой аккаунт вошли, если их несколько. */
.access-account { margin-bottom: 0; }
.access-account strong { color: var(--access-navy); font-weight: 600; overflow-wrap: anywhere; }
.access-account + .access-modes { margin-top: 20px; }
.access-account + .access-notice { margin-top: 18px; }
.access-tabs { display: flex; padding: 1px; border: 1px solid #dce7ff; border-radius: 11px; background: #ebf2ff; margin: 16px 0 18px; }
.access-tabs a { flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center; color: #3a55a0; border-radius: 10px; text-decoration: none; font-size: 15px; }
.access-tabs .is-active { background: var(--access-blue); color: white; }
.access-form { display: flex; flex-direction: column; gap: 7px; }
.access-form label, .access-profile-fields label { font-size: 15px; color: var(--muted); }
.access-form input::placeholder { color: var(--muted); }
.access-form > label:not(:first-child):not(.access-check) { margin-top: 5px; }
.access-page button { font: inherit; cursor: pointer; }
.access-page .access-primary { width: 100%; min-height: 48px; margin-top: 10px; }
.access-primary-link { text-decoration: none; }
.access-page .access-check { display: flex; align-items: flex-start; gap: 10px; margin: 9px 0 3px; color: var(--access-navy); font-size: 13px; line-height: 1.45; }
.access-check input { appearance: auto; flex: 0 0 20px; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--access-blue); }
.access-footnote { margin: 24px 0 4px; color: var(--access-muted); text-align: center; font-size: 14px; }
.access-card--login .access-content { min-height: 394px; }
.access-password { position: relative; }
.access-password input { padding-right: 48px !important; }
.access-password button { position: absolute; right: 0; top: 0; width: 44px; min-height: 44px; border: 0; background: transparent; color: #6983ba; }
.access-password-links { margin: 8px 0 -8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.access-password-links a { min-height: 44px; display: flex; align-items: center; }
.access-otp { padding: 16px 0; border-bottom: 1px solid var(--access-border); }
.access-provider-options { border-top: 1px solid var(--access-border); margin-top: 22px; padding-top: 16px; }
.access-provider-options h2 { font-size: 16px; margin-bottom: 12px; }
.access-provider-options .auth-providers { display: grid; gap: 8px; }
.access-provider-options button { width: 100%; background: var(--accent-soft); border: 1px solid var(--access-border); color: var(--access-blue); min-height: 44px; border-radius: 8px; }
.access-back { display: flex; align-items: center; gap: 12px; min-height: 44px; margin: -14px 0 12px; text-decoration: none; font-size: 15px; }
.access-back span { font-size: 25px; line-height: 1; }
.access-pin-field { position: relative; margin-top: 2px; }
.access-pin-field > label { display: block; margin-bottom: 5px; }
.access-pin { position: relative; height: 48px; }
.access-pin input { height: 100%; }
.access-pin-cells { display: none; }
.access-pin.is-enhanced input { position: absolute; inset: 0; z-index: 1; color: transparent; caret-color: transparent; background: transparent; border: 0; -webkit-text-security: none; }
.access-pin.is-enhanced .access-pin-cells { display: grid; height: 100%; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; pointer-events: none; }
.access-pin-cells span { display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; font-size: 25px; color: var(--text); }
.access-pin:focus-within .access-pin-cells span { border-color: var(--accent); }
.access-pin:has(input[aria-invalid=true]) .access-pin-cells span { border-color: var(--danger); }
.access-pin-toggle { display: block; margin: 0 0 0 auto; min-height: 44px; padding: 2px 0; border: 0; background: transparent; color: var(--muted); text-decoration: underline; font: inherit; font-size: 14px; }
.access-unlock-form { margin-top: 26px; }
.access-unlock-form .access-pin-field > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.access-unlock-form .access-primary { margin-top: 6px; }
.access-center { margin: 14px 0 4px; text-align: center; }
.access-center a { display: inline-flex; align-items: center; min-height: 44px; }
.access-card--unlock { min-height: 440px; }
.access-card--student { min-height: 620px; }
.access-card--student .access-content { padding-top: 24px; padding-bottom: 32px; }
.access-card--student .access-back { margin-bottom: 26px; }
.access-card--student .access-intro { margin: 12px 0 24px; font-size: 18px; }
.access-card--student .access-pin { height: 60px; }
.access-card--student .access-form > .access-pin-field + .access-pin-field { margin-top: 10px; }
.access-card--student .access-unlock-form { margin-top: 42px; }
.access-card--student .access-unlock-form .access-primary { margin-top: 16px; }
.access-card--student .access-footnote { font-size: 16px; }
.access-card--recover .access-form { margin-top: 30px; }
.access-card--recover #recoveryCode { min-height: 58px; font-size: 20px; }
.access-card--recover [data-recovery-new-pin] .access-pin-field { margin-top: 16px; }
.access-modes { display: grid; gap: 14px; margin-top: 28px; }
.access-mode { display: flex; align-items: center; gap: 20px; border: 1px solid var(--access-border); border-radius: 12px; padding: 18px 16px; text-decoration: none; min-height: 106px; transition: background-color var(--motion-fast), border-color var(--motion-fast); }
.access-mode:hover { background: var(--accent-soft); border-color: var(--accent); }
.access-mode-icon { width: 62px; height: 62px; border-radius: 50%; background: var(--accent-soft); display: flex; justify-content: center; align-items: center; flex-shrink: 0; }
.access-mode svg { fill: none; stroke: currentColor; stroke-width: 2; width: 34px; height: 34px; }
.access-mode-body { min-width: 0; flex: 1; }
.access-mode-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 20px; font-weight: 700; color: var(--access-navy); }
.access-badge { display: inline-flex; align-items: center; gap: 7px; padding: 4px 9px; background: var(--accent-soft); color: var(--access-blue); border-radius: 18px; font-size: 12px; font-weight: 400; white-space: nowrap; }
.access-badge svg { width: 16px; height: 18px; }
.access-mode-description { display: block; color: var(--access-muted); font-size: 14px; margin-top: 4px; }
.access-chevron { color: var(--access-navy); font-size: 30px; }
.access-logout { border-top: 1px solid #e8eef9; margin: 30px -2px -14px; padding-top: 8px; text-align: center; }
.access-logout button { min-height: 44px; border: 0; background: transparent; color: var(--access-blue); }
.access-backup { background: var(--accent-soft); padding: 10px 16px 12px; border-radius: 12px; margin: 8px 0 12px; }
.access-backup-value { display: block; width: 100%; min-width: 0; border: 0; background: transparent; text-align: center; padding: 0; margin: 0 0 10px; color: var(--access-navy); line-height: 1.5; font-family: ui-monospace, Consolas, monospace; font-size: 18px; font-weight: 700; resize: none; overflow-wrap: anywhere; word-break: break-all; overflow: hidden; }
.access-backup button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; border: 1px solid var(--access-border); border-radius: 8px; background: #f8faff; color: var(--access-blue); font-weight: 600; }
.access-card--backup .access-content { padding-top: 26px; }
.access-card--backup .access-check { font-size: 15px; }
.access-profile-fields { display: grid; gap: 7px; margin-bottom: 15px; }
.access-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 520px) {
    .access-page { padding: 16px; }
    .access-header { padding: 8px 4px; gap: 5px; min-height: 72px; }
    .access-header img { width: 148px; }
    .access-help { font-size: 12px; gap: 5px; }
    .access-help > span { width: 17px; height: 17px; font-size: 12px; }
    .access-content { padding: 18px 16px 24px; }
    .access-content h1 { font-size: 25px; letter-spacing: -.5px; }
    .access-mode { gap: 12px; padding: 15px 12px; }
    .access-mode-icon { width: 44px; height: 44px; }
    .access-mode svg { width: 27px; height: 27px; }
    .access-mode-title { font-size: 18px; gap: 5px; }
    .access-badge { font-size: 11px; }
    .access-badge svg { width: 14px; height: 16px; }
    .access-card--student .access-intro { font-size: 16px; }
    .access-card--student { min-height: 560px; }
    .access-pin.is-enhanced .access-pin-cells { gap: 6px; }
    .access-backup-value { font-size: 18px; }
    .access-password-links { flex-wrap: wrap; column-gap: 12px; row-gap: 0; }
    .access-card--recover #recoveryCode { font-size: 16px; }
}

/* Закрытая вкладка не показывает личные сведения другому участнику. */
.personal-locked > :not(.personal-lock):not(script):not(style) { visibility: hidden !important; }
.personal-lock { position: fixed; inset: 10% 16px auto; max-width: 480px; margin: auto; padding: 24px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); z-index: 10000; }
.personal-lock h1 { font-size: 24px; }
.personal-lock .button { margin-top: 12px; }
/* Общие компоненты: один контракт состояний для всех разделов. */
.ui-page { width: min(1120px, calc(100% - 40px)); margin: 36px auto 64px; }
.ui-stack { display: grid; gap: 20px; }
.ui-stack > p { margin: 0; }
.ui-card { min-width: 0; padding: clamp(20px, 3vw, 32px); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.ui-muted { color: var(--muted); font-size: 15px; }
.ui-field { display: grid; gap: 7px; min-width: 0; }
.ui-field label { font-size: 16px; font-weight: 600; }
.ui-field :where(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea),
.ui-form :where(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea) { width: 100%; min-width: 0; min-height: 48px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: var(--surface); font: inherit; }
.ui-field p { margin: 0; font-size: 14px; }
.ui-form label { font-size: 16px; }
.ui-field-error { color: var(--danger); font-size: 14px; margin: 6px 0 0; }
:is(input, select, textarea)[aria-invalid=true] { border-color: var(--danger); }
.ui-notice { padding: 14px 18px; margin: 0; border: 1px solid #c5d7f8; border-radius: 12px; background: var(--accent-soft); color: var(--text); font-size: 16px; overflow-wrap: anywhere; }
.ui-notice--error { background: #fff1ef; border-color: #f0bdb8; color: var(--danger); }
.ui-notice--success { background: var(--success-soft); border-color: #b6d8c3; color: var(--success); }
.ui-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
/* Таблица данных (предложение): узкий экран прокручивает её вбок в своей рамке, первая колонка
   остаётся на месте. Область прокрутки получает фокус и подпись для чтения с экрана. */
.ui-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.ui-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; font-variant-numeric: tabular-nums; }
.ui-table th, .ui-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: right; vertical-align: top; white-space: nowrap; }
.ui-table thead th { min-width: 84px; color: var(--muted); font-size: 14px; font-weight: 650; white-space: normal; vertical-align: bottom; }
.ui-table tr > :first-child { position: sticky; left: 0; z-index: 1; min-width: 0; background: var(--surface); text-align: left; box-shadow: inset -1px 0 0 var(--border); }
.ui-table tbody th { font-weight: 650; }
.ui-table tbody tr:last-child > * { border-bottom: 0; }
.ui-table__note { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
@media (max-width: 599px) { .ui-table th, .ui-table td { padding: 8px 10px; } }
.lesson-page .composer { box-shadow: none; padding: 10px 14px 12px; }
.lesson-page .composer__head { margin-bottom: 8px; }
.lesson-page .composer__status:has([data-status-text]:empty) { display: none; }
.lesson-page .tab { border-radius: 9px; }
.lesson-page .progressbar__fill { background: var(--accent); }
.lesson-page .progressbar[data-complete] .progressbar__fill { background: var(--success); }
.app-dropdown__identity { grid-template-columns: 48px minmax(0, 1fr); column-gap: 12px; }
.app-dropdown__identity img { grid-row: 1 / 3; }
.app-dropdown__identity strong, .app-dropdown__identity span { grid-column: 2; }
@media (max-width: 800px) {
    .lesson-page .workspace { min-height: 260px; }
    .lesson-page .composer { padding: 8px 10px 10px; }
}
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; transition: background-color var(--motion-fast), border-color var(--motion-fast), box-shadow var(--motion-fast); }
.button--danger { background: var(--danger); border-color: var(--danger); color: white; }
.button--danger:hover:not(:disabled) { background: #8c1e18; }
/* Второстепенное действие рядом с главным: синяя рамка и текст («Исправить», ступени помощи). */
.button--outline { border-color: var(--accent); background: var(--surface); color: var(--accent); }
.button--outline:hover:not(:disabled) { background: var(--accent-soft); }
.app-page .button--suggestion { min-height:44px; padding:10px 16px; border-radius:18px; border-color:transparent; background:var(--accent-soft); color:var(--link-text); font-size:14px; white-space:normal; text-align:left; }
.button--suggestion:hover:not(:disabled) { background:var(--link-active-bg); }
.ui-question-catalog { width:min(640px, calc(100% - 32px)); max-height:85dvh; overflow:hidden; padding:24px; }
.ui-question-catalog[open] { display:flex; flex-direction:column; }
.ui-question-catalog .ui-dialog-heading { flex:none; }
.ui-question-catalog .ui-dialog-heading h2 { margin:0; font-size:28px; line-height:1.3; }
.ui-question-catalog .ui-dialog-heading p { margin:6px 0 0; font-size:15px; color:var(--muted); }
.ui-question-catalog__body { min-height:0; overflow-y:auto; display:grid; gap:22px; margin-top:22px; padding-right:4px; }
.ui-question-catalog .ui-question-catalog__body h3 { font-size:19px; line-height:1.35; margin:0 0 9px; }
.ui-question-catalog__questions { display:flex; flex-wrap:wrap; gap:7px; }
.ui-question-catalog__questions .button.button--suggestion { width:auto; }
.ui-question-catalog__notice { flex:none; margin-top:16px; }
.ui-question-catalog__notice p { margin:0 0 8px; }
@media (max-width:480px) {
    .ui-question-catalog.ui-dialog--sheet { max-height:70dvh; padding:22px 18px calc(18px + env(safe-area-inset-bottom)); }
    .ui-question-catalog .ui-dialog-heading h2 { font-size:23px; }
    .ui-question-catalog .ui-dialog-heading p { font-size:13px; }
    .ui-question-catalog__body { gap:20px; margin-top:20px; }
    .ui-question-catalog .ui-question-catalog__body h3 { font-size:17px; }
    .ui-question-catalog__questions { align-items:flex-start; flex-direction:column; }
}
.button:active:not(:disabled) { filter: brightness(.94); }
:is(button, input, textarea, select, a, summary, [tabindex]):focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
:is(input, textarea, select):focus-visible { box-shadow: var(--focus-ring); }
[aria-invalid=true]:focus-visible { outline-color: var(--danger); box-shadow: 0 0 0 4px rgb(179 38 30 / 12%); }
button:disabled, input:disabled { cursor: not-allowed; }
[aria-busy=true] button[type=submit] { cursor: progress; }
.ui-dialog { width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: clamp(20px, 4vw, 32px); margin: auto; overflow: auto; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: 0 24px 80px rgb(19 35 72 / 20%); }
.ui-dialog:not([open]) { display: none; }
.ui-dialog::backdrop { background: rgb(19 35 72 / 40%); }
/* Окно для работы со снимком: крупное на компьютере, на весь экран на телефоне. Рамки отступов нет —
   содержимое само раскладывает полосы и сцену. */
.ui-dialog--full { width: min(960px, calc(100% - 64px)); height: min(760px, calc(100dvh - 64px)); max-width: none; max-height: none; padding: 0; overflow: hidden; }
.ui-dialog--full[open] { display: flex; flex-direction: column; }
/* Под окном на весь экран страница не прокручивается и не показывает свою полосу прокрутки. */
html:has(.ui-dialog--full[open]) { overflow: hidden; }
.ui-dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.ui-dialog-heading h2 { font-size: 24px; }
.ui-dialog-heading .iconbutton { flex-shrink: 0; font-size: 24px; }
dialog[open] { animation: ui-appear 160ms ease-out; }
@keyframes ui-appear { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 480px) {
    .ui-page { width: calc(100% - 32px); margin-top: 24px; }
    .ui-actions > .button { flex: 1 1 auto; }
    .ui-dialog--sheet { width: 100%; max-width: none; max-height: 92dvh; margin: auto 0 0; border-radius: 22px 22px 0 0; padding: 28px 20px calc(22px + env(safe-area-inset-bottom)); }
}
/* Телефон в любом положении: редактору фото нужен весь экран. */
@media (max-width: 700px), (max-height: 560px) {
    .ui-dialog--full { width: 100%; height: 100%; height: 100dvh; margin: 0; border: 0; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Предмет, класс и продолжение используют общие карточки каталога. */
.learning-catalog { max-width: 1060px; padding: 28px 18px 48px; }
.learning-breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.learning-breadcrumbs a { min-height: 44px; display: inline-flex; align-items: center; }
.learning-grid { display: grid; gap: 20px; }
.learning-upcoming { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--border); }
.learning-upcoming h2 { font-size: 24px; }
.learning-upcoming .learning-note { margin-top: 8px; }
.learning-upcoming-grid { display: grid; gap: 12px; }
.learning-subject--upcoming { display: flex; align-items: center; gap: 14px; padding: 18px; min-width: 0; box-shadow: none; }
.learning-subject--upcoming .learning-card-icon { flex-shrink: 0; background: var(--bg); color: var(--muted); }
.learning-subject--upcoming h3 { font-size: 17px; overflow-wrap: anywhere; }
.learning-subject__status { display: inline-block; margin-top: 6px; font-size: 13px; color: var(--muted); }
@media (min-width: 600px) { .learning-upcoming-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .learning-upcoming-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: no-preference) {
    .app-links a, .app-signin { transition: color var(--motion-fast), background-color var(--motion-fast), border-color var(--motion-fast); }
    .learning-grid .topiccard:has(a) { transition: border-color 200ms ease-out, box-shadow 200ms ease-out; }
    .learning-grid .topiccard:has(a):hover { box-shadow: 0 4px 16px rgb(19 35 72 / 6%); }
    html:has(.landing) { scroll-behavior: smooth; }
}
.learning-grid .topiccard__link { align-items: center; min-height: 160px; padding: 22px; }
.learning-card-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.learning-card-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.learning-book-cover { display: flex; flex-direction: column; justify-content: space-between; background: var(--accent-soft); color: var(--accent); border-left: 4px solid var(--accent); border-radius: 4px 10px 10px 4px; min-width: 74px; height: 108px; padding: 12px; font-size: 11px; }
.learning-book-cover strong { font-size: 28px; }
.learning-note { color: var(--muted); font-size: 15px; margin: 16px 0 24px; }
.learning-catalog .topics-course__title { margin-top: 30px; }
.learning-catalog .topiccard__link { text-decoration: none; grid-template-areas: none; }
.learning-catalog .topiccard__title, .learning-catalog .topiccard__chapter { grid-area: auto; }
.learning-catalog .topiccard { box-shadow: none; }
.learning-resume-context { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.learning-resume-progress { font-size: 14px; margin: 12px 0 6px; }
.topics-resume progress { display: block; width: min(270px, 100%); height: 6px; accent-color: var(--accent); }
.learning-resume-actions { display: grid; gap: 8px; grid-column: 1 / -1; }
.learning-resume-actions .learning-link { display: grid; place-items: center; min-height: 44px; font-size: 14px; }
.learning-profile { margin: 24px 0; }
.learning-notice { padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin: 24px 0; }
.learning-catalog .topics-resume { margin: 28px 0; }
.learning-catalog .topics-resume__label, .learning-profile .topics-resume__label { font-size: 16px; margin: 0 0 8px; }
.topics-resume__action .topiccard__chevron { color: inherit; }
.app-footer { padding: 24px; border-top: 1px solid var(--border); }
.app-footer nav { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 20px; }

/* Возрастная маркировка 6+ (436-ФЗ): знак в подвале, расшифровка — для чтения с экрана.
   Не нажимается, поэтому наведения, фокуса и других состояний нет. */
.age-mark { display: inline-flex; align-items: center; justify-content: center; align-self: center; min-width: 34px; min-height: 26px; padding: 0 6px; border: 1.5px solid currentColor; border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 700; line-height: 1; white-space: nowrap; vertical-align: middle; }

/* Способы связи: значок, подпись и ссылка. На телефоне столбиком, на широком экране — в ряд. */
.contact-list { display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; }
.contact-item { display: flex; align-items: flex-start; gap: 16px; }
.contact-item > div { min-width: 0; }
.contact-item__icon { width: 28px; height: 28px; margin-top: 6px; color: var(--accent); }
.contact-item__label { margin: 0; color: var(--muted); font-size: 15px; }
.contact-item .ui-link { font-size: 19px; overflow-wrap: anywhere; }
@media (min-width: 760px) { .contact-list { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); } }
@media (max-width: 759px) {
    .topics-resume { grid-template-columns: minmax(0, 1fr); }
    .topics-resume__icon { display: none; }
}
@media (min-width: 760px) {
    .learning-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .learning-catalog .topiclist { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .topics-resume { grid-template-columns: auto minmax(0, 1fr) auto; padding: 24px; }
    .learning-resume-actions { grid-column: auto; }
}

/* Домашка: чат урока, карточки заданий и ступени помощи. Сначала телефон 360 px; с 1000 px слева
   появляется список «Задания». Рамки и фон блоков дают общие .ui-card и .ui-notice, кнопки — общие
   .button и button.ui-link; здесь только раскладка и состояния элементов домашки. */
.homework { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; max-width: 1200px; margin: 0 auto; padding: 10px; }
.homework-main { display: flex; flex-direction: column; gap: 10px; min-width: 0;
    height: calc(var(--homework-viewport, 100dvh) - var(--homework-chrome, 68px) - 20px); min-height: 480px; }
.homework-toolbar.ui-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; padding: 12px 14px; }
.homework-toolbar__title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; }
.homework-toolbar h1 { font-size: 22px; letter-spacing: -.3px; }
.homework-toolbar__counter { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--muted); font-size: 15px; }
.homework-toolbar__counter .progressbar { flex: 1 1 auto; width: auto; max-width: 240px; height: 6px; }
.homework-toolbar__counter[data-complete] .progressbar__fill { background: var(--success); }
.homework-toolbar__actions { grid-column: 2; grid-row: 1; justify-self: end; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.homework-all, .homework-mine { min-height: 44px; padding: 8px 14px; font-size: 15px; }
.homework-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 3px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 14px; line-height: 1.3; white-space: nowrap; }
.homework-chip--small { min-height: 24px; padding: 2px 10px; font-size: 13px; }
.homework-chip--muted { background: var(--bg); color: var(--muted); }
.homework-chat.chat { flex: 1 1 auto; min-height: 0; max-width: none; position: relative; }
/* Скрытые подписи шагов позиционируются внутри прокручиваемой ленты, а не растягивают страницу. */
.homework-chat .chat__list { position: relative; }
.homework-input { display: block; min-height: 48px; max-height: 40vh; resize: none; overflow-y: auto; line-height: 1.45; }
.homework--locked .composer__input { background: var(--bg); color: var(--muted); }
.homework--locked .tab { cursor: not-allowed; }
.homework-tasks { display: none; }
.homework-tasks h2 { font-size: 18px; margin-bottom: 12px; }
.homework-tasklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.homework-tasklist__group { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
/* Строка списка — общая кнопка: наведение, нажатие, фокус и недоступность от .button. */
.button.homework-task { justify-content: flex-start; gap: 12px; width: 100%; min-height: 48px; padding: 8px 12px; font-size: 16px; text-align: left; }
.homework-task--current, .homework-task--current:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.homework-task__mark { display: inline-grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; background: var(--bg); color: var(--text); font-size: 14px; font-weight: 600; }
.homework-task--current .homework-task__mark { background: var(--accent); color: #fff; }
.homework-task--done .homework-task__mark { background: var(--success); color: #fff; }
.homework-task__title { min-width: 0; overflow-wrap: anywhere; }
.homework-new { width: 100%; margin-top: 12px; gap: 8px; }
.homework-dialog .homework-tasklist { margin: 4px 0; }
/* «Мои домашки»: каждая домашка — отдельный чат. Справа на компьютере, в окне на телефоне. */
.homework-chats { display: none; }
.homework-chats h2 { font-size: 18px; margin-bottom: 4px; }
.homework-chatlist { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.homework-chat-entry { display: flex; align-items: stretch; gap: 4px; border-radius: 12px; }
.homework-chat-entry__open { flex: 1 1 auto; display: grid; gap: 2px; min-width: 0; min-height: 48px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background-color 160ms ease, border-color 160ms ease; }
.homework-chat-entry__open:hover:not(:disabled) { border-color: var(--accent); }
.homework-chat-entry__open:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; box-shadow: var(--focus-ring); }
.homework-chat-entry__open:disabled { cursor: not-allowed; opacity: .6; }
.homework-chat-entry--current .homework-chat-entry__open { border-color: var(--accent); background: var(--accent-soft); }
.homework-chat-entry__title { min-width: 0; overflow-wrap: anywhere; font-size: 15px; font-weight: 600; line-height: 1.35; }
.homework-chat-entry--current .homework-chat-entry__title { color: var(--accent); }
.homework-chat-entry__when { color: var(--muted); font-size: 13px; }
.homework-chat-entry__delete { flex: 0 0 44px; align-self: center; }
.homework-dialog .homework-chatlist { margin: 4px 0; }
@media (prefers-reduced-motion: reduce) {
    .homework-chat-entry__open { transition: none; }
}

/* Реплики: карточка задания, список найденного, проверка подстановкой, пример, шаги, итог. */
.homework-page .message--success .message__body:first-of-type { position: relative; padding-left: 46px; }
.homework-ok { position: absolute; left: 14px; top: calc(12px + .15em); width: 22px; height: 22px; padding: 3px; border-radius: 50%; background: var(--success); color: #fff; stroke-width: 2.6; }
.homework-card { margin-top: 10px; }
.homework-card .taskcard__expression { font-size: 19px; }
.homework-card__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 6px 12px; }
.homework-card__head .taskcard__instruction { margin: 4px 0 0; }
.homework-badge { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 10px; border: 1px solid var(--success); border-radius: 8px; color: var(--success); background: var(--surface); font-size: 13px; }
.homework-card__text { margin: 8px 0 4px; font-size: 17px; }
.homework-card__text p { margin: 0; }
/* Низ карточки: тема и параграф, у открытого задания — «Изменить». На телефоне ссылка уходит на свою строку. */
.homework-card__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 12px; margin-top: 8px; }
.homework-card__foot .taskcard__meta { flex: 1 1 14rem; margin: 0; }
.homework-card__edit { font-size: 15px; }
.homework-rows { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.homework-row { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 4px 12px; align-items: start; padding: 12px; }
.homework-row__number { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 15px; }
.homework-row--muted .homework-row__number { background: var(--bg); color: var(--muted); }
.homework-row__body { min-width: 0; overflow-x: auto; }
.homework-row__instruction { margin: 0; font-weight: 650; font-size: 15px; }
.homework-row--muted .homework-row__instruction, .homework-row--muted .homework-row__formula { color: var(--muted); }
.homework-row__formula, .homework-row__text { margin: 2px 0; min-width: 0; }
.homework-row__formula { font-size: 19px; }
/* Формула задания стоит под формулировкой слева, как в тетради, а не по центру карточки. */
.homework-page :is(.homework-card, .homework-example, .homework-own) .math[data-display="true"] { margin: 6px 0; text-align: left; }
.homework-page :is(.homework-card, .homework-example, .homework-own) .katex-display > .katex { text-align: left; }
.homework-row__text p { margin: 0; font-size: 15px; }
.homework-row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; }
.homework-row__note { color: var(--muted); font-size: 14px; }
.homework-row__status { grid-column: 2; display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.homework-row__status .ui-icon { width: 22px; height: 22px; padding: 3px; border-radius: 50%; background: var(--success); color: #fff; stroke-width: 2.6; }
.homework-row__edit { grid-column: 2; justify-self: start; font-size: 15px; }
.homework-check { margin: 10px 0; padding: 12px 14px; overflow-x: auto; }
.homework-check dl { margin: 0; display: grid; gap: 2px; }
.homework-check__line { display: grid; grid-template-columns: 70px auto; gap: 8px; align-items: baseline; }
.homework-check dt { color: var(--muted); font-size: 15px; }
.homework-check dd { margin: 0; }
.homework-check p, .homework-row__formula p, .homework-card__head p, .homework-offer p, .homework-own .message__body p { margin: 0; }
.homework-check__verdict { margin: 6px 0 0 78px; color: var(--danger); }
.homework-check__verdict--holds { color: var(--success); }
/* Клетки таблицы при числе ученика: подписи строк длиннее «слева», столбцы выровнены по всем строкам. */
.homework-check--cells dl { grid-template-columns: max-content minmax(0, 1fr); column-gap: 8px; row-gap: 4px; }
.homework-check--cells .homework-check__line { display: contents; }
.homework-actions { gap: 8px; margin-top: 12px; }
.homework-actions--ladder { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
/* Кнопки внутри реплики компактнее обычных: на телефоне две помещаются в строку, как на макетах. */
.homework-actions--row .button { padding: 9px 14px; font-size: 15px; }
.homework-actions--ladder .button { width: 100%; padding: 10px 8px; white-space: normal; }
.homework-actions--ladder .ui-link { grid-column: 1 / -1; justify-self: start; }
.homework-actions--chips { display: grid; gap: 8px; }
.homework-example-chip { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 48px; padding: 8px 14px; border: 1px solid #c9dbff; border-radius: 12px; background: var(--accent-soft); color: var(--text); font: inherit; font-size: 16px; text-align: left; cursor: pointer; }
.homework-example-chip:hover { border-color: var(--accent); }
.homework-example-chip p { margin: 0; }
.homework-example-chip .ui-icon { flex: 0 0 auto; color: var(--accent); }
.homework-eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 13px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.homework-example, .homework-own, .homework-offer { margin-top: 12px; padding: 14px 16px; overflow-x: auto; }
.homework-example__instruction { margin: 0; font-weight: 650; }
.homework-example__formula, .homework-own .taskcard__expression { font-size: 19px; }
/* Значения букв примера — под формулой тем же размером и по левому краю, как сама формула. */
.homework-example__given { font-size: 19px; text-align: left; }
.homework-example__instruction p { margin: 0; }
.homework-example__steps { list-style: none; margin: 10px 0 0; padding: 10px 0 0; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.homework-example__steps li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 2px 10px; align-items: baseline; }
.homework-example__number { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 600; }
.homework-example__line { min-width: 0; }
.homework-example__comment { grid-column: 2; color: var(--muted); font-size: 15px; }
.homework-example__comment p, .homework-example__check p { margin: 0; }
.homework-example__check { margin-top: 12px; padding: 10px 14px; }
.homework-own .homework-actions { margin-top: 8px; }
.homework-tracker { margin-top: 10px; padding: 14px 16px; overflow-x: auto; }
.homework-tracker__heading { margin: 0 0 10px; font-weight: 700; }
.homework-tracker ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.homework-step { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.homework-step__mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--bg); color: var(--muted); font-weight: 600; font-size: 15px; }
.homework-step__body { min-width: 0; }
.homework-step__body p { margin: 0; }
.homework-step--done .homework-step__mark { background: var(--success); color: #fff; }
.homework-step--done .homework-step__mark .ui-icon { stroke-width: 2.6; }
.homework-step--current .homework-step__mark { background: var(--accent); color: #fff; }
.homework-step--current .homework-step__body { padding: 8px 12px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent-soft); }
.homework-step--locked { color: var(--muted); }
.homework-step > .ui-icon { color: var(--muted); }
.homework-table-wrap { max-width: 100%; margin: 10px 0; padding: 0; overflow-x: auto; }
.homework-table { width: 100%; border-collapse: collapse; font-size: 15px; }
/* Реплика разрешает перенос в любом месте слова, а таблица сжимала столбцы до «Врем/я». Слово и формула
   в клетке целые; не хватает ширины — таблица прокручивается в своей рамке. */
.homework-table th, .homework-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: center; vertical-align: middle; overflow-wrap: normal; word-break: normal; hyphens: manual; }
.homework-table td .katex { white-space: nowrap; }
.homework-table thead th { font-weight: 650; }
.homework-table tbody th { text-align: left; font-weight: 650; }
.homework-table tbody tr:last-child > * { border-bottom: 0; }
.homework-offer__title { margin: 0; font-size: 18px; }
.homework-offer .homework-actions .button { flex: 1 1 200px; }
@media (max-width: 599px) {
    /* На телефоне переписке нужна высота: подсказка о записи видна, пока поле в фокусе. */
    .homework-page .composer__hint { display: none; }
    .homework-page .composer:focus-within .composer__hint { display: block; }
    .homework-table th, .homework-table td { padding: 8px 6px; }
}
@media (min-width: 600px) {
    .homework-card .taskcard__expression { font-size: 24px; }
    .homework-row { grid-template-columns: 32px minmax(0, 1fr) auto; }
    .homework-row__status { grid-column: 3; grid-row: 1; justify-self: end; }
    .homework-row__edit { grid-column: 3; grid-row: 1; justify-self: end; }
    .homework-offer .homework-actions .button { flex: 0 1 auto; }
}
@media (min-width: 1000px) {
    .homework { padding: 16px 24px; }
    .homework-main { height: calc(var(--homework-viewport, 100dvh) - var(--homework-chrome, 77px) - 32px); }
    .homework { grid-template-columns: minmax(0, 1fr) 240px; max-width: 1400px; }
    .homework--with-tasks { grid-template-columns: 240px minmax(0, 1fr) 240px; }
    .homework--with-tasks .homework-tasks { display: block; align-self: start; padding: 18px; }
    .homework-chats { display: block; align-self: start; padding: 18px; }
    .homework-page .homework-mine { display: none; }
    .homework-toolbar.ui-card { grid-template-columns: auto minmax(0, 1fr); padding: 12px 20px; }
    .homework-toolbar__counter { grid-column: 2; grid-row: 1; justify-content: flex-end; }
    .homework-page .homework-all { display: none; }
    .homework-actions--ladder { max-width: 560px; }
}

/* --- «Как решали»: разбор решённого задания (solution-recap.js) ------------------------------
   Общий компонент: сейчас «Домашка», урок подключит его отдельной задачей. Короткая цепочка видна сразу,
   строки решения — в общем раскрывающемся блоке (details, ui-disclosure.js): его наведение, фокус,
   открытие и сокращение движения не переопределяются. Сначала телефон 360 px: запись переносится
   по знакам, а таблица или слишком длинная запись прокручивается внутри своей строки, не страница. */
.solution-recap { display: grid; gap: 10px; min-width: 0; }
.ui-card.solution-recap { padding: 12px 14px; }
/* В строке итога — без рамки карточки, отдельной строкой сетки под заданием и его ступенью помощи. */
.solution-recap--inline { gap: 8px; }
.homework-row__recap { grid-column: 2 / -1; margin-top: 4px; }
.solution-recap__chain { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 18px; margin: 0; min-width: 0;
    font-size: 18px; line-height: 1.6; overflow-wrap: anywhere; }
.solution-recap__segment { min-width: 0; max-width: 100%; }
.solution-recap__details { min-width: 0; }
.solution-recap__body { display: grid; gap: 12px; min-width: 0; padding: 12px 2px 2px; }
.solution-recap__lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; min-width: 0; }
.solution-recap__line { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 2px 10px; align-items: start; min-width: 0; }
.solution-recap__number { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-top: 3px; border-radius: 50%;
    background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 600; }
.solution-recap__content { display: grid; gap: 4px; min-width: 0; }
.solution-recap__formula { min-width: 0; max-width: 100%; overflow-x: auto; overflow-y: hidden; font-size: 18px; line-height: 1.6; }
.solution-recap__formula p, .solution-recap__note p, .solution-recap__chain p { margin: 0; }
.solution-recap__note { color: var(--muted); font-size: 15px; line-height: 1.45; }
.solution-recap__answer { margin: 0; font-size: 17px; }
.solution-recap__answer-label { font-weight: 650; }
.solution-recap__content > .visual-explanation, .solution-recap__content > .homework-table-wrap { margin: 0; }
.solution-recap__formula:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (min-width: 600px) {
    .ui-card.solution-recap { padding: 14px 16px; }
    .solution-recap__chain, .solution-recap__formula { font-size: 19px; }
}

/* --- Беседа пузырями: макеты урока 03 и «Домашки» 04 ------------------------------------
   Аватар снаружи пузыря: ментор слева, ученик справа. Подпись роли — только для чтения с экрана.
   Разметку собирает общий chat-message.js; экраны добавляют только содержимое. */
.chat__list > .message { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; align-items: start; flex-shrink: 0; width: 100%; max-width: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.chat__list > .message--learner { grid-template-columns: minmax(0, 1fr) 40px; }
.chat__list > .message--learner > .message__avatar { grid-column: 2; grid-row: 1; }
.chat__list > .message--learner > .message__content { grid-column: 1; grid-row: 1; align-items: flex-end; }
.chat__list > .message--system { display: block; }
.message__avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.message__content { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; }
.message__content > * { max-width: min(680px, 100%); }
.chat__list .message__body { min-width: 0; padding: 12px 16px; border-radius: 6px 16px 16px 16px; background: #f1f4f9; overflow-wrap: anywhere; }
.chat__list .message--learner .message__body { border-radius: 16px 6px 16px 16px; background: var(--accent-soft); }
.chat__list .message--system .message__content { align-items: center; }
.chat__list .message--system .message__body { padding: 8px 14px; border-radius: 12px; background: var(--success-soft); font-size: 15px; text-align: center; }
/* Карточки, списки и кнопки сообщения занимают колонку беседы; по размеру текста — только сам пузырь. */
.chat__list .message--mentor .message__content > :not(.message__body, .message__role) { align-self: stretch; }
.chat__list .message__content > .taskcard { margin-top: 0; }
.message--pending .message__body { outline: 1px dashed #9db8e8; outline-offset: -1px; }
.message--unconfirmed .message__body { outline: 2px solid var(--warning); outline-offset: -2px; }
/* Фото в реплике ученика — как снимок в мессенджере: над прочитанным текстом, по правому краю.
   Предел ширины — у рамки фото, а не у картинки: иначе рамка вырастает до ширины, которую картинка
   получила бы по высоте, и снимок уезжает от правого края. */
.message__photo { margin: 0; max-width: min(280px, 100%); }
.message__photo-image { display: block; max-width: 100%; max-height: 280px; border: 1px solid var(--border); border-radius: 16px 6px 16px 16px; background: var(--surface); object-fit: contain; }
.message--pending .message__photo-image { opacity: .75; }
.message--unconfirmed .message__photo-image { outline: 2px solid var(--warning); outline-offset: -2px; }
.message__photo--gone { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 16px 6px 16px 16px; background: var(--accent-soft); color: var(--accent); font-size: 15px; }
.message__photo--gone .ui-icon { width: 20px; height: 20px; }
/* Условие задания не шире карточки: длинное уменьшается (fitFormula), дальше прокручивается внутри. */
.taskcard { min-width: 0; }
.taskcard__expression { min-width: 0; max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.taskcard__expression--flow { font-size: 20px; line-height: 1.6; text-align: left; overflow-x: auto; overflow-y: hidden; }
/* Выражение переносится по знакам слева — строка данных идёт за ним так же. */
.taskcard:has(> .taskcard__expression--flow) > .taskcard__given { font-size: 20px; text-align: left; }
@media (max-width: 520px) {
    .chat__list > .message { grid-template-columns: 32px minmax(0, 1fr); column-gap: 8px; }
    .chat__list > .message--learner { grid-template-columns: minmax(0, 1fr) 32px; }
    .message__avatar { width: 32px; height: 32px; }
    .chat__list .message__body { padding: 10px 12px; }
    .chat__list > .message--learner .message__content > * { max-width: 92%; }
}

/* --- Ввод ответа в уроке: макет 03 ---------------------------------------------------------
   На компьютере поле и кнопки в одну строку; на телефоне поле, широкая «Отправить» и две кнопки. */
.tab { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tab .ui-icon { width: 18px; height: 18px; }
.lesson-page .composer__head { flex-wrap: nowrap; gap: 8px; }
.lesson-page .tab { min-height: 44px; }
.lesson-page .composer__help { margin-left: auto; flex-shrink: 0; }
.lesson-page .composer__help[aria-expanded=true] { background: var(--accent-soft); border-color: #c9dbff; color: var(--accent); }
.lesson-page .composer__help .ui-icon { width: 21px; height: 21px; }
.lesson-page .composer__body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; align-items: start; }
.lesson-page .composer__pane { grid-column: 1; min-width: 0; }
.lesson-page .composer__actions { grid-column: 2; grid-row: 1; margin: 0; flex-wrap: nowrap; gap: 8px; }
.lesson-page .composer[data-mode=handwriting] .composer__body { grid-template-columns: minmax(0, 1fr); }
.lesson-page .composer[data-mode=handwriting] .composer__actions { grid-column: 1; grid-row: auto; }
.lesson-page .composer__actions .button { min-height: 48px; white-space: nowrap; }
.lesson-page .composer__input { min-height: 48px; }
.lesson-page .composer:not([data-help-open]) .composer__hint { display: none; }
.lesson-page .composer__hint { margin: 6px 2px 0; }
.composer__send-icon { width: 18px; height: 18px; }
.button--loading .composer__send-icon { display: none; }
.lesson-page .composer__status { display: flex; align-items: flex-start; gap: 7px; margin: 8px 2px 0; min-width: 0; }
.lesson-page .composer__status [data-status-text] { min-width: 0; overflow-wrap: anywhere; }
.lesson-page .composer__status .composer__pulse { flex: 0 0 8px; margin-top: .55em; }
.lesson-page .composer__status--quiet { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 700px) {
    .lesson-page .composer__head { gap: 4px; margin-bottom: 6px; }
    .lesson-page .composer__tabs { display: grid; flex: 1; grid-template-columns: repeat(3, 1fr); gap: 4px; }
    .lesson-page .tab { min-height: 44px; padding-inline: 4px; }
    .lesson-page .composer__body { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .lesson-page .composer__actions { grid-column: 1; grid-row: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
    .lesson-page .composer__actions [data-send] { grid-column: 1 / -1; }
    .lesson-page .composer__actions:has([data-action=show-task][hidden]) [data-action=hint] { grid-column: 1 / -1; }
    .lesson-page .composer__actions .button { min-height: 44px; padding: 8px 10px; font-size: 15px; }
}
/* Фото задания: одна кнопка-значок слева от «Отправить». Поле выбора файла скрыто — его открывает
   кнопка; без показа на экране оно остаётся настоящим, и телефон предлагает камеру и галерею. */
.composer__photo-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.lesson-page .composer__photo { width: 48px; height: 48px; flex: 0 0 auto; }
.composer__photo .ui-icon { width: 22px; height: 22px; }
@media (max-width: 700px) {
    .lesson-page .composer__actions--photo { grid-template-columns: 44px minmax(0, 1fr); }
    .lesson-page .composer__actions--photo [data-send] { grid-column: 2; }
    .lesson-page .composer__actions--photo .composer__status { grid-column: 1 / -1; }
    .lesson-page .composer__photo { width: 44px; height: 44px; }
}

/* Действия принадлежат открытому чату; план остаётся списком подтем. */
.lesson-tools { flex: 0 0 auto; min-width: 0; }
.lesson-tools__content { display: grid; gap: 12px; padding: 12px 0; max-height: 30vh; overflow-y: auto; }
.lesson-tools__content .skills { margin: 8px 0 0; }

/* Компактный урок: тот же ввод и общие окна; свободная высота остаётся переписке. */
.lesson-page--compact .lesson-back { display: none; }
/* Скрытая подпись роли остаётся внутри ленты и не удлиняет страницу за её нижний край. */
.lesson-page--compact .message__content { position: relative; }
.lesson-page--compact .lesson-title { display: block; text-align: left; max-width: 100%; min-height: 44px; }
.lesson-page--compact .lesson-title small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.lesson-page--compact .lesson-task-link { flex: 0 0 auto; align-self: flex-start; min-height: 44px; margin: 0 6px; }
/* Кнопки после законченного разбора стоят над полем ввода и не уезжают вместе с лентой. */
.lesson-next { flex: 0 0 auto; margin: 4px 6px 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.lesson-next[hidden], .lesson-next [hidden] { display: none !important; }
.lesson-next__title { margin: 0 0 8px; font-size: 16px; }
.lesson-next__actions { gap: 8px; }
.lesson-next__actions .button { min-height: 44px; white-space: normal; text-align: center; }
/* Кнопка под ответом ментора: «Показать разбор» там, где о ней говорит реплика. */
.message__actions { margin-top: 10px; }
.message__actions .button { min-height: 44px; }
/* Варианты ответа под заданием: длинные названия переносятся внутри кнопки, а не выходят за ленту. */
.message__actions--choices { gap: 8px; }
.message__actions--choices .button { white-space: normal; text-align: center; }
@media (max-width: 560px) {
    .lesson-next__actions { display: grid; }
    .message__actions--choices { display: grid; }
}
/* Шапка урока — одна строка: тема с ходом слева, действия чата — значок «три точки» справа. */
.lesson-page--compact .lesson-toolbar { flex-wrap: nowrap; }
.lesson-page--compact .lesson-toolbar .topbar__title { flex: 1 1 0; min-width: 0; }
.lesson-page--compact .lesson-toolbar .topbar__source { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lesson-page--compact .lesson-toolbar .topbar__progress { flex: 0 1 auto; min-width: 0; max-width: 50%; flex-wrap: nowrap; }
.lesson-more { flex: 0 0 44px; }
.lesson-more .ui-icon { width: 22px; height: 22px; }
@media (max-width: 800px) {
    /* Полная сводка хода — в плане темы; в шапке остаётся «Шаг N из M» под названием. */
    .lesson-page--compact .topbar__counter { display: none; }
}
.lesson-page--compact .composer__tabs { display: flex; flex: 0 1 auto; justify-content: flex-start; flex-wrap: nowrap; gap: 2px; }
.lesson-page--compact .composer__tools { display: flex; flex-wrap: wrap; margin: 4px 0 0; gap: 0; align-items: center; }
.lesson-page--compact .composer__tools > .iconbutton { flex: 0 0 44px; }
.lesson-page--compact .composer__tools > .ink-recognize { margin-left: auto; padding: 8px 10px; min-height: 44px; font-size: 14px; }
.lesson-page--compact .composer__tools.composer__pane--hidden { display: none; }
.lesson-tools-dialog .ui-actions { display: grid; gap: 8px; margin-top: 16px; }
.lesson-tools-dialog .skills { margin: 12px 0; }
.lesson-tools-dialog .app-links { display: flex; flex-wrap: wrap; margin: 16px 0 0; }
.lesson-tools-dialog .app-dropdown { position: static; width: 100%; max-width: none; margin-top: 12px; box-shadow: none; }
.lesson-page--compact .inkstage--full .composer__tools { flex: 0 0 auto; }
.lesson-page--compact .composer[data-mode=handwriting] { max-height: none; min-height: 0; flex-shrink: 1; overflow-y: auto; }
.lesson-page--compact .inkpad__canvas { height: 150px; }
.lesson-page--compact .inkstage--full .inkpad__canvas { height: 100%; }
.lesson-page--compact .inkpad__placeholder { padding: 12px; text-align: center; }
@media (max-width: 600px) {
    .lesson-page--compact > .app-header { display: none; }
    .lesson-page--compact .lesson-toolbar { width: 100%; margin: 0; padding: 6px; gap: 4px; flex-wrap: nowrap; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
    .lesson-page--compact .lesson-back { display: inline-flex; flex: 0 0 44px; }
    .lesson-page--compact .lesson-toolbar .topbar__title { flex: 1; min-width: 0; }
    .lesson-page--compact .lesson-toolbar h1 { font-size: 15px; line-height: 1.3; margin: 0; }
    .lesson-page--compact .lesson-title { min-height: 44px; padding: 2px; }
    .lesson-page--compact .topbar__progress { display: none; }
    .lesson-page--compact .workspace { padding: 8px 6px 0; min-height: 0; height: calc(var(--lesson-viewport, 100dvh) - var(--lesson-chrome, 64px)); }
    .lesson-page--compact .chat { min-height: 0; gap: 0; }
    .lesson-page--compact .composer { padding: 6px 8px max(8px, env(safe-area-inset-bottom)); border-radius: 14px 14px 0 0; }
    .lesson-page--compact .composer__head { justify-content: flex-start; }
    .lesson-page--compact .tab { padding-inline: 6px; font-size: 13px; gap: 4px; }
    .lesson-page--compact .tab .ui-icon { width: 18px; height: 18px; }
    .lesson-page--compact .composer__body,
    .lesson-page--compact .composer[data-mode=handwriting] .composer__body { grid-template-columns: minmax(0, 1fr) 48px; gap: 6px; }
    .lesson-page--compact .composer__actions { display: flex; grid-column: 2; grid-row: 1; }
    .lesson-page--compact .composer__actions [data-send] { width: 48px; min-height: 48px; padding: 0; }
    .lesson-page--compact [data-send-label] { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
    .lesson-page--compact .composer__send-icon { width: 22px; height: 22px; }
    .lesson-page--compact [data-pane=handwriting]:not(.composer__pane--hidden) { display: contents; }
    .lesson-page--compact .inkstage { grid-column: 1 / -1; }
    .lesson-page--compact .inkpad__result:not(.composer__pane--hidden) { display: contents; }
    .lesson-page--compact .inkpad__result-label { grid-column: 1 / -1; grid-row: 2; margin: 0; }
    .lesson-page--compact [data-ink-field] { grid-column: 1; grid-row: 3; }
    .lesson-page--compact .composer[data-mode=handwriting] .composer__actions { grid-column: 2; grid-row: 2; align-self: start; }
    .lesson-page--compact .composer[data-mode=handwriting]:has(.inkpad__result:not(.composer__pane--hidden)) .composer__actions { grid-row: 3; }
    .lesson-page--compact .inkpad__confidence { grid-column: 1 / -1; grid-row: 4; margin: 0; font-size: 12px; }
    .lesson-page--compact .inkpad__warning { grid-column: 1 / -1; grid-row: 5; }
    .lesson-page--compact .inkpad__notice { grid-column: 1 / -1; margin: 0; font-size: 12px; }
}

/* Навигация урока: заголовки не открывают окна; действия — общие текстовые ссылки. */
.lesson-page--compact .lesson-navigation { display:block; width:100%; max-width:1280px; margin:0 auto; padding:16px 24px 0; border:0; border-radius:0; background:transparent; }
.lesson-navigation__context { display:flex; align-items:center; gap:22px; margin-bottom:12px; }
.lesson-navigation__context p { margin:0; color:var(--muted); font-size:13px; min-width:0; }
.lesson-page--compact .lesson-navigation .lesson-back { display:inline-flex; flex:none; }
.lesson-navigation .ui-link--action { display:inline-flex; align-items:center; gap:7px; padding-block:8px; min-height:44px; font-size:15px; }
.lesson-navigation .ui-icon { width:17px; height:17px; }
.lesson-navigation__heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.lesson-navigation__heading .topbar__title { min-width:0; }
.lesson-navigation__eyebrow { margin:0 0 4px; font-size:12px; color:var(--muted); text-transform:uppercase; }
.lesson-page--compact .lesson-navigation h1 { margin:0; font-size:25px; line-height:1.3; overflow-wrap:anywhere; }
.lesson-navigation__actions { display:flex; flex:none; align-items:center; gap:20px; }
.lesson-page--compact .workspace { min-height:0; }
/* При раскрытом рукописном вводе лента может сжаться: её плавающие действия
   остаются внутри ленты и не перекрывают название шага и меню. */
.lesson-page--compact .chat > .chat-scroll { overflow:hidden; }
/* Рукописный ввод прокручивается сам, оставляя место условию и кнопке возврата к вводу. */
.lesson-page--compact .chat:has(.composer[data-mode=handwriting]) > .chat-scroll { flex:1 0 min(160px, 30%); }
.lesson-current-step { display:flex; align-items:center; gap:14px; flex:none; min-width:0; padding-bottom:8px; border-bottom:1px solid var(--border); }
.lesson-page--compact .lesson-current-step .lesson-title { flex:1; min-width:0; min-height:0; padding:0; font-size:18px; }
.lesson-current-step .topbar__progress { min-width:0; max-width:45%; }
.lesson-current-step .progressbar { width:72px; flex:none; }
.lesson-current-step .topbar__counter { white-space:normal; line-height:1.35; font-size:12px; }
.lesson-stage-plan__heading { font-size:17px; }
.lesson-stage-plan__guide img { width:64px; height:76px; }
.lesson-stage-plan__guide [data-lesson-encouragement] { font-size:14px; }
.lesson-navigation-dialog { width:min(760px, calc(100% - 24px)); background:var(--surface); }
.lesson-navigation-dialog .lesson-plan__head { border-bottom:0; padding:20px 24px 8px; }
.lesson-navigation-dialog .lesson-plan__head h2 { font-size:23px; }
.lesson-navigation-dialog .lesson-plan__content { padding:0 24px 20px; }
.lesson-plan__context { margin:0 0 8px; color:var(--muted); font-size:14px; }
.lesson-plan__hint { margin:16px 0 0; color:var(--muted); font-size:13px; }
.conversation-list--topics.skills, .conversation-list--steps.skills { gap:0; }
.conversation-list--topics .homework-chat-entry { align-items:center; gap:16px; padding:16px 0; border-radius:0; border-bottom:1px solid var(--border); }
.conversation-list__content { flex:1; min-width:0; }
.conversation-list__content > span { display:block; }
.conversation-list__content .homework-chat-entry__when { margin-top:4px; line-height:1.4; }
.conversation-list--topics .conversation-list__action { display:inline-flex; flex:none; align-items:center; gap:7px; min-height:44px; padding-block:8px; font-size:14px; }
.conversation-list--topics .conversation-list__action .ui-icon { width:17px; height:17px; }
.conversation-list--topics .homework-chat-entry:last-child { border-bottom:0; }
.conversation-list--steps .homework-chat-entry { border-radius:0; }
.conversation-list--steps .homework-chat-entry__open { grid-template-columns:18px minmax(0,1fr); gap:4px 12px; min-height:66px; padding:12px; border:0; border-left:2px solid transparent; border-radius:0; background:transparent; transition:none; }
.conversation-list--steps .homework-chat-entry__title, .conversation-list--steps .homework-chat-entry__when { grid-column:2; }
.conversation-list__marker { grid-column:1; grid-row:1 / span 2; padding-top:2px; color:var(--muted); font-size:12px; }
.conversation-list__marker .ui-icon { width:16px; height:16px; color:var(--success); }
.conversation-list--steps .homework-chat-entry__when { font-size:12px; line-height:1.4; }
.conversation-list--steps .homework-chat-entry--current .homework-chat-entry__open { border-left-color:var(--accent); background:transparent; }
.conversation-list--steps .homework-chat-entry__open:hover:not(:disabled) { background:var(--accent-soft); }
.conversation-list--steps .homework-chat-entry__open:active:not(:disabled) { background:var(--link-active-bg); }
@media(min-width:1024px) {
    /* Заголовок совпадает с колонкой беседы, включая её внешние отступы. */
    .lesson-page--compact:has(.workspace--stages) .lesson-navigation { max-width:min(968px,calc(100vw - 528px)); }
}
@media(min-width:1024px) and (max-width:1495px) {
    .lesson-page--compact:has(.workspace--stages) .lesson-navigation__heading { flex-wrap:wrap; }
    .lesson-page--compact:has(.workspace--stages) .lesson-navigation__actions { width:100%; justify-content:space-between; }
}
@media(max-width:1023px) {
    .lesson-navigation__heading { flex-wrap:wrap; }
    .lesson-navigation__actions { justify-content:space-between; width:100%; border-bottom:1px solid var(--border); gap:12px; }
    .lesson-page--compact .workspace { padding-top:12px; }
}
@media(max-width:600px) {
    .lesson-page--compact .lesson-navigation { padding:8px 10px 0; }
    .lesson-navigation__context { display:block; margin-bottom:10px; }
    .lesson-navigation__context p { font-size:12px; margin:4px 0 0; }
    .lesson-navigation__heading { gap:8px; }
    .lesson-page--compact .lesson-navigation h1 { font-size:21px; }
    .lesson-navigation .ui-link--action { font-size:14px; }
    .lesson-navigation__eyebrow { font-size:11px; }
    .lesson-page--compact .workspace { padding:10px 10px 0; }
    .lesson-current-step { gap:8px; padding-bottom:8px; }
    .lesson-page--compact .lesson-current-step .lesson-title { font-size:17px; }
    .lesson-current-step .topbar__progress { display:none; }
    .lesson-navigation-dialog { width:100%; max-width:none; height:100dvh; max-height:100dvh; margin:0; border:0; border-radius:0; }
    .lesson-navigation-dialog .lesson-plan__head { padding:12px 12px 8px; }
    .lesson-navigation-dialog .lesson-plan__content { padding:0 12px 16px; }
    .conversation-list--topics .homework-chat-entry { gap:10px; }
    .conversation-list--topics .conversation-list__action { font-size:13px; }
}

/* Флажок с подписью (предложение от 02.10.2026): согласие с офертой, отдельное согласие на продление.
   Вся подпись нажимается, цель не меньше 44 px; фокус — общее кольцо на самом флажке.
   Ссылка внутри подписи остаётся обычной ссылкой. */
.ui-check { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding: 8px 0; cursor: pointer; font-size: 16px; line-height: 1.45; }
.ui-check input { flex: 0 0 24px; width: 24px; height: 24px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.ui-check input:disabled { cursor: not-allowed; }
.ui-check input:disabled + span { color: var(--muted); }
.ui-check input[aria-invalid=true] { outline: 2px solid var(--danger); outline-offset: 2px; }

/* Шаги и принадлежность личного входа: утверждены вместе с семейным сценарием 07.10.2026. */
.family-flow-badge, .access-profile-role { display:inline-flex; align-items:center; padding:4px 10px; border-radius:20px; background:var(--accent-soft); color:var(--link-text); font-size:14px; font-weight:600; }
.family-flow-step { color:var(--muted); font-size:13px; margin:0 0 10px; }
.family-flow-steps { display:flex; gap:7px; margin:14px 0 22px; }
.family-flow-steps span { height:4px; flex:1; background:var(--border); border-radius:4px; }
.family-flow-steps .is-complete { background:var(--accent); }
.access-profile-identity { display:flex; flex-direction:column; align-items:flex-start; gap:10px; font-size:14px; color:var(--muted); margin:0 0 18px; }

/* Карточка тарифа (предложение от 02.10.2026): страница «Тарифы» и выбор тарифа в кабинете.
   Сама карточка не нажимается; действие — общая кнопка внутри. На телефоне — столбик. */
.tariff-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); align-items: stretch; }
.tariff-card { display: flex; flex-direction: column; gap: 12px; }
.tariff-card h3 { margin: 0; font-size: 20px; }
.tariff-card--featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tariff-card__eyebrow { margin: 0; color: var(--accent); font-size: 14px; font-weight: 650; }
.tariff-card__price { margin: 0; font-size: 15px; color: var(--muted); }
.tariff-card__price strong { color: var(--text); font-size: 26px; font-variant-numeric: tabular-nums; }
.tariff-card__list { display: grid; gap: 6px; margin: 0; padding-left: 20px; }
.tariff-card form, .tariff-card .ui-actions { margin-top: auto; }
.tariff-card .button { width: 100%; white-space: normal; text-align: center; }

/* Текущий тариф (предложение от 02.10.2026): «Ваш тариф» у ученика и «Тариф» у родителя. Блок не
   нажимается; кнопка и ссылка — общие. Длинные слова переносятся, на телефоне всё в столбик. */
.tariff-current { display: grid; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.tariff-current > * { margin: 0; }
.tariff-current__title { font-size: 17px; line-height: 1.45; }
.tariff-current__label { color: var(--muted); }
.tariff-current__list { display: grid; gap: 4px; padding-left: 20px; }
.tariff-current__hint { color: var(--muted); font-size: 15px; }
.profile-surface > .tariff-current { margin: 12px 0 8px; }

/* Таблица тарифов: вариант общей таблицы со словами — по левому краю и с переносом. */
.ui-table--text th, .ui-table--text td { text-align: left; white-space: normal; }
.ui-table--text td, .ui-table--text thead th { min-width: 136px; }
.ui-table--text tr > :first-child { min-width: 136px; max-width: 220px; }
.ui-table--text thead th { color: var(--text); font-size: 15px; }

/* Сообщение со ссылками (предложение от 02.10.2026): общий .ui-notice с заголовком и строкой
   ссылок-действий со значками — блок «Пилотный запуск» на главной и в /start. Целиком не нажимается,
   анимаций нет. Фон ссылки при наведении — белый: голубой фон сообщения уже занят самим сообщением. */
.ui-notice--links { display: grid; gap: 4px; }
.ui-notice--links > p { margin: 0; line-height: 1.5; }
/* Отсчёт до конца бесплатного пилота — отдельной фразой внутри того же сообщения, выделен жирным. */
.ui-notice__countdown { font-weight: 650; }
.ui-notice__links { display: flex; flex-wrap: wrap; gap: 0 20px; margin: 0; padding: 0; list-style: none; }
.ui-notice__links .ui-link--action { gap: 8px; }
.ui-notice__links .ui-icon { width: 20px; height: 20px; color: var(--accent); }
.ui-notice__links .brand-icon { width: 20px; height: 20px; }
@media (hover: hover) {
    .ui-notice--links .ui-link[href]:hover { background-color: var(--surface); }
}
.ui-notice--links .ui-link[href]:focus-visible { background-color: var(--surface); }
@media (max-width: 420px) { .ui-notice__links { flex-direction: column; } }
.learning-catalog .ui-notice--links { margin-top: 20px; }
.landing-main > .ui-notice--links { margin-top: 4px; }

/* Редактор маршрута — предложение от 03.10.2026. Поля и действия используют общие состояния. */
.route-editor { padding: 0; width: min(1440px, calc(100vw - 24px)); height: calc(100dvh - 24px); max-width: none; }
.route-editor__head, .route-editor__foot, .route-editor__status { flex-shrink: 0; }
.route-editor__head, .route-editor__foot { padding: 16px 20px; margin: 0; }
.route-editor__head { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.route-editor__head h2, .route-editor__head p { margin: 0 0 4px; }
.route-editor__head p, .route-editor__status { color: var(--muted); font-size: 14px; }
.route-editor__status { margin: 0; padding: 0 20px 12px; min-height: 32px; }
.route-editor__layout { display: grid; gap: 20px; padding: 0 20px 20px; flex: 1; min-height: 0; overflow: auto; }
.route-editor__steps, .route-editor__fields, .route-editor__lesson { min-width: 0; }
.route-editor__steps h3, .route-editor__lesson h3 { margin: 0 0 8px; }
.route-editor__steps ol { list-style: none; display: grid; gap: 8px; margin: 0 0 12px; padding: 0; }
.route-editor__steps li { min-width: 0; }
.route-editor__steps li button { width: 100%; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.route-editor__steps [aria-current="step"] { background: var(--accent-soft); border-color: var(--accent); }
.route-editor [data-route-form], .route-editor [data-route-rules] { display: grid; gap: 14px; padding-top: 16px; }
.route-editor__ranges { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.route-editor__ranges label { font-size: 14px; }
.route-editor__samples { display: grid; gap: 16px; margin-top: 16px; }
.route-editor__samples[hidden] { display: none; }
.route-editor__samples article { display: grid; gap: 8px; }
.route-editor__lesson { display: flex; flex-direction: column; gap: 12px; }
.route-editor__lesson > p { margin: 0; color: var(--muted); font-size: 14px; }
.route-editor__lesson .chat__list { flex: none; min-height: 320px; height: 420px; overflow-y: auto; padding: 12px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.route-editor__lesson .message__avatar { width: 28px; height: 28px; }
.route-editor__lesson .message__content { min-width: 0; }
.route-editor__lesson > .chat-scroll { display: flex; flex-direction: column; min-height: 160px; flex: 1; overflow: hidden; }
.route-editor__lesson > .chat-scroll .chat__list { height: 100%; flex: 1; }
.route-editor__answer { display: flex; align-items: end; gap: 8px; }
.route-editor__answer .ui-field { flex: 1; }
.route-editor__foot { border-top: 1px solid var(--border); background: var(--surface); position: sticky; bottom: 0; }
.route-editor__foot span { color: var(--muted); font-size: 14px; }
.route-editor [data-route-assistant] { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 8px; display: grid; gap: 12px; }
.route-editor [data-route-assistant] > * { margin: 0; }
.route-assistant__result { display: grid; gap: 12px; }
.route-assistant__compare { display: grid; gap: 12px; }
.route-assistant__compare section { padding: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.route-assistant__compare h4 { margin: 0; }
.route-assistant__compare p { overflow-wrap: anywhere; font-size: 14px; }
@media (min-width: 900px) {
    .route-editor__layout { grid-template-columns: 170px minmax(270px, 1fr) minmax(310px, 1.1fr); }
    .route-editor__steps, .route-editor__fields { height: 100%; min-height: 0; overflow-y: auto; padding-right: 6px; }
    .route-editor__lesson { height: 100%; min-height: 0; overflow-y: auto; }
    .route-editor__lesson .chat__list { height: auto; min-height: 160px; flex: 1; }
}

/* Карточка преподавателя: общий компонент, фотография сохраняется без изменения исходника. */
.ui-teacher-card { display: grid; grid-template-areas: "photo" "content" "contacts"; gap: 20px; align-items: start; }
.ui-teacher-card__photo { grid-area: photo; width: min(100%, 160px); aspect-ratio: 4 / 5; overflow: hidden; border-radius: var(--radius); background: var(--bg); }
.ui-teacher-card__photo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 48% 50%; transform: scale(1.6); }
.ui-teacher-card h3 { margin: 0; }
.ui-card.ui-teacher-card p { margin: 0; }
.ui-teacher-card__content { grid-area: content; display: grid; gap: 12px; min-width: 0; overflow-wrap: anywhere; }
.ui-teacher-card__heading { display: grid; gap: 4px; }
.ui-teacher-card__contacts { grid-area: contacts; display: grid; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
.ui-teacher-card__contacts > p { font-size: 14px; }
.ui-meeting-steps { display: grid; gap: 20px; }
.pilot-meetings-page { max-width: 960px; margin: 32px auto; }
@media (min-width: 640px) {
    .ui-teacher-card { grid-template-columns: 200px minmax(0, 1fr); grid-template-areas: "photo content" "contacts contacts"; }
    .ui-teacher-card__photo { width: 200px; }
    .ui-meeting-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Предложение подписки и ручная оплата — общий компонент, предложение 09.10.2026.
   Карточка не нажимается целиком. Состояния действий и окна задают button и enhanceDialog. */
.subscription-offer__current { display: grid; gap: 20px; align-items: stretch; }
.subscription-plan { display: flex; flex-direction: column; gap: 18px; min-width: 0; padding: clamp(22px, 4vw, 32px); }
.subscription-plan > * { margin: 0; }
.subscription-plan h2 { font-size: clamp(26px, 3vw, 32px); }
.subscription-plan h3 { font-size: 22px; }
.subscription-plan--current { border: 2px solid var(--accent); }
.subscription-plan__badge { align-self: flex-start; display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 20px; background: var(--accent-soft); color: var(--link-text); font-size: 13px; font-weight: 600; }
.subscription-plan__badge--planned { color: var(--muted); background: var(--bg); }
.subscription-plan__intro, .subscription-plan__note { color: var(--muted); }
.subscription-plan__price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.subscription-plan__price strong { font-size: clamp(32px, 5vw, 42px); line-height: 1.15; white-space: nowrap; }
.subscription-plan__price span { font-size: 14px; color: var(--muted); }
.subscription-plan__features { list-style: none; display: grid; gap: 14px; padding: 0; }
.subscription-plan__features li { display: flex; align-items: flex-start; gap: 12px; }
.subscription-plan__features .ui-icon { flex: 0 0 20px; color: var(--accent); margin-top: 3px; }
.subscription-plan__features small { display: block; margin-top: 4px; color: var(--muted); font-size: 14px; }
.subscription-plan__teacher { padding: 16px; border-radius: var(--radius); background: var(--accent-soft); }
.subscription-plan .ui-actions { margin-top: auto; padding-top: 8px; }
.subscription-plan .button { min-height: 48px; }
.subscription-plan__note { font-size: 13px; line-height: 1.5; }
.subscription-trial { display: flex; flex-direction: column; gap: 18px; padding: clamp(22px, 4vw, 32px); }
.subscription-trial__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; color: var(--accent); background: var(--accent-soft); }
.subscription-trial__icon .ui-icon { width: 26px; height: 26px; }
.subscription-trial h2 { font-size: 24px; }
.subscription-trial .button { align-self: start; margin-top: auto; }
.subscription-trial > p:last-child { margin-top: auto; }
.subscription-offer__future { margin-top: 16px; }
.subscription-planned-grid { display: grid; gap: 16px; }
.subscription-plan--planned { gap: 14px; }
.subscription-plan--planned .button { width: 100%; margin-top: auto; }
.subscription-plan__quota { font-weight: 600; }
.subscription-payment__order { padding: 18px; border-radius: var(--radius); background: var(--accent-soft); }
.subscription-payment__order > p { margin: 0; }
.subscription-payment__order > p:nth-last-child(2) { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; }
.subscription-payment__order span { white-space: nowrap; }
.subscription-payment .contact-list { grid-template-columns: minmax(0, 1fr); margin: 0; }
.subscription-payment .contact-item { padding: 16px; }
.subscription-payment__timing { display: flex; gap: 12px; align-items: flex-start; }
.subscription-payment__timing .ui-icon { color: var(--accent); flex-shrink: 0; margin-top: 3px; }
.subscription-payment__timing p { margin: 0; }
@media (min-width: 720px) {
    .subscription-offer__current { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
    .subscription-planned-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .subscription-payment .contact-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Роль аккаунта и семейные действия — предложение от 09.10.2026. */
.app-account__identity { display: grid; min-width: 0; gap: 1px; text-align: left; line-height: 1.35; }
.app-account .app-account__identity [data-account-name] { display: block; }
.app-account [data-account-role] { justify-self: start; max-width: 100%; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--link-text); font-size: 12px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.app-family-action { flex: none; font-size: 14px; }
.app-header__inner:has(.app-family-action) { column-gap: 20px; }
@media (max-width: 1120px) {
    .app-header__inner:has(.app-family-action) { flex-wrap: wrap; row-gap: 8px; }
    .app-family-action { margin-left: auto; }
    .app-account .app-account__identity [data-account-name] { max-width: 140px; }
}
@media (max-width: 800px) {
    .app-header__inner, .app-header__inner:has(.app-family-action) { gap: 8px; padding-inline: 12px; }
    .app-brand img { width: 116px; height: 44px; }
    .app-account summary { gap: 6px; min-height: 44px; }
    .app-account .app-account__identity [data-account-name] { max-width: 86px; font-size: 13px; }
    .app-account [data-account-role] { max-width: 86px; font-size: 11px; }
    .app-family-action { flex-basis: 100%; margin: 0; }
    .app-header .app-family-action { min-height: 44px; padding: 8px 12px; }
}
/* Части ответа — общий информационный статус, без самостоятельного зачёта. */
.quantity-status { min-width: 0; overflow-wrap: anywhere; gap: .5rem; padding-block: .75rem; }
.quantity-status p { margin: 0; }
.quantity-status__title { font-weight: 600; }
.quantity-status__checked { color: var(--text); }

/* Команды Домашки используют общее меню и на компьютере. */
.homework-page .app-mobile-menu { display: block; }
.homework-page .app-mobile-menu summary { display: grid; place-items: center; padding: 6px; list-style: none; color: var(--text); }
.homework-page .app-mobile-menu .app-dropdown { left: 0; right: auto; }
