/* ============================================================ base / tema */
:root {
  --bg: #070b14;
  --surface: #0f1623;
  --surface-2: #18202f;
  --border: #202c41;
  --text: #e8edf5;
  --dim: #93a0b4;
  --accent: #2dd4a7;
  --accent-dim: rgba(45, 212, 167, 0.12);
  --blue: #4f8ff7;
  --amber: #e8b341;
  --live: #ff4d6d;
  --chip-5: #22c55e;
  --chip-3: #3b82f6;
  --chip-1: #f59e0b;
  --chip-0: #64748b;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(45, 212, 167, 0.07), transparent 60%),
    radial-gradient(900px 420px at 0% 0%, rgba(79, 143, 247, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }

abbr[title] { text-decoration: none; cursor: help; }

/* ================================================================= header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(7, 11, 20, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px 0;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.brand-ball { filter: drop-shadow(0 0 6px rgba(45, 212, 167, 0.5)); }

.header-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--dim);
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--live);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
  animation: pulse 1.6s ease-out infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0.55); }
  100% { box-shadow: 0 0 0 9px rgba(255, 77, 109, 0); }
}

.refresh-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.refresh-btn:hover { border-color: var(--accent); }

.refresh-btn.spinning { animation: spin 0.5s linear; }

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

/* ------------------------------------------------------------- progreso */
.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  transition: width 0.6s ease;
}

.progress-label {
  font-size: 0.74rem;
  color: var(--dim);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- pestañas */
.tabs {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-bottom: 10px;
}

.tab {
  flex: 1;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--dim);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

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

.tab[aria-selected='true'] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.tab:focus-visible,
.refresh-btn:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* =================================================================== main */
.main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px;
  min-height: 60vh;
}

/* !important: gana a reglas por ID como #panel-partidos { display:flex } */
.panel[hidden] { display: none !important; }

.banner {
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  background: rgba(79, 143, 247, 0.12);
  border: 1px solid rgba(79, 143, 247, 0.4);
}

.banner-error {
  background: rgba(255, 77, 109, 0.1);
  border-color: rgba(255, 77, 109, 0.45);
}

.loading {
  padding: 48px 0;
  text-align: center;
  color: var(--dim);
}

/* ================================================================ tarjetas */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 800;
}

.card-subtitle {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--dim);
}

.live-tag {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--live);
  letter-spacing: 0.4px;
  animation: blink 1.6s ease-in-out infinite;
}

@keyframes blink { 50% { opacity: 0.45; } }

/* ================================================================== tablas */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.table th {
  color: var(--dim);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 4px 5px;
  text-align: center;
}

.table td { padding: 6px 5px; text-align: center; }

.table tbody tr { border-top: 1px solid var(--border); }

.col-team { text-align: left !important; }

.col-team .team-name {
  margin-left: 7px;
  font-weight: 600;
  white-space: nowrap;
}

.col-pos { width: 26px; color: var(--dim); }

/* -------------------------------------------------------------- banderas */
.flag {
  width: 22px;
  height: 16px;
  border-radius: 3px;
  object-fit: cover;
  vertical-align: -3px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.flag-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 16px;
  border-radius: 3px;
  background: var(--surface-2);
  font-size: 0.55rem;
  font-weight: 800;
  color: var(--dim);
}

/* ---------------------------------------------------------------- chips */
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.74rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.chip-5 { background: rgba(34, 197, 94, 0.16); color: var(--chip-5); }
.chip-3 { background: rgba(59, 130, 246, 0.16); color: var(--chip-3); }
.chip-1 { background: rgba(245, 158, 11, 0.16); color: var(--chip-1); }
.chip-0 { background: rgba(100, 116, 139, 0.16); color: var(--chip-0); }
.chip-wait { background: transparent; color: var(--dim); }

.chip-live { box-shadow: 0 0 0 1px var(--live); animation: blink 1.6s ease-in-out infinite; }

/* ---------------------------------------------------------------- footer */
.site-footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px 16px 28px;
  color: var(--dim);
  font-size: 0.74rem;
}

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