:root {
  --bg-color: #0d0d0e;
  --card-bg: #18181c;
  --card-bg-hover: #222227;
  --text-primary: #ffffff;
  --text-secondary: #a0a0ab;
  --accent-gold: #e5b842;
  --accent-silver: #a3a3a3;
  --accent-bronze: #cd7f32;
  --accent-blue: #248bf2;
  --footer-bg: #1c1c24;
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 16px;
  overflow-x: hidden;
  padding-bottom: 90px; /* Space for sticky footer */
}

/* Header */
.app-header {
  text-align: center;
  padding: 24px 16px 12px;
}

.app-header h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 0%, #a0a0ab 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Tabs Container */
.tabs-container {
  display: flex;
  justify-content: center;
  padding: 8px 16px 20px;
}

.tabs-pill {
  display: flex;
  background-color: #121216;
  border-radius: 20px;
  padding: 4px;
  width: 100%;
  max-width: 380px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 0;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.tab-btn.active {
  background-color: var(--card-bg);
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Leaderboard List */
.leaderboard-container {
  padding: 0 16px;
  max-width: 500px;
  margin: 0 auto;
}

.leaderboard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Leaderboard Item */
.leaderboard-item {
  display: flex;
  align-items: center;
  background-color: var(--card-bg);
  border-radius: 16px;
  padding: 12px 16px;
  transition: transform 0.2s ease, background-color 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.02);
  animation: fadeIn 0.4s ease forwards;
}

.leaderboard-item:hover {
  background-color: var(--card-bg-hover);
  transform: translateY(-1px);
}

/* Gold rank styling */
.leaderboard-item.rank-1 {
  border: 1px solid rgba(229, 184, 66, 0.3);
  box-shadow: 0 4px 15px rgba(229, 184, 66, 0.05);
}

.rank-number-box {
  width: 32px;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Medals */
.medal {
  font-size: 20px;
  display: inline-block;
}

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

/* User Avatar */
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  margin-left: 12px;
  margin-right: 14px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Avatar placeholder fallback */
.avatar-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  margin-left: 12px;
  margin-right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* User Name Info */
.user-info {
  flex-grow: 1;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-username {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* XP Badge */
.xp-badge {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.rank-1 .xp-badge {
  background-color: rgba(229, 184, 66, 0.1);
  color: var(--accent-gold);
  border: 1px solid rgba(229, 184, 66, 0.2);
}

.rank-2 .xp-badge {
  background-color: rgba(163, 163, 163, 0.1);
  color: var(--accent-silver);
  border: 1px solid rgba(163, 163, 163, 0.2);
}

.rank-3 .xp-badge {
  background-color: rgba(205, 127, 50, 0.1);
  color: var(--accent-bronze);
  border: 1px solid rgba(205, 127, 50, 0.2);
}

/* Sticky Footer (YOU) */
.user-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--footer-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px 20px;
  z-index: 100;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease;
}

.user-footer.hidden {
  transform: translateY(100%);
}

.user-footer-content {
  display: flex;
  align-items: center;
  max-width: 460px;
  margin: 0 auto;
}

.you-badge {
  background: linear-gradient(135deg, var(--accent-blue) 0%, #1765c1 100%);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  margin-right: 12px;
}

.footer-rank {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  width: 32px;
  text-align: center;
}

.footer-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  margin-left: 8px;
  margin-right: 12px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.footer-name {
  flex-grow: 1;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.footer-xp {
  background-color: rgba(36, 139, 242, 0.15);
  color: var(--accent-blue);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid rgba(36, 139, 242, 0.3);
}

/* Loading spinner */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-top: 3px solid var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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