/* === Fuente y fondo general con GIF === */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

html {
    margin: 0;
    height: 100%;
}

body {
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Press Start 2P', cursive;
    background: url('https://media1.tenor.com/m/0_-BvSG6IpgAAAAd/monad.gif') no-repeat center center fixed;
    background-size: cover;
    background-attachment: fixed;
    color: #a602ff;
    overflow-y: auto;
    overflow-x: hidden;
}

/* === CONTENEDORES GENERALES === */
#index-container,
#container,
.gameover-container,
#ranking-container {
    width: 60vw;
    max-width: 600px;
    height: auto;
    padding: 2vh 2vw;
    text-align: center;
    background-color: rgb(231, 217, 247);
    border: 0.5vh solid #a825d4;
    border-radius: 2vh;
    box-shadow: 0 0 3vh #3b4cca;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    overflow-y: auto;
    overflow-x: hidden;
}

/* === Encabezados === */
h1 { /* texto normal de h1*/
    font-size: 3.5vw;
    color: #ffffff;
    text-shadow: 0 0 8px #a602ff, 0 0 20px #3b4cca;
}

h2 { /* texto normal de h2*/
    font-size: 1.5vw;
    color: #f33636;
    margin-bottom: 0.5vh;
    text-shadow: 0.2vw 0.2vw #aa00ff;
}

.fontError { /* texto de errores en h2*/
    font-size: 5vw;
    color: #f33636;
    text-shadow: 0.2vw 0.2vw #aa00ff;
}

.fontNameError{ /* texto de errores en h1*/
    font-size: 2vw;
    color: #ffffff;
    text-shadow: 0 0 8px #a602ff, 0 0 20px #3b4cca;
}

p {
    font-size: 1vw;
    margin: 1vh 0;
}

/* === Botones e inputs === */
button,
input,
select {
    font-size: 1vw;
    padding: 1vh 1vw;
    border-radius: 0.8vh;
    font-family: 'Press Start 2P', cursive;
    border: 0.3vh solid #3b4cca;
}

button {
    background-color: #3b4cca;
    color: #ffcb05;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    background-color: #a846f8;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

button:disabled {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
}

/* === Formulario y botones === */
form {
    margin-top: 20px;
}

/* === Mensajes de error === */
.error-alert {
    color: red;
    font-weight: bold;
    margin-top: 10px;
}

/* === Zona de juego === */
#game-area {
    font-size: 1.5em;
    margin-top: 30px;
}

.correct {
    color: green;
}

.wrong {
    color: red;
}

.highlight {
    text-decoration: underline;
    font-weight: bold;
}

#countdown {
    font-size: 2em;
    color: darkblue;
    margin-top: 20px;
}

/* === Botón de volver === */
#back-btn {
    margin-top: 40px;
    display: inline-block;
    background-color: #e43df0;
    color: #ffcb05;
    padding: 12px 25px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
}

#back-btn:hover {
    background-color: #5e2aa1;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* === Tabla Ranking === */
#ranking-container table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 16px;
}

#ranking-container th,
#ranking-container td {
    padding: 12px;
    border: 2px solid #aa32ef;
}

#ranking-container th {
    background-color: #da9bfe;
    color: #3b4cca;
}

#ranking-container table tbody tr:nth-child(odd) {
    background-color: rgb(231, 217, 247);
}

#ranking-container table tbody tr:nth-child(even) {
    background-color: rgb(220, 200, 243);
}

#ranking-container table tr.highlight {
    background-color: #aaff9c !important;
    color: #3b4cca !important;
    font-weight: bold;
}

#ranking-container a {
    text-decoration: none;
    color: #ffcb05;
    font-weight: bold;
    background-color: #3b4cca;
    padding: 12px 25px;
    border-radius: 12px;
    display: inline-block;
    transition: all 0.3s ease;
    margin-top: 20px;
}

#ranking-container a:hover {
    background-color: #aa32ef;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* === Scroll de Ranking con padding === */
#ranking-container .table-scroll {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1vh 2vh;
    border-radius: 1vh;
}

/* Scroll personalizado Webkit */
#ranking-container .table-scroll::-webkit-scrollbar {
    width: 0.8vw;
}

#ranking-container .table-scroll::-webkit-scrollbar-track {
    background: #eae0f7;
    border-radius: 1vh;
}

#ranking-container .table-scroll::-webkit-scrollbar-thumb {
    background-color: #a846f8;
    border-radius: 1vh;
    border: 2px solid #eae0f7;
}

/* Scroll Firefox */
#ranking-container .table-scroll {
    scrollbar-width: thin;
    scrollbar-color: #a846f8 #eae0f7;
}

/* === Game Over: separación de botones === */
.gameover-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2vh;
}

.gameover-container button {
    width: 100%;
    max-width: 250px;
    background-color: #3b4cca;
    color: #ffcb05;
    font-size: 1vw;
    padding: 1.5vh 1vw;
    border-radius: 1vh;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gameover-container button:hover {
    background-color: #a846f8;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* === Easter Egg === */
#easter-egg {
    position: fixed;
    top: 10px;
    right: 10px;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.3s;
    z-index: 1001;
}

#easter-egg:hover {
    opacity: 1;
}

/* Fondo oscuro */
body.laberinto-bg {
    background-image: url('media/giratina.gif');
    background-size: cover;
    background-repeat: no-repeat;
}

body.laberinto-bg::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    filter: brightness(0.55) blur(5px);
    z-index: 0;
}

.giratina-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #ffcb05;
    text-shadow: 2px 2px #3b4cca;
    z-index: 1;
}

#giratina {
    position: absolute;
    width: 120px;
    height: 120px;
    background: url('https://media.tenor.com/0GRl16naN8YAAAAj/pokemon-nintendo.gif') center/contain no-repeat;
    cursor: pointer;
    transition: transform 0.2s ease;
}

#giratina:hover {
    transform: scale(1.2);
}

#resultado {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px 30px;
    border-radius: 20px;
    box-shadow: 0 0 20px #ffcb05;
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Estado visible del contenedor de resultado */
#resultado.mostrar {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

#resultado img {
    width: 150px;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 10px #ffcb05);
}

#resultado p {
    font-size: 22px;
    font-weight: bold;
    color: #ffcb05;
}

/* === 🌍 MEDIA QUERIES GLOBAL === */

/* === Tablets y pantallas medianas (hasta 1024px) === */
@media (max-width: 1024px) {

    h1 {
        font-size: 40px;
    }

    h2 {
        font-size: 28px;
    }

    p {
        font-size: 14px;
    }

    #index-container,
    #container,
    .gameover-container,
    #ranking-container {
        max-width: 500px;
        padding: 40px;
    }

    input,
    select,
    button {
        font-size: 12px;
        padding: 10px;
    }

    #ranking-container table {
        font-size: 14px;
    }

    #ranking-container .table-scroll {
        max-height: 280px;
    }

    #back-btn,
    #ranking-container a {
        padding: 10px 20px;
        font-size: 12px;
    }
}

/* === Móviles grandes (hasta 768px) === */
@media (max-width: 768px) {

    body {
        flex-direction: column;
        padding: 20px;
        overflow-y: auto;
    }

    h1 {
        font-size: 30px;
        text-shadow: 3px 3px #aa00ff;
    }

    h2 {
        font-size: 24px;
    }

    p {
        font-size: 12px;
    }

    #index-container,
    #container,
    .gameover-container,
    #ranking-container {
        width: 90%;
        padding: 30px 20px;
        max-width: 450px;
        border-width: 4px;
        box-shadow: 0 0 20px #3b4cca;
    }

    input,
    select,
    button {
        font-size: 11px;
        padding: 8px;
    }

    #ranking-container table {
        font-size: 12px;
    }

    #ranking-container th,
    #ranking-container td {
        padding: 8px;
    }

    #ranking-container .table-scroll {
        max-height: 240px;
    }

    #back-btn,
    #ranking-container a {
        font-size: 11px;
        padding: 8px 16px;
    }

    #game-area {
        font-size: 1.2em;
    }

    #countdown {
        font-size: 1.5em;
    }

    #easter-egg {
        font-size: 18px;
    }
}

/* === Móviles pequeños (hasta 480px) === */
@media (max-width: 480px) {

    body {
        align-items: flex-start;
        justify-content: flex-start;
        padding: 20px 0;
    }

    h1 {
        font-size: 22px;
    }

    h2 {
        font-size: 18px;
    }

    p {
        font-size: 11px;
    }

    #index-container,
    #container,
    .gameover-container,
    #ranking-container {
        width: 95%;
        padding: 25px 15px;
        max-width: 380px;
        border-width: 3px;
        box-shadow: 0 0 15px #3b4cca;
    }

    input,
    select,
    button {
        font-size: 10px;
        padding: 6px;
    }

    #ranking-container table {
        font-size: 10px;
    }

    #ranking-container th,
    #ranking-container td {
        padding: 5px;
    }

    #ranking-container .table-scroll {
        max-height: 200px;
    }

    #back-btn,
    #ranking-container a {
        font-size: 10px;
        padding: 6px 12px;
    }

    #game-area {
        font-size: 1em;
    }

    #countdown {
        font-size: 1.2em;
    }

    #easter-egg {
        font-size: 16px;
    }
}