:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #1b1f2a;
  --muted: #596176;
  --stroke: #e5eaf3;
  --accent: #f6c800;
  --accent-soft: #fff7d6;
  --code-bg: #f1f4fa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(900px 500px at 10% -10%, #fff9db 0%, transparent 45%), var(--bg);
  color: var(--text);
  font-family: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a {
  color: #8d6f00;
  text-decoration: none;
  font-weight: 640;
}

.topbar {
  position: sticky;
  top: 10px;
  z-index: 60;
  padding: 10px;
  pointer-events: none;
}

.topbar-inner {
  pointer-events: auto;
  width: min(1240px, 100%);
  margin: 0 auto;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 22px rgba(25, 36, 59, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
}

.brand-logo {
  height: 28px;
  width: auto;
  display: block;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip {
  appearance: none;
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 740;
  text-decoration: none;
  cursor: pointer;
}

body[data-lang="ru"] .lang button[data-lang="ru"],
body[data-lang="en"] .lang button[data-lang="en"] {
  background: var(--accent-soft);
  border-color: #f3de80;
}

.layout {
  width: min(1240px, calc(100% - 24px));
  margin: 14px auto 34px;
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  gap: 14px;
}

.sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
  border: 1px solid var(--stroke);
  background: var(--panel);
  border-radius: 16px;
  padding: 14px;
}

.sidebar h2 {
  margin: 0 0 8px;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #707a90;
}

.doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
}

.doc-link {
  display: block;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  color: var(--text);
  font-weight: 640;
}

.doc-link small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 560;
  font-size: 11px;
}

.doc-link.active {
  border-color: #edd46a;
  background: var(--accent-soft);
}

.main {
  border: 1px solid var(--stroke);
  background: var(--panel);
  border-radius: 16px;
  padding: clamp(16px, 2.2vw, 26px);
}

.badge {
  display: inline-flex;
  align-self: start;
  border: 1px solid #f0d76f;
  background: var(--accent-soft);
  border-radius: 999px;
  color: #5a4900;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 760;
}

h1 {
  margin: 10px 0 8px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.06;
  letter-spacing: -0.025em;
}

.lead {
  margin: 0;
  color: var(--muted);
  line-height: 1.56;
  font-size: clamp(14px, 1.4vw, 17px);
}

.toc {
  margin-top: 14px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: #fbfcff;
  padding: 12px;
}

.toc h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #69748c;
}

.toc ul {
  margin: 0;
  padding-left: 18px;
}

.toc li {
  margin: 5px 0;
  color: var(--muted);
}

.section {
  margin-top: 14px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: #fafcff;
  padding: 12px;
}

.section h2 {
  margin: 0 0 8px;
  font-size: clamp(18px, 1.9vw, 23px);
  letter-spacing: -0.015em;
}

.section h3 {
  margin: 10px 0 7px;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.52;
}

.section ul {
  margin: 8px 0 0 18px;
  padding: 0;
  color: var(--muted);
}

.section li {
  margin: 6px 0;
  line-height: 1.45;
}

.code {
  margin-top: 8px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: var(--code-bg);
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  color: #2c3550;
  white-space: pre-wrap;
  word-break: break-word;
}

.note {
  margin-top: 8px;
  border-left: 3px solid #f2d66a;
  background: #fff8dc;
  border-radius: 8px;
  padding: 9px 10px;
  color: #665200;
  font-size: 13px;
}

.foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--stroke);
  color: #76809a;
  font-size: 13px;
}

.lang-ru { display: none; }
.lang-en { display: none; }
body[data-lang="ru"] .lang-ru { display: block; }
body[data-lang="en"] .lang-en { display: block; }

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

  .sidebar {
    position: static;
    top: auto;
  }
}

@media (max-width: 760px) {
  .topbar {
    top: 6px;
    padding: 8px;
  }

  .topbar-inner {
    border-radius: 16px;
    flex-wrap: wrap;
  }
}
