/* /leaderboard — Arena stats. Same East-Minimal-Red palette as /agents and /game-design. */

:root {
  --lb-bg:           #0A0A0C;
  --lb-surface:      #16161A;
  --lb-raised:       #1F1F24;
  --lb-divider:      #2A2A30;
  --lb-divider-soft: #1A1A1F;
  --lb-text:         #E8E8EE;
  --lb-text-muted:   #8B8B95;
  --lb-text-faint:   #525258;
  --lb-red:          #E63946;
  --lb-red-deep:     #C92F3E;
  --lb-red-soft:     rgba(230, 57, 70, 0.15);
  --lb-team-a:       #4A9EFF;
  --lb-team-a-soft:  rgba(74, 158, 255, 0.14);
  --lb-team-b:       #E63946;
  --lb-team-b-soft:  rgba(230, 57, 70, 0.14);
  --lb-gold:         #D4A86A;
  --lb-silver:       #C0C0C0;
  --lb-bronze:       #CD7F32;
}

.lb-page {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(800px 600px at 50% -200px, rgba(230, 57, 70, 0.08), transparent 70%),
    var(--lb-bg);
  color: var(--lb-text);
  font-family: 'Inter Tight', system-ui, sans-serif;
  min-height: 100vh;
}

.lb-toolbar {
  padding: 14px 24px;
  background: rgba(22, 22, 26, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--lb-divider);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--lb-text-muted);
  position: sticky;
  top: 0;
  z-index: 10;
}
.lb-toolbar__brand {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--lb-text-muted);
}
.lb-toolbar__brand em {
  font-style: normal;
  color: var(--lb-red);
  letter-spacing: 0.16em;
}
.lb-toolbar__hint { font-size: 11px; color: var(--lb-text-faint); }

.lb-stage {
  display: flex;
  flex-direction: column;
  gap: 56px;
  padding: 48px 20px 96px;
  max-width: 920px;
  margin: 0 auto;
}

.lb-section { display: flex; flex-direction: column; gap: 14px; }
.lb-section__head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--lb-divider);
}
.lb-section__num {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--lb-red);
}
.lb-section__title {
  margin: 0;
  font-family: 'Newsreader', Georgia, serif;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--lb-text);
}
.lb-section__hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--lb-text-faint);
  letter-spacing: 0.06em;
}

.lb-empty {
  margin: 0;
  padding: 32px;
  text-align: center;
  background: var(--lb-surface);
  border: 1px dashed var(--lb-divider);
  color: var(--lb-text-faint);
  font-style: italic;
}

/* ===== Top by ELO table ===== */
.lb-table {
  background: var(--lb-surface);
  border: 1px solid var(--lb-divider);
  font-family: 'SF Mono', Menlo, monospace;
}
.lb-table__head,
.lb-row {
  display: grid;
  grid-template-columns: 40px 1fr 1fr 70px 70px 70px;
  align-items: center;
  padding: 10px 14px;
  font-size: 12px;
  border-bottom: 1px solid var(--lb-divider-soft);
}
.lb-table__head {
  background: var(--lb-raised);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lb-text-faint);
  border-bottom: 1px solid var(--lb-divider);
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: var(--lb-raised); }

.lb-row__rank {
  font-size: 14px;
  font-weight: 700;
  color: var(--lb-text-faint);
}
.lb-row--rank-1 .lb-row__rank { color: var(--lb-gold); }
.lb-row--rank-2 .lb-row__rank { color: var(--lb-silver); }
.lb-row--rank-3 .lb-row__rank { color: var(--lb-bronze); }

.lb-row__name {
  color: var(--lb-text);
  font-weight: 600;
}
.lb-row__name small {
  color: var(--lb-text-muted);
  font-weight: 400;
  margin-left: 6px;
}
.lb-row__owner { color: var(--lb-text-muted); }
.lb-row__elo {
  color: var(--lb-red);
  font-weight: 700;
  text-align: right;
}
.lb-row__wl    { color: var(--lb-text); text-align: right; }
.lb-row__games { color: var(--lb-text-faint); text-align: right; }

@media (max-width: 640px) {
  .lb-table__head,
  .lb-row { grid-template-columns: 30px 1fr 60px 60px; }
  .lb-table__head > :nth-child(3),  /* hide Owner */
  .lb-row > :nth-child(3),
  .lb-table__head > :nth-child(6),  /* hide Games */
  .lb-row > :nth-child(6) { display: none; }
}

/* ===== Recent tournaments ===== */
.lb-recent { display: flex; flex-direction: column; gap: 18px; }
.lb-bucket { display: flex; flex-direction: column; gap: 6px; }
.lb-bucket__head {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--lb-text-muted);
  padding: 6px 0;
  border-bottom: 1px solid var(--lb-divider);
}
.lb-bucket__head small { color: var(--lb-text-faint); }

.lb-game {
  display: grid;
  grid-template-columns: 130px 1fr 60px 110px 80px;
  align-items: center;
  padding: 10px 14px;
  background: var(--lb-surface);
  border-left: 3px solid var(--lb-text-faint);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.lb-game:hover {
  background: var(--lb-raised);
  border-left-color: var(--lb-red);
}
.lb-game__time {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
  color: var(--lb-text-muted);
}
.lb-game__topic {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 15px;
  color: var(--lb-text);
}
.lb-game__teams {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
  color: var(--lb-text-faint);
  text-align: center;
}
.lb-game__winner {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
}
.winner--1     { color: var(--lb-team-a); }
.winner--2     { color: var(--lb-team-b); }
.winner--none  { color: var(--lb-text-faint); }
.lb-game__prize {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
  color: var(--lb-gold);
  text-align: right;
}

@media (max-width: 640px) {
  .lb-game { grid-template-columns: 90px 1fr 90px; gap: 6px; }
  .lb-game__teams,
  .lb-game__prize { display: none; }
}

/* ===== Modal ===== */
.lb-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.lb-modal--hidden { display: none; }
.lb-modal__card {
  background: var(--lb-surface);
  border: 1px solid var(--lb-red);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 20px 60px rgba(230, 57, 70, 0.3);
}
.lb-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--lb-divider);
  padding-bottom: 12px;
}
.lb-modal__title {
  margin: 0;
  font-family: 'Newsreader', Georgia, serif;
  font-size: 26px;
  color: var(--lb-text);
}
.lb-modal__close {
  background: transparent;
  border: none;
  color: var(--lb-text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.lb-modal__close:hover { color: var(--lb-red); }

.lb-modal__meta { display: flex; flex-direction: column; gap: 4px; }
.tm-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  font-size: 13px;
  padding: 4px 0;
}
.tm-row > span:first-child {
  color: var(--lb-text-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tm-row strong { color: var(--lb-text); font-weight: 700; }
.tm-row em { font-style: italic; color: var(--lb-text-muted); }
.tm-roster {
  align-items: start;
  padding-top: 8px;
  border-top: 1px solid var(--lb-divider-soft);
}
.tm-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.tm-pill {
  padding: 3px 8px;
  background: var(--lb-team-a-soft);
  color: var(--lb-team-a);
  font-size: 11px;
  border-radius: 2px;
}
.tm-roster:last-of-type .tm-pill {
  background: var(--lb-team-b-soft);
  color: var(--lb-team-b);
}
.tm-pill--out {
  opacity: 0.5;
  text-decoration: line-through;
  text-decoration-color: var(--lb-red);
}

.lb-modal__rounds { display: flex; flex-direction: column; gap: 14px; }
.tm-round {
  background: var(--lb-raised);
  padding: 12px 14px;
  border-left: 2px solid var(--lb-red);
}
.tm-round__head {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lb-text-muted);
  margin-bottom: 8px;
}
.tm-round__head strong { color: var(--lb-red); }
.tm-round__msgs { display: flex; flex-direction: column; gap: 6px; }
.tm-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  font-size: 12px;
  background: var(--lb-surface);
}
.tm-msg__author {
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.04em;
}
.tm-msg__author small {
  font-weight: 400;
  color: var(--lb-text-faint);
  margin-left: 4px;
}
.tm-msg__text { color: var(--lb-text); }
.tm-msg--team1 .tm-msg__author { color: var(--lb-team-a); }
.tm-msg--team2 .tm-msg__author { color: var(--lb-team-b); }
.tm-msg--secret {
  border: 1px dashed var(--lb-red);
  background: var(--lb-red-soft);
}
.tm-msg--auto { opacity: 0.6; font-style: italic; }
