.post-main-container {
    margin: 0 auto;
    padding: 60px 20px;
}

.post-layout-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    max-width: 1150px;
    margin: 0 auto;
    padding: 0 20px;
}

.post-render {
    flex: 1;
    min-width: 0;
    max-width: 800px;
    margin: 0;

    padding: 50px 60px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* --- 文章头部 --- */
.post-nav-top {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 25px;
}

.post-nav-top a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.post-nav-top a:hover {
    color: var(--accent);
}

.post-nav-top .sep {
    margin: 0 8px;
    opacity: 0.4;
}

.post-header {
    margin-bottom: 40px;
}

.post-title {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1.3;
    color: var(--text-main);
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.meta-item i {
    margin-right: 4px;
    vertical-align: baseline;
    opacity: 0.8;
}

/* --- 正文 Markdown 渲染 --- */
.post-content {
    font-size: 1.1rem;
    line-height: 1.9;
    color: #334155;
    word-wrap: break-word;
}

/* 标题 */
.post-content h1,
.post-content h2,
.post-content h3 {
    color: var(--text-main);
    margin: 2.5em 0 1.2em;
    font-weight: 700;
}

.post-content h2 {
    font-size: 1.8rem;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 10px;
}

.post-content h3 {
    font-size: 1.45rem;
}

/* 段落与列表 */
.post-content p {
    margin-bottom: 1.6em;
}

.post-content ul,
.post-content ol {
    margin-bottom: 1.6em;
    padding-left: 1.5em;
}

.post-content li {
    margin-bottom: 0.6em;
}

/* 单行代码 */
code:not([class]) {
    background-color: #f3f6f9;
    color: #e83e8c;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    margin: 0 2px;
    border: 1px solid #e1e4e8;
}

/* 引用块 */
.post-content blockquote {
    margin: 2.5em 0;
    padding: 1.2rem 1.8rem;
    background: #f8fafc;
    border-left: 5px solid var(--accent);
    border-radius: 6px;
    color: #475569;
}

.post-content blockquote p {
    margin-bottom: 0;
}

/* 图片 */
.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 0 auto;
    display: block;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

/* 链接 */
.post-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1.5px solid rgba(52, 152, 219, 0.2);
    transition: all 0.2s;
}

.post-content a:hover {
    border-bottom-color: var(--accent);
    background: rgba(52, 152, 219, 0.05);
}

/* --- 页脚 --- */
.post-footer {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid #f1f5f9;
}

.post-tags a {
    display: inline-block;
    padding: 5px 15px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-right: 10px;
    text-decoration: none;
    transition: all 0.2s;
}

.post-tags a:hover {
    background: var(--accent);
    color: #fff;
}

.post-copyright {
    margin-top: 30px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.post-copyright p {
    margin: 5px 0;
}

.post-content table {
    display: table !important;
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 2rem 0 !important;
    border: 1px solid #eef2f7 !important;
    background-color: #fff !important;
    border-radius: 8px !important;
    overflow: hidden !important;

    border-spacing: 0; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.post-content table thead th {
    background-color: #f4f7ff !important;
    color: #445566 !important;
    font-weight: 600 !important;
    padding: 12px 15px !important;
    border-bottom: 2px solid #e2e8f0 !important;
    text-align: left !important;
}

.post-content table td {
    padding: 12px 15px !important;
    border-bottom: 1px solid #f0f2f5 !important;
    color: #556677 !important;
    font-size: 0.95rem !important;
    line-height: 1.5;
}

.post-content table tr:nth-child(even) {
    background-color: #fafbfc !important;
}

.post-content table tr:hover {
    background-color: #f1f5ff !important;
}

@media screen and (max-width: 768px) {
    .post-content table {
        display: block !important;
        overflow-x: auto !important;
        white-space: nowrap;
    }
}

/* --- 相邻文章 --- */
.post-near {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 40px;
}

.near-item {
    background: #f8fafc;
    padding: 20px;
    border-radius: var(--radius);
    text-decoration: none;
    transition: all 0.2s;
}

.near-item:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
}

.near-item .label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.near-item a {
    color: var(--text-main);
    font-weight: 600;
    text-decoration: none;
}

.near-item.next {
    text-align: right;
}

/* --- 移动端适配 --- */
@media (max-width: 768px) {
    .post-main-container, .post-layout-container {
        padding: 0;
    }

    .post-render {
        padding: 40px 20px;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .post-title {
        font-size: 1.8rem;
    }

    .post-near {
        grid-template-columns: 1fr;
    }
}


/* 目录 */
.post-toc-wrapper {
    width: 250px;
    position: sticky;
    top: 100px;
    flex-shrink: 0;
}

.post-toc {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

.toc-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.toc-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-content li {
    margin: 8px 0;
    line-height: 1.4;
}

.toc-content li a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
    display: block;
}

.toc-content li a:hover,
.toc-content li.active a {
    color: var(--accent);
    padding-left: 5px;
}

@media (max-width: 1100px) {
    .post-toc-wrapper {
        display: none;
    }

    .post-render {
        max-width: 860px;
        margin: 0 auto;
    }
}


/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    color: #4a90e2;
    border: 1px solid #eef2f7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 999;
    /* 默认隐藏 */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.back-to-top:hover {
    background-color: #4a90e2;
    color: #fff;
    transform: translateY(-3px);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}