:root {
  --bg: #0b141a;
  --bar: #1f2c34;
  --in: #202c33;
  --out: #005c4b;
  --text: #e9edef;
  --muted: #8696a0;
  --green: #25d366;
  --notice: #53bdeb;
  --notice-text: #7ad78f;
  --pill: #182229;
  --uba: #d71e28;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #000;
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  justify-content: center;
}

.phone {
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 20px 20px, rgba(255,255,255,.035) 3px, transparent 4px),
    radial-gradient(circle at 60px 70px, rgba(255,255,255,.03) 6px, transparent 7px);
  background-size: 90px 90px;
}

/* Header */
.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.back {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--bar);
  color: var(--text);
  display: grid; place-items: center;
  cursor: pointer;
}
.avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--uba);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .5px;
  display: grid; place-items: center;
  flex: none;
}
.title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.name { font-weight: 600; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.verified { flex: none; }

/* Chat */
.chat {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.day {
  align-self: center;
  background: var(--pill);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 8px;
}
.notice {
  align-self: center;
  max-width: 88%;
  text-align: center;
  background: var(--pill);
  color: var(--notice-text);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
}

.msg {
  max-width: 82%;
  padding: 7px 9px 6px;
  border-radius: 10px;
  position: relative;
  animation: pop .18s ease-out;
  overflow-wrap: anywhere;
}
.msg.out { align-self: flex-end; background: var(--out); border-top-right-radius: 3px; }
.msg.in  { align-self: flex-start; background: var(--in); border-top-left-radius: 3px; }
.msg .body { white-space: pre-line; }
.msg .meta {
  float: right;
  margin: 6px 0 -4px 12px;
  font-size: 11px;
  color: rgba(233,237,239,.6);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.msg .meta svg { color: var(--notice); }
.msg::after { content: ""; display: block; clear: both; }

.msg video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border-radius: 7px;
  background: #111b21;
  margin-bottom: 6px;
  cursor: pointer;
}
.msg.has-video { width: 88%; max-width: 88%; padding: 4px 4px 6px; }
.msg.has-video .body { display: block; padding: 0 5px; }
.msg.has-video .meta { margin-right: 5px; }

.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }

/* Composer */
.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  background: var(--bar);
}
.composer input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: 0;
  border-radius: 21px;
  background: #2a3942;
  color: var(--text);
  font-size: 16px;
  padding: 0 16px;
  outline: none;
}
.icon {
  background: none; border: 0; color: var(--text);
  width: 38px; height: 38px;
  display: grid; place-items: center;
  cursor: pointer; flex: none;
}
.send {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 0;
  background: var(--green);
  color: #0b141a;
  display: grid; place-items: center;
  cursor: pointer; flex: none;
}
.send .arrow { display: none; }
.send.ready .arrow { display: block; }
.send.ready .mic { display: none; }

@keyframes pop { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
