/* PZ_MOBILE_LAUNCH_FIXES_V1
   Correcciones críticas detectadas por la auditoría móvil del 28/07/2026.
   Se carga después de app.css y solo altera el comportamiento responsive.
*/

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

img,
video,
iframe,
embed,
object {
  max-width: 100%;
}

.menu-toggle,
.hero-history-arrow,
.footer-social-links a,
button.btn,
a.button {
  min-height: 44px;
}

.footer-social-links a {
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Tablas: mantener la información completa con desplazamiento horizontal controlado. */
.standings-scroll,
.presidents-table-wrap-v140,
.player-season-table-v123 {
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.standings-scroll > table,
.presidents-table-wrap-v140 > table,
.player-season-table-v123 > table {
  max-width: none !important;
}

/* Exzaragocistas: contenedor estable para evitar saltos entre publicaciones. */
.home-ex-stage-v200 {
  height: 720px !important;
  min-height: 720px !important;
  max-height: 720px !important;
  overflow: hidden !important;
}

.home-ex-stage-v200 > .home-ex-card-v201,
.home-ex-card-v201 {
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow: hidden !important;
}

.home-ex-card-v201 iframe,
.home-ex-card-v201 blockquote,
.home-ex-card-v201 .instagram-media {
  max-height: 610px !important;
  overflow: hidden !important;
}

.pz-ex-error-hidden {
  display: none !important;
}

/* Evita que el enlace de X se parta letra a letra. */
.home-social-grid-v200 .home-social-x-v200 > header > a,
.home-social-grid-v142 .social-feed-card-v142 > header > a {
  width: auto !important;
  min-width: max-content !important;
  max-width: 100% !important;
  white-space: nowrap !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
}

/* Tarjetas fotográficas y salas: el contenido no debe quedar recortado. */
.grada-photo-card-v163,
.legacy-room-card-v163 {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

.grada-photo-card-v163 img,
.legacy-room-card-v163 img {
  max-width: 100% !important;
}

/* Fichas de jugador. */
.player-unified-photo-v155 {
  overflow: visible !important;
}

.museum-local-nav-v16,
.decade-nav-v131 > .content-shell {
  overflow-x: auto !important;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap !important;
}

.museum-local-nav-v16 > a,
.decade-nav-v131 > .content-shell > a {
  flex: 0 0 auto !important;
}

/* Liga Fantástica: reglas seguras también fuera de las páginas estáticas. */
body .site {
  max-width: 100%;
  overflow-x: hidden;
}

body .site > .header,
.layout .hero {
  max-width: 100%;
}

@media (max-width: 760px) {
  body {
    min-width: 0 !important;
  }

  .content-shell,
  .dashboard,
  .middle-grid,
  .home-social-viewer-v142,
  .home-social-viewer-v200,
  .home-community-window,
  .home-museum-door-v16,
  .home-lfpz-callout,
  .universe {
    width: min(100% - 24px, 100%) !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* Portada: carrusel principal sin desbordamiento lateral. */
  .hero-home.hero-history-rotator {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .hero-home.hero-history-rotator .hero-copy {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    order: 1;
    padding: 28px 20px 20px !important;
    box-sizing: border-box;
  }

  .hero-home.hero-history-rotator .hero-copy h1 {
    font-size: clamp(2rem, 11vw, 3.2rem) !important;
    line-height: 0.98 !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
  }

  .hero-home.hero-history-rotator .hero-collage {
    position: relative !important;
    inset: auto !important;
    transform: none !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 250px !important;
    order: 2;
    display: block !important;
    overflow: hidden !important;
  }

  .hero-home.hero-history-rotator .hero-collage .hero-photo {
    display: none !important;
  }

  .hero-home.hero-history-rotator .hero-collage .photo-one {
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 250px !important;
    transform: none !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  .hero-home.hero-history-rotator .hero-collage .photo-one img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
  }

  .hero-home.hero-history-rotator .year-card {
    position: absolute !important;
    right: 12px !important;
    bottom: 18px !important;
    left: auto !important;
    z-index: 5;
    transform: scale(.82);
    transform-origin: right bottom;
  }

  .hero-history-controls {
    gap: 8px !important;
  }

  .hero-history-arrow {
    width: 44px !important;
    height: 44px !important;
  }

  .hero-history-dot {
    min-width: 18px !important;
    min-height: 18px !important;
  }

  /* Portada: bloque Zarapasionpedia. */
  .middle-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  .middle-grid .zpp-mini {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    box-sizing: border-box;
  }

  .zpp-brand-home {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    text-align: center !important;
  }

  .zpp-brand-home > img {
    width: min(150px, 48vw) !important;
    height: auto !important;
    flex: none !important;
  }

  .zpp-brand-home .zpp-title {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    text-align: center !important;
  }

  .zpp-brand-home .zpp-title strong,
  .zpp-brand-home .zpp-title span {
    display: block !important;
    position: static !important;
    width: auto !important;
    max-width: 100% !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }

  .zpp-brand-home .zpp-title strong {
    font-size: clamp(1.7rem, 8vw, 2.5rem) !important;
    line-height: 1 !important;
  }

  .zpp-mini .stat-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    width: 100% !important;
  }

  .zpp-mini .stat-row > a {
    min-width: 0 !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }

  /* Página principal de Zarapasionpedia. */
  .archive-stats {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .archive-stats > a,
  .archive-stats > a > span {
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }

  .archive-grid.zpp-grid-v140 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .archive-grid.zpp-grid-v140 > a,
  .archive-grid.zpp-grid-v140 > a > h3,
  .archive-grid.zpp-grid-v140 > a > p {
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }

  /* Redes y cuatro puertas. */
  .home-social-grid-v142,
  .home-social-grid-v200 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  .social-network-grid-v142 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .social-network-grid-v142 > a {
    min-width: 0 !important;
  }

  /* Exzaragocistas: altura fija adaptada al móvil. */
  .home-ex-stage-v200 {
    height: 640px !important;
    min-height: 640px !important;
    max-height: 640px !important;
  }

  .home-ex-card-v201 iframe,
  .home-ex-card-v201 blockquote,
  .home-ex-card-v201 .instagram-media {
    max-height: 530px !important;
  }

  .home-ex-user-v201 strong {
    max-width: 100% !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  /* Calendario: partido siguiente en una sola columna. */
  .calendar-hero,
  #calendar-next-match,
  .calendar-next-card {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .next-match-teams {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    text-align: center !important;
  }

  .next-match-teams .cal-team {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }

  /* Clasificación, presidentes y estadísticas de jugadores. */
  .standings-scroll,
  .presidents-table-wrap-v140,
  .player-season-table-v123 {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .calendar-standings-table {
    min-width: 560px !important;
  }

  .presidents-table-v140 {
    min-width: 760px !important;
  }

  .player-season-table-v123 table {
    min-width: 610px !important;
  }

  /* Legado y La Grada. */
  .legacy-hub-grid-v112.legacy-grid-v140,
  .grada-photo-grid-v163 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .legacy-room-card-v163,
  .grada-photo-card-v163 {
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .grada-photo-card-v163 img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
  }

  /* Índice de jugadores. */
  .players-featured-v110 .player-grid-rich {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .player-card.clickable-card .player-photo {
    width: 100% !important;
    height: auto !important;
    min-height: 250px !important;
    max-height: none !important;
    aspect-ratio: 3 / 4 !important;
    overflow: hidden !important;
  }

  .player-card.clickable-card .player-photo img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  .player-card.clickable-card footer {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px 10px !important;
  }

  .player-card.clickable-card footer > span {
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }

  /* Fichas de jugadores. */
  .player-unified-grid-v155 {
    grid-template-columns: 1fr !important;
  }

  .player-unified-photo-v155 {
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .player-unified-photo-v155 img {
    width: 100% !important;
    height: auto !important;
    max-height: 480px !important;
    object-fit: contain !important;
  }

  .museum-local-nav-v16 {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-bottom: 6px;
  }

  /* Navegación de temporadas. */
  .decade-nav-v131 > .content-shell {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-bottom: 6px;
  }

  /* Liga Fantástica. */
  body .site > .header {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    box-sizing: border-box;
  }

  body .site > .nav {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  body .site > .nav > button,
  #loginButton,
  #registerButton,
  .layout .btn {
    min-height: 44px !important;
  }

  .layout .hero {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    box-sizing: border-box;
  }
}

@media (max-width: 420px) {
  .players-featured-v110 .player-grid-rich,
  .archive-stats,
  .social-network-grid-v142,
  .zpp-mini .stat-row {
    grid-template-columns: 1fr !important;
  }

  .home-ex-stage-v200 {
    height: 610px !important;
    min-height: 610px !important;
    max-height: 610px !important;
  }
}

/* PZ_ZARAPASIONPEDIA_MOBILE_V11
   Corrige la colocación heredada de escritorio de las tarjetas 01-04.
*/
@media (max-width: 760px) {
  body main > section.content-shell > div.archive-grid.zpp-grid-v140 {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    grid-template-columns: none !important;
    grid-auto-columns: auto !important;
    grid-auto-flow: row !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 16px !important;
    overflow: visible !important;
  }

  body main > section.content-shell > div.archive-grid.zpp-grid-v140 > a {
    display: block !important;
    position: relative !important;
    inset: auto !important;
    float: none !important;
    clear: both !important;
    grid-column: auto !important;
    grid-row: auto !important;
    flex: 0 0 auto !important;
    align-self: stretch !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 250px !important;
    margin: 0 !important;
    padding: 28px 28px 30px !important;
    transform: none !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  body main > section.content-shell > div.archive-grid.zpp-grid-v140 > a > * {
    position: static !important;
    inset: auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    transform: none !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
  }

  body main > section.content-shell > div.archive-grid.zpp-grid-v140 > a > span {
    display: block !important;
    margin-bottom: 42px !important;
  }

  body main > section.content-shell > div.archive-grid.zpp-grid-v140 > a > h3 {
    font-size: clamp(2rem, 9vw, 3rem) !important;
    line-height: 1.05 !important;
    margin-top: 0 !important;
    margin-bottom: 18px !important;
  }

  body main > section.content-shell > div.archive-grid.zpp-grid-v140 > a > p {
    font-size: clamp(1.15rem, 5.4vw, 1.55rem) !important;
    line-height: 1.45 !important;
    margin-bottom: 0 !important;
  }
}

/* PZ_MOBILE_LAUNCH_FINAL_V12
   Remate móvil previo al lanzamiento del 31/07/2026.
   Corrige únicamente desbordamientos y recortes confirmados.
*/

@media (max-width: 760px) {
  /* Portada: la tarjeta de X debe poder encogerse dentro del viewport. */
  .home-social-viewer-v142,
  .home-social-viewer-v200,
  .home-social-grid-v142,
  .home-social-grid-v200,
  .home-social-grid-v142 > *,
  .home-social-grid-v200 > *,
  .home-social-x-v200,
  .home-social-x-v200 > header,
  .home-social-x-v200 .social-feed-brand-v142 {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .home-social-grid-v200,
  .home-social-grid-v142 {
    width: 100% !important;
  }

  .home-social-x-v200 > header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 10px !important;
  }

  .home-social-x-v200 > header > a {
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    justify-self: end !important;
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }

  /* Carrusel: elimina el pequeño recorte residual de la primera foto. */
  .hero-home.hero-history-rotator
    .hero-collage
    .hero-photo.photo-one {
    padding: 0 !important;
    border: 0 !important;
    clip-path: none !important;
    line-height: 0 !important;
    box-sizing: border-box !important;
  }

  .hero-home.hero-history-rotator
    .hero-collage
    .hero-photo.photo-one
    img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    transform: none !important;
  }

  /*
   * Calendario, Legado y Liga Fantástica:
   * sus adornos se diseñaron para quedar contenidos. El parche v1.0 dejó
   * visible ese excedente y provocó los tres desbordamientos de página.
   */
  .calendar-next-card,
  #calendar-next-match.calendar-next-card {
    overflow: hidden !important;
  }

  .calendar-shell-v137,
  .calendar-full-list,
  .calendar-month,
  .calendar-month-games,
  .calendar-match,
  .calendar-match > *,
  .cal-versus,
  .cal-team {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .legacy-hub-grid-v112.legacy-grid-v140,
  .legacy-hub-grid-v112.legacy-grid-v140 > * {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .legacy-room-card-v163 {
    overflow: hidden !important;
  }

  body > .site {
    width: 100% !important;
    max-width: 100% !important;
  }

  body > .site > .header {
    overflow: hidden !important;
  }

  /* Índice de jugadores: neutraliza el zoom de escritorio de las fotos. */
  .players-featured-v110
    .player-grid-rich
    .player-card
    .player-photo
    img,
  .players-featured-v110
    .player-grid-rich
    .player-feature-card-v110
    .player-photo
    img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    transform: none !important;
  }

  /* Fichas: altura natural para no perder los últimos píxeles del retrato. */
  .player-unified-photo-v155 {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .player-unified-photo-v155 img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    transform: none !important;
  }
}

/* PZ_LAUNCH_VISIBLE_FIXES_V13
   Correcciones visibles previas al lanzamiento del 31/07/2026.
*/

/*
 * Portada de escritorio: el visor de Exzaragocistas no debe imponer
 * una altura excesiva a las tres columnas de redes.
 * Las alturas móviles de v1.0 permanecen intactas.
 */
@media (min-width: 761px) {
  .home-ex-stage-v200 {
    height: 520px !important;
    min-height: 520px !important;
    max-height: 520px !important;
  }

  .home-ex-card-v201 iframe,
  .home-ex-card-v201 blockquote,
  .home-ex-card-v201 .instagram-media {
    max-height: 430px !important;
  }
}

/* PZ_SOCIAL_BALANCE_V131
   Equilibrio final de las tres tarjetas de redes en escritorio.
*/

@media (min-width: 901px) {
  /*
   * X: el visor compacto anterior conservaba 330 px y dejaba media
   * tarjeta vacía. La nueva altura aprovecha el espacio disponible.
   */
  .home-social-grid-v200
    .home-social-x-v200
    .x-live-compact-v142,
  .home-social-grid-v200
    .social-feed-card-v142
    .x-live-compact-v142 {
    height: 540px !important;
    min-height: 540px !important;
    max-height: 540px !important;
  }

  .home-social-grid-v200
    .home-social-x-v200
    .x-live-compact-v142
    iframe,
  .home-social-grid-v200
    .home-social-x-v200
    .x-live-compact-v142
    .twitter-timeline-rendered,
  .home-social-grid-v200
    .social-feed-card-v142
    .x-live-compact-v142
    iframe,
  .home-social-grid-v200
    .social-feed-card-v142
    .x-live-compact-v142
    .twitter-timeline-rendered {
    height: 540px !important;
    min-height: 540px !important;
    max-height: 540px !important;
  }

  /*
   * Cuatro puertas: tarjetas algo más altas y con una respiración
   * uniforme, manteniendo el bloque alineado con la parte inferior.
   */
  .home-social-grid-v200 .social-networks-v142 {
    display: flex !important;
    flex-direction: column !important;
  }

  .home-social-grid-v200 .social-network-grid-v142 {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    margin-top: auto !important;
  }

  .home-social-grid-v200 .social-network-grid-v142 > a {
    min-height: 88px !important;
    padding: 16px !important;
  }
}
