.leaderboard-page {
  --bg-canvas: #F4F7FE;
  --surface-card: #FFFFFF;
  --surface-subtle: #F8FAFC;
  --surface-glass: rgba(255, 255, 255, 0.88);
  --brand-navy: #1E3A8A;
  --brand-indigo-grad: linear-gradient(135deg, #1E1B4B 0%, #312E81 55%, #1E3A8A 100%);
  --cta-orange-grad: linear-gradient(135deg, #FF7A18 0%, #F97316 100%);
  --cta-orange-hover: linear-gradient(135deg, #EA580C 0%, #C2410C 100%);
  --user-row-bg: #EEF2FF;
  --text-strong: #0F172A;
  --text-body: #475569;
  --text-muted: #94A3B8;
  --status-up: #10B981;
  --status-down: #EF4444;
  --border-hairline: #E2E8F0;
  background: var(--bg-canvas);
  color: var(--text-strong);
  letter-spacing: 0;
}

.leaderboard-page .app-container {
  max-height: none;
  overflow: visible;
  background: var(--bg-canvas);
}

.leaderboard-page .navbar { z-index: 60; }
.leaderboard-page [hidden] { display: none !important; }
.leaderboard-page .lb-main *, .leaderboard-page .lb-filter-sheet * { box-sizing: border-box; letter-spacing: 0; }
.leaderboard-page .lb-main button, .leaderboard-page .lb-main input, .leaderboard-page .lb-main select, .leaderboard-page .lb-filter-sheet button, .leaderboard-page .lb-filter-sheet select { font-family: inherit; }
.leaderboard-page .lb-main button, .leaderboard-page .lb-filter-sheet button { cursor: pointer; }
.leaderboard-page .lb-main button:disabled, .leaderboard-page .lb-filter-sheet button:disabled { cursor: not-allowed; opacity: 0.45; }
.leaderboard-page :is(.lb-main, .lb-filter-sheet) :is(a, button, input, select):focus-visible { outline: 3px solid #60A5FA; outline-offset: 3px; }

.lb-main { width: 100%; max-width: 1160px; margin: 0 auto; padding: 32px 24px; }
.lb-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; margin-bottom: 24px; }
.lb-eyebrow { display: block; font-size: 10px; font-weight: 800; color: var(--text-body); text-transform: uppercase; margin-bottom: 5px; }
.lb-heading h1 { margin: 0; color: var(--brand-navy); font-size: 26px; font-weight: 800; line-height: 1.25; }
.lb-heading p { margin: 7px 0 0; font-size: 12px; color: var(--text-body); }
.lb-modes { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; background: #E2E8F0; border-radius: 12px; isolation: isolate; }
.lb-mode-indicator { position: absolute; left: 4px; top: 4px; bottom: 4px; width: calc((100% - 16px) / 3); border-radius: 8px; background: var(--brand-navy); box-shadow: 0 3px 8px rgba(30, 58, 138, 0.16); transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1); z-index: -1; }
.lb-mode-tab { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; height: 42px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text-body); font-size: 11px; font-weight: 700; white-space: nowrap; transition: color 200ms ease; }
.lb-mode-tab.is-active { color: #FFFFFF; }
.lb-tab-short { display: none; }
.lb-icon-badge { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 7px; font-size: 14px; }
.lb-icon-gold { color: #F59E0B; background: rgba(245, 158, 11, 0.15); }
.lb-icon-orange { color: #F97316; background: rgba(249, 115, 22, 0.15); }
.lb-icon-blue { color: #3B82F6; background: rgba(59, 130, 246, 0.15); }
.lb-icon-mint { color: #34D399; background: rgba(52, 211, 153, 0.20); }

.lb-standing { position: relative; display: grid; grid-template-columns: minmax(230px, 1fr) minmax(240px, 1.15fr) auto; gap: 22px; align-items: center; padding: 20px 24px; margin-bottom: 18px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 16px; color: #FFFFFF; background: var(--brand-indigo-grad); box-shadow: 0 8px 24px rgba(30, 27, 75, 0.12); }
.lb-standing-identity { min-width: 0; }
.lb-standing-eyebrow { display: flex; align-items: center; gap: 7px; min-width: 0; margin-bottom: 12px; color: #FBBF24; font-size: 11px; font-weight: 700; }
.lb-standing-eyebrow > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-standing-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.lb-standing-stats > div { display: flex; flex-direction: column; min-width: 0; gap: 5px; }
.lb-standing-value { display: block; min-height: 30px; color: #FFFFFF; font-size: 25px; line-height: 1.2; font-weight: 800; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.lb-standing-value.lb-metric-long { font-size: 17px; }
.lb-standing-label { font-size: 9px; font-weight: 700; text-transform: uppercase; color: #CBD5E1; }
.lb-standing-delta { display: flex; align-items: center; gap: 6px; min-height: 18px; margin-top: 10px; font-size: 10px; color: #C7D2FE; }
.lb-standing-progress { min-width: 0; }
.lb-progress-goal { display: flex; align-items: flex-start; gap: 9px; color: #E2E8F0; font-size: 11px; line-height: 1.65; }
.lb-progress-goal > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.lb-progress-line { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.lb-progress-track { flex: 1; height: 6px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, 0.15); }
.lb-progress-track > span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #34D399, #10B981); transition: width 500ms ease; }
.lb-progress-line > strong { width: 32px; text-align: right; color: #34D399; font-size: 11px; }
.lb-standing-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.lb-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 15px; border: 0; border-radius: 8px; text-decoration: none; font-size: 12px; font-weight: 700; line-height: 1.4; transition: background 200ms ease, box-shadow 200ms ease; }
.lb-button-orange { color: #FFFFFF; background: var(--cta-orange-grad); box-shadow: 0 3px 8px rgba(249, 115, 22, 0.18); }
.lb-button-orange:hover, .lb-button-orange:active { color: #FFFFFF; background: var(--cta-orange-hover); }
.lb-button-navy { background: var(--brand-navy); color: #FFFFFF; }
.lb-button-navy:hover { background: #172E70; color: #FFFFFF; }
.lb-button-soft { background: #F1F5F9; color: var(--text-body); }
.lb-button-soft:hover { background: #E2E8F0; }
.lb-jump-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 24px; padding: 0; border: 0; background: transparent; color: #E0E7FF; font-size: 10px; font-weight: 600; }
.lb-jump-btn:hover:not(:disabled) { color: #FFFFFF; }

.lb-avatar { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--avatar-start), var(--avatar-end)); color: #FFFFFF; font-size: 14px; font-weight: 800; line-height: 1; }

.lb-ranking-panel { min-width: 0; }
.lb-improve-section h2 { margin: 0; color: var(--text-strong); font-size: 17px; line-height: 1.35; font-weight: 800; }
.lb-count { flex-shrink: 0; min-height: 24px; padding: 3px 9px; border: 1px solid var(--border-hairline); border-radius: 999px; background: var(--surface-card); color: var(--text-body); font-size: 10px; font-weight: 700; }
.lb-count:empty { display: none; }
.lb-toolbar { display: grid; grid-template-columns: minmax(280px, 1.45fr) minmax(150px, 0.85fr) minmax(132px, 0.75fr) minmax(190px, 1fr); align-items: center; gap: 10px; }
.lb-main[data-mode="arena"] .lb-toolbar, .lb-main[data-mode="schools"] .lb-toolbar { grid-template-columns: minmax(220px, 1fr) minmax(250px, 2fr); }
.lb-timeframe-field { display: flex; align-items: center; gap: 5px; padding: 4px 5px 4px 10px; height: 44px; min-width: 0; border: 1px solid var(--border-hairline); border-radius: 10px; background: var(--surface-subtle); }
.lb-timeframe-field > i { flex-shrink: 0; color: #4F46E5; font-size: 12px; }
.lb-timeframe-pills { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; flex: 1; min-width: 0; }
.lb-timeframe-pills button { height: 32px; min-width: 0; padding: 0 5px; border: 0; border-radius: 6px; font-size: 10px; font-weight: 700; white-space: nowrap; background: transparent; color: var(--text-body); }
.lb-timeframe-pills button:hover { background: #E2E8F0; }
.lb-timeframe-pills button.is-active { background: var(--brand-navy); color: #FFFFFF; }
.lb-select-field { display: flex; align-items: center; position: relative; height: 44px; min-width: 0; border: 1px solid var(--border-hairline); border-radius: 10px; background: var(--surface-card); }
.lb-select-field > i { position: absolute; left: 12px; font-size: 12px; color: #4F46E5; pointer-events: none; }
.lb-select-field select { display: block; width: 100%; min-width: 0; height: 100%; margin: 0; padding: 8px 22px 8px 33px; border: 0; border-radius: 10px; background-color: transparent; color: var(--text-body); font-size: 11px; font-weight: 600; text-overflow: ellipsis; }
.lb-search { position: relative; height: 44px; min-width: 0; }
.lb-search > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; pointer-events: none; }
.lb-search input { width: 100%; height: 100%; min-width: 0; margin: 0; padding: 8px 33px 8px 35px; border: 1px solid var(--border-hairline); border-radius: 10px; background: var(--surface-card); color: var(--text-strong); font-size: 12px; }
.lb-search input::placeholder { color: #64748B; }
.lb-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.lb-search button { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #64748B; }
.lb-search button:hover { color: #EF4444; }
.lb-mobile-filter-trigger { display: none; }
.lb-filter-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.lb-filter-label { color: var(--text-body); font-size: 11px; margin-right: 2px; }
.lb-filter-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; padding: 4px 12px; border: 0; border-radius: 999px; color: var(--brand-navy); background: #EEF2FF; font-size: 12px; font-weight: 600; }
.lb-filter-chip:hover { background: #E0E7FF; }
.lb-clear-filters { min-height: 28px; padding: 4px 5px; border: 0; background: transparent; color: #DC2626; font-size: 12px; font-weight: 600; }
.lb-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; margin: 5px 0; }
.lb-meta-row p { margin: 0; min-width: 0; color: var(--text-body); font-size: 10px; overflow-wrap: anywhere; }
.lb-meta-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; color: #64748B; font-size: 9px; }
.lb-icon-button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 32px; height: 32px; padding: 0; border: 1px solid var(--border-hairline); border-radius: 7px; background: var(--surface-card); color: var(--text-body); font-size: 12px; }
.lb-icon-button:hover:not(:disabled) { color: var(--brand-navy); border-color: #93C5FD; background: #EFF6FF; }

.lb-results { min-height: 350px; }
.lb-table-wrap { position: relative; max-height: 640px; overflow-y: auto; overflow-x: clip; border: 1px solid var(--border-hairline); border-radius: 12px; background: var(--surface-card); scrollbar-gutter: stable; }
.leaderboard-page .lb-table { display: table; width: 100%; min-width: 0; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.leaderboard-page .lb-table th { position: sticky; top: 0; z-index: 2; height: 44px; padding: 12px 14px; border-bottom: 1px solid var(--border-hairline); background: var(--surface-subtle); color: #64748B; font-size: 9px; font-weight: 700; text-align: left; text-transform: uppercase; }
.lb-table th i { margin-right: 4px; color: #94A3B8; }
.lb-table .lb-col-rank { width: 14%; }
.lb-table .lb-col-student { width: 34%; }
.lb-table .lb-collapse-column { width: 18%; }
.lb-table .lb-col-score { width: 16%; }
.lb-table .lb-col-action { width: 18%; }
.leaderboard-page .lb-table :is(th, td).lb-collapse-column { text-align: center; }
.leaderboard-page .lb-table :is(th, td).lb-col-score, .leaderboard-page .lb-table :is(th, td).lb-col-action { text-align: right; }
.leaderboard-page .lb-table :is(th, td).lb-col-rank, .leaderboard-page .lb-table :is(th, td).lb-col-student { text-align: left; }
.lb-main[data-mode="arena"] .lb-col-student, .lb-main[data-mode="schools"] .lb-col-student { width: 24%; }
.lb-main[data-mode="arena"] .lb-collapse-column, .lb-main[data-mode="schools"] .lb-collapse-column { width: 20%; }
.lb-main[data-mode="arena"] .lb-col-score, .lb-main[data-mode="schools"] .lb-col-score { width: 17%; }
.lb-main[data-mode="arena"] .lb-col-action, .lb-main[data-mode="schools"] .lb-col-action { width: 25%; }
.leaderboard-page .lb-table td { padding: 12px 14px; border: 0; border-bottom: 1px solid var(--border-hairline); color: var(--text-body); vertical-align: middle; }
.leaderboard-page .lb-table th:first-child, .leaderboard-page .lb-row > td:first-child { padding-left: 24px; }
.leaderboard-page .lb-table th:last-child, .leaderboard-page .lb-row > td:last-child { padding-right: 24px; }
.lb-row { height: 64px; background: var(--surface-card); cursor: pointer; transition: background 160ms ease; }
.lb-row:hover, .lb-row.is-open { background: var(--surface-subtle); }
.lb-row.current-user { background: var(--user-row-bg); }
.lb-row.current-user > td:first-child { box-shadow: inset 4px 0 0 #4F46E5; }
.lb-row.current-user:hover { background: #E0E7FF; }
.leaderboard-page .lb-top-1 { --rank-accent: #F59E0B; background: linear-gradient(90deg, rgba(254, 243, 199, 0.35) 0%, rgba(255, 255, 255, 0) 40%), var(--surface-card); }
.leaderboard-page .lb-top-2 { --rank-accent: #94A3B8; background: linear-gradient(90deg, rgba(241, 245, 249, 0.6) 0%, rgba(255, 255, 255, 0) 40%), var(--surface-card); }
.leaderboard-page .lb-top-3 { --rank-accent: #D97706; background: linear-gradient(90deg, rgba(255, 237, 213, 0.4) 0%, rgba(255, 255, 255, 0) 40%), var(--surface-card); }
.leaderboard-page .lb-row:is(.lb-top-1, .lb-top-2, .lb-top-3) > td:first-child { border-left: 4px solid var(--rank-accent); box-shadow: none; padding-left: 20px; }
.leaderboard-page :is(.lb-top-1, .lb-top-2, .lb-top-3).current-user { background-color: var(--user-row-bg); }
.lb-rank-pill { display: inline-flex; align-items: center; justify-content: center; gap: 5px; flex-shrink: 0; padding: 4px 10px; border: 1px solid; border-radius: 999px; font-size: 12px; font-weight: 800; line-height: 1.4; white-space: nowrap; }
.lb-top-1 .lb-rank-pill { background: #FEF3C7; color: #B45309; border-color: #FCD34D; }
.lb-top-2 .lb-rank-pill { background: #F1F5F9; color: #334155; border-color: #CBD5E1; }
.lb-top-3 .lb-rank-pill { background: #FFEDD5; color: #9A3412; border-color: #FDBA74; }
.lb-row:focus-visible { outline: 2px solid #60A5FA; outline-offset: -2px; }
.lb-rank-cell { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.lb-rank { color: var(--text-strong); font-size: 13px; }
.lb-rank-delta { display: inline-flex; align-items: center; justify-content: center; gap: 3px; min-height: 18px; padding: 2px 4px; border-radius: 4px; font-size: 9px; font-weight: 700; }
.lb-delta-up { background: #ECFDF5; color: #059669; }
.lb-delta-down { background: #FEF2F2; color: #DC2626; }
.lb-delta-neutral { color: var(--text-muted); }
.lb-user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lb-user-meta { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; text-align: left; }
.lb-user-title { display: flex; align-items: center; gap: 5px; min-width: 0; }
.lb-name { min-width: 0; color: var(--text-strong); font-size: 13px; font-weight: 700; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-you { display: inline-flex; align-items: center; flex-shrink: 0; padding: 2px 5px; border-radius: 4px; background: #DBEAFE; color: #1E40AF; font-size: 8px; line-height: 1.3; font-weight: 800; }
.lb-tier { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 20px; height: 20px; border-radius: 6px; font-size: 10px; cursor: help; }
.lb-tier-primary, .lb-tier-purple { color: #1E3A8A; background: #E0E7FF; }
.lb-tier-gold { color: #92400E; background: #FEF3C7; }
.lb-tier-success { color: #065F46; background: #D1FAE5; }
.lb-tier-info { color: #075985; background: #E0F2FE; }
.lb-user-secondary { display: none; align-items: center; gap: 5px; color: #64748B; font-size: 10px; line-height: 1.5; }
.search-highlight { padding: 0 2px; border-radius: 2px; background: #FEF08A; color: #0F172A; }
.lb-subject-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 999px; background: #F1F5F9; color: #334155; font-size: 10px; font-weight: 600; line-height: 1.5; }
.lb-score-stack { display: flex; align-items: flex-end; flex-direction: column; gap: 5px; }
.lb-score-stack > strong { color: var(--brand-navy); font-size: 18px; font-weight: 800; line-height: 1.3; font-variant-numeric: tabular-nums; }
.lb-score-track { display: block; width: 64px; max-width: 100%; height: 4px; border-radius: 999px; overflow: hidden; background: #E2E8F0; }
.lb-score-track > span { display: block; height: 100%; background: #93A8E9; border-radius: inherit; transition: width 220ms ease; }
.lb-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.lb-challenge, .lb-profile-action { display: inline-flex; align-items: center; justify-content: center; gap: 5px; flex-shrink: 0; min-height: 32px; padding: 4px 7px; border: 1px solid #CBD5E1; border-radius: 7px; background: transparent; color: var(--text-body); text-decoration: none; font-size: 10px; font-weight: 700; white-space: nowrap; transition: background 160ms ease, color 160ms ease, border-color 160ms ease; }
.lb-challenge > i { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border: 1px solid #FDBA74; border-radius: 5px; background: #FFF7ED; color: #F97316; }
.lb-profile-action { border-color: transparent; color: var(--brand-navy); }
.lb-row:hover .lb-challenge, .lb-challenge:hover { color: #FFFFFF; background: #F97316; border-color: #F97316; }
.lb-row:hover .lb-challenge > i, .lb-challenge:hover > i { color: #FFFFFF; border-color: transparent; background: rgba(255, 255, 255, 0.15); }
.lb-challenge.lb-button-orange { color: #FFFFFF; background: var(--cta-orange-grad); border: 0; }
.lb-challenge.lb-button-orange > i { color: #FFFFFF; border: 0; background: transparent; }
.lb-challenge.lb-button-orange:hover { background: var(--cta-orange-hover); }
.lb-expand { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 28px; height: 32px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #64748B; font-size: 10px; }
.lb-expand:hover { background: #E2E8F0; }
.lb-expand i, .lb-card-chevron i { transition: transform 220ms ease; }
.is-open > td .lb-expand i, .student-card.is-open .lb-card-chevron i { transform: rotate(180deg); }
.lb-record { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.lb-record > span { padding: 3px 5px; border-radius: 4px; }
.lb-win { color: #059669; background: #ECFDF5; }
.lb-loss { color: #DC2626; background: #FEF2F2; }
.lb-draw { color: #475569; background: #F1F5F9; }
.lb-battle-count { display: inline-flex; align-items: center; gap: 3px; color: #64748B; font-size: 10px; font-weight: 700; }
.leaderboard-page .lb-detail-row > td { height: 0; padding: 0; border: 0; }
.lb-drawer { max-height: 0; overflow: hidden; transition: max-height 220ms cubic-bezier(0.4, 0, 0.2, 1); }
.lb-drawer.is-open { max-height: 160px; }
.lb-drawer-content { max-height: 160px; overflow-y: auto; padding: 14px 24px; border-bottom: 1px solid var(--border-hairline); background: var(--surface-subtle); }
.lb-drawer-name { display: block; margin-bottom: 8px; color: var(--text-strong); font-size: 12px; overflow-wrap: anywhere; }
.lb-breakdown { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lb-drawer-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.lb-achieved { display: inline-flex; align-items: center; gap: 5px; color: #64748B; font-size: 10px; }
.lb-mobile-list { display: none; }
.lb-my-dock { position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 10px 24px; border-top: 1px solid var(--border-hairline); color: var(--text-strong); background: var(--surface-glass); backdrop-filter: blur(12px); box-shadow: 0 -3px 12px rgba(15, 23, 42, 0.06); }
.lb-dock-person { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lb-dock-rank { flex-shrink: 0; padding: 4px 8px; border-radius: 6px; color: var(--brand-navy); background: #EEF2FF; font-size: 12px; font-weight: 800; }
.lb-dock-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.lb-dock-name strong { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.lb-dock-name small { color: #64748B; font-size: 9px; }
.lb-dock-score { display: flex; align-items: baseline; gap: 5px; flex-shrink: 0; color: var(--brand-navy); font-size: 17px; font-variant-numeric: tabular-nums; }
.lb-dock-score small { font-size: 9px; font-weight: 600; }
.lb-dock-cta { display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex-shrink: 0; min-height: 34px; padding: 7px 12px; border: 0; border-radius: 8px; color: #FFFFFF; background: var(--cta-orange-grad); text-decoration: none; font-size: 11px; font-weight: 700; }
.lb-dock-cta:hover { color: #FFFFFF; background: var(--cta-orange-hover); }
.lb-page-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.lb-page-size { display: flex; align-items: center; gap: 6px; color: #64748B; font-size: 10px; }
.lb-page-size select { min-width: 52px; height: 32px; margin: 0; padding: 4px 7px; border: 1px solid var(--border-hairline); border-radius: 6px; color: var(--text-body); background: var(--surface-card); font-size: 11px; }
.lb-pagination, .lb-page-numbers { display: flex; align-items: center; gap: 4px; }
.lb-page-number { width: 32px; height: 32px; padding: 0; border: 1px solid var(--border-hairline); border-radius: 6px; color: var(--text-body); background: var(--surface-card); font-size: 11px; font-weight: 700; }
.lb-page-number.is-active { background: var(--brand-navy); border-color: var(--brand-navy); color: #FFFFFF; opacity: 1 !important; }
.lb-page-gap { width: 20px; text-align: center; color: #64748B; }
.lb-notice { min-height: 16px; margin: 8px 0 0; color: #047857; font-size: 11px; }
.lb-empty-cell { text-align: center; }
.lb-empty { display: flex; align-items: center; flex-direction: column; justify-content: center; gap: 12px; min-height: 300px; padding: 30px 16px; text-align: center; }
.lb-empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; color: #2563EB; background: #DBEAFE; font-size: 24px; }
.lb-empty h3 { margin: 0; color: var(--text-strong); font-size: 16px; font-weight: 800; }
.lb-empty p { max-width: 420px; margin: 0 0 3px; color: var(--text-body); font-size: 12px; overflow-wrap: anywhere; }
.lb-empty-actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
.leaderboard-page .lb-skeleton-row td { padding: 0 24px; height: 64px; }
.lb-skeleton-line, .lb-skeleton-card { display: flex; align-items: center; gap: 12px; height: 64px; }
.lb-skeleton { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%); background-size: 200% 100%; animation: lb-shimmer 1.2s infinite; }
.lb-skeleton-rank { width: 25px; flex-shrink: 0; }
.lb-skeleton-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.lb-skeleton-name { width: 35%; max-width: 220px; }
.lb-skeleton-score { width: 54px; height: 18px; margin-left: auto; }

.lb-improve-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border-hairline); }
.lb-improve-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 16px; }
.lb-improve-card { display: grid; grid-template-columns: 40px minmax(0, 1fr) 14px; gap: 12px; align-items: center; min-height: 116px; padding: 20px; border: 1px solid var(--border-hairline); border-radius: 16px; background: var(--surface-card); color: var(--text-body); text-decoration: none; transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease; }
.lb-improve-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; font-size: 18px; }
.lb-improve-orange { color: #EA580C; background: #FFF7ED; }
.lb-improve-blue { color: #2563EB; background: #EFF6FF; }
.lb-improve-green { color: #059669; background: #ECFDF5; }
.lb-improve-copy { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lb-improve-copy strong { color: var(--text-strong); font-size: 12px; line-height: 1.5; }
.lb-improve-copy > span { color: var(--text-body); font-size: 10px; line-height: 1.6; }
.lb-improve-arrow { color: #64748B; transition: transform 200ms ease; }
.lb-improve-card:hover, .lb-improve-card:focus-visible { transform: translateY(-4px); border-color: #93C5FD; box-shadow: 0 8px 18px rgba(30, 58, 138, 0.07); }
.lb-improve-card:hover .lb-improve-arrow { transform: translateX(4px); }

.leaderboard-page.lb-sheet-open { overflow: hidden; }
.lb-filter-sheet { position: fixed; inset: auto 0 0; width: 100%; max-width: 560px; max-height: 85vh; margin: 0 auto; padding: 8px 16px 0; border: 0; border-radius: 20px 20px 0 0; background: var(--surface-card); color: var(--text-strong); box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.12); z-index: 100; overflow: hidden; }
.lb-filter-sheet[open] { animation: lb-sheet-in 220ms cubic-bezier(0.4, 0, 0.2, 1); }
.lb-filter-sheet::backdrop { background: rgba(15, 23, 42, 0.5); animation: lb-backdrop-in 150ms ease; }
.lb-filter-sheet.is-closing { animation: lb-sheet-out 180ms ease forwards; }
.lb-filter-sheet.is-closing::backdrop { animation: lb-backdrop-out 180ms ease forwards; }
.lb-sheet-handle { display: flex; align-items: center; justify-content: center; height: 20px; margin-bottom: 6px; touch-action: none; cursor: grab; }
.lb-sheet-handle span { width: 40px; height: 4px; border-radius: 2px; background: #CBD5E1; }
.lb-sheet-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.lb-sheet-heading h2 { margin: 0; min-width: 0; color: var(--text-strong); font-size: 16px; font-weight: 800; }
.lb-sheet-fields { display: flex; flex-direction: column; gap: 20px; max-height: calc(85vh - 164px); padding: 2px 2px 4px; overflow-y: auto; overscroll-behavior: contain; }
.lb-sheet-fields fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
.lb-sheet-fields legend, .lb-sheet-select label { display: flex; align-items: center; gap: 7px; padding: 0; margin-bottom: 10px; color: var(--text-body); font-size: 12px; font-weight: 700; }
.lb-sheet-fields legend i, .lb-sheet-select label i { color: #4F46E5; }
.lb-sheet-pill-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.lb-sheet-pill-grid button { min-height: 44px; padding: 9px 8px; border: 1px solid var(--border-hairline); border-radius: 8px; background: var(--surface-subtle); color: var(--text-body); font-size: 12px; font-weight: 700; }
.lb-sheet-pill-grid button.is-active { background: #EEF2FF; color: var(--brand-navy); border-color: #A5B4FC; box-shadow: inset 0 0 0 1px #A5B4FC; }
.lb-sheet-select select { width: 100%; min-height: 44px; margin: 0; padding: 10px 12px; border: 1px solid var(--border-hairline); border-radius: 8px; background: var(--surface-card); color: var(--text-strong); font-size: 14px; }
.lb-sheet-actions { display: grid; grid-template-columns: 35fr 65fr; gap: 10px; margin-top: 18px; padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
.lb-sheet-actions .lb-button { min-height: 48px; border-radius: 12px; }

@keyframes lb-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes lb-sheet-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes lb-sheet-out { from { transform: translateY(0); } to { transform: translateY(100%); } }
@keyframes lb-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes lb-backdrop-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes lb-row-pulse { 0%, 100% { box-shadow: inset 0 0 0 999px rgba(249, 115, 22, 0); } 40% { box-shadow: inset 0 0 0 999px rgba(249, 115, 22, 0.16); } }
.lb-highlight-pulse { animation: lb-row-pulse 1.6s ease; }

@media (min-width: 768px) {
  @media not all and (min-width: 1024px) {
    .lb-main { max-width: 100%; padding: 24px 20px; }
    .lb-header { grid-template-columns: 1fr; gap: 16px; }
    .lb-modes { width: 100%; }
    .lb-mode-tab { font-size: 12px; }
    .lb-standing { grid-template-columns: minmax(0, 1fr) auto; gap: 18px; padding: 20px; }
    .lb-standing-progress { grid-column: 1 / -1; grid-row: 2; }
    .lb-standing-stats { max-width: 380px; }
    .lb-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
    .lb-timeframe-field { grid-column: 1; grid-row: 1; }
    .lb-search { grid-column: 2; grid-row: 1; }
    .lb-subject-field { grid-column: 1; grid-row: 2; }
    .lb-sort-field { grid-column: 2; grid-row: 2; }
    .lb-main[data-mode="arena"] .lb-toolbar, .lb-main[data-mode="schools"] .lb-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lb-main[data-mode="arena"] .lb-subject-field, .lb-main[data-mode="schools"] .lb-state-field { grid-column: 1; grid-row: 1; }
    .lb-collapse-column { display: none; }
    .lb-user-secondary { display: flex; flex-wrap: wrap; }
    .lb-table .lb-col-rank { width: 14%; }
    .lb-table .lb-col-student, .lb-main[data-mode="arena"] .lb-col-student, .lb-main[data-mode="schools"] .lb-col-student { width: 36%; }
    .lb-table .lb-col-score, .lb-main[data-mode="arena"] .lb-col-score, .lb-main[data-mode="schools"] .lb-col-score { width: 20%; }
    .lb-table .lb-col-action, .lb-main[data-mode="arena"] .lb-col-action, .lb-main[data-mode="schools"] .lb-col-action { width: 30%; }
    .leaderboard-page .lb-table th, .leaderboard-page .lb-table td { padding: 12px; }
    .leaderboard-page .lb-table th:first-child, .leaderboard-page .lb-row > td:first-child { padding-left: 16px; }
    .leaderboard-page .lb-row:is(.lb-top-1, .lb-top-2, .lb-top-3) > td:first-child { padding-left: 12px; }
    .leaderboard-page .lb-table th:last-child, .leaderboard-page .lb-row > td:last-child { padding-right: 16px; }
    .lb-improve-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
}

@media not all and (min-width: 768px) {
  .leaderboard-page .navbar { position: relative; }
  .leaderboard-page .nav-container { padding-left: 12px; padding-right: 12px; }
  .lb-main { padding: 16px 12px 88px; }
  .lb-header { display: contents; }
  .lb-heading { margin-bottom: 14px; }
  .lb-heading h1 { font-size: 23px; }
  .lb-heading p { font-size: 11px; }
  .lb-modes { position: sticky; top: 0; z-index: 40; height: 46px; margin-bottom: 14px; }
  .lb-modes::before { content: ''; position: absolute; inset: -4px -12px; z-index: -2; background: var(--surface-glass); backdrop-filter: blur(12px); }
  .lb-mode-tab { height: 38px; gap: 2px; padding: 0; font-size: 12.5px; }
  .lb-mode-tab .lb-icon-badge { width: 16px; height: 24px; border-radius: 5px; font-size: 12px; }
  .lb-tab-long { display: none; }
  .lb-tab-short { display: inline; }
  .lb-standing { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 16px; margin-bottom: 10px; border-radius: 12px; }
  .lb-standing-eyebrow { padding-right: 24px; font-size: 10px; margin-bottom: 12px; }
  .lb-standing-stats { gap: 10px; }
  .lb-standing-value { min-height: 27px; font-size: 23px; }
  .lb-standing-label { font-size: 9px; }
  .lb-standing-delta { margin-top: 8px; min-height: 15px; font-size: 9px; }
  .lb-progress-goal { gap: 8px; font-size: 10px; }
  .lb-progress-goal .lb-icon-badge { width: 24px; height: 24px; font-size: 12px; }
  .lb-progress-line { margin-top: 9px; }
  .lb-standing-actions { display: block; }
  .lb-standing-actions > .lb-button { width: 100%; min-height: 42px; }
  .lb-jump-btn { position: absolute; top: 11px; right: 12px; width: 30px; height: 30px; }
  .lb-jump-btn span { display: none; }
  .lb-count { margin-top: 1px; padding: 3px 7px; font-size: 9px; }
  .lb-main .lb-toolbar, .lb-main[data-mode="arena"] .lb-toolbar, .lb-main[data-mode="schools"] .lb-toolbar { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .lb-desktop-filter { display: none !important; }
  .lb-search { height: 42px; }
  .lb-search input { font-size: 12px; }
  .lb-mobile-filter-trigger { display: flex; align-items: center; justify-content: center; gap: 5px; height: 42px; padding: 0 9px; border: 1px solid #C7D2FE; border-radius: 10px; background: #EEF2FF; color: var(--brand-navy); font-size: 12px; font-weight: 700; }
  .lb-filter-count { display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 50%; background: var(--brand-navy); color: #FFFFFF; font-size: 9px; }
  .lb-filter-summary { display: none; }
  .lb-meta-row { min-height: 36px; gap: 5px; }
  .lb-meta-row p { font-size: 9px; }
  .lb-meta-actions > span { display: none; }
  .lb-meta-actions .lb-icon-button { width: 28px; height: 28px; font-size: 10px; }
  .lb-results { min-height: 352px; }
  .lb-table-wrap { max-height: none; overflow: visible; border: 0; border-radius: 0; background: transparent; scrollbar-gutter: auto; }
  .leaderboard-page .lb-table { display: none !important; }
  .lb-mobile-list { display: flex; flex-direction: column; gap: 8px; }
  .student-card { min-width: 0; border: 1px solid var(--border-hairline); border-radius: 12px; background: var(--surface-card); overflow: hidden; }
  .student-card.current-user { background: var(--user-row-bg); border-left: 4px solid #4F46E5; }
  .leaderboard-page .student-card:is(.lb-top-1, .lb-top-2, .lb-top-3) { border-left: 4px solid var(--rank-accent); }
  .lb-card-toggle { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: 64px; padding: 10px 14px; border: 0; border-radius: 0; background: transparent; color: var(--text-strong); text-align: left; }
  .lb-card-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
  .lb-card-rank { flex-shrink: 0; width: 48px; color: #64748B; font-size: 14px; font-weight: 700; }
  .lb-card-rank .lb-rank-pill { width: 48px; padding: 4px 6px; font-size: 11px; }
  .lb-card-left .lb-name { font-size: 15px; }
  .lb-card-left .lb-you { padding: 2px 4px; font-size: 7px; }
  .lb-mobile-secondary { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #64748B; font-size: 12px; line-height: 1.5; }
  .lb-mobile-secondary > i { margin-right: 3px; font-size: 10px; }
  .lb-card-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
  .lb-card-score { display: flex; flex-direction: column; gap: 2px; text-align: right; }
  .lb-card-score strong { color: var(--brand-navy); font-size: 17px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
  .lb-card-score small { color: #64748B; font-size: 10px; line-height: 1.2; font-weight: 700; }
  .lb-card-chevron { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; color: var(--text-muted); font-size: 12px; }
  .lb-drawer-content { padding: 12px 14px; }
  .lb-drawer-footer .lb-challenge { min-height: 34px; padding: 7px 9px; font-size: 10px; }
  .lb-drawer-footer { gap: 7px; }
  .lb-my-dock { position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; min-height: 64px; height: calc(64px + env(safe-area-inset-bottom, 0px)); padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); border: 0; color: #FFFFFF; background: #1E1B4B; box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.18); gap: 8px; }
  .lb-dock-person { flex: 1; gap: 6px; }
  .lb-dock-person .lb-avatar { width: 28px; height: 28px; font-size: 11px; }
  .lb-dock-rank { padding: 4px 6px; color: #FFFFFF; background: rgba(255, 255, 255, 0.15); font-size: 11px; }
  .lb-dock-name strong { max-width: 110px; color: #FFFFFF; font-size: 10px; }
  .lb-dock-name small { color: #C7D2FE; font-size: 8px; }
  .lb-dock-score { gap: 3px; color: #FBBF24; font-size: 14px; }
  .lb-dock-score small { font-size: 8px; }
  .lb-dock-cta { min-height: 34px; padding: 6px 10px; font-size: 10px; }
  .lb-page-tools { justify-content: flex-end; gap: 8px; }
  .lb-page-size { display: none; }
  .lb-page-numbers { flex-wrap: wrap; }
  .lb-pagination { flex-wrap: wrap; justify-content: flex-end; max-width: 100%; }
  .lb-page-number { width: 28px; height: 30px; font-size: 10px; }
  .lb-page-gap { width: 14px; }
  .lb-empty { min-height: 300px; padding: 24px 12px; }
  .lb-empty h3 { font-size: 15px; }
  .lb-empty p { font-size: 11px; }
  .lb-skeleton-card { padding: 10px 14px; border: 1px solid var(--border-hairline); border-radius: 12px; background: var(--surface-card); }
  .lb-improve-section { margin-top: 22px; padding-top: 20px; }
  .lb-improve-section h2 { font-size: 16px; }
  .lb-improve-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 12px; }
  .lb-improve-card { min-height: 94px; padding: 16px; }
  .lb-improve-copy strong { font-size: 13px; }
  .leaderboard-page .site-footer { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  .lb-filter-sheet { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .leaderboard-page .lb-main *, .leaderboard-page .lb-filter-sheet, .leaderboard-page .lb-filter-sheet *, .leaderboard-page .lb-filter-sheet::backdrop { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .lb-improve-card:hover, .lb-improve-card:focus-visible, .lb-improve-card:hover .lb-improve-arrow { transform: none; }
}