[hidden] { display: none !important; }
:root { --accent: #8b2cf5; --bg: #0b0b0f; --bubble: #26262c; --line: #1f1f25; --muted: #8e8e96; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body { overscroll-behavior: none; }
button { font: inherit; cursor: pointer; }

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

header { display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top)); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.av-wrap { position: relative; width: 52px; height: 52px; flex-shrink: 0; }
.av-wrap img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #222; }
.dot { position: absolute; right: 0; bottom: 0; width: 14px; height: 14px; background: #2ecc40;
  border: 2.5px solid var(--bg); border-radius: 50%; }
.h-name { display: flex; align-items: center; gap: 5px; font-weight: 700; font-size: 19px; }
.verified { display: inline-flex; }
.ai-badge { font-size: 10px; font-weight: 600; color: #c9b6ff; border: 1px solid #5b3fa0;
  padding: 1px 6px; border-radius: 8px; margin-left: 4px; }
.h-status { color: var(--muted); font-size: 14px; margin-top: 2px; }

main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 12px 8px;
  display: flex; flex-direction: column; }
main::before { content: ""; flex: 1; }
.sep { text-align: center; color: var(--muted); font-size: 12px; margin: 8px 0 18px; }

.row { display: flex; align-items: flex-end; gap: 8px; margin: 2px 0; }
.row.them .av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; visibility: hidden; }
.row.them.last .av { visibility: visible; }
.row.me { justify-content: flex-end; }
.row.gap { margin-top: 10px; }
.bubble { max-width: 75%; padding: 9px 14px; border-radius: 20px; font-size: 15.5px; line-height: 1.35;
  word-wrap: break-word; white-space: pre-wrap; animation: pop .18s ease-out; }
.them .bubble { background: var(--bubble); }
.me .bubble { background: var(--accent); }
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }

.time { font-size: 11px; color: var(--muted); margin: 3px 0 8px; }
.time.them { margin-left: 36px; }
.time.me { text-align: right; margin-right: 4px; }

.typing .bubble { display: inline-flex; gap: 4px; padding: 13px 14px; }
.typing i { width: 7px; height: 7px; background: #9a9aa3; border-radius: 50%; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.card { display: block; width: 250px; max-width: 75%; background: var(--bubble); border-radius: 18px; overflow: hidden;
  color: #fff; text-decoration: none; animation: pop .18s ease-out; }
.card img { width: 100%; height: 160px; object-fit: cover; display: block; }
.card .c-body { padding: 10px 14px 12px; }
.card .c-title { font-weight: 600; font-size: 15px; }
.card .c-domain { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card .c-btn { margin-top: 10px; background: var(--accent); text-align: center; padding: 9px; border-radius: 12px; font-weight: 600; font-size: 14px; }

footer { flex-shrink: 0; padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); }
form { display: flex; align-items: center; gap: 6px; background: #17171c; border: 1px solid #2a2a31;
  border-radius: 28px; padding: 6px 8px 6px 10px; }
.icon { background: none; border: 0; color: #e8e8ee; padding: 6px; display: flex; }
#input { flex: 1; background: none; border: 0; outline: none; color: #fff; font-size: 16px; padding: 8px 4px; min-width: 0; }
#input::placeholder { color: var(--muted); }
.send { background: none; border: 0; color: #a98bff; font-weight: 700; font-size: 16px; padding: 6px 10px; }
#emoji-panel { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; background: #17171c; border: 1px solid #2a2a31;
  border-radius: 18px; padding: 10px; margin-bottom: 8px; }
#emoji-panel[hidden] { display: none; }
#emoji-panel button { background: none; border: 0; font-size: 24px; padding: 4px; }

.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(5,5,8,.96); display: flex; align-items: center;
  justify-content: center; padding: 24px; text-align: center; }
.overlay[hidden] { display: none; }
.overlay .box { position: relative; max-width: 340px; width: 100%; }
.overlay .big { font-size: 26px; font-weight: 800; margin: 10px 0; }
.overlay p { color: #cfcfd6; font-size: 15px; line-height: 1.45; }
.overlay .small { font-size: 14px; color: var(--muted); }
.btn { display: block; width: 100%; padding: 15px; border-radius: 14px; border: 0; font-size: 16px; font-weight: 700; margin-top: 12px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: #1c1c22; color: #ddd; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; margin-top: 18px; font-size: 13px; }
.arrow { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 18px; font-size: 40px; color: #fff; animation: nudge 1s infinite; }
@keyframes nudge { 50% { transform: translate(4px, -4px); } }
.blur-bg { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(30px) brightness(.35); }
.age-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid var(--accent); }
