/**
 * Estilos específicos para el Modo Juego
 * Diseño minimalista y a pantalla completa enfocado al 100% en el juego.
 */

body.game-mode {
  background: #000;
  color: #fff;
  height: 100vh; /* Fallback */
  height: 100dvh;
  min-height: 0 !important; /* Reset inherited min-height: 100vh from styles.css */
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Sin scroll para que sea como una app mobile/fullscreen */
}

/* Ocultar elementos globales por defecto en modo juego */
body.game-mode .header,
body.game-mode .footer {
  display: none !important;
}

/* Top bar con botón de volver y logo centrado */
.game-top-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.4rem 1rem;
  background: #111;
  border-bottom: 1px solid #222;
  z-index: 100;
  width: 100%;
  flex-shrink: 0;
}

.game-back-btn {
  color: #888;
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: color 0.2s;
  justify-self: flex-start;
}

.game-back-btn:hover {
  color: #fff;
}

/* Estilos del Logo Centrado */
.game-logo {
  justify-self: center;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}

.game-logo .logo-text {
  color: #fff;
}

.game-logo .logo-punctuation {
  color: var(--color-game-accent, #38bdf8);
}

.game-logo .logo-sub {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: #888;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.game-back-btn:hover {
  color: #fff;
}

/* Bottom footer / credits bar */
.game-bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 1rem;
  background: #111;
  border-top: 1px solid #222;
  font-size: 0.85rem;
  color: #666;
  font-family: var(--font-body);
  z-index: 100;
  width: 100%;
  flex-shrink: 0;
}

.game-fullscreen-btn {
  background: none;
  border: 1px solid #444;
  color: #ccc;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-size: 0.8rem;
}

.game-fullscreen-btn:hover {
  background: #222;
  color: #fff;
  border-color: #666;
}

.game-credits a {
  color: #888;
  text-decoration: underline;
}
.game-credits a:hover {
  color: #ddd;
}

/* Rediseño del contenedor principal - 100% flex height */
body.game-mode .main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch; /* Asegura que las barras ocupen todo el ancho */
  padding: 0;
  margin: 0;
  width: 100%;
  max-height: 100%; /* No permitir que este contenedor sea más alto que el body */
  overflow: hidden;
}

body.game-mode .game-container {
  flex: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* El juego tomará toda el área */
}

body.game-mode .page-title {
  display: none !important; /* Ocultar títulos, el usuario quiere foco total */
}

/* Iframes - llenar el espacio restante */
body.game-mode .iframe-wrapper {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: none !important;
  aspect-ratio: unset !important;
}

body.game-mode iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Juegos sin iframe (Sudoku, Tetris, Papa's) necesitan centrarse bien */
.game-mode-native-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* Subir un poco para que el dashboard no quede muy abajo */
  width: 100%;
  overflow-y: auto; /* Permitir scroll solo si el contenido nativo es muy grande */
  padding: 1rem;
}

/* Utilidad para permitir scroll en el body si se necesita (ej: dashboard) */
body.game-mode.scrollable {
    overflow-y: auto !important;
}

/* Responsiveness (Mobile-First) */
@media (max-width: 768px) {
  .game-top-bar, 
  .game-bottom-bar {
    padding: 0.3rem 0.8rem;
  }

  .game-logo {
    font-size: 1.1rem;
    gap: 0.2rem;
  }

  .game-logo .logo-sub {
    font-size: 0.7rem;
    font-weight: 300;
    letter-spacing: 0.5px;
  }

  .game-back-btn {
    font-size: 0.8rem;
  }

  .game-mode-native-wrapper {
    padding: 5px;
  }

  .game-fullscreen-btn {
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
  }

  .game-credits {
    font-size: 0.75rem;
    max-width: 60%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
