:root {
    --bg-top: #f4ecd8;
    --bg-bottom: #d7ecf4;
    --paper: #fffdf7;
    --ink: #1d2b38;
    --muted: #5f6c79;
    --line: #d2dde6;
    --primary: #1d6fa5;
    --primary-strong: #174d70;
    --chip: #e8f1f7;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    padding: 28px 14px 44px;
    color: var(--ink);
    line-height: 1.75;
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    background:
        radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.65), transparent 34%),
        radial-gradient(circle at 88% 0%, rgba(255, 255, 255, 0.45), transparent 36%),
        linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
}

.page {
    width: min(960px, 100%);
    margin: 0 auto;
    padding: 24px 20px 28px;
    background: var(--paper);
    border: 1px solid rgba(29, 43, 56, 0.12);
    border-radius: 18px;
    box-shadow:
        0 14px 34px rgba(17, 41, 56, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.site-back {
    display: inline-block;
    margin-bottom: 14px;
    padding: 6px 12px;
    border: 1px solid #c7d8e5;
    border-radius: 999px;
    background: #f4f9fd;
    color: var(--primary-strong);
    text-decoration: none;
    font-size: 0.92rem;
    line-height: 1.2;
}

.site-back:hover {
    border-color: #95b9d2;
    background: #eaf4fb;
}

h1,
h2,
h3 {
    margin-top: 0;
    color: #132535;
    font-family: "STZhongsong", "Songti SC", "Noto Serif SC", serif;
    font-weight: 700;
    letter-spacing: 0.3px;
}

h1,
h2 {
    margin-bottom: 10px;
    line-height: 1.25;
}

h3 {
    margin: 24px 0 10px;
    padding: 8px 10px 8px 12px;
    font-size: 1.12rem;
    scroll-margin-top: 20px;
    border-left: 4px solid var(--primary);
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(29, 111, 165, 0.12), transparent);
}

p {
    margin: 10px 0;
}

small {
    display: inline-block;
    margin-top: 2px;
    color: var(--muted);
}

a {
    color: var(--primary);
    text-decoration-color: rgba(29, 111, 165, 0.35);
    text-underline-offset: 0.16em;
}

a:hover {
    color: var(--primary-strong);
}

code {
    padding: 0.1em 0.38em;
    border: 1px solid #d8e4ee;
    border-radius: 6px;
    background: #eef5fa;
    font-family: "Consolas", "Menlo", "Monaco", monospace;
    font-size: 0.92em;
}

pre {
    position: relative;
    margin: 10px 0;
    padding: 12px 84px 12px 14px;
    border: 1px solid #1c3f5a;
    border-radius: 12px;
    background: #0e2637;
    color: #eaf4fb;
    overflow-x: auto;
}

pre.has-copy-btn {
    padding-right: 84px;
}

pre.pre-copy-target {
    margin: 0;
}

.pre-copy-wrap {
    position: relative;
    margin: 10px 0;
}

pre.has-copy-btn {
    position: relative;
}

pre code {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
}

.tab {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 14px;
    padding: 0 0 12px;
    border-bottom: 1px dashed var(--line);
}

.tablinks {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 0.95rem;
    color: #163347;
    background: var(--chip);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tablinks:hover {
    border-color: #9ec5de;
    background: #d7eaf6;
    transform: translateY(-1px);
}

.tablinks.active {
    color: #f6fbff;
    border-color: #1d5b83;
    background: linear-gradient(180deg, #2a7cb1, #1f5f87);
    box-shadow: 0 7px 18px rgba(19, 62, 90, 0.28);
}

.tabcontent {
    display: none;
    margin: 8px 0 16px;
    padding: 12px 14px;
    border: 1px solid #d6e2eb;
    border-radius: 14px;
    background: #fcfeff;
    box-shadow: 0 8px 20px rgba(26, 62, 88, 0.08);
    animation: panelIn 0.26s ease both;
}

.copy-btn {
    appearance: none;
    border: 1px solid #1d5b83;
    border-radius: 10px;
    padding: 7px 12px;
    font-size: 0.92rem;
    color: #f6fbff;
    background: linear-gradient(180deg, #2a7cb1, #1f5f87);
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.copy-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(19, 62, 90, 0.22);
}

.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    inset: 8px 8px auto auto;
    z-index: 3;
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 8px;
    padding: 3px 10px;
    font-size: 12px;
    line-height: 1.5;
    color: #f1f8ff;
    background: rgba(25, 66, 95, 0.85);
    cursor: pointer;
    transition: background 0.16s ease, transform 0.16s ease;
}

.code-copy-btn:hover {
    background: rgba(38, 95, 134, 0.92);
    transform: translateY(-1px);
}

.floating-toc {
    position: fixed;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    width: 168px;
    z-index: 20;
    padding: 10px 10px 8px;
    border: 1px solid #c9d9e5;
    border-radius: 12px;
    background: rgba(247, 252, 255, 0.9);
    box-shadow: 0 10px 24px rgba(24, 54, 76, 0.12);
    backdrop-filter: blur(5px);
}

.floating-toc-title {
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px dashed #c8d8e4;
    font-size: 0.92rem;
    font-weight: 700;
    color: #20405a;
}

.floating-toc-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.floating-toc-item {
    margin: 0;
}

.floating-toc-link {
    display: block;
    padding: 4px 8px;
    margin-bottom: 3px;
    border-radius: 8px;
    color: #1f4765;
    font-size: 0.82rem;
    line-height: 1.38;
    text-decoration: none;
}

.floating-toc-link:hover {
    color: #123850;
    background: rgba(42, 124, 177, 0.15);
}

.floating-toc.is-inline {
    position: static;
    transform: none;
    width: auto;
    max-height: min(42vh, 360px);
    overflow: auto;
    margin: 0 0 14px;
    padding: 8px;
    backdrop-filter: none;
}

img {
    max-width: 100%;
    height: auto;
    border: 1px solid #dce7ef;
    border-radius: 12px;
    box-shadow: 0 8px 22px rgba(26, 53, 74, 0.16);
}

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

@media (max-width: 720px) {
    body {
        padding: 14px 10px 128px;
    }

    .page {
        padding: 16px 12px 18px;
        border-radius: 14px;
    }

    .tab {
        gap: 6px;
    }

    .tablinks {
        padding: 6px 11px;
        font-size: 0.9rem;
    }

    h3 {
        font-size: 1.04rem;
    }
}

@media (max-width: 1280px) {
    .floating-toc {
        position: static;
        top: auto;
        right: auto;
        bottom: auto;
        left: auto;
        transform: none;
        width: auto;
        margin: 0 0 14px;
        max-height: min(42vh, 360px);
        overflow: auto;
        padding: 8px;
        backdrop-filter: none;
    }

    .floating-toc.is-inline .floating-toc-title {
        margin-bottom: 4px;
        padding-bottom: 4px;
        font-size: 0.85rem;
    }

    .floating-toc.is-inline .floating-toc-list {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .floating-toc.is-inline .floating-toc-link {
        margin-bottom: 0;
        padding: 4px 7px;
        font-size: 0.78rem;
        line-height: 1.3;
        white-space: nowrap;
    }
}
