/* ============================================================================
   BATTLE · Base de temas POR JUEGO (estructura + mobile-first)
   ----------------------------------------------------------------------------
   Reglas COMPARTIDAS por los juegos tematizados (BO1 y BO2). NO afecta a BO7
   (blackops7 no coincide con estos selectores, queda intacto).

   Cada tema (battle-theme-blackops1/2.css) define los TOKENS de color:
     --gt-bg --gt-surface --gt-surface-2 --gt-border --gt-accent --gt-accent-2
     --gt-text --gt-muted --gt-glow --gt-radius
   Aqui solo va la ESTRUCTURA (layout, tabla mobile-first, touch, focus).
   Mobile-first: los estilos base son para ~375px; se escalan con min-width.
   ========================================================================== */

body[data-game="blackops1"],
body[data-game="blackops2"] {
  /* Fallbacks por si un tema no cargara */
  --gt-bg: #0b0f16;
  --gt-surface: rgba(255, 255, 255, 0.04);
  --gt-surface-2: rgba(255, 255, 255, 0.08);
  --gt-border: rgba(255, 255, 255, 0.16);
  --gt-accent: #58a6ff;
  --gt-accent-2: #7ee787;
  --gt-text: #f4f7fb;
  --gt-muted: #9fb0c3;
  --gt-glow: rgba(88, 166, 255, 0.35);
  --gt-radius: 10px;
  --gt-touch: 44px;
}

/* --- Selector de juego (pills) — touch-friendly y con estado claro --------- */
body[data-game="blackops1"] .ladder-game-filter .btn,
body[data-game="blackops2"] .ladder-game-filter .btn,
body[data-game="blackops1"] .bhome-game-filter .btn,
body[data-game="blackops2"] .bhome-game-filter .btn {
  min-height: var(--gt-touch);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--gt-radius);
  border: 1px solid var(--gt-border);
  color: var(--gt-text);
  background: var(--gt-surface);
  transition: transform 150ms ease-out, box-shadow 150ms ease-out,
    background-color 150ms ease-out, border-color 150ms ease-out;
}
/* !important necesario: la skin combat/vibe fuerza .btn-primary en rojo. */
body[data-game="blackops1"] .ladder-game-filter .btn.btn-primary,
body[data-game="blackops2"] .ladder-game-filter .btn.btn-primary,
body[data-game="blackops1"] .bhome-game-filter .btn.btn-primary,
body[data-game="blackops2"] .bhome-game-filter .btn.btn-primary {
  background: var(--gt-accent) !important;
  border-color: var(--gt-accent) !important;
  color: var(--gt-on-accent, #06080d) !important;
  box-shadow: 0 0 0 1px var(--gt-accent), 0 0 18px var(--gt-glow) !important;
}

/* --- Foco visible accesible (>= 2px) en todo lo interactivo ---------------- */
body[data-game="blackops1"] a:focus-visible,
body[data-game="blackops1"] button:focus-visible,
body[data-game="blackops1"] .btn:focus-visible,
body[data-game="blackops1"] select:focus-visible,
body[data-game="blackops1"] input:focus-visible,
body[data-game="blackops2"] a:focus-visible,
body[data-game="blackops2"] button:focus-visible,
body[data-game="blackops2"] .btn:focus-visible,
body[data-game="blackops2"] select:focus-visible,
body[data-game="blackops2"] input:focus-visible {
  outline: 2px solid var(--gt-accent-2);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--gt-glow);
}

/* --- Cifras tabulares en datos de ranking (evita saltos de layout) --------- */
body[data-game="blackops1"] .ladder-table,
body[data-game="blackops2"] .ladder-table,
body[data-game="blackops1"] .podium-points,
body[data-game="blackops2"] .podium-points,
body[data-game="blackops1"] .points-col,
body[data-game="blackops2"] .points-col {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ==========================================================================
   TABLA DE LADDER — MOBILE-FIRST: en pantallas estrechas cada fila es una
   TARJETA apilada (sin scroll horizontal roto). En >=768px vuelve a tabla.
   ========================================================================== */
@media (max-width: 767.98px) {
  body[data-game="blackops1"] .ladder-table-wrap,
  body[data-game="blackops2"] .ladder-table-wrap {
    overflow: visible; /* anula el scroll horizontal de .table-responsive */
  }
  body[data-game="blackops1"] .ladder-table,
  body[data-game="blackops2"] .ladder-table,
  body[data-game="blackops1"] .ladder-table tbody,
  body[data-game="blackops2"] .ladder-table tbody {
    display: block;
    width: 100%;
  }
  /* Ocultamos el thead: cada celda lleva su etiqueta via data-label */
  body[data-game="blackops1"] .ladder-table thead,
  body[data-game="blackops2"] .ladder-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  body[data-game="blackops1"] .ladder-table tr,
  body[data-game="blackops2"] .ladder-table tr {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.35rem 0.75rem;
    margin-bottom: 0.85rem;
    padding: 0.85rem 0.9rem 0.95rem;
    border: 1px solid var(--gt-border);
    border-radius: var(--gt-radius);
    background: var(--gt-surface);
  }
  /* Rank: chip a la izquierda, ocupa la 1a columna de las dos primeras filas */
  body[data-game="blackops1"] .ladder-table td,
  body[data-game="blackops1"] .ladder-table th[scope="row"],
  body[data-game="blackops2"] .ladder-table td,
  body[data-game="blackops2"] .ladder-table th[scope="row"] {
    display: flex;
    align-items: center;
    border: 0;
    padding: 0;
    min-height: 28px;
  }
  /* # (rank) y Equipo ocupan la fila superior a lo ancho */
  body[data-game="blackops1"] .ladder-table th[scope="row"].rank-col,
  body[data-game="blackops2"] .ladder-table th[scope="row"].rank-col {
    grid-column: 1;
    grid-row: 1;
    font-size: 1.1rem;
    font-weight: 800;
  }
  body[data-game="blackops1"] .ladder-table td:nth-child(2),
  body[data-game="blackops2"] .ladder-table td:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    font-weight: 700;
  }
  /* Resto de celdas: etiqueta (data-label) + valor, en dos columnas */
  body[data-game="blackops1"] .ladder-table td[data-label],
  body[data-game="blackops2"] .ladder-table td[data-label] {
    grid-column: 1 / -1;
    justify-content: space-between;
    padding: 0.15rem 0;
    border-top: 1px dashed var(--gt-border);
  }
  body[data-game="blackops1"] .ladder-table td[data-label]::before,
  body[data-game="blackops2"] .ladder-table td[data-label]::before {
    content: attr(data-label);
    color: var(--gt-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
  }
  /* La acción "Ver" a ancho completo y con altura táctil */
  body[data-game="blackops1"] .ladder-table td[data-label="Acciones"] .btn,
  body[data-game="blackops2"] .ladder-table td[data-label="Acciones"] .btn {
    min-height: var(--gt-touch);
    width: 100%;
    justify-content: center;
    display: inline-flex;
    align-items: center;
  }
  /* Podio: apilar en columna cómoda en móvil */
  body[data-game="blackops1"] .podium-container,
  body[data-game="blackops2"] .podium-container {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  body[data-game="blackops1"] .podium-place,
  body[data-game="blackops2"] .podium-place {
    width: 100%;
  }
}

/* --- Botones de acción táctiles también en la creación de reto y filtros --- */
@media (max-width: 767.98px) {
  body[data-game="blackops1"] .clist-tab,
  body[data-game="blackops2"] .clist-tab,
  body[data-game="blackops1"] .ladder-mode-filter .btn,
  body[data-game="blackops2"] .ladder-mode-filter .btn {
    min-height: var(--gt-touch);
    display: inline-flex;
    align-items: center;
  }
}

/* --- Respeto a reduced-motion -------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  body[data-game="blackops1"] *,
  body[data-game="blackops2"] * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* --- Filtro de MODO (2v2/3v3/4v4) y tabs activos: usar el acento del juego --- */
body[data-game="blackops1"] .ladder-mode-filter .btn.btn-primary,
body[data-game="blackops2"] .ladder-mode-filter .btn.btn-primary,
body[data-game="blackops1"] .clist-tab.clist-tab--active,
body[data-game="blackops2"] .clist-tab.clist-tab--active {
  background: var(--gt-accent) !important;
  border-color: var(--gt-accent) !important;
  color: var(--gt-on-accent, #06080d) !important;
  box-shadow: 0 0 14px var(--gt-glow) !important;
}

/* --- Pulido: neutralizar acentos rojos/azules de ladder.css en podio/hero --- */
body[data-game="blackops1"] .mx-page-hero,
body[data-game="blackops2"] .mx-page-hero {
  border-bottom: 1px solid var(--gt-border) !important;
  box-shadow: none !important;
}
body[data-game="blackops1"] .podium-place,
body[data-game="blackops2"] .podium-place,
body[data-game="blackops1"] .podium-place.place-1,
body[data-game="blackops2"] .podium-place.place-1,
body[data-game="blackops1"] .podium-place.place-2,
body[data-game="blackops2"] .podium-place.place-2,
body[data-game="blackops1"] .podium-place.place-3,
body[data-game="blackops2"] .podium-place.place-3 {
  border-color: var(--gt-border) !important;
}
body[data-game="blackops1"] .podium-avatar-placeholder,
body[data-game="blackops1"] .podium-avatar-placeholder i,
body[data-game="blackops2"] .podium-avatar-placeholder,
body[data-game="blackops2"] .podium-avatar-placeholder i {
  color: var(--gt-accent) !important;
  border-color: var(--gt-border) !important;
}
body[data-game="blackops1"] .rank-medal,
body[data-game="blackops2"] .rank-medal {
  background: var(--gt-accent) !important;
  color: var(--gt-on-accent) !important;
}
body[data-game="blackops1"] .podium-mode-badge,
body[data-game="blackops2"] .podium-mode-badge {
  border: 1px solid var(--gt-border) !important;
  color: var(--gt-text) !important;
  background: var(--gt-surface) !important;
}

/* ============================================================================
   ARREGLO MOBILE-FIRST (overflow horizontal) — scoped a BO1/BO2, BO7 intacto
   ========================================================================== */

/* Barra roja superior de las cards (combat .card::before) -> acento del juego.
   (todos los tamanos; el rojo de BO7 no debe filtrarse en BO1/BO2) */
body[data-game="blackops1"] .card::before,
body[data-game="blackops2"] .card::before {
  background: linear-gradient(90deg, var(--gt-accent) 0%, var(--gt-accent) 35%, transparent 35%, transparent 100%) !important;
}

@media (max-width: 767.98px) {
  /* Salvaguardas anti-desbordamiento */
  body[data-game="blackops1"],
  body[data-game="blackops2"] {
    overflow-x: hidden;
  }
  body[data-game="blackops1"] *,
  body[data-game="blackops2"] * {
    box-sizing: border-box;
  }
  body[data-game="blackops1"] main,
  body[data-game="blackops2"] main,
  body[data-game="blackops1"] .bhome-hero,
  body[data-game="blackops2"] .bhome-hero,
  body[data-game="blackops1"] .bhome-hero-inner,
  body[data-game="blackops2"] .bhome-hero-inner,
  body[data-game="blackops1"] .container,
  body[data-game="blackops2"] .container {
    max-width: 100% !important;
    overflow-x: hidden;
  }

  /* Neutralizar skew/clip-path angular de botones y pills en movil */
  body[data-game="blackops1"] .btn,
  body[data-game="blackops2"] .btn,
  body[data-game="blackops1"] .clist-tab,
  body[data-game="blackops2"] .clist-tab,
  body[data-game="blackops1"] .bhome-game-filter .btn,
  body[data-game="blackops2"] .bhome-game-filter .btn,
  body[data-game="blackops1"] .ladder-game-filter .btn,
  body[data-game="blackops2"] .ladder-game-filter .btn,
  body[data-game="blackops1"] .ladder-mode-filter .btn,
  body[data-game="blackops2"] .ladder-mode-filter .btn {
    clip-path: none !important;
    max-width: 100%;
  }

  /* Subtitulo del hero: que envuelva, no se corte */
  body[data-game="blackops1"] .bhome-hero-subtitle,
  body[data-game="blackops2"] .bhome-hero-subtitle {
    max-width: 100% !important;
    overflow-wrap: anywhere;
  }

  /* CTAs del hero: APILAR en vertical a ancho completo */
  body[data-game="blackops1"] .bhome-hero-ctas,
  body[data-game="blackops2"] .bhome-hero-ctas,
  body[data-game="blackops1"] .challs-hero-actions,
  body[data-game="blackops2"] .challs-hero-actions {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100%;
  }
  body[data-game="blackops1"] .bhome-hero-ctas .btn,
  body[data-game="blackops2"] .bhome-hero-ctas .btn,
  body[data-game="blackops1"] .challs-hero-actions .btn,
  body[data-game="blackops2"] .challs-hero-actions .btn {
    width: 100% !important;
    justify-content: center;
  }

  /* Metrics strip: rejilla 2x2 a ancho completo, sin separadores que desbordan */
  body[data-game="blackops1"] .bhome-hero-metrics,
  body[data-game="blackops2"] .bhome-hero-metrics {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    width: 100% !important;
    gap: 0.5rem 0.25rem;
    padding: 0.9rem 0.75rem !important;
    background: var(--gt-surface) !important;
    border-color: var(--gt-border) !important;
  }
  body[data-game="blackops1"] .bhome-metric,
  body[data-game="blackops2"] .bhome-metric {
    padding: 0.4rem 0.25rem !important;
  }
  body[data-game="blackops1"] .bhome-metric-sep,
  body[data-game="blackops2"] .bhome-metric-sep {
    display: none !important;
  }

  /* Podio en movil: aplanar los "escalones" y ajustar el numero gigante */
  body[data-game="blackops1"] .podium-place,
  body[data-game="blackops2"] .podium-place {
    clip-path: none !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    text-align: left;
    padding: 0.75rem 0.9rem;
  }
  body[data-game="blackops1"] .podium-place .podium-base,
  body[data-game="blackops2"] .podium-place .podium-base,
  body[data-game="blackops1"] .podium-place.place-1 .podium-base,
  body[data-game="blackops2"] .podium-place.place-1 .podium-base,
  body[data-game="blackops1"] .podium-place.place-2 .podium-base,
  body[data-game="blackops2"] .podium-place.place-2 .podium-base,
  body[data-game="blackops1"] .podium-place.place-3 .podium-base,
  body[data-game="blackops2"] .podium-place.place-3 .podium-base {
    height: auto !important;
    width: auto;
    margin-left: auto;
    background: transparent !important;
    border: 0 !important;
  }
  body[data-game="blackops1"] .podium-rank,
  body[data-game="blackops2"] .podium-rank {
    font-size: 1.6rem !important;
    opacity: 0.55;
  }
  body[data-game="blackops1"] .podium-avatar,
  body[data-game="blackops2"] .podium-avatar,
  body[data-game="blackops1"] .podium-avatar-placeholder,
  body[data-game="blackops2"] .podium-avatar-placeholder {
    width: 56px !important;
    height: 56px !important;
  }
  body[data-game="blackops1"] .podium-stats,
  body[data-game="blackops2"] .podium-stats {
    flex: 1 1 auto;
  }
}

/* Fix fino metrics: los items de grid/flex deben poder encoger (min-width:0)
   y los labels (Space Mono, anchos) deben envolver y no cortarse. */
@media (max-width: 767.98px) {
  body[data-game="blackops1"] .bhome-metric,
  body[data-game="blackops2"] .bhome-metric {
    min-width: 0;
    text-align: center;
  }
  body[data-game="blackops1"] .bhome-metric-lbl,
  body[data-game="blackops2"] .bhome-metric-lbl {
    font-size: 0.58rem !important;
    letter-spacing: 0.04em !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    line-height: 1.2;
  }
  body[data-game="blackops1"] .bhome-metric-val,
  body[data-game="blackops2"] .bhome-metric-val {
    font-size: 1.6rem !important;
  }
  /* Salvaguarda general: cualquier hijo de flex/grid puede encoger */
  body[data-game="blackops1"] .bhome-hero-metrics > *,
  body[data-game="blackops2"] .bhome-hero-metrics > *,
  body[data-game="blackops1"] .bhome-hero-ctas > *,
  body[data-game="blackops2"] .bhome-hero-ctas > * {
    min-width: 0;
  }
}

/* CAUSA RAIZ del overflow del hub: .bhome-hero-bg tiene overflow:visible y
   aloja glows decorativos de hasta 500px (left:0) que ensanchan la pagina.
   Se clipan dentro del hero (=ancho viewport). Aplica a todos los tamanos. */
body[data-game="blackops1"] .bhome-hero,
body[data-game="blackops2"] .bhome-hero,
body[data-game="blackops1"] .bhome-hero-bg,
body[data-game="blackops2"] .bhome-hero-bg {
  overflow: hidden !important;
}
body[data-game="blackops1"] .bhome-hero-glow,
body[data-game="blackops2"] .bhome-hero-glow {
  max-width: 100%;
}
