:root {
    --bg: #0b0b0f;
    /* panel transparency controls */
    --panel-rgb: 18, 18, 26;
    --panel-alpha: 0.72; /* 0 = fully transparent, 1 = solid */
    --panel: rgba(var(--panel-rgb), var(--panel-alpha));
    /* background image tint */
    --bg-tint-alpha: 0.55; /* dark overlay over background image */
    /* text + accents */
    --text: #e7e7ee;
    --muted: #fcfcff;
    --brand: #8ac7ff;
    --accent: #81f4d6;
    --danger: #ff6b6b;
    --warn: #ffcf66;
    --border: rgba(97, 87, 87, 0.199);
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.205);
  }
  
  html, body {
    /* background image with dark overlay for readability */
    background:
      linear-gradient(rgba(11,11,15,var(--bg-tint-alpha)), rgba(11,11,15,var(--bg-tint-alpha))),
      url('/fon/joinfon.webp') center / cover fixed no-repeat;
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell,
      "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  }
  
  .rules-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px 64px;
  }
  
  .hero {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(57, 159, 255, 0.288), rgba(13, 248, 185, 0.308));
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--shadow);
  }
  .hero__tag {
    display: inline-block;
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bg);
    background: var(--accent);
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 8px;
  }
  .hero__title { font-size: 32px; margin: 4px 0 6px; }
  .hero__lead { color: var(--muted); margin: 0 0 10px; }
  .meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 14px; }
  
  .toc {
    position: sticky;
    top: 16px;
    align-self: start;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
    max-height: calc(100vh - 32px);
    overflow: auto;
  }
  .toc { display: none !important; }
  .toc__title { font-weight: 700; margin-bottom: 8px; }
  #toc a { display: block; padding: 6px 8px; color: var(--muted); text-decoration: none; border-radius: 8px; }
  #toc a:hover { color: var(--text); background: rgba(255,255,255,0.06); }
  #toc a.active { color: var(--text); background: rgba(138,199,255,0.15); }
  #toc .toc-h2 { font-weight: 600; }
  #toc .toc-h3 { padding-left: 14px; font-size: 14px; }
  
  .content {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    /* numbering root */
    counter-reset: sec;
  }
  
  .sep { margin-top: 28px; padding-top: 8px; border-top: 1px dashed var(--border); }
  
  /* numbered list 1.1, 1.2, ... based on section */
  .content > section { counter-increment: sec; }
  .content > section .num { list-style: none; padding-left: 28px; counter-reset: sub; }
  .content > section .num > li {
    position: relative;
    margin: 8px 0;
    counter-increment: sub;
  }
  .content > section .num > li::before {
    content: counter(sec) "." counter(sub) " ";
    position: absolute;
    left: -28px;
    width: 24px;
    color: var(--muted);
  }
  
  .status-badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); }
  .status-badge.active { background: rgba(245, 81, 81, 0.411); color: #dff0ff; }
  .status-badge.passive { background: rgba(129,244,214,0.18); color: #e6fff8; }
    
  .note { color: var(--warn); }
  .varn { color:#ff3131 }
  .varnhead { color:#ff6b6b }
  
  .page-footer { margin-top: 24px; display: flex; justify-content: flex-end; }
  .backtotop { color: var(--brand); text-decoration: none; border: 1px solid var(--border); padding: 8px 10px; border-radius: 10px; }
  .backtotop:hover { background: rgba(255,255,255,0.06); }
  
  /* Ð¡ÑÑ‹Ð»ÐºÐ¸ Ð²Ð½ÑƒÑ‚Ñ€Ð¸ Ñ‚ÐµÐºÑÑ‚Ð° */
  .content a { color: var(--brand); text-underline-offset: 2px; }
  .content a:hover { text-decoration: underline; }
  
  /* ÐÐ´Ð°Ð¿Ñ‚Ð¸Ð² */
  @media (max-width: 980px) {
    .rules-container { grid-template-columns: 1fr; }
    .toc { position: static; max-height: none; order: 2; }
  }
  
  /* ÐŸÐµÑ‡Ð°Ñ‚ÑŒ */
  @media print {
    :root { --bg: #ffffff00; --text: #000; --panel: #ffffff; --border: #ddd; }
    body { background: #fff; color: #000; }
    .rules-container { box-shadow: none; max-width: 100%; padding: 0; }
    .hero, .toc, .content { border: none; box-shadow: none; }
    .backtotop { display: none; }
  }
  
  /* Theme controls (opacity/tint) */
  .theme-controls { position: fixed; right: 16px; bottom: 16px; z-index: 1000; }
  .theme-controls__toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 12px; cursor: pointer;
    color: var(--text); background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
  }
  .theme-controls__panel {
    margin-top: 8px; padding: 12px; border-radius: 12px;
    background: var(--panel); color: var(--text);
    border: 1px solid var(--border); box-shadow: var(--shadow);
    width: 260px; display: none;
  }
  .theme-controls.is-open .theme-controls__panel { display: block; }
  .theme-controls__row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin: 8px 0; }
  .theme-controls__label { font-size: 13px; color: var(--muted); }
  .theme-controls input[type="range"] { width: 100%; }
  .theme-controls__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
  .theme-controls__btn { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: rgba(255,255,255,0.06); color: var(--text); cursor: pointer; }
  .theme-controls__btn:hover { background: rgba(255,255,255,0.1); }
  
  