:root {
  --vino: #7a0026;
  --gris-oscuro: #333333;
  --gris: #555555;
  --blanco: #ffffff;
  --verde: #28a745;
  --rojo: #dc3545;
}

body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: var(--blanco);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.container {
  background: var(--blanco);
  color: var(--gris-oscuro);
  padding: 20px;
  border-radius: 20px;
  width: 95%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

header {
  margin-bottom: 20px;
}

.logo {
  max-width: 120px;
  margin-bottom: 10px;
}

h2 {
  color: var(--vino);
  margin-bottom: 10px;
}

.teclado {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin: 20px 0;
}

.teclado button {
  padding: 20px;
  font-size: 22px;
  border: none;
  border-radius: 12px;
  background: var(--vino);
  color: var(--blanco);
  cursor: pointer;
  transition: transform 0.2s, background 0.3s;
  font-weight: bold;
}

.teclado button:hover {
  background: var(--gris-oscuro);
  transform: scale(1.05);
}

.camara {
  margin: 15px 0;
}
#video {
  width: 100%;
  border-radius: 12px;
  border: 3px solid var(--vino);
}

#mensaje {
  margin-top: 15px;
  font-size: 18px;
  padding: 12px;
  border-radius: 12px;
  display: none;
  font-weight: bold;
}

#mensaje.ok { 
  background: var(--verde); 
  color: var(--blanco); 
  animation: fadeIn 0.8s; 
}
#mensaje.error { 
  background: var(--rojo); 
  color: var(--blanco); 
  animation: shake 0.5s; 
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

/* 📱 Responsividad móvil */
@media (max-width: 768px) {
  .container {
    padding: 20px;
    max-width: 95%;
  }
  .teclado button {
    padding: 15px;
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .teclado {
    gap: 10px;
  }
  .teclado button {
    padding: 12px;
    font-size: 18px;
  }
}

/* 🌐 Diseño horizontal en tablets */
@media screen and (orientation: landscape) and (min-width: 768px) and (max-width: 1920px) {
  .container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    max-width: 100%;
    height: 90vh;
    padding: 30px;
    text-align: center;
    align-items: center;
  }

  header {
    grid-column: 1 / span 2;
    margin-bottom: 10px;
  }

  .lado {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  /* Teclado a la izquierda */
  .lado.teclado-container {
    align-items: center;
  }

  .teclado {
    width: 100%;
    max-width: 320px;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
  }

  .teclado button {
    padding: 18px;
    font-size: 22px;
  }

  /* Cámara a la derecha */
  .lado.camara {
    justify-content: flex-start;
  }

  .camara video {
    width: 100%;
    max-width: 600px;
    height: auto;
    max-height: 70vh;
    border-radius: 12px;
  }

  #mensaje {
    font-size: 16px;
    margin-top: 15px;
    max-width: 320px;
  }
}



/* 🔔 Modal flotante */
.modal {
  display: none; /* oculto por defecto */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal-contenido {
  background: var(--blanco);
  padding: 20px 30px;
  border-radius: 15px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  max-width: 400px;
  animation: fadeIn 0.4s;
}

.modal-contenido.ok {
  border-left: 8px solid var(--verde);
  color: var(--verde);
}

.modal-contenido.error {
  border-left: 8px solid var(--rojo);
  color: var(--rojo);
}



.mensaje {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 25px;
  border-radius: 10px;
  font-size: 22px;
  font-weight: bold;
  text-align: center;
  color: white;
  display: none;
  background: rgba(0,0,0,0.8);
}
.mensaje.oculto {
  display: none;
}
