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

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

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.header {
  background: linear-gradient(135deg, #2c3e50, #4a6741);
  color: white;
  padding: 20px;
  text-align: center;
}

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

.controls {
  padding: 20px;
  background: #f8f9fa;
  border-bottom: 2px solid #e9ecef;
}

.mode-selector {
  margin-bottom: 20px;
}

.mode-selector label {
  font-weight: bold;
  margin-right: 15px;
  color: #2c3e50;
}

.mode-selector select {
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
  background: white;
  cursor: pointer;
  transition: border-color 0.3s;
}

.mode-selector select:focus {
  outline: none;
  border-color: #667eea;
}

.player-management {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.player-input {
  display: flex;
  align-items: center;
  gap: 5px;
}

.player-input input {
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  width: 120px;
  transition: border-color 0.3s;
}

.player-input input:focus {
  outline: none;
  border-color: #667eea;
}

.remove-player {
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s;
}

.remove-player:hover {
  background: #c0392b;
}

.add-player {
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  transition: background-color 0.3s;
}

.add-player:hover {
  background: #229954;
}

.custom-rounds {
  margin-top: 20px;
  padding: 20px;
  background: #fff;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  display: none;
}

.custom-rounds h3 {
  margin-bottom: 15px;
  color: #2c3e50;
}

.rounds-selection {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.round-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #f8f9fa;
  cursor: pointer;
  transition: background-color 0.3s;
}

.round-checkbox:hover {
  background: #e9ecef;
}

.round-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.add-custom-round {
  margin-bottom: 20px;
  padding: 15px;
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
}

.add-custom-round h4 {
  margin-bottom: 10px;
  color: #856404;
}

.custom-round-input {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.custom-round-input input {
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  flex: 1;
  min-width: 150px;
  transition: border-color 0.3s;
}

.custom-round-input input:focus {
  outline: none;
  border-color: #667eea;
}

.add-round-btn {
  background: #f39c12;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: background-color 0.3s;
  white-space: nowrap;
}

.add-round-btn:hover {
  background: #e67e22;
}

.selected-rounds {
  margin-top: 20px;
}

.selected-round {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: #e3f2fd;
  border: 1px solid #2196f3;
  border-radius: 6px;
  margin-bottom: 5px;
}

.move-buttons {
  display: flex;
  gap: 5px;
}

.move-btn {
  background: #2196f3;
  color: white;
  border: none;
  border-radius: 4px;
  width: 25px;
  height: 25px;
  cursor: pointer;
  font-size: 12px;
}

.move-btn:hover {
  background: #1976d2;
}

.scoreboard {
  padding: 20px;
  overflow-x: auto;
  position: relative;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.score-table th {
  background: linear-gradient(135deg, #2c3e50, #34495e);
  color: white;
  padding: 15px 8px;
  text-align: center;
  font-weight: bold;
  border-right: 1px solid #34495e;
  position: sticky;
  top: 0;
  z-index: 10;
}

.score-table th:last-child {
  border-right: none;
}

.score-table td {
  padding: 12px 8px;
  text-align: center;
  border-bottom: 1px solid #e9ecef;
  border-right: 1px solid #e9ecef;
}

.score-table td:last-child {
  border-right: none;
}

.score-table tbody tr:nth-child(even) {
  background: #f8f9fa;
}

.score-table tbody tr:hover {
  background: #e3f2fd;
}

.round-name {
  font-weight: bold;
  color: #2c3e50;
  text-align: left;
  padding-left: 15px;
  min-width: 200px;
}

.score-input {
  width: 60px;
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-align: center;
  font-size: 14px;
  transition: border-color 0.3s;
}

.score-input:focus {
  outline: none;
  border-color: #667eea;
  background: #f0f8ff;
}

.total-row {
  background: linear-gradient(135deg, #27ae60, #2ecc71) !important;
  color: white;
  font-weight: bold;
  font-size: 16px;
  position: sticky;
  bottom: 0;
  z-index: 5;
}

.total-row td {
  border-bottom: none;
  border-top: 2px solid #219a52;
}

.export-controls {
  padding: 20px;
  background: #f8f9fa;
  border-top: 2px solid #e9ecef;
  text-align: center;
}

.export-btn {
  background: #3498db;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  margin: 0 5px;
  transition: background-color 0.3s;
}

.export-btn:hover {
  background: #2980b9;
}

.winner-indicator {
  color: #f39c12;
  font-size: 18px;
  font-weight: bold;
}

@media (max-width: 768px) {
  .container {
    margin: 10px;
    border-radius: 8px;
  }

  .header h1 {
    font-size: 2em;
  }

  .controls {
    padding: 15px;
  }

  .player-input input {
    width: 100px;
  }

  .custom-round-input {
    flex-direction: column;
    align-items: stretch;
  }

  .custom-round-input input {
    margin-bottom: 5px;
  }

  .score-table {
    font-size: 12px;
  }

  .score-input {
    width: 50px;
    font-size: 12px;
  }

  .round-name {
    min-width: 150px;
    font-size: 12px;
  }
}

.hidden {
  display: none;
}
