:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-card: #1a1a1a;
  --border: #2a2a2a;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --accent: #3b82f6;
  --success: #22c55e;
  --warning: #f59e0b;
  --orange: #f97316;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

/* Loading */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Error */
.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 12px;
  text-align: center;
}

.error-container h2 {
  color: #ef4444;
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 24px;
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Section Title */
.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.trophy {
  font-size: 1.25rem;
}

/* Score Section */
.score-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}

.score-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.team-score {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.team-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.team-name.winner {
  color: var(--success);
}

.score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3rem;
  font-weight: 700;
}

.score.winner {
  color: var(--success);
}

.winner-badge-container {
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
}

.winner-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
}

.score-divider {
  font-size: 2rem;
  color: var(--text-muted);
  padding: 0 16px;
}

/* Tabs */
.tabs {
  display: flex;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 24px;
  gap: 4px;
}

.tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Players List */
.players-section {
  margin-bottom: 24px;
}

.players-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.player-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  cursor: pointer;
}

.player-header:hover {
  background: var(--bg-secondary);
}

.player-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-rank {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.player-rank.gold { background: #eab308; color: white; }
.player-rank.silver { background: #9ca3af; color: white; }
.player-rank.bronze { background: #d97706; color: white; }

.player-name {
  font-weight: 600;
  font-size: 1rem;
}

.player-points {
  display: flex;
  align-items: center;
  gap: 8px;
}

.points-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.points-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.expand-icon {
  color: var(--text-muted);
  font-size: 1rem;
  transition: transform 0.2s;
}

.player-card.expanded .expand-icon {
  transform: rotate(180deg);
}

.player-details {
  display: none;
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
}

.player-card.expanded .player-details {
  display: block;
}

.stats-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 16px 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stats-row {
  display: flex;
  justify-content: space-around;
  gap: 8px;
}

.stat-box {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  min-width: 70px;
}

.stat-label {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 600;
}

.stat-percent {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--accent);
}

.mini-stat-box {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 12px 16px;
  text-align: center;
  min-width: 50px;
}

/* Team Totals */
.team-totals-section {
  margin-bottom: 24px;
}

.team-totals {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.team-total-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px;
}

.team-total-card.winner {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.team-total-name {
  font-weight: 600;
  font-size: 1.125rem;
  text-align: center;
  margin-bottom: 16px;
}

.team-total-name.winner {
  color: var(--success);
}

.team-stats-grid {
  display: flex;
  justify-content: space-around;
  margin-bottom: 12px;
}

.team-stat {
  text-align: center;
}

.team-stat-label {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.team-stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  font-weight: 600;
}

.team-stat-percent {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--accent);
}

.team-other-stats {
  display: flex;
  justify-content: space-around;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Footer */
.footer {
  text-align: center;
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer strong {
  color: var(--accent);
}

/* Chart Section */
.chart-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}

.chart-container {
  width: 100%;
  height: 200px;
  margin-bottom: 16px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-color.team-a {
  background: var(--accent);
}

.legend-color.team-b {
  background: var(--orange);
}

.chart-summary {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.chart-summary strong {
  color: var(--text-primary);
}

/* Player Timeline */
.player-timeline {
  margin-top: 16px;
}

.timeline-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timeline-container {
  position: relative;
  height: 60px;
  background: var(--bg-primary);
  border-radius: 8px;
  overflow: hidden;
}

.timeline-track {
  position: absolute;
  top: 50%;
  left: 16px;
  right: 16px;
  height: 2px;
  background: var(--border);
  transform: translateY(-50%);
}

.timeline-point {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  color: white;
}

.timeline-dot.pts-1 { background: #22c55e; }
.timeline-dot.pts-2 { background: var(--accent); }
.timeline-dot.pts-3 { background: #f97316; }

.timeline-time {
  position: absolute;
  top: 28px;
  font-size: 0.625rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.timeline-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 400px) {
  .score {
    font-size: 2.5rem;
  }
  
  .tab {
    font-size: 0.75rem;
    padding: 8px 12px;
  }
}
