:root {
    --width-max: 660px;
    --font-secondary: monospace;
    --font-size-primary: 1.01rem;
    --font-size-secondary: 1.03rem;
    /* --body-bg-color: #fbfbf6; */
    --body-bg-color: white;
    --bold-text-color: black;
    --body-text-color: black;
    --link-color: #0355a6;
    --link-visited-color: #551a8b;
    --table-border-color: #f2f2f2;
    --table-th-bg-color: #f2f2f2;
    --img-border-color: #f2f2f2;
    --code-bg-color: #f2f2f2;
    --code-text-color: #222;
    --blockquote-border-color: #666;
    --blockquote-text-color: gray;
    --upvoted-color: #fa8072;
    --caption-text-color: #666;
    --toc-text-color: #e5e5e5;
    --toc-hover-color: e5e5e5;
    --music-bg-hover-light: #e5e5e5;
    --music-bg-light: rgba(229, 229, 229, 0.5);
    --music-text-secondary: #666;
    --music-shadow:
        0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --summary-text-color: #706c6c;
    --svg-size: 0.85em;
    --title-color: #444444;
}

.recent-title {
    border: none;
}

.recent-title a {
    border-bottom: 1px dotted;
}

.grouped {
    margin-right: 0.7rem;
}

.recent-date {
    display: block;
}

summary p {
    color: var(--summary-text-color);
}

:is(article, .summary) p:not(.music-card *) {
    margin-top: 1.6rem;
}

.e-content h2,
.e-content h3,
.e-content h4,
.e-content h5,
.e-content h6 {
    /* font-weight: 800; */
}

gnu {
    display: none;
}

h1,
h2 {
    margin: 0;
    padding: 0;
}

.site-title {
    margin: 15px 0 15px 0;
    font-size: 2.15em;
    font-weight: 700;
}

.badge-88x31 {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.badge-88x31 a {
    flex: 0 0 auto;
    line-height: 0;
}

.badge-88x31 img {
    display: block;
}

.post-title a.item-link {
    font-size: 1.25rem;
    margin-bottom: 0;
}

.e-content :is(h1, h2, h3, h4, h5, h6),
.summary :is(h1, h2, h3, h4, h5, h6) {
    margin-top: 1.5em;
}

.post-meta-item a,
.rss-icon a,
.post-title a,
a.title h1,
p {
    color: var(--body-text-color);
}

body {
    font-family: Noto Serif CJK SC;
    margin: auto;
    padding: 20px;
    max-width: var(--width-max);
    text-align: left;
    background-color: var(--body-bg-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.6;
    color: var(--body-text-color);
}

.post-title a {
    margin: 16px 0;
}

.post-title:hover {
    color: var(--link-color);
}

p {
    line-height: 2;
    /* font-weight: 500; */
}

div.summary p {
    line-height: 2;
}

a {
    text-decoration: none;
    border-bottom: 1px dotted;
    color: var(--body-text-color) !important;
}

strong,
b {
    color: var(--bold-text-color);
}

i {
    font-style: normal;
}

hr {
    border: 0;
    border-top: 1px dashed;
}

time {
    font-size: 1rem;
    color: var(--body-text-color);
}

div.post-meta {
    font-weight: 500;
}

header {
    margin-top: 30px;
}

.title {
    text-align: left;
    text-decoration: none !important;
}

.title:hover {
    text-decoration: none;
}

a.title h1 {
    margin: 15px 0 15px 0;
    font-size: 2.15em;
}

.title span {
    font-weight: 400;
}

nav a {
    margin-right: 8px;
    border: none;
}

footer {
    padding: 25px 0;
    text-align: left;
    font-size: var(--font-size-secondary);
}

.recent-posts-item {
    margin: 0 0 120px 0;
}

.recent-item {
    margin-bottom: 4rem;
}

.recent-list {
    padding-left: 2vw;
}

.post-title a.item-link {
    font-size: 1.8rem;
    border: none;
}

h1.post-title {
    margin-top: 0;
    margin-bottom: 0.7rem;
}

.post-title {
    display: inline-block;
}

.post-date,
.post-date-shortcode {
    font-size: 0.9em;
    color: #666;
    display: inline;
    min-width: 80px;
    flex-shrink: 0;
    margin-left: auto;
}

.recent-empty {
    text-align: center;
    font-style: italic;
}

ul.blog-posts {
    list-style-type: none;
    padding: unset;
}

ul.blog-posts li {
    display: flex;
    margin-bottom: 8px;
}

ul.blog-posts li span {
    flex: 0 0 130px;
}

ul.blog-posts li span.grouped {
    flex: 0 0 80px;
}

.posts-list li {
    margin-bottom: 12px;
}

.post-meta {
    margin-top: 20px;
    margin-bottom: 5px;
}

.recent-posts .post-meta {
    margin-bottom: 3em;
}

.post-meta-item {
    margin-right: 0.3rem;
    display: inline-block;
}

.post-meta-item svg {
    display: inline;
    width: var(--svg-size);
    height: var(--svg-size);
}

.post-meta-item p {
    margin: 0;
}

img {
    max-width: 100%;
    display: block;
    margin-left: auto;
    margin-right: auto;
    content-visibility: auto;
}

img.missing {
    display: none;
}

img[src*="#minipic"] {
    max-width: 50%;
    margin-left: 0;
    margin-right: auto;
}

.image-caption {
    margin: auto;
}

.image-caption figcaption {
    text-align: center;
    font-style: italic;
    font-size: 0.8em;
    margin-top: 0.6em;
    color: var(--caption-text-color);
}

.booklist {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.booklist-item {
    transform: translateZ(0);
    transition:
        transform 0.25s,
        box-shadow 0.25s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.booklist-item:hover {
    transform: translateY(-5px) translateZ(20px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.booklist-item img {
    height: 100%;
}

.rss-icon {
    display: inline;
    font-size: 16px;
    float: right;
    font-family: var(--font-primary);
}

.social-icons {
    margin: 15px 15px 5px 15px;
    text-align: center;
}

.social-icons a {
    padding: 5px 5px;
}

code {
    font-family: var(--font-secondary);
    background-color: var(--code-bg-color);
    color: var(--code-text-color);
    padding: 2px;
    border-radius: 4px;
}

pre code {
    display: block;
    padding: 16px;
    white-space: pre-wrap;
    overflow-x: auto;
}

div.highlight pre {
    border-radius: 4px;
}

div.highlight code {
    background-color: var(--code-bg-color);
    color: var(--code-text-color);
}

blockquote {
    margin: 17px 0 0 0;
    padding-left: 20px;
    font-style: normal;
}

blockquote p {
    color: var(--blockquote-text-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--table-border-color);
    border-radius: 4px;
    margin-top: 16px;
}

th,
td {
    border: 1px solid var(--table-border-color);
    padding: 4px;
}

th {
    background-color: var(--table-th-bg-color);
}

.wm {
    border: 1px #d0d7de solid;
    border-radius: 0.25em;
    padding: 1.5vw;
    padding-top: 0;
    background-color: #fffaed;
    margin-top: 1vh;
}

.wm p {
    margin-top: 1px;
}

textarea {
    width: 100%;
    font-size: 16px;
}

input {
    font-size: 14px;
}

div.footnotes hr::before {
    content: "Footnotes";
    display: block;
    font-size: 1.5em;
    color: var(--bold-text-color);
    margin-top: 16px;
}

.music-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.music-card img {
    border: none !important;
}

.music-info {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.music-cover {
    width: 3.75rem;
    height: 3.75rem;
    border-radius: 0.5rem;
    box-shadow: var(--music-shadow);
    margin: 0 !important;
    object-fit: cover;
}

.music-title {
    margin: 0;
    font-size: 1rem;
    font-weight: bold;
    line-height: 1.2;
}

.music-artist {
    margin: 0;
    font-size: 0.875rem;
    color: var(--music-text-secondary);
}

.music-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.music-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 0.75rem;
    height: 2rem;
    border-radius: 9999px;
    text-decoration: none !important;
    font-size: 0.75rem;
    transition: background-color 0.3s ease;
    background-color: var(--music-bg-light);
    color: inherit;
}

.music-btn:hover {
    background-color: var(--music-bg-hover-light);
}

.music-icon {
    display: block;
    width: 0.75rem;
    height: 0.75rem;
    margin: 0 !important;
}

.music-btn-text {
    display: inline;
}

/* 容器基础样式 */
#ms_toc {
    border-left: 1px solid #ddd; /* 目录左侧的整体引导线 */
    padding: 0 0 0 1em; /* 只留左侧内边距，给缩进留空间 */
    margin-bottom: 2em;
    font-size: 0.9em;
    line-height: 1.6; /* 稍微增加行高，更有大纲感 */
}

#ms_toc strong {
    display: block;
    margin-bottom: 0.8em;
    text-transform: uppercase;
    font-size: 0.8em;
    color: #666; /* 标题颜色稍微减淡，突出内容 */
    letter-spacing: 1px;
}

/* 核心：列表缩进逻辑 */
#ms_toc nav ul {
    list-style: none; /* 彻底移除圆点 */
    padding-left: 0;
    margin: 0;
}

/* 所有的列表项 */
#ms_toc nav li {
    margin: 0.4em 0;
}

/* 关键：通过层级选择器实现逐级缩进 */
/* 第一级不需要额外缩进 */
#ms_toc nav > ul > li {
    padding-left: 0;
}

/* 第二级及更深层级：每深入一级，增加 1.2em 的缩进 */
#ms_toc nav ul ul {
    padding-left: 1.2em;
    margin-left: 0.2em; /* 与父级垂直线错开 */
}

/* 链接样式 */
#ms_toc a {
    text-decoration: none;
    color: #555; /* 默认深灰色，更像大纲 */
    display: inline-block;
    transition: color 0.2s ease;
}

#ms_toc a:hover {
    color: #0056b3; /* 悬停时变蓝 */
    text-decoration: underline;
}

/* 响应式设计：大屏幕时侧靠 (Desktop) */
@media (min-width: 1100px) {
    #ms_toc_container {
        position: fixed;

        /* 使用 calc 动态定位，确保在 600px 正文的右侧 */
        left: calc(50% + 350px);
        top: 20%; /* 距离顶部 15%，比 20% 稍微靠上一点 */

        width: 260px;
        max-height: 75vh; /* 限制高度，防止遮挡底部 */
        overflow-y: auto;
        z-index: 100;
        margin: 0;
    }

    #ms_toc {
        margin-bottom: 0;
    }
}

/* 移动端或窄屏样式：回归到正文流中 */
@media (max-width: 1099px) {
    #ms_toc {
        margin: 2em 0; /* 手机端上下留白 */
        width: auto;
        position: static;
        border-left: 2px solid #eee;
    }
}

button.upvote-btn {
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--body-text-color);
}

button.upvoted {
    color: var(--upvoted-color);
}

span.upvote-count {
    margin-top: -4px;
    font-size: smaller;
}

ul li:has(input) {
    list-style-type: none;
    margin-left: -25.5px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --body-bg-color: #0f0f0f;
        --body-text-color: #e6e6e6;
        --summary-text-color: #a8a8a8;
        --bold-text-color: #ffffff;
        --text-color-tertiary: #888888;

        --link-color: #5cc2ff;
        --link-visited-color: #9d7eff;

        --code-bg-color: #1a1a1a;
        --code-text-color: #d4d4d4;
        --blockquote-border-color: #555555;
        --blockquote-text-color: #bbbbbb;

        --table-border-color: #444444;
        --table-th-bg-color: #1f1f1f;

        --img-border-color: #444444;
        --toc-text-color: #aaaaaa;
        --toc-hover-color: #5cc2ff;

        --color-background: var(--body-bg-color) !important;
    }

    a {
        color: var(--link-color);
        cursor: pointer;
    }

    h3.recent-post-title a {
        color: var(--body-text-color);
    }

    .post-meta-item svg {
        filter: invert(1) hue-rotate(180deg);
    }

    strong {
        /* font-weight: 650; */
    }

    .music-btn {
        background-color: var(--music-bg-dark);
    }
    .music-btn:hover {
        background-color: var(--music-bg-hover-dark);
    }

    .category-link {
        color: #dbdbdb;
    }

    .wm {
        background-color: #161b22;
        border-color: #30363d;
        color: var(--body-text-color);
        padding: 10px;
    }

    .wm input {
        background-color: #010409;
        border: #30363d 1px solid;
        color: var(--body-text-color);
        outline: none;
    }

    #webmention-source:focus {
        border-color: var(--color-accent-fg, #0969da);
        box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
    }

    .wm button {
        color: var(--body-text-color);
        background-color: #161b22;
        border: #30363d 1px solid;
    }

    .post-summary {
        color: var(--text-color-primary) !important;
    }

    .post-item {
        border-bottom: 1px solid #414141 !important;
    }

    .pagination-link {
        border: 1px solid #414141 !important;
    }
}

@media (min-width: 768px) {
    .music-card {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .music-btn {
        padding: 1rem;
        justify-content: center;
        width: auto;
        height: auto;
    }

    .music-icon {
        width: 1.25rem;
        height: 1.25rem;
    }

    .music-btn-text {
        display: none;
    }
}

@media (max-width: 800px) {
    img[src*="#minipic"] {
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    div.toc {
    }
}

@media (max-width: 720px) {
    .post-date {
        min-width: auto;
        font-size: 0.85em;
    }

    .item-link {
        white-space: normal;
        overflow: visible;
    }
}

@media (max-width: 700px) {
    .booklist {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}

@media (max-width: 400px) {
    .booklist {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

.title h1,
.title p {
    margin: 15px 0 !important;
    font-size: 2.15em !important;
    /* font-weight: 700 !important; */
    line-height: 1.2 !important;
    display: block !important;
    padding: 0 !important;
}

.post-title {
    font-size: 26.4px;
    line-height: 1.4 !important;
    display: block !important;
    padding: 0 !important;
}

.post-title a {
    display: inline-block !important;
    padding: 0 !important;
}

nav {
    margin-top: 0 !important;
    margin-bottom: 20px !important;
    line-height: 1.6 !important;
}

header {
    margin-top: 30px;
    display: block;
}
