/* 主题变量 */
:root {
    --bg: #0f1115;
    --bg-card: #1a1d24;
    --bg-card-hover: #1f232c;
    --border: #232833;
    --border-active: #0ea5e9;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #38bdf8;
    --accent-light: #7dd3fc;
    --accent-bg: #0c4a6e;
    --code-bg: #0b1020;
    --code-text: #a5f3fc;
    --header-border: #1e293b;
}
body.light-theme {
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --border: #e2e8f0;
    --border-active: #0284c7;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent: #0369a1;
    --accent-light: #0ea5e9;
    --accent-bg: #e0f2fe;
    --code-bg: #f1f5f9;
    --code-text: #0c4a6e;
    --header-border: #e2e8f0;
}

/* 全局重置 */
*{margin:0;padding:0;box-sizing:border-box}
body{
    font-family:'Consolas','Monaco','Microsoft YaHei',sans-serif;
    background:var(--bg);
    color:var(--text-primary);
    line-height:1.7;
    padding:20px;
    transition:background .3s, color .3s;
}
.container{max-width:960px;margin:40px auto;padding:0 20px}
.container.post-detail{max-width:820px}

/* 头部 */
.header{
    text-align:center;margin-bottom:30px;
    padding-bottom:24px;border-bottom:1px solid var(--header-border);
}
.header h1{
    color:var(--accent);font-size:2.2rem;margin-bottom:8px;
    letter-spacing:1px;
}
.header .sub{color:var(--text-muted);font-size:1rem}

/* 搜索框 */
.search-box{margin-bottom:24px}
.search-box input{
    width:100%;padding:12px 16px;
    background:var(--bg-card);
    border:1px solid var(--border);
    border-radius:8px;color:var(--text-primary);
    font-size:1rem;outline:none;
    transition:border-color .2s;
}
.search-box input:focus{border-color:var(--accent)}
.search-box input::placeholder{color:var(--text-muted)}

/* 分类导航 */
.category-nav{
    margin-bottom:30px;
    display:flex;flex-wrap:wrap;gap:8px;
}
.cat-tag{
    padding:5px 12px;border-radius:6px;
    background:var(--bg-card);
    border:1px solid var(--border);
    color:var(--text-secondary);
    font-size:.85rem;cursor:pointer;
    transition:all .2s;
}
.cat-tag:hover{border-color:var(--accent);color:var(--accent-light)}
.cat-tag.active{
    background:var(--accent-bg);
    border-color:var(--border-active);
    color:#fff;
}

/* 文章卡片网格 */
.post-grid{
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(280px,1fr));
    gap:20px;
}
.post-card{
    background:var(--bg-card);
    border:1px solid var(--border);
    border-radius:10px;padding:24px;cursor:pointer;
    transition:all .25s ease;
    border-left:4px solid var(--border-active);
    text-decoration:none;display:block;
}
.post-card:hover{
    transform:translateY(-4px);
    border-color:var(--accent);
    background:var(--bg-card-hover);
    box-shadow:0 10px 30px rgba(14,165,233,.1);
}
.post-card h3{
    color:var(--text-primary);
    font-size:1.25rem;margin-bottom:10px;
    line-height:1.4;
}
.post-meta{
    color:var(--text-muted);
    font-size:.85rem;margin-bottom:12px;
}
.tags{margin-bottom:14px}
.tag{
    display:inline-block;
    background:var(--accent-bg);
    color:var(--accent-light);
    font-size:.75rem;padding:3px 8px;
    border-radius:4px;margin-right:6px;
}
.excerpt{color:var(--text-secondary);font-size:.95rem}

/* 无结果提示 */
.empty-tip{
    text-align:center;padding:60px 20px;
    color:var(--text-muted);
    display:none;
}

/* 文章详情页 */
.back-btn{
    display:inline-block;
    color:var(--accent);
    text-decoration:none;
    margin-bottom:24px;cursor:pointer;
    font-size:.95rem;
    border:1px solid var(--border-active);
    padding:6px 14px;border-radius:6px;
    background:var(--accent-bg);
}
.back-btn:hover{background:var(--accent);color:#fff}

.detail-title{
    font-size:1.8rem;
    color:var(--text-primary);
    margin-bottom:10px;line-height:1.4;
}
.detail-meta{
    color:var(--text-muted);
    margin-bottom:30px;
    padding-bottom:16px;
    border-bottom:1px solid var(--header-border);
}
.detail-meta .dot{margin:0 6px}

.article h4{
    color:var(--accent);
    margin:24px 0 12px;
    font-size:1.2rem;
}
.article p{margin-bottom:14px;color:var(--text-secondary)}
.article ul{margin:10px 0 16px 24px;color:var(--text-secondary)}
.article li{margin-bottom:6px}

/* 代码块 */
pre{
    background:var(--code-bg);
    border:1px solid var(--border);
    padding:16px;border-radius:8px;
    overflow-x:auto;
    margin:14px 0 20px;
    color:var(--code-text);
    font-size:.9rem;line-height:1.6;
}
code{font-family:Consolas,Monaco,monospace}

/* 页脚 */
.footer{
    text-align:center;margin-top:60px;padding-top:24px;
    border-top:1px solid var(--header-border);
    color:var(--text-muted);font-size:.85rem;
}
.footer a{color:var(--border-active);text-decoration:none}

/* 悬浮按钮：主题切换 + 回到顶部 */
.theme-toggle, .back-top{
    position:fixed;
    width:42px;height:42px;
    border-radius:50%;
    background:var(--bg-card);
    border:1px solid var(--border);
    color:var(--text-primary);
    display:flex;align-items:center;justify-content:center;
    cursor:pointer;z-index:999;
    transition:all .25s ease;
    font-size:18px;
}
.theme-toggle{top:20px;right:20px}
.theme-toggle:hover{
    border-color:var(--accent);
    background:var(--accent-bg);
}
.back-top{
    bottom:30px;right:30px;
    opacity:0;pointer-events:none;
}
.back-top:hover{
    background:var(--accent);
    color:#fff;
    transform:translateY(-2px);
}

/* 移动端适配 */
@media(max-width:640px){
    .header h1{font-size:1.6rem}
    .detail-title{font-size:1.4rem}
    .post-grid{grid-template-columns:1fr}
    .theme-toggle{top:12px;right:12px}
    .back-top{bottom:20px;right:20px}
}
