/* ==========================================================================
   PHPBlog Default Theme 3.0
   纯静态样式，主题色由 header.php 通过 :root 变量注入
   ========================================================================== */

:root {
    --primary: #2563eb;
    --primary-rgb: 37, 99, 235;
    --primary-light: #3b82f6;
    --primary-soft: rgba(var(--primary-rgb), .08);
    --primary-soft-2: rgba(var(--primary-rgb), .14);
    --text: #1e293b;
    --text-light: #64748b;
    --text-lighter: #94a3b8;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-lg: 0 18px 40px -16px rgba(15, 23, 42, .18), 0 8px 16px -12px rgba(15, 23, 42, .1);
    --max-width: 1280px;
    --header-height: 68px;
    --header-bg: rgba(255, 255, 255, .9);
    --code-bg: #0f172a;
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-code: "Fira Code", "JetBrains Mono", Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] {
    --text: #e2e8f0;
    --text-light: #a8b6c8;
    --text-lighter: #74839a;
    --bg: #0b1220;
    --card-bg: #121c2e;
    --border: #243247;
    --border-strong: #33465f;
    --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 1px 2px rgba(0, 0, 0, .2);
    --shadow-lg: 0 20px 50px -20px rgba(0, 0, 0, .7), 0 8px 20px -14px rgba(0, 0, 0, .4);
    --header-bg: rgba(11, 18, 32, .9);
    --primary-soft: rgba(var(--primary-rgb), .16);
    --primary-soft-2: rgba(var(--primary-rgb), .24);
    --code-bg: #060b14;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 24px); }
body {
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background-color .25s ease, color .25s ease;
}
body.has-announcement { --header-offset: 42px; }
img { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; transition: color .2s ease, opacity .2s ease; }
a:hover { color: var(--primary-light); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
ul, ol { list-style: none; }
::selection { background: rgba(var(--primary-rgb), .2); }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: fixed; left: 16px; top: -80px; z-index: 5000;
    background: var(--primary); color: #fff; padding: 10px 18px; border-radius: 8px;
    transition: top .2s ease;
}
.skip-link:focus { top: 16px; color: #fff; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--card-bg); color: var(--text); font-size: 14px; font-weight: 600;
    line-height: 1.4; transition: all .2s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid rgba(var(--primary-rgb), .45); outline-offset: 2px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); color: #fff; }
.btn-light { background: #fff; border-color: #fff; color: var(--primary); }
.btn-light:hover { color: var(--primary); background: #f8fafc; border-color: #f8fafc; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-light); }

/* ---------- 阅读进度 ---------- */
.reading-progress {
    position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 4000;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    box-shadow: 0 0 10px rgba(var(--primary-rgb), .55);
    transition: width .08s linear;
}

/* ---------- 公告 ---------- */
.site-announcement {
    background: linear-gradient(90deg, rgba(var(--primary-rgb), .1), rgba(var(--primary-rgb), .04));
    border-bottom: 1px solid rgba(var(--primary-rgb), .16);
    color: var(--primary); font-size: 13px;
}
.announcement-inner {
    max-width: var(--max-width); margin: 0 auto; padding: 9px 24px;
    display: flex; align-items: center; gap: 10px;
}
.announcement-inner span { flex: 1; min-width: 0; }
.announcement-close {
    background: none; border: 0; color: inherit; font-size: 20px; line-height: 1;
    opacity: .6; padding: 0 4px;
}
.announcement-close:hover { opacity: 1; }

/* ---------- 主题预览条 ---------- */
.theme-preview-bar {
    position: relative; z-index: 1200; display: flex; align-items: center; justify-content: center;
    gap: 18px; flex-wrap: wrap; padding: 8px 18px; background: #0f172a; color: #e2e8f0; font-size: 13px;
}
.theme-preview-bar a, .theme-preview-bar button {
    color: #93c5fd; background: none; border: 0; font-size: 13px; text-decoration: underline;
}
.theme-preview-actions { display: flex; gap: 14px; }

/* ---------- 头部 ---------- */
.site-header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    position: relative; z-index: 1000;
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    transition: box-shadow .25s ease, background .25s ease;
}
.site-header.is-sticky { position: sticky; top: 0; }
.site-header.is-scrolled { box-shadow: 0 8px 28px -20px rgba(15, 23, 42, .45); }
.header-inner {
    max-width: var(--max-width); margin: 0 auto; padding: 0 24px;
    height: var(--header-height); display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.site-logo {
    display: inline-flex; align-items: center; gap: 10px;
    font-size: 21px; font-weight: 800; letter-spacing: -.4px; color: var(--text);
    flex-shrink: 0;
}
.site-logo:hover { color: var(--primary); }
.site-logo img { height: 36px; width: auto; border-radius: 8px; }
.header-right { display: flex; align-items: center; gap: 5px; min-width: 0; }
.site-nav { display: flex; align-items: center; gap: 2px; }
.site-nav a {
    padding: 8px 13px; color: var(--text-light); font-size: 14px; font-weight: 500;
    border-radius: 8px; white-space: nowrap; transition: all .2s ease;
}
.site-nav a:hover, .site-nav a.active { color: var(--primary); background: var(--primary-soft); }
.header-icon-btn {
    width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 50%; background: transparent; color: var(--text-light); font-size: 15px;
    transition: all .2s ease;
}
.header-icon-btn:hover { background: var(--primary-soft); color: var(--primary); }
.header-user {
    display: inline-flex; align-items: center; gap: 7px; margin-left: 4px;
    padding: 4px 10px 4px 4px; border-radius: 22px; background: var(--bg);
    color: var(--text-light); font-size: 13px; max-width: 150px;
}
.header-user:hover { color: var(--primary); background: var(--primary-soft); }
.header-user img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.header-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-login {
    margin-left: 6px; padding: 7px 17px; font-size: 13px; font-weight: 600;
    border: 1px solid var(--primary); border-radius: 22px; color: var(--primary); white-space: nowrap;
}
.header-login:hover { background: var(--primary); color: #fff; }
.mobile-toggle {
    display: none; width: 38px; height: 38px; border: 0; border-radius: 50%;
    background: transparent; color: var(--text); font-size: 19px;
}

/* ---------- 移动菜单 ---------- */
.mobile-menu {
    position: fixed; inset: 0; z-index: 3000; background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(3px); display: flex; justify-content: flex-end;
}
.mobile-menu-panel {
    width: min(360px, 88vw); height: 100%; background: var(--card-bg); padding: 18px;
    display: flex; flex-direction: column; gap: 16px; overflow-y: auto;
    animation: slideInRight .25s ease;
}
.mobile-menu-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 17px; }
.mobile-menu-head button { border: 0; background: var(--bg); width: 34px; height: 34px; border-radius: 50%; color: var(--text-light); }
.mobile-search { display: flex; gap: 8px; }
.mobile-search input { flex: 1; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 10px; padding: 10px 14px; outline: none; }
.mobile-search input:focus { border-color: var(--primary); }
.mobile-search button { width: 44px; border: 0; border-radius: 10px; background: var(--primary); color: #fff; }
.mobile-nav { display: flex; flex-direction: column; gap: 2px; }
.mobile-nav a, .mobile-menu-foot a {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    border-radius: 10px; color: var(--text); font-size: 15px;
}
.mobile-nav a:hover, .mobile-menu-foot a:hover { background: var(--bg); color: var(--primary); }
.mobile-nav i, .mobile-menu-foot i { width: 18px; text-align: center; color: var(--primary); }
.mobile-menu-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
@keyframes slideInRight { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 全局搜索 ---------- */
.search-overlay {
    position: fixed; inset: 0; z-index: 3500; padding: 9vh 16px 16px;
    display: flex; align-items: flex-start; justify-content: center;
    background: rgba(8, 15, 30, .58); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    animation: fadeIn .18s ease;
}
.search-dialog {
    width: min(700px, 100%); max-height: 78vh; display: flex; flex-direction: column;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 18px;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45); overflow: hidden;
    animation: dialogUp .22s ease;
}
.search-dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 10px; }
.search-dialog-head h2 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.search-dialog-head h2 i { color: var(--primary); }
.search-dialog-head button { border: 0; background: var(--bg); color: var(--text-light); width: 32px; height: 32px; border-radius: 50%; }
.search-dialog-form { display: flex; gap: 10px; padding: 8px 24px 16px; border-bottom: 1px solid var(--border); }
.search-dialog-form input {
    flex: 1; border: 0; outline: none; background: transparent; color: var(--text);
    font-size: 19px; font-weight: 600; padding: 8px 0;
}
.search-dialog-form input::placeholder { color: var(--text-lighter); font-weight: 400; }
.search-dialog-form button {
    border: 0; width: 42px; height: 42px; border-radius: 10px; background: var(--primary); color: #fff;
}
.search-results { overflow-y: auto; padding: 10px 12px 12px; min-height: 140px; }
.search-result-item {
    display: flex; gap: 14px; padding: 12px; border-radius: 10px; color: var(--text);
    transition: background .15s ease;
}
.search-result-item:hover, .search-result-item.is-active { background: var(--bg); color: var(--text); }
.search-result-thumb {
    width: 64px; height: 52px; flex: 0 0 64px; border-radius: 8px; overflow: hidden;
    background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center;
}
.search-result-thumb img { width: 100%; height: 100%; object-fit: cover; }
.search-result-body { min-width: 0; flex: 1; }
.search-result-title { font-size: 14px; font-weight: 650; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.search-result-excerpt { font-size: 12px; color: var(--text-light); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.search-result-meta { font-size: 11px; color: var(--text-lighter); margin-top: 4px; }
.search-result-item mark { background: rgba(var(--primary-rgb), .16); color: var(--primary); padding: 0 2px; border-radius: 2px; }
.search-hint { display: flex; align-items: center; gap: 16px; padding: 18px 12px 8px; color: var(--text-lighter); font-size: 12px; flex-wrap: wrap; }
.search-hint kbd {
    display: inline-block; min-width: 20px; text-align: center; padding: 1px 5px; margin-right: 4px;
    border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--bg); font-family: inherit;
}
.search-empty { text-align: center; padding: 34px 16px; color: var(--text-light); font-size: 14px; }
.search-empty i { display: block; font-size: 30px; margin-bottom: 10px; color: var(--text-lighter); }
.search-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 34px; color: var(--text-light); font-size: 14px; }
.search-recent { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; }
.search-recent button {
    border: 1px solid var(--border); background: var(--bg); color: var(--text-light);
    padding: 5px 12px; border-radius: 999px; font-size: 12px;
}
.search-dialog-foot { padding: 12px 24px; border-top: 1px solid var(--border); font-size: 12px; text-align: right; }
.search-dialog-foot a { color: var(--text-light); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes dialogUp { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 主体布局 ---------- */
.site-main {
    max-width: var(--max-width); margin: 0 auto; padding: 32px 24px 48px;
    display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start;
}
.site-main.full-width { grid-template-columns: minmax(0, 1fr); max-width: 940px; }
.site-main.full-width .content { min-width: 0; }
.content { min-width: 0; }

/* ---------- 归档 / 分类头 ---------- */
.archive-header {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 26px 30px; margin-bottom: 24px; box-shadow: var(--shadow);
}
.archive-title-row { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
.archive-icon {
    width: 52px; height: 52px; border-radius: 14px; background: var(--primary-soft);
    color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 21px; flex-shrink: 0;
}
.archive-title { font-size: 26px; font-weight: 800; line-height: 1.3; letter-spacing: -.4px; }
.archive-desc { color: var(--text-light); font-size: 14px; margin-top: 4px; }
.archive-stats { display: flex; align-items: center; gap: 22px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); color: var(--text-light); font-size: 13px; flex-wrap: wrap; }
.archive-stats strong { color: var(--primary); font-size: 16px; }
.archive-feed { margin-left: auto; }
.archive-children { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.archive-children a {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
    background: var(--bg); color: var(--text-light); font-size: 12px;
}
.archive-children a span { color: var(--text-lighter); }
.archive-children a:hover { background: var(--primary-soft); color: var(--primary); }
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; font-size: 12.5px; color: var(--text-lighter); }
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--border-strong); }
.breadcrumb .current { color: var(--text-light); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 列表 / 卡片 ---------- */
.post-list { display: flex; flex-direction: column; gap: 20px; }
.post-card {
    display: flex; background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: rgba(var(--primary-rgb), .22); }
.post-card-cover-link { position: relative; display: block; width: 280px; flex: 0 0 280px; min-height: 196px; overflow: hidden; background: var(--bg); }
.post-card-cover { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .55s cubic-bezier(.2, .7, .3, 1); }
.post-card:hover .post-card-cover { transform: scale(1.045); }
.post-card-cover-mask { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(15, 23, 42, .22)); opacity: .6; }
.post-card-cover-placeholder {
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary), #38bdf8); color: #fff;
    font-size: 58px; font-weight: 800; text-shadow: 0 4px 20px rgba(0, 0, 0, .18);
}
.post-badge-top {
    position: absolute; left: 12px; top: 12px; z-index: 2; display: inline-flex; align-items: center; gap: 4px;
    background: rgba(239, 68, 68, .92); color: #fff; border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 600;
}
.post-card-body { flex: 1; min-width: 0; padding: 22px 24px; display: flex; flex-direction: column; }
.post-card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--text-lighter); margin-bottom: 9px; }
.cat-tag {
    display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px;
    background: var(--primary-soft); color: var(--primary); font-size: 11.5px; font-weight: 650;
}
.cat-tag:hover { background: var(--primary); color: #fff; }
.meta-item { display: inline-flex; align-items: center; gap: 4px; }
.post-top-mark { color: #ef4444; font-weight: 600; }
.post-card-title { font-size: 20px; font-weight: 750; line-height: 1.42; letter-spacing: -.2px; margin-bottom: 8px; }
.post-card-title a { color: var(--text); }
.post-card-title a:hover { color: var(--primary); }
.post-card-excerpt {
    color: var(--text-light); font-size: 14px; line-height: 1.75; margin-bottom: 12px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.post-card-tags a { font-size: 11.5px; color: var(--text-lighter); }
.post-card-tags a:hover { color: var(--primary); }
.post-card-footer {
    margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.author-info { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-light); min-width: 0; }
.author-info img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.author-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.author-info:hover { color: var(--primary); }
.post-card-footer .stats { display: flex; align-items: center; gap: 13px; font-size: 12px; color: var(--text-lighter); flex-shrink: 0; }
.post-card-footer .stats span { display: inline-flex; align-items: center; gap: 4px; }
.read-more {
    width: 28px; height: 28px; border-radius: 50%; background: var(--bg); color: var(--text-light);
    display: inline-flex; align-items: center; justify-content: center; font-size: 11px;
}
.read-more:hover { background: var(--primary); color: #fff; }

/* 紧凑布局 */
.post-list-compact .post-card-cover-link { width: 190px; flex-basis: 190px; min-height: 150px; }
.post-list-compact .post-card-body { padding: 18px 20px; }
.post-list-compact .post-card-title { font-size: 17px; }
.post-list-compact .post-card-excerpt { -webkit-line-clamp: 1; margin-bottom: 8px; }
.post-list-compact .post-card-tags { display: none; }
/* 杂志布局 */
.post-list-magazine .post-card:first-child { flex-direction: column; }
.post-list-magazine .post-card:first-child .post-card-cover-link { width: 100%; flex-basis: auto; height: 380px; min-height: 0; }
.post-list-magazine .post-card:first-child .post-card-title { font-size: 27px; }
.post-list-magazine .post-card:first-child .post-card-body { padding: 28px 32px 30px; position: relative; }
.post-list-magazine .post-card:first-child .post-card-cover-link + .post-card-body { margin-top: -54px; z-index: 2; background: var(--card-bg); border-radius: 18px 18px 0 0; margin-left: 24px; margin-right: 24px; }

/* 空状态 */
.empty-state {
    text-align: center; padding: 70px 24px; background: var(--card-bg);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.empty-state-icon { width: 74px; height: 74px; margin: 0 auto 18px; border-radius: 22px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 28px; }
.empty-state h2 { font-size: 20px; font-weight: 750; margin-bottom: 8px; }
.empty-state p { color: var(--text-light); font-size: 14px; margin-bottom: 20px; }
.empty-state-tags { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.empty-state-tags a { padding: 4px 12px; border-radius: 999px; background: var(--bg); color: var(--text-light); font-size: 12px; }

/* ---------- 加载更多 / 分页 ---------- */
.load-more-wrap { text-align: center; margin-top: 28px; }
.load-more-btn { min-width: 190px; height: 44px; border-radius: 999px; position: relative; }
.load-more-btn.is-loading { pointer-events: none; opacity: .75; }
.load-more-btn.is-loading .load-more-text { visibility: hidden; }
.load-more-btn.is-loading .load-more-spinner { display: block; }
.load-more-spinner {
    display: none; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px;
    margin: -9px 0 0 -9px; border: 2px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.load-more-hint, .load-more-end { margin-top: 10px; font-size: 12px; color: var(--text-lighter); }
.load-more-end i { color: #22c55e; }
.pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 30px 0 10px; }
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 38px;
    padding: 0 12px; border-radius: 9px; font-size: 13px; background: var(--card-bg);
    border: 1px solid var(--border); color: var(--text); transition: all .2s ease;
}
.pagination a:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .current { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pagination .dots { border: 0; background: transparent; color: var(--text-lighter); }

/* ---------- 文章正文 ---------- */
.single-post, .single-page, .comments-section, .related-section {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.single-post, .single-page { padding: 38px 44px 36px; }
.single-header { margin: 14px 0 22px; }
.single-title { font-size: 33px; line-height: 1.34; font-weight: 800; letter-spacing: -.7px; margin-bottom: 14px; }
.single-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; color: var(--text-light); font-size: 13px; }
.single-meta span { display: inline-flex; align-items: center; gap: 5px; }
.single-meta a { color: var(--text-light); }
.single-meta a:hover { color: var(--primary); }
.meta-author img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.single-cover { margin: 0 0 26px; border-radius: 12px; overflow: hidden; background: var(--bg); }
.single-cover img { width: 100%; max-height: 460px; object-fit: cover; display: block; }
.post-summary { margin: 0 0 22px; padding: 13px 17px; border-left: 3px solid var(--primary); border-radius: 0 10px 10px 0; background: rgba(var(--primary-rgb), .055); }
.post-summary > span { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--primary); margin-bottom: 4px; }
.post-summary p { margin: 0; font-size: 13px; line-height: 1.8; color: var(--text-light); }
.post-body { font-size: 16.5px; line-height: 2; color: #334155; word-break: break-word; }
[data-theme="dark"] .post-body { color: #d4deeb; }
.post-body > *:first-child { margin-top: 0; }
.post-body h2, .post-body h3, .post-body h4 { color: var(--text); scroll-margin-top: calc(var(--header-height) + 20px); line-height: 1.45; }
.post-body h2 { font-size: 23px; font-weight: 750; margin: 38px 0 16px; padding-bottom: 9px; border-bottom: 1px solid var(--border); }
.post-body h3 { font-size: 19px; font-weight: 700; margin: 28px 0 12px; }
.post-body h4 { font-size: 16.5px; font-weight: 700; margin: 22px 0 10px; }
.post-body p { margin-bottom: 17px; }
.post-body a { text-decoration: underline; text-decoration-color: rgba(var(--primary-rgb), .3); text-underline-offset: 3px; }
.post-body a:hover { text-decoration-color: var(--primary); }
.post-body img { max-width: 100%; border-radius: 10px; margin: 18px 0; cursor: zoom-in; display: block; }
.post-body ul, .post-body ol { margin: 14px 0 18px 26px; }
.post-body ul { list-style: disc; }
.post-body ol { list-style: decimal; }
.post-body li { margin-bottom: 7px; }
.post-body blockquote {
    border-left: 4px solid var(--primary); padding: 15px 20px; border-radius: 0 10px 10px 0;
    background: var(--primary-soft); margin: 20px 0; color: var(--text-light);
}
.post-body blockquote p:last-child { margin-bottom: 0; }
.post-body pre {
    position: relative; background: var(--code-bg); color: #e2e8f0; padding: 22px 24px;
    border-radius: 12px; overflow-x: auto; margin: 22px 0; font-size: 13.5px; line-height: 1.72;
    border: 1px solid rgba(148, 163, 184, .16);
}
.post-body pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.post-body code { background: var(--primary-soft); color: var(--primary); padding: 2px 6px; border-radius: 5px; font-size: .9em; font-family: var(--font-code); }
.post-body table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px; }
.post-body table th, .post-body table td { border: 1px solid var(--border); padding: 10px 13px; text-align: left; }
.post-body table th { background: var(--bg); font-weight: 650; }
.post-body hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.post-body .table-wrap { overflow-x: auto; margin: 18px 0; }
.code-copy-btn {
    position: absolute; top: 10px; right: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 5px;
    background: rgba(148, 163, 184, .16); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, .2);
    padding: 4px 9px; border-radius: 6px; font-size: 11px; opacity: 0; transition: opacity .2s ease;
}
.post-body pre:hover .code-copy-btn, .code-copy-btn:focus { opacity: 1; }
.code-lang { position: absolute; top: 10px; left: 14px; font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: .8px; }
.post-body .heading-anchor { margin-left: 8px; opacity: 0; font-size: .75em; text-decoration: none; }
.post-body h2:hover .heading-anchor, .post-body h3:hover .heading-anchor { opacity: 1; }

/* 阅读工具栏 */
.single-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin: 0 0 22px; padding: 10px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.toolbar-group { display: flex; align-items: center; gap: 4px; }
.toolbar-btn {
    display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent;
    color: var(--text-light); padding: 6px 10px; border-radius: 8px; font-size: 12.5px;
    transition: all .2s ease;
}
.toolbar-btn:hover { background: var(--primary-soft); color: var(--primary); }
.toolbar-btn.is-active { background: var(--primary-soft); color: var(--primary); }
.like-btn.is-liked { color: #ef4444; }
.like-btn.is-liked i { font-weight: 900; }
.share-native { display: none; }

/* 目录 */
.toc-card {
    border: 1px solid var(--border); border-radius: 12px; background: var(--bg);
    padding: 0; margin-bottom: 24px; overflow: hidden;
}
.toc-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 16px; font-size: 13px; font-weight: 650; }
.toc-head i { color: var(--primary); margin-right: 6px; }
.toc-head button { border: 0; background: none; color: var(--text-lighter); font-size: 18px; line-height: 1; }
.toc-list { padding: 0 16px 14px; display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.toc-list a { display: block; padding: 5px 8px; border-radius: 6px; color: var(--text-light); font-size: 12.5px; line-height: 1.5; }
.toc-list a:hover { background: var(--card-bg); color: var(--primary); }
.toc-list a.is-active { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.toc-list a.toc-h3 { padding-left: 22px; font-size: 12px; }

/* 来源 / 标签 / 分享 */
.post-source {
    margin-top: 26px; padding: 12px 16px; border-radius: 10px; background: var(--bg);
    color: var(--text-light); font-size: 13px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.post-source i { color: var(--primary); }
.post-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 24px; }
.post-tags-label { color: var(--text-light); font-size: 13px; margin-right: 2px; }
.post-tags a { padding: 4px 13px; border-radius: 999px; background: var(--bg); color: var(--text-light); font-size: 12.5px; }
.post-tags a:hover { background: var(--primary); color: #fff; }
.share-bar { display: flex; align-items: center; gap: 9px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.share-label { font-size: 13px; color: var(--text-light); }
.share-btn { width: 34px; height: 34px; border: 0; border-radius: 50%; color: #fff; font-size: 14px; transition: transform .2s ease; }
.share-btn:hover { transform: translateY(-2px) scale(1.04); }
.share-weibo { background: #e6162d; }
.share-qq { background: #12b7f5; }
.share-copy { background: var(--text-light); }
.share-tip { margin-left: auto; font-size: 12px; color: var(--text-lighter); }

/* 作者卡 */
.author-card {
    display: flex; align-items: center; gap: 16px; margin-top: 28px; padding: 18px 20px;
    border-radius: 12px; background: var(--bg); border: 1px solid var(--border);
}
.author-card img { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.author-card-body { flex: 1; min-width: 0; }
.author-card-name { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.author-card-name span { padding: 1px 7px; border-radius: 4px; background: var(--primary-soft); color: var(--primary); font-size: 10px; font-weight: 600; }
.author-card-body p { margin-top: 2px; color: var(--text-light); font-size: 12.5px; }
.author-card-link { flex-shrink: 0; font-size: 12px; color: var(--text-light); }
.author-card-link:hover { color: var(--primary); }

/* 上下篇 */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--border); }
.post-nav-item a { display: block; padding: 14px 16px; border-radius: 10px; background: var(--bg); color: var(--text); height: 100%; }
.post-nav-item a:hover { background: var(--primary-soft); }
.post-nav-next { text-align: right; }
.post-nav-label { display: block; font-size: 11.5px; color: var(--text-lighter); margin-bottom: 4px; }
.post-nav-title { font-size: 13.5px; font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-nav-empty { display: block; padding: 14px 16px; color: var(--text-lighter); font-size: 12.5px; text-align: center; }

/* 相关推荐 */
.related-section { margin-top: 24px; padding: 28px 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.section-head h2 { font-size: 18px; font-weight: 750; }
.section-head h2 i { color: var(--primary); margin-right: 6px; }
.section-head span { font-size: 12px; color: var(--text-lighter); }
.related-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.related-card { display: flex; gap: 12px; padding: 12px; border-radius: 10px; background: var(--bg); color: var(--text); border: 1px solid transparent; }
.related-card:hover { border-color: rgba(var(--primary-rgb), .2); background: var(--primary-soft); color: var(--text); }
.related-cover { width: 78px; height: 58px; border-radius: 8px; overflow: hidden; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.related-cover img { width: 100%; height: 100%; object-fit: cover; }
.related-body { min-width: 0; }
.related-body h3 { font-size: 13.5px; line-height: 1.5; font-weight: 650; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.related-meta { margin-top: 5px; font-size: 11px; color: var(--text-lighter); }

/* 密码 */
.password-card {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); text-align: center; padding: 56px 40px;
}
.password-icon { width: 68px; height: 68px; border-radius: 20px; background: var(--primary-soft); color: var(--primary); font-size: 26px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.password-card h1 { font-size: 24px; margin-bottom: 8px; }
.password-card > p { color: var(--text-light); font-size: 14px; margin-bottom: 22px; }
.password-form { max-width: 320px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.password-form input { width: 100%; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 10px; padding: 12px 15px; outline: none; text-align: center; }
.password-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-error { max-width: 320px; margin: 0 auto 14px; background: #fef2f2; color: #dc2626; border-radius: 8px; padding: 8px 12px; font-size: 13px; }

/* ---------- 评论 ---------- */
.comments-section { margin-top: 24px; padding: 30px 34px; scroll-margin-top: calc(var(--header-height) + 20px); }
.comments-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.comments-head h2 { font-size: 18px; font-weight: 750; }
.comments-head h2 i { color: var(--primary); margin-right: 6px; }
.comments-count { display: inline-flex; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; align-items: center; justify-content: center; }
.comments-audit-hint { font-size: 11.5px; color: var(--text-lighter); }
.comment-form { padding: 16px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); margin-bottom: 24px; position: relative; }
.comment-reply-hint { display: flex; align-items: center; gap: 7px; padding: 7px 10px; margin-bottom: 10px; background: var(--primary-soft); color: var(--primary); border-radius: 7px; font-size: 12px; }
.comment-reply-hint button { margin-left: auto; border: 0; background: transparent; color: inherit; font-size: 17px; line-height: 1; }
.comment-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.comment-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-light); }
.comment-fields em { color: #ef4444; font-style: normal; }
.comment-fields input, .comment-textarea-wrap textarea, .comment-captcha input {
    width: 100%; border: 1px solid var(--border); background: var(--card-bg); color: var(--text);
    border-radius: 8px; padding: 9px 11px; outline: none; font-size: 13.5px; transition: border-color .2s ease, box-shadow .2s ease;
}
.comment-fields input:focus, .comment-textarea-wrap textarea:focus, .comment-captcha input:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.comment-textarea-wrap { display: block; position: relative; }
.comment-textarea-wrap textarea { resize: vertical; min-height: 120px; line-height: 1.7; padding-bottom: 26px; }
.comment-char-count { position: absolute; right: 10px; bottom: 7px; font-size: 11px; color: var(--text-lighter); }
.comment-identity { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; font-size: 13px; color: var(--text-light); }
.comment-identity img { width: 32px; height: 32px; border-radius: 50%; }
.comment-identity-tip { font-size: 10px; color: var(--primary); background: var(--primary-soft); padding: 1px 6px; border-radius: 4px; }
.comment-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.comment-captcha { display: flex; align-items: center; gap: 7px; }
.captcha-question { font-size: 13px; color: var(--text-light); font-weight: 600; white-space: nowrap; }
.comment-captcha input { width: 80px; padding: 7px 9px; }
.captcha-refresh { border: 0; background: transparent; color: var(--text-lighter); font-size: 13px; padding: 5px; }
.captcha-refresh:hover { color: var(--primary); }
.comment-submit-wrap { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.comment-tip { font-size: 11.5px; color: var(--text-lighter); }
.comment-submit-wrap .btn { padding: 9px 20px; font-size: 13px; }
.comment-honeypot { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.comment-list { display: flex; flex-direction: column; }
.comment-item { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: 0; }
.comment-avatar-wrap img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.comment-main { flex: 1; min-width: 0; }
.comment-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 4px; }
.comment-author { font-size: 13.5px; font-weight: 650; }
.comment-badge-admin { font-size: 10px; color: #fff; background: var(--primary); border-radius: 4px; padding: 1px 5px; }
.comment-meta time { font-size: 11.5px; color: var(--text-lighter); }
.comment-body { font-size: 13.8px; line-height: 1.8; color: var(--text-light); word-break: break-word; }
.comment-actions { margin-top: 3px; }
.comment-reply-btn { border: 0; background: transparent; color: var(--text-lighter); font-size: 11.5px; padding: 2px 0; }
.comment-reply-btn:hover { color: var(--primary); }
.comment-children { margin-top: 10px; padding-left: 16px; border-left: 2px solid var(--border); display: flex; flex-direction: column; }
.comment-children .comment-item { padding: 12px 0; }
.comment-children .comment-avatar-wrap img { width: 32px; height: 32px; }
.comment-children .comment-body { font-size: 13px; }
.comments-empty { text-align: center; padding: 38px 20px; color: var(--text-lighter); font-size: 14px; }
.comments-empty i { display: block; font-size: 34px; margin-bottom: 10px; color: var(--border-strong); }
.comments-closed { text-align: center; padding: 22px; border-radius: 10px; background: var(--bg); color: var(--text-light); font-size: 13px; }
.comments-login-tip { text-align: center; padding: 26px; border-radius: 10px; background: var(--bg); color: var(--text-light); font-size: 13px; }
.comments-login-tip p { margin-bottom: 12px; }
.comments-loading { text-align: center; padding: 16px; color: var(--text-lighter); font-size: 12px; }

/* ---------- 侧边栏 ---------- */
.sidebar { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.widget { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.widget-title { display: flex; align-items: center; gap: 7px; font-size: 14.5px; font-weight: 750; margin-bottom: 15px; }
.widget-title i { color: var(--primary); font-size: 13px; }
.widget-title-dot { flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); margin-left: 4px; }
.widget-author { text-align: center; }
.author-avatar-ring { width: 92px; height: 92px; margin: 0 auto 12px; padding: 3px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #38bdf8); }
.author-avatar-ring img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid var(--card-bg); display: block; }
.author-name { font-size: 17px; font-weight: 750; }
.author-bio { font-size: 12.5px; color: var(--text-light); margin-top: 4px; line-height: 1.7; }
.author-stats { display: flex; justify-content: center; gap: 22px; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--border); }
.author-stats div { display: flex; flex-direction: column; align-items: center; }
.author-stats strong { font-size: 19px; color: var(--primary); font-weight: 800; line-height: 1.3; }
.author-stats span { font-size: 11px; color: var(--text-lighter); }
.widget-cta { display: inline-flex; align-items: center; gap: 6px; margin-top: 13px; font-size: 12px; color: var(--text-light); padding: 6px 14px; border-radius: 999px; background: var(--bg); }
.widget-cta:hover { background: var(--primary); color: #fff; }
.widget-search { padding: 14px; }
.widget-search-form { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 9px; padding: 0 10px; border: 1px solid transparent; }
.widget-search-form:focus-within { border-color: var(--primary); background: var(--card-bg); box-shadow: 0 0 0 3px var(--primary-soft); }
.widget-search-form > i { color: var(--text-lighter); font-size: 12px; }
.widget-search-form input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 0; outline: none; color: var(--text); font-size: 13px; }
.widget-search-form button { border: 0; background: transparent; color: var(--text-lighter); padding: 6px; }
.widget-search-form button:hover { color: var(--primary); }
.cat-list { display: flex; flex-direction: column; }
.cat-list a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 2px; border-bottom: 1px dashed var(--border); color: var(--text); font-size: 13px; }
.cat-list a:last-child { border-bottom: 0; }
.cat-list a:hover { color: var(--primary); }
.cat-list a > span:first-child { display: flex; align-items: center; gap: 8px; }
.cat-list i { color: var(--primary); width: 15px; text-align: center; font-size: 12px; }
.cat-count { min-width: 24px; text-align: center; padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--text-lighter); font-size: 11px; }
.cat-list a:hover .cat-count { background: var(--primary-soft); color: var(--primary); }
.hot-list { display: flex; flex-direction: column; gap: 12px; }
.hot-list li { display: flex; gap: 10px; align-items: flex-start; }
.hot-index { width: 20px; height: 20px; border-radius: 5px; background: var(--bg); color: var(--text-lighter); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.hot-index.is-top { background: var(--primary); color: #fff; }
.hot-body { min-width: 0; }
.hot-body a { display: block; color: var(--text); font-size: 13px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hot-body a:hover { color: var(--primary); }
.hot-body > span { font-size: 11px; color: var(--text-lighter); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-cloud a { font-size: 12px; color: var(--text-light); background: var(--bg); padding: 4px 10px; border-radius: 999px; transform: scale(var(--tag-weight, 1)); }
.tag-cloud a:hover { background: var(--primary); color: #fff; }
.recent-comments li { display: flex; gap: 9px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.recent-comments li:last-child { border-bottom: 0; padding-bottom: 0; }
.recent-comments img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; margin-top: 2px; }
.recent-comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; font-size: 12px; }
.recent-comment-head strong { font-weight: 650; }
.recent-comment-head span { color: var(--text-lighter); }
.recent-comment-head a { color: var(--text); }
.recent-comment-head a:hover { color: var(--primary); }
.recent-comments p { margin-top: 2px; font-size: 12px; color: var(--text-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-links { display: flex; flex-wrap: wrap; gap: 7px; }
.friend-links a { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 7px; background: var(--bg); color: var(--text-light); font-size: 12px; }
.friend-links a:hover { background: var(--primary-soft); color: var(--primary); }
.friend-links img { width: 16px; height: 16px; border-radius: 3px; }
.widget-subscribe { text-align: center; background: linear-gradient(145deg, var(--primary), #1d4ed8); color: #fff; border: 0; }
.widget-subscribe .subscribe-icon { width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 50%; background: rgba(255, 255, 255, .16); display: flex; align-items: center; justify-content: center; font-size: 17px; }
.widget-subscribe h3 { font-size: 15px; font-weight: 700; }
.widget-subscribe p { font-size: 12px; color: rgba(255, 255, 255, .75); margin: 3px 0 13px; }
.widget-subscribe .btn { padding: 8px 18px; font-size: 12px; }

/* ---------- 搜索页 ---------- */
.search-page-form { display: flex; gap: 9px; margin-top: 18px; }
.search-page-form input { flex: 1; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 10px; padding: 11px 15px; outline: none; }
.search-page-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; font-size: 12px; color: var(--text-lighter); align-items: center; }
.search-suggestions a { padding: 3px 10px; border-radius: 999px; background: var(--bg); color: var(--text-light); }
.search-suggestions a:hover { color: var(--primary); background: var(--primary-soft); }

/* ---------- 页脚 ---------- */
.site-footer { margin-top: 56px; background: #101827; color: #94a3b8; }
[data-theme="dark"] .site-footer { background: #070d18; }
.footer-inner { max-width: var(--max-width); margin: 0 auto; padding: 48px 24px 26px; }
.footer-top { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 36px; padding-bottom: 30px; border-bottom: 1px solid rgba(148, 163, 184, .14); }
.footer-brand { display: inline-flex; align-items: center; gap: 9px; color: #fff; font-size: 19px; font-weight: 750; margin-bottom: 10px; }
.footer-brand img { max-height: 32px; border-radius: 6px; }
.footer-brand:hover { color: #fff; }
.footer-desc { font-size: 13px; line-height: 1.8; color: #8c9bb0; max-width: 340px; }
.footer-desc-small { margin-top: 3px; color: #728096; }
.footer-tagline { margin-top: 10px; font-size: 12.5px; color: #7dd3fc; }
.footer-social { display: flex; gap: 8px; margin-top: 15px; }
.footer-social a { width: 32px; height: 32px; border-radius: 50%; background: rgba(148, 163, 184, .12); color: #b8c4d4; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.footer-social a:hover { background: var(--primary); color: #fff; }
.footer-col h4 { color: #dbe4ef; font-size: 13px; font-weight: 650; margin-bottom: 12px; }
.footer-col > a { display: block; color: #8c9bb0; font-size: 13px; padding: 3.5px 0; }
.footer-col > a:hover { color: #fff; }
.footer-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.footer-tags a { color: #8c9bb0; font-size: 12px; }
.footer-tags a:hover { color: #fff; }
.footer-muted { font-size: 12px; color: #64748b; }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding-top: 20px; font-size: 12px; color: #738197; }
.footer-bottom a { color: #8c9bb0; }
.footer-bottom a:hover { color: #fff; }
.footer-meta { display: inline-flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.footer-dot { margin: 0 5px; color: #475569; }
.footer-powered strong { color: #b8c4d4; }
.footer-theme { color: #64748b; }

/* ---------- 返回顶部 / Toast ---------- */
.back-to-top {
    position: fixed; right: 22px; bottom: 22px; z-index: 900; width: 42px; height: 42px;
    border: 0; border-radius: 50%; background: var(--primary); color: #fff; font-size: 15px;
    display: none; align-items: center; justify-content: center; box-shadow: 0 10px 24px -8px rgba(var(--primary-rgb), .6);
    transition: transform .2s ease, opacity .2s ease;
}
.back-to-top.show { display: flex; }
.back-to-top:hover { transform: translateY(-3px); }
.toast-container { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 5000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
    pointer-events: auto; display: inline-flex; align-items: center; gap: 8px;
    background: rgba(15, 23, 42, .94); color: #f1f5f9; padding: 10px 18px; border-radius: 999px;
    font-size: 13px; box-shadow: 0 16px 40px -16px rgba(0, 0, 0, .6);
    animation: toastIn .25s ease; max-width: 88vw;
}
.toast.is-success i { color: #4ade80; }
.toast.is-error i { color: #f87171; }
.toast.is-out { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateY(8px); opacity: 0; } }

/* ---------- 图片灯箱 ---------- */
.lightbox {
    position: fixed; inset: 0; z-index: 4500; background: rgba(2, 6, 23, .93);
    display: flex; align-items: center; justify-content: center; padding: 30px; cursor: zoom-out;
    animation: fadeIn .18s ease;
}
.lightbox img { max-width: 94vw; max-height: 88vh; border-radius: 8px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); cursor: default; }
.lightbox-close { position: absolute; top: 18px; right: 22px; width: 40px; height: 40px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 50%; background: rgba(255, 255, 255, .08); color: #fff; font-size: 19px; }
.lightbox-caption { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); color: #cbd5e1; font-size: 12.5px; max-width: 80vw; text-align: center; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .08); color: #fff; }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* ---------- 用户中心 / 旧页面兼容 ---------- */
.text-muted { color: var(--text-light); }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { border-bottom: 1px solid var(--border); padding: 9px 10px; text-align: left; font-size: 13px; }
.admin-table th { color: var(--text-light); font-weight: 600; }
.form-control { width: 100%; border: 1px solid var(--border); background: var(--card-bg); color: var(--text); border-radius: 8px; padding: 9px 12px; outline: none; }
.form-control:focus { border-color: var(--primary); }
.badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 11px; background: var(--primary-soft); color: var(--primary); }
.notice { background: var(--primary-soft); color: var(--primary); border-radius: 10px; padding: 12px 16px; font-size: 13px; }

/* ---------- 动画偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
    .site-main { grid-template-columns: minmax(0, 1fr) 290px; gap: 24px; }
    .post-card-cover-link { width: 230px; flex-basis: 230px; }
    .site-nav a { padding: 8px 9px; font-size: 13px; }
    .footer-top { grid-template-columns: 1.6fr 1fr 1fr; }
    .footer-col:last-child { grid-column: 2 / 4; }
}
@media (max-width: 900px) {
    .site-nav { display: none; }
    .mobile-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .site-main { grid-template-columns: minmax(0, 1fr); }
    .sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .widget-author { grid-column: 1 / -1; }
    .site-main.full-width { max-width: 100%; }
    .share-native { display: inline-flex; }
}
@media (max-width: 720px) {
    :root { --header-height: 60px; --radius: 12px; }
    .timeline-year { grid-template-columns: 1fr; gap: 10px; }
    .timeline-year::before { display: none; }
    .timeline-year-head { flex-direction: row; justify-content: flex-start; gap: 9px; }
    .timeline-year-badge { width: 48px; height: 48px; font-size: 13px; }
    .timeline-month { padding: 14px; }
    .link-apply { padding: 16px; }
    .link-apply .btn { width: 100%; }
    .link-apply-form { padding: 16px; }
    .link-apply-grid { grid-template-columns: 1fr; }
    .link-apply-submit .btn { width: 100%; }
    .error-page { padding: 42px 18px; }
    .error-code { letter-spacing: -3px; }
    .tag-directory { padding: 16px; gap: 8px; }
    .header-inner { padding: 0 14px; gap: 8px; }
    .site-logo { font-size: 18px; }
    .site-logo img { height: 30px; }
    .header-user span { display: none; }
    .header-user { padding: 3px; background: transparent; }
    .header-icon-btn { width: 34px; height: 34px; }
    .site-main { padding: 18px 14px 34px; gap: 18px; }
    .archive-header { padding: 18px; }
    .archive-title { font-size: 21px; }
    .archive-title-row { gap: 12px; }
    .archive-icon { width: 42px; height: 42px; border-radius: 11px; font-size: 17px; }
    .archive-feed { margin-left: 0; }
    .post-card, .post-list-magazine .post-card:first-child { flex-direction: column; }
    .post-card-cover-link, .post-list-magazine .post-card:first-child .post-card-cover-link,
    .post-list-compact .post-card-cover-link { width: 100%; flex-basis: auto; height: 210px; min-height: 0; }
    .post-card-body { padding: 17px 18px 18px; }
    .post-card-title, .post-list-magazine .post-card:first-child .post-card-title { font-size: 18px; }
    .post-card-excerpt { font-size: 13px; -webkit-line-clamp: 2; }
    .post-card-footer .stats { gap: 9px; }
    .post-list-magazine .post-card:first-child .post-card-cover-link + .post-card-body { margin: -34px 12px 0; padding-top: 20px; border-radius: 12px 12px 0 0; }
    .single-post, .single-page, .comments-section, .related-section { padding: 22px 18px; }
    .single-title { font-size: 25px; letter-spacing: -.4px; }
    .single-meta { gap: 9px; font-size: 12px; }
    .post-body { font-size: 16px; line-height: 1.9; }
    .post-body h2 { font-size: 20px; margin-top: 30px; }
    .post-body h3 { font-size: 17.5px; }
    .single-toolbar { align-items: flex-start; }
    .toolbar-btn span { display: none; }
    .share-tip { display: none; }
    .author-card { align-items: flex-start; flex-wrap: wrap; padding: 14px; }
    .author-card-link { margin-left: auto; }
    .post-nav { grid-template-columns: 1fr; }
    .post-nav-next { text-align: left; }
    .related-section { padding: 20px 18px; }
    .related-grid { grid-template-columns: 1fr; }
    .comments-section { padding: 22px 18px; }
    .comment-fields { grid-template-columns: 1fr; }
    .comment-form { padding: 13px; }
    .comment-submit-wrap { width: 100%; justify-content: space-between; }
    .comment-char-count { display: none; }
    .comment-children { padding-left: 9px; }
    .sidebar { grid-template-columns: 1fr; }
    .footer-top { grid-template-columns: 1fr 1fr; gap: 26px; }
    .footer-col:last-child { grid-column: auto; }
    .footer-bottom { flex-direction: column; align-items: flex-start; }
    .search-overlay { padding: 4vh 10px 10px; }
    .search-dialog { max-height: 90vh; border-radius: 14px; }
    .search-dialog-form input { font-size: 16px; }
    .load-more-hint { font-size: 11px; }
    .back-to-top { right: 14px; bottom: 14px; width: 38px; height: 38px; }
}
@media (max-width: 420px) {
    .post-card-cover-link, .post-list-magazine .post-card:first-child .post-card-cover-link { height: 180px; }
    .footer-top { grid-template-columns: 1fr; }
    .header-login { padding: 6px 12px; font-size: 12px; }
    .site-logo span { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------- 归档时间线 ---------- */
.archive-timeline { display: flex; flex-direction: column; gap: 28px; }
.timeline-year { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 22px; position: relative; }
.timeline-year::before { content: ""; position: absolute; left: 45px; top: 48px; bottom: 0; width: 2px; background: linear-gradient(var(--primary), var(--border)); opacity: .35; }
.timeline-year:last-child::before { display: none; }
.timeline-year-head { display: flex; flex-direction: column; align-items: center; gap: 5px; padding-top: 2px; }
.timeline-year-badge { width: 62px; height: 62px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800; box-shadow: 0 8px 22px -10px rgba(var(--primary-rgb), .7); }
.timeline-year-count { font-size: 11px; color: var(--text-lighter); }
.timeline-months { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.timeline-month { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.timeline-month-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: baseline; gap: 8px; }
.timeline-month-title span { color: var(--text-lighter); font-size: 11px; font-weight: 400; }
.timeline-items { display: flex; flex-direction: column; gap: 3px; }
.timeline-item { display: flex; align-items: center; gap: 11px; padding: 8px 9px; border-radius: 8px; color: var(--text); }
.timeline-item:hover { background: var(--primary-soft); color: var(--text); }
.timeline-item img, .timeline-thumb-placeholder { width: 46px; height: 38px; border-radius: 6px; object-fit: cover; flex-shrink: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--text-lighter); font-size: 12px; }
.timeline-item-body { flex: 1; min-width: 0; }
.timeline-item-title { display: block; font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-item-meta { display: block; font-size: 11px; color: var(--text-lighter); margin-top: 1px; }
.timeline-arrow { font-size: 10px; color: var(--text-lighter); }

/* ---------- 作者归档 ---------- */
.author-header-main { display: flex; align-items: center; gap: 18px; margin-top: 16px; }
.author-header-avatar { width: 86px; height: 86px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary-soft); flex-shrink: 0; }
.author-header-info { min-width: 0; }
.author-header-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px; color: var(--text-light); font-size: 12px; }
.author-header-meta i { color: var(--primary); margin-right: 3px; }
.author-header-meta a { color: var(--text-light); }
.author-header-meta a:hover { color: var(--primary); }

/* ---------- 标签目录 ---------- */
.tag-directory { display: flex; flex-wrap: wrap; gap: 10px; padding: 24px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); align-items: center; }
.tag-directory-item { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 14px; border-radius: 999px; background: var(--bg); color: var(--text); border: 1px solid transparent; line-height: 1.4; }
.tag-directory-item:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.tag-directory-item em { font-style: normal; font-size: 11px; color: var(--text-lighter); font-weight: 400; }
.tag-directory-item:hover em { color: rgba(255, 255, 255, .7); }

/* ---------- 友情链接 ---------- */
.link-group { margin-bottom: 26px; }
.link-group-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.link-group-title i { color: var(--primary); font-size: 14px; }
.link-group-title span { color: var(--text-lighter); font-size: 12px; font-weight: 400; }
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.link-card { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; color: var(--text); box-shadow: var(--shadow); }
.link-card:hover { border-color: rgba(var(--primary-rgb), .3); color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.link-logo { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; flex-shrink: 0; }
.link-logo-text { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary), #7c3aed); color: #fff; font-size: 19px; font-weight: 750; }
.link-body { flex: 1; min-width: 0; }
.link-body strong { display: block; font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-body span { display: block; font-size: 11.5px; color: var(--text-lighter); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-arrow { font-size: 11px; color: var(--text-lighter); }
.link-apply { display: flex; align-items: center; gap: 16px; padding: 22px 24px; margin-top: 8px; background: var(--card-bg); border: 1px dashed var(--border-strong); border-radius: var(--radius); flex-wrap: wrap; }
.link-apply-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; }
.link-apply > div:nth-child(2) { flex: 1; min-width: 200px; }
.link-apply h2 { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.link-apply p { font-size: 12.5px; color: var(--text-light); }
.link-apply-form { margin-top: 18px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.link-apply-form-head { margin-bottom: 15px; }
.link-apply-form-head h2 { font-size: 16px; font-weight: 700; }
.link-apply-form-head h2 i { color: var(--primary); margin-right: 5px; }
.link-apply-form-head p { font-size: 12px; color: var(--text-light); margin-top: 3px; }
.link-apply-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.link-apply-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-light); }
.link-apply-grid label.full { grid-column: 1 / -1; }
.link-apply-grid input { width: 100%; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 9px; padding: 9px 12px; outline: none; font-size: 13px; }
.link-apply-grid input:focus { border-color: var(--primary); background: var(--card-bg); box-shadow: 0 0 0 3px var(--primary-soft); }
.link-apply-honeypot { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.link-apply-submit { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 15px; flex-wrap: wrap; }
.link-apply-submit > span { font-size: 11.5px; color: var(--text-lighter); }
.link-apply-submit > span i { color: var(--primary); }

/* ---------- 404 ---------- */
.error-page { text-align: center; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 66px 30px; }
.error-code { font-size: clamp(86px, 16vw, 140px); line-height: 1; font-weight: 900; letter-spacing: -6px; color: transparent; -webkit-text-stroke: 1px var(--border-strong); user-select: none; }
.error-page h1 { font-size: 25px; font-weight: 800; margin: 14px 0 7px; }
.error-page > p { color: var(--text-light); font-size: 14px; }
.error-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.error-search { display: flex; align-items: center; gap: 8px; max-width: 430px; margin: 28px auto 0; padding: 5px 6px 5px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.error-search > i { color: var(--text-lighter); font-size: 13px; }
.error-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); padding: 8px 0; }
.error-search .btn { padding: 8px 16px; font-size: 13px; }
.error-tags { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: 24px; font-size: 12px; color: var(--text-lighter); }
.error-tags a { padding: 4px 11px; border-radius: 999px; background: var(--bg); color: var(--text-light); }
.error-tags a:hover { background: var(--primary-soft); color: var(--primary); }

/* ---------- 新评论高亮 ---------- */
.comment-item.is-new { animation: commentFlash 1.6s ease; }
@keyframes commentFlash { 0% { background: var(--primary-soft); } 100% { background: transparent; } }

/* ---------- 打印 ---------- */
@media print {
    .site-header, .sidebar, .site-footer, .single-toolbar, .comments-section, .related-section,
    .back-to-top, .reading-progress, .site-announcement, .share-bar, .author-card, .post-nav { display: none !important; }
    .site-main { display: block; max-width: 100%; padding: 0; }
    .single-post, .single-page { border: 0; box-shadow: none; padding: 0; }
    .post-body { color: #000; font-size: 12pt; }
}
