@import url('https://fonts.googleapis.com/css2?family=Anton&display=swap');

body {
    font-family: 'Anton', sans-serif;
    text-align: center;
    background-color: #1a1a1a;
    color: #f0f0f0;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    letter-spacing: 0.5px;
}

/* --- PROTECCIÓN ANTI-TRAMPAS Y TRANSICIÓN DE IMÁGENES --- */
#img-personaje, #img-lugar, #img-trivia {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none; 
    pointer-events: none; 
    transition: opacity 0.3s ease-in-out; 
}

#contenedor-imagen-personaje, #foto-antigua, #contenedor-imagen-trivia {
    user-select: none;
    -webkit-user-select: none;
}

/* --- ANIMACIONES DE ENTRADA TIPO JUEGO --- */
@keyframes fadeUpPro {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.sin-animacion .titulo-principal,
.sin-animacion .subtitulo,
.sin-animacion #menu-principal {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
}

/* --- PANTALLA DE INICIO (Punto Medio Centrado) --- */
#pantalla-inicio {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('assets/fotos/alberto-haylli.webp');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    overflow: hidden; 
}

.overlay-inicio {
    background-color: rgba(0, 0, 0, 0.75);
    width: 100%;
    height: 100%; 
    display: flex;
    flex-direction: column;
    justify-content: center; 
    align-items: center; 
}

.titulo-principal {
    font-family: 'Anton', sans-serif;
    color: #FFD700;
    font-size: 5.2rem; 
    margin: 0;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.8);
    letter-spacing: 3px;
    font-weight: normal;
    opacity: 0;
    animation: fadeUpPro 1s ease-out forwards;
    animation-delay: 1s; 
}

.subtitulo {
    font-family: 'Anton', sans-serif;
    color: #cccccc;
    font-size: 2.2rem;
    margin-top: 0;
    margin-bottom: 25px; 
    font-weight: normal;
    letter-spacing: 5px;
    text-transform: uppercase;
    opacity: 0;
    animation: fadeUpPro 1s ease-out forwards;
    animation-delay: 1.3s; 
}

#menu-principal {
    opacity: 0;
    animation: fadeUpPro 1s ease-out forwards;
    animation-delay: 1.6s; 
    width: 100%;
}

.btn-menu {
    background: #FFD700;
    color: #1a1a1a;
    border: none;
    padding: 15px 30px;
    font-size: 1.3rem;
    cursor: pointer;
    border-radius: 8px;
    margin: 8px;
    display: inline-block;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    font-family: 'Anton', sans-serif;
    text-transform: uppercase;
    white-space: nowrap; /* Prohíbe terminantemente que el texto se parta en dos renglones */
}

.btn-menu:hover {
    background: #fff;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.7);
}

.btn-secundario {
    background: transparent;
    color: #fff;
    border: 2px solid #fff;
    padding: 10px 25px;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.3s, color 0.3s;
    font-family: 'Anton', sans-serif;
    white-space: nowrap;
}

.btn-secundario:hover:not(:disabled) {
    background: #fff;
    color: #1a1a1a;
}

.btn-secundario:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #777;
    color: #777;
}

/* --- ESTILOS MODO AULA / MULTI --- */
.input-aula {
    display: block;
    margin: 15px auto;
    padding: 15px;
    font-size: 1.5rem;
    border-radius: 8px;
    border: 3px solid #FFD700;
    background: #222;
    color: white;
    text-align: center;
    font-family: 'Anton', sans-serif;
    width: 250px;
}

.input-aula:focus {
    outline: none;
    background: #333;
}

#contenedor-ranking {
    background: #222;
    border: 3px solid #FFD700;
    border-radius: 12px;
    padding: 20px;
    width: 80%;
    max-width: 600px;
    margin: 30px auto;
}

.ranking-lista {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    font-size: 1.8rem;
    padding: 15px;
    border-bottom: 1px solid #444;
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 5px;
    border-radius: 6px;
}

/* --- SECCIONES DEL JUEGO --- */
header {
    background-color: #0d0d0d;
    padding: 10px 20px;
    border-bottom: 2px solid #d4af37;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.marcador-oculto {
    color: #FFD700;
    font-size: 1.5rem;
    padding: 5px 15px;
    background: #222;
    border-radius: 6px;
    border: 1px solid #FFD700;
}

.btn-volver-inicio {
    background: transparent;
    color: #d4af37;
    border: 1px solid #d4af37;
    padding: 6px 12px;
    cursor: pointer;
    font-family: 'Anton', sans-serif;
    text-transform: uppercase;
    border-radius: 4px;
    transition: all 0.3s;
}

.btn-volver-inicio:hover {
    background: #d4af37;
    color: #1a1a1a;
}

.contenido-juego {
    padding: 15px 20px;
    max-width: 1000px; 
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    width: 100%;
    box-sizing: border-box;
}

h2 {
    font-family: 'Anton', sans-serif;
    font-size: 2.2rem;
    margin-top: 0;
    margin-bottom: 5px;
    font-weight: normal;
}

.contador-ronda {
    font-size: 1.5rem;
    color: #888;
    background: #222;
    padding: 5px 15px;
    border-radius: 4px;
    border: 1px solid #444;
}

.texto-instruccion {
    color: #999;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

/* --- MODO PERSONAJE --- */
#contenedor-imagen-personaje {
    cursor: pointer; 
}

#contenedor-imagen-personaje img {
    max-width: 100%;
    height: auto;
    max-height: 38vh; 
    border-radius: 2px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.8);
    border: 8px solid #fff; 
    border-bottom: 28px solid #fff; 
}

#teclado-movil {
    position: absolute;
    opacity: 0;
    z-index: -1;
    height: 1px;
    width: 1px;
}

#contenedor-palabra {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 15px 0 15px 0;
    flex-wrap: wrap;
    cursor: pointer;
}

.letra-caja {
    width: 35px;
    height: 45px;
    border-bottom: 4px solid #FFD700;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    color: #fff;
    background: rgba(255,255,255,0.05);
    border-radius: 4px 4px 0 0;
}

/* --- PANEL DE PISTAS --- */
.panel-pistas {
    margin-top: 15px;
    width: 100%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 8px;
    border: 1px dashed #666;
}
.btn-pista {
    font-size: 1rem;
    padding: 8px 15px;
    color: #FFD700;
    border-color: #FFD700;
}
.btn-pista:hover:not(:disabled) {
    background: #FFD700;
    color: #111;
}
.texto-pista {
    color: #FFD700;
    font-family: 'Arial', sans-serif;
    font-size: 1.1rem;
    min-height: 25px;
    margin-top: 10px;
    margin-bottom: 0;
    letter-spacing: 0;
}

.btn-confirmar-chico {
    font-size: 1.2rem;
    padding: 10px 20px;
    margin-top: 5px;
}

.texto-enter {
    color: #FFD700;
    font-size: 1rem;
    margin-top: 5px;
    letter-spacing: 1px;
}

/* --- MODO MAPA GEO-HAYLLI --- */
.contenedor-juego-mapa {
    display: flex;
    flex-direction: row; 
    gap: 20px;
    width: 100%;
    margin: 10px 0 20px 0;
    align-items: stretch;
}

#foto-antigua {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #111;
    padding: 10px;
    border-radius: 6px;
}

#foto-antigua img {
    max-width: 100%;
    max-height: 50vh; 
    object-fit: contain;
    border: 4px solid #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

#mapa {
    flex: 1;
    min-height: 450px;
    border: 4px solid #FFD700;
    border-radius: 6px;
    z-index: 1; 
}

/* --- MODO TRIVIA --- */
#texto-pregunta-trivia {
    padding: 0 15px;
}

#contenedor-imagen-trivia {
    margin-bottom: 15px;
    margin-top: 10px;
}

#contenedor-imagen-trivia img {
    max-width: 100%;
    height: auto;
    max-height: 35vh; 
    border-radius: 2px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.8);
    border: 6px solid #fff; 
    border-bottom: 20px solid #fff; 
    box-sizing: border-box;
}

.grid-opciones {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
    max-width: 700px;
}

.btn-opcion-trivia {
    background: #2a2a2a;
    color: #fff;
    border: 2px solid #FFD700;
    padding: 15px 20px;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
    font-family: 'Anton', sans-serif;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    letter-spacing: 1px;
}

.btn-opcion-trivia:hover {
    background: #FFD700;
    color: #1a1a1a;
    transform: translateY(-2px);
}

/* --- MODAL POPUP DE RESULTADOS --- */
.modal-oculto {
    display: none; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); 
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-contenido {
    background-color: #222;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 500px; 
    width: 90%;
    max-height: 85vh; 
    overflow-y: auto; 
    border: 2px solid #FFD700;
    box-shadow: 0 10px 40px rgba(0,0,0,0.9);
}

.modal-contenido::-webkit-scrollbar { width: 6px; }
.modal-contenido::-webkit-scrollbar-thumb { background: #FFD700; border-radius: 10px; }

#modal-titulo {
    font-family: 'Anton', sans-serif;
    font-size: 2.2rem;
    margin-top: 0;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-weight: normal;
}

.titulo-correcto { color: #4CAF50; } 
.titulo-error { color: #f44336; } 

#modal-texto {
    font-size: 1.1rem; 
    line-height: 1.4;
    margin-bottom: 25px;
    color: #ddd;
    font-family: 'Arial', sans-serif;
    letter-spacing: 0;
    white-space: pre-line; 
}

#btn-modal-accion {
    background: #FFD700;
    color: #1a1a1a;
    border: none;
    padding: 12px 35px;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 6px;
    text-transform: uppercase;
    transition: background 0.3s, transform 0.2s;
    font-family: 'Anton', sans-serif;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

#btn-modal-accion:hover {
    background: #fff;
    transform: translateY(-2px);
}

/* =========================================
   REGLAS PARA NOTEBOOKS / LAPTOPS WINDOWS
   ========================================= */
@media (max-width: 1366px), (max-height: 800px) {
    .titulo-principal { font-size: 4.5rem; }
    .subtitulo { font-size: 1.8rem; margin-bottom: 25px; }
    .btn-menu { padding: 12px 28px; font-size: 1.15rem; margin: 6px; }
    hr { margin: 15px auto !important; }
}

/* =========================================
   REGLAS PARA CELULARES
   ========================================= */
@media (max-width: 768px) {
    .overlay-inicio {
        justify-content: center; 
    }
    .titulo-principal { 
        font-size: 3.2rem; 
        margin-bottom: 5px; 
        line-height: 1.1; 
        margin-top: -6vh; /* Mantiene el título levantado */
    }
    .subtitulo { font-size: 1.3rem; margin-bottom: 20px; letter-spacing: 3px; }
    
    .btn-menu { 
        display: block; /* Obliga a comportarse como bloque */
        width: 95%; /* Toma casi todo el ancho */
        max-width: 360px; /* Evita que sea groseramente largo */
        box-sizing: border-box; /* El padding no le suma ancho */
        margin: 8px auto; 
        padding: 15px 10px; /* Botones más rellenos verticalmente */
        font-size: 1.15rem; 
    }
    
    #banner-sala-activa { padding: 10px !important; margin-top: 10px !important; }
    hr { margin: 10px auto !important; }
    
    h2 { font-size: 1.8rem; }
    .letra-caja { width: 25px; height: 35px; font-size: 20px; }
    .texto-enter { display: none; }
    #modal-titulo { font-size: 1.8rem; }
    #modal-texto { font-size: 1rem; }
    
    .contenedor-juego-mapa { flex-direction: column; gap: 10px; }
    #foto-antigua img { max-height: 35vh; }
    #mapa { min-height: 350px; }
    
    #texto-pregunta-trivia { font-size: 1.5rem; padding: 0 10px; }
    .grid-opciones { grid-template-columns: 1fr; gap: 10px; width: 100%; padding: 0 10px; box-sizing: border-box; }
    .btn-opcion-trivia { padding: 12px; font-size: 1.1rem; }
}

.efecto-revelado {
    animation: revelarFoto 1.5s ease-out forwards;
}

@keyframes revelarFoto {
    0% { filter: sepia(100%) contrast(150%) brightness(30%); opacity: 0; }
    50% { filter: grayscale(100%) contrast(120%) brightness(70%); opacity: 0.6; }
    100% { filter: none; opacity: 1; }
}