:root {
  --primary-color: #3498db;
  --secondary-color: #f39c12;
  --team-a-color: #3498db;
  --team-b-color: #e74c3c;
  --background-color: #f5f5f5;
  --text-color: #333;
  --success-color: #2ecc71;
  --warning-color: #f39c12;
  --danger-color: #e74c3c;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  width: 100%;
  box-sizing: border-box;
}

header {
  text-align: center;
  margin-bottom: 30px;
}

header h1 {
  color: var(--primary-color);
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
}

.match-settings {
  background-color: white;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.match-type {
  margin-bottom: 15px;
}

.match-type label,
.team-input label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
}

.match-type select,
.team-input input {
  width: 100%;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
  transition: border-color 0.3s;
}

.match-type select:focus,
.team-input input:focus {
  border-color: var(--primary-color);
  outline: none;
}

.team-names {
  display: flex;
  gap: 15px;
}

.team-input {
  flex: 1;
}

.scoreboard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: white;
  border-radius: 15px;
  padding: 30px 20px;
  margin-bottom: 20px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.team {
  flex: 1;
  text-align: center;
  padding: 0 10px;
}

.team-name {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-a .team-name {
  color: var(--team-a-color);
}

.team-b .team-name {
  color: var(--team-b-color);
}

.score {
  font-size: 4rem;
  font-weight: 700;
  margin: 10px 0;
  transition: all 0.3s ease;
}

.team-a .score {
  color: var(--team-a-color);
}

.team-b .score {
  color: var(--team-b-color);
}

.games {
  font-size: 1.5rem;
  font-weight: 600;
  color: #666;
}

.team-a .games {
  color: var(--team-a-color);
}

.team-b .games {
  color: var(--team-b-color);
}

.versus {
  font-size: 2rem;
  font-weight: 700;
  color: #666;
  padding: 0 20px;
}

.match-status {
  text-align: center;
  margin-bottom: 20px;
}

.status-message {
  font-size: 1.2rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 5px;
  display: inline-block;
  transition: all 0.3s ease;
}

.status-message.game-point {
  background-color: var(--warning-color);
  color: white;
  animation: pulse 1.5s infinite;
}

.status-message.game-win {
  background-color: var(--success-color);
  color: white;
}

.status-message.match-win {
  background-color: var(--success-color);
  color: white;
  font-size: 1.5rem;
  animation: pulse 1.5s infinite;
}

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.team-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 5px;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 80px;
}

.btn:active {
  transform: scale(0.95);
}

.add-btn {
  background-color: var(--success-color);
  color: white;
}

.add-btn:hover {
  background-color: #27ae60;
}

.subtract-btn {
  background-color: var(--danger-color);
  color: white;
}

.subtract-btn:hover:not(:disabled) {
  background-color: #c0392b;
}

.subtract-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.reset-btn {
  background-color: var(--primary-color);
  color: white;
}

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

.rules-btn {
  background-color: var(--secondary-color);
  color: white;
}

.rules-btn:hover {
  background-color: #e67e22;
}

.reset-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s;
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 30px;
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  animation: slideIn 0.3s;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  position: absolute;
  right: 20px;
  top: 15px;
  cursor: pointer;
}

.close:hover {
  color: #000;
}

.modal-content h2 {
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 20px;
}

.rules-content h3 {
  color: var(--secondary-color);
  margin-top: 20px;
  margin-bottom: 10px;
}

.rules-content ul {
  padding-left: 20px;
  margin-bottom: 15px;
}

.rules-content li {
  margin-bottom: 8px;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.score-change {
  animation: scoreChange 0.5s;
}

@keyframes scoreChange {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  header h1 {
    font-size: 2rem;
  }

  .team-names {
    flex-direction: column;
    gap: 10px;
  }

  .scoreboard {
    padding: 20px 15px;
  }

  .team-name {
    font-size: 1.2rem;
  }

  .score {
    font-size: 3rem;
  }

  .games {
    font-size: 1.2rem;
  }

  .versus {
    font-size: 1.5rem;
    padding: 0 10px;
  }

  .controls {
    flex-direction: column;
    gap: 15px;
  }

  .team-controls {
    flex-direction: row;
    justify-content: center;
    width: 100%;
  }

  .reset-controls {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
  }

  .btn {
    min-width: 70px;
    padding: 10px 20px;
    font-size: 1rem;
  }

  .modal-content {
    padding: 20px;
    margin: 10% auto;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.8rem;
  }

  .score {
    font-size: 2.5rem;
  }

  .versus {
    font-size: 1.2rem;
  }

  .btn {
    min-width: 60px;
    padding: 8px 16px;
    font-size: 0.9rem;
  }
}