/* ============ Live Virtual — interface de videochamada ============ */
:root {
    --fundo: #0b0b12;
    --painel: rgba(20, 20, 32, 0.85);
    --borda: rgba(255, 255, 255, 0.08);
    --texto: #f0f0f5;
    --texto-suave: #9a9ab0;
    --acento: #e14e8a;
    --acento-2: #7c4ee1;
    --verde: #2ecc71;
    --raio: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

button, a, input { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--acento);
    outline-offset: 2px;
}

html, body {
    height: 100%;
    background: var(--fundo);
    color: var(--texto);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;

    /* A pagina em si nunca rola: quem rola e so a lista do chat.
       Sem isto o celular faz o efeito elastico ao arrastar e a barra
       do navegador fica entrando e saindo, empurrando o layout. */
    overflow: hidden;
    overscroll-behavior: none;
}

/* Trava a tela no lugar (iOS ignora overflow:hidden sozinho no body). */
body {
    position: fixed;
    inset: 0;
    width: 100%;
    touch-action: manipulation; /* sem zoom por duplo-toque; pinca continua */
}

.oculto { display: none !important; }

/* ============ Layout geral ============ */
.app {
    display: grid;
    grid-template-columns: 1fr 360px;
    height: 100vh;   /* fallback para navegadores sem dvh */
    height: 100dvh;
    /* Com o teclado aberto o live.js poe aqui a altura que sobrou na tela,
       senao o campo de digitar fica escondido atras do teclado. */
    height: var(--altura-visivel, 100dvh);
    gap: 0;
}

/* ============ Palco (video principal) ============ */
.palco {
    position: relative;
    background: #000;
    overflow: hidden;
}

/* Fundo: o mesmo video desfocado preenchendo tudo (sem barras pretas) */
.video-fundo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(28px) brightness(0.45);
    transform: scale(1.15);
    z-index: 0;
    pointer-events: none;
}

/* Frente: o video inteiro, sem corte */
#video-principal {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 1;
}

.sem-video {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--texto-suave);
    font-size: 1.05rem;
}

/* Cabecalho da chamada */
.chamada-topo {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
    background: linear-gradient(rgba(0,0,0,0.65), transparent);
    z-index: 5;
}

.perfil { display: flex; align-items: center; gap: 10px; }

.perfil-foto {
    width: 44px; height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--acento);
}

.perfil-inicial {
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--acento), var(--acento-2));
    font-weight: 700; font-size: 1.2rem;
}

.perfil-info { display: flex; flex-direction: column; line-height: 1.25; }
.perfil-info strong { font-size: 1rem; }

.status {
    font-size: 0.75rem;
    color: var(--texto-suave);
    display: flex; align-items: center; gap: 5px;
}

.ponto {
    width: 8px; height: 8px;
    background: var(--verde);
    border-radius: 50%;
    display: inline-block;
    animation: pulsar 1.6s infinite;
}

@keyframes pulsar {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.topo-direita { display: flex; align-items: center; gap: 12px; }
.espectadores {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(225, 78, 138, 0.22);
    border: 1px solid rgba(225, 78, 138, 0.45);
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}
.espectadores .olho { display: flex; }
.cronometro {
    font-variant-numeric: tabular-nums;
    background: rgba(0,0,0,0.45);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
}
.conexao { color: var(--verde); font-size: 0.7rem; letter-spacing: 2px; }

/* Selo de transparencia */
.selo-transparencia {
    position: absolute;
    bottom: 96px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.55);
    color: var(--texto-suave);
    font-size: 0.7rem;
    padding: 5px 14px;
    border-radius: 20px;
    white-space: nowrap;
    z-index: 4;
    max-width: 92%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============ PiP da camera do visitante ============ */
.pip-camera {
    position: absolute;
    right: 16px;
    bottom: 110px;
    width: 130px;
    aspect-ratio: 3 / 4;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.35);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    cursor: grab;
    touch-action: none;
    z-index: 8;
    background: #111;
}

.pip-camera:active { cursor: grabbing; }

.pip-camera video {
    width: 100%; height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* espelhado */
}

.pip-label {
    position: absolute;
    left: 8px; bottom: 6px;
    font-size: 0.7rem;
    background: rgba(0,0,0,0.55);
    padding: 2px 8px;
    border-radius: 10px;
}

.mic-indicador {
    position: absolute;
    right: 6px; top: 6px;
    font-size: 0.6rem;
    background: rgba(226, 78, 138, 0.85);
    padding: 2px 6px;
    border-radius: 8px;
}

/* ============ Controles circulares ============ */
.controles {
    position: absolute;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 14px;
    z-index: 6;
}

.ctrl {
    width: 54px; height: 54px;
    border-radius: 50%;
    border: 1px solid var(--borda);
    background: rgba(30, 30, 46, 0.85);
    color: var(--texto);
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, background 0.2s;
    backdrop-filter: blur(8px);
}

.ctrl svg { display: block; }
.ctrl .icone { display: flex; }

/* Alternancia de icone (ex.: som mudo/alto) controlada pela classe .ativo */
.ctrl .icone-on { display: none; }
.ctrl.ativo .icone-off { display: none; }
.ctrl.ativo .icone-on { display: flex; }

.ctrl:hover { transform: scale(1.08); background: rgba(50, 50, 72, 0.9); }
.ctrl.ativo { background: var(--acento); border-color: var(--acento); }
.ctrl.encerrar { background: #d84040; border-color: #d84040; }

/* ============ Chamada flutuante (fechou o pop-up sem assinar) ============ */
.cta-assinar {
    position: absolute;
    /* logo abaixo do cabecalho da chamada (72px de altura), com folga */
    top: calc(84px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 7;
    display: flex;
    align-items: center;
    gap: 8px;
    /* max-content mantem o texto em uma linha quando cabe, e so quebra
       quando o rotulo e longo demais pra tela */
    width: max-content;
    max-width: min(92%, 360px);
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(225, 78, 138, 0.95), rgba(124, 78, 225, 0.95));
    color: #fff;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(225, 78, 138, 0.35);
    animation: cta-entrada 0.35s ease-out, cta-respiro 2.8s ease-in-out 0.6s infinite;
}

.cta-assinar:hover { filter: brightness(1.08); }
.cta-assinar:active { transform: translateX(-50%) scale(0.98); }

.cta-cadeado { font-size: 0.95rem; }
.cta-seta { font-size: 1.15rem; opacity: 0.85; margin-left: 2px; }

@keyframes cta-entrada {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes cta-respiro {
    0%, 100% { box-shadow: 0 10px 30px rgba(225, 78, 138, 0.3); }
    50%      { box-shadow: 0 10px 38px rgba(225, 78, 138, 0.6); }
}

/* Durante o bloqueio da previa a chamada e redundante */
.previa-travada .cta-assinar { display: none; }

@media (max-width: 620px) {
    .cta-assinar {
        /* no celular o cabecalho e mais compacto */
        top: calc(72px + env(safe-area-inset-top, 0px));
        font-size: 0.78rem;
        padding: 9px 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cta-assinar { animation: none; }
}

/* ============ Fim da previa gratuita ============ */
.previa-bloqueio {
    position: absolute;
    inset: 0;
    z-index: 9;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(6, 6, 12, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: surgir 0.25s ease-out;
}

/* O quadro congelado fica desfocado atras do bloqueio */
.previa-travada #video-principal { filter: blur(10px) brightness(0.6); }

/* Estilo "carregando": o quadro parado aparece mais, so escurecido,
   com a roda girando por cima — como um video que parou de carregar. */
.previa-bloqueio.previa-carregando {
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
/* No estilo carregando o quadro fica quase nitido (classe posta pelo live.js) */
.previa-travada.previa-leve #video-principal {
    filter: blur(3px) brightness(0.45);
}

.previa-roda {
    display: block;
    width: 54px;
    height: 54px;
    margin: 0 auto 16px;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: var(--acento);
    border-radius: 50%;
    animation: girar 0.9s linear infinite;
}

.previa-carregando h2 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--texto-suave);
}
.previa-carregando p { font-size: 0.85rem; }

@media (prefers-reduced-motion: reduce) {
    .previa-roda { animation-duration: 2.4s; }
}

.previa-caixa {
    text-align: center;
    max-width: 330px;
}
.previa-caixa h2 { font-size: 1.15rem; margin-bottom: 8px; }
.previa-caixa p {
    color: var(--texto-suave);
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 18px;
}
.previa-cadeado {
    display: inline-block;
    font-size: 1.9rem;
    margin-bottom: 10px;
}
.previa-caixa .botao { width: 100%; }

/* Aviso flutuante */
.aviso-flutuante {
    position: absolute;
    top: 76px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 0.85rem;
    z-index: 9;
    max-width: 90%;
    text-align: center;
}

/* ============ Chat ============ */
.chat {
    display: flex;
    flex-direction: column;
    background: var(--painel);
    border-left: 1px solid var(--borda);
    backdrop-filter: blur(14px);
    min-height: 0;
}

.chat-titulo {
    padding: 14px 16px;
    border-bottom: 1px solid var(--borda);
    display: flex;
    flex-direction: column;
}
.chat-titulo small { color: var(--texto-suave); font-size: 0.7rem; }

/* Fica escondido por padrao: o cabecalho do chat ja avisa que e IA.
   So volta no celular em pe, onde aquele cabecalho nao aparece. */
.selo-ia { display: none; }

.chat-mensagens {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain; /* nao arrasta o pull-to-refresh da pagina */
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.18) transparent;
}

.chat-mensagens::-webkit-scrollbar { width: 6px; }
.chat-mensagens::-webkit-scrollbar-track { background: transparent; }
.chat-mensagens::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.18);
    border-radius: 3px;
}

.msg {
    max-width: 85%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
    animation: surgir 0.2s ease-out;
}

@keyframes surgir {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg.eu {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--acento), var(--acento-2));
    border-bottom-right-radius: 4px;
}

.msg.ela {
    align-self: flex-start;
    background: rgba(255,255,255,0.08);
    border-bottom-left-radius: 4px;
}

.msg .autor {
    display: block;
    font-size: 0.68rem;
    color: var(--texto-suave);
    margin-bottom: 2px;
}

.digitando {
    padding: 6px 16px;
    font-size: 0.78rem;
    color: var(--texto-suave);
}
.digitando span {
    display: inline-block;
    width: 5px; height: 5px;
    background: var(--texto-suave);
    border-radius: 50%;
    margin-right: 2px;
    animation: digita 1.2s infinite;
}
.digitando span:nth-child(2) { animation-delay: 0.2s; }
.digitando span:nth-child(3) { animation-delay: 0.4s; }
@keyframes digita { 0%,100% { opacity: 0.25; } 50% { opacity: 1; } }

.chat-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--borda);
}

.chat-form input {
    flex: 1;
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--borda);
    border-radius: 24px;
    padding: 11px 16px;
    color: var(--texto);
    font-size: 0.95rem;
    outline: none;
}
.chat-form input:focus { border-color: var(--acento); }

.chat-form button {
    width: 46px; height: 46px;
    border-radius: 50%;
    border: none;
    background: var(--acento);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.chat-form button svg { margin-left: -2px; }

/* ============ Modais ============ */
.modal {
    position: fixed;
    inset: 0;
    /* mais leve: da pra ver a live atras do vidro */
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.modal-caixa {
    /* vidro escuro em vez do azulado solido */
    background: rgba(10, 10, 16, 0.55);
    backdrop-filter: blur(24px) saturate(1.15);
    -webkit-backdrop-filter: blur(24px) saturate(1.15);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
    border-radius: var(--raio);
    /* espaco extra no topo pro botao de fechar nao encostar no conteudo */
    padding: 46px 24px 28px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    position: relative;
    max-height: 92dvh;
    overflow-y: auto;
}

/* Navegador sem backdrop-filter: fundo um pouco mais fechado pra manter contraste */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .modal-caixa { background: rgba(10, 10, 16, 0.92); }
}

.modal-caixa h2 { margin-bottom: 12px; }
.modal-caixa p { color: var(--texto-suave); font-size: 0.92rem; line-height: 1.5; }

.modal-botoes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.modal-nota { font-size: 0.72rem !important; margin-top: 14px; }

.botao {
    padding: 13px 20px;
    border-radius: 12px;
    border: 1px solid var(--borda);
    background: rgba(255,255,255,0.07);
    color: var(--texto);
    font-size: 0.95rem;
    cursor: pointer;
    transition: filter 0.15s;
}
.botao:hover { filter: brightness(1.2); }
.botao.primario {
    background: linear-gradient(135deg, var(--acento), var(--acento-2));
    border: none;
    font-weight: 600;
}
.botao.grande { width: 100%; padding: 15px; font-size: 1.05rem; }

/* Botao de fechar: circulo no canto, fora do fluxo do texto.
   A regra `.modal-caixa.vip > *` (camada acima da foto de fundo) tem
   especificidade maior e transformava este botao em `position: relative`,
   jogando ele pra dentro do conteudo — daí o X ficava sobre o titulo. */
.fechar,
.modal-caixa.vip > .fechar {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    color: var(--texto);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    transition: background 0.15s, transform 0.12s;
}
.fechar:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: scale(1.06);
}

/* VIP */
/* ============ Botoes de plano dentro do chat ============ */
.chat-planos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
    align-self: flex-start;
    max-width: 90%;
}

.chat-plano-btn {
    padding: 9px 14px;
    border-radius: 999px;
    border: 1px solid rgba(225, 78, 138, 0.5);
    background: rgba(225, 78, 138, 0.12);
    color: var(--texto);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s;
}
.chat-plano-btn:hover { filter: brightness(1.25); }
.chat-plano-btn.destaque {
    background: linear-gradient(135deg, var(--acento), var(--acento-2));
    border-color: transparent;
}

/* ============ Planos (basico e vip) ============ */
.modal-caixa.vip {
    max-width: 720px;
    overflow: hidden; /* segura a imagem de fundo dentro das bordas */
}

/* Imagem de fundo do pop-up (definida no admin), bem borrada e escura
   pra nao competir com o texto dos planos. */
.modal-caixa.vip.com-fundo::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--fundo-planos);
    background-size: cover;
    background-position: center;
    filter: blur(18px) brightness(0.42) saturate(1.1);
    transform: scale(1.15); /* esconde a borda transparente que o blur cria */
    z-index: 0;
    pointer-events: none;
}
/* Todo o conteudo fica acima da imagem */
.modal-caixa.vip > * { position: relative; z-index: 1; }

.planos-titulo { margin-bottom: 18px; font-size: 1.25rem; }

/* O modal alarga conforme a quantidade de planos (classe vinda do PHP) */
.modal-caixa.vip.planos-qtd-2 { max-width: min(720px, 94vw); }
.modal-caixa.vip.planos-qtd-3 { max-width: min(1000px, 96vw); }
.modal-caixa.vip.planos-qtd-4 { max-width: min(1180px, 96vw); }

.planos-grade {
    display: grid;
    /* quantas colunas couberem: 2 planos = 2, 3 planos = 3... e quebra sozinho */
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
    align-items: stretch;
}

/* Dica de deslizar: so existe no carrossel do celular */
.planos-arraste { display: none; }

.plano {
    position: relative;
    display: flex;
    flex-direction: column;
    text-align: left;
    padding: 20px 18px;
    border-radius: 16px;
    border: 1px solid var(--borda);
    background: rgba(255, 255, 255, 0.03);
    /* sem overflow:hidden aqui — cortaria o selo "Mais completo",
       que fica 10px pra fora do topo do card */
}

/* Foto propria do plano: ocupa o topo do card, esmaecendo pro fundo escuro
   pra o texto continuar legivel logo abaixo. */
.plano.com-foto::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 46%;
    background-image: var(--foto-plano);
    background-size: cover;
    background-position: center;
    -webkit-mask-image: linear-gradient(#000 55%, transparent);
    mask-image: linear-gradient(#000 55%, transparent);
    /* a foto se arredonda sozinha (o card nao usa mais overflow:hidden) */
    border-radius: 15px 15px 0 0;
    z-index: 0;
    pointer-events: none;
}
/* Conteudo sempre acima da foto */
.plano.com-foto > * { position: relative; z-index: 1; }
/* Empurra o texto pra baixo da foto */
.plano.com-foto .plano-titulo { margin-top: calc(46% - 12px); }
/* O selo "Mais completo" fica por cima da foto, nao empurrado */
.plano.com-foto .plano-selo { margin-top: 0; }

/* O plano em destaque ganha borda colorida e um brilho de fundo */
.plano.destaque {
    border-color: rgba(225, 78, 138, 0.55);
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(225, 78, 138, 0.2), transparent 70%),
        rgba(255, 255, 255, 0.07);
}

/* Com o modal translucido, os cards precisam de um pouco mais de corpo
   pra nao sumirem no fundo */
.modal-caixa.vip .plano { background: rgba(255, 255, 255, 0.06); }
.modal-caixa.vip .plano.destaque {
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(225, 78, 138, 0.2), transparent 70%),
        rgba(255, 255, 255, 0.07);
}

.plano-selo {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--acento), var(--acento-2));
}

.plano-titulo { font-size: 1.05rem; margin-bottom: 6px; }

.plano-descricao {
    font-size: 0.82rem !important;
    line-height: 1.45;
    margin-bottom: 12px;
}

.plano-beneficios {
    list-style: none;
    margin: 0 0 16px;
    font-size: 0.84rem;
    line-height: 1.4;
    color: var(--texto);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
/* Empurra o preco e o botao pro fim do card: os dois ficam alinhados
   entre as colunas mesmo com quantidades diferentes de beneficio */
.plano-beneficios { flex: 1; }

.plano-beneficios li {
    position: relative;
    padding-left: 22px;
}
.plano-beneficios li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 0.42em;
    width: 9px;
    height: 5px;
    border-left: 2px solid var(--acento);
    border-bottom: 2px solid var(--acento);
    transform: rotate(-45deg);
}

.plano-preco {
    display: flex;
    align-items: baseline;
    gap: 2px;
    margin-bottom: 2px;
}
.plano-preco .moeda { font-size: 1rem; font-weight: 600; margin-right: 4px; }
.plano-preco strong { font-size: 2.3rem; font-weight: 800; line-height: 1; }
.plano-preco .centavos { font-size: 1rem; font-weight: 600; }

.plano-duracao {
    font-size: 0.72rem !important;
    margin-bottom: 14px;
}

.plano .botao { width: 100%; }
.plano:not(.destaque) .botao.primario {
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid var(--borda);
}

/* Celular: carrossel deslizante — um card por vez, o proximo dando
   uma espiadinha na borda (empilhar 3+ planos virava scroll infinito) */
@media (max-width: 620px) {
    .planos-grade {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: 84%;
        gap: 12px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        padding: 4px 2px 10px;
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
    }
    .planos-grade::-webkit-scrollbar { height: 4px; }
    .planos-grade::-webkit-scrollbar-track { background: transparent; }
    .planos-grade::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.25);
        border-radius: 2px;
    }

    .plano {
        scroll-snap-align: center;
        padding: 18px 16px;
    }
    .plano-preco strong { font-size: 2rem; }

    /* Um plano so: ocupa a largura toda, sem carrossel */
    .planos-qtd-1 .planos-grade { grid-auto-columns: 100%; }

    .planos-arraste {
        display: block;
        text-align: center;
        font-size: 0.72rem !important;
        margin-top: 2px;
        color: var(--texto-suave);
    }
}

/* ============ Formulario do pagador (gateways que exigem CPF) ============ */
.dados-aviso { font-size: 0.85rem !important; margin-bottom: 16px; }
.dados-nota { font-size: 0.7rem !important; margin-top: 12px; }

.form-cliente {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.form-cliente label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.82rem;
    color: var(--texto-suave);
}

.form-cliente .opcional { opacity: 0.7; }

.form-cliente input {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--borda);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--texto);
    font-size: 0.95rem;
    font-family: inherit;
    width: 100%;
}
.form-cliente input:focus {
    outline: none;
    border-color: var(--acento);
    box-shadow: 0 0 0 3px rgba(225, 78, 138, 0.16);
}

.form-cliente button { margin-top: 4px; }

.botao.voltar {
    background: none;
    border: none;
    color: var(--texto-suave);
    font-size: 0.82rem;
    padding: 6px;
}
.botao.voltar:hover { color: var(--texto); }

.cliente-erro {
    color: #ff8080 !important;
    font-size: 0.82rem !important;
    background: rgba(231, 76, 60, 0.12);
    border: 1px solid rgba(231, 76, 60, 0.4);
    border-radius: 8px;
    padding: 9px 12px;
    margin: 0;
}

.pix-qrcode {
    width: min(210px, 62vw);
    aspect-ratio: 1;
    height: auto;
    background: #fff;
    border-radius: 12px;
    margin: 12px auto;
    display: block;
}

.pix-copia { display: flex; gap: 8px; margin-top: 8px; }
.pix-copia input {
    flex: 1;
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--borda);
    border-radius: 10px;
    padding: 10px;
    color: var(--texto);
    font-size: 0.75rem;
}

.pix-aguardando {
    margin-top: 14px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.spinner {
    width: 14px; height: 14px;
    border: 2px solid var(--texto-suave);
    border-top-color: var(--acento);
    border-radius: 50%;
    display: inline-block;
    animation: girar 0.8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

.pagamento-ok { color: var(--verde) !important; font-size: 1.05rem !important; }

/* Rodape */
.rodape {
    position: fixed;
    bottom: 4px;
    left: 10px;
    font-size: 0.65rem;
    z-index: 3;
}
.rodape a { color: var(--texto-suave); text-decoration: none; }

.live-off {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    padding: 20px;
}
.live-off p { color: var(--texto-suave); }

/* ============ Mobile ============ */
@media (max-width: 860px) {
    .app {
        grid-template-columns: 1fr;
        grid-template-rows: 58vh 42vh;
        grid-template-rows: 58dvh 42dvh;
    }

    .chat { border-left: none; border-top: 1px solid var(--borda); }

    /* Topo mais compacto: tudo cabe numa linha sem cortar */
    .chamada-topo { padding: 10px 12px; gap: 8px; }
    .perfil { gap: 8px; min-width: 0; flex: 1; }
    .perfil-foto { width: 38px; height: 38px; }
    .perfil-inicial { font-size: 1rem; }
    .perfil-info { min-width: 0; }
    .perfil-info strong {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .status { font-size: 0.65rem; white-space: nowrap; }
    .topo-direita { gap: 6px; flex-shrink: 0; }
    .espectadores { font-size: 0.68rem; padding: 3px 8px; gap: 4px; }
    .cronometro { font-size: 0.72rem; padding: 3px 8px; }
    .conexao { display: none; } /* libera espaco na barra */

    /* PiP menor, acima do selo e dos controles */
    .pip-camera {
        width: 88px;
        bottom: 132px;
        right: 10px;
        border-radius: 12px;
    }
    .pip-label { font-size: 0.62rem; padding: 2px 6px; }

    .ctrl { width: 46px; height: 46px; font-size: 1.05rem; }
    .controles { gap: 8px; bottom: 12px; }

    /* Selo pode quebrar em 2 linhas em vez de truncar */
    .selo-transparencia {
        bottom: 72px;
        font-size: 0.6rem;
        white-space: normal;
        text-align: center;
        line-height: 1.35;
        max-width: 78%;
        padding: 4px 12px;
    }

    .chat-titulo { padding: 10px 14px; }
    .chat-mensagens { padding: 10px 12px; gap: 8px; }
    .msg { font-size: 0.88rem; }
    .chat-form { padding: 10px; }
    .chat-form input { padding: 10px 14px; }
    .chat-form button { width: 42px; height: 42px; }

    .rodape { display: none; }
}

/* Telas bem estreitas */
@media (max-width: 380px) {
    .ctrl { width: 42px; height: 42px; }
    .ctrl svg { width: 18px; height: 18px; }
    .controles { gap: 6px; }
    .espectadores { font-size: 0.62rem; padding: 3px 6px; }
    .cronometro { font-size: 0.66rem; padding: 3px 6px; }
    .status { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
    .pip-camera { width: 78px; }
}

/* ============ Dispositivos touch: menos GPU, mais bateria ============ */
@media (hover: none) {
    /* blur e caro em celular basico; fundo solido quase identico visualmente */
    .chat, .ctrl {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .chat { background: rgba(18, 18, 30, 0.96); }
    .ctrl { background: rgba(30, 30, 46, 0.92); }

    /* No celular o video preenche a tela (estilo TikTok/IG Live);
       a camada desfocada nao e necessaria e custa decodificacao extra */
    .video-fundo { display: none; }
    #video-principal { object-fit: cover; }
}

/* ============ Celular em pe: chat transparente sobre o video ============ */
@media (max-width: 860px) and (orientation: portrait) {
    .app {
        position: relative;
        grid-template-rows: 100vh;
        grid-template-rows: 100dvh;
    }

    /* O chat vira um overlay flutuante: o video aparece atras das mensagens */
    .chat {
        position: absolute;
        left: 0; right: 0; bottom: 0; top: auto;
        background: transparent;
        border: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        z-index: 7;
        pointer-events: none; /* toques passam pro video; so mensagens e input capturam */
        padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); /* espaco dos controles */
        transition: opacity 0.25s ease, transform 0.25s ease;
    }

    /* Sem o cabecalho do chat, o selo assume o aviso de que o chat e IA */
    .chat-titulo { display: none; }
    .selo-ia { display: inline; }

    .chat-mensagens {
        pointer-events: auto;
        flex: 0 1 auto;
        max-height: 30vh;
        max-height: 30dvh;
        padding: 8px 12px;
        /* mensagens antigas somem em fade no topo */
        -webkit-mask-image: linear-gradient(transparent, #000 20%);
        mask-image: linear-gradient(transparent, #000 20%);
    }

    .msg { max-width: 78%; }
    .msg.ela { background: rgba(0, 0, 0, 0.55); }
    .msg.eu { background: linear-gradient(135deg, rgba(225, 78, 138, 0.88), rgba(124, 78, 225, 0.88)); }
    .msg .autor { color: rgba(255, 255, 255, 0.75); }

    .digitando {
        padding: 2px 14px 6px;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    }

    .chat-form {
        pointer-events: auto;
        border-top: none;
        background: transparent;
        padding: 6px 12px 8px;
    }
    .chat-form input {
        background: rgba(0, 0, 0, 0.45);
        border-color: rgba(255, 255, 255, 0.22);
    }

    /* Selo de transparencia sobe pra nao brigar com o chat */
    .selo-transparencia {
        bottom: auto;
        top: calc(64px + env(safe-area-inset-top, 0px));
    }

    /* Toque no video: o chat sai de cena (classe alternada pelo live.js) */
    body.chat-oculto .chat {
        opacity: 0;
        transform: translateY(14px);
    }
    body.chat-oculto .chat-mensagens,
    body.chat-oculto .chat-form {
        pointer-events: none;
    }
}

/* ============ Teclado aberto no celular: menos poluicao, mais chat ============ */
@supports selector(:has(*)) {
    @media (max-width: 860px) and (orientation: portrait) {
        .app:has(#chat-input:focus) .pip-camera,
        .app:has(#chat-input:focus) .selo-transparencia,
        .app:has(#chat-input:focus) .controles {
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s;
        }
        /* Sem os controles embaixo, o chat desce e as mensagens ganham espaco */
        .app:has(#chat-input:focus) .chat {
            padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        }
        .app:has(#chat-input:focus) .chat-mensagens {
            max-height: 42vh;
            max-height: 42dvh;
        }
    }
}

/* ============ Celular deitado (paisagem): video e chat lado a lado ============ */
@media (max-width: 940px) and (orientation: landscape) and (max-height: 520px) {
    .app {
        grid-template-columns: 1fr 280px;
        grid-template-rows: 100vh;
        grid-template-rows: 100dvh;
    }
    .chat { border-top: none; border-left: 1px solid var(--borda); }
    .ctrl { width: 42px; height: 42px; }
    .ctrl svg { width: 18px; height: 18px; }
    .controles { gap: 8px; bottom: 10px; }
    .selo-transparencia { bottom: 62px; font-size: 0.55rem; }
    .pip-camera { width: 72px; bottom: 110px; }
    .chamada-topo { padding: 8px 12px; }
}

/* ============ Preferencia por menos movimento ============ */
@media (prefers-reduced-motion: reduce) {
    .ponto,
    .digitando span,
    .msg {
        animation: none;
    }
    .ctrl, .app,
    .app:has(#chat-input:focus) .controles {
        transition: none;
    }
}
