/*VARIABLES*/
:root {
    --rowNum: 5;
    --colNum: 5;
    --button-text: #f8fafc;
    --button-shadow: 0 16px 32px rgba(15, 23, 42, 0.28);
    --button-shadow-hover: 0 22px 42px rgba(15, 23, 42, 0.34);
    /* --gridHeight: 128px;
    --gridWidht: 128px; */
    --gridHeight: 250px;
    --gridWidht: 25%;
}

html,
body {
    min-height: 100dvh;
    /* Considera la UI del navegador */
}

/*CUERPO*/
body {
    background: url(https://puedjs.unam.mx/memorama_arbol/img/fondo.png);
    font-family: "Baloo 2", "Poppins", sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
}

button {
    font-family: "Baloo 2", "Fredoka", sans-serif;
}

/*CONTAINER ELEMENTS*/
.container {
    display: grid;
    text-align: center;
    gap: 10px;
    grid-template-areas: "numPartidas maxPuntos puntos cronometro"
        "baraja baraja baraja baraja";
    grid-template-columns: 1fr 1fr 1fr 1fr;
    flex: 1 0 auto;
}

.numPartidas,
.maxPuntos,
.puntos,
.nivelActual,
.reloj {
    font-family: "Baloo 2", "Poppins", sans-serif;
    color: #151923;
    font-size: .95rem;
    font-weight: 800;
}

/*PARTIDAS*/
.numPartidas {
    grid-area: numPartidas;
}

/*PUNTOS*/
.maxPuntos {
    grid-area: maxPuntos;
}

.puntos {
    grid-area: puntos;
}

.nivelActual {
    grid-area: nivelActual;
}

/*CRONOMETRO*/
.cronometro {
    grid-area: cronometro;
}

.reloj {
    display: inline;
    font-weight: bold;
}

/* TABLERO */
.wrapper {
    grid-area: baraja;
    padding: 2%;
    display: none;
    justify-content: center;
    grid-template-rows: repeat(var(--rowNum), var(--gridHeight));
    grid-template-columns: repeat(var(--colNum), var(--gridWidht));
    gap: 20px;
    width: 55%;
    margin: 0 auto;
}

/* CARTAS */
.carta {
    grid-column-start: auto;
    grid-row-start: auto;
    position: relative;
    z-index: 1;
    transform-style: preserve-3d;
    transition: transform 0.50s ease;
    will-change: transform;
    /* width: var(--gridWidht);
    height: var(--gridHeight); */
    width: 100%;
    height: auto;
    max-width: 250px;
    max-height: 250px;
}

/* IMAGEN FRONT CARTA */
input[type='image'] {
    /* background: white; */
    /* border-radius: 12px; */
    width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: contain;
    text-shadow: 0 0 0 black;
    /* Muestra el texto */
    caret-color: transparent;
    /* Oculta el cursor */
    color: transparent;
    caret-color: transparent;
    display: block;
}

.face {
    position: absolute;
    /* width: var(--gridWidht);
    height: var(--gridHeight); */
    width: 100%;
    height: auto;
    object-fit: contain;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: rotateY(180deg) translateZ(1px) scale(1);
    -ms-transform: rotateY(180deg) translateZ(1px) scale(1);
    -moz-transform: rotateY(180deg) translateZ(1px) scale(1);
    -webkit-transform: rotateY(180deg) translateZ(1px) scale(1);
    -o-transform: rotateY(180deg) translateZ(1px) scale(1);
}

.back {
    transform: rotateY(0deg) translateZ(1px) scale(1);
    -webkit-transform: rotateY(0deg) translateZ(1px) scale(1);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    visibility: visible;
    /* visibility: hidden; */
}

/* ANIMACIONES CARTA GIRAR Y CRECER */
.mostrar {
    z-index: 5;
    transform: rotateY(180deg) scale(1.08);
    -ms-transform: rotateY(180deg) scale(1.08);
    -moz-transform: rotateY(180deg) scale(1.08);
    -webkit-transform: rotateY(180deg) scale(1.08);
    -o-transform: rotateY(180deg) scale(1.08);
}

.mostrar.acertada {
    z-index: 2;
    transform: rotateY(180deg) scale(1);
    -ms-transform: rotateY(180deg) scale(1);
    -moz-transform: rotateY(180deg) scale(1);
    -webkit-transform: rotateY(180deg) scale(1);
    -o-transform: rotateY(180deg) scale(1);
}

.back input[type='image']:hover {
    transform: scale(1.1);
}

/* BLOQUEO TABLERO */
.bloquear input[type='image']:hover {
    border: none;
    box-shadow: none;
}

/* MODAL */
.modalDialog {
    display: block;
    position: relative;
    background-color: rgba(0, 0, 0, .0);
    color: #fff;
}

#modalScore {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    padding: 16px;
    z-index: 1000;
    font-family: "Baloo 2", "Poppins", sans-serif;
    box-sizing: border-box;
}

.modal-score h2 {
    margin: 0 0 4rem 0;
    font-family: "Baloo 2", "Poppins", sans-serif;
    font-weight: 700;
    line-height: 1.5rem;
}

.hide {
    display: none !important;
}

.modal-content {
    width: 100%;
    margin: 1% auto 5%;
    border-radius: 5px;
    background: #00000000;
    text-align: center;
    display: grid;
    gap: 5px;
}

.tabla-info{
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
}

.tabla-info .info label, .tabla-info .info span {
    font-family: "Baloo 2", "Poppins", sans-serif;
    color: #000;
    font-weight: 600;
}

.tabla-info .info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.fila-inputs .col-12 {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 1%;
    align-items: center;
}

.modal-body button {
    width: 100%;
    max-width: 260px;
}

.modal-header {
    font-family: "Baloo 2", "Poppins", sans-serif;
    color: #000;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-header h2 {
    font-size: 3rem;
    font-weight: 700;
    margin: 0;
}

.modal-header p {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.modal-footer {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 0 4rem;
    gap: 16px;
}

.modal-footer #ayuda svg {
    fill: currentColor;
    width: 1rem;
}

.modal-score-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.score-feedback {
    display: none;
    align-items: center;
    border-radius: 16px;
    font-family: "Baloo 2", "Poppins", sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.15;
    padding: 9px 12px;
}

.score-feedback.is-visible {
    display: flex;
}

.score-feedback.is-success {
    background: rgba(47, 224, 141, 0.2);
    color: #087d4d;
}

.score-feedback.is-error {
    background: rgba(255, 113, 144, 0.24);
    color: #9f1239;
}

/*MODAL PUNTOS*/
/* .modal-score-body {
    display: grid;
    justify-content: space-around;
    padding: 2%;
} */

.tabla {
    grid-auto-flow: column;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
}

.footer {
    margin: 5% 5% 0 10%;
    gap: 12px;
}

.titlePtos {
    font-family: "Baloo 2", "Fredoka", sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
}

/*MODAL PARTIDAS*/
.modal-tscore-body {
    display: grid;
    padding: 2%;
}

.tPartidas {
    grid-auto-flow: column;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
}

/*BOTONES*/
.btn {
    background: linear-gradient(180deg, #70f4b9 0%, #1cb572 100%);
    color: var(--button-text);
    padding: 14px 18px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 24px;
    cursor: pointer;
    font-family: "Baloo 2", "Fredoka", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: var(--button-shadow);
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: var(--button-shadow-hover);
    filter: saturate(1.08);
}

.btn.neutral {
    background-color: gray;
}

.btn.neutral:hover {
    background-color: gray;
    border: 3px solid darkslategray;
    padding: 4px 12px;
}

.content-menus {
    display: none;
    justify-content: flex-end;
    text-align: center;
    padding-top: 1rem;
    padding-right: 2rem;
    width: 100%;
    box-sizing: border-box;
}

.content-menus.is-visible {
    display: flex;
}

.bar-menus {
    display: grid;
    grid-template-columns: repeat(2, minmax(92px, 1fr));
    grid-template-areas:
        "numPartidas puntos"
        "maxPuntos nivelActual"
        "cronometro cronometro";
    gap: 8px;
    width: min(320px, calc(100vw - 32px));
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.55);
    padding: 10px;
    border-radius: 24px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.36),
        0 14px 28px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(8px);
}

.numPartidas,
.maxPuntos,
.puntos,
.nivelActual {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.62);
    line-height: 1;
}

.numPartidas span,
.maxPuntos span,
.puntos span,
.nivelActual span {
    margin-left: 4px;
}

.cronometro {
    min-height: 44px;
    padding: 6px 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, #333b4e 0%, #171d29 100%);
    color: #fff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        0 10px 22px rgba(15, 23, 42, 0.18);
}

.cronometro .reloj {
    color: inherit;
    font-size: 1.25rem;
    font-weight: 800;
}

/* Estilos del header */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background-color: #f7bd00;
}

.logos-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    height: 50px;
    width: auto;
    filter: brightness(0) invert(1);
}

.nav-buttons {
    display: flex;
    gap: 15px;
}

.nav-button {
    font-size: 0.95rem;
}

.nav-button:hover {
    background-color: transparent;
}

/* Estilos del modal de aceptación */
#audioAlert {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    font-family: "Baloo 2", "Poppins", sans-serif;
}

.alert-box {
    background: #bebbcf;
    padding: 15px;
    border-radius: 25px;
    text-align: start;
    max-width: 300px;
    font-family: "Baloo 2", "Poppins", sans-serif;
}

.modal-score-body {
    background: #bebbcf;
    padding: 16px;
    border-radius: 25px;
    text-align: start;
    width: min(92vw, 360px);
    max-width: 360px;
    min-width: 0;
    font-family: "Baloo 2", "Poppins", sans-serif;
    box-sizing: border-box;
}

.alert-box h2 {
    margin: 0 0 4rem 0;
    font-family: "Baloo 2", "Poppins", sans-serif;
    font-weight: 700;
    line-height: 1.5rem;
}

#acceptAudio {
    font-family: "Baloo 2", "Fredoka", sans-serif;
}

.alert-box svg {
    margin: 0 2.5rem 0 0;
    width: 35px;
    fill: #fff;
    background: #000;
    border-radius: 50%;
    padding: 0.5rem;
}

.alert-box .fila {
    display: flex;
    flex-direction: row;
    width: 100%;
    min-width: 145px;
}

.hover-sound {
    -webkit-tap-highlight-color: transparent;
}

.game-button {
    --button-bg: linear-gradient(180deg, #2ecf83 0%, #12a862 100%);
    --button-glow: rgba(18, 168, 98, 0.2);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
    padding: 12px 20px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    color: var(--button-text);
    font-family: "Baloo 2", "Fredoka", sans-serif;
    text-transform: uppercase;
    letter-spacing: 0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    background: var(--button-bg);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        inset 0 -4px 10px rgba(0, 0, 0, 0.1),
        0 10px 22px rgba(15, 23, 42, 0.16);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    overflow: hidden;
}

.game-button > * {
    position: relative;
    z-index: 1;
}

.game-button::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.55) 0 8px, transparent 9px),
        radial-gradient(circle at 88% 18%, rgba(255, 255, 255, 0.28) 0 7px, transparent 8px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.08) 42%, rgba(255, 255, 255, 0));
    opacity: 0.92;
    pointer-events: none;
}

.game-button::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 8px;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0.68;
    transform: scaleX(0.46);
    transform-origin: left;
    transition: transform 0.18s ease, opacity 0.18s ease;
    pointer-events: none;
}

.game-button:hover {
    padding: 12px 20px;
    background: var(--button-bg);
    transform: translateY(-2px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.32),
        inset 0 -4px 10px rgba(0, 0, 0, 0.08),
        0 14px 28px rgba(15, 23, 42, 0.18),
        0 0 0 5px var(--button-glow);
    filter: saturate(1.08);
}

.game-button:hover::after {
    opacity: 0.86;
    transform: scaleX(0.78);
}

.game-button:active {
    padding: 12px 20px;
    background: var(--button-bg);
    transform: translateY(1px) scale(0.99);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.2);
}

.btn.game-button,
.btn.game-button:hover,
.btn.game-button:active {
    padding: 12px 20px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    background: var(--button-bg);
}

.game-button:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.7);
    outline-offset: 3px;
}

.game-button--primary {
    --button-bg: linear-gradient(180deg, #2fe08d 0%, #12a862 100%);
    --button-glow: rgba(18, 168, 98, 0.2);
}

.game-button--accent {
    --button-bg: linear-gradient(180deg, #45bfff 0%, #1d73db 100%);
    --button-glow: rgba(29, 115, 219, 0.2);
}

.game-button--danger {
    --button-bg: linear-gradient(180deg, #ff7190 0%, #d73558 100%);
    --button-glow: rgba(215, 53, 88, 0.2);
}

.game-button--secondary {
    --button-bg: linear-gradient(180deg, #ffd864 0%, #eda916 100%);
    --button-glow: rgba(237, 169, 22, 0.22);
    color: #1b1b1b;
}

.game-button--ghost {
    --button-bg: linear-gradient(180deg, #333b4e 0%, #171d29 100%);
    --button-glow: rgba(23, 29, 41, 0.2);
}

.game-button--ghost::before,
.game-button--ghost::after {
    display: none;
}

.game-button--icon {
    width: 56px;
    min-width: 56px;
    padding: 0;
    border-radius: 50%;
    --button-bg: linear-gradient(180deg, #333b4e 0%, #171d29 100%);
}

.game-button--icon svg {
    width: 18px;
    height: 18px;
}

#tablaPuntuaciones {
    flex: 0 1 auto;
    width: auto;
    max-width: 360px;
    white-space: nowrap;
}

#cancelar,
#guardarJugador,
#acceptAudio {
    min-width: 140px;
}

#modalScore #cancelar,
#modalScore #guardarJugador {
    min-width: 0;
}

/* Estilos del footer */
.footer-container {
    background-color: #343a40;
    color: white;
    padding: 10px 0;
    text-align: center;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
    flex-direction: row;
}

.footer-link {
    color: #adb5bd;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-link:hover {
    color: white;
}

.copyright {
    font-size: 14px;
    color: #6c757d;
}

.hidden {
    display: none;
}

/*  */
#loader {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: white;
    font-size: 1.5em;
}

.loader-content {
    text-align: center;
    width: 80%;
    max-width: 400px;
}

.progress-container {
    width: 100%;
    height: 20px;
    background: #333;
    border-radius: 10px;
    margin: 20px 0;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: #4CAF50;
    width: 0%;
    transition: width 0.3s;
}

.percentage {
    font-weight: bold;
}

.bloquear {
    pointer-events: none;
    /* Desactiva clics */
}
