/* ========== 全局变量与基础（浅色科技主题） ========== */
:root {
    /* 背景：柔和的浅色，带一丝冷调 */
    --bg: #f4f7fb;
    --bg-soft: #eef2f8;
    --bg-card: #ffffff;
    --bg-card-hover: #fbfcfe;
    --border: #e2e8f1;
    --border-strong: #cbd5e1;
    --text: #1a202c;
    --text-dim: #4a5568;
    --text-muted: #94a3b8;

    /* 主色：科技蓝紫渐变 */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: rgba(37, 99, 235, .08);
    --accent: #7c3aed;
    --accent-soft: rgba(124, 58, 237, .1);

    --green: #16a34a;
    --red: #dc2626;
    --yellow: #d97706;
    --cyan: #0891b2;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .04);
    --shadow: 0 4px 6px -1px rgba(15, 23, 42, .06), 0 2px 4px -2px rgba(15, 23, 42, .06);
    --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, .08), 0 8px 10px -6px rgba(15, 23, 42, .06);
    --max-width: 1200px;

    /* 渐变主色（用于品牌/科技感） */
    --grad-tech: linear-gradient(135deg, #2563eb 0%, #7c3aed 50%, #db2777 100%);
    --grad-soft: linear-gradient(135deg, rgba(37, 99, 235, .08), rgba(124, 58, 237, .08));
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    /* 微妙的科技网格背景 */
    background-image:
        linear-gradient(rgba(99, 102, 241, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, .04) 1px, transparent 1px);
    background-size: 32px 32px;
    background-position: -1px -1px;
}

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

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

code, pre, kbd, samp {
    font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13.5px;
}

/* ========== 布局容器 ========== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== 顶部导航 ========== */
.site-header {
    background: rgba(255, 255, 255, .85);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
}
.site-header .inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
}
.site-brand { display: flex; align-items: center; gap: 12px; }
.site-brand .logo {
    width: 36px; height: 36px;
    background: var(--grad-tech);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .35);
    position: relative;
    overflow: hidden;
}
.site-brand .logo::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.4) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: shimmer 3s infinite;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.site-brand .name { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -.3px; }
.site-brand .desc { font-size: 12px; color: var(--text-muted); }
.site-brand .mood {
    font-size: 11.5px;
    color: var(--primary);
    font-weight: 500;
    margin-top: 1px;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav { display: flex; gap: 4px; align-items: center; }
.nav > a, .nav-dropdown > a {
    color: var(--text-dim);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all .15s;
    cursor: pointer;
}
.nav > a:hover, .nav-dropdown > a:hover {
    color: var(--text);
    background: var(--primary-soft);
    text-decoration: none;
}
.nav > a.active, .nav-dropdown > a.active {
    color: var(--primary);
    background: var(--primary-soft);
}

/* 分类下拉菜单 */
.nav-dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all .18s ease;
    z-index: 100;
}
.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--text-dim);
    border-radius: 6px;
    font-size: 13.5px;
    transition: all .12s;
}
.dropdown-menu a:hover {
    background: var(--primary-soft);
    color: var(--primary);
    text-decoration: none;
}
.dropdown-menu a.active { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.dropdown-menu .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}
.dropdown-menu .count {
    margin-left: auto;
    padding: 1px 8px;
    background: var(--bg-soft);
    border-radius: 10px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ========== 首页 Hero（科技感） ========== */
.page-hero {
    position: relative;
    padding: 72px 0 44px;
    text-align: center;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}
.hero-bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(37, 99, 235, .06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, .06) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: radial-gradient(ellipse 60% 60% at 50% 40%, black 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 40%, black 30%, transparent 80%);
    pointer-events: none;
}
.hero-glow {
    position: absolute;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(124, 58, 237, .12), transparent 60%);
    pointer-events: none;
    filter: blur(40px);
}
.hero-content { position: relative; z-index: 1; }
.hero-badge {
    display: inline-block;
    padding: 4px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    letter-spacing: .3px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}
.page-hero h1 {
    font-size: 38px;
    margin: 0 0 12px;
    letter-spacing: -1px;
    font-weight: 800;
    background: linear-gradient(120deg, var(--text) 0%, var(--primary) 50%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.page-hero p { color: var(--text-dim); margin: 0; font-size: 15px; }
.hero-mood {
    display: inline-block;
    margin-top: 12px;
    padding: 4px 16px;
    background: var(--bg-card);
    border: 1px dashed var(--border-strong);
    border-radius: 999px;
    font-size: 13px;
    color: var(--text-dim);
    box-shadow: var(--shadow-sm);
}
.hero-filter { margin-top: 14px; font-size: 13px; color: var(--text-muted); }
.hero-filter .tag { margin: 0 4px; }

/* ========== 首页文章列表 ========== */
.post-list { padding: 24px 0 60px; display: grid; gap: 16px; }
.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 26px;
    transition: all .18s;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.post-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--grad-tech);
    opacity: 0;
    transition: opacity .18s;
}
.post-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
    background: var(--bg-card-hover);
}
.post-card:hover::before { opacity: 1; }
.post-card .meta-top {
    display: flex; gap: 10px; align-items: center;
    font-size: 12.5px; color: var(--text-muted);
    margin-bottom: 10px;
}
.tag {
    display: inline-block;
    padding: 2px 10px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.tag-accent { background: var(--accent-soft); color: var(--accent); }
.tag-sticky { background: linear-gradient(135deg,#e67e22,#f39c12); color: #fff; font-weight: 600; }
.post-sticky { border-left: 4px solid #e67e22; background: linear-gradient(to right, #fff8f0, var(--card-bg)); }
.btn-bold { font-weight: 700; font-size: 15px; min-width: 38px; justify-content: center; }
.btn-bold strong { font-weight: 800; }
.post-card h2 { margin: 0 0 8px; font-size: 20px; line-height: 1.4; }
.post-card h2 a { color: var(--text); }
.post-card h2 a:hover { color: var(--primary); text-decoration: none; }
.post-card .excerpt { color: var(--text-dim); margin: 0 0 14px; font-size: 14px; }
.post-card .meta-bottom {
    display: flex; gap: 16px; align-items: center;
    color: var(--text-muted); font-size: 12.5px;
}

/* ========== 文章详情 ========== */
.article { padding: 40px 0 80px; }
.article .article-head { padding-bottom: 24px; border-bottom: 1px solid var(--border); margin-bottom: 28px; }
.article .article-head h1 { font-size: 30px; line-height: 1.35; margin: 8px 0 14px; letter-spacing: -.5px; }
.article .article-meta { color: var(--text-muted); font-size: 13px; display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.article .article-content { font-size: var(--article-size, 15.5px); line-height: 1.85; }
.article .article-content h2 { font-size: 22px; margin: 32px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.article .article-content h3 { font-size: 18px; margin: 26px 0 10px; }
.article .article-content p { margin: 14px 0; }
.article .article-content ul { padding-left: 22px; }
.article .article-content li { margin: 6px 0; }
.article .article-content a { border-bottom: 1px solid currentColor; }
.article .article-content a:hover { text-decoration: none; }
.article .article-content blockquote {
    border-left: 3px solid var(--primary);
    background: var(--primary-soft);
    color: var(--text-dim);
    padding: 12px 18px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
}
.article .article-content img.md-image {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin: 8px 0;
    box-shadow: var(--shadow);
}

/* 行内代码 */
.inline-code {
    background: var(--primary-soft);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent);
    border: 1px solid rgba(124, 58, 237, .15);
    font-size: 13px;
}

/* 代码块容器：与网页一致的浅色风格 */
.code-wrap {
    margin: 18px 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    background: var(--bg);
}
.code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 14px;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
}
.code-lang {
    font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
}
.code-lang::before {
    content: '●';
    margin-right: 6px;
    color: var(--primary);
    font-size: 10px;
}
.copy-btn {
    background: var(--bg-card);
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
}
.copy-btn:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.copy-btn.copied { background: var(--green); border-color: var(--green); color: #fff; }
.code-block {
    margin: 0;
    background: var(--bg);
    padding: 14px 16px;
    overflow-x: auto;
    line-height: 1.6;
    border-radius: 0;
    tab-size: 4;
    -moz-tab-size: 4;
}
.code-block code {
    color: var(--text);
    background: none;
    padding: 0;
    font-size: 13.5px;
    line-height: 1.6;
}
/* highlight.js 主题微调，让代码块字体大小一致 */
.code-block code.hljs { padding: 0; background: transparent; }

/* 文件附件卡片 */
.file-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    margin: 16px 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    transition: all .15s;
}
.file-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.file-icon { font-size: 28px; }
.file-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.file-name { font-weight: 600; color: var(--text); font-size: 14px; word-break: break-all; }
.file-meta { color: var(--text-muted); font-size: 11.5px; font-family: "JetBrains Mono", monospace; letter-spacing: .5px; }
.file-download {
    padding: 6px 16px;
    background: var(--grad-tech);
    color: #fff !important;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
    transition: all .15s;
    box-shadow: 0 2px 8px rgba(37, 99, 235, .25);
}
.file-download:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, .35); }

.back-link { display: inline-block; margin-bottom: 20px; color: var(--text-dim); font-size: 14px; }

/* ========== 空状态 ========== */
.empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}
.empty .big { font-size: 48px; margin-bottom: 12px; }

/* ========== 页脚 ========== */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    background: var(--bg-soft);
}

/* ========== 后台 ========== */
.admin-body { background: var(--bg); }
.admin-header {
    background: rgba(255, 255, 255, .85);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
}
.admin-header .inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 0;
}
.admin-header .brand { font-weight: 700; display: flex; align-items: center; gap: 10px; color: var(--text); }
.admin-nav { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }
.admin-nav a, .admin-nav span {
    color: var(--text-dim); padding: 7px 12px; border-radius: 7px; font-size: 14px;
}
.admin-nav a:hover { color: var(--text); background: var(--primary-soft); text-decoration: none; }
.admin-nav a.active { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.admin-user { color: var(--text-muted); font-size: 13px; padding: 7px 8px !important; }

.admin-main { padding: 30px 0 80px; }
.admin-main h1 { margin: 0 0 22px; font-size: 22px; }

/* 仪表盘卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 30px; }
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    background: var(--grad-soft);
    border-radius: 50%;
    transform: translate(30%, -30%);
}
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--primary); position: relative; z-index: 1; }
.stat-card .label { color: var(--text-muted); font-size: 13px; margin-top: 4px; position: relative; z-index: 1; }

/* 表格 */
.table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td {
    padding: 12px 16px; text-align: left; font-size: 14px;
    border-bottom: 1px solid var(--border);
}
table.data th { color: var(--text-muted); background: var(--bg-soft); font-weight: 600; font-size: 13px; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--bg-card-hover); }
.row-title { font-weight: 600; color: var(--text); }
.status-badge {
    display: inline-block; padding: 2px 10px; border-radius: 11px; font-size: 12px; font-weight: 500;
}
.status-published { background: rgba(22, 163, 74, .12); color: var(--green); }
.status-draft { background: rgba(217, 119, 6, .12); color: var(--yellow); }

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px;
    border-radius: 7px;
    font-size: 13.5px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
    text-decoration: none;
}
.btn:hover { text-decoration: none; border-color: var(--border-strong); background: var(--bg-card-hover); }
.btn-primary { background: var(--primary); color: #fff !important; border-color: var(--primary); box-shadow: 0 2px 8px rgba(37, 99, 235, .25); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); box-shadow: 0 4px 12px rgba(37, 99, 235, .35); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: rgba(220, 38, 38, .08); border-color: var(--red); }
.btn-danger:disabled { opacity: .4; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* 主题色块选择（后台设置页） */
.theme-list { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-swatch {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text-dim);
    transition: all .15s;
}
.theme-swatch:hover { border-color: var(--border-strong); }
.theme-swatch input { display: none; }
.theme-swatch .swatch {
    width: 18px; height: 18px; border-radius: 50%;
    border: 1px solid var(--border-strong);
    display: inline-block;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6);
}
.theme-swatch:has(input:checked) {
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 0 0 2px var(--primary-soft);
}
.theme-swatch input:checked + .swatch { outline: 2px solid var(--primary); outline-offset: 2px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }

/* 表单 */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    max-width: 1080px;
    box-shadow: var(--shadow-sm);
}
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13.5px; color: var(--text-dim); margin-bottom: 6px; font-weight: 500; }
.field .hint { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=password], input[type=email], textarea, select {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: all .15s;
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
    background: var(--bg-card);
}
textarea.content-area {
    min-height: 440px;
    font-family: "JetBrains Mono", "SFMono-Regular", Consolas, Menlo, monospace;
    font-size: 13.5px;
    line-height: 1.65;
    resize: vertical;
    tab-size: 4;
    -moz-tab-size: 4;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* 编辑器工具条 */
.editor-toolbar {
    display: flex; align-items: center; gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap; /* 空间不足时按钮换行，而不是被挤成竖排 */
}
.editor-toolbar .btn-sm { padding: 4px 10px; white-space: nowrap; }
/* 长提示文字单独占一行，避免挤压按钮 */
.editor-toolbar .hint {
    width: 100%; margin: 6px 0 0 !important;
    white-space: normal;
}
/* 字体/字号/颜色格式化控件 */
.editor-toolbar .fmt-divider {
    width: 1px; height: 22px; background: var(--border, #d0d7de);
    margin: 0 2px; flex: 0 0 auto;
}
.editor-toolbar .fmt-label {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12.5px; color: var(--text-muted, #57606a);
    margin: 0; flex: 0 0 auto;
    white-space: nowrap; /* 防止"字体/字号"文字被挤成竖排 */
}
.editor-toolbar .fmt-select {
    height: 26px; padding: 0 6px;
    font-size: 12.5px; font-family: inherit;
    border: 1px solid var(--border, #d0d7de); border-radius: 5px;
    background: #fff; color: var(--text, #1f2328);
    cursor: pointer;
}
.editor-toolbar .fmt-color {
    width: 30px; height: 26px; padding: 0; border: 1px solid var(--border, #d0d7de);
    border-radius: 5px; background: #fff; cursor: pointer; flex: 0 0 auto;
}
.editor-toolbar .fmt-color::-webkit-color-swatch-wrapper { padding: 2px; }
.editor-toolbar .fmt-color::-webkit-color-swatch { border: none; border-radius: 3px; }
.upload-progress {
    margin-top: 8px;
    padding: 6px 12px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 6px;
    font-size: 12.5px;
}

/* 登录页 */
.auth-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(circle at 25% 20%, rgba(37, 99, 235, .12), transparent 50%),
        radial-gradient(circle at 75% 80%, rgba(124, 58, 237, .12), transparent 50%),
        var(--bg);
    padding: 30px;
    position: relative;
    overflow: hidden;
}
.auth-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(99, 102, 241, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, .05) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
}
.auth-card {
    width: 100%; max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}
.auth-card .auth-brand { text-align: center; margin-bottom: 26px; }
.auth-card .auth-brand .logo {
    width: 48px; height: 48px; margin: 0 auto 12px;
    background: var(--grad-tech);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 20px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, .35);
}
.auth-card .auth-brand h1 { margin: 0; font-size: 20px; }
.auth-card .auth-brand p { margin: 6px 0 0; color: var(--text-muted); font-size: 13px; }

/* 提示信息 */
.alert {
    padding: 10px 14px;
    border-radius: 7px;
    font-size: 13.5px;
    margin-bottom: 16px;
    border: 1px solid;
}
.alert-error { background: rgba(220, 38, 38, .08); color: var(--red); border-color: rgba(220, 38, 38, .25); }
.alert-success { background: rgba(22, 163, 74, .08); color: var(--green); border-color: rgba(22, 163, 74, .25); }

/* 分页 */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 26px; }
.pagination a, .pagination span {
    padding: 7px 12px; border: 1px solid var(--border); border-radius: 7px;
    background: var(--bg-card); color: var(--text-dim); font-size: 13.5px;
    box-shadow: var(--shadow-sm);
}
.pagination a:hover { color: var(--text); text-decoration: none; border-color: var(--border-strong); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ========== 移动端适配 ========== */
@media (max-width: 720px) {
    .container { padding: 0 14px; }

    /* 顶部导航 */
    .site-header .inner { flex-wrap: wrap; padding: 10px 0 4px; gap: 4px; }
    .site-brand .desc { display: none; }
    .nav { width: 100%; justify-content: flex-start; gap: 2px; flex-wrap: wrap; }
    .nav > a, .nav-dropdown > a { padding: 7px 10px; font-size: 13.5px; white-space: nowrap; }
    /* 分类改为横向滑动的胶囊条（触屏友好） */
    .nav-dropdown { position: static; flex: 1 1 100%; }
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding: 4px 0 8px;
        background: transparent;
        border: none;
        box-shadow: none;
        min-width: 0;
        -webkit-overflow-scrolling: touch;
    }
    .dropdown-menu a {
        white-space: nowrap;
        border: 1px solid var(--border);
        background: var(--bg-card);
        border-radius: 999px;
        padding: 4px 12px;
        font-size: 12.5px;
        flex-shrink: 0;
    }
    .dropdown-menu a.active { border-color: var(--primary); }
    .dropdown-menu .dot { display: none; }
    .dropdown-menu .count { margin-left: 4px; }

    /* Hero */
    .page-hero { padding: 40px 0 26px; }
    .page-hero h1 { font-size: 24px; letter-spacing: 0; }
    .page-hero p { font-size: 13.5px; }

    /* 文章卡片 */
    .post-list { gap: 12px; padding: 18px 0 40px; }
    .post-card { padding: 16px 16px 14px; }
    .post-card h2 { font-size: 17px; word-break: break-word; }
    .post-card .meta-bottom { flex-wrap: wrap; gap: 8px; }

    /* 文章详情 */
    .article { padding: 24px 0 50px; }
    .article .article-head h1 { font-size: 22px; }
    .article .article-content { font-size: calc(var(--article-size, 15.5px) - 1px); }
    .article .article-content h2 { font-size: 19px; }
    .article .article-content h3 { font-size: 16.5px; }

    /* 代码块 */
    .code-head { padding: 6px 10px; }
    .code-block { padding: 12px; }
    .code-block code { font-size: 12.5px; }

    /* 文件卡片 */
    .file-card { flex-wrap: wrap; padding: 12px 14px; gap: 10px; }
    .file-download { width: 100%; text-align: center; padding: 8px; }

    /* 后台 */
    .admin-header .inner { flex-wrap: wrap; padding: 10px 0 6px; gap: 4px; }
    .admin-nav { gap: 0; width: 100%; }
    .admin-nav a, .admin-nav span { padding: 6px 8px; font-size: 13px; }
    .admin-nav .admin-user { display: none; }
    .admin-main { padding: 20px 0 60px; }
    .toolbar { flex-wrap: wrap; gap: 10px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-card .num { font-size: 22px; }
    .form-card { padding: 18px 14px; }
    .field-row { grid-template-columns: 1fr; gap: 0; }
    .editor-toolbar { flex-wrap: wrap; }
    .editor-toolbar .hint { width: 100%; margin: 6px 0 0 !important; }

    /* 输入框 16px 防 iOS 聚焦自动缩放 */
    input[type=text], input[type=password], input[type=email], textarea, select { font-size: 16px; }

    /* 表格转为卡片式 */
    table.data thead { display: none; }
    table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
    table.data tr { margin-bottom: 10px; border: 1px solid var(--border); border-radius: 8px; }
    table.data td { text-align: left; }

    /* 登录页 */
    .auth-card { padding: 26px 20px; }

    /* 分页 */
    .pagination { flex-wrap: wrap; }
}

@media (max-width: 420px) {
    .page-hero h1 { font-size: 21px; }
    .site-brand .name { font-size: 16px; }
    .stat-card .num { font-size: 20px; }
}

/* ===== 新增：搜索框 / RSS / 标签云 / 编辑器分屏预览 / 自动保存 / 返回主页 ===== */

/* 前台头部搜索框 */
.search-form { display: flex; align-items: center; gap: 6px; margin-left: 14px; }
.search-form input[type=search] {
    width: 170px; padding: 7px 12px; font-size: 13.5px;
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--bg-soft); outline: none; transition: width .2s, box-shadow .2s;
}
.search-form input[type=search]:focus { width: 210px; box-shadow: 0 0 0 3px rgba(37,99,235,.12); border-color: var(--primary); }
.search-form button { border: none; background: transparent; font-size: 15px; cursor: pointer; padding: 4px 6px; color: var(--text-muted); }
.rss-link { font-size: 16px; text-decoration: none !important; opacity: .85; }
.rss-link:hover { opacity: 1; }

/* 标签云 */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 0 40px; }
.tag-cloud-item { font-size: 13.5px; padding: 6px 12px; }
.tag-count { opacity: .65; margin-left: 2px; }

/* 文件附件 - 无效链接 */
.file-bad { color: var(--red); border-color: #fecaca; background: #fef2f2; }

/* 编辑器分屏预览 */
.editor-split { display: block; }
.editor-split .preview-pane { display: none; }
.editor-split.preview-on { display: flex; gap: 12px; align-items: stretch; }
.editor-split.preview-on .content-area { flex: 1; min-width: 0; }
.editor-split.preview-on .preview-pane {
    display: block; flex: 1; min-width: 0; overflow-y: auto; max-height: 560px;
    border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
    background: #fff; font-size: var(--article-size, 16px); line-height: 1.75;
}
.preview-pane h1, .preview-pane h2, .preview-pane h3 { margin: .6em 0 .4em; }
.preview-pane p { margin: .6em 0; }
.preview-pane img { max-width: 100%; border-radius: var(--radius-sm); }
.preview-pane blockquote {
    margin: .6em 0; padding: 8px 14px; border-left: 4px solid var(--primary);
    background: var(--bg-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-dim);
}
.preview-pane ul, .preview-pane ol { padding-left: 1.4em; margin: .4em 0; }
.preview-pane hr { border: none; border-top: 1px solid var(--border); margin: 1.2em 0; }
.preview-pane code { font-size: .92em; }

/* 自动保存提示 */
.autosave-hint { color: var(--primary); font-size: 12.5px; margin-left: 8px; }

/* 后台「返回主页」按钮 */
.btn-home { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.btn-home:hover { background: var(--primary); color: #fff; }

/* 窄屏适配 */
@media (max-width: 768px) {
    .search-form { margin: 6px 0 0; width: 100%; }
    .search-form input[type=search] { flex: 1; width: auto; }
    .search-form input[type=search]:focus { width: auto; }
    .editor-split.preview-on { flex-direction: column; }
    .editor-split.preview-on .preview-pane { max-height: 400px; }
}
/* ============================================================
   主页两栏改版 + 移动端抽屉导航 + 多栏页脚（新增，追加于此文件末尾）
   ============================================================ */

/* ---------- 主页两栏布局 ---------- */
.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 28px;
    align-items: start;
    padding: 24px 0 40px;
}
.col-main { min-width: 0; }
.two-col .post-list { padding: 0 0 8px; }

/* ---------- 侧边栏 ---------- */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 84px;
}
.side-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}
.side-card h3 {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: .5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.side-card h3::before {
    content: '';
    width: 4px;
    height: 14px;
    border-radius: 2px;
    background: var(--grad-tech);
    flex-shrink: 0;
}
.side-empty { color: var(--text-muted); font-size: 13px; margin: 0; }
.side-about p { margin: 0 0 12px; color: var(--text-muted); font-size: 13px; line-height: 1.7; }
.rss-btn {
    display: inline-block;
    padding: 6px 14px;
    background: var(--grad-tech);
    color: #fff !important;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none !important;
    transition: transform .15s, box-shadow .15s;
}
.rss-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, .3); }

.side-hot { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; counter-reset: hot; }
.side-hot li { counter-increment: hot; display: flex; gap: 10px; align-items: baseline; }
.side-hot li::before {
    content: counter(hot);
    font-weight: 700;
    font-size: 12px;
    color: var(--primary);
    opacity: .55;
    min-width: 14px;
    line-height: 1.6;
    text-align: right;
}
.side-hot a { color: var(--text-dim); font-size: 13.5px; line-height: 1.5; }
.side-hot a:hover { color: var(--primary); }

.side-cats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.side-cats a { display: flex; justify-content: space-between; align-items: center; color: var(--text-dim); font-size: 13.5px; }
.side-cats a:hover { color: var(--primary); }
.side-cats span { background: var(--bg-soft); border-radius: 10px; padding: 1px 8px; font-size: 12px; color: var(--text-muted); }

.side-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.side-tags a { padding: 3px 10px; background: var(--primary-soft); color: var(--primary); border-radius: 999px; font-size: 12.5px; }
.side-tags a:hover { background: var(--primary); color: #fff; text-decoration: none; }
.side-tags i { font-style: normal; opacity: .6; margin-left: 2px; font-size: 11px; }

/* ---------- 卡片增强 ---------- */
.post-card h2 a { transition: color .15s; }
.post-card .excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
}
.post-card .meta-bottom { flex-wrap: wrap; }

/* ---------- Hero 统计小胶囊 ---------- */
.hero-stats { display: flex; justify-content: center; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.hero-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 22px;
    box-shadow: var(--shadow-sm);
    min-width: 96px;
    transition: transform .15s, border-color .15s;
}
.hero-stat:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.hero-stat b { display: block; font-size: 24px; font-weight: 800; color: var(--primary); line-height: 1.2; }
.hero-stat span { font-size: 12px; color: var(--text-muted); }

/* ---------- 移动端汉堡按钮 + 抽屉导航 ---------- */
.nav-toggle {
    display: none;
    width: 38px; height: 38px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    flex-shrink: 0;
}
.nav-toggle:hover { border-color: var(--primary); color: var(--primary); }
.nav-drawer { display: contents; }

.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
}
body.nav-open .nav-overlay { opacity: 1; pointer-events: auto; }

/* ---------- 多栏页脚 ---------- */
.site-footer { text-align: left; padding: 36px 0 30px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1.4fr; gap: 28px; }
.footer-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 15px; }
.footer-brand .logo {
    width: 26px; height: 26px;
    background: var(--grad-tech);
    border-radius: 7px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 13px;
}
.footer-col { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text-muted); }
.footer-col h4 { margin: 0 0 4px; font-size: 13px; color: var(--text-dim); font-weight: 700; }
.footer-col a { color: var(--text-muted); }
.footer-col a:hover { color: var(--primary); }
.footer-about p { margin: 0; line-height: 1.7; }
.footer-rss {
    align-self: flex-start;
    margin-top: 4px;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
}

/* ---------- 移动端适配（两栏折行 / 抽屉） ---------- */
@media (max-width: 992px) {
    .two-col { grid-template-columns: 1fr; gap: 24px; }
    .sidebar { position: static; }
}
@media (max-width: 768px) {
    .nav-toggle { display: inline-flex; position: relative; z-index: 61; }

    .nav-drawer {
        display: flex;
        flex-direction: column;
        gap: 6px;
        position: fixed;
        top: 0; right: 0;
        height: 100vh;
        width: min(300px, 82vw);
        z-index: 60;
        background: var(--bg-card);
        border-left: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
        padding: 20px 16px 30px;
        transform: translateX(100%);
        transition: transform .25s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    body.nav-open .nav-drawer { transform: translateX(0); }
    .nav-drawer .nav {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 2px;
    }
    .nav-drawer .nav > a,
    .nav-drawer .nav-dropdown > a {
        width: 100%;
        text-align: left;
        padding: 10px 12px;
    }
    .nav-drawer .nav-dropdown { position: static; }
    .nav-drawer .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 4px 0;
        background: transparent;
        border: none;
        box-shadow: none;
        min-width: 0;
        max-height: none;
        overflow: visible;
    }
    .nav-drawer .dropdown-menu a {
        border: none;
        background: transparent;
        border-radius: 6px;
        padding: 8px 12px;
        white-space: normal;
        font-size: 13.5px;
    }
    .nav-drawer .dropdown-menu a.active { border-color: transparent; }
    .nav-drawer .dropdown-menu .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
    .nav-drawer .dropdown-menu .count { margin-left: auto; }
    .nav-drawer .search-form { margin: 10px 0 0; width: 100%; }
    .nav-drawer .search-form input[type=search] { flex: 1; width: auto; font-size: 16px; }
    .nav-drawer .search-form input[type=search]:focus { width: auto; }

    /* 页脚折行 */
    .footer-grid { grid-template-columns: 1fr; gap: 20px; }
    .hero-stat b { font-size: 20px; }
    .hero-stat { padding: 8px 16px; min-width: 84px; }
}