@font-face { font-family: "Inter"; src: url("/fonts/Inter-Regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/Inter-Italic.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/Inter-Medium.woff") format("woff"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/Inter-SemiBold.woff") format("woff"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/Inter-Bold.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --ink: #172033;
  --text: #2a3346;
  --muted: #5d6778;
  --line: #dce1e8;
  --accent: #2347c5;
  --accent-ink: #1a3699;
  --accent-soft: #e8edfb;
  --done: #1e8a5a;
  --done-soft: #e3f3eb;
  --danger: #b42318;
  --sidebar-w: 320px;
  --radius-s: 6px;
  --radius-m: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  font-feature-settings: "kern", "calt";
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
button { font: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Кнопки и формы ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border: 1px solid var(--accent); border-radius: var(--radius-s);
  background: var(--accent); color: #fff; font-weight: 600; font-size: 16px;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-quiet { background: transparent; color: var(--accent); }
.btn-quiet:hover { background: var(--accent-soft); color: var(--accent-ink); }
.btn-done { background: var(--done-soft); border-color: var(--done); color: var(--done); }
.btn-done:hover { background: var(--done-soft); border-color: var(--done); color: #156b45; }
.btn-wide { width: 100%; }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.field input {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1px solid #c6cdd8; border-radius: var(--radius-s);
  font: inherit; font-size: 16px; color: var(--ink); background: #fff;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field small { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; margin: 4px 0 20px; color: var(--text); }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.form-error { color: var(--danger); font-size: 14px; margin: -4px 0 16px; }
.form-note { color: var(--muted); font-size: 14px; margin-top: 20px; }

/* ---------- Экран входа и заявки ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-intro { background: var(--ink); color: #dfe5f0; padding: 56px clamp(24px, 5vw, 72px); display: flex; flex-direction: column; justify-content: center; }
.auth-intro h1 { color: #fff; font-size: clamp(32px, 4vw, 46px); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 14px; font-weight: 700; }
.auth-intro .lead { font-size: 19px; line-height: 1.5; color: #c4cde0; margin: 0 0 36px; max-width: 34em; }
.plan { list-style: none; margin: 0; padding: 0; max-width: 520px; }
.plan li { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 12px 0; border-top: 1px solid #2c3750; }
.plan li:last-child { border-bottom: 1px solid #2c3750; }
.plan .name { color: #fff; font-size: 15px; font-weight: 500; }
.plan .count { color: #8f9ab0; font-size: 13px; font-variant-numeric: tabular-nums; }
.plan .strip { grid-column: 1 / -1; }
.auth-intro .format { margin-top: 28px; font-size: 15px; color: #a9b3c7; max-width: 32em; }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 28px; line-height: 1.2; letter-spacing: -0.01em; color: var(--ink); margin: 0 0 8px; }
.auth-card .sub { color: var(--muted); margin: 0 0 28px; font-size: 16px; }
.auth-card .switch { margin-top: 24px; font-size: 15px; color: var(--muted); }

/* «Флайтинг»: полоска из сегментов, один сегмент — один урок, как в медиаплане */
.strip { display: flex; gap: 3px; height: 8px; }
.strip i { flex: 1; border-radius: 2px; background: #d3d9e3; }
.auth-intro .strip i { background: #34405a; }
.strip i.done { background: var(--done); }
.strip i.current { background: var(--accent); }

/* ---------- Ожидание доступа ---------- */
.wait { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.wait-card { max-width: 520px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 40px; }
.wait-card h1 { font-size: 28px; line-height: 1.2; color: var(--ink); margin: 0 0 12px; }
.wait-card p { margin: 0 0 16px; }
.wait-card .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.wait-card .who { font-size: 14px; color: var(--muted); }

/* ---------- Курс: каркас ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 24px 18px 32px;
}
.side-head { padding: 0 6px 18px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.side-head a.home { display: block; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 18px; line-height: 1.25; letter-spacing: -0.01em; }
.side-head .total { margin-top: 10px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-head .bar { margin-top: 6px; height: 4px; background: #e6eaf0; border-radius: 2px; overflow: hidden; }
.side-head .bar span { display: block; height: 100%; background: var(--done); }

.module { border-bottom: 1px solid #edf0f4; }
.module-btn {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  padding: 14px 6px 12px; color: var(--ink); border-radius: var(--radius-s);
}
.module-btn:hover { background: #f6f8fb; }
.module-btn .m-num { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.module-btn .m-title { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; font-weight: 600; line-height: 1.3; margin: 2px 0 10px; }
.module-btn .chev { flex: none; color: var(--muted); transition: transform .15s ease; }
.module.open .chev { transform: rotate(90deg); }
.lessons { list-style: none; margin: 0 0 10px; padding: 0; display: none; }
.module.open .lessons { display: block; }
.lessons a {
  display: grid; grid-template-columns: 38px 1fr 16px; gap: 4px; align-items: start;
  padding: 7px 6px; border-radius: var(--radius-s);
  color: var(--text); text-decoration: none; font-size: 14px; line-height: 1.35;
}
.lessons a:hover { background: #f3f6fb; color: var(--ink); }
.lessons a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }
.lessons .l-num { color: var(--muted); font-variant-numeric: tabular-nums; }
.lessons a[aria-current="page"] .l-num { color: var(--accent); }
.lessons .tick { color: var(--done); font-weight: 700; text-align: right; }
.side-foot { margin-top: 20px; padding: 0 6px; font-size: 14px; }
.side-foot button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 0; text-decoration: underline; text-underline-offset: 2px; }

.topbar { display: none; }

/* ---------- Курс: контент ---------- */
.main { padding: 48px clamp(20px, 5vw, 72px) 96px; }
.reading { max-width: 700px; }
.crumb { font-size: 14px; color: var(--muted); margin: 0 0 18px; }
.lesson-head { margin-bottom: 36px; }
.lesson-num { font-size: 56px; line-height: 1; font-weight: 700; color: var(--accent); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin: 0 0 12px; }
.lesson-head h1 { font-size: clamp(28px, 3.4vw, 38px); line-height: 1.15; letter-spacing: -0.02em; color: var(--ink); margin: 0; font-weight: 700; }

.prose h2 { font-size: 23px; line-height: 1.25; letter-spacing: -0.01em; color: var(--ink); margin: 44px 0 14px; font-weight: 700; }
.prose h3 { font-size: 19px; line-height: 1.3; color: var(--ink); margin: 32px 0 10px; font-weight: 600; }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 18px; }
.prose li { margin-bottom: 8px; }
.prose li > p { margin-bottom: 8px; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose blockquote { margin: 20px 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--line); color: var(--text); }
.prose figure { margin: 24px 0; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius-s); border: 1px solid var(--line); display: block; }
.prose figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; }
.prose h2:first-child { margin-top: 0; }

/* «Ключевая мысль» — главное в уроке, поэтому выделена */
.prose h2.key { font-size: 15px; font-weight: 600; color: var(--accent-ink); margin: 0 0 8px; letter-spacing: 0; }
.prose .key-text { background: var(--accent-soft); border-radius: var(--radius-m); padding: 18px 22px; margin: 0 0 8px; color: var(--ink); font-size: 18px; line-height: 1.55; }
.prose .key-text p:last-child { margin-bottom: 0; }

.table-wrap { overflow-x: auto; margin: 20px 0 24px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.45; min-width: 520px; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.prose th { background: #f6f8fb; color: var(--ink); font-weight: 600; }
.prose tr:last-child td { border-bottom: 0; }
.prose td + td, .prose th + th { border-left: 1px solid var(--line); }

/* Упражнение: шаги, которые можно отмечать */
.prose ul.task-list { list-style: none; padding: 0; }
.prose ul.task-list li { margin: 0; }
.prose ul.task-list label {
  display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface);
  margin-bottom: 8px; cursor: pointer;
}
.prose ul.task-list .step { width: 20px; height: 20px; margin-top: 3px; border: 2px solid #aab3c2; border-radius: 50%; }
.prose ul.task-list li.checked label { border-color: #bfe2cf; background: var(--done-soft); }
.prose ul.task-list li.checked .step { border-color: var(--done); background: var(--done) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3 3 7-7' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat; }

.lesson-foot { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--line); }
.lesson-foot .mark { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 32px; }
.lesson-foot .mark p { margin: 0; color: var(--muted); font-size: 15px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pager a { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); text-decoration: none; color: var(--ink); line-height: 1.35; }
.pager a:hover { border-color: var(--accent); }
.pager a span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.pager a.next { text-align: right; grid-column: 2; }

/* ---------- Обзор курса ---------- */
.overview h1 { font-size: clamp(30px, 3.6vw, 40px); line-height: 1.12; letter-spacing: -0.02em; color: var(--ink); margin: 0 0 12px; }
.overview .lead { font-size: 18px; color: var(--muted); margin: 0 0 28px; }
.continue { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); margin-bottom: 40px; }
.continue .what { flex: 1 1 260px; }
.continue .what span { display: block; font-size: 14px; color: var(--muted); }
.continue .what strong { display: block; font-size: 18px; color: var(--ink); line-height: 1.35; margin-top: 2px; }
.mod-list { list-style: none; margin: 0; padding: 0; }
.mod-list li { padding: 18px 0; border-top: 1px solid var(--line); }
.mod-list a { text-decoration: none; color: var(--ink); font-weight: 600; font-size: 17px; }
.mod-list .meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.mod-list .meta span { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.loading { padding: 64px 24px; color: var(--muted); text-align: center; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--radius-s); font-size: 15px; z-index: 50; }

/* ---------- Телефон и планшет ---------- */
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth-intro { padding: 36px 20px 32px; }
  .auth-intro .lead { margin-bottom: 0; font-size: 17px; }
  .auth-intro .plan, .auth-intro .format { display: none; }
  .auth-panel { padding: 32px 20px 56px; align-items: flex-start; }
}
@media (max-width: 900px) {
  body { font-size: 16.5px; }
  .shell { display: block; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 10px 16px;
  }
  .topbar .t { font-weight: 600; color: var(--ink); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar button { flex: none; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-s); color: var(--ink); font-weight: 500; cursor: pointer; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(88vw, 360px); z-index: 40; transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
  .shell.menu-open .sidebar { transform: translateX(0); box-shadow: 0 0 0 100vmax rgba(23, 32, 51, .35); }
  .main { padding: 28px 16px 72px; }
  .lesson-num { font-size: 44px; }
  .pager { grid-template-columns: 1fr; }
  .pager a.next { grid-column: 1; }
  .wait-card { padding: 28px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
