body { padding-bottom: 60px; }

.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
}
.stats-header h1 { margin: 0; font-size: 1.6rem; }
.stats-header a.btn, .stats-header span { min-width: 90px; }

.stats-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  flex-wrap: wrap;
}
.tab-btn {
  cursor: pointer;
  background: transparent;
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}
.tab-btn.active {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #201200;
  border-color: transparent;
}

.stats-main { max-width: 900px; margin: 0 auto; padding: 0 20px; }
.tab-panel.hidden { display: none; }

.loading, .empty { text-align: center; color: var(--ink-dim); padding: 40px; font-style: italic; }

.stats-table { display: flex; flex-direction: column; gap: 6px; }
.stats-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
}
.stats-row.header {
  background: transparent;
  border: none;
  color: var(--gold-light);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  padding-bottom: 4px;
}
.contrada-cell { font-weight: 800; }

.games-table .stats-row { grid-template-columns: 1.3fr 1fr 1fr 1.6fr 1fr; }
.game-row { cursor: pointer; transition: background 0.2s ease; }
.game-row:hover { background: rgba(212, 175, 55, 0.1); }
.chevron { color: var(--gold-light); text-align: right; }

.game-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 26, 0.85);
}
.game-detail-modal.hidden { display: none; }
.game-detail-panel {
  padding: 28px 32px;
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.game-detail-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.game-detail-header h2 { margin: 0; font-size: 1.1rem; }
.game-detail-body { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.game-detail-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.game-detail-row .rank { width: 26px; font-weight: 800; color: var(--gold); }
.game-detail-row .name { flex: 1; font-weight: 600; }
.game-detail-row .score { color: var(--gold-light); font-weight: 800; }

@media (max-width: 640px) {
  .stats-row.header { display: none; }
  .stats-row, .games-table .stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-size: 0.85rem;
  }
  .stats-row > span { flex: 1 1 auto; }
}
