@font-face {
  font-family: 'Fredoka One';
  src: url('https://fonts.gstatic.com/s/fredokaone/v8/k3kUo8kEI-tA1RRcTZGmTlHGCac.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Fredoka One', sans-serif;
}
body {-webkit-tap-highlight-color: rgba(0,0,0,0);}
body {
  background: linear-gradient(to bottom, #f5f5f7, #ffffff);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

.contenedor-juego {
  width: 100%;
  max-width: 500px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  margin: 0 auto 20px auto;
  position: relative;
  overflow: hidden;
  padding: 10px;
}

.cabecera,
.piecera {
  background-color: #6b4d5e;
  color: #fff;
  padding: 15px;
  text-align: center;
}

.temporizador {
  font-size: 20px;
  font-weight: bold;
}

.area-juego {
  padding: 15px;
}

.tablero-contenedor {
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 0;
}

.tablero {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 100%;
}

.tablero.nivel-facil {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  aspect-ratio: 1/1;
}

.tablero.nivel-medio {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(5, 1fr);
  aspect-ratio: 4/5;
}

.tablero.nivel-dificil {
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(6, 1fr);
  aspect-ratio: 5/6;
}

.carta {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s;
  cursor: pointer;
}

.carta.volteada {
  transform: rotateY(180deg);
}

.carta.emparejada {
  pointer-events: none;
}

.carta.emparejada .cara.delantera {
  visibility: hidden;
}

.carta.emparejada .cara.trasera {
  opacity: 0.5;
}

.cara {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 5px;
  backface-visibility: hidden;
}

.cara.trasera {
  background: #f0f0f0 url('../images/dorso.png') center/contain no-repeat;
}

.cara.delantera {
  background-size: cover;
  background-position: center;
  transform: rotateY(180deg);
}

.pantalla-inicio {
  position: absolute;
  top: 60px;
  height: calc(100% - 120px);
  left: 0;
  z-index: 10;
  width: 100%;
  background: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: inherit;
  box-shadow: inherit;
}

.pantalla-inicio img {
  max-width: 80%;
  height: auto;
  margin-bottom: 20px;
  border-radius: 5px;
  box-shadow: 2px 5px 5px rgba(0, 0, 0, 0.2);
}

.juegoTitulo {
  color: #6b4d5e;
  font-size: 2.5em;
  margin: 2px;
  text-align: center;
}

.juegoNivel {
  color: #6b4d5e;
  font-size: 2em;
  margin-bottom: 20px;
  text-align: center;
}

.boton {
  background-color: #ff9900;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 16px 32px;
  font-size: 1.5rem;
  cursor: pointer;
  transition: background-color 0.3s;
  margin: 15px;
}

.boton:hover {
  background-color: #cc7a00;
}

.mensaje-final {
  position: absolute;
  z-index: 20;
  top: 60px;
  bottom: 60px;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
  text-align: center;
  border-radius: 10px;
  margin: 0 10px;
}

.mensaje-final h2 {
  font-size: 2.5em;
  margin-bottom: 20px;
}

.mensaje-final p {
  font-size: 2em;
  margin-bottom: 30px;
}

.oculto {
  display: none;
}

/* ===== ESTILOS COMUNES RESTANTES ===== */

/* Menú cabecera */
.menu a {
  color: #ffffff;
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: bold;
}

.menu a:hover {
  text-decoration: underline;
  color: #ffcc00;
}

/* Botón menú */
.boton-menu {
  display: inline-block;
  padding: 0.75em 1.25em;
  background-color: #ffffff;
  color: #333333;
  text-decoration: none;
  font-size: 1rem;
  font-weight: bold;
  border: 2px solid #999;
  border-radius: 8px;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 102;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

.boton-menu:hover {
  background-color: #eee;
  color: #000;
  border-color: #666;
}

/* Contenido informativo */
.contenido-informativo {
  width: 100%;
  max-width: 720px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  padding: 30px 25px;
  color: #6b4d5e;
  font-family: 'Fredoka One', sans-serif;
  line-height: 1.8;
  margin-bottom: 80px;
  font-size: 1.25rem;
}

.contenido-informativo h1,
.contenido-informativo h2 {
  text-align: center;
  color: #6b4d5e;
  margin-bottom: 20px;
}

.contenido-informativo p {
  margin-bottom: 15px;
}

.contenido-informativo a {
  color: #cc5500;
  text-decoration: underline;
  font-weight: 700;
}

.contenido-informativo a:hover {
  text-decoration: none;
}

/* Imagen informativa */
.imagen-contenedor {
  display: flex;
  justify-content: center;
  margin: 30px 0;
}

.imagen-contenedor img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 5px 10px rgba(0,0,0,0.08);
}

/* Footer global */
.footer-global {
  width: 100vw;
  background-color: #6b4d5e;
  color: white;
  padding: 15px 20px;
  text-align: center;
  font-size: 1.3rem;
  font-family: 'Fredoka One', sans-serif;
  border-radius: 0;
  box-sizing: border-box;
}

.contenido-footer {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-global a {
  color: #ffcc00;
  text-decoration: none;
  margin: 0 8px;
}

.footer-global a:hover {
  text-decoration: underline;
}

/* Breadcrumb (opcional) */
.breadcrumb {
  background-color: #f0f0f0;
  padding: 8px 20px;
  font-size: 0.9rem;
  font-family: 'Fredoka One', sans-serif;
  border-radius: 0 0 10px 10px;
  max-width: 540px;
  width: 100%;
  margin: 0 auto 20px auto;
}

.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0;
  margin: 0;
}

.breadcrumb li::after {
  content: "›";
  padding: 0 8px;
  color: #6b4d5e;
}

.breadcrumb li:last-child::after {
  content: "";
}

.breadcrumb a {
  color: #6b4d5e;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* Media Queries Comunes */
@media (max-width: 500px) {
  .juegoTitulo {
    font-size: 1.5em;
  }
  
  .juegoNivel {
    font-size: 1.8em;
  }
  
  .contenido-informativo {
    padding: 20px 15px;
  }
  
  .contenido-informativo h1 {
    font-size: 1.5em;
  }
  
  .contenido-informativo h2 {
    font-size: 1.5em;
  }
  
  .contenido-informativo p {
    font-size: 1.35rem;
  }
  
  .mensaje-final h2 {
    font-size: 1.8em;
  }
  
  .mensaje-final p {
    font-size: 1.4em;
  }
  
  .pantalla-inicio .boton-menu {
    font-size: 1rem;
    padding: 10px 16px;
  }
}

@media (max-width: 420px) {
  .contenedor-juego {
    max-width: 100%;
  }
  
  .boton {
    font-size: 1.1rem;
    padding: 12px 24px;
  }
}

@media (max-width: 540px) {
  .contenedor-juego {
    max-width: 95vw;
    padding: 8px;
  }
  
  .tablero {
    gap: 6px;
  }
  
  .boton {
    font-size: 1.2rem;
    padding: 14px 28px;
  }
}