/* ── Copilot leaderboard module ── */

.slide.is-copilot {
    color: var(--text-bg, #fff);
    background-color: var(--bg-color, var(--bg));
}

.copilot {
    display: flex;
    flex-direction: column;
    gap: 1.5em;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    font-size: 1.8em;
}

/* ── Header ── */
.copilot__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.copilot__header-left {
    display: flex;
    align-items: center;
    gap: 1em;
}

.copilot__icon {
    width: 2.8em;
    height: 2.8em;
    border-radius: 0.75em;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.copilot__icon svg {
    width: 1.4em;
    height: 1.4em;
    opacity: 0.7;
}

.is-dark .copilot__icon {
    background: rgba(0, 0, 0, 0.06);
}

.copilot__title {
    font-size: 2em;
    font-weight: 700;
    margin: 0;
    line-height: 1.1;
}

.copilot__subtitle {
    font-size: 1em;
    opacity: 0.55;
    font-weight: 500;
}

.copilot__sync {
    font-size: 1.6em;
    opacity: 0.5;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    display: inline-flex;
    align-items: baseline;
    gap: 0.35em;
    white-space: nowrap;
}

.copilot__sync-sep {
    font-weight: 300;
    opacity: 0.5;
}

.copilot__sync-now {
    font-weight: 800;
}

/* ── Header stats (right side) ── */
.copilot__stats {
    display: flex;
    gap: 1.6em;
    align-items: center;
}

.copilot__stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.copilot__stat-value {
    font-size: 1.4em;
    font-weight: 800;
}

.copilot__stat-limit {
    opacity: 0.4;
    font-weight: 700;
}

.copilot__stat-label {
    font-size: 0.75em;
    opacity: 0.55;
    font-weight: 500;
    margin-top: 0.15em;
}

/* ── Podium (uses .copilot__card with --podium modifier) ── */
.copilot__card--podium {
    grid-column: span 5;
}

.copilot__card--rank-1 { order: -2; }
.copilot__card--rank-2 { order: -3; }
.copilot__card--rank-3 { order: -1; }

.copilot__card--podium .copilot__card-avatar {
    width: 4.4em;
    height: 4.4em;
}

.copilot__card--podium .copilot__card-name {
    font-size: 1.15em;
}

.copilot__card--podium .copilot__card-usage {
    font-size: 1.9em;
}

.copilot__card--podium .copilot__card-bg-rank {
    font-size: 9em;
}

.copilot__card--podium.copilot__card--rank-1 .copilot__card-avatar {
    width: 5.6em;
    height: 5.6em;
}
.copilot__card--podium.copilot__card--rank-1 .copilot__card-name {
    font-size: 1.45em;
}
.copilot__card--podium.copilot__card--rank-1 .copilot__card-usage {
    font-size: 2.5em;
}
.copilot__card--podium.copilot__card--rank-1 .copilot__card-bg-rank {
    font-size: 12em;
}

/* Podium tier colours — subtle metallic gold / silver / bronze accents on dark base */
.copilot__card--podium.copilot__card--rank-1 {
    --accent: #f1b500;
}
.copilot__card--podium.copilot__card--rank-1::before {
    background: linear-gradient(135deg, rgba(255, 215, 90, 0.45) 0%, rgba(241, 181, 0, 0.18) 35%, transparent 70%);
}

.copilot__card--podium.copilot__card--rank-2 {
    --accent: #cfcfcf;
}
.copilot__card--podium.copilot__card--rank-2::before {
    background: linear-gradient(135deg, rgba(240, 240, 240, 0.4) 0%, rgba(180, 180, 180, 0.16) 35%, transparent 70%);
}

.copilot__card--podium.copilot__card--rank-3 {
    --accent: #c8803e;
}
.copilot__card--podium.copilot__card--rank-3::before {
    background: linear-gradient(135deg, rgba(232, 168, 107, 0.4) 0%, rgba(176, 107, 42, 0.18) 35%, transparent 70%);
}

.copilot__card--rank-1::before,
.copilot__card--rank-2::before,
.copilot__card--rank-3::before {
    /* overridden by .copilot__card--podium.copilot__card--rank-X::before above */
}

/* ── Grid (rest of users) ── */
.copilot__grid {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(var(--rows, 2), 1fr);
    grid-auto-flow: row;
    gap: 0.6em;
    flex: 1;
    overflow: hidden;
}

.copilot__grid > .copilot__card:not(.copilot__card--podium) {
    grid-column: span 3;
}

.copilot__card {
    --accent: #6c63ff;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 1em;
    padding: 0.9em 1.1em 1.4em;
    border-radius: 0.85em;
    background: var(--bg-alt);
    color: var(--text-bg-alt);
    min-width: 0;
    min-height: 0;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    font-size: 1.35em;
}

.copilot__card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%);
    pointer-events: none;
}

.copilot__card--tier-0,
.copilot__card--tier-1,
.copilot__card--tier-2 { --accent: #6c63ff; }

.copilot__card-bg-rank {
    position: absolute;
    right: -0.05em;
    bottom: -0.35em;
    font-size: 7em;
    font-weight: 900;
    line-height: 1;
    color: rgba(255, 255, 255, 0.06);
    pointer-events: none;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.05em;
}

.is-dark .copilot__card-bg-rank {
    color: rgba(0, 0, 0, 0.06);
}

.copilot__card-avatar {
    width: 4em;
    height: 4em;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.15);
    border: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.copilot__card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.copilot__card-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1em;
    position: relative;
    z-index: 1;
}

.copilot__card-rank {
    font-size: 0.75em;
    font-weight: 800;
    opacity: 0.55;
    letter-spacing: 0.04em;
    color: var(--accent);
    line-height: 1;
}

.copilot__card-name {
    font-size: 1.05em;
    font-weight: 700;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.copilot__card-usage {
    font-size: 1.7em;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    margin-top: 0.15em;
}

.copilot__card-requests {
    font-size: 0.78em;
    opacity: 0.55;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.copilot__card-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0.35em;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.copilot__card-bar span {
    display: block;
    height: 100%;
    width: var(--bar, 0%);
    background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, white));
    border-radius: 0 0.2em 0.2em 0;
    transition: width 0.6s ease;
}

.is-dark .copilot__card-bar {
    background: rgba(0, 0, 0, 0.08);
}

/* Podium emphasis: thicker bottom bar + glow for top 3 */
.copilot__card--podium.copilot__card--rank-3 .copilot__card-bar { height: 0.6em; }
.copilot__card--podium.copilot__card--rank-2 .copilot__card-bar { height: 0.9em; }
.copilot__card--podium.copilot__card--rank-1 .copilot__card-bar { height: 1.8em; }

.copilot__card--podium .copilot__card-bar span {
    box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 60%, transparent);
}

/* ── Error / empty state ── */
.copilot__state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1em;
    flex: 1;
    opacity: 0.4;
}

.copilot__state svg {
    width: 3em;
    height: 3em;
}

.copilot__state p {
    font-size: 1.1em;
    font-weight: 400;
}

.copilot__state--error {
    opacity: 0.6;
}

/* ── Dark text variant ── */
.is-dark .copilot__card {
    background: rgba(0, 0, 0, 0.04);
}
