body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden; 
  background-color: #f0f0f0; 
  font-family: Arial, sans-serif;
}

#video, canvas {
  position: absolute;
  /* Asegura que el video y el canvas no excedan el tamaño de la ventana */
  max-width: 100vw;
  max-height: 100vh;
}

canvas {
  z-index: 5;
}

#instruction-box {
    position: fixed; 
    top: 5vh; 
    left: 50%;
    transform: translateX(-50%); 
    
    background-color: rgba(255, 255, 255, 0.9); 
    color: #333;
    padding: 15px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); 
    
    z-index: 50; 
    text-align: center;
    /* Usa un ancho máximo para que no se desborde en pantallas pequeñas */
    max-width: 90vw;
    min-width: 250px;
    transition: background-color 0.3s, color 0.3s, opacity 0.3s;
}

#instruction-text {
    margin: 0;
    font-size: 1.1em;
    font-weight: bold;
}

#instruction-box.success {
    background-color: #00ff6a;
    color: #000;
    box-shadow: 0 4px 15px rgba(0, 255, 106, 0.5);
}

#face-overlay-guide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; 
  z-index: 10; 
  background-color: transparent;
}

#face-overlay-guide::after {
  content: '';
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  
  /* Uso de unidades relativas (vh) para que el óvalo escale con la pantalla */
  width: 30vh; 
  height: 45vh; 
  
  transform: translate(-50%, -50%); 
  border-radius: 50%; 
  /* Crea el efecto de máscara para oscurecer el exterior */
  box-shadow: 0 0 0 9999px rgba(255, 255, 255, 0.7); 
  border: 4px solid rgba(255, 0, 0, 0.4); 
  transition: all 0.3s ease-in-out;
}

#face-overlay-guide.aligned::after {
  border: 4px solid #00ff6a; 
  box-shadow: 0 0 0 9999px rgba(255, 255, 255, 0.2); 
  animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
  0% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.01); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

#final-photo-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0s linear 0.5s;
}

#final-photo-container.show {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease-in-out;
}

#final-photo {
    max-width: 90%;
    max-height: 90%;
    border: 5px solid white;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
}
