:root {
    --primary: #1abc9c;
    --primary-dark: #16a085;
    --bg: #f0f2f5;
    --card-bg: #fff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --overlay: rgba(0,0,0,0.4);
    --overlay-hover: rgba(0,0,0,0.55);
    --header-bg: #fff;
    --header-shadow: 0 2px 8px rgba(0,0,0,0.08);
    --card-radius: 12px;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.06);
    --font: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}
.dark {
    --bg: #0f0f1a; --card-bg: #1a1a2e; --text: #e0e0e0; --text-light: #999;
    --header-bg: #16213e; --header-shadow: 0 2px 8px rgba(0,0,0,0.3);
    --card-shadow: 0 2px 12px rgba(0,0,0,0.2);
    --overlay: rgba(0,0,0,0.5); --overlay-hover: rgba(0,0,0,0.65);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; transition: background .3s, color .3s; }
a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--header-bg); box-shadow: var(--header-shadow); transition: background .3s; }
.header-inner { display: flex; align-items: center; height: 60px; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.site-logo { font-size: 22px; font-weight: 700; white-space: nowrap; background: linear-gradient(135deg, #1abc9c, #3498db, #9b59b6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.site-logo:hover { opacity: 0.8; }
.site-nav { display: flex; gap: 4px; margin-left: 24px; flex: 1; }
.site-nav a { padding: 6px 14px; border-radius: 20px; font-size: 14px; white-space: nowrap; color: var(--text); transition: all .2s; }
.site-nav a:hover, .site-nav a.active { background: var(--primary); color: #fff; }
.cat-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; justify-content: center; }
.cat-bar a { padding: 6px 14px; border-radius: 20px; font-size: 14px; white-space: nowrap; color: var(--text); transition: all .2s; }
.cat-bar a:hover { background: var(--primary); color: #fff; }
.header-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.btn-icon { width: 36px; height: 36px; border-radius: 50%; border: none; background: transparent; color: var(--text); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .2s; }
.btn-icon:hover { background: var(--bg); }
.search-box { position: relative; display: none; }
.search-box.active { display: flex; }
.search-box input { width: 200px; height: 36px; padding: 0 36px 0 14px; border: 1px solid #ddd; border-radius: 18px; background: var(--bg); color: var(--text); font-size: 14px; outline: none; }
.search-box button { position: absolute; right: 4px; top: 2px; width: 32px; height: 32px; border: none; background: transparent; color: var(--text-light); cursor: pointer; font-size: 16px; }
.mobile-menu-btn { display: none; }
.dark .search-box input { border-color: #444; }

/* Page Title */
.page-title { padding: 24px 0 8px; font-size: 22px; font-weight: 700; text-align: center; }
.page-title small { font-size: 14px; color: var(--text-light); font-weight: 400; margin-left: 8px; }

/* Post Grid */
.post-grid { display: flex; flex-direction: column; gap: 20px; padding: 20px 0; max-width: 710px; margin: 0 auto; }
.post-card { border-radius: var(--card-radius); overflow: hidden; background: var(--card-bg); box-shadow: var(--card-shadow); transition: transform .3s, box-shadow .3s; display: block; color: var(--text); contain: layout style; }
.post-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); color: var(--text); }
.card-cover { position: relative; height: 12.5rem; overflow: hidden; background: linear-gradient(135deg, #2c3e50, #1abc9c); }
.card-cover-img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; transition: transform .4s; }
.post-card:hover .card-cover-img { transform: scale(1.06); }
.card-overlay { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: linear-gradient(transparent 30%, var(--overlay) 100%); display: flex; flex-direction: column; justify-content: flex-end; padding: 16px; }
.post-card:hover .card-overlay { background: linear-gradient(transparent 20%, var(--overlay-hover) 100%); }
.card-category { display: inline-block; padding: 2px 10px; border-radius: 10px; background: var(--primary); color: #fff; font-size: 12px; margin-bottom: 8px; align-self: flex-start; }
.card-title { font-size: 20px; font-weight: 600; color: #1abc9c; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 1px 4px rgba(0,0,0,0.6); }
.card-meta { font-size: 12px; color: rgba(255,255,255,0.7); margin-top: 6px; }

/* Pagination */
ol.page-navigator {
    list-style: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 30px 0 40px;
    flex-wrap: wrap;
    margin: 0;
}
ol.page-navigator li { display: inline-flex; }
ol.page-navigator li a, ol.page-navigator li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 14px;
    transition: all .2s;
    background: var(--card-bg);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    text-decoration: none;
}
ol.page-navigator li a:hover {
    background: var(--primary);
    color: #fff;
}
ol.page-navigator li.current a,
ol.page-navigator li.current span {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}
ol.page-navigator li.dots span {
    background: none;
    box-shadow: none;
    color: var(--text-light);
}

/* Post Detail */
.post-detail { background: var(--card-bg); border-radius: var(--card-radius); padding: 32px; margin: 20px auto; box-shadow: var(--card-shadow); max-width: 800px; }
.post-detail h1 { font-size: 26px; line-height: 1.4; margin-bottom: 12px; }
.post-meta-detail { color: var(--text-light); font-size: 14px; margin-bottom: 20px; display: flex; gap: 16px; flex-wrap: wrap; }
.post-meta-detail a { color: var(--primary); }
.post-content { line-height: 1.8; font-size: 16px; word-break: break-word; }
.post-content img { border-radius: 8px; margin: 12px 0; display: block; max-width: 100%; }
.post-content p { margin-bottom: 16px; }
.post-content h2, .post-content h3 { margin: 24px 0 12px; }
.post-content a { color: var(--primary); border-bottom: 1px dashed var(--primary); }
.post-content video { max-width: 100%; border-radius: 8px; }
.post-videos { margin-top: 20px; }
.video-item { margin-bottom: 16px; }
.video-item video { width: 100%; max-width: 100%; border-radius: 8px; background: #000; }
.post-content ul, .post-content ol { padding-left: 1.5em; margin-bottom: 16px; }
.post-content li { margin-bottom: 4px; }
.post-content blockquote { border-left: 3px solid var(--primary); padding: 12px 16px; margin: 16px 0; background: var(--bg); border-radius: 4px; }
.post-content pre { background: #f8f8f8; padding: 16px; border-radius: 8px; overflow-x: auto; margin: 16px 0; }
.post-content code { background: #f0f0f0; padding: 2px 6px; border-radius: 4px; font-size: 14px; }
.post-content pre code { background: none; padding: 0; }
.post-content table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.post-content th, .post-content td { border: 1px solid #ddd; padding: 8px 12px; text-align: left; }
.dark .post-content pre { background: #1e1e2e; }
.dark .post-content code { background: #2a2a3e; }
.dark .post-content th, .dark .post-content td { border-color: #444; }
.post-tags { margin-top: 24px; padding-top: 16px; border-top: 1px solid #eee; display: flex; gap: 8px; flex-wrap: wrap; }
.dark .post-tags { border-color: #333; }
.post-tags a { padding: 4px 14px; border-radius: 14px; font-size: 13px; background: var(--bg); color: var(--text-light); transition: all .2s; border-bottom: none; text-decoration: none; }
.post-tags a:hover { background: var(--primary); color: #fff; }
.category-links { margin-top: 16px; padding: 12px 16px; background: var(--bg); border-radius: 8px; font-size: 14px; color: var(--text-light); }
.category-links a { margin: 0 6px; border-bottom: none; }

/* Related */
.related-section { margin: 30px auto; max-width: 800px; }
.related-section h3 { font-size: 20px; margin-bottom: 16px; font-weight: 700; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.related-grid .card-cover { height: 10rem; }

/* Footer */
.site-footer { background: var(--header-bg); padding: 32px 0 20px; margin-top: 40px; transition: background .3s; border-top: 1px solid rgba(0,0,0,0.06); }
.dark .site-footer { border-color: rgba(255,255,255,0.06); }
.footer-inner { text-align: center; }
.footer-brand { font-size: 20px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.footer-desc { color: var(--text-light); font-size: 14px; margin-bottom: 16px; }
.footer-links { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.footer-links a { color: var(--text-light); font-size: 13px; text-decoration: none; }
.footer-links a:hover { color: var(--primary); }
.footer-copy { color: var(--text-light); font-size: 12px; }

/* 404 */
.not-found { text-align: center; padding: 60px 20px 30px; }
.not-found h1 { font-size: 96px; color: var(--primary); margin: 0; line-height: 1; }
.not-found > p { font-size: 18px; color: var(--text-light); margin: 16px 0 28px; }
.not-found-actions { margin-bottom: 40px; }
.btn-home { display: inline-block; padding: 12px 32px; border-radius: 24px; background: var(--primary); color: #fff; font-size: 15px; text-decoration: none; transition: background .2s; }
.btn-home:hover { background: var(--primary-dark); }
.not-found-recommend { margin-top: 40px; text-align: left; }
.not-found-recommend h3 { font-size: 20px; margin-bottom: 16px; font-weight: 700; }

/* Responsive */
@media (max-width: 768px) {
    .site-nav { display: none; max-height: none; }
    .site-nav.open { display: flex; flex-direction: column; position: absolute; top: 60px; left: 0; right: 0; background: var(--header-bg); padding: 12px 16px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 99; gap: 4px; }
    .cat-bar { gap: 4px; margin-bottom: 14px; }
    .cat-bar a { font-size: 12px; padding: 4px 10px; }
    .mobile-menu-btn { display: flex; width: 36px; height: 36px; border: none; background: transparent; color: var(--text); font-size: 22px; cursor: pointer; align-items: center; justify-content: center; margin-left: 8px; }
    .post-grid { max-width: 100%; gap: 14px; }
    .card-cover { height: 10.5rem; }
    .post-detail { padding: 20px 16px; margin: 12px auto; }
    .post-detail h1 { font-size: 20px; }
    .related-grid { grid-template-columns: repeat(2, 1fr); }
    .related-section { margin: 20px auto; }
    .header-inner { padding: 0 12px; }
    .search-box input { width: 140px; }
}
@media (max-width: 480px) {
    .related-grid { grid-template-columns: 1fr; }
}
@media (min-width: 768px) and (max-width: 1301px) { .post-grid { max-width: 720px; } }
@media (min-width: 1302px) and (max-width: 1599px) { .post-grid { max-width: 864px; } }
@media (min-width: 1600px) and (max-width: 1799px) { .post-grid { max-width: 896px; } }
@media (min-width: 1800px) and (max-width: 1999px) { .post-grid { max-width: 960px; } }
@media (min-width: 2000px) and (max-width: 2399px) { .post-grid { max-width: 992px; } }
@media (min-width: 2400px) { .post-grid { max-width: 1024px; } }
