* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: system-ui, sans-serif;
}

/* ===========================
   Módulo de voz / subtítulos
   =========================== */

.voice-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    animation: smoothReveal 0.6s ease-out forwards;
}

@keyframes smoothReveal {
    from {
        opacity: 0;
        transform: scale(1.02);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Capa de fondo con imágenes de naturaleza */
.background-voice {
    position: absolute;
    inset: 0;
    /* Fondo inicial: una de las imágenes de naturaleza usadas en speak.js */
    background-image: url('https://images.unsplash.com/photo-1470115636492-6d2b56f9146d?fm=jpg&q=60&w=3000&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8NHx8Zm9uZG8lMjBkZSUyMHBhbnRhbGxhJTIwZGUlMjBuYXR1cmFsZXphfGVufDB8fDB8fHww');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 1s ease-in-out;
    z-index: -1;
    filter: brightness(0.45) blur(1px);
    transform: scale(1.02);
    will-change: opacity, transform;
}

/* EFECTO VINYETA: Spotlight Cinematic */
.background-voice::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, transparent 20%, rgba(0, 0, 0, 0.5) 100%);
    z-index: 1;
    pointer-events: none;
}

/* Eliminado ruido y desenfoque para máxima nitidez */

/* Contenedor de subtítulos generados por voz */
.voice-subtitles {
    position: relative;
    max-width: 80%;
    padding: 14px 22px;
    color: #ffffff;
    font-size: 3.2rem;
    line-height: 1.5;
    font-weight: 800;
    border-radius: 8px;
    text-align: center;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    white-space: pre-wrap;
    text-transform: uppercase;
    text-shadow:
        -2px 0 0 #000,
        2px 0 0 #000,
        0 -2px 0 #000,
        0 2px 0 #000;

    /* Mostrar como máximo 3 líneas de texto, recortando el resto */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Switch para cambiar el modo de fondos de voz */
.voice-bg-switch {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    z-index: 5;
}

.voice-bg-switch__label {
    text-shadow: 1px 1px 2px #000;
    text-transform: uppercase;
}

.voice-bg-switch__toggle {
    width: 40px;
    height: 20px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.3);
    position: relative;
}

.voice-bg-switch__knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.7);
    transition: transform 0.2s ease;
}

/* Estado ON: mover el knob a la derecha y dar más brillo */
.voice-bg-switch--on .voice-bg-switch__toggle {
    background: rgba(76, 175, 80, 0.7); /* verde */
}

.voice-bg-switch--on .voice-bg-switch__knob {
    transform: translateX(20px);
}

@media (min-width: 3840px) {
    .voice-subtitles {
        font-size: 18rem;
        max-width: 80%;
    }

    .voice-subtitles--info {
        font-size: 4rem;
    }
}

@media (min-width: 7680px) {
    .voice-subtitles {
        font-size: 30rem;
        max-width: 88%;
    }

    .voice-subtitles--info {
        font-size: 6rem;
    }
}

/* Ajuste específico de texto para pantallas 1920x1080 (solo tipografía, no layout) */
@media (min-width: 1920px) and (max-width: 3839px) {
    .voice-subtitles {
        font-size: 5rem;
    }

    .voice-subtitles--info {
        font-size: 2rem;
    }
}

/* Estado informativo cuando no hay voz o hay errores */
.voice-subtitles--info {
    opacity: 0.8;
    font-style: italic;
}

/* Palabras resaltadas por importancia */
.voice-word--important {
    color: #ffeb3b;
    /* amarillo intenso */
}

/* Palabras que representan gritos (más grandes y rojas) */
.voice-word--shout {
    color: #ff4444;
}

/* Utilidad para ocultar formularios controlados por JS */
.form-hidden {
    display: none !important;
}

/* Estilos Dinámicos de Texto */

/* Palabras Santas: Amarillo */
.voice-holy {
    color: #ffd700;
    /* Dorado/Amarillo */
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
}

/* Palabras coloreadas al azar con tonos claros y suaves */
.voice-random-1 {
    color: #b3e5fc; /* celeste claro */
}

.voice-random-2 {
    color: #c8e6c9; /* verde claro */
}

.voice-random-3 {
    color: #ffe0b2; /* naranja pastel */
}

@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-1deg);
    }
}