/* =========================================================
   REALBOT LEADERBOARD
   Full replacement for css/nfsleaderboard.css
   Visual language: Realbot control centre — navy / cyan / violet
========================================================= */

:root {
  --rb-bg: #050811;
  --rb-bg-deep: #03050a;
  --rb-panel: rgba(10, 16, 29, 0.88);
  --rb-panel-strong: rgba(12, 20, 35, 0.96);
  --rb-panel-soft: rgba(255, 255, 255, 0.038);
  --rb-panel-hover: rgba(255, 255, 255, 0.07);
  --rb-text: #eef5ff;
  --rb-muted: #93a3bb;
  --rb-muted-2: #68768d;
  --rb-line: rgba(145, 174, 218, 0.16);
  --rb-line-strong: rgba(145, 174, 218, 0.30);
  --rb-cyan: #54c8ff;
  --rb-cyan-soft: rgba(84, 200, 255, 0.16);
  --rb-violet: #8b6cff;
  --rb-violet-soft: rgba(139, 108, 255, 0.15);
  --rb-green: #58e6a6;
  --rb-gold: #ffd166;
  --rb-danger: #ff6b8d;
  --rb-shadow: 0 28px 74px rgba(0, 0, 0, 0.42);
  --rb-shadow-sm: 0 15px 34px rgba(0, 0, 0, 0.30);
  --rb-inset: inset 0 1px 0 rgba(255, 255, 255, 0.055), inset 0 -1px 0 rgba(0, 0, 0, 0.36);
  --r-xl: 26px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 11px;
  --r-pill: 999px;
  --maxw: 1680px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--rb-text);
  font-family: var(--font-body, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  background:
    radial-gradient(circle at 9% 0%, rgba(84, 200, 255, 0.14), transparent 30%),
    radial-gradient(circle at 95% 6%, rgba(139, 108, 255, 0.17), transparent 34%),
    radial-gradient(circle at 45% 110%, rgba(84, 200, 255, 0.065), transparent 38%),
    linear-gradient(180deg, #080d18 0%, #050812 52%, #03050a 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.82;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    radial-gradient(900px 500px at 12% 4%, rgba(84, 200, 255, 0.08), transparent 72%),
    radial-gradient(720px 470px at 84% 16%, rgba(139, 108, 255, 0.09), transparent 70%);
  background-size: 42px 42px, 42px 42px, auto, auto;
  mask-image: linear-gradient(to bottom, black, rgba(0, 0, 0, 0.7) 72%, transparent);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(84, 200, 255, 0.025), transparent 34%),
    linear-gradient(285deg, rgba(139, 108, 255, 0.03), transparent 36%);
}

img {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(84, 200, 255, 0.9);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

/* =========================================================
   Loader
========================================================= */
#loaderScreen {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 6, 12, 0.88);
  backdrop-filter: blur(14px);
}

.loader-box {
  width: min(440px, 92vw);
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--rb-line-strong);
  border-radius: 22px;
  background:
    radial-gradient(circle at 100% 0%, rgba(139, 108, 255, 0.16), transparent 46%),
    radial-gradient(circle at 0% 100%, rgba(84, 200, 255, 0.13), transparent 48%),
    linear-gradient(180deg, rgba(16, 25, 43, 0.98), rgba(7, 11, 21, 0.98));
  box-shadow: var(--rb-shadow);
}

.loader-title {
  font-family: var(--font-display, ui-sans-serif, system-ui, sans-serif);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.loader-sub,
.loader-status {
  margin-top: 6px;
  color: var(--rb-muted);
  font-size: 13px;
}

.loader-bar-wrap {
  height: 9px;
  margin: 19px 0 9px;
  overflow: hidden;
  border: 1px solid var(--rb-line);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.05);
}

.loader-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rb-cyan), var(--rb-violet));
  box-shadow: 0 0 18px rgba(84, 200, 255, 0.48);
  transition: width 0.2s ease;
}

/* =========================================================
   Main shell
========================================================= */
main.content {
  width: min(96vw, var(--maxw));
  max-width: var(--maxw);
  margin: 0 auto 72px;
  padding: 30px 0 46px;
}

.lb-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.lb-main {
  min-width: 0;
}

.lb-sidebar {
  position: sticky;
  top: 18px;
  z-index: 30;
  align-self: start;
}

.lb-side-card,
.leaderboard-header-box,
.leaderboard-toolbar,
.track-card,
#playerSearchPanel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--rb-line);
  border-radius: var(--r-xl);
  background:
    linear-gradient(180deg, rgba(20, 31, 52, 0.74), rgba(7, 12, 23, 0.92)),
    var(--rb-panel);
  box-shadow: var(--rb-shadow-sm);
  backdrop-filter: blur(16px);
}

.lb-side-card::before,
.leaderboard-header-box::before,
.leaderboard-toolbar::before,
.track-card::before,
#playerSearchPanel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.65;
  background:
    linear-gradient(120deg, rgba(84, 200, 255, 0.08), transparent 30%),
    linear-gradient(300deg, rgba(139, 108, 255, 0.08), transparent 32%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012), rgba(255, 255, 255, 0.012) 1px, transparent 1px, transparent 5px);
}

.lb-side-card {
  padding: 14px;
}

.back-link {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--rb-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: var(--rb-inset);
  color: var(--rb-text);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.back-link:hover {
  transform: translateY(-1px);
  border-color: rgba(84, 200, 255, 0.48);
  background: linear-gradient(135deg, rgba(84, 200, 255, 0.12), rgba(139, 108, 255, 0.10));
}

.lb-side-intro {
  position: relative;
  z-index: 1;
  padding: 20px 4px 8px;
}

.lb-side-kicker,
.lb-header-kicker,
.lb-panel-title,
.lb-stat-label,
.track-sub,
.meta-chip,
.wr-badge,
.ps-sub,
.loader-sub,
.loader-status {
  color: var(--rb-muted);
}

.lb-side-kicker,
.lb-header-kicker,
.lb-panel-title,
.lb-stat-label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lb-side-title {
  margin-top: 8px;
  font-family: var(--font-display, ui-sans-serif, system-ui, sans-serif);
  font-size: 29px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -0.05em;
}

.lb-side-intro p {
  margin: 10px 0 0;
  color: var(--rb-muted);
  font-size: 13px;
  line-height: 1.5;
}

.lb-side-block {
  position: relative;
  z-index: 1;
  margin-top: 18px;
}

.lb-panel-title {
  margin: 0 0 10px;
  padding-left: 4px;
}

/* =========================================================
   Sidebar mode / tier controls
========================================================= */
.mode-switcher--stack,
.tier-switcher--stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.mode-switcher button,
.tier-switcher button,
.platform-quick-filter button,
.track-platform-link,
.player-search-cta,
.player-search-cta-small,
.ps-close-btn,
.track-expand-btn {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.mode-switcher--stack button,
.tier-switcher--stack button {
  position: relative;
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: var(--rb-inset);
  color: var(--rb-muted);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.mode-switcher--stack button::before,
.tier-switcher--stack button::before {
  content: "";
  width: 3px;
  align-self: stretch;
  margin: 8px 0;
  border-radius: var(--r-pill);
  background: transparent;
}

.mode-switcher--stack button:hover,
.tier-switcher--stack button:hover {
  transform: translateX(2px);
  border-color: var(--rb-line);
  background: rgba(255, 255, 255, 0.052);
  color: var(--rb-text);
}

.mode-switcher--stack button.active,
.tier-switcher--stack button.active {
  border-color: rgba(84, 200, 255, 0.42);
  background: linear-gradient(135deg, rgba(84, 200, 255, 0.16), rgba(139, 108, 255, 0.13));
  box-shadow: inset 3px 0 0 var(--rb-cyan), var(--rb-inset), 0 10px 24px rgba(0, 0, 0, 0.18);
  color: #fff;
}

.mode-switcher--stack button.active::before,
.tier-switcher--stack button.active::before {
  background: linear-gradient(var(--rb-cyan), var(--rb-violet));
}

.mode-mini-icon,
.tier-icon,
.platform-mini-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  object-fit: contain;
}

.player-search-cta,
.player-search-cta-small,
.ps-close-btn,
.track-expand-btn {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid rgba(84, 200, 255, 0.42);
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(84, 200, 255, 0.24), rgba(139, 108, 255, 0.23));
  box-shadow: var(--rb-inset), 0 12px 27px rgba(0, 0, 0, 0.2);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  transition: transform 0.16s ease, filter 0.16s ease, border-color 0.16s ease;
}

.player-search-cta:hover,
.player-search-cta-small:hover,
.ps-close-btn:hover,
.track-expand-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.12);
  border-color: rgba(84, 200, 255, 0.72);
}

.player-search-cta--hero {
  width: 100%;
}

/* =========================================================
   Header / telemetry
========================================================= */
.leaderboard-header-box {
  margin-bottom: 18px;
}

.lb-header-hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 20px;
  padding: 26px;
}

.lb-header-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 5px 0;
}

.lb-title-logo-wrap {
  margin-top: 8px;
}

.lb-title-logo {
  width: min(500px, 100%);
  display: block;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.34));
}

.lb-subline {
  max-width: 650px;
  margin-top: 10px;
  color: rgba(238, 245, 255, 0.72);
  font-size: 15px;
  font-style: italic;
}

.lb-filter-readout {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 21px;
}

.lb-filter-readout span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--rb-line);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: var(--rb-inset);
  color: var(--rb-muted);
  font-size: 12px;
}

.lb-filter-readout strong {
  color: var(--rb-text);
}

.lb-header-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.lb-stat-card {
  position: relative;
  min-height: 102px;
  overflow: hidden;
  padding: 17px;
  border: 1px solid var(--rb-line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(84, 200, 255, 0.08), rgba(139, 108, 255, 0.055)), rgba(255, 255, 255, 0.026);
  box-shadow: var(--rb-inset);
}

.lb-stat-card::after {
  content: "";
  position: absolute;
  right: 15px;
  bottom: 0;
  left: 15px;
  height: 3px;
  border-radius: var(--r-pill) var(--r-pill) 0 0;
  background: linear-gradient(90deg, var(--rb-cyan), var(--rb-violet));
  opacity: 0.92;
}

.lb-stat-value {
  margin-top: 11px;
  color: #fff;
  font-family: var(--font-display, ui-sans-serif, system-ui, sans-serif);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
  font-weight: 950;
  letter-spacing: -0.06em;
}

.lb-stat-value--sync {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 28px;
}

.sync-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rb-green);
  box-shadow: 0 0 18px rgba(88, 230, 166, 0.78);
}

/* =========================================================
   Filter toolbar
========================================================= */
.leaderboard-toolbar {
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding: 11px;
  border-radius: 18px;
}

.track-filter-shell {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
}

.track-filter-icon {
  position: absolute;
  left: 14px;
  z-index: 1;
  color: var(--rb-muted);
  pointer-events: none;
}

#trackFilterInput,
#playerSearch {
  color: var(--rb-text);
}

#trackFilterInput {
  width: 100%;
  min-height: 46px;
  padding: 0 14px 0 38px;
  border: 1px solid var(--rb-line);
  border-radius: 13px;
  outline: 0;
  background: rgba(4, 8, 16, 0.54);
  box-shadow: var(--rb-inset);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

#trackFilterInput:hover {
  border-color: var(--rb-line-strong);
}

#trackFilterInput:focus {
  border-color: rgba(84, 200, 255, 0.68);
  background: rgba(4, 8, 16, 0.72);
  box-shadow: 0 0 0 3px rgba(84, 200, 255, 0.11), var(--rb-inset);
}

#trackFilterInput::placeholder,
#playerSearch::placeholder {
  color: rgba(238, 245, 255, 0.42);
}

.platform-quick-filter,
.track-platform-inline {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.platform-quick-filter .track-platform-link,
.track-platform-inline .track-platform-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--rb-line);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.026);
  box-shadow: var(--rb-inset);
  color: var(--rb-muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.platform-quick-filter img,
.track-platform-inline img,
.player-platform-icon,
.meta-platform-icon {
  width: 15px;
  height: 15px;
  object-fit: contain;
}

.platform-quick-filter .track-platform-link:hover,
.track-platform-inline .track-platform-link:hover,
.platform-quick-filter .track-platform-link.active,
.track-platform-inline .track-platform-link.active {
  border-color: rgba(84, 200, 255, 0.48);
  background: linear-gradient(135deg, rgba(84, 200, 255, 0.14), rgba(139, 108, 255, 0.13));
  color: #fff;
}

/* =========================================================
   Track cards / leaderboards
========================================================= */
#leaderboards {
  position: relative;
}

.track-card {
  margin: 0 0 16px;
  border-radius: 20px;
}

.track-card:hover {
  border-color: rgba(84, 200, 255, 0.28);
}

.track-inner {
  position: relative;
  z-index: 1;
  padding: 16px;
}

.track-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.track-heading-left {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.track-icon {
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(84, 200, 255, 0.30);
  border-radius: 16px;
  background:
    radial-gradient(circle at 30% 10%, rgba(84, 200, 255, 0.21), transparent 56%),
    linear-gradient(145deg, rgba(139, 108, 255, 0.14), rgba(255, 255, 255, 0.025));
  box-shadow: var(--rb-inset), 0 12px 24px rgba(0, 0, 0, 0.2);
}

.track-icon img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.track-title-wrap {
  min-width: 0;
}

.track-title {
  max-width: 760px;
  overflow: hidden;
  color: #fff;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-display, ui-sans-serif, system-ui, sans-serif);
  font-size: clamp(19px, 2.2vw, 28px);
  line-height: 1.06;
  font-weight: 950;
  letter-spacing: -0.045em;
}

.track-link {
  transition: color 0.16s ease;
}

.track-link:hover {
  color: var(--rb-cyan);
}

.track-sub {
  margin-top: 5px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.track-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

.meta-chip,
.wr-badge {
  min-height: 33px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--rb-line);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: var(--rb-inset);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.meta-chip strong {
  color: #fff;
}

.track-table-wrapper {
  overflow: hidden;
  border: 1px solid var(--rb-line);
  border-radius: 17px;
  background: rgba(2, 5, 11, 0.38);
  box-shadow: var(--rb-inset);
}

.track-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--rb-text);
  font-size: 14px;
}

.track-table th,
.track-table td {
  padding: 12px;
  text-align: left;
  vertical-align: middle;
  font-feature-settings: "tnum" 1;
}

.track-table thead {
  background: rgba(255, 255, 255, 0.045);
}

.track-table th {
  color: var(--rb-muted);
  border-bottom: 1px solid var(--rb-line);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.track-table tbody td {
  border-bottom: 1px solid rgba(145, 174, 218, 0.095);
}

.track-table tbody tr:last-child td {
  border-bottom: 0;
}

.track-table tbody tr {
  transition: background 0.15s ease;
}

.track-table tbody tr:hover td {
  background: rgba(84, 200, 255, 0.055);
}

.track-table tbody tr:first-child td {
  background: linear-gradient(90deg, rgba(84, 200, 255, 0.11), rgba(139, 108, 255, 0.07), transparent);
}

.track-table tbody tr:first-child td:first-child {
  color: var(--rb-cyan);
  font-weight: 950;
}

.fav-row-highlight td {
  background: rgba(255, 209, 102, 0.07) !important;
}

.player-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.player-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  object-fit: cover;
  border: 1px solid rgba(145, 174, 218, 0.35);
  border-radius: 50%;
  background: #0b1220;
  box-shadow: 0 8px 19px rgba(0, 0, 0, 0.36);
}

.player-name-wrap {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.player-name {
  max-width: 220px;
  overflow: hidden;
  color: var(--rb-text);
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 800;
  transition: color 0.15s ease;
}

.player-name:hover {
  color: var(--rb-cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.delta-wr {
  color: var(--rb-cyan);
  font-weight: 950;
}

.delta-plus {
  color: var(--rb-muted);
}

.car-cell,
.track-table td:nth-child(5) {
  max-width: 260px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.run-media-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.run-media-btn,
.shot-trigger,
.screenshot-modal-close,
.player-search-clear {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.run-media-btn {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 9px;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
}

.run-media-btn img {
  width: 18px;
  height: 18px;
  display: block;
  opacity: 0.78;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.6));
}

.run-media-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(84, 200, 255, 0.34);
  background: rgba(84, 200, 255, 0.08);
}

.run-media-btn:hover img {
  opacity: 1;
}

/* =========================================================
   Screenshot modal
========================================================= */
.screenshot-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(2, 5, 10, 0.9);
  backdrop-filter: blur(12px);
}

.screenshot-modal-inner {
  position: relative;
  max-width: 96vw;
  max-height: 92vh;
}

#screenshotModalImg {
  display: block;
  max-width: 96vw;
  max-height: 92vh;
  border: 1px solid var(--rb-line-strong);
  border-radius: 15px;
  background: #020409;
  box-shadow: var(--rb-shadow);
}

.screenshot-modal-close {
  position: absolute;
  top: -47px;
  right: 0;
  width: 38px;
  height: 38px;
  border: 1px solid var(--rb-line);
  border-radius: 12px;
  background: rgba(13, 21, 37, 0.85);
  color: #fff;
  font-size: 18px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.screenshot-modal-close:hover {
  border-color: rgba(84, 200, 255, 0.55);
  background: linear-gradient(135deg, rgba(84, 200, 255, 0.18), rgba(139, 108, 255, 0.16));
}

/* =========================================================
   Player search overlay
========================================================= */
#playerSearchOverlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 20px 40px;
  background: rgba(2, 5, 10, 0.82);
  backdrop-filter: blur(11px);
}

#playerSearchPanel {
  width: min(940px, 100%);
  max-height: 76vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
}

.ps-header-row,
.ps-search-row,
.pr-name-line {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ps-title {
  font-family: var(--font-display, ui-sans-serif, system-ui, sans-serif);
  font-size: 22px;
  font-weight: 950;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.player-search-shell {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--rb-line);
  border-radius: 13px;
  background: rgba(4, 8, 16, 0.57);
  box-shadow: var(--rb-inset);
}

.player-search-shell:focus-within {
  border-color: rgba(84, 200, 255, 0.64);
  box-shadow: 0 0 0 3px rgba(84, 200, 255, 0.10), var(--rb-inset);
}

.player-search-icon {
  color: var(--rb-muted);
}

#playerSearch {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-weight: 750;
}

#playerSearchResults {
  position: relative;
  z-index: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.ps-empty {
  padding: 16px 4px;
  color: var(--rb-muted);
}

.player-result-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--rb-line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.031);
  box-shadow: var(--rb-inset);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.player-result-card:hover {
  transform: translateY(-1px);
  border-color: rgba(84, 200, 255, 0.45);
  background: linear-gradient(135deg, rgba(84, 200, 255, 0.10), rgba(139, 108, 255, 0.08));
}

.pr-avatar-wrap,
.pr-avatar-wrap img {
  width: 58px;
  height: 58px;
  border-radius: 50%;
}

.pr-avatar-wrap {
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--rb-line-strong);
  background: #0a1020;
}

.pr-avatar-wrap img {
  object-fit: cover;
}

.pr-main {
  min-width: 0;
  flex: 1;
}

.pr-name {
  color: #fff;
  font-size: 17px;
  font-weight: 900;
}

.pr-tag {
  padding: 6px 9px;
  border: 1px solid var(--rb-line);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.042);
  color: var(--rb-muted);
  font-size: 11px;
}

/* =========================================================
   Crew rail
========================================================= */
#crewMenu {
  position: fixed;
  top: 50%;
  right: 16px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--rb-line);
  border-radius: 22px;
  background: rgba(7, 12, 23, 0.82);
  box-shadow: var(--rb-shadow-sm);
  backdrop-filter: blur(13px);
  transform: translateY(-50%);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.crew-btn {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.crew-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
  filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.62));
}

.crew-btn:hover {
  transform: scale(1.06);
  border-color: rgba(84, 200, 255, 0.45);
  background: rgba(84, 200, 255, 0.08);
}

.crew-btn.active {
  border-color: rgba(84, 200, 255, 0.66);
  background: linear-gradient(135deg, rgba(84, 200, 255, 0.17), rgba(139, 108, 255, 0.16));
  box-shadow: 0 0 22px rgba(84, 200, 255, 0.22);
}

.crew-btn.active img {
  filter: drop-shadow(0 0 13px rgba(84, 200, 255, 0.82)) drop-shadow(0 8px 15px rgba(0, 0, 0, 0.66));
}

#crewMenu::before {
  content: "✕";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rb-cyan), var(--rb-violet));
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}

#crewMenu:hover::before {
  opacity: 1;
}

#crewMenu.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(84px);
}

#crewMenuReopen {
  position: fixed;
  top: 50%;
  right: 14px;
  z-index: 1300;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--rb-cyan);
  box-shadow: 0 0 18px rgba(84, 200, 255, 0.66);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
}

#crewMenu.is-hidden ~ #crewMenuReopen {
  opacity: 1;
  pointer-events: auto;
}

/* =========================================================
   Empty / error states
========================================================= */
#leaderboards > p {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--rb-line);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(84, 200, 255, 0.055), rgba(139, 108, 255, 0.045));
  box-shadow: var(--rb-inset);
  color: var(--rb-muted) !important;
}

/* =========================================================
   Scrollbars
========================================================= */
::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

::-webkit-scrollbar-track {
  background: rgba(1, 3, 7, 0.58);
}

::-webkit-scrollbar-thumb {
  border: 3px solid rgba(1, 3, 7, 0.58);
  border-radius: var(--r-pill);
  background: rgba(145, 174, 218, 0.27);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(84, 200, 255, 0.46);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(145, 174, 218, 0.27) rgba(1, 3, 7, 0.58);
}

/* =========================================================
   Responsive
========================================================= */
@media (max-width: 1180px) {
  .lb-shell {
    grid-template-columns: 1fr;
  }

  .lb-sidebar {
    position: relative;
    top: 0;
  }

  .mode-switcher--stack,
  .tier-switcher--stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lb-header-hero {
    grid-template-columns: 1fr;
  }

  .lb-header-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  main.content {
    width: min(100% - 24px, var(--maxw));
    padding-top: 18px;
  }

  .leaderboard-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .platform-quick-filter {
    justify-content: flex-start;
  }

  .track-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .track-meta {
    justify-content: flex-start;
  }

  .track-table-wrapper {
    overflow-x: auto;
  }

  .track-table {
    min-width: 760px;
  }

  #crewMenu {
    top: auto;
    right: auto;
    bottom: 14px;
    left: 50%;
    flex-direction: row;
    border-radius: var(--r-pill);
    transform: translateX(-50%);
  }

  .crew-btn {
    width: 46px;
    height: 46px;
  }

  #crewMenu.is-hidden {
    transform: translateX(-50%) translateY(110px);
  }

  #crewMenuReopen {
    top: auto;
    right: 18px;
    bottom: 18px;
    transform: none;
  }
}

@media (max-width: 580px) {
  .mode-switcher--stack,
  .tier-switcher--stack,
  .lb-header-stats {
    grid-template-columns: 1fr;
  }

  .lb-side-card,
  .leaderboard-header-box,
  .leaderboard-toolbar,
  .track-card {
    border-radius: 19px;
  }

  .lb-header-hero {
    padding: 18px;
  }

  .lb-title-logo {
    width: min(410px, 100%);
  }

  .lb-subline {
    font-size: 14px;
  }

  .ps-header-row,
  .ps-search-row,
  .pr-name-line {
    flex-direction: column;
    align-items: stretch;
  }

  .track-inner {
    padding: 13px;
  }

  .track-meta {
    gap: 6px;
  }
}


/* =========================================================
   REALBOT LEADERBOARD V2 — FLAT CONTROL-CENTRE SURFACES
   Removes the noisy table gradients and keeps visual hierarchy
   in borders, spacing, and restrained cyan accents.
========================================================= */
body {
  background: #060a12;
}

body::before {
  opacity: .42;
  background-image:
    radial-gradient(900px 540px at 12% 0%, rgba(84, 200, 255, .075), transparent 72%),
    radial-gradient(680px 440px at 88% 4%, rgba(139, 108, 255, .065), transparent 72%);
  background-size: auto;
  mask-image: none;
}

body::after {
  display: none;
}

.lb-side-card,
.leaderboard-header-box,
.leaderboard-toolbar,
.track-card,
#playerSearchPanel {
  background: rgba(10, 16, 29, .96);
  box-shadow: 0 16px 42px rgba(0, 0, 0, .22);
}

.lb-side-card::before,
.leaderboard-header-box::before,
.leaderboard-toolbar::before,
.track-card::before,
#playerSearchPanel::before {
  display: none;
}

.back-link,
.mode-switcher--stack button,
.tier-switcher--stack button,
.player-search-cta,
.player-search-cta-small,
.ps-close-btn,
.track-expand-btn,
.lb-stat-card,
.track-icon,
.platform-quick-filter .track-platform-link,
.track-platform-inline .track-platform-link,
.player-result-card {
  background-image: none;
}

.player-search-cta,
.player-search-cta-small,
.ps-close-btn,
.track-expand-btn {
  border-color: rgba(84, 200, 255, .5);
  background: rgba(84, 200, 255, .13);
}

.mode-switcher--stack button.active,
.tier-switcher--stack button.active,
.platform-quick-filter .track-platform-link.active,
.track-platform-inline .track-platform-link.active {
  background: rgba(84, 200, 255, .12);
  border-color: rgba(84, 200, 255, .5);
  box-shadow: inset 3px 0 0 var(--rb-cyan), var(--rb-inset);
}

.lb-stat-card {
  background: rgba(255, 255, 255, .032);
}

.lb-stat-card::after {
  background: var(--rb-cyan);
  opacity: .7;
}

.track-icon {
  background: rgba(84, 200, 255, .065);
}

.track-table-wrapper {
  background: rgba(3, 7, 14, .52);
}

.track-table thead {
  background: rgba(255, 255, 255, .03);
}

.track-table tbody tr {
  background: transparent;
}

.track-table tbody tr:hover td {
  background: rgba(84, 200, 255, .04);
}

.track-table tbody tr:first-child td {
  background: rgba(84, 200, 255, .045);
}

.track-table tbody tr:first-child td:first-child {
  border-left: 3px solid var(--rb-cyan);
  color: var(--rb-cyan);
}

.track-table tbody td {
  background: transparent;
}

.player-avatar {
  border-color: rgba(84, 200, 255, .5);
  background: #111827;
}

.player-platform-badge {
  min-width: 26px;
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 1px solid rgba(145, 174, 218, .25);
  border-radius: 6px;
  background: rgba(255,255,255,.035);
  color: var(--rb-muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .06em;
  line-height: 1;
}

.player-platform-badge--pc {
  border-color: rgba(84, 200, 255, .42);
  color: #9de4ff;
}

.player-platform-badge--ps5 {
  border-color: rgba(139, 108, 255, .45);
  color: #c9bcff;
}

.player-platform-badge--xbox {
  border-color: rgba(88, 230, 166, .42);
  color: #aef4cf;
}

.run-media-btn {
  border-color: rgba(145, 174, 218, .22);
  background: rgba(255,255,255,.025);
}

.run-media-btn:hover {
  border-color: rgba(84, 200, 255, .58);
  background: rgba(84, 200, 255, .12);
}

.media-glyph {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  color: var(--rb-cyan);
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 12px rgba(84, 200, 255, .35);
}

.media-glyph--video {
  color: #c3b7ff;
  font-size: 14px;
}

.pr-avatar-wrap,
.pr-avatar-wrap img {
  background: #101827;
}


.platform-filter-label,
.platform-mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  min-height: 18px;
  color: var(--rb-muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .07em;
  line-height: 1;
}

.platform-mini-badge--pc { color: #9de4ff; }
.platform-mini-badge--ps5 { color: #c9bcff; }
.platform-mini-badge--xbox { color: #aef4cf; }


/* =========================================================
   SHARED REALBOT HEADER / FOOTER INTEGRATION
========================================================= */
body.nfs-leaderboard-page main.content {
  padding-top: 106px;
}

body.nfs-leaderboard-page .site-nav a[data-nav-leaderboard].active {
  color: #ffffff;
  border-color: rgba(84, 200, 255, .42);
  background: linear-gradient(135deg, rgba(84, 200, 255, .18), rgba(139, 108, 255, .16));
  box-shadow: inset 3px 0 0 rgba(84, 200, 255, .92);
}

@media (max-width: 820px) {
  body.nfs-leaderboard-page main.content {
    padding-top: 88px;
  }
}
