/* ============================================
   GuestChat — warm dark theme
   palette: deep ink, terracotta accent, cream text
   ============================================ */

:root {
  /* core palette */
  --ink-900: #0e0c0a;
  --ink-800: #16130f;
  --ink-700: #1f1b16;
  --ink-600: #2a241d;
  --ink-500: #3a3128;
  --ink-400: #5a4d40;

  --cream: #f5ead6;
  --cream-dim: #c9bfae;
  --cream-faint: #8a8377;

  --accent: #e07856;       /* terracotta */
  --accent-bright: #ff8e6a;
  --accent-soft: #e0785622;

  --green: #7cc77a;
  --red: #d96565;
  --gold: #d4a857;

  /* typography */
  --serif: 'Fraunces', 'Times New Roman', serif;
  --sans: 'Manrope', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Courier New', monospace;

  /* layout */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;

  /* shadows */
  --shadow-soft: 0 4px 24px -8px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 32px -4px rgba(224, 120, 86, 0.25);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100dvh;
  background: var(--ink-900);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* film grain overlay for warmth */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.04;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* glowing background orbs */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  z-index: 0;
  pointer-events: none;
}
.orb-1 {
  width: 500px; height: 500px;
  background: var(--accent);
  top: -100px; left: -100px;
  animation: orb-float 20s ease-in-out infinite;
}
.orb-2 {
  width: 400px; height: 400px;
  background: var(--gold);
  bottom: -100px; right: -100px;
  animation: orb-float 24s ease-in-out infinite reverse;
}
@keyframes orb-float {
  0%,100% { transform: translate(0, 0); }
  50% { transform: translate(60px, -40px); }
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at top, var(--ink-700) 0%, var(--ink-900) 60%);
}

.login-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 460px;
  padding: 24px;
}

.login-card {
  background: rgba(22, 19, 15, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(245, 234, 214, 0.08);
  border-radius: var(--radius-lg);
  padding: 44px 40px 32px;
  box-shadow: var(--shadow-soft), var(--shadow-glow);
  animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 36px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cream-dim);
}
.brand.small { margin-bottom: 0; font-size: 11px; }
.brand-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: 0.6; transform: scale(0.85); }
}

.login-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 42px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  color: var(--cream);
}
.login-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

.login-sub {
  font-size: 14px;
  color: var(--cream-faint);
  margin-bottom: 32px;
  line-height: 1.55;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--cream-faint);
}
.field input {
  background: rgba(14, 12, 10, 0.6);
  border: 1px solid rgba(245, 234, 214, 0.1);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--cream);
  transition: all 0.2s ease;
  outline: none;
}
.field input::placeholder { color: var(--cream-faint); opacity: 0.5; }
.field input:focus {
  border-color: var(--accent);
  background: rgba(14, 12, 10, 0.9);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#pin {
  font-family: var(--mono);
  letter-spacing: 0.4em;
}

.btn-primary {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--accent);
  color: var(--ink-900);
  border: none;
  border-radius: var(--radius);
  padding: 15px 24px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: lowercase;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-bright);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -8px var(--accent);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.status-msg {
  font-size: 13px;
  text-align: center;
  min-height: 18px;
  margin-top: 4px;
}
.status-msg.error { color: var(--red); }
.status-msg.success { color: var(--green); }
.status-msg.info { color: var(--cream-faint); }

.login-foot {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cream-faint);
  opacity: 0.6;
}

/* ============================================
   CHAT APP SHELL
   ============================================ */
.chat-body { background: var(--ink-900); }

.app-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: 100dvh;
  position: relative;
  z-index: 2;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  background: var(--ink-800);
  border-right: 1px solid rgba(245, 234, 214, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(245, 234, 214, 0.05);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--cream-dim);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.icon-btn:hover {
  background: rgba(245, 234, 214, 0.06);
  color: var(--cream);
}

.me-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(245, 234, 214, 0.05);
}
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: var(--ink-900);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 17px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.me-info { min-width: 0; }
.me-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.me-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--cream-faint);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.dot-online {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}
.dot-offline {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-400);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 16px 8px;
  padding: 10px 12px;
  background: var(--ink-700);
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: all 0.15s;
}
.search-box:focus-within {
  border-color: var(--accent);
  background: var(--ink-900);
}
.search-box svg { color: var(--cream-faint); flex-shrink: 0; }
.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--cream);
  font-family: var(--sans);
  font-size: 13px;
  outline: none;
  min-width: 0;
}
.search-box input::placeholder { color: var(--cream-faint); }
.search-clear {
  background: none;
  border: none;
  color: var(--cream-faint);
  cursor: pointer;
  font-size: 14px;
}

.room-nav {
  padding: 6px 12px;
}
.room-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--cream-dim);
  font-family: var(--sans);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.room-btn:hover { background: rgba(245, 234, 214, 0.04); color: var(--cream); }
.room-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.room-icon {
  font-size: 16px;
  width: 24px;
  text-align: center;
}

.section-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px 8px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--cream-faint);
}
.count-badge {
  background: var(--ink-700);
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  color: var(--cream-dim);
}

.user-list {
  list-style: none;
  padding: 0 12px;
  overflow-y: auto;
  flex-shrink: 0;
}
.user-list:last-of-type { flex: 1; }

.user-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.user-item:hover { background: rgba(245, 234, 214, 0.04); }
.user-item.active { background: var(--accent-soft); }
.user-item.active .user-name { color: var(--accent); }
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ink-500), var(--ink-600));
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
  text-transform: uppercase;
  position: relative;
}
.user-avatar.online::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--ink-800);
}
.user-name {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.unread-badge {
  background: var(--accent);
  color: var(--ink-900);
  font-size: 10px;
  font-weight: 800;
  font-family: var(--mono);
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(224, 120, 86, 0.5);
  flex-shrink: 0;
}

.empty-list {
  padding: 16px 20px;
  font-size: 12px;
  color: var(--cream-faint);
  font-style: italic;
}
.empty-list.highlight {
  color: var(--accent);
  font-weight: 500;
  font-style: normal;
  background: var(--accent-soft);
  margin: 4px 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--accent);
  text-align: center;
  padding: 12px;
}

/* ============================================
   CHAT MAIN
   ============================================ */
.chat-main {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--ink-900) 0%, var(--ink-800) 100%);
  position: relative;
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(245, 234, 214, 0.05);
  background: rgba(22, 19, 15, 0.5);
  backdrop-filter: blur(10px);
}
.chat-head-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.chat-sub {
  font-size: 11px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cream-faint);
  margin-top: 2px;
}

.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scroll-behavior: smooth;
}

.empty-state {
  margin: auto;
  text-align: center;
  color: var(--cream-faint);
  font-style: italic;
  font-family: var(--serif);
}
.empty-state .empty-icon {
  font-size: 36px;
  color: var(--accent);
  margin-bottom: 12px;
  opacity: 0.6;
}

.msg {
  display: flex;
  gap: 10px;
  max-width: 70%;
  animation: msg-in 0.3s ease;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg.mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ink-500), var(--ink-600));
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
  text-transform: uppercase;
  align-self: flex-end;
  margin-bottom: 4px;
}
.msg.mine .msg-avatar {
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: var(--ink-900);
}

.msg-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.msg-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
  padding: 0 4px;
}
.msg.mine .msg-meta { justify-content: flex-end; }
.msg-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--cream-dim);
}
.msg-time {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--cream-faint);
}

.msg-bubble {
  padding: 10px 14px;
  background: var(--ink-700);
  border: 1px solid rgba(245, 234, 214, 0.05);
  border-radius: var(--radius);
  font-size: 14.5px;
  line-height: 1.45;
  word-wrap: break-word;
  word-break: break-word;
  color: var(--cream);
  position: relative;
}
.msg.mine .msg-bubble {
  background: var(--accent);
  color: var(--ink-900);
  border-color: transparent;
}
.msg.mine .msg-bubble::after { content: ''; }

.msg-bubble.media-bubble {
  padding: 4px;
  background: var(--ink-700);
}
.msg.mine .msg-bubble.media-bubble { background: var(--accent); }
.msg-media {
  max-width: 100%;
  max-height: 320px;
  border-radius: 10px;
  cursor: pointer;
  display: block;
}
.msg-caption {
  padding: 6px 10px 4px;
  font-size: 13px;
}

.msg-actions {
  position: absolute;
  top: -10px;
  right: -10px;
  background: var(--ink-600);
  border: 1px solid rgba(245, 234, 214, 0.1);
  border-radius: 8px;
  padding: 2px;
  display: none;
  gap: 2px;
  box-shadow: var(--shadow-soft);
}
.msg.mine .msg-actions { right: auto; left: -10px; }
.msg-bubble:hover .msg-actions { display: flex; }
.msg-action-btn {
  background: none;
  border: none;
  color: var(--cream-dim);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 5px;
  font-size: 11px;
}
.msg-action-btn:hover { background: rgba(245,234,214,0.1); color: var(--red); }

.msg-deleted {
  font-style: italic;
  color: #ffffff;
  font-size: 13px;
}

/* Read receipts — placed in the msg-meta line next to the timestamp */
.msg-receipt {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  vertical-align: middle;
  transition: color 0.2s ease;
}
.msg-receipt svg {
  display: block;
}
.msg-receipt.sent { color: var(--cream-faint); }     /* dim grey: delivered/sent */
.msg-receipt.read { color: var(--accent-bright); }   /* bright orange: read */

.day-divider {
  text-align: center;
  margin: 18px 0 8px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--cream-faint);
  position: relative;
}
.day-divider::before, .day-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: rgba(245, 234, 214, 0.05);
}
.day-divider::before { left: 0; }
.day-divider::after  { right: 0; }

/* ============================================
   COMPOSER
   ============================================ */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 24px 18px;
  border-top: 1px solid rgba(245, 234, 214, 0.05);
  background: rgba(22, 19, 15, 0.5);
  backdrop-filter: blur(10px);
}

#message-input {
  flex: 1;
  background: var(--ink-700);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--cream);
  resize: none;
  outline: none;
  max-height: 140px;
  line-height: 1.4;
  transition: border-color 0.15s;
}
#message-input:focus { border-color: var(--accent); }
#message-input::placeholder { color: var(--cream-faint); }

.btn-send {
  background: var(--accent);
  color: var(--ink-900);
  border: none;
  border-radius: var(--radius);
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-send:hover:not(:disabled) {
  background: var(--accent-bright);
  transform: translateY(-1px);
}
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; }

.upload-btn {
  width: 44px; height: 44px;
  background: var(--ink-700);
  border-radius: var(--radius);
  flex-shrink: 0;
}
.upload-btn:hover { background: var(--ink-600); color: var(--accent); }

.upload-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--accent);
  max-width: 240px;
}
.upload-preview span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.upload-preview button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
}

.upload-progress {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink-700);
  border: 1px solid rgba(245,234,214,0.1);
  border-radius: var(--radius);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--cream-dim);
  min-width: 240px;
}
.upload-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--ink-500);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.upload-progress-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  width: var(--progress, 0%);
  transition: width 0.2s;
}

/* ============================================
   LIGHTBOX
   ============================================ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  animation: fade-in 0.2s ease;
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.lightbox-close {
  position: absolute;
  top: 20px; right: 20px;
  background: rgba(255,255,255,0.1);
  border: none;
  color: var(--cream);
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}
.lightbox-content img,
.lightbox-content video {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 12px;
}

/* ============================================
   SCROLLBARS
   ============================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--ink-500);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-400); }

/* ============================================
   RESPONSIVE / MOBILE
   ============================================ */

/* Mobile-only utility — hidden on desktop, shown on mobile */
/* Note: no !important so JS can hide individual buttons via .hidden class */
.mobile-only { display: none; }
.mobile-only.hidden { display: none !important; }

/* Sidebar overlay — only visible on mobile when sidebar is open */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9;
  opacity: 0;
  transition: opacity 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

@media (max-width: 768px) {
  /* Use dynamic viewport height so mobile browser bars don't crop the composer */
  html, body { height: 100dvh; }

  .app-shell {
    grid-template-columns: 1fr;
    height: 100dvh;
  }

  /* Sidebar slides in as drawer */
  .sidebar {
    position: fixed;
    inset: 0;
    width: 85%;
    max-width: 340px;
    z-index: 10;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    /* Respect iPhone notch/home indicator */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar.open { transform: translateX(0); }

  /* Show mobile-only buttons */
  .mobile-only { display: flex; }
  .mobile-only.hidden { display: none; }

  /* Chat head adjusts to fit nav buttons */
  .chat-head {
    padding: 14px 14px;
    gap: 10px;
    /* Account for iPhone notch in landscape/portrait */
    padding-top: max(14px, env(safe-area-inset-top));
  }
  .menu-btn, .back-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0;
  }
  .chat-head-info {
    flex: 1;
    min-width: 0;
  }
  .chat-title {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Login responsive bits */
  .login-title { font-size: 32px; }
  .login-card { padding: 32px 24px 24px; }

  /* Chat layout */
  .messages-area {
    padding: 14px;
    gap: 6px;
  }
  .composer {
    padding: 10px 12px;
    gap: 8px;
    /* Account for iPhone home indicator */
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  .msg { max-width: 88%; }

  /* Slightly bigger tap targets */
  .btn-send, .upload-btn {
    width: 42px;
    height: 42px;
  }

  /* Prevent iOS zoom-on-focus by ensuring input font is >=16px */
  #message-input,
  .field input,
  .search-box input {
    font-size: 16px;
  }
}

/* Very small screens — extra trim */
@media (max-width: 380px) {
  .me-card { padding: 12px 14px; }
  .search-box { margin: 10px 12px 6px; }
  .messages-area { padding: 10px; }
  .composer { padding: 8px 10px; gap: 6px; }
  .msg-bubble { font-size: 14px; padding: 8px 12px; }
}
