/* Leaderboard page — layout and components.
   Shares the playfield's 3/4 frame so both boxes match. */

.leaderboard-page {
  width: min(390px, 100%);
  padding: 0 12px 52px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 2;
}

/* Same frame as the playfield's #board. */
.leaderboard-page .board-frame {
  width: 100%;
}

.panel {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  min-height: 440px;
  max-height: min(62dvh, 540px);
  border-radius: 18px;
  overflow: hidden;
  box-sizing: border-box;
  background:
    linear-gradient(rgba(160, 195, 220, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(160, 195, 220, 0.22) 1px, transparent 1px),
    linear-gradient(180deg, #f3f9ff 0%, #eef6ff 55%, #e6f1ff 100%);
  background-size: 22px 22px, 22px 22px, auto;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 1px 0 #fff;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.panel-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex: none;
}

.back {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  border: 1px solid #fff;
  background: linear-gradient(180deg, #fff, #eef8ff);
  color: #2a4a6b;
  box-shadow: 0 6px 16px rgba(90, 150, 210, 0.18), inset 0 1px 0 #fff;
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
}

.panel h1 {
  font-size: 13px;
  letter-spacing: 0.13em;
  font-weight: 900;
  margin: 0;
}

.me-line {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  opacity: 0.72;
  margin-bottom: 8px;
  flex: none;
  min-height: 14px;
}

.panel-rows {
  flex: 1;
  overflow-y: auto;
  display: grid;
  gap: 6px;
  align-content: start;
  -webkit-overflow-scrolling: touch;
}

.rows {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

/* Slim row: rank, identity, stats only (no badge column). */
.rows li {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 1px 0 #fff;
  flex: none;
}

/* Space constraint: only the top 6 rows are shown. */
.rows li:nth-child(n + 7) {
  display: none;
}

.rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
  color: #2a4a6b;
  background: linear-gradient(180deg, #fff, #eaf6ff);
  border: 1px solid #fff;
}

.name {
  font-weight: 800;
  font-size: 13px;
  line-height: 1.2;
}

.stats {
  font-size: 11px;
  opacity: 0.78;
  line-height: 1.3;
}

.rows li.me {
  background: rgba(14, 116, 144, 0.12);
  border-color: rgba(14, 116, 144, 0.35);
}

.rows li.me .rank {
  color: #0e7490;
}

.you {
  font-size: 9px;
  font-weight: 900;
  color: #0e7490;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.empty {
  opacity: 0.72;
  font-size: 13px;
  padding: 12px 2px;
}

.status {
  flex: none;
  min-height: 16px;
  font-size: 11px;
  opacity: 0.78;
  margin-top: 6px;
}

/* Mobile: tighten padding and let the panel fill the viewport. */
@media (max-width: 480px) {
  .leaderboard-page {
    padding: 0 8px 48px;
    gap: 8px;
  }

  .panel {
    padding: 10px;
    min-height: 0;
    max-height: none;
    flex: 1;
  }

  .panel-top {
    margin-bottom: 8px;
  }

  .rows li {
    padding: 6px 8px;
  }
}

@media (max-height: 700px) {
  .panel {
    min-height: 0;
  }
}

/* Credit pill — fixed at the very bottom, centered. */
.credit-pill {
  position: fixed;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #2a4a6b;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 6px 16px rgba(90, 150, 210, 0.2), inset 0 1px 0 #fff;
  z-index: 50;
  white-space: nowrap;
  pointer-events: none;
}

/* On small screens keep the pill centered and clear of
   the dock, never drifting to the side — same as the
   main playfield page. */
@media (max-width: 480px) {
  .credit-pill {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: max(8px, env(safe-area-inset-bottom));
    font-size: 10px;
    padding: 6px 14px;
  }
}

