/* =============================================
   KL Leaderboard — Frontend Styles
   Design: Parengcashper dark navy system
   Accent: #3b82f6 (blue)
   ============================================= */

:root {
    --kl-lb-accent:        #3b82f6;
    --kl-lb-accent-dim:    rgba(59, 130, 246, 0.5);
    --kl-lb-accent-glow:   rgba(59, 130, 246, 0.15);
    --kl-lb-accent-border: rgba(59, 130, 246, 0.3);
    --kl-lb-bg:            rgb(15, 33, 46);
    --kl-lb-bg2:           rgb(26, 44, 56);
    --kl-lb-border:        rgba(255, 255, 255, 0.07);
    --kl-lb-border-light:  rgba(255, 255, 255, 0.04);
    --kl-lb-gold:          #f59e0b;
    --kl-lb-silver:        #94a3b8;
    --kl-lb-bronze:        #cd7c3a;
    --kl-lb-text:          #ffffff;
    --kl-lb-text-muted:    #94a3b8;
    --kl-lb-radius:        10px;
    --kl-lb-transition:    0.3s ease;
}

/* ── Wrapper ─────────────────────────────── */
.kl-lb-wrap {
    color: var(--kl-lb-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
}

/* ============================================
   TOGGLE
   ============================================ */
.kl-lb-toggle {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--kl-lb-bg);
    border: 1px solid var(--kl-lb-border);
    border-radius: 999px;
    padding: 4px;
    max-width: 380px;
    width: 100%;
    margin: 0 auto 32px;
}

.kl-lb-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: var(--kl-lb-accent);
    border-radius: 999px;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 14px var(--kl-lb-accent-glow);
    z-index: 5;
}

.kl-lb-second-active .kl-lb-slider {
    transform: translateX(100%);
}

.kl-lb-tab {
    position: relative;
    z-index: 10;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 14px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.3s ease;
    user-select: none;
    white-space: nowrap;
    border: none;
    background: transparent;
    line-height: 1;
}

.kl-lb-tab.is-active {
    color: #ffffff;
}

.kl-lb-tab svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.kl-lb-tab.is-active svg {
    opacity: 1;
}

/* ============================================
   COUNTDOWN
   ============================================ */
.kl-lb-countdown {
    background: var(--kl-lb-bg2);
    border: 1px solid var(--kl-lb-border);
    border-radius: var(--kl-lb-radius);
    padding: 28px 20px;
    margin-bottom: 20px;
    text-align: center;
    max-width: 920px;
    margin-left: auto;
    margin-right: auto;
}

.kl-lb-cd-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--kl-lb-text-muted);
    margin-bottom: 18px;
}

.kl-lb-cd-line {
    display: block;
    width: 28px;
    height: 1px;
    background: var(--kl-lb-border);
    flex-shrink: 0;
}

.kl-lb-cd-units {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: nowrap;
}

.kl-lb-cd-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.kl-lb-cd-num {
    font-size: clamp(28px, 6vw, 50px);
    font-weight: 900;
    color: #ffffff;
    line-height: 1;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}

.kl-lb-cd-unit label {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--kl-lb-text-muted);
}

.kl-lb-cd-sep {
    font-size: clamp(20px, 4vw, 38px);
    font-weight: 900;
    color: rgba(255, 255, 255, 0.15);
    line-height: 1;
    margin-bottom: 18px;
    flex-shrink: 0;
}

/* ── Final badge ──────────────────────────── */
.kl-lb-final-badge {
    display: flex;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    align-items: center;
    gap: 6px;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid var(--kl-lb-accent-border);
    border-radius: 999px;
    padding: 7px 16px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--kl-lb-accent-dim);
    margin-bottom: 20px;
}

.kl-lb-final-badge svg {
    width: 12px;
    height: 12px;
    stroke: var(--kl-lb-accent-dim);
}

/* ============================================
   PODIUM
   ============================================ */
.kl-lb-podium {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    align-items: end;
    margin-bottom: 16px;
}

.kl-lb-place-2 { order: 1; }
.kl-lb-place-1 { order: 2; }
.kl-lb-place-3 { order: 3; }

.kl-lb-podium-card {
    background: var(--kl-lb-bg2);
    border: 1px solid var(--kl-lb-border);
    border-radius: var(--kl-lb-radius);
    padding: 28px 18px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform var(--kl-lb-transition);
}

.kl-lb-podium-card:hover {
    transform: translateY(-4px);
}

.kl-lb-place-first {
    border-color: rgba(245, 158, 11, 0.3);
    background: linear-gradient(180deg, rgba(245,158,11,0.05) 0%, var(--kl-lb-bg2) 60%);
    padding-top: 36px;
    padding-bottom: 36px;
}

/* Top accent lines */
.kl-lb-place-1::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--kl-lb-gold), transparent);
}
.kl-lb-place-2::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--kl-lb-silver), transparent);
}
.kl-lb-place-3::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--kl-lb-bronze), transparent);
}

.kl-lb-place-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.25);
    margin-bottom: 16px;
}

.kl-lb-place-1 .kl-lb-place-badge {
    color: var(--kl-lb-gold);
    letter-spacing: 0.25em;
    margin-bottom: 24px;
}
.kl-lb-place-2 .kl-lb-place-badge { color: var(--kl-lb-silver); }
.kl-lb-place-3 .kl-lb-place-badge { color: var(--kl-lb-bronze); }

.kl-lb-rank-icon { width: 11px; height: 11px; }
.kl-lb-place-1 .kl-lb-rank-icon { fill: var(--kl-lb-gold); }
.kl-lb-place-2 .kl-lb-rank-icon { stroke: var(--kl-lb-silver); }
.kl-lb-place-3 .kl-lb-rank-icon { stroke: var(--kl-lb-bronze); }

/* ── Avatar ──────────────────────────────── */
.kl-lb-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 900;
    margin: 0 auto 14px;
    border: 2px solid var(--kl-lb-border);
    background: var(--kl-lb-bg);
    color: rgba(255, 255, 255, 0.4);
}

.kl-lb-avatar-1 {
    width: 76px;
    height: 76px;
    border-color: var(--kl-lb-gold);
    color: var(--kl-lb-gold);
    box-shadow: 0 0 22px rgba(245,158,11,0.2);
    font-size: 26px;
}
.kl-lb-avatar-2 { border-color: var(--kl-lb-silver); color: var(--kl-lb-silver); }
.kl-lb-avatar-3 { border-color: var(--kl-lb-bronze); color: var(--kl-lb-bronze); }

.kl-lb-player-name {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 5px;
    word-break: break-all;
}

.kl-lb-place-first .kl-lb-player-name {
    font-size: 17px;
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.01em;
}

.kl-lb-wager-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.25);
    margin-bottom: 10px;
}

.kl-lb-prize-amount {
    font-size: 22px;
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1;
}

.kl-lb-place-first .kl-lb-prize-amount {
    font-size: 30px;
    color: var(--kl-lb-gold);
}

.kl-lb-prize-currency {
    font-size: 8px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-top: 5px;
}

.kl-lb-place-first .kl-lb-prize-currency {
    color: rgba(245, 158, 11, 0.4);
}

/* ============================================
   TABLE (ranks 4–5)
   ============================================ */
.kl-lb-table-wrap {
    border-radius: var(--kl-lb-radius);
    overflow: hidden;
    background: var(--kl-lb-bg2);
    border: 1px solid var(--kl-lb-border);
    margin-bottom: 20px;
}

.kl-lb-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 !important;
}

.kl-lb-table thead tr {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--kl-lb-border);
}

.kl-lb-table th,
.kl-lb-table td {
    border: none !important;
}

.kl-lb-table th {
    padding: 16px 24px;
    text-align: left;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--kl-lb-text-muted);
}

.kl-lb-table th:last-child,
.kl-lb-table td:last-child {
    text-align: right;
}

.kl-lb-table tbody tr {
    border-top: 1px solid var(--kl-lb-border-light) !important;
    transition: background var(--kl-lb-transition);
}

.kl-lb-table tbody tr:last-child { border-bottom: none; }
.kl-lb-table tbody tr:hover td { background: rgba(255,255,255,0.01); }

.kl-lb-table td {
    padding: 22px 24px;
    color: var(--kl-lb-text);
    font-size: 15px;
}

.kl-lb-td-rank {
    font-size: 14px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.3);
    width: 72px;
    text-align: center !important;
    border-right: 1px solid var(--kl-lb-border) !important;
}

.kl-lb-td-player {
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.kl-lb-avatar-sm {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--kl-lb-bg);
    border: 1px solid var(--kl-lb-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

.kl-lb-td-wager {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.45);
    font-size: 14px;
}

.kl-lb-td-prize {
    font-weight: 900;
    color: #fff;
    font-size: 20px;
    letter-spacing: -0.02em;
}

/* ============================================
   FOOTER
   ============================================ */
.kl-lb-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 4px;
}

.kl-lb-join-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    background: var(--kl-lb-accent);
    color: #ffffff;
    padding: 14px 28px;
    border-radius: var(--kl-lb-radius);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    transition: transform var(--kl-lb-transition), background var(--kl-lb-transition), box-shadow var(--kl-lb-transition);
    border: none;
    box-shadow: 0 8px 20px rgba(59,130,246,0.25);
}

.kl-lb-join-btn:hover {
    transform: translateY(-2px);
    background: #2563eb;
    box-shadow: 0 12px 28px rgba(59,130,246,0.35);
    text-decoration: none;
    color: #fff;
}

.kl-lb-join-btn svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.kl-lb-updated {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.2);
}

.kl-lb-updated svg {
    width: 11px;
    height: 11px;
    stroke: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

/* ── Empty / Loading ─────────────────────── */
.kl-lb-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--kl-lb-text-muted);
    font-size: 14px;
    background: var(--kl-lb-bg2);
    border: 1px solid var(--kl-lb-border);
    border-radius: var(--kl-lb-radius);
    margin-bottom: 20px;
}

.kl-lb-inner {
    position: relative;
    transition: opacity 0.15s ease;
}

.kl-lb-inner.kl-lb-loading {
    opacity: 0.3;
    pointer-events: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media ( max-width: 640px ) {
    .kl-lb-toggle { max-width: 100%; }

    .kl-lb-tab { font-size: 11px; padding: 10px 8px; gap: 5px; }
    .kl-lb-tab svg { width: 12px; height: 12px; }

    .kl-lb-countdown { padding: 18px 12px; }
    .kl-lb-cd-header { font-size: 9px; gap: 8px; margin-bottom: 12px; }
    .kl-lb-cd-units { gap: 8px; }
    .kl-lb-cd-num { font-size: clamp(20px, 6.5vw, 28px); }
    .kl-lb-cd-sep { font-size: clamp(14px, 3.5vw, 20px); margin-bottom: 14px; }

    .kl-lb-podium {
        grid-template-columns: 1fr;
        gap: 10px;
        align-items: stretch;
    }
    .kl-lb-place-1 { order: 1; }
    .kl-lb-place-2 { order: 2; }
    .kl-lb-place-3 { order: 3; }
    .kl-lb-place-first { padding-top: 28px; padding-bottom: 28px; }
    .kl-lb-prize-amount { font-size: 20px; }
    .kl-lb-place-first .kl-lb-prize-amount { font-size: 26px; }

    .kl-lb-table th { padding: 12px 14px; font-size: 9px; }
    .kl-lb-table td { padding: 14px 14px; font-size: 13px; }
    .kl-lb-td-rank { width: 42px; font-size: 11px; }
    .kl-lb-td-prize { font-size: 15px; }
    .kl-lb-td-wager { font-size: 12px; }
    .kl-lb-avatar-sm { width: 28px; height: 28px; font-size: 10px; }
    .kl-lb-td-player { gap: 8px; font-size: 13px; }

    .kl-lb-footer { flex-direction: column; align-items: flex-start; }
    .kl-lb-join-btn { font-size: 11px; padding: 12px 20px; }
}
