:root {
    --bg-0: #0a122d;
    --bg-1: #1a2a4a;
    --bg-2: #314262;
    --surface: rgba(56, 70, 96, 0.56);
    --surface-strong: rgba(62, 78, 108, 0.72);
    --line: rgba(136, 173, 236, 0.18);
    --text: #e5ecfa;
    --muted: #b3bfd2;
    --accent: #93b2dc;
    --accent-2: #7f9dc7;
    --shadow: 0 18px 42px rgba(3, 11, 33, 0.42);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    color: var(--text);
    font-family: "Manrope", sans-serif;
    background: radial-gradient(circle at 18% 10%, rgba(122, 159, 210, 0.23), transparent 36%),
    radial-gradient(circle at 86% 24%, rgba(111, 136, 176, 0.21), transparent 38%),
    linear-gradient(145deg, var(--bg-0), var(--bg-1) 52%, var(--bg-2));
}

a,
a:hover,
a:focus,
a:active,
a:visited {
    text-decoration: none !important;
}

.bg-orb {
    position: fixed;
    z-index: -2;
    border-radius: 999px;
    pointer-events: none;
    filter: blur(92px);
}

.orb-a {
    width: 390px;
    height: 390px;
    top: -90px;
    left: -110px;
    background: rgba(126, 167, 214, 0.25);
}

.orb-b {
    width: 460px;
    height: 460px;
    top: 200px;
    right: -120px;
    background: rgba(108, 136, 176, 0.26);
}

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: -3;
    background-image: linear-gradient(rgba(157, 178, 214, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(157, 178, 214, 0.04) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: radial-gradient(circle at center, black, transparent 85%);
}

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 24px;
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
    background: radial-gradient(circle at 12% -55%, rgba(129, 175, 224, 0.14), transparent 44%), radial-gradient(circle at 86% -52%, rgba(123, 148, 192, 0.16), transparent 46%), linear-gradient(180deg, rgba(30, 44, 75, 0.94), rgba(34, 50, 84, 0.84));
    box-shadow: 0 8px 26px rgba(2, 10, 28, 0.2);
}

.mobile-menu-btn {
    display: none;
}

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

.brand-mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.brand h1 {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.1rem;
}

.brand p {
    margin: 1px 0 0;
    font-size: 0.82rem;
    color: var(--muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-badges {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    background: rgba(17, 39, 88, 0.72);
    color: var(--muted);
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 0.75rem;
    letter-spacing: 0.2px;
}

.header-badge.is-live {
    color: #d7f8ff;
    border-color: rgba(128, 178, 224, 0.45);
    background: linear-gradient(120deg, rgba(58, 103, 143, 0.5), rgba(75, 98, 138, 0.5));
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 360px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: linear-gradient(150deg, rgba(61, 83, 133, 0.56), rgba(49, 68, 113, 0.64));
    box-shadow: 0 0 0 1px rgba(144, 183, 248, 0.16) inset;
}

.search-box input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    padding: 10px 0;
}

.icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    vertical-align: -2px;
}

.icon-sm {
    width: 14px;
    height: 14px;
    flex-basis: 14px;
}

h2 .icon,
h3 .icon {
    margin-right: 6px;
}

.menu-btn,
.subtab {
    border: 1px solid transparent;
    color: var(--text);
    font: inherit;
    border-radius: 5px;
    transition: 0.2s ease;
}

.menu-btn,
.subtab {
    cursor: pointer;
    text-decoration: none;
}

.menu-btn:hover,
.subtab:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

.layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    grid-template-areas: "sidebar content";
    gap: 18px;
    padding: 92px 22px 20px;
    min-height: calc(100vh - 72px);
    align-items: start;
}

.sidebar {
    grid-area: sidebar;
    position: sticky;
    top: 90px;
    height: calc(100vh - 108px);
    overflow: auto;
    min-width: 0;
    padding: 18px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: linear-gradient(180deg, rgba(40, 60, 104, 0.72), rgba(35, 53, 93, 0.68));
    box-shadow: 0 0 0 1px rgba(153, 221, 255, 0.18) inset, 0 10px 26px rgba(7, 14, 44, 0.3);
}

.sidebar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.sidebar h2 {
    margin: 0 0 14px;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1rem;
}

.menu-list,
.submenu,
.sidebar-foot ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-list li {
    margin-bottom: 8px;
}

.menu-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 11px 12px;
    border-color: rgba(152, 188, 245, 0.32);
    background: linear-gradient(180deg, rgba(63, 84, 132, 0.58), rgba(48, 67, 112, 0.6));
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-btn.active {
    border-color: rgba(169, 207, 255, 0.6);
    background: linear-gradient(125deg, rgba(104, 137, 191, 0.5), rgba(92, 114, 159, 0.46));
    box-shadow: 0 0 0 1px rgba(166, 204, 255, 0.26) inset;
}

.menu-group {
    margin: 14px 0 8px;
    font-size: 0.9rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-icon {
    display: inline-flex;
}

.submenu {
    padding-left: 8px;
}

.submenu-empty {
    color: var(--muted);
    font-size: 0.84rem;
    padding: 6px 10px;
}

.sidebar-foot {
    margin-top: 22px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.sidebar-foot p {
    margin: 0 0 8px;
    color: var(--muted);
}

.sidebar-foot li {
    padding: 5px 0;
}

.content {
    grid-area: content;
    min-width: 0;
    width: 100%;
    max-width: 1280px;
    padding: 0;
}

.doc-section {
    display: block;
    animation: reveal 0.28s ease;
}

.hero {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: clamp(22px, 3vw, 36px);
    background: linear-gradient(130deg, rgba(64, 84, 122, 0.72), rgba(58, 72, 108, 0.68));
    box-shadow: 0 0 0 1px rgba(153, 221, 255, 0.2) inset, 0 10px 26px rgba(7, 14, 44, 0.3);
}

.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid rgba(143, 210, 255, 0.45);
    background: rgba(113, 189, 255, 0.15);
    font-size: 0.82rem;
    color: #c8eeff;
}

.hero h2 {
    margin: 14px 0 10px;
    max-width: 14ch;
    line-height: 1.03;
    font-size: clamp(1.9rem, 4.7vw, 3.1rem);
    font-family: "Space Grotesk", sans-serif;
}

.hero p {
    margin: 0;
    max-width: 68ch;
    color: var(--muted);
}

.hero-stats {
    margin-top: 22px;
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(130px, 1fr));
}

.hero-stats article {
    padding: 16px;
    border-radius: 5px;
    border: 1px solid var(--line);
    background: linear-gradient(150deg, rgba(66, 90, 142, 0.54), rgba(47, 66, 111, 0.6));
    box-shadow: 0 0 0 1px rgba(144, 183, 248, 0.14) inset;
}

.hero-stats strong {
    display: block;
    font-size: 1.7rem;
    font-family: "Space Grotesk", sans-serif;
}

.hero-stats span {
    font-size: 0.9rem;
    color: var(--muted);
}

.panel-grid {
    margin-top: 16px;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(170px, 1fr));
}

.panel,
.doc-card {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-strong);
    box-shadow: 0 0 0 1px rgba(153, 221, 255, 0.16) inset, 0 12px 26px rgba(7, 14, 44, 0.28);
}

.panel {
    padding: 18px;
}

.doc-card {
    padding: 20px;
    margin-bottom: 16px;
}

.panel h3,
.doc-card h3,
.doc-card h4 {
    margin-top: 0;
    font-family: "Space Grotesk", sans-serif;
}

.script-head {
    margin-bottom: 10px;
}

.script-head h2 {
    margin: 0;
}

.script-head p {
    margin: 5px 0 0;
    color: var(--muted);
}

.subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.subtab {
    padding: 9px 13px;
    border-color: rgba(152, 188, 245, 0.32);
    background: linear-gradient(180deg, rgba(62, 84, 133, 0.56), rgba(49, 69, 114, 0.58));
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.subtab.active {
    border-color: rgba(170, 206, 255, 0.56);
    background: linear-gradient(125deg, rgba(101, 131, 184, 0.5), rgba(90, 111, 153, 0.48));
}

pre {
    overflow: auto;
    border-radius: 5px;
    padding: 10px 44px 10px 12px;
    border: 1px solid rgba(147, 186, 248, 0.28);
    background: linear-gradient(180deg, rgba(33, 49, 85, 0.84), rgba(25, 40, 73, 0.82));
    position: relative;
    line-height: 1.45;
}

pre.pre-singleline {
    padding-top: 9px;
    padding-bottom: 9px;
}

code {
    font-size: 0.9rem;
    font-family: Consolas, "Courier New", monospace;
}

.code-copy-btn {
    position: absolute;
    top: 7px;
    right: 8px;
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(125, 182, 255, 0.36);
    border-radius: 4px;
    background: rgba(16, 39, 89, 0.82);
    color: #dff1ff;
    cursor: pointer;
    transition: 0.16s ease;
}

.code-copy-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px) scale(1.02);
}

.code-copy-btn svg {
    width: 14px;
    height: 14px;
}

pre.copied .code-copy-btn {
    border-color: rgba(109, 226, 192, 0.62);
    background: rgba(23, 105, 87, 0.78);
}

pre.pre-singleline .code-copy-btn {
    top: 50%;
    transform: translateY(-50%);
}

pre.pre-singleline .code-copy-btn:hover {
    transform: translateY(-50%) scale(1.02);
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1100px) {
    .layout {
        grid-template-columns: 1fr;
        grid-template-areas: "content";
        padding: 84px 14px 14px;
    }

    .sidebar {
        grid-area: auto;
        position: fixed;
        top: 74px;
        left: -340px;
        width: 310px;
        height: calc(100vh - 88px);
        z-index: 90;
        transition: left 0.24s ease;
    }

    .sidebar.open {
        left: 14px;
    }

    .mobile-menu-btn {
        display: inline-grid;
        place-items: center;
        width: 38px;
        height: 38px;
        border-radius: 8px;
        border: 1px solid var(--line);
        background: linear-gradient(150deg, rgba(61, 83, 133, 0.56), rgba(49, 68, 113, 0.64));
        box-shadow: 0 0 0 1px rgba(144, 183, 248, 0.16) inset;
        color: var(--text);
        cursor: pointer;
    }

    .content {
        max-width: 100%;
    }

    .panel-grid,
    .hero-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 780px) {
    .topbar {
        flex-wrap: wrap;
    }

    .topbar-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-badges {
        width: 100%;
    }

    .search-box {
        min-width: 1px;
        width: 100%;
    }
}

.site-footer {
    margin: 8px 22px 20px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: linear-gradient(180deg, rgba(40, 60, 104, 0.72), rgba(35, 53, 93, 0.68));
    box-shadow: 0 0 0 1px rgba(153, 221, 255, 0.16) inset, 0 10px 24px rgba(7, 14, 44, 0.28);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
}

.footer-inner p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 14px;
}

.footer-links a {
    color: var(--text);
    text-decoration: none;
    border-bottom: 0;
    transition: 0.2s ease;
}

.footer-links a:hover {
    border-bottom-color: transparent;
}

@media (max-width: 780px) {
    .site-footer {
        margin: 8px 14px 14px;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.kpi {
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 12px;
    background: linear-gradient(180deg, rgba(63, 84, 132, 0.48), rgba(46, 66, 109, 0.52));
}

.kpi strong {
    display: block;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.25rem;
}

.kpi span {
    color: var(--muted);
    font-size: 0.85rem;
}

.callout {
    border: 1px solid var(--line);
    border-left: 2px solid var(--accent);
    border-radius: 5px;
    background: linear-gradient(180deg, rgba(63, 84, 132, 0.46), rgba(46, 66, 109, 0.5));
    padding: 12px 14px;
    margin-top: 12px;
}

.callout.warn {
    border-left-color: #ffb366;
}

.flow {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.flow-step {
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 12px;
    background: linear-gradient(180deg, rgba(63, 84, 132, 0.46), rgba(46, 66, 109, 0.5));
}

.flow-step h4 {
    margin: 0 0 6px;
}

.api-entry {
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 12px;
    margin-top: 12px;
    background: linear-gradient(180deg, rgba(63, 84, 132, 0.46), rgba(46, 66, 109, 0.5));
}

.api-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.chip {
    display: inline-block;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 3px 9px;
    font-size: 0.78rem;
    color: var(--muted);
    background: rgba(31, 47, 84, 0.72);
}

.two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 12px;
}

@media (max-width: 980px) {
    .kpi-grid,
    .two-col {
        grid-template-columns: 1fr;
    }
}
