:root {
  --bg: #070b12;
  --bg-elevated: #0f1623;
  --bg-card: rgba(18, 27, 42, 0.78);
  --border: rgba(148, 163, 184, 0.14);
  --text: #e8edf5;
  --text-muted: #94a3b8;
  --accent: #3d7eff;
  --accent-soft: rgba(61, 126, 255, 0.14);
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.12);
  --gold: #fbbf24;
  --radius: 14px;
  --radius-lg: 22px;
  --font: "DM Sans", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --sidebar-w: 260px;
  --header-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: #6b9fff;
}

code {
  font-size: 0.9em;
  background: var(--bg-elevated);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
}

.bg-orb-1 {
  width: 480px;
  height: 480px;
  top: -160px;
  right: 10%;
  background: rgba(61, 126, 255, 0.25);
}

.bg-orb-2 {
  width: 360px;
  height: 360px;
  bottom: 5%;
  left: -100px;
  background: rgba(52, 211, 153, 0.12);
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 50% at 50% 0%, black, transparent 70%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  background: rgba(7, 11, 18, 0.88);
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.92rem;
}

.header-links a {
  color: var(--text-muted);
}

.header-links a:hover {
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid transparent;
  transition: transform 0.2s, background 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  color: #fff;
  background: #5a92ff;
}

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 2.5rem;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 1.5rem);
}

.sidebar-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.toc {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--border);
}

.toc li {
  margin: 0;
}

.toc a {
  display: block;
  padding: 0.4rem 0 0.4rem 1rem;
  margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.toc a:hover,
.toc a.active {
  color: var(--text);
  border-left-color: var(--accent);
}

.toc .toc-sub a {
  padding-left: 1.75rem;
  font-size: 0.82rem;
}

.doc-hero {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
  background: var(--green-soft);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.doc-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.85rem);
  line-height: 1.15;
  margin: 0 0 1rem;
  font-weight: 600;
}

.lead {
  font-size: 1.15rem;
  color: #c5d0e0;
  margin: 1.25rem 0 0;
  max-width: 62ch;
}

section {
  margin-bottom: 2.75rem;
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}

section h2 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  margin: 0 0 1rem;
  font-weight: 600;
}

section h3 {
  font-size: 1.12rem;
  margin: 1.5rem 0 0.6rem;
  color: #dce4f0;
}

section p {
  margin: 0 0 1rem;
  color: #c8d2e0;
}

section ul,
section ol {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
  color: #c8d2e0;
}

section li {
  margin-bottom: 0.45rem;
}

.card,
.bot-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  margin: 1.25rem 0;
}

.card h4,
.bot-card h4 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.card p,
.bot-card p {
  margin: 0;
  font-size: 0.92rem;
}

.bot-card .handle {
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.card-grid,
.signal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.card-grid .card,
.signal-grid .signal-card {
  margin: 0;
}

.signal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.signal-card h4 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.signal-card p {
  margin: 0;
  font-size: 0.88rem;
  color: #c8d2e0;
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.steps li {
  position: relative;
  padding: 0.85rem 0 0.85rem 2.75rem;
  border-bottom: 1px solid var(--border);
  color: #c8d2e0;
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid rgba(61, 126, 255, 0.35);
  color: #b8d0ff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.steps strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.btn-guide {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}

.btn-guide:last-child {
  border-bottom: none;
}

.btn-pill {
  flex-shrink: 0;
  width: 168px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  text-align: center;
}

.btn-guide p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  flex: 1;
  min-width: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 1rem 0;
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.65rem 0.85rem;
  text-align: left;
}

th {
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 600;
}

td {
  color: #c8d2e0;
}

.links-table td:first-child {
  color: var(--text-muted);
  width: 38%;
}

.disclaimer {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  font-size: 0.92rem;
  color: #e8d5a8;
}

.disclaimer p {
  margin: 0 0 0.75rem;
  color: inherit;
}

.disclaimer p:last-child {
  margin: 0;
}

.doc-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  font-size: 1.1rem;
  cursor: pointer;
}

.lang-switch {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  gap: 2px;
  flex-shrink: 0;
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn.active {
  background: linear-gradient(135deg, #3d7eff, #2563eb);
  color: #fff;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.sidebar-top .sidebar-label {
  margin: 0;
}

.lang-switch-sidebar {
  display: none;
}

body.lang-ru {
  letter-spacing: 0.01em;
}

.steps li span {
  display: block;
  margin-top: 0.15rem;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding-top: 1.25rem;
  }

  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    background: rgba(7, 11, 18, 0.97);
    padding: 1.25rem;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .header-links .hide-mobile {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .lang-switch-sidebar {
    display: inline-flex;
  }

  .btn-pill {
    width: 140px;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 1rem;
  }

  .btn-guide {
    flex-direction: column;
    gap: 0.5rem;
  }

  .btn-pill {
    width: 100%;
    text-align: left;
  }

  .header-links .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
  }
}
