/*
 * Sistema de diseño Mundial 2026 — AISLADO.
 * Reglas de oro (no romper):
 *  - TODO cuelga de .mun-block. Cero selectores de elemento globales.
 *  - Variables CSS definidas en .mun-block (no en :root) => no pisan el tema.
 *  - Layout fluido: box-sizing border-box, max-width 100%, sin anchos fijos.
 *  - Nada de !important contra el tema.
 */

.mun-block {
  /* Paleta (de los diseños de Stitch) */
  --mun-bg-deep: #0f0a2e;
  --mun-bg-grad-a: #1a1248;
  --mun-bg-grad-b: #2b1d6e;
  --mun-purple: #6d28d9;
  --mun-purple-bright: #7c3aed;
  --mun-gold: #f5b301;
  --mun-yellow: #FFE400;
  /* amarillo principal de TO */
  --mun-live: #e11d2a;
  --mun-qualified: #16a34a;
  --mun-qualified-bg: #dcfce7;
  --mun-playoff-bg: #fef9c3;
  --mun-ink: #111827;
  --mun-black: #000000;
  --mun-ink-soft: #4b5563;
  --mun-line: #e5e7eb;
  --mun-card: #ffffff;
  --mun-on-dark: #f8fafc;
  --mun-on-dark-soft: #c7d2fe;

  /* Tabla de grupo */
  --mun-group-pill: #e23b2e;
  --mun-group-pill-text: #ffffff;
  --mun-group-qual-tint: #f0fdf4;
  --mun-group-playoff-tint: #fefce8;
  --mun-group-playoff-bar: #eab308;
  --mun-zone-neutral: #c7ccd4;
  --mun-td: #707070;
  --mun-th: #9aa1ac;

  /* Escala / forma */
  --mun-radius: 14px;
  --mun-radius-sm: 5px;
  --mun-gap: 16px;
  --mun-shadow: 0 8px 30px rgba(15, 10, 46, 0.12);

  /* Tipografía: hereda del tema para el cuerpo; display serif para titulares */
  --mun-font: inherit;
  --mun-font-display: Georgia, "Times New Roman", serif;

  /* Reset local, solo dentro del contenedor */
  box-sizing: border-box;
  max-width: 100%;
  font-family: var(--mun-font);
  color: var(--mun-ink);
  line-height: 1.4;
}

.mun-block *,
.mun-block *::before,
.mun-block *::after {
  box-sizing: border-box;
}

.mun-block img {
  max-width: 100%;
  height: auto;
}

.mun-flag {
  display: block;
  height: auto;
  flex-shrink: 0;
}

/* Aviso discreto (config/datos ausentes) */
.mun-notice {
  padding: 14px 16px;
  border: 1px dashed var(--mun-line);
  border-radius: var(--mun-radius-sm);
  background: #fafafa;
  color: var(--mun-ink-soft);
  font-size: 0.9rem;
}

/* Badge "EN VIVO" reutilizable */
.mun-live-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  line-height: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01rem;
  text-transform: uppercase;
  gap: 0.5rem;
  color: var(--mun-black);
}

.mun-live-badge::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--mun-live);
  animation: mun-pulse 1.2s ease-in-out infinite;
}

@keyframes mun-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mun-live-badge::before {
    animation: none;
  }
}

/* ── Tabla genérica (.mun-table): la usan todos los bloques tipo tabla ──
   Esqueleto: tabla + cabecera + filas + celdas. Modificadores reutilizables:
   __num (columna índice), __label (nombre, alineado a la izquierda),
   __hi (columna destacada, p. ej. Pts). */
.mun-table {
  background: linear-gradient(180deg, #F7F7F7 0%, #F7F7F7 30%, #FFFFFF 100%);
}

/* Filas en flex (sin <table>): cada celda es un ítem. Reparten el ancho por
   igual y se encogen; __num va estrecha (al contenido) y __label se lleva el
   resto, recortando el nombre con … (lo que la <table> no permitía). */
.mun-table__head,
.mun-table__row {
  display: flex;
  align-items: center;
}

.mun-table__head>*,
.mun-table__row>* {
  text-align: center;
}

.mun-table__head {
  background: #EEEEE3;
  border-bottom: 2px solid var(--mun-card);
}

.mun-table__head>* {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.01rem;
  padding: 0.625rem 0.25rem;
  opacity: 0.5;
}

@media screen and (max-width: 43rem) {
  .mun-table__head>* {
    font-size: 0.8125rem;
  }
}

.mun-table__head .mun-table__num,
.mun-table__head .mun-table__label,
.mun-table__head .mun-table__hi {
  opacity: 1;
}

.mun-table__row {
  position: relative;
}

.mun-table__row::after {
  position: absolute;
  content: '';
  left: 50%;
  bottom: 0;
  width: calc(100% - 2.5rem);
  height: 1px;
  transform: translate(-50%);
  background: var(--mun-line);
}

.mun-table__row:last-child::after {
  display: none;
}

.mun-table__row:last-child {
  border: none;
}

.mun-table__row>* {
  padding: 1.25rem 0.25rem;
  font-size: 0.8125rem;
  color: var(--mun-td);
}

@media screen and (max-width: 37.5rem) {
  .mun-table__row>* {
    font-size: 0.75rem;
  }

  .mun-table__row::after {
    width: calc(100% - 1.625rem);
  }
}

.mun-table__num {
  font-weight: 700;
  color: var(--mun-ink);
}

.mun-table__label {
  text-align: left;
}

.mun-table__hi {
  color: var(--mun-ink);
}

.mun-table__hi strong {
  font-weight: 700;
}

/* ── Grupo (.mun-gt): pastilla + .mun-table, plano (sin tarjeta). La comparten
   los bloques Grupos y Clasificación. ── */
.mun-gt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.625rem;
}

.mun-gt-pill {
  display: inline-block;
  background: var(--mun-group-pill);
  color: var(--mun-card);
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 0.8125rem;
  padding: 0.5rem 0.9375rem;
  border-radius: 0.3125rem 0.3125rem 0 0;
}

.mun-gt-head .mun-live-badge {
  padding: 0 0.625rem 0.3125rem 0;
}

.mun-gt-teamwrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mun-gt-name {
  min-width: 0;
  font-weight: 500;
  color: var(--mun-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Anchos de columna PROPIOS de la tabla de grupo. Columnas numéricas de ancho fijo
   (escalan al añadir GF/GC sin comerse el nombre); el equipo se lleva el resto y se
   recorta con … En pantallas estrechas (móvil) ocultamos GF/GC y queda la vista compacta
   PJ G E P DG Pts. Usamos @media (NO @container, que AMP prohíbe en amp-custom). */
.mun-gt .mun-table__head>*,
.mun-gt .mun-table__row>* {
  flex: 0 0 auto;
  min-width: 2.5rem;
}

.mun-gt .mun-table__label {
  flex: 1 1 0;
  min-width: 0;
}

/* 35rem (no 30): entre 480 y 560px el sidebar ya colapsó pero la tarjeta sigue ancha en
   viewport estrecho — sin esto el nombre del equipo quedaba en ~1-6 caracteres. */
@media screen and (max-width: 35rem) {
  .mun-gt .mun-gt-gcol {
    display: none;
  }

  .mun-gt .mun-table__head>*,
  .mun-gt .mun-table__row>* {
    min-width: 2.1875rem;
  }
}

/* Zona de clasificación (solo en la tarjeta de grupo). Barra de acento con box-shadow
   inset → queda DENTRO de la tabla, alineada al borde, sin desplazar la columna.
   Por DEFECTO neutra (gris): solo coloreamos cuando hay resultados (estilo Marca y
   demás referencias). Verde = clasificado; el ámbar queda reservado para los mejores
   terceros si lo añadimos. Las clases .mun-q-* (más específicas) pisan la neutra. */
.mun-gt .mun-table__row .mun-table__num {
  box-shadow: inset 0.1875rem 0 0 var(--mun-zone-neutral);
}

.mun-gt .mun-table__row.mun-q-qualified .mun-table__num {
  box-shadow: inset 0.1875rem 0 0 var(--mun-qualified);
}

.mun-gt .mun-table__row.mun-q-playoff .mun-table__num {
  box-shadow: inset 0.1875rem 0 0 var(--mun-group-playoff-bar);
}

/* Mapa de color por grupo: solo la pastilla (los resaltados de clasificación
   se mantienen verde/ámbar, ver leyenda). Paleta oficial del Mundial; C/H/I/J
   oscurecidas para que contraste el texto blanco. Cada grupo es .mun-g-<letra>
   que pisa --mun-group-pill. */
.mun-g-a {
  --mun-group-pill: #DC0202;
}

.mun-g-b {
  --mun-group-pill: #385AFF;
}

.mun-g-c {
  --mun-group-pill: #9c36b5;
}

.mun-g-d {
  --mun-group-pill: #2f9e44;
}

.mun-g-e {
  --mun-group-pill: #F54505;
}

.mun-g-f {
  --mun-group-pill: #1B2789;
}

.mun-g-g {
  --mun-group-pill: #C30096;
}

.mun-g-h {
  --mun-group-pill: #165649;
}

.mun-g-i {
  --mun-group-pill: #7F1311;
}

.mun-g-j {
  --mun-group-pill: #0c8599;
}

.mun-g-k {
  --mun-group-pill: #6741d9;
}

.mun-g-l {
  --mun-group-pill: #F12E74;
}

/* Leyenda de la zona de clasificación */
.mun-gt-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.125rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01rem;
  padding: 0.9375rem 0;
}

.mun-gt-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.mun-gt-key {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 0.125rem;
  flex-shrink: 0;
}

.mun-gt-key--qual {
  background: var(--mun-qualified);
}

.mun-gt-key--playoff {
  background: var(--mun-group-playoff-bar);
}

/* ── Selector reutilizable (.mun-select): filtros de bloques. Amarillo TO, texto
   y flecha en negro, sin el estilo nativo del navegador. ── */
.mun-select {
  -webkit-appearance: none;
  appearance: none;
  min-width: 7.5rem;
  max-width: 100%;
  text-overflow: ellipsis;
  overflow: hidden;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--mun-black);
  background-color: var(--mun-yellow);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 2l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  padding: 0.5rem 2.25rem 0.5rem 1rem;
  border: none;
  border-radius: var(--mun-radius-sm);
  cursor: pointer;
}

.mun-select:focus-visible {
  outline: 0.125rem solid var(--mun-black);
  outline-offset: 0.125rem;
}

/* ── Ficha de partido reutilizable (.mun-match-card): la comparten mini-calendario
   y calendario. Tarjeta blanca, dos filas de equipo (bandera + nombre +
   marcador/hora) y pie (fecha + grupo/ronda). El tamaño/posición lo pone el
   bloque (celda del carrusel, ítem de la rejilla…). ── */
.mun-match-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 0 1.125rem 0.9375rem;
  background: var(--mun-card);
  border: 0.0625rem solid var(--mun-line);
  border-radius: 0.625rem;
  overflow: hidden;
}

.mun-match-card.is-finished {
  background: var(--mun-on-dark);
}

.mun-match-card.is-live {
  padding-top: 1.25rem;
  border-color: var(--mun-live);
}

.mun-match-card .mun-live-badge {
  position: absolute;
  left: 1rem;
  top: 0.625rem;
  background: none;
  font-size: 0.5rem;
  line-height: 0.5rem;
  gap: 0.25rem;
}

.mun-match-card .mun-live-badge::before {
  width: 0.375rem;
  height: 0.375rem;
}

/* Al terminar, el runtime quita .is-live de la tarjeta → se oculta el badge "En vivo"
   (el marcador final ya se ve). El badge solo se pinta en SSR si está en vivo. */
.mun-match-card:not(.is-live) .mun-live-badge {
  display: none;
}

.mun-match-body {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0.875rem;
}

.mun-match-teams {
  flex: 1 1 auto;
  min-width: 0;
}

.mun-match-row {
  display: flex;
  align-items: center;
  height: 2.625rem;
  gap: 0.625rem;
  padding: 0.625rem 0 0.375rem;
  overflow: hidden;
}

.mun-match-row+.mun-match-row {
  border-top: 0.0625rem solid var(--mun-line);
}

.mun-match-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.9375rem;
  line-height: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.01rem;
  color: var(--mun-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mun-match-score,
.mun-match-kickoff {
  flex: 0 0 auto;
  font-size: 0.875rem;
  line-height: 0.875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--mun-ink);
}

/* La ficha emite SIEMPRE marcador + hora (+ badge, ya oculto arriba en :not(.is-live)) para que
   el runtime promocione una tarjeta "próxima" a en vivo sin reconstruir el DOM. Estas reglas
   conservan el aspecto por estado: la "próxima" muestra hora (sin marcador); en vivo/finalizada,
   marcador (sin hora). El badge "En vivo" solo aparece en .is-live (regla de arriba). */
.mun-match-card.is-upcoming .mun-match-score {
  display: none;
}

.mun-match-card.is-live .mun-match-kickoff,
.mun-match-card.is-finished .mun-match-kickoff {
  display: none;
}

.mun-match-foot {
  display: flex;
  flex-direction: column;
  margin-top: auto;
}

.mun-match-date {
  font-size: 0.6875rem;
  line-height: 0.8125rem;
  letter-spacing: 0.01rem;
  font-weight: 600;
  color: var(--mun-ink);
}

.mun-match-tag {
  font-size: 0.6875rem;
  line-height: 0.875rem;
  font-weight: 500;
  color: var(--mun-ink-soft);
}

/* El display:flex de la ficha ganaría al [hidden]; forzamos el ocultado (filtros). */
.mun-match-card[hidden] {
  display: none;
}

/* ── Tarjeta-panel compartida (.mun-panel): el "box" blanco de los bloques de detalle
   (eventos, h2h, predicciones, ficha-jugador, ficha-estadio). Solo el LOOK; el padding
   (tamaño) lo pone cada bloque, porque varía (p. ej. ficha-estadio no lo lleva: su
   banner sangra al borde y el padding va en el cuerpo). ── */
.mun-panel {
  font-family: var(--font-family);
  background: var(--mun-card);
  padding: 1.875rem;
  border: 0.0625rem solid var(--mun-line);
  border-radius: var(--mun-radius);
  margin: 2.5rem 0;
  overflow: hidden;
}

@media screen and (max-width: 37.5rem) {
  .mun-panel {
    padding: 0.9375rem;
  }
}

/* ── Cabecera de partido compartida (.mun-mh): la usan los bloques de tarjeta clara
   (eventos, h2h). Badge EN VIVO opcional, dos equipos (nombre fuera / bandera dentro)
   y un centro (marcador con score=true, o "VS"/hora), con una línea de meta debajo.
   El cuerpo bajo la cabecera y el espaciado lo pone cada bloque. ── */
.mun-mh {
  text-align: center;
}

.mun-mh .mun-live-badge {
  margin-bottom: 0.875rem;
  font-size: 0.8125rem;
  line-height: 0.8125rem;
  color: var(--mun-live);
}

.mun-mh-minute {
  color: var(--mun-ink-soft);
  font-weight: 600;
}

.mun-mh-match {
  display: grid;
  /* minmax(0,1fr), no 1fr: deja que las columnas de equipo encojan por debajo de su
     contenido → el nombre recorta con … (un 1fr normal = minmax(auto,1fr) no encoge). */
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(0.375rem, 2vw, 1rem);
}

.mun-mh-team {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.mun-mh-team-home {
  justify-content: flex-end;
}

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

@media screen and (max-width: 37.5rem) {
  .mun-mh-team {
    gap: 0.375rem;
    flex-flow: column nowrap;
  }

  .mun-mh-team-away {
    flex-flow: column-reverse nowrap;
  }
}

.mun-mh-name {
  min-width: 0;
  font-weight: 700;
  font-size: clamp(0.8125rem, 2.2vw, 1.25rem);
  letter-spacing: 0.01rem;
  color: var(--mun-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mun-mh-center {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mun-mh-num {
  min-width: 1ch;
  text-align: center;
  font-weight: 700;
  font-size: clamp(1.25rem, 5vw, 1.75rem);
  line-height: 1;
  color: var(--mun-ink);
  font-variant-numeric: tabular-nums;
}

.mun-mh-dash {
  margin: 0 0.625rem;
  color: var(--mun-ink-soft);
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.mun-mh-vs {
  font-weight: 700;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  letter-spacing: 0.02em;
  color: var(--mun-ink);
}

.mun-mh-meta {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  margin: 0.625rem 0 0;
  font-size: clamp(0.75rem, 3vw, 0.9375rem);
  line-height: 1;
  letter-spacing: 0.02rem;
  font-weight: 500;
  color: var(--mun-ink-sof);
}

.mun-mh-sep {
  display: block;
  font-size: 0;
  width: 0.1875rem;
  height: 0.1875rem;
  margin: 0 0.9375rem;
  border-radius: 50%;
  background: var(--mun-ink);
}