:root {
    color-scheme: light dark;
}

body {
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    color: #222;
    background: #fff;
    margin: 0;
    padding: 16px 24px 24px;
    line-height: 1.6;
    max-width: 820px;
}

h1 {
    font-size: 1.35em;
    font-weight: 600;
    color: #003d80;
    border-bottom: 2px solid #cce0f5;
    padding-bottom: 6px;
    margin: 0 0 14px 0;
}

h2 {
    font-size: 1.05em;
    font-weight: 600;
    color: #005a9e;
    margin: 16px 0 6px;
}

p {
    margin: 6px 0 10px;
}

a {
    color: #0066cc;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    color: #004499;
}

ul, ol {
    margin: 4px 0 10px 0;
    padding-left: 24px;
}

li {
    margin: 2px 0;
}

.indent {
    margin-left: 24px;
}

kbd {
    display: inline-block;
    padding: 1px 7px;
    font-size: 0.88em;
    background: #f5f5f5;
    border: 1px solid #bbb;
    border-bottom-width: 2px;
    border-radius: 3px;
    font-family: inherit;
    white-space: nowrap;
}

code, pre {
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.92em;
}

pre {
    background: #f7f9fc;
    border: 1px solid #dde4ed;
    padding: 10px 14px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 8px 0;
}

table.kv {
    border-collapse: collapse;
    margin: 8px 0;
}

table.kv td {
    padding: 3px 20px 3px 0;
    vertical-align: top;
}

table.kv td:first-child {
    white-space: nowrap;
    font-weight: 600;
    color: #004;
}

.note {
    background: #f0f6ff;
    border-left: 3px solid #4a90d9;
    padding: 8px 12px;
    margin: 10px 0;
    border-radius: 0 4px 4px 0;
}

hr {
    border: none;
    border-top: 1px solid #dde4ed;
    margin: 16px 0;
}

.nav {
    margin-top: 20px;
    padding-top: 8px;
    border-top: 1px solid #e0e8f0;
    font-size: 0.9em;
    color: #555;
}

.nav a {
    color: #555;
}

/* Previous/Next footer appended by help.js (order from help_nav.js). */
.pagenav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

/* When it follows a hand-written .nav up-link, don't stack two rules. */
.nav + .pagenav {
    margin-top: 4px;
    padding-top: 0;
    border-top: none;
}

/* Search-match highlight (toc.htm result list). */
mark {
    background: #ffe28a;
    color: inherit;
    padding: 0 1px;
}

/* Contents pane: result snippets, keyboard selection, current topic. */
#results .snip {
    font-size: 0.85em;
    color: #667;
    margin: 1px 0 8px;
}

#results li.sel {
    background: #e2eefc;
    outline: 1px solid #b7d3f3;
}

nav a.current {
    font-weight: 600;
    color: #003d80;
}

/* Single breakpoint, aligned with the csitte.at site (max-width: 720px). */
@media (max-width: 720px) {
    body {
        padding: 12px;
    }

    table.kv td {
        overflow-wrap: anywhere;
        padding-right: 12px;
    }

    table.kv td:first-child {
        white-space: normal;
    }
}

/* Dark mode follows the system/browser preference; no toggle by design. */
@media (prefers-color-scheme: dark) {
    body {
        color: #d6d9de;
        background: #1b1e24;
    }

    h1 {
        color: #7cb5f0;
        border-bottom-color: #2c405c;
    }

    h2 {
        color: #69a8e6;
    }

    a {
        color: #6cb0f5;
    }

    a:hover {
        color: #9ccafa;
    }

    kbd {
        background: #2a2f38;
        border-color: #555c68;
    }

    pre {
        background: #22262e;
        border-color: #39404c;
    }

    table.kv td:first-child {
        color: #9db8d6;
    }

    .note {
        background: #1d2b3f;
    }

    hr {
        border-top-color: #39404c;
    }

    .nav {
        border-top-color: #333a44;
        color: #98a0ab;
    }

    .nav a {
        color: #98a0ab;
    }

    mark {
        background: #66541a;
    }

    #results .snip {
        color: #8f97a3;
    }

    #results li.sel {
        background: #243447;
        outline-color: #3a5578;
    }

    nav a.current {
        color: #9ccafa;
    }
}

/* Print: drop navigation chrome, keep ink-friendly colors. */
@media print {
    body {
        max-width: none;
        padding: 0;
        color: #000;
        background: #fff;
    }

    .nav, .pagenav {
        display: none;
    }

    a {
        color: inherit;
        text-decoration: underline;
    }

    h1 {
        color: #000;
        border-bottom-color: #999;
    }

    h2 {
        color: #000;
    }

    pre, kbd {
        background: #fff;
        border-color: #999;
    }

    .note {
        background: #fff;
        border-left-color: #999;
    }
}
