:root {
  --primary: #f39c12;
  --secondary: #2c3e50;
  --light: #ecf0f1;
  --dark: #2c3e50;
  --danger: #e74c3c;
  --success: #27ae60;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  background-color: var(--light);
  color: var(--dark);
}

header {
  background: var(--secondary);
  color: white;
  padding: 0.8rem;
  text-align: center;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

nav {
  background: #34495e;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  min-height: 2.5rem;
}

.nav-spacer {
  flex: 1;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.nav-links a {
  color: white;
  text-decoration: none;
  font-weight: bold;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  transition: background 0.2s;
  white-space: nowrap;
}

.nav-links a:hover {
  background: rgba(255,255,255,0.1);
}

/* Burger Menu with Checkbox Toggle */
.burger-menu {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  position: relative; /* Remove absolute positioning */
  right: auto;
}

#burger-toggle {
  display: none;
}

.burger-icon {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 5px;
  z-index: 1001;
}

.burger-icon span {
  display: block;
  width: 25px;
  height: 3px;
  background-color: white;
  border-radius: 2px;
}

.burger-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: #34495e;
  border: 1px solid #2c3e50;
  border-radius: 4px;
  min-width: 150px;
  z-index: 1000;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

#burger-toggle:checked ~ .burger-dropdown {
  display: block;
}

.burger-dropdown a {
  display: block;
  padding: 1rem;
  color: white;
  text-decoration: none;
  border-bottom: 1px solid #2c3e50;
}

.burger-dropdown a:last-child {
  border-bottom: none;
}

/* Match Action Bar */
.match-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
}

.btn-finish {
  background: var(--danger);
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
}

.btn-abort {
  background: #7f8c8d;
  padding: 0.2rem 0.4rem;
  font-size: 0.65rem;
  opacity: 0.8;
}

.btn-abort:hover {
  background: var(--danger);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
  max-width: 90%;
}

.reset-count {
  font-size: 0.9rem;
  color: #7f8c8d;
  margin-top: 0.5rem;
  text-align: center;
}

/* Tabs */
.tabs {
  display: flex;
  margin-bottom: 1rem;
  border-bottom: 2px solid #ddd;
}

.tab-btn {
  flex: 1;
  padding: 0.8rem;
  border: none;
  background: none;
  cursor: pointer;
  font-weight: bold;
  color: #7f8c8d;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.uplot {
  margin: 0 auto;
}

main {
  padding: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.card {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  margin-bottom: 1rem;
}

/* Player Selection Buttons */
.player-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.player-option {
  display: block;
  position: relative;
}

.player-option input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.player-label {
  display: block;
  padding: 1rem;
  background: #f8f9fa;
  border: 2px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  text-align: center;
  transition: all 0.2s;
  user-select: none;
}

.player-option input:checked + .player-label {
  background: var(--primary);
  color: white;
  border-color: #d35400;
}

.player-option input:disabled + .player-label {
  background: #eee;
  color: #aaa;
  cursor: not-allowed;
  border-color: #ddd;
  opacity: 0.6;
}

button:disabled, .btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.7;
}

button, .btn {
  display: inline-block;
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.8rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
  text-align: center;
}

.btn-small { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-danger { background: var(--danger); }
.btn-success { background: var(--success); }

form div { margin-bottom: 1rem; }
label { display: block; font-weight: bold; }
input[type="text"], input[type="password"], select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

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

th, td {
  padding: 0.8rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

/* Scoreboard styles */
.scoreboard {
  display: flex;
  justify-content: space-around;
  text-align: center;
  gap: 1rem;
}

.team-box {
  flex: 1;
  padding: 1rem;
  border: 2px solid #ddd;
  border-radius: 8px;
}

.score-value {
  font-size: 4rem;
  font-weight: bold;
  margin: 1rem 0;
}

.tasks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
  min-height: 1.5rem;
}

.task-badge {
  background: var(--primary);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.controls button {
  font-size: 2rem;
  width: 100%;
}

.minus-btn {
  background: #7f8c8d;
}

@media (max-width: 480px) {
  .nav-links { gap: 0.5rem; }
  .nav-links a { padding: 0.3rem 0.4rem; font-size: 0.9rem; }
  header { padding: 0.5rem; }
  header h1 { font-size: 1.2rem; }
  
  main {
    padding: 0;
  }

  .card {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0.8rem;
    border-bottom: 1px solid #ddd;
  }

  .score-value { font-size: 3rem; }
  .controls button { padding: 1rem; }
}
