/* ── Streaming Leaderboard ─────────────────────────────────── */
.slb-wrap { margin: 1.5rem 0; }

/* Hero */
.slb-hero {
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
    color: #fff;
    padding: 2rem 1.5rem;
    text-align: center;
    border-radius: 12px 12px 0 0;
}
.slb-hero-title, .article-body .slb-hero-title { font-size: 1.5rem; font-weight: 700; margin: 0 0 4px; border-bottom: none !important; padding-bottom: 0; color: #fff !important; }
.slb-hero-logo { width: 36px; height: auto; margin: 0 auto 8px; display: block; }
.slb-hero-subtitle { font-size: 1rem; opacity: 0.9; margin: 0 0 4px; }
.slb-hero-updated { font-size: 0.8rem; opacity: 0.6; margin: 0; }

/* Stats row */
.slb-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}
.slb-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    text-align: center;
}
.slb-stat-value { display: block; font-size: 1.5rem; font-weight: 700; color: #1e40af; }
.slb-stat-label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
[data-theme="dark"] .slb-stat-value { color: #818cf8; }

/* ── Desktop Table ────────────────────────────────────────── */
.slb-table-responsive { overflow-x: auto; }

.slb-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.slb-table a {
    color: inherit;
    text-decoration: none;
}
.slb-table a:hover { color: var(--color-primary); }

.slb-table th,
.slb-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.slb-table th {
    background: var(--bg-surface-2);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: var(--text-heading);
    border-bottom: 2px solid var(--border-light);
    white-space: nowrap;
}

/* Alternating rows */
.slb-table tbody tr:nth-child(even) { background: var(--bg-surface); }
.slb-table tbody tr:hover { background: var(--bg-surface-2); }

/* Column widths */
.slb-col-rank { width: 50px; text-align: center !important; }
.slb-col-change { width: 55px; text-align: center !important; }
.slb-col-watchtime { width: 120px; text-align: right !important; }
.slb-col-num { width: 100px; text-align: right !important; font-variant-numeric: tabular-nums; }

/* Streamer cell */
.slb-streamer-cell { display: flex !important; align-items: center !important; gap: 0.75rem; flex-direction: row !important; }
.slb-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--bg-surface-2); display: inline-block; margin: 0; }
.slb-streamer-name { font-weight: 500; white-space: nowrap; }

/* Prevent article-body styles from breaking table layout */
.article-body .slb-wrap { all: unset; display: block; margin: 1.5rem 0; }
.article-body .slb-table a { text-decoration: none; color: inherit; }
.article-body .slb-table a:hover { color: var(--color-primary); }
.article-body .slb-table img { display: inline-block; margin: 0; }

/* Prevent article-body styles from breaking embedded apps */
.article-body .graph-favicon-overlay img,
.graph-favicon-overlay img,
.graph-favicon,
.graph-avatar { display: block !important; margin: 0 !important; max-width: none !important; }
.slb-wt-value { font-weight: 600; }

/* Medals */
.slb-medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
}
.slb-medal-gold { background: linear-gradient(135deg, #ffd700, #ffed4a); color: #92400e; }
.slb-medal-silver { background: linear-gradient(135deg, #c0c0c0, #e5e7eb); color: #374151; }
.slb-medal-bronze { background: linear-gradient(135deg, #cd7f32, #d97706); color: #fff; }

/* Change indicators */
.slb-change-up { color: #10b981; font-weight: 600; font-size: 0.8rem; }
.slb-change-down { color: #ef4444; font-weight: 600; font-size: 0.8rem; }
.slb-change-same { color: var(--text-muted); font-size: 0.75rem; }
.slb-change-new {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    font-weight: 700;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
[data-theme="dark"] .slb-change-new { background: rgba(59,130,246,0.2); color: #60a5fa; }

/* Badges */
.slb-partner-badge {
    display: inline-block;
    font-size: 0.6rem;
    background: #1e40af;
    color: #fff;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 5px;
    vertical-align: middle;
    font-weight: 600;
    letter-spacing: 0.025em;
}
.slb-affiliate-badge {
    display: inline-block;
    font-size: 0.6rem;
    background: #d97706;
    color: #fff;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 5px;
    vertical-align: middle;
    font-weight: 600;
    letter-spacing: 0.025em;
}
[data-theme="dark"] .slb-partner-badge { background: #4f46e5; }
[data-theme="dark"] .slb-affiliate-badge { background: #b45309; }

/* ── Mobile Cards ─────────────────────────────────────────── */
.slb-cards { display: none; }

/* ── Summary Stats Grid ───────────────────────────────────── */
.streaming-summary-container { margin: 1.5rem 0; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}
.stat-card.primary { border-left: 3px solid #3b82f6; }
.stat-card.highlight { border-left: 3px solid #ef4444; }
.stat-icon { font-size: 1.2rem; display: block; margin-bottom: 4px; }
.stat-value { display: block; font-size: 1.6rem; font-weight: 700; color: var(--text-heading); }
.stat-label { display: block; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }
.stat-comparison { display: block; font-size: 0.8rem; margin-top: 4px; }

.comparison-positive { color: #16a34a; }
.comparison-negative { color: #dc2626; }
.comparison-neutral { color: var(--text-muted); }

/* ── Top Streamers Cards ──────────────────────────────────── */
.streaming-top-streamers-section { margin: 1.5rem 0; }
.streaming-top-streamers-section h3 { margin-bottom: 1rem; }

.streaming-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.streaming-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: box-shadow 0.2s;
}
.streaming-card:hover { box-shadow: var(--shadow-sm); }
.streaming-card img { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }

.streaming-card-info { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.streaming-card-rank { font-size: 0.7rem; color: var(--text-muted); font-weight: 700; }
.channel_name { font-weight: 600; color: var(--text-heading); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel_name:hover { color: var(--color-primary); }
.avg_viewers, .followers { font-size: 0.8rem; color: var(--text-muted); }
.followers_gained { font-size: 0.75rem; }
.followers_gained.positive { color: #16a34a; }
.followers_gained.negative { color: #dc2626; }

/* ── Chart Containers ─────────────────────────────────────── */
.streaming-chart-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 1rem 0;
}
.chart-title { font-size: 1rem; margin: 0 0 12px; }
.chart-wrapper { position: relative; }
.streaming-error { color: #dc2626; font-style: italic; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .slb-table-responsive { display: none; }
    .slb-cards {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 2rem;
    }

    .slb-hero { border-radius: 8px; }
    .slb-hero-title { font-size: 1.3rem; }

    .slb-card {
        background: var(--card-bg);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 1rem;
        box-shadow: var(--shadow-sm);
    }

    .slb-card-header {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .slb-card-rank { flex-shrink: 0; text-align: center; min-width: 36px; }
    .slb-card-rank-num { font-weight: 700; font-size: 1rem; color: var(--text-muted); }
    .slb-card-change { font-size: 0.75rem; margin-top: 2px; }

    .slb-card-info { flex: 1; min-width: 0; }
    .slb-card-name {
        font-weight: 600;
        font-size: 1rem;
        color: var(--text-heading);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .slb-card-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem 0.75rem;
        border-top: 1px solid var(--border);
        padding-top: 0.75rem;
    }
    .slb-card-stat-label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); }
    .slb-card-stat-value { display: block; font-weight: 600; font-size: 0.9rem; color: var(--text-heading); }

    .slb-stats { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .slb-stats { grid-template-columns: 1fr; }
    .streaming-cards-grid { grid-template-columns: 1fr; }
    .streaming-card img { width: 32px; height: 32px; }
    .streaming-card { padding: 10px; gap: 10px; }
    .slb-stat-card { padding: 1rem; }
    .slb-stat-value { font-size: 1.25rem; }
}
