:root {
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --blue: #2563eb;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.5;
}

.top-nav {
  background: var(--gray-900);
  color: white;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.top-nav .brand {
  font-size: 18px;
  font-weight: 700;
}

.top-nav a {
  color: var(--gray-300);
  text-decoration: none;
  font-size: 14px;
}

.top-nav a.active, .top-nav a:hover { color: white; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

h1 { font-size: 24px; margin-bottom: 8px; }
h2 { font-size: 18px; margin-bottom: 8px; }
p { color: var(--gray-500); margin-bottom: 16px; }

.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }

.participant-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 16px;
}

.participant-card h3 {
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--gray-700);
}

.team-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--gray-100);
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 13px;
  margin: 2px;
}

.team-chip.eliminated {
  opacity: 0.4;
  text-decoration: line-through;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge.alive { background: #dcfce7; color: var(--green); }
.badge.eliminated { background: #fee2e2; color: var(--red); }
.badge.bonus { background: #fef3c7; color: var(--amber); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--gray-200);
}

th { font-weight: 600; color: var(--gray-500); font-size: 12px; text-transform: uppercase; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.btn.primary { background: var(--blue); color: white; }
.btn.primary:hover { background: #1d4ed8; }
.btn.danger { background: var(--red); color: white; }
.btn.danger:hover { background: #b91c1c; }
.btn.outline { background: white; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn.outline:hover { background: var(--gray-50); }
.btn:disabled { opacity: 0.5; cursor: default; }

input, select {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 14px;
}

.form-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.form-row input { flex: 1; }

.alert {
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 14px;
}

.alert.error { background: #fee2e2; color: var(--red); }
.alert.success { background: #dcfce7; color: var(--green); }
.alert.info { background: #dbeafe; color: var(--blue); }

.match-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
}

.match-card .teams { flex: 1; display: flex; align-items: center; gap: 8px; }
.match-card .score { display: flex; align-items: center; gap: 4px; }
.match-card .score input { width: 40px; text-align: center; }
.match-card .vs { color: var(--gray-400); }

.standings-table .pos { width: 30px; color: var(--gray-400); }
.standings-table .pts { font-weight: 700; }

.group-section { margin-bottom: 24px; }
.group-section h3 { margin-bottom: 8px; font-size: 15px; }

.summary-strip {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.summary-stat {
  text-align: center;
}

.summary-stat .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--blue);
}

.summary-stat .label {
  font-size: 13px;
  color: var(--gray-500);
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}

.empty-state h3 { color: var(--gray-600); margin-bottom: 8px; }

.draw-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

.draw-participants h2,
.draw-pool h2 {
  margin-bottom: 12px;
}

.team-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
}

.team-pool .team-chip {
  transition: all 0.3s ease;
}

.team-pool .team-chip.selected {
  border: 2px solid var(--blue);
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.6);
  animation: pulse 1s ease-in-out infinite;
  transform: scale(1.05);
}

.team-pool .team-chip.assigned {
  opacity: 0.3;
  text-decoration: line-through;
}

.participant-card.revealed {
  border-color: var(--green) !important;
  transition: border-color 0.3s ease;
}

.draw-status {
  text-align: center;
  font-size: 20px;
  padding: 16px;
  font-weight: 700;
  color: var(--gray-700);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(37, 99, 235, 0.4); }
  50% { box-shadow: 0 0 20px rgba(37, 99, 235, 0.8); }
}

@media (max-width: 768px) {
  .grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .draw-layout { grid-template-columns: 1fr; }
}
