/* ============================================================
   CHISELCRAFT LEADERBOARDS — leaderboards.css
   War-room aesthetic: dark stone, gold/ember/rune accents
   ============================================================ */

:root {
  --obsidian: #0a0a0f;
  --stone:    #111118;
  --slate:    #1a1a26;
  --ember:    #e8621a;
  --gold:     #d4a017;
  --silver:   #9ca3af;
  --bronze:   #b45309;
  --rune:     #5b9cf6;
  --violet:   #9b59f5;
  --mist:     #a0aec0;

  /* Medal colors */
  --rank1-color: #f0c040;
  --rank1-glow:  rgba(240,192,64,0.25);
  --rank2-color: #c0c8d8;
  --rank2-glow:  rgba(192,200,216,0.18);
  --rank3-color: #c8834c;
  --rank3-glow:  rgba(200,131,76,0.20);
}

/* ─── BASE ────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Crimson Pro', serif; -webkit-font-smoothing: antialiased; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--obsidian); }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 3px; }
::selection { background: rgba(212,160,23,0.25); }

/* ─── NAVBAR ─────────────────────────────────────────────── */
#navbar { background: transparent; transition: background 0.4s, backdrop-filter 0.4s, border-color 0.4s; }
#navbar.scrolled { background: rgba(10,10,15,0.92); border-bottom: 1px solid rgba(212,160,23,0.12); backdrop-filter: blur(18px); }
.nav-link { position: relative; }
.nav-link::after { content: ''; position: absolute; bottom: 0; left: 50%; right: 50%; height: 1px; background: var(--gold); transition: left .3s, right .3s; }
.nav-link:hover::after { left: 16px; right: 16px; }
.lb-mobile-menu { background: rgba(10,10,15,0.97); border-top: 1px solid rgba(212,160,23,0.1); backdrop-filter: blur(20px); }
.btn-discord { background: rgba(88,101,242,0.15); border: 1px solid rgba(88,101,242,0.4); color: #a5b4fc; letter-spacing: .1em; }
.btn-discord:hover { background: rgba(88,101,242,0.3); border-color: rgba(88,101,242,0.7); color: #fff; box-shadow: 0 0 16px rgba(88,101,242,0.3); }
.btn-ip { background: rgba(212,160,23,0.1); border: 1px solid rgba(212,160,23,0.35); color: var(--gold); letter-spacing: .1em; }
.btn-ip:hover { background: rgba(212,160,23,0.2); border-color: rgba(212,160,23,0.7); color: #fff; box-shadow: 0 0 16px rgba(212,160,23,0.25); }

/* ─── AMBIENT + HERO ─────────────────────────────────────── */
.lb-ambient {
  background:
    radial-gradient(ellipse 60% 50% at 15% 20%, rgba(212,160,23,0.05) 0%, transparent 55%),
    radial-gradient(ellipse 55% 45% at 85% 70%, rgba(232,98,26,0.04) 0%, transparent 55%),
    radial-gradient(ellipse 50% 60% at 50% 50%, rgba(91,156,246,0.03) 0%, transparent 55%);
}

.lb-hero { background: var(--obsidian); }
.lb-hero-bg {
  background:
    radial-gradient(ellipse 90% 70% at 50% -10%, rgba(212,160,23,0.09) 0%, transparent 60%),
    var(--obsidian);
}
.lb-hero-grid {
  background-image:
    linear-gradient(rgba(212,160,23,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212,160,23,0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 100% 70% at 50% 0%, black 10%, transparent 80%);
  opacity: 0.6;
}

.lb-title-main {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(2rem, 6vw, 4rem);
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.04em;
}
.lb-title-accent {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(2.4rem, 8vw, 5.5rem);
  background: linear-gradient(135deg, var(--gold) 30%, var(--ember) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 30px rgba(212,160,23,0.3));
}

.lb-live-badge {
  background: rgba(17,17,24,0.8);
  border: 1px solid rgba(212,160,23,0.2);
  backdrop-filter: blur(12px);
}

/* ─── PODIUM ─────────────────────────────────────────────── */
.lb-podium-wrap {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 12px;
  max-width: 680px;
  margin: 0 auto;
  animation: podiumRise 0.8s ease both;
}
@keyframes podiumRise {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (max-width: 500px) {
  .lb-podium-wrap { grid-template-columns: 1fr; max-width: 280px; }
}

.podium-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 1rem 1rem;
  border-radius: 14px;
  background: rgba(17,17,24,0.75);
  border: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s;
}
.podium-card:hover { transform: translateY(-4px); }

/* Rank-specific podium styles */
.podium-card-1 {
  border-color: rgba(240,192,64,0.3);
  box-shadow: 0 0 40px rgba(240,192,64,0.1), 0 8px 32px rgba(0,0,0,0.4);
  order: 2;
}
.podium-card-2 {
  border-color: rgba(192,200,216,0.2);
  box-shadow: 0 0 24px rgba(192,200,216,0.07);
  order: 1;
  margin-top: 24px;
}
.podium-card-3 {
  border-color: rgba(200,131,76,0.2);
  box-shadow: 0 0 24px rgba(200,131,76,0.07);
  order: 3;
  margin-top: 24px;
}
@media (max-width: 500px) {
  .podium-card-1, .podium-card-2, .podium-card-3 { order: unset; margin-top: 0; }
}

.podium-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 14px;
}
.podium-glow-1 { background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(240,192,64,0.12) 0%, transparent 60%); }
.podium-glow-2 { background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(192,200,216,0.08) 0%, transparent 60%); }
.podium-glow-3 { background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(200,131,76,0.09) 0%, transparent 60%); }

.podium-medal {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 8px currentColor);
  animation: medalSpin 0.6s ease both;
}
@keyframes medalSpin {
  from { transform: rotateY(90deg) scale(0.5); opacity: 0; }
  to   { transform: rotateY(0deg) scale(1); opacity: 1; }
}

.podium-avatar {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  image-rendering: pixelated;
  margin-bottom: 0.5rem;
  transition: transform 0.3s;
}
.podium-card-1 .podium-avatar {
  width: 62px;
  height: 62px;
  border: 2px solid rgba(240,192,64,0.4);
  box-shadow: 0 0 16px rgba(240,192,64,0.25);
}
.podium-card:hover .podium-avatar { transform: scale(1.08); }

.podium-name {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  text-align: center;
  margin-bottom: 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.podium-bounty {
  font-family: 'Cinzel Decorative', serif;
  font-size: 0.9rem;
}
.podium-card-1 .podium-bounty { color: var(--rank1-color); }
.podium-card-2 .podium-bounty { color: var(--rank2-color); }
.podium-card-3 .podium-bounty { color: var(--rank3-color); }

/* Kingdom podium icon */
.podium-kingdom-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 10px rgba(212,160,23,0.3));
}

/* ─── TABS ───────────────────────────────────────────────── */
.lb-tabs-wrap {
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 0;
}

.lb-tab {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  color: rgba(160,174,192,0.6);
  position: relative;
  overflow: hidden;
  transition: background 0.3s, border-color 0.3s, color 0.3s, box-shadow 0.3s;
}
.lb-tab::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 2px;
  background: transparent;
  transition: background 0.3s;
}
.lb-tab:hover {
  background: rgba(212,160,23,0.06);
  border-color: rgba(212,160,23,0.2);
  color: rgba(212,160,23,0.8);
}

.lb-tab-active {
  background: rgba(212,160,23,0.1) !important;
  border-color: rgba(212,160,23,0.35) !important;
  color: var(--gold) !important;
  box-shadow: 0 0 20px rgba(212,160,23,0.12) !important;
}
.lb-tab-active::after { background: var(--gold) !important; }

.tab-icon { font-size: 0.9rem; }

/* ─── TABLE CARD ─────────────────────────────────────────── */
.lb-card {
  background: rgba(14,14,20,0.85);
  border: 1px solid rgba(212,160,23,0.12);
  backdrop-filter: blur(16px);
  box-shadow: 0 0 60px rgba(212,160,23,0.04), 0 24px 48px rgba(0,0,0,0.4);
  transition: box-shadow 0.4s;
}
.lb-card:hover { box-shadow: 0 0 80px rgba(212,160,23,0.08), 0 24px 48px rgba(0,0,0,0.4); }

.lb-card-glow {
  background: radial-gradient(ellipse 70% 30% at 50% 0%, rgba(212,160,23,0.06) 0%, transparent 60%);
  pointer-events: none;
}
.lb-card-glow-kingdoms {
  background: radial-gradient(ellipse 70% 30% at 50% 0%, rgba(232,98,26,0.06) 0%, transparent 60%);
  pointer-events: none;
}

/* Grid layouts */
.lb-grid-players {
  grid-template-columns: 56px 1fr 120px;
  align-items: center;
}
.lb-grid-kingdoms {
  grid-template-columns: 56px 1fr 120px;
  align-items: center;
}
@media (max-width: 480px) {
  .lb-grid-players, .lb-grid-kingdoms { grid-template-columns: 44px 1fr 80px; }
}

/* Table header */
.lb-table-header {
  background: rgba(10,10,15,0.6);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* ─── TABLE ROWS ─────────────────────────────────────────── */
.lb-row {
  display: grid;
  align-items: center;
  padding: 0.9rem 1.5rem;
  transition: background 0.25s, transform 0.2s;
  position: relative;
  overflow: hidden;
  cursor: default;
  animation: rowSlideIn 0.4s ease both;
}
.lb-row-players   { grid-template-columns: 56px 1fr 120px; }
.lb-row-kingdoms  { grid-template-columns: 56px 1fr 120px; }

@media (max-width: 480px) {
  .lb-row-players, .lb-row-kingdoms { grid-template-columns: 44px 1fr 80px; padding: 0.75rem 1rem; }
}

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

.lb-row:hover {
  background: rgba(212,160,23,0.04);
  transform: translateX(3px);
}
.lb-row:hover::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--gold);
  opacity: 0.5;
}

/* Rank 1 row */
.lb-row-rank1 {
  background: linear-gradient(90deg, rgba(240,192,64,0.07) 0%, transparent 60%);
  border-left: 2px solid rgba(240,192,64,0.35);
}
.lb-row-rank1:hover { background: linear-gradient(90deg, rgba(240,192,64,0.12) 0%, transparent 60%); }
.lb-row-rank1:hover::before { background: var(--rank1-color); opacity: 1; }

/* Rank 2 row */
.lb-row-rank2 {
  background: linear-gradient(90deg, rgba(192,200,216,0.05) 0%, transparent 60%);
  border-left: 2px solid rgba(192,200,216,0.25);
}
.lb-row-rank2:hover { background: linear-gradient(90deg, rgba(192,200,216,0.09) 0%, transparent 60%); }

/* Rank 3 row */
.lb-row-rank3 {
  background: linear-gradient(90deg, rgba(200,131,76,0.05) 0%, transparent 60%);
  border-left: 2px solid rgba(200,131,76,0.25);
}
.lb-row-rank3:hover { background: linear-gradient(90deg, rgba(200,131,76,0.09) 0%, transparent 60%); }

/* ─── RANK BADGE ─────────────────────────────────────────── */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-family: 'Cinzel Decorative', serif;
  font-size: 0.75rem;
  font-weight: 700;
}
.rank-badge-1 {
  background: rgba(240,192,64,0.15);
  border: 1px solid rgba(240,192,64,0.4);
  color: var(--rank1-color);
  box-shadow: 0 0 12px rgba(240,192,64,0.2);
}
.rank-badge-2 {
  background: rgba(192,200,216,0.1);
  border: 1px solid rgba(192,200,216,0.3);
  color: var(--rank2-color);
}
.rank-badge-3 {
  background: rgba(200,131,76,0.1);
  border: 1px solid rgba(200,131,76,0.3);
  color: var(--rank3-color);
}
.rank-badge-other {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  color: rgba(160,174,192,0.5);
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
}

/* ─── PLAYER CELL ────────────────────────────────────────── */
.player-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.player-head {
  width: 34px;
  height: 34px;
  border-radius: 5px;
  image-rendering: pixelated;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
  background: rgba(255,255,255,0.04);
}
.lb-row:hover .player-head {
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(212,160,23,0.25);
}
.player-head-skeleton {
  width: 34px; height: 34px;
  border-radius: 5px;
  background: rgba(255,255,255,0.06);
  flex-shrink: 0;
  animation: skeletonPulse 1.6s ease-in-out infinite;
}

.player-name {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}
.lb-row:hover .player-name { color: var(--gold); }

.player-name-loading {
  height: 12px;
  width: 120px;
  border-radius: 4px;
  background: rgba(255,255,255,0.07);
  animation: skeletonPulse 1.6s ease-in-out infinite;
}

/* ─── KINGDOM CELL ───────────────────────────────────────── */
.kingdom-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.kingdom-emblem {
  width: 34px; height: 34px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: rgba(212,160,23,0.08);
  border: 1px solid rgba(212,160,23,0.15);
  flex-shrink: 0;
  transition: transform 0.2s;
}
.lb-row:hover .kingdom-emblem { transform: scale(1.1); }

.kingdom-name {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}
.lb-row:hover .kingdom-name { color: var(--ember); }

/* ─── BOUNTY CELL ────────────────────────────────────────── */
.bounty-cell {
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}
.bounty-value {
  font-family: 'Cinzel Decorative', serif;
  font-size: 0.85rem;
  color: rgba(212,160,23,0.85);
  transition: color 0.2s;
}
.lb-row:hover .bounty-value { color: var(--gold); }
.bounty-dash {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: rgba(160,174,192,0.25);
  letter-spacing: 0.1em;
}
.bounty-icon { font-size: 0.65rem; opacity: 0.5; }

.bounty-loading {
  height: 12px;
  width: 60px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  margin-left: auto;
  animation: skeletonPulse 1.6s ease-in-out infinite;
}

/* ─── SKELETON ANIMATION ─────────────────────────────────── */
@keyframes skeletonPulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 0.2; }
}

/* ─── EMPTY STATE ────────────────────────────────────────── */
.lb-empty-state { border-top: 1px solid rgba(255,255,255,0.04); }

/* ─── TOAST ──────────────────────────────────────────────── */
.lb-toast {
  background: rgba(17,17,24,0.97);
  border: 1px solid rgba(212,160,23,0.4);
  color: var(--gold);
  backdrop-filter: blur(16px);
  transform: translateX(-50%) translateY(20px);
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
}
.lb-toast.show {
  opacity: 1 !important;
  transform: translateX(-50%) translateY(0) !important;
  pointer-events: auto;
}

/* ─── PANEL TRANSITION ───────────────────────────────────── */
.lb-panel { animation: panelFadeIn 0.35s ease both; }
@keyframes panelFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── ROW STAGGER DELAYS ─────────────────────────────────── */
.lb-row:nth-child(1)  { animation-delay: 0.02s; }
.lb-row:nth-child(2)  { animation-delay: 0.06s; }
.lb-row:nth-child(3)  { animation-delay: 0.10s; }
.lb-row:nth-child(4)  { animation-delay: 0.14s; }
.lb-row:nth-child(5)  { animation-delay: 0.18s; }
.lb-row:nth-child(6)  { animation-delay: 0.22s; }
.lb-row:nth-child(7)  { animation-delay: 0.26s; }
.lb-row:nth-child(8)  { animation-delay: 0.30s; }
.lb-row:nth-child(9)  { animation-delay: 0.34s; }
.lb-row:nth-child(10) { animation-delay: 0.38s; }

/* ─── REFRESH SPIN ───────────────────────────────────────── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.refreshing svg { animation: spin 1s linear infinite; }
