:root {
    --page-bg: #eef0f2;
    --panel-bg: #f8f8f8;
    --card-bg: #ffffff;
    --line: #e5e6e8;
    --text: #24272c;
    --muted: #8b9199;
    --soft: #f4f5f6;
    --accent: #20242a;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    background: var(--page-bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    line-height: 1.65;
}

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

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

.site-frame {
    max-width: 1460px;
    min-height: 100vh;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 26px rgba(15, 23, 42, 0.08);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 260px minmax(260px, 420px) 1fr;
    align-items: center;
    height: 64px;
    padding: 0 28px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.topbar-brand {
    display: flex;
    align-items: center;
    min-width: 0;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0;
    color: #050505;
}

.topbar-brand img {
    max-width: 170px;
    max-height: 42px;
    object-fit: contain;
}

.search-box {
    display: grid;
    grid-template-columns: 1fr 46px;
    width: 100%;
    height: 40px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

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

.search-box button {
    border: 0;
    background: transparent;
    color: #111;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.layout {
    display: grid;
    grid-template-columns: 274px minmax(0, 1fr) 300px;
    min-height: calc(100vh - 64px);
}

.profile-panel {
    padding: 32px 26px;
    background: var(--panel-bg);
    border-right: 1px solid var(--line);
}

.profile-mark {
    display: grid;
    place-items: center;
    width: 120px;
    height: 120px;
    margin: 0 auto 14px;
    overflow: hidden;
    color: #fff;
    background: #050505;
    border-radius: 50%;
    font-size: 34px;
    font-weight: 800;
}

.profile-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-panel h1 {
    margin: 0;
    text-align: center;
    font-size: 18px;
}

.profile-panel p {
    margin: 8px auto 28px;
    color: var(--muted);
    text-align: center;
    font-size: 14px;
}

.side-nav {
    display: grid;
    gap: 6px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.side-nav span {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 13px;
}

.side-nav a {
    display: block;
    padding: 12px 16px;
    color: #737982;
    border-radius: 6px;
    font-size: 15px;
}

.side-nav a:hover {
    color: var(--text);
    background: #fff;
}

.content-area {
    min-width: 0;
    padding: 34px 24px 64px;
    background: #fff;
}

.page-head {
    max-width: 820px;
    margin: 0 auto 24px;
}

.page-head h2 {
    margin: 0 0 6px;
    font-size: 36px;
    font-weight: 400;
}

.page-head p {
    margin: 0;
    color: var(--muted);
}

.post-feed {
    display: grid;
    gap: 24px;
    max-width: 820px;
    margin: 0 auto;
}

.post-card {
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.post-card-image {
    display: block;
    aspect-ratio: 16 / 6;
    margin: 24px 24px 0;
    overflow: hidden;
    background: var(--soft);
    border-radius: 4px;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: #fff;
    background: linear-gradient(135deg, #111827, #4b5563);
    font-size: 28px;
    font-weight: 800;
}

.post-card-body {
    padding: 22px 36px 26px;
}

.post-card h2 {
    margin: 0 0 12px;
    font-size: 24px;
    line-height: 1.45;
    font-weight: 500;
}

.post-card h2 a:hover {
    color: #111827;
}

.pin {
    display: inline-block;
    margin-right: 8px;
    padding: 2px 8px;
    color: #fff;
    background: var(--danger);
    border-radius: 3px;
    font-size: 13px;
    line-height: 1.4;
    vertical-align: middle;
}

.post-card p {
    margin: 0 0 20px;
    color: #8a9099;
    font-size: 15px;
}

.post-card footer {
    display: flex;
    gap: 16px;
    padding-top: 18px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: 13px;
}

.right-panel {
    padding: 28px 28px 0;
    background: var(--panel-bg);
    border-left: 1px solid var(--line);
}

.panel-tabs {
    display: flex;
    gap: 38px;
    align-items: flex-end;
    height: 44px;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
}

.panel-tabs span {
    display: block;
    padding-bottom: 12px;
    font-size: 15px;
}

.panel-tabs .active {
    color: var(--text);
    border-bottom: 3px solid var(--accent);
}

.hot-list {
    display: grid;
    gap: 20px;
    padding-top: 20px;
}

.hot-list a {
    display: grid;
    gap: 6px;
    color: #868c95;
}

.hot-list a:hover {
    color: var(--text);
}

.hot-list strong {
    display: -webkit-box;
    overflow: hidden;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.65;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.hot-list small {
    color: #a5abb3;
}

.post-template .site-frame {
    max-width: none;
    box-shadow: none;
}

.post-template .topbar {
    height: 56px;
    grid-template-columns: 280px minmax(260px, 420px) 1fr;
    padding: 0 34px;
}

.post-template .topbar-brand {
    font-size: 24px;
}

.doc-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    min-height: calc(100vh - 56px);
    background: #fff;
}

.doc-outline {
    position: sticky;
    top: 56px;
    align-self: start;
    height: calc(100vh - 56px);
    padding: 26px 22px 36px 30px;
    overflow: auto;
    border-right: 1px solid var(--line);
    background: #fff;
}

.doc-back {
    display: inline-flex;
    margin-bottom: 22px;
    color: #6b7280;
    font-size: 13px;
}

.doc-back:hover {
    color: #111827;
}

.doc-outline strong {
    display: block;
    margin-bottom: 14px;
    color: #111827;
    font-size: 14px;
}

#doc-toc {
    display: grid;
    gap: 4px;
}

#doc-toc a,
.doc-toc-empty {
    display: block;
    padding: 5px 8px;
    overflow: hidden;
    color: #667085;
    border-radius: 5px;
    font-size: 13px;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#doc-toc a:hover,
#doc-toc a.is-active {
    color: #1d4ed8;
    background: #eff6ff;
}

#doc-toc .toc-h3 {
    padding-left: 20px;
}

#doc-toc .toc-h4 {
    padding-left: 32px;
    color: #98a2b3;
}

.doc-content-area {
    padding: 42px 7vw 96px;
    background: #fff;
}

.doc-article {
    max-width: 900px;
    margin: 0 auto;
}

.post-template .article-header {
    padding-bottom: 24px;
    border-bottom: 0;
}

.post-template .article-header h1 {
    margin-bottom: 10px;
    font-size: 36px;
    line-height: 1.25;
    font-weight: 700;
}

.post-template .article-meta {
    color: #8590a2;
    font-size: 13px;
}

.doc-cover {
    margin: 12px 0 30px;
    border-radius: 8px;
}

.doc-body {
    padding-top: 10px;
    color: #1f2937;
    font-size: 16px;
    line-height: 1.82;
}

.doc-body h2,
.doc-body h3,
.doc-body h4 {
    scroll-margin-top: 80px;
}

.doc-body h2 {
    margin: 2em 0 0.85em;
    color: #111827;
    font-size: 26px;
    font-weight: 700;
}

.doc-body h3 {
    margin: 1.65em 0 0.75em;
    color: #111827;
    font-size: 21px;
    font-weight: 700;
}

.doc-body h4 {
    margin: 1.35em 0 0.65em;
    color: #111827;
    font-size: 18px;
    font-weight: 700;
}

.doc-body p,
.doc-body ul,
.doc-body ol,
.doc-body blockquote {
    margin-bottom: 0.95em;
}

.doc-body blockquote {
    padding: 10px 0 10px 16px;
    color: #344054;
    border-left: 3px solid #2f6df6;
    background: transparent;
}

.post-template .article-content a {
    color: #2563eb;
    font-weight: 600;
}

.post-template .article-content a:hover {
    color: #1d4ed8;
}

.doc-body img {
    margin: 1.25em auto;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
}

.doc-body > figure img,
.doc-body > p > img,
.doc-body .kg-image-card img {
    width: auto;
    max-width: 100%;
}

.doc-body table {
    margin: 1.15em 0 1.5em;
    border-color: #dbe3f0;
}

.doc-body th,
.doc-body td {
    padding: 10px 12px;
    border-color: #dbe3f0;
}

.article {
    max-width: 860px;
    margin: 0 auto;
    background: #fff;
}

.article-cover {
    margin: 0 0 26px;
    overflow: hidden;
    border-radius: 6px;
}

.article-cover img {
    width: 100%;
}

.article-header {
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}

.article-header h1 {
    margin: 0 0 14px;
    font-size: 36px;
    line-height: 1.3;
    font-weight: 500;
}

.article-meta {
    display: flex;
    gap: 16px;
    color: var(--muted);
    font-size: 14px;
}

.article-content {
    padding-top: 28px;
    font-size: 17px;
}

.article-content a {
    color: #e11d48;
    text-decoration: underline;
    text-underline-offset: 3px;
    word-break: break-word;
}

.article-content a:hover {
    color: #be123c;
}

.article-content p,
.article-content ul,
.article-content ol,
.article-content blockquote {
    margin: 0 0 1.2em;
}

.article-content strong,
.article-content b {
    font-weight: 700;
}

.article-content h2,
.article-content h3,
.article-content h4 {
    margin: 1.7em 0 0.75em;
    line-height: 1.35;
}

.article-content h2 {
    font-size: 26px;
}

.article-content h3 {
    font-size: 22px;
}

.article-content h4 {
    font-size: 19px;
}

.article-content img {
    margin: 1.5em auto;
    border-radius: 6px;
}

.article-content table {
    display: table;
    width: 100% !important;
    max-width: 100%;
    margin: 1.5em 0;
    border-collapse: collapse;
    table-layout: auto;
    background: #fff;
    font-size: 15px;
}

.article-content col,
.article-content colgroup {
    width: auto !important;
}

.article-content th,
.article-content td {
    min-width: 160px;
    padding: 12px 14px;
    border: 1px solid #d9e0ea;
    vertical-align: top;
    word-break: break-word;
}

.article-content th {
    background: #f3f6fb;
    font-weight: 700;
}

.article-content td[style],
.article-content th[style] {
    width: auto !important;
}

.article-content td p,
.article-content th p {
    margin-bottom: 0.75em;
}

.article-content td img,
.article-content th img {
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0.35em auto;
}

.article-content figure,
.article-content .kg-image-card {
    margin: 1.7em auto;
}

.article-content img.is-zoomable {
    cursor: zoom-in;
}

.has-lightbox {
    overflow: hidden;
}

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    place-items: center;
    padding: 28px;
    background: rgba(10, 12, 16, 0.82);
}

.image-lightbox.is-open {
    display: grid;
}

.image-lightbox img {
    max-width: min(1180px, 96vw);
    max-height: 92vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5);
}

.image-lightbox button {
    position: fixed;
    top: 22px;
    right: 24px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

.article-content .kg-width-wide {
    width: min(1040px, calc(100vw - 48px));
    max-width: none;
    margin-left: 50%;
    transform: translateX(-50%);
}

.article-content .kg-width-full {
    width: min(1180px, calc(100vw - 24px));
    max-width: none;
    margin-left: 50%;
    transform: translateX(-50%);
}

.article-content .kg-width-wide img,
.article-content .kg-width-full img {
    width: 100%;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    max-width: 820px;
    margin: 28px auto 0;
    color: var(--muted);
}

.pagination a {
    padding: 8px 14px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.page-number {
    font-size: 14px;
}

.error-page {
    display: grid;
    place-items: center;
    min-height: 55vh;
    color: var(--muted);
    text-align: center;
}

.error-page strong {
    color: #cbd5df;
    font-size: 112px;
    line-height: 1;
}

.error-page h1 {
    margin: 8px 0 4px;
    color: var(--text);
    font-size: 28px;
    font-weight: 500;
}

.error-page p {
    margin: 0 0 16px;
}

.error-page a {
    color: #2563eb;
}

.tag-grid,
.archive-list {
    display: grid;
    gap: 14px;
    max-width: 820px;
    margin: 0 auto;
}

.tag-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.tag-card,
.archive-list a {
    display: grid;
    gap: 4px;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.tag-card:hover,
.archive-list a:hover {
    border-color: #cfd3d8;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.tag-card strong,
.archive-list strong {
    font-size: 17px;
    font-weight: 500;
}

.tag-card span,
.archive-list span {
    color: var(--muted);
    font-size: 13px;
}

.post-template .doc-article {
    max-width: 900px;
}

.post-template .doc-body h2 {
    margin: 2em 0 0.85em;
    color: #111827;
    font-size: 26px;
    font-weight: 700;
}

.post-template .doc-body h3 {
    margin: 1.65em 0 0.75em;
    color: #111827;
    font-size: 21px;
    font-weight: 700;
}

.post-template .doc-body h4 {
    margin: 1.35em 0 0.65em;
    color: #111827;
    font-size: 18px;
    font-weight: 700;
}

.post-template .doc-body p,
.post-template .doc-body ul,
.post-template .doc-body ol,
.post-template .doc-body blockquote {
    margin-bottom: 0.95em;
}

@media (max-width: 1180px) {
    .topbar {
        grid-template-columns: 220px minmax(220px, 1fr);
    }

    .layout {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .right-panel {
        display: none;
    }

    .post-template .topbar {
        grid-template-columns: 220px minmax(220px, 1fr);
    }

    .doc-layout {
        grid-template-columns: 240px minmax(0, 1fr);
    }

    .doc-outline {
        padding-left: 22px;
    }

    .doc-content-area {
        padding-right: 36px;
        padding-left: 36px;
    }
}

@media (max-width: 760px) {
    .site-frame {
        box-shadow: none;
    }

    .topbar {
        grid-template-columns: 1fr;
        gap: 12px;
        height: auto;
        padding: 14px 16px;
    }

    .topbar-brand {
        justify-content: center;
        font-size: 22px;
    }

    .layout {
        display: block;
    }

    .profile-panel {
        padding: 22px 18px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .profile-mark {
        width: 88px;
        height: 88px;
    }

    .side-nav {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
        padding-top: 16px;
    }

    .side-nav span {
        display: none;
    }

    .side-nav a {
        padding: 8px 4px;
        text-align: center;
        font-size: 14px;
    }

    .content-area {
        padding: 22px 14px 44px;
    }

    .page-head h2 {
        font-size: 28px;
    }

    .post-card-image {
        aspect-ratio: 16 / 9;
        margin: 12px 12px 0;
    }

    .post-card-body {
        padding: 16px 18px 20px;
    }

    .post-card h2,
    .article-header h1 {
        font-size: 22px;
    }

    .post-card footer,
    .article-meta {
        flex-wrap: wrap;
    }

    .article-content table {
        display: block;
        overflow-x: auto;
        white-space: normal;
    }

    .article-content th,
    .article-content td {
        min-width: 150px;
    }

    .post-template .topbar {
        display: grid;
        grid-template-columns: 1fr;
        height: auto;
        padding: 12px 14px;
    }

    .doc-layout {
        display: block;
    }

    .doc-outline {
        position: static;
        height: auto;
        max-height: 210px;
        padding: 14px 16px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .doc-back {
        margin-bottom: 10px;
    }

    .doc-content-area {
        padding: 24px 18px 56px;
    }

    .post-template .article-header h1 {
        font-size: 28px;
    }

    .post-template .doc-body h2 {
        font-size: 23px;
    }

    .post-template .doc-body h3 {
        font-size: 20px;
    }
}
