:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #657188;
    --line: #dfe5ef;
    --brand: #3498db;
    --green: #15803d;
    --red: #dc2626;
    --shadow: 0 12px 30px rgba(23, 32, 51, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    scroll-padding-top: 92px;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

button,
input {
    font: inherit;
}

header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 50;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.header-content {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}

.logo .icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
}

.logo h1 {
    margin: 0;
    font-size: 22px;
}

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

.search-box,
.credential-box label {
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--muted);
}

.search-box {
    width: min(360px, 42vw);
}

.search-box input,
.credential-box input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
}

.nav {
    position: fixed;
    top: 96px;
    left: max(16px, calc((100vw - 1180px) / 2));
    width: 230px;
    max-height: calc(100vh - 120px);
    overflow: auto;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.nav-group {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
}

.nav-group strong {
    padding: 6px 8px;
    color: var(--muted);
    font-size: 13px;
}

.nav a {
    display: block;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
}

.nav a:hover {
    background: #eef8ff;
    color: var(--brand);
}

.content {
    width: min(920px, calc(100% - 300px));
    margin: 0 auto;
    padding: 96px 0 40px;
    margin-left: max(280px, calc((100vw - 1180px) / 2 + 280px));
}

.doc-tools,
.card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.doc-tools {
    padding: 16px;
    margin-bottom: 18px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--brand);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

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

.credential-box label {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.doc-list {
    display: grid;
    gap: 18px;
}

.card {
    padding: 18px;
}

.card-header {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}

.color-bar {
    position: absolute;
    inset: 0 auto 0 0;
    width: 8px;
    background: var(--brand);
}

.card-header-content {
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 16px 16px 24px;
}

.card-header h3 {
    margin: 0 0 6px;
    font-size: 22px;
}

.card-header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.category-pill {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 999px;
    background: #edf8ff;
    color: var(--brand);
    font-size: 13px;
    font-weight: 700;
}

.sub-card {
    padding: 14px;
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fcff;
}

.url-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

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

.method {
    flex: 0 0 auto;
    border-radius: 6px;
    background: var(--brand);
    color: white;
    padding: 7px 12px;
    font-weight: 700;
}

.url-content p {
    margin: 0;
    overflow-wrap: anywhere;
    font-weight: 700;
}

.copy-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #b7def6;
    border-radius: 8px;
    background: #edf8ff;
    color: var(--brand);
    padding: 8px 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.example-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 12px;
}

.example-card {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fcff;
    overflow: hidden;
}

.example-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 46px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: #f3faff;
}

code {
    display: block;
    min-height: 180px;
    max-height: 380px;
    padding: 14px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: linear-gradient(to right, #f9fbfd, #f4f7f9);
    color: #1f2937;
    font-family: Consolas, "Microsoft YaHei", monospace;
    font-size: 13px;
    line-height: 1.7;
}

.empty-row,
.empty-card {
    color: var(--muted);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 100;
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
    border-radius: 999px;
    background: #0f172a;
    color: #fff;
    padding: 10px 16px;
    transition: 0.2s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

body.dark {
    --bg: #111827;
    --panel: #1f2937;
    --text: #f8fafc;
    --muted: #cbd5e1;
    --line: #374151;
    --shadow: none;
}

body.dark header {
    background: rgba(31, 41, 55, 0.94);
}

body.dark .sub-card,
body.dark .search-box,
body.dark .credential-box label,
body.dark .theme-toggle,
body.dark .example-card {
    background: #111827;
}

body.dark .nav a:hover,
body.dark .category-pill,
body.dark .example-head {
    background: #1f6fa5;
    color: #dbeafe;
}

body.dark code {
    background: #0f172a;
    color: #e5e7eb;
}

@media (max-width: 1180px) {
    code {
        min-height: 120px;
    }
}

@media (max-width: 1024px) {
    header {
        position: sticky;
    }

    .header-content {
        align-items: stretch;
        flex-direction: column;
        padding: 14px 0;
    }

    .actions,
    .search-box {
        width: 100%;
    }

    .nav {
        position: static;
        width: min(100% - 24px, 900px);
        max-height: none;
        margin: 10px auto;
        padding: 10px;
        display: flex;
        gap: 12px;
        overflow-x: auto;
        box-shadow: none;
    }

    .nav-group {
        min-width: 160px;
        margin-bottom: 0;
    }

    .content {
        width: min(100% - 24px, 900px);
        margin: 0 auto;
        padding-top: 0;
    }

    .credential-box {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .container {
        width: min(100% - 20px, 1180px);
    }

    .header-content {
        min-height: auto;
        gap: 12px;
    }

    .logo h1 {
        font-size: 18px;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .theme-toggle {
        width: 100%;
    }

    .doc-tools,
    .card {
        padding: 14px;
    }

    .url-info,
    .url-content,
    .card-header-content {
        align-items: flex-start;
        flex-direction: column;
    }

    .copy-btn {
        width: 100%;
        justify-content: center;
    }

    code {
        max-height: none;
        font-size: 12px;
    }
}
