/* --------------------------------------------------------------------------
   Statistics page
   --------------------------------------------------------------------------
   Loaded after _base.css, which brings the header, the page shell and the
   shared .rules-hero / .rule-section helpers used by the card below.
   -------------------------------------------------------------------------- */

.stats-gate,
.stats-body {
    margin-top: 1.5rem;
}

.stats-gate {
    padding: 1.75rem 1.5rem;
    /* The global call to action sits against the right edge, where a player
       would look for their own place on the board. */
    text-align: right;

    background-image: linear-gradient(135deg, rgba(0, 119, 181, 0.08), rgba(214, 43, 47, 0.07));
    border: 1px solid rgba(0, 119, 181, 0.16);
    border-radius: 20px;
}

.stats-gate h2 {
    margin: 0 0 0.6rem;
    font-size: clamp(1.15rem, 2.6vw, 1.5rem);
    color: var(--dark-gray);
}

.stats-gate p {
    max-width: 46ch;
    margin: 0 0 1.25rem auto;
    color: #555;
    line-height: 1.6;
}

.stats-signin {
    padding: 0.75rem 1.75rem;
    border: none;
    border-radius: 999px;
    background-image: linear-gradient(90deg, var(--linkedin-color), var(--interpol-color));
    color: #fff;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.stats-signin:hover {
    filter: brightness(1.06);
}

.stats-status {
    margin: 1.5rem 0 0;
    color: #777;
}

.stats-status.is-error {
    color: #c0392b;
}

.stats-status[hidden] {
    display: none;
}

.stats-h {
    margin: 2rem 0 0.9rem;
    font-size: clamp(1.05rem, 2.4vw, 1.3rem);
    color: var(--dark-gray);
}

/* ---- your own numbers --------------------------------------------------- */

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
    gap: 0.75rem;
}

.stats-card {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.9rem 1rem;

    background-color: #fff;
    border: 1px solid rgba(51, 51, 51, 0.08);
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.04);
}

.stats-card__label {
    color: #6b7280;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

.stats-card__value {
    color: var(--dark-gray);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.stats-card__rank {
    color: var(--linkedin-color);
    font-size: 0.78rem;
    font-weight: 600;
}

/* ---- leaderboard -------------------------------------------------------- */

.stats-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.stats-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.45rem 0.9rem;
    border: 1px solid rgba(51, 51, 51, 0.14);
    border-radius: 999px;
    background-color: #fff;
    color: var(--dark-gray);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.stats-tab:hover {
    color: var(--linkedin-color);
    border-color: rgba(0, 119, 181, 0.35);
}

.stats-tab[aria-selected="true"] {
    border-color: transparent;
    background-image: linear-gradient(90deg, var(--linkedin-color), var(--interpol-color));
    color: #fff;
}

.stats-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(51, 51, 51, 0.08);
    border-radius: 14px;
    background-color: #fff;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 22rem;
}

.stats-table th,
.stats-table td {
    padding: 0.65rem 0.9rem;
    text-align: left;
}

.stats-table thead th {
    color: #6b7280;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(51, 51, 51, 0.08);
}

.stats-table tbody tr + tr td {
    border-top: 1px solid rgba(51, 51, 51, 0.06);
}

.stats-table td:nth-child(1) {
    width: 3.5rem;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}

.stats-table td:nth-child(3) {
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stats-table thead th:nth-child(3) {
    text-align: right;
}

.stats-row--top td:nth-child(1) {
    color: var(--linkedin-color);
    font-weight: 700;
}

/* the signed-in player's own line, wherever they are on the board */
.stats-row--you {
    background-color: rgba(0, 119, 181, 0.08);
}

.stats-row--you td {
    font-weight: 600;
}

.stats-you-badge {
    margin-left: 0.45rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background-color: var(--linkedin-color);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    vertical-align: middle;
}

.stats-empty,
.stats-note {
    margin: 1rem 0 0;
    color: #777;
    font-size: 0.9rem;
    line-height: 1.6;
}

.stats-note {
    color: #8a919c;
    font-size: 0.82rem;
}

.stats-empty[hidden] {
    display: none;
}

@media (max-width: 560px) {
    .stats-card__value {
        font-size: 1.3rem;
    }

    .stats-tab {
        font-size: 0.8rem;
    }

    /* One column: a right-aligned block on a phone reads as a mistake. */
    .stats-gate {
        text-align: left;
    }

    .stats-gate p {
        margin-right: 0;
    }
}

/* ---- the two halves ----------------------------------------------------
   Personal statistics first, then the global ones, separated by a rule so
   the page reads as two sections rather than one long list. */

.stats-section {
    margin-top: 2.25rem;
}

.stats-section + .stats-section {
    margin-top: 2.75rem;
    padding-top: 2.25rem;
    border-top: 1px solid rgba(51, 51, 51, 0.1);
}

.stats-section > .stats-h:first-child {
    margin-top: 0;
}

.stats-lead {
    max-width: 66ch;
    margin: 0 0 1.25rem;
    color: #666;
    line-height: 1.6;
}

/* ---- what a visitor without an account sees ---------------------------- */

.stats-limited[hidden] {
    display: none;
}

.stats-card--locked {
    background-color: #fbfcfe;
    border-style: dashed;
    border-color: rgba(51, 51, 51, 0.16);
    box-shadow: none;
}

.stats-card--locked .stats-card__value {
    display: flex;
    align-items: center;
    color: #b9bfcc;
}

.stats-lock {
    width: 24px;
    height: 24px;
}

.stats-card__lock {
    margin-top: auto;
    color: var(--linkedin-color);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.stats-cta {
    margin-top: 1.25rem;
    padding: 1.5rem;
    border: 1px solid rgba(0, 119, 181, 0.16);
    border-radius: 18px;
    background-image: linear-gradient(135deg, rgba(0, 119, 181, 0.08), rgba(214, 43, 47, 0.07));
    /* The personal call to action sits against the left edge, opposite the
       global one at the foot of the page. */
    text-align: left;
}

.stats-cta__title {
    margin: 0 0 0.5rem;
    font-size: clamp(1.05rem, 2.4vw, 1.3rem);
    color: var(--dark-gray);
}

.stats-cta__lead {
    max-width: 48ch;
    margin: 0 0 1.15rem;
    color: #555;
    line-height: 1.6;
}

