:root {
  --bg: #0e1621;
  --panel: #17212b;
  --panel2: #1c2733;
  --line: #101921;
  --txt: #ffffff;
  --muted: #708499;
  --accent: #5288c1;
  --accent2: #64b5ef;
  --bubble-in: #182533;
  --bubble-out: #2b5278;
  --danger: #e5484d;
  --ok: #4dcd5e;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior: none;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 18px; font-size: 13px; margin-top: 10px; text-align: center; }
.ic { width: 24px; height: 24px; display: block; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ---------- LOGIN ---------- */
.auth {
  align-items: center; justify-content: center; padding: 24px; overflow: hidden;
  background: radial-gradient(140% 90% at 50% -20%, #2f6fb0 0%, #1b2b3d 42%, #0e1621 100%);
}
.auth-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.auth-bg .b {
  position: absolute; border-radius: 50%; opacity: .16;
  background: linear-gradient(135deg, #7cc4f5, #3f72af);
  animation: float 9s ease-in-out infinite;
}
.auth-bg .b1 { width: 130px; height: 130px; left: -34px; top: 10%; }
.auth-bg .b2 { width: 72px; height: 72px; right: 9%; top: 7%; opacity: .12; animation-delay: 1.4s; }
.auth-bg .b3 { width: 170px; height: 170px; right: -46px; bottom: 8%; opacity: .1; animation-delay: .8s; }
.auth-bg .b4 { width: 92px; height: 92px; left: 8%; bottom: 16%; opacity: .09; animation-delay: 2.1s; }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-24px) } }
.auth-card {
  position: relative; width: 100%; max-width: 380px;
  background: rgba(23,33,43,.74);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 24px; padding: 28px 22px 22px;
  backdrop-filter: blur(16px);
  box-shadow: 0 26px 70px rgba(0,0,0,.5);
  animation: rise .5s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.brand { text-align: center; margin-bottom: 22px; }
.logo {
  width: 106px; height: 106px; margin: 0 auto 14px; border-radius: 30px;
  background: linear-gradient(135deg, rgba(124,196,245,.22), rgba(63,114,175,.22));
  border: 1px solid rgba(255,255,255,.10);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 16px 40px rgba(63,114,175,.45);
}
.logo svg { width: 82px; height: 82px; filter: drop-shadow(0 8px 14px rgba(0,0,0,.35)); }
.brand h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: .4px; }
.brand-tag { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; color: var(--muted); }
.brand-tag .ic { width: 14px; height: 14px; color: var(--accent2); }
#authForm { display: flex; flex-direction: column; gap: 11px; }
.field {
  display: flex; align-items: center; gap: 10px;
  background: rgba(12,20,28,.7);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px; padding: 0 14px;
}
.field .ic { color: var(--muted); width: 20px; height: 20px; flex: 0 0 auto; }
.field input {
  flex: 1; border: none; background: none; color: var(--txt);
  padding: 15px 0; font-size: 16px; outline: none;
}
.field:focus-within { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(100,181,239,.15); }
.primary {
  margin-top: 4px; padding: 15px; border: none; border-radius: 14px;
  background: linear-gradient(135deg, #64b5ef, #5288c1);
  color: #fff; font-size: 16px; font-weight: 600; letter-spacing: .2px;
  box-shadow: 0 10px 24px rgba(82,136,193,.35);
}
.primary:active { transform: translateY(1px); }
.link { align-self: center; margin-top: 16px; background: none; border: none; color: var(--accent2); font-size: 14px; }
.avatar-picker {
  width: 92px; height: 92px; margin: 2px auto 6px; border-radius: 50%;
  background: rgba(12,20,28,.7); border: 2px dashed rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  cursor: pointer; text-align: center; color: var(--muted); font-size: 10px; line-height: 1.25;
}
.avatar-picker.filled { border-style: solid; border-color: var(--accent2); }
.avatar-picker img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-picker .ic { width: 22px; height: 22px; margin: 0 auto 2px; }

/* ---------- TOPBAR / LISTA ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(12px + var(--safe-top)) 12px 12px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar .title { flex: 1; font-size: 19px; font-weight: 600; }
.icon-btn {
  background: none; border: none; color: var(--muted); padding: 8px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:active { background: rgba(255,255,255,.06); }
.list { flex: 1; overflow-y: auto; padding: 6px 0 calc(70px + var(--safe-bottom)); }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.row:active { background: var(--panel2); }
.avatar {
  width: 50px; height: 50px; border-radius: 50%; flex: 0 0 auto; position: relative;
  background: linear-gradient(135deg, #64b5ef, #5288c1);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 17px; color: #fff; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar .dot { position: absolute; right: 0; bottom: 1px; width: 13px; height: 13px; border-radius: 50%; background: var(--ok); border: 2px solid var(--panel); }
.avatar.sm { width: 38px; height: 38px; font-size: 14px; }
.row .info { flex: 1; min-width: 0; }
.row .name { font-weight: 600; display: flex; align-items: baseline; gap: 6px; }
.row .name small { color: var(--muted); font-weight: 400; font-size: 11px; }
.row .preview { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { background: var(--accent); color: #fff; border-radius: 12px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 46px 24px; font-size: 14px; }
.empty .ic { width: 46px; height: 46px; margin: 0 auto 12px; opacity: .4; }
.bottomnav { display: flex; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom); }
.tab { flex: 1; background: none; border: none; color: var(--muted); padding: 9px; display: flex; flex-direction: column; gap: 3px; align-items: center; font-size: 11px; }
.tab.active { color: var(--accent2); }

/* ---------- CHAT ---------- */
.chat {
  background: var(--bg);
  background-image: radial-gradient(rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: 22px 22px;
}
.chat-top { padding-left: 4px; }
.chat-top .peer { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.peer-txt { display: flex; flex-direction: column; min-width: 0; }
.peer-name { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peer-sub { font-size: 12px; color: var(--muted); height: 14px; }
.messages { flex: 1; overflow-y: auto; padding: 12px 10px 18px; display: flex; flex-direction: column; }
.daysep { align-self: center; margin: 12px 0 6px; font-size: 12px; color: #cdd8e6; background: rgba(0,0,0,.30); padding: 3px 12px; border-radius: 12px; }

.bubble {
  position: relative; max-width: 82%; margin-top: 3px;
  padding: 7px 11px 5px; border-radius: 15px; font-size: 15px; line-height: 1.38;
  word-wrap: break-word; white-space: pre-wrap; box-shadow: 0 1px 1px rgba(0,0,0,.14);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.bubble.in { align-self: flex-start; background: var(--bubble-in); border-bottom-left-radius: 6px; }
.bubble.out { align-self: flex-end; background: var(--bubble-out); border-bottom-right-radius: 6px; }
.bubble.first { margin-top: 10px; }
.bubble.group.in { border-bottom-left-radius: 15px; }
.bubble.group.out { border-bottom-right-radius: 15px; }
.bubble .btext p { margin: 0; }
.bmeta { display: flex; align-items: center; justify-content: flex-end; gap: 3px; margin-top: 2px; min-height: 12px; }
.btime { font-size: 10.5px; color: rgba(255,255,255,.55); }
.bubble.in .btime { color: var(--muted); }
.bmeta .ic { width: 13px; height: 13px; color: rgba(255,255,255,.65); }
.bubble .sender { font-size: 11px; font-weight: 700; letter-spacing: .2px; margin-bottom: 2px; }
.bubble.in .sender { color: var(--accent2); }
.bubble.out .sender { color: #cfe9ff; }
.bubble.undecryptable { font-style: italic; opacity: .65; }

/* midia */
.bubble.media { padding: 4px 4px 5px; width: fit-content; max-width: 82%; }
.bubble.media .cap { padding: 5px 7px 1px; }
.bubble .media-body { display: block; border-radius: 12px; overflow: hidden; }
.bubble img.media-img { display: block; max-width: 300px; max-height: 340px; width: auto; height: auto; }
.media-placeholder {
  width: 230px; height: 150px; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 8px; background: rgba(0,0,0,.22); color: #cfd9e6; font-size: 12px;
}
.media-placeholder.audio { width: 250px; height: 54px; flex-direction: row; }
.media-file { display: flex; align-items: center; gap: 10px; padding: 8px; width: 250px; }
.media-file .fi { width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.media-file .fmeta { flex: 1; min-width: 0; }
.media-file .fname { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-file .fsize { font-size: 11px; opacity: .7; }
.media-file .fdl { color: inherit; opacity: .85; }
.bubble audio { display: block; width: 250px; height: 40px; }
.bubble video.media-video { display: block; max-width: 300px; max-height: 360px; border-radius: 12px; background: #000; }

.composer-wrap { background: var(--panel); border-top: 1px solid var(--line); }
.composer { display: flex; gap: 4px; align-items: center; padding: 8px 8px calc(8px + var(--safe-bottom)); }
.composer input { flex: 1; border: none; background: var(--panel2); color: var(--txt); padding: 12px 14px; border-radius: 20px; font-size: 16px; outline: none; }
.round-send { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--accent2); color: #fff; display: flex; align-items: center; justify-content: center; }
.round-send:active { background: var(--accent); }

/* ---------- SHEET (anexos) ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 30; }
.sheet {
  position: fixed; left: 8px; right: 8px; bottom: calc(8px + var(--safe-bottom));
  background: var(--panel); border-radius: 18px; padding: 8px; z-index: 31;
  display: flex; flex-direction: column; gap: 2px; animation: rise .2s ease;
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
}
.sheet button {
  display: flex; align-items: center; gap: 14px; background: none; border: none;
  color: var(--txt); font-size: 16px; padding: 15px 14px; border-radius: 12px; text-align: left;
}
.sheet button:active { background: var(--panel2); }
.sheet .ic { color: var(--accent2); }
.sheet button.danger { color: var(--danger); }
.sheet button.danger .ic { color: var(--danger); }
.sheet-note { font-size: 12px; color: var(--muted); padding: 2px 14px 10px; }
.sheet-title { font-size: 13px; color: var(--muted); padding: 12px 14px 6px; }
.forward-list { max-height: 46vh; overflow-y: auto; }
.forward-list .row { padding: 10px 14px; }

/* barra de resposta */
.reply-bar {
  display: flex; align-items: center; gap: 8px;
  margin: 8px 8px 0; padding: 7px 10px;
  background: var(--panel2); border-left: 3px solid var(--accent2); border-radius: 10px;
}
.rb-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rb-label { color: var(--accent2); font-size: 12px; font-weight: 600; }
.bmeta .edited { font-size: 10px; color: var(--muted); margin-right: 6px; font-style: italic; }
.bubble.out .bmeta .edited { color: rgba(255,255,255,.6); }
#replyName { color: var(--accent2); font-size: 12px; font-weight: 600; }
#replyPreview { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* citacao dentro do balao */
.quote {
  border-left: 3px solid var(--accent2); background: rgba(0,0,0,.20);
  padding: 4px 8px; margin-bottom: 5px; border-radius: 6px; max-width: 100%;
}
.bubble.out .quote { border-left-color: #bfe0ff; }
.quote .qn { color: var(--accent2); font-size: 12px; font-weight: 600; }
.bubble.out .quote .qn { color: #bfe0ff; }
.quote .qp { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- GRAVACAO ---------- */
.record { background: #05080f; align-items: center; justify-content: center; }
.record #recordPreview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #05080f; }
.rec-audio { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.rec-wave { display: flex; align-items: flex-end; gap: 5px; height: 46px; }
.rec-wave span { width: 6px; background: var(--accent2); border-radius: 3px; animation: wav .9s ease-in-out infinite; }
.rec-wave span:nth-child(2){ animation-delay:.15s } .rec-wave span:nth-child(3){ animation-delay:.3s }
.rec-wave span:nth-child(4){ animation-delay:.45s } .rec-wave span:nth-child(5){ animation-delay:.6s }
@keyframes wav { 0%,100% { height: 12px } 50% { height: 44px } }
.rec-time { font-size: 26px; font-weight: 700; }
.rec-actions { position: absolute; bottom: calc(40px + var(--safe-bottom)); left: 0; right: 0; display: flex; justify-content: center; gap: 60px; z-index: 2; }
.round { width: 62px; height: 62px; border-radius: 50%; border: none; background: rgba(255,255,255,.16); color: #fff; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(6px); }
.round.send { background: var(--accent2); } .round.hang { background: var(--danger); } .round.accept { background: var(--ok); }
.round.active { background: rgba(255,255,255,.42); }

/* ---------- CHAMADA ---------- */
.call { background: #05080f; }
.call #remoteVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.call #localVideo { position: absolute; top: calc(14px + var(--safe-top)); right: 14px; width: 30%; max-width: 150px; border-radius: 14px; object-fit: cover; border: 1px solid var(--line); transform: scaleX(-1); z-index: 2; }
.call-info { position: absolute; top: calc(20px + var(--safe-top)); left: 0; right: 0; text-align: center; font-size: 15px; color: #cbd6ee; z-index: 2; }
.call-actions { position: absolute; bottom: calc(28px + var(--safe-bottom)); left: 0; right: 0; display: flex; justify-content: center; gap: 22px; z-index: 2; }
.incoming { align-items: center; justify-content: center; background: rgba(5,8,15,.96); }
.incoming-box { text-align: center; padding: 24px; }
.incoming-name { font-size: 22px; font-weight: 700; margin: 14px 0 4px; }
.pulse { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto; background: linear-gradient(135deg, #64b5ef, #5288c1); display: flex; align-items: center; justify-content: center; animation: pulse 1.6s ease-in-out infinite; }
.pulse .ic { width: 40px; height: 40px; color: #fff; }
@keyframes pulse { 0%,100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(100,181,239,.5); } 50% { transform: scale(1.06); box-shadow: 0 0 0 18px rgba(100,181,239,0); } }
.incoming-actions { display: flex; justify-content: center; gap: 40px; margin-top: 26px; }

/* ---------- VIEWER / TOAST ---------- */
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.94); z-index: 60; display: flex; align-items: center; justify-content: center; }
.viewer img { max-width: 96%; max-height: 92%; border-radius: 10px; }
.viewer-close { position: absolute; top: calc(16px + var(--safe-top)); right: 16px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.14); border: none; color: #fff; display: flex; align-items: center; justify-content: center; }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translateX(-50%); background: #000; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 70; max-width: 90%; text-align: center; }

/* ---------- status das mensagens (ticks) ---------- */
.bmeta .ic.tick { width: 15px; height: 15px; color: rgba(255,255,255,.6); }
.bmeta .ic.tick.read { color: #4fc3f7; }

/* ---------- FAB (novo post) ---------- */
.fab {
  position: fixed; right: 18px; bottom: calc(84px + var(--safe-bottom));
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, #64b5ef, #3f72af); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(63,114,175,.5); z-index: 20;
}
.fab .ic { width: 26px; height: 26px; }

/* ---------- Posts ---------- */
.post-card { margin: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.post-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.post-head .info { flex: 1; min-width: 0; }
.post-head .name { font-weight: 600; font-size: 15px; }
.post-head .time { font-size: 11px; color: var(--muted); }
.post-body { padding: 0 12px 12px; }
.post-text { white-space: pre-wrap; word-wrap: break-word; font-size: 15px; line-height: 1.4; }
.post-media { display: block; width: 100%; max-height: 420px; object-fit: cover; background: #000; }
.post-del { color: var(--muted); background: none; border: none; padding: 6px; }
.post-exp { font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; }
.post-exp .ic { width: 12px; height: 12px; }
.post-textarea {
  width: calc(100% - 28px); margin: 0 14px; min-height: 90px; resize: none;
  background: var(--panel2); color: var(--txt); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; font-size: 15px; font-family: inherit; outline: none;
}
.post-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px 14px; }
.post-pick { display: inline-flex; align-items: center; gap: 8px; color: var(--accent2); font-size: 14px; padding: 10px 12px; border-radius: 12px; background: var(--panel2); }
.post-pick .ic { width: 20px; height: 20px; }
.post-pub { margin-left: auto; padding: 12px 22px; }

/* ---------- Alerta estilo Dynamic Island ---------- */
.banner {
  position: fixed; top: calc(10px + var(--safe-top)); left: 50%;
  transform: translateX(-50%) translateY(-130%);
  width: min(92%, 420px);
  background: rgba(8,10,14,.94); backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.09); border-radius: 22px;
  padding: 10px 14px; display: flex; align-items: center; gap: 12px;
  z-index: 80; box-shadow: 0 16px 44px rgba(0,0,0,.55);
  opacity: 0; transition: transform .45s cubic-bezier(.2,.9,.25,1), opacity .35s;
}
.banner.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.banner-badge { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #64b5ef, #3f72af); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.banner-badge .ic { width: 20px; height: 20px; color: #fff; }
.banner-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#bannerName { font-weight: 600; font-size: 14px; }
#bannerMsg { font-size: 13px; color: #c9d3e0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Desktop / WhatsApp Web (dois paineis) ---------- */
.chat-empty { display: none; }

@media (min-width: 900px) {
  body { display: grid; grid-template-columns: 380px minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }

  .screen.app  { position: relative; inset: auto; height: 100vh; height: 100dvh; border-right: 1px solid var(--line); }
  .screen.chat { position: relative; inset: auto; height: 100vh; height: 100dvh; }
  .screen.auth, .screen.call, .screen.record, .screen.incoming { position: fixed; }

  #backBtn { display: none; }
  .list { padding-bottom: 10px; }
  .bottomnav { flex: 0 0 auto; }

  .chat-empty {
    grid-column: 2; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; height: 100vh; height: 100dvh; color: var(--muted); text-align: center; padding: 24px;
    background: var(--bg);
    background-image: radial-gradient(rgba(255,255,255,.022) 1px, transparent 1px);
    background-size: 22px 22px;
  }
  .chat-empty.hidden { display: none !important; }
  .ce-logo { width: 86px; height: 86px; border-radius: 50%; background: var(--panel); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
  .ce-logo .ic { width: 42px; height: 42px; color: var(--accent2); }
  .chat-empty h3 { margin: 0; color: var(--txt); font-weight: 600; font-size: 18px; }
  .chat-empty p { margin: 0; font-size: 14px; }
}

/* ---------- Perfil ---------- */
.profile-btn { background: none; border: none; padding: 0; margin-right: 10px; }
.profile-btn .avatar { width: 38px; height: 38px; font-size: 14px; }
.profile-name { width: calc(100% - 28px); margin: 10px 14px 6px; background: var(--panel2); color: var(--txt); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 15px; outline: none; }
.profile-email { margin: 0 14px 4px; color: var(--muted); font-size: 13px; }
.ghost-btn { background: none; border: 1px solid var(--line); color: var(--txt); padding: 12px 22px; border-radius: 12px; font-size: 15px; }
#profileSheet .avatar-picker { margin: 6px auto 8px; }

/* ---------- Emojis ---------- */
.emoji-panel { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; max-height: 220px; overflow-y: auto; background: var(--panel); border-top: 1px solid var(--line); }
.emoji-panel button { font-size: 24px; line-height: 1; background: none; border: none; padding: 7px 0; border-radius: 9px; cursor: pointer; }
.emoji-panel button:active { background: var(--panel2); }

.emoji { display: inline-block; }
.btext.emoji-only { line-height: 1.15; }
.btext.emoji-only .emoji { font-size: 42px; }
.btext.emoji-only.count-1 .emoji { font-size: 54px; }
.btext.emoji-only.count-2 .emoji { font-size: 46px; }

@keyframes e-bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-9px)} }
@keyframes e-pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.2)} }
@keyframes e-clap { 0%,100%{transform:scale(1) rotate(0)} 25%{transform:scale(1.15) rotate(-9deg)} 75%{transform:scale(1.15) rotate(9deg)} }
@keyframes e-wave { 0%,100%{transform:rotate(0)} 20%{transform:rotate(16deg)} 40%{transform:rotate(-10deg)} 60%{transform:rotate(12deg)} 80%{transform:rotate(-6deg)} }
@keyframes e-laugh { 0%,100%{transform:rotate(0) translateY(0)} 25%{transform:rotate(-9deg) translateY(-3px)} 75%{transform:rotate(9deg) translateY(-3px)} }
@keyframes e-cry { 0%,100%{transform:translateY(0)} 50%{transform:translateY(4px) scale(1.06)} }
@keyframes e-flicker { 0%,100%{transform:scale(1); filter:brightness(1)} 50%{transform:scale(1.16); filter:brightness(1.35)} }
@keyframes e-party { 0%,100%{transform:rotate(0) scale(1)} 25%{transform:rotate(-14deg) scale(1.12)} 75%{transform:rotate(14deg) scale(1.12)} }
@keyframes e-flash { 0%,100%{opacity:1; transform:scale(1)} 50%{opacity:.5; transform:scale(1.14)} }
@keyframes e-spin { 0%{transform:rotate(0)} 100%{transform:rotate(360deg)} }
@keyframes e-flex { 0%,100%{transform:scale(1)} 50%{transform:scale(1.24) rotate(-5deg)} }
@keyframes e-pop { 0%,100%{transform:scale(1)} 40%{transform:scale(1.28)} 70%{transform:scale(.94)} }
@keyframes e-shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }
@keyframes e-tilt { 0%,100%{transform:rotate(0)} 50%{transform:rotate(-11deg)} }

.emoji.a-bounce { animation: e-bounce 1s ease-in-out infinite; }
.emoji.a-pulse  { animation: e-pulse 1.2s ease-in-out infinite; }
.emoji.a-clap   { animation: e-clap 1s ease-in-out infinite; }
.emoji.a-wave   { animation: e-wave 1.4s ease-in-out infinite; }
.emoji.a-laugh  { animation: e-laugh .9s ease-in-out infinite; }
.emoji.a-cry    { animation: e-cry 1.4s ease-in-out infinite; }
.emoji.a-flicker{ animation: e-flicker .8s ease-in-out infinite; }
.emoji.a-party  { animation: e-party 1.1s ease-in-out infinite; }
.emoji.a-flash  { animation: e-flash .9s ease-in-out infinite; }
.emoji.a-spin   { animation: e-spin 3s linear infinite; }
.emoji.a-flex   { animation: e-flex 1.1s ease-in-out infinite; }
.emoji.a-pop    { animation: e-pop 1.3s ease-in-out infinite; }
.emoji.a-shake  { animation: e-shake .5s ease-in-out infinite; }
.emoji.a-tilt   { animation: e-tilt 1.6s ease-in-out infinite; }

/* ---------- chamada de voz (avatar central) ---------- */
.call-avatar { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; z-index: 2; }
.avatar.big { width: 120px; height: 120px; font-size: 40px; border-radius: 50%; }
.call-name { font-size: 22px; font-weight: 600; }

/* ===================== EFEITOS ===================== */
@keyframes popIn { 0% { opacity: 0; transform: translateY(8px) scale(.96); } 100% { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slideInRight { from { opacity: .3; transform: translateX(9%); } to { opacity: 1; transform: none; } }
@keyframes sheetUp { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes glowPulse { 0%,100% { box-shadow: 0 6px 18px rgba(82,136,193,.35); } 50% { box-shadow: 0 6px 26px rgba(100,181,239,.75); } }
@keyframes fabPulse { 0%,100% { box-shadow: 0 8px 22px rgba(63,114,175,.5), 0 0 0 0 rgba(100,181,239,.5); } 50% { box-shadow: 0 8px 30px rgba(63,114,175,.7), 0 0 0 12px rgba(100,181,239,0); } }
@keyframes onlinePulse { 0%,100% { box-shadow: 0 0 0 0 rgba(77,205,94,.65); } 50% { box-shadow: 0 0 0 5px rgba(77,205,94,0); } }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

body { background-image: radial-gradient(1200px 500px at 50% -10%, rgba(63,114,175,.18), transparent 60%); }

/* topbar com gradiente */
.topbar { background: linear-gradient(180deg, #1c2937 0%, var(--panel) 100%); }

/* barra inferior com leve degradê e transição */
.bottomnav { background: linear-gradient(0deg, #141d27 0%, var(--panel) 100%); }
.tab { transition: transform .12s ease, color .2s ease; }
.tab:active { transform: scale(.9); }
.tab.active { filter: drop-shadow(0 0 8px rgba(100,181,239,.5)); }

/* login: borda animada + titulo brilhante + logo flutuante */
.auth-card { position: relative; }
.auth-card::before {
  content: ''; position: absolute; inset: -1px; border-radius: 25px; padding: 1px;
  background: linear-gradient(120deg, rgba(100,181,239,.7), rgba(139,92,246,.5), rgba(100,181,239,.7));
  background-size: 300% 300%; animation: gradientShift 6s ease infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.auth .logo { animation: floatY 4s ease-in-out infinite; }
.brand h1 {
  background: linear-gradient(90deg, #bfe0ff, #64b5ef, #bfe0ff); background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 3s linear infinite;
}

/* botoes */
.primary { transition: transform .12s ease, box-shadow .25s ease; }
.primary:active { transform: scale(.97); }
.round-send { transition: transform .12s ease, box-shadow .25s ease; }
.round-send:active { transform: scale(.88); }
.round-send:not(.hidden) { animation: glowPulse 2.4s ease-in-out infinite; }
.round:active { transform: scale(.9); }
.fab { animation: fabPulse 2.8s ease-in-out infinite; }

/* avatar/online */
.avatar .dot { animation: onlinePulse 1.8s ease-in-out infinite; }

/* mensagens: entrada dos baloes */
.bubble.appear { animation: popIn .22s cubic-bezier(.2,.9,.25,1) both; }

/* telas / sheets / toast */
.screen.chat { animation: slideInRight .22s ease; }
.sheet { animation: sheetUp .26s cubic-bezier(.2,.9,.25,1); }
.toast { animation: fadeUp .25s ease; }

/* posts */
.post-card { animation: fadeUp .28s ease both; transition: transform .18s ease, box-shadow .25s ease; }

/* hover (desktop) */
@media (hover: hover) and (min-width: 900px) {
  .row { border-radius: 12px; transition: background .15s ease, transform .12s ease; }
  .row:hover { background: var(--panel2); transform: translateX(2px); }
  .post-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(0,0,0,.35); }
  .icon-btn:hover { background: rgba(255,255,255,.08); color: var(--txt); }
  .primary:hover { box-shadow: 0 12px 28px rgba(82,136,193,.55); }
  .bubble { transition: box-shadow .2s ease; }
  .bubble:hover { box-shadow: 0 3px 10px rgba(0,0,0,.25); }
}

/* botao trocar camera na gravacao */
.rec-flip { position: absolute; top: calc(14px + var(--safe-top)); right: 14px; z-index: 3; width: 48px; height: 48px; }

/* ===================== SCROLLBARS ELEGANTES ===================== */
* { scrollbar-width: thin; scrollbar-color: #3a5678 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #3f5f86, #2b3b52); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #64b5ef, #3f5f86); background-clip: content-box; }
*::-webkit-scrollbar-corner { background: transparent; }

.tagblocked { color: var(--danger) !important; margin-left: 6px; font-weight: 600; }

/* ===================== MAIS EFEITOS ===================== */
@keyframes sweep { 0% { left: -60%; } 100% { left: 130%; } }
.primary { position: relative; overflow: hidden; }
.primary::after { content: ''; position: absolute; top: 0; bottom: 0; width: 38%; left: -60%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent); transform: skewX(-20deg); animation: sweep 3.4s ease-in-out infinite; }

.avatar { transition: box-shadow .25s ease, transform .2s ease; }
@keyframes ringPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(100,181,239,.35); } 50% { box-shadow: 0 0 0 3px rgba(100,181,239,.08); } }
.profile-btn .avatar { animation: ringPulse 3s ease-in-out infinite; }
@keyframes floatSoft { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.fab .ic { animation: floatSoft 2.4s ease-in-out infinite; }

.tab.active .ic { filter: drop-shadow(0 0 6px rgba(100,181,239,.85)); }
.messages { scroll-behavior: smooth; }
.post-media { transition: transform .35s ease; }
.bubble.out .btext p { text-shadow: 0 1px 1px rgba(0,0,0,.18); }

@keyframes dash { to { background-position: 200% 0; } }
.chat-top { background: linear-gradient(90deg, #1c2937, #24354b, #1c2937); background-size: 200% 100%; animation: dash 9s linear infinite; }

@keyframes glowText { 0%,100% { text-shadow: 0 0 0 rgba(100,181,239,0); } 50% { text-shadow: 0 0 12px rgba(100,181,239,.55); } }
.brand h1 { animation: shimmer 3s linear infinite, glowText 3s ease-in-out infinite; }

@media (hover: hover) and (min-width: 900px) {
  .avatar:hover { box-shadow: 0 0 0 3px rgba(100,181,239,.5); transform: scale(1.06); }
  .post-card:hover .post-media { transform: scale(1.03); }
}

/* ===================== INSTALAR PWA ===================== */
.install-prompt {
  position: fixed; left: 10px; right: 10px; bottom: calc(12px + var(--safe-bottom)); z-index: 85;
  display: flex; align-items: center; gap: 12px;
  background: rgba(15,22,33,.96); border: 1px solid rgba(100,181,239,.35);
  border-radius: 18px; padding: 12px; box-shadow: 0 18px 44px rgba(0,0,0,.55);
  animation: sheetUp .3s ease;
}
.ip-logo { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg,#64b5ef,#3f72af); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 22px; color: #fff; flex: 0 0 auto; }
.ip-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ip-txt b { font-size: 14px; }
.ip-txt span { font-size: 12px; color: var(--muted); }
.ip-btn { padding: 10px 16px !important; margin: 0 !important; }
@media (min-width: 900px) { .install-prompt { left: auto; right: 20px; max-width: 380px; } }

/* ===================== LOCALIZACAO (ADMIN) ===================== */
.admin-loc { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 6px 14px 4px; width: calc(100% - 28px); }
.admin-loc .ic { width: 18px; height: 18px; }
.loc-list { max-height: 52vh; overflow-y: auto; padding: 4px 0 8px; }
.loc-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.loc-info { flex: 1; min-width: 0; }
.loc-info .name { font-weight: 600; font-size: 14px; }
.loc-coord { font-size: 12px; color: var(--muted); }
.loc-map { padding: 8px 14px; font-size: 13px; text-decoration: none; }

/* ===================== SOBRE O DESENVOLVEDOR ===================== */
.dev-info { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; background: rgba(100,181,239,.12); border: 1px solid rgba(100,181,239,.35); color: var(--accent2); padding: 8px 14px; border-radius: 20px; font-size: 12px; transition: transform .12s ease; }
.dev-info .ic { width: 15px; height: 15px; }
.dev-info:active { transform: scale(.96); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(5px); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 24px; animation: fadeUp .2s ease; }
.modal-card { position: relative; width: 100%; max-width: 360px; background: linear-gradient(180deg, #1b2733, #141d27); border: 1px solid rgba(255,255,255,.09); border-radius: 22px; padding: 26px 22px 22px; text-align: center; box-shadow: 0 26px 70px rgba(0,0,0,.6); animation: sheetUp .3s ease; }
.modal-close { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,.08); border: none; color: var(--txt); width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.dev-photo { width: 108px; height: 108px; border-radius: 50%; object-fit: cover; margin: 0 auto 12px; display: block; border: 3px solid rgba(100,181,239,.6); box-shadow: 0 10px 30px rgba(63,114,175,.5); animation: floatY 4s ease-in-out infinite; }
.modal-card h3 { margin: 0 0 4px; font-size: 20px; }
.dev-role { margin: 0 0 16px; color: var(--accent2); font-size: 13px; font-weight: 600; }
.dev-links { display: flex; flex-direction: column; gap: 10px; }
.dev-link { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; color: var(--txt); text-decoration: none; font-size: 14px; }
.dev-link:active { transform: scale(.98); }
.dev-link .ic { width: 18px; height: 18px; color: var(--accent2); }
.dev-brand { margin-top: 16px; font-size: 12px; color: var(--muted); letter-spacing: 3px; text-transform: uppercase; }

/* ===================== FAB INSTALAR (LOGIN) ===================== */
.auth-install-fab {
  position: absolute; top: calc(16px + var(--safe-top)); right: 16px; z-index: 6;
  width: 58px; height: 58px; border: none; border-radius: 50%;
  background: linear-gradient(135deg,#64b5ef,#3f72af); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 30px rgba(63,114,175,.65);
  animation: fabBob 2.6s ease-in-out infinite;
}
.auth-install-fab .ic { width: 26px; height: 26px; position: relative; z-index: 2; animation: floatSoft 2.4s ease-in-out infinite; }
.auth-install-fab .fab-ring { position: absolute; inset: -4px; border-radius: 50%; border: 2px solid rgba(100,181,239,.75); animation: ringExpand 2s ease-out infinite; }
.auth-install-fab::before {
  content: ''; position: absolute; inset: -4px; border-radius: 50%; padding: 3px;
  background: conic-gradient(from 0deg, #64b5ef, transparent 35%, #8b5cf6, transparent 75%, #64b5ef);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spin 3.2s linear infinite;
}
.auth-install-fab .fab-tip {
  position: absolute; top: 50%; right: calc(100% + 10px); transform: translateY(-50%);
  background: rgba(8,10,14,.92); color: #cfe9ff; border: 1px solid rgba(100,181,239,.4);
  font-size: 11px; padding: 5px 10px; border-radius: 10px; white-space: nowrap;
  animation: tipPulse 2s ease-in-out infinite;
}
@keyframes fabBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes ringExpand { 0% { transform: scale(.85); opacity: .95; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes tipPulse { 0%,100% { opacity: .7; } 50% { opacity: 1; } }

/* ===================== MAPA DE LOCALIZACAO ===================== */
#locSheet { max-height: 90vh; overflow-y: auto; }
.loc-map-box { height: 40vh; min-height: 220px; border-radius: 12px; margin: 6px 14px; overflow: hidden; background: var(--panel2); }
.loc-list { max-height: 24vh; }

/* ===================== PROMPT DE LOCALIZACAO ===================== */
.loc-refresh { float: right; color: var(--accent2) !important; }
.loc-prompt { position: fixed; left: 10px; right: 10px; bottom: calc(12px + var(--safe-bottom)); z-index: 86; display: flex; align-items: center; gap: 10px; background: rgba(15,22,33,.96); border: 1px solid rgba(100,181,239,.35); border-radius: 16px; padding: 12px; box-shadow: 0 18px 44px rgba(0,0,0,.55); animation: sheetUp .3s ease; }
.lp-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lp-txt b { font-size: 14px; }
.lp-txt span { font-size: 12px; color: var(--muted); }
@media (min-width: 900px) { .loc-prompt { left: auto; right: 20px; max-width: 380px; } }

/* ===================== MARCADORES DE PARTICIPANTES (MAPA) ===================== */
.map-avatar-marker { background: none !important; border: none !important; }
.map-avatar-marker .mam {
  width: 42px; height: 42px; border-radius: 50%; overflow: hidden;
  border: 3px solid #64b5ef; box-shadow: 0 4px 12px rgba(0,0,0,.55);
  background: linear-gradient(135deg,#64b5ef,#3f72af);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px;
}
.map-avatar-marker .mam img { width: 100%; height: 100%; object-fit: cover; }
.leaflet-tooltip.map-tip {
  background: rgba(8,10,14,.92); color: #eaf3ff; border: 1px solid rgba(100,181,239,.5);
  border-radius: 8px; font-size: 11px; font-weight: 600; padding: 3px 8px; box-shadow: none;
}
.leaflet-tooltip.map-tip:before { display: none; }
.leaflet-popup-content-wrapper { background: #17212b; color: #fff; border-radius: 12px; }
.leaflet-popup-tip { background: #17212b; }
.leaflet-popup-content a { color: #64b5ef; }
.loc-row.has-loc { cursor: pointer; }

/* lista antes do mapa, altura ajustada */
.loc-list { max-height: 30vh; }
#locSheet .loc-list { border-bottom: 1px solid var(--line); }
.loc-map-box { height: 34vh; min-height: 200px; }

/* ===================== ASSISTENTE IA ===================== */
.ai-card { max-width: 360px; }
.ai-avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; margin: 0 auto 8px; display: block; border: 3px solid rgba(100,181,239,.6); box-shadow: 0 10px 26px rgba(63,114,175,.5); }
.ai-card h3 { margin: 0 0 2px; font-size: 18px; }
.ai-sub { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.ai-input { width: 100%; min-height: 72px; resize: none; background: var(--panel2); color: var(--txt); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 15px; font-family: inherit; outline: none; }
.ai-send { width: 100%; margin-top: 10px; }
.ai-result { margin-top: 10px; font-size: 13px; text-align: left; }
.ai-result .muted { color: var(--muted); }
.ai-msg { background: rgba(43,82,120,.45); border-radius: 10px; padding: 8px 10px; margin-top: 8px; white-space: pre-wrap; }
.ai-chip { display: inline-block; margin: 6px 6px 0 0; padding: 6px 12px; border-radius: 16px; background: var(--panel2); border: 1px solid var(--accent2); color: var(--accent2); font-size: 13px; }

/* botao IA (genio) no composer */
.ai-btn { background: linear-gradient(135deg,#a855f7,#6366f1) !important; }
.ai-btn .ic { width: 24px; height: 24px; }

/* ===================== CORRETOR INTELIGENTE (input) ===================== */
.ai-suggest { display: flex; align-items: center; gap: 8px; margin: 8px 8px 0; padding: 8px 10px; background: rgba(139,92,246,.12); border: 1px solid rgba(139,92,246,.4); border-left: 3px solid #a855f7; border-radius: 10px; animation: fadeUp .2s ease; }
.ai-suggest.warn { background: rgba(229,72,77,.12); border-color: rgba(229,72,77,.5); border-left-color: var(--danger); }
.as-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.as-label { font-size: 11px; font-weight: 700; color: #c4b5fd; }
.ai-suggest.warn .as-label { color: #f2a0a3; }
#asText { font-size: 13px; color: var(--txt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-use { background: linear-gradient(135deg,#a855f7,#6366f1); border: none; color: #fff; padding: 7px 14px; border-radius: 16px; font-size: 13px; font-weight: 600; flex: 0 0 auto; }
.as-use:active { transform: scale(.95); }
.ai-suggest.warn .as-use { display: none; }
