/* O Verso, guia do LiVerso: conversa roteirizada no canto da tela (área pública). */

.verso {
    --verso-violeta: #6952B8;
    --verso-tinta: #21213A;
    --verso-lavanda: #C6B6F0;
    --verso-lilas: #E9E2FC;
    --verso-dourado: #F3BD48;
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 990; /* abaixo da pilha de avisos (1000) */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    font-family: inherit;
}

.verso[hidden],
.verso__conversa[hidden],
.verso__bolha[hidden] {
    display: none;
}

/* ---- Conversa ---- */

.verso__conversa {
    width: min(360px, calc(100vw - 32px));
    max-height: min(560px, calc(100vh - 120px));
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e8e3ef;
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(33, 33, 58, .18);
    overflow: hidden;
    animation: verso-entra .28s ease-out;
}

.verso__topo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--verso-violeta);
    color: #fff;
}

.verso__rosto {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--verso-lilas);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.verso__rosto svg {
    width: 40px;
    height: 44px;
}

.verso__nome b {
    display: block;
    font-family: var(--fonte-titulo, Lora, serif);
    font-size: 1.05rem;
}

.verso__nome small {
    opacity: .85;
}

.verso__fechar {
    margin-left: auto;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.verso__fechar:hover,
.verso__fechar:focus-visible {
    background: rgba(255, 255, 255, .16);
}

.verso__corpo {
    flex: 1 1 auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.verso__balao {
    max-width: 92%;
    padding: 10px 12px;
    border-radius: 16px 16px 16px 4px;
    background: var(--verso-lilas);
    color: var(--verso-tinta);
    line-height: 1.45;
    animation: verso-balao .22s ease-out;
}

.verso__balao--pessoa {
    align-self: flex-end;
    border-radius: 16px 16px 4px 16px;
    background: var(--verso-tinta);
    color: #fff;
}

.verso__digitando {
    display: inline-flex;
    gap: 4px;
    padding: 12px 14px;
}

.verso__digitando i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--verso-violeta);
    opacity: .4;
    animation: verso-ponto 1s infinite;
}

.verso__digitando i:nth-child(2) { animation-delay: .15s; }
.verso__digitando i:nth-child(3) { animation-delay: .3s; }

.verso__opcoes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 14px 14px;
}

.verso__opcoes:empty {
    display: none;
}

.verso__opcao {
    border: 1.5px solid var(--verso-violeta);
    border-radius: 999px;
    padding: 8px 13px;
    background: #fff;
    color: var(--verso-violeta);
    font: inherit;
    font-size: .92rem;
    text-decoration: none;
    cursor: pointer;
}

.verso__opcao:hover,
.verso__opcao:focus-visible {
    background: var(--verso-lilas);
}

.verso__opcao--acao {
    border-color: var(--verso-dourado);
    background: var(--verso-dourado);
    color: var(--verso-tinta);
    font-weight: 600;
}

.verso__opcao--acao:hover,
.verso__opcao--acao:focus-visible {
    background: #ffd36b;
}

/* ---- Bolinha (Verso recolhido) ---- */

.verso__bolha {
    width: 68px;
    height: 68px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--verso-lilas);
    box-shadow: 0 8px 24px rgba(33, 33, 58, .22);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform .15s;
}

.verso__bolha:hover,
.verso__bolha:focus-visible {
    transform: scale(1.06);
}

.verso__bolha svg {
    width: 54px;
    height: 58px;
}

/* ---- Desenho e movimento ---- */

.verso-estrela { transform-origin: 60px 20px; animation: verso-brilho 3.2s ease-in-out infinite; }
.verso-corpo { transform-origin: 60px 118px; animation: verso-respira 3.6s ease-in-out infinite; }
.verso-piscar { transform-origin: center; transform-box: fill-box; animation: verso-piscar 5s infinite; }

@keyframes verso-brilho { 0%, 100% { transform: rotate(0) scale(1); } 50% { transform: rotate(12deg) scale(1.08); } }
@keyframes verso-respira { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes verso-piscar { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes verso-entra { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes verso-balao { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes verso-ponto { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .verso-estrela, .verso-corpo, .verso-piscar, .verso__conversa, .verso__balao, .verso__digitando i { animation: none; }
}

/* ---- Celular: conversa na parte de baixo, até metade da tela ---- */

@media (max-width: 560px) {
    .verso {
        right: 12px;
        bottom: 12px;
        left: 12px;
        align-items: flex-end;
    }

    .verso__conversa {
        width: 100%;
        max-height: 55vh;
        border-radius: 20px 20px 16px 16px;
    }

    .verso__bolha {
        width: 58px;
        height: 58px;
    }

    .verso__bolha svg {
        width: 46px;
        height: 50px;
    }
}

/* Com a conversa aberta no celular, a moldura não pode bloquear toques na página fora dela. */
.verso { pointer-events: none; }
.verso > * { pointer-events: auto; }
