.post-content img,pre {
    max-width: 100%
}

pre,textarea {
    overflow: auto
}

.alert a,a,h1,header a {
    text-decoration: none
}

#footer,.center {
    text-align: center
}

.post-item,ol.comment-list {
    list-style: none
}

.alert a,.comment-head,cite.fn {
    font-weight: 700
}

* {
    padding: 0;
    margin: 0;
    border: none;
    outline: 0
}

body {
    font-family: "Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif;
    font-size: 16px;
    color: #39434d;
    letter-spacing: .3px
}

#container {
    max-width: 1200px;
    width: 90%;
    margin: 1.5em auto;
    display: block;
    padding: 3%
}

#main {
    position: relative;
    max-width: 720px;
    margin: 0 auto;
    padding: 0;
    margin-bottom: 1em;
}

header {
    padding: .3em 0;
    margin: 0 auto;
    max-width: 720px;
}

/* 主页的header样式 */
#main > header {
    border-bottom: 1px solid #d8dadc;
}

/* 文章页的header样式 */
.article-container + header,
.content > header {
    border-bottom: none !important;
}

h1 {
    font-size: 1.7em;
    margin: 0.5em 0 0.2em;
    text-align: left;
}

/* 文章页标题样式 */
.post-title {
    font-size: 1.7em;
    margin: 0.5em 0 0.2em;
    text-align: center;
    border-bottom: none;
}

header a {
    color: #0e1a26;
}

header a:hover {
    color: #32393f
}

a {
    color: #747677
}

a.img,a.img:hover {
    border: 0!important
}

.slash {
    padding: 0 8px
}

#footer a:hover,.post a:hover {
    color: #32393f;
}

ul.post-list {
    padding: .7em 0
}

li {
    padding: .2em 0
}

.post-meta {
    text-align: center;
    color: #8796a3;
    font-size: 0.9em;
    margin: 0.5em 0 1em;
}

.post-meta,.post-meta a {
    color: #8796a3
}

p {
    margin: 1em 0;
    line-height: 1.7;
}

h3 {
    margin: 1em 0 .7em
}

h4 {
    font-size: 1.1em;
    margin: 1em 0 .7em
}

blockquote {
    color: #3e4246;
    border-left: 4px solid #71797f;
    padding-left: 1em;
    margin: .7em 0
}

.post-content a {
    border-bottom: 1px solid #747677
}

.post-content hr {
    margin: 1em auto;
    width: 100px;
    border: 1px solid #b2bCC4;
    border-width: 2px 0 0
}

.post-content ul {
    padding: 0 2em;
    margin: .7em 0
}

.post-content li {
    padding: 0
}

code,kbd,tt,var {
    font-size: .92857em;
    font-family: "Lucida Console",Consolas,"DejaVu Sans Mono",monospace;
    color: #C13;
    padding: 2px 6px;
    background: #f3f3f0;
    word-break: break-word
}

pre {
    background: #f3f3f0;
    font-size: 15px;
    margin-bottom: .5em;
    padding: 1em;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
}

pre code {
    padding: 0;
    display: block;
    overflow-x: auto;
    font-family: "Lucida Console", Consolas, "DejaVu Sans Mono", monospace;
    line-height: 1.5;
}

.copy-button {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    background: #e0e0e0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    transition: all 0.3s ease;
    opacity: 0;
}

pre:hover .copy-button {
    opacity: 1;
}

.copy-button:hover {
    background: #d0d0d0;
    color: #333;
}

.copy-button.copied {
    background: #4CAF50;
    color: white;
}

.pagenav {
    width: 100%;
    margin: 1.5em auto;
    text-align: center;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    clear: both; /* 确保不会与其他元素并排 */
}

.prev-page a, .next-page a {
    padding: 5px 10px;
    background-color: #f5f5f5;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.prev-page a:hover, .next-page a:hover {
    background-color: #32393f;
    color: #fff;
    text-decoration: none;
}

.page-nav-item {
    position: relative;
    min-width: 80px;
}

@media (prefers-color-scheme: dark) {
    .prev-page a, .next-page a {
        background-color: #2d2d2d;
        color: #e6e6e6;
    }
    
    .prev-page a:hover, .next-page a:hover {
        background-color: #444;
        color: #fff;
    }
}

#footer {
    margin-top: 1em;
    font-size: 14px
}

nav {
    text-align: center;
    margin: 0 auto;
    max-width: 720px;
}

nav a {
    margin: 0 5px;
    display: inline-block;
}

.license {
    font-size: 12px
}

input, textarea {
    padding: 5px 0;
    font-family: inherit;
    font-size: 15px;
}

input:not([type='button']):not([type='submit']), textarea {
    border-bottom: 1px solid #d8dadc
}

textarea {
    width: 100%;
    height: auto;
    resize: vertical
}

input:not([type='button']):not([type='submit']):focus,textarea:focus {
    border-bottom: 1px solid #a4a9ad
}

input#author,input#mail,input#url {
    width: 32.8%
}

input.button,input.submit {
    color: #fff;
    padding: 5px;
    background-color: #575d61;
    text-transform: uppercase
}

input.button:hover,input.submit:hover {
    background-color: #7c8184
}

.alert {
    margin: 1em 0;
    padding: 4px 8px;
    border-radius: 0
}

.alert a {
    border: 0
}

.alert>p,.alert>ul {
    margin-bottom: 0
}

.alert>p+p {
    margin-top: 5px
}

.success {
    color: #159756;
    border: 1px solid #159756
}

.info {
    color: #1d6fee;
    border: 1px solid #1d6fee
}

.warning {
    color: #fdba2c;
    border: 1px solid #fdba2c
}

.danger {
    color: #da4733;
    border: 1px solid #da4733
}

#comments a:hover {
    color: #32393f;
    border-bottom: 1px solid #32393f
}

.comment-head {
    font-size: 1.17em;
    font-style: italic;
    margin: 1.5em 0 0
}

li.comment-parent {
    padding: .5em 0;
    border-top: 1px dashed #ddd
}

li.comment-child {
    padding: 0
}

p.comment-user-info {
    margin-bottom: .5em
}

cite.fn {
    font-style: normal
}

span.comment-author cite,span.comment-author cite a {
    color: #444b50
}

span.author cite,span.author cite a {
    color: #506986
}

span.user cite,span.user cite a {
    color: #455a64
}

.comment-list p {
    display: inline;
}

.comment-list p.comment-user-info {
    display: block;
    margin-bottom: .5em
}

.comment-children {
    margin-left: 1.5em
}

.comment-meta {
    font-size: 0.9em;
    color: #8796a3;
    margin: 0.3em 0;
    user-select: none;
}

.comment-date {
    color: #8796a3;
    font-size: 0.9em;
}

.cancel-comment-reply a,.comment-reply a {
    font-size: 14px;
    font-style: normal;
    padding: 0 5px
}

.cancel-comment-reply a:hover,.comment-reply a:hover {
    background-color: #32393f;
    color: #fff!important
}

.comment-button {
    text-align: right;
    display: block!important;
    margin-bottom: 1em!important
}

@media screen and (max-width:768px) {
    input#author,input#mail,input#url {
        width: 100%
    }

    input#author,input#mail {
        margin-bottom: 5px
    }
    
    .page-nav-item {
        min-width: 60px;
    }
    
    .prev-page.page-nav-item::before,
    .next-page.page-nav-item::after {
        font-size: 1em;
    }
    
    /* 确保移动设备上评论内容正确显示 */
    .comment-item {
        padding: 10px;
    }
    
    /* 减小移动设备上底部导航的间距 */
    #footer {
        margin-top: 0.8em;
    }
    
    #container {
        padding: 2%;
        margin: 1em auto;
    }
    
    /* 改进移动设备上的评论布局 */
    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3em;
    }
    
    .comment-date {
        margin-left: 0;
    }

    /* 移动设备上评论表单宽度控制 */
    .comment-form {
        width: 100%;
        overflow: hidden;
    }
    
    .comment-form-content {
        width: 100%;
        margin-top: 8px;
    }
    
    .comment-form-content textarea {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin-top: 0;
    }
    
    .comment-form-submit {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        margin-top: 1em;
        box-sizing: border-box;
    }
    
    .submit-button {
        width: auto;
        padding: 8px 16px;
    }
}

@media (prefers-color-scheme: dark) {
    body {
        background-color: #212121;
        color: #f0f2f4
    }

    header {
        padding: .3em 0;
        border-bottom: 1px solid #798086
    }

    header a {
        color: #dae6f1
    }
    
    header a:hover {
        color: #b8c0c7
    }
    
    a {
        color: #cbcdcd
    }

    #footer a:hover,.post a:hover {
        color: #f1f2f4;
    }

    .post-meta,.post-meta a {
        color: #a9b3bc
    }

    blockquote {
        color: #bbbfc3;
        border-left: 4px solid #aeb3b7
    }
    
    .post-content a {
        border-bottom: 1px solid #cbcdcd
    }
    
    .post-content hr {
        border: 1px solid #434d56
    }

    code,kbd,tt,var {
        color: #f5899d;
        background: #39392d
    }
    
    pre {
        background: #39392d
    }

    .pagenav a:hover {
        background-color: #f1f2f4;
        color: #333
    }

    input:not([type='button']):not([type='submit']), textarea {
        color: #fff;
        background-color: #212121;
        border-bottom: 1px solid #798086
    }

    input:not([type='button']):not([type='submit']):focus,textarea:focus {
        border-bottom: 1px solid #c9cccf
    }
    
    input.button,input.submit {
        color: #212121;
        background-color: #bcc0c2;
    }

    input.button:hover,input.submit:hover {
        background-color: #a3a6a8
    }

    .success {
        color: #62eaa6;
        border: 1px solid #62eaa6
    }
    
    .info {
        color: #88b4f6;
        border: 1px solid #88b4f6
    }
    
    .warning {
        color: #fed681;
        border: 1px solid #fed681
    }
    
    .danger {
        color: #e78c7e;
        border: 1px solid #e78c7e
    }

    #comments a:hover {
        color: #f1f2f4;
        border-bottom: 1px solid #f1f2f4
    }

    li.comment-parent {
        border-top: 1px dashed #555
    }

    span.comment-author cite,span.comment-author cite a {
        color: #acb4b9
    }
    
    span.author cite,span.author cite a {
        color: #9fb1c6
    }
    
    span.user cite,span.user cite a {
        color: #96acb6
    }

    .cancel-comment-reply a:hover,.comment-reply a:hover {
        background-color: #f1f2f4;
        color: #333!important
    }

    .post-item a:hover {
        color: #f0f2f4;
    }

    .site-description {
        color: #a9b3bc;
    }

    #main > header {
        border-bottom: 1px solid #798086;
    }
    .article-container + header,
    .content > header {
        border-bottom: none !important;
    }

    .post-item a::after {
        background-color: #f0f2f4;
    }

    .comment-date {
        color: #a9b3bc;
    }
}

/* 文章布局样式 */
/* 基本内容容器样式 */
.content {
    position: relative;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 0;
    /* 首页布局 - 默认垂直布局 */
    display: flex;
    flex-direction: column;
}

/* 文章详情页布局 - 水平布局 */
.content-with-toc {
    display: flex;
    flex-direction: row;
    gap: 30px;
    align-items: flex-start;
    max-width: none;
    justify-content: center;
    padding-right: 310px; /* 为目录预留空间 */
}

.article-container {
    flex: 0 1 720px;
    min-width: 0;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.post {
    width: 100%;
}

/* 文章目录样式 */
.toc-container {
    position: fixed !important;
    top: 200px; /* 增加顶部距离，与文章标题完全对齐 */
    right: calc(50% - 360px - 310px); /* 根据文章宽度和间距计算位置 */
    width: 280px;
    max-height: calc(100vh - 220px); /* 调整最大高度 */
    overflow-y: auto;
    background: transparent;
    padding: 15px;
    border-radius: 0;
    border-left: none;
    flex-shrink: 0;
    z-index: 100; /* 确保目录在评论框上方 */
    pointer-events: none; /* 不干扰底层元素的交互 */
}

.toc-title {
    font-size: 1.1em;
    font-weight: normal;
    margin-bottom: 10px;
    color: #39434d;
    position: sticky;
    top: 0;
    background: transparent;
    padding-bottom: 10px;
    border-bottom: 1px solid #d8dadc;
    pointer-events: auto; /* 允许标题点击 */
}

#toc {
    font-size: 14px;
    line-height: 1.7;
    pointer-events: auto; /* 允许目录点击 */
}

#toc ul {
    list-style: none;
    padding-left: 15px;
    margin: 0;
}

#toc li {
    margin: 5px 0;
}

#toc a {
    color: #747677;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
    padding: 2px 0;
    position: relative;
    opacity: 1;
    white-space: nowrap;
}

#toc a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: 0;
    left: 0;
    background-color: #32393f;
    transition: width 0.3s ease;
}

#toc a:hover {
    color: #32393f;
    transform: translateX(5px);
    opacity: 0.7;
}

#toc a:hover::after {
    width: 100%;
}

#toc .toc-h1 { margin-left: 0; }
#toc .toc-h2 { margin-left: 1em; }
#toc .toc-h3 { margin-left: 2em; }
#toc .toc-h4 { margin-left: 3em; }
#toc .toc-h5 { margin-left: 4em; }
#toc .toc-h6 { margin-left: 5em; }

/* 响应式布局 */
@media screen and (max-width: 768px) {
    .content, .content-with-toc {
        flex-direction: column;
        padding-right: 0;
    }
    
    .toc-container {
        position: static !important;
        width: 100%;
        max-height: none;
        margin-bottom: 20px;
        z-index: auto; /* 在移动设备上不需要z-index */
        pointer-events: auto; /* 在移动设备上恢复正常交互 */
    }
    
    /* 评论区域在移动设备上的调整 */
    .comments-area,
    .guestbook-comments {
        max-width: 100%;
        width: 100%;
        z-index: auto; /* 在移动设备上不需要z-index */
    }
}

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
    .toc-container {
        background: #212121;
        border-left-color: #798086;
    }
    
    .toc-title {
        background: #212121;
        color: #f0f2f4;
        border-bottom-color: #798086;
    }
    
    #toc a {
        color: #cbcdcd;
    }
    
    #toc a::after {
        background-color: #f1f2f4;
    }
    
    #toc a:hover {
        color: #f1f2f4;
    }
}

/* 主页文章列表样式 */
.content .post {
    width: 100%;
    margin: 0; /* 移除外边距 */
}

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

.post-item {
    padding: .1em 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.post-item + .post-item {
    margin-top: 0.1em;
}

.post-item a {
    color: #1a1a1a;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    padding: 1px 0;
    opacity: 1;
    white-space: nowrap;
}

.post-item a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: 0;
    left: 0;
    background-color: #f0f2f4;
    transition: width 0.3s ease;
}

.post-item a:hover {
    color: #000;
    border-bottom: 1px solid #000;
}

.post-item time {
    color: #8796a3;
    font-size: 0.9em;
    white-space: nowrap;
    flex: 0 0 auto;
}

.post-meta {
    margin: .5em 0 0;
}

.site-description {
    color: #8796a3;
    font-size: 1em;
    margin: 0 0 0.5em;
    font-style: italic;
    text-align: left;
}

/* 评论列表样式 */
.comment-list {
    list-style: none;
    padding: 0;
    margin: 2em 0;
}

.comment-list p {
    margin: 0.5em 0;
    line-height: 1.6;
}

.comment-head {
    font-size: 1.1em;
    font-weight: normal;
    margin: 1.5em 0 0.5em;
    color: #39434d;
}

.comment-meta {
    font-size: 0.9em;
    color: #8796a3;
    margin: 0.3em 0;
}

.comment-children {
    margin-left: 2em;
    padding-left: 1em;
    border-left: 2px solid #d8dadc;
}

.comment-reply a {
    color: #8796a3;
    font-size: 0.9em;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    padding: 2px 0;
    opacity: 1;
}

.comment-reply a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: 0;
    left: 0;
    background-color: #32393f;
    transition: width 0.3s ease;
}

.comment-reply a:hover {
    color: #32393f;
    transform: translateX(5px);
    opacity: 0.7;
}

.comment-reply a:hover::after {
    width: 100%;
}

@media (prefers-color-scheme: dark) {
    .comment-head {
        color: #f0f2f4;
    }
    
    .comment-meta {
        color: #a9b3bc;
    }
    
    .comment-children {
        border-left-color: #798086;
    }
    
    .comment-reply a {
        color: #a9b3bc;
    }
    
    .comment-reply a::after {
        background-color: #f1f2f4;
    }
    
    .comment-reply a:hover {
        color: #f1f2f4;
    }
}

@media (prefers-color-scheme: dark) {
    .post-item a {
        color: #f0f2f4;
    }
    
    .post-item a:hover {
        color: #fff;
        border-bottom: 1px solid #fff;
    }
}

/* 页面模板样式 */
.button {
    display: inline-block;
    padding: 8px 16px;
    background-color: #333;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.button:hover {
    background-color: #555;
}

.category-list {
    margin: 20px 0;
}

.category-item {
    margin: 10px 0;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.category-item a {
    color: #333;
    text-decoration: none;
}

.category-item a:hover {
    color: #666;
}

.archive-list {
    margin: 20px 0;
}

.archive-item {
    margin: 10px 0;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.archive-date {
    color: #666;
    margin-right: 10px;
}

.archive-item a {
    color: #333;
    text-decoration: none;
}

.archive-item a:hover {
    color: #666;
}

/* 评论区域样式优化 */
.comments-area,
.guestbook-comments {
    margin: 0.5em 0; /* 减小上下边距 */
    padding: 0.5em 0; /* 减小上下内边距 */
    border-top: 1px solid #eee;
    max-width: 720px; /* 设置与文章内容相同的宽度 */
    overflow-x: hidden;
    box-sizing: border-box;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    position: relative; /* 添加相对定位 */
    z-index: 50; /* 确保评论区有合适的层级 */
}

.comments-title, .response-title {
    font-size: 1.2em;
    font-weight: normal;
    margin: 1em 0;
    color: #39434d;
}

.comment-list {
    list-style: none;
    padding: 0;
    margin: 2em 0;
}

.comment-item {
    padding: 1em;
    border-radius: 8px;
    background-color: #f9f9f9;
    margin-bottom: 1em;
    transition: all 0.3s ease;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-break: break-word;
    overflow: hidden;
}

.comment-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5em;
    flex-wrap: wrap;
}

.comment-author {
    font-weight: 500;
    color: #39434d;
    font-size: 1.5em;
}

.comment-author.author {
    color: #506986;
}

.comment-author.user {
    color: #455a64;
}

.comment-date {
    font-size: 0.85em;
    color: #8796a3;
}

.pending {
    color: #da4733;
    font-size: 0.85em;
    margin-left: 0.5em;
}

.comment-content {
    line-height: 1.6;
    margin: 0.5em 0;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    overflow-x: auto;
}

.comment-footer {
    text-align: right;
    margin-top: 0.5em;
}

.comment-reply a {
    color: #8796a3;
    font-size: 0.9em;
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 3px 8px;
    border-radius: 4px;
    background-color: #f1f1f1;
}

.comment-reply a:hover {
    color: #fff;
    background-color: #32393f;
}

.comment-children {
    margin-left: 2em;
    padding-left: 1em;
    border-left: 2px solid #e0e0e0;
}

/* 评论表单样式 */
.comment-form {
    margin: 1.5em 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* 防止内容溢出 */
    position: relative; /* 添加相对定位 */
    z-index: 50; /* 设置z-index比目录低 */
}

.comment-form-author {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1em;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* 防止内容溢出 */
}

.comment-form-author input {
    flex: 1;
    min-width: 150px;
    max-width: calc(33.33% - 7px);
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.comment-form-author input:focus {
    border-color: #506986;
    outline: none;
}

.comment-form-content {
    width: 100%;
    margin-bottom: 1em;
    box-sizing: border-box;
    overflow: hidden; /* 防止内容溢出 */
}

.comment-form-content textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    min-height: 100px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    display: block;
    overflow-x: hidden;
    max-width: 100%; /* 确保不超过父容器 */
}

.comment-form-content textarea:focus {
    border-color: #506986;
    outline: none;
}

.comment-form-submit {
    display: flex;
    justify-content: flex-end;
    margin-top: 1em;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* 防止按钮区域溢出 */
}

.submit-button {
    padding: 8px 16px;
    background-color: #506986;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-button:hover {
    background-color: #39434d;
}

.submit-tip {
    font-size: 0.85em;
    color: #8796a3;
}

.logged-in-as {
    margin-bottom: 1em;
    padding: 8px 12px;
    background-color: #f9f9f9;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* 防止内容溢出 */
}

.logout {
    margin-left: 0.5em;
}

.comment-closed {
    padding: 1em;
    background-color: #f9f9f9;
    border-radius: 4px;
    color: #8796a3;
    text-align: center;
}

/* 确保留言板和评论区域的样式一致 */
.guestbook-comments .comment-form,
.comments-area .comment-form {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.comments-area {
    max-width: 720px; /* 限制评论区域最大宽度与文章内容一致 */
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    position: relative; /* 添加相对定位 */
    z-index: 50; /* 确保评论区有合适的层级 */
}

.guestbook-comments .comment-form-author,
.comments-area .comment-form-author {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between; /* 确保子元素均匀分布 */
}

.guestbook-comments .comment-form-author input,
.comments-area .comment-form-author input {
    flex: 1;
    min-width: 150px;
    max-width: calc(33.33% - 7px);
    box-sizing: border-box;
    width: calc(33.33% - 7px); /* 确保固定宽度 */
}

@media screen and (max-width: 768px) {
    .comment-form-author {
        flex-direction: column;
        gap: 8px;
    }
    
    .comment-form-author input {
        width: 100%;
        max-width: 100%;
        margin-bottom: 8px;
    }
    
    input#author,
    input#mail,
    input#url {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .guestbook-comments .comment-form-author,
    .comments-area .comment-form-author {
        flex-direction: column;
        gap: 8px;
    }
    
    .guestbook-comments .comment-form-author input,
    .comments-area .comment-form-author input {
        max-width: 100%;
        width: 100%;
        margin-bottom: 8px;
    }
}

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
    .comments-title, .response-title {
        color: #f0f2f4;
    }
    
    .comment-item {
        background-color: #2a2a2a;
    }
    
    .comment-item:hover {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    
    .comment-author {
        color: #f0f2f4;
        font-size: 1.1em;
    }
    
    .comment-author.author {
        color: #a9c2e6;
    }
    
    .comment-author.user {
        color: #a9b3bc;
    }
    
    .pending {
        color: #e78c7e;
    }
    
    .comment-reply a {
        background-color: #3a3a3a;
        color: #a9b3bc;
    }
    
    .comment-reply a:hover {
        background-color: #506986;
        color: #fff;
    }
    
    .comment-children {
        border-left-color: #3a3a3a;
    }
    
    .comment-form-author input,
    .comment-form-content textarea {
        background-color: #2a2a2a;
        border-color: #3a3a3a;
        color: #f0f2f4;
    }
    
    .comment-form-author input:focus,
    .comment-form-content textarea:focus {
        border-color: #a9b3bc;
    }
    
    .logged-in-as {
        background-color: #2a2a2a;
    }
    
    .comment-closed {
        background-color: #2a2a2a;
    }
}

/* 留言板特定样式 */
.guestbook-comments {
    margin-top: 1em; /* 减少与上方分割线的距离 */
    padding-top: 1em; /* 减少顶部内边距 */
    border-top: 1px solid #eee;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    position: relative; /* 添加相对定位 */
    z-index: 50; /* 确保留言板有合适的层级 */
}

/* 解决评论项内容可能溢出的问题 */
.guestbook-comments .comment-item,
.comments-area .comment-item {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

/* 确保表单按钮不会溢出 */
.comment-form-submit {
    display: flex;
    justify-content: flex-end;
    margin-top: 1em;
    width: 100%;
    box-sizing: border-box;
}

/* 修复评论内容溢出问题 */
.post .comments-area,
.post .guestbook-comments {
    width: 100%;
    max-width: 720px; /* 确保与文章内容宽度一致 */
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

.guestbook-comments .comments-title {
    font-size: 0.9em; /* 缩小字体 */
    margin-bottom: 1em;
    text-align: left; /* 左对齐 */
    position: relative;
    color: #8796a3; /* 使用较浅的颜色 */
    font-weight: normal;
}

.guestbook-comments .comments-title:after {
    display: none; /* 移除底部横线 */
}

.guestbook-comments .comment-item {
    border-left: 3px solid #506986;
}

.guestbook-comments .comment-children .comment-item {
    border-left: 3px solid #8796a3;
}

.guestbook-comments .response-title {
    text-align: center;
    margin-bottom: 1.5em;
}

.guestbook-comments .submit-button {
    background-color: #506986;
}

.guestbook-comments .submit-button:hover {
    background-color: #39434d;
}

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
    .guestbook-comments {
        border-top-color: #3a3a3a;
    }
    
    .guestbook-comments .comments-title {
        color: #798086; /* 暗色模式下使用较浅的灰色 */
    }
    
    .guestbook-comments .comments-title:after {
        background: #a9b3bc;
    }
    
    .guestbook-comments .comment-item {
        border-left-color: #a9b3bc;
    }
    
    .guestbook-comments .comment-children .comment-item {
        border-left-color: #798086;
    }
}

/* 增强代码和预格式化文本在评论中的显示 */
.comment-content pre,
.comment-content code {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 确保评论中的图片不会溢出 */
.comment-content img {
    max-width: 100%;
    height: auto;
}

/* 处理评论中的长链接问题 */
.comment-content a {
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    display: inline-block;
}

/* 确保评论中的长内容不会溢出 */
.comment-content * {
    max-width: 100%;
}

/* 评论框与文章内容宽度保持一致 */
.post .comment-form,
.post .comments-area,
.post .guestbook-comments {
    max-width: 720px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    position: relative;
    z-index: 50;
}

/* 文章导航样式 */
.post-nav {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 5px; /* 减小标题之间的间距 */
    margin: 1em 0 0; /* 移除底部边距 */
    padding-top: 0.8em; /* 减小与上分割线的间距 */
    border-top: 1px solid #eee;
}

/* 确保文章导航后面的元素也减少上边距 */
.post-nav + * {
    margin-top: 0.5em;
}

/* 评论区域样式调整 */
.comments-area {
    margin-top: 0.8em !important; /* 减小评论区域的上边距 */
}

/* 文章样式调整 */
.post {
    margin-bottom: 0; /* 确保文章底部没有多余边距 */
}

/* 确保article元素没有多余的底部边距 */
article.post {
    margin-bottom: 0;
    padding-bottom: 0;
}

.prev-post {
    grid-row: 1;
    justify-self: start; /* 左对齐 */
    max-width: 90%;
    position: relative;
}

.next-post {
    grid-row: 2;
    justify-self: end; /* 右对齐 */
    max-width: 90%;
    position: relative;
}

.prev-post a, .next-post a {
    padding: 3px 0; /* 减小内边距 */
    transition: all 0.2s ease;
    display: inline-block;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    color: #747677;
    text-decoration: none;
}

/* 添加符号 */
.prev-post a::before {
    content: "« ";
    font-size: 1.1em;
}

.next-post a::after {
    content: " »";
    font-size: 1.1em;
}

.prev-post a:hover, .next-post a:hover {
    color: #32393f;
}

@media (prefers-color-scheme: dark) {
    .post-nav {
        border-top-color: #3a3a3a;
    }
    
    .prev-post a, .next-post a {
        color: #e6e6e6;
    }
    
    .prev-post a:hover, .next-post a:hover {
        color: #fff;
    }
}

@media screen and (max-width: 768px) {
    .prev-post, .next-post {
        max-width: 100%;
    }
}