/* ═══════════════════════════════════════════════════════
   DESIGN 3: LUXURY EDITORIAL
   Magazine-quality typography. Muted earth tones.
   Generous whitespace. Elegant serif headings.
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Source+Sans+3:wght@300;400;500;600;700&display=swap');

:root {
  --green: #2d6a4f;
  --amber: #b08d57;
  --red: #9b2226;
  --blue: #264653;
  --ink: #1a1a1a;
  --warm-white: #faf8f5;
  --sand: #f0ebe3;
  --stone: #d4c5b2;
  --clay: #8b7355;
  --charcoal: #2d2d2d;
  --text: #3d3d3d;
  --muted: #8a8279;
}

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

body {
  font-family: 'Source Sans 3', 'Georgia', serif;
  background: var(--warm-white);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.top-nav {
  background: var(--ink);
  color: var(--warm-white);
  padding: 0 40px;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 64px;
}

.top-nav .brand {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.top-nav a {
  color: var(--stone);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: color 0.3s;
}

.top-nav a.active, .top-nav a:hover { color: var(--warm-white); }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 40px;
}

h1 {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 6px;
  color: var(--ink);
}

h2 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 400;
  margin-bottom: 8px;
  color: var(--ink);
  font-style: italic;
}

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

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--clay);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
}

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

.card {
  background: white;
  border: 1px solid var(--sand);
  border-radius: 2px;
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

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

.participant-card {
  background: white;
  border: 1px solid var(--sand);
  border-radius: 2px;
  padding: 20px;
  transition: box-shadow 0.3s;
}

.participant-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

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

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

.participant-card h3 {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink);
}

.team-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--sand);
  border-radius: 2px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  margin: 3px;
  color: var(--charcoal);
}

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

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.badge.alive { background: #e8f5e9; color: var(--green); }
.badge.eliminated { background: #fce4e4; color: var(--red); }
.badge.bonus { background: #f5ecd7; color: var(--amber); }
.badge.pot { background: #dde8ea; color: var(--blue); }

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

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

th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--sand);
}

th {
  font-weight: 600;
  color: var(--clay);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

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

.btn.primary { background: var(--ink); color: var(--warm-white); }
.btn.primary:hover { background: var(--charcoal); }
.btn.primary:active { background: #111; }
.btn.danger { background: var(--red); color: white; }
.btn.danger:hover { background: #7d1a1d; }
.btn.danger:active { background: #5f1315; }
.btn.outline { background: white; border: 1px solid var(--stone); color: var(--text); }
.btn.outline:hover { background: var(--sand); }
.btn.outline:active { background: var(--stone); color: var(--ink); }
.btn:disabled { opacity: 0.35; cursor: default; }

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

input, select {
  padding: 10px 14px;
  border: 1px solid var(--stone);
  border-radius: 2px;
  font-size: 14px;
  min-height: 44px;
  box-sizing: border-box;
  font-family: 'Source Sans 3', sans-serif;
  background: white;
  color: var(--text);
}

input:focus, select:focus {
  border-color: var(--clay);
}

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

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

.alert.error { background: #fce4e4; color: var(--red); }
.alert.success { background: #e8f5e9; color: var(--green); }
.alert.info { background: #dde8ea; color: var(--blue); }

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

.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(--stone); font-style: italic; }

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

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

.group-section h3 {
  font-family: 'Playfair Display', serif;
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 400;
  font-style: italic;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--stone);
  color: var(--ink);
}

.group-layout { display: flex; gap: 32px; 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: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

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

.fixture-time {
  min-width: 104px;
  font-size: 12px;
  color: var(--stone);
  white-space: nowrap;
  font-weight: 500;
}

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

.summary-strip {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
  padding: 32px 0;
  border-top: 1px solid var(--stone);
  border-bottom: 1px solid var(--stone);
  margin-bottom: 32px;
}

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

.summary-stat .value {
  font-family: 'Playfair Display', serif;
  font-size: 40px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1;
}

.summary-stat .label {
  font-size: 11px;
  color: var(--clay);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 4px;
}

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

tr.zero-hero { background: #faf5eb; }

.badge.zero-hero-badge {
  background: #f5ecd7;
  color: var(--amber);
  font-size: 12px;
  padding: 0 6px;
}

.badge.third { background: #f5ecd7; color: var(--amber); }

tr.status-qualified { background: #f0f7f2; }
tr.status-eliminated { background: #fdf2f2; }
tr.status-third { background: #faf5eb; }

.empty-state {
  text-align: center;
  padding: 80px 40px;
  color: var(--stone);
}

.empty-state h2 {
  color: var(--clay);
  margin-bottom: 8px;
  font-style: normal;
}

.draw-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  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 16px; min-height: 32px; }

.draw-layout .team-chip {
  font-size: 11px;
  padding: 5px 10px;
  margin: 2px;
}

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

.team-pool .team-chip.selected {
  border: 1px solid var(--amber);
  box-shadow: 0 0 16px rgba(176, 141, 87, 0.3);
  animation: luxury-glow 1.5s ease-in-out infinite;
  transform: scale(1.04);
}

.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: 6px;
  align-content: flex-start;
}

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

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

.draw-status {
  text-align: center;
  font-size: 14px;
  padding: 12px;
  font-weight: 500;
  color: var(--clay);
  font-style: italic;
}

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

.pot-header {
  font-size: 10px;
  font-weight: 600;
  color: var(--clay);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--sand);
}

@keyframes luxury-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(176, 141, 87, 0.2); }
  50% { box-shadow: 0 0 24px rgba(176, 141, 87, 0.4); }
}

.ko-match {
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid var(--sand);
  border-radius: 2px;
  margin-bottom: 6px;
  overflow: hidden;
}

.ko-team { padding: 8px 12px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.ko-team.winner { background: #f0f7f2; font-weight: 600; }
.ko-score { padding: 2px 12px; font-size: 12px; color: var(--clay); text-align: center; background: var(--sand); border-top: 1px solid var(--sand); border-bottom: 1px solid var(--sand); }
.ko-score-input { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 4px 8px; background: var(--sand); border-top: 1px solid var(--sand); border-bottom: 1px solid var(--sand); }
.ko-select { padding: 4px; font-size: 12px; border: 1px solid var(--stone); border-radius: 2px; margin: 2px 4px; }

.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-size: 10px;
  font-weight: 600;
  color: var(--clay);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 2px 0;
  align-self: start;
}

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

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

.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: 20px; }
.h2h-section h3 {
  font-family: 'Playfair Display', serif;
  margin-bottom: 8px;
  font-size: 16px;
  font-style: italic;
  font-weight: 400;
}
.h2h-section p { font-size: 13px; color: var(--stone); }

.fixture-teams {
  font-size: 12px;
  color: var(--stone);
  padding-top: 0;
  margin-bottom: 4px;
  font-style: italic;
}

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

@media (max-width: 768px) {
  .container { padding: 32px 20px; }
  .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(26, 26, 26, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.auth-box {
  background: white;
  border: 1px solid var(--sand);
  border-radius: 2px;
  padding: 40px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.auth-box h2 { font-family: 'Playfair Display', serif; font-size: 22px; margin-bottom: 4px; font-style: normal; }
.auth-box p { color: var(--muted); margin-bottom: 24px; }
.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;
  }
}
