:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --ink: #23201d;
  --muted: #7c766c;
  --line: #edebe5;
  --accent: #d83a34;        /* фирменный красный REDit */
  --accent-hover: #c22f2a;
  --accent-soft: #fbe9e7;
  --accent-ink: #a5261f;
  --warm: #b8794a;
  --done: #4e8a5b;
  --done-soft: #e7f1e9;
  --star: #f2b21e;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(35,32,29,.04), 0 10px 34px rgba(35,32,29,.06);
  --shadow-soft: 0 1px 2px rgba(35,32,29,.04), 0 4px 16px rgba(35,32,29,.05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Georgia", "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 17px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.22; letter-spacing: -0.01em; margin: 0 0 .4em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 28px; }
.page { padding-top: 32px; padding-bottom: 90px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; max-width: 1200px; margin: 0 auto; padding: 0 28px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.brand-mark {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 11px;
  background: var(--accent); color: #fff;
  font-family: var(--serif); font-size: 1.2rem;
}
.brand-mark.light { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.brand-mark.big { width: 58px; height: 58px; font-size: 2rem; border-radius: 16px; }
.brand-text { font-size: 1.04rem; }
.brand-light { color: #fff; }
.header-nav { display: flex; align-items: center; gap: 22px; font-size: .95rem; }
.header-user { color: var(--muted); }
.inline { display: inline; margin: 0; }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.link-btn:hover { color: var(--accent); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .96rem; cursor: pointer; transition: .15s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); font-weight: 500; }
.btn-ghost:hover { border-color: #d9d5cd; }
.btn-done { background: var(--done-soft); color: var(--done); border-color: #cfe6d4; }
.btn-block { width: 100%; }

/* Forms */
.form label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 16px; }
.form input, textarea {
  display: block; width: 100%; padding: 13px 15px;
  border: 1px solid var(--line); border-radius: 12px; font: inherit; color: var(--ink); background: #fcfbf9;
}
.form input { margin-top: 6px; }
.form input:focus, textarea:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; font-size: .98rem; }
.alert { background: #fbeceb; color: #9c342c; border-radius: 12px; padding: 11px 15px; font-size: .9rem; margin-bottom: 16px; }

/* ============ Вход: полноэкранный сплит ============ */
.login-body { background: var(--bg); }
.login-split { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }

.login-brand {
  position: relative; color: #fff;
  background: radial-gradient(1200px 600px at 20% 0%, #e5473f 0%, #d83a34 42%, #b02a25 100%);
  display: flex; align-items: center; overflow: hidden;
}
.login-brand::after {
  content: ""; position: absolute; right: -140px; bottom: -160px; width: 460px; height: 460px;
  background: rgba(255,255,255,.07); border-radius: 50%;
}
.login-brand-inner { position: relative; z-index: 1; padding: 56px 6vw; width: 100%; max-width: 640px; margin: 0 auto; }
.login-hero { margin: 40px 0 34px; }
.login-hero h1 { color: #fff; font-size: 2.5rem; line-height: 1.14; margin-bottom: .35em; }
.login-hero p { color: rgba(255,255,255,.9); font-size: 1.08rem; max-width: 30em; }

.login-portrait { margin-bottom: 34px; }
.portrait-frame {
  width: 156px; height: 176px; border-radius: 20px; padding: 6px; overflow: hidden;
  background: rgba(255,255,255,.14); box-shadow: 0 0 0 2px rgba(255,255,255,.5);
}
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px; display: block; }

.login-facts { list-style: none; margin: 0; padding: 0; display: flex; gap: 14px; flex-wrap: wrap; }
.login-facts li {
  background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.22);
  border-radius: 14px; padding: 14px 18px; display: flex; flex-direction: column; min-width: 120px;
}
.login-facts b { font-size: 1.3rem; font-family: var(--serif); }
.login-facts span { font-size: .82rem; color: rgba(255,255,255,.85); margin-top: 2px; }

.login-form-side { display: flex; align-items: center; justify-content: center; padding: 48px 6vw; }
.login-form-card { width: 100%; max-width: 400px; }
.login-form-card h2 { font-size: 1.7rem; }
.login-form-card > .muted { margin-top: -.2em; }
.login-form-card .form { margin-top: 22px; }
.auth-hint { color: var(--muted); font-size: .85rem; margin: 18px 0 0; }
.auth-demo { color: var(--muted); font-size: .82rem; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }

/* ============ Дашборд ============ */
.dash-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.dash-count { text-align: right; }
.dash-count b { display: block; font-family: var(--serif); font-size: 2rem; color: var(--accent); line-height: 1; }
.dash-count span { font-size: .82rem; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 24px; grid-auto-rows: 1fr; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-soft); transition: transform .15s ease, box-shadow .15s ease; }
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(35,32,29,.11); }
/* карточка курса, вертикальная колонка на всю высоту ячейки ряда */
.course-card { display: flex; flex-direction: column; height: 100%; }
.card-thumb { height: 148px; flex: none; display: grid; place-items: center; }
.card-thumb span { font-family: var(--serif); font-size: 3rem; color: #fff; opacity: .92; }
.card-thumb-img { padding: 0; background: #efece7; }
.card-thumb-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Обложка-фон карточки (обложка направления или своя обложка курса) */
.card-cover { padding: 0; background-color: #3a1416; background-size: cover; background-position: center; background-repeat: no-repeat; }
.thumb-0 { background: linear-gradient(135deg, #e2564f, #cf3f39); }
.thumb-1 { background: linear-gradient(135deg, #7c9a8e, #5f8071); }
.thumb-2 { background: linear-gradient(135deg, #8f8bc0, #6f6aa8); }
.thumb-3 { background: linear-gradient(135deg, #d99a5e, #c07f3e); }
.thumb-4 { background: linear-gradient(135deg, #b7a06a, #9c8449); }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
/* область названия ровно в 2 строки с чистым многоточием, без просвечивания 3-й строки */
.card-body h2 {
  font-size: 1.12rem;
  line-height: 1.3;
  height: 2.6em;            /* ровно 2 строки: 2 * line-height */
  margin: 0 0 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;  /* очень длинные слова тоже переносятся и не ломают обрезку */
}
/* блок прогресса прижат к низу карточки, у всех на одной линии */
.course-card .progress { margin-top: auto; }

/* Progress */
.progress { margin-top: 14px; }
.progress-bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-bar.big { height: 10px; }
.progress-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.progress-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: .85rem; }

.back { display: inline-block; color: var(--muted); font-size: .9rem; margin-bottom: 20px; }
.back:hover { color: var(--accent); }

/* ============ Курс: hero-баннер ============ */
.course-hero { position: relative; margin: 4px 0 26px; min-height: 260px; border-radius: var(--radius); overflow: hidden; background-color: #3a1416; background-size: cover; background-position: center; box-shadow: var(--shadow-soft); display: flex; align-items: flex-end; }
.course-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(30,10,12,.82), rgba(30,10,12,.30) 55%, rgba(30,10,12,0)); }
.course-hero-inner { position: relative; z-index: 1; padding: 30px 34px; max-width: 760px; }
.course-hero-inner h1 { margin: 0; color: #fff; font-size: clamp(1.7rem, 3.4vw, 2.35rem); line-height: 1.15; text-shadow: 0 2px 14px rgba(0,0,0,.45); }
.course-hero-inner p { margin: 10px 0 0; color: rgba(255,255,255,.92); font-size: 1.02rem; text-shadow: 0 1px 8px rgba(0,0,0,.4); }

/* ============ Курс: две колонки ============ */
.course-layout { display: grid; grid-template-columns: 340px 1fr; gap: 34px; align-items: start; }
.course-aside { position: sticky; top: 90px; }
.course-aside-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-soft); }
.aside-cover { height: 180px; border-radius: 12px; overflow: hidden; display: grid; place-items: center; margin-bottom: 16px; }
.aside-cover img { width: 100%; height: 100%; object-fit: cover; }
.aside-cover span { font-family: var(--serif); font-size: 3rem; color: #fff; }
.course-aside-card h1 { font-size: 1.5rem; }
.course-aside-card .progress-bar { margin-top: 8px; }
.course-aside-meta { margin: 8px 0 16px; }

.course-content { min-width: 0; }
.block { margin-bottom: 26px; }
.block-title { font-family: var(--font); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: .78rem; color: var(--muted); margin-bottom: 11px; }
.lessons { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-soft); }
.lesson-row + .lesson-row { border-top: 1px solid var(--line); }
.lesson-row a { display: flex; align-items: center; gap: 14px; padding: 15px 20px; }
.lesson-row a:hover { background: #fbfaf8; }
.lesson-check { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: .8rem; color: var(--done); }
.lesson-row.is-done .lesson-check { background: var(--done-soft); border-color: #cfe6d4; }
.lesson-name { flex: 1; }
.lesson-meta { display: flex; align-items: center; gap: 10px; flex: none; }
.tag { font-size: .72rem; padding: 3px 9px; border-radius: 999px; font-weight: 700; letter-spacing: .02em; }
.tag-video { background: var(--accent-soft); color: var(--accent-ink); }
.tag-soon { background: #eeece7; color: var(--muted); }
.tag-admin { background: var(--accent-soft); color: var(--accent-ink); }

/* ============ Урок: две колонки ============ */
.lesson-layout { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 34px; align-items: start; }
.lesson-main { min-width: 0; }
.lesson-top { margin-bottom: 18px; }
.lesson-top h1 { font-size: 1.9rem; }
.player { background: #16130f; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 16 / 9; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.player-placeholder { height: 100%; display: grid; place-content: center; text-align: center; color: #e8e2d8; padding: 30px; }
.player-placeholder p { margin: 0; }
.player-placeholder .muted { color: #aaa196; }

.lesson-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 22px 0 28px; flex-wrap: wrap; }
.lesson-nav { display: flex; gap: 10px; }
/* Текст урока, перенесённый из XL. Типографика читаемая: узкая мера строки,
   свои отступы, картинки вписаны по ширине. */
.lesson-body { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 32px; margin-bottom: 26px; box-shadow: var(--shadow-soft); font-size: 1.02rem; line-height: 1.75; }
.lesson-body > :first-child { margin-top: 0; }
.lesson-body :last-child { margin-bottom: 0; }
.lesson-body p { margin: 0 0 1.05em; max-width: 68ch; }
.lesson-body h2, .lesson-body h3, .lesson-body h4 { font-family: var(--serif); color: var(--ink); line-height: 1.3; margin: 1.7em 0 .6em; }
.lesson-body h2 { font-size: 1.5rem; }
.lesson-body h3 { font-size: 1.22rem; }
.lesson-body h4 { font-size: 1.05rem; }
.lesson-body ul, .lesson-body ol { margin: 0 0 1.05em; padding-left: 1.3em; max-width: 68ch; }
.lesson-body li { margin-bottom: .4em; }
.lesson-body li::marker { color: var(--accent); }
.lesson-body a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; word-break: break-word; }
.lesson-body a:hover { color: var(--accent); }
.lesson-body b, .lesson-body strong { font-weight: 600; }
.lesson-body img { display: block; max-width: 100%; height: auto; border-radius: 12px; margin: 1.3em 0; }

/* Аудио из тела урока: стоит там же, где стояло в XL. Штатный плеер браузера,
   подкрашенный в фирменный красный (accent-color красит прогресс и громкость). */
.lesson-audio { display: block; width: 100%; max-width: 68ch; height: 44px; margin: 1.4em 0; accent-color: var(--accent); color-scheme: light; border-radius: 999px; background: #f1efea; }
.lesson-audio::-webkit-media-controls-panel { background: #f1efea; }
.lesson-audio:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Материалы урока: файлы отдаёт бэкенд по /lesson/:id/file/:fileId */
.lesson-materials { margin-bottom: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 26px; box-shadow: var(--shadow-soft); }
.lesson-materials h3 { color: var(--ink); margin: 0 0 16px; }
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.file-item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fcfbf9; transition: border-color .15s ease, background .15s ease; }
.file-item:hover { border-color: #ded9d0; background: var(--surface); }
.file-icon { flex: none; width: 40px; height: 48px; border-radius: 7px; display: grid; place-items: center; font-size: .6rem; font-weight: 700; letter-spacing: .04em; color: #fff; background: var(--muted); }
.file-icon.file-pdf { background: var(--accent); }
.file-icon.file-doc { background: #3a6ea5; }
.file-icon.file-ppt { background: var(--warm); }
.file-icon.file-xls { background: var(--done); }
.file-icon.file-img { background: #7a5ea5; }
.file-icon.file-txt { background: #6b6259; }
.file-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-name { font-weight: 500; word-break: break-word; }
.file-download { flex: none; padding: 8px 16px; font-size: .9rem; }

@media (max-width: 640px) {
  .lesson-body { padding: 22px 18px; }
  .lesson-materials { padding: 20px 18px; }
  .file-item { flex-wrap: wrap; }
  .file-download { width: 100%; text-align: center; }
}

/* Боковая навигация урока */
.lesson-aside { position: sticky; top: 90px; }
.lesson-aside-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-soft); max-height: calc(100vh - 120px); overflow: auto; }
.aside-course-link { display: block; font-weight: 600; margin-bottom: 12px; }
.aside-course-link:hover { color: var(--accent); }
.aside-lessons { margin-top: 8px; }
.aside-block { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin: 14px 0 6px; }
.aside-lesson { display: flex; gap: 9px; align-items: flex-start; padding: 7px 9px; border-radius: 9px; font-size: .9rem; }
.aside-lesson:hover { background: #fbfaf8; }
.aside-lesson.is-current { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.aside-check { flex: none; width: 16px; color: var(--done); font-size: .8rem; line-height: 1.5; }
.aside-lesson-name { flex: 1; }

/* ============ Комментарии ============ */
.comments { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 26px; box-shadow: var(--shadow-soft); }
.count-badge { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: .82rem; font-family: var(--font); vertical-align: middle; }
.comment-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; align-items: flex-start; }
.comment-form textarea { width: 100%; }
.comments-empty { padding: 8px 0; }
.comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.comment { display: flex; gap: 14px; }
.comment.is-reply { margin-left: 40px; }
.comment-avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-family: var(--serif); }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 3px; }
.comment-author { font-weight: 600; }
.comment-text { margin: 0; white-space: pre-wrap; word-wrap: break-word; }

/* ============ Отзывы ============ */
.reviews { margin-top: 30px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 26px; box-shadow: var(--shadow-soft); }
.reviews-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.reviews-head h3 { margin: 0; }
.reviews-rating { display: flex; align-items: center; gap: 8px; }
.reviews-rating b { font-size: 1.15rem; }
.stars { display: inline-flex; }
.stars .star { color: var(--line); font-size: 1.05rem; line-height: 1; }
.stars .star.on { color: var(--star); }

.review-form { background: #fcfbf9; border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 22px; }
.review-form-label { font-weight: 600; margin-bottom: 10px; }
.review-form textarea { margin: 12px 0; background: #fff; }
/* звёздный ввод: строка в обратном порядке для hover-эффекта */
.star-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; }
.star-input input { position: absolute; opacity: 0; width: 0; height: 0; }
.star-input label { font-size: 1.9rem; color: var(--line); cursor: pointer; padding: 0 2px; transition: color .1s; }
.star-input label:hover, .star-input label:hover ~ label,
.star-input input:checked ~ label { color: var(--star); }

.review-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.review { border-top: 1px solid var(--line); padding-top: 18px; }
.review:first-child { border-top: none; padding-top: 0; }
.review-top { display: flex; align-items: center; gap: 12px; }
.review-author { font-weight: 600; }
.review-top .stars { margin-top: 2px; }
.review-date { margin-left: auto; }
.review-text { margin: 10px 0 0; white-space: pre-wrap; }

a.header-user:hover { color: var(--accent); }

/* ============ Профиль ============ */
.notice { background: var(--done-soft); color: var(--done); border-radius: 12px; padding: 11px 15px; font-size: .9rem; margin-bottom: 16px; }
.profile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 26px; box-shadow: var(--shadow-soft); }
.panel h3 { margin-bottom: 18px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-row label { margin-bottom: 16px; }
.form input:disabled { background: #f2f0ec; color: var(--muted); cursor: not-allowed; }
.field-hint { margin: -6px 0 16px; }
@media (max-width: 780px) { .profile-grid { grid-template-columns: 1fr; } }

/* ============ Мой путь: карта маршрута ============ */
.path-head { margin-bottom: 22px; }

.path-summary { display: flex; align-items: center; gap: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px; box-shadow: var(--shadow-soft); margin-bottom: 40px; flex-wrap: wrap; }
.ring-big { position: relative; width: 118px; height: 118px; flex: none; }
.ring-big svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-big .ring-bg { fill: none; stroke: var(--line); stroke-width: 10; }
.ring-big .ring-fg { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .4s ease; }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-label b { font-family: var(--serif); font-size: 1.7rem; line-height: 1; }
.ring-label span { font-size: .74rem; color: var(--muted); }
.summary-stats { list-style: none; margin: 0; padding: 0; display: flex; gap: 26px; flex-wrap: wrap; }
.summary-stats li { display: flex; flex-direction: column; }
.summary-stats b { font-family: var(--serif); font-size: 1.8rem; color: var(--accent); line-height: 1; }
.summary-stats span { font-size: .82rem; color: var(--muted); margin-top: 3px; }
.summary-stats .stat-locked b { color: var(--muted); }

/* Ветка направления */
.path-branch { --dir: var(--accent); margin-bottom: 26px; }
.dir-target-vk    { --dir: #d83a34; }
.dir-context      { --dir: #b5472e; }
.dir-telegram     { --dir: #e0762e; }
.dir-neuro        { --dir: #c99a2e; }
.dir-design       { --dir: #5f8071; }
.dir-copywriting  { --dir: #7f8c4a; }
.dir-marketplaces { --dir: #b8794a; }
.dir-markirovka   { --dir: #6a7bad; }
.dir-clients      { --dir: #c05a86; }
.dir-money        { --dir: #a8673d; }
.dir-base         { --dir: #9a6a52; }

.branch-head { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; border-radius: 12px; padding: 4px; transition: background .14s ease; }
a.branch-head:hover { background: color-mix(in srgb, var(--dir) 8%, transparent); }
.branch-go { margin-left: auto; color: var(--dir); font-weight: 600; font-size: .9rem; opacity: 0; transition: opacity .14s ease; }
a.branch-head:hover .branch-go { opacity: 1; }
.branch-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: color-mix(in srgb, var(--dir) 14%, #fff); color: var(--dir); }
.branch-icon svg { width: 22px; height: 22px; }
.branch-head h2 { margin: 0; font-size: 1.3rem; }
.branch-count { background: color-mix(in srgb, var(--dir) 14%, #fff); color: var(--dir); border-radius: 999px; padding: 2px 10px; font-weight: 700; }

/* Змеевидная тропа */
.path-track { list-style: none; margin: 0; padding: 8px 0 18px; position: relative; }
.path-track::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 4px; transform: translateX(-50%);
  background: repeating-linear-gradient(to bottom, var(--dir) 0 11px, transparent 11px 22px);
  opacity: .45; border-radius: 4px;
}
.station { position: relative; width: 50%; box-sizing: border-box; margin: 8px 0; }
.station:nth-child(odd)  { left: 0;   padding-right: 52px; }
.station:nth-child(even) { left: 50%; padding-left: 52px; }
/* короткий соединитель от карточки к тропе */
.station::after { content: ""; position: absolute; top: 50%; width: 40px; height: 3px; background: var(--dir); opacity: .4; }
.station:nth-child(odd)::after  { right: 12px; }
.station:nth-child(even)::after { left: 12px; }

.station-card { position: relative; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow-soft); transition: transform .14s ease, box-shadow .14s ease; }
a.station-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(35,32,29,.11); }
/* отступ со стороны медальона, чтобы текст не заходил под него */
.station:nth-child(odd)  .station-card { text-align: right; padding-right: 46px; }
.station:nth-child(even) .station-card { padding-left: 46px; }

/* Медальон на тропе */
.medallion { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; background: var(--dir); color: #fff; box-shadow: 0 4px 14px rgba(35,32,29,.18), 0 0 0 5px var(--bg); }
.station:nth-child(odd)  .medallion { right: -33px; }
.station:nth-child(even) .medallion { left: -33px; }
.medallion .m-icon { display: grid; place-items: center; }
.medallion .m-icon svg { width: 30px; height: 30px; }
.medallion .m-ring { position: absolute; inset: -3px; width: calc(100% + 6px); height: calc(100% + 6px); transform: rotate(-90deg); }
.m-ring .mr-bg { fill: none; stroke: rgba(255,255,255,.35); stroke-width: 4; }
.m-ring .mr-fg { fill: none; stroke: var(--star); stroke-width: 4; stroke-linecap: round; }
.m-badge { position: absolute; right: -4px; bottom: -4px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .95rem; background: var(--star); color: #fff; box-shadow: 0 0 0 3px var(--bg); }

.station-body { min-width: 0; }
.station-status { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--dir); }
.station-title { margin: 3px 0 6px; font-weight: 600; font-size: 1.02rem; line-height: 1.3; }
.station-meta { font-size: .86rem; color: var(--muted); }
.station-meta.done { color: var(--done); font-weight: 600; }

/* Флажок «ты здесь» */
.here-flag { position: absolute; top: -12px; left: 16px; background: var(--accent); color: #fff; font-size: .74rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; box-shadow: var(--shadow-soft); }
.station:nth-child(odd) .here-flag { left: auto; right: 16px; }
.station.is-current .station-card { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-soft); }

/* Пройдено / закрыто */
.st-done .station-card { background: color-mix(in srgb, var(--dir) 6%, #fff); }
.st-locked .medallion { background: #bcb6ab; box-shadow: 0 4px 12px rgba(35,32,29,.12), 0 0 0 5px var(--bg); }
.st-locked .station-card { background: #f4f2ee; border-style: dashed; cursor: default; }
.st-locked .station-status, .st-locked .station-title { color: var(--muted); }
.station-unlock { display: inline-block; margin-top: 4px; font-size: .82rem; color: var(--muted); }

@media (max-width: 760px) {
  .path-track::before { left: 33px; }
  .station { width: 100%; left: 0 !important; padding: 0 0 0 84px !important; margin: 14px 0; }
  .station .station-card { text-align: left !important; }
  .station .medallion { left: 0 !important; right: auto !important; }
  .station::after { left: 66px !important; right: auto !important; width: 18px; }
  .station .here-flag { left: 16px !important; right: auto !important; }
}

/* Каталог под картой пути */
.catalog-all { margin-top: 46px; }
.catalog-head { margin-bottom: 20px; }
.card-badge { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .02em; padding: 3px 9px; border-radius: 999px; margin-bottom: 8px; }
.badge-open { background: var(--done-soft); color: var(--done); }
.badge-locked { background: #eeeae4; color: var(--muted); }
.card-locked { opacity: .96; }
.card-locked .card-thumb { filter: grayscale(.5) opacity(.85); }
.card-locked .card-body h2 { color: var(--muted); }

/* Страница раздела направления */
.dir-hero { --dir: var(--accent); display: flex; align-items: center; gap: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px; box-shadow: var(--shadow-soft); margin-bottom: 28px; }
.dir-hero.dir-target-vk { --dir: #d83a34; } .dir-hero.dir-context { --dir: #b5472e; } .dir-hero.dir-telegram { --dir: #e0762e; }
.dir-hero.dir-neuro { --dir: #c99a2e; } .dir-hero.dir-design { --dir: #5f8071; } .dir-hero.dir-copywriting { --dir: #7f8c4a; }
.dir-hero.dir-marketplaces { --dir: #b8794a; } .dir-hero.dir-markirovka { --dir: #6a7bad; } .dir-hero.dir-clients { --dir: #c05a86; }
.dir-hero.dir-money { --dir: #a8673d; } .dir-hero.dir-base { --dir: #9a6a52; }
.dir-hero-icon { width: 56px; height: 56px; flex: none; display: grid; place-items: center; border-radius: 16px; background: color-mix(in srgb, var(--dir) 14%, #fff); color: var(--dir); }
.dir-hero-icon svg { width: 30px; height: 30px; }
.dir-hero h1 { margin: 0 0 .15em; }
.dir-hero-count { margin-left: auto; font-family: var(--serif); font-size: 2rem; color: var(--dir); }

.dir-list { display: flex; flex-direction: column; gap: 18px; }
.dir-course { --dir: var(--accent); display: grid; grid-template-columns: 200px 1fr; gap: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-soft); }
.dir-course.dir-target-vk { --dir: #d83a34; } .dir-course.dir-context { --dir: #b5472e; } .dir-course.dir-telegram { --dir: #e0762e; }
.dir-course.dir-neuro { --dir: #c99a2e; } .dir-course.dir-design { --dir: #5f8071; } .dir-course.dir-copywriting { --dir: #7f8c4a; }
.dir-course.dir-marketplaces { --dir: #b8794a; } .dir-course.dir-markirovka { --dir: #6a7bad; } .dir-course.dir-clients { --dir: #c05a86; }
.dir-course.dir-money { --dir: #a8673d; } .dir-course.dir-base { --dir: #9a6a52; }
.dir-course-cover { position: relative; min-height: 150px; }
.dir-course-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-fallback { width: 100%; height: 100%; min-height: 150px; display: grid; place-items: center; }
.cover-fallback span { font-family: var(--serif); font-size: 3rem; color: #fff; }
.cover-lock { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2rem; background: rgba(40,34,26,.35); }
.dir-course.is-locked .dir-course-cover { filter: grayscale(.6); }
.dir-course-main { padding: 18px 22px 18px 0; display: flex; flex-direction: column; }
.dir-course-main h3 { margin: 4px 0 6px; }
.dir-course-desc { font-size: .92rem; margin: 0 0 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dir-course-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.dir-course-progress { flex: 1; min-width: 160px; }
.dir-course-progress .progress-bar { margin-bottom: 5px; }

@media (max-width: 640px) {
  .dir-course { grid-template-columns: 1fr; }
  .dir-course-cover { height: 160px; }
  .dir-course-main { padding: 0 18px 18px; }
  .dir-course-foot { flex-direction: column; align-items: stretch; }
  .dir-course-foot .btn { width: 100%; }
}

/* Empty / 404 */
.empty { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 48px 30px; text-align: center; box-shadow: var(--shadow-soft); }
.empty .btn { margin-top: 14px; }

/* ============ Адаптив ============ */
@media (max-width: 980px) {
  .course-layout { grid-template-columns: 1fr; }
  .course-aside { position: static; }
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-aside { position: static; order: 2; }
  .lesson-aside-card { max-height: none; }
}
@media (max-width: 860px) {
  .login-split { grid-template-columns: 1fr; min-height: 0; }
  .login-brand-inner { padding: 44px 30px; max-width: none; }
  .login-hero h1 { font-size: 1.9rem; }
  .login-form-side { padding: 40px 30px 56px; }
  .login-form-card { max-width: 460px; margin: 0 auto; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 0 18px; }
  .header-inner { padding: 0 18px; }
  h1 { font-size: 1.6rem; }
  .lesson-top h1 { font-size: 1.5rem; }
  .brand-text { display: none; }
  .dash-hero { align-items: center; }
  .course-hero { min-height: 190px; margin-bottom: 20px; }
  .course-hero-inner { padding: 22px 20px; }
  .cards { grid-template-columns: 1fr; gap: 18px; }
  .lesson-actions { flex-direction: column; align-items: stretch; }
  .lesson-nav { justify-content: space-between; }
  .lesson-nav .btn { flex: 1; }
  .comment.is-reply { margin-left: 16px; }
  .login-hero h1 { font-size: 1.7rem; }
  .login-facts { gap: 10px; }
  .login-facts li { min-width: 0; flex: 1 1 100%; flex-direction: row; align-items: baseline; gap: 8px; padding: 12px 14px; }
  .login-facts b { font-size: 1.1rem; }
  .login-facts span { margin-top: 0; }
}

/* ============ Админка школы ============ */
/* Отдельная шапка и своя сетка: ученический интерфейс это не задевает. */
.admin-body { background: #f4f2ee; }
.admin-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.admin-header-inner { display: flex; align-items: center; gap: 30px; height: 62px; max-width: 1560px; margin: 0 auto; padding: 0 28px; }
.admin-header .brand-mark { background: #23201d; }
.admin-nav { display: flex; gap: 4px; font-size: .95rem; }
.admin-nav a { padding: 7px 14px; border-radius: 10px; color: var(--muted); }
.admin-nav a:hover { background: #f4f2ee; color: var(--ink); }
.admin-nav a.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.admin-nav-right { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: .9rem; }
.admin-exit { color: var(--muted); }
.admin-exit:hover { color: var(--accent); }

.admin-wrap { max-width: 1560px; margin: 0 auto; padding: 28px 28px 80px; }
.admin-head { margin-bottom: 22px; }
.admin-head h1 { margin-bottom: .15em; }
.admin-head p { margin: 0; }
.admin-head.row { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.head-actions { display: flex; align-items: center; gap: 10px; }
.mt12 { margin-top: 12px; }

/* Плитки обзора */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-soft); display: block; transition: transform .14s ease, box-shadow .14s ease; }
a.stat:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(35,32,29,.1); }
.stat b { display: block; font-family: var(--serif); font-size: 2.1rem; line-height: 1; color: var(--accent); }
.stat span { display: block; margin-top: 5px; font-size: .92rem; }
.stat i { display: block; margin-top: 4px; font-style: normal; }

.admin-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }
.admin-cols-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.admin-side { display: flex; flex-direction: column; gap: 20px; }

/* Таблицы */
.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-soft); }
.admin-table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fbfaf8; font-weight: 700; }
.admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tbody tr:last-child td, .admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: #fbfaf8; cursor: pointer; }
.admin-table td.num, .admin-table th.num { text-align: right; white-space: nowrap; }
.admin-table.compact { box-shadow: none; border-radius: 12px; }
.admin-table.compact td { padding: 9px 12px; font-size: .92rem; }
.admin-table.compact tbody tr:hover, .admin-table.compact tr:hover { background: transparent; cursor: default; }
.row-title { font-weight: 600; }
.row-title:hover { color: var(--accent); }
.row-cover { display: block; width: 56px; height: 38px; border-radius: 7px; background: #efece7 center/cover no-repeat; }
.clamp1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 3px 0 0; }

/* Поиск и фильтры */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.input {
  display: block; width: 100%; padding: 10px 13px; font: inherit; font-size: .95rem;
  border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink);
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filter-bar .input { width: auto; min-width: 260px; }
.filter-bar select.input { min-width: 220px; }
.input-sm { padding: 7px 11px; font-size: .9rem; border-radius: 9px; width: auto; }
.form select.input { margin-top: 6px; }

.btn-sm { padding: 9px 16px; font-size: .9rem; border-radius: 10px; }
.btn-xs { padding: 6px 11px; font-size: .82rem; border-radius: 9px; font-weight: 500; }
.btn-danger { background: var(--accent); color: #fff; }
.btn-danger:hover { background: var(--accent-hover); }
.danger-text { color: var(--accent-ink); }

.icon-btn { background: none; border: 1px solid var(--line); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; font-size: .85rem; line-height: 1; color: var(--muted); }
.icon-btn:hover { border-color: #d9d5cd; background: #fbfaf8; color: var(--ink); }
.icon-btn.danger:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn.is-off { background: var(--accent-soft); border-color: #f3d3d0; }
.row-actions { display: inline-flex; gap: 5px; align-items: center; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.mini-list li:last-child { border-bottom: none; }
.mini-list a:hover { color: var(--accent); }

/* Обложка курса */
.cover-edit { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.cover-preview { width: 168px; height: 112px; flex: none; border-radius: 12px; background: #efece7 center/cover no-repeat; border: 1px solid var(--line); }
.cover-edit-body { min-width: 0; }
.cover-edit-body p { margin: 0 0 6px; }
input[type=file] { font-size: .88rem; max-width: 100%; }

/* Блоки и уроки в редакторе курса */
.edit-block { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.edit-block.is-hidden { background: #faf8f5; border-style: dashed; }
.edit-block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: #fbfaf8; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.edit-block-head .input { min-width: 240px; }
.edit-lessons { list-style: none; margin: 0; padding: 0; }
.edit-lessons li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: .93rem; }
.edit-lessons li:last-child { border-bottom: none; }
.edit-lessons li.is-hidden { background: #faf8f5; }
.edit-lessons li.is-hidden .edit-lesson-name { color: var(--muted); text-decoration: line-through; }
.edit-lesson-name { flex: 1; min-width: 0; }
.edit-lesson-name:hover { color: var(--accent); }
.edit-lesson-tags { display: inline-flex; gap: 5px; flex: none; }
.empty-row { justify-content: center; }
.add-row { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.add-row p { margin: 6px 0 0; }
.add-row .input { min-width: 220px; }

.admin-files { list-style: none; margin: 0; padding: 0; }
.admin-files li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.admin-files li:last-child { border-bottom: none; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; line-height: 1.5; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; background: #f4f2ee; padding: 1px 5px; border-radius: 5px; }

.danger-zone { border-color: #f0d9d7; }
.danger-zone h3 { color: var(--accent-ink); }

/* Ученики */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: middle; }
.dot-ok { background: var(--done); }
.dot-wait { background: var(--star); }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 22px; }
.progress.mini { margin-top: 6px; max-width: 260px; }
.progress.mini .progress-bar { height: 6px; }
.link-box input { margin-top: 8px; font-size: .85rem; }
.link-box p { margin: 0; }

/* Модерация */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { padding: 10px 16px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.chip { padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .86rem; color: var(--muted); }
.chip:hover { border-color: #d9d5cd; color: var(--ink); }
.chip.is-active { background: var(--accent-soft); border-color: #f3d3d0; color: var(--accent-ink); font-weight: 600; }

.mod-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.mod-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow-soft); }
.mod-item.is-hidden { background: #faf8f5; border-style: dashed; }
.mod-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.mod-where { margin: 4px 0 0; }
.mod-where a:hover { color: var(--accent); }
.mod-text { margin: 8px 0 12px; white-space: pre-wrap; }
.mod-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mod-reply { display: none; margin-top: 12px; }
.mod-reply.open { display: block; }
.mod-reply textarea { width: 100%; margin-bottom: 10px; }
.stars { color: var(--star); letter-spacing: .06em; }

/* Установка пароля по ссылке от админа */
.setpass-card { max-width: 420px; margin: 40px auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 32px; box-shadow: var(--shadow-soft); }
.setpass-card h1 { font-size: 1.6rem; }

@media (max-width: 1180px) {
  .admin-cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .admin-header-inner { height: auto; padding: 12px 18px; flex-wrap: wrap; gap: 12px; }
  .admin-wrap { padding: 20px 18px 60px; }
  .admin-nav { flex-wrap: wrap; }
  .filter-bar .input { min-width: 0; flex: 1; }
  .cover-edit { flex-direction: column; }
}

/* Ссылка в админку из шапки ученика: видит её только админ. */
.header-admin { color: var(--accent); font-weight: 600; }

/* ============ Публичная витрина школы ============ */
/* Главная, страницы направлений и карточек курсов. Кабинет ученика эти
   стили не задевают: всё под .home-body или под своими классами. */

.home-body { background: var(--bg); }
.eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 10px;
}
.btn-sm { padding: 8px 16px; font-size: .9rem; }
.btn-lg { padding: 14px 28px; font-size: 1.02rem; }
.link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.header-nav-public a { color: var(--muted); }
.header-nav-public a:hover { color: var(--ink); }
.header-nav-public a.btn { color: #fff; }

/* Секции */
/* Фон секций чередуем явно, а не через nth-child: порядок блоков на главной
   ещё будет меняться (промо, отзывы), полосатость не должна от него зависеть. */
.home-section { padding: 76px 0; }
.home-author, .home-courses, .home-reviews { background: var(--surface); }
.home-directions, .home-how, .home-promo, .home-cta { background: var(--bg); }
.section-head {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px 60px; align-items: end; margin-bottom: 36px;
}
.section-head h2 { font-size: 2rem; margin: 0; }
.section-note { margin: 0; max-width: 46em; }

/* Герой */
.home-hero { background: linear-gradient(160deg, #2a0f10 0%, #55191a 46%, var(--accent) 130%); position: relative; overflow: hidden; }
.home-hero::after {
  content: ''; position: absolute; inset: auto -10% -55% 55%;
  height: 90%; border-radius: 50%; background: rgba(255,255,255,.06);
}
.home-hero-inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.15fr .85fr;
  gap: 56px; align-items: center; padding-top: 72px; padding-bottom: 72px;
}
.home-hero-text h1 { color: #fff; font-size: 3rem; line-height: 1.1; margin-bottom: .35em; }
.home-hero-lead { color: rgba(255,255,255,.9); font-size: 1.1rem; max-width: 32em; }
.home-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 30px 0 36px; }
.home-hero-actions .btn-ghost { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.35); color: #fff; }
.home-hero-actions .btn-ghost:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.5); }
.home-facts { list-style: none; margin: 0; padding: 0; display: flex; gap: 14px; flex-wrap: wrap; }
.home-facts li {
  flex: 1 1 150px; display: flex; flex-direction: column;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px; padding: 15px 17px; color: #fff;
}
.home-facts b { font-size: 1.35rem; font-family: var(--serif); }
.home-facts span { font-size: .84rem; color: rgba(255,255,255,.85); margin-top: 2px; }

.home-hero-portrait { position: relative; }
.home-hero-portrait .portrait-frame { width: 100%; max-width: 420px; height: 460px; margin-left: auto; }
.portrait-badge {
  position: absolute; right: 16px; bottom: -20px;
  background: var(--surface); border-radius: 14px; padding: 13px 18px;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.portrait-badge b { font-family: var(--serif); font-size: 1.15rem; }
.portrait-badge span { font-size: .8rem; color: var(--muted); }

/* Кто автор */
.home-author-inner { display: grid; grid-template-columns: .85fr 1.15fr; gap: 56px; align-items: start; }
.author-photo { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #efece7; }
.author-photo img { width: 100%; height: 100%; max-height: 480px; object-fit: cover; display: block; }
.author-regalia { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.author-regalia li {
  position: relative; padding-left: 26px; font-size: .95rem; color: var(--muted);
}
.author-regalia li::before {
  content: ''; position: absolute; left: 0; top: .5em;
  width: 12px; height: 12px; border-radius: 4px; background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.home-author-text h2 { font-size: 2.2rem; }
.home-author-text .lead { font-size: 1.15rem; color: var(--ink); }
.author-quote {
  margin: 26px 0; padding: 18px 24px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 12px 12px 0;
  font-family: var(--serif); font-size: 1.08rem; font-style: italic; color: var(--accent-ink);
}
.author-links { display: flex; gap: 12px; flex-wrap: wrap; }

/* Направления */
.dir-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.dir-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-soft);
  transition: transform .15s ease, box-shadow .15s ease;
}
.dir-card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(35,32,29,.11); }
.dir-card-cover { height: 132px; position: relative; }
.dir-card-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(35,16,16,.05), rgba(35,16,16,.45)); }
.dir-card-icon {
  position: absolute; z-index: 1; left: 14px; bottom: 12px;
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: rgba(255,255,255,.92); color: var(--accent); box-shadow: var(--shadow-soft);
}
.dir-card-icon svg { width: 21px; height: 21px; }
.dir-card-body { padding: 16px 18px 18px; }
.dir-card-body h3 { font-size: 1.05rem; margin-bottom: .3em; }

/* Слот под продажи и рекламу */
.promo-card {
  display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center;
  background: linear-gradient(135deg, #2a0f10, #55191a);
  border-radius: 22px; padding: 40px 44px; color: #fff;
}
.promo-label {
  display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; background: rgba(255,255,255,.16);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 12px;
}
.promo-card h2 { color: #fff; margin-bottom: .3em; }
.promo-card p { color: rgba(255,255,255,.88); margin: 0; max-width: 44em; }
.promo-side { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.promo-note { font-size: .82rem; color: rgba(255,255,255,.75); text-align: center; }

/* Витрина курсов */
.filter-chips { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 28px; }
.chip {
  font: inherit; font-size: .87rem; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  padding: 8px 15px; border-radius: 999px; transition: all .12s ease;
}
.chip:hover { border-color: #d9d5cd; color: var(--ink); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.cards-4 { grid-template-columns: repeat(4, 1fr); }
.card-dir {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .03em;
  color: var(--accent-ink); background: var(--accent-soft);
  padding: 3px 9px; border-radius: 999px; margin-bottom: 9px; align-self: flex-start;
}
.course-card .card-body h2 { font-size: 1.02rem; }
.card-sub { margin-bottom: .6em; }
.card-foot { margin-top: auto; padding-top: 10px; }
.cards-empty { text-align: center; padding: 40px 0; }

/* Как проходит обучение */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 20px; counter-reset: step; }
.step {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px 22px; position: relative;
}
.step-num {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: var(--accent); color: #fff; font-family: var(--serif); font-size: 1.15rem;
  margin-bottom: 14px;
}
.step h3 { font-size: 1.05rem; margin-bottom: .35em; }
.step p { font-size: .92rem; color: var(--muted); margin: 0; }

/* Отзывы на главной */
.review-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.review-card {
  margin: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; gap: 14px;
}
.review-card blockquote { margin: 0; font-size: 1rem; line-height: 1.62; }
.review-card figcaption { display: flex; align-items: center; gap: 12px; margin-top: auto; }
.review-card figcaption > span:last-child { display: flex; flex-direction: column; line-height: 1.35; }

/* Финальный призыв */
.cta-card {
  display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 42px 46px; box-shadow: var(--shadow);
}
.cta-card h2 { font-size: 1.9rem; margin-bottom: .3em; }
.cta-card p { color: var(--muted); margin: 0; max-width: 40em; }
.cta-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Подвал */
.site-footer { background: #23201d; color: rgba(255,255,255,.72); padding: 56px 0 26px; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; }
.footer-brand p { margin: 16px 0 0; font-size: .92rem; max-width: 34em; }
.footer-col h4 { font-family: var(--serif); font-size: 1rem; color: #fff; margin: 0 0 14px; font-weight: 600; }
.footer-col a { display: block; font-size: .92rem; padding: 4px 0; color: rgba(255,255,255,.72); }
.footer-col a:hover { color: #fff; }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 44px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.12);
  font-size: .85rem;
}
.footer-socials { display: flex; gap: 8px; }
.footer-socials a {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(255,255,255,.1); color: #fff; font-size: .78rem; font-weight: 700;
}
.footer-socials a:hover { background: var(--accent); }

/* Витрина направления и курса */
.pub-hero {
  background-color: #3a1416; background-size: cover; background-position: center;
  position: relative;
}
.pub-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(120deg, rgba(30,12,12,.9) 30%, rgba(30,12,12,.6)); }
.pub-hero-inner { position: relative; z-index: 1; padding-top: 40px; padding-bottom: 48px; color: #fff; }
.pub-hero h1 { color: #fff; font-size: 2.4rem; max-width: 20em; }
.pub-hero p { color: rgba(255,255,255,.85); margin: 0; }
.pub-hero-meta { margin-top: 8px !important; font-size: .95rem; }
.back-light { color: rgba(255,255,255,.75); }
.back-light:hover { color: #fff; }
.pub-hero-icon {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px;
  background: rgba(255,255,255,.14); color: #fff; margin-bottom: 14px;
}
.pub-hero-icon svg { width: 24px; height: 24px; }

.pub-facts { list-style: none; margin: 18px 0; padding: 0; display: flex; flex-direction: column; gap: 1px; background: var(--line); border-radius: 12px; overflow: hidden; }
.pub-facts li { display: flex; align-items: baseline; gap: 8px; background: var(--surface); padding: 11px 14px; }
.pub-facts b { font-family: var(--serif); font-size: 1.15rem; }
.pub-facts span { font-size: .87rem; color: var(--muted); }
.pub-aside-note { text-align: center; margin: 10px 0 0; }
.pub-login-btn { margin-top: 9px; }
.pub-program-head { margin-bottom: 22px; }
.pub-program-head h2 { margin-bottom: .2em; }
.pub-program-head p { margin: 0; }
/* Уроки на витрине: не ссылки, кликать нечего, контента за ними нет. */
.lessons-static .lesson-row.is-preview { display: flex; align-items: center; gap: 14px; padding: 15px 20px; }
.lessons-static .lesson-name { color: var(--ink); }
.lessons-static .lesson-meta { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* 404 */
.notfound {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 64px 30px 56px; text-align: center; box-shadow: var(--shadow-soft);
  max-width: 720px; margin: 40px auto;
}
.notfound-code {
  display: block; font-family: var(--serif); font-size: 4.6rem; line-height: 1;
  color: var(--accent); opacity: .22; margin-bottom: 10px;
}
.notfound h1 { font-size: 1.9rem; }
.notfound > .muted { max-width: 34em; margin: 0 auto 26px; }
.notfound-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.notfound-help { margin: 24px 0 0; }

/* Адаптив витрины */
@media (max-width: 1100px) {
  .dir-grid { grid-template-columns: repeat(3, 1fr); }
  .cards-4 { grid-template-columns: repeat(3, 1fr); }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .home-hero-text h1 { font-size: 2.5rem; }
}
@media (max-width: 900px) {
  .home-section { padding: 56px 0; }
  .home-hero-inner { grid-template-columns: 1fr; gap: 40px; padding-top: 48px; padding-bottom: 56px; }
  .home-hero-portrait { order: -1; }
  .home-hero-portrait .portrait-frame { max-width: 340px; height: 380px; margin: 0 auto; }
  .portrait-badge { right: auto; left: 50%; transform: translateX(120px); bottom: -14px; }
  .home-author-inner { grid-template-columns: 1fr; gap: 34px; }
  .author-photo img { max-height: 380px; }
  .section-head { grid-template-columns: 1fr; gap: 12px; align-items: start; }
  .review-grid { grid-template-columns: repeat(2, 1fr); }
  .cards-3 { grid-template-columns: repeat(2, 1fr); }
  .cards-4 { grid-template-columns: repeat(2, 1fr); }
  .dir-grid { grid-template-columns: repeat(2, 1fr); }
  .promo-card, .cta-card { grid-template-columns: 1fr; padding: 32px 28px; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 30px; }
  .header-nav-public a:not(.btn) { display: none; }
}
@media (max-width: 640px) {
  .home-hero-text h1 { font-size: 1.95rem; }
  .home-hero-lead { font-size: 1rem; }
  .home-hero-actions { margin: 24px 0 28px; }
  .home-hero-actions .btn { flex: 1 1 100%; text-align: center; }
  .home-facts li { flex: 1 1 100%; flex-direction: row; align-items: baseline; gap: 8px; padding: 12px 14px; }
  .home-facts b { font-size: 1.1rem; }
  .home-facts span { margin-top: 0; }
  .home-hero-portrait .portrait-frame { max-width: 100%; height: 320px; }
  .portrait-badge { transform: none; left: auto; right: 14px; }
  .section-head h2, .home-author-text h2, .cta-card h2 { font-size: 1.6rem; }
  /* Фото Екатерины уже показано в герое, на узком экране второй такой же
     портрет идёт сразу следом и выглядит как дубль. Оставляем регалии. */
  .author-photo { display: none; }
  .author-regalia { margin-top: 0; }
  .dir-grid, .cards-3, .cards-4, .steps, .review-grid { grid-template-columns: 1fr; }
  .pub-hero h1 { font-size: 1.7rem; }
  .footer-inner { grid-template-columns: 1fr; gap: 26px; }
  .footer-bottom { justify-content: center; text-align: center; }
  .notfound { padding: 44px 22px 40px; }
  .notfound-actions .btn { flex: 1 1 100%; text-align: center; }
  .cta-actions .btn { flex: 1 1 100%; text-align: center; }
}

/* --- Галочка «Показывать на витрине» в редакторе курса --- */
.check-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; cursor: pointer; }
.check-row input[type="checkbox"] { flex: none; width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.check-row span { display: block; font-size: .9rem; color: var(--ink); }
.check-row span .small { display: block; font-weight: 400; margin-top: 3px; }

/* --- Визуальный редактор текста урока --- */
.wysiwyg { margin-bottom: 8px; }
.wysiwyg-label { font-size: .9rem; color: var(--muted); margin-bottom: 6px; }
.wysiwyg-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 8px; background: #fcfbf9; border: 1px solid var(--line);
  border-radius: 12px 12px 0 0; border-bottom: none;
}
.wtool {
  min-width: 34px; height: 32px; padding: 0 8px; border: 1px solid var(--line);
  background: var(--surface); border-radius: 8px; color: var(--ink); font: inherit;
  font-size: .9rem; cursor: pointer; line-height: 1; display: inline-flex;
  align-items: center; justify-content: center; transition: background .12s, border-color .12s;
}
.wtool:hover { border-color: var(--accent); color: var(--accent); }
.wtool.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.wsep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.wysiwyg-area {
  min-height: 320px; max-height: 640px; overflow-y: auto; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: 0 0 12px 12px; background: #fff;
  color: var(--ink); line-height: 1.6; font-size: .96rem;
}
.wysiwyg-area:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wysiwyg-area h2 { font-size: 1.3rem; margin: 14px 0 8px; }
.wysiwyg-area h3 { font-size: 1.12rem; margin: 12px 0 6px; }
.wysiwyg-area p { margin: 0 0 10px; }
.wysiwyg-area ul, .wysiwyg-area ol { margin: 0 0 10px; padding-left: 22px; }
.wysiwyg-area img { max-width: 100%; height: auto; border-radius: 10px; margin: 6px 0; }
.wysiwyg-area a { color: var(--accent); }
.wysiwyg-area audio { width: 100%; margin: 8px 0; }
.wysiwyg-html { width: 100%; border-radius: 0 0 12px 12px; }

/* --- Загрузка видео файлом --- */
.video-upload { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.video-upload h4 { margin: 0 0 6px; font-size: 1rem; }
.video-status { margin: 8px 0; color: var(--accent-ink); }
