/* Справка 8levels — общие стили всех страниц (113i, 13.10.2026).
   Цвета те же, что у сайта: тёмная тема по умолчанию, светлая — по выбору
   человека (ключ ce8-theme общий с сайтом) или по настройке системы. */
:root {
    --bg: #0d1117; --surface: #161b22; --surface-2: #1c2128; --surface-3: #21262d;
    --border: #30363d; --text: #e6edf3; --text-muted: #9aa4af; --text-faint: #7d8590;
    --primary: #58a6ff; --green: #26a69a; --mark: rgba(38, 166, 154, 0.28);
    --radius-sm: 6px; --radius-md: 10px;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color-scheme: dark;
}
[data-theme="light"] {
    --bg: #f6f8fa; --surface: #ffffff; --surface-2: #f0f2f5; --surface-3: #e6e9ed;
    --border: #d0d7de; --text: #1f2328; --text-muted: #59636e; --text-faint: #6e7781;
    --primary: #0969da; --green: #1a7f72; --mark: rgba(26, 127, 114, 0.18);
    color-scheme: light;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-padding-top: 76px; }
body {
    font-family: var(--font-body); font-size: 15px; line-height: 1.65;
    background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); }

/* шапка */
.top {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
    padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; font-size: 16px; flex: none; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
    color: var(--text); font: inherit; font-size: 13px; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--surface-3); }
.btn-icon { width: 34px; padding: 0; }

/* поиск */
.hs { position: relative; flex: 1 1 auto; max-width: 440px; margin-left: 18px; }
.hs input {
    width: 100%; height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg); color: var(--text); font: inherit; font-size: 14px;
}
.hs input:focus { outline: 2px solid var(--green); outline-offset: -1px; }
.hs-res {
    position: absolute; top: 40px; left: 0; right: 0; max-height: min(70vh, 520px); overflow: auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28); padding: 6px;
}
.hs-res a { display: block; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.hs-res a:hover, .hs-res a.on { background: var(--surface-2); }
.hs-res b { display: block; font-size: 14px; font-weight: 600; }
.hs-res small { display: block; font-size: 12px; color: var(--text-faint); }
.hs-res span { display: block; font-size: 13px; color: var(--text-muted); line-height: 1.45; }
.hs-res mark { background: var(--mark); color: inherit; border-radius: 2px; }
.hs-empty { padding: 10px; font-size: 13px; color: var(--text-muted); }

/* раскладка */
.wrap > * { min-width: 0; }
.wrap { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 36px; max-width: 1160px; margin: 0 auto; padding: 28px 20px 70px; }
nav.toc { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 90px); overflow: auto; }
nav.toc summary { display: none; }
.toc-list a {
    display: block; padding: 6px 10px; border-radius: var(--radius-sm); color: var(--text-muted);
    text-decoration: none; font-size: 14px;
}
.toc-list a:hover { background: var(--surface-2); color: var(--text); }
.toc-list > a.active { background: var(--surface-2); color: var(--text); font-weight: 600; box-shadow: inset 2px 0 0 var(--green); }
.toc-sub { margin: 2px 0 8px 10px; padding-left: 8px; border-left: 1px solid var(--border); }
.toc-sub a { font-size: 13px; padding: 4px 8px; line-height: 1.4; }
.toc-sub a.on { color: var(--text); }

main { max-width: 820px; }
.crumb { font-size: 12px; color: var(--text-faint); margin-bottom: 4px; }
h1 { font-size: 28px; line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
main > .lead { color: var(--text-muted); margin-bottom: 22px; font-size: 15.5px; }
h3 { position: relative; font-size: 18px; line-height: 1.35; font-weight: 650; margin: 34px 0 10px; display: flex; align-items: baseline; gap: 8px; }
h3 .anc {
    display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: none;
    border-radius: var(--radius-sm); color: var(--text-faint); opacity: 0.55; align-self: center;
}
h3:hover .anc, h3 .anc:focus-visible { opacity: 1; }
h3 .anc:hover { background: var(--surface-2); color: var(--text); }
h3:target > span { background: var(--mark); border-radius: 4px; }
main p { margin-bottom: 12px; }
ul, ol { margin: 0 0 14px 22px; }
li { margin-bottom: 6px; }
.note {
    margin: 14px 0; padding: 12px 14px; border-radius: var(--radius-md);
    background: var(--surface-2); border-left: 3px solid var(--green); color: var(--text-muted);
}
.tw { overflow-x: auto; max-width: 100%; margin: 0 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
.tw table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { white-space: nowrap; font-size: 12px; letter-spacing: 0.02em; color: var(--text-faint); font-weight: 600; }
td:first-child { font-weight: 560; overflow-wrap: break-word; hyphens: manual; }
tbody tr:last-child td { border-bottom: 0; }
code { font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-size: 0.9em; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }

/* снимки экрана: у каждой темы свой файл, грузится только видимый (loading=lazy) */
.shot { margin: 16px 0 20px; }
.shot img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.shot figcaption { margin-top: 8px; font-size: 13px; color: var(--text-muted); }
[data-theme="dark"] .shot .th-light, [data-theme="light"] .shot .th-dark { display: none; }

/* назад / дальше */
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--border); }
.pn a {
    display: block; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md);
    background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600;
}
.pn a:hover { border-color: var(--green); }
.pn small { display: block; font-size: 12px; font-weight: 400; color: var(--text-faint); }
.pn-next { text-align: right; grid-column: 2; }

footer { max-width: 1160px; margin: 0 auto; padding: 0 20px 60px; color: var(--text-faint); font-size: 13px; }
footer .f-main { color: var(--text); margin-bottom: 6px; }
footer .f-links, footer .f-note { margin-top: 6px; }

.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0;
    padding: 9px 14px; border-radius: var(--radius-md); background: var(--text); color: var(--bg);
    font-size: 13px; pointer-events: none; transition: opacity 0.18s, transform 0.18s; z-index: 40;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* узкий экран: таблицы — карточками, меню — выпадающее */
@media (max-width: 860px) {
    html { scroll-padding-top: 118px; }
    .wrap { grid-template-columns: 1fr; gap: 14px; padding: 14px 14px 56px; }
    nav.toc { position: sticky; top: 55px; z-index: 20; max-height: none; overflow: visible; margin: 0 -14px; }
    nav.toc details { background: var(--surface); border-bottom: 1px solid var(--border); }
    nav.toc summary {
        display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; list-style: none; font-size: 14px;
    }
    nav.toc summary::-webkit-details-marker { display: none; }
    nav.toc summary span { color: var(--text-faint); font-size: 12px; }
    nav.toc summary b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    nav.toc summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg); transition: transform 0.15s; }
    nav.toc details[open] summary::after { transform: rotate(-135deg); }
    .toc-list { max-height: 65vh; overflow: auto; padding: 0 8px 10px; }
    .top { padding: 9px 14px; gap: 10px; }
    .brand span { display: none; }
    .hs { margin-left: 0; }
    .top-right .btn:not(.btn-icon) { display: none; }
    h1 { font-size: 23px; }
    h3 { font-size: 17px; margin-top: 28px; }
}
@media (max-width: 620px) {
    .tw { overflow-x: visible; }
    .tw table { display: block; border: 0; background: transparent; }
    .tw thead { display: none; }
    .tw tbody, .tw tr, .tw td { display: block; width: 100%; }
    .tw tr { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); padding: 8px 0; margin-bottom: 8px; }
    .tw td { border: 0; padding: 2px 12px; }
    .tw td:first-child { font-weight: 620; font-size: 15px; margin-bottom: 2px; }
    .tw td:not(:first-child)::before { content: attr(data-label) ": "; color: var(--text-faint); }
    .tw .t-cols2 td:not(:first-child)::before { content: none; }
    .pn { grid-template-columns: 1fr; }
    .pn-next { grid-column: 1; }
}
@media print {
    .top, nav.toc, .pn, .anc { display: none; }
    .wrap { display: block; padding: 0; }
}
