* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #53a2d4 0%, #53a2d4 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1800px;
  margin: 0 auto;
}

header {
  text-align: center;
  color: white;
  padding: 20px 0;
  margin-bottom: 30px;
}

header h1 {
  font-size: 2.5rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  margin-bottom: 15px;
}

nav {
  display: flex;
  justify-content: center;
  gap: 15px;
}

nav a {
  color: white;
  text-decoration: none;
  padding: 8px 20px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.3s;
}

nav a:hover,
nav a.active {
  background: rgba(255, 255, 255, 0.3);
}

/* Game Selector */
.game-selector {
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.selector-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.selector-content label {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
}

.selector-content select {
  padding: 10px 15px;
  font-size: 1rem;
  border: 2px solid #667eea;
  border-radius: 5px;
  background: white;
  cursor: pointer;
  min-width: 300px;
  transition: border-color 0.3s;
}

.selector-content select:hover {
  border-color: #764ba2;
}

.selector-content select:focus {
  outline: none;
  border-color: #764ba2;
  box-shadow: 0 0 0 3px rgba(118, 75, 162, 0.1);
}

.game-header {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-header h2 {
  color: #333;
  margin-bottom: 10px;
}

.game-meta {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.meta-item {
  padding: 6px 12px;
  background: #f0f0f0;
  border-radius: 5px;
  font-size: 0.9rem;
  color: #666;
}

.team-summary {
  display: flex;
  gap: 20px;
  margin-top: 15px;
}

.team-summary-item {
  flex: 1;
  background: linear-gradient(135deg, #53a2d4, #53a2d4);
  color: white;
  padding: 15px;
  border-radius: 8px;
  text-align: center;
}

.team-summary-item .team-name {
  font-size: 1.3rem;
  font-weight: bold;
  margin-bottom: 5px;
}

.team-summary-item .team-score {
  font-size: 2rem;
  font-weight: bold;
}

.team-summary-item .coach-name {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-top: 5px;
}

.legend-section {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.legend-section h3 {
  color: #333;
  margin-bottom: 12px;
}

.collapsible-header {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: color 0.3s;
}

.collapsible-header:hover {
  color: #667eea;
}

.toggle-icon {
  display: inline-block;
  transition: transform 0.3s ease;
  font-size: 0.8em;
  min-width: 20px;
}

.toggle-icon.collapsed {
  transform: rotate(-90deg);
}

.collapsible-content {
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
  max-height: 1000px;
  opacity: 1;
}

.collapsible-content.collapsed {
  max-height: 0;
  opacity: 0;
}

.scoring-legend {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

/* Rules Section */
.rules-section {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.rules-section h3 {
  color: #333;
  margin-bottom: 15px;
  font-size: 1.5rem;
  border-bottom: 2px solid #667eea;
  padding-bottom: 10px;
}

.game-rules {
  color: #333;
  line-height: 1.6;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 10px;
}

.game-rules h4 {
  color: #667eea;
  font-size: 1.3rem;
  margin: 20px 0 10px 0;
  padding-top: 15px;
  border-top: 1px solid #e0e0e0;
}

.game-rules h4:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.game-rules h5 {
  color: #764ba2;
  font-size: 1.1rem;
  margin: 15px 0 8px 0;
  font-weight: 600;
}

.game-rules p {
  margin: 8px 0;
}

.game-rules li {
  margin-left: 30px;
  margin-bottom: 5px;
}

.game-rules blockquote {
  background: #f5f5f5;
  border-left: 4px solid #667eea;
  padding: 15px 20px;
  margin: 15px 0;
  font-style: italic;
  color: #555;
  border-radius: 5px;
}

.game-rules br {
  display: block;
  margin: 5px 0;
  content: "";
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 4px solid #667eea;
}

.legend-code {
  font-weight: bold;
  color: #667eea;
  min-width: 50px;
}

.legend-name {
  color: #666;
  font-size: 0.9rem;
}

.legend-points {
  font-weight: bold;
  color: #333;
  margin-left: auto;
}

.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.team-column {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.team-header {
  background: linear-gradient(90deg, #53a2d4, #526977);
  color: white;
  padding: 20px;
  text-align: center;
}

.team-header h2 {
  margin: 0;
  font-size: 1.8rem;
  margin-bottom: 5px;
}

.team-header .avg-score {
  font-size: 1.1rem;
  opacity: 0.9;
}

.team-header .rank-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
  margin-top: 8px;
}

.team-header .coach-info {
  font-size: 0.95rem;
  opacity: 0.85;
  margin-top: 8px;
  font-style: italic;
}

.players-table {
  width: 100%;
}

.players-table table {
  width: 100%;
  border-collapse: collapse;
}

.players-table thead {
  background: #f8f9fa;
  position: sticky;
  top: 0;
}

.players-table th {
  padding: 12px 8px;
  text-align: center;
  font-size: 0.85rem;
  color: #333;
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
}

.players-table th:first-child {
  text-align: left;
  padding-left: 15px;
}

.players-table tbody tr {
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s;
}

.players-table tbody tr:hover {
  background: #f8f9fa;
}

.players-table td {
  padding: 12px 8px;
  text-align: center;
  font-size: 0.9rem;
}

.players-table td:first-child {
  text-align: left;
  padding-left: 15px;
  font-weight: 500;
  color: #333;
}

.player-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rank-badge-sm {
  display: inline-block;
  background: #667eea;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: bold;
}

.rank-1 .rank-badge-sm {
  background: #FFD700;
  color: #333;
}

.rank-2 .rank-badge-sm {
  background: #C0C0C0;
  color: #333;
}

.rank-3 .rank-badge-sm {
  background: #CD7F32;
  color: white;
}

.score-cell {
  font-weight: 600;
  color: #667eea;
}

.total-score {
  font-weight: bold;
  font-size: 1.1rem;
  color: #333;
  background: #f8f9fa;
}

.stat-count {
  color: #666;
}

.point-value-row {
  background: #e9ecef;
  font-size: 0.85rem;
  font-style: italic;
}

.point-value-row td {
  color: #666;
}

@media (max-width: 1200px) {
  .teams-grid {
    grid-template-columns: 1fr;
  }
}
