:root {
    --bg: #f4f6fc;
    --card: rgba(255, 255, 255, 0.75);
    --card-hover: rgba(255, 255, 255, 0.92);
    --border: rgba(255, 255, 255, 0.6);
    --border-accent: rgba(130, 94, 246, 0.18);
    --text: #1e1e2e;
    --text-secondary: #5a5a72;
    --muted: #8a8a9e;
    --muted-light: #b0b0c0;
    --primary: #6c5ce7;
    --primary-glow: rgba(108, 92, 231, 0.3);
    --primary-light: rgba(108, 92, 231, 0.08);
    --gold: #f0b90b;
    --gold-glow: rgba(240, 185, 11, 0.4);
    --gold-bg: rgba(240, 185, 11, 0.08);
    --silver: #a0aab4;
    --silver-glow: rgba(160, 170, 180, 0.35);
    --silver-bg: rgba(160, 170, 180, 0.06);
    --bronze: #c8946e;
    --bronze-glow: rgba(200, 148, 110, 0.35);
    --bronze-bg: rgba(200, 148, 110, 0.06);
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --radius-full: 999px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-card: 0 2px 12px rgba(108, 92, 231, 0.04), 0 8px 32px rgba(108, 92, 231, 0.05);
    --shadow-card-hover: 0 4px 20px rgba(108, 92, 231, 0.08), 0 12px 40px rgba(108, 92, 231, 0.07);
    --shadow-stat: 0 2px 8px rgba(108, 92, 231, 0.03), 0 6px 20px rgba(108, 92, 231, 0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; height: 100%; }
body {
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    background: radial-gradient(ellipse at 50% -15%, rgba(108, 92, 231, 0.2), transparent 55%),
                radial-gradient(ellipse at 85% 75%, rgba(108, 92, 231, 0.06), transparent 45%),
                radial-gradient(ellipse at 15% 85%, rgba(160, 170, 180, 0.08), transparent 45%),
                var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#confettiCanvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9999; }

/* Full‑screen preloader */
.preloader-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(244, 246, 252, 0.7); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    display: flex; justify-content: center; align-items: center; z-index: 10000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
.preloader-overlay.fade-out { opacity: 0; visibility: hidden; pointer-events: none; }

.loader { width: 80px; height: 50px; position: relative; }
.loader-text {
    position: absolute; top: 0; padding: 0; margin: 0; color: #a78bfa;
    animation: text_713 3.5s ease both infinite; font-size: 0.8rem; letter-spacing: 1px;
    font-family: 'Inter', sans-serif; font-weight: 600;
}
.load {
    background-color: #6c5ce7; border-radius: 50px; display: block; height: 16px; width: 16px;
    bottom: 0; position: absolute; transform: translateX(64px);
    animation: loading_713 3.5s ease both infinite; box-shadow: 0 4px 14px rgba(108, 92, 231, 0.4);
}
.load::before {
    position: absolute; content: ""; width: 100%; height: 100%;
    background-color: #a78bfa; border-radius: inherit;
    animation: loading2_713 3.5s ease both infinite; box-shadow: 0 2px 8px rgba(167, 139, 250, 0.35);
}

@keyframes text_713 { 0% { letter-spacing: 1px; transform: translateX(0px); } 40% { letter-spacing: 2px; transform: translateX(26px); } 80% { letter-spacing: 1px; transform: translateX(32px); } 90% { letter-spacing: 2px; transform: translateX(0px); } 100% { letter-spacing: 1px; transform: translateX(0px); } }
@keyframes loading_713 { 0% { width: 16px; transform: translateX(0px); } 40% { width: 100%; transform: translateX(0px); } 80% { width: 16px; transform: translateX(64px); } 90% { width: 100%; transform: translateX(0px); } 100% { width: 16px; transform: translateX(0px); } }
@keyframes loading2_713 { 0% { transform: translateX(0px); width: 16px; } 40% { transform: translateX(0%); width: 80%; } 80% { width: 100%; transform: translateX(0px); } 90% { width: 80%; transform: translateX(15px); } 100% { transform: translateX(0px); width: 16px; } }

/* Main app */
.app-wrapper {
    max-width: 800px; width: 100%; flex: 1; display: flex; flex-direction: column; position: relative; z-index: 1;
    opacity: 0; visibility: hidden; transition: opacity 0.4s ease, visibility 0.4s ease;
}
.app-wrapper.visible { opacity: 1; visibility: visible; }
.lb-meta-row .meta-dot,
.lb-email {
    display: none;
}

/* Navigation */
.nav {
    position: sticky; top: 10px; z-index: 50; border-radius: var(--radius-full); padding: 10px 20px;
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px;
    background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.7); box-shadow: 0 2px 12px rgba(108, 92, 231, 0.04);
    transition: all var(--transition);
}
.nav:hover { background: rgba(255, 255, 255, 0.8); box-shadow: 0 4px 20px rgba(108, 92, 231, 0.06); }
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
    width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
    background: linear-gradient(135deg, #6c5ce7, #5a4bd1); color: #fff; font-weight: 900; font-size: 17px;
    box-shadow: 0 8px 20px rgba(108, 92, 231, 0.3); flex-shrink: 0; transition: transform var(--transition);
    animation: logoPulse 3s ease-in-out infinite; letter-spacing: -0.5px;
}
@keyframes logoPulse { 0%, 100% { box-shadow: 0 8px 20px rgba(108, 92, 231, 0.3); } 50% { box-shadow: 0 12px 28px rgba(108, 92, 231, 0.5); } }
.brand-text h1 { font-size: 14px; margin: 0; line-height: 1.2; letter-spacing: -0.2px; font-weight: 800; color: #5a4bd1; }
.brand-text p { margin: 2px 0 0; font-size: 10px; color: var(--muted); letter-spacing: 0.6px; text-transform: uppercase; font-weight: 700; }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
    width: 38px; height: 38px; border-radius: 50%; background: var(--primary-light); border: 1px solid transparent;
    cursor: pointer; display: grid; place-items: center; transition: all var(--transition); color: #6c5ce7; position: relative; flex-shrink: 0;
}
.icon-btn svg { width: 17px; height: 17px; fill: currentColor; }
.icon-btn:hover { background: #6c5ce7; color: #fff; box-shadow: 0 6px 16px var(--primary-glow); transform: translateY(-2px); }
.icon-btn:active { transform: scale(0.94); }

/* Animations */
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { 0% { transform: scale(0.94); opacity: 0; } 60% { transform: scale(1.015); } 100% { transform: scale(1); opacity: 1; } }
@keyframes rankGlowGold { 0%, 100% { box-shadow: 0 0 16px rgba(240, 185, 11, 0.25), 0 0 40px rgba(240, 185, 11, 0.08); } 50% { box-shadow: 0 0 24px rgba(240, 185, 11, 0.4), 0 0 56px rgba(240, 185, 11, 0.14); } }
@keyframes rankGlowSilver { 0%, 100% { box-shadow: 0 0 14px rgba(160, 170, 180, 0.2), 0 0 32px rgba(160, 170, 180, 0.06); } 50% { box-shadow: 0 0 20px rgba(160, 170, 180, 0.35), 0 0 44px rgba(160, 170, 180, 0.1); } }
@keyframes rankGlowBronze { 0%, 100% { box-shadow: 0 0 12px rgba(200, 148, 110, 0.2), 0 0 28px rgba(200, 148, 110, 0.05); } 50% { box-shadow: 0 0 18px rgba(200, 148, 110, 0.32), 0 0 40px rgba(200, 148, 110, 0.09); } }

/* Hero */
.lb-hero { text-align: center; margin-bottom: 22px; }
.lb-hero h2 { font-size: clamp(26px, 5vw, 40px); font-weight: 900; letter-spacing: -0.03em; color: var(--text); margin-bottom: 6px; line-height: 1.15; }
.lb-hero h2 span { background: linear-gradient(135deg, #6c5ce7, #a78bfa); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.lb-subtitle { color: var(--text-secondary); font-size: 14px; font-weight: 600; letter-spacing: -0.1px; }
.lb-updated { font-size: 11px; color: var(--muted-light); font-weight: 500; margin-top: 6px; letter-spacing: 0.2px; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.stat-card {
    background: rgba(255, 255, 255, 0.7); border: 1px solid rgba(255, 255, 255, 0.65); border-radius: var(--radius-md);
    padding: 18px 14px; text-align: center; transition: all var(--transition); box-shadow: var(--shadow-stat);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); border-color: var(--border-accent); }
.stat-icon { margin: 0 auto 8px; width: 26px; height: 26px; color: #6c5ce7; opacity: 0.8; }
.stat-card .stat-value { display: block; font-size: 28px; font-weight: 900; color: var(--text); letter-spacing: -0.03em; margin-bottom: 2px; line-height: 1; }
.stat-card .stat-label { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.7px; }

/* Leaderboard List */
.lb-list { display: flex; flex-direction: column; gap: 10px; }
.lb-row {
    display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.6); border-radius: var(--radius-lg); transition: all var(--transition);
    box-shadow: var(--shadow-card); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    cursor: default; position: relative; overflow: hidden; animation: popIn 0.4s ease both; min-height: 68px;
}
.lb-row:nth-child(1) { animation-delay: 0.04s; } .lb-row:nth-child(2) { animation-delay: 0.08s; } .lb-row:nth-child(3) { animation-delay: 0.12s; } .lb-row:nth-child(4) { animation-delay: 0.16s; } .lb-row:nth-child(5) { animation-delay: 0.20s; } .lb-row:nth-child(6) { animation-delay: 0.24s; } .lb-row:nth-child(7) { animation-delay: 0.28s; } .lb-row:nth-child(8) { animation-delay: 0.32s; } .lb-row:nth-child(9) { animation-delay: 0.36s; } .lb-row:nth-child(10) { animation-delay: 0.40s; }
.lb-row:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); border-color: var(--border-accent); background: var(--card-hover); }

.lb-row.rank-1 { border-color: rgba(240, 185, 11, 0.35); background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 252, 240, 0.8) 100%); animation: rankGlowGold 3.2s ease-in-out infinite, popIn 0.4s ease both; }
.lb-row.rank-2 { border-color: rgba(160, 170, 180, 0.3); background: linear-gradient(135deg, rgba(255, 255, 255, 0.82) 0%, rgba(248, 249, 250, 0.78) 100%); animation: rankGlowSilver 3.6s ease-in-out infinite, popIn 0.4s ease both; }
.lb-row.rank-3 { border-color: rgba(200, 148, 110, 0.28); background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(252, 248, 244, 0.76) 100%); animation: rankGlowBronze 4s ease-in-out infinite, popIn 0.4s ease both; }

.rank-badge {
    flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
    font-weight: 900; font-size: 17px; letter-spacing: -0.02em; position: relative; transition: all var(--transition); color: #fff;
}
.rank-1 .rank-badge { background: linear-gradient(135deg, #f5c518, #e0a800); box-shadow: 0 6px 18px var(--gold-glow); font-size: 19px; }
.rank-1 .rank-badge::after { content: '👑'; position: absolute; top: -14px; font-size: 15px; animation: popIn 0.5s ease 0.3s both; }
.rank-2 .rank-badge { background: linear-gradient(135deg, #c8cdd3, #a0aab4); box-shadow: 0 5px 14px var(--silver-glow); font-size: 18px; }
.rank-3 .rank-badge { background: linear-gradient(135deg, #d4a87c, #b8805a); box-shadow: 0 5px 14px var(--bronze-glow); font-size: 17px; }
.rank-other .rank-badge { background: rgba(108, 92, 231, 0.07); color: var(--text-secondary); font-size: 15px; border: 2px solid rgba(108, 92, 231, 0.1); }

.lb-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lb-name { font-weight: 700; font-size: 14.5px; color: var(--text); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.lb-meta-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-secondary); font-weight: 500; }
.lb-meta-row .meta-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-light); flex-shrink: 0; }
.lb-program { font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.lb-email { color: var(--muted); font-weight: 500; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }

.lb-metrics { display: flex; gap: 16px; align-items: center; flex-shrink: 0; }
.lb-metric { text-align: center; min-width: 44px; }
.lb-metric .metric-val { font-weight: 800; font-size: 16px; color: var(--text); letter-spacing: -0.03em; line-height: 1; }
.lb-metric .metric-label { font-size: 9.5px; color: var(--muted-light); font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; margin-top: 3px; }
.metric-score.high { color: #10b981 !important; } .metric-score.mid { color: #f59e0b !important; } .metric-score.low { color: #ef4444 !important; }
.metric-xp { color: #6c5ce7 !important; }

.grade-badge { display: inline-block; padding: 4px 10px; border-radius: var(--radius-full); font-weight: 700; font-size: 11px; letter-spacing: 0.2px; line-height: 1; }
.grade-a-plus { background: rgba(16, 185, 129, 0.1); color: #059669; border: 1px solid rgba(16, 185, 129, 0.25); }
.grade-a { background: rgba(16, 185, 129, 0.07); color: #047857; border: 1px solid rgba(16, 185, 129, 0.18); }
.grade-b-plus { background: rgba(59, 130, 246, 0.08); color: #2563eb; border: 1px solid rgba(59, 130, 246, 0.2); }
.grade-b { background: rgba(59, 130, 246, 0.06); color: #1d4ed8; border: 1px solid rgba(59, 130, 246, 0.14); }
.grade-c { background: rgba(245, 158, 11, 0.08); color: #d97706; border: 1px solid rgba(245, 158, 11, 0.2); }
.grade-d { background: rgba(239, 68, 68, 0.08); color: #b91c1c; border: 1px solid rgba(239, 68, 68, 0.2); }
.grade-f { background: rgba(239, 68, 68, 0.12); color: #991b1b; border: 1px solid rgba(239, 68, 68, 0.25); }

.lb-empty { text-align: center; padding: 48px 24px; color: var(--muted); font-weight: 600; font-size: 15px; display: none; }
.lb-empty svg { width: 48px; height: 48px; color: var(--muted-light); margin-bottom: 14px; opacity: 0.5; }

.footer { margin-top: auto; padding: 20px 0 4px; display: flex; align-items: center; justify-content: center; width: 100%; }
.footer-inner { border-radius: var(--radius-full); padding: 9px 22px; background: rgba(255, 255, 255, 0.45); backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, 0.7); color: var(--muted); font-weight: 600; font-size: 11px; text-align: center; letter-spacing: 0.4px; }

/* Responsive */
@media (max-width: 700px) { .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } .stat-card { padding: 16px 12px; border-radius: var(--radius-sm); } .stat-card .stat-value { font-size: 24px; } .lb-row { gap: 10px; padding: 12px 14px; border-radius: var(--radius-md); flex-wrap: wrap; } .rank-badge { width: 38px; height: 38px; font-size: 15px; } .rank-1 .rank-badge { font-size: 16px; } .rank-1 .rank-badge::after { font-size: 12px; top: -11px; } .lb-name { font-size: 13.5px; } .lb-meta-row { font-size: 11px; gap: 5px; } .lb-email { max-width: 110px; font-size: 10.5px; } .lb-metrics { width: 100%; justify-content: flex-end; gap: 12px; padding-top: 2px; } .lb-metric .metric-val { font-size: 14px; } .lb-metric .metric-label { font-size: 9px; } .grade-badge { font-size: 10px; padding: 3px 8px; } .lb-metric { min-width: 36px; } }
@media (max-width: 420px) { body { padding: 8px; } .loader { width: 64px; height: 40px; } .loader-text { font-size: 0.7rem; letter-spacing: 0.8px; } .load { height: 13px; width: 13px; } @keyframes loading_713 { 0% { width: 13px; transform: translateX(0px); } 40% { width: 100%; transform: translateX(0px); } 80% { width: 13px; transform: translateX(51px); } 90% { width: 100%; transform: translateX(0px); } 100% { width: 13px; transform: translateX(0px); } } @keyframes loading2_713 { 0% { transform: translateX(0px); width: 13px; } 40% { transform: translateX(0%); width: 80%; } 80% { width: 100%; transform: translateX(0px); } 90% { width: 80%; transform: translateX(12px); } 100% { transform: translateX(0px); width: 13px; } } @keyframes text_713 { 0% { letter-spacing: 0.8px; transform: translateX(0px); } 40% { letter-spacing: 1.6px; transform: translateX(20px); } 80% { letter-spacing: 0.8px; transform: translateX(26px); } 90% { letter-spacing: 1.6px; transform: translateX(0px); } 100% { letter-spacing: 0.8px; transform: translateX(0px); } } .nav { padding: 8px 14px; margin-bottom: 18px; } .logo { width: 36px; height: 36px; font-size: 15px; border-radius: 11px; } .brand-text h1 { font-size: 12.5px; } .brand-text p { font-size: 9px; } .icon-btn { width: 34px; height: 34px; } .icon-btn svg { width: 15px; height: 15px; } .lb-hero h2 { font-size: 22px; } .lb-subtitle { font-size: 12px; } .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; } .stat-card { padding: 14px 10px; border-radius: var(--radius-sm); } .stat-card .stat-value { font-size: 22px; } .stat-card .stat-label { font-size: 9px; } .lb-row { padding: 10px 12px; gap: 8px; border-radius: var(--radius-sm); } .rank-badge { width: 34px; height: 34px; font-size: 14px; } .rank-1 .rank-badge { font-size: 15px; } .rank-1 .rank-badge::after { font-size: 11px; top: -10px; } .lb-name { font-size: 13px; } .lb-meta-row { font-size: 10px; gap: 4px; } .lb-email { max-width: 90px; font-size: 10px; } .lb-metrics { gap: 8px; } .lb-metric { min-width: 30px; } .lb-metric .metric-val { font-size: 13px; } .lb-metric .metric-label { font-size: 8px; } .grade-badge { font-size: 9px; padding: 3px 7px; } .footer-inner { font-size: 10px; padding: 8px 16px; } }