:root {
      --fs-hero:  clamp(48px, 7vw, 96px);
      --fs-h2:    clamp(32px, 4vw, 56px);
      --fs-h3:    clamp(20px, 2.5vw, 28px);
      --fs-body:  16px;
      --fs-small: 13px;
    }

    
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    html {
      scroll-behavior: smooth;
      overflow-x: clip;
      font-size: 16px;
      -webkit-text-size-adjust: 100%;
      max-width: 100%;
    }
    .skip-link {
      position: absolute;
      left: -9999px;
      top: auto;
      width: 1px;
      height: 1px;
      overflow: hidden;
      z-index: 10000;
      padding: 12px 20px;
      background: var(--accent, #F97316);
      color: #fff;
      font-weight: 600;
      text-decoration: none;
      border-radius: 12px;
    }
    .skip-link:focus {
      left: 16px;
      top: 16px;
      width: auto;
      height: auto;
      overflow: visible;
    }
    body {
      font-family: 'Inter', sans-serif;
      background: var(--bg-deep);
      color: var(--text-main);
      line-height: 1.65;
      font-size: var(--fs-body);
      font-weight: 400;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      overflow-x: clip;
      max-width: 100%;
    }
    a { color: var(--accent); text-decoration: none; transition: opacity 0.15s; }
    a:hover { opacity: 0.8; }

    
    .container {
      max-width: 1200px;
      margin: 0 auto;
      padding: 0 16px;
      width: 100%;
      min-width: 0;
    }

    
    h1, h2, h3 {
      font-family: 'Inter', sans-serif;
      color: var(--text-main);
    }

    
    nav {
      position: sticky;
      top: 0;
      z-index: 100;
      background: var(--topbar-bg);
      backdrop-filter: blur(24px);
      -webkit-backdrop-filter: blur(24px);
      border-bottom: 1px solid var(--border);
      padding: 16px 0;
    }
    .nav-inner {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 24px;
    }
    .nav-logo {
      font-family: 'Inter', sans-serif;
      font-weight: 700;
      font-size: 1.15rem;
      display: flex;
      align-items: center;
      gap: 10px;
      color: var(--text-main);
      flex-shrink: 0;
      letter-spacing: -0.02em;
    }
    .nav-logo-mark {
      width: 34px; height: 34px;
      background: transparent;
      border-radius: 9px;
      display: flex; align-items: center; justify-content: center;
      overflow: hidden;
    }
    .nav-logo-mark img {
      width: 100%; height: 100%;
      object-fit: contain;
      border-radius: 9px;
    }
    html.dark-theme .nav-logo-mark {
      background: rgba(255, 255, 255, 0.08);
      box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
    }
    .nav-back {
      font-size: 14px;
      font-weight: 500;
      color: var(--text-muted);
      display: inline-flex;
      align-items: center;
      gap: 6px;
      min-height: 44px;
      padding: 8px 4px;
      transition: color 0.18s;
    }
    .nav-back:hover { color: var(--text-main); opacity: 1; }
    .nav-back svg { width: 16px; height: 16px; }

    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      font-family: 'Inter', sans-serif;
      font-weight: 600;
      font-size: var(--fs-body);
      cursor: pointer;
      border: none;
      text-decoration: none;
      border-radius: 12px;
      padding: 14px 28px;
      min-height: 48px;
      line-height: 1.3;
      white-space: normal;
      max-width: 100%;
    }
    .btn-primary {
      background: var(--accent);
      color: var(--on-accent);
    }
    .btn-primary:hover { opacity: 0.92; }
    .doc-main .btn { margin-top: 8px; }
    .doc-main .btn-primary { width: auto; max-width: 100%; }

    
    .doc-main {
      max-width: 760px;
      margin: 0 auto;
      padding: 48px 16px 80px;
      overflow-x: clip;
      overflow-wrap: anywhere;
      word-break: break-word;
    }
    .doc-header {
      margin-bottom: 56px;
      padding-bottom: 36px;
      border-bottom: 1px solid var(--border);
    }
    .doc-label {
      font-size: var(--fs-small);
      font-weight: 500;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--accent);
      margin-bottom: 16px;
    }
    .doc-header h1 {
      font-size: clamp(32px, 5vw, 48px);
      font-weight: 700;
      letter-spacing: -0.02em;
      line-height: 1.15;
      margin-bottom: 14px;
    }
    .doc-meta {
      font-size: 14px;
      color: var(--text-muted);
    }

    .highlight {
      background: var(--accent-dim);
      border-left: 3px solid var(--accent);
      border-radius: 0 14px 14px 0;
      padding: 20px 24px;
      margin: 32px 0;
    }
    .highlight p { margin: 0; color: var(--text-main); }

    .doc-main h2 {
      font-size: 22px;
      font-weight: 600;
      letter-spacing: -0.01em;
      margin: 48px 0 16px;
    }
    .doc-main h3 {
      font-size: 16px;
      font-weight: 600;
      color: var(--text-main);
      margin: 28px 0 10px;
    }
    .doc-main p {
      margin-bottom: 16px;
      color: var(--text-muted);
      font-size: var(--fs-body);
      line-height: 1.75;
      overflow-wrap: anywhere;
      word-break: break-word;
    }
    .doc-main a {
      overflow-wrap: anywhere;
      word-break: break-word;
    }
    .doc-main ul, .doc-main ol {
      margin: 0 0 16px 22px;
      color: var(--text-muted);
    }
    .doc-main li {
      margin-bottom: 8px;
      font-size: var(--fs-body);
      line-height: 1.7;
    }
    .doc-main li strong { color: var(--text-main); font-weight: 600; }

    
    footer {
      padding: 40px 0;
      border-top: 1px solid var(--border);
    }
    .footer-inner {
      display: grid;
      grid-template-columns: auto 1fr;
      grid-template-areas:
        "brand copy"
        "legal legal"
        "links links";
      gap: 20px 24px;
      align-items: center;
    }
    .footer-inner > .nav-logo { grid-area: brand; }
    .footer-copy {
      grid-area: copy;
      justify-self: end;
      text-align: right;
      font-size: 13px;
      color: var(--text-muted);
    }
    .footer-legal {
      grid-area: legal;
      width: 100%;
    }
    .footer-links {
      grid-area: links;
      display: flex;
      gap: 16px 24px;
      flex-wrap: wrap;
      width: 100%;
      max-width: 100%;
    }
    .footer-links a {
      font-size: 13px;
      color: var(--text-muted);
      transition: color 0.15s;
    }
    .footer-links a:hover { color: var(--text-main); opacity: 1; }

    @media (min-width: 768px) {
      .container { padding: 0 24px; }
      .doc-main { padding: 64px 24px 100px; }
    }

    @media (min-width: 1024px) {
      .doc-main { padding: 80px 24px 120px; }
    }

    @media (max-width: 768px) {
      .container { padding: 0 16px; }
      .doc-main { padding: 48px 16px 80px; }
      .nav-inner { gap: 12px; min-width: 0; }
      .nav-logo { font-size: 1rem; min-width: 0; }
      .nav-back {
        font-size: 13px;
        flex-shrink: 1;
        min-width: 0;
        white-space: nowrap;
      }
      .doc-header h1 { font-size: clamp(26px, 7vw, 36px); }
      .doc-main h2 { font-size: 19px; margin-top: 36px; }
      .highlight { padding: 16px 18px; margin: 24px 0; }
      .doc-main .btn-primary {
        display: flex;
        width: 100%;
        justify-content: center;
        text-align: center;
      }
      footer { padding: 32px 0 calc(32px + env(safe-area-inset-bottom, 0px)); }
    }

    @media (max-width: 640px) {
      .doc-main { padding: 40px 16px 72px; }
      .doc-header { margin-bottom: 40px; padding-bottom: 28px; }
      .footer-links {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
      }
      .footer-links a {
        display: flex;
        align-items: center;
        min-height: 44px;
        padding: 4px 0;
        font-size: 14px;
        line-height: 1.5;
      }
      .footer-inner {
        grid-template-columns: 1fr;
        grid-template-areas:
          "brand"
          "copy"
          "legal"
          "links";
      }
      .footer-inner > .footer-copy {
        justify-self: start;
        text-align: left;
      }
    }

.legal-page { min-height: 100vh; background: var(--bg-deep); }
.legal-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}
.legal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 20px;
  box-shadow: var(--shadow-md);
}

@media (min-width: 768px) {
  .legal-wrap { padding: 48px 24px 80px; }
  .legal-card { padding: 40px 32px; }
}

.footer-legal {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
}
html.dark-theme .footer-legal {
  color: rgba(243, 244, 246, 0.72);
}
html.dark-theme .footer-legal a {
  color: rgba(243, 244, 246, 0.85);
}

.doc-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  margin: 16px 0;
}
.doc-main .doc-data-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 14px;
}
.doc-main .doc-data-table th,
.doc-main .doc-data-table td {
  border: 1px solid var(--border);
  padding: 10px;
  text-align: left;
  color: var(--text-muted);
  vertical-align: top;
}
.doc-main .doc-data-table th {
  color: var(--text-main);
  font-weight: 600;
  background: var(--bg-glass);
}
html.dark-theme .doc-main .doc-data-table th {
  background: var(--surface);
}

.legal-toc {
  position: sticky;
  top: calc(72px + env(safe-area-inset-top, 0px));
  z-index: 50;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 14px;
  margin-bottom: 20px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
}
.legal-toc::-webkit-scrollbar { display: none; }
.legal-toc a {
  flex: 0 0 auto;
  padding: 8px 12px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
.legal-toc a:hover { color: var(--text-main); opacity: 1; }
.table-scroll-hint { margin: 8px 0 0; text-align: center; }
.table-scroll-hint.is-hidden { display: none; }

.doc-table-wrap::after {
  content: '';
}
@media (max-width: 768px) {
  .doc-table-wrap {
    position: relative;
  }
  .doc-table-wrap.has-horizontal-overflow::after {
    content: '← Листайте →';
    display: block;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    padding-top: 8px;
  }
}

