:root {
    --width: 660px;
    --font-yahei: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Ubuntu,"Helvetica Neue",Helvetica,Arial,"PingFangSC-Regular","Hiragino Sans GB","Lantinghei SC","Microsoft Yahei","Source Han Sans CN","WenQuanYi Micro Hei",SimSun,sans-serif;
    --font-fangsong: Baskerville, "Times New Roman", "Liberation Serif", STFangsong, FangSong, FangSong_GB2312, "CWTEX\-F", serif;
    --font-songti: Georgia, "Nimbus Roman No9 L", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif CN", STSong, "AR PL New Sung", "AR PL SungtiL GB", NSimSun, SimSun, "TW\-Sung", "WenQuanYi Bitmap Song", "AR PL UMing CN", "AR PL UMing HK", "AR PL UMing TW", "AR PL UMing TW MBE", PMingLiU, MingLiU, serif;
    --font-scale: 1em;
    --background-color: #fbf9f3;
    --heading-color: #222;
    --text-color: #444;
    --link-color: #3273dc;
    --visited-color:  #8b6fcb;
    --code-background-color: #f2f2f2;
    --code-color: #222;
    --blockquote-color: #222;
    --gray-color: #999;
}
@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #111;
        --heading-color: #eee;
        --text-color: #ddd;
        --link-color: #6ab0e5;
        --visited-color:  #8b6fcb;
        --code-background-color: #000;
        --code-color: #ddd;
        --blockquote-color: #ccc;
        --gray-color: #999;
    }
}
body {
    font-family: var(--font-yahei); /* 可替换 --font-fangsong 或 --font-songti 字体 */
    font-size: var(--font-scale);
    margin: auto;
    padding: 20px;
    max-width: var(--width);
    text-align: left;
    background-color: var(--background-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.7;
    color: var(--text-color);
}
html{scroll-behavior:smooth;}
h1,h2,h3,h4,h5,h6{color:var(--heading-color);display:inherit}
a{color:var(--link-color);cursor:pointer;text-decoration:none;border-bottom:1px solid transparent}
a:hover,nav .current{border-bottom:1px solid}
nav a{margin-right:8px}
strong,b{color:var(--heading-color)}
button{margin:0;cursor:pointer}
table{width:100%}
hr{border:0;border-top:1px dashed}
img{max-width:100%;height:auto}
time,.intro{color:var(--gray-color);}
code{font-family:monospace;padding:2px;background-color:var(--code-background-color);color:var(--code-color);border-radius:4px}
blockquote{border-left:1px solid #999;color:var(--code-color);padding-left:20px;font-style:italic}
input{border-radius:4px;border:1px solid var(--gray-color);margin:0 0 15px 0;padding:10px;width:50%}
input:focus{outline:0}
input[type="submit"]{padding:9px 10px 10px;text-align:center;width:80px;display:inline-flex;background-color:var(--heading-color);color:var(--code-background-color);border:none}
input[type="submit"]:hover{cursor:pointer;opacity:.7}
header,footer{padding:20px 0}
.title:hover{text-decoration:none;border:none}
.title h1,.title h2{font-size:1.5em}
ul.posts{list-style-type:none;padding:unset}
ul.posts li{display:flex;margin:3px 0}
ul.posts li span{flex:0 0 115px}
ul.posts li a:visited{color:var(--visited-color)}
.tags{margin-top:30px;color:var(--gray-color)}
.tags a{margin:0 5px 0 2px}
/* 日间模式 (背景暖白) */
body.day-mode {
    --background-color: #fbf9f3;
    --text-color: #333333;
    --heading-color: #222222;
}
/* 夜间模式 (背景深灰) */
body.night-mode {
    --background-color: #1e1e1e;
    --text-color: #cccccc;
    --heading-color: #eeeeee;
}
/* 让切换过渡更平滑 */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========================================
   工具栏样式（暗色/亮色切换 + 字号控制）
   ======================================== */
#toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 10px 0 15px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--gray-color, #999);
    font-size: 14px;
    opacity: 0.6;
    transition: opacity 0.2s;
}
#toolbar:hover {
    opacity: 1;
}
#toolbar button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color, #444);
    transition: background 0.15s, transform 0.1s;
}
#toolbar button:hover {
    background: var(--code-background-color, #f0f0f0);
    transform: scale(1.05);
}
#toolbar button:active {
    transform: scale(0.93);
}
.toolbar-divider {
    color: var(--gray-color, #999);
    padding: 0 2px;
    user-select: none;
}

/* 字体缩放过渡 */
body {
    transition: font-size 0.2s ease;
}

/* ========================================
   日间模式 / 夜间模式（手动切换）
   ======================================== */
body.day-mode {
    --background-color: #fbf9f3;
    --text-color: #333333;
    --heading-color: #222222;
    --link-color: #3273dc;
    --code-background-color: #f0f0f0;
}
body.night-mode {
    --background-color: #1a1a1a;
    --text-color: #cccccc;
    --heading-color: #eeeeee;
    --link-color: #6ab0e5;
    --code-background-color: #2d2d2d;
}

/* ===== 文章列表日期时间样式 ===== */
ul.posts li {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 4px 8px;
    padding: 3px 0;
    overflow: hidden;
}
ul.posts li .post-datetime {
    flex-shrink: 0;
    color: var(--gray-color, #999);
    font-size: 0.9em;
    font-variant-numeric: tabular-nums;
}
ul.posts li a {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
    flex: 0 0 70px;
    color: var(--gray-color, #999);
    font-size: 0.85em;
    font-variant-numeric: tabular-nums;
}
ul.posts li a {
    flex: 1;
    min-width: 120px;
}

/* ===== 文章列表日期时间样式（紧凑版） ===== */
ul.posts li {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 4px 8px;
    padding: 3px 0;
    overflow: hidden;
}
ul.posts li .post-datetime {
    flex-shrink: 0;
    color: var(--gray-color, #999);
    font-size: 0.9em;
    font-variant-numeric: tabular-nums;
}
ul.posts li a {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
    flex: 0 0 auto;
    color: var(--gray-color, #999);
    font-size: 0.85em;
    font-variant-numeric: tabular-nums;
}
ul.posts li a {
    flex: 1;
    min-width: 80px;
}

/* ===== 文章列表日期时间样式（紧凑版） ===== */
ul.posts li {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 4px 8px;
    padding: 3px 0;
    overflow: hidden;
}
ul.posts li .post-datetime {
    flex-shrink: 0;
    color: var(--gray-color, #999);
    font-size: 0.9em;
    font-variant-numeric: tabular-nums;
}
ul.posts li a {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
    flex: 0 0 auto;
    color: var(--gray-color, #999);
    font-size: 0.85em;
    font-variant-numeric: tabular-nums;
}
ul.posts li a {
    flex: 1;
    min-width: 80px;
}

/* ===== 文章列表日期时间（紧凑版） ===== */
ul.posts li {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 4px 8px;
    padding: 3px 0;
    overflow: hidden;
}
ul.posts li .post-datetime {
    flex-shrink: 0;
    color: var(--gray-color, #999);
    font-size: 0.9em;
    font-variant-numeric: tabular-nums;
}
ul.posts li a {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
ul.posts li .post-datetime {
    flex: 0 0 auto;
    color: var(--gray-color, #999);
    font-size: 0.95em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap; /* 防止日期时间换行 */
}
ul.posts li a {
    flex: 1;
    min-width: 80px;
}

/* ===== 文章列表卡片样式 ===== */
ul.posts {
    list-style: none;
    padding: 0;
}
ul.posts li {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 4px 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
    background-color: var(--background-color, #fff);
    border: 1px solid var(--gray-color, #e0e0e0);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transition: box-shadow 0.2s;
}
ul.posts li:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
ul.posts li .post-datetime {
    flex-shrink: 0;
    color: var(--gray-color, #999);
    font-size: 0.9em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
ul.posts li a {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== 手机端调整：日期时间和标题分行 ===== */
@media (max-width: 600px) {
    ul.posts li {
        flex-wrap: wrap;
        gap: 2px 0;
        padding: 10px 12px;
    }
    ul.posts li .post-datetime {
        flex-basis: 100%;
        font-size: 0.85em;
        margin-bottom: 2px;
    }
    ul.posts li a {
        flex-basis: 100%;
        white-space: normal;
        word-break: break-word;
        overflow: visible;
        text-overflow: unset;
    }
}

/* ===== 让分类标签颜色变淡 ===== */
ul.posts li .post-meta a {
    color: var(--gray-color, #999);
    text-decoration: none;
    border-bottom: none;
}
ul.posts li .post-meta a:hover {
    color: var(--text-color, #444);
    border-bottom: 1px solid var(--gray-color, #999);
}

/* ===== 区分颜色：标题蓝、时间灰、分类暖色 ===== */
ul.posts li .post-datetime {
    color: var(--gray-color, #999);
}

ul.posts li .post-meta a {
    color: #b35c5c; /* 亮色模式暖红褐 */
    text-decoration: none;
    border-bottom: none;
    transition: color 0.2s;
}
ul.posts li .post-meta a:hover {
    color: #8a3f3f; /* 悬停加深 */
}

/* 暗色模式下分类颜色变亮 */
@media (prefers-color-scheme: dark) {
    ul.posts li .post-meta a {
        color: #e08a7a;
    }
    ul.posts li .post-meta a:hover {
        color: #f5b0a0;
    }
}

/* ===== 区分颜色：标题蓝、时间灰、分类暖色 ===== */
ul.posts li .post-datetime {
    color: var(--gray-color, #999);
}

ul.posts li .post-meta a {
    color: #b35c5c; /* 亮色模式暖红褐 */
    text-decoration: none;
    border-bottom: none;
    transition: color 0.2s;
}
ul.posts li .post-meta a:hover {
    color: #8a3f3f; /* 悬停加深 */
}

/* 暗色模式下分类颜色变亮 */
@media (prefers-color-scheme: dark) {
    ul.posts li .post-meta a {
        color: #e08a7a;
    }
    ul.posts li .post-meta a:hover {
        color: #f5b0a0;
    }
}

/* ===== 直接给分类标签上色 ===== */
ul.posts li a[href*="/category/"] {
    color: #b35c5c !important;
    text-decoration: none;
    border-bottom: none;
}
ul.posts li a[href*="/category/"]:hover {
    color: #8a3f3f !important;
}

/* 暗色模式 */
@media (prefers-color-scheme: dark) {
    ul.posts li a[href*="/category/"] {
        color: #e08a7a !important;
    }
    ul.posts li a[href*="/category/"]:hover {
        color: #f5b0a0 !important;
    }
}

/* ===== 顶部导航菜单：区分当前页面 ===== */
nav a {
    color: var(--gray-color, #888);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    margin-right: 12px;
    font-size: 0.95em;
}
nav a:hover {
    color: var(--text-color, #444);
    border-bottom-color: var(--gray-color, #ccc);
}
nav a.current {
    color: var(--link-color, #3273dc);
    border-bottom-color: var(--link-color, #3273dc);
    font-weight: 500;
}

/* 暗色模式 */
@media (prefers-color-scheme: dark) {
    nav a.current {
        color: #6ab0e5;
        border-bottom-color: #6ab0e5;
    }
}

/* ===== 顶部导航中的分类链接改为红色 ===== */
nav a[href*="/category/"] {
    color: #b35c5c !important;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
nav a[href*="/category/"]:hover {
    color: #8a3f3f !important;
    border-bottom-color: #b35c5c;
}
nav a[href*="/category/"].current {
    color: #b35c5c !important;
    border-bottom-color: #b35c5c;
    font-weight: 500;
}

/* 暗色模式 */
@media (prefers-color-scheme: dark) {
    nav a[href*="/category/"] {
        color: #e08a7a !important;
    }
    nav a[href*="/category/"]:hover {
        color: #f5b0a0 !important;
        border-bottom-color: #e08a7a;
    }
    nav a[href*="/category/"].current {
        color: #e08a7a !important;
        border-bottom-color: #e08a7a;
    }
}

/* ===== 顶部导航中的首页、关于等非分类链接颜色 ===== */
nav a:not([href*="/category/"]) {
    color: #555;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
nav a:not([href*="/category/"]):hover {
    color: #222;
    border-bottom-color: #ccc;
}
nav a:not([href*="/category/"]).current {
    color: #3273dc;
    border-bottom-color: #3273dc;
    font-weight: 500;
}

/* 暗色模式 */
@media (prefers-color-scheme: dark) {
    nav a:not([href*="/category/"]) {
        color: #999;
    }
    nav a:not([href*="/category/"]):hover {
        color: #ddd;
        border-bottom-color: #666;
    }
    nav a:not([href*="/category/"]).current {
        color: #6ab0e5;
        border-bottom-color: #6ab0e5;
    }
}

/* ===== 顶部导航中的首页、关于等非分类链接颜色（墨绿色） ===== */
nav a:not([href*="/category/"]) {
    color: #4a7c6f;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
nav a:not([href*="/category/"]):hover {
    color: #2f5a50;
    border-bottom-color: #4a7c6f;
}
nav a:not([href*="/category/"]).current {
    color: #4a7c6f;
    border-bottom-color: #4a7c6f;
    font-weight: 500;
}

/* 暗色模式 */
@media (prefers-color-scheme: dark) {
    nav a:not([href*="/category/"]) {
        color: #7db09a;
    }
    nav a:not([href*="/category/"]):hover {
        color: #a8d0be;
        border-bottom-color: #7db09a;
    }
    nav a:not([href*="/category/"]).current {
        color: #7db09a;
        border-bottom-color: #7db09a;
    }
}

/* ===== 文章详情页分类标签改为红色 ===== */
.post-meta a[href*="/category/"],
article .post-meta a,
.post a[href*="/category/"] {
    color: #b35c5c !important;
    text-decoration: none;
    border-bottom: none;
}
.post-meta a[href*="/category/"]:hover,
article .post-meta a:hover,
.post a[href*="/category/"]:hover {
    color: #8a3f3f !important;
}

/* 暗色模式 */
@media (prefers-color-scheme: dark) {
    .post-meta a[href*="/category/"],
    article .post-meta a,
    .post a[href*="/category/"] {
        color: #e08a7a !important;
    }
    .post-meta a[href*="/category/"]:hover,
    article .post-meta a:hover,
    .post a[href*="/category/"]:hover {
        color: #f5b0a0 !important;
    }
}

/* ===== 文章详情页分类标签改为红色 ===== */
.post-meta a[href*="/category/"],
article .post-meta a,
.post a[href*="/category/"] {
    color: #b35c5c !important;
    text-decoration: none;
    border-bottom: none;
}
.post-meta a[href*="/category/"]:hover,
article .post-meta a:hover,
.post a[href*="/category/"]:hover {
    color: #8a3f3f !important;
}

/* 暗色模式 */
@media (prefers-color-scheme: dark) {
    .post-meta a[href*="/category/"],
    article .post-meta a,
    .post a[href*="/category/"] {
        color: #e08a7a !important;
    }
    .post-meta a[href*="/category/"]:hover,
    article .post-meta a:hover,
    .post a[href*="/category/"]:hover {
        color: #f5b0a0 !important;
    }
}

/* ===== 全局统一分类链接为红色（包括文章详情页） ===== */
a[href*="/category/"] {
    color: #b35c5c !important;
    text-decoration: none;
}
a[href*="/category/"]:hover {
    color: #8a3f3f !important;
}

/* 暗色模式 */
@media (prefers-color-scheme: dark) {
    a[href*="/category/"] {
        color: #e08a7a !important;
    }
    a[href*="/category/"]:hover {
        color: #f5b0a0 !important;
    }
}
