/* ========== 全局重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; color: #333; }

/* ========== 返回顶部按钮（公用） ========== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: none;
    z-index: 200;
    transition: opacity 0.3s, transform 0.3s;
}
.back-to-top:hover { background: #1557b0; transform: translateY(-2px); }
.back-to-top.show { display: block; }

/* ============================================== */
/* 前台文章详情页 (article.php)                     */
/* ============================================== */
body { background: #f5f5f5; line-height: 1.8; }
.topbar {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 0 20px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar .logo { font-size: 18px; font-weight: 700; color: #1a73e8; text-decoration: none; }
.topbar .home-link { font-size: 14px; color: #666; text-decoration: none; }
.main-container { max-width: 820px; margin: 0 auto; padding: 20px 16px 40px; }
.breadcrumb { font-size: 13px; color: #888; margin-bottom: 16px; }
.breadcrumb a { color: #1a73e8; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.article-card {
    background: #fff;
    border-radius: 12px;
    padding: 32px 36px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    margin-bottom: 20px;
}
.article-card h1 { font-size: 2em; color: #111; margin-bottom: 12px; line-height: 1.4; }
.article-meta { color: #999; font-size: 13px; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid #f0f0f0; }
.toc {
    background: #f8fafc;
    border-left: 3px solid #1a73e8;
    padding: 16px 20px;
    margin-bottom: 28px;
    border-radius: 0 8px 8px 0;
}
.toc h3 { font-size: 15px; margin-bottom: 10px; color: #333; }
.toc ul { list-style: none; padding: 0; }
.toc ul li { margin-bottom: 6px; }
.toc ul li a { color: #0066cc; text-decoration: none; font-size: 14px; }
.toc ul li a:hover { color: #004499; text-decoration: underline; }
.article-content { font-size: 17px; }
.article-content h2 {
    font-size: 1.5em;
    margin: 32px 0 14px;
    color: #111;
    border-bottom: 2px solid #1a73e8;
    padding-bottom: 8px;
}
.article-content p { margin: 14px 0; }
.article-content a { color: #0066cc; text-decoration: underline; }
.article-content a:hover { color: #004499; }

/* 广告卡片 */
.ad-card {
    background: #fff8e1;
    border-left: 4px solid #ff9800;
    padding: 14px 18px;
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
    font-size: 14px;
}
.ad-card a {
    display: inline-block;
    background: #ff9800;
    color: #fff;
    padding: 6px 16px;
    border-radius: 4px;
    text-decoration: none;
    margin-left: 10px;
    font-weight: 600;
}
.ad-card a:hover { background: #e68900; }
.related-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px 36px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    margin-bottom: 20px;
}
.related-card h3 { font-size: 16px; color: #333; margin-bottom: 12px; }
.related-card ul { list-style: none; padding: 0; }
.related-card ul li { margin-bottom: 8px; }
.related-card ul li a { color: #0066cc; text-decoration: none; font-size: 15px; }
.related-card ul li a:hover { text-decoration: underline; }
.guide-card {
    background: linear-gradient(135deg, #e8f0fe 0%, #f0f4ff 100%);
    border: 2px solid #1a73e8;
    border-radius: 12px;
    padding: 24px 36px;
    text-align: center;
    margin-bottom: 20px;
}
.guide-card p { font-size: 16px; color: #333; margin-bottom: 10px; }
.guide-card a {
    display: inline-block;
    background: #1a73e8;
    color: #fff;
    padding: 10px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 15px;
    transition: background 0.2s;
}
.guide-card a:hover { background: #1557b0; }

/* 高频词加粗样式 */
.product-highlight { color: #e65100; font-weight: 700; }

.mobile-ad-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1a73e8;
    color: #fff;
    text-align: center;
    padding: 12px 16px;
    z-index: 150;
    font-size: 14px;
}
.mobile-ad-bar a {
    color: #fff;
    background: rgba(255,255,255,0.2);
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none;
    margin-left: 8px;
    font-weight: 600;
}
@media (max-width: 640px) {
    .mobile-ad-bar { display: block; }
    .article-card { padding: 20px 16px; }
    .article-card h1 { font-size: 1.5em; }
    .article-content { font-size: 16px; }
    .back-to-top { bottom: 60px; right: 16px; width: 40px; height: 40px; font-size: 18px; }
}

/* ============================================== */
/* 前台首页 (index.php)                            */
/* ============================================== */
.site-header {
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    color: #fff;
    padding: 40px 20px 50px;
    text-align: center;
}
.site-header h1 { font-size: 2em; margin-bottom: 8px; }
.site-header p { font-size: 1.1em; opacity: 0.85; }
.site-header .brand-link {
    display: inline-block;
    margin-top: 16px;
    padding: 8px 20px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}
.site-header .brand-link:hover { background: rgba(255,255,255,0.35); }

.home-main-container { max-width: 1100px; margin: -30px auto 0; padding: 0 16px 40px; position: relative; z-index: 10; }
.content-grid { display: grid; grid-template-columns: 1fr 300px; gap: 20px; margin-top: 20px; }

/* 首页卡片 */
.home-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    margin-bottom: 20px;
}
.home-card h2 {
    font-size: 18px;
    color: #111;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #1a73e8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.featured-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.featured-item {
    background: #f8fafc;
    border-radius: 10px;
    padding: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #e8ecf1;
}
.featured-item:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.featured-item h3 { font-size: 15px; margin-bottom: 8px; line-height: 1.5; }
.featured-item h3 a { color: #111; text-decoration: none; }
.featured-item h3 a:hover { color: #1a73e8; }
.featured-item .feat-desc {
    font-size: 13px; color: #666; line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.featured-item .feat-meta { margin-top: 10px; font-size: 12px; color: #999; display: flex; justify-content: space-between; }

.article-list-item { padding: 14px 0; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }
.article-list-item:last-child { border-bottom: none; }
.article-list-item .al-title { flex: 1; font-size: 15px; }
.article-list-item .al-title a { color: #333; text-decoration: none; transition: color 0.2s; }
.article-list-item .al-title a:hover { color: #1a73e8; }
.article-list-item .al-keyword { font-size: 12px; color: #999; margin-top: 4px; }
.article-list-item .al-time { font-size: 12px; color: #aaa; white-space: nowrap; margin-left: 16px; }

.sidebar-card ul { list-style: none; padding: 0; }
.sidebar-card ul li { margin-bottom: 10px; }
.sidebar-card ul li a { color: #444; text-decoration: none; font-size: 14px; display: flex; justify-content: space-between; align-items: center; transition: color 0.2s; }
.sidebar-card ul li a:hover { color: #1a73e8; }
.sidebar-card ul li .seed-count { font-size: 12px; color: #999; background: #f0f0f0; padding: 2px 10px; border-radius: 10px; }
.about-text { font-size: 13px; color: #666; line-height: 1.8; }

.random-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.random-item { background: #f8fafc; border-radius: 8px; padding: 12px 16px; font-size: 14px; border: 1px solid #e8ecf1; }
.random-item a { color: #333; text-decoration: none; }
.random-item a:hover { color: #1a73e8; }

.pagination { text-align: center; margin-top: 20px; }
.pagination a, .pagination span { display: inline-block; padding: 6px 14px; margin: 0 4px; border-radius: 6px; background: #fff; color: #1a73e8; text-decoration: none; border: 1px solid #ddd; font-size: 14px; transition: all 0.2s; }
.pagination a:hover { background: #e8f0fe; }
.pagination span.current { background: #1a73e8; color: #fff; border-color: #1a73e8; }

.site-footer { text-align: center; padding: 30px 20px; font-size: 13px; color: #999; border-top: 1px solid #eee; background: #fff; }

@media (max-width: 768px) {
    .content-grid { grid-template-columns: 1fr; }
    .site-header h1 { font-size: 1.5em; }
    .featured-grid { grid-template-columns: 1fr; }
    .random-grid { grid-template-columns: 1fr 1fr; }
    .article-list-item { flex-direction: column; align-items: flex-start; }
    .article-list-item .al-time { margin-left: 0; margin-top: 6px; }
    .back-to-top { bottom: 20px; right: 16px; width: 40px; height: 40px; font-size: 18px; }
}
@media (max-width: 400px) {
    .random-grid { grid-template-columns: 1fr; }
}