/* Nós Dois 💕 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --rosa: #ff6f91;
  --rosa-escuro: #e0487a;
  --rosa-claro: #ffe3ec;
  --lilas: #b69bff;
  --fundo: #fff6f9;
  --cartao: #ffffff;
  --texto: #3b2a33;
  --cinza: #9a8a92;
  --balao-outro: #ffffff;
  --verde: #3ccf7a;
  --lido: #7c4dff;
  --sombra: 0 1px 4px rgba(90, 30, 60, .08);
}

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--texto);
  background: var(--fundo);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ===================== Login ===================== */
.tela-login {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,.55) 0 60px, transparent 61px),
    radial-gradient(circle at 85% 80%, rgba(255,255,255,.35) 0 90px, transparent 91px),
    linear-gradient(135deg, #ffc7d6 0%, #ffe7ef 50%, #e5d9ff 100%);
}
.cartao-login {
  width: 100%; max-width: 360px;
  background: var(--cartao);
  border-radius: 28px;
  padding: 32px 26px 24px;
  box-shadow: 0 20px 60px rgba(224, 72, 122, .2);
  text-align: center;
}
.cartao-login .logo { font-size: 56px; display: inline-block; animation: batida 1.5s ease-in-out infinite; }
.cartao-login h1 { margin: 6px 0 2px; font-size: 28px; color: var(--rosa-escuro); }
.cartao-login .sub { margin: 0 0 22px; color: var(--cinza); }
.cartao-login button[type=submit] {
  width: 100%; margin-top: 6px; padding: 14px;
  border: 0; border-radius: 16px;
  font-size: 17px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--rosa), var(--lilas));
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(255, 111, 145, .35);
}
.cartao-login button[type=submit]:active { transform: scale(.98); }
.cartao-login .rodape { margin: 18px 0 0; font-size: 12px; color: var(--cinza); }

.campo { display: block; text-align: left; margin-bottom: 12px; }
.campo span { display: block; font-size: 13px; color: var(--cinza); margin: 0 0 4px 6px; }
.campo input {
  width: 100%; padding: 13px 15px;
  border: 2px solid var(--rosa-claro); border-radius: 15px;
  font-size: 16px; outline: none;
  background: var(--fundo); color: var(--texto);
  transition: border-color .2s;
}
.campo input:focus { border-color: var(--rosa); }
.erro {
  background: #ffe1e6; color: #b3264d;
  padding: 10px 12px; border-radius: 12px;
  margin-bottom: 14px; font-size: 14px;
}

/* ===================== App ===================== */
.app {
  position: relative;
  height: 100dvh;
  display: flex; flex-direction: column;
  max-width: 820px; margin: 0 auto;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,111,145,.06) 0 46px, transparent 47px),
    radial-gradient(circle at 88% 42%, rgba(182,155,255,.08) 0 64px, transparent 65px),
    radial-gradient(circle at 30% 78%, rgba(255,111,145,.05) 0 38px, transparent 39px),
    var(--fundo);
}
@media (min-width: 821px) {
  body.pagina-chat { background: linear-gradient(135deg, #ffd6e2, #eee4ff); }
  .app { box-shadow: 0 0 40px rgba(224, 72, 122, .15); }
}

/* Topo */
.topo {
  position: relative; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: linear-gradient(135deg, var(--rosa), #ff9a8b 60%, var(--lilas));
  color: #fff;
  box-shadow: 0 2px 14px rgba(224, 72, 122, .25);
}
.avatar {
  position: relative; flex: none;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.28); border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 19px;
}
.avatar .bolinha {
  position: absolute; right: -1px; bottom: -1px;
  width: 13px; height: 13px; border-radius: 50%;
  background: #c9b8c1; border: 2px solid #fff;
  transition: background .3s;
}
.avatar.online .bolinha { background: var(--verde); }
.info { flex: 1; min-width: 0; }
.nome { font-weight: 800; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { font-size: 13px; opacity: .95; min-height: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status.online, .status.digitando { font-weight: 700; }
.pontinhos i { font-style: normal; animation: piscar 1.2s infinite; }
.pontinhos i:nth-child(2) { animation-delay: .2s; }
.pontinhos i:nth-child(3) { animation-delay: .4s; }

.botao-menu {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.18); color: #fff;
  font-size: 22px; line-height: 1; cursor: pointer;
}
.menu {
  position: absolute; right: 10px; top: calc(100% - 4px);
  min-width: 240px; padding: 6px;
  background: var(--cartao); color: var(--texto);
  border-radius: 16px; box-shadow: 0 12px 34px rgba(60, 20, 40, .22);
  animation: aparecer .15s ease-out;
}
.menu button {
  display: flex; gap: 10px; align-items: center;
  width: 100%; padding: 12px 12px; border: 0; border-radius: 11px;
  background: none; text-align: left; font-size: 15px; cursor: pointer;
}
.menu button:hover { background: var(--rosa-claro); }
.menu form { margin: 0; }

.aviso-conexao {
  background: #fff1c4; color: #7a5a00;
  font-size: 13px; text-align: center; padding: 6px;
}

/* Lista */
.lista {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 10px 12px 6px;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.dias-juntos {
  position: sticky; top: 0; z-index: 2;
  width: max-content; max-width: 92%;
  margin: 2px auto 8px; padding: 5px 13px;
  font-size: 12.5px; font-weight: 700; color: var(--rosa-escuro);
  background: rgba(255,255,255,.88); border-radius: 999px;
  box-shadow: var(--sombra);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.carregar-antigas {
  display: block; margin: 6px auto 10px; padding: 7px 14px;
  border: 1px solid var(--rosa-claro); border-radius: 999px;
  background: var(--cartao); color: var(--rosa-escuro); font-size: 13px; cursor: pointer;
}
.carregando, .vazio { text-align: center; color: var(--cinza); margin-top: 30vh; line-height: 1.7; }

.dia {
  text-align: center; margin: 14px auto 10px;
  font-size: 12px; color: var(--cinza);
}
.dia::before, .dia::after { content: " ♡ "; color: var(--rosa); }

.msg {
  display: flex; flex-wrap: wrap;
  margin: 3px 0;
  animation: entrar .22s ease-out;
}
.msg.eu { justify-content: flex-end; }
.msg.curtiu { margin-bottom: 14px; }
.msg.destaque .balao { animation: destaque 1.6s ease; }

.balao {
  position: relative;
  max-width: min(78%, 520px);
  padding: 7px 11px 5px;
  border-radius: 20px;
  line-height: 1.38;
  overflow-wrap: anywhere;
  box-shadow: var(--sombra);
  -webkit-touch-callout: none;
}
.msg.eu .balao {
  background: linear-gradient(135deg, var(--rosa), #ff8fab);
  color: #fff; border-bottom-right-radius: 6px;
}
.msg.outro .balao { background: var(--balao-outro); border-bottom-left-radius: 6px; }
.msg.pendente .balao { opacity: .7; }
.msg.apagada .balao { background: transparent !important; color: var(--cinza) !important; border: 1px dashed #e3cfd8; box-shadow: none; }
.texto-apagado { font-style: italic; font-size: 14px; }

.balao p { margin: 0; white-space: pre-wrap; }
.balao p.grande { font-size: 42px; line-height: 1.15; padding: 2px 0; }
.balao a { color: inherit; text-decoration: underline; }

.foto { margin: 2px -5px 4px; }
.foto img {
  display: block; width: 100%; height: auto;
  max-width: 300px; max-height: 360px; object-fit: cover;
  border-radius: 15px; cursor: zoom-in; background: rgba(0,0,0,.05);
}

.citacao-msg {
  display: block; margin: 2px -3px 5px; padding: 6px 9px;
  border-left: 3px solid currentColor; border-radius: 10px;
  background: rgba(0,0,0,.06); font-size: 13px; cursor: pointer;
  max-height: 64px; overflow: hidden;
}
.msg.eu .citacao-msg { background: rgba(255,255,255,.22); }
.msg.outro .citacao-msg { border-color: var(--rosa); }
.citacao-msg strong { display: block; font-size: 12px; }
.citacao-msg span { opacity: .85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.rodape-msg {
  display: flex; justify-content: flex-end; align-items: center; gap: 3px;
  font-size: 10.5px; opacity: .78; margin-top: 2px;
}
.check::before { content: "✓"; font-weight: 700; }
.msg.lida .check::before { content: "✓✓"; letter-spacing: -3px; padding-right: 3px; }
.msg.eu .check { opacity: .75; }
.msg.eu.lida .check { color: #5b21b6; opacity: 1; }
.msg.pendente .check::before { content: "🕓"; font-weight: 400; }

.msg.curtiu .visto-em { margin-top: 15px; }
.visto-em {
  flex-basis: 100%; text-align: right;
  font-size: 11px; color: var(--cinza);
  margin: 3px 4px 2px;
}

.selo-curtida {
  display: none; position: absolute; bottom: -11px;
  width: 25px; height: 25px; border-radius: 50%;
  background: var(--cartao); font-size: 14px;
  align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.msg.eu .selo-curtida { left: -6px; }
.msg.outro .selo-curtida { right: -6px; }
.msg.curtiu .selo-curtida { display: flex; animation: batida .4s; }
.pop {
  position: absolute; left: 50%; top: 50%;
  font-size: 50px; pointer-events: none;
  transform: translate(-50%, -50%);
  animation: pop .9s ease-out forwards;
}

.mais {
  position: absolute; top: 4px; right: 6px;
  width: 24px; height: 24px; border-radius: 50%;
  border: 0; cursor: pointer; opacity: 0;
  background: rgba(0,0,0,.12); color: inherit; font-size: 14px; line-height: 1;
  transition: opacity .15s;
}
@media (hover: hover) and (pointer: fine) {
  .balao:hover .mais { opacity: 1; }
}

/* Digitando */
.digitando-bolha .balao { display: flex; gap: 4px; padding: 13px 14px; }
.digitando-bolha .balao span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--rosa); opacity: .5;
  animation: pulo 1.2s infinite;
}
.digitando-bolha .balao span:nth-child(2) { animation-delay: .15s; }
.digitando-bolha .balao span:nth-child(3) { animation-delay: .3s; }

/* Botão descer */
.descer {
  position: absolute; right: 14px; bottom: 82px; z-index: 4;
  width: 42px; height: 42px; border-radius: 50%;
  border: 0; background: var(--cartao); color: var(--rosa-escuro);
  font-size: 22px; line-height: 1; cursor: pointer;
  box-shadow: 0 3px 12px rgba(60, 20, 40, .2);
}
.descer .contagem {
  position: absolute; top: -6px; right: -4px;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--rosa); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* Barra de resposta e prévia */
.barra-resposta, .previa {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px 0; background: var(--cartao);
  border-top: 1px solid var(--rosa-claro);
}
.barra-resposta .citacao {
  flex: 1; min-width: 0; padding: 6px 10px;
  border-left: 3px solid var(--rosa); border-radius: 10px;
  background: var(--rosa-claro); font-size: 13px;
}
.barra-resposta .citacao strong { display: block; color: var(--rosa-escuro); font-size: 12px; }
.barra-resposta .citacao span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-resposta button, .previa button {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: var(--rosa-claro); color: var(--rosa-escuro); cursor: pointer;
}
.previa { position: relative; }
.previa img { max-height: 110px; max-width: 70%; border-radius: 14px; border: 3px solid var(--rosa-claro); }

/* Escrever */
.escrever {
  display: flex; align-items: flex-end; gap: 7px;
  padding: 9px 9px;
  padding-bottom: max(9px, env(safe-area-inset-bottom));
  background: var(--cartao);
  border-top: 1px solid var(--rosa-claro);
}
.escrever textarea {
  flex: 1; min-width: 0; resize: none;
  border: 2px solid var(--rosa-claro); border-radius: 22px;
  padding: 10px 14px; max-height: 140px;
  font: inherit; font-size: 16px; line-height: 1.3;
  outline: none; background: var(--fundo); color: var(--texto);
}
.escrever textarea:focus { border-color: var(--rosa); }
.botao-redondo {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  border: 0; display: flex; align-items: center; justify-content: center;
  font-size: 20px; cursor: pointer; background: var(--rosa-claro);
  transition: transform .1s;
}
.botao-redondo:active { transform: scale(1.18); }
.botao-enviar { background: linear-gradient(135deg, var(--rosa), var(--lilas)); color: #fff; }

/* Folha de ações e janelas */
.fundo-escuro {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(40, 15, 30, .45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: aparecer .15s ease-out;
}
.folha {
  width: 100%; max-width: 480px;
  background: var(--cartao); border-radius: 22px 22px 0 0;
  padding: 12px 12px max(14px, env(safe-area-inset-bottom));
  animation: subirFolha .2s ease-out;
}
.folha > button {
  display: block; width: 100%; padding: 14px; margin-top: 6px;
  border: 0; border-radius: 14px; background: var(--fundo);
  font-size: 16px; text-align: left; cursor: pointer;
}
.folha > button.perigo { color: #d12a5a; }
.folha > button.cancelar { text-align: center; font-weight: 700; background: var(--rosa-claro); }
.emojis-rapidos { display: flex; justify-content: center; padding: 4px 0 6px; }
.emojis-rapidos button {
  width: 56px; height: 56px; border-radius: 50%;
  border: 0; background: var(--fundo); font-size: 30px; cursor: pointer;
}
.emojis-rapidos button.ativo { background: var(--rosa-claro); box-shadow: inset 0 0 0 2px var(--rosa); }

#modal-senha { align-items: center; padding: 20px; }
.janela {
  width: 100%; max-width: 380px;
  background: var(--cartao); border-radius: 22px; padding: 22px;
  animation: aparecer .15s ease-out;
}
.janela h2 { margin: 0 0 16px; font-size: 19px; color: var(--rosa-escuro); }
.botoes { display: flex; gap: 10px; margin-top: 8px; }
.botoes button {
  flex: 1; padding: 12px; border: 0; border-radius: 14px; cursor: pointer;
  font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--rosa), var(--lilas));
}
.botoes button.secundario { background: var(--rosa-claro); color: var(--rosa-escuro); }

/* Foto grande */
.zoom {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(25, 8, 18, .94);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.zoom img { max-width: 96vw; max-height: 92vh; border-radius: 10px; }

/* Aviso rápido */
.toast {
  position: fixed; left: 50%; bottom: 96px; z-index: 70;
  transform: translate(-50%, 10px); opacity: 0;
  max-width: 88vw; padding: 10px 16px; border-radius: 14px;
  background: rgba(50, 20, 35, .92); color: #fff; font-size: 14px; text-align: center;
  transition: opacity .25s, transform .25s;
}
.toast.mostrar { opacity: 1; transform: translate(-50%, 0); }

/* Chuva de corações */
.coracoes { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.voa {
  position: absolute; bottom: -50px;
  animation-name: subir; animation-timing-function: ease-in; animation-fill-mode: forwards;
}

/* Animações */
@keyframes subir {
  0%   { transform: translateY(0) rotate(0); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translateY(-112vh) rotate(25deg); opacity: 0; }
}
@keyframes batida { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.18); } 60% { transform: scale(.95); } }
@keyframes pop {
  0%   { transform: translate(-50%, -50%) scale(.2); opacity: 0; }
  40%  { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -95%) scale(1); opacity: 0; }
}
@keyframes entrar { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes subirFolha { from { transform: translateY(40px); } to { transform: none; } }
@keyframes piscar { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
@keyframes pulo { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }
@keyframes destaque { 0%, 100% { box-shadow: var(--sombra); } 30% { box-shadow: 0 0 0 4px rgba(255,111,145,.55); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .coracoes { display: none; }
}

/* Modo escuro */
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #1d1420;
    --cartao: #2a1d2c;
    --texto: #f5e9ef;
    --cinza: #b49aa8;
    --rosa-claro: #3d2737;
    --balao-outro: #33243a;
    --sombra: 0 1px 4px rgba(0,0,0,.35);
  }
  .tela-login { background: linear-gradient(135deg, #3a1f30, #1d1420 55%, #2a2140); }
  .erro { background: #4a1f2e; color: #ffc2d1; }
  .dias-juntos { background: rgba(42, 29, 44, .9); color: #ff9db6; }
  .aviso-conexao { background: #4a3c12; color: #ffe08a; }
  .msg.apagada .balao { border-color: #4d3747; }
  .msg.eu.lida .check { color: #3b0f82; }
  body.pagina-chat { background: #140d16; }
}
