:root {
  --bg: #080a10;
  --surface: #0e121c;
  --surface-hover: #141926;
  --border: rgba(255, 255, 255, 0.08);
  --text: #eef2f7;
  --muted: #7c879b;
  --gold: #f5b915;
  --silver: #cbd5e1;
  --bronze: #c77a3a;
  --green: #34d399;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.45;
}

.cosmos-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 50% 18%, rgba(245, 185, 21, 0.05), transparent 70%),
    radial-gradient(1px 1px at 15% 22%, rgba(255,255,255,0.22), transparent),
    radial-gradient(1px 1px at 42% 14%, rgba(255,255,255,0.25), transparent),
    radial-gradient(1px 1px at 68% 30%, rgba(255,255,255,0.18), transparent),
    radial-gradient(1px 1px at 85% 19%, rgba(255,255,255,0.22), transparent),
    radial-gradient(1px 1px at 26% 68%, rgba(255,255,255,0.18), transparent),
    radial-gradient(1px 1px at 77% 74%, rgba(255,255,255,0.18), transparent);
  background-color: var(--bg);
}

.container {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
}

.pixel-icon {
  image-rendering: pixelated;
  object-fit: contain;
  display: inline-block;
  flex-shrink: 0;
}

.xs-icon { width: 17px; height: 17px; }
.sm-icon { width: 20px; height: 20px; }
.brand-icon { width: 24px; height: 24px; }

/* Topbar */
.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(8, 10, 16, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
}

.brand-name {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.14em;
}

.search-box {
  flex: 1;
  max-width: 340px;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px 3px 3px 12px;
}

.search-box:focus-within {
  border-color: rgba(245, 185, 21, 0.55);
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.88rem;
  min-width: 0;
}

.search-submit {
  background: #1b2234;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.search-submit:hover {
  background: #232c42;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.status-dot.offline {
  background: #64748b;
}

.ip-btn {
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid rgba(245, 185, 21, 0.35);
  color: var(--gold);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.ip-btn:hover {
  border-color: var(--gold);
}

.search-feedback {
  text-align: center;
  margin-top: 14px;
  min-height: 18px;
  font-size: 0.86rem;
  color: #fca5a5;
}

.suggestion-link {
  color: var(--gold);
  text-decoration: underline;
  cursor: pointer;
  margin: 0 4px;
}

/* Player profile card */
.hidden {
  display: none !important;
}

.player-profile-section {
  margin: 14px 0 28px;
}

.profile-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
}

.profile-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 7px;
  font-size: 1.1rem;
  cursor: pointer;
}

.profile-close:hover {
  color: var(--text);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.profile-render-wrap {
  width: 110px;
  height: 158px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.profile-render {
  max-height: 140px;
  width: auto;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.65));
}

.profile-summary {
  flex: 1;
  min-width: 240px;
}

.profile-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.profile-title-row h2 {
  font-size: 1.45rem;
}

.profile-uuid {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: monospace;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.stat-box {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
}

.stat-value {
  font-size: 1rem;
  font-weight: 700;
}

.stat-value.gold { color: var(--gold); }

.profile-kits-wrap {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.profile-kits-wrap h3 {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 600;
}

.profile-kits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 8px;
}

.kit-stat-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}

.kit-stat-card strong {
  display: block;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.kit-stat-card span {
  font-size: 0.76rem;
  color: var(--muted);
}

/* Leaderboard */
.leaderboard-section {
  padding: 26px 0 56px;
}

.section-header {
  text-align: center;
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.95rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -0.01em;
}

/* Podium */
.podium-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 0 auto 24px;
  max-width: 840px;
}

.laurel {
  width: 96px;
  height: 190px;
  color: rgba(212, 162, 52, 0.34);
  flex-shrink: 0;
}

.podium-grid {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.podium-card {
  position: relative;
  width: 178px;
  border-radius: 12px;
  padding: 14px 12px 14px;
  text-align: center;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #0d1018;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.podium-card:hover {
  transform: translateY(-3px);
}

.podium-card.rank-1 {
  order: 2;
  width: 196px;
  min-height: 278px;
  border-color: rgba(245, 185, 21, 0.38);
  background: linear-gradient(180deg, rgba(245, 185, 21, 0.04) 0%, #0d1018 55%, rgba(245, 185, 21, 0.16) 100%);
}

.podium-card.rank-2 {
  order: 1;
  min-height: 242px;
  border-color: rgba(203, 213, 225, 0.25);
  background: linear-gradient(180deg, rgba(203, 213, 225, 0.03) 0%, #0d1018 55%, rgba(203, 213, 225, 0.11) 100%);
}

.podium-card.rank-3 {
  order: 3;
  min-height: 222px;
  border-color: rgba(199, 122, 58, 0.28);
  background: linear-gradient(180deg, rgba(199, 122, 58, 0.03) 0%, #0d1018 55%, rgba(199, 122, 58, 0.12) 100%);
}

.podium-name {
  font-weight: 700;
  font-size: 0.98rem;
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-1 .podium-name { color: var(--gold); font-size: 1.08rem; }
.rank-2 .podium-name { color: #e2e8f0; }
.rank-3 .podium-name { color: #e2a072; }

.podium-skin {
  height: 112px;
  width: auto;
  margin: 0 auto;
  display: block;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.75));
}

.rank-1 .podium-skin {
  height: 130px;
}

.podium-bar {
  height: 2px;
  width: 72%;
  margin: 6px auto 6px;
  border-radius: 2px;
  opacity: 0.6;
}

.rank-1 .podium-bar { background: var(--gold); }
.rank-2 .podium-bar { background: var(--silver); }
.rank-3 .podium-bar { background: var(--bronze); }

.podium-rank-num {
  font-size: 1.95rem;
  font-weight: 800;
  line-height: 1.05;
}

.rank-1 .podium-rank-num { color: var(--gold); }
.rank-2 .podium-rank-num { color: var(--silver); }
.rank-3 .podium-rank-num { color: var(--bronze); }

.podium-metric {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 3px;
}

/* Rank List (#4+) */
.rank-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 600px;
  margin: 0 auto 28px;
}

.rank-row {
  display: grid;
  grid-template-columns: 36px 30px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.rank-row:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.16);
}

.rank-num {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--muted);
  text-align: center;
}

.rank-avatar {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  image-rendering: pixelated;
}

.rank-player {
  font-weight: 600;
  font-size: 0.92rem;
}

.rank-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--muted);
}

.rank-stats strong {
  color: var(--text);
}

/* Controls below leaderboard */
.controls-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.pill-group {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
}

.pill {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.pill:hover {
  color: var(--text);
}

.pill.active {
  background: rgba(245, 185, 21, 0.14);
  color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(245, 185, 21, 0.35);
}

.kit-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 720px;
  margin: 0 auto;
}

.kit-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.kit-tab:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.kit-tab.active {
  color: var(--text);
  background: #151b2a;
  border-color: rgba(245, 185, 21, 0.45);
}

.empty-state {
  text-align: center;
  padding: 32px 20px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 520px;
  margin: 0 auto 24px;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 18px 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-inner {
  display: flex;
  justify-content: center;
}

@media (max-width: 780px) {
  .laurel { display: none; }
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 0; }
  .search-box { order: 3; max-width: 100%; width: 100%; }
}

@media (max-width: 600px) {
  .podium-card.rank-1 { order: 1; width: 100%; max-width: 260px; }
  .podium-card.rank-2 { order: 2; width: 47%; min-width: 145px; }
  .podium-card.rank-3 { order: 3; width: 47%; min-width: 145px; }
}
