:root {
  --bg: #05050f;
  --bg-elevated: #0d0d22;
  --card: #12122a;
  --cyan: #3ec8ff;
  --magenta: #b34bff;
  --pink: #ff4bd8;
  --text: #eef0ff;
  --text-dim: #9aa0c2;
  --border: rgba(255, 255, 255, 0.08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-top: var(--safe-top);
  padding-bottom: calc(64px + var(--safe-bottom));
  min-height: 100%;
  background:
    radial-gradient(circle at 20% 0%, rgba(179, 75, 255, 0.15), transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(62, 200, 255, 0.12), transparent 40%),
    var(--bg);
}

.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-chip img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--cyan);
}

.profile-chip .name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.gl-balance {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  color: var(--cyan);
}

/* ---------- page container ---------- */
.page {
  padding: 4px 12px 16px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  margin: 10px 4px 12px;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- game banners ---------- */
.games-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.game-banner {
  width: 100%;
  display: block;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.game-banner:active { transform: scale(0.98); }

.game-banner img {
  width: 100%;
  height: auto;
  display: block;
}

.game-banner-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
}

/* ---------- leaderboard ---------- */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.leaderboard-row .rank {
  width: 24px;
  text-align: center;
  font-weight: 800;
  color: var(--text-dim);
}

.leaderboard-row:nth-child(1) .rank { color: #ffd54b; }
.leaderboard-row:nth-child(2) .rank { color: #c9c9d9; }
.leaderboard-row:nth-child(3) .rank { color: #d98a4b; }

.leaderboard-row img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.leaderboard-row .info { flex: 1; min-width: 0; }
.leaderboard-row .info .name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.leaderboard-row .gl {
  font-weight: 700;
  color: var(--cyan);
  font-size: 13px;
}

/* ---------- profile page ---------- */
.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  margin-top: 8px;
}

.profile-card img {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--magenta);
}

.profile-card .name { font-size: 18px; font-weight: 700; }
.profile-card .username { color: var(--text-dim); font-size: 13px; }

.profile-card .gl-big {
  margin-top: 8px;
  font-size: 26px;
  font-weight: 800;
  color: var(--cyan);
}

/* ---------- bottom nav ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 8px 0 calc(8px + var(--safe-bottom));
  z-index: 10;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-dim);
  font-size: 11px;
  background: none;
  border: none;
  padding: 4px 14px;
}

.nav-item.active { color: var(--cyan); }

.nav-item .nav-icon {
  width: 22px;
  height: 22px;
}

.nav-item.center .nav-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
  margin-top: -18px;
  box-shadow: 0 4px 16px rgba(179, 75, 255, 0.4);
}

.nav-item.center .nav-icon-wrap svg { width: 24px; height: 24px; color: #05050f; }

.loading-text {
  text-align: center;
  color: var(--text-dim);
  padding: 30px 0;
  font-size: 13px;
}
