:root {
  color-scheme: light;
  --ink: #13213c;
  --ink-soft: #2d3b57;
  --muted: #55627a;
  --bg: #edf1f5;
  --surface: #ffffff;
  --line: #c9d3de;
  --bubble: #e3eaf2;
  --accent: #f2c230;
  --ok: #1f7a6e;
  --radius-lg: 22px;
  --radius-sm: 10px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
}

a { color: var(--ink); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 720px; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  font-weight: 600;
}
.top small { font-weight: 400; color: var(--muted); }

/* --- Hero ------------------------------------------------------------------ */

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: center;
  padding: 32px 0 72px;
}

h1 {
  font-size: clamp(34px, 5.2vw, 58px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  font-weight: 800;
  margin: 0 0 20px;
  max-width: 14ch;
}

.lead { font-size: 19px; color: var(--ink-soft); max-width: 34em; margin: 0 0 28px; }

.cta { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 26px;
  border-radius: 999px;
  font: 600 17px/1 var(--font);
  text-decoration: none;
  border: 2px solid var(--ink);
  cursor: pointer;
  text-align: center;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-soft); border-color: var(--ink-soft); }
.btn-secondary { background: transparent; color: var(--ink); }
.btn-secondary:hover { background: var(--surface); }

.note { color: var(--muted); font-size: 14px; margin: 14px 0 0; max-width: 34em; }

/* --- Демо-чат: главный визуальный элемент страницы ----------------------- */

.chat {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px 18px 18px;
  box-shadow: 0 30px 60px -30px rgba(19, 33, 60, 0.45);
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 14px;
  border-bottom: 1px solid var(--bg);
  margin-bottom: 14px;
}
.chat-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--ok); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.chat-head b { display: block; font-size: 15px; }
.chat-head span { display: block; font-size: 13px; color: var(--muted); }

.msg {
  width: fit-content;
  max-width: 82%;
  padding: 9px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.4;
  margin: 0 0 8px;
  opacity: 0;
  animation: pop 0.35s ease forwards;
}
.msg.bot { background: var(--bubble); border-bottom-left-radius: 4px; }
.msg.me { background: var(--ink); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.msg-keys { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 10px; opacity: 0; animation: pop 0.35s ease forwards; }
.msg-keys span {
  font-size: 13px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--line); color: var(--ink-soft);
}
.msg-keys span.picked { border-color: var(--ink); background: var(--ink); color: #fff; }
.msg.total { background: var(--accent); font-weight: 600; }
.msg.total small { display: block; font-weight: 400; margin-top: 4px; }

.chat > :nth-child(2) { animation-delay: 0.2s; }
.chat > :nth-child(3) { animation-delay: 0.7s; }
.chat > :nth-child(4) { animation-delay: 1.2s; }
.chat > :nth-child(5) { animation-delay: 1.5s; }
.chat > :nth-child(6) { animation-delay: 2.0s; }
.chat > :nth-child(7) { animation-delay: 2.5s; }
.chat > :nth-child(8) { animation-delay: 3.0s; }
.chat > :nth-child(9) { animation-delay: 3.6s; }

@keyframes pop {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .msg, .msg-keys { animation: none; opacity: 1; }
}

.chat-caption { color: var(--muted); font-size: 14px; margin: 12px 4px 0; }

/* --- Секции ---------------------------------------------------------------- */

section { padding: 56px 0; border-top: 1px solid var(--line); }

h2 {
  font-size: clamp(26px, 3.4vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 800;
  margin: 0 0 24px;
  max-width: 22ch;
}

h3 { font-size: 19px; margin: 0 0 6px; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; counter-reset: step; }
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step);
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid var(--ink); font-weight: 800; margin-bottom: 14px;
}
.steps p { margin: 0; color: var(--ink-soft); }
.steps .time { display: block; color: var(--muted); font-size: 14px; margin-bottom: 6px; }

/* Чек: что и сколько вы платите */
.receipt { max-width: 620px; }
.receipt-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 0;
}
.receipt-row .name { flex: 0 1 auto; }
.receipt-row .name small { display: block; color: var(--muted); font-size: 14px; }
.receipt-row .dots { flex: 1 1 auto; border-bottom: 2px dotted var(--line); transform: translateY(-5px); min-width: 24px; }
.receipt-row .sum { flex: 0 0 auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.receipt-total { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 16px; font-size: 22px; font-weight: 800; }
.receipt-total .sum { background: var(--accent); padding: 2px 10px; border-radius: 6px; }
.receipt-foot { color: var(--muted); font-size: 15px; margin: 18px 0 0; }

.plain-list { margin: 0; padding-left: 1.2em; max-width: 40em; }
.plain-list li { margin-bottom: 10px; }

.author { max-width: 40em; }
.author p { margin: 0 0 12px; }

details { border-bottom: 1px solid var(--line); max-width: 720px; }
details:first-of-type { border-top: 1px solid var(--line); }
summary { cursor: pointer; padding: 18px 0; font-weight: 600; list-style: none; position: relative; padding-right: 32px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; position: absolute; right: 4px; top: 14px; font-size: 24px; font-weight: 400; }
details[open] summary::after { content: "−"; }
details p { margin: 0 0 18px; color: var(--ink-soft); }

.final { text-align: left; }

footer { padding: 40px 0 56px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
footer p { margin: 0 0 6px; }
footer a { color: var(--muted); margin-right: 16px; }

/* --- Страница практикума -------------------------------------------------- */

.doc { background: var(--surface); border-radius: var(--radius-lg); padding: 40px 48px; margin: 8px 0 40px; }
.doc h1 { font-size: clamp(30px, 4.4vw, 44px); max-width: none; }
.doc h2 { font-size: 26px; margin-top: 48px; max-width: none; }
.doc h3 { margin-top: 28px; }
.doc p, .doc li { max-width: 40em; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.doc blockquote { margin: 20px 0; padding: 14px 18px; background: var(--bg); border-radius: var(--radius-sm); color: var(--ink-soft); }
.doc blockquote p { margin: 0; }
.doc pre {
  background: var(--ink); color: #f1f4f8; padding: 18px 20px; border-radius: var(--radius-sm);
  overflow-x: auto; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.doc code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.92em; }
.doc :not(pre) > code { background: var(--bg); padding: 1px 6px; border-radius: 5px; }
.doc img { max-width: 100%; height: auto; display: block; margin: 18px 0; border: 1px solid var(--line); border-radius: 10px; }
.doc table { border-collapse: collapse; width: 100%; font-size: 15px; display: block; overflow-x: auto; }
.doc th, .doc td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--bg); }

.doc-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.doc-tools .btn { min-height: 40px; padding: 0 16px; font-size: 15px; width: auto; border-width: 1.5px; }

/* Рабочая страница практикума: шапка с прогрессом, оглавление, шаги */

.guide { padding-bottom: 24px; }

.guide-hero { padding: 16px 0 32px; max-width: 780px; }
.guide-eyebrow {
  display: inline-block; margin: 0 0 16px; padding: 4px 12px; border-radius: 999px;
  background: var(--accent); font-size: 14px; font-weight: 600;
}
.guide-hero h1 { max-width: 20ch; margin-bottom: 14px; }
.guide-sub { font-size: 19px; color: var(--ink-soft); margin: 0 0 24px; max-width: 34em; }

.progress { margin: 0 0 22px; max-width: 520px; }
.progress-track { height: 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.progress-fill { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 999px; transition: width 0.35s ease; }
.progress-text { margin: 8px 0 0; font-size: 15px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.guide-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.guide-actions .btn { min-height: 46px; padding: 0 20px; font-size: 16px; border-width: 1.5px; }
.guide-note { margin: 14px 0 0; font-size: 14px; color: var(--muted); }

.guide-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }

.guide-nav { position: sticky; top: 16px; }
.guide-nav .nav-box { border: 0; max-width: none; }
.nav-box > summary { display: none; }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: flex; gap: 10px; align-items: flex-start; padding: 7px 10px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--ink-soft); font-size: 15px; line-height: 1.35;
}
.nav-list a:hover { background: var(--surface); }
.nav-list a.is-current { background: var(--surface); color: var(--ink); font-weight: 600; }
.nav-title small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }
.nav-mark {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--ink);
  display: grid; place-items: center; font-size: 12px; font-weight: 800; margin-top: 2px; background: var(--bg);
}
.nav-dot { flex: 0 0 auto; width: 24px; height: 24px; position: relative; margin-top: 2px; }
.nav-dot::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--line); }
.nav-list a.is-done .nav-mark { background: var(--ok); border-color: var(--ok); color: transparent; position: relative; }
.nav-list a.is-done .nav-mark::after {
  content: ""; position: absolute; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.guide-doc { margin-top: 0; padding-top: 32px; }
.guide-author { color: var(--ink-soft); font-size: 15px; margin: 0 0 8px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }

.guide-section { padding: 8px 0 32px; border-bottom: 1px solid var(--line); scroll-margin-top: 16px; }
.guide-section:last-of-type { border-bottom: 0; }
.guide-doc .guide-section h2 { display: flex; gap: 12px; align-items: flex-start; margin-top: 32px; }
.step-badge {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-size: 18px; font-weight: 800; margin-top: -3px;
}
.guide-section.is-done .step-badge { background: var(--ok); }

.step-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-top: 24px; }
.step-done {
  display: inline-flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 18px 0 14px;
  border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  font: 600 16px/1 var(--font); cursor: pointer;
}
.step-done:hover { background: var(--bg); }
.step-done-box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--ink); position: relative; flex: 0 0 auto; }
.step-done[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.step-done[aria-pressed="true"] .step-done-box { border-color: #fff; }
.step-done[aria-pressed="true"] .step-done-box::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.step-next { font-weight: 600; text-decoration: none; }
.step-next:hover { text-decoration: underline; }

.code-wrap { position: relative; }
.code-wrap pre { padding-top: 44px; }
.copy-btn {
  position: absolute; top: 8px; right: 8px; min-height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.08); color: #fff;
  font: 600 13px/1 var(--font); cursor: pointer;
}
.copy-btn:hover { background: rgba(255, 255, 255, 0.18); }
.copy-btn.is-copied { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.doc pre mark.ph { background: var(--accent); color: var(--ink); border-radius: 4px; padding: 0 3px; }

.doc li.task { list-style: none; margin-left: -1.2em; }
.task label { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 4px 0; }
.task input { width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--ok); flex: 0 0 auto; cursor: pointer; }
.task input:checked + span { color: var(--muted); text-decoration: line-through; }

.help-card { margin-top: 32px; padding: 28px; border-radius: var(--radius-lg); background: var(--bg); }
.doc .help-card h2 { margin-top: 0; font-size: 24px; }
.help-card p { color: var(--ink-soft); }
.help-card .btn { min-height: 46px; font-size: 16px; }

@media (max-width: 900px) {
  .guide-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .guide-nav { position: sticky; top: 0; z-index: 5; margin: 0 -16px; padding: 8px 16px; background: var(--bg); }
  .guide-nav .nav-box { background: var(--surface); border-radius: var(--radius-sm); border: 1px solid var(--line); }
  .nav-box > summary { display: block; padding: 12px 40px 12px 14px; font-size: 16px; }
  .nav-box > summary::after { top: 6px; right: 12px; }
  .nav-list { padding: 0 6px 8px; max-height: 60vh; overflow-y: auto; }
  .guide-section { scroll-margin-top: 72px; }
}

@media (max-width: 560px) {
  .guide-actions .btn { width: 100%; }
  .guide-doc { padding-top: 22px; }
  .step-done { width: 100%; justify-content: center; }
  .help-card { padding: 22px 18px; }
}

.message-box { background: var(--surface); border-radius: var(--radius-lg); padding: 40px; margin: 40px 0 80px; }
.message-box h1 { font-size: 34px; max-width: none; }
.message-box p { max-width: 36em; color: var(--ink-soft); margin: 0 0 24px; }

.legal { padding: 8px 0 48px; }
.legal h1 { font-size: 34px; max-width: none; }
.legal h2 { font-size: 21px; margin-top: 32px; max-width: none; }
.legal p, .legal li { max-width: 44em; }

/* --- Страница курса -------------------------------------------------------- */

.section-lead { color: var(--ink-soft); max-width: 40em; margin: -8px 0 24px; }

.lead-card {
  background: var(--bubble);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 12px 14px;
  margin: 0 0 8px;
  max-width: 88%;
  font-size: 15px;
  opacity: 0;
  animation: pop 0.4s ease 0.3s forwards;
}
.chat-static .msg { opacity: 0; animation: pop 0.4s ease 1.3s forwards; }
.lead-title { font-weight: 800; margin: 0 0 8px; }
.lead-card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.lead-card dt { color: var(--muted); }
.lead-card dd { margin: 0; }
.lead-card dd:nth-of-type(2) { font-weight: 600; }
.lead-time { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .lead-card, .chat-static .msg { animation: none; opacity: 1; } }

.acceptance {
  list-style: none; padding: 0; margin: 0; counter-reset: acc;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px;
}
.acceptance li {
  counter-increment: acc; display: flex; gap: 14px; align-items: baseline;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.acceptance li::before {
  content: counter(acc); flex: 0 0 auto; width: 28px; height: 28px; border-radius: 6px;
  border: 2px solid var(--ink); display: grid; place-items: center;
  font-weight: 800; font-size: 14px; transform: translateY(6px);
}
.acceptance li:last-child::before { background: var(--accent); }

.modules { max-width: 760px; }
.module summary { display: flex; gap: 16px; align-items: center; padding: 16px 32px 16px 0; }
.module summary::after { top: 50%; transform: translateY(-55%); }
.module-n {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
  background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 800;
}
.module-head { display: flex; flex-direction: column; }
.module-name { font-size: 19px; font-weight: 800; }
.module-weeks { font-weight: 400; color: var(--muted); font-size: 14px; }
.module-result { margin: 0 0 12px 56px; color: var(--ink); }
.module-lessons { margin: 0 0 20px 56px; padding-left: 1.2em; color: var(--ink-soft); }
.module-lessons li { margin-bottom: 6px; }

.receipt-wide { max-width: 760px; }

@media (max-width: 860px) {
  .acceptance { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .module-result, .module-lessons { margin-left: 0; }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding-bottom: 56px; }
  .steps { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .btn { width: 100%; }
  .doc { padding: 24px 18px; border-radius: 16px; }
  .message-box { padding: 28px 20px; }
  section { padding: 44px 0; }
}

@media print {
  body { background: #fff; }
  .top, .doc-tools, footer, .guide-nav, .guide-actions, .guide-note, .progress,
  .step-foot, .copy-btn, .help-card .cta { display: none !important; }
  .guide-layout { display: block; }
  .code-wrap pre { padding-top: 18px; }
  .doc pre mark.ph { background: none; text-decoration: underline; }
  .doc { padding: 0; }
  .doc pre { background: #f3f5f8; color: #000; border: 1px solid #ccc; }
}
