/**
 * QuizMind - Gamification, Ranks, Leaderboard & Achievements Stylesheet
 * High-Contrast Light Theme Aesthetic matching QuizMind Design System v2.0
 */

/* 1. Header XP Widget - Unified 40px Capsule Aesthetic */
.header-xp-widget {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px 0 5px;
    background: #ffffff;
    border: 1px solid #e8eaf6;
    border-radius: 999px;
    text-decoration: none;
    color: #0f172a;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 18px -6px rgba(79, 70, 229, 0.12), inset 0 1px 0 #fff;
    box-sizing: border-box;
    line-height: 1;
    flex-shrink: 0;
}
.header-xp-widget:hover {
    background: #ffffff;
    border-color: #6366f1;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -4px rgba(99, 102, 241, 0.25);
}
.header-avatar-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: #0f172a;
    flex-shrink: 0;
    border: 2px solid #cd7f32;
    background: #f8fafc;
    box-sizing: border-box;
}
.header-xp-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
}
.header-rank-badge {
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1;
}
.header-xp-amount {
    font-size: 0.78rem;
    font-weight: 800;
    color: #d97706;
    background: #fffbeb;
    padding: 3px 7px;
    border-radius: 999px;
    border: 1px solid #fef3c7;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    line-height: 1;
    white-space: nowrap;
}

@media (max-width: 1420px) {
    .header-xp-widget {
        padding: 0 10px 0 5px;
        gap: 6px;
    }
    .header-rank-badge {
        font-size: 0.72rem;
    }
}
@media (max-width: 1320px) {
    .header-rank-badge {
        display: none;
    }
    .header-xp-widget {
        padding: 0 8px 0 5px;
    }
}
@media (max-width: 1200px) {
    .header-xp-widget {
        height: 36px;
        padding: 0 8px 0 4px;
        gap: 5px;
    }
    .header-avatar-circle {
        width: 26px;
        height: 26px;
    }
    .header-rank-badge {
        display: none;
    }
}
@media (max-width: 480px) {
    .header-xp-amount {
        font-size: 0.72rem;
        padding: 2px 5px;
    }
}

/* 2. Rank Colors & Borders */
.rank-bronze { border-color: #cd7f32 !important; color: #b45309; }
.rank-silver { border-color: #0284c7 !important; color: #0284c7; }
.rank-gold { border-color: #d97706 !important; color: #d97706; }
.rank-platinum { border-color: #059669 !important; color: #059669; }
.rank-master {
    border-color: #9333ea !important;
    color: #9333ea;
    box-shadow: 0 0 12px rgba(147, 51, 234, 0.3) !important;
}

/* 3. Dopamine Hit Celebration Banner on Results Page */
.dopamine-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid #818cf8;
    border-radius: 20px;
    padding: 1.5rem 1.8rem;
    margin-bottom: 2rem;
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.12);
    position: relative;
    overflow: hidden;
    animation: dopaminePop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes dopaminePop {
    0% { opacity: 0; transform: scale(0.97) translateY(8px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
.dopamine-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.dopamine-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.dopamine-xp-counter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.dopamine-xp-spark {
    font-size: 1.8rem;
    animation: pulseSpark 1.5s infinite ease-in-out;
}
@keyframes pulseSpark {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2) rotate(8deg); }
}
.dopamine-xp-number {
    font-size: 2.2rem;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(135deg, #d97706, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}
.dopamine-title {
    font-weight: 800;
    font-size: 1.15rem;
    color: #0f172a;
    margin: 0;
}
.dopamine-subtitle {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 0.2rem;
}
.dopamine-breakdown-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.dopamine-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #334155;
}
.dopamine-tag.streak {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #c2410c;
}
.dopamine-tag.perfect {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #15803d;
}
.dopamine-progress-wrap {
    background: #f8fafc;
    border-radius: 12px;
    padding: 0.85rem 1.15rem;
    border: 1px solid #e2e8f0;
}
.dopamine-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 0.4rem;
}
.dopamine-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}
.dopamine-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
    border-radius: 99px;
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 4. Rank Up Notification Banner */
.rankup-modal-alert {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1.5px solid #f59e0b;
    border-radius: 14px;
    padding: 0.85rem 1.25rem;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #92400e;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.2);
}

/* 5. Profile Page Layout */
.profile-hero-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 2.2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}
.profile-hero-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.8rem;
}
.profile-avatar-wrap {
    position: relative;
    cursor: pointer;
}
.profile-avatar-large {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    background: #f8fafc;
    border: 3.5px solid #cd7f32;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}
.profile-avatar-large:hover {
    transform: scale(1.05);
}
.profile-avatar-edit-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    background: #4f46e5;
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.profile-details {
    flex: 1;
    min-width: 240px;
}
.profile-nickname-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.profile-nickname {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.2;
    color: #0f172a;
}
.profile-edit-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #64748b;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
}
.profile-edit-btn:hover {
    color: #0f172a;
    background: #e2e8f0;
}
.profile-rank-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    border-radius: 99px;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    margin-bottom: 0.75rem;
}

/* Stats Metric Cards */
.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.profile-stat-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s, border-color 0.2s;
}
.profile-stat-box:hover {
    transform: translateY(-2px);
    border-color: #6366f1;
}
.profile-stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 0.35rem;
}
.profile-stat-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: #0f172a;
    line-height: 1;
}

/* 6. Achievements Grid */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.2rem;
}
.achievement-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 1.4rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}
.achievement-card.unlocked {
    background: linear-gradient(135deg, #ffffff 0%, #f5f3ff 100%);
    border-color: #c7d2fe;
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.1);
}
.achievement-card.locked {
    background: #f8fafc;
    opacity: 0.65;
}
.achievement-card.locked:hover {
    opacity: 0.85;
}
.achievement-icon-box {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #64748b;
    flex-shrink: 0;
}
.achievement-card.unlocked .achievement-icon-box {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}
.achievement-body {
    flex: 1;
}
.achievement-title {
    font-size: 0.98rem;
    font-weight: 800;
    margin: 0 0 0.2rem 0;
    color: #0f172a;
}
.achievement-desc {
    font-size: 0.82rem;
    color: #64748b;
    margin: 0 0 0.45rem 0;
    line-height: 1.35;
}
.achievement-reward {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.78rem;
    font-weight: 800;
    color: #d97706;
}

/* 7. Leaderboard Page Styles */
.leaderboard-nav-tabs {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 2rem;
}
.leaderboard-tab-btn {
    padding: 0.7rem 1.6rem;
    border-radius: 99px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-weight: 700;
    font-size: 0.92rem;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}
.leaderboard-tab-btn:hover {
    color: #0f172a;
    background: #f8fafc;
}
.leaderboard-tab-btn.active {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

/* Podium top 3 */
.podium-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
    align-items: flex-end;
    margin-bottom: 2.5rem;
}
@media (max-width: 640px) {
    .podium-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    .podium-card.place-1 {
        order: 1 !important;
        margin-top: 10px;
    }
    .podium-card.place-2 {
        order: 2 !important;
    }
    .podium-card.place-3 {
        order: 3 !important;
    }
}
.podium-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 1.6rem 1rem;
    text-align: center;
    position: relative;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
}
.podium-card:hover {
    transform: translateY(-4px);
}
.podium-card.place-1 {
    order: 2;
    padding-top: 2.2rem;
    padding-bottom: 2.2rem;
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
    border: 2px solid #f59e0b;
    box-shadow: 0 14px 35px rgba(245, 158, 11, 0.18);
}
.podium-card.place-2 {
    order: 1;
    background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 100%);
    border: 1.5px solid #38bdf8;
    box-shadow: 0 8px 20px rgba(56, 189, 248, 0.12);
}
.podium-card.place-3 {
    order: 3;
    background: linear-gradient(180deg, #fff7ed 0%, #ffffff 100%);
    border: 1.5px solid #fdba74;
    box-shadow: 0 8px 20px rgba(249, 115, 22, 0.1);
}
.podium-crown {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.4));
    animation: crownFloat 2s infinite ease-in-out;
}
@keyframes crownFloat {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-5px); }
}
.podium-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 0.75rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    background: #f8fafc;
    border: 3px solid #f59e0b;
}
.podium-name {
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.podium-xp {
    font-size: 1.3rem;
    font-weight: 900;
    color: #d97706;
}

/* Leaderboard Table */
.leaderboard-table-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}
.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 0.95rem 1.4rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
    font-size: 0.92rem;
    color: #0f172a;
}
.leaderboard-row:hover {
    background: #f8fafc;
}
.leaderboard-row.is-current-user {
    background: #eef2ff;
    border-color: #c7d2fe;
    font-weight: 700;
}
.lb-pos {
    width: 44px;
    font-weight: 900;
    font-size: 1rem;
    color: #64748b;
}
.lb-player {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}
.lb-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    background: #f8fafc;
    border: 2px solid #cd7f32;
    flex-shrink: 0;
}
.lb-nick {
    font-weight: 700;
    color: #0f172a;
}
.lb-streak {
    margin-right: 1.5rem;
    font-size: 0.84rem;
    color: #c2410c;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.lb-xp {
    font-weight: 900;
    font-size: 1.05rem;
    color: #d97706;
    text-align: right;
    min-width: 80px;
}

/* Modal for Avatar selection */
.avatar-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.avatar-modal-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 2rem;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    text-align: center;
    color: #0f172a;
}
.avatar-choices-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}
.avatar-choice-item {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    cursor: pointer;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    transition: all 0.2s ease;
    margin: 0 auto;
}
.avatar-choice-item:hover, .avatar-choice-item.selected {
    transform: scale(1.15);
    border-color: #4f46e5;
    box-shadow: 0 0 14px rgba(79, 70, 229, 0.3);
}

/* 11. Home Page Leaderboard Showcase - Premium Animated Edition */
.section-home-leaderboard {
    position: relative;
    padding: 4.5rem 0;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0) 0%, rgba(241, 245, 249, 0.65) 100%);
    overflow: hidden;
}

/* Ambient Breathing Glow */
.lb-ambient-glow {
    position: absolute;
    top: 5%;
    left: 15%;
    width: 70%;
    height: 80%;
    background: radial-gradient(circle at 35% 45%, rgba(245, 158, 11, 0.1) 0%, rgba(99, 102, 241, 0.06) 45%, transparent 70%);
    filter: blur(80px);
    pointer-events: none;
    z-index: 1;
    animation: lbGlowBreath 8s ease-in-out infinite alternate;
}
@keyframes lbGlowBreath {
    0% { transform: scale(0.95) translate(-10px, 0); opacity: 0.6; }
    100% { transform: scale(1.08) translate(15px, 10px); opacity: 1; }
}

/* Fixed Elegant Eyebrow Pill */
.home-leaderboard-pill-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}
.home-leaderboard-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 18px;
    background: #ffffff;
    border: 1px solid #fde68a;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    color: #b45309;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 4px 16px -2px rgba(245, 158, 11, 0.15), inset 0 1px 0 #fff;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    line-height: 1;
}
.home-leaderboard-pill:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: #f59e0b;
    box-shadow: 0 6px 20px -2px rgba(245, 158, 11, 0.25);
}
.trophy-bounce-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    animation: trophyBounce 3s ease-in-out infinite;
}
@keyframes trophyBounce {
    0%, 100% { transform: translateY(0); }
    15% { transform: translateY(-4px) rotate(-6deg); }
    30% { transform: translateY(0) rotate(4deg); }
    45% { transform: translateY(-2px) rotate(0); }
}

.pill-sparkle-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
    display: inline-block;
    animation: sparklePulse 2s ease-in-out infinite;
}
@keyframes sparklePulse {
    0%, 100% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.4); opacity: 1; }
}

.home-lb-title {
    font-size: 2.1rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: #0f172a;
    margin-bottom: 0.5rem;
}
.home-lb-subtitle {
    max-width: 620px;
    margin: 0 auto;
    font-size: 1rem;
    color: #475569;
    line-height: 1.55;
}

/* Grid Layout */
.home-leaderboard-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 2.2rem;
    align-items: stretch;
    margin-top: 2.5rem;
}

/* Cards */
.home-leaderboard-card,
.home-leaderboard-rules-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 2rem 2.2rem;
    box-shadow: 0 12px 36px -6px rgba(15, 23, 42, 0.06), inset 0 1px 0 #fff;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}
.home-leaderboard-card:hover,
.home-leaderboard-rules-card:hover {
    box-shadow: 0 16px 44px -8px rgba(79, 70, 229, 0.12), inset 0 1px 0 #fff;
}

/* Card Header */
.home-leaderboard-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 1.25rem;
}
.trophy-header-icon-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    color: #d97706;
    border: 1px solid #fde68a;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

/* Live Radar Badge */
.home-leaderboard-live-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    overflow: hidden;
}
.live-pulse-ring {
    position: absolute;
    width: 10px;
    height: 10px;
    left: 10px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.4);
    animation: liveRingWave 2s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}
@keyframes liveRingWave {
    0% { transform: scale(1); opacity: 0.9; }
    100% { transform: scale(3.5); opacity: 0; }
}

/* Player Rows */
.home-leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}
.home-player-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0.8rem 1.15rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    animation: rowSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(var(--row-idx, 0) * 0.08s);
}
@keyframes rowSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.home-player-row:hover {
    background: #ffffff;
    border-color: #6366f1;
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 8px 24px -4px rgba(99, 102, 241, 0.14);
}

/* Special treatment for #1 Champion */
.home-player-row.top-three.rank-pos-1 {
    background: linear-gradient(135deg, #ffffff 0%, #fffdfa 100%);
    border-color: #fde68a;
    box-shadow: 0 4px 16px -2px rgba(245, 158, 11, 0.12);
}
.home-player-row.top-three.rank-pos-1:hover {
    border-color: #f59e0b;
    box-shadow: 0 10px 28px -4px rgba(245, 158, 11, 0.25);
}

.home-player-pos {
    width: 30px;
    font-weight: 800;
    text-align: center;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.home-player-medal {
    font-size: 1.35rem;
    line-height: 1;
    display: inline-block;
    transition: transform 0.2s ease;
}
.home-player-row:hover .home-player-medal {
    transform: scale(1.2) rotate(6deg);
}

/* Floating animation on medals */
.medal-anim-1 { animation: medalFloat 2.6s ease-in-out infinite; }
.medal-anim-2 { animation: medalFloat 2.9s ease-in-out 0.4s infinite; }
.medal-anim-3 { animation: medalFloat 3.2s ease-in-out 0.8s infinite; }

@keyframes medalFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px) rotate(4deg); }
}

.home-player-rank-num {
    color: #64748b;
    font-size: 0.88rem;
    font-weight: 800;
}

.home-player-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}
.home-player-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 2px solid #cd7f32;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.home-player-row:hover .home-player-avatar {
    transform: scale(1.1);
}

.home-player-crown {
    position: absolute;
    top: -8px;
    right: -5px;
    font-size: 0.95rem;
    filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.4));
    animation: crownGleam 2.8s ease-in-out infinite;
}
@keyframes crownGleam {
    0%, 100% { transform: translateY(0) rotate(-6deg); }
    50% { transform: translateY(-3px) rotate(6deg) scale(1.15); }
}

.home-player-info {
    flex: 1;
    min-width: 0;
}
.home-player-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.home-player-nick {
    font-weight: 750;
    color: #0f172a;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.home-player-rank-tag {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 6px;
    border: 1px solid;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}
.home-player-sub {
    margin-top: 2px;
}
.home-player-streak-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.74rem;
    font-weight: 750;
    color: #c2410c;
    background: #fff7ed;
    border: 1px solid #ffedd5;
    padding: 1px 7px;
    border-radius: 999px;
}
.flame-pulse-icon {
    display: inline-block;
    animation: flamePulse 1.8s ease-in-out infinite;
}
@keyframes flamePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.22) rotate(-4deg); }
}

/* XP Chip */
.home-player-xp {
    flex-shrink: 0;
}
.home-player-xp-val {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.92rem;
    font-weight: 850;
    color: #d97706;
    background: #fffbeb;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid #fef3c7;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(245, 158, 11, 0.08);
    transition: all 0.2s ease;
}
.home-player-row:hover .home-player-xp-val {
    background: #fef3c7;
    border-color: #fde68a;
    transform: scale(1.05);
}
.xp-bolt-glow {
    animation: boltPulse 2s ease-in-out infinite;
    display: inline-block;
}
@keyframes boltPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 1px #d97706); }
    50% { transform: scale(1.25); filter: drop-shadow(0 0 4px #f59e0b); }
}

/* Shimmer Button */
.btn-shimmer {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-shimmer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -120%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.15), transparent);
    transform: skewX(-25deg);
    animation: btnShimmerSweep 5s infinite;
}
@keyframes btnShimmerSweep {
    0%, 70% { left: -120%; }
    100% { left: 220%; }
}

/* Right Rules Card */
.rules-card-badge {
    margin-bottom: 0.85rem;
}
.rules-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.74rem;
    font-weight: 800;
    color: #4338ca;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    padding: 4px 12px;
    border-radius: 999px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.rules-card-title {
    font-size: 1.45rem;
    font-weight: 850;
    color: #0f172a;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.02em;
}
.rules-card-desc {
    color: #475569;
    font-size: 0.90rem;
    margin: 0 0 1.4rem 0;
    line-height: 1.55;
}
.rules-xp-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    flex: 1;
}
.rules-xp-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.rules-xp-item:hover {
    background: #ffffff;
    border-color: #6366f1;
    transform: translateX(5px) scale(1.01);
    box-shadow: 0 6px 18px -3px rgba(99, 102, 241, 0.1);
}

.rules-xp-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 850;
    font-size: 0.92rem;
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.rules-xp-item:hover .rules-xp-icon {
    transform: scale(1.14) rotate(-4deg);
}
.icon-xp-10 { background: #eef2ff; color: #4f46e5; border: 1px solid #e0e7ff; }
.icon-xp-2  { background: #ecfdf5; color: #059669; border: 1px solid #d1fae5; }
.icon-xp-50 { background: #fdf4ff; color: #9333ea; border: 1px solid #fae8ff; }
.icon-xp-streak { background: #fff7ed; color: #ea580c; border: 1px solid #ffedd5; }

.rules-xp-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.rules-xp-content strong {
    font-size: 0.88rem;
    color: #0f172a;
    font-weight: 750;
}
.rules-xp-content span {
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.4;
}

.rules-cta-wrap {
    margin-top: 1.6rem;
}
.btn-glow-pulse {
    position: relative;
    box-shadow: 0 4px 18px rgba(99, 102, 241, 0.35);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-glow-pulse:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 26px rgba(99, 102, 241, 0.55);
}

/* Tournament Info Notice Banner */
.tournament-notice-banner {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.95rem 1.25rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.88rem;
    color: #334155;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}
.tournament-notice-link {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
    margin-left: 1rem;
    transition: color 0.2s;
}
.tournament-notice-link:hover {
    color: #4338ca;
    text-decoration: underline;
}

@media (max-width: 992px) {
    .home-leaderboard-grid {
        grid-template-columns: 1fr;
        gap: 1.8rem;
    }
    .home-lb-title {
        font-size: 1.7rem;
    }
}

/* Mobile Polish for Gamification & Tournaments */
@media (max-width: 640px) {
    .tournament-notice-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem;
    }
    .tournament-notice-link {
        margin-left: 0;
    }
    .leaderboard-nav-tabs {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        padding: 4px;
    }
    .leaderboard-tab-btn {
        font-size: 0.78rem;
        padding: 0.6rem 0.4rem;
        text-align: center;
        justify-content: center;
        white-space: nowrap;
    }
    .home-leaderboard-card,
    .home-leaderboard-rules-card {
        padding: 1.25rem 1rem !important;
        border-radius: 18px !important;
    }
    .home-leaderboard-card-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    .home-player-row {
        padding: 0.65rem 0.75rem !important;
        gap: 8px !important;
    }
    .home-player-nick {
        font-size: 0.86rem !important;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .home-player-rank-tag {
        font-size: 0.62rem !important;
        padding: 2px 6px !important;
    }
    .home-player-xp {
        font-size: 0.82rem !important;
    }
    .profile-hero-card {
        padding: 1.25rem 1rem !important;
        border-radius: 18px !important;
    }
    .profile-hero-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
    }
    .profile-nickname-row {
        justify-content: center;
    }
    .profile-nickname {
        font-size: 1.45rem;
    }
    .profile-details {
        min-width: unset;
        width: 100%;
    }
    .profile-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    .profile-stat-box {
        padding: 0.85rem 0.6rem !important;
        border-radius: 14px !important;
    }
    .profile-stat-value {
        font-size: 1.35rem !important;
    }
    .achievements-grid {
        grid-template-columns: 1fr !important;
        gap: 0.85rem !important;
    }
    .achievement-card {
        padding: 0.95rem 1rem !important;
        border-radius: 14px !important;
    }
    .achievement-icon-box {
        width: 44px;
        height: 44px;
        min-width: 44px;
        font-size: 1.3rem;
    }
}
