/* Savanah leaderboard — e-sports themed dashboard.
 *
 * Palette: deep-savanna black-greens with sunrise gold + crimson accent.
 * Pixel-art conventions from icons/CLAUDE.md: nearest filtering on every
 * .png so the 16×16 species/rank sprites stay crisp at any zoom.
 */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background:
    radial-gradient(ellipse at 30% -10%, #2a1f0a 0%, transparent 55%),
    radial-gradient(ellipse at 80% -5%, #3a1a0a 0%, transparent 50%),
    linear-gradient(180deg, #0c1410 0%, #050907 100%);
  background-attachment: fixed;
  color: #e8e6df;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: #ffd133; text-decoration: none; }
a:hover { text-decoration: underline; }
img { image-rendering: pixelated; image-rendering: -moz-crisp-edges; image-rendering: crisp-edges; }

/* ─── PIXELARTICONS ────────────────────────────────────────────────────
 *
 * https://pixelarticons.com — 24×24 pixel-art SVG icons. We don't ship a
 * build step; load each icon as a CSS mask from jsdelivr's CDN copy of
 * the npm package so the foreground color comes from `currentColor` (CSS
 * mask + flat background lets us tint per call site without per-icon
 * dupes). Add a new icon = one .pa-foo class with --icon mask URL.
 */
.pa-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
          mask: var(--icon) center / contain no-repeat;
  vertical-align: middle;
  flex-shrink: 0;
}
/* AIDEV-NOTE: pixelarticons@1.8.1 has no skull/medal/timer/sword. Verified
 * names below; before adding more, check via:
 *   curl -sf https://cdn.jsdelivr.net/npm/pixelarticons@1.8.1/svg/<name>.svg
 */
.pa-trophy        { --icon: url("https://cdn.jsdelivr.net/npm/pixelarticons@1.8.1/svg/trophy.svg"); }
.pa-timer         { --icon: url("https://cdn.jsdelivr.net/npm/pixelarticons@1.8.1/svg/clock.svg"); }
.pa-bullseye-arrow { --icon: url("https://cdn.jsdelivr.net/npm/pixelarticons@1.8.1/svg/bullseye-arrow.svg"); }
.pa-bullseye     { --icon: url("https://cdn.jsdelivr.net/npm/pixelarticons@1.8.1/svg/bullseye.svg"); }
.pa-flag         { --icon: url("https://cdn.jsdelivr.net/npm/pixelarticons@1.8.1/svg/flag.svg"); }
.pa-heart        { --icon: url("https://cdn.jsdelivr.net/npm/pixelarticons@1.8.1/svg/heart.svg"); }
.pa-shield       { --icon: url("https://cdn.jsdelivr.net/npm/pixelarticons@1.8.1/svg/shield.svg"); }
.pa-radio        { --icon: url("https://cdn.jsdelivr.net/npm/pixelarticons@1.8.1/svg/radio-signal.svg"); }
.pa-users        { --icon: url("https://cdn.jsdelivr.net/npm/pixelarticons@1.8.1/svg/users.svg"); }
/* Aliases for the names index.html uses today, so theme tweaks don't have
 * to touch markup. `pa-skull` re-uses bullseye-arrow as the closest
 * combat-iconography match in this icon set. */
.pa-skull { --icon: url("https://cdn.jsdelivr.net/npm/pixelarticons@1.8.1/svg/bullseye-arrow.svg"); }

/* ─── HERO ─────────────────────────────────────────────────────────────── */

.hero {
  position: relative;
  padding: 32px 28px 0;
  border-bottom: 1px solid #2a2a1f;
  background:
    linear-gradient(180deg, rgba(255,209,51,.06) 0%, transparent 60%),
    repeating-linear-gradient(135deg,
      transparent 0 18px, rgba(255,209,51,.015) 18px 19px);
  overflow: hidden;
}
.hero::before {
  /* Acacia silhouette stripe at the bottom of the hero — pure CSS, no asset. */
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 4px;
  background:
    linear-gradient(90deg, #ffd133 0%, #d97a1a 50%, #b8420f 100%);
  opacity: .6;
}
.hero-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.hero-brand { display: flex; align-items: center; gap: 18px; }
.hero-mark {
  width: 64px; height: 64px;
  /* object-fit: contain keeps non-square sprites (e.g. wide elephant) from
   * stretching to a square. Background fills any letterbox slack so the
   * sprite reads as a deliberate vignette instead of bare canvas. */
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(255,209,51,.35));
}
.hero-text { line-height: 1.1; }
.hero-eyebrow {
  font-size: 11px; letter-spacing: 4px; color: #d97a1a;
  font-weight: 700;
}
.hero-title {
  font-size: 44px; letter-spacing: 6px; font-weight: 900;
  margin: 4px 0 6px;
  background: linear-gradient(180deg, #fff7d6 0%, #ffd133 60%, #d97a1a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 2px 24px rgba(255,209,51,.18);
}
.hero-sub { font-size: 13px; color: #9a988a; }

.hero-meta { display: flex; gap: 10px; flex-wrap: wrap; }
.meta-pill {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 8px 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid #2a2a1f;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.meta-pill-label {
  font-size: 9px; letter-spacing: 2px; color: #6e6c5c;
  display: inline-flex; align-items: center; gap: 5px;
}
.meta-pill-label .pa-icon { width: 10px; height: 10px; }
.meta-pill-value { font-size: 18px; font-weight: 700; color: #f5e9b8; }
.meta-pill-value.live { color: #4cd964; }

/* ─── BOARD TABS ───────────────────────────────────────────────────────── */

.board-tabs {
  max-width: 1280px;
  margin: 28px auto 0;
  display: flex;
  gap: 0;
  border-bottom: 1px solid #2a2a1f;
}
.board-tab {
  background: transparent;
  border: none;
  color: #8a887a;
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}
.board-tab .pa-icon { width: 18px; height: 18px; }
.board-tab:hover { color: #e8e6df; background: rgba(255,209,51,.04); }
.board-tab.active {
  color: #ffd133;
  border-bottom-color: #ffd133;
  background: linear-gradient(180deg, transparent 0%, rgba(255,209,51,.06) 100%);
}

/* ─── MAIN ─────────────────────────────────────────────────────────────── */

main { max-width: 1280px; margin: 0 auto; padding: 32px 28px 64px; }

.board[hidden] { display: none; }

.board-headline { margin-bottom: 24px; }
.board-headline h2 {
  font-size: 26px; font-weight: 800; margin: 0 0 4px;
  letter-spacing: 1px; color: #fff7d6;
}
.board-blurb { color: #8a887a; font-size: 13px; margin: 0; }

/* ─── PODIUM (top 3) ───────────────────────────────────────────────────── */

.podium {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
  margin-bottom: 28px;
  align-items: end;
}
.podium-card {
  position: relative;
  padding: 22px 18px 24px;
  background: linear-gradient(180deg, rgba(255,255,255,.03) 0%, rgba(0,0,0,.4) 100%);
  border: 1px solid #2a2a1f;
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.podium-card:hover { transform: translateY(-3px); }
.podium-card .place-tag {
  position: absolute; top: 12px; left: 14px;
  font-size: 11px; letter-spacing: 2px; font-weight: 700;
  color: #6e6c5c;
}
.podium-card .player-portrait {
  width: 96px; height: 96px;
  background: rgba(0,0,0,.4);
  border: 1px solid #2a2a1f;
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
}
.podium-card .player-portrait img {
  width: 72px;
  height: 72px;
  /* contain → wide species (elephant, crocodile) keep proportions inside
   * the square portrait box; vertical sprites (vulture) likewise. */
  object-fit: contain;
}
.podium-card .player-name {
  font-size: 18px; font-weight: 700;
  margin: 4px 0 0;
  color: #fff7d6;
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.podium-card .rank-line {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 1px;
}
/* Rank emblems are smooth vector art (RhosGFX Vector Ranks, CC0) — override
 * the global img{image-rendering:pixelated} so they don't render blocky, and
 * size them up enough that the escalating ornamentation reads. */
.podium-card .rank-line img { width: 26px; height: 26px; object-fit: contain; image-rendering: auto; }
.podium-card .metric {
  font-size: 28px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff7d6 0%, #ffd133 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-top: 4px;
}
.podium-card .metric-sub {
  font-size: 10px; letter-spacing: 2px; color: #6e6c5c;
}

/* Place-specific styling */
.podium-card[data-place="1"] {
  border-color: #ffd133;
  box-shadow: 0 0 24px rgba(255,209,51,.18), inset 0 1px 0 rgba(255,209,51,.4);
  order: 2;
  padding-top: 30px;
  padding-bottom: 32px;
}
.podium-card[data-place="1"] .place-tag { color: #ffd133; }
.podium-card[data-place="1"] .player-portrait { border-color: #ffd133; }
.podium-card[data-place="2"] { order: 1; opacity: .98; }
.podium-card[data-place="2"] { border-color: #b9bcc8; }
.podium-card[data-place="2"] .place-tag { color: #b9bcc8; }
.podium-card[data-place="3"] { order: 3; opacity: .96; }
.podium-card[data-place="3"] { border-color: #c87f3a; }
.podium-card[data-place="3"] .place-tag { color: #c87f3a; }

.empty-podium {
  grid-column: 1 / -1;
  padding: 24px;
  text-align: center;
  color: #6e6c5c;
  border: 1px dashed #2a2a1f;
}

.online-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #4cd964; box-shadow: 0 0 8px rgba(76,217,100,.6);
  margin-right: 6px;
  vertical-align: middle;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

/* ─── ROWS TABLE ───────────────────────────────────────────────────────── */

.rows-card {
  background: rgba(0,0,0,.32);
  border: 1px solid #2a2a1f;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  overflow: hidden;
}
.rows-head, .row {
  display: grid;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
}
.rows-head[data-cols="ranked"]   { grid-template-columns: 40px 1fr 140px 220px 70px 110px; }
.row[data-cols="ranked"]         { grid-template-columns: 40px 1fr 140px 220px 70px 110px; }
.rows-head[data-cols="playtime"] { grid-template-columns: 40px 1fr 100px 70px 90px 110px; }
.row[data-cols="playtime"]       { grid-template-columns: 40px 1fr 100px 70px 90px 110px; }
.rows-head[data-cols="alphas"]   { grid-template-columns: 40px 1fr 100px 80px 70px 110px; }
.row[data-cols="alphas"]         { grid-template-columns: 40px 1fr 100px 80px 70px 110px; }
.rows-head[data-cols="biggest"]  { grid-template-columns: 40px 1fr 100px 90px 70px 110px; }
.row[data-cols="biggest"]        { grid-template-columns: 40px 1fr 100px 90px 70px 110px; }

.rows-head {
  font-size: 10px; letter-spacing: 2px; color: #6e6c5c;
  border-bottom: 1px solid #2a2a1f;
  background: rgba(255,209,51,.03);
  text-transform: uppercase;
}
.rows-head .num, .row .num { text-align: right; font-variant-numeric: tabular-nums; }

.rows { list-style: none; margin: 0; padding: 0; }
.row {
  border-bottom: 1px solid #1f1f15;
  font-size: 13px;
  transition: background .12s;
}
.row:last-child { border-bottom: none; }
.row:hover { background: rgba(255,209,51,.04); }
.row .place {
  font-weight: 700; color: #6e6c5c;
  font-variant-numeric: tabular-nums;
}
.row .player {
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
.row .player .pname {
  font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #fff7d6;
}
.row .player .portrait {
  width: 28px; height: 28px;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.row .player .portrait img { width: 22px; height: 22px; object-fit: contain; }
.row .rank-cell {
  display: flex; align-items: center; gap: 6px;
  font-weight: 600;
  letter-spacing: 1px;
  font-size: 11px;
}
.row .rank-cell img { width: 22px; height: 22px; object-fit: contain; image-rendering: auto; }
/* Stacked rank-cell on the ranked board: percentile gem on top, career
 * tier chip below. Keeps the 6-column grid intact; chip is small + dim
 * so the percentile gem stays the dominant signal. */
.row .rank-cell.stacked {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.row .rank-cell.stacked .rank-line {
  display: flex; align-items: center; gap: 6px;
}
.career-chip {
  font-size: 9px;
  letter-spacing: 1.5px;
  font-weight: 700;
  text-transform: uppercase;
  opacity: .75;
}
.podium-card .career-chip {
  margin-top: -2px;
  font-size: 10px;
}

.row .progress {
  display: flex; flex-direction: column; gap: 4px;
}
.row .progress-bar {
  height: 6px;
  background: rgba(255,255,255,.06);
  border: 1px solid #2a2a1f;
  position: relative;
  overflow: hidden;
}
.row .progress-fill {
  position: absolute; inset: 0 auto 0 0;
  background: linear-gradient(90deg, #d97a1a 0%, #ffd133 100%);
  width: 0%;
  transition: width .4s ease-out;
}
.row .progress-label {
  font-size: 10px; color: #8a887a; letter-spacing: .5px;
}

.row .metric { font-weight: 700; color: #f5e9b8; }

/* ─── FOOTER ───────────────────────────────────────────────────────────── */

.page-foot {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 28px 32px;
  border-top: 1px solid #1f1f15;
  font-size: 11px;
  color: #6e6c5c;
  letter-spacing: 1px;
  text-align: center;
}

/* ─── RESPONSIVE ───────────────────────────────────────────────────────── */

@media (max-width: 880px) {
  .hero-title { font-size: 32px; letter-spacing: 4px; }
  .hero-mark { width: 48px; height: 48px; }
  .podium { grid-template-columns: 1fr; gap: 12px; }
  .podium-card[data-place="1"],
  .podium-card[data-place="2"],
  .podium-card[data-place="3"] { order: initial; }
  .rows-head, .row { gap: 8px; padding: 10px 12px; font-size: 12px; }
  .rows-head[data-cols="ranked"], .row[data-cols="ranked"]     { grid-template-columns: 28px 1fr 90px 100px; }
  .rows-head[data-cols="ranked"] :nth-child(5),
  .rows-head[data-cols="ranked"] :nth-child(6),
  .row[data-cols="ranked"] .col-runs,
  .row[data-cols="ranked"] .col-playtime { display: none; }
  .rows-head[data-cols="playtime"], .row[data-cols="playtime"] { grid-template-columns: 28px 1fr 70px 100px; }
  .rows-head[data-cols="playtime"] :nth-child(4),
  .rows-head[data-cols="playtime"] :nth-child(5),
  .row[data-cols="playtime"] .col-runs,
  .row[data-cols="playtime"] .col-avg { display: none; }
  .rows-head[data-cols="alphas"], .row[data-cols="alphas"]     { grid-template-columns: 28px 1fr 60px 80px; }
  .rows-head[data-cols="alphas"] :nth-child(5),
  .rows-head[data-cols="alphas"] :nth-child(6),
  .row[data-cols="alphas"] .col-runs,
  .row[data-cols="alphas"] .col-playtime { display: none; }
  .rows-head[data-cols="biggest"], .row[data-cols="biggest"]   { grid-template-columns: 28px 1fr 60px 80px; }
  .rows-head[data-cols="biggest"] :nth-child(5),
  .rows-head[data-cols="biggest"] :nth-child(6),
  .row[data-cols="biggest"] .col-runs,
  .row[data-cols="biggest"] .col-playtime { display: none; }
}
