/* Design tokens — Light estilo Linear/Vercel (modo claro por defecto) */
:root {
  --font-header: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  --bg-primary: #fafafa;
  --bg-secondary: #ffffff;
  --bg-glass: #ffffff;
  --bg-hover: #f4f4f5;
  --border-glass: #e4e4e7;
  --border-glass-hover: #d4d4d8;

  --color-accent: #18181b;
  --color-accent-strong: #000000;
  --color-accent-glow: rgba(0, 0, 0, 0.06);
  --color-on-accent: #ffffff;
  --color-gold: #ca8a04;
  --color-gold-soft: #fef3c7;
  --color-gold-glow: rgba(202, 138, 4, 0.15);
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --color-neutral: #71717a;

  --text-main: #09090b;
  --text-muted: #71717a;
  --text-dark: #18181b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-main: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-glow: 0 0 0 1px rgba(0, 0, 0, 0.05);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  /* Tints (overlays sutiles que se invierten por tema) */
  --tint-1: rgba(0, 0, 0, 0.025);
  --tint-2: rgba(0, 0, 0, 0.04);
  --tint-3: rgba(0, 0, 0, 0.06);
  --tint-4: rgba(0, 0, 0, 0.1);
}

/* Tema oscuro — limpio, gris-negro tipo Linear dark */
:root[data-theme="dark"] {
  --bg-primary: #09090b;
  --bg-secondary: #131316;
  --bg-glass: #131316;
  --bg-hover: #1c1c20;
  --border-glass: #27272a;
  --border-glass-hover: #3f3f46;

  --color-accent: #fafafa;
  --color-accent-strong: #ffffff;
  --color-accent-glow: rgba(255, 255, 255, 0.08);
  --color-on-accent: #09090b;
  --color-gold: #eab308;
  --color-gold-soft: rgba(234, 179, 8, 0.2);
  --color-gold-glow: rgba(234, 179, 8, 0.2);
  --color-success: #22c55e;
  --color-danger: #ef4444;
  --color-neutral: #a1a1aa;

  --text-main: #fafafa;
  --text-muted: #a1a1aa;
  --text-dark: #f4f4f5;

  --shadow-main: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 0 1px rgba(255, 255, 255, 0.05);

  --tint-1: rgba(255, 255, 255, 0.03);
  --tint-2: rgba(255, 255, 255, 0.05);
  --tint-3: rgba(255, 255, 255, 0.08);
  --tint-4: rgba(255, 255, 255, 0.12);
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Contenedor de la Aplicación */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}
@media (max-width: 560px) {
  .app-container { padding: 1rem 0.6rem; }
}

/* Tablas anchas (ej. mejores terceros) hacen scroll interno sin reventar la página */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Encabezado Premium */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.logo-area h1 {
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1.85rem;
  letter-spacing: -0.8px;
  line-height: 1.05;
  margin-top: 0.25rem;
  color: var(--text-main);
}

.logo-area h1 span {
  color: var(--color-gold);
  font-weight: 800;
}

.logo-area .subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

/* Botones */
.btn {
  font-family: var(--font-header);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
  color: var(--text-main);
}

.btn-secondary {
  background: var(--bg-secondary);
  border-color: var(--border-glass);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-glass-hover);
}

/* Barra de Navegación */
.app-navigation {
  display: flex;
  background: var(--bg-glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.35rem;
  margin-bottom: 1.5rem;
  gap: 0.3rem;
  box-shadow: var(--shadow-main);
}

.nav-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-header);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all var(--transition-fast);
}

.nav-tab:hover {
  color: var(--text-main);
  background: var(--tint-1);
}

/* Barra de Filtros */
.filters-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  max-width: 320px;
  width: 100%;
}

.search-box input {
  width: 100%;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem 0.65rem 2.2rem;
  color: var(--text-main);
  font-family: var(--font-body);
  transition: all var(--transition-fast);
}

.search-box input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 12px var(--color-accent-glow);
}

.search-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.quick-stats {
  display: flex;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.45rem 1rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.stat-val {
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1.05rem;
}

.stat-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Paneles de Contenido */
.tab-pane {
  display: none;
}

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

/* Fase de Grupos */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1rem;
}

.group-card {
  background: var(--bg-glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1rem 1rem 0.85rem;
  box-shadow: var(--shadow-main);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.group-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--color-accent), #8b5cf6);
  opacity: 0.8;
}

.group-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-glass-hover);
  box-shadow: 0 10px 30px var(--tint-3);
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.group-title {
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.2px;
  color: var(--text-main);
}

/* Tabla de Posiciones */
.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.standings-table th, 
.standings-table td {
  padding: 0.55rem 0.35rem;
  text-align: center;
}

.standings-table th {
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--tint-3);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.standings-table td {
  border-bottom: 1px solid var(--tint-1);
}

.standings-table tr:last-child td {
  border-bottom: none;
}

.standings-table td.team-cell {
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-flag-inline {
  font-size: 1.15rem;
  line-height: 1;
}

/* Filas Destacadas en Fase de Grupos */
.standings-table tbody tr:nth-child(1) {
  background: rgba(22, 163, 74, 0.05);
}
.standings-table tbody tr:nth-child(2) {
  background: rgba(22, 163, 74, 0.05);
}

.standings-table tr.row-qualified-direct td.pos-num {
  color: var(--color-success);
  font-weight: 700;
}

.standings-table tr.row-qualified-3rd td.pos-num {
  color: var(--color-gold);
  font-weight: 700;
}

.pos-num {
  font-weight: 600;
  color: var(--text-muted);
  width: 20px;
}

.pts-num {
  font-weight: 700;
  color: var(--text-main);
}

.group-footer-info {
  margin-top: auto;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--tint-2);
  padding-top: 0.65rem;
}

/* Tabla de Terceros */
.card-glass-container {
  background: var(--bg-glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-main);
}
@media (max-width: 560px) {
  .card-glass-container { padding: 1rem 0.75rem; }
}

.card-glass-header {
  margin-bottom: 1.25rem;
}

.card-glass-header h2 {
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.3px;
}

.card-glass-header p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.third-place-table {
  font-size: 0.95rem;
}

.third-place-table th,
.third-place-table td {
  padding: 0.85rem 1rem;
}

.third-place-table tr.qualified-row {
  background: rgba(22, 163, 74, 0.06);
}

.third-place-table tr.eliminated-row {
  background: rgba(220, 38, 38, 0.04);
}

.badge-status {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-qualified {
  background-color: var(--color-success);
}

.status-eliminated {
  background-color: var(--color-danger);
}

.status-text {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-text.ok { color: var(--color-success); }
.status-text.fail { color: var(--color-danger); }

.legend-area {
  display: flex;
  gap: 1.5rem;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
}

/* BRACKET ELIMINATORIO (Horizontal Scrollable Tree) */
.bracket-wrapper {
  overflow-x: auto;
  padding: 1rem 0;
  width: 100%;
}

/* Modificación de scrollbars */
.bracket-wrapper::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
  height: 8px;
}

.bracket-wrapper::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track {
  background: var(--tint-1);
  border-radius: 10px;
}

.bracket-wrapper::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
  background: var(--tint-4);
  border-radius: 10px;
}

.bracket-wrapper::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

.bracket-container {
  display: flex;
  gap: 3.5rem;
  padding: 1.5rem 0.5rem;
  min-width: 1550px;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  width: 250px;
  flex-shrink: 0;
}

.round-title {
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1.15rem;
  text-align: center;
  color: var(--text-main);
  margin-bottom: 0.15rem;
}

.accent-title {
  color: var(--color-gold);
}

.round-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 2rem;
  letter-spacing: 0.5px;
}

.matches-list {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  height: 100%;
  gap: 1.5rem;
}

/* Tarjeta de Partido del Bracket */
.match-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: var(--shadow-main);
}

.match-card:hover {
  border-color: var(--border-glass-hover);
  box-shadow: 0 8px 25px var(--tint-3);
}

.match-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--tint-2);
  padding-bottom: 0.35rem;
}

.match-card-venue {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--tint-1);
  text-align: right;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.match-card-teams {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.match-card-team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

.team-display-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-weight: 500;
}

.team-display-info.filled {
  color: var(--text-main);
}

.team-display-info.winner {
  color: var(--text-main);
  font-weight: 700;
}

.team-display-info.loser {
  opacity: 0.55;
}

.match-score-badge {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-muted);
  width: 25px;
  text-align: center;
}

.match-score-badge.filled {
  color: var(--text-main);
}

.match-score-badge.winner {
  color: var(--color-success);
}

.match-score-badge.loser {
  opacity: 0.55;
}

/* Indicación de penaltis */
.pen-info {
  font-size: 0.62rem;
  background: var(--tint-3);
  color: var(--text-muted);
  padding: 0px 4px;
  border-radius: 4px;
  margin-left: 4px;
}

/* Estructura específica para Final / Tercer Lugar */
.final-block {
  margin-bottom: 3.5rem;
}

/* Responsividad general */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .btn {
    flex: 1;
    justify-content: center;
  }
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .search-box {
    max-width: none;
  }
  .quick-stats {
    justify-content: center;
  }
  .app-navigation {
    flex-direction: column;
  }
}

/* === Tracker en vivo: indicador de sync, pills de estado, fixtures === */

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.sync-indicator .sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-neutral);
  box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.15);
}
.sync-indicator.ok .sync-dot {
  background: var(--color-success);
}
.sync-indicator.ok {
  color: var(--text-main);
  border-color: rgba(22, 163, 74, 0.3);
}
.sync-indicator.syncing .sync-dot {
  background: var(--color-accent);
  animation: pulseDot 1.2s infinite;
}
.sync-indicator.syncing {
  color: var(--text-main);
  border-color: var(--color-accent-glow);
}
.sync-indicator.error .sync-dot {
  background: var(--color-danger);
}
.sync-indicator.error {
  color: var(--color-danger);
  border-color: rgba(220, 38, 38, 0.3);
}

@keyframes pulseDot {
  0%   { box-shadow: 0 0 0 0   rgba(0, 0, 0, 0.25); }
  70%  { box-shadow: 0 0 0 8px rgba(0, 0, 0, 0);    }
  100% { box-shadow: 0 0 0 0   rgba(0, 0, 0, 0);    }
}

/* Pill de estado por partido */
.status-pill {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
}
.status-pill.status-live {
  background: rgba(220, 38, 38, 0.1);
  color: var(--color-danger);
  border: 1px solid rgba(220, 38, 38, 0.3);
  animation: pulseLive 1.6s infinite;
}
.status-pill.status-ft {
  background: rgba(22, 163, 74, 0.1);
  color: var(--color-success);
  border: 1px solid rgba(22, 163, 74, 0.3);
}
.status-pill.status-scheduled {
  background: var(--tint-2);
  color: var(--text-muted);
  border: 1px solid var(--border-glass);
}
.status-pill.status-other {
  background: rgba(202, 138, 4, 0.1);
  color: var(--color-gold);
  border: 1px solid rgba(202, 138, 4, 0.3);
}

@keyframes pulseLive {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

/* Lista de partidos dentro de cada tarjeta de grupo */
.group-fixtures {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem 0.5rem 0;
  border-top: 1px dashed var(--border-glass);
  margin-top: 0.5rem;
}
.fixture-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas:
    "home score away"
    "meta meta meta";
  align-items: center;
  gap: 0.45rem 0.6rem;
  padding: 0.6rem 0.7rem;
  background: var(--tint-1);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}
.fixture-row .fixture-team {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.fixture-row .fixture-team.home { grid-area: home; justify-content: flex-end; }
.fixture-row .fixture-team.away { grid-area: away; justify-content: flex-start; }
.fixture-row .fixture-score {
  grid-area: score;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: center;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}
.fixture-row .fixture-meta {
  grid-area: meta;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.fixture-row .fixture-when {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* =====================================================
   Refinamientos visuales — broadcasting FIFA, iOS-compacto
   ===================================================== */

/* Borde superior de grupo: uniforme morado→dorado, estático */
.group-card::before {
  height: 3px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-gold));
  opacity: 0.85;
}

/* Highlight de filas clasificadas: barrita lateral suave */
.standings-table tr.row-qualified-direct td:first-child,
.standings-table tr.row-qualified-3rd td:first-child {
  position: relative;
}
.standings-table tr.row-qualified-direct td:first-child::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 2px; height: 55%;
  background: var(--color-success);
  border-radius: 2px;
}
.standings-table tr.row-qualified-3rd td:first-child::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 2px; height: 55%;
  background: var(--color-gold);
  border-radius: 2px;
}

/* Fixtures de grupo: tipografía tabular, hover sutil */
.fixture-row {
  grid-template-columns: 1fr 64px 1fr auto;
  font-variant-numeric: tabular-nums;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.fixture-row:hover {
  background: var(--tint-1);
  border-color: var(--tint-4);
}
.fixture-row .fixture-team {
  font-weight: 600;
  letter-spacing: 0.2px;
  gap: 0.4rem;
  overflow: visible;
  white-space: nowrap;
}
.fixture-row .t-flag { font-size: 1.05rem; line-height: 1; }
.fixture-row .t-code { font-size: 0.85rem; }
.fixture-row .fixture-score {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: transparent;
  border: none;
}
.fixture-row .fixture-score.has-score {
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.3);
  color: var(--text-main);
  font-size: 0.95rem;
  letter-spacing: 0;
  text-transform: none;
  animation: scorePop 0.4s ease-out;
}
@keyframes scorePop {
  0%   { transform: scale(0.9); opacity: 0.4; }
  60%  { transform: scale(1.04); }
  100% { transform: scale(1);    opacity: 1;  }
}

/* LIVE: borde rojo suave + pulse mínimo (sin barrido de gradiente) */
.fixture-row.is-live {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.04);
}

/* Bracket: nombres NO se cortan, rompen a 2 líneas */
.match-card {
  padding: 0.85rem;
  position: relative;
  border-radius: var(--radius-md);
}
.team-display-info {
  flex: 1;
  min-width: 0;
  white-space: normal;
  word-break: break-word;
  line-height: 1.2;
  font-size: 0.82rem;
}
.team-display-info > span:last-child {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.match-card-team-row {
  align-items: center;
  gap: 0.5rem;
}
.match-score-badge {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
  width: 30px;
}
.match-score-badge.filled {
  animation: scorePop 0.4s ease-out;
}

/* Partido LIVE en bracket: borde rojo, sin animación de pulse */
.match-card.is-live {
  border-color: rgba(220, 38, 38, 0.35);
  box-shadow:
    0 0 0 1px rgba(220, 38, 38, 0.2),
    0 8px 24px rgba(220, 38, 38, 0.08);
}

/* Gran Final: tinte dorado sutil + trofeo estático */
.match-card.is-final {
  border-color: rgba(202, 138, 4, 0.35);
  background: linear-gradient(160deg,
    rgba(202, 138, 4, 0.06),
    var(--bg-glass) 60%);
  box-shadow:
    0 0 0 1px rgba(202, 138, 4, 0.18),
    0 10px 28px rgba(202, 138, 4, 0.08);
}
.match-card.is-final::after {
  content: "🏆";
  position: absolute;
  top: -8px;
  right: -6px;
  font-size: 1.2rem;
  filter: drop-shadow(0 4px 8px rgba(202, 138, 4, 0.35));
}

.match-score-badge.winner {
  color: var(--color-gold);
}

/* Pestañas activas: pill de fondo, sin barra inferior */
.nav-tab.active {
  background: var(--color-accent-strong);
  color: var(--color-on-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border-left: none;
}

/* Stat de partidos jugados: dorado sólido */
.stat-val {
  color: var(--color-gold);
  font-weight: 700;
}

#btn-refresh {
  font-size: 0.82rem;
  padding: 0.5rem 0.85rem;
}
#btn-refresh:hover {
  background: var(--color-accent-strong);
  border-color: var(--color-accent-strong);
  color: var(--color-on-accent);
}

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

/* Entrada escalonada de tarjetas (mínimo) */
.group-card,
.match-card {
  animation: cardIn 0.35s ease-out both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.bracket-round .round-title {
  color: var(--text-main);
}
.bracket-round .round-title.accent-title {
  color: var(--color-gold);
}

/* =====================================================
   Calendario (lista cronológica)
   ===================================================== */

.schedule-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.schedule-filter-btn {
  background: var(--tint-1);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-family: var(--font-header);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.schedule-filter-btn:hover {
  background: var(--tint-3);
  color: var(--text-main);
}
.schedule-filter-btn.active {
  background: var(--color-accent-strong);
  border-color: var(--color-accent-strong);
  color: var(--color-on-accent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.schedule-team-select {
  margin-left: auto;
  background: var(--tint-1);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-family: var(--font-header);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.45rem 2rem 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--transition-fast);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.schedule-team-select:hover { background-color: var(--tint-3); }
.schedule-team-select:focus-visible {
  outline: 2px solid var(--color-accent-strong);
  outline-offset: 2px;
}
.schedule-team-select:not([data-default="true"]):not([value=""]) { color: var(--text-main); }

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.schedule-day-title {
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1.05rem;
  text-transform: capitalize;
  color: var(--text-main);
  padding-bottom: 0.6rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid var(--tint-3);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.schedule-day.is-today .schedule-day-title {
  color: var(--color-gold);
}
.today-pill {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(202, 138, 4, 0.12);
  color: var(--color-gold);
  border: 1px solid rgba(202, 138, 4, 0.4);
  text-transform: uppercase;
}

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

.sched-row {
  display: grid;
  grid-template-columns: 88px 80px minmax(0, 1fr) 95px minmax(0, 1fr) auto;
  grid-template-areas:
    "time stage home score away status"
    "venue venue venue venue venue venue";
  align-items: center;
  gap: 0.4rem 0.7rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.sched-row:hover {
  border-color: var(--border-glass-hover);
  background: var(--tint-1);
}
.sched-row.is-live {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.04);
}

.sched-time {
  grid-area: time;
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sched-stage {
  grid-area: stage;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.sched-home, .sched-away {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.2;
}
.sched-home { grid-area: home; justify-content: flex-end; text-align: right; }
.sched-away { grid-area: away; justify-content: flex-start; }
.sched-home .t-flag, .sched-away .t-flag {
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}
.sched-home .t-name, .sched-away .t-name {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.2;
}
.t-name.placeholder {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.8rem;
}

.sched-score {
  grid-area: score;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  background: var(--tint-1);
  border: 1px solid var(--border-glass);
  min-width: 80px;
}
.sched-score.has-score {
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.3);
  color: var(--text-main);
}
.sched-score.is-live {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.3);
}
.sched-score .dash {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.sched-score .winner { color: var(--color-success); }
.sched-score .loser  { opacity: 0.55; }

.sched-status { grid-area: status; }

.sched-venue {
  grid-area: venue;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding-top: 0.3rem;
  border-top: 1px dashed var(--tint-1);
}

.schedule-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  font-style: italic;
}

@media (max-width: 768px) {
  .sched-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "time stage"
      "home home"
      "score score"
      "away away"
      "status status"
      "venue venue";
    gap: 0.3rem;
    text-align: center;
  }
  .sched-home, .sched-away { justify-content: center; text-align: center; }
  .sched-score { justify-self: center; }
  .sched-status { justify-self: center; }
}

/* =====================================================
   Hero "Próximo partido"
   ===================================================== */
.next-match-hero {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-main);
  position: relative;
  overflow: hidden;
}
.next-match-hero::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-gold));
}
.hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}
.hero-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--tint-3);
  color: var(--text-main);
  text-transform: uppercase;
}
.hero-badge.live {
  background: rgba(220, 38, 38, 0.12);
  color: var(--color-danger);
  border: 1px solid rgba(220, 38, 38, 0.3);
  animation: pulseLive 1.6s infinite;
}
.hero-stage {
  font-weight: 600;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.7rem;
}
.hero-countdown {
  margin-left: auto;
  font-weight: 700;
  color: var(--color-gold);
  font-variant-numeric: tabular-nums;
}
.hero-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1.15rem;
}
.hero-team {
  min-width: 0;
  overflow-wrap: anywhere;
}
.hero-team.home { text-align: right; }
.hero-team.away { text-align: left; }
.hero-vs {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.hero-score {
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.hero-score .dash {
  color: var(--text-muted);
  font-weight: 400;
  padding: 0 0.2rem;
}
.hero-venue {
  margin-top: 0.7rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
@media (max-width: 560px) {
  .hero-teams { font-size: 0.95rem; }
  .hero-score { font-size: 1.3rem; }
}

/* =====================================================
   Banner "API caída"
   ===================================================== */
.api-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.25);
  color: var(--color-danger);
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.85rem;
  font-weight: 500;
}
.api-banner[hidden] { display: none; }
.banner-close {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
}
.banner-close:hover { opacity: 1; }

/* =====================================================
   Skeleton loading
   ===================================================== */
.skeleton-card {
  height: 280px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(90deg, var(--tint-1) 0%, var(--tint-2) 50%, var(--tint-1) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =====================================================
   Bracket: tarjetas atenuadas por búsqueda
   ===================================================== */
.match-card.is-dim {
  opacity: 0.35;
  filter: saturate(0.5);
  transition: opacity var(--transition-fast), filter var(--transition-fast);
}

/* =====================================================
   Equipo favorito ⭐ — toggle + resaltado dorado
   ===================================================== */
.fav-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--text-muted);
  padding: 0;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), transform var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.fav-toggle:hover {
  color: var(--color-gold);
  transform: scale(1.2);
}
.fav-toggle[aria-pressed="true"] {
  color: var(--color-gold);
}

/* Standings: fila del equipo favorito tintada */
.standings-table tr.is-fav td {
  background: rgba(202, 138, 4, 0.05);
}
.standings-table tr.is-fav .team-cell { font-weight: 700; }

/* Filas de calendario y fixtures de grupo: barrita dorada + tinte */
.fixture-row.is-fav,
.sched-row.is-fav {
  box-shadow: inset 3px 0 0 0 var(--color-gold);
  background: rgba(202, 138, 4, 0.04);
  border-color: rgba(202, 138, 4, 0.3);
}

/* Tarjeta del bracket con favorito */
.match-card.is-fav {
  border-color: rgba(202, 138, 4, 0.4);
  box-shadow:
    0 0 0 1px rgba(202, 138, 4, 0.3),
    0 4px 14px rgba(202, 138, 4, 0.12);
}

/* Hero del próximo partido si involucra al favorito */
.next-match-hero.is-fav {
  border-color: rgba(202, 138, 4, 0.4);
  background: linear-gradient(135deg, rgba(202, 138, 4, 0.06) 0%, var(--bg-glass) 60%);
}
.next-match-hero.is-fav::before {
  background: linear-gradient(90deg, var(--color-gold), #fde047);
  height: 3px;
}

/* =====================================================
   Botón "Hoy" (separado del grupo de filtros)
   ===================================================== */
.schedule-jump {
  margin-left: auto;
}

/* Toggle de tema */
.theme-toggle {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition-fast);
}
.theme-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--border-glass-hover);
}
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: inline; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: inline; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---- Respetar usuarios con motion reducido ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}

/* =====================================================
   Perfil de equipo — diálogo
   ===================================================== */
[data-team-link] {
  cursor: pointer;
  transition: color var(--transition-fast);
}
[data-team-link]:hover { color: var(--color-accent-strong); }
[data-team-link]:focus-visible {
  outline: 2px solid var(--color-accent-strong);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Importante: garantiza que dialogs cerrados estén ocultos
   (algunos navegadores móviles no aplican display:none por defecto). */
dialog:not([open]) { display: none !important; }

.team-profile-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  border: 1px solid var(--border-glass);
  background: var(--bg-secondary);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 0;
  width: min(560px, 92vw);
  max-height: 88vh;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
}
.team-profile-dialog *,
.team-profile-dialog *::before,
.team-profile-dialog *::after { box-sizing: border-box; }
.team-profile-dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
}
.team-profile-dialog > div {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 88vh;
  background: var(--bg-secondary);
}

.team-profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-glass);
  background: var(--tint-1);
}
.team-profile-flag { font-size: 2.5rem; line-height: 1; }
.team-profile-title { flex: 1; min-width: 0; }
.team-profile-title h2 {
  margin: 0;
  font-family: var(--font-header);
  font-size: 1.4rem;
}
.team-profile-title p {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.team-profile-fav,
.team-profile-close {
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.team-profile-fav { font-size: 1.3rem; color: var(--color-gold); }
.team-profile-fav:hover,
.team-profile-close:hover { background: var(--tint-2); }

.team-profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-glass);
  font-variant-numeric: tabular-nums;
}
.team-profile-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.25rem;
  background: var(--tint-1);
  border-radius: var(--radius-sm);
}
.team-profile-stats strong {
  font-family: var(--font-header);
  font-size: 1.1rem;
  font-weight: 700;
}
.team-profile-stats span {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.team-profile-stats > div.big { background: var(--tint-3); }

.team-profile-section {
  padding: 1rem 1.5rem;
}
.team-profile-section h3 {
  margin: 0 0 0.6rem;
  font-family: var(--font-header);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}
.team-profile-section + .team-profile-section { padding-top: 0; }

.team-profile-matches {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.team-profile-match {
  background: var(--tint-1);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  border-left: 3px solid transparent;
}
.team-profile-match.win  { border-left-color: var(--color-success, #16a34a); }
.team-profile-match.loss { border-left-color: var(--color-danger,  #dc2626); }
.team-profile-match.draw { border-left-color: var(--text-muted); }
.tpm-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.35rem;
}
.tpm-line {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.95rem;
}
.tpm-vs  { color: var(--text-muted); font-weight: 600; font-size: 0.8rem; }
.tpm-opp { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpm-score {
  font-family: var(--font-header);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.tpm-venue {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}


