/*
 * 个人博客样式（无构建步骤：直接手写 CSS，宝塔上传即可生效）
 * 配色用 CSS 变量，深浅色通过 [data-theme] 切换。
 */

:root {
    --bg: #ffffff;
    --bg-soft: #f7f8fa;
    --bg-elevated: #ffffff;
    --text: #1f2328;
    --text-soft: #57606a;
    --text-muted: #8b949e;
    --border: #e5e7eb;
    --border-strong: #d0d7de;
    --accent: #2563eb;
    --accent-soft: #eff4ff;
    --danger: #c0392b;
    --success: #1a7f37;
    --warn: #9a6700;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 20px rgba(0, 0, 0, .05);
    --font-sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    --maxw: 760px;
    --maxw-wide: 1080px;
}

[data-theme="dark"] {
    --bg: #0d1117;
    --bg-soft: #161b22;
    --bg-elevated: #161b22;
    --text: #e6edf3;
    --text-soft: #9aa7b4;
    --text-muted: #7d8590;
    --border: #263040;
    --border-strong: #30363d;
    --accent: #6ea8fe;
    --accent-soft: #17233a;
    --danger: #f85149;
    --success: #3fb950;
    --warn: #d29922;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.75;
}

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

img { max-width: 100%; height: auto; }

.container { max-width: var(--maxw-wide); margin: 0 auto; padding: 0 20px; }

/* ---------- 头部 ---------- */
.site-header {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(6px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
    flex-wrap: wrap;
}

.site-brand { display: flex; flex-direction: column; line-height: 1.3; }
.site-name { font-weight: 700; font-size: 18px; color: var(--text); }
.site-desc { font-size: 12px; color: var(--text-muted); }

.site-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.site-nav a {
    color: var(--text-soft);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 14px;
}
.site-nav a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.site-nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.nav-admin { border: 1px solid var(--border-strong); }

.theme-toggle {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-soft);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 5px 9px;
    font-size: 14px;
    line-height: 1;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: 0;
    cursor: pointer;
    padding: 8px;
}
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--text-soft); }

/* ---------- 主体 ---------- */
.site-main { padding: 32px 0 64px; }

.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 26px; margin: 0 0 6px; }
.page-desc { color: var(--text-muted); margin: 0; font-size: 14px; }

.muted { color: var(--text-muted); }
.empty-state { text-align: center; padding: 48px 16px; color: var(--text-soft); }
.empty-state h2 { font-size: 18px; margin: 0 0 8px; }

/* ---------- 文章卡片 ---------- */
.post-list { display: flex; flex-direction: column; gap: 8px; }

.post-card {
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}
.post-card:last-child { border-bottom: 0; }

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.post-card-title { font-size: 19px; margin: 0 0 6px; line-height: 1.45; }
.post-card-title a { color: var(--text); }
.post-card-title a:hover { color: var(--accent); text-decoration: none; }

.post-card-excerpt { margin: 0 0 10px; color: var(--text-soft); font-size: 15px; }

.post-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-muted);
}
.post-card-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--text-soft);
}
.tag-pill:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.tag-pill-sm { font-size: 11px; padding: 1px 7px; }
.tag-count { color: var(--text-muted); font-size: 11px; }

.badge {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    color: var(--text-soft);
    white-space: nowrap;
}
.badge-published { color: var(--success); border-color: var(--success); }
.badge-draft { color: var(--warn); border-color: var(--warn); }
.badge-inbox { color: var(--danger); border-color: var(--danger); }
.badge-note { color: var(--accent); border-color: var(--accent); }
.badge-pinned { color: var(--danger); border-color: var(--danger); }

.tag-cloud { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }
.tag-cloud h3 { font-size: 14px; color: var(--text-muted); margin: 0 0 12px; font-weight: 600; }
.tag-cloud-items { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud-large .tag-pill { font-size: 14px; padding: 6px 14px; }

/* ---------- 文章详情 ---------- */
.post-detail { max-width: var(--maxw); margin: 0 auto; }
.post-header { margin-bottom: 24px; }
.post-title { font-size: 30px; line-height: 1.35; margin: 4px 0 12px; }
.post-source { font-size: 14px; color: var(--text-muted); margin: 10px 0 0; }

.post-body { font-size: 16.5px; }

.toc {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
    padding: 12px 16px;
    margin: 0 0 24px;
    font-size: 14px;
}
.toc summary { cursor: pointer; font-weight: 600; color: var(--text-soft); }
.toc ol { margin: 10px 0 0; padding-left: 20px; }
.toc li { margin: 3px 0; }
.toc-level-3 { margin-left: 16px; list-style: circle; }

.prose { color: var(--text); }
.prose > *:first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { line-height: 1.4; margin: 1.8em 0 .7em; scroll-margin-top: 80px; }
.prose h2 { font-size: 22px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: 18px; }
.prose p { margin: 0 0 1.1em; }
.prose ul, .prose ol { padding-left: 24px; margin: 0 0 1.1em; }
.prose li { margin: 4px 0; }
.prose blockquote {
    margin: 0 0 1.1em;
    padding: 2px 16px;
    border-left: 3px solid var(--border-strong);
    color: var(--text-soft);
    background: var(--bg-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.prose code {
    font-family: var(--font-mono);
    font-size: .9em;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
}
.prose pre {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    overflow-x: auto;
    margin: 0 0 1.2em;
    position: relative;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: 13.5px; line-height: 1.6; }
.prose img { border-radius: var(--radius); }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.2em; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.prose th { background: var(--bg-soft); font-weight: 600; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }

.post-footer { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }
.post-adjacent { display: flex; gap: 12px; flex-wrap: wrap; }
.adjacent-link {
    flex: 1 1 240px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
    color: var(--text);
}
.adjacent-link:hover { border-color: var(--accent); text-decoration: none; }
.adjacent-next { text-align: right; }
.adjacent-label { font-size: 12px; color: var(--text-muted); }
.adjacent-title { font-size: 15px; }

.related { margin-top: 28px; }
.related h3 { font-size: 14px; color: var(--text-muted); margin: 0 0 10px; }
.related ul { list-style: none; padding: 0; margin: 0; }
.related li { padding: 6px 0; border-bottom: 1px dashed var(--border); }

/* ---------- 归档 ---------- */
.archive-group { margin-bottom: 28px; }
.archive-month { font-size: 16px; color: var(--text-soft); margin: 0 0 8px; }
.archive-list { list-style: none; padding: 0; margin: 0; }
.archive-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 15px;
}
.archive-list time { color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------- 搜索 ---------- */
.search-form { display: flex; gap: 8px; margin-top: 12px; }
.search-form input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
}

/* ---------- 分页 ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; align-items: center; margin: 32px 0 8px; flex-wrap: wrap; }
.page-link {
    padding: 5px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-size: 14px;
}
.page-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.page-link.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-link.disabled { color: var(--text-muted); opacity: .6; }
.page-ellipsis { color: var(--text-muted); }

/* ---------- 提示 ---------- */
.alert {
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 14px;
    background: var(--bg-soft);
}
.alert p { margin: 0; }
.alert p + p { margin-top: 4px; }
.alert-success { border-left-color: var(--success); color: var(--success); }
.alert-error { border-left-color: var(--danger); color: var(--danger); }
.alert-warn { border-left-color: var(--warn); color: var(--warn); }
.alert pre { margin: 8px 0 0; }

/* ---------- 按钮与表单 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.4;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { color: #fff; filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-danger { border-color: var(--danger); color: var(--danger); }

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; color: var(--text-soft); margin-bottom: 5px; }
.field input[type="text"], .field input[type="password"], .field input[type="url"],
.field input[type="number"], .field input[type="datetime-local"], .field select, .field textarea,
.card input[type="text"], .card input[type="url"], .card textarea, .card select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---------- 页脚 ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0; font-size: 13px; color: var(--text-muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer-inner p { margin: 0; }
.footer-links { display: flex; gap: 12px; }
.footer-icp { margin: 12px 0 0; text-align: center; font-size: 12px; }
.footer-icp a { color: var(--text-muted); }
.footer-icp a:hover { color: var(--accent); }

/* ---------- 登录页 ---------- */
.auth-body { background: var(--bg-soft); display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.auth-wrapper { width: 100%; max-width: 380px; padding: 24px; }
.auth-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 28px 24px;
}
.auth-title { font-size: 20px; margin: 0 0 4px; text-align: center; }
.auth-sub { color: var(--text-muted); font-size: 13px; text-align: center; margin: 0 0 20px; }
.auth-tip { font-size: 12px; color: var(--text-muted); text-align: center; margin: 14px 0 0; }
.auth-footer { text-align: center; font-size: 13px; margin-top: 16px; }

/* ---------- 后台布局 ---------- */
.admin-body { background: var(--bg-soft); }
.admin-layout { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: 220px;
    flex: 0 0 220px;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.admin-brand { padding: 6px 10px 16px; display: flex; flex-direction: column; }
.admin-brand a { font-weight: 700; color: var(--text); font-size: 16px; }
.admin-brand-sub { font-size: 12px; color: var(--text-muted); }

.admin-menu { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.admin-menu a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-size: 14px;
}
.admin-menu a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.admin-menu a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.menu-count { font-size: 12px; color: var(--text-muted); }

.admin-sidebar-footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 0; border-top: 1px solid var(--border); font-size: 13px; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
    position: sticky;
    top: 0;
    z-index: 10;
}
.admin-title { font-size: 16px; margin: 0; flex: 1; }
.admin-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-soft); }
.admin-user form { margin: 0; }
.admin-nav-toggle { display: none; }
.admin-content { padding: 24px; max-width: 1180px; width: 100%; }

/* ---------- 后台组件 ---------- */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 18px;
}
.card-title { font-size: 15px; margin: 0 0 14px; }
.table-card { padding: 0; overflow-x: auto; }

.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
}
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-muted); }

.dashboard-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }

.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.check-list li:last-child { border-bottom: 0; }
.check-fail strong { color: var(--warn); }
.check-list span { color: var(--text-muted); font-size: 13px; }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.mini-list li:last-child { border-bottom: 0; }
.mini-meta { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-tab { padding: 5px 11px; border-radius: var(--radius-sm); font-size: 13px; color: var(--text-soft); border: 1px solid transparent; }
.filter-tab:hover { background: var(--bg-elevated); text-decoration: none; }
.filter-tab.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.toolbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-search { display: flex; gap: 6px; }
.inline-search input { padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font-size: 13px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { background: var(--bg-soft); font-size: 13px; color: var(--text-soft); font-weight: 600; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.row-title { color: var(--text); font-weight: 500; }
.row-sub { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.col-source { white-space: nowrap; }
.col-num, .col-time { white-space: nowrap; color: var(--text-muted); }
.col-actions { white-space: nowrap; }
.col-actions .link { margin-right: 8px; font-size: 13px; }
.inline-form { display: inline; margin: 0; }
.link-danger { background: none; border: 0; padding: 0; color: var(--danger); cursor: pointer; font-size: 13px; font-family: inherit; }
.link-danger:hover { text-decoration: underline; }

/* ---------- 编辑器 ---------- */
.editor-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.editor-pane textarea {
    width: 100%;
    min-height: 520px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.7;
    padding: 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    color: var(--text);
    resize: vertical;
}
.preview-pane {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    padding: 16px 20px;
    min-height: 520px;
    max-height: 720px;
    overflow: auto;
}
.editor-toolbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.editor-toolbar .btn { padding: 4px 9px; font-size: 13px; }
.editor-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-actions .spacer { flex: 1; }
.autosave-hint { font-size: 12px; color: var(--text-muted); }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.dropzone {
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-soft);
}
.dropzone.dragover { border-color: var(--accent); color: var(--accent); }

/* ---------- 编辑页 ---------- */
.edit-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.edit-main { min-width: 0; }
.edit-side { position: sticky; top: 76px; }

.title-input {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--border);
    padding: 6px 2px 10px;
    font-size: 22px;
    font-weight: 600;
    font-family: inherit;
    background: transparent;
    color: var(--text);
    margin-bottom: 12px;
}
.title-input:focus { outline: none; border-bottom-color: var(--accent); }

.form-actions-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.danger-zone { margin-top: 8px; padding-top: 14px; }

@media (max-width: 1100px) {
    .edit-layout { grid-template-columns: 1fr; }
    .edit-side { position: static; }
}

.tag-row-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tag-row-form input { width: auto; min-width: 120px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font-size: 13px; }

/* ---------- 媒体库 ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.media-item { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.media-item img { width: 100%; height: 140px; object-fit: cover; display: block; background: var(--bg-soft); }
.media-info { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.media-name { color: var(--text); word-break: break-all; }
.media-meta { color: var(--text-muted); }
.media-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- 代码高亮（highlight.js 的 token 配色，跟随深色模式） ---------- */
:root {
    --hl-fg: #24292f;
    --hl-comment: #6e7781;
    --hl-keyword: #cf222e;
    --hl-string: #0a3069;
    --hl-number: #0550ae;
    --hl-title: #8250df;
    --hl-type: #953800;
    --hl-attr: #0550ae;
    --hl-meta: #6e7781;
    --hl-add: #116329;
    --hl-del: #a40e26;
}

[data-theme="dark"] {
    --hl-fg: #c9d1d9;
    --hl-comment: #8b949e;
    --hl-keyword: #ff7b72;
    --hl-string: #a5d6ff;
    --hl-number: #79c0ff;
    --hl-title: #d2a8ff;
    --hl-type: #ffa657;
    --hl-attr: #79c0ff;
    --hl-meta: #8b949e;
    --hl-add: #aff5b4;
    --hl-del: #ffa198;
}

.hljs { color: var(--hl-fg); background: transparent; }
.hljs-comment, .hljs-quote { color: var(--hl-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-doctag, .hljs-name { color: var(--hl-keyword); }
.hljs-string, .hljs-regexp, .hljs-char, .hljs-meta .hljs-string { color: var(--hl-string); }
.hljs-number, .hljs-symbol, .hljs-bullet, .hljs-variable, .hljs-template-variable, .hljs-link,
.hljs-selector-attr, .hljs-selector-pseudo { color: var(--hl-number); }
.hljs-title, .hljs-section, .hljs-selector-id { color: var(--hl-title); }
.hljs-type, .hljs-title.class_, .hljs-built_in, .hljs-builtin-name { color: var(--hl-type); }
.hljs-attr, .hljs-attribute, .hljs-property, .hljs-params, .hljs-template-tag { color: var(--hl-attr); }
.hljs-meta { color: var(--hl-meta); }
.hljs-addition { color: var(--hl-add); }
.hljs-deletion { color: var(--hl-del); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .editor-layout { grid-template-columns: 1fr; }
    .preview-pane { min-height: 260px; max-height: none; }
}

@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .site-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding-bottom: 12px;
    }
    .site-nav.open { display: flex; }
    .site-nav a { padding: 9px 10px; }
    .theme-toggle { align-self: flex-start; margin: 4px 0 0 4px; }

    .post-title { font-size: 24px; }
    .site-main { padding: 20px 0 48px; }

    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 40;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: var(--shadow);
    }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-nav-toggle { display: flex; }
    .admin-content { padding: 16px; }
    .admin-topbar { padding: 10px 14px; }
    .col-tags, .col-type { display: none; }
}
