/* ═══════════════════════════════════════════════════════
   DESIGN 2: RETRO-FUTURISTIC WORLD CUP
   1994 World Cup poster energy. Bold primaries.
   Condensed type. Dynamic angles. Electric.
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --green: #00c853;
  --amber: #ffc400;
  --red: #ff1744;
  --blue: #2979ff;
  --deep-blue: #0d1b3e;
  --electric: #00e5ff;
  --gold: #ffd740;
  --surface: #0a1628;
  --card: #111d35;
  --text: #e8eaf6;
  --muted: #7986cb;
  --glow: rgba(0, 229, 255, 0.15);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--surface);
  color: var(--text);
  line-height: 1.5;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(41, 121, 255, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(0, 229, 255, 0.06) 0%, transparent 50%);
}

.top-nav {
  background: linear-gradient(135deg, var(--deep-blue) 0%, #1a237e 100%);
  color: white;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
  border-bottom: 2px solid var(--electric);
  position: relative;
}

.top-nav::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--electric), var(--gold), var(--electric));
}

.top-nav .brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-nav .brand svg { filter: drop-shadow(0 0 6px var(--electric)); }

.top-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  transition: color 0.2s, text-shadow 0.2s;
}

.top-nav a.active, .top-nav a:hover {
  color: var(--electric);
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.5);
}

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

h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px;
  letter-spacing: 2px;
  margin-bottom: 4px;
  background: linear-gradient(90deg, var(--electric), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  color: var(--electric);
}

p { color: var(--muted); margin-bottom: 16px; font-size: 14px; }

label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}

:focus-visible {
  outline: 2px solid var(--electric);
  outline-offset: 2px;
}

.card {
  background: var(--card);
  border: 1px solid rgba(0, 229, 255, 0.15);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

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

.participant-card {
  background: var(--card);
  border: 1px solid rgba(0, 229, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.participant-card:hover {
  border-color: rgba(0, 229, 255, 0.3);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.08);
}

.draw-participants .participant-card {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.draw-participants .participant-card h3 { margin-bottom: 0; margin-right: 4px; }

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

.team-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  margin: 3px;
  color: var(--text);
  transition: all 0.2s;
}

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

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.alive { background: rgba(0, 200, 83, 0.2); color: var(--green); border: 1px solid rgba(0, 200, 83, 0.3); }
.badge.eliminated { background: rgba(255, 23, 68, 0.2); color: var(--red); border: 1px solid rgba(255, 23, 68, 0.3); }
.badge.bonus { background: rgba(255, 196, 0, 0.2); color: var(--gold); border: 1px solid rgba(255, 196, 0, 0.3); }
.badge.pot { background: rgba(41, 121, 255, 0.2); color: var(--blue); border: 1px solid rgba(41, 121, 255, 0.3); }

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

.standings-table { table-layout: fixed; }

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0, 229, 255, 0.08);
}

th {
  font-weight: 700;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s;
}

.btn.primary {
  background: linear-gradient(135deg, var(--blue), var(--electric));
  color: var(--deep-blue);
  box-shadow: 0 4px 16px rgba(0, 229, 255, 0.3);
}
.btn.primary:hover { box-shadow: 0 6px 24px rgba(0, 229, 255, 0.5); transform: translateY(-1px); }
.btn.primary:active { transform: translateY(0); }
.btn.danger { background: linear-gradient(135deg, var(--red), #ff5252); color: white; }
.btn.danger:hover { box-shadow: 0 4px 16px rgba(255, 23, 68, 0.4); }
.btn.danger:active { transform: translateY(0); }
.btn.outline { background: transparent; border: 1px solid var(--muted); color: var(--text); }
.btn.outline:hover { background: rgba(0, 229, 255, 0.1); border-color: var(--electric); }
.btn.outline:active { background: rgba(0, 229, 255, 0.15); }
.btn:disabled { opacity: 0.3; cursor: default; }

svg.icon { vertical-align: middle; display: inline; }

input, select {
  padding: 10px 14px;
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 8px;
  font-size: 14px;
  min-height: 44px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
}

input:focus, select:focus {
  border-color: var(--electric);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.2);
}

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

.alert {
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  border: 1px solid;
}

.alert.error { background: rgba(255, 23, 68, 0.1); color: var(--red); border-color: rgba(255, 23, 68, 0.3); }
.alert.success { background: rgba(0, 200, 83, 0.1); color: var(--green); border-color: rgba(0, 200, 83, 0.3); }
.alert.info { background: rgba(41, 121, 255, 0.1); color: var(--electric); border-color: rgba(0, 229, 255, 0.3); }

.match-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 229, 255, 0.06);
}

.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: 48px; text-align: center; font-size: 15px; }
.match-card .vs { color: var(--muted); }

.standings-table .col-num { text-align: center; white-space: nowrap; }
.standings-table .pos { width: 30px; color: var(--muted); }
.standings-table .col-pts { font-weight: 800; color: var(--gold); }

.group-section { margin-bottom: 32px; }

.group-section h3 {
  font-family: 'Bebas Neue', sans-serif;
  margin-bottom: 8px;
  font-size: 18px;
  letter-spacing: 2px;
  padding-bottom: 4px;
  border-bottom: 2px solid rgba(0, 229, 255, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-section h3::before {
  content: '';
  width: 4px;
  height: 18px;
  background: var(--electric);
  border-radius: 2px;
}

.group-layout { display: flex; gap: 24px; align-items: flex-start; }
.group-layout .standings-table { flex: 1; min-width: 0; }
.group-fixtures { flex: 1; min-width: 260px; font-size: 13px; }

.fixture-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(0, 229, 255, 0.06);
}

.fixture-row:has(+ .fixture-teams) { border-bottom: 0; padding-bottom: 0; }

.fixture-time {
  min-width: 104px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.fixture-home { flex: 1; text-align: right; }
.fixture-away { flex: 1; }
.fixture-score { min-width: 28px; text-align: center; font-weight: 700; color: var(--electric); }

.summary-strip {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  padding: 20px;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid rgba(0, 229, 255, 0.1);
  margin-bottom: 24px;
}

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

.summary-stat .value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px;
  line-height: 1;
  background: linear-gradient(135deg, var(--electric), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.summary-stat .label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.zero-hero-stat .value {
  background: linear-gradient(135deg, var(--gold), var(--amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.zero-hero-stat .label { color: var(--gold); }

tr.zero-hero { background: rgba(255, 215, 64, 0.08); }

.badge.zero-hero-badge {
  background: rgba(255, 215, 64, 0.2);
  color: var(--gold);
  font-size: 12px;
  padding: 0 6px;
}

.badge.third { background: rgba(255, 196, 0, 0.2); color: var(--gold); border: 1px solid rgba(255, 196, 0, 0.3); }

tr.status-qualified { background: rgba(0, 200, 83, 0.08); }
tr.status-eliminated { background: rgba(255, 23, 68, 0.06); }
tr.status-third { background: rgba(255, 196, 0, 0.06); }

.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
}

.empty-state h2 { color: var(--electric); margin-bottom: 8px; }

.draw-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  font-size: 13px;
  align-items: start;
}

.draw-layout h1 { font-size: 24px; margin-bottom: 0; }
.draw-layout h2 { font-size: 16px; margin-bottom: 6px; }
.draw-layout h3 { font-size: 13px; margin-bottom: 0; }
.draw-layout .draw-participants h2,
.draw-layout .draw-pool h2 { margin-bottom: 12px; }

.draw-layout .btn { font-size: 12px; padding: 8px 14px; min-height: 32px; }

.draw-layout .team-chip {
  font-size: 11px;
  padding: 5px 9px;
  margin: 2px;
  border-radius: 14px;
}

.draw-layout .badge { font-size: 10px; padding: 3px 7px; }

.team-pool .team-chip.selected {
  border-color: var(--electric);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.5);
  animation: electric-pulse 0.8s ease-in-out infinite;
  transform: scale(1.05);
}

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

.draw-participants .assigned-teams { display: contents; }
.draw-participants h2, .draw-pool h2 { margin-bottom: 12px; }

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

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

.participant-card.revealed {
  border-color: var(--green) !important;
  box-shadow: 0 0 20px rgba(0, 200, 83, 0.2);
  transition: all 0.3s;
}

.draw-status {
  text-align: center;
  font-size: 14px;
  padding: 10px;
  font-weight: 700;
  color: var(--electric);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.pot-section { margin-bottom: 10px; }

.pot-header {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(0, 229, 255, 0.15);
}

@keyframes electric-pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(0, 229, 255, 0.4); }
  50% { box-shadow: 0 0 28px rgba(0, 229, 255, 0.8); }
}

.ko-match {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid rgba(0, 229, 255, 0.12);
  border-radius: 8px;
  margin-bottom: 6px;
  overflow: hidden;
}

.ko-team { padding: 6px 10px; font-size: 12px; display: flex; align-items: center; gap: 6px; }
.ko-team.winner { background: rgba(0, 200, 83, 0.1); font-weight: 600; }
.ko-score { padding: 2px 10px; font-size: 11px; color: var(--muted); text-align: center; background: rgba(0, 0, 0, 0.2); border-top: 1px solid rgba(0, 229, 255, 0.08); border-bottom: 1px solid rgba(0, 229, 255, 0.08); }
.ko-score-input { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 4px 8px; background: rgba(0, 0, 0, 0.2); border-top: 1px solid rgba(0, 229, 255, 0.08); border-bottom: 1px solid rgba(0, 229, 255, 0.08); }
.ko-select { padding: 4px; font-size: 12px; border: 1px solid rgba(0, 229, 255, 0.2); border-radius: 4px; margin: 2px 4px; background: var(--card); color: var(--text); }

.ko-bracket-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: auto repeat(16, 1fr);
  gap: 4px;
  height: 750px;
}

.ko-round-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--electric);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 2px 0;
  align-self: start;
}

.ko-bracket-grid .ko-match { margin: 0; border-radius: 6px; justify-content: space-between; }
.ko-bracket-grid .ko-team { padding: 3px 6px; font-size: 10px; gap: 3px; }
.ko-bracket-grid .ko-score { padding: 1px 6px; font-size: 10px; }

.h2h-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.h2h-table { min-width: 0; }
.h2h-table th, .h2h-table td { padding: 6px 5px; }
.h2h-table th:nth-child(2), .h2h-table td:nth-child(2) { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 768px) { .h2h-table th, .h2h-table td { padding: 4px 3px; font-size: 12px; } }
.h2h-fixtures { min-width: 0; }
.h2h-section { margin-bottom: 16px; }
.h2h-section h3 {
  font-family: 'Bebas Neue', sans-serif;
  margin-bottom: 8px;
  font-size: 16px;
  letter-spacing: 1.5px;
  color: var(--electric);
}
.h2h-section p { font-size: 13px; color: var(--muted); }

.fixture-teams {
  font-size: 11px;
  color: var(--muted);
  padding-top: 0;
  margin-bottom: 4px;
}

@media (max-width: 1024px) {
  .h2h-layout { grid-template-columns: 1fr; }
  .h2h-table, .h2h-fixtures { width: 100%; min-width: 0; }
}

@media (max-width: 768px) {
  .grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .draw-layout { grid-template-columns: 1fr; }
  .ko-layout { flex-wrap: wrap; }
  .ko-bracket-grid { height: auto; grid-template-columns: 1fr 1fr; grid-template-rows: none; }
  .ko-bracket-grid .ko-round-label { display: none; }
  .ko-bracket-grid .ko-match { grid-column: auto !important; grid-row: auto !important; }
  .group-layout { flex-direction: column; }
  .group-fixtures { width: 100%; min-width: 0; }
  .h2h-layout { grid-template-columns: 1fr; }
  .h2h-table, .h2h-fixtures { width: 100%; min-width: 0; }
}

#auth-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 22, 40, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.auth-box {
  background: var(--card);
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 16px;
  padding: 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 255, 0.1);
}

.auth-box h2 { font-family: 'Bebas Neue', sans-serif; font-size: 24px; letter-spacing: 1px; margin-bottom: 4px; }
.auth-box p { color: var(--muted); margin-bottom: 20px; }
.auth-box .form-row { flex-direction: row; }
.auth-box input { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
