/* ELO Skill Rating — Spectator Styles */

/* --- Leaderboard --- */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #1a1a2e;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ranking-card:hover {
  background: #1f1f3a;
  transform: translateX(4px);
}

.ranking-card.selected {
  background: #252545;
  box-shadow: 0 0 8px rgba(100, 100, 255, 0.3);
}

.ranking-rank {
  font-size: 1.4em;
  min-width: 40px;
  text-align: center;
}

.ranking-info {
  flex: 1;
}

.ranking-name {
  font-weight: 600;
  font-size: 1.05em;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ranking-tier {
  font-size: 0.8em;
  font-weight: 500;
}

.ranking-streak {
  font-size: 0.85em;
  background: rgba(255, 100, 0, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  color: #ff6400;
}

.ranking-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  font-size: 0.9em;
}

.ranking-elo {
  font-weight: 700;
  font-size: 1.1em;
  color: #fff;
}

.ranking-delta {
  font-weight: 600;
  font-size: 0.9em;
}

.delta-up { color: #4caf50; }
.delta-down { color: #f44336; }
.delta-flat { color: #888; }

.ranking-meta {
  color: #888;
  font-size: 0.8em;
}

/* ELO Progress Bar */
.ranking-bar-container {
  margin-top: 6px;
  height: 4px;
  background: #2a2a4a;
  border-radius: 2px;
  overflow: hidden;
}

.ranking-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* --- Empty State --- */
.ranking-empty {
  text-align: center;
  padding: 40px 20px;
  color: #888;
}

.ranking-empty p:first-child {
  font-size: 1.2em;
  color: #ccc;
}

.ranking-hint {
  font-size: 0.9em;
  margin-top: 8px;
}

/* --- Tier Guide --- */
.tier-guide {
  margin-top: 20px;
}

.tier-guide h3 {
  color: #ccc;
  margin-bottom: 12px;
  font-size: 1em;
}

.tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}

.tier-card {
  text-align: center;
  padding: 8px;
  background: #1a1a2e;
  border-radius: 6px;
  border: 1px solid;
}

.tier-emoji {
  display: block;
  font-size: 1.5em;
  margin-bottom: 4px;
}

.tier-name {
  display: block;
  font-weight: 600;
  font-size: 0.85em;
}

.tier-min {
  display: block;
  color: #888;
  font-size: 0.75em;
}

/* --- Agent Detail --- */
.agent-detail-card {
  margin-top: 16px;
  padding: 16px;
  background: #1a1a2e;
  border-radius: 8px;
  border: 2px solid;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.detail-emoji { font-size: 1.8em; }

.detail-name {
  font-size: 1.2em;
  font-weight: 700;
  color: #fff;
}

.detail-tier {
  font-size: 0.9em;
  font-weight: 500;
}

.detail-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.stat-box {
  text-align: center;
  padding: 8px 12px;
  background: #252545;
  border-radius: 6px;
  min-width: 60px;
}

.stat-val {
  display: block;
  font-size: 1.3em;
  font-weight: 700;
  color: #fff;
}

.stat-label {
  display: block;
  font-size: 0.7em;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- ELO Chart --- */
.ranking-chart {
  margin: 12px 0;
}

.ranking-chart h4 {
  color: #ccc;
  font-size: 0.9em;
  margin-bottom: 8px;
}

.elo-chart {
  width: 100%;
  height: auto;
  max-height: 160px;
  background: #0d0d1a;
  border-radius: 6px;
  padding: 4px;
}

/* --- History Table --- */
.ranking-history {
  margin-top: 12px;
}

.ranking-history h4 {
  color: #ccc;
  font-size: 0.9em;
  margin-bottom: 8px;
}

.ranking-history table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
}

.ranking-history th {
  text-align: left;
  padding: 6px 8px;
  color: #888;
  border-bottom: 1px solid #333;
  font-weight: 500;
}

.ranking-history td {
  padding: 6px 8px;
  color: #ccc;
  border-bottom: 1px solid #1a1a2e;
}

.ranking-reason {
  font-size: 0.8em;
  color: #666;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Light Mode --- */
.light-mode .ranking-card { background: #f8f9fa; }
.light-mode .ranking-card:hover { background: #f0f1f3; }
.light-mode .ranking-card.selected { background: #e8e9f0; }
.light-mode .ranking-elo { color: #222; }
.light-mode .ranking-name { color: #222; }
.light-mode .ranking-meta { color: #666; }
.light-mode .ranking-bar-container { background: #ddd; }
.light-mode .ranking-empty p:first-child { color: #444; }
.light-mode .tier-card { background: #f8f9fa; }
.light-mode .agent-detail-card { background: #f8f9fa; }
.light-mode .detail-name { color: #222; }
.light-mode .stat-box { background: #eee; }
.light-mode .stat-val { color: #222; }
.light-mode .stat-label { color: #666; }
.light-mode .elo-chart { background: #f0f0f0; }
.light-mode .ranking-history th { color: #666; border-color: #ddd; }
.light-mode .ranking-history td { color: #444; border-color: #eee; }
.light-mode .tier-guide h3 { color: #444; }
.light-mode .ranking-chart h4 { color: #444; }
.light-mode .ranking-history h4 { color: #444; }

/* --- Mobile --- */
@media (max-width: 768px) {
  .ranking-card { padding: 10px 12px; }
  .ranking-rank { font-size: 1.1em; min-width: 30px; }
  .ranking-meta { display: none; }
  .detail-stats { gap: 8px; }
  .stat-box { min-width: 50px; padding: 6px 8px; }
  .stat-val { font-size: 1.1em; }
  .tier-grid { grid-template-columns: repeat(4, 1fr); }
  .ranking-history table { font-size: 0.75em; }
  .ranking-reason { max-width: 100px; }
}

@media (max-width: 480px) {
  .tier-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-stats { justify-content: center; }
}
