:root {
    --bg: #0f1117;
    --panel: #151922;
    --panel-2: #191f2a;
    --text: #eef3fb;
    --muted: #a9b4c6;
    --line: #252c38;
    --line-2: #303949;
    --accent: #e14d4d;
    --accent-soft: rgba(225, 77, 77, 0.12);
    --max: 1320px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Inter, sans-serif;
    line-height: 1.7;
}

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

img {
    display: block;
    max-width: 100%;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(15, 17, 23, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.topbar-inner,
.page-shell {
    max-width: var(--max);
    margin: 0 auto;
    padding-left: 22px;
    padding-right: 22px;
}

.topbar-inner {
    min-height: 74px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
    justify-content: space-between;
    gap: 18px;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-logo {
    width: 66px;
    height: auto;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.brand-text strong {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-text small {
    color: var(--muted);
}

.search-shell {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--line-2);
    background: #11151d;
    color: var(--text);
    outline: none;
}

.search-input::placeholder {
    color: #7f8ba0;
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    display: none;
    background: var(--panel);
    border: 1px solid var(--line-2);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28);
}

.search-results.show {
    display: block;
}

.search-result {
    display: block;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

.search-result:last-child {
    border-bottom: 0;
}

.search-result:hover {
    background: var(--panel-2);
}

.search-result strong {
    display: block;
    margin-bottom: 2px;
}

.search-result span,
.search-empty {
    color: var(--muted);
    font-size: 0.93rem;
}

.search-empty {
    padding: 14px;
}

.page-shell {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 22px;
    padding-top: 28px;
    padding-bottom: 56px;
}

.sidebar {
    position: sticky;
    top: 96px;
    align-self: start;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
}

.sidebar-title {
    padding: 18px 18px 14px;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
}

.sidebar details {
    border-bottom: 1px solid var(--line);
}

.sidebar details:last-of-type {
    border-bottom: 0;
}

.sidebar summary {
    list-style: none;
    cursor: pointer;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
}

.sidebar summary::-webkit-details-marker {
    display: none;
}

.sidebar summary::after {
    content: "▸";
    color: var(--muted);
    font-weight: 500;
    transition: transform 0.16s ease;
}

.sidebar details[open] summary::after {
    transform: rotate(90deg);
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    padding: 0 8px 12px;
}

.sidebar-link {
    display: block;
    padding: 8px 10px;
    color: var(--muted);
    border-radius: 6px;
    margin: 1px 0;
}

.sidebar-link:hover {
    color: var(--text);
    background: var(--panel-2);
}

.content {
    min-width: 0;
}

.doc-section {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 24px;
}

.doc-section + .doc-section {
    margin-top: 18px;
}

.kicker {
    display: inline-flex;
    align-items: center;
    padding: 6px 11px;
    border-radius: 999px;
    background: var(--accent-soft);
    border: 1px solid rgba(225, 77, 77, 0.18);
    color: #ffb8b8;
    font-size: 0.92rem;
}

.doc-section h1,
.doc-section h2 {
    margin: 14px 0 10px;
    letter-spacing: -0.03em;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 0.94rem;
    margin-bottom: 18px;
}

.code-block {
    margin-top: 14px;
    padding: 16px 18px;
    background: #10141c;
    border: 1px solid var(--line);
    border-radius: 8px;
    white-space: pre-wrap;
    font-family: Consolas, "Cascadia Code", monospace;
    color: #d7e0f2;
}

.links-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.link-chip {
    display: inline-flex;
    align-items: center;
    padding: 9px 13px;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    color: var(--text);
}

.link-chip:hover {
    background: var(--panel-2);
}

code {
    font-family: Consolas, "Cascadia Code", monospace;
    color: #ffcf9c;
}

@media (max-width: 980px) {
    .topbar-inner {
        grid-template-columns: 1fr;
        padding-top: 16px;
        padding-bottom: 16px;
    }

    .page-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }
}

.hero h1 {
    font-size: clamp(2.3rem, 5vw, 4rem);
    line-height: 0.98;
}

.section h2 {
    font-size: 2rem;
}

.hero p,
.section p,
.section li {
    color: var(--muted);
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.tag {
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--line-2);
    background: #12161d;
    color: #dce4ef;
    font-size: 0.87rem;
}

.accent-aqua { color: #97dbff; border-color: #3a677c; }
.accent-fire { color: #ffb09f; border-color: #73433d; }
.accent-earth { color: #e0bf99; border-color: #6f533a; }
.accent-void { color: #ceb8ff; border-color: #53447a; }
.accent-omni { color: #ffd89b; border-color: #705828; }

.split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.code {
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #10131a;
    color: #dae2ee;
    font-family: Consolas, "Courier New", monospace;
    white-space: pre-wrap;
}

ul {
    margin: 10px 0 0;
    padding-left: 20px;
}

.links-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.link-chip {
    padding: 10px 12px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: #11151d;
    color: var(--muted);
}

.link-chip:hover {
    color: var(--text);
}

@media (max-width: 1080px) {
    .topbar-inner,
    .layout,
    .split {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }
}

@media (max-width: 720px) {
    .topbar-inner,
    .layout {
        padding-left: 14px;
        padding-right: 14px;
    }

    .brand-logo {
        width: 58px;
    }

    .hero,
    .section,
    .sidebar {
        padding: 18px;
    }
}
