/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0d1117;
  --bg2:         #161b22;
  --bg3:         #1f2937;
  --bg4:         #2d3748;
  --border:      #30363d;
  --border2:     #404954;
  --gold:        #f0b429;
  --gold2:       #ffd166;
  --gold-dim:    #7a5c10;
  --gold-glow:   rgba(240,180,41,.15);
  --text:        #e6edf3;
  --text2:       #8b949e;
  --text3:       #555e68;
  --accent:      #388bfd;
  --green:       #3fb950;
  --red:         #f85149;
  --purple:      #bc8cff;
  --purple-dim:  rgba(188,140,255,.12);
  --sidebar-w:   272px;
  --sidebar-current-w: 272px;
  --topbar-h:    58px;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 8px 32px rgba(0,0,0,.6);
  --t:           0.17s ease;
}

html { font-size: 15px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== LAYOUT ===== */
.layout { display: flex; min-height: 100vh; }
.view { width: 100%; }
.view.hidden { display: none; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  transition: width var(--t), min-width var(--t);
  z-index: 100;
}
.sidebar.collapsed { width: 52px; min-width: 52px; }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .search-wrap,
.sidebar.collapsed .category-nav { display: none; }
.sidebar.collapsed .logo { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 14px 0; }
.sidebar.collapsed .sidebar-toggle { transform: rotate(180deg); }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px; border-bottom: 1px solid var(--border); gap: 8px;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 1.35rem; }
.logo-text { font-size: .95rem; font-weight: 800; color: var(--gold); letter-spacing: .3px; white-space: nowrap; }
.sidebar-toggle {
  background: none; border: none; color: var(--text3); cursor: pointer;
  font-size: 1.1rem; padding: 5px 7px; border-radius: var(--radius-sm);
  transition: color var(--t), background var(--t); line-height: 1;
}
.sidebar-toggle:hover { background: var(--bg3); color: var(--text); }

.search-wrap {
  position: relative; padding: 9px 12px; border-bottom: 1px solid var(--border);
}
.search-input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 7px 10px 7px 30px; font-size: .82rem; outline: none;
  transition: border-color var(--t);
}
.search-input::placeholder { color: var(--text3); }
.search-input:focus { border-color: var(--accent); }
.search-icon { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); font-size: .75rem; pointer-events: none; }

.category-nav {
  flex: 1; overflow-y: auto; padding: 6px 0 20px;
  scrollbar-width: thin; scrollbar-color: var(--border2) transparent;
}

/* ===== SIDEBAR PLAYER TILE ===== */
.sidebar-player-tile {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
  cursor: default;
  user-select: none;
  opacity: .55;
  transition: opacity var(--t);
}
.sidebar-player-tile:hover { opacity: .75; }
.spt-avatar {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.spt-info { flex: 1; min-width: 0; }
.spt-name {
  font-size: .78rem; font-weight: 700; color: var(--text2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.spt-meta { font-size: .67rem; color: var(--text3); margin-top: 1px; }
.spt-badge {
  font-size: .58rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  background: var(--bg4); color: var(--text3); border: 1px solid var(--border2);
  border-radius: 20px; padding: 2px 6px; flex-shrink: 0;
}
.sidebar.collapsed .sidebar-player-tile { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .spt-info,
.sidebar.collapsed .spt-badge { display: none; }
.category-nav::-webkit-scrollbar { width: 3px; }
.category-nav::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
.nav-loading { padding: 16px; color: var(--text3); font-size: .82rem; }

/* nav items */
.nav-home, .nav-all, .nav-realm-first, .nav-leaderboard {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 14px; font-size: .83rem; font-weight: 600;
  cursor: pointer; border-left: 2px solid transparent;
  transition: background var(--t), color var(--t);
  color: var(--text2);
}
.nav-home:hover, .nav-all:hover { background: var(--bg3); color: var(--text); }
.nav-home.active { color: var(--gold); border-left-color: var(--gold); background: var(--gold-glow); }
.nav-all.active  { color: var(--gold); border-left-color: var(--gold); background: var(--gold-glow); }
.nav-realm-first { color: var(--purple); }
.nav-realm-first:hover { background: var(--purple-dim); }
.nav-realm-first.active { border-left-color: var(--purple); background: var(--purple-dim); }
.nav-leaderboard { color: var(--accent); }
.nav-leaderboard:hover { background: rgba(56,139,253,.08); color: #7eb8ff; }
.nav-leaderboard.active { border-left-color: var(--accent); background: rgba(56,139,253,.1); }

.nav-sep { height: 1px; background: var(--border); margin: 6px 12px; }

.nav-group { margin-bottom: 1px; }
.nav-parent {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; cursor: pointer;
  font-size: .75rem; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: .6px; user-select: none;
  transition: background var(--t), color var(--t);
}
.nav-parent:hover { background: var(--bg3); color: var(--text2); }
.nav-parent .nav-chevron { margin-left: auto; font-size: .65rem; transition: transform var(--t); }
.nav-parent.open .nav-chevron { transform: rotate(90deg); }
.nav-parent .nav-count { font-size: .66rem; background: var(--bg4); border-radius: 20px; padding: 1px 5px; color: var(--text3); margin-left: auto; }

.nav-children { display: none; }
.nav-children.open { display: block; }

.nav-child {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 14px 5px 26px; font-size: .82rem; color: var(--text2);
  cursor: pointer; border-left: 2px solid transparent;
  transition: background var(--t), color var(--t);
}
.nav-child:hover { background: var(--bg3); color: var(--text); }
.nav-child.active { color: var(--gold); border-left-color: var(--gold); background: var(--gold-glow); }
.nav-child .nav-count { margin-left: auto; font-size: .66rem; color: var(--text3); background: var(--bg4); border-radius: 20px; padding: 1px 5px; }

/* ===== MAIN ===== */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ===== TOPBAR ===== */
.topbar {
  height: var(--topbar-h); background: var(--bg2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; gap: 14px; position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-btn { display: none; background: none; border: none; color: var(--text2); cursor: pointer; font-size: 1.2rem; padding: 6px; border-radius: var(--radius-sm); }
.page-title { font-size: .95rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.stats-bar { display: flex; align-items: center; gap: 8px; font-size: .75rem; color: var(--text2); }
.stats-bar b { color: var(--gold2); }
.stat-sep { color: var(--border2); }

.refresh-countdown {
  font-size: .72rem; color: var(--text3);
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 10px;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}

.top-tabs { display: flex; gap: 3px; }
.top-tab {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); border-radius: var(--radius-sm);
  padding: 4px 11px; font-size: .75rem; font-weight: 600;
  cursor: pointer; transition: all var(--t);
}
.top-tab:hover { border-color: var(--gold-dim); color: var(--text); }
.top-tab.active { background: var(--gold); color: #0a0800; border-color: var(--gold); }
.top-tabs.hidden { display: none; }

/* ===== CONTENT ===== */
.content { flex: 1; padding: 20px 22px 40px; }

.grid-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 10px;
}
#resultCount { font-size: .78rem; color: var(--text2); }

/* pagination */
.pagination { display: flex; gap: 3px; align-items: center; flex-wrap: wrap; }
.pagination.bottom { margin-top: 22px; justify-content: center; }
.page-btn {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text2);
  border-radius: var(--radius-sm); padding: 4px 10px; font-size: .75rem;
  cursor: pointer; transition: all var(--t);
}
.page-btn:hover:not(:disabled) { border-color: var(--gold-dim); color: var(--text); }
.page-btn.active { background: var(--gold); color: #0a0800; border-color: var(--gold); font-weight: 700; }
.page-btn:disabled { opacity: .3; cursor: default; }
.page-ellipsis { color: var(--text3); padding: 0 3px; font-size: .78rem; }

/* ===== ACHIEVEMENT GRID ===== */
.achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px;
}
.grid-loading {
  grid-column: 1/-1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 80px 20px; gap: 14px; color: var(--text2);
}
.spinner {
  width: 34px; height: 34px; border: 3px solid var(--border);
  border-top-color: var(--gold); border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== ACHIEVEMENT CARD ===== */
.card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: border-color var(--t), transform var(--t), box-shadow var(--t);
  cursor: pointer; display: flex; flex-direction: column;
}
.card:hover { border-color: var(--gold-dim); transform: translateY(-2px); box-shadow: var(--shadow); }
.card.realm-first { border-color: rgba(188,140,255,.25); }
.card.realm-first:hover { border-color: var(--purple); }

.card-header { display: flex; align-items: flex-start; gap: 11px; padding: 13px 13px 8px; }
.card-icon {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem; overflow: hidden;
}
.card-info { flex: 1; min-width: 0; }
.card-title { font-size: .87rem; font-weight: 600; color: var(--text); line-height: 1.3; margin-bottom: 3px; }
.card.realm-first .card-title { color: var(--purple); }
.card-desc { font-size: .73rem; color: var(--text2); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.card-meta { display: flex; align-items: center; gap: 6px; padding: 0 13px 9px; flex-wrap: wrap; }
.badge {
  font-size: .65rem; font-weight: 700; border-radius: 20px; padding: 2px 7px;
  display: inline-flex; align-items: center; gap: 3px; white-space: nowrap;
}
.badge-points { background: rgba(240,180,41,.1); color: var(--gold); border: 1px solid rgba(240,180,41,.2); }
.badge-rf     { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(188,140,255,.25); }
.badge-reward { background: rgba(63,185,80,.08); color: var(--green); border: 1px solid rgba(63,185,80,.2); max-width: 160px; overflow: hidden; text-overflow: ellipsis; }

/* leaderboard in card */
.card-leaderboard { border-top: 1px solid var(--border); padding: 9px 13px 11px; flex: 1; }
.lb-title { font-size: .67rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 7px; }
.lb-empty { font-size: .75rem; color: var(--text3); padding: 6px 0; }
.lb-list { display: flex; flex-direction: column; gap: 3px; }
.lb-row {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 7px;
  padding: 4px 5px; border-radius: var(--radius-sm); transition: background var(--t);
}
.lb-row:hover { background: var(--bg3); }
.lb-rank {
  font-size: .68rem; font-weight: 800; width: 22px; height: 22px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.lb-rank.r1 { background: linear-gradient(135deg,#b8860b,#ffd700); color:#000; }
.lb-rank.r2 { background: linear-gradient(135deg,#7a8fa0,#c0cdd6); color:#000; }
.lb-rank.r3 { background: linear-gradient(135deg,#8b4513,#cd7f32); color:#fff; }
.lb-rank.rN { background: var(--bg4); color: var(--text3); font-size: .62rem; }
.lb-player { min-width: 0; }
.lb-name { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-sub  { font-size: .65rem; color: var(--text3); }
.lb-date { font-size: .65rem; color: var(--text3); text-align: right; white-space: nowrap; }

.card-lb-loading { display: flex; align-items: center; gap: 7px; font-size: .72rem; color: var(--text3); padding: 5px 0; }
.mini-spinner { width: 13px; height: 13px; border: 2px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin .6s linear infinite; flex-shrink: 0; }

/* ===== REALM FIRST VIEW ===== */
.rf-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #1a1130 0%, #0d1117 60%);
  border: 1px solid rgba(188,140,255,.2); border-radius: 14px;
  margin-bottom: 28px; padding: 36px 32px; text-align: center;
}
.rf-hero-glow {
  position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
  width: 400px; height: 200px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(188,140,255,.18) 0%, transparent 70%);
  pointer-events: none;
}
.rf-hero-content { position: relative; z-index: 1; }
.rf-crown { font-size: 3rem; margin-bottom: 10px; filter: drop-shadow(0 0 18px rgba(188,140,255,.6)); }
.rf-hero h2 { font-size: 1.5rem; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.rf-hero p  { font-size: .85rem; color: var(--text2); }

.rf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.rf-grid .grid-loading { grid-column: 1/-1; }

/* realm-first card */
.rf-card {
  background: var(--bg2); border: 1px solid rgba(188,140,255,.2);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color var(--t), transform var(--t), box-shadow var(--t);
  display: flex; flex-direction: column;
}
.rf-card:hover { border-color: var(--purple); transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,.5); }
.rf-card.unclaimed { opacity: .55; border-color: var(--border); }
.rf-card.unclaimed:hover { border-color: var(--border2); transform: none; }

.rf-card-header { display: flex; align-items: flex-start; gap: 11px; padding: 13px; }
.rf-card-icon {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.rf-card-info { flex: 1; min-width: 0; }
.rf-card-title { font-size: .87rem; font-weight: 700; color: var(--purple); line-height: 1.3; margin-bottom: 2px; }
.rf-card-category { font-size: .7rem; color: var(--text3); }
.rf-card-type { font-size: .65rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .4px; }

.rf-winner {
  border-top: 1px solid rgba(188,140,255,.15);
  padding: 10px 13px 13px;
  display: flex; align-items: center; gap: 10px;
}
.rf-winner-crown { font-size: 1.2rem; filter: drop-shadow(0 0 6px rgba(255,215,0,.5)); flex-shrink: 0; }
.rf-winner-info { flex: 1; min-width: 0; }
.rf-winner-name { font-size: .88rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rf-winner-sub  { font-size: .7rem; color: var(--text3); }
.rf-winner-date { font-size: .68rem; color: var(--text3); text-align: right; white-space: nowrap; flex-shrink: 0; }

.rf-unclaimed {
  border-top: 1px solid var(--border); padding: 10px 13px 13px;
  display: flex; align-items: center; gap: 8px; color: var(--text3);
}
.rf-unclaimed-icon { font-size: 1.1rem; }
.rf-unclaimed-text { font-size: .8rem; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.75); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 500px; max-height: 85vh; overflow-y: auto;
  position: relative; box-shadow: var(--shadow); animation: fadeUp .15s ease;
}
@keyframes fadeUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }

.modal-close {
  position: absolute; top: 12px; right: 12px;
  background: var(--bg3); border: 1px solid var(--border); color: var(--text2);
  border-radius: 50%; width: 28px; height: 28px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: .8rem;
  transition: all var(--t);
}
.modal-close:hover { background: var(--bg4); color: var(--text); }
.modal-inner { padding: 22px; }

.modal-ach-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.modal-ach-icon {
  width: 58px; height: 58px; flex-shrink: 0; background: var(--bg3); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 1.7rem; border: 1px solid var(--border);
}
.modal-ach-title { font-size: 1.1rem; font-weight: 800; line-height: 1.3; margin-bottom: 4px; }
.modal-ach-desc  { font-size: .8rem; color: var(--text2); line-height: 1.5; }
.modal-badges    { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.modal-lb-title { font-size: .68rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.modal-lb-list  { display: flex; flex-direction: column; gap: 5px; }
.modal-lb-row {
  display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sm); background: var(--bg3); border: 1px solid var(--border);
}
.modal-lb-rank {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: .75rem; font-weight: 800; flex-shrink: 0;
}
.modal-lb-rank.r1 { background: linear-gradient(135deg,#b8860b,#ffd700); color:#000; }
.modal-lb-rank.r2 { background: linear-gradient(135deg,#7a8fa0,#c0cdd6); color:#000; }
.modal-lb-rank.r3 { background: linear-gradient(135deg,#8b4513,#cd7f32); color:#fff; }
.modal-lb-rank.rN { background: var(--bg4); color: var(--text2); }
.modal-lb-name { font-size: .86rem; font-weight: 600; }
.modal-lb-sub  { font-size: .7rem; color: var(--text3); }
.modal-lb-date { font-size: .7rem; color: var(--text3); text-align: right; }
.modal-empty   { text-align: center; color: var(--text3); padding: 22px 0; font-size: .83rem; }

/* ===== HOME HERO ===== */
.home-hero {
  position: relative;
  overflow: hidden;
  min-height: 320px;
  padding: 72px 40px 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(ellipse 110% 140% at 50% -10%, rgba(240,180,41,.22) 0%, rgba(240,180,41,.06) 38%, transparent 60%),
    radial-gradient(ellipse 60% 70% at 10% 100%, rgba(56,139,253,.09) 0%, transparent 55%),
    radial-gradient(ellipse 60% 70% at 90% 90%, rgba(188,140,255,.07) 0%, transparent 55%),
    linear-gradient(175deg, #04060e 0%, #080e1c 40%, #0d1117 100%);
  border-bottom: 1px solid rgba(240,180,41,.12);
}

.home-hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 50%, black 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 90% 80% at 50% 50%, black 30%, transparent 100%);
}

.home-hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.home-hero-trophy {
  font-size: 3.6rem;
  filter: drop-shadow(0 0 28px rgba(240,180,41,.7)) drop-shadow(0 0 8px rgba(240,180,41,.4));
  animation: trophy-pulse 3s ease-in-out infinite;
}
@keyframes trophy-pulse {
  0%, 100% { filter: drop-shadow(0 0 28px rgba(240,180,41,.7)) drop-shadow(0 0 8px rgba(240,180,41,.4)); }
  50%       { filter: drop-shadow(0 0 40px rgba(240,180,41,.9)) drop-shadow(0 0 14px rgba(240,180,41,.5)); }
}

.home-hero-title {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--text);
  line-height: 1.15;
  text-shadow: 0 2px 24px rgba(0,0,0,.8);
}

.home-hero-sub {
  font-size: .95rem;
  color: var(--text2);
  max-width: 360px;
}

.home-hero-stats {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(240,180,41,.15);
  border-radius: 40px;
  padding: 10px 28px;
  backdrop-filter: blur(8px);
}

.home-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 22px;
  gap: 2px;
}

.home-stat-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gold2);
  line-height: 1;
}

.home-stat-lbl {
  font-size: .65rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .6px;
}

.home-stat-sep {
  width: 1px;
  height: 36px;
  background: rgba(240,180,41,.2);
  flex-shrink: 0;
}

/* ===== HOME FEED ===== */
.home-feed {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 28px 24px 40px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.home-feed-col {
  padding: 0 12px;
}

.home-feed-col + .home-feed-col {
  border-left: 1px solid var(--border);
}

.home-feed-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.home-feed-icon { font-size: 1.2rem; }

.home-feed-header h2 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}

/* ===== HOME HERO PVP STATS ===== */
.home-stat-sep-pvp { background: rgba(224,96,96,.3); }
.home-stat-val-pvp { color: #e87070 !important; }

/* ===== HOME PVP SECTION ===== */
.home-pvp-section { border-top: none; }

.home-pvp-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 22px 32px;
  max-width: 1200px; margin: 0 auto; width: 100%;
  background: linear-gradient(135deg, rgba(224,96,96,.09) 0%, transparent 65%);
  border-top: 1px solid rgba(224,96,96,.2);
  border-bottom: 1px solid rgba(224,96,96,.12);
}
.home-pvp-banner-left { display: flex; align-items: center; gap: 14px; }
.home-pvp-banner-icon {
  font-size: 2rem;
  filter: drop-shadow(0 0 12px rgba(224,96,96,.55));
}
.home-pvp-banner-title {
  font-size: 1.05rem; font-weight: 800; color: #e87070; line-height: 1.2;
}
.home-pvp-banner-sub {
  font-size: .75rem; color: var(--text3); margin-top: 2px;
}
.home-pvp-banner-btn {
  background: rgba(224,96,96,.12); border: 1px solid rgba(224,96,96,.3);
  color: #e87070; border-radius: var(--radius-sm);
  padding: 8px 16px; font-size: .8rem; font-weight: 700;
  cursor: pointer; transition: all var(--t); white-space: nowrap;
}
.home-pvp-banner-btn:hover {
  background: rgba(224,96,96,.22); border-color: #e87070; color: #ff9090;
}

/* ===== FEED ITEMS ===== */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feed-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--t), background var(--t);
  cursor: default;
}

.feed-item:hover { border-color: var(--gold-dim); background: var(--bg3); }
.feed-item.rf    { border-color: rgba(188,140,255,.2); }
.feed-item.rf:hover { border-color: var(--purple); }

.feed-rank {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 800;
  flex-shrink: 0;
}
.feed-rank.r1 { background: linear-gradient(135deg,#b8860b,#ffd700); color:#000; }
.feed-rank.r2 { background: linear-gradient(135deg,#7a8fa0,#c0cdd6); color:#000; }
.feed-rank.r3 { background: linear-gradient(135deg,#8b4513,#cd7f32); color:#fff; }
.feed-rank.rN { background: var(--bg4); color: var(--text3); }
.feed-icon-plain {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.feed-body { min-width: 0; }
.feed-title {
  font-size: .84rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.feed-item.rf .feed-title { color: var(--purple); }
.feed-player {
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feed-sub {
  font-size: .67rem;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.feed-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.feed-pts {
  font-size: .62rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(240,180,41,.1);
  border: 1px solid rgba(240,180,41,.2);
  border-radius: 20px;
  padding: 2px 6px;
  white-space: nowrap;
}

.feed-date {
  font-size: .62rem;
  color: var(--text3);
  text-align: right;
  white-space: nowrap;
}

.feed-empty {
  text-align: center;
  color: var(--text3);
  font-size: .82rem;
  padding: 40px 0;
}

/* ===== PLAYER LEADERBOARD ===== */
.plb-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #070f20 0%, #0d1117 65%);
  border: 1px solid rgba(56,139,253,.2); border-radius: 14px;
  padding: 36px 32px; text-align: center; margin-bottom: 0;
}
.plb-hero-glow {
  position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
  width: 420px; height: 200px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(56,139,253,.18) 0%, transparent 70%);
  pointer-events: none;
}
.plb-hero-content { position: relative; z-index: 1; }
.plb-hero-icon {
  font-size: 3rem; margin-bottom: 10px;
  filter: drop-shadow(0 0 18px rgba(56,139,253,.55));
  display: block;
}
.plb-hero h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; color: var(--text); }
.plb-hero p  { font-size: .85rem; color: var(--text2); }

.plb-controls {
  display: flex; align-items: center; gap: 12px; padding: 10px 0 0; flex-wrap: wrap;
}
.plb-search-wrap { position: relative; flex: 0 0 220px; }
.plb-search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  font-size: .78rem; pointer-events: none;
}
.plb-search {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 8px 12px 8px 32px; font-size: .85rem; outline: none;
  transition: border-color var(--t);
}
.plb-search:focus { border-color: var(--accent); }
.plb-search::placeholder { color: var(--text3); }
.plb-sort-tabs { display: flex; gap: 4px; justify-content: center; padding: 18px 0 0; }
.plb-sort-tab {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); border-radius: var(--radius-sm);
  padding: 7px 15px; font-size: .8rem; font-weight: 600;
  cursor: pointer; transition: all var(--t);
}
.plb-sort-tab:hover { border-color: var(--accent); color: var(--text); }
.plb-sort-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.plb-result-row { padding: 10px 0 4px; }
.plb-result-count { font-size: .78rem; color: var(--text2); }

.plb-list { display: flex; flex-direction: column; gap: 5px; }
.plb-row {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--t), background var(--t);
}
.plb-row:hover { border-color: var(--gold-dim); background: var(--bg3); }
.plb-top1 { border-color: rgba(240,180,41,.4); }
.plb-top2 { border-color: rgba(192,205,214,.3); }
.plb-top3 { border-color: rgba(205,127,50,.3); }
.plb-top1:hover { border-color: var(--gold) !important; }
.plb-top2:hover { border-color: #c0cdd6 !important; }
.plb-top3:hover { border-color: #cd7f32 !important; }

.plb-rank-badge {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 800; flex-shrink: 0;
}
/* reuses existing r1/r2/r3/rN rank classes */

.plb-player { min-width: 0; }
.plb-name {
  font-size: .9rem; font-weight: 700; display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.plb-sub {
  font-size: .68rem; color: var(--text3); display: block; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.plb-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.plb-pts-badge, .plb-honor-badge {
  font-size: .68rem; font-weight: 700; border-radius: 20px; padding: 3px 9px;
  display: inline-flex; align-items: center; gap: 3px; white-space: nowrap;
  opacity: .45; transition: opacity var(--t), transform var(--t);
}
.plb-pts-badge.active, .plb-honor-badge.active { opacity: 1; }
.plb-pts-badge   { background: rgba(240,180,41,.1); color: var(--gold); border: 1px solid rgba(240,180,41,.18); }
.plb-honor-badge { background: rgba(56,139,253,.1); color: var(--accent); border: 1px solid rgba(56,139,253,.18); }
.plb-pts-badge small, .plb-honor-badge small { font-weight: 400; opacity: .75; }

/* ===== YOUR CHARACTER BAR ===== */
.plb-you-bar {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-current-w);
  right: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  background: var(--bg2);
  border-top: 2px solid var(--accent);
  box-shadow: 0 -6px 28px rgba(56,139,253,.13);
  transition: left var(--t), transform var(--t), opacity var(--t);
}
.plb-you-bar.hidden {
  transform: translateY(110%);
  opacity: 0;
  pointer-events: none;
}

.plb-you-pill {
  font-size: .6rem; font-weight: 800; letter-spacing: .8px; text-transform: uppercase;
  background: var(--accent); color: #fff; border-radius: 20px; padding: 3px 8px;
  flex-shrink: 0;
}

.plb-you-selector {
  display: flex; align-items: center; gap: 7px; flex-shrink: 0;
}
.plb-you-avatar {
  width: 32px; height: 32px; border-radius: 7px;
  background: var(--bg3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: .95rem;
  flex-shrink: 0;
}
.plb-you-select {
  background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 5px 8px; font-size: .8rem; font-weight: 600;
  outline: none; cursor: pointer; max-width: 160px;
  transition: border-color var(--t);
}
.plb-you-select:focus { border-color: var(--accent); }
.plb-you-select option { background: var(--bg3); }

.plb-you-meta {
  flex: 1; font-size: .72rem; color: var(--text3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.plb-you-scores {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.plb-you-rank-badge {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 800; flex-shrink: 0;
}
.plb-you-pts {
  font-size: .75rem; font-weight: 700;
  color: var(--gold); background: rgba(240,180,41,.1);
  border: 1px solid rgba(240,180,41,.18); border-radius: 20px; padding: 4px 10px;
  white-space: nowrap;
}
.plb-you-honor {
  font-size: .75rem; font-weight: 700;
  color: var(--accent); background: rgba(56,139,253,.1);
  border: 1px solid rgba(56,139,253,.18); border-radius: 20px; padding: 4px 10px;
  white-space: nowrap;
}

/* ===== NAV PVP ===== */
.nav-pvp {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 14px; font-size: .83rem; font-weight: 600;
  cursor: pointer; border-left: 2px solid transparent;
  transition: background var(--t), color var(--t);
  color: #e06060;
}
.nav-pvp:hover { background: rgba(224,96,96,.08); color: #ff9090; }
.nav-pvp.active { border-left-color: #e06060; background: rgba(224,96,96,.1); }

/* ===== PVP HERO ===== */
.pvp-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #1a0a0a 0%, #0d1117 65%);
  border: 1px solid rgba(224,96,96,.2); border-radius: 14px;
  padding: 36px 32px; text-align: center; margin-bottom: 0;
}
.pvp-hero-glow {
  position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
  width: 420px; height: 200px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(224,96,96,.18) 0%, transparent 70%);
  pointer-events: none;
}
.pvp-hero-content { position: relative; z-index: 1; }
.pvp-hero-icon {
  font-size: 3rem; margin-bottom: 10px; display: block;
  filter: drop-shadow(0 0 18px rgba(224,96,96,.55));
}
.pvp-hero h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; color: var(--text); }
.pvp-hero p  { font-size: .85rem; color: var(--text2); }

/* ===== PVP CONTROLS ===== */
.pvp-controls {
  display: flex; align-items: center; gap: 12px; padding: 10px 0 0; flex-wrap: wrap;
}
.pvp-search-wrap { position: relative; flex: 0 0 220px; }
.pvp-search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  font-size: .78rem; pointer-events: none;
}
.pvp-search {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 8px 12px 8px 32px; font-size: .85rem; outline: none;
  transition: border-color var(--t);
}
.pvp-search:focus { border-color: #e06060; }
.pvp-search::placeholder { color: var(--text3); }

/* ===== PVP TABS ===== */
.pvp-tabs { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; padding: 18px 0 0; }
.pvp-tab {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); border-radius: var(--radius-sm);
  padding: 7px 15px; font-size: .8rem; font-weight: 600;
  cursor: pointer; transition: all var(--t);
}
.pvp-tab:hover { border-color: #e06060; color: var(--text); }
.pvp-tab.active { background: #c03030; color: #fff; border-color: #c03030; }

/* ===== PVP LIST ===== */
.pvp-list { display: flex; flex-direction: column; gap: 5px; margin-top: 16px; }

.pvp-row {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--t), background var(--t);
}
.pvp-row:hover { border-color: rgba(224,96,96,.3); background: var(--bg3); }
.pvp-top1 { border-color: rgba(240,180,41,.4); }
.pvp-top2 { border-color: rgba(192,205,214,.3); }
.pvp-top3 { border-color: rgba(205,127,50,.3); }
.pvp-top1:hover { border-color: var(--gold) !important; }
.pvp-top2:hover { border-color: #c0cdd6 !important; }
.pvp-top3:hover { border-color: #cd7f32 !important; }

.pvp-rank-badge {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 800; flex-shrink: 0;
}

/* ===== PVP ARENA ROWS ===== */
.pvp-team-info { min-width: 0; }
.pvp-team-name {
  font-size: .9rem; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px;
}
.pvp-team-members { font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pvp-member { font-weight: 600; }
.pvp-member-sep { color: var(--text3); }

.pvp-team-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.pvp-rating-badge {
  font-size: .75rem; font-weight: 800;
  background: rgba(224,96,96,.12); color: #e87070;
  border: 1px solid rgba(224,96,96,.22); border-radius: 20px; padding: 3px 9px;
  white-space: nowrap;
}

/* ===== PVP PLAYER ROWS ===== */
.pvp-player-info { min-width: 0; }
.pvp-name {
  font-size: .9rem; font-weight: 700; display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pvp-sub {
  font-size: .68rem; color: var(--text3); display: block; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pvp-player-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }

/* ===== PVP STAT BADGES ===== */
.pvp-record { font-size: .7rem; color: var(--text3); white-space: nowrap; }
.pvp-record small { opacity: .7; }

.pvp-kills-badge, .pvp-honor-pts-badge, .pvp-wins-badge, .pvp-games-badge {
  font-size: .68rem; font-weight: 700; border-radius: 20px; padding: 3px 9px;
  display: inline-flex; align-items: center; gap: 3px; white-space: nowrap;
}
.pvp-kills-badge {
  background: rgba(248,81,73,.1); color: #f85149;
  border: 1px solid rgba(248,81,73,.2);
}
.pvp-honor-pts-badge {
  background: rgba(240,180,41,.1); color: var(--gold);
  border: 1px solid rgba(240,180,41,.18);
}
.pvp-wins-badge {
  background: rgba(63,185,80,.1); color: var(--green);
  border: 1px solid rgba(63,185,80,.2);
}
.pvp-games-badge {
  background: rgba(56,139,253,.1); color: var(--accent);
  border: 1px solid rgba(56,139,253,.18);
}
.pvp-honor-pts-badge {
  background: rgba(240,180,41,.1); color: var(--gold);
  border: 1px solid rgba(240,180,41,.18);
}
.pvp-arena-pts-badge {
  background: rgba(188,140,255,.1); color: var(--purple);
  border: 1px solid rgba(188,140,255,.2);
}
.pvp-kills-badge small, .pvp-honor-pts-badge small, .pvp-arena-pts-badge small,
.pvp-wins-badge small, .pvp-games-badge small { font-weight: 400; opacity: .75; }

.pvp-empty {
  text-align: center; color: var(--text3);
  font-size: .83rem; padding: 60px 0;
}

/* ===== SIDEBAR OVERLAY (mobile backdrop) ===== */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 99;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform var(--t); }
  .sidebar.mobile-open { transform: translateX(0); box-shadow: var(--shadow); }
  .sidebar-toggle { display: none; }
  .sidebar-overlay { display: block; }
  .sidebar-overlay.visible { opacity: 1; pointer-events: auto; }
  .menu-btn { display: flex; }
  .stats-bar { display: none; }
  .refresh-countdown { display: none; }
  .achievement-grid, .rf-grid { grid-template-columns: 1fr; }
  .home-hero { min-height: auto; padding: 50px 20px 44px; }
  .home-hero-title { font-size: 1.7rem; }
  .home-hero-stats { padding: 10px 12px; flex-wrap: wrap; justify-content: center; border-radius: 16px; gap: 4px 0; }
  .home-stat { padding: 6px 14px; }
  .home-stat-sep, .home-stat-sep-pvp { display: none; }
  .home-stat-val { font-size: 1.2rem; }
  .home-feed { grid-template-columns: 1fr; padding: 20px 12px 32px; }
  .home-feed-col + .home-feed-col { border-left: none; border-top: 1px solid var(--border); padding-top: 24px; margin-top: 8px; }
  .plb-hero { padding: 28px 20px; }
  .plb-hero h2 { font-size: 1.2rem; }
  .plb-row { padding: 10px 12px; gap: 10px; grid-template-columns: 38px 1fr auto; }
  .plb-rank-badge { width: 34px; height: 34px; font-size: .72rem; }
  .plb-name { font-size: .83rem; }
  .plb-you-bar { left: 0; gap: 8px; padding: 10px 12px; }
  .plb-you-meta { display: none; }
  .plb-you-pts, .plb-you-honor { padding: 3px 8px; font-size: .68rem; }
  .pvp-hero { padding: 28px 20px; }
  .pvp-hero h2 { font-size: 1.2rem; }
  .pvp-tabs { gap: 3px; }
  .pvp-tab { padding: 6px 10px; font-size: .72rem; }
  .pvp-row { padding: 10px 12px; gap: 10px; grid-template-columns: 38px 1fr auto; }
  .pvp-rank-badge { width: 34px; height: 34px; font-size: .72rem; }
  .pvp-name, .pvp-team-name { font-size: .83rem; }
  .plb-search-wrap, .pvp-search-wrap { flex: 1; }
}
