/* --- CONFIGURACIÓN GENERAL --- */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: sans-serif;
    color: white;
    overflow: hidden; 
    
    /* FONDO GENERAL (Para el menú principal) */
    background-image: url('Assets/fondo2.jpg'); 
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* --- ESTILOS COMUNES --- */
section {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%; 
    width: 100%;
    display: flex;
    flex-direction: column; 
    justify-content: center;
    align-items: center;
}

/* --- CAPA 2: EL MENÚ (BOTONES) --- */
#menu {
    z-index: 1; 
}

/* --- CONTROL DE VISIBILIDAD DE LOS BOTONES --- */
.contenedor-botones {
    display: flex;
    flex-wrap: wrap; 
    justify-content: center;
    gap: 20px; 
    margin-top: 30px;
    opacity: 0; 
    transition: opacity 0.5s ease-in; 
}

.contenedor-botones.visible {
    opacity: 1;
}

/* --- ESTILOS DE LOS BOTONES DEL MENÚ (RECTANGULARES) --- */
.btn-imagen {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: white;
    /* CAMBIO 1: Hacemos el contenedor más ancho */
    width: 220px;            
    margin: 15px;            /* Un poco más de margen para que respiren */
}

.btn-imagen img {
    /* CAMBIO 2: Dimensiones rectangulares */
    width: 100%;             /* Ocupa todo el ancho del contenedor (220px) */
    height: 110px;           /* Altura fija más pequeña para que se vea alargado */
    
    object-fit: cover;       /* IMPORTANTE: Esto evita que la imagen se deforme/estire */
    border-radius: 15px;     /* Mantenemos bordes redondeados */
    border: 3px solid white;
    transition: transform 0.3s, border-color 0.3s; 
    background-color: rgba(0,0,0,0.5); 
    display: block;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3); /* Agregué una sombra suave para dar profundidad */
}

.btn-imagen span {
    margin-top: 10px;
    font-size: 1.1rem;
    text-align: center;
    text-transform: uppercase; /* Opcional: hace que el texto se vea más como etiqueta */
    letter-spacing: 1px;
}

.btn-imagen:hover img {
    transform: scale(1.05);  /* Escalado un poco más sutil al ser rectángulo */
    border-color: #4ade80; 
}

/* --- CAPA 1: INICIO (EL TELÓN / LOGO) --- */
#inicio {
    z-index: 10; 
    background-image: url('Assets/fondo.png'); 
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer; 
    transition: transform 1.5s cubic-bezier(0.77, 0, 0.175, 1);
}

#inicio.subir {
    transform: translateY(-100%); 
}

/* ================================================= */
/* --- ESCENA INTERACTIVA (PÁGINA INICIO.HTML) --- */
/* ================================================= */

/* FONDO LIMPIO (SIN BLUR) PARA LA PÁGINA INTERACTIVA */
#pag1 {
    /* El !important aquí asegura que se use el fondo 3 y no el 2 */
    background-image: url('Assets/fondo3.jpg') !important;
    position: relative;
}

#escena-interactiva {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* --- OBJETOS INTERACTIVOS --- */
.objeto-lab {
    position: absolute; 
    display: block;
    cursor: pointer;
    
    /* CAMBIO: Se retiró el borde rojo de prototipado */
    border: none;
    
    transition: transform 0.2s; 
}

/* IMAGEN GLOW (RESPLANDOR) */
.objeto-lab img {
    width: 100%;
    height: 100%;
    object-fit: contain; 
    opacity: 0; /* INVISIBLE */
    transition: opacity 0.3s ease; 
}

.objeto-lab:hover img {
    opacity: 1; /* VISIBLE AL PASAR EL MOUSE */
}

/* --- POSICIONES RE-CALCULADAS A PORCENTAJES --- */
/* Base de cálculo: 1920px ancho x 1080px alto */

/* 1. MICROSCOPIO 1 */
#btn-microscopio {
    /* Conversión: 172px / 1080px = 15.9% */
    top: 2.8%;      
    /* Conversión: 454px / 1920px = 23.6% */
    left: 5.6%;     
    
    /* Mantenemos tus dimensiones fijas */
    width: 54%;  
    height: 40%; 
}

/* 2. PLACAS DE PETRI */
#btn-placas {
    top: 6.4%;      /* (136/1080) */
    left: 40.8%;     /* (893/1920) */
    width: 38%;
    height: 38%;
}

/* 3. MICROSCOPIO 2 (ELECTRÓNICO) */
#btn-micro2 {
    top: 56.9%;      /* (629/1080) */
    left: 12.5%;     /* (451/1920) */
    width: 52%;
    height: 52%;
}

/* 4. PUERTA */
#btn-puerta {
    top: 16.5%;      /* (221/1080) */
    left: 61.7%;     /* (1549/1920) */
    
    /* NOTA: Como la puerta está muy a la derecha, 
       usamos 'left' en porcentaje para que no se salga de la pantalla */
    width: 55%;
    height: 55%;
}

/* BOTÓN VOLVER */
.boton-volver-flotante {
    position: absolute;
    bottom: 30px;
    left: 30px;
    color: white;
    text-decoration: none;
    font-size: 1.2rem;
    background: rgba(0,0,0,0.5);
    padding: 10px 20px;
    border-radius: 20px;
    border: 1px solid white;
    z-index: 100; /* Asegura que esté encima de todo */
}


/* ================================================= */
/* --- PÁGINA DE CRÉDITOS (FONDO WEBP + PNG 80%) --- */
/* ================================================= */

/* 1. EL FONDO ANIMADO (.WEBP) */
#pag-creditos {
    /* El !important asegura que sobreescriba el fondo2 del body general */
    background-image: url('Assets/fondo3.webp') !important;
    
    /* Aseguramos que cubra toda la pantalla */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    /* Configuración Flexbox para centrar la imagen PNG automáticamente */
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Opcional: Si el video es muy brillante, podemos oscurecerlo un poco
       usando un "inset box-shadow" sobre el body, o simplemente dejarlo así. */
}

/* 2. LA IMAGEN CENTRAL (PNG) */
.imagen-central-80 {
    /* Ocupa el 80% del ancho disponible... */
    max-width: 80%;
    
    /* ...PERO también cuidamos que no se salga de alto (80% del alto de pantalla) */
    max-height: 80vh;
    
    /* Mantiene la proporción perfecta (no se estira) */
    object-fit: contain;
    
    /* Un poco de sombra para que se despegue del fondo animado */
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.5));
    
    /* Animación de entrada suave (reciclamos la que ya creamos antes) */
    animation: aparecerSuave 1s ease-out;
}

/* Reutilizamos la animación de Fade In si no la tenías definida globalmente */
@keyframes aparecerSuave {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Fondo general (mantenemos un oscurecimiento leve para que resalte, pero menos agresivo) */
.overlay-carga {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Oscuro semitransparente */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    font-family: 'TuFuentePixel', sans-serif; /* Asegúrate de usar la misma fuente del menú */
}

.titulo-pixel {
    color: white;
    font-size: 2rem;
    margin-bottom: 40px;
    text-shadow: 2px 2px 0px #4db6ac; /* Sombra acorde al color del tema */
    letter-spacing: 2px;
}

.contenedor-slots {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 400px;
}


/* --- BLOQUE 1: FONDO Y ESTRUCTURA (Faltaba esto) --- */

/* Fondo oscuro semitransparente que cubre toda la pantalla y centra el contenido */
.overlay-carga {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); /* Fondo oscuro */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    font-family: sans-serif; /* Cambia esto por tu fuente pixel si la tienes importada */
}

.titulo-pixel {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 40px;
    text-shadow: 3px 3px 0px #4db6ac; /* Sombra estilo pixel */
    letter-spacing: 4px;
    text-transform: uppercase;
}

.contenedor-slots {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 450px; /* Ancho máximo para que no se estire demasiado */
}

/* --- BLOQUE 2: BOTONES (Lo que ya tenías, corregido) --- */

.slot-partida {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-cargar {
    flex-grow: 1;
    background-color: #4db6ac; /* Tu color verde azulado */
    border: none;
    border-radius: 10px;
    padding: 20px;
    color: white;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.1s, background-color 0.2s;
    box-shadow: 0 5px 0 #398e86; /* Efecto 3D */
}

.btn-cargar:hover {
    background-color: #80cbc4; /* Color corregido (sin la 'k') */
    transform: translateY(-2px);
}

.btn-cargar:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #398e86;
}

.icono-slot {
    font-size: 1.5rem;
}

.info-partida {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.nombre-partida {
    font-size: 1.4rem;
    font-weight: bold;
    text-transform: uppercase;
}

.fecha-partida {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Botón de Borrar */
.btn-borrar {
    background-color: #ff6b6b;
    border: none;
    border-radius: 10px;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 5px 0 #c94f4f;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, background-color 0.2s;
}

.btn-borrar:hover {
    background-color: #ff8585;
    transform: translateY(-2px);
}

.btn-borrar:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #c94f4f;
}

/* Botón Volver */
.btn-regresar {
    margin-top: 30px;
    background: transparent;
    border: 2px solid white;
    color: white;
    padding: 12px 30px;
    border-radius: 30px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    font-size: 1rem;
    align-self: center; /* Centrar el botón */
    transition: all 0.2s;
}

.btn-regresar:hover {
    background: white;
    color: #4db6ac;
}
/* =========================================
   ESTILOS NUEVOS DE GALERÍA (ESTILO MENÚ)
   ========================================= */

/* TÍTULOS */
.titulo-galeria {
    font-family: 'TuFuentePixel', sans-serif; /* Tu tipografía del juego */
    color: white;
    font-size: 3rem;
    text-shadow: 4px 4px 0 #4db6ac; /* Sombra sólida turquesa */
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.subtitulo-galeria {
    color: #b2dfdb;
    font-size: 1.1rem;
    font-family: sans-serif;
    margin-bottom: 40px;
}

/* REJILLA */
.galeria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 25px;
    max-width: 900px;
    margin: 0 auto;
}

/* TARJETA BASE */
.item-galeria {
    position: relative;
    border-radius: 15px; /* Bordes redondeados como el menú */
    overflow: hidden;    /* Recorta la imagen a los bordes */
    aspect-ratio: 1 / 1; /* Cuadrada */
    cursor: pointer;
    border: 4px solid #4db6ac; /* Marco turquesa */
    background: #000;
    box-shadow: 0 6px 0 #398e86; /* Efecto 3D */
    transition: all 0.2s ease;
}

.item-galeria:hover {
    transform: translateY(-4px);
    border-color: #80cbc4; /* Marco brillante */
    box-shadow: 0 8px 0 #398e86;
}

.thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* --- ESTADO BLOQUEADO (NUEVO) --- */
.item-bloqueado {
    cursor: not-allowed;
    border-color: #546e7a; /* Marco gris */
    box-shadow: 0 6px 0 #37474f;
}

.item-bloqueado:hover {
    transform: none; /* No se mueve */
    border-color: #546e7a;
}

/* Efecto visual en la imagen bloqueada */
.item-bloqueado .thumb-img {
    filter: grayscale(100%) blur(4px); /* Blanco y negro + Borroso */
    opacity: 0.6;
}

/* Capa del candado */
.capa-candado {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.4); /* Oscurece un poco */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.icono-candado {
    font-size: 3.5rem;
    filter: drop-shadow(0 0 5px black); /* Sombra para que se vea bien */
}

/* --- MODAL (Pantalla Completa) --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-activa {
    opacity: 1;
    pointer-events: auto;
}

.modal-contenedor-interno {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90%;
}

.modal-imagen {
    max-height: 60vh;
    border: 4px solid white;
    border-radius: 10px;
    box-shadow: 0 0 25px #4db6ac;
}

.modal-texto {
    color: white;
    text-align: center;
    margin-top: 20px;
}

.modal-titulo {
    font-size: 2rem;
    color: #4db6ac;
    text-transform: uppercase;
    text-shadow: 2px 2px 0 black;
}

.btn-cerrar-modal {
    margin-top: 20px;
    background: transparent;
    border: 2px solid #ff6b6b;
    color: #ff6b6b;
    padding: 10px 30px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: 0.2s;
}
.btn-cerrar-modal:hover {
    background: #ff6b6b;
    color: white;
}

/* --- ESTILO BASE DEL BOTÓN DE MÚSICA --- */
#btn-musica-global {
    /* Posicionamiento fijo en la esquina superior derecha */
    position: fixed;
    top: 30px;
    right: 30px;
    
    /* Dimensiones grandes y forma circular */
    width: 70px;
    height: 70px;
    border-radius: 50%;
    
    /* Colores alineados con tu estética de laboratorio */
    background-color: rgba(15, 23, 42, 0.9); /* Azul Slate muy oscuro */
    border: 3px solid #ffffff;
    color: #ffffff;
    
    /* Tipografía y Centrado del Icono */
    font-size: 2.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    
    /* Capas y Sombra */
    z-index: 200; /* Asegura estar por encima de todo */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
    
    /* ESTADO INICIAL: Oculto para no interferir con el logo */
    opacity: 0;
    pointer-events: none;
    
    /* Transiciones suaves para todas las propiedades */
    transition: 
        opacity 0.8s ease-out, 
        transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        border-color 0.3s,
        background-color 0.3s,
        box-shadow 0.3s;
}

/* --- INTERACCIONES (HOVER Y ACTIVE) --- */
#btn-musica-global:hover {
    transform: scale(1.15); /* Crece ligeramente */
    border-color: #4ade80; /* Cambia al verde neón de tus otros botones */
    background-color: rgba(0, 0, 0, 1);
    box-shadow: 0 0 25px rgba(74, 222, 128, 0.4); /* Resplandor neón */
}

#btn-musica-global:active {
    transform: scale(0.9); /* Efecto de pulsación */
}

/* --- LÓGICA DE VISIBILIDAD (TRIGGER) --- */
/* Cuando el telón (#inicio) recibe la clase .subir, 
   el botón de música que es su hermano posterior se vuelve visible */
#inicio.subir ~ #btn-musica-global {
    opacity: 1;
    pointer-events: auto; /* Reactiva los clics cuando es visible */
}

/* Responsividad: Un poco más pequeño en pantallas móviles */
@media (max-width: 600px) {
    #btn-musica-global {
        width: 55px;
        height: 55px;
        font-size: 1.6rem;
        top: 15px;
        right: 15px;
    }
}

/* =========================
   HUD ÚNICO DE ESCALA: REGLA + VALOR (BOTTOM CENTER)
   Reemplaza tu bloque viejo de #hud-escala por este
   ========================= */

#hud-escala{
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 4000;
  pointer-events: none;

  width: min(560px, calc(100vw - 44px));
  padding: 14px 18px 12px;
  border-radius: 22px;

  background: rgba(10, 18, 30, 0.45);
  border: 1px solid rgba(255,255,255,0.22);
  box-shadow:
    0 10px 28px rgba(0,0,0,0.28),
    inset 0 1px 0 rgba(255,255,255,0.12);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  display: grid;
  gap: 10px;
  justify-items: center;

  opacity: 0;
  transform: translateX(-50%) translateY(10px);
}

/* Label superior */
#hud-escala .escala-label{
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  opacity: 0.8;
  margin: 0;
  color: rgba(255,255,255,0.82);
}

/* Contenedor de regla */
#hud-escala .escala-regla{
  position: relative;
  width: 100%;
  height: 22px;
}

/* Línea base */
#hud-escala .escala-regla::after{
  content:"";
  position:absolute;
  left: 4%;
  right: 4%;
  bottom: 7px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255,255,255,0.75);
  box-shadow: 0 0 14px rgba(255,255,255,0.10);
  opacity: 0;
}

/* Capas de ticks */
#hud-escala .ticks{
  position:absolute;
  left: 4%;
  right: 4%;
  bottom: 7px;

  transform-origin: center;
  opacity: 0;
  transform: scaleX(0.65);
  filter: blur(0px);
}

/* Major: pocas largas */
#hud-escala .ticks.major{
  height: 18px;
  bottom: 6px;
  background: repeating-linear-gradient(
    to right,
    rgba(255,255,255,0.92) 0 2px,
    transparent 2px 80px
  );
}

/* Minor: medianas */
#hud-escala .ticks.minor{
  height: 14px;
  bottom: 6px;
  background: repeating-linear-gradient(
    to right,
    rgba(255,255,255,0.58) 0 1px,
    transparent 1px 20px
  );
}

/* Micro: densas */
#hud-escala .ticks.micro{
  height: 10px;
  bottom: 6px;
  background: repeating-linear-gradient(
    to right,
    rgba(255,255,255,0.30) 0 1px,
    transparent 1px 6px
  );
}

/* Valor centrado */
#hud-escala .escala-valor{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: rgba(255,255,255,0.95);

  display: flex;
  gap: 8px;
  align-items: baseline;

  text-shadow: 0 2px 10px rgba(0,0,0,0.35);

  opacity: 0;
  transform: translateY(6px);
}

#hud-escala #escala-num{
  font-size: 28px;
  line-height: 1;
}

#hud-escala #escala-uni{
  font-size: 18px;
  opacity: 0.92;
  color: #fbbf24;
}

/* =========================
   Animación: entrada + densidad de regla
   (se dispara con .anim)
   ========================= */
#hud-escala.anim{
  animation: hudIn 420ms cubic-bezier(.2,.9,.2,1) forwards;
}

#hud-escala.anim .escala-regla::after{
  animation: baseLineIn 420ms ease-out 120ms forwards;
}

/* densidad creciente */
#hud-escala.anim .ticks.major{
  animation: ticksIn 520ms cubic-bezier(.2,.9,.2,1) 140ms forwards;
}
#hud-escala.anim .ticks.minor{
  animation: ticksIn 520ms cubic-bezier(.2,.9,.2,1) 260ms forwards;
}
#hud-escala.anim .ticks.micro{
  animation: ticksIn 520ms cubic-bezier(.2,.9,.2,1) 380ms forwards;
}

#hud-escala.anim .escala-valor{
  animation: valuePop 420ms cubic-bezier(.2,.9,.2,1) 260ms forwards;
}

@keyframes hudIn{
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes baseLineIn{
  to { opacity: 1; }
}

@keyframes ticksIn{
  0% { opacity: 0; transform: scaleX(0.70); filter: blur(1px); }
  60%{ opacity: 1; transform: scaleX(1.02); filter: blur(0px); }
  100%{ opacity: 1; transform: scaleX(1.00); }
}

@keyframes valuePop{
  0% { opacity: 0; transform: translateY(8px); }
  70%{ opacity: 1; transform: translateY(0); }
  100%{ opacity: 1; transform: translateY(0); }
}

/* Responsivo HUD */
@media (max-width: 600px){
  #hud-escala{
    padding: 12px 14px 10px;
    border-radius: 18px;
  }
  #hud-escala #escala-num{ font-size: 22px; }
  #hud-escala #escala-uni{ font-size: 15px; }
}

/* HUD en landscape móvil: compactar mucho */
@media (max-height: 500px) {
  #hud-escala {
    bottom: 6px;
    padding: 6px 14px 4px;
    border-radius: 14px;
    width: min(360px, calc(100vw - 40px));
  }
  #hud-escala .escala-regla { height: 14px; }
  #hud-escala .escala-label { font-size: 0.55rem; letter-spacing: 1px; }
  #hud-escala #escala-num { font-size: 18px; }
  #hud-escala #escala-uni { font-size: 13px; }
  #hud-escala .escala-valor { gap: 5px; }
  #hud-escala .ticks.major { height: 12px; }
  #hud-escala .ticks.minor { height: 9px; }
  #hud-escala .ticks.micro { height: 6px; }
}


/* ================================================= */
/* --- RESPONSIVO: MENÚ PRINCIPAL (index.html) ---   */
/* ================================================= */

/* ---- Tablets y pantallas medianas (≤1024px) ---- */
@media (max-width: 1024px) {
  .contenedor-botones {
    gap: 15px;
    margin-top: 20px;
    padding: 0 20px;
  }

  .btn-imagen {
    width: 180px;
    margin: 10px;
  }

  .btn-imagen img {
    height: 95px;
  }

  .btn-imagen span {
    font-size: 1rem;
  }
}

/* ---- Móviles en landscape y tablets chicas (≤768px) ---- */
@media (max-width: 768px) {
  .contenedor-botones {
    gap: 12px;
    margin-top: 15px;
    padding: 0 15px;
  }

  .btn-imagen {
    width: 150px;
    margin: 8px;
  }

  .btn-imagen img {
    height: 80px;
    border-width: 2px;
    border-radius: 12px;
  }

  .btn-imagen span {
    font-size: 0.9rem;
    margin-top: 6px;
    letter-spacing: 0.5px;
  }

  /* Barra de progreso ADN más compacta */
  .dna-progress-container {
    width: 180px;
    padding: 10px 14px;
    bottom: 15px;
    right: 15px;
    border-radius: 24px;
  }

  .dna-info-row {
    font-size: 0.8rem;
  }

  /* Botón volver flotante más compacto */
  .boton-volver-flotante {
    bottom: 15px;
    left: 15px;
    font-size: 1rem;
    padding: 8px 16px;
  }
}

/* ---- Móviles en portrait (≤480px) ---- */
@media (max-width: 480px) {
  .contenedor-botones {
    gap: 10px;
    margin-top: 10px;
    padding: 0 10px;
    /* Dos columnas uniformes en móvil */
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    justify-items: center;
  }

  .btn-imagen {
    width: 100%;
    max-width: 160px;
    margin: 0;
  }

  .btn-imagen img {
    height: 70px;
    border-radius: 10px;
  }

  .btn-imagen span {
    font-size: 0.78rem;
    margin-top: 5px;
    letter-spacing: 0;
  }

  /* Telón: texto de ayuda si lo agregas después */
  #inicio {
    background-size: contain;
    background-color: black;
  }

  /* Barra ADN aún más compacta */
  .dna-progress-container {
    width: 150px;
    padding: 8px 12px;
    bottom: 10px;
    right: 10px;
    border-radius: 20px;
  }

  .dna-info-row {
    font-size: 0.75rem;
  }

  .progress-track {
    height: 6px;
  }

  .boton-volver-flotante {
    font-size: 0.9rem;
    padding: 7px 14px;
    border-radius: 16px;
  }
}

/* ---- Móviles muy pequeños (≤360px) ---- */
@media (max-width: 360px) {
  .contenedor-botones {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 0 8px;
  }

  .btn-imagen img {
    height: 58px;
  }

  .btn-imagen span {
    font-size: 0.72rem;
  }
}

/* ---- Galería responsiva ---- */
@media (max-width: 768px) {
  .titulo-galeria {
    font-size: 2rem;
    margin-bottom: 5px;
  }

  .subtitulo-galeria {
    font-size: 0.95rem;
    margin-bottom: 20px;
  }

  .galeria-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    max-width: 95%;
  }

  .modal-titulo {
    font-size: 1.4rem;
  }

  .modal-imagen {
    max-height: 50vh;
  }
}

@media (max-width: 480px) {
  .titulo-galeria {
    font-size: 1.5rem;
  }

  .galeria-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
  }

  .modal-titulo {
    font-size: 1.2rem;
  }

  .btn-cerrar-modal {
    padding: 8px 24px;
    font-size: 0.9rem;
  }
}

/* ---- Cargar partida responsivo ---- */
@media (max-width: 480px) {
  .titulo-pixel {
    font-size: 1.6rem;
    letter-spacing: 2px;
    margin-bottom: 25px;
  }

  .contenedor-slots {
    max-width: 90%;
  }

  .btn-cargar {
    padding: 14px;
    gap: 10px;
  }

  .nombre-partida {
    font-size: 1.1rem;
  }

  .btn-borrar {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }

  .btn-regresar {
    padding: 10px 24px;
    font-size: 0.9rem;
  }
}

/* ================================================= */
/* --- RESPONSIVO: PÁGINAS DE JUEGO ---              */
/* ================================================= */

/* ---- Fix: permitir scroll en páginas con contenido largo ---- */
body.pagina-interna {
  overflow: auto;
  height: auto;
  min-height: 100vh;
}

body.pagina-interna .contenido-interno {
  position: relative;
  height: auto;
  min-height: 100vh;
  overflow: visible;
}

/* ---- Créditos responsivo ---- */
@media (max-width: 768px) {
  .imagen-central-80 {
    max-width: 95%;
    max-height: 70vh;
  }
}

/* ---- Botón volver: landscape ---- */
@media (max-height: 500px) {
  .boton-volver-flotante {
    bottom: 8px;
    left: 10px;
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 14px;
  }
}
