:root {
  --bg: #1a1a1a;
  --bg-secondary: #222222;
  --surface: #252525;
  --surface-hover: #2d2d2d;
  --border: rgba(255, 255, 255, 0.08);
  --text-main: #f9fbff;
  --text-muted: #9aa3b7;
  --accent: #d4af37;
  --accent-secondary: #8b7e1a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html {
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #d4af37, #8b7e1a);
  border-radius: 6px;
  border: 2px solid var(--surface);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #e0c968, #9b8e2a);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.3);
}

/* Firefox Scrollbar */
* {
  scrollbar-color: linear-gradient(180deg, #d4af37, #8b7e1a) var(--bg);
  scrollbar-width: thin;
}

body {
  background: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0;
}

/* ===============================
   HEADER
   =============================== */

.header {
  background: linear-gradient(135deg, rgba(37, 37, 37, 0.8), rgba(39, 39, 39, 0.8));
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  margin-bottom: 32px;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.header-left {
  flex-shrink: 0;
}

.logo {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  object-fit: cover;
}

.logo-long {
  height: 60px;
  object-fit: contain;
  width: 100%;
  filter:
    drop-shadow(0 12px 24px rgba(0, 0, 0, 0.75))
    drop-shadow(0 0 36px rgba(212, 175, 55, 0.2))
    drop-shadow(0 0 14px rgba(212, 175, 55, 0.2));
}

.header-center {
  flex: 1;
}

.header-center h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.header-center p {
  font-size: 13px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

/* ===============================
   SEARCH BAR
   =============================== */

.search-container {
  flex: 1;
  max-width: 400px;
  margin: 0 auto;
  position: relative;
}

.search-input-wrapper {
  position: relative;
  border: 2px solid rgba(212, 175, 55, 0.3);
  border-radius: 20px;
  background: rgba(37, 37, 37, 0.8);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  z-index: 5;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  background: transparent;
  border: none;
  border-radius: 20px;
  color: var(--text-main);
  font-size: 14px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search-input:hover {
  transform: scale(1.02);
}

.search-input:focus {
  transform: scale(1.04);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:-webkit-autofill,
.search-input:-webkit-autofill:hover,
.search-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-main);
  -webkit-box-shadow: 0 0 0 1000px rgba(37, 37, 37, 0.95) inset;
  box-shadow: 0 0 0 1000px rgba(37, 37, 37, 0.95) inset;
  border: 2px solid rgba(212, 175, 55, 0.3);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.3s, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.search-input:focus ~ .search-icon {
  color: #d4af37;
}

.search-input:hover ~ .search-icon {
  transform: translateY(-50%) scale(1.02);
}

.search-input:focus ~ .search-icon {
  transform: translateY(-50%) scale(1.06);
}

.search-input-wrapper:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.55);
}

.search-input-wrapper:focus-within {
  border-color: #d4af37;
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.4), inset 0 0 10px rgba(212, 175, 55, 0.1);
  transform: scale(1.04);
}

.search-results {
  position: absolute;
  top: 100%;
  transform: translateY(2px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-top: none;
  border-radius: 0 0 16px 16px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 20;
}

.search-input-wrapper {
  overflow: hidden;
}

.search-input-wrapper.open {
  overflow: visible;
}
.search-results.active {
  max-height: 500px;
  overflow-y: auto;
}

.search-results::-webkit-scrollbar {
  width: 10px;
}

.search-results::-webkit-scrollbar-track {
  background: rgba(20, 20, 20, 0.6);
  border-radius: 10px;
}

.search-results::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #444, #2c2c2c);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.35);
  transition: all 0.2s ease;
}

.search-results::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #555, #3a3a3a);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.45);
}

.search-results {
  scrollbar-color: #3a3a3a rgba(20, 20, 20, 0.6);
  scrollbar-width: thin;
}
.search-result-item {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
  cursor: pointer;
  transition: background 0.2s, transform 0.16s ease, box-shadow 0.16s ease;
}

.search-result-item:hover {
  background: rgba(212, 175, 55, 0.1);
  transform: translateX(3px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid rgba(212, 175, 55, 0.4);
  object-fit: cover;
  flex-shrink: 0;
  transition: border-color 0.2s;
}

.search-result-item:hover .search-result-avatar {
  border-color: #d4af37;
}

.search-result-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-result-name {
  color: #e7ebf5;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  transition: color 0.16s ease, text-shadow 0.16s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.search-result-tiers {
  font-size: 12px;
  color: #b7becf;
  font-weight: 600;
  transition: color 0.16s ease, text-shadow 0.16s ease;
}

.search-result-item:hover .search-result-name {
  color: #f2d572;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.55);
}

.search-result-item:hover .search-result-tiers {
  color: #e0c25d;
  text-shadow: 0 0 6px rgba(212, 175, 55, 0.35);
}

.search-rank {
  font-weight: 800;
  font-size: 14px;
  min-width: 26px;
  text-align: right;
  color: #e7ebf5;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.rank-gold { color: #f6c14e; text-shadow: 0 0 8px rgba(246, 193, 78, 0.55); }
.rank-silver { color: #cfd6e3; text-shadow: 0 0 8px rgba(207, 214, 227, 0.45); }
.rank-bronze { color: #e3a05c; text-shadow: 0 0 8px rgba(227, 160, 92, 0.45); }
.rank-runner { color: #d9c27a; text-shadow: 0 0 6px rgba(217, 194, 122, 0.35); }

.search-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, #d4af37, #8b7e1a);
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(212, 175, 55, 0.3);
}

.btn-discord {
  background: rgba(38, 196, 133, 0.18);
  color: #26c485;
  border: 1px solid rgba(38, 196, 133, 0.45);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-discord:hover {
  background: rgba(38, 196, 133, 0.28);
  border-color: rgba(38, 196, 133, 0.65);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(38, 196, 133, 0.35);
}

.btn-discord:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(38, 196, 133, 0.25);
}

.discord-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.45));
}

.small-discord-icon {
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
}

.btn-secondary {
  background: rgba(212, 175, 55, 0.15);
  color: var(--text-main);
  border: 1px solid rgba(212, 175, 55, 0.3);
}

.btn-secondary:hover {
  background: rgba(212, 175, 55, 0.25);
  border-color: rgba(212, 175, 55, 0.5);
}

.btn-admin {
  background: rgba(100, 200, 100, 0.2);
  color: #64c864;
  border: 1px solid rgba(100, 200, 100, 0.4);
}

.btn-admin:hover {
  background: rgba(100, 200, 100, 0.3);
  border-color: rgba(100, 200, 100, 0.6);
}

.btn-logout {
  background: rgba(255, 100, 100, 0.2);
  color: #ff6464;
  border: 1px solid rgba(255, 100, 100, 0.4);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-logout:hover {
  background: rgba(255, 100, 100, 0.3);
  border-color: rgba(255, 100, 100, 0.6);
}

.btn-secondary {
  background: rgba(212, 175, 55, 0.15);
  color: #e6c742;
  border: 1px solid rgba(212, 175, 55, 0.4);
}

.btn-secondary:hover {
  background: rgba(212, 175, 55, 0.25);
  border-color: rgba(212, 175, 55, 0.7);
  transform: translateY(-2px);
}

/* ===============================
   TABS
   =============================== */

.tabs-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0;
  margin-bottom: 32px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.tabs-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 8px;
  min-height: 48px;
  align-items: center;
}

.context-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.context-bar.hidden {
  display: none;
}

.server-ip-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(145deg, rgba(31, 31, 31, 0.9), rgba(22, 22, 22, 0.9));
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
  min-height: 70px;
}

.server-ip-card.animate-in {
  opacity: 0;
  transform: translateY(-50px);
  animation: tierDropFade 0.75s ease forwards;
}

.server-ip-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.server-ip-icon {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.server-ip-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.server-ip-label {
  font-size: 11px;
  letter-spacing: 0.6px;
  color: #d9d9d9;
  opacity: 0.8;
}

.server-ip-value {
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: #f3d984;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.server-ip-value:hover {
  background: rgba(212, 175, 55, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(212, 175, 55, 0.15);
}

.server-ip-value.copied {
  background: rgba(58, 209, 99, 0.2);
  border-color: rgba(58, 209, 99, 0.6);
  color: #b7ffd3;
  box-shadow: 0 0 10px rgba(58, 209, 99, 0.4);
}

.server-discord-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(88, 101, 242, 0.18);
  border: 1px solid rgba(88, 101, 242, 0.35);
  color: #cfd4ff;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
  height: 70px;
  min-width: 70px;
  justify-content: center;
  padding: 0 18px;
  position: relative;
}

.server-discord-btn.animate-in {
  opacity: 0;
  transform: translateY(-50px);
  animation: tierDropFade 0.75s ease forwards;
  animation-delay: 0ms;
}

.server-discord-btn:hover {
  background: rgba(88, 101, 242, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(88, 101, 242, 0.25);
}

.server-discord-tooltip {
  position: absolute;
  bottom: 120%;
  right: 0;
  background: rgba(26, 19, 52, 0.92);
  color: #b999ff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}

.server-discord-btn:hover .server-discord-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.server-ip-copy-icon {
  width: 14px;
  height: 14px;
  opacity: 0.85;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.server-ip-value:hover .server-ip-copy-icon {
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.35));
}

.server-ip-value .copy-text {
  display: inline-block;
}

.server-ip-value.copied .copy-text {
  visibility: visible;
}

.server-ip-tooltip {
  position: absolute;
  bottom: 120%;
  right: 0;
  background: rgba(0, 0, 0, 0.85);
  color: #f3d984;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.server-ip-value:hover .server-ip-tooltip,
.server-ip-value.copied .server-ip-tooltip {
  opacity: 1;
  transform: translateY(0);
}

#tabLoadingBar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, #d4af37, #8b7e1a);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
  transition: width 0.35s ease;
  pointer-events: none;
}

#tabActiveIndicator {
  position: absolute;
  bottom: 0;
  height: 3px;
  width: 0;
  background: #d4af37;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
  border-radius: 999px;
  transition: transform 0.25s ease, width 0.25s ease;
  pointer-events: none;
}

.tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  height: 48px;
  display: flex;
  align-items: center;
}

.tab:hover {
  color: #e6c742;
  transform: translateY(-1px);
}

.tab.active {
  color: var(--accent);
}

.tab img {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
  transition: transform 0.2s, filter 0.2s;
}

.tab:hover img,
.tab.active img {
  transform: translateY(-1px);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}

/* ===============================
   MAIN CONTENT
   =============================== */

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  margin-bottom: 60px;
}

.tiers-wrapper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  grid-auto-rows: max-content;
  width: 100%;
}

#tiersContainer {
  width: 100%;
}

#tiersContainer > .leaderboard-row {
  display: grid;
  grid-template-columns: 50px auto 1fr 1fr;
  margin-bottom: 12px;
}

.tier-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.2s;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.tier-section:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.1);
}

.tier-section.animate-in {
  opacity: 0;
  transform: translateY(-60px);
  animation: tierDropFade 0.9s ease forwards;
  animation-delay: var(--tier-delay, 0ms);
}

@keyframes tierDropFade {
  0% {
    opacity: 0;
    transform: translateY(-60px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.tier-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.18), rgba(139, 126, 26, 0.12));
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.tier-label-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  color: #f7e6b0;
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.35);
}

.tier-players {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
  flex: 1;
  overflow: hidden;
}

.tier-player-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 0 8px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.tier-player-row:hover {
  transform: translateY(-1px);
  border-color: rgba(212, 175, 55, 0.4);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.tier-player-row .tier-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
}

.tier-player-name {
  color: var(--text-main);
  font-weight: 600;
  font-size: 13px;
  overflow: visible;
  white-space: normal;
}

.tier-rank-chip {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
}

.tier-rank-high {
  color: #e6c742;
}

.tier-rank-low {
  color: #9aa3b7;
}

.tier-empty {
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
  text-align: center;
  padding: 8px 0;
}

.overall-container {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tiers-wrapper > div[style*="width: 100%"] {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tier-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.2s;
}

.tier-section:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.1);
}

.tier-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.tier-label-badge {
  background: linear-gradient(135deg, #d4af37, #8b7e1a);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 0;
}

.tier-section.tier-1 .tier-header {
  background: #3d3012;
  border-bottom-color: #5b461b;
}

.tier-section.tier-1 .tier-label-badge {
  background: linear-gradient(135deg, #f6c14e, #b4861c);
  color: #fff7d7;
}

.tier-section.tier-2 .tier-header {
  background: #2f3441;
  border-bottom-color: #434a58;
}

.tier-section.tier-2 .tier-label-badge {
  background: linear-gradient(135deg, #c7d2e2, #8f9bb0);
  color: #eef2f7;
}

.tier-section.tier-3 .tier-header {
  background: #3c291f;
  border-bottom-color: #5a3a2b;
}

.tier-section.tier-3 .tier-label-badge {
  background: linear-gradient(135deg, #e3a05c, #b96c2f);
  color: #fff3e4;
}

.tier-section.tier-4 .tier-header,
.tier-section.tier-5 .tier-header {
  background: #1f2126;
  border-bottom-color: #2b2e35;
}

.tier-section.tier-4 .tier-label-badge,
.tier-section.tier-5 .tier-label-badge {
  background: linear-gradient(135deg, #3a3f47, #2c3139);
  color: #e2e5ea;
}

.tier-players {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  flex: 1;
}

.tier-player-badge {
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: var(--accent);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* High tier (brighter background) */
.tier-player-badge.high-tier {
  background: rgba(212, 175, 55, 0.25);
  border-color: rgba(212, 175, 55, 0.6);
  color: #e6c742;
}

.tier-player-badge:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: rgba(212, 175, 55, 0.5);
  transform: translateX(4px);
}

.tier-player-badge.high-tier:hover {
  background: rgba(212, 175, 55, 0.35);
  border-color: rgba(212, 175, 55, 0.8);
}

.tier-empty {
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
  text-align: center;
  padding: 8px 0;
}

/* ===============================
   LEADERBOARD
   =============================== */

.leaderboard-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  grid-template-columns: 120px 1.7fr 3fr 110px;
  align-items: center;
  gap: 16px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  margin-bottom: 12px;
  opacity: 1;
  transform: translateX(0);
}

.leaderboard-row:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 32px rgba(212, 175, 55, 0.25), 0 0 20px rgba(212, 175, 55, 0.15);
  transform: translateX(8px) scale(1.02);
  background: var(--surface-hover);
}

/* Medal ranks styling */
.leaderboard-row.medal-gold {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.35), rgba(212, 175, 55, 0.14));
  border: 2px solid #d4af37;
  box-shadow: 0 0 24px rgba(212, 175, 55, 0.45), inset 0 0 12px rgba(212, 175, 55, 0.18);
  position: relative;
  overflow: hidden;
}

.leaderboard-row.medal-gold:hover {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.35), rgba(212, 175, 55, 0.15));
  border-color: #d4af37;
  box-shadow: 0 12px 32px rgba(212, 175, 55, 0.5), inset 0 0 15px rgba(212, 175, 55, 0.25), 0 0 30px rgba(212, 175, 55, 0.4);
  transform: translateX(8px) scale(1.02);
}

.leaderboard-row.medal-silver {
  background: linear-gradient(135deg, rgba(207, 214, 227, 0.28), rgba(207, 214, 227, 0.12));
  border: 2px solid #cfd6e3;
  box-shadow: 0 0 18px rgba(207, 214, 227, 0.45), inset 0 0 12px rgba(207, 214, 227, 0.14);
  position: relative;
  overflow: hidden;
}

.leaderboard-row.medal-silver:hover {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.3), rgba(192, 192, 192, 0.12));
  border-color: #c0c0c0;
  box-shadow: 0 12px 32px rgba(192, 192, 192, 0.5), inset 0 0 15px rgba(192, 192, 192, 0.2), 0 0 25px rgba(192, 192, 192, 0.4);
  transform: translateX(8px) scale(1.02);
}

.leaderboard-row.medal-bronze {
  background: linear-gradient(135deg, rgba(228, 164, 106, 0.3), rgba(228, 164, 106, 0.12));
  border: 2px solid #e4a46a;
  box-shadow: 0 0 18px rgba(228, 164, 106, 0.45), inset 0 0 12px rgba(228, 164, 106, 0.14);
  position: relative;
  overflow: hidden;
}

.leaderboard-row.medal-bronze:hover {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.3), rgba(205, 127, 50, 0.12));
  border-color: #cd7f32;
  box-shadow: 0 12px 32px rgba(205, 127, 50, 0.5), inset 0 0 15px rgba(205, 127, 50, 0.2), 0 0 25px rgba(205, 127, 50, 0.4);
  transform: translateX(8px) scale(1.02);
}

.leaderboard-row.medal-gold::after,
.leaderboard-row.medal-silver::after,
.leaderboard-row.medal-bronze::after {
  content: "";
  position: absolute;
  top: -40%;
  left: -35%;
  width: 70%;
  height: 180%;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0));
  transform: skewX(-18deg);
  animation: shineSweep 3.2s ease-in-out infinite;
  pointer-events: none;
}

.leaderboard-row.runner-up::after,
.leaderboard-row:not(.medal-gold):not(.medal-silver):not(.medal-bronze)::after {
  display: none;
}

/* Runner-up ranks (4-10) - subtle pastel gold/yellow */
.leaderboard-row.runner-up {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.12), rgba(212, 175, 55, 0.05));
  border: 1px solid rgba(212, 175, 55, 0.25);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.15), inset 0 0 8px rgba(212, 175, 55, 0.08);
}

.leaderboard-row.runner-up:hover {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.18), rgba(212, 175, 55, 0.08));
  border-color: rgba(212, 175, 55, 0.35);
  box-shadow: 0 12px 32px rgba(212, 175, 55, 0.2), inset 0 0 12px rgba(212, 175, 55, 0.12), 0 0 20px rgba(212, 175, 55, 0.15);
  transform: translateX(8px) scale(1.02);
}

.leaderboard-row.animate-in {
  opacity: 0;
  transform: translateX(-80px);
  animation: rowSlideFade 1.2s ease forwards;
  animation-delay: var(--row-delay, 0ms);
}

@keyframes rowSlideFade {
  0% {
    opacity: 0;
    transform: translateX(-80px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.leaderboard-rank {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 72px;
  border-radius: 14px;
  font-size: 26px;
  font-weight: 800;
  color: #e7ebf5;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.leaderboard-rank::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0));
  opacity: 0.65;
}

.leaderboard-rank::after {
  content: "";
  position: absolute;
  top: -40%;
  left: -30%;
  width: 60%;
  height: 180%;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
  transform: skewX(-18deg);
  animation: shineSweep 3s ease-in-out infinite;
  pointer-events: none;
}

.leaderboard-rank.rank-gold { color: #f6c14e; text-shadow: 0 0 10px rgba(246, 193, 78, 0.65), 0 0 18px rgba(246, 193, 78, 0.35); }
.leaderboard-rank.rank-silver { color: #d9e0ee; text-shadow: 0 0 9px rgba(217, 224, 238, 0.55), 0 0 14px rgba(217, 224, 238, 0.25); }
.leaderboard-rank.rank-bronze { color: #e4a46a; text-shadow: 0 0 9px rgba(228, 164, 106, 0.55), 0 0 14px rgba(228, 164, 106, 0.25); }
.leaderboard-rank.rank-runner { color: #d8c077; text-shadow: 0 0 6px rgba(216, 192, 119, 0.35); }

/* Keep compact/plain ranks for 11+ */
.leaderboard-row:not(.medal-gold):not(.medal-silver):not(.medal-bronze):not(.runner-up) .leaderboard-rank {
  width: auto;
  height: auto;
  padding: 0;
  background: none;
  box-shadow: none;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.45);
}

.leaderboard-row:not(.medal-gold):not(.medal-silver):not(.medal-bronze):not(.runner-up) .leaderboard-rank::before,
.leaderboard-row:not(.medal-gold):not(.medal-silver):not(.medal-bronze):not(.runner-up) .leaderboard-rank::after {
  display: none;
}

@keyframes shineSweep {
  0% { transform: translateX(-60%) skewX(-18deg); opacity: 0; }
  20% { opacity: 0.9; }
  50% { transform: translateX(140%) skewX(-18deg); opacity: 0; }
  100% { transform: translateX(140%) skewX(-18deg); opacity: 0; }
}

.player-info {
  display: flex;
  align-items: center;
  gap: 12px;
  align-self: center;
  min-width: 0;
  position: relative;
}

.player-avatar {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 2px solid var(--border);
  object-fit: cover;
  transition: all 0.2s;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.5);
}

.player-info:hover .player-avatar {
  transform: scale(1.05);
}

.player-details {
  flex: 1;
}

.player-info::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  right: 0;
  border-radius: 12px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  display: none;
}

.leaderboard-row.medal-gold .player-info::before,
.leaderboard-row.medal-silver .player-info::before,
.leaderboard-row.medal-bronze .player-info::before,
.leaderboard-row.runner-up .player-info::before {
  opacity: 0.7;
  transform: translateX(0);
  display: block;
}

.player-info:hover::before {
  opacity: 0.9;
}


.player-details h3 {
  margin-bottom: 4px;
  font-size: 15px;
}

.player-details p {
  font-size: 12px;
  color: var(--text-muted);
}

.player-tiers {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  align-self: center;
  justify-self: end;
  text-align: right;
  padding-right: 0;
}

.tier-icon-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;

  position: relative;}

.tier-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(35, 35, 35, 0.8);
  border: 1px solid rgba(212, 175, 55, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45), inset 0 0 8px rgba(212, 175, 55, 0.1);
}

.tier-icon-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  transition: all 0.3s ease;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.tier-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
}

.tier-tooltip {
  position: absolute;
  background: linear-gradient(135deg, #d4af37, #8b7e1a);
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.4);
  z-index: 1000;
  top: -45px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px) scale(0.8);
}

.tier-icon-container:hover .tier-icon-badge {
  transform: scale(1.15) translateY(-4px);
  border-color: rgba(212, 175, 55, 0.8);
  box-shadow: 0 8px 22px rgba(212, 175, 55, 0.4), inset 0 0 12px rgba(212, 175, 55, 0.2);
}

.tier-icon-container:hover .tier-icon-img {
  filter: brightness(1.3) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 6px rgba(212, 175, 55, 0.6));
}

.tier-icon-container:hover .tier-label {
  opacity: 0.6;
  font-size: 10px;
}

.tier-icon-container:hover .tier-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(-12px) scale(1);
}

.player-stats {
  display: flex;
  gap: 20px;
  text-align: right;
  justify-self: end;
  margin-left: auto;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  .leaderboard-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .player-stats {
    justify-self: start;
  }

  .stat {
    align-items: flex-start;
  }
}

/* ===============================
   MODAL
   =============================== */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 1;
  animation: fadeIn 0.3s ease-out;
  cursor: pointer;
}

.modal.show .modal-overlay {
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  background: var(--surface);
  border: 2px solid #d4af37;
  border-radius: 12px;
  max-width: 700px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  z-index: 2;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(212, 175, 55, 0.2);
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(50px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal.closing .modal-overlay {
  animation: fadeOut 0.3s ease-out forwards;
}

.modal.closing .modal-content {
  animation: slideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes slideDown {
  from {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  to {
    transform: translateY(50px) scale(0.95);
    opacity: 0;
  }
}

.modal-header {
  padding: 24px 24px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(212, 175, 55, 0.05);
}

.modal-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: #f9fbff;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 32px;
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 6px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
  flex-shrink: 0;
  position: relative;
  z-index: 100;
  pointer-events: auto;
}

.modal-close:hover {
  transform: scale(1.15);
  animation: bounceScale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bounceScale {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1.15); }
}

.modal-body {
  padding: 24px;
}

.modal-tier-card {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.modal-tier-card:hover {
  background: rgba(212, 175, 55, 0.15) !important;
  border-color: #d4af37 !important;
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.3), 0 0 20px rgba(212, 175, 55, 0.15) !important;
}

.modal-tiers-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-tier-section {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.modal-tier-label {
  font-weight: 600;
  color: var(--text-muted);
  min-width: 100px;
  font-size: 12px;
  text-transform: uppercase;
}

.modal-tier-value {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===============================
   FOOTER
   =============================== */

.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.footer p {
  margin: 0;
}

/* ===============================
   RESPONSIVE
   =============================== */

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }

  .header-center h1 {
    font-size: 24px;
  }

  .header-right {
    width: 100%;
    justify-content: center;
  }

  .tabs-container {
    padding: 0 12px;
  }

  .tiers-table th,
  .tiers-table td {
    padding: 12px 16px;
    font-size: 12px;
  }

  .tier-badge {
    padding: 3px 8px;
    font-size: 11px;
  }

  .modal-content {
    width: 95%;
  }
}

/* ===============================
   LEADERBOARD
   =============================== */

.leaderboard-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  grid-template-columns: 50px auto 1fr 1fr;
  align-items: center;
  gap: 16px;
  transition: all 0.2s;
  cursor: pointer;
}

.leaderboard-row:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.1);
}

.leaderboard-rank {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  color: var(--accent);
}

.player-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-avatar {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 2px solid var(--border);
  object-fit: cover;
  transition: all 0.2s;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.5);
}

.player-info:hover .player-avatar {
  transform: scale(1.05);
}

.player-details {
  flex: 1;
}

.player-details h3 {
  margin-bottom: 4px;
  font-size: 15px;
}

.player-details p {
  font-size: 12px;
  color: var(--text-muted);
}

.player-tiers {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.tier-icon-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tier-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(35, 35, 35, 0.8);
  border: 1px solid rgba(212, 175, 55, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 0 8px rgba(212, 175, 55, 0.1);
}

.tier-icon-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  transition: all 0.3s ease;
}

.tier-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
}

.tier-icon-container:hover .tier-icon-badge {
  transform: scale(1.15) translateY(-4px);
  border-color: rgba(212, 175, 55, 0.8);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4), inset 0 0 12px rgba(212, 175, 55, 0.2);
}

.tier-icon-container:hover .tier-icon-img {
  filter: brightness(1.3) drop-shadow(0 0 6px rgba(212, 175, 55, 0.6));
}

.tier-icon-container:hover .tier-label {
  transform: scale(1.1);
}

.player-stats {
  display: flex;
  gap: 20px;
  text-align: right;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  .leaderboard-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .player-stats {
    justify-self: start;
  }

  .stat {
    align-items: flex-start;
  }
}

/* ===============================
   MEDIA QUERIES
   =============================== */

@media (max-width: 1200px) {
  .tiers-wrapper {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 900px) {
  .tiers-wrapper {
    grid-template-columns: repeat(3, 1fr);
  }

  .header {
    margin-bottom: 20px;
  }

  .logo {
    width: 48px;
    height: 48px;
  }

  .header-center h1 {
    font-size: 20px;
  }

  .header-center p {
    font-size: 12px;
  }

  .btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .tiers-table th,
  .tiers-table td {
    padding: 10px 12px;
    font-size: 11px;
  }
}

@media (max-width: 600px) {
  .tiers-wrapper {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .tier-section {
    border-radius: 8px;
  }

  .tier-header {
    padding: 12px 12px;
  }

  .tier-label-badge {
    padding: 6px 12px;
    font-size: 12px;
    margin-bottom: 6px;
  }

  .tier-players {
    padding: 12px;
    gap: 6px;
  }

  .tier-player-badge {
    padding: 8px 10px;
    font-size: 11px;
  }

  .tier-badge {
    padding: 3px 8px;
    font-size: 11px;
  }

  .modal-content {
    width: 95%;
  }
}

@media (max-width: 480px) {
  .tiers-wrapper {
    grid-template-columns: 1fr;
  }
}
.leaderboard-row:not(.medal-gold):not(.medal-silver):not(.medal-bronze):not(.runner-up) .player-info::before {
  display: none !important;
}
