/* GitHub 热搜·中国小白版 —— 掘金骨架 + 衬线大简介 设计令牌 */

:root {
    --bg: #f4f5f5;
    --card: #ffffff;
    --border: #e4e6eb;
    --text-1: #252933;
    --text-2: #515767;
    --text-3: #8a919f;
    --brand: #1e80ff;
    --brand-soft: #eaf2ff;
    --up: #f64242;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    --serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
    --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
        "Helvetica Neue", Arial, sans-serif;
    --mono: "SF Mono", "Consolas", "Menlo", monospace;
}

[data-theme="dark"] {
    --bg: #16171a;
    --card: #1e1f23;
    --border: #2c2e33;
    --text-1: #e8e9eb;
    --text-2: #b4b7bc;
    --text-3: #7d8188;
    --brand: #3d8bff;
    --brand-soft: #1d2c42;
    --up: #ff6b6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text-1);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background 0.2s, color 0.2s;
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ── 顶部导航 ─────────────────────────────────────────────── */
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.topbar-row {
    display: flex; align-items: center; justify-content: space-between;
    height: 56px;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-name { font-size: 18px; font-weight: 700; color: var(--text-1); }
.brand-sub {
    font-size: 13px; font-weight: 600; color: var(--brand);
    background: var(--brand-soft); padding: 1px 7px; border-radius: 4px;
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.brand-tagline { font-size: 13px; color: var(--text-3); }
.theme-toggle {
    font-size: 13px; color: var(--text-2); background: transparent;
    border: 1px solid var(--border); border-radius: 6px;
    padding: 5px 12px; cursor: pointer; font-family: var(--sans);
    transition: all 0.15s;
}
.theme-toggle:hover { border-color: var(--brand); color: var(--brand); }

/* ── 榜单导航 Tab ─────────────────────────────────────────── */
.tabbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 56px; z-index: 40;
}
.tabbar-row { display: flex; gap: 4px; overflow-x: auto; }
.tab {
    font-size: 14px; font-weight: 500; color: var(--text-2);
    padding: 12px 14px; white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color 0.15s;
}
.tab:hover { color: var(--brand); }
.tab.active { color: var(--brand); font-weight: 600; border-bottom-color: var(--brand); }
/* 搞钱榜 Tab：金色突出（变现主题） */
.tab-money { color: #d97706; font-weight: 600; }
.tab-money:hover { color: #d97706; }
.tab-money.active { color: #d97706; border-bottom-color: #d97706; }

/* ── 主内容区 ─────────────────────────────────────────────── */
.main { padding: 24px 20px 48px; }

/* ── 统计卡片 ─────────────────────────────────────────────── */
.stat-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: 8px; padding: 14px 16px;
}
.stat-label { font-size: 12px; color: var(--text-3); }
.stat-value {
    font-size: 22px; font-weight: 700; color: var(--text-1);
    margin-top: 4px; font-family: var(--mono);
}

/* ── 分类/语言筛选（单行横向滚动，不堆叠） ─────────────────── */
.cat-filter {
    display: flex; gap: 8px; margin-bottom: 18px;
    overflow-x: auto; flex-wrap: nowrap;
    padding-bottom: 6px; scrollbar-width: thin;
}
.cat-filter::-webkit-scrollbar { height: 4px; }
.cat-filter::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.cat-chip {
    font-size: 13px; color: var(--text-2);
    background: var(--card); border: 1px solid var(--border);
    padding: 5px 12px; border-radius: 20px; cursor: pointer;
    transition: all 0.15s; white-space: nowrap; flex-shrink: 0;
}
.cat-chip:hover { border-color: var(--brand); color: var(--brand); }
.cat-chip.active {
    background: var(--brand); color: #fff; border-color: var(--brand);
}

/* ── 区块标题 ─────────────────────────────────────────────── */
.section-head { margin: 4px 0 16px; }
.section-title { font-size: 20px; font-weight: 700; color: var(--text-1); }
.section-title .accent { color: var(--brand); }
.section-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }

/* ── 项目卡片信息流 ────────────────────────────────────────── */
.card-list { display: flex; flex-direction: column; gap: 14px; }
.pcard {
    display: flex; gap: 24px;
    background: var(--card); border: 1px solid var(--border);
    border-radius: 10px; padding: 20px 22px;
    transition: all 0.15s; position: relative;
}
.pcard:hover { border-color: var(--brand); box-shadow: var(--shadow); }

.pcard-rank {
    flex-shrink: 0; width: 32px; padding-top: 3px;
    font-size: 18px; font-weight: 700; color: var(--text-3);
    font-family: var(--mono);
}
.pcard-rank.top { color: var(--brand); }

.pcard-body { flex: 1; min-width: 0; }
.pcard-title {
    font-family: var(--serif);
    font-size: 21px; font-weight: 700; line-height: 1.4;
    color: var(--text-1); margin: 0 0 6px;
}
.pcard-title .cn-flag { font-size: 14px; margin-left: 6px; }
.pcard-desc {
    font-size: 14px; color: var(--text-2); line-height: 1.6;
    margin: 0 0 12px;
}

/* 标签独立行（分类/变现/增长），不再和 repo 名挤一行 */
.pcard-tags {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 6px 10px; margin-bottom: 10px;
}
/* repo 名底部行（虚线上分隔） */
.pcard-foot {
    display: flex; align-items: center; gap: 14px;
    font-size: 12px; color: var(--text-3);
    padding-top: 10px; border-top: 1px dashed var(--border);
}
.pcard-foot .name { font-family: var(--mono); }
.pcard-foot .lang::before {
    content: "●"; margin-right: 4px; font-size: 9px; color: var(--brand);
}
.cat-badge {
    font-size: 12px; color: var(--brand); background: var(--brand-soft);
    padding: 2px 8px; border-radius: 4px; font-weight: 500;
}

/* ── 变现标签（搞钱功能） ─────────────────────────────────── */
.mz-badge {
    font-size: 12px; font-weight: 600;
    padding: 2px 8px; border-radius: 4px; white-space: nowrap;
}
.mz-badge.mz-a { color: #1e80ff; background: #eaf2ff; }          /* 🚀 自部署 蓝 */
.mz-badge.mz-b { color: #16a34a; background: #e8f7ee; }          /* 🔧 二开 绿 */
.mz-badge.mz-c { color: #9333ea; background: #f3eaff; }          /* 🤖 套壳 紫 */
[data-theme="dark"] .mz-badge.mz-a { color: #5ea0ff; background: #1d2c42; }
[data-theme="dark"] .mz-badge.mz-b { color: #4ade80; background: #14331f; }
[data-theme="dark"] .mz-badge.mz-c { color: #c084fc; background: #2c1d42; }

/* ── 增长类型 + 新上榜 + 上手成本 标签（P0 四件套） ─────────── */
.gt-badge {
    font-size: 12px; font-weight: 600;
    padding: 2px 8px; border-radius: 4px; white-space: nowrap;
}
.gt-badge.gt-burst { color: #d97706; background: #fdf1e0; }      /* 爆发 橙 */
.gt-badge.gt-steady { color: #16a34a; background: #e8f7ee; }     /* 稳定 绿 */
.gt-badge.gt-tail { color: var(--text-3); background: var(--bg); } /* 长尾 灰 */
[data-theme="dark"] .gt-badge.gt-burst { color: #f59e0b; background: #2c2113; }
[data-theme="dark"] .gt-badge.gt-steady { color: #4ade80; background: #14331f; }
[data-theme="dark"] .gt-badge.gt-tail { color: #7d8188; background: #1e1f23; }

.new-badge {
    font-size: 12px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, #f64242, #e8327a);
    padding: 2px 8px; border-radius: 4px; white-space: nowrap;
    margin-left: 8px; vertical-align: 2px;
}

.cost-badge {
    font-size: 12px; font-weight: 500;
    padding: 2px 8px; border-radius: 4px; white-space: nowrap;
    color: var(--text-2); background: var(--bg);
    border: 1px solid var(--border);
}
.cost-badge.cost-a { color: #16a34a; border-color: rgba(22,163,74,0.35); background: rgba(22,163,74,0.06); }
.cost-badge.cost-b { color: #d97706; border-color: rgba(217,119,6,0.35); background: rgba(217,119,6,0.06); }
.cost-badge.cost-c { color: #e11d48; border-color: rgba(225,29,72,0.35); background: rgba(225,29,72,0.06); }

/* 详情页三句式（insight v2） */
.insight-3col {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
    margin-bottom: 14px;
}
.insight-col {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; padding: 12px 14px;
}
.insight-col-label {
    font-size: 12px; color: var(--text-3); margin-bottom: 4px; font-weight: 600;
}
.insight-col-text { font-size: 14px; color: var(--text-1); line-height: 1.6; }
.insight-alt {
    font-size: 13px; color: var(--text-2); line-height: 1.6;
    background: linear-gradient(to right, rgba(217,119,6,0.08), transparent);
    border-left: 2px solid #d97706;
    padding: 8px 12px; border-radius: 0 6px 6px 0; margin-bottom: 14px;
}
.insight-alt::before { content: "🔄 替代谁 · "; font-weight: 600; color: #d97706; }

/* 反特性提醒（P1-2，依赖第三方服务） */
.risk-warn {
    font-size: 13px; color: #e11d48; line-height: 1.6;
    background: rgba(225, 29, 72, 0.06);
    border: 1px solid rgba(225, 29, 72, 0.2);
    padding: 8px 12px; border-radius: 6px; margin-bottom: 14px;
    font-weight: 500;
}

/* 收藏按钮（P1-1 收藏机制） */
.fav-btn {
    font-size: 16px; line-height: 1; color: var(--text-3);
    background: transparent; border: none; cursor: pointer;
    padding: 2px 6px; margin-left: 8px; vertical-align: 2px;
    transition: all 0.15s; border-radius: 4px;
}
.fav-btn:hover { color: #f59e0b; transform: scale(1.2); }
.fav-btn.faved { color: #f59e0b; }
[data-theme="dark"] .fav-btn { color: #7d8188; }
[data-theme="dark"] .fav-btn.faved { color: #fbbf24; }

/* 详情页收藏按钮（大号带文字） */
.fav-btn-lg { min-width: 88px; }
.fav-btn-lg.faved { color: #f59e0b; border-color: rgba(245, 158, 11, 0.5); background: rgba(245, 158, 11, 0.06); }

/* ── 任务进度板（老板可见性） ─────────────────────────────── */
.pr-status {
    font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 4px;
    margin-left: 8px; vertical-align: 2px;
}
.pr-running { color: #1e80ff; background: #eaf2ff; }
.pr-done { color: #16a34a; background: #e8f7ee; }
[data-theme="dark"] .pr-running { color: #5ea0ff; background: #1d2c42; }
[data-theme="dark"] .pr-done { color: #4ade80; background: #14331f; }
.pr-bar-wrap {
    height: 8px; background: var(--bg); border-radius: 4px;
    overflow: hidden; margin-top: 10px;
}
.pr-bar {
    height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, #1e80ff, #3d8bff);
    transition: width 0.8s ease;
}
[data-theme="dark"] .pr-bar { background: linear-gradient(90deg, #3d8bff, #5ea0ff); }
.pr-msg {
    font-size: 13px; color: var(--text-2); margin-top: 8px;
    background: var(--bg); border-radius: 6px; padding: 6px 10px;
}

/* ── 月度精选（月刊页） ─────────────────────────────────── */
.mp-hero {
    text-align: center; padding: 20px 0 28px;
    border-bottom: 1px solid var(--border); margin-bottom: 20px;
}
.mp-issue {
    font-size: 13px; color: var(--brand); font-weight: 600;
    letter-spacing: 0.08em; margin-bottom: 8px;
}
.mp-title {
    font-family: var(--serif); font-size: 30px; font-weight: 700;
    color: var(--text-1); margin: 0 0 6px; line-height: 1.3;
}
.mp-sub { font-size: 14px; color: var(--text-3); }

/* ── 每日技术风向区块 */
.trend-bar {
    display: flex; align-items: center; gap: 12px;
    background: linear-gradient(135deg, rgba(30,128,255,0.06), rgba(217,119,6,0.05));
    border: 1px solid rgba(30,128,255,0.15);
    border-radius: 10px; padding: 14px 18px; margin-bottom: 20px;
}
.trend-icon { font-size: 26px; flex-shrink: 0; }
.trend-text { font-size: 15px; color: var(--text-1); line-height: 1.7; }
.trend-text strong { color: var(--brand); }
.trend-loading { font-size: 13px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }

/* 搞钱建议（详情页/卡片下方的一句话 pitch） */
.mz-pitch {
    font-size: 13px; color: var(--text-2); line-height: 1.6;
    background: linear-gradient(to right, rgba(217, 119, 6, 0.06), transparent);
    border-left: 2px solid #d97706;
    padding: 8px 12px; border-radius: 0 6px 6px 0; margin-top: 10px;
}
.mz-pitch::before { content: "💡 搞钱思路 · "; font-weight: 600; color: #d97706; }

/* 右侧热度列（左边框分隔，与内容区视觉分离） */
.pcard-heat {
    flex-shrink: 0; width: 130px; text-align: right;
    border-left: 1px solid var(--border); padding-left: 22px;
    display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.heat-num {
    font-size: 20px; font-weight: 700; color: var(--text-1);
    font-family: var(--mono);
}
.heat-label { font-size: 12px; color: var(--text-3); }
.heat-up { font-size: 13px; font-weight: 600; color: var(--up); font-family: var(--mono); }

/* 分享按钮 */
.share-btn {
    position: absolute; right: 20px; top: 18px;
    font-size: 12px; color: var(--text-3); background: transparent;
    border: 1px solid var(--border); border-radius: 6px;
    padding: 4px 10px; cursor: pointer; font-family: var(--sans);
    opacity: 0; transition: all 0.15s;
}
.pcard:hover .share-btn { opacity: 1; }
.share-btn:hover { color: var(--brand); border-color: var(--brand); }

/* ── 分页 ────────────────────────────────────────────────── */
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 28px; }
.pager-btn {
    font-size: 13px; color: var(--text-2); background: var(--card);
    border: 1px solid var(--border); padding: 7px 16px; border-radius: 6px;
    transition: all 0.15s;
}
.pager-btn:hover { border-color: var(--brand); color: var(--brand); }
.pager-info { font-size: 13px; color: var(--text-3); }

/* ── 空态 ────────────────────────────────────────────────── */
.empty {
    text-align: center; padding: 80px 20px; background: var(--card);
    border: 1px solid var(--border); border-radius: 8px;
}
.empty-icon { font-size: 44px; margin-bottom: 14px; }
.empty-title { font-size: 17px; font-weight: 600; color: var(--text-1); margin-bottom: 8px; }
.empty-desc { font-size: 13px; color: var(--text-3); margin-bottom: 18px; }
.empty-btn {
    display: inline-block; font-size: 13px; color: #fff; background: var(--brand);
    padding: 8px 20px; border-radius: 6px;
}

/* ── 详情页 ───────────────────────────────────────────────── */
.back-link {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 13px; color: var(--text-3); margin-bottom: 16px;
    transition: color 0.15s;
}
.back-link:hover { color: var(--brand); }

.detail-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: 8px; padding: 28px; margin-bottom: 16px;
}
.detail-title {
    font-family: var(--serif); font-size: 30px; font-weight: 700;
    line-height: 1.3; color: var(--text-1); margin: 0 0 6px;
}
.detail-reponame { font-size: 14px; color: var(--text-3); font-family: var(--mono); margin-bottom: 16px; }

/* 小白推荐指数 */
.friendliness-bar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    font-size: 14px; margin-bottom: 14px;
    background: linear-gradient(to right, rgba(30, 128, 255, 0.06), transparent);
    padding: 8px 14px; border-radius: 8px;
}
.friendliness-stars { font-size: 17px; color: #f59e0b; letter-spacing: 1px; }
.friendliness-score { font-weight: 700; color: var(--text-1); font-family: var(--mono); }
.friendliness-label { font-size: 12px; color: var(--text-3); }
.friendliness-reasons { font-size: 12px; color: var(--text-3); }
[data-theme="dark"] .friendliness-stars { color: #fbbf24; }
.detail-summary { font-size: 16px; color: var(--text-2); line-height: 1.7; margin-bottom: 18px; }
.detail-orig {
    font-size: 13px; color: var(--text-3); line-height: 1.6;
    padding: 12px 14px; background: var(--bg); border-radius: 6px;
    margin-bottom: 18px;
}
.detail-orig::before { content: "原文 · "; font-weight: 600; }
.detail-stats { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; }
.dstat { display: flex; flex-direction: column; }
.dstat-num { font-size: 20px; font-weight: 700; color: var(--text-1); font-family: var(--mono); }
.dstat-num.up { color: var(--up); }
.dstat-label { font-size: 12px; color: var(--text-3); }
.detail-actions { margin-left: auto; display: flex; gap: 10px; }
.btn {
    font-size: 14px; font-weight: 500; padding: 9px 20px; border-radius: 6px;
    cursor: pointer; transition: all 0.15s; border: 1px solid transparent;
    font-family: var(--sans);
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { color: var(--brand); border-color: var(--brand); }

.topic-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.topic-tag {
    font-size: 12px; color: var(--brand); background: var(--brand-soft);
    padding: 3px 10px; border-radius: 12px;
}

.section-block {
    background: var(--card); border: 1px solid var(--border);
    border-radius: 8px; padding: 24px; margin-bottom: 16px;
}
.section-block-title { font-size: 17px; font-weight: 700; color: var(--text-1); margin: 0 0 16px; }

.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* 相关项目 */
.related-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0; border-bottom: 1px solid var(--border);
}
.related-item:last-child { border-bottom: none; }
.related-name { font-size: 14px; font-weight: 600; color: var(--text-1); }
.related-summary { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.related-heat { font-size: 13px; color: var(--text-2); font-family: var(--mono); white-space: nowrap; margin-left: 16px; }

/* ── AI 亮点解析 ──────────────────────────────────────────── */
.insight-list { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 10px; }
.insight-item {
    font-size: 14px; color: var(--text-1); line-height: 1.6;
    padding-left: 20px; position: relative;
}
.insight-item::before {
    content: "✦"; position: absolute; left: 0; top: 0;
    color: #d97706; font-size: 14px;
}
.insight-value {
    font-size: 14px; color: var(--text-2); line-height: 1.7;
    background: linear-gradient(to right, rgba(30, 128, 255, 0.06), transparent);
    border-left: 2px solid var(--brand);
    padding: 10px 14px; border-radius: 0 6px 6px 0;
}
.insight-value::before { content: "💡 对你有什么用 · "; font-weight: 600; color: var(--brand); }
.insight-loading {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--text-3); padding: 14px 0;
}
.insight-loading-dot {
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid rgba(217, 119, 6, 0.25); border-top-color: #d97706;
    animation: insight-spin 0.8s linear infinite;
}
@keyframes insight-spin { to { transform: rotate(360deg); } }

/* ── 页脚 ────────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 28px 0 40px; }
.footer-explainer {
    font-size: 13px; color: var(--text-2); line-height: 1.8;
    background: var(--card); border: 1px solid var(--border);
    border-radius: 8px; padding: 16px 20px; margin-bottom: 16px;
}
.footer-meta { font-size: 12px; color: var(--text-3); text-align: center; }
.footer-meta a { color: var(--text-3); text-decoration: underline; }
.footer-meta a:hover { color: var(--brand); }

/* ── 分享弹层 ─────────────────────────────────────────────── */
.share-modal-mask {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    display: none; align-items: center; justify-content: center; z-index: 100;
}
.share-modal-mask.show { display: flex; }
.share-modal {
    background: var(--card); border-radius: 12px; padding: 24px;
    width: min(480px, 90vw); box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}
.share-modal-title { font-size: 16px; font-weight: 700; color: var(--text-1); margin: 0 0 14px; }
.share-text-box {
    font-size: 13px; color: var(--text-2); background: var(--bg);
    border: 1px solid var(--border); border-radius: 8px; padding: 14px;
    line-height: 1.7; margin-bottom: 14px; white-space: pre-wrap; word-break: break-all;
}
.share-canvas-wrap { text-align: center; margin-bottom: 14px; }
#shareCanvas { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); }
.share-modal-btns { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Toast 提示 ────────────────────────────────────────────── */
.toast {
    position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(80px);
    background: var(--text-1); color: var(--bg); font-size: 13px;
    padding: 10px 20px; border-radius: 8px; z-index: 200;
    opacity: 0; transition: all 0.3s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 响应式 ───────────────────────────────────────────────── */
@media (max-width: 720px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .info-grid { grid-template-columns: 1fr; }
    .pcard { flex-direction: column; gap: 10px; }
    .pcard-heat {
        width: auto; flex-direction: row; align-items: baseline;
        gap: 12px; text-align: left;
    }
    .pcard-rank { width: auto; }
    .brand-tagline { display: none; }
    .pcard-title { font-size: 19px; }
    .detail-title { font-size: 24px; }
    .detail-actions { margin-left: 0; width: 100%; }
    .share-btn { opacity: 1; position: static; margin-top: 8px; }
}
