/* ==========================================================================
   TRUCACHO GD - SUBTÍTULOS DE DIÁLOGOS (los crea js/sistemas/director_audio.js)
   Abajo a la izquierda: no tapa la mano del jugador (centro) ni la botonera (derecha).
   ========================================================================== */

#tg-subtitulos {
    position: fixed;
    left: 2%;
    bottom: 3cqh;
    z-index: 999990;                 /* por encima de la mesa y overlays de juego */
    width: min(30cqw, 400px);
    min-width: 230px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 8px;
    pointer-events: none;
}

.tg-sub {
    --color-personaje: #ffffff;
    position: relative;
    background: #fffdf3;
    color: #1b1b1b;
    border: 3px solid #111;
    border-left: 10px solid var(--color-personaje);
    border-radius: 14px 14px 14px 4px;
    padding: 7px 12px 8px;
    box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.85);
    font-family: 'Arial Black', Impact, sans-serif;
    line-height: 1.25;
    transform-origin: bottom left;
    animation: tgSubEntrar 0.22s cubic-bezier(0.18, 0.89, 0.32, 1.28) both;
}

.tg-sub.saliendo {
    animation: tgSubSalir 0.3s ease-in forwards;
}

.tg-sub-nombre {
    display: block;
    font-size: 0.72rem;
    letter-spacing: 1px;
    color: #111;
    text-transform: uppercase;
    margin-bottom: 1px;
}

.tg-sub-nombre::before {
    content: '';
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--color-personaje);
    border: 2px solid #111;
    vertical-align: -1px;
}

.tg-sub-texto {
    display: block;
    font-size: 0.98rem;
    font-style: italic;
}

/* Frase sin voz grabada todavía: globo de "pensamiento" con borde punteado */
.tg-sub.tg-sub-sin-voz {
    border-style: dashed;
    border-left-style: solid;
}

@keyframes tgSubEntrar {
    from { opacity: 0; transform: scale(0.6) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes tgSubSalir {
    to { opacity: 0; transform: translateY(8px) scale(0.92); }
}

@media (max-width: 760px) {
    #tg-subtitulos { left: 8px; right: 8px; width: auto; min-width: 0; bottom: 1.5cqh; }
    .tg-sub-texto { font-size: 0.86rem; }
}
