/* ==========================================================================
   ESTILOS RETRO ARCADE PARA MÓVIL Y DISPOSITIVOS TÁCTILES
   expoaprendizaje - Solo media queries y componentes táctiles nuevos.
   No modifica los estilos base existentes de la versión aprobada.
   ========================================================================== */

/* ==========================================================================
   1. MARCADORES DE PUNTAJE (CENTRADO SUPERIOR Y TAMAÑO MEJORADO)
   ========================================================================== */
.game-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: clamp(0.72rem, 1.8vw, 1rem);
}

/* En juegos de 1 jugador con récord: apilar el récord debajo del puntaje */
.game-stats.stat-stacked {
  flex-direction: column;
  gap: 3px;
}

.game-stats.stat-stacked .record-row {
  font-size: 0.82em;
  opacity: 0.95;
}

/* ==========================================================================
   2. REGLAS GLOBALES PARA PANTALLAS COMPACTAS Y DISPOSITIVOS TÁCTILES
   ========================================================================== */
@media (max-width: 900px), (pointer: coarse) {
  html, body {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Bloqueo estricto de scroll ÚNICAMENTE durante la partida en arena de juego */
  html:has(.game-container),
  body:has(.game-container),
  html:has(.split-vertical-container),
  body:has(.split-vertical-container) {
    height: 100% !important;
    height: 100dvh !important;
    overflow: hidden !important;
    overscroll-behavior: none !important;
  }

  *, *::before, *::after {
    box-sizing: border-box !important;
  }

  /* Ajuste de contenedor de juego sin scroll */
  .game-container {
    width: 100% !important;
    max-width: 100vw !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding: max(4px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)) !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  /* Barra de control superior en celular: botón MENÚ y marcadores nunca se solapan */
  .game-top-bar {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px 10px !important;
    margin-bottom: 4px !important;
    padding: 6px 10px !important;
    box-sizing: border-box !important;
    min-height: auto !important;
    position: static !important;
  }

  .game-top-bar #btn-back-menu {
    position: static !important;
    transform: none !important;
    font-size: clamp(0.55rem, 2vw, 0.65rem) !important;
    padding: 6px 10px !important;
    flex-shrink: 0 !important;
  }

  .game-stats {
    flex: 1 1 auto !important;
    justify-content: flex-end !important;
    flex-wrap: wrap !important;
    gap: 8px 12px !important;
    font-size: clamp(0.6rem, 2.7vw, 0.85rem) !important;
  }

  .arcade-screen {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    max-height: calc(100dvh - 64px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 6px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  /* Adaptación de la cuadrícula de juegos en el menú principal */
  .selection-container {
    padding: 12px 14px 40px 14px;
    gap: 16px;
  }

  .games-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
    gap: 14px !important;
  }

  /* Área táctil de canastas, pistas y lienzos */
  canvas {
    touch-action: none;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }
}

/* Teléfonos en modo vertical estricto */
@media (max-width: 580px) and (orientation: portrait) {
  .games-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .hero-title {
    font-size: clamp(1.6rem, 7vw, 2.4rem) !important;
  }

  .hero-content {
    gap: 16px !important;
    padding: 14px !important;
  }
}

/* ==========================================================================
   3. AVISO RETRO "GIRA EL CELULAR" (Puro Neón Arcade, Sin Emojis)
   ========================================================================== */
.arcade-rotate-prompt {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  background: rgba(4, 3, 14, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.arcade-rotate-prompt.activo {
  display: flex !important;
}

.rotate-card {
  background: var(--bg-cabinet, #0d0b21);
  border: 4px solid var(--neon-magenta, #ff007f);
  box-shadow: 0 0 35px var(--neon-magenta-glow, rgba(255, 0, 127, 0.55));
  border-radius: 6px;
  padding: 28px 20px;
  text-align: center;
  max-width: 440px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.rotate-icon-wrap {
  animation: rotateGlowPulse 1.8s infinite ease-in-out;
}

@keyframes rotateGlowPulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.08) rotate(15deg); }
}

.rotate-title {
  font-family: var(--font-pixel, monospace);
  font-size: clamp(1.1rem, 4vw, 1.6rem);
  color: var(--neon-yellow, #ffe600);
  text-shadow: 0 0 15px var(--neon-yellow-glow, rgba(255, 230, 0, 0.55));
  margin: 0;
}

.rotate-sub {
  font-family: var(--font-pixel, monospace);
  font-size: clamp(0.6rem, 2.2vw, 0.76rem);
  color: var(--neon-cyan, #00f0ff);
  line-height: 1.7;
  margin: 0;
}

/* ==========================================================================
   4. CONTROLES TÁCTILES ARCADE: JOYSTICKS Y BOTONES VIRTUALES
   ========================================================================== */
.arcade-touch-layer {
  display: none !important;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
}

@media (hover: none) and (pointer: coarse) {
  .arcade-touch-layer {
    display: flex !important;
  }
}

/* Joypad base circular */
.arcade-joystick-wrap {
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(13, 11, 33, 0.55);
  border: 3px solid #00f0ff;
  touch-action: none;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}

/* Palanca interior (Knob) */
.arcade-joystick-knob {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #00f0ff;
  border: 2px solid #fff;
  pointer-events: none;
  transform: translate(0px, 0px);
  transition: transform 0.05s ease-out;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.8);
}

/* Botón táctil arcade */
.arcade-touch-btn {
  pointer-events: auto;
  min-width: 58px;
  min-height: 58px;
  border-radius: 50%;
  background: rgba(13, 11, 33, 0.65);
  border: 3px solid #00f0ff;
  color: #00f0ff;
  font-family: var(--font-pixel, monospace);
  font-size: 0.62rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.08s, background-color 0.08s;
}

.arcade-touch-btn.activo,
.arcade-touch-btn:active {
  transform: scale(0.92);
  background: rgba(0, 240, 255, 0.35);
}

/* Controles flotantes en juegos de 2 jugadores en pantalla horizontal */
.dual-touch-overlay {
  position: absolute;
  bottom: 12px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 16px;
  pointer-events: none;
  box-sizing: border-box;
}

.dual-touch-overlay .side-p1,
.dual-touch-overlay .side-p2 {
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: none;
}

/* ==========================================================================
   5. ADAPTACIÓN PARA JUEGOS FRENTE A FRENTE (AUTOS Y CLICS 1 VS 1)
   Pantalla dividida en vertical: Jugador 1 arriba (rotado 180°), Jugador 2 abajo
   ========================================================================== */
@media (orientation: portrait), (max-width: 768px) {
  /* Contenedor dividido en 2 mitades simétricas */
  .split-vertical-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
  }

  /* Mitad del jugador superior (rotada 180 grados para jugar frente a frente en la mesa) */
  .player-half-top {
    flex: 1;
    width: 100%;
    height: 50%;
    transform: rotate(180deg);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-bottom: 3px solid var(--neon-cyan, #00f0ff);
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.3);
  }

  /* Mitad del jugador inferior (orientación normal) */
  .player-half-bottom {
    flex: 1;
    width: 100%;
    height: 50%;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-top: 3px solid var(--neon-magenta, #ff007f);
    box-shadow: 0 -4px 15px rgba(255, 0, 127, 0.3);
  }

  /* Franja central de marcador entre ambas mitades */
  .center-split-divider {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    background: #09081a;
    border: 2px solid var(--neon-yellow, #ffe600);
    box-shadow: 0 0 15px var(--neon-yellow-glow, rgba(255, 230, 0, 0.55));
    border-radius: 4px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: calc(100% - 24px);
    max-width: 500px;
    box-sizing: border-box;
    pointer-events: auto;
  }

  .split-scores-group {
    display: flex;
    align-items: center;
    gap: 14px;
  }

  .split-hud-score {
    font-family: var(--font-pixel, monospace);
    font-size: clamp(0.55rem, 2.2vw, 0.72rem);
    line-height: 1.3;
    white-space: nowrap;
  }

  .j1-hud {
    color: var(--neon-cyan, #00f0ff);
    transform: rotate(180deg);
    text-align: right;
  }

  .j2-hud {
    color: var(--neon-magenta, #ff007f);
    text-align: left;
  }

  /* Botones grandes de cambio de carril en Autos */
  .autos-touch-controls {
    position: absolute;
    bottom: 8px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 14px;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 25;
  }

  .btn-carril-touch {
    pointer-events: auto;
    width: 68px;
    height: 68px;
    border-radius: 8px;
    background: rgba(13, 11, 33, 0.75);
    border: 3px solid currentColor;
    font-family: var(--font-pixel, monospace);
    font-size: 1.3rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
  }
}

/* ==========================================================================
   6. OPTIMIZACIÓN DE TABLEROS (PUZZLE Y MEMORIA)
   Uso óptimo de espacio sin desbordarse de la pantalla
   ========================================================================== */
@media (max-width: 600px) {
  .memory-grid {
    width: min(92vw, calc(100dvh - 160px)) !important;
    height: min(92vw, calc(100dvh - 160px)) !important;
    gap: 6px !important;
  }

  .puzzle-board {
    width: min(88vw, calc(100dvh - 170px)) !important;
    height: min(88vw, calc(100dvh - 170px)) !important;
    gap: 4px !important;
  }
}

/* ==========================================================================
   7. CRUCETA (D-PAD) Y CONTROLES TÁCTILES: VISIBLES SOLO EN DISPOSITIVOS TÁCTILES
   En computador se ocultan por defecto (display: none !important) para usar solo teclado.
   ========================================================================== */
.d-pad-container,
.mobile-jump-zone,
.autos-touch-controls,
.btn-carril-touch,
.arcade-joystick-wrap,
.arcade-touch-btn {
  display: none !important;
}

/* Mostrar controles táctiles SOLO en dispositivos que sean táctiles reales */
@media (hover: none) and (pointer: coarse) {
  .d-pad-container {
    display: grid !important;
  }
  .mobile-jump-zone {
    display: block !important;
  }
  .autos-touch-controls {
    display: flex !important;
  }
  .btn-carril-touch {
    display: flex !important;
  }
  .arcade-joystick-wrap {
    display: flex !important;
  }
  .arcade-touch-btn {
    display: inline-flex !important;
  }
}

/* ==========================================================================
   8. AJUSTES RESPONSIVOS DE CANVAS PARA JUEGOS DE 1 JUGADOR
   Adaptar las áreas de canvas para que no se desborden en móvil
   ========================================================================== */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  /* Snake: el canvas cuadrado debe caber con la cruceta debajo */
  .snake-canvas-wrap {
    width: min(100%, calc(100dvh - 240px)) !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Atrapa: canvas que quepa sin cortes */
  .atrapa-canvas-wrap {
    width: min(100%, 680px) !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 130px) !important;
    margin: 4px auto !important;
    box-sizing: border-box !important;
  }

  /* Esquiva: runner ancho 16:9 */
  .runner-canvas-wrap {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 130px) !important;
    box-sizing: border-box !important;
  }

  /* Laberinto: con cruceta debajo */
  .maze-canvas-wrap {
    width: min(100%, calc(100dvh - 240px)) !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 240px) !important;
    box-sizing: border-box !important;
  }

  /* Ocultar indicadores de teclas (se usan controles táctiles) */
  .key-indicator-bar {
    display: none !important;
  }
}

/* En celular vertical para Atrapa: ocupar todo el espacio disponible del marco sin barras negras */
@media (hover: none) and (pointer: coarse) and (orientation: portrait), (max-width: 600px) and (orientation: portrait) {
  .atrapa-canvas-wrap {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: unset !important;
    aspect-ratio: unset !important;
    flex: 1 1 auto !important;
    margin: 0 !important;
  }
}

/* En móvil vertical, d-pad más grande para mejor usabilidad táctil */
@media (hover: none) and (pointer: coarse) and (max-width: 580px) {
  .d-pad-container {
    grid-template-columns: repeat(3, 62px) !important;
    grid-template-rows: repeat(3, 56px) !important;
    gap: 5px !important;
    margin: 6px auto !important;
  }

  .d-btn {
    font-size: 1.3rem !important;
    min-height: 48px !important;
  }
}

/* ==========================================================================
   9. ESQUIVA: ZONA TÁCTIL GRANDE PARA SALTAR
   El jugador puede tocar CUALQUIER parte de la pantalla para saltar.
   El botón se muestra solo en dispositivos táctiles.
   ========================================================================== */
.mobile-jump-zone {
  display: none !important;
}

@media (hover: none) and (pointer: coarse) {
  .mobile-jump-zone {
    display: block !important;
  }
}

/* ==========================================================================
   10. CARRERA DE CLICS: ADAPTACIÓN MÓVIL FRENTE A FRENTE (2 JUGADORES)
   En celular vertical: J1 arriba (rotado 180°), J2 abajo (normal).
   Textos, botones y contadores orientados hacia cada jugador.
   ========================================================================== */
@media (orientation: portrait) and (max-width: 900px), (max-width: 768px), (pointer: coarse) and (orientation: portrait) {
  /* Arena dividida verticalmente, ya está en el CSS del juego */

  /* Jugador 1 (arriba, rotado 180° para leer frente a frente en la mesa) */
  .player-zone.player-1 {
    transform: rotate(180deg);
  }

  /* Ocultar la tecla de teclado en celular, mostrar instrucciones de toque */
  .key-badge {
    display: none !important;
  }

  /* Botones de clic más grandes en celular */
  .click-button {
    width: 90vw !important;
    height: min(22vh, 130px) !important;
    font-size: clamp(1rem, 3vw, 1.5rem) !important;
  }

  /* Marcador de victorias orientado al centro para ambos jugadores */
  .victories-banner {
    font-size: clamp(0.55rem, 1.6vw, 0.7rem) !important;
    padding: 4px 12px !important;
  }

  /* Barra tira y afloja más fina */
  .tug-of-war-container {
    width: 85% !important;
    height: 12px !important;
  }

  /* Temporizador centrado entre las dos mitades */
  .timer-badge {
    top: 50% !important;
    font-size: 0.85rem !important;
  }

  /* Scores más grandes */
  .score-number {
    font-size: clamp(3rem, 12vw, 5.5rem) !important;
    margin-bottom: 6px !important;
  }

  /* Animación de pulsación "+" ajustada para vertical */
  .floating-plus {
    font-size: 1.6rem !important;
  }
}

/* ==========================================================================
   11. MEJORAS DE TABLEROS INTERACTIVOS EN MÓVIL (PUZZLE Y MEMORIA)
   Las piezas y cartas deben tener zonas táctiles de mínimo 48px
   ========================================================================== */
@media (pointer: coarse) {
  .puzzle-tile {
    min-height: 48px !important;
    min-width: 48px !important;
  }

  .memory-card {
    min-height: 48px !important;
    min-width: 48px !important;
  }

  /* Botones de acción del puzzle más accesibles */
  .puzzle-controls .btn-arcade {
    min-height: 48px !important;
    padding: 10px 20px !important;
  }
}

/* ==========================================================================
   12. OVERLAY DE INICIO / GAME-OVER SCROLLABLE EN MÓVIL
   El overlay debe ser accesible siempre, con scroll si el contenido
   excede la pantalla (especialmente en landscape).
   ========================================================================== */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .game-start-overlay,
  .overlay.active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    z-index: 200 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    padding: 16px 12px !important;
    box-sizing: border-box !important;
  }

  .game-start-overlay.oculto {
    display: none !important;
  }

  /* Modales de Game Over / transiciones */
  .arcade-modal,
  .arcade-modal-card,
  .modal-card {
    max-height: 95dvh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
  }

  /* Botón de sonido integrado en la barra superior de juego */
  .game-top-bar #btn-toggle-sonido,
  .game-top-bar .btn-sonido-arcade {
    position: static !important;
    top: auto !important;
    right: auto !important;
    min-width: 44px !important;
    min-height: 44px !important;
    width: 44px !important;
    height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    border-radius: 6px !important;
    z-index: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Ocultar el header .top-controls flotante original en móvil
     (el botón de sonido ya fue reubicado en .game-top-bar por JS) */
  .top-controls {
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

/* ==========================================================================
   13. LANDSCAPE MÓVIL: CANVAS EXPANDIDOS Y UI COMPACTA
   En horizontal (altura baja), eliminar calc(100vh-Xpx) que deja
   el juego en ~60px. El canvas debe llenar todo el espacio disponible.
   ========================================================================== */
@media (max-height: 520px) and (hover: none) and (pointer: coarse),
       (max-height: 520px) and (max-width: 900px) {
  /* Barra superior ultra-compacta */
  .game-top-bar {
    min-height: 32px !important;
    padding: 3px 8px !important;
    margin-bottom: 2px !important;
    gap: 4px 8px !important;
  }

  .game-top-bar #btn-back-menu {
    font-size: 0.5rem !important;
    padding: 4px 8px !important;
  }

  .game-stats {
    font-size: 0.55rem !important;
    gap: 6px 8px !important;
  }

  /* Ocultar indicadores de teclado */
  .key-indicator-bar {
    display: none !important;
  }

  /* Ocultar icono SVG grande del overlay de inicio */
  .start-icon {
    display: none !important;
  }

  /* Texto del overlay más compacto */
  .game-title-big {
    font-size: clamp(0.9rem, 3.5vw, 1.3rem) !important;
    margin: 4px 0 !important;
  }

  .game-instructions {
    font-size: clamp(0.5rem, 1.8vw, 0.65rem) !important;
    margin: 4px 0 !important;
    max-height: 60px !important;
    overflow-y: auto !important;
  }

  /* Botón START sticky al fondo del overlay en landscape */
  .game-start-overlay .btn-arcade,
  .overlay .btn-arcade {
    margin-top: 6px !important;
    position: sticky !important;
    bottom: 8px !important;
    z-index: 10 !important;
  }

  /* TODOS los canvas wraps: expandir al máximo */
  .hockey-canvas-wrap,
  .pong-canvas-wrap,
  .tanks-canvas-wrap,
  .sumo-canvas-wrap,
  .runner-canvas-wrap,
  .atrapa-canvas-wrap {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    flex: 1 1 auto !important;
    margin: 0 !important;
  }

  /* Snake y Laberinto: canvas cuadrado al lado de D-pad */
  .snake-canvas-wrap,
  .maze-canvas-wrap {
    width: auto !important;
    height: 100% !important;
    max-height: 100% !important;
    aspect-ratio: 1 / 1 !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
  }

  /* Puzzle y Memoria: expandir al máximo */
  .puzzle-board {
    width: min(95%, calc(100dvh - 80px)) !important;
    height: auto !important;
    max-height: calc(100dvh - 80px) !important;
  }

  .memory-grid {
    width: min(95%, calc(100dvh - 80px)) !important;
    height: auto !important;
    max-height: calc(100dvh - 80px) !important;
  }

  /* Arcade screen llena toda la pantalla restante */
  .arcade-screen {
    max-height: calc(100dvh - 38px) !important;
    padding: 2px !important;
  }

  /* D-pad compacto al lado del canvas en landscape */
  .d-pad-container {
    grid-template-columns: repeat(3, 46px) !important;
    grid-template-rows: repeat(3, 42px) !important;
    gap: 2px !important;
    margin: 0 4px !important;
  }
}

/* ==========================================================================
   14. LANDSCAPE: SNAKE Y LABERINTO CON D-PAD AL LADO
   ========================================================================== */
@media (max-height: 520px) and (hover: none) and (pointer: coarse) {
  /* En landscape para snake y laberinto: flexbox horizontal canvas+dpad */
  body:has(.snake-canvas-wrap) .arcade-screen,
  body:has(.maze-canvas-wrap) .arcade-screen {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
  }
}

/* ==========================================================================
   15. PORTRAIT MÓVIL: CANVAS EXPANDIDOS SIN CUELLOS DE BOTELLA
   ========================================================================== */
@media (max-width: 900px) and (orientation: portrait), (hover: none) and (pointer: coarse) and (orientation: portrait) {
  .hockey-canvas-wrap,
  .pong-canvas-wrap,
  .tanks-canvas-wrap,
  .sumo-canvas-wrap,
  .runner-canvas-wrap {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 110px) !important;
    flex: 1 1 auto !important;
  }
}
