/* Amigo de Bolso — visual único do app.
   Pensado pro celular primeiro: é onde ele vive. Fundo escuro e quente porque
   muita gente usa à noite, e alvos grandes porque se conversa com ele andando. */

:root {
    --fundo: #161311;
    --fundo-alto: #1E1A16;
    --superficie: #241F1A;
    --linha: #38302A;
    --texto: #F4EEE7;
    --suave: #A9998A;
    --ambar: #E9A63C;
    --ambar-forte: #F2B857;
    --verde: #3E7F6E;
    --erro: #E5705C;
    --raio: 18px;
    --sombra: 0 12px 32px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }

/* Precisa vir com !important: as telas são display:flex, e um display
   explícito vence o "display:none" que o navegador dá ao [hidden] sozinho —
   era por isso que a tela de Ajustes aparecia embaixo da conversa. */
[hidden] { display: none !important; }

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;   /* quem rola é a conversa, não a página inteira */
}

body {
    background:
        radial-gradient(120% 60% at 50% -10%, #2A2119 0%, transparent 60%),
        var(--fundo);
    color: var(--texto);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button, input, select {
    font: inherit;
    color: inherit;
}

/* ----------------------------------------------------------------- login */

.login {
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;   /* o body não rola; num celular baixo, o cartão rola aqui */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    gap: 28px;
}

.login-marca {
    text-align: center;
}

.login-marca .selo {
    width: 76px;
    height: 76px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 34px;
    background: linear-gradient(160deg, var(--ambar-forte), #B9741F);
    box-shadow: var(--sombra);
}

.login-marca h1 {
    margin: 0;
    font-size: 26px;
    letter-spacing: -.02em;
}

.login-marca p {
    margin: 6px 0 0;
    color: var(--suave);
    font-size: 15px;
}

.cartao {
    width: 100%;
    max-width: 380px;
    background: var(--superficie);
    border: 1px solid var(--linha);
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    padding: 24px;
}

.campo {
    display: block;
    margin-bottom: 16px;
}

.campo span {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--suave);
}

.campo input,
.campo select {
    width: 100%;
    padding: 13px 14px;
    background: var(--fundo-alto);
    border: 1px solid var(--linha);
    border-radius: 12px;
    outline: none;
}

.campo input:focus,
.campo select:focus {
    border-color: var(--ambar);
    box-shadow: 0 0 0 3px rgba(233, 166, 60, .18);
}

.botao {
    width: 100%;
    padding: 14px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(160deg, var(--ambar-forte), #CE8A26);
    color: #2A1C06;
    font-weight: 650;
    cursor: pointer;
}

.botao:active { transform: translateY(1px); }

.botao-vazado {
    background: transparent;
    border: 1px solid var(--linha);
    color: var(--texto);
    font-weight: 500;
}

.aviso-erro {
    margin: 0 0 16px;
    padding: 11px 13px;
    border-radius: 12px;
    background: rgba(229, 112, 92, .12);
    border: 1px solid rgba(229, 112, 92, .35);
    color: #F0A497;
    font-size: 15px;
}

.rodape-nota {
    color: var(--suave);
    font-size: 13px;
    text-align: center;
    margin: 0;
    max-width: 320px;
}

/* ------------------------------------------------------------------- app */

.app {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    max-width: 560px;
    margin: 0 auto;
}

.topo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--linha);
    background: rgba(22, 19, 17, .85);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 2;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #2A1C06;
    background: linear-gradient(160deg, var(--ambar-forte), #B9741F);
    flex: none;
}

.topo h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 620;
    letter-spacing: -.01em;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icone {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--linha);
    background: var(--fundo-alto);
    font-size: 17px;
    cursor: pointer;
    flex: none;
}

.icone:active { background: var(--superficie); }

.tela {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* --------------------------------------------------------- conversa */

.conversa {
    flex: 1;
    overflow-y: auto;
    padding: 20px 18px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bolha {
    max-width: 82%;
    padding: 11px 15px;
    border-radius: 18px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    animation: entra .18s ease-out;
}

.bolha-voce {
    align-self: flex-end;
    background: var(--verde);
    border-bottom-right-radius: 6px;
}

.bolha-migo {
    align-self: flex-start;
    background: var(--superficie);
    border: 1px solid var(--linha);
    border-bottom-left-radius: 6px;
}

@keyframes entra {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

/* Texto de boas-vindas, some assim que a conversa começa. */
.vazio {
    margin: auto;
    text-align: center;
    color: var(--suave);
    font-size: 15px;
    max-width: 260px;
}

.palco {
    padding: 12px 18px calc(20px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    border-top: 1px solid var(--linha);
    background: var(--fundo);
}

/* O orbe é o que diz, sem ler nada, em que ponto do ciclo a conversa está. */
.orbe {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    flex: none;
    background: radial-gradient(circle at 32% 30%, #4A4038, #221D19 70%);
    border: 1px solid var(--linha);
    transition: background .3s, box-shadow .3s;
}

.orbe-ouvindo {
    background: radial-gradient(circle at 32% 30%, var(--ambar-forte), #A5661A 70%);
    animation: pulsa 1.6s ease-in-out infinite;
}

.orbe-pensando {
    background: radial-gradient(circle at 32% 30%, #6E6152, #302921 70%);
    animation: respira 2.4s ease-in-out infinite;
}

.orbe-falando {
    background: radial-gradient(circle at 32% 30%, #5FA894, var(--verde) 70%);
    animation: pulsa .9s ease-in-out infinite;
}

@keyframes pulsa {
    0%, 100% { box-shadow: 0 0 0 0 rgba(233, 166, 60, .32); }
    50%      { box-shadow: 0 0 0 18px rgba(233, 166, 60, 0); }
}

@keyframes respira {
    0%, 100% { opacity: .55; }
    50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .orbe, .bolha { animation: none !important; }
}

.status {
    margin: 0;
    min-height: 1.5em;
    text-align: center;
    color: var(--suave);
    font-size: 15px;
}

.botao-falar {
    width: 100%;
    max-width: 340px;
    padding: 16px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(160deg, var(--ambar-forte), #CE8A26);
    color: #2A1C06;
    font-size: 17px;
    font-weight: 650;
    cursor: pointer;
    box-shadow: var(--sombra);
}

.botao-falar:active { transform: translateY(1px); }

.botao-falar:disabled {
    background: var(--superficie);
    color: var(--suave);
    box-shadow: none;
    cursor: not-allowed;
}

/* --------------------------------------------------------- ajustes */

.ajustes {
    padding: 20px 18px calc(28px + env(safe-area-inset-bottom));
    overflow-y: auto;
}

.ajustes h2 {
    margin: 0 0 4px;
    font-size: 20px;
}

.ajustes .secao {
    background: var(--superficie);
    border: 1px solid var(--linha);
    border-radius: var(--raio);
    padding: 18px;
    margin-top: 18px;
}

.linha-voz {
    display: flex;
    gap: 10px;
    align-items: center;
}

.linha-voz select { flex: 1; min-width: 0; }

.linha-voz .botao-vazado {
    width: auto;
    flex: none;
    padding: 13px 16px;
}

.nota {
    margin: 10px 0 0;
    color: var(--suave);
    font-size: 13.5px;
}

.status-salvo {
    margin: 12px 0 0;
    min-height: 1.4em;
    color: var(--ambar);
    font-size: 14px;
    text-align: center;
}

.conta {
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--suave);
    font-size: 14px;
}

.conta a {
    color: var(--erro);
    text-decoration: none;
    border: 1px solid var(--linha);
    border-radius: 10px;
    padding: 9px 14px;
    flex: none;
}
