/* ═══════════════════════════════════════════════════════════════
   2026 FIFA World Cup Prediction — Design System
   Dark theme with gold accents, glassmorphism, and micro-animations
   ═══════════════════════════════════════════════════════════════ */

/* ─── Google Fonts Import ──────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ─── CSS Custom Properties ─────────────────────────────────────── */
:root {
  /* Background Colors */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-input: rgba(255, 255, 255, 0.06);
  --bg-input-focus: rgba(255, 255, 255, 0.1);

  /* Accent Colors */
  --gold: #d4a853;
  --gold-light: #e8c97a;
  --gold-dark: #b08930;
  --gold-glow: rgba(212, 168, 83, 0.15);
  --fifa-blue: #326295;
  --fifa-blue-light: #4a82b5;
  --green: #10b981;
  --green-glow: rgba(16, 185, 129, 0.15);
  --red: #ef4444;
  --orange: #f59e0b;

  /* Text Colors */
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-gold: rgba(212, 168, 83, 0.3);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow-gold: 0 0 20px rgba(212, 168, 83, 0.15);
  --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.15);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Sizes */
  --header-height: 70px;
  --max-width: 1600px;
}

/* ─── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Background Effect ─────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(50, 98, 149, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(212, 168, 83, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(16, 185, 129, 0.03) 0%, transparent 50%);
  z-index: 0;
  pointer-events: none;
}

/* ─── Header ───────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  height: var(--header-height);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-logo {
  font-size: 28px;
  line-height: 1;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Progress Bar ──────────────────────────────────────────────── */
.progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: 16px;
}

.progress-bar {
  width: 120px;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light));
  border-radius: 3px;
  transition: width var(--transition-slow);
  min-width: 2px;
}

.progress-text {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 500;
}

/* ─── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-gold);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #0a0e1a;
  border-color: var(--gold);
  font-weight: 600;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  box-shadow: var(--shadow-glow-gold);
}

.btn-danger {
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--red);
}

.btn-icon {
  font-size: 16px;
  line-height: 1;
}

/* ─── Tab Navigation ───────────────────────────────────────────── */
.tab-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 24px 0;
  display: flex;
  gap: 4px;
  position: relative;
  z-index: 1;
}

.tab-btn {
  padding: 12px 28px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.tab-btn.active {
  color: var(--gold);
  background: var(--bg-card);
  border-color: var(--border-medium);
  font-weight: 600;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold);
}

.tab-btn .tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
}

/* ─── Main Content ─────────────────────────────────────────────── */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 48px;
  position: relative;
  z-index: 1;
}

.section {
  animation: fadeIn 0.3s ease;
}

.section.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Groups Grid ──────────────────────────────────────────────── */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
  padding-top: 20px;
}

/* ─── Group Card ───────────────────────────────────────────────── */
.group-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-normal);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.group-card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.group-card.group-complete {
  border-color: rgba(16, 185, 129, 0.25);
  box-shadow: var(--shadow-glow-green);
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(50, 98, 149, 0.12), rgba(212, 168, 83, 0.08));
  border-bottom: 1px solid var(--border-subtle);
}

.group-header h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--gold);
}

.group-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-size: 14px;
  font-weight: 700;
  animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

/* ─── Matches ──────────────────────────────────────────────────── */
.group-matches {
  padding: 12px 16px;
}

.matchday {
  margin-bottom: 8px;
}

.matchday:last-child {
  margin-bottom: 0;
}

.matchday-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 4px 6px;
}

.match-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.match-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.match-team {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.match-team-home {
  justify-content: flex-end;
  text-align: right;
}

.match-team-away {
  justify-content: flex-start;
}

.team-flag {
  width: 24px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.team-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-score {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.score-input {
  width: 36px;
  height: 32px;
  text-align: center;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition-fast);
  -moz-appearance: textfield;
  appearance: textfield;
}

.score-input::-webkit-inner-spin-button,
.score-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.score-input:focus {
  outline: none;
  border-color: var(--gold);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 2px var(--gold-glow);
}

.score-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.score-separator {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 300;
  width: 12px;
  text-align: center;
}

/* ─── Standings Table ──────────────────────────────────────────── */
.standings-wrapper {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border-subtle);
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.standings-table thead th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 4px;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
}

.standings-table thead th.st-team {
  text-align: left;
  padding-left: 8px;
}

.standings-table tbody tr {
  transition: background var(--transition-fast);
}

.standings-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.standings-table tbody tr.qualified {
  background: rgba(16, 185, 129, 0.06);
}

.standings-table tbody tr.third-place {
  background: rgba(245, 158, 11, 0.06);
}

.standings-table td {
  padding: 8px 4px;
  text-align: center;
  font-weight: 500;
}

.standings-table td.st-pos {
  color: var(--text-muted);
  font-size: 11px;
  width: 24px;
}

.standings-table td.st-team {
  text-align: left;
  padding-left: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.st-flag {
  width: 16px;
  height: 11px;
  object-fit: cover;
  border-radius: 1px;
  flex-shrink: 0;
}

.standings-table td.st-pts {
  font-weight: 700;
  color: var(--gold);
}

.standings-table td.st-stat {
  color: var(--text-secondary);
  font-size: 12px;
}

/* ─── Standings Legend ─────────────────────────────────────────── */
.standings-legend {
  display: flex;
  gap: 16px;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.legend-qualified .legend-dot {
  background: var(--green);
}

.legend-third .legend-dot {
  background: var(--orange);
}

/* ═══════════════════════════════════════════════════════════════
   BRACKET STYLES
   ═══════════════════════════════════════════════════════════════ */

/* ─── Bracket Placeholder ──────────────────────────────────────── */
.bracket-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
}

.bracket-placeholder-icon {
  font-size: 64px;
  margin-bottom: 16px;
  filter: grayscale(0.5);
}

.bracket-placeholder h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.bracket-placeholder p {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 400px;
  line-height: 1.6;
}

.bracket-progress {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.bracket-progress-bar {
  width: 200px;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}

.bracket-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light));
  border-radius: 4px;
  transition: width 0.5s ease;
}

.bracket-progress span {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ─── Bracket Wrapper ──────────────────────────────────────────── */
.bracket-wrapper {
  padding-top: 16px;
}

/* ─── Bracket Round Labels ─────────────────────────────────────── */
.bracket-round-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  gap: 8px;
}

.bracket-round-labels span {
  flex: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.bracket-round-labels .final-label {
  color: var(--gold);
  font-size: 12px;
}

/* ─── Bracket Container ───────────────────────────────────────── */
.bracket-container {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 16px 0;
  /* 8 R32 matches × 76px each = 608px + padding */
  height: 680px;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dark) var(--bg-secondary);
}

.bracket-container::-webkit-scrollbar {
  height: 6px;
}

.bracket-container::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 3px;
}

.bracket-container::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 3px;
}

/* ─── Bracket Half ─────────────────────────────────────────────── */
.bracket-half {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-width: 0;
}

.bracket-left {
  flex-direction: row;
}

.bracket-right {
  flex-direction: row;
}

/* ─── Bracket Center (Final + Trophy) ──────────────────────────── */
.bracket-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0 12px;
  min-width: 220px;
  max-width: 260px;
  overflow: visible;
  z-index: 1;
}

.bracket-final-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

/* ─── Bracket Round Column ─────────────────────────────────────── */
.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  flex-shrink: 0;
  padding: 0 6px;
  position: relative;
  z-index: 2;
}

.bracket-r32 { min-width: 160px; }
.bracket-r16 { min-width: 160px; }
.bracket-qf { min-width: 160px; }
.bracket-sf { min-width: 160px; }

/* ─── Bracket Match Card ──────────────────────────────────────── */
.bracket-match {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: all var(--transition-fast);
  margin: 3px 0;
  min-width: 148px;
  /* Fixed height prevents layout shift from image loading */
  height: 66px;
  flex-shrink: 0;
}

.bracket-match:hover {
  border-color: var(--border-medium);
}

.bracket-match-team {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  cursor: default;
  transition: all var(--transition-fast);
  border-bottom: 1px solid var(--border-subtle);
  height: 32px;
  box-sizing: border-box;
}

.bracket-match-team:last-child {
  border-bottom: none;
}

.bracket-match-team.team-selectable {
  cursor: pointer;
}

.bracket-match-team.team-selectable:hover {
  background: rgba(212, 168, 83, 0.08);
}

.bracket-match-team.team-winner {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.05));
  border-left: 3px solid var(--green);
}

.bracket-flag {
  width: 18px;
  height: 12px;
  object-fit: cover;
  border-radius: 1px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.bracket-team-name {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bracket-team-empty {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ─── Final Match Card ─────────────────────────────────────────── */
.bracket-final-match {
  width: 200px;
}

.bracket-final-match .bracket-match {
  border-color: var(--border-gold);
  background: rgba(212, 168, 83, 0.06);
}

.bracket-final-match .bracket-match-team {
  padding: 8px 12px;
  min-height: 36px;
}

.bracket-final-match .bracket-team-name {
  font-size: 13px;
  font-weight: 600;
}

.bracket-final-match .bracket-flag {
  width: 22px;
  height: 15px;
}

.final-match-header {
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  padding: 6px 0 4px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ─── Stadium / Trophy Area ────────────────────────────────────── */
.trophy-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 168, 83, 0.12) 0%, transparent 70%),
    var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  width: 100%;
}

/* Subtle golden shimmer overlay */
.trophy-area::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(212, 168, 83, 0.03) 60deg,
    transparent 120deg,
    rgba(212, 168, 83, 0.04) 180deg,
    transparent 240deg,
    rgba(212, 168, 83, 0.02) 300deg,
    transparent 360deg
  );
  animation: shimmerRotate 12s linear infinite;
  pointer-events: none;
}

@keyframes shimmerRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.trophy-icon {
  font-size: 52px;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 0 16px rgba(212, 168, 83, 0.5));
  animation: trophyFloat 3s ease-in-out infinite;
}

@keyframes trophyFloat {
  0%, 100% {
    transform: translateY(0);
    filter: drop-shadow(0 0 16px rgba(212, 168, 83, 0.4));
  }
  50% {
    transform: translateY(-6px);
    filter: drop-shadow(0 8px 24px rgba(212, 168, 83, 0.6));
  }
}

.trophy-waiting {
  position: relative;
  z-index: 1;
  text-align: center;
}

.trophy-waiting-text {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

.champion-reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
  animation: champReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes champReveal {
  from { opacity: 0; transform: scale(0.5) translateY(20px); }
  60% { transform: scale(1.1) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.champion-flag {
  width: 64px;
  height: 43px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(212, 168, 83, 0.3);
  border: 2px solid var(--gold-dark);
}

.champion-name {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #f5e6b8, var(--gold), #b08930);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

.champion-label {
  font-size: 9px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
  padding: 3px 10px;
  border: 1px solid var(--border-gold);
  border-radius: 20px;
  background: rgba(212, 168, 83, 0.08);
}

/* Sparkle particles on champion reveal */
.champion-reveal::before,
.champion-reveal::after {
  content: '✦';
  position: absolute;
  font-size: 12px;
  color: var(--gold-light);
  opacity: 0;
  animation: sparkle 2s ease-in-out infinite;
}

.champion-reveal::before {
  top: -8px;
  left: 10px;
  animation-delay: 0.3s;
}

.champion-reveal::after {
  bottom: 0;
  right: 10px;
  animation-delay: 1s;
}

@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50% { opacity: 0.8; transform: scale(1.2); }
}

/* 3rd place match - smaller, more subdued */
.third-place-section .final-match-header {
  color: var(--text-secondary);
  font-size: 10px;
}

.third-place-section .bracket-match {
  border-color: var(--border-subtle);
  background: var(--bg-card);
  opacity: 0.85;
}

.third-place-section .bracket-match-team {
  padding: 5px 10px;
  min-height: 28px;
}

.third-place-section .bracket-team-name {
  font-size: 11px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.modal-visible {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}

.modal-visible .modal {
  transform: scale(1);
}

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  padding: 12px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  pointer-events: none;
}

.toast.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ─── Export Overlay ───────────────────────────────────────────── */
.export-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 26, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  backdrop-filter: blur(4px);
}

.export-overlay-content {
  text-align: center;
  color: var(--text-primary);
}

.export-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════
   AUTH MODAL
   ═══════════════════════════════════════════════════════════════ */

.auth-modal {
  max-width: 420px;
  width: 92%;
  padding: 0;
  overflow: hidden;
}

.auth-header {
  text-align: center;
  padding: 28px 24px 20px;
  background: linear-gradient(135deg, rgba(50, 98, 149, 0.15), rgba(212, 168, 83, 0.1));
  border-bottom: 1px solid var(--border-subtle);
}

.auth-logo {
  font-size: 40px;
  display: block;
  margin-bottom: 8px;
}

.auth-header h3 {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 0;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
}

.auth-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.auth-tab:hover {
  color: var(--text-primary);
}

.auth-tab.active {
  color: var(--gold);
}

.auth-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--gold);
  border-radius: 1px;
}

.auth-form {
  padding: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: all var(--transition-fast);
}

.form-group input:focus {
  outline: none;
  border-color: var(--gold);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 2px var(--gold-glow);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-group small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.auth-error {
  color: var(--red);
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 8px;
  text-align: center;
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 15px;
}

/* ═══════════════════════════════════════════════════════════════
   USER HEADER
   ═══════════════════════════════════════════════════════════════ */

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #0a0e1a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════
   SUBMIT BAR
   ═══════════════════════════════════════════════════════════════ */

.submit-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: rgba(10, 14, 26, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-gold);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.submit-bar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.submit-bar-text {
  font-size: 14px;
  color: var(--text-secondary);
}

.submit-bar-text strong {
  color: var(--gold);
}

.btn-submit {
  padding: 12px 28px;
  font-size: 15px;
  white-space: nowrap;
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(212, 168, 83, 0.2); }
  50% { box-shadow: 0 0 20px rgba(212, 168, 83, 0.4); }
}

/* ═══════════════════════════════════════════════════════════════
   LOCKED STATE
   ═══════════════════════════════════════════════════════════════ */

.locked-banner {
  position: sticky;
  top: var(--header-height);
  z-index: 50;
  background: linear-gradient(90deg, rgba(212, 168, 83, 0.12), rgba(16, 185, 129, 0.08));
  border-bottom: 1px solid var(--border-gold);
  padding: 10px 24px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--gold);
}

.predictions-locked .score-input,
.input-locked {
  opacity: 0.5;
  cursor: not-allowed !important;
  pointer-events: none;
}

.predictions-locked .bracket-match-team.team-selectable {
  cursor: not-allowed !important;
  pointer-events: none;
}

.predictions-locked .bracket-match-team.team-selectable:hover {
  background: transparent;
}

/* ═══════════════════════════════════════════════════════════════
   LEADERBOARD
   ═══════════════════════════════════════════════════════════════ */

.leaderboard-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 14px;
}

.leaderboard-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
}

.leaderboard-empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  filter: grayscale(0.4);
}

.leaderboard-empty h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.leaderboard-empty p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.leaderboard-wrapper {
  padding-top: 20px;
  max-width: 700px;
  margin: 0 auto;
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.leaderboard-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
}

.leaderboard-count {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 8px;
}

.leaderboard-my-rank {
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 6px 14px;
}

.leaderboard-my-rank strong {
  color: var(--gold);
  font-size: 18px;
}

.leaderboard-table-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

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

.leaderboard-table thead th {
  background: rgba(212, 168, 83, 0.06);
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
}

.leaderboard-table thead th.lb-user {
  text-align: left;
}

.leaderboard-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.leaderboard-table tbody tr:last-child {
  border-bottom: none;
}

.leaderboard-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.leaderboard-table td {
  padding: 12px 16px;
  text-align: center;
}

.leaderboard-table td.lb-rank {
  font-weight: 700;
  font-size: 15px;
  width: 50px;
  color: var(--text-muted);
}

.leaderboard-table td.lb-user {
  text-align: left;
}

.lb-display-name {
  font-weight: 600;
}

.lb-me-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  background: var(--gold-glow);
  color: var(--gold);
  border: 1px solid var(--border-gold);
}

.leaderboard-table td.lb-group,
.leaderboard-table td.lb-knockout {
  color: var(--text-secondary);
  font-size: 13px;
}

.leaderboard-table td.lb-total {
  font-weight: 800;
  font-size: 16px;
  color: var(--gold);
}

/* Medal rows */
.lb-medal-1 {
  background: rgba(255, 215, 0, 0.06) !important;
}
.lb-medal-1 td.lb-rank { color: #ffd700; }

.lb-medal-2 {
  background: rgba(192, 192, 192, 0.04) !important;
}
.lb-medal-2 td.lb-rank { color: #c0c0c0; }

.lb-medal-3 {
  background: rgba(205, 127, 50, 0.04) !important;
}
.lb-medal-3 td.lb-rank { color: #cd7f32; }

/* Current user row */
.lb-me {
  border-left: 3px solid var(--gold) !important;
}

/* Scoring info footer */
.leaderboard-footer {
  margin-top: 24px;
}

.scoring-info h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.scoring-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scoring-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
}

.scoring-pts {
  font-weight: 800;
  color: var(--gold);
  font-size: 14px;
  min-width: 24px;
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 1024px) {
  .groups-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }

  .bracket-round-labels {
    font-size: 10px;
    padding: 8px 0;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .header-inner {
    padding: 0 16px;
    flex-wrap: wrap;
    height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
    gap: 8px;
  }

  .header-title {
    font-size: 15px;
  }

  .header-subtitle {
    display: none;
  }

  .progress-container {
    order: 3;
    width: 100%;
    margin-right: 0;
  }

  .progress-bar {
    flex: 1;
  }

  .header-actions {
    gap: 4px;
  }

  .btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .btn span:not(.btn-icon) {
    display: none;
  }

  .tab-nav {
    padding: 12px 16px 0;
  }

  .tab-btn {
    padding: 10px 16px;
    font-size: 13px;
    flex: 1;
    text-align: center;
  }

  .main-content {
    padding: 0 16px 32px;
  }

  .groups-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .match-team .team-name {
    font-size: 12px;
  }

  .bracket-container {
    height: auto;
    flex-direction: column;
    overflow-x: hidden;
  }

  .bracket-half {
    flex-direction: column;
  }

  .bracket-round {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 8px 0;
  }

  .bracket-match {
    height: auto;
    min-width: 140px;
    flex: 0 0 auto;
  }

  .bracket-match-team {
    height: auto;
    min-height: 32px;
  }

  .bracket-round-labels {
    display: none;
  }

  .bracket-round::before {
    content: attr(data-round);
    display: block;
    width: 100%;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 4px;
  }

  .bracket-r32::before { content: 'Son 32'; }
  .bracket-r16::before { content: 'Son 16'; }
  .bracket-qf::before { content: 'Çeyrek Final'; }
  .bracket-sf::before { content: 'Yarı Final'; }

  .bracket-center {
    padding: 16px 0;
    min-width: auto;
    max-width: none;
  }

  .bracket-final-match {
    width: 100%;
    max-width: 280px;
  }

  .trophy-area {
    max-width: 280px;
  }

  .bracket-connectors {
    display: none !important;
  }
}

/* Small mobile */
@media (max-width: 400px) {
  .match-row {
    gap: 4px;
  }

  .score-input {
    width: 30px;
    height: 28px;
    font-size: 13px;
  }

  .team-flag {
    width: 20px;
    height: 14px;
  }
}
