* {
  -webkit-tap-highlight-color: transparent !important;
}

/* Escala global (ajustada) */
html {
  font-size: 18px;
  -webkit-text-size-adjust: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background-color: #6ce5f5;
  background-image: url("img/cartographer moviles.png");
  color: #000000;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body.user-authenticated #btn-elegir-modo {
  display: block !important;
}

.pantalla-central {
  text-align: center;
  margin-top: 0rem;
}

.pantalla-central button {
  display: block;
  margin: 1rem auto;
  margin-top: 0.2rem;
  padding: 10px 20px;
  font-size: 16px;
  background-color: #4794e1;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  width: 80%;
  max-width: 300px;
  touch-action: auto;
  -webkit-touch-action: auto;
  pointer-events: auto;
}



header {
  text-align: center;
  margin-bottom: 0.8rem;
}

.auth {
  margin-top: 0.8rem;
  display: flex;
  justify-content: center;
}

button {
  cursor: pointer;
  font-weight: bold;
  padding: 8px 12px;
  margin: 3px;
  border: none;
  border-radius: 4px;
  background: #79abec;
  color: white;
  font-size: 12px;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button#logout-btn {
  background: #e85454;
  color: white;
  font-size: 1rem;        /* aumenta tamaño del texto */
  padding: 12px 24px;     /* más espacio interno */
  border: none;
  border-radius: 8px;
  margin-bottom: 2rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

button#logout-btn:hover {
  background: #8d4444;    /* tono más oscuro al pasar el mouse */
  transform: scale(1.05); /* leve zoom al pasar */
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tablero {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}

.fila {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 15px;
}

.cell {
  width: 100px;
  height: 100px;
  background: #b0b0b0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  text-transform: uppercase;
  font-weight: bold;
  position: relative;
  overflow: hidden;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-action: manipulation;
  /* Remover transition para evitar conflictos con animaciones */
}

/* Animaciones para las celdas del tablero */
.cell.filled {
  animation: cellPop 0.2s ease-in-out;
}

.cell.flip {
  animation: cellFlip 0.6s ease-in-out;
}

.cell.shake {
  animation: cellShake 0.5s ease-in-out;
}

.cell.bounce {
  animation: cellBounce 0.3s ease-in-out;
}

/* Animación de entrada de letra */
@keyframes cellPop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* Animación de volteo de celda */
@keyframes cellFlip {
  0% {
    transform: rotateX(0deg);
  }
  50% {
    transform: rotateX(90deg);
  }
  100% {
    transform: rotateX(0deg);
  }
}

/* Animación de sacudida para palabras inválidas */
@keyframes cellShake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

/* Animación de rebote */
@keyframes cellBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Animación de revelación de color */
.cell.reveal {
  animation: cellReveal 0.8s ease-in-out;
}

@keyframes cellReveal {
  0% {
    transform: rotateX(0deg);
  }
  50% {
    transform: rotateX(90deg);
  }
  100% {
    transform: rotateX(0deg);
  }
}

/* Animaciones específicas para letras correctas e incorrectas */
.cell.correct-bounce {
  animation: correctBounce 0.6s ease-in-out;
}

.cell.wrong-bounce {
  animation: wrongBounce 0.6s ease-in-out;
}

/* Rebote hacia arriba para letras correctas */
@keyframes correctBounce {
  0% {
    transform: translateY(0px);
  }
  20% {
    transform: translateY(-20px);
  }
  40% {
    transform: translateY(-5px);
  }
  60% {
    transform: translateY(-15px);
  }
  80% {
    transform: translateY(-2px);
  }
  100% {
    transform: translateY(0px);
  }
}

/* Rebote hacia los lados para letras incorrectas */
@keyframes wrongBounce {
  0% {
    transform: translateX(0px);
  }
  20% {
    transform: translateX(-12px);
  }
  40% {
    transform: translateX(12px);
  }
  60% {
    transform: translateX(-6px);
  }
  80% {
    transform: translateX(6px);
  }
  100% {
    transform: translateX(0px);
  }
}

/* Animación combinada para revelación con rebote */
.cell.reveal-correct {
  animation: revealCorrect 1.2s ease-in-out;
}

.cell.reveal-wrong {
  animation: revealWrong 1.2s ease-in-out;
}

@keyframes revealCorrect {
  0% {
    transform: rotateX(0deg) translateY(0px);
  }
  40% {
    transform: rotateX(90deg) translateY(0px);
  }
  50% {
    transform: rotateX(0deg) translateY(-20px);
  }
  65% {
    transform: rotateX(0deg) translateY(-5px);
  }
  80% {
    transform: rotateX(0deg) translateY(-15px);
  }
  90% {
    transform: rotateX(0deg) translateY(-2px);
  }
  100% {
    transform: rotateX(0deg) translateY(0px);
  }
}

@keyframes revealWrong {
  0% {
    transform: rotateX(0deg) translateX(0px);
  }
  40% {
    transform: rotateX(90deg) translateX(0px);
  }
  50% {
    transform: rotateX(0deg) translateX(-12px);
  }
  65% {
    transform: rotateX(0deg) translateX(12px);
  }
  80% {
    transform: rotateX(0deg) translateX(-6px);
  }
  90% {
    transform: rotateX(0deg) translateX(6px);
  }
  100% {
    transform: rotateX(0deg) translateX(0px);
  }
}

/* Clases adicionales para testing */
.cell.test-correct {
  animation: correctBounce 0.8s ease-in-out;
}

.cell.test-wrong {
  animation: wrongBounce 0.8s ease-in-out;
}

/* Aumentar el ancho global de todos los bloques */
.bloque,
#estadisticas {
  background: white;
  max-width: 700px !important;
  width: 100%;
  margin: 1.5rem auto;
  padding: 1.5rem;
  box-sizing: border-box;
  border-radius: 16px;
}

/* Bloque del título (más compacto) */
.bloque-superior {
  padding: 0.1rem 1.2rem;
  margin-bottom: 0.5rem;
}

.bloque-superior h1 {
  font-size: 1.6rem;
  margin: 0.2rem 0 0.6rem;
  text-align: center;
}

/* Bloque de estadísticas más compacto */
.bloque-estadisticas {
  padding: 0rem 0.5rem;
  margin-bottom: 0.2rem;
}

/* Teclado con más aire lateral */
.teclado {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0 1.5rem;
  box-sizing: border-box;
}

/* Filas del teclado bien distribuidas */
.fila-teclado {
  display: flex;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 8px;
  margin-bottom: 10px;
  width: 100%;
  box-sizing: border-box;
}

/* Teclas normales */
.tecla {
  flex: 1;
  min-width: 30px;
  height: 44px;
  font-size: 1rem;
  border-radius: 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  background: #b0b0b0 !important;
  color: #222 !important;
  font-weight: bold;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: none !important;
  transform: none !important;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-action: manipulation;
}

/* Animación para teclas del teclado virtual */
.tecla.pressed {
  animation: teclaPress 0.1s ease-in-out;
}

@keyframes teclaPress {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

/* Teclas especiales (ENTER y ⌫) */
.tecla.especial {
  flex: 2.5;
  max-width: 170px;
  height: 44px;
  background: #565758 !important;
  font-size: 1rem;
  padding: 0 12px;
  white-space: nowrap;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #fff !important;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-action: manipulation;
}

/* Estados */
.correct {
  background-color: #6aaa64;
  color: white;
}

.misplaced {
  background-color: #c9b458;
  color: white;
}

.wrong {
  background-color: #787c7e;
  color: white;
}

/* Estadísticas */
#estadisticas {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.card-estadistica {
  flex: 1;
  background: #ffffff;
  border-radius: 12px;
  padding: 0.6rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  text-align: center;
  font-size: 0.85rem;
  font-weight: bold;
  color: #080808;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.card-estadistica.morado {
  background-color: #c7c0de;
}

.card-estadistica.verde {
  background-color: #d4f8e8;
}

.card-estadistica.rojo {
  background-color: #edb6b6;
}

.card-estadistica svg {
  width: 24px;
  height: 24px;
  color: #4a90e2;
  margin-bottom: 0.2rem;
}

.card-estadistica p {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #000000;
}

.card-estadistica span {
  font-size: 1rem;
  margin-top: 0.2rem;
  color: #222;
}

#logo {
  margin-top: 0 !important;
  display: block;
  margin: 0rem auto 0.2rem;
  max-width: 300px;
  height: auto;
  position: relative;
  top: -5rem;
}

#login-formulario input {
  padding: 0.6rem;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  width: 80%;
  max-width: 300px;
  -webkit-touch-callout: none;
  -webkit-user-select: text;
  -khtml-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-action: manipulation;
}

#mensaje {
  margin: 0.8rem 0;
  font-size: 1rem;
  font-weight: bold;
  color: #333;
  text-align: center;
}

/* Sistema de notificaciones toast que no afecta el layout */
.toast-notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #ffe6e6;
  color: #dc3545;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 0.9rem;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  max-width: 90%;
  text-align: center;
  pointer-events: none;
  border: 1px solid #ffcccc;
}

.toast-notification.show {
  opacity: 1;
}

.toast-notification.success {
  background: #e8f5e8;
  color: #28a745;
  border: 1px solid #c3e6c3;
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

.toast-notification.error {
  background: #ffe6e6;
  color: #dc3545;
  border: 1px solid #ffcccc;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
}

.toast-notification.warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
}

/* Modificar el mensaje para que no cause desplazamiento cuando está vacío */
#mensaje:empty {
  margin: 0;
  height: 0;
  overflow: hidden;
}

#login-container {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
}

#login-btn {
  border: 2px solid #538d4e;
  background: transparent;
  color: #538d4e;
  border-radius: 25px;
  padding: 6px 16px;
  font-weight: bold;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s;
}

#login-btn:hover {
  background-color: #538d4e;
  color: white;
}

#login-btn svg {
  width: 18px;
  height: 18px;
}

.bloque-juego {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bloque-sesion {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

button:focus,
.tecla:focus {
  outline: 2px solid #4794e1;
  outline-offset: 2px;
}

/* Versión escritorio */
@media (min-width: 1024px) {
  html {
    font-size: 20px;
  }

  .bloque,
  #estadisticas {
    max-width: 860px;
    padding: 1rem;
  }

  .cell {
    width: 70px;
    height: 70px;
    font-size: 2rem;
  }

  .tecla {
    height: 56px;
    font-size: 1.2rem;
    min-width: 40px;
  }

  .card-estadistica svg {
    width: 32px;
    height: 32px;
  }

  .card-estadistica span {
    font-size: 1.5rem;
  }

  #mensaje {
    font-size: 1.2rem;
  }
  
  /* Botones más grandes para escritorio */
  #pantalla-inicial button {
    padding: 15px 30px !important;
    font-size: 18px !important;
    max-width: 400px !important;
    min-height: 60px !important;
  }
}

/* Móviles */
@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  body {
    padding: 0.5rem 0.8rem;
  }

  .pantalla-central {
    padding: 0 0.8rem;
  }

  .bloque {
    padding: 1rem;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin: 1.2rem auto;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .cell {
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
  }

  #tablero {
    padding: 0;
    overflow-x: hidden;
  }

  .teclado {
    display: flex;
    flex-direction: column;
    padding: 0 0.2rem;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
  }

  .fila-teclado {
    display: flex;
    justify-content: center;
    gap: 3px;
    padding: 0.2rem 0;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    flex-wrap: wrap;
  }

  .tecla {
    flex: 1;
    min-width: 0;
    height: 42px;
    font-size: 0.9rem;
    margin: 0;
    border-radius: 4px;
  }

  .tecla.especial {
    flex: 1.5;
    min-width: 80px;
    max-width: 100px;
    height: 44px;
    background: #565758;
    font-size: 1rem;
    padding: 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
  }

  #mensaje {
    font-size: 1rem;
  }

  button,
  #login-btn {
    font-size: 0.95rem;
    padding: 8px 12px;
  }

  #pantalla-inicial {
    padding-top: 0rem;
  }

  #logo {
    margin-top: 1rem !important;
    margin-bottom: 0rem !important;
    position: relative !important;
    top: -6rem !important;
    margin-bottom: -2rem !important;
  }
  
  #pantalla-inicial p {
    margin-top: -7rem !important;
  }
  
  #politica-privacidad-container {
    margin-top: 0rem !important;
    margin-bottom: -2rem !important;
    transform: translateY(0.5rem) !important;
  }
  
  /* Asegurar que el botón Jugar sin cuenta funcione en móviles */
  #btn-sin-sesion {
    pointer-events: auto !important;
    touch-action: auto !important;
    -webkit-touch-action: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
  
  /* Asegurar que el botón Elegir modo funcione en móviles */
  #btn-elegir-modo {
    pointer-events: auto !important;
    touch-action: manipulation !important;
    -webkit-touch-action: manipulation !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
    z-index: 1000 !important;
    display: block !important;
    cursor: pointer !important;
  }
  

  
  /* Asegurar que el botón funcione en todos los dispositivos táctiles */
  #btn-elegir-modo {
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
  }
  
  /* Ocultar botón Elegir modo por defecto en móviles */
  #btn-elegir-modo {
    display: none !important;
  }
  
  /* Solo mostrar cuando el usuario esté autenticado */
  body.user-authenticated #btn-elegir-modo {
    display: block !important;
  }

  .pantalla-central p {
    margin-bottom: 2rem;
    font-size: 1rem;
  }
}

/* Efectos hover mejorados para todos los botones */
button {
  transition: all 0.3s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}



/* Hover para botones de modo tiempo */
button[id*="tiempo"]:hover {
  background-color: #ff8c00 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 140, 0, 0.3);
}

/* Hover para botón de volver a elegir modo */
#btn-volver-modos {
  display: block;
  margin: 1.5rem auto 0 auto;
  font-size: 1rem;
  padding: 0.6rem 1.5rem;
  background: #6ce5f5;
  color: #222;
  border-radius: 1rem;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(108,229,245,0.10);
  text-align: center;
  transition: background 0.2s, transform 0.2s;
  border: none;
}
#btn-volver-modos:hover {
  background: #4ac6d4;
  color: #fff;
  transform: scale(1.04);
}

/* Hover para botón de cerrar sesión */
#btn-cerrar-sesion-modos:hover {
  background-color: #d32f2f;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
}

/* Hover para botones de compartir */
button[id*="compartir"]:hover,
.btn-compartir:hover {
  background-color: #28a745 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Hover para botones de instrucciones */
#btn-ver-instrucciones:hover {
  background-color: #17a2b8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

/* Hover para botones de registro y login */
#btn-ir-registro:hover,
#btn-ir-login:hover,
#btn-iniciar-sesion:hover,
#registro-btn:hover {
  background-color: #6c757d;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* Hover para botones de volver */
button[id*="volver"]:hover {
  background-color: #6c757d;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* Hover para botones de cancelar */
#btn-cancelar-login:hover,
#btn-olvide-clave:hover {
  background-color: #6c757d;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* Hover para botones de reset */
#btn-enviar-reset:hover {
  background-color: #fd7e14;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(253, 126, 20, 0.3);
}

/* Hover para botones de nueva partida */
#btn-nueva-partida:hover,
.btn-nueva-partida:hover {
  background-color: #20c997;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(32, 201, 151, 0.3);
}

/* Hover para teclas del teclado virtual */
.tecla:hover {
  background-color: #9ca3af;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tecla.especial:hover {
  background-color: #6b7280;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Hover para teclas con estados */
.tecla.correct:hover {
  background-color: #059669;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.tecla.misplaced:hover {
  background-color: #d97706;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

.tecla.wrong:hover {
  background-color: #dc2626;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

/* Efecto de presión al hacer clic */
.tecla:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Hover para enlaces que actúan como botones */
a[href="#"] {
  transition: all 0.3s ease;
  display: inline-block;
}

a[href="#"]:hover {
  transform: translateY(-1px);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Hover para botón de cerrar instrucciones */
#cerrar-instrucciones:hover {
  background-color: #dc3545 !important;
  color: white;
  transform: scale(1.1);
  border-radius: 50%;
}

/* Hover para botones de redes sociales */
.btn-redes-sociales:hover {
  transform: translateY(-2px) scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* Estilos específicos para botones de redes sociales */
.btn-redes-sociales {
  transition: all 0.3s ease;
  position: relative;
}

.btn-redes-sociales svg {
  transition: all 0.3s ease;
}

.btn-redes-sociales:hover svg {
  transform: scale(1.1);
}

/* Prevenir zoom en iOS - Reglas específicas */
* {
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Asegurar que los elementos interactivos no causen zoom */
button, .tecla, .cell, a, input, textarea, select {
  touch-action: manipulation;
  -webkit-touch-action: manipulation;
}

/* Para inputs de texto, permitir selección pero prevenir zoom */
input[type="text"], input[type="email"], input[type="password"], textarea {
  font-size: 16px !important;
  -webkit-user-select: text;
  user-select: text;
}

/* Prevenir zoom en elementos específicos del juego */
.tablero, .teclado, .fila, .fila-teclado {
  touch-action: manipulation;
  -webkit-touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

/* Optimización para dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {
  button {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Prevenir cambios de color en botones en dispositivos táctiles */
  button:hover,
  button:active,
  button:focus {
    background-color: #79abec !important;
    background: #79abec !important;
    color: white !important;
  }
  
  /* Mantener colores específicos para botones especiales */
  #btn-iniciar-sesion:hover,
  #btn-iniciar-sesion:active,
  #btn-iniciar-sesion:focus {
    background: #007bff !important;
    background-color: #007bff !important;
    color: white !important;
  }
  
  #registro-btn:hover,
  #registro-btn:active,
  #registro-btn:focus {
    background: #28a745 !important;
    background-color: #28a745 !important;
    color: white !important;
  }
  
  button#logout-btn:hover,
  button#logout-btn:active,
  button#logout-btn:focus {
    background: #e85454 !important;
    background-color: #e85454 !important;
    color: white !important;
  }
  
  .pantalla-central button:hover,
  .pantalla-central button:active,
  .pantalla-central button:focus {
    background: #4794e1 !important;
    background-color: #4794e1 !important;
    color: white !important;
  }
  
  .cell {
    min-height: 44px;
    min-width: 44px;
    font-size: 1.5rem;
  }
  
  /* Mantener el diseño uniforme del teclado */
  .tecla {
    min-height: 44px;
    /* No establecer min-width para mantener flex uniforme */
  }
  
  .tecla.especial {
    min-height: 44px;
    /* Mantener flex específico para teclas especiales */
  }
}

/* --- Mejorar visualmente el cronómetro en modo tiempo --- */
#cronometro-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1.5rem;
  margin-top: 0.5rem;
}

#cronometro {
  font-size: 1.4rem;
  font-weight: bold;
  color: #4a3aff;
  background: #d4f8e8; /* Igual que .card-estadistica.verde */
  border-radius: 1.2rem;
  padding: 0.2rem 1.2rem;
  box-shadow: 0 2px 12px rgba(74,58,255,0.10);
  letter-spacing: 0.1em;
  display: inline-block;
  text-align: center;
}

/* Colores para el cronómetro según el tiempo restante */
#cronometro.crono-naranja {
  background: #ff9800 !important;
  color: #fff !important;
}
#cronometro.crono-rojo {
  background: #e74c3c !important;
  color: #fff !important;
}

@media (max-width: 600px) {
  #cronometro {
    font-size: 1.1rem;
    padding: 0.15rem 0.7rem;
  }
}

/* --- BLOQUE REFORZADO PARA TECLAS DEL TECLADO VIRTUAL --- */
.tecla, .tecla.especial {
  background: #b0b0b0 !important;
  color: #222 !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-tap-highlight-color: transparent !important;
  touch-action: manipulation;
}
.tecla.especial {
  background: #565758 !important;
  color: #fff !important;
}

/* Estados con máxima prioridad */
.tecla.correct, .tecla.correct:active, .tecla.correct:focus, .tecla.correct:hover, .tecla.correct.pressed {
  background-color: #6aaa64 !important;
  color: #fff !important;
}
.tecla.misplaced, .tecla.misplaced:active, .tecla.misplaced:focus, .tecla.misplaced:hover, .tecla.misplaced.pressed {
  background-color: #c9b458 !important;
  color: #fff !important;
}
.tecla.wrong, .tecla.wrong:active, .tecla.wrong:focus, .tecla.wrong:hover, .tecla.wrong.pressed {
  background-color: #787c7e !important;
  color: #fff !important;
}

/* Hover, focus, active, pressed: nunca cambian color ni fondo */
.tecla:active, .tecla:focus, .tecla:hover, .tecla.pressed,
.tecla.especial:active, .tecla.especial:focus, .tecla.especial:hover, .tecla.especial.pressed {
  background: inherit !important;
  color: inherit !important;
  box-shadow: none !important;
  outline: none !important;
  filter: none !important;
  transition: none !important;
  transform: none !important;
}

/* Elimina cualquier transición de color/fondo en teclas */
.tecla, .tecla.especial {
  transition: none !important;
}
/* --- FIN BLOQUE REFORZADO --- */

/* --- BLOQUE ULTRA-ESPECÍFICO PARA TECLAS DEL TECLADO VIRTUAL --- */
.tecla, .tecla:active, .tecla:focus, .tecla:hover, .tecla.pressed,
.tecla.correct, .tecla.correct:active, .tecla.correct:focus, .tecla.correct:hover, .tecla.correct.pressed,
.tecla.misplaced, .tecla.misplaced:active, .tecla.misplaced:focus, .tecla.misplaced:hover, .tecla.misplaced.pressed,
.tecla.wrong, .tecla.wrong:active, .tecla.wrong:focus, .tecla.wrong:hover, .tecla.wrong.pressed,
.tecla.especial, .tecla.especial:active, .tecla.especial:focus, .tecla.especial:hover, .tecla.especial.pressed {
  background: #b0b0b0 !important;
  color: #222 !important;
  box-shadow: none !important;
  outline: none !important;
  border: none !important;
}

.tecla.correct, .tecla.correct:active, .tecla.correct:focus, .tecla.correct:hover, .tecla.correct.pressed {
  background: #6aaa64 !important;
  color: #fff !important;
}
.tecla.misplaced, .tecla.misplaced:active, .tecla.misplaced:focus, .tecla.misplaced:hover, .tecla.misplaced.pressed {
  background: #c9b458 !important;
  color: #fff !important;
}
.tecla.wrong, .tecla.wrong:active, .tecla.wrong:focus, .tecla.wrong:hover, .tecla.wrong.pressed {
  background: #787c7e !important;
  color: #fff !important;
}
.tecla.especial, .tecla.especial:active, .tecla.especial:focus, .tecla.especial:hover, .tecla.especial.pressed {
  background: #565758 !important;
  color: #fff !important;
}
/* --- FIN BLOQUE ULTRA-ESPECÍFICO --- */

/* Botón cerrar sesión en móviles - mover a la parte inferior */
@media (max-width: 600px) {
  .btn-cerrar-sesion {
    top: auto !important;
    right: auto !important;
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    font-size: 1rem !important;
    padding: 0.8rem 1.5rem !important;
    background: #dc3545 !important;
    color: white !important;
    border: none !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3) !important;
    opacity: 1 !important;
    z-index: 1000 !important;
    width: auto !important;
    min-width: 120px !important;
  }
}

/* Estilos específicos para el botón de toggle password */
#toggle-password {
  position: absolute !important;
  right: 0.75rem !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  background: none !important;
  border: none !important;
  cursor: pointer !important;
  color: #000 !important;
  padding: 0.25rem !important;
  width: 24px !important;
  height: 24px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: none !important;
  box-shadow: none !important;
  margin: 0 !important;
  z-index: 10 !important;
}

#toggle-password:hover {
  background: none !important;
  transform: translateY(-50%) !important;
  box-shadow: none !important;
  color: #000 !important;
}

#toggle-password:active {
  background: none !important;
  transform: translateY(-50%) !important;
  box-shadow: none !important;
}

#toggle-password:focus {
  background: none !important;
  transform: translateY(-50%) !important;
  box-shadow: none !important;
  outline: none !important;
}

#eye-icon {
  pointer-events: none !important;
  fill: #000 !important;
  width: 18px !important;
  height: 18px !important;
}

/* Ajustes para tablets y móviles */
@media (max-width: 768px) {
  #toggle-password {
    width: 20px !important;
    height: 20px !important;
    right: 0.8rem !important;
    top: 45% !important;
  }
  
  #eye-icon {
    width: 14px !important;
    height: 14px !important;
  }
}

@media (max-width: 600px) {
  #toggle-password {
    width: 16px !important;
    height: 16px !important;
    right: 0.6rem !important;
    top: 42% !important;
  }
  
  #eye-icon {
    width: 10px !important;
    height: 10px !important;
  }
}