/* ============================================================================
   Leaderboard - shared styles for the live competition panel rendered by
   leaderboard-client.js (LeaderboardClient). One unified light design across
   all demos; the markup is injected by LeaderboardClient.mount().

   Selectors mirror the markup the client emits: .leaderboard-panel wraps a
   .panel-title, a .leaderboard-status (with a .status-indicator dot), and a
   .leaderboard-content holding .your-position and the .leaderboard-list of
   .leaderboard-entry rows (.leaderboard-rank / -user / -scores), plus the
   .empty-leaderboard and .leaderboard-separator states.
   ============================================================================ */

.leaderboard-panel {
    width: 100%;
    max-width: calc(600px * var(--z));
    margin: calc(20px * var(--z)) auto;
    padding: calc(20px * var(--z)) calc(24px * var(--z));
    background: var(--paper);
    border: calc(1px * var(--z)) solid var(--hairline-2);
    box-sizing: border-box;
    font-size: var(--step--1);
    color: var(--ink);
}

/* Scoped so it does not collide with .panel-title used by other demo panels. */
.leaderboard-panel .panel-title {
    font-size: var(--step-0);
    font-weight: 600;
    color: var(--ink);
    margin-bottom: calc(14px * var(--z));
    text-align: center;
}

.leaderboard-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: calc(8px * var(--z));
    font-size: var(--step--1);
    color: var(--muted);
    margin-bottom: calc(16px * var(--z));
}

.status-indicator {
    width: calc(10px * var(--z));
    height: calc(10px * var(--z));
    border-radius: 50%;
    background: var(--hairline);
    display: inline-block;
    flex-shrink: 0;
}

.status-indicator.connected {
    background: var(--success);
}

.status-indicator.connecting {
    background: var(--warning);
    animation: leaderboard-pulse 1.2s ease-in-out infinite;
}

.status-indicator.disconnected {
    background: var(--error);
}

@keyframes leaderboard-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.leaderboard-content {
    display: block;
}

.your-position {
    background: var(--surface);
    border: calc(1px * var(--z)) solid var(--hairline);
    padding: calc(10px * var(--z)) calc(14px * var(--z));
    margin-bottom: calc(14px * var(--z));
    font-size: var(--step--1);
    color: var(--imperial);
    display: none;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: calc(6px * var(--z));
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    gap: calc(12px * var(--z));
    padding: calc(8px * var(--z)) calc(12px * var(--z));
    background: var(--surface);
    border: calc(1px * var(--z)) solid var(--hairline-2);
}

.leaderboard-entry.highlight {
    background: var(--surface);
    border-color: var(--imperial);
    font-weight: 600;
}

.leaderboard-rank {
    flex: 0 0 auto;
    min-width: calc(36px * var(--z));
    font-weight: 700;
    color: var(--imperial);
}

.leaderboard-user {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-scores {
    flex: 0 0 auto;
    color: var(--muted);
    text-align: right;
}

.empty-leaderboard {
    text-align: center;
    color: var(--muted);
    font-style: normal;
    padding: calc(16px * var(--z)) 0;
}

.leaderboard-separator {
    text-align: center;
    color: var(--muted);
    letter-spacing: calc(2px * var(--z));
    padding: calc(2px * var(--z)) 0;
}

/* The "keep this tab active" line in a Compete tab. */
.compete-warning {
    color: var(--error);
    font-weight: bold;
}
