:root {
    --bg: #0b0e13;
    --bg2: #0c1118;
    --surface: #0f1420;
    --ink: #e6edf5;
    --muted: #98a5b8;
    --edge: #1c2433;
    --accent: #66e6c8;
    --accent2: #6d84ff;
    --max: 1100px;
    --radius: 12px;
    --s1: 6px;
    --s2: 10px;
    --s3: 14px;
    --s4: 18px;
}

* {
    box-sizing: border-box
}

html {
    scroll-behavior: smooth
}

body {
    margin: 0;
    padding-top: 96px;
    padding-bottom: 56px;
    color: var(--ink);
    background:
        radial-gradient(900px 600px at 90% -10%, rgba(109, 132, 255, .08), transparent 60%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
    font: 14.75px/1.6 "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.wrap {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 var(--s3)
}

/* ================= NAV ================= */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(12, 16, 24, .92);
    border-bottom: 1px solid var(--edge);
    backdrop-filter: blur(10px) saturate(140%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}

nav .wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.brand {
    font-weight: 800;
    font-size: 20px;
    margin: 8px 0 4px;
    letter-spacing: .4px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    color: transparent;
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

.links a {
    position: relative;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    padding: 4px 2px;
    opacity: .85;
    transition: opacity .15s ease;
}

.links a:hover {
    opacity: 1
}

.links a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -5px;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    transform: scaleX(0);
    transform-origin: center;
    transition: transform .25s ease;
}

.links a.active::after {
    transform: scaleX(1)
}

.hamburger {
    display: none
}

/* ===== Mobile layout ===== */
@media (max-width:899px) {
    .hamburger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        width: 36px;
        height: 32px;
        border: none;
        background: none;
        cursor: pointer;
        position: absolute;
        top: 12px;
        right: 16px;
        z-index: 1101;
    }

    .hamburger span {
        width: 22px;
        height: 2px;
        background: var(--ink);
        border-radius: 2px;
        transition: transform .3s ease, opacity .3s ease;
    }

    .hamburger.active span:nth-child(1) {
        transform: translateY(7px) rotate(45deg)
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0
    }

    .hamburger.active span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg)
    }

    .links {
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        display: flex;
        flex-direction: column;
        gap: 14px;
        background: rgba(12, 16, 24, .98);
        border-top: 1px solid var(--edge);
        box-shadow: 0 10px 24px rgba(0, 0, 0, .45);
        max-height: 0;
        overflow: hidden;
        padding: 0;
        transition: max-height .28s ease, padding .28s ease;
    }

    .links.open {
        max-height: 70vh;
        padding: 12px 0
    }

    body.nav-open::before {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 1100;
        background: rgba(0, 0, 0, .35);
    }

    section {
        scroll-margin-top: 108px
    }
}

@media (min-width:900px) {
    body {
        padding-top: 148px
    }

    section {
        scroll-margin-top: 168px
    }
}

/* ================= SEARCH ================= */
.searchbar {
    padding: 20px 0 12px;
    border-bottom: 1px solid var(--edge)
}

.searchbar input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--edge);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    outline: none;
    transition: box-shadow .15s ease, border-color .15s ease;
}

.searchbar input::placeholder {
    color: #9aa6bb88
}

.searchbar input:focus {
    border-color: #2a3650;
    box-shadow: 0 0 0 2px rgba(102, 230, 200, .28)
}

.search-meta {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px
}

/* ================= CONTENT ================= */
section {
    padding: 54px 0 20px;
    border-bottom: 1px solid var(--edge)
}

section h2 {
    margin: 0 0 8px;
    font-size: 16px;
    letter-spacing: .2px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    color: transparent;
}

section p {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 13px
}

.grid {
    display: grid;
    gap: 18px;
    grid-template-columns: 1fr !important
}

.card {
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #101726, #0c121d) padding-box,
        linear-gradient(135deg, rgba(102, 230, 200, .45), rgba(109, 132, 255, .45)) border-box;
    box-shadow: 0 6px 14px rgba(0, 0, 0, .22);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-head {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    font-weight: 700;
    font-size: 13px;
    color: var(--ink);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, 0)),
        radial-gradient(120% 40% at 50% 0%, rgba(255, 255, 255, .04), transparent 60%);
}

.code {
    position: relative;
    padding: 16px 18px;
    background: #0a0f19
}

pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    overflow-x: hidden;
    font-size: 13.5px;
    line-height: 1.7;
    letter-spacing: .1px;
    word-spacing: .6px;
}

pre code {
    font: inherit
}

pre::-webkit-scrollbar {
    height: 0
}

.copy {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 11.5px;
    padding: 6px 11px;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    color: #061016;
    transition: filter .12s ease, transform .06s ease;
}

.copy:hover {
    filter: brightness(1.06)
}

.copy:active {
    transform: translateY(1px)
}

mark {
    background: #ffe08a;
    color: #000;
    padding: 0 2px;
    border-radius: 2px
}

/* ================= FOOTER ================= */
footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    text-align: center;
    color: var(--muted);
    padding: 14px 0;
    font-size: 12.5px;
    background: rgba(12, 16, 24, .9);
    border-top: 1px solid var(--edge);
    backdrop-filter: blur(10px) saturate(140%);
}

footer a {
    color: var(--accent);
    text-decoration: none
}

.hidden {
    display: none !important
}

.skip {
    position: absolute;
    left: -9999px
}

.skip:focus {
    left: 12px;
    top: 12px;
    background: #fff;
    color: #000;
    padding: 6px 8px;
    border-radius: 6px
}

@media (max-width:520px) {
    body {
        font-size: 14px
    }

    .brand {
        font-size: 15px
    }

    section h2 {
        font-size: 15px
    }

    pre {
        font-size: 13px;
        line-height: 1.65
    }
}

@media print {

    nav,
    .searchbar,
    .copy {
        display: none
    }

    body {
        background: #fff;
        color: #000
    }

    .card {
        background: #fff;
        border: 1px solid #ccc;
        box-shadow: none
    }

    section {
        page-break-inside: avoid
    }
}