:root {
    color-scheme: dark;
    --wiki-bg: #22262b;
    --wiki-sidebar: #171b20;
    --wiki-top: #0e1217;
    --wiki-panel: #272c32;
    --wiki-border: #323840;
    --wiki-text: #e6e9ed;
    --wiki-muted: #aeb5be;
    --wiki-blue: #168cff;
    --wiki-blue-hover: #45a4ff;
    --wiki-top-height: 48px;
    --wiki-sidebar-width: 340px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; }
body.wiki-body { margin: 0; background: var(--wiki-bg); color: var(--wiki-text); font-size: 15px; line-height: 1.65; }
a { color: var(--wiki-blue); text-decoration: none; }
a:hover { color: var(--wiki-blue-hover); }
button, input, textarea { font: inherit; }
.sr-only, .wiki-skip-link { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.wiki-skip-link:focus { clip: auto; width: auto; height: auto; margin: 8px; padding: 8px 12px; z-index: 100; background: #fff; color: #000; }

.wiki-topbar {
    position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--wiki-top-height); display: flex; align-items: center; gap: 12px;
    padding: 0 8px; background: var(--wiki-top); border-bottom: 1px solid #252a30;
}
.wiki-icon-button, .wiki-account-button {
    min-height: 36px; border: 1px solid var(--wiki-border); border-radius: 5px; background: #20252b; color: var(--wiki-text);
    display: inline-flex; align-items: center; justify-content: center; padding: 6px 11px; cursor: pointer;
}
.wiki-icon-button { min-width: 42px; font-size: 20px; line-height: 1; }
.wiki-icon-button.primary { border-color: var(--wiki-blue); background: var(--wiki-blue); color: white; }
.wiki-brand { display: flex; align-items: center; gap: 12px; color: var(--wiki-text); font-size: 18px; white-space: nowrap; }
.wiki-brand:hover { color: white; }
.wiki-brand img { width: 70px; height: 28px; object-fit: contain; }
.wiki-search { width: min(310px, 28vw); margin-left: auto; position: relative; }
.wiki-search input { width: 100%; height: 34px; padding: 6px 40px 6px 12px; color: var(--wiki-text); background: #171c21; border: 1px solid #252b32; border-radius: 4px; outline: none; }
.wiki-search input:focus { border-color: var(--wiki-blue); box-shadow: 0 0 0 2px rgb(22 140 255 / 20%); }
.wiki-search kbd { position: absolute; right: 8px; top: 6px; border: 1px solid #3a424b; border-radius: 3px; color: #8d96a0; padding: 0 6px; line-height: 20px; font-size: 12px; }
.wiki-account-actions { display: flex; align-items: center; gap: 8px; }
.wiki-account-actions form { margin: 0; }
.wiki-account-button { font-size: 13px; }

.wiki-sidebar {
    position: fixed; z-index: 40; left: 0; top: var(--wiki-top-height); bottom: 0; width: var(--wiki-sidebar-width);
    overflow: auto; background: var(--wiki-sidebar); border-right: 1px solid var(--wiki-border); padding: 24px 12px 40px;
    scrollbar-color: #59616a transparent; scrollbar-width: thin; transition: transform .2s ease, visibility .2s;
}
.wiki-sidebar nav { display: grid; gap: 2px; }
.wiki-sidebar-action { display: flex; align-items: center; gap: 12px; padding: 8px 6px; color: var(--wiki-text); border-radius: 4px; }
.wiki-sidebar-action span { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 4px; background: #262c33; color: #c8d0d8; font-size: 18px; }
.wiki-sidebar-action:hover { background: #20262c; color: white; }
.wiki-sidebar-section { margin-top: 14px; border-top: 1px solid #282e35; padding-top: 10px; display: grid; gap: 4px; }
.wiki-sidebar-heading { color: #dce1e6; padding: 5px 7px 8px; font-weight: 600; }
.wiki-sidebar-section > a { color: var(--wiki-text); padding: 4px 7px; }
.wiki-tree, .wiki-tree ul { list-style: none; margin: 0; padding: 0; }
.wiki-tree .wiki-tree { padding-left: 13px; border-left: 1px solid #30363d; margin-left: 7px; }
.wiki-tree li { margin: 1px 0; }
.wiki-tree a, .wiki-tree summary span { display: block; color: #e0e4e8; padding: 4px 7px; border-radius: 3px; overflow-wrap: anywhere; }
.wiki-tree a:hover, .wiki-tree a.active { background: #252b32; color: var(--wiki-blue-hover); }
.wiki-tree details > summary { list-style: none; display: flex; align-items: center; cursor: pointer; }
.wiki-tree details > summary::-webkit-details-marker { display: none; }
.wiki-tree details > summary::before {
    content: "";
    display: inline-block;
    flex: 0 0 auto;
    width: 0;
    height: 0;
    margin: 0 5px 0 3px;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 6px solid #87919b;
    transform-origin: 3px 4px;
    transition: transform .15s;
}
.wiki-tree details[open] > summary::before { transform: rotate(90deg); }
.wiki-tree summary a, .wiki-tree summary span { flex: 1; }
.wiki-sidebar-backdrop { display: none; }

.wiki-main { margin-left: var(--wiki-sidebar-width); min-height: 100vh; padding: calc(var(--wiki-top-height) + 26px) 30px 70px; transition: margin-left .2s ease; }
.wiki-main > * { max-width: 1510px; margin-inline: auto; }
.wiki-breadcrumbs { display: flex; align-items: center; gap: 12px; min-height: 32px; margin-bottom: 18px; color: var(--wiki-muted); text-transform: capitalize; }
.wiki-breadcrumbs a { color: var(--wiki-blue); }
.wiki-page-frame { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 40px; align-items: start; }
.wiki-toc { position: sticky; top: calc(var(--wiki-top-height) + 25px); border-bottom: 1px solid var(--wiki-border); padding-bottom: 14px; }
.wiki-toc-title { padding: 3px 0 10px; border-bottom: 1px solid var(--wiki-border); margin-bottom: 10px; font-weight: 600; }
.wiki-toc nav { display: grid; gap: 3px; }
.wiki-toc a { color: var(--wiki-muted); padding: 3px 0; line-height: 1.35; }
.wiki-toc a:hover { color: white; }
.wiki-toc a.level-1 { font-weight: 700; color: #d8dde2; }
.wiki-toc a.level-2 { padding-left: 10px; }
.wiki-toc a.level-3, .wiki-toc a.level-4 { padding-left: 22px; font-size: 13px; }
.muted { color: var(--wiki-muted); }

.wiki-markdown { min-width: 0; color: #edf0f3; font-size: 16px; }
.wiki-markdown h1, .wiki-markdown h2, .wiki-markdown h3, .wiki-markdown h4 { color: #e3e6e9; font-weight: 400; line-height: 1.25; scroll-margin-top: 68px; }
.wiki-markdown h1 { margin: 0 0 20px; font-size: clamp(30px, 3vw, 40px); }
.wiki-markdown h2 { margin: 28px 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--wiki-border); font-size: 30px; }
.wiki-markdown h3 { margin: 24px 0 10px; font-size: 23px; }
.wiki-markdown h4 { margin: 20px 0 8px; font-size: 18px; font-weight: 600; }
.wiki-markdown p { margin: 0 0 16px; }
.wiki-markdown strong { color: #f5f6f7; }
.wiki-markdown hr { border: 0; border-top: 1px solid var(--wiki-border); margin: 22px 0; }
.wiki-markdown blockquote { margin: 18px 0; padding: 12px 18px; border-left: 4px solid var(--wiki-blue); background: #1b2025; color: #cbd1d7; }
.wiki-markdown code { padding: 2px 5px; border-radius: 3px; background: #171b20; color: #f0b7c3; font-family: "Cascadia Code", Consolas, monospace; }
.wiki-markdown pre { overflow: auto; padding: 16px; background: #15191e; border: 1px solid var(--wiki-border); border-radius: 5px; }
.wiki-markdown pre code { padding: 0; color: #e4e8ec; background: none; }
.wiki-markdown table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; margin: 18px 0 26px; }
.wiki-markdown th, .wiki-markdown td { min-width: 130px; padding: 9px 11px; border: 1px solid #414850; vertical-align: top; }
.wiki-markdown th { background: #1b2026; text-align: left; }
.wiki-markdown tr:nth-child(even) td { background: #252a30; }
.wiki-markdown img { display: block; max-width: 100%; height: auto; margin: 18px auto; border-radius: 4px; }
.wiki-markdown li { margin: 4px 0; }
.wiki-page-meta { margin-top: 48px; padding-top: 14px; border-top: 1px solid var(--wiki-border); color: #929ba5; font-size: 13px; }
.wiki-status { margin-bottom: 18px; padding: 9px 13px; border: 1px solid #277a50; border-radius: 5px; background: #173725; color: #bce8ce; }
.wiki-empty-state { padding: 40px; border: 1px dashed #49515a; border-radius: 7px; text-align: center; }

.wiki-button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 14px; border: 1px solid #4a535d; border-radius: 5px; background: #20262c; color: white; cursor: pointer; }
.wiki-button:hover { border-color: #687582; color: white; }
.wiki-button.primary { border-color: var(--wiki-blue); background: var(--wiki-blue); }
.wiki-editor-card, .wiki-preview { padding: 24px; border: 1px solid var(--wiki-border); border-radius: 7px; background: #20252a; }
.wiki-preview { margin-top: 24px; }
.wiki-editor-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.wiki-editor-heading h1 { margin: 2px 0 20px; font-weight: 400; }
.eyebrow { color: #7fbaff; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.wiki-editor-card label { display: block; margin: 12px 0 6px; font-weight: 600; }
.wiki-input, .wiki-editor { width: 100%; color: #eef1f4; background: #12171b; border: 1px solid #424a53; border-radius: 4px; outline: none; }
.wiki-input { min-height: 42px; padding: 8px 11px; }
.wiki-input:focus, .wiki-editor:focus { border-color: var(--wiki-blue); box-shadow: 0 0 0 2px rgb(22 140 255 / 18%); }
.wiki-input[readonly] { color: #aeb5bc; background: #191e23; }
.wiki-field-help { margin: 5px 0 16px; color: #a7afb8; font-size: 13px; }
.wiki-editor-toolbar { display: flex; gap: 4px; padding: 7px; border: 1px solid #424a53; border-bottom: 0; border-radius: 4px 4px 0 0; background: #1b2026; }
.wiki-editor-toolbar button { min-width: 36px; height: 32px; padding: 3px 8px; border: 1px solid transparent; border-radius: 3px; background: transparent; color: #dce1e5; cursor: pointer; }
.wiki-editor-toolbar button:hover { border-color: #4b5660; background: #272e35; }
.wiki-editor { min-height: 58vh; resize: vertical; padding: 16px; border-radius: 0 0 4px 4px; font: 14px/1.55 "Cascadia Code", Consolas, monospace; tab-size: 4; }
.wiki-editor-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 14px; }
.wiki-validation { color: #ff9da3; font-size: 13px; }
.wiki-validation ul { margin: 5px 0; }
.wiki-az-list, .wiki-search-results { display: grid; gap: 8px; }
.wiki-az-list a, .wiki-search-results a { display: grid; padding: 12px 14px; border: 1px solid var(--wiki-border); border-radius: 5px; background: #20252a; color: #e8ebee; }
.wiki-az-list a:hover, .wiki-search-results a:hover { border-color: #4b5661; background: #252b31; }
.wiki-az-list span, .wiki-search-results span { color: #96a0aa; font-size: 12px; }
.wiki-search-results h2 { margin: 0 0 5px; padding: 0; border: 0; font-size: 20px; font-weight: 600; }
.wiki-search-results p { margin: 0 0 5px; color: #c7cdd3; }

@media (max-width: 1180px) {
    .wiki-page-frame { grid-template-columns: minmax(0, 1fr); }
    .wiki-toc { display: none; }
}

@media (min-width: 821px) {
    html.wiki-sidebar-collapsed .wiki-sidebar { visibility: hidden; transform: translateX(-100%); pointer-events: none; }
    html.wiki-sidebar-collapsed .wiki-main { margin-left: 0; }
}

@media (max-width: 820px) {
    :root { --wiki-sidebar-width: min(330px, 88vw); }
    .wiki-brand strong { display: none; }
    .wiki-brand img { width: 76px; }
    .wiki-search { width: auto; flex: 1; }
    .wiki-account-button { font-size: 0; min-width: 38px; }
    .wiki-account-button::after { content: "Login"; font-size: 12px; }
    .wiki-account-actions form .wiki-account-button::after { content: "Out"; }
    .wiki-sidebar { transform: translateX(-102%); box-shadow: 8px 0 24px rgb(0 0 0 / 35%); }
    body.sidebar-open .wiki-sidebar { transform: translateX(0); }
    .wiki-sidebar-backdrop { position: fixed; z-index: 35; inset: var(--wiki-top-height) 0 0; border: 0; background: rgb(0 0 0 / 52%); }
    body.sidebar-open .wiki-sidebar-backdrop { display: block; }
    .wiki-main { margin-left: 0; padding-inline: 18px; }
    .wiki-markdown { font-size: 15px; }
    .wiki-markdown h1 { font-size: 31px; }
    .wiki-markdown h2 { font-size: 25px; }
    .wiki-editor-card, .wiki-preview { padding: 16px; }
}

@media (max-width: 520px) {
    .wiki-topbar { gap: 6px; }
    .wiki-brand { display: none; }
    .wiki-main { padding-inline: 13px; }
    .wiki-breadcrumbs { overflow-x: auto; white-space: nowrap; }
    .wiki-editor-heading { display: block; }
    .wiki-editor-heading .wiki-button { margin-bottom: 12px; }
}
