/* ==========================================================================
   FastJoins — Leaderboard: stats, rankings, podium, table and "my position"
   ========================================================================== */
.lb-card { position: relative; padding: 16px 18px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); }
.lb-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.lb-muted { margin: 8px 0 14px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.lb-muted b { color: var(--text); }
.hide-sm { }

/* ---------- Stats ---------- */
.lb-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.lb-stat { display: flex; align-items: center; gap: 14px; animation: lbIn 0.4s var(--ease) both; }
.lb-stat:nth-child(2) { animation-delay: 50ms; }
.lb-stat:nth-child(3) { animation-delay: 100ms; }
.lb-stat strong { display: block; margin-top: 2px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.lb-stat > div { min-width: 0; }
.lb-stat-user { display: flex; align-items: center; gap: 8px; margin-top: 4px; min-width: 0; }
.lb-stat-user strong { margin: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-stat-user span { font-weight: 700; font-size: 14px; white-space: nowrap; }
.lb-ico { --c: var(--accent); flex-shrink: 0; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 6px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.lb-ico svg { width: 20px; height: 20px; }
.lb-ico.blue { --c: #5b8eff; }
.lb-ico.gold { --c: #f0bd6a; }
.lb-ico.green { --c: #3fca7e; }
@keyframes lbIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Toolbar ---------- */
.lb-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.lb-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); }
.lb-tabs button { height: 34px; padding: 0 14px; border: 0; border-radius: 4px; background: none; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background-color 0.15s, color 0.15s; }
.lb-tabs button:hover { color: var(--text); }
.lb-tabs button.active { background: var(--surface-3); color: var(--text); }
.lb-search { position: relative; width: 260px; }
.lb-search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); fill: none; stroke: var(--text-3); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.lb-search .input { width: 100%; padding-left: 38px; border-radius: 6px; }

/* ---------- Avatars ---------- */
.lb-av { display: block; flex-shrink: 0; border-radius: 50%; object-fit: cover; background: var(--surface-3); }
.lb-av-letter { display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, hsl(var(--h, 220) 70% 58%), hsl(calc(var(--h, 220) + 40) 65% 45%)); }

/* ---------- Podium ---------- */
.lb-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 14px; max-width: 820px; margin: 10px auto 22px; }
.lb-podium:empty { display: none; }
.lb-p {
    --c: #c3c8d4;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding-top: 6px;
    color: inherit;
    text-decoration: none;
    text-align: center;
    animation: lbIn 0.5s var(--ease) both;
    animation-delay: calc((4 - var(--i)) * 90ms);
}
.lb-p.p1 { --c: #f0bd6a; }
.lb-p.p3 { --c: #d49a6a; }
.lb-p-av { position: relative; margin-bottom: 8px; }
.lb-p-av .lb-av { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--c), 0 12px 30px -10px var(--c); transition: transform 0.25s var(--ease); }
.lb-p:hover .lb-p-av .lb-av { transform: translateY(-3px); }
.lb-p-rank { position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 4px; font-size: 13px; font-weight: 800; color: #1b1407; background: var(--c); box-shadow: 0 0 0 3px var(--bg); }
.lb-crown { position: absolute; left: 50%; top: -22px; width: 30px; height: 30px; transform: translateX(-50%) rotate(-8deg); fill: #f0bd6a; filter: drop-shadow(0 4px 10px rgba(240, 189, 106, 0.55)); animation: lbFloat 3s ease-in-out infinite; }
@keyframes lbFloat { 50% { transform: translateX(-50%) translateY(-3px) rotate(-8deg); } }
.lb-p-name { max-width: 100%; margin-top: 6px; font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-p-value { display: inline-flex; align-items: center; gap: 6px; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.lb-p-value .coin-ico { width: 16px; height: 16px; }
.lb-p small { color: var(--text-3); font-size: 12px; }
.lb-p-step {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
    padding-top: 10px;
    border-radius: 6px 6px 0 0;
    border: 1px solid color-mix(in srgb, var(--c) 35%, var(--border));
    border-bottom: 0;
    background: linear-gradient(180deg, color-mix(in srgb, var(--c) 18%, var(--surface)), var(--surface) 85%);
    transform-origin: bottom;
    animation: lbStep 0.7s var(--ease) both;
    animation-delay: calc((4 - var(--i)) * 90ms + 0.1s);
}
.lb-p-step span { font-size: 30px; font-weight: 900; color: color-mix(in srgb, var(--c) 70%, transparent); }
.lb-p.p1 .lb-p-step { height: 110px; }
.lb-p.p2 .lb-p-step { height: 80px; }
.lb-p.p3 .lb-p-step { height: 60px; }
.lb-p.is-me .lb-p-name { color: var(--accent-text); }
@keyframes lbStep { from { transform: scaleY(0); } }

/* ---------- Table + side ---------- */
.lb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 14px; align-items: start; }
.lb-table-card { padding: 0; overflow: hidden; }
.lb-table tbody tr { cursor: pointer; transition: background-color 0.12s; }
.lb-table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.lb-table tbody tr.is-me { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.rank-col { width: 64px; }
.lb-rank { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 4px; font-weight: 700; font-size: 13px; color: var(--text-3); background: var(--surface-2); font-variant-numeric: tabular-nums; }
tr.r1 .lb-rank { color: #1b1407; background: #f0bd6a; }
tr.r2 .lb-rank { color: #15171c; background: #c3c8d4; }
tr.r3 .lb-rank { color: #1b1206; background: #d49a6a; }
.lb-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lb-who .grow { flex: 1; min-width: 0; max-width: 320px; }
.lb-who strong { display: block; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-you { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; color: var(--accent-text); background: var(--accent-soft); vertical-align: 1px; }
.lb-bar { height: 4px; margin-top: 6px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.lb-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3c78f2, #7b5cff); transform-origin: left; animation: lbBar 0.8s var(--ease) both; }
tr.r1 .lb-bar span { background: linear-gradient(90deg, #e5a23a, #f0bd6a); }
@keyframes lbBar { from { transform: scaleX(0); } }
.lb-value { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.lb-value .coin-ico { width: 14px; height: 14px; }
.lb-level { display: inline-block; min-width: 26px; padding: 2px 6px; border-radius: 4px; text-align: center; font-size: 12px; font-weight: 700; color: var(--accent-text); background: var(--accent-soft); }
.lb-empty { padding: 28px; text-align: center; color: var(--text-3); }
.lb-more { display: flex; justify-content: center; padding: 10px; border-top: 1px solid var(--border); }

.lb-side { position: sticky; top: 80px; }
.lb-me { display: flex; flex-direction: column; gap: 14px; border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); background: radial-gradient(300px 160px at 100% 0%, rgba(123, 92, 255, 0.16), transparent 70%), var(--surface); }
.lb-me .button { border-radius: 6px; }
.lb-me-head { display: flex; align-items: center; gap: 14px; }
.lb-me-head .lb-av { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.lb-me-rank { display: block; font-size: 34px; font-weight: 900; letter-spacing: -0.03em; line-height: 1; background: linear-gradient(135deg, #8fb2ff, #a48bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lb-me-head small { color: var(--text-3); font-size: 12px; }
.lb-me-value { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; border-radius: 6px; background: var(--bg-raised); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.lb-me-value b { font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.lb-me-gap small { display: block; margin-top: 6px; color: var(--text-3); font-size: 12px; }
.lb-me-lead { padding: 10px 12px; border-radius: 6px; font-size: 14px; font-weight: 700; color: #f0bd6a; background: var(--amber-soft); }
.lb-me-top { align-self: flex-start; padding: 3px 8px; border-radius: 4px; font-size: 12px; font-weight: 700; color: #5fd394; background: var(--green-soft); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .lb-layout { grid-template-columns: minmax(0, 1fr); }
    .lb-side { position: static; order: -1; }
}
@media (max-width: 700px) {
    .lb-stats { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .lb-stat { padding: 12px 14px; }
    .lb-tabs { display: flex; width: 100%; }
    .lb-tabs button { flex: 1 1 auto; padding: 0 6px; font-size: 12px; white-space: nowrap; }
    .lb-search { width: 100%; }
    .lb-podium { gap: 8px; }
    .lb-p-name { font-size: 13px; }
    .lb-p-value { font-size: 15px; }
    .lb-p.p1 .lb-p-step { height: 80px; }
    .lb-p.p2 .lb-p-step { height: 58px; }
    .lb-p.p3 .lb-p-step { height: 44px; }
    .lb-p-step span { font-size: 22px; }
    .hide-sm { display: none; }
    .rank-col { width: 44px; }
}
