
:root {
    --page-bg: #F4F6F9;
    --surface: #FFFFFF;
    --border: #E6E9EF;
    --text: #2B3440;
    --text-2: #5C6772;
    --muted: #94A0AE;
    --accent: #5B7CA6;
    --accent-hover: #4A6B92;
    --accent-soft: #EAF1F8;
    --code-bg: #F3F5F8;
    --todo-bg: #FBF3E4;
    --todo-text: #9A6B2F;
    --topbar-h: 56px;
    --toc-w: 248px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--page-bg);
    color: var(--text);
    font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h2[id], h3[id] { scroll-margin-top: calc(var(--topbar-h) + 16px); }

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: 1180px;
    height: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-avatar { display: block; line-height: 0; }
.brand-name { color: var(--text); font-weight: 700; font-size: 15px; }
.brand-name:hover { color: var(--accent); }
.brand-mark {
    display: block;
    width: 24px; height: 24px; border-radius: 50%;
    object-fit: cover;
    background: linear-gradient(135deg, #fdfeff, #020c18);
}

.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a {
    padding: 6px 12px;
    border-radius: 4px;
    color: var(--text-2);
    font-size: 13.5px;
}
.topnav a:hover { color: var(--accent); }
.topnav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.shell {
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: var(--toc-w) minmax(0, 1fr);
    align-items: start;
}

.toc {
    position: sticky;
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    padding: 22px 12px 24px 16px;
    background: var(--surface);
    border-right: 1px solid var(--border);
}

@media (min-width: 1181px) {
    .toc { border-left: 1px solid var(--border); }
}

.toc-label { margin: 0 0 2px; font-size: 11.5px; font-weight: 400; color: var(--muted); }
.toc-page { margin: 0 0 12px; font-size: 14.5px; font-weight: 700; }

.toc-group { margin-bottom: 2px; }

.toc-link, .toc-sublink {
    display: block;
    padding: 5px 8px;
    border-radius: 4px;
    color: var(--text);
    font-size: 13px;
}
.toc-link:hover, .toc-sublink:hover { background: var(--accent-soft); color: var(--accent); }
.toc-sublink { margin-left: 12px; padding: 4px 8px; font-size: 12.5px; color: var(--text-2); }
.toc-link.active, .toc-sublink.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.content { padding: 28px 32px 0; max-width: 920px; }

.page-title { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.4; }
.page-sub { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

.hero { display: flex; align-items: center; justify-content: space-between; gap: 32px; }
.hero-greeting { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.hero-title { margin: 0; font-size: 30px; font-weight: 700; }
.hero-tagline { margin: 8px 0 0; color: var(--text-2); font-size: 15px; }
.hero-bio { margin: 14px 0 0; max-width: 560px; color: var(--text-2); font-size: 13.5px; }
.hero-avatar-link { flex: 0 0 auto; display: block; border-radius: 50%; }
.hero-avatar {
    flex: 0 0 auto;
    display: block;
    width: 150px; height: 150px; border-radius: 50%;
    object-fit: cover;
    background: linear-gradient(135deg, #7E9CBF, #5B7CA6);
}

section.block { margin-top: 40px; }
h2 { margin: 0 0 14px; font-size: 18px; font-weight: 700; }
h3 { margin: 0 0 10px; font-size: 15.5px; font-weight: 600; }

p { margin: 0 0 10px; color: var(--text-2); font-size: 13.5px; }

ul.bullets { margin: 4px 0 12px; padding: 0; list-style: none; }
ul.bullets li { position: relative; padding-left: 16px; margin-bottom: 4px; color: var(--text-2); font-size: 13.5px; }
ul.bullets li::before { content: "·"; position: absolute; left: 2px; color: var(--accent); font-weight: 700; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 16px; }
.cards.single { grid-template-columns: minmax(0, 1fr); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(31, 45, 61, .08); }

.card-top { display: flex; align-items: center; gap: 8px; }
.card-date { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.card-title { margin: 10px 0 0; font-size: 15.5px; font-weight: 600; line-height: 1.5; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--accent); }
.card-excerpt { margin: 6px 0 0; font-size: 12.5px; color: var(--text-2); }
.card-meta { margin: 12px 0 0; font-size: 11.5px; color: var(--muted); }

.chip {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11.5px;
    line-height: 1.5;
}
.chip-todo { background: var(--todo-bg); color: var(--todo-text); }

.tag-chip {
    display: inline-block;
    margin: 0 8px 8px 0;
    padding: 5px 10px;
    border-radius: 4px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12.5px;
}
.tag-chip:hover { background: var(--accent); color: #fff; }
.tag-chip .count { opacity: .7; margin-left: 4px; font-size: 11px; }

.group { margin-top: 34px; }
.post-meta { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; color: var(--muted); font-size: 12px; }
.post-lead { margin: 16px 0 0; color: var(--text-2); font-size: 13.5px; }
hr.rule { margin: 20px 0 24px; border: 0; border-top: 1px solid var(--border); }

.post-section { margin-bottom: 30px; }
.post-section h2 { scroll-margin-top: calc(var(--topbar-h) + 16px); }

pre.code {
    margin: 4px 0 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--code-bg);
    overflow-x: auto;
}
pre.code code {
    font-family: Consolas, Menlo, "DejaVu Sans Mono", monospace;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text);
}
.code-lang { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-family: inherit; }
strong { font-weight: 600; color: var(--text); }
del { color: var(--muted); }
code {
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--code-bg);
    font-family: Consolas, Menlo, "DejaVu Sans Mono", monospace;
    font-size: 12.5px;
    color: var(--text);
}
pre.code code { padding: 0; background: none; }

ol { margin: 4px 0 14px; padding-left: 22px; }
ol li { margin-bottom: 4px; color: var(--text-2); font-size: 13.5px; }
ul.bullets ul.bullets, ul.bullets ol, ol ul.bullets { margin: 4px 0 0; padding-left: 16px; }
ul.bullets ul.bullets li::before { content: "–"; color: var(--muted); }

blockquote {
    margin: 12px 0 16px;
    padding: 10px 16px;
    border-left: 3px solid var(--accent);
    border-radius: 0 6px 6px 0;
    background: var(--surface);
}
blockquote p:last-child { margin-bottom: 0; }

.table-wrap { margin: 12px 0 16px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 7px 10px; border: 1px solid var(--border); text-align: left; color: var(--text-2); }
th { background: var(--code-bg); color: var(--text); font-weight: 600; }
tbody tr:nth-child(even) { background: #FAFBFD; }
th.c, td.c { text-align: center; }
th.r, td.r { text-align: right; }
img { max-width: 100%; height: auto; }
figure.fig { margin: 16px 0 18px; }
figure.fig img {
    display: block;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}
figure.fig figcaption {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    align-items: baseline;
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
}
.fig-cap { color: var(--text-2); }
.fig-meta { margin-left: auto; font-size: 11.5px; }

h4 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.content h2 { margin-left: 0; }
.content h3 { margin-left: 16px; }
.content h4 { margin-left: 32px; }
.content h5, .content h6 { margin-left: 48px; }
.indent-3, .indent-4, .indent-5, .indent-6 { margin-left: 16px; }
.indent-3 > :first-child, .indent-4 > :first-child,
.indent-5 > :first-child, .indent-6 > :first-child { margin-left: 0; }
.content .card-title { margin-left: 0; }
.todo-note {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 7px;
    border-radius: 3px;
    background: var(--todo-bg);
    color: var(--todo-text);
    font-size: 11px;
    font-weight: 400;
    vertical-align: middle;
}

.note {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
}
.note h2, .note h3 { margin-top: 0; }
.site-footer {
    margin: 28px 0 0;
    padding: 16px 0 20px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
}
@media (max-width: 860px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .toc {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        padding: 18px 20px;
    }
    .content { padding: 22px 20px 0; }
    .topbar-inner { padding: 0 16px; overflow-x: auto; }
    .brand-name { display: none; }
    .hero { flex-direction: column-reverse; align-items: flex-start; gap: 20px; }
    .hero-avatar { width: 104px; height: 104px; font-size: 40px; }
}
.term {
    margin-left: 6px;
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
}

ul.files {
    margin: 0 0 14px;
    padding: 0;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

ul.files li.file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin: 0;
    border-top: 1px solid var(--border);
}
ul.files li.file-row:first-child { border-top: 0; }
ul.files li.file-row::before { content: none; }

.filetype {
    flex: 0 0 auto;
    min-width: 46px;
    padding: 2px 6px;
    border-radius: 3px;
    text-align: center;
    font-size: 11px;
    background: #EEF1F5;
    color: var(--text-2);
}
.filetype.pdf { background: #FBECEC; color: #A65252; }
.filetype.ppt { background: #FBEFE4; color: #A5663A; }
.filetype.doc { background: var(--accent-soft); color: var(--accent-hover); }
.filetype.zip { background: #F0EFE6; color: #6E6A45; }

.file-name { flex: 1 1 auto; font-size: 13.5px; color: var(--text); }
.file-name:hover { color: var(--accent); }
.file-size { flex: 0 0 auto; font-size: 12px; color: var(--muted); }
.file-note { flex: 0 0 auto; font-size: 11.5px; color: var(--muted); }

.note-index {
    margin: 4px 0 16px;
    padding: 0;
    list-style: none;
}
.note-index li { position: relative; padding-left: 16px; margin-bottom: 6px; font-size: 13.5px; }
.note-index li::before { content: "·"; position: absolute; left: 2px; color: var(--accent); font-weight: 700; }
.note-index a { color: var(--text); }
.note-index a:hover { color: var(--accent); }

.math-block { display: block; margin: 12px 0; overflow-x: auto; overflow-y: hidden; }
.katex { font-size: 1.05em; }

.fold-head {
    position: relative;
    cursor: pointer;
    user-select: none;
}
.fold-head::before {
    content: "▾";
    position: absolute;
    left: -16px;
    top: 0;
    width: 16px;
    text-align: center;
    color: var(--muted);
    font-weight: 400;
}
.fold-head:hover::before { color: var(--accent); }
.fold-head.collapsed::before { content: "▸"; }
.fold-hidden { display: none !important; }

@media (max-width: 520px) {
    ul.files li.file-row { flex-wrap: wrap; gap: 6px; }
    .file-name { flex: 1 1 100%; order: 2; }
}

