:root {
  --bg: #F4F5FA;
  --text: #24314B;
  --muted: #516078;
  --primary: #6D58C7;
  --primary-hover: #5c47b8;
  --ink: #24314B;
  --card: #ffffff;
  --line: rgba(36, 49, 75, 0.12);
  --soft: #f3f0fb;
  --header: 80px;
  --font: Inter, "Segoe UI", system-ui, sans-serif;
  --max: 1200px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.6;
  overflow-wrap: break-word;
}

img, svg { max-width: 100%; display: block; }

a { color: var(--primary); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

p, ul, ol { margin: 0 0 1rem; }

h1, h2, h3, h4 {
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.7rem;
}

h1 { font-size: 42px; }
h2 { font-size: 32px; margin-top: 2.2rem; }
h3 { font-size: 20px; letter-spacing: -0.02em; }

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  background: #fff;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  z-index: 50;
}

.skip-link:focus { top: 12px; }

:focus { outline: none; }

:focus-visible {
  outline: 3px solid #c4b6f0;
  outline-offset: 3px;
}

.container {
  width: min(var(--max), calc(100% - 64px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--ink);
  color: #fff;
}

.header-inner {
  height: var(--header);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.logo {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 16px;
  white-space: nowrap;
  min-height: 44px;
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: block;
  overflow: hidden;
  flex: 0 0 36px;
}

.logo-mark img {
  width: 36px;
  height: 36px;
  display: block;
}

.site-nav ul {
  display: flex;
  gap: 4px 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  justify-content: center;
}

.site-nav a {
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
}

.site-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

.site-nav a[aria-current="page"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.header-tools {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-toggle {
  display: none;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  position: relative;
  margin: 0 auto;
}

.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle span::before { top: -6px; }
.nav-toggle span::after { top: 6px; }

.mobile-nav {
  display: none;
  background: #1b263c;
  padding: 8px 16px 20px;
}

.mobile-nav a {
  display: flex;
  align-items: center;
  min-height: 48px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

.mobile-nav .btn { width: 100%; margin-top: 8px; }

.btn {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 12px;
  border: 2px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  background: #fff;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: transparent;
  border-color: rgba(36, 49, 75, 0.22);
  color: var(--text);
}

.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.hero { padding: 40px 0 8px; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 48px;
  align-items: center;
  background: #fff;
  border-radius: 28px;
  padding: 48px;
  border: 1px solid var(--line);
}

.lead { font-size: 18px; color: var(--text); }

.subline { color: var(--muted); font-size: 16px; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero .notice { margin: 24px 0 0; }

.hero-figure {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px;
  background: var(--ink);
  border-radius: 20px;
}

.kcard {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 14px 14px 16px;
  min-height: 108px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.kcard span {
  display: block;
  color: #c4b6f0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.kcard strong,
.kcard em { display: block; font-style: normal; color: #fff; }

.kcard strong { margin-top: 18px; font-size: 16px; letter-spacing: -0.02em; }
.kcard em { color: rgba(255, 255, 255, 0.68); font-size: 13px; margin-top: 4px; }

.section { padding: 64px 0 8px; }

.section h2 {
  margin-top: 0;
  font-size: 36px;
}

.section h2::after {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  margin-top: 14px;
  border-radius: 99px;
  background: var(--primary);
}

.section-intro {
  max-width: 640px;
  color: var(--muted);
  margin-top: -0.2rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 28px;
}

.card,
.panel,
.notice,
.result-item,
.quiz-card,
.form-card,
.score-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.card { padding: 28px 24px 24px; }

.section:not(#curriculum) .card h3::before {
  content: "";
  display: block;
  width: 28px;
  height: 3px;
  border-radius: 99px;
  background: var(--primary);
  margin-bottom: 16px;
}

.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

.module-num {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--primary);
  margin-bottom: 14px;
}

.module-time {
  display: inline-block;
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

#curriculum .card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

#curriculum .text-link { margin-top: auto; }

.card .text-link,
.toc a,
.breadcrumbs a { font-weight: 600; }

.text-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.text-link::after { content: "→"; margin-left: 8px; }

.split-panels {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  align-items: stretch;
}

.split-panels .panel { padding: 36px 32px 20px; }

.split-panels .panel:first-child {
  background: var(--ink);
  color: #fff;
  border-color: transparent;
}

.split-panels .panel:first-child h2 { color: #fff; }
.split-panels .panel:first-child h2::after { background: #c4b6f0; }

.split-panels .panel:first-child .btn-secondary {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.split-panels .panel:first-child .btn-secondary:hover {
  background: #fff;
  color: var(--ink);
  border-color: #fff;
}

.split-panels h2 { margin-top: 0; font-size: 30px; }

.notice {
  padding: 14px 16px;
  background: var(--soft);
  border-color: transparent;
  border-left: 3px solid var(--primary);
  border-radius: 12px;
  margin: 0 0 24px;
  color: var(--text);
}

.page-intro { padding: 40px 0 16px; }

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0;
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); }

.breadcrumbs li:not(:last-child)::after {
  content: "/";
  margin: 0 8px;
  color: rgba(36, 49, 75, 0.35);
}

.lesson-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 760px);
  gap: 28px;
  justify-content: center;
  align-items: start;
  padding-bottom: 48px;
}

.toc {
  position: sticky;
  top: calc(var(--header) + 16px);
  background: var(--ink);
  border-radius: 20px;
  padding: 12px 8px;
}

.toc-summary {
  display: none;
  list-style: none;
  color: #fff;
}

.toc-summary::-webkit-details-marker { display: none; }

@media (min-width: 901px) {
  .toc-details > .toc-list { display: block; }
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 4px;
}

.toc-list a {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.78);
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.35;
}

.toc-list a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.toc-list a[aria-current="page"] {
  background: var(--primary);
  color: #fff;
}

.toc-list [data-read="true"] .read-mark::before { content: "✓ "; }

.lesson-kicker {
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.progress-line {
  height: 4px;
  background: #e6e4f2;
  border-radius: 99px;
  overflow: hidden;
  margin: 8px 0 24px;
}

.progress-line span {
  display: block;
  height: 100%;
  background: var(--primary);
}

.lesson-main {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 40px 44px 32px;
}

.lesson-main h1 { font-size: 36px; }
.lesson-main h2 { font-size: 24px; letter-spacing: -0.02em; }

.lesson-main p:has(> strong:first-child) {
  background: var(--soft);
  border-radius: 14px;
  padding: 16px 18px;
}

.lesson-pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.lesson-pager .next { justify-self: end; }

#read-status {
  min-height: 1.4em;
  color: var(--muted);
  font-size: 15px;
  margin-top: 8px;
}

.page-intro.prose:has(.modules-table) { max-width: none; }

.page-intro.prose:has(.modules-table) > p,
.page-intro.prose:has(.modules-table) > h1,
.page-intro.prose:has(.modules-table) > .notice { max-width: 720px; }

.table-wrap {
  overflow-x: auto;
  margin-top: 32px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th, td {
  text-align: left;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

thead th {
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfe; }

.quiz-top { margin-bottom: 20px; }

.quiz-count {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 10px;
}

.quiz-bar {
  height: 4px;
  background: #e6e4f2;
  border-radius: 99px;
  overflow: hidden;
}

.quiz-bar::before {
  content: "";
  display: block;
  height: 100%;
  width: var(--progress, 20%);
  background: var(--primary);
}

.quiz-card { padding: 28px; }

.quiz-step h2 { margin-top: 0; font-size: 26px; }

.option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 0 0 10px;
  min-height: 48px;
  cursor: pointer;
  background: #fff;
}

.option:hover { border-color: rgba(109, 88, 199, 0.45); }

.option:has(input:checked) {
  border-color: var(--primary);
  background: var(--soft);
}

.option input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

.quiz-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.score-block { padding: 32px; margin-bottom: 20px; }

.score-value {
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin: 0;
  color: var(--primary);
}

.result-flag { font-weight: 700; }
.result-flag.is-match { color: #1f6b45; }
.result-flag.is-miss { color: #8a3b12; }

.result-item { padding: 22px; margin-bottom: 14px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 28px; }

.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}

.contact-details {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
}

.contact-details h1 { margin-top: 0; }

.contact-facts { margin: 8px 0 20px; }
.contact-facts div { margin-bottom: 14px; }
.contact-facts dt {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.contact-facts dd { margin: 4px 0 0; }

.contact-map {
  grid-column: 1 / -1;
  width: 100%;
  height: 420px;
  min-height: 420px;
  margin-top: 8px;
  border: 0;
  border-radius: 20px;
  background: #e6e8f2;
}

.form-card { position: relative; padding: 28px; max-width: none; }
.form-card .preloader {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
}
.form-card label.error {
  color: #8a3b12;
  font-size: 15px;
  font-weight: 400;
  margin: 0;
}

.field { margin-bottom: 16px; }

label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 15px; }

input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(36, 49, 75, 0.18);
  background: #fbfbfe;
  color: var(--text);
  font: inherit;
  padding: 10px 14px;
}

textarea { min-height: 140px; resize: vertical; }

.check-field {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 500;
}

.check-field input { width: 20px; height: 20px; margin-top: 4px; accent-color: var(--primary); }

.field-error { color: #8a3b12; min-height: 1.2em; font-size: 15px; margin: 6px 0 0; }

.form-card .iti,
.form-card .intl-tel-input { display: block; width: 100%; }
.form-card .iti__country-list,
.form-card .intl-tel-input .country-list { z-index: 6; color: var(--text); font-size: 15px; }
.form-card .iti input[type="tel"],
.form-card .intl-tel-input input[type="tel"] { width: 100%; }
.field-error:empty { display: none; margin: 0; min-height: 0; }
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: #8a3b12;
  background: #fff8f5;
}

.form-banner {
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.form-banner.ok { background: #e7f6ee; }
.form-banner.bad { background: #fdeee6; }

.hp {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.site-footer {
  margin-top: 72px;
  padding: 48px 0 40px;
  background: var(--ink);
  color: rgba(255, 255, 255, 0.78);
}

.site-footer a { color: #efeaff; }

.site-footer .container > p:first-child { max-width: 720px; }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 18px 0 8px;
}

.footer-links a {
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.copyright { color: rgba(255, 255, 255, 0.55); font-size: 15px; }

.cookie-bar {
  position: fixed;
  z-index: 30;
  left: 16px;
  bottom: 16px;
  width: min(420px, calc(100% - 32px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(36, 49, 75, 0.16);
  padding: 18px;
}

.cookie-bar .btn-secondary { background: #fff; }

.cookie-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.prose { max-width: 760px; }
.prose h2:first-child,
.lesson-main h2:first-of-type { margin-top: 1.6rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.empty-result { padding: 8px 0 24px; }

@media (max-width: 700px) {
  .modules-table thead { display: none; }
  .modules-table tr,
  .modules-table td { display: block; width: 100%; }
  .modules-table td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .modules-table tbody tr:hover td { background: transparent; }
}

@media (max-width: 900px) {
  :root { --header: 64px; }
  h1 { font-size: 30px; }
  body { font-size: 16px; line-height: 1.65; }
  .container { width: min(var(--max), calc(100% - 32px)); }
  .header-inner { grid-template-columns: 1fr auto; }
  .site-nav { display: none; }
  .header-cta { display: none; }
  .nav-toggle { display: inline-block; }
  .mobile-nav:not([hidden]) { display: block; }
  .hero { padding-top: 20px; }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px 20px;
    border-radius: 20px;
  }
  .hero-actions .btn { width: 100%; }
  .card-grid,
  .lesson-layout,
  .split-panels,
  .contact-layout { grid-template-columns: 1fr; gap: 16px; }
  .contact-map { min-height: 280px; height: 280px; margin-top: 0; }
  .section { padding-top: 40px; }
  .section h2,
  .split-panels h2 { font-size: 26px; }
  .lesson-main { padding: 24px 18px; }
  .lesson-main h1 { font-size: 30px; }
  .toc { position: static; padding: 0; }
  .toc-summary {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 16px;
    font-weight: 700;
    cursor: pointer;
  }
  .toc-details:not([open]) .toc-list { display: none; }
  .lesson-pager { grid-template-columns: 1fr; }
  .lesson-pager .next,
  .lesson-pager .prev,
  .lesson-pager .mark { justify-self: stretch; width: 100%; }
  .quiz-actions { flex-direction: column; }
  .quiz-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .cookie-bar,
  .lesson-pager,
  .nav-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  .lesson-layout { display: block; }
  .lesson-main,
  .hero-grid,
  .card,
  .toc { box-shadow: none; }
}
