:root {
  color-scheme: dark;
  --bg: #090a0f;
  --panel: #111217;
  --composer: #1b1b21;
  --bubble: #1a1b22;
  --line: rgba(255, 255, 255, 0.11);
  --muted: #8c8d96;
  --text: #f6f5fb;
  --purple: #775cff;
  font-family: "DM Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: var(--bg); }
body { color: var(--text); overflow: hidden; }
button, textarea { font: inherit; }
button { color: inherit; border: 0; cursor: pointer; }

.chat-shell { min-height: 100dvh; height: 100dvh; background: var(--bg); position: relative; overflow: hidden; }
.chat-header { height: 89px; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 24px 0 18px; position: relative; z-index: 5; background: rgba(9, 10, 15, .96); }
.profile-button { position: relative; background: transparent; padding: 0; width: 64px; height: 64px; flex: 0 0 auto; }
.avatar-ring { width: 64px; height: 64px; display: block; border: 2px solid transparent; border-radius: 50%; background: linear-gradient(var(--bg), var(--bg)) padding-box, linear-gradient(135deg, #f6aa68, #a44ac9 66%, #603eda) border-box; padding: 4px; }
.avatar-ring img { display: block; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.avatar-ring.is-typing { animation: avatar-typing-pulse 1.6s ease-out infinite; }
@keyframes avatar-typing-pulse {
  0% { box-shadow: 0 0 0 0 rgba(119, 92, 255, .65); }
  70% { box-shadow: 0 0 0 8px rgba(119, 92, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(119, 92, 255, 0); }
}
.online-dot { width: 14px; height: 14px; border-radius: 50%; background: #5fb650; border: 2px solid var(--bg); position: absolute; right: -1px; bottom: 1px; }
.profile-copy { margin-left: 14px; line-height: 1.1; min-width: 0; }
.profile-copy h1 { font-size: 17px; letter-spacing: -.02em; margin: 0 0 3px; font-weight: 700; }
.profile-copy p { margin: 0; color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 6px; }
.presence-dot { width: 7px; height: 7px; border-radius: 50%; background: #5fb650; flex: 0 0 auto; }
.profile-copy p[data-state="away"] .presence-dot { display: none; }
.header-actions { margin-left: auto; display: flex; gap: 18px; align-items: center; }
.icon-button { width: 28px; height: 36px; display: grid; place-items: center; background: transparent; color: #f3f1f7; }
.icon-button svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:hover, .composer-icon:hover { color: #b9aaff; }

.chat-log { position: absolute; inset: 89px 0 92px; overflow-y: auto; padding: 0 16px 24px; scrollbar-width: thin; scrollbar-color: #292a31 transparent; }
.day-label { text-align: center; color: #a0a0aa; font-size: 13px; padding: clamp(250px, 47vh, 370px) 0 16px; }
.message-list { max-width: 840px; margin: 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.message-row { width: 100%; display: flex; align-items: flex-end; gap: 8px; animation: rise-in .22s ease-out both; }
.message-row.user { justify-content: flex-end; }
.message-avatar { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%; object-fit: cover; }
/* Same purple pulsing halo as the header avatar (see .avatar-ring.is-typing above), sized to
   wrap the small in-chat avatar instead. Only ever applied to the avatar next to the "typing…"
   bubble (see avatarMarkup(true) in app.js) — a regular, already-sent message's avatar is a
   plain <img> with no wrapper, so this never lights up on past messages. */
.message-avatar-ring { display: block; width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%; }
.message-avatar-ring .message-avatar { width: 100%; height: 100%; }
.message-avatar-ring.is-typing { animation: avatar-typing-pulse 1.6s ease-out infinite; }
.message-bubble { max-width: min(78%, 480px); min-height: 44px; padding: 11px 14px; border-radius: 20px; background: var(--bubble); color: #f1eff6; font-size: 15px; line-height: 1.35; }
.message-row.user .message-bubble { background: var(--purple); border-bottom-right-radius: 7px; }
.message-row.assistant .message-bubble { border-bottom-left-radius: 7px; }
.message-time { font-size: 11px; color: #6e707b; margin: 0 7px 4px; white-space: nowrap; }
.photo-card { min-height: 44px; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 20px; background: #27272f; padding: 6px 15px 6px 6px; color: #f4f2fa; font-weight: 600; font-size: 14px; text-align: left; cursor: pointer; overflow: hidden; }
.photo-card:hover { background: #33333d; }.photo-card:focus-visible { outline: 2px solid #a99cff; outline-offset: 2px; }
.photo-card > span { display: flex; align-items: center; gap: 8px; padding-left: 2px; }
.photo-card .play { width: 18px; height: 18px; color: var(--purple); fill: currentColor; flex: 0 0 auto; }
.photo-thumb { display: block; width: 48px; height: 56px; object-fit: cover; border-radius: 15px; }
.cta-card { position: relative; min-width: 220px; display: grid; gap: 3px; padding: 13px 38px 13px 16px; border-radius: 18px; background: linear-gradient(135deg, #292041, #20202b); color: #f5f2ff; text-decoration: none; border: 1px solid rgba(167, 145, 255, .34); }
.cta-card:hover { border-color: rgba(185, 166, 255, .8); background: linear-gradient(135deg, #352650, #262633); }
.cta-card:focus-visible { outline: 2px solid #a99cff; outline-offset: 2px; }
.cta-card .cta-kicker { color: #bab0df; font-size: 12px; }.cta-card strong { font-size: 14px; }.cta-arrow { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: #c0b0ff; font-size: 20px; }
.typing { display: inline-flex; gap: 4px; align-items: center; padding: 12px 15px; flex-wrap: wrap; }.typing-caption { width: 100%; color: #b7b5c0; font-size: 12px; margin-bottom: 2px; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: #9d9ca8; animation: blink 1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .12s; }.typing i:nth-child(3) { animation-delay: .24s; }

.composer-wrap { position: absolute; z-index: 4; left: 0; right: 0; bottom: 10px; padding: 0 16px; }
.composer { max-width: 880px; margin: 0 auto; min-height: 62px; border-radius: 32px; border: 1px solid rgba(255,255,255,.18); background: var(--composer); box-shadow: 0 4px 22px rgba(0,0,0,.22); display: flex; align-items: center; gap: 10px; padding: 7px 15px 7px 17px; }
.composer-icon { width: 30px; height: 42px; background: transparent; color: #f0eef6; display: grid; place-items: center; flex: 0 0 auto; }
.composer-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.camera-button svg { width: 24px; height: 24px; }
.message-field { flex: 1; min-width: 0; }
#message-input { display: block; width: 100%; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 16px; line-height: 1.4; max-height: 84px; padding: 7px 0; }
#message-input::placeholder { color: #92919b; }
.composer-actions { display: flex; align-items: center; gap: 5px; }
.send-button { display: none; width: 34px; height: 34px; border-radius: 50%; background: var(--purple); place-items: center; flex: 0 0 auto; }
.send-button svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.composer.has-text .send-button { display: grid; }.composer.has-text .composer-actions { display: none; }
.attachment-preview { max-width: 880px; margin: 0 auto 7px; display: flex; align-items: center; gap: 8px; color: #cac7d6; font-size: 13px; padding: 7px 14px; }
.attachment-preview strong { color: #fff; }.attachment-preview button { background: transparent; color: #a99cff; }
.attachment-preview [data-action="send-attachment"] { margin-left: auto; }
.attachment-thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex: 0 0 auto; }
.attachment-cancel { color: #cac7d6; font-size: 18px; line-height: 1; padding: 2px 4px; }

.push-banner { max-width: 880px; margin: 0 auto 10px; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 4px 18px rgba(0,0,0,.22); animation: rise-in .22s ease-out both; }
.push-banner-icon { width: 20px; height: 20px; color: var(--purple); flex: 0 0 auto; }
.push-banner-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.push-banner-text { flex: 1 1 auto; font-size: 13.5px; color: var(--text); min-width: 0; }
.push-banner-cta { flex: 0 0 auto; padding: 8px 16px; border-radius: 999px; background: var(--purple); color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; }
.push-banner-cta:hover { background: #8a72ff; }
.push-banner-dismiss { flex: 0 0 auto; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: transparent; color: var(--muted); font-size: 17px; line-height: 1; }
.push-banner-dismiss:hover { background: rgba(255,255,255,.08); color: var(--text); }
@media (max-width: 460px) {
  .push-banner-text { font-size: 12.5px; }
  .push-banner-cta { padding: 7px 12px; font-size: 12.5px; }
}
.composer.is-complete { opacity: .6; }.composer.is-complete .composer-icon, .composer.is-complete .send-button { pointer-events: none; }.composer.is-complete #message-input { cursor: not-allowed; }

.more-menu { position: absolute; top: 73px; right: 16px; width: 190px; padding: 6px; background: #24242b; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 45px rgba(0,0,0,.42); }
.more-menu button { width: 100%; display: flex; align-items: center; gap: 10px; background: transparent; border-radius: 8px; padding: 10px 9px; font-size: 14px; text-align: left; }.more-menu button:hover { background: #33333c; }.menu-icon { width: 22px; text-align: center; color: #c5baff; font-size: 18px; }
.emoji-picker { position: absolute; z-index: 8; right: 24px; bottom: 82px; display: flex; gap: 3px; padding: 8px; border: 1px solid var(--line); background: #24242b; border-radius: 14px; box-shadow: 0 15px 40px rgba(0,0,0,.35); }.emoji-picker button { font-size: 21px; background: transparent; border-radius: 9px; padding: 4px 5px; }.emoji-picker button:hover { background: #34343e; }
.toast { position: absolute; z-index: 10; left: 50%; bottom: 88px; transform: translateX(-50%); padding: 10px 14px; border-radius: 10px; background: #282830; color: #f0eef7; font-size: 13px; white-space: nowrap; box-shadow: 0 12px 30px rgba(0,0,0,.34); }
.funnel-ended { width: 100%; text-align: center; color: #777784; font-size: 12px; padding: 18px 0 6px; }
.call-sheet, .story-sheet { position: absolute; z-index: 12; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(360px, calc(100vw - 32px)); border: 1px solid var(--line); background: #1a1a21; border-radius: 22px; box-shadow: 0 24px 70px rgba(0,0,0,.52); text-align: center; }
.call-sheet { padding: 30px 24px 24px; display: grid; gap: 8px; }.call-avatar { margin: 0 auto 8px; width: 88px; height: 88px; padding: 3px; border-radius: 50%; background: linear-gradient(135deg, #f0a15f, #a852b5, #4b3c9c); }.call-avatar img { width: 100%; height: 100%; border-radius: 50%; }.call-sheet strong { font-size: 19px; }.call-sheet span { color: var(--muted); font-size: 14px; }.end-call { margin: 18px auto 0; width: 44px; height: 44px; border-radius: 50%; background: #f05262; font-size: 26px; line-height: 1; }
.story-sheet { min-height: 420px; overflow: hidden; padding: 18px 20px 20px; background: linear-gradient(160deg, #503573, #1c1633 75%); text-align: left; }.story-topline { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: #e1d8f0; }.story-topline button { background: transparent; font-size: 25px; color: #fff; }.story-card { display: flex; align-items: center; gap: 11px; margin: 38px 0 24px; }.story-card img { width: 42px; height: 42px; border-radius: 50%; }.story-card strong, .story-card small { display: block; }.story-card small { color: #c6b5d8; font-size: 12px; margin-top: 4px; }.story-sheet p { position: absolute; left: 20px; right: 20px; bottom: 76px; font-size: 22px; line-height: 1.25; }.story-close { position: absolute; bottom: 20px; right: 20px; background: rgba(255,255,255,.16); border-radius: 9px; padding: 8px 12px; }
.photo-sheet { position: absolute; z-index: 12; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(390px, calc(100vw - 32px)); padding: 14px; border: 1px solid var(--line); border-radius: 20px; background: #1a1a21; box-shadow: 0 24px 70px rgba(0,0,0,.52); }.photo-sheet img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 14px; margin-top: 12px; }
.scrim { position: absolute; inset: 0; z-index: 11; background: rgba(0,0,0,.48); backdrop-filter: blur(4px); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@keyframes rise-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

@media (max-width: 620px) {
  .chat-header { height: 80px; padding: 0 16px; }.chat-log { inset: 80px 0 88px; }.day-label { padding-top: 38vh; }.profile-button, .avatar-ring { width: 56px; height: 56px; }.profile-copy { margin-left: 12px; }.profile-copy h1 { font-size: 16px; }.profile-copy p { font-size: 13px; }.header-actions { gap: 9px; }.icon-button svg { width: 23px; height: 23px; }.composer-wrap { bottom: max(9px, env(safe-area-inset-bottom)); padding: 0 8px; }.composer { min-height: 58px; padding: 6px 9px 6px 12px; gap: 7px; }.composer-actions { gap: 0; }.composer-icon { width: 28px; }.composer-icon svg { width: 23px; height: 23px; }.camera-button { width: 29px; }.message-bubble { font-size: 15px; }.more-menu { right: 9px; top: 67px; }.photo-thumb { width: 44px; height: 52px; }
}
