:root {
  --bg: #090a0f;
  --surface: #12131b;
  --surface-elevated: #191b25;
  --bubble-in: #1b1c26;
  --accent: #2f6ff3;
  --accent-2: #4b8bff;
  --accent-soft: rgba(47, 111, 243, 0.14);
  --text: #f5f5fa;
  --muted: #8e909e;
  --line: rgba(255, 255, 255, 0.09);
  --green: #34c759;
  --red: #ff453a;
  --vh: 1vh;
  --radius-pill: 999px;
  --font-sans: 'DM Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] {
  display: none !important;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

textarea:focus,
textarea:focus-visible {
  outline: none;
  box-shadow: none;
}

img {
  display: block;
  max-width: 100%;
}

/* ===========================
   APP SHELL
   =========================== */
.app-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(var(--vh, 1vh) * 100);
  height: 100dvh;
  max-width: 100vw;
  overflow: hidden;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(47, 111, 243, 0.08), transparent 65%),
    var(--bg);
}

/* ===========================
   IN-APP FLOATING NOTIFICATION
   =========================== */
.live-notif {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px));
  z-index: 120;
  pointer-events: none;
}

.live-notif-card {
  pointer-events: auto;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  text-align: left;
  border-radius: 18px;
  background: rgba(25, 27, 37, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.13);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(47, 111, 243, 0.18);
  animation: notifSlideDown 320ms var(--ease-out) both;
  transition: transform 180ms ease, background 180ms ease;
}

.live-notif-card:hover {
  background: rgba(31, 34, 46, 0.96);
  transform: translateY(1px);
}

.live-notif.is-leaving .live-notif-card {
  animation: notifSlideUp 220ms ease forwards;
}

.live-notif-avatar-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.live-notif-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.live-notif-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--surface-elevated);
}

.live-notif-body {
  min-width: 0;
  flex: 1;
}

.live-notif-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 1px;
}

.live-notif-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.live-notif-time {
  font-size: 12px;
  color: var(--muted);
}

.live-notif-preview {
  margin: 0;
  font-size: 13.5px;
  color: rgba(245, 245, 250, 0.84);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes notifSlideDown {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes notifSlideUp {
  to {
    opacity: 0;
    transform: translateY(-16px) scale(0.96);
  }
}

/* ===========================
   HEADER
   =========================== */
.app-header {
  position: relative;
  z-index: 30;
  flex-shrink: 0;
  padding-top: env(safe-area-inset-top);
  background: rgba(9, 10, 15, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  height: 64px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.avatar-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 160ms var(--ease-out);
}

.avatar-btn:active {
  transform: scale(0.94);
}

.avatar-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 2px;
  background: rgba(255, 255, 255, 0.14);
  transition: background 240ms ease;
}

.avatar-btn.has-unseen-story .avatar-ring {
  background: linear-gradient(135deg, #4b8bff, #2f6ff3 45%, #c850c0 100%);
}

.avatar-halo {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent-2);
  opacity: 0;
  pointer-events: none;
}

.avatar-btn.is-typing .avatar-halo {
  animation: avatarHaloPulse 1.5s ease-out infinite;
}

@keyframes avatarHaloPulse {
  0% {
    opacity: 0.75;
    transform: scale(0.94);
  }
  100% {
    opacity: 0;
    transform: scale(1.22);
  }
}

.avatar-img {
  position: relative;
  z-index: 1;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--bg);
  background: var(--surface-elevated);
}

.online-dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  z-index: 2;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--bg);
}

.identity {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.identity-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.identity-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.verified-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.verified-icon-lg {
  width: 18px;
  height: 18px;
}

.identity-status {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 180ms ease;
}

.identity-status.is-active-action {
  color: var(--accent-2);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: rgba(245, 245, 250, 0.88);
  transition: background 160ms ease, color 160ms ease, transform 140ms ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Bell badge & attention pulse */
.notify-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  border: 1.5px solid var(--bg);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 200ms ease, transform 200ms ease, background 200ms ease;
}

.notify-btn.needs-attention .notify-badge {
  opacity: 1;
  transform: scale(1);
  background: var(--accent-2);
  animation: bellPulse 2.4s ease-in-out infinite;
}

.notify-btn.is-enabled .notify-badge {
  opacity: 1;
  transform: scale(1);
  background: var(--green);
  animation: none;
}

@keyframes bellPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(75, 139, 255, 0.65);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(75, 139, 255, 0);
  }
}

/* More dropdown menu */
.more-wrap {
  position: relative;
}

.more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 228px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(25, 27, 37, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
  z-index: 60;
  transform-origin: top right;
  animation: popIn 160ms var(--ease-out) both;
}

.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: background 140ms ease;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.menu-item svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
  flex-shrink: 0;
}

.menu-item.is-danger {
  color: #ff6961;
}

.menu-item.is-danger svg {
  color: #ff6961;
}

.menu-pill {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.menu-pill.is-on {
  background: rgba(52, 199, 89, 0.16);
  color: var(--green);
}

.menu-divider {
  height: 1px;
  margin: 5px 8px;
  background: var(--line);
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===========================
   STICKY PINNED LINK BAR
   =========================== */
.pinned-bar {
  border-top: 1px solid var(--line);
  background: rgba(18, 19, 27, 0.92);
  animation: slideDownBar 260ms var(--ease-out) both;
}

@keyframes slideDownBar {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pinned-inner {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  transition: background 150ms ease;
}

.pinned-inner:hover {
  background: rgba(47, 111, 243, 0.1);
}

.pinned-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-2);
  flex-shrink: 0;
}

.pinned-icon svg {
  width: 15px;
  height: 15px;
}

.pinned-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  overflow: hidden;
}

.pinned-platform {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-2);
  flex-shrink: 0;
}

.pinned-domain {
  font-size: 13px;
  color: rgba(245, 245, 250, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pinned-arrow {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--muted);
  flex-shrink: 0;
}

.pinned-arrow svg {
  width: 16px;
  height: 16px;
}

/* ===========================
   CHAT STAGE & LOG
   =========================== */
.chat-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-log {
  flex: 1;
  min-height: 0;
  padding-bottom: 22px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.chat-log::-webkit-scrollbar {
  width: 6px;
}

.chat-log::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.chat-column {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 10px 14px 4px;
  display: flex;
  flex-direction: column;
}

/* Profile Card */
.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 12px 10px;
  margin-bottom: 2px;
}

.profile-avatar-btn {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  transition: transform 180ms var(--ease-out);
}

.profile-avatar-btn:hover {
  transform: scale(1.03);
}

.profile-avatar-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}

.profile-avatar-btn.has-unseen-story .profile-avatar-ring {
  background: linear-gradient(135deg, #4b8bff, #2f6ff3 50%, #c850c0 100%);
}

.profile-avatar-img {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg);
  background: var(--surface-elevated);
}

.profile-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.profile-name {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.profile-handle {
  margin: 1px 0 0;
  font-size: 13.5px;
  color: var(--muted);
}

.profile-bio {
  margin: 7px auto 0;
  max-width: 360px;
  font-size: 13.5px;
  color: rgba(245, 245, 250, 0.86);
}

.profile-meta {
  margin-top: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.story-pill-btn {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  transition: background 160ms ease, border-color 160ms ease, transform 140ms ease;
}

.story-pill-btn:hover {
  background: rgba(47, 111, 243, 0.16);
  border-color: rgba(75, 139, 255, 0.35);
}

.story-pill-btn:active {
  transform: scale(0.96);
}

.story-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
}

/* Day Label */
.day-label {
  align-self: center;
  margin: 4px 0 12px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

/* ===========================
   MESSAGES
   =========================== */
.messages {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.time-divider {
  align-self: center;
  margin: 8px 0 2px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.34);
  text-align: center;
  user-select: none;
}

.msg-row {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
  margin-top: 7px;
  animation: riseIn 200ms var(--ease-out) both;
}

.msg-row.is-grouped {
  margin-top: 0;
}

.msg-row.is-time-split {
  margin-top: 3px;
}

.msg-row.has-receipt .msg-time {
  display: none;
}

.msg-row.role-user {
  justify-content: flex-end;
}

.msg-row.role-assistant {
  justify-content: flex-start;
}

.msg-row.has-reaction {
  margin-bottom: 12px;
}

.msg-row.has-reaction.has-time {
  margin-bottom: 4px;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.msg-avatar-slot {
  width: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
}

.msg-row.role-assistant.has-time .msg-avatar-slot {
  padding-bottom: 17px;
}

.msg-row.role-assistant.has-time.has-reaction .msg-avatar-slot {
  padding-bottom: 27px;
}

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-elevated);
}

.msg-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: min(78%, 500px);
  min-width: 0;
}

.msg-row.role-user .msg-stack {
  align-items: flex-end;
}

.msg-row.role-assistant .msg-stack {
  align-items: flex-start;
}

.msg-reply-tag {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 4px;
  padding: 0 4px;
}

.msg-bubble-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.msg-bubble {
  position: relative;
  padding: 11px 15px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.44;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  user-select: text;
}

.msg-row.role-assistant .msg-bubble {
  background: var(--bubble-in);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.msg-row.role-user .msg-bubble {
  background: linear-gradient(135deg, #2f6ff3, #4380ff);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(47, 111, 243, 0.22);
}

.msg-row.role-assistant.group-start .msg-bubble,
.msg-row.role-assistant.group-start .voice-card,
.msg-row.role-assistant.group-start .photo-card {
  border-bottom-left-radius: 5px;
}

.msg-row.role-assistant.group-mid .msg-bubble,
.msg-row.role-assistant.group-mid .voice-card,
.msg-row.role-assistant.group-mid .photo-card {
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
}

.msg-row.role-assistant.group-end .msg-bubble,
.msg-row.role-assistant.group-end .voice-card,
.msg-row.role-assistant.group-end .photo-card {
  border-top-left-radius: 5px;
}

.msg-row.role-user.group-start .msg-bubble,
.msg-row.role-user.group-start .voice-card,
.msg-row.role-user.group-start .photo-card {
  border-bottom-right-radius: 5px;
}

.msg-row.role-user.group-mid .msg-bubble,
.msg-row.role-user.group-mid .voice-card,
.msg-row.role-user.group-mid .photo-card {
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
}

.msg-row.role-user.group-end .msg-bubble,
.msg-row.role-user.group-end .voice-card,
.msg-row.role-user.group-end .photo-card {
  border-top-right-radius: 5px;
}

.msg-time {
  margin-top: 4px;
  font-size: 10.5px;
  line-height: 1.25;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.34);
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.msg-row.role-assistant .msg-time {
  padding-left: 6px;
  align-self: flex-start;
}

.msg-row.role-user .msg-time {
  padding-right: 6px;
  align-self: flex-end;
}

.msg-row.has-reaction .msg-time {
  margin-top: 14px;
}

.msg-bubble a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Quick hover heart button on Ana's messages */
.react-trigger {
  opacity: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  transition: opacity 150ms ease, background 150ms ease, color 150ms ease, transform 140ms ease;
  flex-shrink: 0;
}

.msg-row.role-assistant:hover .react-trigger,
.react-trigger:focus-visible,
.react-trigger.is-reacted {
  opacity: 1;
}

.react-trigger:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ff5b79;
  transform: scale(1.08);
}

.react-trigger.is-reacted {
  color: #ff5b79;
}

.react-trigger svg {
  width: 14px;
  height: 14px;
}

/* Reaction Pill */
.reaction-pill {
  position: absolute;
  bottom: -11px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  border: 1.5px solid var(--bg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  font-size: 12px;
  line-height: 1;
  animation: reactionPop 240ms var(--ease-out) both;
}

.msg-row.role-assistant .reaction-pill {
  right: 8px;
}

.msg-row.role-user .reaction-pill {
  left: 8px;
}

@keyframes reactionPop {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  70% {
    transform: scale(1.16);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Delivery / Read Receipt */
.receipt-row {
  align-self: flex-end;
  margin-top: 5px;
  padding-right: 4px;
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
  animation: riseIn 180ms ease both;
}

.msg-time + .receipt-row {
  margin-top: 2px;
}

.msg-row.has-reaction:not(.has-time) .receipt-row {
  margin-top: 13px;
}

.receipt-row.is-seen {
  color: rgba(142, 144, 158, 0.9);
}

/* ===========================
   PHOTO MESSAGE CARDS
   =========================== */
.photo-card {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 6px 15px 6px 6px;
  border-radius: 20px;
  background: #23242e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #f4f2fa;
  font-weight: 600;
  font-size: 14px;
  text-align: left;
  overflow: hidden;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms var(--ease-out);
}

.photo-card:hover {
  background: #2b2d39;
  border-color: rgba(75, 139, 255, 0.42);
}

.photo-card:active {
  transform: scale(0.98);
}

.photo-thumb {
  display: block;
  width: 48px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  flex: 0 0 auto;
  background: #141620;
}

.photo-pill-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-right: 2px;
  white-space: nowrap;
}

.photo-pill-play {
  width: 16px;
  height: 16px;
  color: var(--accent);
  fill: currentColor;
  flex: 0 0 auto;
}

.msg-row.role-user .photo-card,
.photo-card.photo-card-user {
  display: block;
  width: min(148px, 48vw);
  padding: 0;
  gap: 0;
  border-radius: 18px;
  background: #141620;
  border: 1px solid rgba(75, 139, 255, 0.35);
}

.photo-card-img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  transition: transform 280ms var(--ease-out);
}

.photo-card:hover .photo-card-img {
  transform: scale(1.03);
}

/* ===========================
   VOICE MEMO PLAYER
   =========================== */
.voice-card {
  width: min(300px, 78vw);
  padding: 11px 13px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-margin-bottom: 22px;
}

.msg-row.role-assistant .voice-card {
  background: var(--bubble-in);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.msg-row.role-user .voice-card {
  background: linear-gradient(135deg, #2f6ff3, #4380ff);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(47, 111, 243, 0.24);
}

.voice-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.voice-play-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 140ms ease, filter 140ms ease;
}

.msg-row.role-assistant .voice-play-btn {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(47, 111, 243, 0.35);
}

.msg-row.role-user .voice-play-btn {
  background: #ffffff;
  color: var(--accent);
}

.voice-play-btn:hover {
  transform: scale(1.05);
}

.voice-play-btn:active {
  transform: scale(0.93);
}

.voice-play-btn svg {
  width: 16px;
  height: 16px;
}

.voice-unplayed-dot {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-2);
  border: 2px solid var(--bubble-in);
}

.voice-card.is-played .voice-unplayed-dot {
  display: none;
}

.voice-center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.voice-waveform {
  height: 30px;
  display: flex;
  align-items: center;
  gap: 2.5px;
  cursor: pointer;
  padding: 2px 0;
  touch-action: manipulation;
}

.voice-bar {
  flex: 1;
  min-width: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  transition: background 110ms linear, transform 140ms ease;
}

.msg-row.role-assistant .voice-bar.is-filled {
  background: var(--accent-2);
}

.msg-row.role-user .voice-bar {
  background: rgba(255, 255, 255, 0.35);
}

.msg-row.role-user .voice-bar.is-filled {
  background: #ffffff;
}

.voice-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.voice-duration {
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.voice-controls-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.voice-speed-btn {
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  transition: background 140ms ease;
}

.voice-speed-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.voice-transcript-btn {
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(245, 245, 250, 0.82);
  transition: background 140ms ease, color 140ms ease;
}

.voice-transcript-btn:hover,
.voice-transcript-btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.voice-transcript-box {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 13px;
  line-height: 1.4;
  font-style: italic;
  color: rgba(245, 245, 250, 0.86);
  animation: riseIn 160ms ease both;
}

/* ===========================
   CTA / LINK PREVIEW CARD
   =========================== */
.cta-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(310px, 78vw);
  padding: 12px 14px;
  border-radius: 18px;
  text-decoration: none;
  color: var(--text);
  background: linear-gradient(145deg, rgba(27, 29, 41, 0.96), rgba(20, 22, 32, 0.98));
  border: 1px solid rgba(75, 139, 255, 0.28);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.34);
  transition: transform 180ms var(--ease-out), border-color 180ms ease, box-shadow 180ms ease;
}

.cta-card:hover {
  transform: translateY(-1px);
  border-color: rgba(75, 139, 255, 0.65);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(75, 139, 255, 0.25);
}

.cta-icon-tile {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2f6ff3, #4b8bff);
  color: #ffffff;
  flex-shrink: 0;
}

.cta-icon-tile svg {
  width: 20px;
  height: 20px;
}

.cta-body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cta-platform {
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
}

.cta-host {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cta-arrow {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent-2);
  flex-shrink: 0;
}

.cta-arrow svg {
  width: 15px;
  height: 15px;
}

/* ===========================
   MULTI-STATE ACTIVITY BUBBLE
   =========================== */
.activity-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 12px;
  animation: riseIn 200ms var(--ease-out) both;
}

.activity-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-radius: 20px;
  border-bottom-left-radius: 6px;
  background: var(--bubble-in);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13.5px;
  color: var(--muted);
}

.activity-visual {
  display: none;
  align-items: center;
}

.activity-pill[data-mode="typing"] .activity-visual-typing {
  display: inline-flex;
  gap: 4px;
}

.activity-visual-typing i {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  animation: dotBounce 1.2s ease-in-out infinite;
}

.activity-visual-typing i:nth-child(2) {
  animation-delay: 0.16s;
}

.activity-visual-typing i:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes dotBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.activity-pill[data-mode="photo"] .activity-visual-photo {
  display: inline-flex;
  color: var(--accent-2);
  animation: photoShimmer 1.3s ease-in-out infinite;
}

.activity-visual-photo svg {
  width: 16px;
  height: 16px;
}

@keyframes photoShimmer {
  0%, 100% {
    opacity: 0.5;
    transform: scale(0.95);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

.activity-pill[data-mode="voice"] .activity-visual-voice {
  display: inline-flex;
  align-items: center;
  gap: 2.5px;
  height: 15px;
}

.activity-visual-voice i {
  display: block;
  width: 2.5px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent-2);
  animation: eqPulse 0.9s ease-in-out infinite;
}

.activity-visual-voice i:nth-child(2) {
  animation-delay: 0.15s;
}

.activity-visual-voice i:nth-child(3) {
  animation-delay: 0.3s;
}

.activity-visual-voice i:nth-child(4) {
  animation-delay: 0.45s;
}

@keyframes eqPulse {
  0%, 100% {
    height: 4px;
    opacity: 0.55;
  }
  50% {
    height: 15px;
    opacity: 1;
  }
}

/* ===========================
   SCROLL TO BOTTOM PILL
   =========================== */
.scroll-bottom-btn {
  position: absolute;
  right: max(16px, calc(50% - 394px));
  bottom: 14px;
  z-index: 15;
  height: 38px;
  min-width: 38px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: rgba(25, 27, 37, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(14px);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  animation: popIn 180ms var(--ease-out) both;
}

.scroll-bottom-btn svg {
  width: 18px;
  height: 18px;
}

.unread-chip {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* ===========================
   JOIN OVERLAY (DANCING BLUE BORDER)
   =========================== */
.join-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(9, 10, 15, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity 280ms ease;
}

.join-overlay.is-hiding {
  opacity: 0;
  pointer-events: none;
}

.join-card {
  position: relative;
  width: min(330px, 100%);
  padding: 2px;
  border-radius: 26px;
  overflow: hidden;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.6),
    0 0 38px rgba(47, 111, 243, 0.24);
}

.join-card::before {
  content: '';
  position: absolute;
  inset: -60%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 110deg,
    #2f6ff3 175deg,
    #78adff 205deg,
    #2f6ff3 235deg,
    transparent 300deg,
    transparent 360deg
  );
  animation: spinGlow 3.2s linear infinite;
}

@keyframes spinGlow {
  to {
    transform: rotate(360deg);
  }
}

.join-card-inner {
  position: relative;
  z-index: 1;
  border-radius: 24px;
  padding: 28px 22px 24px;
  background: rgba(18, 19, 27, 0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.join-avatar-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  margin-bottom: 14px;
}

.join-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(75, 139, 255, 0.45);
}

.join-online-dot {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--green);
  border: 3px solid var(--surface);
}

.join-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.join-sub {
  margin: 5px 0 16px;
  font-size: 13px;
  color: var(--muted);
}

.join-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(245, 245, 250, 0.85);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: background 240ms ease, color 240ms ease, border-color 240ms ease;
}

.join-pill.is-seen {
  background: var(--accent-soft);
  color: #82b2ff;
  border-color: rgba(75, 139, 255, 0.4);
}

.join-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* ===========================
   DRAG & DROP OVERLAY
   =========================== */
.drop-overlay {
  position: absolute;
  inset: 12px;
  z-index: 35;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: rgba(9, 10, 15, 0.86);
  border: 2px dashed var(--accent-2);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.drop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.drop-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-2);
}

.drop-icon svg {
  width: 28px;
  height: 28px;
}

.drop-title {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 700;
}

.drop-sub {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* ===========================
   COMPOSER DOCK
   =========================== */
.composer-dock {
  position: relative;
  z-index: 28;
  flex-shrink: 0;
  padding: 6px 12px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(9, 10, 15, 0.98) 65%, rgba(9, 10, 15, 0));
}

.composer-inner {
  position: relative;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Hide compact push banner while mobile keyboard is open */
body.keyboard-open .push-banner {
  display: none !important;
}

.push-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  border-radius: 14px;
  background: rgba(25, 27, 37, 0.92);
  border: 1px solid rgba(75, 139, 255, 0.24);
  animation: riseIn 220ms var(--ease-out) both;
}

.push-banner-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.push-banner-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-2);
  flex-shrink: 0;
}

.push-banner-icon svg {
  width: 14px;
  height: 14px;
}

.push-banner-text {
  font-size: 13px;
  color: rgba(245, 245, 250, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.push-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.push-banner-cta {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  transition: background 150ms ease, transform 130ms ease;
}

.push-banner-cta:hover {
  background: var(--accent-2);
}

.push-banner-cta:active {
  transform: scale(0.95);
}

.push-banner-close {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--muted);
  transition: background 140ms ease, color 140ms ease;
}

.push-banner-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

/* Attachment Preview Bar */
.attachment-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 16px;
  background: var(--surface-elevated);
  border: 1px solid var(--line);
  animation: riseIn 180ms var(--ease-out) both;
}

.attachment-thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.attachment-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.attachment-title {
  font-size: 13.5px;
  font-weight: 600;
}

.attachment-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-send-btn {
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.attachment-clear-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 19px;
  color: var(--muted);
}

.attachment-clear-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

/* Emoji Picker */
.emoji-picker {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: min(320px, 100%);
  padding: 10px;
  border-radius: 18px;
  background: rgba(25, 27, 37, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(22px);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.55);
  z-index: 40;
  animation: popIn 150ms var(--ease-out) both;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

.emoji-item {
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 20px;
  transition: background 120ms ease, transform 120ms ease;
}

.emoji-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.14);
}

/* Composer Pill */
.composer-pill {
  width: 100%;
  min-height: 50px;
  padding: 5px 6px;
  border-radius: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  outline: none;
  box-shadow: none;
  transition: border-color 180ms ease;
}

.composer-pill:focus,
.composer-pill:focus-visible,
.composer-pill:focus-within {
  border-color: rgba(255, 255, 255, 0.16);
  outline: none;
  box-shadow: none;
}

.composer-normal {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  width: 100%;
}

.composer-camera-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #ffffff;
  flex-shrink: 0;
  transition: transform 140ms ease, background 150ms ease;
}

.composer-camera-btn:hover {
  background: var(--accent-2);
}

.composer-camera-btn:active {
  transform: scale(0.92);
}

.composer-camera-btn svg {
  width: 18px;
  height: 18px;
}

.composer-input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  max-height: 120px;
  padding: 8px 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px; /* Prevents iOS auto-zoom */
  line-height: 1.38;
  resize: none;
  outline: none;
  box-shadow: none;
  overflow-y: auto;
}

.composer-input:focus,
.composer-input:focus-visible {
  outline: none;
  box-shadow: none;
}

.composer-input::placeholder {
  color: var(--muted);
}

.composer-idle-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.composer-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: rgba(245, 245, 250, 0.8);
  transition: background 140ms ease, color 140ms ease, transform 120ms ease;
}

.composer-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.composer-icon-btn:active {
  transform: scale(0.92);
}

.composer-icon-btn svg {
  width: 19px;
  height: 19px;
}

.send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2f6ff3, #4b8bff);
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(47, 111, 243, 0.35);
  animation: popIn 150ms var(--ease-out) both;
  transition: transform 140ms ease, filter 140ms ease;
}

.send-btn:hover {
  filter: brightness(1.08);
}

.send-btn:active {
  transform: scale(0.9);
}

.send-btn svg {
  width: 18px;
  height: 18px;
}

/* Inline Voice Recording Bar */
.composer-recording {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 0 2px;
  animation: riseIn 160ms var(--ease-out) both;
}

.rec-cancel-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ff6961;
  background: rgba(255, 69, 58, 0.14);
  flex-shrink: 0;
  transition: background 140ms ease, transform 120ms ease;
}

.rec-cancel-btn:hover {
  background: rgba(255, 69, 58, 0.24);
}

.rec-cancel-btn svg {
  width: 17px;
  height: 17px;
}

.rec-info {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.65);
  animation: recPulse 1.2s ease-out infinite;
}

@keyframes recPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.65);
  }
  100% {
    box-shadow: 0 0 0 8px rgba(255, 69, 58, 0);
  }
}

.rec-label {
  font-size: 13.5px;
  font-weight: 600;
}

.rec-demo-badge {
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  background: rgba(75, 139, 255, 0.16);
  color: var(--accent-2);
}

.rec-timer {
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.rec-eq {
  flex: 1;
  min-width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  overflow: hidden;
}

.rec-eq span {
  width: 3px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent-2);
  transition: height 90ms linear;
}

.rec-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2f6ff3, #4b8bff);
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(47, 111, 243, 0.4);
}

.rec-send-btn svg {
  width: 18px;
  height: 18px;
}

/* ===========================
   MODALS & SHEETS
   =========================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 16px;
}

#photo-sheet,
#story-sheet,
#call-sheet {
  z-index: 140;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 10, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fadeIn 180ms ease both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-sheet {
  position: relative;
  z-index: 1;
  width: min(410px, 100%);
  padding: 28px 24px 24px;
  border-radius: 26px;
  background: rgba(20, 22, 32, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.65);
  text-align: center;
  animation: sheetRise 240ms var(--ease-out) both;
}

@keyframes sheetRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  transition: background 140ms ease, color 140ms ease;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* Notify Modal — quiet, compact, low-contrast card */
#notify-modal .modal-scrim {
  background: rgba(5, 6, 10, 0.34);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.notify-sheet {
  width: min(296px, 100%);
  max-width: 296px;
  padding: 16px 16px 13px;
  border-radius: 16px;
  background: #13151d;
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.42);
  text-align: left;
}

.notify-sheet .modal-close-btn {
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  font-size: 16px;
  background: transparent;
  color: rgba(245, 245, 250, 0.42);
}

.notify-sheet .modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(245, 245, 250, 0.78);
}

.notify-compact-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-right: 22px;
}

.notify-avatar-mini-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
}

.notify-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.notify-bell-mini {
  position: absolute;
  right: -3px;
  bottom: -2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #274c99;
  color: #dbe8ff;
  border: 2px solid #13151d;
}

.notify-bell-mini svg {
  width: 10px;
  height: 10px;
}

.btn-bell-ico {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.notify-head-copy {
  min-width: 0;
}

.modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.notify-sheet .modal-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: rgba(245, 245, 250, 0.92);
}

.modal-subtitle {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.48;
  color: var(--muted);
}

.notify-sheet .modal-subtitle {
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.38;
  color: rgba(245, 245, 250, 0.56);
}

.notify-preview-link {
  display: block;
  margin: 2px auto 0;
  padding: 2px 6px;
  background: transparent;
  color: rgba(245, 245, 250, 0.38);
  font-size: 11.5px;
  font-weight: 500;
  transition: color 140ms ease;
}

.notify-preview-link:hover {
  color: rgba(245, 245, 250, 0.72);
}

.notify-denied-note {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 69, 58, 0.09);
  border: 1px solid rgba(255, 69, 58, 0.18);
  font-size: 11.5px;
  line-height: 1.38;
  color: rgba(255, 178, 173, 0.9);
  text-align: left;
}

.modal-actions {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notify-sheet .modal-actions {
  margin-top: 13px;
  gap: 6px;
}

.modal-secondary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-primary {
  width: 100%;
  height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2f6ff3, #4b8bff);
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 8px 22px rgba(47, 111, 243, 0.34);
  transition: transform 140ms ease, filter 140ms ease;
}

.notify-sheet .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  background: rgba(47, 111, 243, 0.22);
  color: #93bcff;
  border: 1px solid rgba(75, 139, 255, 0.30);
  font-size: 13px;
  font-weight: 600;
  box-shadow: none;
}

.notify-sheet .btn-primary:hover {
  background: rgba(47, 111, 243, 0.32);
  color: #c6dcff;
  filter: none;
}

.btn-primary:hover {
  filter: brightness(1.07);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-ghost {
  height: 42px;
  padding: 0 14px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  transition: background 140ms ease;
}

.notify-sheet .btn-ghost,
.notify-sheet .btn-subtle {
  height: 36px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(245, 245, 250, 0.64);
}

.notify-sheet .btn-subtle:hover {
  background: rgba(255, 255, 255, 0.09);
  color: rgba(245, 245, 250, 0.88);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.13);
}

.btn-subtle {
  height: 42px;
  padding: 0 14px;
  border-radius: 13px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  transition: background 140ms ease, color 140ms ease;
}

.btn-subtle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.status-badge-on {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--green);
  background: rgba(52, 199, 89, 0.12);
  border: 1px solid rgba(52, 199, 89, 0.24);
}

.status-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.settings-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.setting-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer;
}

.setting-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-title {
  font-size: 14px;
  font-weight: 600;
}

.setting-desc {
  font-size: 12px;
  color: var(--muted);
}

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.16);
  flex-shrink: 0;
  transition: background 180ms ease;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 180ms var(--ease-out);
}

.toggle-input:checked + .toggle-track {
  background: var(--accent);
}

.toggle-input:checked + .toggle-track::after {
  transform: translateX(18px);
}

/* ===========================
   STORY SHEET
   =========================== */
.story-frame {
  position: relative;
  z-index: 1;
  width: min(410px, calc(100vw - 24px));
  height: min(740px, calc(100dvh - 32px));
  border-radius: 26px;
  overflow: hidden;
  background: #0d0f16;
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.72);
  animation: sheetRise 220ms var(--ease-out) both;
}

.story-progress-track {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  z-index: 5;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  overflow: hidden;
}

.story-progress-fill {
  height: 100%;
  width: 0%;
  background: #ffffff;
  border-radius: 999px;
}

.story-progress-fill.is-running {
  animation: storyProgress 8s linear forwards;
}

@keyframes storyProgress {
  from { width: 0%; }
  to { width: 100%; }
}

.story-header {
  position: absolute;
  top: 22px;
  left: 14px;
  right: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.story-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.story-author-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.65);
}

.story-author-meta {
  display: flex;
  align-items: baseline;
  gap: 7px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

.story-author-name {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.story-time {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.78);
}

.story-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(8px);
}

.story-media-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #12141e;
}

.story-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-caption {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 18px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(9, 10, 15, 0.68);
  backdrop-filter: blur(12px);
  font-size: 14.5px;
  color: #ffffff;
  text-align: center;
}

.story-reply-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: #0d0f16;
  border-top: 1px solid var(--line);
}

.story-reply-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  font-size: 16px;
  outline: none;
}

.story-reply-input:focus {
  border-color: var(--accent-2);
}

.story-reply-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #ffffff;
  flex-shrink: 0;
}

.story-reply-send svg {
  width: 18px;
  height: 18px;
}

/* ===========================
   CALL SHEET
   =========================== */
.call-sheet {
  padding: 36px 24px 28px;
}

.call-rings {
  position: relative;
  width: 126px;
  height: 126px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
}

.call-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(75, 139, 255, 0.55);
  animation: callRingPulse 2.1s ease-out infinite;
}

.call-ring.r2 {
  animation-delay: 0.7s;
}

.call-ring.r3 {
  animation-delay: 1.4s;
}

.call-rings.is-ended .call-ring {
  animation: none;
  opacity: 0.15;
}

@keyframes callRingPulse {
  0% {
    transform: scale(0.72);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.38);
    opacity: 0;
  }
}

.call-avatar {
  position: relative;
  z-index: 2;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--surface-elevated);
}

.call-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.call-sub {
  margin: 7px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.call-actions {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.call-end-btn {
  width: 100%;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 69, 58, 0.18);
  border: 1px solid rgba(255, 69, 58, 0.35);
  color: #ff6961;
  font-size: 15px;
  font-weight: 600;
  transition: background 140ms ease;
}

.call-end-btn:hover {
  background: rgba(255, 69, 58, 0.28);
}

/* ===========================
   PHOTO LIGHTBOX
   =========================== */
.lightbox-frame {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 760px);
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: sheetRise 200ms var(--ease-out) both;
}

.lightbox-close-btn {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  color: #ffffff;
  background: rgba(25, 27, 37, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.lightbox-image {
  max-width: 100%;
  max-height: 80dvh;
  border-radius: 18px;
  object-fit: contain;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.72);
}

.lightbox-caption {
  margin: 0;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: rgba(18, 19, 27, 0.88);
  border: 1px solid var(--line);
  font-size: 13.5px;
  color: rgba(245, 245, 250, 0.92);
  text-align: center;
}

/* ===========================
   RESPONSIVE BREAKPOINTS
   =========================== */
@media (max-width: 600px) {
  .header-inner {
    height: 60px;
    padding: 0 10px 0 12px;
  }

  .chat-column {
    padding: 8px 10px 4px;
  }

  .profile-card {
    padding: 12px 10px 8px;
  }

  .profile-avatar-btn {
    width: 72px;
    height: 72px;
    margin-bottom: 8px;
  }

  .profile-avatar-img {
    width: 64px;
    height: 64px;
  }

  .photo-thumb {
    width: 44px;
    height: 52px;
  }

  .msg-row.role-user .photo-card,
  .photo-card.photo-card-user {
    width: min(136px, 46vw);
  }

  .msg-stack {
    max-width: 84%;
  }

  .composer-dock {
    padding: 6px 8px max(10px, env(safe-area-inset-bottom));
  }

  /* Bottom-sheet presentation for modals on mobile */
  .modal-backdrop:not(.lightbox-backdrop):not(.story-backdrop) {
    align-items: end;
    padding: 0;
  }

  .modal-backdrop:not(.lightbox-backdrop):not(.story-backdrop) .modal-sheet {
    width: 100%;
    border-radius: 26px 26px 0 0;
    padding: 26px 20px max(24px, env(safe-area-inset-bottom));
  }

  .story-frame {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }

  .story-backdrop {
    padding: 0;
  }

  .scroll-bottom-btn {
    right: 14px;
  }
}

@media (max-width: 620px) {
  #notify-modal {
    align-items: end;
    padding: 0 12px max(14px, env(safe-area-inset-bottom));
  }

  #notify-modal .notify-sheet {
    width: min(312px, 100%);
    max-width: 312px;
    border-radius: 16px;
    padding: 15px 15px 12px;
  }
}

@media (max-width: 480px) {
  .push-banner {
    gap: 8px;
    padding: 8px 10px;
  }

  .push-banner-left {
    gap: 7px;
  }

  .push-banner-icon {
    width: 24px;
    height: 24px;
  }

  .push-banner-text {
    font-size: 12.5px;
  }

  .push-banner-cta {
    padding: 5px 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  .push-banner-close {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 360px) {
  .push-banner-text {
    font-size: 12px;
  }

  .voice-card {
    width: 248px;
  }

  .rec-label {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
