:root {
  color-scheme: light;
  --bg: #f6f3ec;
  --text: #17191f;
  --muted: #626978;
  --soft: #858b98;
  --line: #ddd5c6;
  --paper: #fffdf8;
  --paper-soft: #fbf8f1;
  --blue: #245cff;
  --blue-soft: #edf2ff;
  --green: #0c7c59;
  --green-soft: #eaf7f1;
  --red: #b42318;
  --red-soft: #fff0ed;
  --shadow: 0 18px 44px rgba(42, 35, 24, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
}

.page {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0;
}

.hero {
  max-width: 760px;
  padding: 28px 0 36px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 16px;
  font-size: clamp(48px, 8vw, 92px);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 16px;
  font-size: 24px;
}

.lead {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 22px;
  max-width: 680px;
}

.routes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0 36px;
}

.route {
  min-height: 220px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  text-decoration: none;
}

.route:hover {
  border-color: var(--blue);
}

.route-accent:hover {
  border-color: var(--green);
}

.route-kicker {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.route strong {
  display: block;
  font-size: 34px;
  line-height: 1.05;
}

.route span:last-child {
  color: var(--muted);
  font-size: 17px;
}

.links,
.note {
  padding: 28px;
  border-top: 1px solid var(--line);
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.link-grid a {
  min-height: 72px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  display: flex;
  align-items: center;
  text-decoration: none;
  font-weight: 700;
}

.link-grid a:hover {
  border-color: var(--blue);
  background: var(--paper);
}

.note p {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
}

@media (max-width: 760px) {
  .page {
    width: min(100% - 24px, 1040px);
    padding: 28px 0;
  }

  .hero {
    padding-top: 12px;
  }

  .lead {
    font-size: 19px;
  }

  .routes,
  .link-grid {
    grid-template-columns: 1fr;
  }

  .route {
    min-height: 190px;
  }

  .route strong {
    font-size: 30px;
  }

  .links,
  .note {
    padding: 24px 0;
  }
}

.doc-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}

.doc-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 30px 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.86);
  overflow: auto;
}

.doc-brand {
  display: block;
  margin-bottom: 26px;
  text-decoration: none;
}

.doc-brand strong {
  display: block;
  font-size: 22px;
}

.doc-brand span {
  color: var(--muted);
  font-size: 14px;
}

.doc-nav-section {
  margin: 22px 0;
}

.doc-nav-section h2 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.doc-nav-section a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 16px;
}

.doc-nav-section a:hover,
.doc-nav-section a[aria-current="page"] {
  background: var(--paper);
  color: var(--blue);
}

.doc-nav-section a[data-done="true"]::after {
  content: "завершено";
  display: block;
  margin-top: 2px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.progress-section {
  margin-top: 0;
  margin-bottom: 26px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.progress-section h2 {
  margin-bottom: 10px;
}

.progress-section .continue-link {
  padding: 0;
  color: var(--blue);
  font-weight: 800;
}

.progress-section .continue-link:hover {
  background: transparent;
}

.progress-section p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.progress-meter {
  height: 8px;
  margin-top: 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  overflow: hidden;
}

.progress-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.doc-main {
  position: relative;
  z-index: 1;
  width: min(900px, calc(100% - 56px));
  padding: 64px 0 96px;
  margin: 0 auto;
}

.doc-main h1 {
  max-width: 820px;
  margin-bottom: 22px;
  font-size: clamp(40px, 5.2vw, 76px);
  line-height: 1.02;
  letter-spacing: 0;
}

.doc-main h2 {
  margin-top: 44px;
  margin-bottom: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 27px;
}

.doc-main p,
.doc-main li {
  color: var(--muted);
  font-size: 19px;
}

.doc-main p {
  max-width: 760px;
}

.doc-main a {
  color: var(--blue);
  font-weight: 700;
}

.doc-main code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--blue-soft);
  color: #4d5667;
}

.doc-main table {
  width: 100%;
  margin: 18px 0 32px;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  overflow: hidden;
  table-layout: fixed;
}

.doc-main th,
.doc-main td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.doc-main th {
  color: var(--text);
  font-size: 15px;
  text-transform: none;
  background: var(--paper-soft);
}

.doc-main td {
  color: var(--muted);
  font-size: 16px;
}

.doc-main th:last-child,
.doc-main td:last-child {
  border-right: 0;
}

.doc-main tbody tr:last-child td {
  border-bottom: 0;
}

.lesson-kicker {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 34px;
}

.lesson-meta span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.72);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.callout {
  margin: 24px 0 34px;
  padding: 22px 24px;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.callout p:last-child {
  margin-bottom: 0;
}

.soft-list {
  display: grid;
  gap: 10px;
  max-width: 760px;
  margin: 18px 0 30px;
  padding: 0;
  list-style: none;
}

.soft-list li {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.78);
}

.term-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 34px;
}

.doc-main .term-grid details {
  max-width: none;
  margin: 0;
}

.doc-main .term-grid p {
  margin: 12px 0 0;
  font-size: 17px;
}

.source-links {
  margin-bottom: 14px;
}

.lesson-road {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0 34px;
}

.lesson-road div,
.concept-card,
.number-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.lesson-road div {
  padding: 16px;
}

.lesson-road strong,
.concept-card strong,
.number-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 18px;
}

.lesson-road span,
.concept-card span,
.number-card span {
  color: var(--muted);
  font-size: 15px;
}

.concept-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0 34px;
}

.concept-card {
  padding: 20px;
}

.market-stack {
  display: grid;
  gap: 10px;
  max-width: 760px;
  margin: 20px 0 34px;
}

.market-layer {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.market-layer strong {
  color: var(--text);
}

.market-layer span {
  color: var(--muted);
}

.order-book-demo {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: stretch;
  max-width: 760px;
  margin: 20px 0 34px;
}

.book-side {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.book-side strong {
  display: block;
  margin-bottom: 12px;
  color: var(--text);
}

.book-side div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.spread-badge {
  display: grid;
  place-items: center;
  min-width: 110px;
  padding: 18px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 900;
  text-align: center;
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 34px;
}

.number-card {
  padding: 18px;
}

.number-card b {
  display: block;
  color: var(--blue);
  font-size: 28px;
  line-height: 1;
}

.bridge-note {
  max-width: 760px;
  margin: 28px 0 34px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--green-soft);
}

.bridge-note p {
  margin-bottom: 0;
}

.visual-panel {
  max-width: 760px;
  margin: 22px 0 34px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.visual-panel svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-axis {
  stroke: #9aa1ae;
  stroke-width: 2;
}

.chart-grid {
  stroke: #e7dfd1;
  stroke-width: 1;
}

.chart-profit {
  stroke: var(--green);
  stroke-width: 4;
  fill: none;
}

.chart-loss {
  stroke: var(--red);
  stroke-width: 4;
  fill: none;
}

.chart-line {
  stroke: var(--blue);
  stroke-width: 4;
  fill: none;
}

.chart-area {
  fill: rgba(36, 92, 255, 0.1);
}

.chart-label {
  fill: var(--muted);
  font: 700 14px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.chart-title {
  fill: var(--text);
  font: 900 18px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.scenario-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 34px;
}

.scenario-strip div {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.scenario-strip strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.scenario-strip span {
  color: var(--muted);
}

.formula-card {
  max-width: 760px;
  margin: 20px 0 34px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--blue-soft);
}

.formula-card p {
  margin-bottom: 8px;
}

.formula-card p:last-child {
  margin-bottom: 0;
}

.quiz {
  display: grid;
  gap: 16px;
  margin: 22px 0 34px;
}

.quiz-question {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.quiz-question p {
  margin-bottom: 12px;
  color: var(--text);
  font-weight: 800;
}

.quiz-question label {
  display: block;
  margin: 8px 0;
  color: var(--muted);
  font-size: 17px;
}

.quiz-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.quiz button {
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.quiz-result {
  min-height: 24px;
  color: var(--muted);
  font-weight: 800;
}

.quiz-question.correct {
  border-color: var(--green);
  background: var(--green-soft);
}

.quiz-question.incorrect {
  border-color: var(--red);
  background: var(--red-soft);
}

.home-main .lead {
  margin-bottom: 34px;
}

.next-step {
  margin: 28px 0 34px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.course-steps {
  display: grid;
  gap: 8px;
  max-width: 640px;
  margin: 18px 0 22px;
  padding-left: 24px;
}

.course-steps li {
  color: var(--muted);
  font-size: 18px;
}

.lesson-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.lesson-footer a {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  text-decoration: none;
}

.lesson-footer a:last-child {
  border-color: transparent;
  background: var(--blue);
  color: #fff;
}

.doc-main details {
  max-width: 760px;
  margin: 18px 0 24px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.doc-main summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
}

.journal-table td:first-child {
  width: 28%;
  color: var(--text);
  font-weight: 800;
}

.next-step p {
  max-width: 680px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.primary-action,
.secondary-action {
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.primary-action {
  background: var(--blue);
  color: #ffffff;
}

.doc-main .primary-action {
  color: #ffffff;
}

.secondary-action {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--text);
}

.doc-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.doc-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  text-decoration: none;
}

.doc-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 22px;
}

.doc-card span {
  color: var(--muted);
}

@media (max-width: 860px) {
  .doc-layout {
    grid-template-columns: 1fr;
  }

  .doc-sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .doc-main {
    width: min(100% - 28px, 840px);
    padding-top: 32px;
  }

  .doc-card-grid {
    grid-template-columns: 1fr;
  }

  .lesson-road,
  .concept-grid,
  .number-grid,
  .order-book-demo,
  .scenario-strip {
    grid-template-columns: 1fr;
  }

  .market-layer {
    grid-template-columns: 1fr;
  }

  .term-grid {
    grid-template-columns: 1fr;
  }

  .action-row {
    display: grid;
  }
}
