:root {
  color-scheme: dark;
  --bg: #17131d;
  --panel: #1b2028;
  --panel-2: #222936;
  --text: #f4f6f9;
  --muted: #aeb7c6;
  --line: #343c49;
  --accent: #ffbd45;
  --shadow: rgba(0, 0, 0, .28);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.6;
}
a { color: inherit; }
p, li, code, a { overflow-wrap: anywhere; }
.wrap {
  width: min(1020px, calc(100% - 32px));
  margin: 0 auto;
}
header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(16, 19, 24, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.topbar {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-weight: 800;
  text-decoration: none;
}
.brand img {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  box-shadow: 0 8px 22px var(--shadow);
}
nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
nav a, .button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}
nav a:hover, .button:hover { border-color: var(--accent); }
.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #121212;
}
.lang-switch {
  display: inline-flex;
  overflow: hidden;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}
.lang-switch button {
  min-width: 44px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.lang-switch button:last-child { border-right: 0; }
.lang-switch button[aria-pressed="true"] {
  background: var(--accent);
  color: #121212;
}
main { padding: 42px 0 58px; }
.hero {
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
h1 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(38px, 6vw, 68px);
  line-height: 1.05;
  letter-spacing: 0;
}
.lead {
  max-width: 790px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 19px;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}
.toc {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 8px;
}
.toc a {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px 14px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}
.toc a:hover { border-color: var(--accent); }
section.chapter {
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}
h2 {
  margin: 0 0 14px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}
h3 {
  margin: 24px 0 8px;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}
p { margin: 10px 0 0; color: var(--muted); }
ul, ol { margin: 10px 0 0; padding-left: 22px; color: var(--muted); }
li { margin: 5px 0; }
code {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #111721;
  padding: 1px 5px;
  color: #f6d28d;
  font-family: Consolas, "Courier New", monospace;
  font-size: .95em;
}
.card {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px 18px;
}
.note {
  margin-top: 12px;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: var(--panel);
  padding: 12px 14px;
  color: var(--muted);
}
.guide-lang { display: none; }
body[data-lang="ru"] .guide-lang[data-guide-lang="ru"],
body[data-lang="en"] .guide-lang[data-guide-lang="en"] { display: block; }
footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 34px;
  color: var(--muted);
  font-size: 14px;
}
@media (max-width: 760px) {
  .topbar { align-items: flex-start; padding: 12px 0; }
  nav { justify-content: flex-start; }
  .toc { grid-template-columns: 1fr; }
}
@media print {
  :root {
    color-scheme: light;
    --bg: #ffffff;
    --panel: #ffffff;
    --panel-2: #f3f5f8;
    --text: #111827;
    --muted: #374151;
    --line: #cbd5e1;
    --accent: #c77900;
  }
  html { scroll-behavior: auto; }
  body { background: #ffffff; color: var(--text); }
  header { position: static; background: #ffffff; backdrop-filter: none; }
  nav, .actions { display: none; }
  main { padding: 20px 0; }
  .wrap { width: 100%; }
  .guide-lang { display: block !important; }
  .guide-lang + .guide-lang { page-break-before: always; }
  h1 { font-size: 32px; }
  .topbar { min-height: 52px; }
  .lead { font-size: 16px; }
  .hero { padding-bottom: 20px; }
  .toc { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .toc a { padding: 8px; font-size: 12px; }
  code { background: #f3f4f6; color: #27313c; }
  h2 { margin-bottom: 10px; font-size: 22px; break-after: avoid-page; page-break-after: avoid; }
  h3 { margin-top: 16px; font-size: 16px; break-after: avoid-page; page-break-after: avoid; }
  p, li { font-size: 12px; line-height: 1.35; orphans: 3; widows: 3; }
  p { margin: 6px 0; }
  li { margin: 3px 0; }
  section.chapter { padding: 8px 0; }
  header { display: none; }
  li { break-inside: avoid; }
  .note { break-inside: avoid; page-break-inside: avoid; }
  footer { display: none; }
}

.app-guide { padding: 22px 0 32px; }
.app-guide .chapter { padding-block: 20px; }
.app-guide .toc { margin-top: 16px; }
@media print {
  .app-guide { padding: 20px 0; }
  .app-guide .chapter { padding-block: 8px; }
}
