/* ================================================================
   ShunyiHome — 亮暗主题统一样式
   ================================================================ */

/* ===== CSS 变量 ===== */
:root {
    /* 暗色主题（默认） */
    --bg-body: #0f1117;
    --bg-card: #1a1d28;
    --bg-navbar: #1a1d28;
    --bg-input: #151722;
    --bg-highlight: #12141c;
    --bg-hover: rgba(255,255,255,0.06);
    --bg-hover-light: rgba(255,255,255,0.04);
    --text-primary: #e4e6eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-heading: #f3f4f6;
    --text-dim: #4b5563;
    --text-code: #409eff;
    --border: rgba(255,255,255,0.06);
    --border-strong: rgba(255,255,255,0.1);
    --border-subtle: rgba(255,255,255,0.04);
    --overlay: rgba(15,17,23,0.75);
    --shadow-sm: 0 1px 8px rgba(0,0,0,0.1);
    --shadow-md: 0 2px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.5);
    --scrollbar-track: #0f1117;
    --scrollbar-thumb: #2a2d3a;
    --scrollbar-thumb-hover: #3a3d4a;
    --btn-close-filter: invert(1) grayscale(100%) brightness(200%);
    --table-striped: rgba(255,255,255,0.015);
    --table-hover: rgba(255,255,255,0.04);
    --table-active: rgba(255,255,255,0.06);
    --code-bg: rgba(255,255,255,0.03);
    --code-inline-bg: rgba(142,150,170,0.14);
    --highlight-bg: #151722;
    --highlight-hll: #2a2d3a;
    --autofill-shadow: 0 0 0 1000px #151722 inset;
    --post-text: #98989f;
    --post-heading: #dfdfd6;
    --post-border: #2e2e32;
    --post-sidebar-bg: #161618;
    --post-table-header: #202127;
    --color-primary: #60a5fa;
    --color-primary-solid: #2563eb;
    --color-primary-solid-hover: #1d4ed8;
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --state-active-bg: rgba(37,99,235,0.14);
    --state-active-border: rgba(96,165,250,0.45);
    --focus-ring: #60a5fa;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --page-gutter: clamp(16px, 4vw, 32px);
    --bs-body-font-family: 'Noto Sans SC', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans', 'Liberation Sans', Arial, sans-serif;
}

/* 亮色主题 */
html.light {
    --bg-body: #f5f5f5;
    --bg-card: #ffffff;
    --bg-navbar: rgba(255,255,255,0.85);
    --bg-input: #ffffff;
    --bg-highlight: #f8f8f8;
    --bg-hover: rgba(0,0,0,0.04);
    --bg-hover-light: rgba(0,0,0,0.02);
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --text-heading: #111111;
    --text-dim: #bbbbbb;
    --text-code: #2563eb;
    --border: rgba(0,0,0,0.08);
    --border-strong: rgba(0,0,0,0.12);
    --border-subtle: rgba(0,0,0,0.04);
    --overlay: rgba(245,245,245,0.75);
    --shadow-sm: 0 1px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.15);
    --scrollbar-track: #f5f5f5;
    --scrollbar-thumb: #cccccc;
    --scrollbar-thumb-hover: #aaaaaa;
    --btn-close-filter: none;
    --table-striped: rgba(0,0,0,0.02);
    --table-hover: rgba(0,0,0,0.04);
    --table-active: rgba(0,0,0,0.06);
    --code-bg: rgba(0,0,0,0.03);
    --code-inline-bg: rgba(0,0,0,0.06);
    --highlight-bg: #f6f6f6;
    --highlight-hll: #e8e8e8;
    --autofill-shadow: 0 0 0 1000px #ffffff inset;
    --post-text: #666666;
    --post-heading: #333333;
    --post-border: #e0e0e0;
    --post-sidebar-bg: #ffffff;
    --post-table-header: #f0f0f0;
    --state-active-bg: rgba(37,99,235,0.1);
    --state-active-border: rgba(37,99,235,0.32);
}

html {
    scrollbar-gutter: stable;
}
body {
    background-color: var(--bg-body);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--text-primary);
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}
/* 文章详情页专用背景色 */
body:has(.post-page-wrapper) {
    background-color: #1b1b1f;
}
html.light body:has(.post-page-wrapper) {
    background-color: #ffffff;
}
html.light .toc-panel { background: #ffffff; }
/* 背景图半透明遮罩 */
body.has-bg::after {
    content: "";
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 0;
    pointer-events: none;
}
body.has-bg > .flex-grow-1,
body.has-bg > .navbar-placeholder {
    position: relative;
    z-index: 1;
}
body.has-bg > .search-overlay {
    position: fixed;
    z-index: 2000;
}

/* 容器宽度 */
@media (min-width: 768px) {
    .container { max-width: 800px; }
}
@media (min-width: 992px) {
    .container { max-width: 800px; }
}

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

/* ===== 导航栏 ===== */
.site-navbar {
    --nav-action-gap: 1.5rem;
    --post-nav-line-offset: 0px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    width: 100%;
    background-color: transparent;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: none;
    transition: background-color 0.3s, border-color 0.3s;
}
.navbar-placeholder { height: 64px; flex-shrink: 0; }

/* 首页背景图下 */
.home-bg .blog-pagination .page-link-custom {
    background-color: rgba(26, 29, 40, 0.85);
    backdrop-filter: blur(12px);
}
.home-bg .blog-pagination .page-link-custom.active {
    background-color: rgba(37, 99, 235, 0.9);
}
.home-bg .site-navbar .nav-link { color: var(--text-primary); }
.home-bg .blog-item .split { color: var(--text-muted); }
.home-bg .overview-item .label { color: var(--text-secondary); }
.home-bg .recommend-container .title { color: var(--text-secondary); }
.home-bg .recommend-container .date-tag { color: var(--text-muted); }
.home-bg .blog-sidebar-cat-item { color: var(--text-secondary); border-color: var(--border-strong); }
.home-bg .blog-sidebar-cat-item:hover { color: #60a5fa; border-color: #60a5fa; background: rgba(96,165,250,0.1); }
.home-bg .card-header-title { color: var(--text-primary); }
.home-bg .page-link-custom { color: var(--text-secondary); }

.navbar-inner {
    width: 100%;
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.navbar-brand {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-primary) !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}
.navbar-brand:hover { color: #409eff !important; text-decoration: none; }
.navbar-right { display: flex; align-items: center; gap: var(--nav-action-gap); }
.site-navbar .nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0 0.75rem;
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.15s, background-color 0.15s;
    white-space: nowrap;
}
.site-navbar .nav-link:hover { color: #409eff; background-color: transparent; }
.site-navbar .nav-link i { font-size: 0.85rem; }
.site-navbar .nav-link.dropdown-toggle { color: var(--text-secondary); }
.site-navbar .nav-link.dropdown-toggle:hover { color: var(--text-primary); }
.site-navbar .nav-link.dropdown-toggle::after { display: none; }
.navbar-right .nav-link,
.navbar-right-logged .nav-link {
    padding-left: 0;
    padding-right: 0;
}
.nav-separator { width: 1px; height: 20px; background: var(--post-border); flex-shrink: 0; margin-left: var(--nav-action-gap); margin-right: var(--nav-action-gap); }
.navbar-right-logged { display: flex; align-items: center; gap: var(--nav-action-gap); }

/* 主题切换开关 */
.theme-toggle {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 11px;
    border: 1px solid var(--border-strong);
    background: var(--bg-hover);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}
.theme-toggle:hover {
    border-color: #60a5fa;
}
.theme-toggle:focus-visible,
.navbar-toggler:focus-visible,
.navbar-search-bar:focus-visible,
.mobile-menu-link:focus-visible,
.search-result-item:focus-visible,
.toc-mobile-btn:focus-visible,
.site-confirm-dialog .btn:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}
.theme-toggle .toggle-knob {
    position: absolute;
    left: 19px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: left 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.theme-toggle .toggle-icon {
    font-size: 10px;
    color: var(--bg-body);
    line-height: 1;
}
html.light .theme-toggle .toggle-knob {
    left: 1px;
}

/* 移动端菜单按钮 */
.navbar-toggler {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: 3px;
    transition: color 0.15s, background-color 0.15s;
}
.navbar-toggler:hover { color: var(--text-primary); background-color: var(--bg-hover); }

/* 搜索条 */
.navbar-search-container { flex: 1; display: flex; align-items: center; padding-left: 32px; }
.navbar-search-bar {
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 6px;
    margin: 0;
    height: 38px;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    transition: border 0.2s;
}
.navbar-search-bar:hover { color: var(--text-secondary); border-color: #60a5fa; }
.navbar-search-bar:focus { border-color: #60a5fa; }
.navbar-search-bar i { font-size: 0.85rem; }
.navbar-search-bar kbd {
    font-size: 0.65rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    padding: 0.05rem 0.4rem;
    color: var(--text-muted);
}

/* 搜索弹窗 */
.search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(15,17,23,0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
html.light .search-overlay {
    background: rgba(17,24,39,0.24);
}
body.has-bg > .search-overlay {
    position: fixed;
    z-index: 2000;
}
.search-overlay.open { display: block; }
.search-overlay[aria-hidden="true"] { display: none; }
.search-dialog {
    position: fixed;
    top: 87px;
    left: 50%;
    transform: translateX(-50%);
    width: min(560px, calc(100vw - 24px));
    max-width: 560px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}
.search-dialog-input {
    padding: 12px;
}
.search-dialog-input input {
    width: 100%;
    height: 50px;
    padding: 12px;
    font-size: 18px;
    color: var(--text-primary);
    background: var(--bg-input) !important;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    outline: none;
}
.search-dialog-input input::placeholder {
    color: var(--text-dim);
}
.search-dialog-input input:focus {
    border-color: #60a5fa;
}
.search-dialog-results {
    max-height: 360px;
    overflow-y: auto;
    padding: 0 12px 12px;
}
.search-result-empty,
.search-result-item {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
}
.search-result-empty {
    color: var(--text-muted);
}
.search-result-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 4px 12px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}
.search-result-item:hover,
.search-result-item.active {
    background: var(--bg-hover);
    color: var(--text-heading);
    text-decoration: none;
}
.search-result-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.95rem;
    font-weight: 500;
}
.search-result-summary {
    grid-column: 1 / -1;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.search-result-date {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* 移动端菜单 */
.mobile-menu { display: none; padding: 0.5rem 0; border-top: 1px solid var(--border-subtle); }
.mobile-menu.open { display: block; }
.mobile-menu-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.15s, background-color 0.15s;
}
.mobile-menu-link:hover { color: var(--text-primary); background-color: var(--bg-hover-light); }
.mobile-menu-link i { font-size: 0.9rem; width: 1.2rem; text-align: center; }
.mobile-menu-divider { height: 1px; background: var(--border); margin: 0.25rem 1.25rem; }

/* ===== 卡片 ===== */
.card {
    background-color: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
    border-radius: 4px;
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card-header {
    background-color: var(--bg-hover-light);
    border-bottom-color: var(--border);
    font-weight: 600;
}

/* ===== 文字颜色 ===== */
.text-muted { color: var(--text-muted) !important; }
.text-dark { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-primary { color: #60a5fa !important; }
.text-info { color: #67b8e3 !important; }
.text-success { color: #4ade80 !important; }
.text-warning { color: #fbbf24 !important; }
.text-danger { color: #f87171 !important; }
.text-light { color: var(--text-heading) !important; }

/* ===== 徽章 ===== */
.badge.bg-info { background-color: rgba(14,165,233,0.2) !important; color: #7dd3fc !important; }
.badge.bg-success { background-color: rgba(34,197,94,0.2) !important; color: #86efac !important; }
.badge.bg-danger { background-color: rgba(239,68,68,0.2) !important; color: #fca5a5 !important; }
.badge.bg-warning { background-color: rgba(234,179,8,0.2) !important; color: #fde68a !important; }
.badge.bg-secondary { background-color: var(--bg-hover) !important; color: var(--text-secondary) !important; }
.badge.bg-dark { background-color: var(--bg-input) !important; color: var(--text-secondary) !important; }

/* ===== 按钮 ===== */
.btn-primary { background-color: #2563eb; border-color: #2563eb; }
.btn-primary:hover { background-color: #1d4ed8; border-color: #1d4ed8; }
.btn-secondary { background-color: var(--bg-card); border-color: var(--border-strong); color: var(--text-primary); }
.btn-secondary:hover { background-color: var(--bg-hover); border-color: var(--border-strong); color: var(--text-heading); }
.btn-outline-primary { color: #60a5fa; border-color: rgba(96,165,250,0.4); }
.btn-outline-primary:hover { background-color: #2563eb; border-color: #2563eb; color: #fff; }
.btn-outline-secondary { color: var(--text-secondary); border-color: var(--border-strong); }
.btn-outline-secondary:hover { background-color: var(--bg-card); border-color: var(--border-strong); color: var(--text-primary); }
.btn-outline-success { color: #4ade80; border-color: rgba(74,222,128,0.4); }
.btn-outline-success:hover { background-color: #16a34a; border-color: #16a34a; color: #fff; }
.btn-outline-danger { color: #f87171; border-color: rgba(248,113,113,0.4); }
.btn-outline-danger:hover { background-color: #dc2626; border-color: #dc2626; color: #fff; }

/* ===== 表单控件 ===== */
html input[type="text"],
html input[type="password"],
html input[type="email"],
html input[type="number"],
html input[type="search"],
html input[type="tel"],
html input[type="url"],
html input[type="date"],
html textarea,
html select,
html .form-control,
html .form-select {
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-strong);
}
html .form-control:focus,
html .form-select:focus {
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: #3b82f6;
    box-shadow: 0 0 0 0.2rem rgba(59,130,246,0.15);
}
html .form-control::placeholder { color: var(--text-dim); }
html input:-webkit-autofill,
html input:-webkit-autofill:hover,
html input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-primary) !important;
    -webkit-box-shadow: var(--autofill-shadow) !important;
    caret-color: var(--text-primary);
    transition: background-color 5000s ease-in-out 0s;
}
html option { background-color: var(--bg-card); color: var(--text-primary); }

/* ===== 下拉菜单 ===== */
.dropdown-menu {
    background-color: var(--bg-card);
    border-color: var(--border);
    box-shadow: var(--shadow-lg);
}
.dropdown-item { color: var(--text-secondary); }
.dropdown-item:hover { background-color: var(--bg-hover); color: var(--text-primary); }
.dropdown-divider { border-color: var(--border); }

/* ===== 提示条 ===== */
.alert-danger { background-color: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.2); color: #fca5a5; }
.alert-info { background-color: rgba(14,165,233,0.08); border-color: rgba(14,165,233,0.2); color: #7dd3fc; }
.alert-warning { background-color: rgba(234,179,8,0.08); border-color: rgba(234,179,8,0.2); color: #fde68a; }
.alert-success { background-color: rgba(34,197,94,0.08); border-color: rgba(34,197,94,0.2); color: #86efac; }

/* ===== 弹窗 ===== */
.modal-content {
    background-color: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
    box-shadow: var(--shadow-xl);
}
.modal-header { border-bottom-color: var(--border); }
.modal-footer { border-top-color: var(--border); }
.btn-close { filter: var(--btn-close-filter); }

/* ===== 全站反馈 ===== */
.site-toast-stack {
    position: fixed;
    right: var(--page-gutter);
    bottom: calc(20px + env(safe-area-inset-bottom));
    z-index: 2600;
    display: grid;
    gap: 8px;
    width: min(360px, calc(100vw - 2 * var(--page-gutter)));
    pointer-events: none;
}
.site-toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    font-size: 0.88rem;
    line-height: 1.5;
    pointer-events: auto;
}
.site-toast i { flex: 0 0 auto; margin-top: 2px; }
.site-toast.success i { color: var(--color-success); }
.site-toast.error i { color: var(--color-danger); }
.site-toast.info i { color: var(--color-primary); }
.site-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 2550;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--page-gutter);
    background: rgba(15,17,23,0.72);
    backdrop-filter: blur(6px);
}
html.light .site-confirm-overlay { background: rgba(17,24,39,0.24); }
.site-confirm-overlay.open { display: flex; }
.site-confirm-dialog {
    width: min(420px, 100%);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-xl);
    padding: 18px;
}
.site-confirm-dialog h2 {
    margin: 0 0 8px;
    color: var(--text-heading);
    font-size: 1.05rem;
    font-weight: 700;
}
.site-confirm-dialog p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
}
.site-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

/* ===== 表格 ===== */
.table {
    color: var(--text-primary) !important;
    --bs-table-color: var(--text-primary);
    --bs-table-bg: transparent;
    --bs-table-bg-type: transparent;
    --bs-table-bg-state: transparent;
    --bs-table-accent-bg: transparent;
    --bs-table-striped-bg: var(--table-striped);
    --bs-table-striped-color: var(--text-primary);
    --bs-table-hover-bg: var(--table-hover);
    --bs-table-hover-color: var(--text-primary);
    --bs-table-active-bg: var(--table-active);
    --bs-table-active-color: var(--text-primary);
    --bs-table-border-color: var(--border);
}
.table > :not(caption) > * > * {
    color: var(--text-primary) !important;
    background-color: var(--bs-table-bg) !important;
    box-shadow: none !important;
    border-bottom-color: var(--bs-table-border-color);
}
.table-hover tbody tr:hover > * {
    background-color: var(--bs-table-hover-bg) !important;
}
.table thead th {
    background-color: var(--bg-highlight) !important;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom-color: var(--border);
}

/* ===== 分页 ===== */
.blog-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 0 1rem;
}
.blog-pagination .page-link-custom {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 4px;
    border-radius: 2px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s, transform 0.15s;
}
.blog-pagination .page-link-custom:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    transform: translateY(-1px);
}
.blog-pagination .page-link-custom.active {
    background-color: #2563eb;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}
.blog-pagination .page-link-custom.disabled { opacity: 0.3; pointer-events: none; }

/* Bootstrap 分页覆盖 */
.pagination .page-link {
    font-size: 0.85rem;
    background-color: var(--bg-card);
    border-color: var(--border);
    color: var(--text-secondary);
}
.pagination .page-link:hover {
    background-color: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
}
.pagination .page-item.active .page-link {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
.pagination .page-item.disabled .page-link {
    background-color: var(--bg-card);
    border-color: var(--border-subtle);
    color: var(--text-dim);
}

/* 加载动画 */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.spin { animation: spin 1s linear infinite; display: inline-block; }
#loadingOverlay { background: var(--bg-body) !important; }

/* 页脚 */
.flex-grow-1 {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}
.site-content {
    flex: 1 0 auto;
    width: 100%;
}
.site-footer {
    flex-shrink: 0;
    width: 100%;
    margin-top: 64px;
    padding: 20px 12px;
    text-align: center;
    font-size: 1rem;
    background-color: var(--bg-body);
    border-top: 1px solid var(--border);
}
.site-footer-link {
    color: var(--text-dim);
    text-decoration: none;
}
.site-footer-link:hover { color: var(--text-secondary) !important; }

/* ================================================================
   博客样式
   ================================================================ */

.container:has(.home-wrapper) { max-width: 1126px; }

.home-wrapper { max-width: 1126px; margin: 0 auto; padding: 0 20px; }

/* 首屏区 */
.header-banner { padding: 80px 0; text-align: center; }
.header-banner h1 { margin: 0; padding: 0; line-height: 1.2; }
.hero-name { font-size: 36px; font-weight: 700; color: var(--text-heading); }
.hero-desc { font-size: 20px; font-weight: 400; font-family: 'Noto Sans SC', sans-serif; color: var(--text-secondary); margin: 16px 0 0; }

.blog-search-bar { margin-top: 0.75rem; margin-bottom: 0.5rem; }

/* 内容布局 */
.content-wrapper { display: flex; gap: 1rem; align-items: flex-start; }
.blog-list-wrapper { flex: 1 1 0; min-width: 0; }
.blog-info-wrapper { flex: 0 0 300px; min-width: 0; }

/* 文章卡片 */
.blog-item {
    display: flex;
    align-items: flex-start;
    padding: 16px 20px;
    margin-bottom: 20px;
    background-color: var(--bg-card);
    border: none;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: box-shadow 0.2s;
    gap: 0;
    position: relative;
    overflow: hidden;
}
.blog-item:hover { box-shadow: var(--shadow-md); color: inherit; text-decoration: none; }
.blog-item .pin { position: absolute; top: 0; left: 0; width: 0; height: 0; border: 0; font-size: 0; overflow: visible; }
.blog-item .pin::before {
    content: "";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    background: #409eff;
    clip-path: polygon(0 0, 100% 0, 0 100%);
    opacity: 0.5;
    transition: opacity 0.2s;
}
.blog-item:hover .pin::before { opacity: 1; }
.blog-item .info-container { flex: 1; min-width: 0; }
.blog-item .info-part { min-width: 0; }
.blog-item .title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px;
    line-height: 1.4;
    transition: color 0.15s;
}
.blog-item:hover .title { color: #60a5fa; }
.blog-item .description-html { margin-bottom: 0; }
.blog-item .description-html span { font-size: 0.875rem; color: var(--text-muted); line-height: 1.7; }
.blog-item .badge-list {
    font-size: 0.8125rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-top: 8px;
}
.blog-item .split { margin: 0 0.4rem; color: var(--text-dim); }
.blog-item .el-tag.tag-item {
    background: rgba(37,99,235,0.12);
    color: #60a5fa;
    padding: 0.15rem 0.55rem;
    border-radius: 3px;
    font-size: 0.75rem;
    margin-right: 0.2rem;
    transition: background-color 0.15s;
}
.blog-item .el-tag.tag-item:hover { background: rgba(37,99,235,0.22); }

/* 侧边栏卡片 */
.blog-info-wrapper .card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}
.blog-info-wrapper .card-header-bar { display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.75rem; }
.blog-info-wrapper .card-header-title { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }

.blog-author { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.blog-author p { font-size: 1rem; font-weight: 400; color: var(--text-heading); margin: 0; }
.blog-sidebar-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 600;
    flex-shrink: 0;
    object-fit: cover;
}

/* 统计区 */
.overview-data { display: flex; justify-content: center; align-items: center; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.overview-item { display: flex; flex-direction: column; align-items: center; flex: 1; padding: 0 0.5rem; }
.overview-item .count { font-size: 1.125rem; font-weight: 400; color: var(--text-primary); line-height: 1.3; }
.overview-item .label { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; }
.split-bar { width: 1px; height: 24px; background: var(--border); flex-shrink: 0; }

/* 标签云 */
.blog-sidebar-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
}
.blog-sidebar-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 1.8rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid rgba(96,165,250,0.24);
    border-radius: 4px;
    background: rgba(37,99,235,0.09);
    color: #60a5fa;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.blog-sidebar-tag:hover,
.blog-sidebar-tag:focus {
    border-color: rgba(96,165,250,0.55);
    background: rgba(37,99,235,0.18);
    color: #bfdbfe;
}
.blog-sidebar-tag small { color: var(--text-muted); font-size: 0.68em; }
.blog-sidebar-tag.tag-weight-1 { font-size: 0.76rem; }
.blog-sidebar-tag.tag-weight-2 { font-size: 0.84rem; }
.blog-sidebar-tag.tag-weight-3 { font-size: 0.92rem; }
.blog-sidebar-tag.tag-weight-4 { font-size: 1rem; }
.blog-sidebar-tag.tag-weight-5 { font-size: 1.08rem; }

/* 精选文章 */
.recommend-container { list-style: none; padding: 0; margin: 0; }
.recommend-container li { display: flex; align-items: baseline; padding: 0.35rem 0; font-size: 0.85rem; }
.recommend-container .num { font-style: normal; font-weight: 600; color: var(--text-secondary); font-size: 0.8rem; min-width: 14px; margin-right: 0.5rem; transition: color 0.15s; }
.recommend-container .des { flex: 1; display: flex; align-items: baseline; justify-content: space-between; min-width: 0; }
.recommend-container .des .title {
    color: var(--text-secondary);
    text-decoration: none;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: inherit;
    font-weight: 400;
    transition: color 0.15s;
}
.recommend-container li:hover .num,
.recommend-container li:hover .des .title { color: #60a5fa; }
.recommend-container .suffix { flex-shrink: 0; margin-left: 0.5rem; }
.recommend-container .date-tag { color: var(--text-dim); font-size: 0.75rem; }

/* 搜索表单 */
.blog-search-form .input-group-text { background-color: var(--bg-input); border-color: var(--border-strong); color: var(--text-muted); }
.blog-search-form .form-control { border-left: none; }

/* 文章详情 */
.post-article { padding-top: 0; padding-bottom: 48px; margin: 0 auto; }
.post-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 1.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    transition: color 0.15s, background-color 0.15s;
}
.post-back-link:hover { color: var(--text-secondary); background-color: var(--bg-hover-light); }
.post-title { font-size: 2rem; font-weight: 600; color: var(--post-heading); line-height: 2.5rem; letter-spacing: 0; margin-bottom: 1rem; }
.post-meta { font-size: 0.875rem; color: var(--post-heading); display: flex; align-items: center; flex-wrap: wrap; gap: 0.2rem; margin-bottom: 2rem; }
.post-meta-sep { margin: 0 0.4rem; color: var(--text-dim); }
.post-edit-link { color: var(--text-muted); text-decoration: none; font-size: 0.8125rem; }
.post-edit-link:hover { color: var(--text-secondary); }

.post-content { line-height: 1.75; font-size: 1rem; color: var(--post-text); overflow-wrap: anywhere; word-break: normal; }
.post-content h1, .post-content h2, .post-content h3,
.post-content h4, .post-content h5, .post-content h6 { color: var(--post-heading); font-weight: 600; }
.post-content h1 { font-size: 2rem; line-height: 2.5rem; letter-spacing: 0; margin: 2.5rem 0 0.75rem; }
.post-content > :first-child { margin-top: 0 !important; }
.post-content h2 { font-size: 1.5rem; line-height: 2rem; margin: 3rem 0 1rem; padding-top: 1.5rem; }
.post-content h3 { font-size: 1.25rem; line-height: 1.75rem; margin: 2rem 0 0; }
.post-content p { margin: 0; }
.post-content p + p { margin-top: 16px; }
.post-content .post-info-block {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.75rem 0;
    margin: 0 0 1.5rem;
    border-top: 1px solid var(--post-border);
    border-bottom: 1px solid var(--post-border);
    color: var(--text-muted);
    font-size: 0.875rem;
}
.post-content .post-info-item { display: inline-flex; align-items: center; gap: 0.35rem; min-width: 0; }
.post-content .post-info-label { color: var(--text-dim); }
.post-content .post-info-value { color: var(--post-text); }
.post-content .post-info-tags .post-info-value { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
.post-content .post-info-tag {
    display: inline-flex;
    align-items: center;
    min-height: 1.4rem;
    padding: 0 0.45rem;
    border: 0;
    border-radius: 3px;
    background: rgba(37,99,235,0.12);
    color: #60a5fa;
    font-family: inherit;
    font-size: 0.75rem;
    line-height: 1.4;
    cursor: pointer;
}
.post-content .post-info-tag:hover,
.post-content .post-info-tag:focus {
    background: rgba(37,99,235,0.22);
    color: #bfdbfe;
}
.post-content a { color: #60a5fa; text-decoration: none; font-weight: 500; }
.post-content a:hover { text-decoration: underline; }
.post-content blockquote {
    border-left: 2px solid var(--post-border);
    padding: 0.5rem 1rem;
    color: var(--post-text);
    margin: 16px 0;
}
.post-content img { max-width: 100%; height: auto; border-radius: 4px; margin: 1em 0; }
.post-content video { max-width: 100%; border-radius: 4px; margin: 1em 0; }
.post-content ul, .post-content ol { margin-bottom: 1em; padding-left: 1.5em; }
.post-content li { margin-bottom: 0.3em; }

/* 表格 */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    display: block;
    overflow-x: auto;
    max-width: 100%;
}
.post-content th, .post-content td {
    padding: 8px 16px;
    border-bottom: 1px solid var(--post-border);
    text-align: left;
}
.post-content th {
    background: var(--post-table-header);
    font-weight: 600;
}
.post-content tr:last-child th, .post-content tr:last-child td {
    border-bottom: none;
}

/* 代码块 */
.post-content pre {
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
    position: relative;
    max-width: 100%;
}
.code-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--bg-hover-light);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}
.post-content pre:hover .code-copy-btn,
.code-copy-btn:focus-visible { opacity: 1; }
.code-copy-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.code-copy-btn.copied { color: #10b981; border-color: #10b981; opacity: 1; }
.post-content code {
    color: var(--text-code);
    background: rgba(101,117,133,0.16);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.875em;
}
.post-content pre code { color: var(--text-primary); background: none; padding: 0; font-size: 0.9em; }

/* Pygments 代码高亮 */
.highlight { background: var(--highlight-bg); padding: 0; border-radius: 4px; }
.highlight .hll { background-color: var(--highlight-hll); }
.highlight .c { color: var(--text-muted); font-style: italic; }
.highlight .k { color: #c084fc; }
.highlight .n { color: var(--text-primary); }
.highlight .o { color: var(--text-secondary); }
.highlight .p { color: var(--text-secondary); }
.highlight .s { color: #4ade80; }
.highlight .s1 { color: #4ade80; }
.highlight .s2 { color: #4ade80; }
.highlight .mi { color: #fbbf24; }
.highlight .mf { color: #fbbf24; }
.highlight .kc { color: #c084fc; }
.highlight .kd { color: #c084fc; }
.highlight .kr { color: #c084fc; }
.highlight .kt { color: #60a5fa; }
.highlight .nc { color: #60a5fa; }
.highlight .nf { color: #60a5fa; }
.highlight .na { color: #67b8e3; }
.highlight .nb { color: #67b8e3; }
.highlight .nd { color: #fbbf24; }
.highlight .nn { color: var(--text-primary); }
.highlight .nt { color: #f87171; }
.highlight .nv { color: var(--text-primary); }
.highlight .w { color: var(--text-primary); }

/* ================================================================
   文章详情 — 扩展 Markdown 元素样式（对标 Typora）
   ================================================================ */

/* 删除线 */
.post-content del { color: var(--text-muted); text-decoration: line-through; }

/* 高亮 ==text== */
.post-content mark { background: rgba(250, 200, 50, 0.25); color: inherit; padding: 2px 4px; border-radius: 3px; }

/* 下标/上标 */
.post-content sub, .post-content sup { font-size: 0.75em; line-height: 0; position: relative; vertical-align: baseline; }
.post-content sup { top: -0.5em; }
.post-content sub { bottom: -0.25em; }

/* 脚注 */
.post-content .footnote { font-size: 0.85rem; color: var(--text-muted); }
.post-content .footnote hr { border-color: var(--border); margin: 2em 0 1em; }
.post-content .footnote ol { padding-left: 1.5em; }
.post-content .footnote p { margin: 0.3em 0; }
.post-content sup.footnote-ref a { color: #60a5fa; font-size: 0.75em; text-decoration: none; }
.post-content sup.footnote-ref a:hover { text-decoration: underline; }

/* 任务列表 */
.post-content .task-list { list-style: none; padding-left: 0; }
.post-content .task-list li { display: flex; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.4em; }
.post-content .task-list-item { list-style: none; }
.post-content .task-list-item input[type="checkbox"] {
    appearance: none; -webkit-appearance: none;
    width: 16px; height: 16px; flex-shrink: 0;
    border: 2px solid var(--border); border-radius: 3px;
    background: transparent; cursor: pointer;
    margin-top: 4px; position: relative;
    transition: border-color 0.15s, background-color 0.15s;
}
.post-content .task-list-item input[type="checkbox"]:checked {
    background: #2563eb; border-color: #2563eb;
}
.post-content .task-list-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute; left: 3px; top: 0px;
    width: 5px; height: 9px;
    border: solid #fff; border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* 提示框/告示块 */
.post-content .admonition {
    border-left: 4px solid #60a5fa;
    background: rgba(96, 165, 250, 0.06);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin: 1em 0;
    font-size: 0.95rem;
}
.post-content .admonition-title {
    font-weight: 600;
    color: #60a5fa;
    margin-bottom: 0.25rem;
}
.post-content .admonition.warning { border-left-color: #f59e0b; background: rgba(245, 158, 11, 0.06); }
.post-content .admonition.warning .admonition-title { color: #f59e0b; }
.post-content .admonition.danger { border-left-color: #ef4444; background: rgba(239, 68, 68, 0.06); }
.post-content .admonition.danger .admonition-title { color: #ef4444; }
.post-content .admonition.tip { border-left-color: #10b981; background: rgba(16, 185, 129, 0.06); }
.post-content .admonition.tip .admonition-title { color: #10b981; }

/* 定义列表 */
.post-content dl { margin: 1em 0; }
.post-content dt { font-weight: 600; color: var(--post-heading); margin-top: 0.75em; }
.post-content dd { margin-left: 1.5em; margin-bottom: 0.5em; color: var(--post-text); }

/* 缩写 */
.post-content abbr[title] { text-decoration: underline dotted; cursor: help; }

/* 数学公式容器 */
.post-content mjx-container { overflow-x: auto; overflow-y: hidden; margin: 1em 0; }
.post-content mjx-container[display="true"] { display: block !important; text-align: center; }

/* 键盘按键 */
.post-content kbd {
    background: var(--bg-hover-light);
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 0.85em;
    font-family: inherit;
    box-shadow: 0 1px 0 var(--border-strong);
}

/* 折叠块 */
.post-content details {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 1rem;
    margin: 1em 0;
}
.post-content details summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--post-heading);
    padding: 0.25rem 0;
}
.post-content details[open] summary { margin-bottom: 0.5rem; }

/* Typora 常用扩展：标签页、Mermaid、自动链接 */
.post-content .tabbed-set {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 1.25em 0;
    border: 1px solid var(--post-border);
    border-radius: 4px;
    overflow: hidden;
}
.post-content .tabbed-set > input { display: none; }
.post-content .tabbed-set > label {
    padding: 0.45rem 0.8rem;
    cursor: pointer;
    color: var(--post-text);
    background: var(--post-table-header);
    border-right: 1px solid var(--post-border);
    font-size: 0.9rem;
}
.post-content .tabbed-set > input:checked + label {
    color: var(--post-heading);
    background: var(--bg-card);
}
.post-content .tabbed-content {
    width: 100%;
    padding: 0.9rem 1rem;
    border-top: 1px solid var(--post-border);
}
.post-content .mermaid {
    max-width: 100%;
    overflow-x: auto;
    margin: 1.25em 0;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--post-border);
    border-radius: 4px;
}

/* 空状态 */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 3rem; margin-bottom: 1rem; display: block; }

/* 内容不存在 */
.not-found-page {
    min-height: 52vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 16px;
}
.not-found-mark {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    color: #60a5fa;
    font-size: 2rem;
    margin-bottom: 18px;
    background: var(--bg-card);
}
.not-found-page h3 { margin: 0 0 8px; color: var(--text-heading); font-size: 1.35rem; }
.not-found-page p { max-width: 420px; color: var(--text-secondary); margin: 0 0 18px; }
.not-found-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* 博客管理 */
.actions-cell { white-space: nowrap; }
.actions-cell .btn { padding: 0.25rem 0.5rem; font-size: 0.8rem; }

/* 编辑器 */
.editor-textarea {
    min-height: 400px;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    tab-size: 4;
}

/* ================================================================
   文章详情 — TOC + 相关文章
   ================================================================ */

/* 三栏布局 — 左侧栏固定270px，参照 xmagicer */
.post-page-wrapper { display: grid; grid-template-columns: 1fr; align-items: start; width: 100%; padding: 0; box-sizing: border-box; gap: 0; }
.post-left-sidebar { width: 270px; padding: 64px 10px 96px 32px; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; box-sizing: border-box; background-color: var(--post-sidebar-bg); z-index: 10; }
.post-body { display: flex; align-items: flex-start; min-width: 0; gap: 0; padding-top: 16px; }
.post-main { flex: 1; min-width: 0; max-width: 688px; margin: 0 auto; }
.post-right-sidebar { flex: 0 0 224px; width: 224px; padding: 48px 0 0 0; box-sizing: border-box; }
.post-right-sidebar .toc-card { position: fixed; top: 112px; width: 224px; max-height: calc(100vh - 112px); overflow-y: auto; }
.preview-banner {
    margin: 0 0 12px;
    padding: 8px 10px;
    border: 1px solid rgba(245,158,11,0.35);
    border-radius: 6px;
    background: rgba(245,158,11,0.08);
    color: #f59e0b;
    font-size: 0.86rem;
}

.toc-card {
    background-color: transparent;
    border: none;
    border-left: 1px solid var(--post-border);
    border-radius: 0;
    padding: 0;
    padding-left: 16px;
    box-shadow: none;
    position: relative;
}
.toc-marker {
    position: absolute;
    left: -1px;
    width: 2px;
    background: #2563eb;
    border-radius: 1px;
    transition: top 0.2s ease, height 0.2s ease;
    top: 0;
    height: 0;
    opacity: 0;
}
.toc-marker.visible { opacity: 1; }
.toc-title { font-size: 0.875rem; font-weight: 600; color: var(--post-heading); margin-bottom: 0.75rem; text-align: left; }
.toc-nav > .toc > ul, .toc-nav > .toc > ul ul { list-style: none; padding: 0; margin: 0; }
.toc-nav > .toc > .toctitle { display: none; }
.toc-nav li { margin: 0; }
.toc-nav a {
    display: block;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    color: var(--post-text);
    text-decoration: none;
    border-radius: 3px;
    transition: color 0.15s, background-color 0.15s;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.toc-nav a:hover { color: var(--text-primary); background-color: var(--bg-hover-light); }
.toc-nav a.active { color: #60a5fa; background-color: rgba(37,99,235,0.08); }
.toc-nav > .toc > ul > li > a { padding-left: 0.5rem; }
.toc-nav > .toc > ul > li > ul > li > a { padding-left: 1rem; font-size: 0.78rem; }
.toc-nav > .toc > ul > li > ul > li > ul > li > a { padding-left: 1.5rem; font-size: 0.75rem; }
.toc-nav > .toc > ul > li > ul > li > ul > li > ul > li > a { padding-left: 2rem; font-size: 0.73rem; }

/* 左侧栏 — 相关文章 */
.post-left-card {
    background-color: var(--post-sidebar-bg);
    border: none;
    border-radius: 0;
    padding: 10px;
    box-shadow: none;
}
.post-left-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--post-heading);
    margin-bottom: 0.75rem;
    text-align: left;
}
.post-left-list { list-style: none; padding: 0; margin: 0; counter-reset: left-counter; }
.post-left-list li {
    counter-increment: left-counter;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin: 0;
    padding: 0.35rem 0;
}
.post-left-list li::before {
    content: counter(left-counter);
    display: inline-block;
    min-width: 1.4em;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--post-heading);
    background: transparent;
    flex-shrink: 0;
    transition: color 0.15s;
}
.post-left-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0;
    text-decoration: none;
    color: inherit;
    flex: 1;
    min-width: 0;
    transition: color 0.15s;
}
.post-left-item:hover { color: #60a5fa; }
.post-left-list li:has(.post-left-item:hover)::before,
.post-left-list li:has(.post-left-item:focus-visible)::before,
.post-left-list li:has(.post-left-item.active)::before { color: #60a5fa; }
.post-left-item-title {
    font-size: 14px;
    color: var(--post-heading);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}
.post-left-item:hover .post-left-item-title,
.post-left-item:focus-visible .post-left-item-title,
.post-left-item.active .post-left-item-title { color: #60a5fa; }
.post-left-item-date {
    font-size: 0.7rem;
    color: var(--text-dim);
    flex-shrink: 0;
    white-space: nowrap;
}

/* 浮动目录按钮 + 面板 */
.toc-mobile-bar {
    position: fixed;
    top: 64px;
    right: 16px;
    left: auto;
    z-index: 1040;
    padding: 0;
    display: flex;
    align-items: center;
}
.toc-mobile-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}
.toc-mobile-btn:focus { color: var(--text-muted); }
@media (hover: hover) and (pointer: fine) {
    .toc-mobile-btn:hover { color: var(--text-primary); }
}
.toc-mobile-btn.active { color: #60a5fa; }
.toc-mobile-btn.active:focus { color: #60a5fa; }
.toc-mobile-btn.active i { transform: rotate(-90deg); }
.toc-mobile-btn i { font-size: 12px; transition: transform 0.15s; }
.toc-panel {
    position: fixed;
    top: 96px;
    right: 16px;
    left: auto;
    z-index: 1035;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    background: #1b1b1f;
    border: 1px solid var(--border-strong);
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    display: none;
    box-sizing: border-box;
}
.toc-panel-inner {
    padding: 8px 12px 16px 16px;
    min-width: 200px;
}

/* 移动端相关文章（底部） */
.related-posts { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.related-posts-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 1rem; display: flex; align-items: center; gap: 0.35rem; }
.related-posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; }
.related-post-card {
    display: block;
    padding: 14px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.related-post-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: rgba(96,165,250,0.15);
    color: inherit;
    text-decoration: none;
}
.related-post-card .rp-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.4rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.related-post-card:hover .rp-title { color: #60a5fa; }
.related-post-card .rp-meta { font-size: 0.75rem; color: var(--text-dim); display: flex; align-items: center; gap: 0.4rem; }
.related-post-card .rp-cat { background: rgba(37,99,235,0.12); color: #60a5fa; padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.7rem; }

/* ================================================================
   文章详情 — 响应式断点（参照 xmagicer）
   ================================================================ */
/* <992px: 左侧栏隐藏，内容全宽，目录用右上角浮动按钮 */

/* 992~1280px: 左侧栏270px可见，无目录，内容从贯穿线右侧开始 */
@media (min-width: 992px) and (max-width: 1279.98px) {
    .post-page-wrapper { grid-template-columns: 1fr; margin: 0 auto; }
    .post-left-sidebar { width: 270px; padding: 64px 10px 96px 32px; }
    .post-right-sidebar { display: none; }
    .post-main { max-width: min(688px, calc(100vw - 318px)); margin-left: 294px; margin-right: 24px; }
    body:has(.post-page-wrapper) .navbar-search-container { margin-left: 112px; }
    .toc-mobile-bar { right: 12px; }
    .toc-panel { right: 12px; }
}
/* ≥1280px: 左侧栏270px + 目录224px，内容居中，导航栏网格对齐三栏 */
@media (min-width: 1280px) {
    .post-page-wrapper { grid-template-columns: 1fr; max-width: 1440px; margin: 0 auto; }
    .post-left-sidebar { width: 270px; padding: 64px 10px 96px 32px; }
    .post-right-sidebar { display: block !important; }
    .post-main { margin-left: 294px; margin-right: 24px; max-width: 688px; }
    .toc-mobile-bar { display: none !important; }
    .toc-panel { display: none !important; }

    /* 导航栏五列网格，间距缩小让内容更宽 */
    body:has(.post-page-wrapper) .navbar-inner {
        display: grid;
        grid-template-columns: 270px 24px minmax(0, 688px) 24px 224px;
        padding: 0;
        align-items: center;
        justify-content: start;
        height: 64px;
    }
    body:has(.post-page-wrapper) .navbar-inner > * {
        grid-row: 1;
    }
    /* 标题在侧栏列 */
    body:has(.post-page-wrapper) .navbar-brand {
        grid-column: 1;
        padding-left: 32px;
        width: auto;
        justify-self: start;
    }
    /* 搜索框在内容列 */
    body:has(.post-page-wrapper) .navbar-search-container {
        grid-column: 3;
        margin-left: 0;
        padding-left: 0;
    }
    /* 登录态：关于作者+药丸停在目录分割线左侧，保持药丸↔竖线的视觉间距 */
    body:has(.post-page-wrapper) .site-navbar.is-logged-in .navbar-right {
        grid-column: 3 / 5;
        justify-self: end;
        margin-right: calc(var(--nav-action-gap) + var(--post-nav-line-offset));
    }
    /* 游客态：关于作者+药丸占用登录后工作台+账号的位置 */
    body:has(.post-page-wrapper) .site-navbar.is-guest .navbar-right {
        grid-column: 5;
        justify-self: start;
        margin-left: calc(1px + var(--nav-action-gap) - var(--post-nav-line-offset));
        margin-right: 0;
    }
    /* 文章页登录态使用独立竖线，精确落在目录左侧分割线的同一列线 */
    body:has(.post-page-wrapper) .site-navbar.is-logged-in .nav-separator {
        display: block !important;
        grid-column: 5;
        justify-self: start;
        margin: 0;
        transform: translateX(calc(-1 * var(--post-nav-line-offset)));
    }
    body:has(.post-page-wrapper) .site-navbar.is-logged-in .navbar-right-logged {
        grid-column: 5;
        border-left: 0;
        margin-left: calc(1px + var(--nav-action-gap) - var(--post-nav-line-offset));
        padding-left: 0;
        gap: var(--nav-action-gap);
        min-height: 20px;
    }
    body:has(.post-page-wrapper) .site-navbar.is-guest .nav-separator {
        display: none !important;
    }
}

/* ≥1440px：页面居中，导航栏同步居中，侧栏背景延伸到视口左边缘 */
@media (min-width: 1440px) {
    body:has(.post-page-wrapper) .site-navbar {
        --post-nav-line-offset: 4px;
    }
    body:has(.post-page-wrapper) .navbar-inner {
        max-width: 1440px;
        margin: 0 auto;
        grid-template-columns: 270px 112px 688px 110px 224px;
        padding: 0 36px 0 0;
    }
    body:has(.post-page-wrapper) .post-main {
        margin-left: 382px;
        margin-right: 110px;
    }
    body:has(.post-page-wrapper) .post-left-sidebar {
        left: calc((100% - 1440px) / 2);
    }
    body:has(.post-page-wrapper) .post-page-wrapper::before {
        content: "";
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: calc((100% - 1440px) / 2);
        background: var(--post-sidebar-bg);
        z-index: 1;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .toc-mobile-bar { right: 12px; }
    .toc-panel { right: 12px; }
}

/* ================================================================
   移动端适配
   ================================================================ */
@media (max-width: 767.98px) {
    html, body { max-width: 100%; overflow-x: hidden; }
    body:has(.post-page-wrapper) .site-navbar {
        background-color: var(--post-sidebar-bg);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border-bottom: 1px solid var(--post-border);
    }
    .container { max-width: 100%; padding-left: var(--page-gutter); padding-right: var(--page-gutter); }
    .container:has(.mobile-home) { padding-left: 0; padding-right: 0; }
    .mobile-home .home-wrapper { width: 100%; max-width: 440px; margin: 0 auto; padding: 0 var(--page-gutter); }
    .mobile-home-content { flex-direction: column; align-items: center; width: 100%; gap: 0; }
    .mobile-home .blog-list-wrapper,
    .mobile-home .blog-info-wrapper {
        width: 100%;
        flex: 1 1 auto;
    }
    .mobile-author-wrapper { order: 1; }
    .mobile-home .blog-list-wrapper { order: 2; }
    .mobile-tag-wrapper { order: 3; margin-top: 1rem; }
    .toc-mobile-bar { right: 8px; }
    .toc-panel { right: 8px; left: 8px; top: 96px; max-height: 60vh; max-width: calc(100vw - 16px); }
    .post-article { padding-top: 1.5rem; padding-bottom: 1.5rem; }
    .post-title { font-size: 1.5rem; line-height: 2rem; letter-spacing: 0; }
    .post-content { font-size: 0.95rem; }
    .post-content h1 { font-size: 1.5rem; }
    .post-content h2 { font-size: 1.3rem; }
    .home-wrapper { padding: 0 12px; }
    .header-banner { padding: 2rem 0; text-align: center; }
    .hero-name { font-size: 1.5rem; }
    .hero-desc { font-size: 0.85rem; }
    .blog-item { width: 100%; padding: 0.75rem 1rem; margin: 0 auto 12px; }
    .blog-item .title { font-size: 1rem; }
    .blog-item .pin { display: none; }
    .post-toc-sidebar, .post-right-sidebar { display: none; }
    .post-left-sidebar { display: none; }
    .post-page-wrapper { display: block; width: 100%; max-width: 100%; padding: 0 16px; overflow-x: hidden; }
    .post-body { display: block; margin-left: 0; width: 100%; max-width: 100%; overflow-x: hidden; }
    .post-main { max-width: 100%; min-width: 0; overflow-x: hidden; }
    .post-content { max-width: 100%; overflow-x: hidden; }
    .post-content pre,
    .post-content table,
    .post-content .highlight,
    .post-content .mermaid,
    .post-content mjx-container {
        max-width: 100%;
        overflow-x: auto;
    }
    .post-content pre { padding: 1rem; }
    .post-content table { width: max-content; min-width: 100%; }
    .related-posts-grid { grid-template-columns: 1fr; }
    .blog-info-wrapper .card { padding: 0.75rem; }
    .overview-item .count { font-size: 1rem; }
    .blog-pagination { padding: 1rem 0 0.5rem; }
    .content-wrapper { flex-direction: column; }
    .blog-list-wrapper { flex: 1 1 auto; }
    .blog-info-wrapper { flex: 1 1 auto; width: 100%; }
    .mobile-home { display: block; }
}
@media (min-width: 768px) {
    .mobile-home { display: none; }
    .blog-list-wrapper { flex: 1 1 0; min-width: 0; }
    .blog-info-wrapper { flex: 0 0 300px; min-width: 0; }
    .post-page-wrapper { display: grid; grid-template-columns: 1fr; }
    .post-main { max-width: 688px; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }
}
