/* The largest equipped ornament spans 2.84 times its avatar diameter.
   Stages reserve that footprint independently of names and controls. */
.profile-avatar-stage { height:128px; width:100%; display:flex; align-items:center; justify-content:center; }
.profile-avatar-stage:has(.frame-champion-crown) { height:206px; }
.profile-avatar-stage .profile-avatar-pill { width:72px; height:72px; margin:0; }
.profile-header-section { text-align:center; }
.user-profile-card {
  width:min(540px,94vw) !important;
  padding:26px !important;
  max-height:92dvh !important;
  overflow-y:auto;
  background:radial-gradient(ellipse at 50% 0, #19334c66, transparent 340px), var(--surface-color);
  border-radius:26px !important;
}
.user-profile-card .user-profile-header {
  flex-direction:column;
  gap:8px !important;
  padding:0 0 18px !important;
  margin-bottom:16px !important;
  text-align:center;
}
.user-profile-header .user-profile-avatar-wrap {
  width:100%;
  height:auto;
  box-sizing:border-box;
  padding:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}
.user-profile-portrait { width:100%; height:136px; display:flex; align-items:center; justify-content:center; }
.user-profile-portrait:has(.frame-champion-crown) { height:226px; }
.user-profile-portrait:has(.frame-silver-crown,.frame-leader-crown) { height:154px; }
.user-profile-portrait .frame-champion-crown { transform:translateY(-12px); }
.user-profile-avatar-tools { display:flex; justify-content:center; gap:10px; padding:4px 0; }
.user-profile-avatar-tools:not(:has(.avatar-action-btn:not(.hidden))) { display:none; }
.user-profile-header .user-profile-avatar {
  width:80px !important;
  height:80px !important;
  flex:0 0 80px;
  font-size:1.8rem !important;
}
.user-profile-avatar-wrap .avatar-action-btn {
  position:static;
  top:auto !important;
  bottom:0 !important;
  width:36px;
  height:36px;
  z-index:20;
  border-radius:12px;
  box-shadow:none;
}
.user-profile-avatar-wrap .edit-avatar-btn { right:46px !important; left:auto !important; }
.user-profile-avatar-wrap .reset-avatar-btn { right:0 !important; left:auto !important; }
.user-profile-name-row .user-profile-rank-badge {
  position:static;
  padding:4px 9px; border-radius:8px;
  font-size:.75rem; line-height:1.4;
  background:#f59e0b18; color:#fbbf24; border:1px solid #dba34166;
}
body[data-theme="light"] .user-profile-name-row .user-profile-rank-badge { color:#85520b; background:#fff3d6; }
.user-profile-identity { width:100%; min-width:0; }
.user-profile-name-row { justify-content:center; flex-wrap:wrap; gap:8px 12px; }
.user-profile-header .user-profile-name { margin:0; font-size:1.6rem !important; overflow-wrap:anywhere; }
.user-profile-meta { justify-content:center; margin-top:12px; }
.user-profile-status-wrap { margin-top:8px; }
.user-profile-bio:empty { display:none; }
.user-profile-bio { line-height:1.6; overflow-wrap:anywhere; }
.user-bio-edit-box { width:100%; min-width:0; gap:8px; }
.user-bio-edit-box .up-bio-input { min-width:0; flex:1; }
.user-bio-edit-box .bio-counter { flex-shrink:0; }
.profile-favorite-track-box { padding:16px; border-radius:16px; background:var(--surface-hover); }
.favorite-track-header { flex-wrap:wrap; gap:6px; line-height:1.5; }
.favorite-track-header .fav-title { overflow-wrap:anywhere; white-space:normal; overflow:visible; }
.user-profile-stats-grid { gap:10px; }
.profile-stat-box {
  padding:14px 16px;
  display:grid;
  grid-template-columns:28px minmax(0,1fr);
  gap:3px 10px;
  align-items:center;
  text-align:left;
  background:linear-gradient(140deg,#38bdf809,transparent),var(--surface-hover);
  border-radius:16px;
}
.profile-stat-box .stat-box-icon { grid-row:1 / 3; margin:0; color:var(--highlight); }
.profile-stat-box .stat-box-val, .profile-stat-box .stat-box-lbl { grid-column:2; }
.profile-stat-box .stat-box-val { font-size:1.35rem; letter-spacing:-.035em; font-variant-numeric:tabular-nums; }
.profile-stat-box .stat-box-lbl { margin-top:5px; font-size:.76rem; }
.profile-stat-box.stat-box-wide { padding:16px; flex-wrap:wrap; gap:8px 12px; }
.profile-stat-box.stat-box-wide .stat-box-icon,
.profile-stat-box.stat-box-wide .stat-box-lbl { margin:0; }

.leaderboard-modal {
  max-width: 920px !important;
  width: min(920px, 94vw) !important;
  padding: 26px 28px !important;
  max-height: 92dvh !important;
  overflow-y: auto;
  scrollbar-width: thin;
  background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(56, 189, 248, 0.16), transparent 70%),
              radial-gradient(ellipse 70% 40% at 50% 100%, rgba(15, 23, 42, 0.7), transparent),
              var(--surface-color) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 26px !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65), 0 0 1px rgba(255, 255, 255, 0.15) !important;
}
.leaderboard-modal .lb-header-row {
  margin-bottom: 16px;
  gap: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.leaderboard-modal .lb-title {
  letter-spacing: .04em;
  font-size: 1.25rem;
  font-weight: 800;
  text-transform: uppercase;
}
.leaderboard-modal .lb-limit-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 18px 0;
  flex-wrap: wrap;
}
.leaderboard-modal .lb-limit-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-right: 4px;
}
.leaderboard-modal .lb-limit-btn {
  background: var(--surface-hover);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.leaderboard-modal .lb-limit-btn:hover {
  color: var(--text-primary);
  border-color: rgba(56, 189, 248, 0.4);
}
.leaderboard-modal .lb-limit-btn.active {
  background: rgba(56, 189, 248, 0.16);
  border-color: var(--highlight);
  color: #fff;
  font-weight: 700;
}

/* ==========================================================================
   TOP 3 PODIUM - DESKTOP ARCHITECTURE (DEFAULT)
   ========================================================================== */
.leaderboard-modal .lb-podium-container {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-end !important;
  justify-content: center !important;
  gap: 26px !important;
  margin: 16px auto 26px !important;
  max-width: 860px;
  width: 100%;
  padding: 0 4px !important;
  box-sizing: border-box;
}
.leaderboard-modal .podium-card {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  min-width: 0 !important;
  max-width: none !important;
  padding: 14px 12px 0 12px !important;
  box-sizing: border-box !important;
  cursor: pointer;
  transition: transform .2s cubic-bezier(0.2, 0, 0, 1), box-shadow .2s ease, border-color .2s ease !important;
  overflow: visible !important;
}
.leaderboard-modal .podium-card:hover {
  transform: translateY(-4px) !important;
}
.leaderboard-modal .podium-card.podium-rank-2 {
  order: 1;
  flex: 1 1 0;
  background: linear-gradient(180deg, rgba(203, 213, 225, 0.14) 0%, rgba(148, 163, 184, 0.04) 40%, rgba(15, 23, 42, 0.85) 100%), var(--surface-hover) !important;
  border: 1px solid rgba(203, 213, 225, 0.4) !important;
  border-radius: 22px 22px 14px 14px !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(241, 245, 249, 0.35) !important;
}
.leaderboard-modal .podium-card.podium-rank-1 {
  order: 2;
  flex: 1.25 1 0;
  z-index: 5;
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.18) 0%, rgba(245, 158, 11, 0.05) 45%, rgba(15, 23, 42, 0.9) 100%), var(--surface-hover) !important;
  border: 1px solid rgba(251, 191, 36, 0.55) !important;
  border-radius: 26px 26px 16px 16px !important;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.45), 0 0 35px rgba(251, 191, 36, 0.2), inset 0 1px 0 rgba(255, 243, 196, 0.5) !important;
}
.leaderboard-modal .podium-card.podium-rank-3 {
  order: 3;
  flex: 1 1 0;
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.14) 0%, rgba(180, 83, 9, 0.04) 40%, rgba(15, 23, 42, 0.85) 100%), var(--surface-hover) !important;
  border: 1px solid rgba(217, 119, 6, 0.4) !important;
  border-radius: 22px 22px 14px 14px !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(254, 215, 170, 0.3) !important;
}

/* Card top bar: badge + tier label */
.podium-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 4px;
  margin-bottom: 6px;
  box-sizing: border-box;
}
.podium-rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.82rem;
  line-height: 1;
}
.podium-rank-badge.rank-1 {
  background: rgba(245, 158, 11, 0.24);
  color: #fde047;
  border: 1px solid rgba(251, 191, 36, 0.65);
  font-size: 0.9rem;
  padding: 4px 12px;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.3);
}
.podium-rank-badge.rank-2 {
  background: rgba(148, 163, 184, 0.22);
  color: #f1f5f9;
  border: 1px solid rgba(203, 213, 225, 0.55);
}
.podium-rank-badge.rank-3 {
  background: rgba(217, 119, 6, 0.22);
  color: #fed7aa;
  border: 1px solid rgba(217, 119, 6, 0.55);
}
.podium-crown-icon {
  display: flex;
  align-items: center;
  line-height: 0;
}
.podium-tier-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  opacity: 0.75;
  text-transform: uppercase;
}
.podium-rank-1 .podium-tier-label { color: #fde047; }
.podium-rank-2 .podium-tier-label { color: #cbd5e1; }
.podium-rank-3 .podium-tier-label { color: #fdba74; }

/* Podium Avatar Stage */
.podium-avatar-stage {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible !important;
  box-sizing: border-box;
}
.podium-rank-1 .podium-avatar-stage {
  height: 200px;
  padding-top: 6px;
}
.podium-rank-2 .podium-avatar-stage,
.podium-rank-3 .podium-avatar-stage {
  height: 165px;
  padding-top: 4px;
}

/* Avatar element */
.leaderboard-modal .podium-avatar {
  margin: 0 !important;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  position: relative;
  box-sizing: border-box;
}
.podium-rank-1 .podium-avatar {
  width: 96px !important;
  height: 96px !important;
  font-size: 2.1rem !important;
  border: 3px solid #fbbf24;
  box-shadow: 0 0 24px rgba(251, 191, 36, 0.45);
}
.podium-rank-2 .podium-avatar {
  width: 84px !important;
  height: 84px !important;
  font-size: 1.8rem !important;
  border: 2px solid #cbd5e1;
  box-shadow: 0 0 18px rgba(203, 213, 225, 0.35);
}
.podium-rank-3 .podium-avatar {
  width: 84px !important;
  height: 84px !important;
  font-size: 1.8rem !important;
  border: 2px solid #d97706;
  box-shadow: 0 0 18px rgba(217, 119, 6, 0.35);
}

/* Player Details */
.podium-player-details {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 5;
  box-sizing: border-box;
}
.podium-rank-1 .podium-player-details {
  margin-top: 32px !important;
}
.podium-rank-2 .podium-player-details,
.podium-rank-3 .podium-player-details {
  margin-top: 14px !important;
}

.leaderboard-modal .podium-name {
  width: 100%;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 4px 0;
}
.podium-rank-1 .podium-name {
  font-size: 1.22rem !important;
  font-weight: 800;
  color: #fff;
}
.podium-rank-2 .podium-name {
  font-size: 1.05rem !important;
  font-weight: 700;
  color: #f1f5f9;
}
.podium-rank-3 .podium-name {
  font-size: 1.05rem !important;
  font-weight: 700;
  color: #fed7aa;
}

.leaderboard-modal .podium-title-wrap {
  min-height: 24px;
  margin: 2px 0 6px 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.leaderboard-modal .podium-title-badge {
  max-width: 92%;
  box-sizing: border-box;
  font-size: 0.68rem;
  padding: 2px 8px;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
}

.podium-score-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
}
.leaderboard-modal .podium-score {
  font-size: 1.25rem !important;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.podium-rank-1 .podium-score {
  font-size: 1.45rem !important;
  color: #fbbf24;
  text-shadow: 0 0 14px rgba(251, 191, 36, 0.4);
}
.podium-rank-2 .podium-score {
  color: #cbd5e1;
}
.podium-rank-3 .podium-score {
  color: #f97316;
}
.leaderboard-modal .podium-levels {
  margin-top: 3px;
  font-size: 0.76rem;
  opacity: 0.72;
  color: var(--text-secondary);
}

/* Stepped Pedestal Base at card bottom */
.podium-pedestal-base {
  width: calc(100% + 24px);
  margin: 0 -12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border-top-width: 2px;
  border-top-style: solid;
}
.podium-rank-1 .podium-pedestal-base {
  height: 54px;
  border-radius: 0 0 16px 16px;
  border-top-color: rgba(251, 191, 36, 0.6);
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.25) 0%, rgba(245, 158, 11, 0.06) 100%);
}
.podium-rank-1 .podium-base-num {
  font-size: 1.55rem;
  font-weight: 900;
  color: #fde047;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
}
.podium-rank-2 .podium-pedestal-base {
  height: 40px;
  border-radius: 0 0 14px 14px;
  border-top-color: rgba(203, 213, 225, 0.45);
  background: linear-gradient(180deg, rgba(203, 213, 225, 0.18) 0%, rgba(148, 163, 184, 0.04) 100%);
}
.podium-rank-2 .podium-base-num {
  font-size: 1.3rem;
  font-weight: 800;
  color: #cbd5e1;
}
.podium-rank-3 .podium-pedestal-base {
  height: 30px;
  border-radius: 0 0 14px 14px;
  border-top-color: rgba(217, 119, 6, 0.45);
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.18) 0%, rgba(180, 83, 9, 0.04) 100%);
}
.podium-rank-3 .podium-base-num {
  font-size: 1.2rem;
  font-weight: 800;
  color: #d97706;
}

/* ==========================================================================
   LEADERBOARD TABLE - DESKTOP (DEFAULT)
   ========================================================================== */
.leaderboard-modal .lb-content-wrapper { flex-shrink: 0; }
.leaderboard-modal .lb-scroll-area { max-height: none !important; overflow: visible !important; flex-shrink: 0; }
.leaderboard-modal .lb-table {
  width: 100%;
  border-spacing: 0 8px;
  border-collapse: separate;
  table-layout: fixed;
}
.leaderboard-modal .lb-table thead th {
  padding: 8px 12px;
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.leaderboard-modal .lb-th-rank { width: 8%; text-align: center; }
.leaderboard-modal .lb-th-player { width: 52%; text-align: left; }
.leaderboard-modal .lb-th-levels { width: 16%; text-align: center; }
.leaderboard-modal .lb-th-score { width: 24%; text-align: right; }

.leaderboard-modal .lb-player-row {
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.leaderboard-modal .lb-player-row:hover td {
  background: rgba(56, 189, 248, 0.12) !important;
}

.leaderboard-modal .lb-table td {
  padding: 8px 12px;
  border: 0;
  vertical-align: middle;
}
.leaderboard-modal .lb-table td:first-child { border-radius: 14px 0 0 14px; }
.leaderboard-modal .lb-table td:last-child { border-radius: 0 14px 14px 0; }

/* Top 4-10 tier rows: subtle status, glow, border */
.leaderboard-modal .lb-player-row.lb-top-tier td {
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.09) 0%, rgba(30, 58, 88, 0.38) 40%, rgba(15, 23, 42, 0.65) 100%);
  border-top: 1px solid rgba(56, 189, 248, 0.22);
  border-bottom: 1px solid rgba(56, 189, 248, 0.22);
}
.leaderboard-modal .lb-player-row.lb-top-tier td:first-child {
  border-left: 3px solid #38bdf8;
}
.leaderboard-modal .lb-player-row.lb-top-tier td:last-child {
  border-right: 1px solid rgba(56, 189, 248, 0.22);
}
.leaderboard-modal .lb-player-row.lb-top-tier .lb-rank-num {
  color: #7dd3fc;
  font-weight: 800;
  font-size: 1.02rem;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

/* Ranks 11+ rows: peaceful, subtle alternating material */
.leaderboard-modal .lb-player-row.lb-standard-row:nth-child(even) td {
  background: rgba(255, 255, 255, 0.025);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.leaderboard-modal .lb-player-row.lb-standard-row:nth-child(odd) td {
  background: rgba(255, 255, 255, 0.045);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.leaderboard-modal .lb-player-row.lb-standard-row td:first-child {
  border-left: 1px solid rgba(255, 255, 255, 0.05);
}
.leaderboard-modal .lb-player-row.lb-standard-row td:last-child {
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}
.leaderboard-modal .lb-player-row.lb-standard-row .lb-rank-num {
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.95rem;
}

/* Cell content */
.leaderboard-modal .lb-col-rank { text-align: center; }
.leaderboard-modal .lb-col-player { }
.leaderboard-modal .lb-player-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.lb-avatar-stage {
  width: 78px;
  height: 78px;
  flex: 0 0 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.lb-avatar-stage:has(.frame-champion-crown) {
  width: 120px;
  height: 116px;
  flex-basis: 120px;
}
.leaderboard-modal .lb-avatar-mini {
  margin: 0;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  font-size: 1.1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-player-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  gap: 2px;
}
.leaderboard-modal .lb-player-name {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}
.leaderboard-modal .lb-player-title-box {
  display: flex;
  align-items: center;
}
.leaderboard-modal .lb-player-title-box .user-title-badge {
  font-size: 0.68rem;
  padding: 2px 7px;
  margin: 0;
}
.leaderboard-modal .lb-col-levels {
  text-align: center;
}
.leaderboard-modal .lb-stat-levels {
  font-size: 1.0rem;
  font-weight: 700;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.leaderboard-modal .lb-stat-levels-sub {
  display: none;
}
.leaderboard-modal .lb-col-score {
  text-align: right;
}
.leaderboard-modal .lb-score-val {
  font-size: 1.12rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--highlight);
  white-space: nowrap;
}

/* Silver asset aperture preservation */
.frame-silver-crown > :is(.avatar-photo,.avatar-letter,img) {
  position: absolute !important;
  width: 112% !important; height: 130% !important;
  max-width: none;
  left: 50%; top: 40%; transform: translate(-50%,-50%);
  object-fit: cover;
  border-radius: 50% !important;
}
.frame-silver-crown > .avatar-letter { display: flex !important; align-items: center; justify-content: center; background: inherit; }

/* Light theme colors */
body[data-theme="light"] .user-profile-card,
body[data-theme="light"] .leaderboard-modal { background: radial-gradient(ellipse at 50% 0,#e4eff7,transparent 480px),#fafcfe !important; }
body[data-theme="light"] .profile-stat-box,
body[data-theme="light"] .profile-favorite-track-box { background: #edf2f7; }

body[data-theme="light"] .leaderboard-modal .podium-card.podium-rank-1 {
  background: linear-gradient(180deg, #fff9e6 0%, #fef3c7 45%, #ffffff 100%) !important;
  border-color: #f59e0b !important;
  box-shadow: 0 12px 36px rgba(245, 158, 11, 0.15) !important;
}
body[data-theme="light"] .podium-rank-1 .podium-name { color: #78350f !important; }
body[data-theme="light"] .podium-rank-1 .podium-tier-label { color: #b45309 !important; }
body[data-theme="light"] .leaderboard-modal .podium-card.podium-rank-2 {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 45%, #ffffff 100%) !important;
  border-color: #94a3b8 !important;
  box-shadow: 0 10px 28px rgba(100, 116, 139, 0.12) !important;
}
body[data-theme="light"] .podium-rank-2 .podium-name { color: #1e293b !important; }
body[data-theme="light"] .podium-rank-2 .podium-tier-label { color: #475569 !important; }
body[data-theme="light"] .leaderboard-modal .podium-card.podium-rank-3 {
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 45%, #ffffff 100%) !important;
  border-color: #ea580c !important;
  box-shadow: 0 10px 28px rgba(194, 65, 12, 0.12) !important;
}
body[data-theme="light"] .podium-rank-3 .podium-name { color: #7c2d12 !important; }
body[data-theme="light"] .podium-rank-3 .podium-tier-label { color: #9a3412 !important; }

body[data-theme="light"] .leaderboard-modal .lb-player-row.lb-top-tier td {
  background: linear-gradient(90deg, #e0f2fe 0%, #f0f9ff 100%) !important;
  border-color: #bae6fd !important;
}
body[data-theme="light"] .leaderboard-modal .lb-player-row.lb-top-tier .lb-rank-num {
  color: #0284c7 !important;
  text-shadow: none;
}
body[data-theme="light"] .leaderboard-modal .lb-player-row.lb-standard-row:nth-child(even) td {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}
body[data-theme="light"] .leaderboard-modal .lb-player-row.lb-standard-row:nth-child(odd) td {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

/* ==========================================================================
   TABLET ADAPTATION (601px - 960px)
   ========================================================================== */
@media (max-width: 960px) and (min-width: 601px) {
  .leaderboard-modal {
    padding: 22px 20px !important;
    width: 95vw !important;
  }
  .leaderboard-modal .lb-podium-container {
    gap: 16px !important;
    margin: 14px auto 22px !important;
    max-width: 720px;
  }
  .leaderboard-modal .podium-card {
    padding: 12px 8px 0 8px !important;
  }
  .podium-rank-1 .podium-avatar-stage {
    height: 180px;
  }
  .podium-rank-2 .podium-avatar-stage,
  .podium-rank-3 .podium-avatar-stage {
    height: 150px;
  }
  .podium-rank-1 .podium-avatar {
    width: 86px !important;
    height: 86px !important;
    font-size: 1.8rem !important;
  }
  .podium-rank-2 .podium-avatar,
  .podium-rank-3 .podium-avatar {
    width: 76px !important;
    height: 76px !important;
    font-size: 1.5rem !important;
  }
  .podium-rank-1 .podium-player-details {
    margin-top: 26px !important;
  }
  .podium-rank-2 .podium-player-details,
  .podium-rank-3 .podium-player-details {
    margin-top: 12px !important;
  }
  .podium-rank-1 .podium-name { font-size: 1.1rem !important; }
  .podium-rank-2 .podium-name,
  .podium-rank-3 .podium-name { font-size: 0.95rem !important; }
  .podium-rank-1 .podium-score { font-size: 1.3rem !important; }
  .podium-rank-2 .podium-score,
  .podium-rank-3 .podium-score { font-size: 1.15rem !important; }

  .podium-rank-1 .podium-pedestal-base { height: 46px; }
  .podium-rank-2 .podium-pedestal-base { height: 35px; }
  .podium-rank-3 .podium-pedestal-base { height: 26px; }

  /* Tablet table */
  .leaderboard-modal .lb-th-rank { width: 9%; }
  .leaderboard-modal .lb-th-player { width: 50%; }
  .leaderboard-modal .lb-th-levels { width: 17%; }
  .leaderboard-modal .lb-th-score { width: 24%; }
  .leaderboard-modal .lb-table td { padding: 7px 10px; }
  .leaderboard-modal .lb-score-val { font-size: 1.02rem; }
}

/* ==========================================================================
   MOBILE ADAPTATION (<= 600px)
   ========================================================================== */
@media (max-width: 600px) {
  .user-profile-card { padding: 20px 16px !important; }
  .leaderboard-modal {
    padding: 16px 12px !important;
    width: 96vw !important;
    border-radius: 20px !important;
  }
  .leaderboard-modal .lb-header-row {
    margin-bottom: 8px;
  }
  .leaderboard-modal .lb-title {
    font-size: 1.05rem;
  }
  .leaderboard-modal .lb-limit-bar {
    margin: 4px 0 10px 0;
    gap: 5px;
  }
  .leaderboard-modal .lb-limit-btn {
    padding: 3px 9px;
    font-size: 0.72rem;
  }

  /* Mobile Podium: Same 3-in-a-row stepped Olympic pedestal design as on Desktop/Laptop! (2 - 1 - 3) */
  .leaderboard-modal .lb-podium-container {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-end !important;
    justify-content: center !important;
    gap: 5px !important;
    margin: 8px auto 14px !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .leaderboard-modal .podium-card {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    transform: none !important;
  }

  /* 2nd Place (Silver) - Left */
  .leaderboard-modal .podium-card.podium-rank-2 {
    order: 1 !important;
    flex: 1 1 0 !important;
    padding: 7px 3px 0 3px !important;
    border-radius: 14px 14px 10px 10px !important;
  }

  /* 1st Place (Champion) - Center & Elevated */
  .leaderboard-modal .podium-card.podium-rank-1 {
    order: 2 !important;
    flex: 1.16 1 0 !important;
    z-index: 5 !important;
    margin-top: -12px !important;
    padding: 8px 4px 0 4px !important;
    border-radius: 16px 16px 12px 12px !important;
  }

  /* 3rd Place (Bronze) - Right */
  .leaderboard-modal .podium-card.podium-rank-3 {
    order: 3 !important;
    flex: 1 1 0 !important;
    padding: 7px 3px 0 3px !important;
    border-radius: 14px 14px 10px 10px !important;
  }

  /* Card Header */
  .podium-card-top {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1px;
    margin-bottom: 2px;
  }
  .podium-rank-1 .podium-rank-badge {
    font-size: 0.68rem;
    padding: 1.5px 5px;
  }
  .podium-rank-2 .podium-rank-badge,
  .podium-rank-3 .podium-rank-badge {
    font-size: 0.60rem;
    padding: 1px 4px;
  }
  .podium-rank-1 .podium-tier-label {
    font-size: 0.48rem;
    letter-spacing: 0.04em;
  }
  .podium-rank-2 .podium-tier-label,
  .podium-rank-3 .podium-tier-label {
    font-size: 0.44rem;
    letter-spacing: 0.03em;
  }

  /* Avatar stages */
  .podium-rank-1 .podium-avatar-stage {
    width: 100% !important;
    height: 94px !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .podium-rank-2 .podium-avatar-stage,
  .podium-rank-3 .podium-avatar-stage {
    width: 100% !important;
    height: 78px !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .podium-rank-1 .podium-avatar {
    width: 52px !important;
    height: 52px !important;
    font-size: 1.25rem !important;
  }
  .podium-rank-2 .podium-avatar,
  .podium-rank-3 .podium-avatar {
    width: 44px !important;
    height: 44px !important;
    font-size: 1.05rem !important;
  }

  /* Player details */
  .podium-rank-1 .podium-player-details {
    margin-top: 8px !important;
    width: 100% !important;
    text-align: center !important;
    align-items: center !important;
    z-index: 6;
  }
  .podium-rank-2 .podium-player-details,
  .podium-rank-3 .podium-player-details {
    margin-top: 6px !important;
    width: 100% !important;
    text-align: center !important;
    align-items: center !important;
    z-index: 6;
  }

  .podium-rank-1 .podium-name {
    font-size: 0.78rem !important;
    font-weight: 700;
    text-align: center !important;
    margin: 0 0 1px 0;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
  }
  .podium-rank-2 .podium-name,
  .podium-rank-3 .podium-name {
    font-size: 0.72rem !important;
    font-weight: 600;
    text-align: center !important;
    margin: 0 0 1px 0;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
  }

  .podium-title-wrap {
    min-height: 0;
    margin: 0 0 2px 0;
    display: flex;
    justify-content: center !important;
    width: 100%;
  }
  .podium-rank-1 .podium-title-badge {
    font-size: 0.50rem;
    padding: 1px 3px;
    max-width: 95%;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .podium-rank-2 .podium-title-badge,
  .podium-rank-3 .podium-title-badge {
    font-size: 0.46rem;
    padding: 1px 3px;
    max-width: 95%;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .podium-score-wrap {
    margin-bottom: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
  }
  .podium-rank-1 .podium-score {
    font-size: 0.84rem !important;
    font-weight: 800 !important;
    line-height: 1.1;
  }
  .podium-rank-2 .podium-score,
  .podium-rank-3 .podium-score {
    font-size: 0.74rem !important;
    font-weight: 700 !important;
    line-height: 1.1;
  }
  .podium-rank-1 .podium-levels {
    font-size: 0.58rem;
    margin-top: 1px;
    line-height: 1.1;
  }
  .podium-rank-2 .podium-levels,
  .podium-rank-3 .podium-levels {
    font-size: 0.54rem;
    margin-top: 1px;
    line-height: 1.1;
  }

  /* Stepped Pedestal Bases on Mobile */
  .podium-rank-1 .podium-pedestal-base {
    display: flex !important;
    height: 28px !important;
    margin: 3px -4px 0 -4px;
    width: calc(100% + 8px);
    border-radius: 0 0 12px 12px;
  }
  .podium-rank-1 .podium-base-num { font-size: 0.98rem; }

  .podium-rank-2 .podium-pedestal-base {
    display: flex !important;
    height: 22px !important;
    margin: 2px -3px 0 -3px;
    width: calc(100% + 6px);
    border-radius: 0 0 10px 10px;
  }
  .podium-rank-2 .podium-base-num { font-size: 0.88rem; }

  .podium-rank-3 .podium-pedestal-base {
    display: flex !important;
    height: 16px !important;
    margin: 2px -3px 0 -3px;
    width: calc(100% + 6px);
    border-radius: 0 0 10px 10px;
  }
  .podium-rank-3 .podium-base-num { font-size: 0.78rem; }

  /* Mobile Table: Exact Laptop/Desktop 4-column tabular design */
  .leaderboard-modal .lb-table {
    display: table !important;
    width: 100% !important;
    border-spacing: 0 5px !important;
    border-collapse: separate !important;
    table-layout: fixed !important;
  }
  .leaderboard-modal .lb-table thead {
    display: table-header-group !important;
  }
  .leaderboard-modal .lb-table thead th {
    padding: 6px 3px !important;
    font-size: 0.58rem !important;
    letter-spacing: 0.04em !important;
    color: var(--text-secondary);
  }
  .leaderboard-modal .lb-th-rank { width: 9% !important; text-align: center !important; }
  .leaderboard-modal .lb-th-player { width: 49% !important; text-align: left !important; }
  .leaderboard-modal .lb-th-levels { width: 16% !important; text-align: center !important; }
  .leaderboard-modal .lb-th-score { width: 26% !important; text-align: right !important; }

  .leaderboard-modal .lb-table tbody {
    display: table-row-group !important;
    width: 100% !important;
  }
  .leaderboard-modal .lb-player-row {
    display: table-row !important;
  }
  .leaderboard-modal .lb-table td {
    display: table-cell !important;
    padding: 5px 3px !important;
    vertical-align: middle !important;
  }
  .leaderboard-modal .lb-table td:first-child {
    border-radius: 10px 0 0 10px !important;
  }
  .leaderboard-modal .lb-table td:last-child {
    border-radius: 0 10px 10px 0 !important;
  }

  /* Rank cell */
  .leaderboard-modal .lb-col-rank {
    text-align: center !important;
  }
  .leaderboard-modal .lb-rank-num {
    font-size: 0.80rem !important;
  }

  /* Player cell */
  .leaderboard-modal .lb-col-player {
    text-align: left !important;
  }
  .leaderboard-modal .lb-player-cell {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    min-width: 0 !important;
  }
  .lb-avatar-stage {
    width: 48px !important;
    height: 48px !important;
    flex: 0 0 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
  }
  .lb-avatar-stage:has(.frame-champion-crown) {
    width: 60px !important;
    height: 60px !important;
    flex-basis: 60px !important;
  }
  .leaderboard-modal .lb-avatar-mini {
    width: 30px !important;
    height: 30px !important;
    flex: 0 0 30px !important;
    font-size: 0.82rem !important;
  }
  .lb-player-info {
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 1px !important;
  }
  .leaderboard-modal .lb-player-name {
    font-size: 0.78rem !important;
    line-height: 1.25 !important;
    font-weight: 700 !important;
  }
  .leaderboard-modal .lb-player-title-box .user-title-badge {
    font-size: 0.48rem !important;
    padding: 1px 4px !important;
    max-width: 80px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Levels cell */
  .leaderboard-modal .lb-col-levels {
    text-align: center !important;
  }
  .leaderboard-modal .lb-stat-levels {
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    color: var(--text-secondary) !important;
  }
  .leaderboard-modal .lb-stat-levels-sub {
    display: none !important;
  }

  /* Score cell */
  .leaderboard-modal .lb-col-score {
    text-align: right !important;
  }
  .leaderboard-modal .lb-score-val {
    font-size: 0.82rem !important;
    font-weight: 800 !important;
  }

  .user-profile-stats-grid .profile-stat-box {
    padding: 12px 10px;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 3px 7px;
  }
  .user-profile-stats-grid .stat-box-val { font-size: 1.1rem; }
}

@media (prefers-reduced-motion:reduce) {
  .leaderboard-modal .podium-card,
  .leaderboard-modal .lb-player-row {
    transition: none !important;
  }
}

@media (prefers-reduced-motion:reduce) {
  .leaderboard-modal .podium-card,
  .leaderboard-modal .lb-player-row {
    transition: none !important;
  }
}
