:root {
  --bg: #faf7f2;
  --bg-tint: #f1ede4;
  --surface: #ffffff;
  --text: #2f3430;
  --muted: #6b716b;
  --accent: #7a8f7b;
  --accent-dark: #5f7460;
  --accent-soft: #e6ece4;
  --line: #e4dfd4;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(47, 52, 48, .06);
  --serif: "Lora", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1f1d; --bg-tint: #242825; --surface: #262a27; --text: #e8ebe7; --muted: #a3aaa3;
    --accent: #8fa690; --accent-dark: #a9c0aa; --accent-soft: #2e3830; --line: #383d39;
    --shadow: 0 6px 24px rgba(0,0,0,.25);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body { margin: 0; font: 400 17px/1.65 var(--sans); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-dark); }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(30px, 4.6vw, 48px); }
h2 { font-size: clamp(25px, 3.2vw, 34px); }
h3 { font-size: 20px; margin-top: 1.4em; }
h4 { font-size: 17px; margin-top: 1.2em; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.3em; }
li { margin-bottom: .45em; }

.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 20px; }

/* Шапка */
.header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.header__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.logo { font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--text); text-decoration: none; white-space: nowrap; }
.logo span { display: block; font: 400 13px/1 var(--sans); color: var(--muted); }
.progress { flex: 1; max-width: 280px; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: var(--accent); transition: width .15s; }

/* Первый экран */
.hero { padding: 56px 0 40px; }
.eyebrow { color: var(--accent-dark); font-weight: 500; font-size: 15px; letter-spacing: .02em; }
.lead { font-size: 19px; color: var(--muted); max-width: 720px; }
.hero__facts { display: flex; flex-wrap: wrap; gap: 32px; list-style: none; padding: 0; margin: 28px 0 0; color: var(--muted); font-size: 15px; }
.hero__facts li { margin: 0; }
.hero__facts strong { display: block; font-family: var(--serif); font-size: 26px; color: var(--text); }

/* Раскладка: меню шагов + контент */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 48px; padding-bottom: 80px; }
.steps-nav { position: sticky; top: 92px; align-self: start; }
.steps-nav ol { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps-nav li { margin: 0; }
.steps-nav a { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 15px; line-height: 1.35; }
.steps-nav a b { font-weight: 600; color: var(--accent-dark); min-width: 1.2em; }
.steps-nav a:hover { background: var(--bg-tint); color: var(--text); }
.steps-nav a.is-active { background: var(--accent-soft); color: var(--text); }

.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 36px 40px; margin-bottom: 28px; }
.step__num { display: inline-block; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-dark); background: var(--accent-soft); padding: 4px 12px; border-radius: 99px; margin-bottom: 14px; }
.lead-sm { font-size: 18px; color: var(--muted); }
.note { font-size: 14px; color: var(--muted); }
.callout { background: var(--bg-tint); border-left: 3px solid var(--accent); padding: 14px 18px; border-radius: 0 10px 10px 0; }

/* Таблицы */
.table-wrap { overflow-x: auto; margin: 0 0 1.2em; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
th { background: var(--bg-tint); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tr.hl td { background: var(--accent-soft); font-weight: 600; }

/* График средних баллов */
.bars { margin: 8px 0 24px; }
.bars__title { font-weight: 600; margin-bottom: 10px; }
.bars__grid { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; align-items: end; height: 220px; padding-top: 24px; border-bottom: 1px solid var(--line); }
.bars__col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bars__val { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.bars__bar { width: 100%; max-width: 44px; background: color-mix(in srgb, var(--muted) 35%, transparent); border-radius: 6px 6px 0 0; }
.bars__col.is-last .bars__bar { background: var(--accent); }
.bars__col.is-last .bars__val { color: var(--accent-dark); font-weight: 600; }
.bars__yr { font-size: 12px; color: var(--muted); text-align: center; margin-top: 6px; }
.bars__years { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.bars__ref { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--accent-dark); font-size: 12px; color: var(--accent-dark); }
.bars__ref span { position: absolute; right: 0; top: -18px; background: var(--surface); padding: 0 4px; }

/* Конспекты: аккордеон */
.topic { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.topic > summary { cursor: pointer; list-style: none; padding: 16px 20px; font-family: var(--serif); font-weight: 600; font-size: 19px; display: flex; justify-content: space-between; gap: 12px; background: var(--bg-tint); }
.topic > summary::-webkit-details-marker { display: none; }
.topic > summary::after { content: "+"; font-family: var(--sans); color: var(--accent-dark); }
.topic[open] > summary::after { content: "−"; }
.topic__body { padding: 8px 24px 20px; }
.topic__body h3:first-child { margin-top: .8em; }
.topic__body p:has(> strong:first-child) { }

/* Таймлайн плана */
.timeline { list-style: none; padding: 0; margin: 20px 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 22px 42px; margin: 0; }
.timeline input { position: absolute; left: 0; top: 2px; width: 24px; height: 24px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.timeline label { cursor: pointer; }
.tl__when { font-size: 14px; color: var(--muted); font-weight: 500; }
.timeline h3 { margin: 2px 0 6px; font-size: 19px; }
.timeline p { margin: 0 0 4px; font-size: 16px; }
.tl__ctrl { color: var(--accent-dark); font-weight: 500; }
.timeline li.is-check h3 { color: var(--accent-dark); }
.timeline li.is-done h3, .timeline li.is-done p { opacity: .55; }

/* Карточки и чек-лист */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 16px 0; }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; background: var(--bg); }
.card h3 { margin: 6px 0; font-size: 18px; }
.card p { margin: 0; font-size: 15px; color: var(--muted); }
.card__tag { font-size: 13px; color: var(--accent-dark); font-weight: 600; }
.checks { list-style: none; padding: 0; }
.checks label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.checks input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--accent); flex: none; }
.checks li.is-done label { color: var(--muted); text-decoration: line-through; }
.sources li { font-size: 15px; }

/* Маршрут ученика */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 22px; border: 0; border-radius: 99px; background: var(--accent-dark); color: #fff; font: 600 16px/1.3 var(--sans); text-decoration: none; text-align: center; cursor: pointer; transition: background .15s, transform .15s; }
.btn:hover { background: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; transform: none; }
.btn--small { min-height: 40px; padding: 8px 18px; font-size: 15px; }
@media (prefers-color-scheme: dark) { .btn { color: #1c1f1d; } }

.route { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 24px; align-items: center; margin-top: 32px; padding: 20px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-width: 820px; }
.route__text strong { display: block; font-family: var(--serif); font-size: 20px; }
.route__text span { color: var(--muted); font-size: 15px; }
.route__bar { grid-column: 1 / -1; grid-row: 2; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.route__bar i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.route__actions { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.route__reset { border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; padding: 4px; }

.step__lock { display: none; }
.step.is-locked { background: var(--bg-tint); box-shadow: none; }
.step.is-locked > :not(.step__num):not(h2):not(.step__lock) { display: none; }
.step.is-locked h2 { color: var(--muted); margin-bottom: .3em; }
.step.is-locked .step__lock { display: block; margin: 0; color: var(--muted); }
.step.is-done .step__num::after { content: " ✓"; }

.step__done { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.step__done-hint { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 15px; }
.step__done-hint:empty { display: none; }
.step__done-ok { display: none; color: var(--accent-dark); font-weight: 600; }
.step.is-done .step__done .btn { display: none; }
.step.is-done .step__done-ok { display: inline; }

.steps-nav a.is-locked { opacity: .5; }
.steps-nav a.is-locked b::after { content: "🔒"; font-size: 11px; margin-left: 2px; }
.steps-nav a.is-passed b { color: var(--accent); }
.steps-nav a.is-passed span::after { content: " ✓"; color: var(--accent-dark); }

.topic.is-locked > summary { cursor: not-allowed; color: var(--muted); background: var(--bg); }
.topic.is-locked > summary::after { content: "🔒"; }
.topic.is-done > summary::before { content: "✓"; order: 2; margin-left: auto; color: var(--accent-dark); font-family: var(--sans); }
.topic__btn { margin-top: 18px; }
.topic.is-done .topic__btn { display: none; }

.timeline li.is-waiting { opacity: .5; }
.timeline li.is-waiting input { cursor: not-allowed; }

/* Видео */
.videos { margin: 24px 0 4px; }
.videos__h { margin: 0 0 10px; font-size: 18px; }
.video { margin-bottom: 12px; }
.video__play { display: flex; gap: 14px; align-items: center; width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.video__play:hover { border-color: var(--accent); background: var(--accent-soft); }
.video__icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--accent-dark); color: var(--surface); font-size: 16px; padding-left: 3px; }
.video__meta { min-width: 0; }
.video__title { display: block; font-weight: 600; line-height: 1.35; }
.video__sub { display: block; font-size: 14px; color: var(--muted); }
.video__frame { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.video__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video__link { display: inline-block; margin-top: 6px; font-size: 14px; }

/* Проверь себя: ответы спрятаны */
.quiz { margin: 22px 0 6px; padding: 18px 20px; border-radius: 12px; background: var(--bg-tint); }
.quiz > h3:first-child, .quiz > h4:first-child { margin-top: 0; }
.quiz ol { padding-left: 1.4em; }
.quiz li { margin-bottom: 14px; }
details.answer { margin-top: 6px; }
details.answer > summary { display: inline-block; cursor: pointer; list-style: none; padding: 2px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--accent-dark); font-size: 14px; font-weight: 600; }
details.answer > summary::-webkit-details-marker { display: none; }
details.answer[open] > summary { background: var(--accent-soft); }
details.answer > :not(summary) { margin-top: 8px; font-size: 15px; }
.new-badge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-dark); font: 600 12px/1.6 var(--sans); vertical-align: middle; }

/* Тест с таймером */
body.has-test { overflow: hidden; }
.test { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: center; align-items: flex-start; padding: 24px 16px; background: rgba(28, 31, 29, .55); overflow-y: auto; }
.test__panel { width: 100%; max-width: 760px; background: var(--surface); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.25); overflow: hidden; }
.test__head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 22px; background: var(--bg-tint); border-bottom: 1px solid var(--line); }
.test__head strong { display: block; font-family: var(--serif); font-size: 18px; line-height: 1.3; }
.test__kicker { font-size: 13px; color: var(--muted); }
.test__timer { flex: none; min-width: 84px; padding: 6px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font: 600 20px/1 var(--sans); font-variant-numeric: tabular-nums; text-align: center; }
.test__timer.is-low { color: #b3412f; border-color: #e3b4aa; }
.test__body { padding: 8px 22px 12px; }
.test__foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--bg); }
.test__foot .btn:only-child { margin-left: auto; }
.tq { margin: 18px 0; padding: 0 0 18px; border: 0; border-bottom: 1px solid var(--line); }
.tq legend { display: flex; gap: 10px; padding: 0; margin-bottom: 8px; font-weight: 600; line-height: 1.45; }
.tq__n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); font-size: 14px; }
.tq__hint { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.tq__explain { margin: 4px 0 0; font-size: 14px; }
.test__cats { margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--accent-dark); }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; margin: 0 0 4px; border-radius: 10px; cursor: pointer; font-size: 16px; line-height: 1.45; }
.opt:hover { background: var(--bg-tint); }
.opt input { flex: none; width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent-dark); }
.opt--match { justify-content: space-between; align-items: center; cursor: default; }
.opt--match select { flex: none; min-width: 64px; min-height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.test__term { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
.test__result { margin: 16px 0 8px; padding: 16px 18px; border-radius: 12px; }
.test__result strong { display: block; font-family: var(--serif); font-size: 21px; margin-bottom: 4px; }
.test__result.is-pass { background: var(--accent-soft); }
.test__result.is-fail { background: #f8e8e4; }
.test__review { padding-left: 1.3em; }
.test__review li { margin-bottom: 14px; }
.test__review li p { margin: 0 0 2px; }
.test__review li.is-right b:first-child { color: var(--accent-dark); }
.test__review li.is-wrong b:first-child { color: #b3412f; }
.gate__fail:empty { display: none; }
.gate__fail { flex-basis: 100%; padding: 12px 14px; border-left: 3px solid #c9725f; border-radius: 0 10px 10px 0; background: #f8e8e4; font-size: 15px; }
.topic__btn { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.topic__btn .step__done-ok { display: none; }
@media (prefers-color-scheme: dark) {
  .test__result.is-fail, .gate__fail { background: #3a2a26; }
  .test__timer.is-low { color: #f0a090; border-color: #6a3a30; }
}
@media (max-width: 640px) {
  .test { padding: 0; }
  .test__panel { min-height: 100%; border-radius: 0; }
  .test__head, .test__body, .test__foot { padding-left: 16px; padding-right: 16px; }
  .opt--match { flex-direction: column; align-items: stretch; }
}

/* Журнал результатов для родителей */
.parent-log { grid-column: 1 / -1; }
.parent-log__stats { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-bottom: 10px; font-size: 15px; color: var(--muted); }
.parent-log__stats b { color: var(--text); }
.parent-log__note { margin: 0; font-size: 15px; color: var(--muted); }
.parent-log__table { max-height: 320px; overflow: auto; margin: 0; }
.parent-log__table td { font-size: 14px; }
.parent-log__table tr.is-fail td:nth-child(3) { color: #b3412f; }

/* Возврат на главную и режим родителя */
.back { font-size: 14px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.back:hover { color: var(--accent-dark); }
.parent-link { margin-top: 10px; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }
body.is-parent .parent-link { display: none; }
body.is-parent .step__done, body.is-parent .topic__btn { display: none; }

.footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: 14px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .steps-nav { position: static; margin-bottom: 20px; overflow-x: auto; }
  .steps-nav ol { display: flex; gap: 6px; }
  .steps-nav a { white-space: nowrap; border: 1px solid var(--line); }
  .steps-nav a span { display: none; }
  .progress { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .container { padding: 0 16px; }
  .step { padding: 24px 18px; }
  .topic__body { padding: 4px 16px 16px; }
  .cards { grid-template-columns: 1fr; }
  .route { grid-template-columns: minmax(0, 1fr); padding: 18px; }
  .route__bar { grid-row: auto; }
  .step__done .btn { width: 100%; }
  th, td { padding: 8px 10px; font-size: 14px; }
  .bars__val { font-size: 10px; }
  .bars__yr { font-size: 10px; }
}
