/* leaderboard.css — Platform Scoreboard (v2) */

/* ── Hero ────────────────────────────────────────────── */
.lb-hero {
    max-width: 760px;
    margin: 0 auto;
    padding: 3rem 1.5rem 1.5rem;
    text-align: center;
}
.lb-hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
}
.lb-sub {
    font-size: 0.9rem;
    color: var(--text-dim);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}
.lb-sub a { color: var(--text); text-decoration: underline; }

.lb-hero-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    margin-top: 1.75rem;
    border: 1px solid var(--border);
    background: var(--border);
}
.lb-stat {
    background: var(--bg);
    padding: 1.1rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}
.lb-stat-n {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(1.4rem, 3vw, 2rem);
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--text);
}
.lb-stat-green { color: #00ff88; }
.lb-stat-l {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-faint);
}

/* ── Risk distribution bar ───────────────────────────── */
.lb-risk-wrap {
    padding: 1rem 1.5rem 0.75rem;
    max-width: 900px;
    margin: 0 auto;
}
.lb-risk-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--border);
}
.lb-risk-bar span {
    transition: width 0.4s ease;
    min-width: 0;
}
.lb-risk-bar .rb-critical { background: #ff4444; }
.lb-risk-bar .rb-high { background: #ff8833; }
.lb-risk-bar .rb-moderate { background: #ccaa00; }
.lb-risk-bar .rb-low { background: #3ddc84; }

.lb-risk-legend {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    margin-top: 0.5rem;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--text-faint);
}
.lb-risk-key {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.lb-risk-key span:last-child {
    font-weight: 700;
    color: var(--text-dim);
}
.lb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.lb-dot-critical { background: #ff4444; }
.lb-dot-high { background: #ff8833; }
.lb-dot-moderate { background: #ccaa00; }
.lb-dot-low { background: #3ddc84; }

/* ── Category cards ──────────────────────────────────── */
.lb-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem 0.5rem;
    max-width: 900px;
    margin: 0 auto;
}
.lb-cat-card {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    white-space: nowrap;
}
.lb-cat-card:hover {
    border-color: var(--text-faint);
    color: var(--text);
}
.lb-cat-card.active {
    border-color: var(--accent);
    background: rgba(200, 151, 106, 0.08);
    color: var(--accent);
}
.lb-cat-count {
    font-size: 0.62rem;
    color: var(--text-faint);
    opacity: 0.7;
}
.lb-cat-card.active .lb-cat-count { color: var(--accent); opacity: 1; }

/* ── Controls ────────────────────────────────────────── */
.lb-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-top: 0.5rem;
}
.lb-controls input, .lb-controls select {
    background: transparent;
    border: none;
    border-right: 1px solid var(--border);
    color: var(--text);
    padding: 0.65rem 0.9rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    outline: none;
}
.lb-controls input { flex: 1; min-width: 180px; }
.lb-controls select { min-width: 140px; cursor: pointer; }
.lb-controls input::placeholder { color: var(--text-faint); }
.lb-controls input:focus, .lb-controls select:focus { background: var(--surface); }

.lb-view-toggle {
    display: flex;
    align-items: stretch;
}
.lb-view-btn {
    background: transparent;
    border: none;
    border-left: 1px solid var(--border);
    color: var(--text-faint);
    padding: 0 0.7rem;
    font-size: 1rem;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.lb-view-btn:hover { color: var(--text); background: var(--surface); }
.lb-view-btn.active { color: var(--accent); background: var(--surface); }

/* ── Table ───────────────────────────────────────────── */
.lb-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.lb-table th {
    background: var(--surface);
    border-bottom: 2px solid var(--border);
    padding: 0.55rem 0.6rem;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.lb-table th:hover { color: var(--text); }
.lb-table td {
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.lb-table tbody tr { transition: background 0.1s; }
.lb-table tbody tr:hover td { background: var(--surface); }

.score-cell {
    font-family: var(--font-mono);
    font-weight: 700;
    text-align: center;
}
.dim-cell {
    font-family: var(--font-mono);
    text-align: center;
    font-size: 0.8rem;
}

.vs-critical { color: #ff4444; }
.vs-high { color: #ff8833; }
.vs-moderate { color: #ccaa00; }
.vs-low { color: #3ddc84; }

.cat-tag {
    font-size: 0.68rem;
    font-family: var(--font-mono);
    padding: 0.1rem 0.4rem;
    border: 1px solid var(--border);
    white-space: nowrap;
}

/* Platform name link */
.lb-platform-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}
.lb-platform-link:hover {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: var(--border);
}

/* Gradient pips */
.g-bar { display: inline-flex; gap: 2px; }
.g-pip { width: 7px; height: 7px; background: var(--border); }
.g-pip.d1 { background: #ccaa00; }
.g-pip.d2 { background: #ff8833; }
.g-pip.d3 { background: #ff4444; }

/* On-chain badge */
.chain-badge {
    font-size: 0.65em;
    color: #4ade80;
    margin-left: 0.25em;
    vertical-align: middle;
}

/* ── Method note ─────────────────────────────────────── */
.method-note {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--text-dim);
    line-height: 1.7;
    max-width: 760px;
    margin: 0 auto;
}
.method-note strong { color: var(--text); }
.method-note a { color: var(--text); }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
    .lb-hero-stats { grid-template-columns: repeat(2, 1fr); }
    .lb-risk-legend { flex-wrap: wrap; gap: 0.75rem; }
    .lb-cats { gap: 0.4rem; padding: 0.75rem 1rem; }
    .lb-table { font-size: 0.75rem; }
    .lb-table th, .lb-table td { padding: 0.4rem 0.3rem; }
    .hide-mobile { display: none; }
    .lb-controls { flex-direction: column; }
    .lb-controls input, .lb-controls select {
        border-right: none;
        border-bottom: 1px solid var(--border);
        width: 100%;
        font-size: 1rem;
        min-height: 44px;
    }
    .lb-view-toggle {
        width: 100%;
        justify-content: center;
        border-top: 1px solid var(--border);
    }
    .lb-view-btn { border-left: none; border-right: 1px solid var(--border); flex: 1; padding: 0.5rem; }
    .lb-view-btn:last-child { border-right: none; }
}

@media (max-width: 480px) {
    .lb-hero { padding: 2rem 1rem 1.25rem; }
    .lb-hero-stats { grid-template-columns: repeat(2, 1fr); }
    .lb-stat-n { font-size: 1.3rem; }
    .lb-table { font-size: 0.72rem; }
    .lb-table th, .lb-table td { padding: 0.35rem 0.25rem; }
    .lb-cats { padding: 0.5rem 0.75rem; }
}
