/* «Шаг» — общие стили приложения: светлая и тёмная темы, страницы, формы. */

:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --soft: #f0f3f8;
  --ink: #202d43;
  --muted: #647086;
  --line: #e0e5ed;
  --blue: #315bba;
  --blue-strong: #254992;
  --blue-soft: #e9effc;
  --coral: #d64829;
  --coral-soft: #fff0e9;
  --green: #217759;
  --green-soft: #e5f3ec;
  --amber: #936509;
  --amber-soft: #fcf1d9;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --hero: #e7eefb;
  --hero-line: #c6d4f0;
  --hero-ink: #233e77;
  --shadow: 0 12px 32px rgb(27 46 76 / 5%);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151b26;
  --surface: #1d2635;
  --soft: #263145;
  --ink: #ebeff8;
  --muted: #b0bbce;
  --line: #364155;
  --blue: #a5bfff;
  --blue-strong: #c3d4ff;
  --blue-soft: #2b3c5b;
  --coral: #ffab8f;
  --coral-soft: #49332e;
  --green: #91d5b6;
  --green-soft: #253f3c;
  --amber: #f4ce7e;
  --amber-soft: #413a2c;
  --danger: #ff9b91;
  --danger-soft: #4a2b2a;
  --hero: #243653;
  --hero-line: #40557a;
  --hero-ink: #dce7ff;
  --shadow: none;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
  margin: 0;
  font: 14px/1.55 'Golos Text', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; color: inherit; border: 0; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
img { max-width: 100%; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; line-height: 1.2; }
h1 { font-size: clamp(26px, 2.5vw, 36px); font-weight: 600; letter-spacing: -1.1px; }
h2 { font-size: 21px; font-weight: 600; letter-spacing: -.6px; }
h3 { font-size: 16px; font-weight: 600; letter-spacing: -.4px; }

svg { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-library { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: -100px; left: 12px; z-index: 100; padding: 12px 16px; border-radius: 8px; background: var(--surface); }
.skip-link:focus { top: 12px; }
.mobile-only { display: none !important; }

/* Скрываем содержимое до проверки сессии, чтобы не мигало. */
html.js body:not(.ready) .workspace { visibility: hidden; }

/* ---------- Боковое меню ---------- */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  z-index: 20;
  padding: 32px 18px 18px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.brand-row { display: flex; align-items: center; justify-content: space-between; margin: 0 12px 32px; }
.brand { display: flex; gap: 12px; align-items: center; font-size: 31px; font-weight: 800; line-height: 1; letter-spacing: -1.5px; }
.brand img { width: 40px; height: 40px; min-width: 40px; object-fit: cover; border-radius: 12px; }
.brand-caption { display: block; font-size: 10px; font-weight: 500; letter-spacing: 0; line-height: 1.8; color: var(--muted); margin-top: 3px; }

.exam-label { margin: 0 10px 28px; padding: 10px 12px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; font-weight: 600; }
.exam-label > span:last-child { margin-left: auto; color: var(--muted); font-weight: 400; }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex-shrink: 0; }

.main-nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 500; }
.nav-item:hover { color: var(--ink); background: var(--soft); }
.nav-item.active { background: var(--blue-soft); color: var(--blue); }
.nav-item svg { width: 19px; height: 19px; }
.nav-count { margin-left: auto; font-size: 11px; }

.sidebar-bottom { margin-top: auto; padding-top: 40px; }
.small-note { padding: 20px 14px; margin-bottom: 16px; border-top: 1px solid var(--line); }
.small-note > svg { color: var(--coral); margin-bottom: 14px; width: 26px; height: 26px; }
.small-note strong { display: block; font-size: 17px; line-height: 1.5; letter-spacing: -.4px; }
.small-note p { font-size: 12px; color: var(--muted); margin-top: 10px; }
.help-button { display: flex; align-items: center; gap: 10px; width: 100%; background: transparent; color: var(--muted); padding: 12px; font-size: 12px; border-radius: 8px; }
.help-button:hover { background: var(--soft); color: var(--ink); }
.profile { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); margin-top: 12px; padding: 20px 10px 0; }
.avatar { background: var(--coral-soft); color: var(--coral); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.profile strong { display: block; font-size: 13px; font-weight: 600; }
.profile div > span { display: block; font-size: 10px; color: var(--muted); }
.profile-badge { margin-left: auto; border: 1px solid var(--line); border-radius: 6px; font-size: 11px; padding: 2px 7px; }

/* ---------- Верхняя панель ---------- */

.workspace { margin-left: 232px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 10; padding: 0 40px; height: 80px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-title, .top-actions { display: flex; gap: 14px; align-items: center; }
.topbar-title > span:first-of-type { font-weight: 500; font-size: 13px; }
.top-actions time { font-size: 12px; color: var(--muted); }

.theme-toggle { display: flex; align-items: center; gap: 9px; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 12px; }
.theme-toggle:hover { background: var(--soft); border-color: var(--muted); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: block; }
.switch-track { width: 26px; height: 16px; background: var(--line); border-radius: 16px; padding: 3px; }
.switch-track::before { content: ''; display: block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); transition: transform .15s; }
[data-theme="dark"] .switch-track { background: var(--blue-soft); }
[data-theme="dark"] .switch-track::before { background: var(--blue); transform: translateX(10px); }

main { width: 100%; max-width: 1420px; margin: 0 auto; padding: 36px 40px 0; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head .page-caption { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.page-head h1 + p { color: var(--muted); font-size: 13px; margin-top: 10px; max-width: 62ch; }
.pace { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ---------- Кнопки ---------- */

.primary-button { padding: 12px 17px; min-height: 44px; display: inline-flex; gap: 20px; align-items: center; border-radius: 8px; background: var(--blue); color: #fff; font-size: 12px; font-weight: 500; }
.primary-button:hover { background: var(--blue-strong); }
[data-theme="dark"] .primary-button { color: #14203a; }
.primary-button svg { width: 18px; height: 18px; }
.primary-button[disabled] { opacity: .6; cursor: progress; }
.ghost-button { padding: 11px 16px; min-height: 42px; display: inline-flex; align-items: center; gap: 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; font-weight: 500; }
.ghost-button:hover { border-color: var(--muted); background: var(--soft); }
.ghost-button svg { width: 17px; height: 17px; }
.danger-button { padding: 11px 16px; min-height: 42px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 12px; font-weight: 500; }
.danger-button:hover { box-shadow: inset 0 0 0 1px var(--danger); }
.icon-button { display: grid; place-items: center; min-width: 40px; min-height: 40px; background: transparent; border-radius: 8px; }
.icon-button:hover { background: var(--soft); }
.text-link { font-size: 12px; font-weight: 500; color: var(--blue); display: inline-flex; align-items: center; gap: 6px; }
.text-link:hover { text-decoration: underline; }
.text-link svg { width: 16px; height: 16px; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Карточки и блоки ---------- */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.card + .card { margin-top: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.card-head h2 { font-size: 18px; }
.card-head p { font-size: 12px; color: var(--muted); margin-top: 6px; }
.quiet-badge { font-size: 10px; color: var(--muted); background: var(--soft); border: 1px solid var(--line); padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stack { display: grid; gap: 20px; }
.empty { padding: 26px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- Главная ---------- */

.hero { display: flex; position: relative; overflow: hidden; background: var(--hero); border-radius: 18px; min-height: 292px; color: var(--hero-ink); }
.hero-copy { padding: 32px 36px; flex: 1; z-index: 1; }
.lesson-label { display: flex; align-items: center; gap: 8px; font-size: 11px; margin-bottom: 16px; }
.lesson-label > span { width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.hero h2 { font-size: clamp(25px, 2.2vw, 33px); line-height: 1.2; letter-spacing: -.9px; font-weight: 600; }
.hero-copy p { font-size: 12px; margin: 16px 0 22px; line-height: 1.7; }
.lesson-duration { margin-left: 14px; display: inline-flex; gap: 5px; align-items: center; font-size: 10px; }
.lesson-duration svg { width: 14px; height: 14px; }
.hero-visual { width: 39%; min-width: 255px; position: relative; display: grid; place-items: center; }
.hero-visual .hero-photo { position: relative; z-index: 1; }
.orbit { position: absolute; width: 350px; height: 350px; border: 1px solid var(--hero-line); border-radius: 50%; }
.orbit-two { width: 260px; height: 260px; }
.math-paper { position: relative; padding: 24px; width: 240px; background-color: var(--surface); background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 20px 20px; border: 6px solid var(--surface); color: var(--ink); box-shadow: var(--shadow); border-radius: 8px; transform: rotate(-7deg); }
.paper-label { display: block; font-size: 10px; margin-bottom: 20px; background: var(--surface); width: fit-content; }
.equation { display: block; font-size: 25px; white-space: nowrap; font-weight: 500; letter-spacing: -1px; }
.hand-line { display: block; height: 2px; width: 80px; margin: 8px 0 10px 62px; background: var(--coral); transform: rotate(-4deg); }
.solution { font-size: 29px; font-weight: 500; margin-left: 35px; }
.solution span { color: var(--green); margin-left: 15px; }
.paper-bottom { display: block; font-size: 9px; margin-top: 22px; background: var(--surface); }

.stats-strip { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); padding: 28px 0; margin-bottom: 34px; gap: 20px; }
.stat { display: flex; align-items: center; gap: 14px; min-width: 0; }
.stat + .stat { padding-left: 24px; border-left: 1px solid var(--line); }
.stat-symbol { display: grid; place-items: center; border-radius: 12px; width: 44px; height: 44px; flex-shrink: 0; }
.coral { background: var(--coral-soft); color: var(--coral); }
.blue { background: var(--blue-soft); color: var(--blue); }
.green { background: var(--green-soft); color: var(--green); }
.amber { background: var(--amber-soft); color: var(--amber); }
.stat-label { display: block; font-size: 11px; color: var(--muted); }
.stat-value { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px; font-size: 27px; line-height: 1.5; font-weight: 600; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.stat-value > span:not(.stat-note) { font-size: 13px; letter-spacing: 0; }
.stat-value .stat-note { font-size: 10px; color: var(--muted); letter-spacing: 0; font-weight: 400; margin-left: 7px; }
.stat-value .positive { color: var(--green); }

/* ---------- Предметы ---------- */

.subject-list { display: grid; gap: 10px; }
.subject { display: flex; align-items: center; gap: 16px; text-align: left; background: var(--surface); border: 1px solid var(--line); padding: 19px; border-radius: 12px; width: 100%; }
.subject:hover { border-color: var(--blue); }
.subject-symbol { display: grid; place-items: center; width: 46px; height: 46px; flex-shrink: 0; font-size: 21px; font-weight: 500; border-radius: 10px; }
.subject-details { flex: 1; min-width: 0; }
.subject-details > strong { display: block; font-weight: 600; font-size: 14px; }
.subject-details > span:not(.progress-bar) { display: block; color: var(--muted); font-size: 10px; margin: 3px 0 10px; }
.progress-bar { display: block; height: 4px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.progress-bar i { display: block; width: var(--progress, 0%); background: var(--bar-color, var(--blue)); height: 100%; border-radius: 4px; }
.subject-completion { text-align: right; min-width: 65px; font-variant-numeric: tabular-nums; }
.subject-completion strong { display: block; font-size: 15px; font-weight: 500; }
.subject-completion span { display: block; font-size: 9px; color: var(--muted); margin-top: 3px; }
.subject-arrow { width: 16px; height: 16px; color: var(--muted); }
.subject-card { border: 1px solid var(--line); border-radius: 14px; padding: 24px; background: var(--surface); }
.subject-card + .subject-card { margin-top: 16px; }
.subject-card-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.subject-card-head .subject-info { flex: 1; min-width: 180px; }
.subject-card-head h3 { font-size: 17px; }
.subject-card-head p { font-size: 12px; color: var(--muted); margin-top: 5px; }
.topic-list { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.topic-chip.done { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.topic-chip svg { width: 13px; height: 13px; }

/* ---------- План ---------- */

.task-group { display: grid; gap: 2px; }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.task:last-child { border-bottom: 0; }
.task input { width: 18px; height: 18px; flex-shrink: 0; margin: 3px 0 0; accent-color: var(--blue); cursor: pointer; }
.task-body { flex: 1; min-width: 0; }
.task strong { display: block; font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.task small { display: block; font-size: 10px; color: var(--muted); margin-top: 4px; }
.task input:checked ~ .task-body strong { text-decoration: line-through; color: var(--muted); }
.task-delete { background: transparent; color: var(--muted); border-radius: 8px; padding: 6px; }
.task-delete:hover { color: var(--danger); background: var(--danger-soft); }
.task-delete svg { width: 16px; height: 16px; }
.task-form { display: grid; gap: 12px; grid-template-columns: 2fr 1fr 0.7fr auto; align-items: end; }
.field { display: grid; gap: 7px; }
.field label { font-size: 11px; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
}
input::placeholder { color: var(--muted); }
.hint { font-size: 10px; color: var(--muted); }
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--soft); border-radius: 10px; }
.tab { padding: 8px 14px; border-radius: 8px; background: transparent; font-size: 12px; color: var(--muted); min-height: 36px; }
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Практика ---------- */

.quiz-shell { max-width: 760px; }
.quiz-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; font-size: 11px; color: var(--muted); }
.quiz-progress .progress-bar { flex: 1; background: var(--line); }
.quiz-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.quiz-topic { font-size: 10px; color: var(--muted); margin-bottom: 12px; }
.quiz-question { font-size: 18px; font-weight: 500; line-height: 1.5; letter-spacing: -.3px; }
.answer-form { display: grid; gap: 14px; margin-top: 22px; }
.answer-form .button-row { justify-content: flex-start; }
.feedback { margin-top: 22px; padding: 18px; border-radius: 12px; background: var(--soft); }
.feedback.correct { background: var(--green-soft); }
.feedback.wrong { background: var(--coral-soft); }
.feedback strong { display: block; font-size: 14px; margin-bottom: 8px; }
.feedback p { font-size: 13px; color: var(--ink); margin-bottom: 16px; }
.feedback .expected { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.result-summary { text-align: center; padding: 20px 0; }
.result-score { font-size: 44px; font-weight: 600; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.result-list { text-align: left; display: grid; gap: 10px; margin-top: 24px; }
.result-item { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.result-item svg { width: 18px; height: 18px; margin-top: 2px; }
.result-item.ok svg { color: var(--green); }
.result-item.no svg { color: var(--coral); }
.subject-choice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.choice-card { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.choice-card:hover { border-color: var(--blue); }
.choice-card h3 { margin-bottom: 8px; }
.choice-card p { font-size: 11px; color: var(--muted); line-height: 1.7; }
.choice-card .quiet-badge { margin-bottom: 16px; display: inline-block; }

/* ---------- Прогресс ---------- */

.chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; height: 200px; }
.chart-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 10px; height: 100%; }
.chart-bar { width: 100%; max-width: 42px; border-radius: 8px 8px 4px 4px; background: var(--blue-soft); }
.chart-bar i { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--blue); }
.chart-empty { display: block; width: 100%; max-width: 42px; height: 4px; border-radius: 4px; background: var(--line); }
.chart-label { font-size: 10px; color: var(--muted); }
.chart-caption { font-size: 10px; color: var(--muted); margin-top: 14px; text-align: center; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 10px; color: var(--muted); font-weight: 500; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.score-pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; background: var(--blue-soft); color: var(--blue); }
.score-pill.good { background: var(--green-soft); color: var(--green); }
.score-pill.low { background: var(--coral-soft); color: var(--coral); }

/* ---------- Формы и уведомления ---------- */

.form-grid { display: grid; gap: 16px; max-width: 460px; }
.alert { padding: 12px 14px; border-radius: 9px; font-size: 12px; border: 1px solid transparent; }
.alert.error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.alert.success { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.alert.info { background: var(--blue-soft); color: var(--blue); border-color: var(--blue); }
.alert[hidden] { display: none; }
.field-error { font-size: 11px; color: var(--danger); min-height: 15px; }

/* ---------- Экран входа ---------- */

.auth-shell { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-aside { background: var(--hero); color: var(--hero-ink); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.auth-aside .brand { font-size: 34px; }
.auth-aside h2 { font-size: clamp(28px, 2.6vw, 40px); letter-spacing: -1.3px; margin-bottom: 16px; }
.auth-aside p { font-size: 13px; line-height: 1.8; max-width: 42ch; }
.auth-points { display: grid; gap: 14px; margin-top: 10px; }
.auth-point { display: flex; gap: 12px; align-items: flex-start; font-size: 12px; }
.auth-point svg { width: 18px; height: 18px; color: var(--coral); margin-top: 2px; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(420px, 100%); }
.auth-card h1 { font-size: 28px; margin-bottom: 10px; }
.auth-card > p { color: var(--muted); font-size: 13px; margin-bottom: 28px; }
.auth-card .form-grid { max-width: none; }
.auth-foot { margin-top: 24px; font-size: 12px; color: var(--muted); }
.auth-foot a { color: var(--blue); font-weight: 500; }
.auth-foot a:hover { text-decoration: underline; }
.demo-note { margin-top: 20px; padding: 14px; border: 1px dashed var(--line); border-radius: 10px; font-size: 11px; color: var(--muted); line-height: 1.7; }
.demo-note code { font-size: 11px; color: var(--ink); }

/* ---------- Прочее ---------- */

footer { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); margin-top: 40px; padding: 20px 0; font-size: 10px; color: var(--muted); }
.backdrop { display: none; }
dialog { width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 48px); overflow-y: auto; overscroll-behavior: contain; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: 0 24px 80px #0004; }
dialog::backdrop { background: rgb(10 20 35 / 65%); }
.dialog-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
dialog p { color: var(--muted); margin-bottom: 16px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 32px); background: var(--ink); color: var(--surface); padding: 12px 20px; border-radius: 10px; z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.show { opacity: 1; }
.loading { display: flex; align-items: center; gap: 10px; padding: 26px; color: var(--muted); font-size: 13px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Иллюстрации ---------- */

.art { display: block; width: 100%; height: 100%; object-fit: cover; }
[data-theme="dark"] .art { filter: brightness(.86) saturate(.9); }

.subject-thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.subject { align-items: center; }

.subject-card-head .art-frame { width: 100%; max-width: 232px; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--soft); flex-shrink: 0; }
.subject-card-head { align-items: flex-start; gap: 22px; }
.subject-meter { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.subject-meter .progress-bar { flex: 1; height: 6px; }
.meter-value { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.meter-note { display: block; font-size: 11px; color: var(--muted); margin-top: 8px; }

.choice-cover { aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--soft); margin-bottom: 16px; }

.hero-photo { width: min(330px, 92%); border-radius: 10px; border: 5px solid var(--surface); box-shadow: var(--shadow); transform: rotate(-3deg); overflow: hidden; aspect-ratio: 4 / 3; }
[data-theme="dark"] .hero-photo { border-color: var(--soft); }

.empty-art { width: min(210px, 70%); margin: 0 auto 14px; border-radius: 10px; overflow: hidden; }
.empty p { margin: 0 auto; max-width: 40ch; }

.auth-art { width: 100%; max-width: 460px; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); margin-top: 28px; }
.notice-art { width: min(420px, 100%); aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); margin: 24px 0 28px; }

@media (max-width: 980px) {
  .subject-card-head .art-frame { max-width: 100%; }
  .auth-art, .notice-art { max-width: 100%; }
}

/* ---------- Адаптивность ---------- */

@media (min-width: 1600px) { main { padding-top: 48px; } .hero { min-height: 330px; } .hero-copy { padding: 40px; } }

@media (max-width: 1200px) {
  .sidebar { width: 210px; padding-inline: 12px; }
  .workspace { margin-left: 210px; }
  main, .topbar { padding-inline: 26px; }
  .grid-2 { gap: 20px; grid-template-columns: 1.3fr 1fr; }
  .subject { gap: 10px; padding: 16px; }
  .subject-arrow { display: none; }
  .subject-symbol { width: 38px; height: 38px; }
  .stat-value .stat-note { margin-left: 0; width: 100%; }
  .hero-copy { padding: 28px; }
  .hero-visual { min-width: 210px; }
  .math-paper { width: 210px; padding: 20px 12px; }
  .lesson-duration { display: flex; margin: 12px 0 0; }
  .task-form { grid-template-columns: 1fr 1fr; }
  .task-form .field-wide { grid-column: 1 / -1; }
}

@media (max-width: 980px) {
  .grid-2, .grid-3, .subject-choice { grid-template-columns: 1fr; }
  .stat + .stat { padding-left: 14px; }
  .stat { gap: 8px; }
  .stat-symbol { width: 32px; height: 32px; }
  .hero-visual { min-width: 180px; }
  .math-paper { width: 180px; }
  .equation { font-size: 21px; }
  .paper-label { font-size: 8px; }
  .hero-copy { padding: 26px; }
  .pace, .top-actions time { display: none; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { padding: 32px 26px; }
  .auth-points { display: none; }
}

@media (max-width: 760px) {
  .mobile-only { display: grid !important; }
  .sidebar { transform: translateX(-100%); width: 270px; padding: 24px 18px; transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .backdrop.show { display: block; position: fixed; inset: 0; z-index: 19; background: #10182888; }
  .workspace { margin-left: 0; }
  .topbar { height: 70px; padding-inline: 14px; }
  .topbar-title { gap: 7px; }
  .top-actions { gap: 0; }
  main { padding: 26px 18px 0; }
  .page-head { margin-bottom: 22px; }
  .page-head h1 { font-size: 27px; }
  .hero { min-height: 0; }
  .hero-copy { padding: 26px; }
  .hero h2 { font-size: 28px; }
  .hero-visual { display: none; }
  .lesson-duration { display: inline-flex; margin: 0 0 0 12px; }
  .stats-strip { padding: 24px 0; gap: 12px; margin-bottom: 26px; }
  .stat { display: block; }
  .stat-symbol { margin-bottom: 10px; }
  .stat-label { font-size: 10px; }
  .stat-value { font-size: 24px; }
  .stat-value .stat-note { font-size: 9px; }
  .card { padding: 18px; }
  .card-head h2 { font-size: 17px; }
  .task-form { grid-template-columns: 1fr; }
  .quiz-card { padding: 20px; }
  .quiz-question { font-size: 16px; }
  .chart { gap: 6px; }
  .chart-bar { max-width: none; }
  footer { font-size: 9px; flex-wrap: wrap; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}

@media (max-width: 560px) {
  .theme-toggle [data-theme-label] { display: none; }
  .theme-toggle { gap: 8px; padding: 0 10px; }
  .topbar-title > span:first-of-type { font-size: 12px; }
}

@media (max-width: 460px) {
  .demo-badge { display: none; }
  .topbar { gap: 8px; }
}
  .hero-copy { padding: 23px; }
  .lesson-duration { display: flex; margin: 12px 0 0; }
  .quiet-badge { font-size: 9px; }
  .subject { padding: 12px; }
  .subject-details > strong { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
