/* ==========================================================================
   PaperTrade — /leaderboard page styles
   Header and footer come from the shared PublicLayout (layout.js / layout.css).
   ========================================================================== */
:root { color-scheme: dark; }
body { margin: 0; background: var(--bg, #0B0E14); color: var(--text, #E6EAF2); font-family: var(--font-body, "Inter", system-ui, sans-serif); font-size: 14px; line-height: 1.5; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--brand, #7C8CFF); color: var(--brand-ink, #0B0E14); padding: 10px 16px; border-radius: 0 0 10px 0; font-weight: 600; text-decoration: none; }
.skip-link:focus { left: 0; }
.lb-main :is(a, button, input, [tabindex]):focus-visible { outline: 2px solid var(--brand, #7C8CFF); outline-offset: 2px; }

.lb-main { padding: 36px 0 40px; }
.lb-wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }

/* ---- Tournament header ---- */
.lb-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px 32px; flex-wrap: wrap; margin-bottom: 30px; }
.lb-eyebrow { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted, #8A94A8); }
.lb-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lb-head h1 { margin: 0; font-size: clamp(24px, 3vw, 32px); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.lb-status { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--up, #2EBD85); background: rgba(46, 189, 133, .12); border: 1px solid rgba(46, 189, 133, .35); }
.lb-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up, #2EBD85); }
@media (prefers-reduced-motion: no-preference) { .lb-status-dot { animation: lb-pulse 1.6s ease-in-out infinite; } }
@keyframes lb-pulse { 50% { opacity: .35; } }
.lb-head-meta { display: flex; align-items: stretch; gap: 12px; flex-wrap: wrap; }
.lb-count, .lb-prize { display: flex; align-items: center; gap: 10px; background: var(--panel, #131824); border: 1px solid var(--border, #263042); border-radius: 10px; padding: 10px 16px; }
.lb-count { flex-direction: column; align-items: flex-start; gap: 2px; }
.lb-count-label { font-size: 12px; color: var(--muted, #8A94A8); }
.lb-count-time { font-family: var(--font-mono, "JetBrains Mono", monospace); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lb-prize { font-size: 14px; font-weight: 500; }
.lb-prize-icon { display: inline-flex; color: var(--gold, #F2B84B); }
.pro-badge { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: #0B0E14; background: var(--gold, #F2B84B); padding: 3px 8px; border-radius: 6px; }

/* ---- Podium ---- */
.lb-section { margin-bottom: 28px; }
.lb-podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.podium-card { position: relative; display: flex; flex-direction: column; gap: 12px; background: var(--panel, #131824); border: 1px solid var(--border, #263042); border-radius: 14px; padding: 20px; }
.podium-card.is-first { border-color: rgba(242, 184, 75, .5); background: linear-gradient(180deg, rgba(242, 184, 75, .09), rgba(242, 184, 75, .02)), var(--panel, #131824); box-shadow: 0 10px 34px rgba(242, 184, 75, .09); }
.podium-crown { position: absolute; top: -13px; inset-inline-end: 16px; color: var(--gold, #F2B84B); filter: drop-shadow(0 2px 6px rgba(242, 184, 75, .45)); }
.podium-top { display: flex; align-items: center; gap: 12px; }
.podium-rank { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--raised, #1B2230); border: 1px solid var(--border, #263042); color: var(--muted, #8A94A8); font-family: var(--font-mono, "JetBrains Mono", monospace); font-size: 13px; font-weight: 700; }
.podium-card.is-first .podium-rank { background: var(--gold, #F2B84B); border-color: transparent; color: #0B0E14; }
.podium-card.is-second .podium-rank { color: #C7CFDD; }
.podium-card.is-third .podium-rank { color: #D89B6A; }
.lb-ava { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%; font-size: 13px; font-weight: 700; color: #0B0E14; }
.lb-ava--sm { width: 28px; height: 28px; font-size: 11px; }
.podium-name { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-pnl { font-family: var(--font-mono, "JetBrains Mono", monospace); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.podium-pnl.is-gold { color: var(--gold, #F2B84B); }
.podium-stats { display: flex; gap: 18px; font-size: 12px; color: var(--muted, #8A94A8); }
.podium-stats b { font-family: var(--font-mono, "JetBrains Mono", monospace); font-weight: 600; color: var(--text, #E6EAF2); }

/* ---- Toolbar: tabs + search + note ---- */
.lb-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.lb-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--panel, #131824); border: 1px solid var(--border, #263042); border-radius: 10px; }
.lb-tab { height: 32px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; color: var(--muted, #8A94A8); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.lb-tab:hover { color: var(--text, #E6EAF2); }
.lb-tab[aria-selected="true"] { background: var(--raised, #1B2230); color: var(--text, #E6EAF2); box-shadow: inset 0 0 0 1px var(--border, #263042); }
.lb-search { position: relative; flex: 1 1 220px; max-width: 320px; }
.lb-search-icon { position: absolute; inset-inline-start: 12px; top: 50%; translate: 0 -50%; display: inline-flex; color: var(--muted, #8A94A8); pointer-events: none; }
.lb-search input { width: 100%; height: 44px; padding-inline: 38px 14px; box-sizing: border-box; background: var(--panel, #131824); border: 1px solid var(--border, #263042); border-radius: 10px; color: var(--text, #E6EAF2); font: inherit; }
.lb-search input::placeholder { color: var(--muted, #8A94A8); }
.lb-note { margin: 0 0 14px; font-size: 12px; color: var(--muted, #8A94A8); }

/* ---- Table ---- */
.lb-table-wrap { background: var(--panel, #131824); border: 1px solid var(--border, #263042); border-radius: 12px; overflow: auto; max-height: 640px; }
.lb-table { width: 100%; min-width: 780px; border-collapse: separate; border-spacing: 0; }
.lb-table th { position: sticky; top: 0; z-index: 2; background: var(--raised, #1B2230); padding: 10px 16px; border-bottom: 1px solid var(--border, #263042); text-align: start; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted, #8A94A8); white-space: nowrap; }
.lb-table td { padding: 11px 16px; border-bottom: 1px solid var(--border, #263042); white-space: nowrap; vertical-align: middle; }
.lb-table tbody tr:last-child td { border-bottom: 0; }
.lb-table tbody tr:hover { background: rgba(124, 140, 255, .05); }
.th-num { text-align: end !important; }
.lb-num { font-family: var(--font-mono, "JetBrains Mono", monospace); font-variant-numeric: tabular-nums; }
.lb-rank { width: 48px; color: var(--muted, #8A94A8); font-weight: 600; }
.lb-rank.is-r1 { color: var(--gold, #F2B84B); }
.lb-rank.is-r2 { color: #C7CFDD; }
.lb-rank.is-r3 { color: #D89B6A; }
.lb-user { display: inline-flex; align-items: center; gap: 10px; }
.lb-name { font-weight: 500; }
.lb-wins-badge { font-size: 11px; font-weight: 700; color: var(--gold, #F2B84B); background: rgba(242, 184, 75, .12); border: 1px solid rgba(242, 184, 75, .35); padding: 2px 7px; border-radius: 999px; }
.lb-pos { color: var(--up, #2EBD85); }
.lb-neg { color: var(--down, #FF5C75); }
.lb-spark-svg { display: block; }
.lb-delta { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono, "JetBrains Mono", monospace); font-size: 13px; font-weight: 600; }
.lb-delta.is-up { color: var(--up, #2EBD85); }
.lb-delta.is-down { color: var(--down, #FF5C75); }
.lb-delta.is-flat { color: var(--muted, #8A94A8); font-weight: 400; }

/* ---- Pagination ---- */
.lb-pages-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.lb-pages-info { font-size: 13px; color: var(--muted, #8A94A8); }
.lb-pages { display: flex; gap: 6px; }
.lb-page { min-width: 32px; height: 32px; padding: 0 8px; display: inline-grid; place-items: center; border: 1px solid var(--border, #263042); border-radius: 8px; background: var(--panel, #131824); color: var(--text, #E6EAF2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.lb-page:hover:not(:disabled) { background: var(--raised, #1B2230); }
.lb-page[aria-current="page"] { background: var(--brand, #7C8CFF); border-color: transparent; color: var(--brand-ink, #0B0E14); }
.lb-page:disabled { opacity: .4; cursor: default; }

/* ---- Skeleton (shimmer disabled under prefers-reduced-motion) ---- */
.sk-row { display: grid; grid-template-columns: 48px 1fr 100px 90px 110px 130px 90px; gap: 16px; align-items: center; min-width: 720px; padding: 15px 16px; border-bottom: 1px solid var(--border, #263042); }
.sk-row:last-child { border-bottom: 0; }
.sk-bar { height: 12px; border-radius: 6px; background: var(--raised, #1B2230); }
@media (prefers-reduced-motion: no-preference) {
  .sk-bar { background: linear-gradient(90deg, var(--raised, #1B2230) 25%, #232C3E 50%, var(--raised, #1B2230) 75%); background-size: 200% 100%; animation: lb-shimmer 1.2s linear infinite; }
}
@keyframes lb-shimmer { to { background-position: -200% 0; } }

/* ---- Empty state ---- */
.lb-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 56px 24px; text-align: center; }
.lb-empty-icon { display: inline-flex; color: var(--muted, #8A94A8); opacity: .75; }
.lb-empty-icon svg { width: 42px; height: 42px; }
.lb-empty-title { margin: 4px 0 0; font-size: 16px; font-weight: 600; color: var(--text, #E6EAF2); }
.lb-empty-sub { margin: 0; font-size: 13px; color: var(--muted, #8A94A8); }

/* ---- CTA + disclaimer ---- */
.lb-cta { display: flex; justify-content: space-between; align-items: center; gap: 20px 32px; flex-wrap: wrap; margin-top: 8px; padding: 28px; border: 1px solid rgba(124, 140, 255, .35); border-radius: 14px; background: linear-gradient(135deg, rgba(124, 140, 255, .14), rgba(124, 140, 255, .04)); }
.lb-cta-copy h2 { margin: 0 0 6px; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.lb-cta-copy p { margin: 0; font-size: 14px; color: var(--muted, #8A94A8); }
.lb-cta-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lb-cta-btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 30px; border-radius: 10px; background: var(--brand, #7C8CFF); color: var(--brand-ink, #0B0E14); font-size: 15px; font-weight: 700; text-decoration: none; }
.lb-cta-btn:hover { filter: brightness(1.08); }
.lb-cta-note { margin: 0; font-size: 12px; color: var(--muted, #8A94A8); }
.lb-disclaimer { margin: 26px 0 0; padding-top: 16px; border-top: 1px solid var(--border, #263042); text-align: center; font-size: 12px; color: var(--muted, #8A94A8); }
.lb-noscript { padding: 24px; text-align: center; color: var(--muted, #8A94A8); }

/* ---- Responsive: 1024 / 390 ---- */
@media (max-width: 1024px) {
  .podium-pnl { font-size: 22px; }
  .lb-podium { gap: 12px; }
}
@media (max-width: 640px) {
  .lb-wrap { padding: 0 16px; }
  .lb-main { padding-top: 24px; }
  .lb-head { align-items: flex-start; flex-direction: column; margin-bottom: 24px; }
  .lb-head-meta { width: 100%; }
  .lb-prize { flex: 1; justify-content: flex-start; }
  .lb-podium { grid-template-columns: 1fr; }
  .lb-toolbar { flex-direction: column; align-items: stretch; }
  .lb-search { max-width: none; }
  .lb-cta { flex-direction: column; align-items: flex-start; }
  .lb-cta-actions { align-items: stretch; width: 100%; }
}
