*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
  --bg:#0d0e14;
  --surface:#13161e;
  --surface2:#181c26;
  --border:#1f2433;
  --border2:#252c3d;
  --accent:#ff7700;
  --accent-glow:#963f0530;
  --text:#e8ecf4;
  --muted:#5a5d78;
  --muted2:#3d3d60;
  --ht1:#ffd700;--ht1b:#ffd70018;
  --lt1:#ffd700;--lt1b:#ffd70010;
  --t1muted:#ffd70080;
  --ht2:#c4c4c4;--ht2b:#c4c4c418;
  --lt2:#c4c4c4;--lt2b:#c4c4c410;
  --t2muted:#c4c4c480;
  --ht3:#CE8946;--ht3b:#CE894618;
  --lt3:#CE8946;--lt3b:#CE894610;
  --t3muted:#CE894680;
  --ht4:#474747;--ht4b:#47474718;
  --lt4:#474747;--lt4b:#47474710;
  --ht5:#474747;--ht5b:#47474708;
  --lt5:#474747;--lt5b:#47474706;
  --r:#ef4444;--rb:#ef444418;
  --cgm: linear-gradient(135deg, #FFD700, #FFF176, #FFB300);
  --cgm-glow: #ffdc0030;
  --cm:#fffc5b;--cm-glow:#fffc5b30;
  --ca:#ff8585;--ca-glow:#ff858530;
  --cs:#e66bff;--cs-glow:#e66bff30;
  --cc:#8b5cf6;--cc-glow:#8b5cf630;
  --cn:#0ea5e9;--cn-glow:#0ea5e930;
  --cr:#acacac;--rk-glow:#acacac30;
  --NA:#3b83f641;
  --EU:#10b98141;
  --SA:#f59e0b41;
  --AS:#8b5cf641;
  --AU:#ec489941;
}
html,body{height:100%;background:var(--bg);color:var(--text);font-family:'Outfit',sans-serif;font-size:14px;overflow-x:hidden;overflow-y:auto}
::-webkit-scrollbar{width:5px;height:5px}
::-webkit-scrollbar-track{background:var(--bg)}
::-webkit-scrollbar-thumb{background:var(--border2);border-radius:99px}
.app{display:flex;flex-direction:column;min-height:100vh}

/* TOP NAV */
.topnav{
  position:sticky;top:0;z-index:200;
  display:flex;align-items:center;gap:0;
  background:var(--surface);
  border-bottom:1px solid var(--border);
  height:52px;
  padding:0 16px;
  backdrop-filter:blur(20px);
}
.nav-logo{
  display:flex;align-items:center;gap:8px;
  font-weight:800;font-size:16px;letter-spacing:-.5px;
  color:var(--text);text-decoration:none;
  margin-right:24px;flex-shrink:0;
}
.nav-logo span{color:var(--accent)}
.nav-links{
  display:flex;align-items:center;gap:2px;
  position:absolute;left:50%;transform:translateX(-50%);
}
.nav-link{
  display:flex;align-items:center;gap:6px;
  padding:6px 12px;border-radius:6px;
  font-size:13px;font-weight:500;color:var(--muted);
  cursor:pointer;transition:all .15s;text-decoration:none;
  white-space:nowrap;
}
.nav-link:hover{color:var(--text);background:#ffffff08}
.nav-link.active{color:var(--text);background:#ffffff0d}
.nav-link svg{width:15px;height:15px;flex-shrink:0}
.nav-right{display:flex;align-items:center;gap:8px;margin-left:auto}
.search-btn{
  display:flex;align-items:center;gap:6px;
  padding:6px 14px;border-radius:6px;
  background:#ffffff08;border:1px solid var(--border2);
  color:var(--muted);font-size:13px;cursor:pointer;
  transition:all .15s;font-family:'Outfit',sans-serif;
}
.search-btn:hover{border-color:var(--accent);color:var(--text)}
.search-kbd{
  font-family:'JetBrains Mono',monospace;font-size:10px;
  background:#ffffff0a;border:1px solid var(--border2);
  border-radius:3px;padding:1px 5px;margin-left:4px;
}

/* NAV DROPDOWN */
.nav-dropdown{position:relative}
.nav-dropdown-trigger{
  display:flex;align-items:center;gap:6px;
  padding:6px 12px;border-radius:6px;
  font-size:13px;font-weight:500;color:var(--muted);
  cursor:pointer;transition:all .15s;
  background:none;border:none;font-family:'Outfit',sans-serif;
  white-space:nowrap;
}
.nav-dropdown-trigger:hover{color:var(--text);background:#ffffff08}
.nav-dropdown-trigger svg{width:15px;height:15px;flex-shrink:0}
.nav-dropdown-chevron{width:11px!important;height:11px!important;transition:transform .2s;opacity:.6}
.nav-dropdown:hover .nav-dropdown-chevron,.nav-dropdown.open .nav-dropdown-chevron{transform:rotate(180deg)}
.nav-dropdown-menu{
  position:absolute;top:100%;left:0;
  background:var(--surface);
  border:1px solid var(--border2);
  border-radius:10px;padding:5px;
  min-width:168px;
  box-shadow:0 12px 32px rgba(0,0,0,0.5);
  opacity:0;pointer-events:none;
  transform:translateY(-4px) scale(.98);
  transform-origin:top left;
  transition:opacity .15s,transform .15s;
  z-index:300;
  margin-top:6px;
}
.nav-dropdown-menu::before{
  content:'';
  position:absolute;
  top:-10px;left:0;right:0;
  height:10px;
}
.nav-dropdown:hover .nav-dropdown-menu,.nav-dropdown.open .nav-dropdown-menu{
  opacity:1;pointer-events:all;transform:translateY(0) scale(1)
}
.nav-dropdown-item{
  display:flex;align-items:center;gap:9px;
  padding:8px 10px;border-radius:7px;
  font-size:13px;font-weight:500;color:var(--muted);
  text-decoration:none;transition:all .15s;white-space:nowrap;
}
.nav-dropdown-item:hover{color:var(--text);background:#ffffff08}
.nav-dropdown-item svg,.nav-dropdown-item img{width:15px;height:15px;flex-shrink:0}
.nav-dropdown-divider{height:1px;background:var(--border);margin:4px 0}

/* GAMEMODE BAR */
.modebar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.modebar::-webkit-scrollbar { display: none; }

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 24px;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}
.mode-btn:hover {
  color: var(--text);
  background: var(--surface2);
  border-bottom:3px solid var(--border);
}
.mode-btn.active {
  color: var(--accent);
  background: var(--accent)18;
  border-color: var(--accent)44;
}
.mode-icon {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mode-icon img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  filter: brightness(0) saturate(100%) invert(35%) sepia(10%) saturate(600%) hue-rotate(200deg) brightness(90%);
  transition: filter 0.2s ease;
}
.mode-btn:hover .mode-icon img {
  filter: brightness(0) saturate(100%) invert(95%) sepia(5%) saturate(300%) hue-rotate(195deg) brightness(120%);
}
.mode-btn.active .mode-icon img {
  filter: brightness(0) saturate(100%) invert(65%) sepia(50%) saturate(500%) hue-rotate(180deg) brightness(110%);
}
/* MAIN */
.main{display:flex;flex:1;min-height:0}

/* SIDEBAR */
.sidebar{
  width:220px;flex-shrink:0;
  border-right:1px solid var(--border);
  padding:16px 0;
}
.sidebar-section{margin-bottom:4px}
.sidebar-label{
  font-size:15px;font-weight:700;letter-spacing:1.5px;text-transform:uppercase;
  color:var(--muted2);padding:8px 16px 4px;
}
.sidebar-item{
  display:flex;align-items:center;justify-content:space-between;
  padding:7px 16px;cursor:pointer;transition:all .15s;
  font-size:13px;font-weight:500;color:var(--muted);
}
.sidebar-item:hover{color:var(--text);background:#ffffff05}
.sidebar-item.active{color:var(--text);background:#5b8cff12;border-right:2px solid var(--accent)}
.sidebar-count{font-size:11px;font-family:'JetBrains Mono',monospace;}

/* RANKINGS AREA */
.rankings-area{flex:1;min-width:0;padding:20px 24px}

/* Config Banner */
.config-banner{
  display:flex;align-items:center;gap:12px;
  background:linear-gradient(90deg,#5b8cff10,#5b8cff05);
  border:1px solid #5b8cff30;border-radius:8px;
  padding:12px 16px;margin-bottom:20px;
}
.config-banner input{
  flex:1;background:#0a0c11;border:1px solid var(--border2);border-radius:6px;
  color:var(--text);font-family:'JetBrains Mono',monospace;font-size:12px;
  padding:7px 12px;outline:none;transition:border-color .15s;
}
.config-banner input:focus{border-color:var(--accent)}
.config-banner button{
  padding:7px 16px;border-radius:6px;border:none;cursor:pointer;
  background:var(--accent);color:#fff;font-family:'Outfit',sans-serif;
  font-size:13px;font-weight:600;transition:all .15s;flex-shrink:0;
}
.scoreStack{display:flex;flex-direction:column;gap:4px}
.config-banner button:hover{opacity:.85;transform:translateY(-1px)}
.config-banner button:disabled{opacity:.5;cursor:not-allowed;transform:none}
#ratingsTab {display: flex;gap: 8px;margin-bottom: 10px;}
.ratings-tab {cursor: pointer;padding: 6px 12px;font-weight: 500;color: var(--muted);transition: all 0.2s ease;font-size: smaller; display: flex; align-items: center; gap: 4px;}
.ratings-tab.active {border-bottom: 1px solid var(--accent);color: white;}
.ratings-tab.active:hover {border-bottom: 1px solid var(--accent);color: white;}
.ratings-tab:hover {color: var(--text); border-bottom: 1px solid var(--muted);}
.ratings-content {display: none;}
.ratings-content.active {display: block;}
/* Page header */
.nav-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  filter: brightness(0) saturate(100%) invert(35%) sepia(10%) saturate(600%) hue-rotate(200deg) brightness(90%);
  transition: filter 0.2s ease;
}
.nav-link:hover .nav-icon {
  filter: brightness(0) saturate(100%) invert(95%) sepia(5%) saturate(300%) hue-rotate(195deg) brightness(120%);
}
.page-header{
  display:flex;align-items:center;justify-content:space-between;
  margin-bottom:20px;
}
.page-title{font-size:20px;font-weight:800;letter-spacing:-.5px}
.page-subtitle{font-size:13px;color:var(--muted);margin-top:2px}
.header-actions{display:flex;align-items:center;gap:8px}
.search-bar{
  display:flex;align-items:center;gap:8px;
  background:var(--surface2);border:1px solid var(--border2);border-radius:8px;
  padding:7px 12px;
}
.search-bar svg{width:14px;height:14px;color:var(--muted);flex-shrink:0}
.search-bar input{
  background:none;border:none;outline:none;
  color:var(--text);font-family:'Outfit',sans-serif;font-size:13px;
  width:160px;
}
.search-bar input::placeholder{color:var(--muted)}

/* Score dropdown */
.score-dropdown-btn { background:var(--surface2); border:1px solid var(--border2); color:var(--muted); }
.score-dropdown-btn:hover { color:var(--text); }
.score-dropdown-menu { min-width:120px; }

/* Retired toggle */
.retired-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 7px 12px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  transition: border-color 0.15s, color 0.15s;
  user-select: none;
  white-space: nowrap;
}
.retired-toggle:has(input:checked) {
  border-color: var(--accent);
  color: var(--text);
}
.retired-toggle input { display: none; }
.retired-toggle-track {
  width: 30px;
  height: 17px;
  border-radius: 999px;
  background: var(--border2);
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}
.retired-toggle-track::after {
  content: '';
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--muted);
  top: 3px;
  left: 3px;
  transition: transform 0.2s ease, background 0.2s;
}
.retired-toggle:has(input:checked) .retired-toggle-track {
  background: var(--accent);
}
.retired-toggle:has(input:checked) .retired-toggle-track::after {
  transform: translateX(13px);
  background: #fff;
}

/* 🏆 LEADERBOARD ROW-BASED LAYOUT */
.leaderboard-container {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px 20px 20px;
  background: var(--surface2);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-bottom: 1px solid var(--border);
  animation: slideIn 0.4s ease backwards;
  position: relative;
}

.leaderboard-row:hover {
  background: var(--surface);
  border-bottom-color: var(--accent);
  transform: translateX(4px);
  box-shadow: inset 0 0 20px rgba(5, 150, 105, 0.15);
}

.leaderboard-row:last-child {
  border-bottom: none;
}

.leaderboard-row.top-3 {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.08), rgba(255, 215, 0, 0.04));
  border-left: 3px solid var(--accent);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Rank Number */
.rank-number {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--muted);
  min-width: 40px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
}

.rank-number.rank-1 { color: #ffd700; font-size: 28px; }
.rank-number.rank-2 { color: #c0c0c0; font-size: 26px; }
.rank-number.rank-3 { color: #cd7f32; font-size: 26px; }
.cgm {
  background: linear-gradient(135deg, #FFD700, #FFF176, #FFB300);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
/* Player Info Section */
.player-info-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  min-width: 240px;
}

.player-avatar {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-avatar-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--muted));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.player-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.player-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.player-rank-title {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.player-rank-title strong {
  color: var(--accent);
}

/* Region Badge */
.region-badge {
  min-width: 50px;
  text-align: center;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  background: #ffffff08;
  border: 1px solid var(--border2);
}

.region-badge.NA { background: var(--NA, rgba(220, 38, 38, 0.2)); color: #60a5fa; border-color:rgba(72, 116, 236, 0.3) }
.region-badge.EU { background: var(--EU, rgba(34, 197, 94, 0.2)); color: #34d399; border-color: rgba(34, 197, 94, 0.3); }
.region-badge.SA { background: var(--SA, rgba(245, 158, 11, 0.2)); color: #fbbf24; border-color: rgba(245, 158, 11, 0.3); }
.region-badge.AS { background: var(--AS, rgba(139, 92, 246, 0.2)); color: #a78bfa; border-color: rgba(139, 92, 246, 0.3); }
.region-badge.AU { background: var(--AU, rgba(72, 143, 236, 0.2)); color: #f472b6; border-color: rgba(220, 38, 38, 0.3); }

/* Tier icon tooltip */
.tier-icon-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 6px 10px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 200;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.tier-icon:hover .tier-icon-tooltip { opacity: 1; visibility: visible; }
.tier-icon.tier-unranked:hover { border-color: var(--muted) !important; box-shadow: none !important; }
.tip-mode { color: var(--muted); font-size: 10px; margin-bottom: 2px; }
.tip-tier { font-weight: 700; font-size: 13px; margin-bottom: 1px; }
.tip-pts  { color: var(--muted); font-size: 10px; }

/* Score in tier player rows */
.tier-row-score { font-size: 12px; font-weight: 700; color: var(--text); margin-left: auto; margin-right: 8px; white-space: nowrap; }
.tier-row-score-unit { font-size: 10px; opacity: 0.55; }

/* Tier Icons Section */
.tier-icons {
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
  position: relative;
  padding-bottom: 28px;
}

.tier-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s;
  flex-shrink: 0;
  font-size: 18px;
  cursor: help;
  font-weight: 700;
}

.tier-icon:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(5, 150, 105, 0.4);
}

.tier-icon-label {
  position: absolute;
  bottom: -24px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 1;
  pointer-events: none;
  transition: opacity 0.2s;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.tier-icon:hover .tier-icon-label {
  opacity: 1;
  color: var(--text);
}

/* Tier Colors */
.tier-icon.HT1 { border-color: #ffd700; background: rgba(255, 215, 0, 0.15); color: #ffd700; }
.tier-icon.LT1 { border-color: #ffd700; background: rgba(255, 215, 0, 0.1); color: #ffd700; }
.tier-icon.HT2 { border-color: #c0c0c0; background: rgba(192, 192, 192, 0.15); color: #c0c0c0; }
.tier-icon.LT2 { border-color: #c0c0c0; background: rgba(192, 192, 192, 0.1); color: #c0c0c0; }
.tier-icon.HT3 { border-color: #cd7f32; background: rgba(205, 127, 50, 0.15); color: #cd7f32; }
.tier-icon.LT3 { border-color: #cd7f32; background: rgba(205, 127, 50, 0.1); color: #cd7f32; }
.tier-icon.HT4 { border-color: #888; background: rgba(136, 136, 136, 0.1); color: #aaa; }
.tier-icon.LT4 { border-color: #666; background: rgba(102, 102, 102, 0.08); color: #888; }
.tier-icon.HT5 { border-color: #555; background: rgba(85, 85, 85, 0.08); color: #777; }
.tier-icon.LT5 { border-color: #444; background: rgba(68, 68, 68, 0.06); color: #666; }
.tier-icon.R { border-color: #ef5350; background: rgba(239, 83, 80, 0.15); color: #ef5350; }

/* Empty State */
.tier-section{margin-bottom:6px}

/* Tier colours */
.tier-HT1{--tc:var(--ht1);--tcb:var(--ht1b)}
.tier-HT2{--tc:var(--ht2);--tcb:var(--ht2b)}
.tier-HT3{--tc:var(--ht3);--tcb:var(--ht3b)}
.tier-MT3{--tc:var(--mt3);--tcb:var(--mt3b)}
.tier-LT1{--tc:var(--lt1);--tcb:var(--lt1b)}
.tier-LT2{--tc:var(--lt2);--tcb:var(--lt2b)}
.tier-LT3{--tc:var(--lt3);--tcb:var(--lt3b)}
.tier-LT4{--tc:var(--lt4);--tcb:var(--lt4b)}
.tier-LT5{--tc:var(--lt5);--tcb:var(--lt5b)}
.tier-R{--tc:var(--r);--tcb:var(--rb)}

.tier-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 20px;
  background: var(--bg);
  border-radius: 8px;
}

.tier-column {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.tier-column:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(5, 150, 105, 0.15);
}

.tier-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(var(--tier-color-rgb), 0.15), rgba(var(--tier-color-rgb), 0.08));
  border-bottom: 2px solid var(--tier-color);
  color: var(--text);
  font-weight: 700;
  text-align: center;
}

.tier-header-icon {
  font-size: 28px;
  line-height: 1;
}

.tier-header-label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--tier-color);
}

.tier-header-count {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.tier-players-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  flex: 1;
  overflow-y: visible;
}

.tier-player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 0;
  height: 44px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
  animation: slideInTier 0.3s ease backwards;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.tier-player-row:hover {
  background: var(--surface);
}

.tier-player-row:last-child {
  border-bottom: none;
}

/* Sliding region panel */
.tier-row-region {
  width: 2px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  transition: width 0.2s ease;
}
.tier-row-region strong {
  opacity: 0;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  transition: opacity 0.1s ease;
  font-family: 'JetBrains Mono', monospace;
}
.tier-player-row:hover .tier-row-region {
  width: 36px;
}
.tier-player-row:hover .tier-row-region strong {
  opacity: 1;
}
.tier-row-region-empty {
  width: 2px;
  height: 100%;
  flex-shrink: 0;
}

/* Chevron */
.tier-row-chevron-wrap {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  color: var(--accent);
  transition: color 0.15s ease;
}

@keyframes slideInTier {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tier-player-avatar {
  width: 40px;
  height: 48px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border2);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
}

.tier-player-avatar img {
  width: 32px;
  height: 180px;
  object-fit: contain;
  transform: scaleX(-1);
  position: absolute;
  bottom: -82px;
}

.tier-player-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tier-indicator {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin-left: auto;
  letter-spacing: -0.5px;
  font-family: 'JetBrains Mono', monospace;
}

/* Tier column specific colors */
.tier-1 .tier-header { --tier-color: #ffd700; --tier-color-rgb: 255, 215, 0; }
.tier-2 .tier-header { --tier-color: #c4c4c4; --tier-color-rgb: 196, 196, 196; }
.tier-3 .tier-header { --tier-color: #CE8946; --tier-color-rgb: 206, 137, 70; }
.tier-4 .tier-header { --tier-color: #474747; --tier-color-rgb: 71, 71, 71; }
.tier-5 .tier-header { --tier-color: #474747; --tier-color-rgb: 71, 71, 71; }

/* Responsive tier board */

/* Chromebook / tablet: horizontal scroll so columns never wrap */
@media (min-width: 601px) and (max-width: 1350px) {
  .tier-board {
    display: flex;
    overflow-x: auto;
    padding: 16px;
    gap: 12px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .tier-column {
    flex: 0 0 210px;
    scroll-snap-align: start;
  }
}

/* Mobile: horizontal scroll like tablet */
@media (max-width: 600px) {
  .tier-board {
    display: flex;
    overflow-x: auto;
    padding: 12px;
    gap: 10px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .tier-column {
    flex: 0 0 180px;
    scroll-snap-align: start;
  }
}

.tier-header{background:var(--tcb,#ffffff05);border:1px solid color-mix(in srgb,var(--tc,#fff) 15%,transparent)}
.tier-label{color:var(--tc,var(--text))}
.player-list{border-color:color-mix(in srgb,var(--tc,#fff) 12%,transparent)}
.player-row{background:var(--surface);border-bottom-color:color-mix(in srgb,var(--tc,#fff) 6%,transparent)}
.player-row:hover{background:color-mix(in srgb,var(--tc,#fff) 4%,var(--surface))}
.peak-badge{background:color-mix(in srgb,var(--tc,#fff) 15%,transparent);color:var(--tc,var(--text))}

/* ── Player Profile Modal ───────────────────────────── */
.profile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.profile-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.profile-modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 24px;
  width: 100%;
  max-width: 440px;
  padding: 32px 40px 36px;
  position: relative;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.2s ease;
}
.profile-overlay.open .profile-modal {
  transform: translateY(0) scale(1);
}
.profile-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface2);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
}
.profile-close:hover { color: var(--text); background: var(--border2); }
.profile-avatar-ring {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--surface2);
  overflow: hidden;
  position: relative;
  margin: 0 auto 16px;
  flex-shrink: 0;
}
.profile-avatar-ring img {
  position: absolute;
  width: 75px;
  height: auto;
  object-fit: scale-down;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%) scaleX(-1);
}
.profile-name {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  text-align: center;
  margin-bottom: 8px;
}
.profile-rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 99px;
  font-size: 15px;
  font-weight: 600;
  margin: 0 auto 8px;
}
.profile-region {
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  margin-bottom: 16px;
}
.profile-kirka-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 8px 14px;
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  transition: all 0.15s;
  margin: 0 auto 24px;
}
.profile-kirka-link:hover { border-color: var(--accent); color: var(--text); }
.profile-section-label {
  font-size: 18px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 10px;
}
.profile-position-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  height: 52px;
  overflow: hidden;
  margin-bottom: 20px;
}
.profile-position-num {
  width: 80px;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 12px;
  position: relative;
  flex-shrink: 0;
}
.profile-position-num img.shimmer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-position-num strong {
  position: relative;
  font-size: 2rem;
  font-weight: 800;
  font-style: italic;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.7));
  z-index: 1;
}
.profile-position-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
}
.profile-position-pts {
  font-size: 16px;
  color: var(--muted);
  font-weight: 500;
}
.profile-tiers-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.profile-tier-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 44px;
}
.profile-tier-icon-ring {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  border: 2px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  overflow: hidden;
}
.profile-tier-icon-ring img { width: 100%; height: 100%; object-fit: contain; }
.profile-tier-label {
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  padding: 1px 4px;
  text-align: center;
  width: 36px;
}

/* States */
.state-box{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:64px 24px;gap:12px;color:var(--muted);text-align:center}
.state-icon{font-size:36px;opacity:.4}
.state-title{font-size:15px;font-weight:600;color:var(--muted)}
.state-sub{font-size:13px;max-width:340px;line-height:1.6}
.loading-bar-wrap{width:220px;height:4px;background:var(--border2);border-radius:99px;overflow:hidden}
.loading-bar{height:100%;width:40%;background:var(--accent);border-radius:99px;animation:loadbar 1.2s ease-in-out infinite}
@keyframes loadbar{0%{transform:translateX(-100%)}60%{transform:translateX(200%)}100%{transform:translateX(200%)}}

/* Footer */
.footer{border-top:1px solid var(--border);padding:12px 24px;display:flex;align-items:center;justify-content:space-between;font-size:12px;color:var(--muted)}
.footer a{color:var(--muted);text-decoration:none}
.footer a:hover{color:var(--text)}

/* Row animation */
.player-row{animation:rowIn .25s ease both}
@keyframes rowIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}
@keyframes cardIn{from{opacity:0;translate:0 4px}to{opacity:1;translate:0 0}}

/* ── Logo swap ───────────────────────────── */
.logo-icon { display: none; }

/* ── Leaderboard row dual-layout ─────────── */
.lb-mobile { display: none; }

/* ── Mobile (≤700px) ─────────────────────── */
@media (max-width: 700px) {
  /* Nav */
  .logo-full  { display: none; }
  .logo-icon  { display: block !important; }
  .topnav     { flex-wrap: wrap; height: auto; padding: 6px 12px; gap: 2px; }
  .nav-logo   { margin-right: 0; }
  .nav-links  {
    position: static;
    transform: none;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    flex-wrap: nowrap;
    padding: 0;
  }
  .nav-links::-webkit-scrollbar { display: none; }

  /* overflow-x:auto implicitly clips overflow-y, hiding the dropdown.
     JS repositions the menu to position:fixed on mobile — ensure it
     sits above everything and isn't constrained by its parent's width. */
  .nav-dropdown.open .nav-dropdown-menu {
    position: fixed;
    z-index: 9999;
    min-width: 168px;
    width: max-content;
  }

  /* Mode bar: start from left so Overall tab is reachable */
  .modebar { justify-content: flex-start; }

  /* Layout */
  .sidebar         { display: none; }
  .rankings-area   { padding: 12px; }
  .page-header     { flex-direction: column; align-items: flex-start; gap: 10px; }
  .header-actions  { width: 100%; }
  .search-bar      { flex: 1; }
  .search-bar input{ width: 100%; }
  .retired-toggle-label { display: none; }

  /* Column header row hidden on mobile */
  .lb-header { display: none !important; }

  /* Leaderboard rows */
  .lb-desktop { display: none !important; }
  .lb-mobile  {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
  }
  .lbm-row1 {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .lbm-avatar-wrap {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0,0,0,0.25);
  }
  .lbm-avatar {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scaleX(-1);
  }
  .lbm-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  .lbm-nameline {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
  }
  .lbm-nameline .lbm-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
  }
  .lbm-rank-num {
    font-size: 15px;
    font-weight: 800;
    font-style: italic;
    flex-shrink: 0;
  }
  .lbm-subline {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
  }
  .lbm-tiers {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
  }
  /* Scale down tier icons in mobile tiers row */
  .lbm-tiers .tier-icon {
    width: 40px !important;
    height: 40px !important;
  }
  .lbm-tiers .tier-icon img {
    width: 18px !important;
    height: 18px !important;
  }
}

/* 404 Page */
.not-found{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;padding:60px 24px;text-align:center}
.not-found-code{font-family:'JetBrains Mono',monospace;font-size:clamp(96px,18vw,160px);font-weight:700;line-height:1;color:var(--accent);letter-spacing:-4px;opacity:.15;user-select:none;margin-bottom:-16px}
.not-found-icon{font-size:48px;margin-bottom:20px}
.not-found-title{font-size:22px;font-weight:700;color:var(--text);margin-bottom:10px}
.not-found-desc{font-size:14px;color:var(--muted);max-width:380px;line-height:1.6;margin-bottom:32px}
.not-found-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}
.btn-primary{display:flex;align-items:center;gap:8px;padding:9px 20px;background:var(--accent);color:#fff;border-radius:8px;font-size:13px;font-weight:600;text-decoration:none;transition:all .15s;font-family:'Outfit',sans-serif}
.btn-primary:hover{background:#047857;transform:translateY(-1px)}
.btn-secondary{display:flex;align-items:center;gap:8px;padding:9px 20px;background:#ffffff08;border:1px solid var(--border2);color:var(--muted);border-radius:8px;font-size:13px;font-weight:500;text-decoration:none;transition:all .15s;font-family:'Outfit',sans-serif}
.btn-secondary:hover{border-color:var(--accent);color:var(--text)}
.quick-links{display:flex;align-items:center;gap:4px;flex-wrap:wrap;justify-content:center;margin-top:40px}
.quick-links-label{font-size:12px;color:var(--muted2);margin-right:4px}
.quick-link{padding:5px 12px;border-radius:6px;font-size:12px;color:var(--muted);text-decoration:none;transition:all .15s}
.quick-link:hover{color:var(--text);background:#ffffff06}