* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Fredoka", sans-serif;
  background: linear-gradient(180deg, #eaf3ff 0%, #dbe9ff 55%, #ffffff 55%);
  min-height: 100vh;
  color: #22314a;
}

.lb-page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
}

.lb-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 10px;
}

.lb-back {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: #1266d8;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 8px rgba(18, 102, 216, 0.15);
  text-decoration: none;
  flex: none;
}

.lb-topbar h1 {
  font-size: 1.3rem;
  margin: 0;
  color: #22314a;
  font-weight: 800;
  flex: 1;
  text-align: center;
  margin-right: 36px;
}

.lb-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 2px 16px 16px;
  padding: 6px;
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(18, 102, 216, 0.1);
  /* 4+ tabs (Math Race / Lang & Arts / SolarQuest / MathVille, and any
     future game) can't always fit one row at this font size on a narrow
     phone -- scroll instead of forcing each tab to squeeze/overflow the
     pill's rounded edge. */
  overflow-x: auto;
  scrollbar-width: none;
}
.lb-tabs::-webkit-scrollbar { display: none; }

.lb-tab {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  background: transparent;
  color: #5c6f8a;
  border: none;
  white-space: nowrap;
  font-family: inherit;
  cursor: pointer;
}

.lb-tab img {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  flex: none;
  object-fit: cover;
}

.lb-tab.active {
  background: #1266d8;
  color: #fff;
  box-shadow: 0 4px 10px rgba(18, 102, 216, 0.35);
}

.lb-metric-label {
  text-align: center;
  font-size: 0.75rem;
  color: #5c6f8a;
  padding: 0 16px 18px;
}

.lb-metric-label b {
  color: #1266d8;
}

/* ---------- podium ---------- */
.lb-podium {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: end;
  padding: 0 14px;
  gap: 8px;
}

.lb-p-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lb-p-slot.empty {
  visibility: hidden;
}

.lb-p-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  margin-bottom: 8px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

.lb-p-slot.first .lb-p-avatar {
  width: 68px;
  height: 68px;
  font-size: 1.4rem;
  border: 3px solid #f4b400;
}

.lb-p-slot.second .lb-p-avatar {
  border: 3px solid #a8b3c2;
}

.lb-p-slot.third .lb-p-avatar {
  border: 3px solid #c98a4b;
}

.lb-p-name {
  font-weight: 800;
  font-size: 0.85rem;
  text-align: center;
}

.lb-p-score {
  font-size: 0.68rem;
  color: #5c6f8a;
  margin-bottom: 10px;
  text-align: center;
}

.lb-p-bar {
  width: 100%;
  border-radius: 14px 14px 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  padding-bottom: 8px;
}

.lb-p-slot.first .lb-p-bar {
  height: 150px;
  background: linear-gradient(180deg, #ffd35c, #f4b400);
}

.lb-p-slot.second .lb-p-bar {
  height: 110px;
  background: linear-gradient(180deg, #c7d0db, #a8b3c2);
}

.lb-p-slot.third .lb-p-bar {
  height: 85px;
  background: linear-gradient(180deg, #dba46b, #c98a4b);
}

@keyframes lb-glow {
  0%, 100% { box-shadow: 0 0 6px 2px rgba(244, 180, 0, 0.55), 0 6px 14px rgba(0, 0, 0, 0.18); }
  50% { box-shadow: 0 0 18px 8px rgba(255, 211, 92, 0.9), 0 6px 14px rgba(0, 0, 0, 0.18); }
}

.lb-p-slot.first .lb-p-avatar {
  animation: lb-glow 1.8s ease-in-out infinite;
}

/* ---------- your position + list ---------- */
.lb-you {
  margin: 0 14px 10px;
  padding: 10px 16px;
  border-radius: 0 0 14px 14px;
  background: linear-gradient(120deg, #1266d8, #3a8bef);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(18, 102, 216, 0.35);
  position: relative;
  z-index: 1;
}

.lb-you.hidden {
  display: none;
}

.lb-you .rank {
  font-weight: 800;
  font-size: 1rem;
  width: 30px;
  text-align: center;
}

.lb-you .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.78rem;
  flex: none;
}

.lb-you .info {
  flex: 1;
  min-width: 0;
}

.lb-you .label {
  font-size: 0.62rem;
  opacity: 0.85;
}

.lb-you .name {
  font-weight: 800;
  font-size: 0.9rem;
}

.lb-you .score {
  font-weight: 800;
  font-size: 0.88rem;
}

.lb-list {
  padding: 0 14px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 2px 8px rgba(18, 102, 216, 0.08);
}

.lb-row .rank {
  width: 22px;
  text-align: center;
  font-weight: 700;
  color: #5c6f8a;
  font-size: 0.9rem;
}

.lb-row .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.78rem;
  color: #fff;
  flex: none;
}

.lb-row .name {
  flex: 1;
  font-weight: 700;
  font-size: 0.9rem;
}

.lb-row .score {
  font-weight: 800;
  color: #1266d8;
  font-size: 0.88rem;
}

.lb-empty {
  text-align: center;
  color: #5c6f8a;
  font-size: 0.9rem;
  padding: 40px 24px;
  line-height: 1.6;
}

.lb-empty.hidden,
.lb-podium.hidden,
.lb-list.hidden {
  display: none;
}
