:root {
  --text: #5f5869;
  --text-h: #120f17;
  --bg: #ffffff;
  --surface: #f6f4f9;
  --border: #e6e3ea;
  --accent: #8b2cf5;
  --accent-bg: rgba(139, 44, 245, 0.08);
  --accent-border: rgba(139, 44, 245, 0.35);
  --sans: system-ui, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #a7a3b0;
    --text-h: #f2f0f5;
    --bg: #131218;
    --surface: #1c1a23;
    --border: #2d2a36;
    --accent: #c084fc;
    --accent-bg: rgba(192, 132, 252, 0.12);
    --accent-border: rgba(192, 132, 252, 0.4);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  font: 16px/1.7 var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-h);
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.app-link {
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  background: var(--accent);
  padding: 8px 14px;
  border-radius: 8px;
}

.app-link:hover {
  filter: brightness(1.08);
}

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

.hero {
  background:
    radial-gradient(1200px 300px at 10% -40%, var(--accent-bg), transparent),
    var(--bg);
  border-bottom: 1px solid var(--border);
}

.hero .inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 24px 28px;
}

.doc-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.doc-switcher a {
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.doc-switcher a:hover {
  color: var(--text-h);
  border-color: var(--accent-border);
}

.doc-switcher a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: var(--accent-border);
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-h);
}

.hero .lead {
  margin: 0;
  max-width: 720px;
  font-size: 18px;
}

.meta {
  margin-top: 16px;
  font-size: 14px;
}

/* ---------- Layout ---------- */

.layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.toc {
  position: sticky;
  top: 88px;
  font-size: 14px;
}

.toc p {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border);
}

.toc a {
  display: block;
  padding: 5px 0 5px 14px;
  margin-left: -1px;
  color: var(--text);
  text-decoration: none;
  line-height: 1.4;
  border-left: 2px solid transparent;
}

.toc a:hover {
  color: var(--text-h);
  border-left-color: var(--accent);
}

article {
  max-width: 760px;
}

article h2 {
  margin: 44px 0 12px;
  font-size: 22px;
  line-height: 1.3;
  color: var(--text-h);
  letter-spacing: -0.01em;
}

article h2:first-of-type {
  margin-top: 8px;
}

article h3 {
  margin: 24px 0 8px;
  font-size: 17px;
  color: var(--text-h);
}

article p,
article ul,
article ol {
  margin: 0 0 14px;
}

article li {
  margin-bottom: 6px;
}

article strong {
  color: var(--text-h);
}

/* ---------- Components ---------- */

.summary {
  margin: 0 0 32px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.summary h2 {
  margin: 0 0 12px !important;
  font-size: 16px;
}

.summary ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.summary li {
  position: relative;
  padding-left: 28px;
  margin: 0;
}

.summary li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-bg) no-repeat center / 12px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b2cf5' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-h);
  background: var(--surface);
}

tr:last-child td {
  border-bottom: none;
}

.callout {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  background: var(--accent-bg);
  border-radius: 0 10px 10px 0;
}

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

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 42px;
  margin-bottom: 14px;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-bg);
  border-radius: 50%;
}

.options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 0 0 24px;
}

.option {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.option .tag {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.option h3 {
  margin: 0 0 6px;
}

.option p {
  margin: 0;
  font-size: 15px;
}

code {
  overflow-wrap: anywhere;
  font-size: 0.92em;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-h);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
}

.site-footer .inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
}

.site-footer p {
  margin: 0;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.site-footer nav a {
  color: var(--text);
  text-decoration: none;
}

.site-footer nav a:hover {
  color: var(--accent);
}

/* ---------- Responsive & print ---------- */

@media (max-width: 860px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding-top: 20px;
  }

  .toc {
    position: static;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 16px;
  }
}

@media print {
  .site-header,
  .toc,
  .doc-switcher,
  .app-link {
    display: none;
  }

  .layout {
    display: block;
    padding: 0;
  }

  body {
    color: #000;
    background: #fff;
  }
}
