/* =========================================================
   Live Chat — Messenger-Inspired Theme (full feature port)
   ========================================================= */
:root {
  --bg: #0a0a0f;
  --sidebar-bg: #111118;
  --surface: #16161e;
  --surface-2: #1e1e2a;
  --surface-3: #262636;
  --border: rgba(255,255,255,0.06);
  --text: #e8e8ee;
  --text-2: #9494a8;
  --text-3: #6b6b80;
  --primary: #5b5fea;
  --primary-hover: #7074f0;
  --primary-rgb: 91,95,234;
  --green: #22c55e;
  --green-rgb: 34,197,94;
  --red: #ef4444;
  --bubble-mine: #5b5fea;
  --bubble-mine-text: #fff;
  --bubble-them: #1e1e2a;
  --bubble-them-text: #e8e8ee;
  --bubble-system: transparent;
  --bubble-system-text: var(--text-2);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
--transition: 0.2s cubic-bezier(.4,0,.2,1);
}

/* ===== App theme toggle (whole chat.php): light theme ===== */
html.chat-theme-light {
  --bg: #eef0f3;
  --sidebar-bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e4e6eb;
  --border: rgba(0,0,0,0.08);
  --text: #050505;
  --text-2: #65676b;
  --text-3: #8b8d98;
  --primary: #0084ff;
  --primary-hover: #0071e3;
  --primary-rgb: 0,132,255;
  --green: #22c55e;
  --red: #e0245e;
  --bubble-mine: #0084ff;
  --bubble-mine-text: #ffffff;
  --bubble-them: #3a3f4b;
  --bubble-them-text: #ffffff;
  --bubble-system-text: #65676b;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ===== AUTH VIEW ===== */
.auth-view {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(91,95,234,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(34,197,94,0.06) 0%, transparent 50%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 40px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.auth-logo { margin-bottom: 20px; }

.auth-logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  font-size: 28px;
  color: #fff;
}

.auth-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.auth-subtitle { color: var(--text-2); font-size: 13px; margin-bottom: 28px; }

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}
.auth-tab.active { background: var(--primary); color: #fff; }

.auth-form { text-align: left; }

.auth-field { position: relative; margin-bottom: 14px; }

.auth-field i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 14px;
  pointer-events: none;
}

.auth-field input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}
.auth-field input::placeholder { color: var(--text-3); }
.auth-field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.15); }

.auth-btn {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-xs);
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 4px;
}
.auth-btn:hover { background: var(--primary-hover); }
.auth-btn:active { transform: scale(0.98); }

.auth-msg { margin-top: 14px; font-size: 13px; min-height: 18px; }
.auth-msg.error { color: var(--red); }
.auth-msg.success { color: var(--green); }

.auth-back {
  display: inline-block;
  margin-top: 20px;
  color: var(--text-3);
  font-size: 12px;
  text-decoration: none;
  transition: var(--transition);
}
.auth-back:hover { color: var(--primary); }

.chat-auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 18px 0 12px;
  color: var(--text-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.chat-auth-divider::before,
.chat-auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.chat-auth-friendstag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}
.chat-auth-friendstag i { color: var(--primary); }
.chat-auth-friendstag:hover {
  background: var(--surface-3);
  border-color: var(--primary);
  color: var(--text);
  text-decoration: none;
}

/* ===== CHAT LAYOUT ===== */
.messenger-app { height: 100vh; height: var(--kb-h, 100dvh); overflow: hidden; }
.chat-view { display: flex; height: 100vh; height: var(--kb-h, 100vh); }

.chat-container {
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 300px;
  min-width: 300px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  z-index: 20;
}

.sidebar-header { padding: 14px 14px 10px; border-bottom: 1px solid var(--border); }

.sidebar-user { display: flex; align-items: center; gap: 12px; }

.chat-chip-avatar-wrap { position: relative; width: 42px; height: 42px; flex-shrink: 0; }
.sidebar-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }

.avatar-frame-overlay {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  pointer-events: none;
  z-index: 2;
}

.sidebar-avatar-edit {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border: 2px solid var(--sidebar-bg);
  border-radius: 50%;
  font-size: 8px;
  cursor: pointer;
  z-index: 3;
  transition: var(--transition);
}
.sidebar-avatar-edit:hover { background: var(--primary-hover); }

.sidebar-user-info { overflow: hidden; }

.sidebar-username {
  display: block;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-role { display: block; font-size: 11px; color: var(--text-3); margin-top: 1px; text-transform: capitalize; }

.sidebar-pm-btn { margin-left: auto; position: relative; flex-shrink: 0; }

.pm-unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: #fff;
  border: 2px solid var(--sidebar-bg);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

.sidebar-search { position: relative; padding: 10px 14px 6px; }
.sidebar-search i { position: absolute; left: 26px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 12px; }
.sidebar-search input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}
.sidebar-search input:focus { border-color: var(--primary); }
.sidebar-search input::placeholder { color: var(--text-3); }

.sidebar-section-title {
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidebar-section-title i { color: var(--text-3); font-size: 11px; }

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}
.sidebar-list::-webkit-scrollbar { width: 4px; }
.sidebar-list::-webkit-scrollbar-track { background: transparent; }
.sidebar-list::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }

.chatter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.chatter-item:hover { background: var(--surface-2); }
.chatter-item.active { background: var(--surface-3); }

.chatter-avatar-hold { position: relative; flex-shrink: 0; display: flex; }
.chatter-avatar-wrap { position: relative; width: 38px; height: 38px; display: block; flex-shrink: 0; }
.chatter-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }

.chatter-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  background: #fff;
  border: 2px solid var(--sidebar-bg);
  border-radius: 50%;
  z-index: 3;
}

.chatter-info { overflow: hidden; }

.chatter-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
}

.chatter-role-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 2px;
  text-transform: uppercase;
  vertical-align: middle;
  letter-spacing: 0.03em;
}
.badge-admin { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-moderator { background: rgba(251,191,36,0.15); color: #fbbf24; }
.badge-dj { background: rgba(91,95,234,0.15); color: #818cf8; }
.badge-station_manager { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-station_owner { background: rgba(244,114,182,0.15); color: #f472b6; }
.badge-vip { background: rgba(34,197,94,0.15); color: #4ade80; }
.badge-owner { background: rgba(244,114,182,0.15); color: #f472b6; }
.badge-developer { background: rgba(168,85,247,0.15); color: #c084fc; }

.chatter-pm-btn {
  margin-left: auto;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-3);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.chatter-pm-btn:hover { background: var(--surface-3); color: var(--primary); }

.chatter-empty {
  text-align: center;
  padding: 34px 16px;
  color: var(--text-3);
  font-size: 13px;
}
.chatter-empty i { display: block; font-size: 26px; margin-bottom: 10px; opacity: 0.35; }

/* ---- Top chatters slider ---- */
.top-chatters-box { padding: 2px 0 8px; border-bottom: 1px solid var(--border); }
.top-chatters-box .sidebar-section-title { display: flex; align-items: center; justify-content: space-between; }
.top-chatters-nav { display: inline-flex; gap: 4px; }
.top-chatters-prev,
.top-chatters-next {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: none;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 10px;
  cursor: pointer;
  transition: var(--transition);
}
.top-chatters-prev:hover,
.top-chatters-next:hover { background: var(--surface-3); color: var(--text); }

.top-chatters-viewport { overflow: hidden; }
.top-chatters-track { display: flex; flex-wrap: nowrap; will-change: transform; }

.top-chatter-card {
  flex: 0 0 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px 8px;
  position: relative;
  background: var(--surface);
  border-top: 2px solid transparent;
}
.top-chatter-rank-1 { border-top-color: rgba(251,191,36,0.5); background: linear-gradient(180deg, rgba(251,191,36,0.08), transparent); }
.top-chatter-rank-2 { border-top-color: rgba(203,213,225,0.35); }
.top-chatter-rank-3 { border-top-color: rgba(205,127,50,0.4); }

.top-chatter-rank {
  position: absolute;
  top: 2px;
  left: 4px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  background: var(--surface-3);
  color: var(--text-2);
  z-index: 3;
}
.top-chatter-rank.rank-1 { background: radial-gradient(circle at 30% 30%, #fff7cc, #fbbf24); color: #7c4a00; box-shadow: 0 0 10px rgba(251,191,36,0.5); }
.top-chatter-rank.rank-2 { background: #cbd5e1; color: #475569; }
.top-chatter-rank.rank-3 { background: #b9702e; color: #fff; }

.top-chatter-avatar-btn { position: relative; }
.top-chatter-avatar-img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.top-chatter-card .chatter-avatar-wrap { width: 44px; height: 44px; }
.top-chatter-medal { position: absolute; top: -7px; right: -7px; font-size: 13px; color: #fde047; text-shadow: 0 0 6px rgba(250,204,21,0.8); }
.top-chatter-medal.medal-silver { color: #cbd5e1; text-shadow: 0 0 6px rgba(203,213,225,0.8); }
.top-chatter-medal.medal-bronze { color: #cd7f32; text-shadow: 0 0 6px rgba(205,127,50,0.8); }

.top-chatter-name {
  font-size: 11px;
  font-weight: 600;
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-chatter-count { font-size: 9.5px; color: var(--text-3); }

/* ---- Quiz scoreboard (sidebar) ---- */
.quiz-scoreboard-card {
  border-top: 1px solid var(--border);
  padding-bottom: 6px;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}
.quiz-score-list { padding: 0 8px; }

.quiz-score-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}
.quiz-score-item:hover { background: var(--surface-2); }

.quiz-score-rank {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
  font-weight: 700;
  font-size: 11px;
  position: relative;
}
.quiz-score-rank.rank-1 { background: radial-gradient(circle at 30% 30%, #fff7cc, #fbbf24); color: #7c4a00; box-shadow: 0 0 10px rgba(251,191,36,0.5); }
.quiz-score-rank.rank-2 { background: #cbd5e1; color: #475569; }
.quiz-score-rank.rank-3 { background: #b9702e; color: #fff; }
.quiz-score-medal { position: absolute; top: -8px; right: -8px; font-size: 10px; color: #fde047; text-shadow: 0 0 6px rgba(250,204,21,0.8); }

.quiz-score-avatar-btn { flex-shrink: 0; display: flex; }
.quiz-score-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }

.quiz-score-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.quiz-score-meta { font-size: 10.5px; color: var(--text-3); white-space: nowrap; }

.chatter-chip { font-size: 12px; color: var(--text-3); padding: 6px 10px; display: block; text-align: center; }
.chatter-chip.empty { font-style: italic; }

/* ---- Sidebar footer ---- */
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.sidebar-coins {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  color: #fbbf24;
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
}

.sidebar-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-3);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}
.sidebar-btn:hover { background: var(--surface-2); color: var(--text); }
.sidebar-btn.danger:hover { background: rgba(239,68,68,0.1); color: var(--red); }

/* ===== MAIN CHAT ===== */
.chat-main {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.chat-container.chat-has-bg-image .chat-main,
.chat-container.chat-has-bg-image .chat-msg-scroll {
  background: transparent;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 30;
  flex-shrink: 0;
}

.chat-header-back {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}

.chat-header-info { flex: 1; min-width: 0; }

.chat-header-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header-title i { color: var(--primary); font-size: 14px; }

.chat-header-status {
  font-size: 11px;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

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

.chat-header-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-2);
  font-size: 15px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.chat-header-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

#btnChatAudio { color: #facc15; }
#btnChatAudio.playing {
  color: #ffd84d;
  background: rgba(250, 204, 21, 0.14);
  animation: chat-audio-pulse 1.8s ease-in-out infinite;
}
@keyframes chat-audio-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0); }
  50% { box-shadow: 0 0 0 5px rgba(250, 204, 21, 0.18); }
}

.chat-header-btn { position: relative; }
.chat-inbox-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: #fff;
  border: 1.5px solid var(--sidebar-bg);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
}

/* Radio music marquee */
.chat-radio-marquee {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 180px;
  min-width: 0;
  color: #facc15;
  font-size: 12px;
}
.chat-radio-marquee > .fas { font-size: 11px; opacity: 0.9; flex-shrink: 0; }
.chat-radio-marquee-wrap {
  overflow: hidden;
  white-space: nowrap;
  min-width: 0;
}
.chat-radio-marquee-inner {
  display: inline-flex;
  white-space: nowrap;
  will-change: transform;
  color: var(--text-2);
  font-weight: 500;
}
.chat-radio-marquee-inner.marquee-on { animation: radio-marquee-scroll 14s linear infinite; }
.chat-radio-marquee-inner .m-text { padding-right: 44px; }
@keyframes radio-marquee-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Store dropdown */
.chat-store-dd-wrap { position: relative; }
.chat-store-dd {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 176px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  display: none;
  z-index: 40;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
}
.chat-store-dd.open { display: block; }
.chat-store-dd-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}
.chat-store-dd-item i { color: var(--primary); width: 16px; text-align: center; font-size: 12px; }
.chat-store-dd-item:hover { background: var(--surface-3); }

/* ===== CHAT EFFECTS (floating room effect) ===== */
.chat-effects {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 6;
}

.header-float-confetti { position: absolute; top: -24px; left: 0; border-radius: 2px; animation: fx-confetti-fall linear infinite; pointer-events: none; }
@keyframes fx-confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(108vh) rotate(720deg); opacity: 0.15; }
}

.header-float-bubble,
.header-float-bubble2 {
  position: absolute;
  bottom: -24px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.32), rgba(255,255,255,0.05) 62%);
  border: 1px solid rgba(255,255,255,0.14);
  animation: fx-bubble-rise linear infinite;
  pointer-events: none;
}
.header-float-bubble2 { background: radial-gradient(circle at 30% 30%, rgba(148,163,255,0.4), rgba(91,95,234,0.12) 62%); border-color: rgba(148,163,255,0.18); }
@keyframes fx-bubble-rise {
  0% { transform: translateY(0); opacity: 0; }
  12% { opacity: 0.6; }
  100% { transform: translateY(-108vh); opacity: 0; }
}

.header-float-rain { position: absolute; top: -24px; width: 1px; background: linear-gradient(180deg, rgba(147,197,253,0), rgba(147,197,253,0.85)); animation: fx-rain-fall linear infinite; pointer-events: none; }
@keyframes fx-rain-fall {
  0% { transform: translateY(0); opacity: 0.5; }
  100% { transform: translateY(108vh); opacity: 0.1; }
}

.header-float-firefly {
  position: absolute;
  bottom: -12px;
  border-radius: 50%;
  animation: fx-firefly-drift linear infinite;
  pointer-events: none;
}
@keyframes fx-firefly-drift {
  0% { transform: translate(0, 0); opacity: 0; }
  15% { opacity: 0.9; }
  50% { transform: translate(42px, -36vh); opacity: 0.7; }
  85% { opacity: 0.5; }
  100% { transform: translate(-28px, -106vh); opacity: 0; }
}

.header-float-star,
.header-float-sparkle {
  position: absolute;
  line-height: 1;
  animation: fx-twinkle ease-in-out infinite;
  pointer-events: none;
}
@keyframes fx-twinkle {
  0%, 100% { opacity: 0.12; transform: scale(0.7) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.15) rotate(16deg); }
}

.header-float-occ { position: absolute; top: -26px; left: 0; line-height: 1; animation: fx-occ-fall linear infinite; pointer-events: none; }
@keyframes fx-occ-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  85% { opacity: 0.9; }
  100% { transform: translateY(105vh) rotate(28deg); opacity: 0; }
}

.header-fireworks-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* ===== QUIZ BANNER ===== */
.chat-quiz-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: linear-gradient(90deg, rgba(251,191,36,0.12), rgba(251,191,36,0.04));
  border-bottom: 1px solid rgba(251,191,36,0.25);
  font-size: 12.5px;
  flex-shrink: 0;
  cursor: default;
}
.chat-quiz-banner > i.fa-bolt { color: #fbbf24; }
.quiz-banner-question { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quiz-banner-prize {
  margin-left: auto;
  color: #fbbf24;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

/* ===== CHAT SEEN BAR ===== */
.chat-seen-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  position: relative;
  flex-shrink: 0;
}
.chat-seen-label { color: var(--text-3); font-weight: 600; text-transform: uppercase; font-size: 10px; letter-spacing: 0.05em; }
.chat-seen-list { display: flex; position: relative; }
.chat-seen-user { position: relative; width: 26px; height: 26px; margin-left: -8px; z-index: 1; cursor: pointer; flex-shrink: 0; transition: var(--transition); }
.chat-seen-user:first-child { margin-left: 0; }
.chat-seen-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; border: 2px solid var(--surface); transition: var(--transition); }
.chat-seen-user:hover { z-index: 20; }
.chat-seen-user:hover .chat-seen-avatar { transform: translateY(-3px); box-shadow: 0 4px 10px rgba(0,0,0,0.4); }
.chat-seen-list:hover .chat-seen-user { margin-left: 0; }
.chat-seen-more {
  min-width: 26px;
  height: 26px;
  margin-left: -6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--surface);
  color: var(--text-2);
  font-size: 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.chat-seen-more:hover { background: var(--surface-3); color: var(--text); }

.chat-seen-name { color: var(--text); font-weight: 600; margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }

.chat-seen-popup {
  position: absolute;
  top: calc(100% + 6px);
  left: 16px;
  width: 240px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  padding: 8px;
  z-index: 40;
}
.chat-seen-popup-list { max-height: 220px; overflow-y: auto; }
.chat-seen-popup-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; }
.chat-seen-popup-row:hover { background: var(--surface-3); }
.chat-seen-popup-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.chat-seen-popup-name { font-size: 12.5px; }

/* ===== CHAT NOTES STRIP (Messenger-style note cards: bubble with tail above avatar) ===== */
.chat-notes {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  overflow-x: auto;
  padding: 12px 16px;
  background: #ffffff;
  border-bottom: 1px solid #e4e6eb;
  scrollbar-width: thin;
  scrollbar-color: #d0d2d6 transparent;
  cursor: grab;
  flex-shrink: 0;
}
.chat-notes.dragging { cursor: grabbing; user-select: none; }
.chat-note {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 0;
  padding: 0;
  flex-shrink: 0;
  max-width: 190px;
  cursor: pointer;
}
.chat-note-column { min-width: 0; }
.chat-note-body {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f0f2f5;
  border-radius: 12px;
  padding: 7px 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  transition: background 0.15s ease;
}
.chat-note-body::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #f0f2f5;
  z-index: -1;
}
.chat-note:hover .chat-note-body { background: #e4e6eb; }
.chat-note:hover .chat-note-body::after { background: #e4e6eb; }
.chat-note.mine .chat-note-body { background: #e0f0ff; }
.chat-note.mine .chat-note-body::after { background: #e0f0ff; }
.chat-note.mine:hover .chat-note-body { background: #d2e8fa; }
.chat-note.mine:hover .chat-note-body::after { background: #d2e8fa; }
.chat-note-text { font-size: 12.5px; line-height: 1.35; color: #050505; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-note-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  flex-shrink: 0;
  background: #e4e6eb;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.btn-chat-note-edit {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 0;
  border-radius: 50%;
  color: #0084ff;
  font-size: 9px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-chat-note-edit:hover { background: #0084ff; color: #ffffff; }
.pm-inbox > .chat-notes { order: -1; flex-shrink: 0; padding: 12px 16px; }
.chat-pm-search {
  order: -2;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 10px;
  padding: 6px 12px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 20px;
  background: #fff;
}
.chat-pm-search-icon { color: #6b7280; font-size: 12px; }
.chat-pm-search-input {
  flex: 1;
  min-width: 0;
  display: block;
  resize: none;
  overflow: hidden;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  line-height: 1.4;
  color: #000;
  font-family: var(--font);
}
.chat-pm-search-input::placeholder { color: #9aa3af; }
.chat-pm-search-clear {
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
}
.chat-pm-search-clear:hover { color: #e53e3e; }

/* ===== MESSAGES ===== */
.chat-msg-scroll {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}
.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }

.chat-jump-latest {
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px) scale(0.85);
  transition: opacity 0.25s, transform 0.25s;
}
.chat-jump-latest.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0) scale(1);
}
.chat-jump-latest::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 9px solid var(--primary);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}
.chat-jump-latest-avatar {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
  background: var(--surface-3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}
.chat-jump-latest-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.chat-welcome { margin: auto; text-align: center; padding: 40px 20px; max-width: 320px; }
.chat-welcome-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(var(--primary-rgb), 0.1);
  font-size: 30px;
  color: var(--primary);
  margin-bottom: 16px;
}
.chat-welcome h3 { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.chat-welcome p { font-size: 13px; color: var(--text-2); }

/* ---- Message row ---- */
.chat-message {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  max-width: 80%;
  position: relative;
  animation: msgIn 0.2s ease;
}
.chat-message:not(.system) {
  position: relative;
  padding-left: 44px;
}
.chat-message:not(.system) > .chat-msg-avatar,
.chat-message:not(.system) > .chat-msg-avatar-wrap {
  position: absolute;
  left: 0;
  top: 2px;
  margin-top: 0;
}
.chat-message.mine:not(.system) { margin-left: auto; justify-content: flex-end; padding-left: 0; }

@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  cursor: pointer;
  background: var(--surface-2);
  margin-top: 2px;
}
.chat-msg-avatar-wrap {
  position: relative;
  align-self: flex-start;
  flex-shrink: 0;
  margin-top: 2px;
  width: 34px;
  height: 34px;
}
.chat-msg-avatar-wrap .chat-msg-avatar { width: 34px; height: 34px; margin: 0; }

/* ---- Bubble ---- */
.chat-msg-body {
  position: relative;
  background: var(--bubble-them);
  color: var(--bubble-them-text);
  padding: 9px 14px;
  border-radius: 20px;
  border-bottom-left-radius: 6px;
  max-width: 100%;
  min-width: 0;
  flex-shrink: 1;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
}
.chat-message.mine .chat-msg-body { background: var(--bubble-mine); color: var(--bubble-mine-text); border-bottom-left-radius: 20px; border-bottom-right-radius: 6px; box-shadow: 0 2px 10px rgba(30,144,255,0.18); max-width: 100%; }

.chat-msg-body.has-user-bg { background-repeat: no-repeat; background-size: 100% 100%; background-position: center; }
.chat-msg-body.has-user-bg::after { display: none; }
.chat-msg-body.is-reply { padding-top: 8px; }
.chat-msg-body.image-only { display: inline-flex; flex-direction: column; padding: 0; background: none; box-shadow: none; border: none; width: auto; max-width: 100%; justify-content: center; align-items: center; }
.chat-message.mine .chat-msg-body.image-only { margin-left: auto; margin-right: 0; max-width: min(100%, 320px); }
.chat-msg-body.image-only .chat-msg-sticker { margin: 0; width: auto; height: auto; max-width: min(100%, 200px); max-height: 200px; min-width: 0; object-fit: contain; padding: 5px; background: #2f2f40; border: none; border-radius: 12px; }
.chat-message.mine .chat-msg-body.image-only .chat-msg-sticker { background: var(--bubble-mine); box-shadow: 0 2px 10px rgba(30,144,255,0.18); }
.chat-msg-body.image-only.has-user-bg { background-repeat: no-repeat; background-size: 100% 100%; background-position: center; padding: 10px; }
.chat-msg-body.image-only.has-user-bg:has(.chat-msg-sticker) { padding: 0; }
.chat-msg-body.image-only.has-user-bg .chat-msg-sticker,
.chat-message.mine .chat-msg-body.image-only.has-user-bg .chat-msg-sticker { background: transparent; }
.chat-msg-body.image-only .chat-msg-image { margin: 0; max-width: min(100%, 320px); max-height: 260px; width: auto; height: auto; object-fit: cover; padding: 3px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.10); background: #2f2f40; }
.chat-message.mine .chat-msg-body.image-only .chat-msg-image { background: var(--bubble-mine); border-color: transparent; box-shadow: 0 2px 10px rgba(30,144,255,0.18); }
.chat-msg-body.image-only.has-user-bg .chat-msg-image,
.chat-message.mine .chat-msg-body.image-only.has-user-bg .chat-msg-image { background: rgba(15, 15, 22, 0.45); }
.chat-msg-body.image-only .chat-msg-name { display: none; }
.chat-msg-body.image-only .chat-text { display: none; }
.chat-message.mine .chat-msg-body.image-only .chat-msg-sticker { margin-left: auto; margin-right: 0; }
.chat-msg-body.image-only:has(.chat-msg-sticker) { padding: 0; }
.chat-msg-body.image-only .chat-msg-sticker { padding: 5px; min-width: 0; min-height: 0; }
.chat-message.mine:has(.chat-msg-body.image-only .chat-msg-sticker) { justify-content: flex-end; margin-left: auto; margin-right: 0; }
.chat-message.mine:has(.chat-msg-body.image-only .chat-msg-sticker) .chat-msg-actions { padding-left: 0; justify-content: flex-end; }
.chat-message:has(.chat-msg-body.image-only) + .chat-message:has(.chat-msg-body.image-only) { margin-top: -8px; }

/* ---- TikTok-style animal speech sticker ---- */
.chat-msg-animal-sticker {
  position: absolute;
  top: -12px;
  right: -12px;
  z-index: 3;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  background: #fff;
  border-radius: 9px 9px 9px 3px;
  box-shadow: 0 2px 7px rgba(0,0,0,0.22);
  animation: chatAnimalPop 0.45s cubic-bezier(.2,.9,.3,1.5) both;
  pointer-events: none;
}
.chat-msg-animal-sticker img {
  width: 18px;
  height: 12px;
  border-radius: 2px;
}
.chat-msg-animal-sticker::after {
  content: "";
  position: absolute;
  left: 5px;
  bottom: -4px;
  width: 8px;
  height: 8px;
  background: #fff;
  transform: rotate(45deg);
  box-shadow: 2px 2px 3px rgba(0,0,0,0.12);
}
.chat-message.mine .chat-msg-animal-sticker {
  right: auto;
  left: -12px;
  border-radius: 9px 9px 3px 9px;
}
.chat-message.mine .chat-msg-animal-sticker::after {
  left: auto;
  right: 5px;
  box-shadow: -2px 2px 3px rgba(0,0,0,0.12);
}
@keyframes chatAnimalPop {
  0% { opacity: 0; transform: scale(0.2) rotate(-12deg); }
  60% { opacity: 1; transform: scale(1.2) rotate(6deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

.chat-reply-tag {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-2);
  background: rgba(255,255,255,0.06);
  border-left: 2px solid var(--primary);
  border-radius: 8px;
  padding: 4px 9px;
  margin-bottom: 5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.chat-reply-tag i { font-size: 9px; }
.chat-message.mine .chat-reply-tag { border-left-color: rgba(255,255,255,0.4); }

.chat-msg-name { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 3px; padding-left: 4px; max-width: 100%; overflow: hidden; }
.chat-msg-main { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.chat-message.mine .chat-msg-name { display: none; }

.chat-username {
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}
.chat-username.has-bg { display: inline-block; padding: 1px 7px; border-radius: 9px; line-height: 1.5; }

.chat-role-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: middle;
  line-height: 1.5;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.14);
}
.chat-role-badge.vip { background: rgba(245,158,11,0.16); color: #fbbf24; border-color: rgba(245,158,11,0.4); }
.chat-role-badge.dj { background: rgba(236,72,153,0.16); color: #f472b6; border-color: rgba(236,72,153,0.4); }
.chat-role-badge.moderator { background: rgba(16,185,129,0.16); color: #34d399; border-color: rgba(16,185,129,0.4); }
.chat-role-badge.station_manager { background: rgba(16,185,129,0.16); color: #34d399; border-color: rgba(16,185,129,0.4); }
.chat-role-badge.station_owner { background: rgba(244,114,182,0.16); color: #f472b6; border-color: rgba(244,114,182,0.4); }
.chat-role-badge.owner { background: rgba(244,114,182,0.16); color: #f472b6; border-color: rgba(244,114,182,0.4); }
.chat-role-badge.admin { background: rgba(239,68,68,0.16); color: #f87171; border-color: rgba(239,68,68,0.4); }
.chat-role-badge.developer { background: rgba(168,85,247,0.16); color: #c084fc; border-color: rgba(168,85,247,0.4); }
.chat-role-badge.custom { background: rgba(148,163,184,0.16); color: #cbd5e1; border-color: rgba(148,163,184,0.35); }

.chat-text { display: block; color: white; font-size: 0.85rem; line-height: 1.45; margin: 2px 0 0; word-break: break-word; overflow-wrap: anywhere; text-align: left; }
.chat-text.chat-text-short { font-size: 16px; line-height: 1.4; }
.chat-text a { color: inherit; text-decoration: underline; }
.chat-msg-edited { font-size: 10.5px; color: var(--text-3); font-weight: 400; white-space: nowrap; }

.chat-msg-image {
  max-width: min(100%, 280px);
  max-height: 260px;
  border-radius: 12px;
  margin-top: 4px;
  display: block;
  cursor: pointer;
  object-fit: cover;
}
.chat-msg-sticker {
  min-width: 90px;
  min-height: 90px;
  max-width: min(100%, 140px);
  max-height: 140px;
  object-fit: contain;
  display: block;
  margin-top: 2px;
  border-radius: 12px;
  cursor: pointer;
}
.chat-msg-sticker.sticker-sharp {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.chat-msg-voice { max-width: 220px; height: 38px; margin-top: 2px; display: block; }

/* ---- Reactions (Messenger style: react button hangs off the bubble edge, pills overlap its bottom corner) ---- */
.btn-msg-react {
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.chat-message:hover .btn-msg-react,
.chat-message:focus-within .btn-msg-react,
.chat-message.show-react .btn-msg-react,
.btn-msg-react:focus-visible { opacity: 1; pointer-events: auto; }
/* Other users: react button hangs off the bubble's outer-right edge */
.chat-message:not(.mine) .btn-msg-react { right: auto; left: 100%; margin-right: 0; margin-left: 6px; }
.btn-msg-react:hover { background: var(--surface-3); border-color: var(--primary); }
.btn-msg-react.reacted { background: rgba(var(--primary-rgb), 0.18); border-color: var(--primary); color: #fff; box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.4); }
.btn-msg-react.reacted i { animation: react-pop 0.3s ease; }
.react-default-emoji { font-size: 13px; animation: emoji-pulse 2s ease-in-out infinite; }

@keyframes react-pop {
  0% { transform: scale(0.4); }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

@keyframes emoji-pulse {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.15) rotate(-5deg); }
    50% { transform: scale(1) rotate(0deg); }
75% { transform: scale(1.15) rotate(5deg); }
}

/* Reaction pills overlap the bubble's bottom corner (Messenger style) */
.chat-reactions {
  position: absolute;
  bottom: -9px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 200px;
}
.chat-container .chat-reactions {
  position: absolute;
  bottom: -9px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 200px;
}
.chat-message:not(.mine) .chat-reactions {
  left: 0;
  right: auto;
  justify-content: flex-start;
  flex-wrap: nowrap;
  max-width: 100%;
}
.chat-container .chat-message:not(.mine) .chat-reactions {
  left: 0;
  right: auto;
  justify-content: flex-start;
  flex-wrap: nowrap;
  max-width: 100%;
}
.chat-message.mine .chat-reactions {
  right: 0;
  left: auto;
  justify-content: flex-end;
  flex-wrap: nowrap;
  max-width: 100%;
}
.chat-container .chat-message.mine .chat-reactions {
  right: 0;
  left: auto;
  justify-content: flex-end;
  flex-wrap: nowrap;
  max-width: 100%;
}

/* Keep the bubble tall enough so overlaid chips never clip it */
.chat-message.has-reactions .chat-msg-body { margin-bottom: 6px; }

.react-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 0 solid transparent;
  border-radius: 999px;
  padding: 2px 8px 2px 6px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  user-select: none;
}
.react-pill:hover { transform: translateY(-1px); }
.react-pill.active { color: #fff; }
.react-pill-count { font-size: 11px; font-weight: 700; color: #fff; }
.react-pill-emoji {
    display: inline-block;
    animation: emoji-wiggle 2.5s ease-in-out infinite;
}
@keyframes emoji-wiggle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    20% { transform: scale(1.2) rotate(-8deg); }
    40% { transform: scale(1) rotate(0deg); }
    60% { transform: scale(1.2) rotate(8deg); }
    80% { transform: scale(1) rotate(0deg); }
}
@keyframes react-pill-in {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---- Actions row (under bubble) ---- */
.chat-msg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  order: 1;
  margin-top: 3px;
  padding-left: 44px;
  opacity: 0.45;
  transition: opacity 0.15s ease;
}
.chat-message:hover .chat-msg-actions,
.chat-message:focus-within .chat-msg-actions,
.chat-message.show-react .chat-msg-actions { opacity: 1; }
.chat-message.mine .chat-msg-actions { padding-left: 0; justify-content: flex-end; }

.chat-time { font-size: 11px; color: var(--text-3); margin-right: auto; white-space: nowrap; }
.chat-message.mine .chat-time { margin-right: 0; margin-left: auto; }

.btn-msg-pm,
.btn-msg-reply,
.btn-msg-delete {
  background: transparent;
  border: none;
  color: var(--text-3);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  transition: var(--transition);
}
.btn-msg-pm:hover,
.btn-msg-reply:hover { background: var(--surface-2); color: var(--text); }
.btn-msg-delete:hover { background: rgba(239,68,68,0.12); color: var(--red); }

/* ---- Hearts float (chat_effect=hearts) ---- */
.msg-hearts-float {
  position: absolute;
  bottom: 0;
  left: 10%;
  pointer-events: none;
  z-index: 10;
  line-height: 1;
  animation: hearts-float-bottom ease-in-out infinite;
}
@keyframes hearts-float-bottom {
  0% { transform: translateY(0) scale(0.6) rotate(-10deg); opacity: 0; }
  15% { opacity: 0.9; }
  50% { transform: translateY(-18px) scale(1) rotate(10deg); opacity: 0.7; }
  85% { opacity: 0.5; }
  100% { transform: translateY(-34px) scale(0.5) rotate(-5deg); opacity: 0; }
}

/* ---- Space rockets (chat_effect=space_message) ---- */
.chat-message.chat-msg-effect-space_message .space-rocket { position: absolute; top: -8px; right: -30px; pointer-events: none; animation: chat-effect-rocket 1.4s ease-in infinite; }
@keyframes chat-effect-rocket {
  0% { transform: translate(0, 0) rotate(-20deg); opacity: 0; }
  15% { opacity: 1; }
  55% { transform: translate(-46px, -70px) rotate(24deg); opacity: 1; }
  100% { transform: translate(-110px, -168px) rotate(34deg); opacity: 0; }
}

/* ---- Item-effect class tweaks ---- */
.chat-message.chat-msg-effect-neon_join .chat-msg-body { border: 1px solid rgba(34,211,238,0.55); animation: neon-join-blink 4s ease-out forwards; }
.chat-message.chat-msg-effect-royal_entrance .chat-msg-body { border: 1px solid rgba(251,191,36,0.6); }
@keyframes neon-join-blink {
  0% { box-shadow: 0 0 30px rgba(34,211,238,0.9), inset 0 0 20px rgba(34,211,238,0.3); }
  10% { box-shadow: 0 0 0 transparent; }
  20% { box-shadow: 0 0 25px rgba(34,211,238,0.8), inset 0 0 18px rgba(34,211,238,0.25); }
  30% { box-shadow: 0 0 0 transparent; }
  100% { box-shadow: 0 0 0 transparent; }
}

/* ===== SYSTEM MESSAGES ===== */
.chat-message.system {
  width: 100%;
  max-width: 100%;
  text-align: center;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
}

.chat-system-text {
  display: inline-block;
  padding: 4px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-3);
  font-size: 12px;
  font-style: italic;
  max-width: 90%;
  overflow-wrap: anywhere;
}

.btn-msg-delete.system {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 10px;
  cursor: pointer;
  border-radius: 6px;
  transition: var(--transition);
}
.btn-msg-delete.system:hover { color: var(--red); background: rgba(239,68,68,0.1); }

/* ===== Animated radio-station welcome bubble (login/register system post) ===== */
.chat-message.system.welcome {
  animation: chatWelcomeIn 0.7s cubic-bezier(.2,.9,.3,1.2) both;
}
.chat-welcome-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #bbe51e;
  background: rgba(187, 229, 30, 0.12);
  border: 1px solid rgba(187, 229, 30, 0.4);
  box-shadow: 0 0 10px rgba(187, 229, 30, 0.18);
  animation: chatWelcomeIn 0.7s cubic-bezier(.2,.9,.3,1.2) both;
}
.chat-welcome-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #bbe51e;
  box-shadow: 0 0 0 0 rgba(187, 229, 30, 0.5);
  animation: chatWelcomeLivePulse 1.4s ease-in-out infinite;
}
.chat-welcome-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 11px;
}
.chat-welcome-eq i {
  display: block;
  width: 3px;
  margin: 0;
  background: #bbe51e;
  border-radius: 2px;
  animation: chatWelcomeEq 1s ease-in-out infinite;
}
.chat-welcome-eq i:nth-child(1) { animation-delay: -0.9s; }
.chat-welcome-eq i:nth-child(2) { animation-delay: -0.6s; }
.chat-welcome-eq i:nth-child(3) { animation-delay: -0.3s; }
.chat-welcome-eq i:nth-child(4) { animation-delay: -0.7s; }
.chat-message.system.welcome .chat-system-text {
  font-style: normal;
  font-weight: 600;
  color: var(--primary);
  border-color: rgba(var(--primary-rgb), 0.45);
  background: linear-gradient(120deg, rgba(var(--primary-rgb), 0.14), rgba(var(--primary-rgb), 0.32), rgba(var(--primary-rgb), 0.14));
  background-size: 200% 100%;
  box-shadow: 0 0 14px rgba(var(--primary-rgb), 0.25);
  animation: chatWelcomeSweep 2.2s ease-out both;
}
html.chat-theme-light .chat-message.system.welcome .chat-system-text {
  color: var(--primary);
  border-color: rgba(var(--primary-rgb), 0.55);
}
@keyframes chatWelcomeIn {
  0% { opacity: 0; transform: translateY(10px) scale(0.85); }
  60% { opacity: 1; transform: translateY(-2px) scale(1.03); }
  100% { opacity: 1; transform: none; }
}
@keyframes chatWelcomeSweep {
  0% { background-position: 200% 0; }
  100% { background-position: 0% 0; }
}
@keyframes chatWelcomeLivePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(187, 229, 30, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(187, 229, 30, 0); }
}
@keyframes chatWelcomeEq {
  0%, 100% { height: 3px; }
  50% { height: 11px; }
}
.chat-welcome-fm-letter {
  display: inline-block;
  animation: chatWelcomeFmRainbow 3s linear infinite;
}
@keyframes chatWelcomeFmRainbow {
  0%   { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

/* ---- Quiz winner board ---- */
.chat-message.system.quiz-win { background: none; padding: 0; }
.quiz-win-board {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
  padding: 16px 14px;
  background: linear-gradient(135deg, rgba(255,193,7,0.18), rgba(255,46,99,0.16), rgba(168,85,247,0.18));
  border: 1px solid rgba(255,193,7,0.55);
  box-shadow: 0 0 24px rgba(255,193,7,0.35), inset 0 0 18px rgba(255,46,99,0.15);
  animation: quizWinPop 0.6s cubic-bezier(0.2,0.9,0.3,1.4), quizWinGlow 1.8s ease-in-out infinite;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
@keyframes quizWinPop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes quizWinGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(255,193,7,0.3); }
  50% { box-shadow: 0 0 34px rgba(255,46,99,0.55); }
}
.quiz-win-glow {
  position: absolute;
  top: -60%;
  left: -30%;
  width: 160%;
  height: 220%;
  background: conic-gradient(from 0deg, transparent 0 40deg, rgba(255,255,255,0.12) 50deg, transparent 60deg);
  animation: quizWinSweep 2.4s linear infinite;
  pointer-events: none;
}
@keyframes quizWinSweep {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.quiz-win-crown { font-size: 2rem; line-height: 1; animation: quizWinBounce 1s ease-in-out infinite; filter: drop-shadow(0 0 12px rgba(255,193,7,0.9)); }
@keyframes quizWinBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.08); }
}
.quiz-win-title { font-size: 0.95rem; font-weight: 800; letter-spacing: 0.18em; color: #ffc107; text-shadow: 0 0 14px rgba(255,193,7,0.8); }
.quiz-win-text { color: #fff; font-size: 0.8rem; font-weight: 600; line-height: 1.4; max-width: 95%; }

/* ---- Color dice win board ---- */
.chat-message.system.colordice-win { background: none; padding: 0; }
.colordice-win-board {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
  padding: 14px 12px;
  background: linear-gradient(135deg, rgba(255,193,7,0.16), rgba(34,197,94,0.14), rgba(59,130,246,0.16));
  border: 1px solid rgba(255,193,7,0.5);
  box-shadow: 0 0 24px rgba(255,193,7,0.3), inset 0 0 18px rgba(34,197,94,0.12);
  animation: colordiceWinPop 0.6s cubic-bezier(0.2,0.9,0.3,1.4), colordiceWinGlow 1.8s ease-in-out infinite;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
@keyframes colordiceWinPop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes colordiceWinGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(255,193,7,0.28); }
  50% { box-shadow: 0 0 34px rgba(34,197,94,0.5); }
}
.colordice-win-glow {
  position: absolute;
  top: -60%;
  left: -30%;
  width: 160%;
  height: 220%;
  background: conic-gradient(from 0deg, transparent 0 40deg, rgba(255,255,255,0.1) 50deg, transparent 60deg);
  animation: quizWinSweep 2.4s linear infinite;
  pointer-events: none;
}
.colordice-win-dice { font-size: 1.6rem; line-height: 1; }
.colordice-win-title { font-weight: 800; letter-spacing: 0.15em; color: #fde047; text-shadow: 0 0 12px rgba(250,204,21,0.7); font-size: 0.85rem; }
.colordice-win-text { font-size: 0.78rem; color: #fff; font-weight: 600; line-height: 1.45; max-width: 95%; }

/* ---- Color dice roll board ---- */
.chat-message.system.colordice-roll { background: none; padding: 0; }
.colordice-roll-board {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(139,92,246,0.16), rgba(59,130,246,0.12), rgba(16,185,129,0.14));
  border: 1px solid rgba(139,92,246,0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.colordice-roll-board-glow {
  position: absolute;
  top: -60%;
  left: -30%;
  width: 160%;
  height: 220%;
  background: conic-gradient(from 0deg, transparent 0 40deg, rgba(255,255,255,0.1) 50deg, transparent 60deg);
  animation: quizWinSweep 2.4s linear infinite;
  pointer-events: none;
}
.colordice-roll-board-title { position: relative; font-weight: 800; letter-spacing: 0.12em; font-size: 0.8rem; color: #c4b5fd; }
.colordice-roll-board-dice { position: relative; display: flex; gap: 8px; }
.colordice-roll-board-die {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: #fff;
  border: 2px solid rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: dicePop 0.5s cubic-bezier(0.2,0.9,0.3,1.4);
}
.colordice-roll-board-die:nth-child(2) { animation-delay: 0.12s; }
.colordice-roll-board-die:nth-child(3) { animation-delay: 0.24s; }
.colordice-roll-board-text { position: relative; color: var(--text-2); font-size: 0.78rem; }

.colordice-die-dot { width: 30px; height: 30px; border-radius: 50%; background: #ddd; display: block; transition: background 0.1s; }
.colordice-die-dot[data-color="red"]    { background: #ef4444; }
.colordice-die-dot[data-color="blue"]   { background: #3b82f6; }
.colordice-die-dot[data-color="yellow"] { background: #facc15; }
.colordice-die-dot[data-color="green"]  { background: #22c55e; }
.colordice-die-dot[data-color="white"]  { background: #f5f5f5; }
.colordice-die-dot[data-color="pink"]   { background: #f472b6; }

@keyframes diceShake {
  0%   { transform: rotate(0deg) translateY(0); }
  20%  { transform: rotate(16deg) translateY(-7px); }
  40%  { transform: rotate(-14deg) translateY(3px); }
  60%  { transform: rotate(10deg) translateY(-4px); }
  80%  { transform: rotate(-6deg) translateY(2px); }
  100% { transform: rotate(0deg) translateY(0); }
}
@keyframes dicePop {
  0%   { transform: scale(0.35); }
  60%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* ===== CHAT INPUT ===== */
.chat-input-area {
  padding: 8px 16px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  position: relative;
  flex-shrink: 0;
}

.reply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  margin-bottom: 8px;
  background: rgba(var(--primary-rgb), 0.08);
  border-radius: var(--radius-xs);
  border-left: 3px solid var(--primary);
  font-size: 12px;
}
.reply-bar-content { display: flex; align-items: center; gap: 6px; color: var(--text-2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.reply-bar-content b { color: var(--text); }
.reply-bar-close { background: none; border: none; color: var(--text-3); cursor: pointer; padding: 4px; font-size: 11px; transition: var(--transition); }
.reply-bar-close:hover { color: var(--text); }

.chat-image-preview,
.chat-pm-image-preview { position: relative; display: inline-block; margin-bottom: 8px; }
.chat-image-preview img,
.chat-pm-image-preview img { max-width: 200px; max-height: 140px; border-radius: 12px; display: block; object-fit: cover; }

.chat-preview-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 10px;
  cursor: pointer;
  z-index: 2;
  transition: var(--transition);
}
.chat-preview-remove:hover { transform: scale(1.1); }

.chat-input-row { display: flex; align-items: flex-end; gap: 6px; }

.input-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--text-3);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.input-btn:hover { background: var(--surface-2); color: var(--text); }
.input-btn.has-image { color: var(--primary); }

.chat-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: flex-end;
}

.chat-input {
  width: 100%;
  padding: 10px 42px 10px 16px;
  background: var(--surface-2);
border: 1px solid transparent;
  border-radius: 22px;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  outline: none;
  transition: var(--transition);
}
#chatInput.chat-input {
  height: 42px;
  min-height: 42px;
  max-height: 120px;
  line-height: 1.35;
  box-sizing: border-box;
  resize: none;
  overflow-x: hidden;
  overflow-y: hidden;
  display: block;
}
@media (max-width: 767px) {
  #chatInput.chat-input,
  .chat-pm-input-row .chat-input,
  .chat-messages textarea,
  .chat-messages input[type="text"] {
    font-size: 16px;
  }
}
.chat-input::placeholder { color: var(--text-3); }
.chat-input:focus { border-color: var(--primary); }

.smiley-btn { position: absolute; right: 4px; }

.smiley-picker,
.pm-smiley-picker {
  position: absolute;
  bottom: 100%;
  right: 0;
  left: auto;
  margin-bottom: 6px;
  width: 280px;
  max-height: 220px;
  background: linear-gradient(135deg, rgba(20, 20, 20, 0.98), rgba(35, 35, 35, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.smiley-picker-head {
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.smiley-picker-grid,
.smiley-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px 12px;
  overflow-y: auto;
}

.smiley-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  padding: 4px;
  transition: all 0.2s ease;
}
.smiley-item img { max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: none; }
.smiley-item:hover { border-color: var(--primary); background: rgba(255, 255, 255, 0.12); transform: scale(1.08); }

.smiley-section-label {
  grid-column: 1 / -1;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.4);
  padding: 6px 0 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.smiley-section-label:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}
.smiley-picker-empty { grid-column: 1 / -1; font-size: 0.75rem; color: rgba(255, 255, 255, 0.5); padding: 16px; text-align: center; }

.chat-container.chat-input-top .smiley-picker {
  bottom: auto;
  top: 100%;
  margin-bottom: 0;
  margin-top: 6px;
}

.send-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.send-btn:hover { background: var(--primary-hover); transform: scale(1.05); }
.send-btn:active { transform: scale(0.95); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== COLOR DICE PANEL ===== */
.color-dice-panel {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 16px;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 50px rgba(0,0,0,0.5);
  overflow: hidden;
  z-index: 45;
}

.colordice-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.colordice-title { font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.colordice-round {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-2);
  background: var(--surface-3);
  padding: 2px 8px;
  border-radius: 8px;
}
.colordice-coins { font-size: 11px; color: #fbbf24; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.colordice-close { width: 26px; height: 26px; border: none; background: transparent; color: var(--text-3); border-radius: 6px; cursor: pointer; transition: var(--transition); }
.colordice-close:hover { color: var(--text); background: var(--surface-3); }

.colordice-countdown {
  text-align: center;
  padding: 8px;
  font-size: 12.5px;
  color: #fbbf24;
  font-weight: 700;
  background: rgba(251,191,36,0.07);
  font-variant-numeric: tabular-nums;
}
.colordice-status { text-align: center; padding: 6px; font-size: 11.5px; color: var(--text-2); min-height: 10px; }

.colordice-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 10px 10px; }
.colordice-color {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition);
}
.colordice-color:hover { border-color: rgba(var(--primary-rgb), 0.4); }
.colordice-color.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.25); }
.colordice-dot { width: 34px; height: 34px; border-radius: 50%; box-shadow: 0 2px 8px rgba(0,0,0,0.35); }
.colordice-color-name { font-weight: 600; font-size: 12.5px; }
.colordice-color-meta { font-size: 10.5px; color: var(--text-3); text-align: center; }
.colordice-mybet { font-size: 10.5px; color: var(--green); font-weight: 600; }
.colordice-bet-cell { display: flex; gap: 6px; width: 100%; }
.colordice-amount-input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  text-align: center;
  outline: none;
}
.colordice-amount-input:focus { border-color: var(--primary); }
.colordice-bet-btn {
  padding: 6px 10px;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.colordice-bet-btn:hover { background: var(--primary-hover); }
.colordice-bet-btn:disabled,
.colordice-amount-input:disabled { opacity: 0.45; cursor: not-allowed; }

.colordice-last-result { padding: 10px 12px; background: rgba(251,191,36,0.05); border-top: 1px solid var(--border); text-align: center; }
.colordice-last-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); font-weight: 700; }
.colordice-last-dice { font-size: 22px; margin: 4px 0; }
.colordice-last-winners { font-size: 11px; color: var(--green); }
.colordice-last-winners.none { color: var(--text-3); }

.colordice-close-bottom {
  width: 100%;
  padding: 9px;
  background: var(--surface-2);
  border: none;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}
.colordice-close-bottom:hover { color: var(--text); }

/* ---- Color dice roll overlay ---- */
.colordice-roll-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,5,10,0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 400;
}
.colordice-roll-die {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  background: #fff;
  border: 3px solid rgba(0,0,0,0.25);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.colordice-roll-overlay.rolling .colordice-roll-die { animation: diceShake 0.55s ease-in-out infinite; }
.colordice-roll-overlay.rolling .colordice-roll-die:nth-child(2) { animation-delay: 0.09s; }
.colordice-roll-overlay.rolling .colordice-roll-die:nth-child(3) { animation-delay: 0.18s; }
.colordice-roll-overlay.settled .colordice-roll-die { animation: dicePop 0.5s cubic-bezier(0.2,0.9,0.3,1.4); }
.colordice-roll-overlay.settled .colordice-roll-dot { box-shadow: 0 0 14px rgba(255,255,255,0.6); }
.colordice-roll-die .colordice-die-dot { width: 42px; height: 42px; }
.colordice-roll-board-die .colordice-die-dot { width: 28px; height: 28px; box-shadow: 0 0 10px rgba(255,255,255,0.5); }
.colordice-roll-dot { width: 30px; height: 30px; border-radius: 50%; background: var(--dice-final, #ddd); display: block; }

/* ===== AMBIENT PARTICLES (bursts/sparkles) ===== */
.royal-sparkle-dot {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,220,80,0.95) 0%, rgba(251,191,36,0.6) 50%, transparent 70%);
  box-shadow: 0 0 6px rgba(251,191,36,0.8), 0 0 12px rgba(255,220,80,0.5);
  pointer-events: none;
  z-index: 100;
  animation: royal-dot-sparkle 3s ease-out forwards;
}
@keyframes royal-dot-sparkle {
  0% { opacity: 0; transform: scale(0.3); }
  20% { opacity: 1; transform: scale(1); }
  60% { opacity: 0.8; transform: scale(1.2); }
  100% { opacity: 0; transform: scale(0.5); }
}

.heart-burst-particle {
  position: absolute;
  color: rgba(244,114,182,0.9);
  text-shadow: 0 0 6px rgba(244,114,182,0.6), 0 0 12px rgba(236,72,153,0.4);
  pointer-events: none;
  z-index: 100;
  animation: heart-burst-fly 2s ease-out forwards;
}
@keyframes heart-burst-fly {
  0% { opacity: 1; transform: translate(0,0) scale(0.4) rotate(0deg); }
  30% { opacity: 1; transform: translate(var(--hb-x,20px), var(--hb-y,-60px)) scale(1.1) rotate(15deg); }
  100% { opacity: 0; transform: translate(var(--hb-x,40px), var(--hb-y,-120px)) scale(0.6) rotate(-10deg); }
}

.starry-burst-particle {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255,255,255,0.9);
  pointer-events: none;
  z-index: 100;
  animation: starry-burst-fly 2.4s ease-out forwards;
}
@keyframes starry-burst-fly {
  0% { opacity: 1; transform: translate(0,0); }
  40% { opacity: 1; transform: translate(var(--sb-x,40px), var(--sb-y,-80px)); }
  100% { opacity: 0; transform: translate(var(--sb-x,60px), var(--sb-y,-140px)); }
}

/* ===== STAR SKY chat background (starry bg item) ===== */
.chat-container.chat-bg-starry { background-color: rgba(0,0,0,0.18); }
.starry-overlay { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.starry-falling-star {
  position: absolute;
  top: -8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px rgba(255,255,255,0.9);
  animation: starry-fall linear infinite;
  opacity: 0.9;
}
@keyframes starry-fall {
  0% { transform: translateY(0); opacity: 0; }
  10% { opacity: 0.9; }
  100% { transform: translateY(105vh); opacity: 0; }
}

/* ===== ANIMATED NAME COLORS (name color fx) ===== */
.chat-name-fx {
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  background-size: 200% auto;
  display: inline-block;
}
.chat-name-fx-gold { background-image: linear-gradient(90deg, #fff6a8, #fbd84a, #b8860b, #fbd84a, #fff6a8); animation: namefx-shimmer 2.6s linear infinite; }
.chat-name-fx-ocean { background-image: linear-gradient(90deg, #b2ebf2, #4dd0e1, #0277bd, #00e5ff, #b2ebf2); animation: namefx-flow 3s linear infinite; }
.chat-name-fx-rainbow { background-image: linear-gradient(90deg, #ff5252, #ffca28, #4caf50, #29b6f6, #7e57c2, #f06292, #ff5252); animation: namefx-shimmer 1.8s linear infinite; }
.chat-name-fx-fire { background-image: linear-gradient(90deg, #ff6e40, #ffb300, #ff3d00, #ffca28, #ff6e40); animation: namefx-flicker 1.3s linear infinite; }
.chat-name-fx-neon { background-image: linear-gradient(90deg, #67e8f9, #a78bfa, #22d3ee, #e879f9, #67e8f9); animation: namefx-shimmer 2s linear infinite; }
.chat-name-fx-galaxy { background-image: linear-gradient(90deg, #c4b5fd, #818cf8, #f0abfc, #818cf8, #c4b5fd); animation: namefx-flow 3.2s linear infinite; }
@keyframes namefx-shimmer { to { background-position: 200% center; } }
@keyframes namefx-flow { to { background-position: 200% center; } }
@keyframes namefx-flicker {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.45); }
}

/* ===== TEXT EFFECTS (name text effects) ===== */
.text-effect-rainbow {
  background: linear-gradient(90deg, #ff0000, #ff8000, #ffff00, #00ff00, #00ffff, #0080ff, #8000ff, #ff00ff, #ff0000) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  animation: text-effect-rainbow-move 2s linear infinite;
}
@keyframes text-effect-rainbow-move {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}
.text-effect-glitter {
  background-image:
    radial-gradient(circle, #ffffff 1.5px, transparent 2px),
    radial-gradient(circle, #ffe066 1.5px, transparent 2px),
    linear-gradient(135deg, #f9d423, #ff4e50, #f9d423) !important;
  background-size: 30px 30px, 45px 45px, 300% 100% !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  animation: text-effect-glitter-move 2.2s linear infinite;
}
@keyframes text-effect-glitter-move {
  0% { background-position: 0 0, 0 0, 0% 50%; }
  100% { background-position: 30px 30px, 45px 45px, 300% 50%; }
}
.text-effect-shimmer {
  background: linear-gradient(90deg, #b8b8c4 0%, #ffffff 25%, #b8b8c4 50%, #ffffff 75%, #b8b8c4 100%) !important;
  background-size: 200% 100% !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  animation: text-effect-shimmer-move 2s linear infinite;
}
@keyframes text-effect-shimmer-move {
  0% { background-position: 0% 0; }
  100% { background-position: -200% 0; }
}
.text-effect-glow {
  color: #ffffff !important;
  text-shadow: 0 0 6px rgba(255,193,7,0.9), 0 0 14px rgba(255,193,7,0.7), 0 0 28px rgba(255,193,7,0.5);
  animation: text-effect-glow-pulse 1.6s ease-in-out infinite;
}
@keyframes text-effect-glow-pulse {
  0%, 100% { text-shadow: 0 0 6px rgba(255,193,7,0.55), 0 0 14px rgba(255,193,7,0.35), 0 0 28px rgba(255,193,7,0.2); }
  50% { text-shadow: 0 0 10px rgba(255,193,7,1), 0 0 26px rgba(255,193,7,0.85), 0 0 46px rgba(255,193,7,0.6); }
}
.text-effect-neon {
  color: #ffffff !important;
  text-shadow: 0 0 4px #ffffff, 0 0 10px #00e5ff, 0 0 22px #00e5ff, 0 0 40px #ff00ff;
  animation: text-effect-neon-flicker 2.4s linear infinite;
}
@keyframes text-effect-neon-flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { text-shadow: 0 0 4px #ffffff, 0 0 10px #00e5ff, 0 0 22px #00e5ff, 0 0 40px #ff00ff; opacity: 1; }
  20%, 24%, 55% { text-shadow: 0 0 2px #ffffff, 0 0 5px #00e5ff; opacity: 0.8; }
}
.text-effect-flicker {
  color: #ffffff !important;
  animation: text-effect-flicker-anim 1.5s linear infinite;
}
@keyframes text-effect-flicker-anim {
  0%, 100% { opacity: 1; }
  41% { opacity: 1; }
  42% { opacity: 0.3; }
  43% { opacity: 1; }
  45% { opacity: 0.2; }
  46% { opacity: 1; }
  70% { opacity: 1; }
  71% { opacity: 0.4; }
  72% { opacity: 1; }
}

/* ===== STORE ITEM CHAT BUBBLES ===== */
.chat-msg-body.chat-bubble-neon {
  background: linear-gradient(135deg, rgba(34,211,238,0.16), rgba(168,85,247,0.16));
  border: 1px solid rgba(34,211,238,0.55);
  box-shadow: 0 0 12px rgba(34,211,238,0.25);
  overflow: hidden;
}
.chat-msg-body.chat-bubble-neon::before {
  content: "";
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 100%;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 8% 92%, rgba(34,211,238,0.8) 0px, rgba(34,211,238,0.3) 3px, transparent 5px),
    radial-gradient(circle at 22% 88%, rgba(168,85,247,0.7) 0px, rgba(168,85,247,0.2) 2px, transparent 4px),
    radial-gradient(circle at 38% 95%, rgba(34,211,238,0.9) 0px, rgba(34,211,238,0.3) 4px, transparent 6px),
    radial-gradient(circle at 50% 85%, rgba(232,121,249,0.6) 0px, rgba(232,121,249,0.2) 2px, transparent 4px),
    radial-gradient(circle at 62% 93%, rgba(103,232,249,0.8) 0px, rgba(103,232,249,0.3) 3px, transparent 5px),
    radial-gradient(circle at 75% 87%, rgba(168,85,247,0.7) 0px, rgba(168,85,247,0.25) 4px, transparent 6px),
    radial-gradient(circle at 88% 94%, rgba(34,211,238,0.85) 0px, rgba(34,211,238,0.3) 3px, transparent 5px);
  animation: neon-bubble-float 2.5s ease-in-out infinite;
}
.chat-msg-body.chat-bubble-neon > * { position: relative; z-index: 1; }
@keyframes neon-bubble-float {
  0% { transform: translateY(0) scale(1); opacity: 0.6; }
  25% { transform: translateY(-3px) scale(1.1); opacity: 1; }
  50% { transform: translateY(-8px) scale(0.9); opacity: 0.3; }
  75% { transform: translateY(-4px) scale(1.05); opacity: 0.9; }
  100% { transform: translateY(0) scale(1); opacity: 0.6; }
}

.chat-msg-body.chat-bubble-royal {
  background: linear-gradient(135deg, rgba(251,191,36,0.14), rgba(234,179,8,0.10));
  border: 1px solid rgba(251,191,36,0.5);
  box-shadow: 0 0 12px rgba(251,191,36,0.2);
  overflow: hidden;
}
.chat-msg-body.chat-bubble-royal::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 10% 5%, rgba(251,191,36,0.9) 0px, rgba(251,191,36,0.4) 2px, transparent 4px),
    radial-gradient(circle at 25% -5%, rgba(255,220,80,0.8) 0px, rgba(255,220,80,0.3) 1.5px, transparent 3px),
    radial-gradient(circle at 42% 2%, rgba(251,191,36,0.85) 0px, rgba(251,191,36,0.35) 2.5px, transparent 5px),
    radial-gradient(circle at 58% -3%, rgba(255,200,50,0.9) 0px, rgba(255,200,50,0.4) 2px, transparent 4px),
    radial-gradient(circle at 72% 4%, rgba(251,191,36,0.8) 0px, rgba(251,191,36,0.3) 1.5px, transparent 3px),
    radial-gradient(circle at 88% -2%, rgba(255,220,80,0.85) 0px, rgba(255,220,80,0.35) 2px, transparent 4px);
  animation: royal-star-fall 3s linear infinite;
}
.chat-msg-body.chat-bubble-royal > * { position: relative; z-index: 1; }
@keyframes royal-star-fall {
  0% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(25%); opacity: 1; }
  100% { transform: translateY(60%); opacity: 0; }
}

.chat-msg-body.chat-bubble-heart {
  background: linear-gradient(135deg, rgba(236,72,153,0.2), rgba(244,114,182,0.15));
  border: 2px solid rgba(244,114,182,0.6);
  box-shadow: 0 0 16px rgba(244,114,182,0.3), 0 0 30px rgba(244,114,182,0.1);
  border-radius: 18px 18px 18px 6px;
  position: relative;
  overflow: visible;
}
.chat-msg-body.chat-bubble-heart::before {
  content: "\2665";
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 20px;
  line-height: 1;
  color: rgba(244,114,182,0.9);
  text-shadow: 0 0 8px rgba(244,114,182,0.6), 0 0 16px rgba(236,72,153,0.4);
  pointer-events: none;
  z-index: 1;
  animation: heart-float-pulse 2s ease-in-out infinite;
}
@keyframes heart-float-pulse {
  0%, 100% { transform: translateX(-50%) translateY(0) scale(1); }
  50% { transform: translateX(-50%) translateY(-3px) scale(1.15); }
}

/* ===== STORE ITEM CSS AVATAR FRAMES ===== */
/* The ring is a 100% centered circle over the avatar box (34×34 on chat
   messages) so it always hugs the edge of the round avatar. */
.chat-item-frame-neon::before,
.chat-item-frame-crown::before,
.chat-item-frame-galaxy::before,
.chat-item-frame-cute::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  margin: -50% 0 0 -50%;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
  box-sizing: border-box;
}
.chat-item-frame-neon::before { border: 3px solid #22d3ee; animation: item-frame-neon-pulse 2s ease-in-out infinite; }
.chat-item-frame-crown::before { border: 3px solid #fbbf24; box-shadow: 0 0 12px rgba(251,191,36,0.6); }
.chat-item-frame-galaxy::before { border: 3px solid #a855f7; background: radial-gradient(circle, transparent 55%, rgba(168,85,247,0.25)); box-shadow: 0 0 14px rgba(168,85,247,0.8), inset 0 0 10px rgba(168,85,247,0.4); }
.chat-item-frame-cute::before { border: 3px solid #f472b6; box-shadow: 0 0 10px rgba(244,114,182,0.6); }
@keyframes item-frame-neon-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(34,211,238,0.6), inset 0 0 6px rgba(34,211,238,0.3); }
  50% { box-shadow: 0 0 18px rgba(34,211,238,1), inset 0 0 12px rgba(34,211,238,0.6); }
}

/* ===== PM PANEL ===== */
.pm-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 100vw;
  height: 100vh;
  height: var(--kb-h, 100dvh);
  max-height: 100vh;
  max-height: var(--kb-h, 100dvh);
  overflow: hidden;
  z-index: 140;
  background: var(--sidebar-bg);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 40px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
}

.pm-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.pm-nav-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}
.pm-nav-btn:hover { background: var(--surface-2); color: var(--text); }
.pm-panel-title { flex: 1; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.pm-panel-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pm-inbox,
.pm-thread { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.chat-pm-thread-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; overscroll-behavior: contain; }
.chat-pm-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-3);
  font-size: 12.5px;
  text-align: center;
  padding: 20px;
}
.chat-pm-empty i { font-size: 26px; opacity: 0.4; }

.chat-pm-thread-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
}
.chat-pm-thread-item:hover { background: var(--surface-2); }
.chat-pm-thread-item.has-unread { background: rgba(135, 206, 235, 0.18); }
.chat-pm-thread-item.has-unread:hover { background: rgba(135, 206, 235, 0.3); }
.chat-pm-thread-item.has-unread .chat-pm-thread-snippet { color: #4aa3df; font-weight: 600; }

.chat-pm-thread-avatar { position: relative; flex-shrink: 0; display: flex; }
.chat-pm-thread-avatar .chat-pm-avatar { width: 44px; height: 44px; }
.chat-pm-avatar { border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.chat-pm-avatar-sm { width: 34px; height: 34px; }
.chat-pm-avatar-md { width: 44px; height: 44px; }
.chat-pm-msg-avatar { margin-top: 2px; cursor: pointer; transition: filter .15s ease; }
.chat-pm-msg-avatar:hover { filter: brightness(1.15); }

.chat-pm-thread-mid { flex: 1; min-width: 0; }
.chat-pm-thread-top { display: flex; align-items: center; gap: 6px; width: 100%; }
.chat-pm-thread-name { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pm-thread-time { margin-left: auto; font-size: 10.5px; color: var(--text-3); white-space: nowrap; flex-shrink: 0; }
.chat-pm-thread-snippet {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}
.chat-pm-snippet-reply { font-size: 9px; flex-shrink: 0; }
.chat-pm-thread-unread {
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  flex-shrink: 0;
}
.chat-pm-thread-more {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  opacity: 0;
}
.chat-pm-thread-more:hover { background: var(--surface-3); color: #f87171; }
.chat-pm-thread-item:hover .chat-pm-thread-more,
.chat-pm-thread-more:focus { opacity: 1; }
@media (pointer: coarse) {
  .chat-pm-thread-more { opacity: 1; }
}
.chat-pm-delete-text { margin: 0 0 4px; font-size: 14px; }
.chat-pm-delete-note { margin: 0; font-size: 12px; color: var(--text-2); line-height: 1.5; }

/* ---- PM thread header ---- */
/* Partner avatar + theme/background options live in the PM panel header */
.chat-pm-head-avatar {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.chat-pm-head-avatar-ph { font-size: 20px; color: var(--text-3); }
.chat-pm-partner-ava-wrap { position: relative; flex-shrink: 0; display: flex; cursor: pointer; }
.chat-pm-partner-ava-wrap:hover .chat-pm-avatar { filter: brightness(1.15); }
.chat-pm-partner-meta { min-width: 0; }
.chat-pm-partner-uname { display: block; font-size: 11.5px; color: var(--text-3); }
.pm-theme-wrap { position: relative; flex-shrink: 0; }
.pm-theme-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-2);
  cursor: pointer;
  transition: var(--transition);
}
.pm-theme-btn:hover { background: var(--surface-2); color: var(--text); }
.pm-theme-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 170px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  display: none;
  flex-direction: column;
  z-index: 50;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.pm-options-menu { width: 180px; max-height: min(520px, 65vh); overflow-y: auto; }
.chat-pm-theme-menu-sep { display: block; height: 1px; background: var(--border); margin: 4px 6px; }
.chat-pm-theme-menu-title {
  display: block;
  padding: 4px 8px 6px;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
}
.chat-pm-theme-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  padding: 7px 8px;
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}
.chat-pm-theme-opt:hover { background: var(--surface-3); }
.chat-pm-theme-opt.active { background: rgba(var(--primary-rgb), 0.16); color: #a5b4fc; }
.pm-theme-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.sw-classic { background: linear-gradient(135deg, #1e90ff, #0e6ed2); }
.sw-im { background: linear-gradient(135deg, #06c755, #ffffff 60%); }
.sw-neon { background: linear-gradient(135deg, #22d3ee, #f472b6); }
.sw-paper { background: linear-gradient(135deg, #f3ead8, #a8d5a2); }
.sw-twitter { background: linear-gradient(135deg, #1da1f2, #ffffff); }
.sw-doodle { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.sw-ocean { background: linear-gradient(135deg, #0ea5e9, #06b6d4); }
.sw-sunset { background: linear-gradient(135deg, #d946ef, #8b5cf6); }
.pm-bg-swatch {
  width: 22px;
  height: 18px;
  border-radius: 5px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
}
.sw-bg-none { background: repeating-linear-gradient(45deg, rgba(255,255,255,0.18) 0 5px, transparent 5px 10px); }
.sw-bg-upload { background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.05)); border-style: dashed; }
.sw-bg-waves { background: linear-gradient(135deg, #0f2b46, #0d5c63); }
.sw-bg-dusk { background: linear-gradient(160deg, #2a1e4a, #6b2d5c); }
.sw-bg-forest { background: linear-gradient(160deg, #14281d, #2f6b3e); }
.sw-bg-midnight { background: linear-gradient(160deg, #0d1226, #1e2a52); }
.sw-bg-slate { background: linear-gradient(160deg, #1b2130, #2c3444); }
.sw-bg-aurora { background: linear-gradient(135deg, #0f2b46, #14525d, #3b2f63); }

/* ---- PM chat backgrounds (applied to #chatPmMessages, overrides panel theme messages bg) ---- */
#chatPmMessages.pm-bg-waves { background: linear-gradient(135deg, #0f2b46, #0d5c63); }
#chatPmMessages.pm-bg-dusk { background: linear-gradient(160deg, #2a1e4a, #6b2d5c); }
#chatPmMessages.pm-bg-forest { background: linear-gradient(160deg, #14281d, #2f6b3e); }
#chatPmMessages.pm-bg-midnight { background: linear-gradient(160deg, #0d1226, #1e2a52); }
#chatPmMessages.pm-bg-slate { background: linear-gradient(160deg, #1b2130, #2c3444); }
#chatPmMessages.pm-bg-aurora { background: linear-gradient(135deg, #0f2b46, #14525d, #3b2f63); }
#chatPmMessages.pm-bg-img { background-size: cover; background-position: center; background-repeat: no-repeat; }

/* ---- PM messages ---- */
.chat-pm-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
  overscroll-behavior: contain;
}
.chat-pm-messages::-webkit-scrollbar { width: 5px; }
.chat-pm-messages::-webkit-scrollbar-track { background: transparent; }
.chat-pm-messages::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }

.chat-pm-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  max-width: 93%;
  position: relative;
  animation: msgIn 0.18s ease;
}
.chat-pm-msg.mine { margin-left: auto; justify-content: flex-end; }
.chat-pm-msg.theirs { margin-right: auto; }

.chat-pm-msg-main { min-width: 0; display: flex; flex-direction: column; }
.chat-pm-msg.mine .chat-pm-msg-main { align-items: flex-end; }

.chat-pm-bubble-wrap { position: relative; display: flex; flex-direction: column; align-items: flex-start; }
.chat-pm-msg.mine .chat-pm-bubble-wrap { align-items: flex-end; }

.chat-pm-bubble {
  background: var(--bubble-them);
  color: var(--bubble-them-text);
  padding: 8px 13px;
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  overflow-wrap: anywhere;
  word-break: break-word;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  max-width: 100%;
  min-width: 40px;
  display: flex;
  flex-direction: column;
}
.chat-pm-msg.mine .chat-pm-bubble { background: var(--bubble-mine); color: var(--bubble-mine-text); border-bottom-left-radius: 18px; border-bottom-right-radius: 6px; }

/* PM message + note-reply text follows the bubble's own color, never forced white */
.chat-pm-bubble .chat-text { color: inherit; }

/* Light theme: Classic PM theirs-bubble matches the Classic #0a5477 look */
html.chat-theme-light .pm-panel:not([class*='pm-theme-']) .chat-pm-msg.theirs .chat-pm-bubble {
  background: #0a5477;
  color: #ffffff;
}

/* Image/sticker-only PM bubbles: let the photo become the bubble (no padding gap) */
.chat-pm-bubble:has(img.chat-msg-image:only-child),
.chat-pm-bubble:has(img.chat-msg-sticker:only-child) {
  padding: 0;
  background: transparent;
  box-shadow: none;
  min-width: 0;
  overflow: hidden;
  display: inline-flex;
  width: max-content;
}
.chat-pm-bubble:has(img.chat-msg-image:only-child) {
  max-width: min(320px, 100%);
}
.chat-pm-bubble:has(img.chat-msg-sticker:only-child) {
  max-width: min(150px, 100%);
}
.chat-pm-bubble:has(img.chat-msg-image:only-child) .chat-msg-image {
  margin-top: 0;
  width: auto;
  height: auto;
  max-width: min(100%, 320px);
  max-height: 260px;
  padding: 3px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  background: var(--bubble-them);
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  border-bottom-left-radius: 6px;
}
.chat-pm-msg.mine .chat-pm-bubble:has(img.chat-msg-image:only-child) .chat-msg-image {
  background: var(--bubble-mine);
  border-color: rgba(255,255,255,0.25);
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 6px;
}
.chat-pm-bubble:has(img.chat-msg-sticker:only-child) .chat-msg-sticker {
  margin-top: 0;
  padding: 5px;
  border: none;
  border-radius: 12px;
  background: transparent;
  border-bottom-left-radius: 6px;
}
.chat-pm-msg.mine .chat-pm-bubble:has(img.chat-msg-sticker:only-child) .chat-msg-sticker {
  background: transparent;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 6px;
}

.chat-pm-msg-name-row { margin-bottom: 2px; display: flex; align-items: flex-end; gap: 6px; flex-wrap: wrap; }
.chat-pm-msg-name { font-size: 12px; font-weight: 600; color: var(--primary); }

.chat-pm-reply-quote {
  background: rgba(255,255,255,0.07);
  border-left: 2px solid var(--primary);
  border-radius: 8px;
  padding: 5px 9px;
  margin-bottom: 6px;
  font-size: 11.5px;
  color: #ffffff;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-pm-msg.mine .chat-pm-reply-quote { border-left-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.12); }
.chat-pm-reply-name { font-weight: 700; font-size: 10.5px; }
.chat-pm-reply-note-ic { margin-left: 5px; font-size: 10px; color: inherit; }
.chat-pm-reply-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- PM reactions (mirror live chat: react button hangs off the bubble edge, pills overlap its bottom corner) ---- */
.btn-pm-react {
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.chat-pm-msg:hover .btn-pm-react,
.chat-pm-msg:focus-within .btn-pm-react,
.chat-pm-msg.show-react .btn-pm-react,
.btn-pm-react:focus-visible { opacity: 1; pointer-events: auto; }
/* Partner messages: react button hangs off the bubble's outer-left edge */
.chat-pm-msg.theirs .btn-pm-react { right: auto; left: 100%; margin-right: 0; margin-left: 6px; }
.btn-pm-react:hover { background: var(--surface-3); border-color: var(--primary); }
.btn-pm-react.reacted { background: rgba(var(--primary-rgb), 0.18); border-color: var(--primary); color: #fff; box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.4); }
.btn-pm-react.reacted i { animation: react-pop 0.3s ease; }
.btn-pm-react .react-default-emoji { font-size: 13px; }

/* Reaction pills overlap the bubble's bottom corner (Messenger style) */
.chat-pm-reactions {
  position: absolute;
  bottom: -9px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 200px;
}
.chat-pm-msg.theirs .chat-pm-reactions {
  left: 0;
  right: auto;
  justify-content: flex-start;
  flex-wrap: nowrap;
  max-width: 100%;
}
.chat-pm-msg.mine .chat-pm-reactions {
  right: 0;
  left: auto;
  justify-content: flex-end;
}
/* Keep the bubble tall enough so overlaid chips never clip it */
.chat-pm-msg.has-reactions .chat-pm-bubble { margin-bottom: 6px; }

/* ---- Actions row (under bubble, mirrors live chat) ---- */
.chat-pm-msg-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin-top: 3px;
  opacity: 0.45;
  transition: opacity 0.15s ease;
}
.chat-pm-msg:hover .chat-pm-msg-actions,
.chat-pm-msg:focus-within .chat-pm-msg-actions,
.chat-pm-msg.show-react .chat-pm-msg-actions { opacity: 1; }
.chat-pm-msg.mine .chat-pm-msg-actions { justify-content: flex-end; }

.chat-pm-time { font-size: 11px; color: var(--text-3); margin-right: auto; white-space: nowrap; }
.chat-pm-msg.mine .chat-pm-time { margin-right: 0; margin-left: auto; }

.btn-pm-msg-reply,
.btn-pm-msg-edit,
.btn-pm-msg-del {
  background: transparent;
  border: none;
  color: var(--text-3);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  transition: var(--transition);
}
.btn-pm-msg-reply:hover,
.btn-pm-msg-edit:hover { background: var(--surface-2); color: var(--text); }
.btn-pm-msg-del:hover { background: rgba(239,68,68,0.12); color: var(--red); }

.chat-pm-edit { display: flex; flex-direction: column; gap: 8px; }
.chat-pm-edit-input {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 12.5px;
  resize: vertical;
  outline: none;
}
.chat-pm-edit-input:focus { border-color: var(--primary); }
.chat-pm-edit-btns { display: flex; justify-content: flex-end; gap: 6px; }
.btn-chat-pm-edit-save,
.btn-chat-pm-edit-cancel {
  border: none;
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 11.5px;
  cursor: pointer;
  font-family: var(--font);
  transition: var(--transition);
}
.btn-chat-pm-edit-save { background: var(--primary); color: #fff; }
.btn-chat-pm-edit-save:hover { background: var(--primary-hover); }
.btn-chat-pm-edit-cancel { background: var(--surface-3); color: var(--text-2); }
.btn-chat-pm-edit-cancel:hover { color: var(--text); }

/* ---- PM reply chip ---- */
.chat-pm-reply-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(var(--primary-rgb), 0.08);
  border-left: 3px solid var(--primary);
  font-size: 12px;
  color: var(--text-2);
  margin: 0 12px 4px;
  border-radius: 8px;
}
.chat-pm-reply-chip-ic { color: var(--primary); font-size: 10px; flex-shrink: 0; }
.chat-pm-reply-chip-name { font-weight: 700; color: var(--text); flex-shrink: 0; }
.chat-pm-reply-chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.chat-pm-reply-chip-cancel { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 11px; padding: 2px; flex-shrink: 0; transition: var(--transition); }
.chat-pm-reply-chip-cancel:hover { color: var(--text); }

/* ---- PM voice bar ---- */
.chat-pm-voice-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface-2);
  border-radius: 10px;
  margin: 0 12px 4px;
  font-size: 12px;
}
.chat-pm-voice-bar > i { color: var(--primary); }
.chat-pm-voice-bar audio { height: 32px; flex: 1; min-width: 0; }
.pm-voice-timer { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; flex-shrink: 0; }
#btnChatPmMic.recording,
.input-btn.recording { color: var(--red); animation: mic-pulse 1s ease-in-out infinite; }
@keyframes mic-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ---- PM input ---- */
.chat-pm-input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-pm-input-wrap { flex: 1; position: relative; display: flex; align-items: flex-end; }
.chat-pm-input-wrap .chat-input {
  height: 42px;
  min-height: 42px;
  max-height: 120px;
  line-height: 1.35;
  box-sizing: border-box;
  resize: none;
  overflow-x: hidden;
  overflow-y: hidden;
  display: block;
}
.pm-smiley-picker { bottom: 100%; right: 0; }

/* ---- PM bubble themes ---- */
.pm-theme-doodle .chat-pm-msg.theirs .chat-pm-bubble {
  background: linear-gradient(135deg, rgba(255,236,179,0.34), rgba(255,214,102,0.2));
  border: 1px solid rgba(255,214,102,0.5);
}
.pm-theme-doodle .chat-pm-msg.mine .chat-pm-bubble {
  background: linear-gradient(135deg, rgba(251,191,36,0.75), rgba(245,158,11,0.65));
}
.pm-theme-ocean .chat-pm-msg.theirs .chat-pm-bubble {
  background: linear-gradient(135deg, rgba(14,165,233,0.4), rgba(56,189,248,0.24));
  border: 1px solid rgba(56,189,248,0.55);
}
.pm-theme-ocean .chat-pm-msg.mine .chat-pm-bubble {
  background: linear-gradient(135deg, rgba(14,165,233,0.6), rgba(6,182,212,0.5));
}
.pm-theme-sunset .chat-pm-msg.theirs .chat-pm-bubble {
  background: linear-gradient(135deg, rgba(236,72,153,0.4), rgba(168,85,247,0.28));
  border: 1px solid rgba(244,114,182,0.55);
}
.pm-theme-sunset .chat-pm-msg.mine .chat-pm-bubble {
  background: linear-gradient(135deg, rgba(217,70,239,0.65), rgba(139,92,246,0.6));
}

/* =============================================
   PM themes: IM Style / Neon / Paper / Twitter
   (same options as index.php's PM, shared via chat_pm_theme)
   ============================================= */
.pm-panel.pm-theme-im { background: #f6f7f9; }
.pm-panel.pm-theme-im .pm-panel-header {
  background: #ffffff;
  border-bottom: 1px solid #e8eaed;
}
.pm-panel.pm-theme-im .pm-panel-title { color: #202124; }
.pm-panel.pm-theme-im .pm-panel-title i { color: #06c755; }
.pm-panel.pm-theme-im .pm-nav-btn,
.pm-panel.pm-theme-im .pm-theme-btn {
  border: 1px solid #e0e3e8;
  background: #f6f7f9;
  color: #5f6368;
}
.pm-panel.pm-theme-im .pm-nav-btn:hover,
.pm-panel.pm-theme-im .pm-theme-btn:hover { background: #eef1f4; color: #202124; }
.pm-panel.pm-theme-im .chat-pm-thread-list,
.pm-panel.pm-theme-im .chat-pm-messages { background: #f6f7f9; }
.pm-panel.pm-theme-im .chat-pm-thread-item:hover { background: rgba(32, 33, 36, 0.06); }
.pm-panel.pm-theme-im .chat-pm-thread-item.has-unread { background: rgba(135, 206, 235, 0.2); }
.pm-panel.pm-theme-im .chat-pm-thread-item.has-unread:hover { background: rgba(135, 206, 235, 0.34); }
.pm-panel.pm-theme-im .chat-pm-thread-name,
.pm-panel.pm-theme-im .chat-pm-msg-name { color: #202124; }
.pm-panel.pm-theme-im .chat-pm-thread-snippet { color: #5f6368; }
.pm-panel.pm-theme-im .chat-pm-thread-time,
.pm-panel.pm-theme-im .chat-pm-time { color: #9aa0a6; }
.pm-panel.pm-theme-im .chat-pm-avatar { border-color: rgba(32, 33, 36, 0.12); }
.pm-panel.pm-theme-im .chat-pm-msg.theirs .chat-pm-bubble {
  background: #128167;
  border: 1px solid #e3e6ea;
  color: #ffffff;
}
.pm-panel.pm-theme-im .chat-pm-msg.mine .chat-pm-bubble {
  background: #06c755;
  border: 1px solid #06c755;
  color: #ffffff;
  box-shadow: none;
}
.pm-panel.pm-theme-im .chat-pm-msg .chat-pm-bubble { animation: pm-im-bubble-in 0.25s ease; }
.pm-panel.pm-theme-im .chat-pm-reply-quote {
  background: rgba(32, 33, 36, 0.05);
  border-left-color: rgba(6, 199, 85, 0.5);
}
.pm-panel.pm-theme-im .chat-pm-msg.mine .chat-pm-reply-quote {
  background: rgba(255, 255, 255, 0.18);
  border-left-color: rgba(255, 255, 255, 0.5);
}
.pm-panel.pm-theme-im .chat-pm-reply-text { color: #ffffff; }
.pm-panel.pm-theme-im .btn-pm-msg-reply,
.pm-panel.pm-theme-im .btn-pm-msg-edit,
.pm-panel.pm-theme-im .btn-pm-msg-del { color: #8494ac; }
.pm-panel.pm-theme-im .chat-pm-input-row {
  background: #ffffff;
  border-top: 1px solid #e8eaed;
}
.pm-panel.pm-theme-im .chat-pm-input-row .chat-input {
  background: #f0f2f5;
  border: 1px solid #d7dce1;
  color: #111111;
}
.pm-panel.pm-theme-im .chat-pm-input-row .chat-input::placeholder { color: #9aa0a6; }
.pm-panel.pm-theme-im .input-btn { color: #7a8087; }
.pm-panel.pm-theme-im .input-btn.recording { color: #ff5d6c; }
.pm-panel.pm-theme-im .send-btn { background: #06c755; }
.pm-panel.pm-theme-im .pm-smiley-picker {
  background: #ffffff;
  border: 1px solid #e3e6ea;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}
.pm-panel.pm-theme-im .pm-smiley-picker .smiley-picker-head,
.pm-panel.pm-theme-im .pm-smiley-picker .smiley-section-label {
  color: rgba(0, 0, 0, 0.55);
  border-color: rgba(0, 0, 0, 0.1);
}
.pm-panel.pm-theme-im .pm-smiley-picker .smiley-item {
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.04);
}
.pm-panel.pm-theme-im .pm-smiley-picker .smiley-item:hover {
  border-color: #06c755;
  background: rgba(6, 199, 85, 0.1);
}
.pm-panel.pm-theme-im .pm-smiley-picker .smiley-picker-empty { color: rgba(0, 0, 0, 0.5); }
.pm-panel.pm-theme-im .pm-voice-timer { color: #06c755; }
@keyframes pm-im-bubble-in {
  0% { opacity: 0; transform: translateY(8px) scale(0.96); }
  100% { opacity: 1; transform: none; }
}

.pm-panel.pm-theme-neon { background: #0a0a0f; }
.pm-panel.pm-theme-neon .pm-panel-header {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(34, 211, 238, 0.25);
}
.pm-panel.pm-theme-neon .pm-panel-title { color: #22d3ee; }
.pm-panel.pm-theme-neon .pm-panel-title i { color: #f472b6; }
.pm-panel.pm-theme-neon .chat-pm-thread-list,
.pm-panel.pm-theme-neon .chat-pm-messages { background: #0a0a0f; }
.pm-panel.pm-theme-neon .chat-pm-thread-item:hover { background: rgba(34, 211, 238, 0.08); }
.pm-panel.pm-theme-neon .chat-pm-thread-item.has-unread { background: rgba(135, 206, 235, 0.16); }
.pm-panel.pm-theme-neon .chat-pm-thread-item.has-unread:hover { background: rgba(135, 206, 235, 0.28); }
.pm-panel.pm-theme-neon .chat-pm-thread-name,
.pm-panel.pm-theme-neon .chat-pm-msg-name { color: #e8f6ff; }
.pm-panel.pm-theme-neon .chat-pm-thread-snippet,
.pm-panel.pm-theme-neon .chat-pm-thread-time,
.pm-panel.pm-theme-neon .chat-pm-time { color: #64748b; }
.pm-panel.pm-theme-neon .chat-pm-msg.theirs .chat-pm-bubble {
  background: #11111a;
  border: 1px solid rgba(34, 211, 238, 0.5);
  color: #e8f6ff;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.25), inset 0 0 8px rgba(34, 211, 238, 0.08);
}
.pm-panel.pm-theme-neon .chat-pm-msg.mine .chat-pm-bubble {
  background: #160f1d;
  border: 1px solid rgba(244, 114, 182, 0.55);
  color: #ffe4f1;
  box-shadow: 0 0 12px rgba(244, 114, 182, 0.3), inset 0 0 8px rgba(244, 114, 182, 0.1);
}
.pm-panel.pm-theme-neon .chat-pm-input-row {
  background: #0d0d14;
  border-top: 1px solid rgba(34, 211, 238, 0.2);
}
.pm-panel.pm-theme-neon .chat-pm-input-row .chat-input {
  background: #0d0d14;
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: #e8f6ff;
}
.pm-panel.pm-theme-neon .chat-pm-input-row .chat-input::placeholder { color: #475569; }
.pm-panel.pm-theme-neon .input-btn { color: #67e8f9; }
.pm-panel.pm-theme-neon .input-btn.recording { color: #f472b6; }
.pm-panel.pm-theme-neon .send-btn { background: linear-gradient(135deg, #22d3ee, #f472b6); }
.pm-panel.pm-theme-neon .pm-voice-timer { color: #22d3ee; }

.pm-panel.pm-theme-paper { background: #f3ead8; }
.pm-panel.pm-theme-paper .pm-panel-header {
  background: #fbf6ea;
  border-bottom: 1px solid #e6d9bb;
}
.pm-panel.pm-theme-paper .pm-panel-title { color: #6b5d3e; }
.pm-panel.pm-theme-paper .pm-panel-title i { color: #a8d5a2; }
.pm-panel.pm-theme-paper .pm-nav-btn,
.pm-panel.pm-theme-paper .pm-theme-btn {
  border: 1px solid #e0d4b4;
  background: #fbf6ea;
  color: #9a8b68;
}
.pm-panel.pm-theme-paper .chat-pm-thread-list,
.pm-panel.pm-theme-paper .chat-pm-messages { background: #f3ead8; }
.pm-panel.pm-theme-paper .chat-pm-thread-item:hover { background: rgba(107, 93, 62, 0.08); }
.pm-panel.pm-theme-paper .chat-pm-thread-item.has-unread { background: rgba(135, 206, 235, 0.4); }
.pm-panel.pm-theme-paper .chat-pm-thread-item.has-unread:hover { background: rgba(135, 206, 235, 0.55); }
.pm-panel.pm-theme-paper .chat-pm-thread-name,
.pm-panel.pm-theme-paper .chat-pm-msg-name { color: #6b5d3e; }
.pm-panel.pm-theme-paper .chat-pm-thread-snippet,
.pm-panel.pm-theme-paper .chat-pm-thread-time,
.pm-panel.pm-theme-paper .chat-pm-time { color: #a3926f; }
.pm-panel.pm-theme-paper .chat-pm-msg.theirs .chat-pm-bubble {
  background: #276b55;
  border: 1px solid #e4d9bd;
  color: #ffffff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.07);
}
.pm-panel.pm-theme-paper .chat-pm-msg.mine .chat-pm-bubble {
  background: #cfe6b8;
  border: 1px solid #b8d49c;
  color: #33402a;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.07);
}
.pm-panel.pm-theme-paper .chat-pm-input-row {
  background: #fbf6ea;
  border-top: 1px solid #e6d9bb;
}
.pm-panel.pm-theme-paper .chat-pm-input-row .chat-input {
  background: #fffdf7;
  border: 1px solid #ddd0af;
  color: #4a4232;
}
.pm-panel.pm-theme-paper .chat-pm-input-row .chat-input::placeholder { color: #b0a184; }
.pm-panel.pm-theme-paper .input-btn { color: #9a8b68; }
.pm-panel.pm-theme-paper .input-btn.recording { color: #b86f5a; }
.pm-panel.pm-theme-paper .send-btn { background: #a8d5a2; color: #33402a; }
.pm-panel.pm-theme-paper .pm-voice-timer { color: #8aa97c; }

.pm-panel.pm-theme-twitter { background: #ffffff; }
.pm-panel.pm-theme-twitter .pm-panel-header {
  background: #ffffff;
  border-bottom: 1px solid #e1e8ed;
}
.pm-panel.pm-theme-twitter .pm-panel-title { color: #14171a; }
.pm-panel.pm-theme-twitter .pm-panel-title i { color: #1da1f2; }
.pm-panel.pm-theme-twitter .pm-nav-btn,
.pm-panel.pm-theme-twitter .pm-theme-btn {
  border: 1px solid #e1e8ed;
  background: #ffffff;
  color: #657786;
}
.pm-panel.pm-theme-twitter .chat-pm-thread-list,
.pm-panel.pm-theme-twitter .chat-pm-messages { background: #ffffff; }
.pm-panel.pm-theme-twitter .chat-pm-thread-item:hover { background: #f7f9fa; }
.pm-panel.pm-theme-twitter .chat-pm-thread-item.has-unread { background: rgba(135, 206, 235, 0.2); }
.pm-panel.pm-theme-twitter .chat-pm-thread-item.has-unread:hover { background: rgba(135, 206, 235, 0.34); }
.pm-panel.pm-theme-twitter .chat-pm-thread-name,
.pm-panel.pm-theme-twitter .chat-pm-msg-name { color: #14171a; }
.pm-panel.pm-theme-twitter .chat-pm-thread-snippet,
.pm-panel.pm-theme-twitter .chat-pm-thread-time,
.pm-panel.pm-theme-twitter .chat-pm-time { color: #657786; }
.pm-panel.pm-theme-twitter .chat-pm-avatar { border-color: rgba(20, 23, 26, 0.12); }
.pm-panel.pm-theme-twitter .chat-pm-msg.theirs .chat-pm-bubble {
  background: #5f64f5;
  border: 1px solid #e1e8ed;
  color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.pm-panel.pm-theme-twitter .chat-pm-msg.mine .chat-pm-bubble {
  background: #1da1f2;
  border: 1px solid #1da1f2;
  color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(29, 161, 242, 0.35);
}
.pm-panel.pm-theme-twitter .chat-pm-input-row {
  background: #ffffff;
  border-top: 1px solid #e1e8ed;
}
.pm-panel.pm-theme-twitter .chat-pm-input-row .chat-input {
  background: #f5f8fa;
  border: 1px solid #e1e8ed;
  color: #14171a;
}
.pm-panel.pm-theme-twitter .chat-pm-input-row .chat-input::placeholder { color: #657786; }
.pm-panel.pm-theme-twitter .input-btn { color: #657786; }
.pm-panel.pm-theme-twitter .input-btn.recording { color: #1da1f2; }
.pm-panel.pm-theme-twitter .send-btn { background: #1da1f2; }
.pm-panel.pm-theme-twitter .pm-voice-timer { color: #1da1f2; }

/* Doodle (warm sketch amber) */
.pm-panel.pm-theme-doodle { background: #fbf3dc; }
.pm-panel.pm-theme-doodle .pm-panel-header {
  background: linear-gradient(90deg, #fdeec2, #f9e6b3);
  border-bottom: 1px solid #ecd9a0;
}
.pm-panel.pm-theme-doodle .pm-panel-title { color: #6b5310; }
.pm-panel.pm-theme-doodle .pm-panel-title i { color: #d97706; }
.pm-panel.pm-theme-doodle .pm-nav-btn,
.pm-panel.pm-theme-doodle .pm-theme-btn {
  border: 1px solid #e4cf9a;
  background: #fff7e0;
  color: #8a6d22;
}
.pm-panel.pm-theme-doodle .pm-nav-btn:hover,
.pm-panel.pm-theme-doodle .pm-theme-btn:hover { background: #fcebc4; color: #6b5310; }
.pm-panel.pm-theme-doodle .chat-pm-thread-list,
.pm-panel.pm-theme-doodle .chat-pm-messages { background: #fbf3dc; }
.pm-panel.pm-theme-doodle .chat-pm-thread-item:hover { background: rgba(217, 119, 6, 0.1); }
.pm-panel.pm-theme-doodle .chat-pm-thread-item.has-unread { background: rgba(255, 200, 60, 0.35); }
.pm-panel.pm-theme-doodle .chat-pm-thread-item.has-unread:hover { background: rgba(255, 200, 60, 0.5); }
.pm-panel.pm-theme-doodle .chat-pm-thread-name,
.pm-panel.pm-theme-doodle .chat-pm-msg-name { color: #6b5310; }
.pm-panel.pm-theme-doodle .chat-pm-thread-snippet,
.pm-panel.pm-theme-doodle .chat-pm-thread-time,
.pm-panel.pm-theme-doodle .chat-pm-time { color: #a58b4a; }
.pm-panel.pm-theme-doodle .chat-pm-msg.theirs .chat-pm-bubble {
  background: linear-gradient(135deg, rgba(217,119,6,0.8), rgba(180,140,20,0.72));
  border: 1px solid rgba(255,190,60,0.55);
  color: #ffffff;
}
.pm-panel.pm-theme-doodle .chat-pm-msg.mine .chat-pm-bubble {
  background: linear-gradient(135deg, rgba(251,191,36,0.8), rgba(245,158,11,0.7));
  border: 1px solid rgba(217,119,6,0.5);
  color: #ffffff;
}
.pm-panel.pm-theme-doodle .chat-pm-input-row {
  background: #fff7e0;
  border-top: 1px solid #ecd9a0;
}
.pm-panel.pm-theme-doodle .chat-pm-input-row .chat-input {
  background: #fffdf3;
  border: 1px solid #e4cf9a;
  color: #4a3c10;
}
.pm-panel.pm-theme-doodle .chat-pm-input-row .chat-input::placeholder { color: #a58b4a; }
.pm-panel.pm-theme-doodle .input-btn { color: #9a7b2e; }
.pm-panel.pm-theme-doodle .input-btn.recording { color: #d97706; }
.pm-panel.pm-theme-doodle .send-btn { background: #d97706; }
.pm-panel.pm-theme-doodle .pm-voice-timer { color: #d97706; }

/* Ocean (sky blue) */
.pm-panel.pm-theme-ocean { background: #e1f1fb; }
.pm-panel.pm-theme-ocean .pm-panel-header {
  background: linear-gradient(90deg, #d9eefc, #cae8fb);
  border-bottom: 1px solid #b4dcf5;
}
.pm-panel.pm-theme-ocean .pm-panel-title { color: #0c4a6e; }
.pm-panel.pm-theme-ocean .pm-panel-title i { color: #0284c7; }
.pm-panel.pm-theme-ocean .pm-nav-btn,
.pm-panel.pm-theme-ocean .pm-theme-btn {
  border: 1px solid #b4dcf5;
  background: #f2faff;
  color: #3b6f8d;
}
.pm-panel.pm-theme-ocean .pm-nav-btn:hover,
.pm-panel.pm-theme-ocean .pm-theme-btn:hover { background: #d8edfa; color: #0c4a6e; }
.pm-panel.pm-theme-ocean .chat-pm-thread-list,
.pm-panel.pm-theme-ocean .chat-pm-messages { background: #e1f1fb; }
.pm-panel.pm-theme-ocean .chat-pm-thread-item:hover { background: rgba(2, 132, 199, 0.1); }
.pm-panel.pm-theme-ocean .chat-pm-thread-item.has-unread { background: rgba(56, 189, 248, 0.3); }
.pm-panel.pm-theme-ocean .chat-pm-thread-item.has-unread:hover { background: rgba(56, 189, 248, 0.45); }
.pm-panel.pm-theme-ocean .chat-pm-thread-name,
.pm-panel.pm-theme-ocean .chat-pm-msg-name { color: #0c4a6e; }
.pm-panel.pm-theme-ocean .chat-pm-thread-snippet,
.pm-panel.pm-theme-ocean .chat-pm-thread-time,
.pm-panel.pm-theme-ocean .chat-pm-time { color: #5b8aa6; }
.pm-panel.pm-theme-ocean .chat-pm-msg.theirs .chat-pm-bubble {
  background: linear-gradient(135deg, rgba(14,165,233,0.42), rgba(56,189,248,0.26));
  border: 1px solid rgba(56,189,248,0.6);
  color: #ffffff;
}
.pm-panel.pm-theme-ocean .chat-pm-msg.mine .chat-pm-bubble {
  background: linear-gradient(135deg, rgba(14,165,233,0.65), rgba(6,182,212,0.55));
  border: 1px solid rgba(3,140,200,0.5);
  color: #ffffff;
}
.pm-panel.pm-theme-ocean .chat-pm-input-row {
  background: #e9f5fd;
  border-top: 1px solid #b4dcf5;
}
.pm-panel.pm-theme-ocean .chat-pm-input-row .chat-input {
  background: #f2faff;
  border: 1px solid #b4dcf5;
  color: #0c3654;
}
.pm-panel.pm-theme-ocean .chat-pm-input-row .chat-input::placeholder { color: #5b8aa6; }
.pm-panel.pm-theme-ocean .input-btn { color: #3b6f8d; }
.pm-panel.pm-theme-ocean .input-btn.recording { color: #0284c7; }
.pm-panel.pm-theme-ocean .send-btn { background: #0284c7; }
.pm-panel.pm-theme-ocean .pm-voice-timer { color: #0284c7; }
.pm-panel.pm-theme-ocean .chat-pm-reply-quote {
  background: rgba(6, 42, 63, 0.38);
  border-left-color: rgba(255, 255, 255, 0.65);
  color: #ffffff;
}
.pm-panel.pm-theme-ocean .chat-pm-msg.mine .chat-pm-reply-quote {
  color: #ffffff;
  border-left-color: rgba(255, 255, 255, 0.7);
}
.pm-panel.pm-theme-ocean .chat-pm-reply-text { color: #ffffff; }

/* Sunset (pink → purple) */
.pm-panel.pm-theme-sunset { background: #fbe7ec; }
.pm-panel.pm-theme-sunset .pm-panel-header {
  background: linear-gradient(90deg, #fcd9e4, #f6d9ef);
  border-bottom: 1px solid #ecbfd6;
}
.pm-panel.pm-theme-sunset .pm-panel-title { color: #7a1144; }
.pm-panel.pm-theme-sunset .pm-panel-title i { color: #db2777; }
.pm-panel.pm-theme-sunset .pm-nav-btn,
.pm-panel.pm-theme-sunset .pm-theme-btn {
  border: 1px solid #ecbfd6;
  background: #fff0f4;
  color: #a05579;
}
.pm-panel.pm-theme-sunset .pm-nav-btn:hover,
.pm-panel.pm-theme-sunset .pm-theme-btn:hover { background: #fbdbe8; color: #7a1144; }
.pm-panel.pm-theme-sunset .chat-pm-thread-list,
.pm-panel.pm-theme-sunset .chat-pm-messages { background: #fbe7ec; }
.pm-panel.pm-theme-sunset .chat-pm-thread-item:hover { background: rgba(219, 39, 119, 0.1); }
.pm-panel.pm-theme-sunset .chat-pm-thread-item.has-unread { background: rgba(236, 72, 153, 0.3); }
.pm-panel.pm-theme-sunset .chat-pm-thread-item.has-unread:hover { background: rgba(236, 72, 153, 0.45); }
.pm-panel.pm-theme-sunset .chat-pm-thread-name,
.pm-panel.pm-theme-sunset .chat-pm-msg-name { color: #7a1144; }
.pm-panel.pm-theme-sunset .chat-pm-thread-snippet,
.pm-panel.pm-theme-sunset .chat-pm-thread-time,
.pm-panel.pm-theme-sunset .chat-pm-time { color: #b06b8a; }
.pm-panel.pm-theme-sunset .chat-pm-msg.theirs .chat-pm-bubble {
  background: linear-gradient(135deg, rgba(190,54,118,0.85), rgba(143,72,231,0.8));
  border: 1px solid rgba(244,114,182,0.55);
  color: #ffffff;
}
.pm-panel.pm-theme-sunset .chat-pm-msg.mine .chat-pm-bubble {
  background: linear-gradient(135deg, rgba(217,70,239,0.7), rgba(139,92,246,0.65));
  border: 1px solid rgba(168,85,247,0.5);
  color: #ffffff;
}
.pm-panel.pm-theme-sunset .chat-pm-input-row {
  background: #fff0f4;
  border-top: 1px solid #ecbfd6;
}
.pm-panel.pm-theme-sunset .chat-pm-input-row .chat-input {
  background: #fff7fa;
  border: 1px solid #ecbfd6;
  color: #4d0f2a;
}
.pm-panel.pm-theme-sunset .chat-pm-input-row .chat-input::placeholder { color: #b06b8a; }
.pm-panel.pm-theme-sunset .input-btn { color: #a05579; }
.pm-panel.pm-theme-sunset .input-btn.recording { color: #db2777; }
.pm-panel.pm-theme-sunset .send-btn { background: #a21caf; }
.pm-panel.pm-theme-sunset .pm-voice-timer { color: #a21caf; }

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  backdrop-filter: blur(4px);
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.modal-header h3 i { color: var(--primary); }
.modal-header h3 b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-profile-header-title { display: flex; align-items: center; gap: 6px; min-width: 0; }

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-3);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }

.modal-body { padding: 18px; overflow-y: auto; flex: 1; }

.small-modal-card { max-width: 380px; }
.chat-profile-modal-card { max-width: 440px; }
.store-modal-card { max-width: 500px; }

/* ---- Settings ---- */
.settings-group { margin-bottom: 18px; }
.settings-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.settings-row { display: flex; gap: 6px; align-items: stretch; }
.settings-info { display: block; font-size: 12px; line-height: 1.45; color: var(--text-2); padding: 2px 2px 4px; }
.settings-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  margin-bottom: 8px;
  transition: var(--transition);
}
.settings-input:focus { border-color: var(--primary); }
.settings-save {
  padding: 0 14px;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-xs);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
  flex-shrink: 0;
}
.settings-save:hover { background: var(--primary-hover); }
.settings-btn {
  padding: 10px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}
.settings-btn:hover { background: var(--surface-3); }
.settings-btn.danger { background: rgba(239,68,68,0.12); color: #f87171; border-color: rgba(239,68,68,0.25); }
.settings-btn.danger:hover { background: rgba(239,68,68,0.22); }
.settings-btn-sm { margin-left: auto; padding: 6px 10px; font-size: 11px; }
.settings-msg { margin-top: 10px; font-size: 12px; min-height: 16px; }
.settings-msg.error { color: var(--red); }
.settings-msg.success { color: var(--green); }

/* ---- Chat profile modal ---- */
.chat-profile { position: relative; border-radius: 14px; overflow: hidden; padding: 16px; background: var(--surface-2); }
.chat-profile > * { position: relative; z-index: 1; }
.chat-profile-cover { position: relative; margin: -16px -16px 0; padding: 16px; border-radius: inherit; }
.chat-profile-cover > * { position: relative; z-index: 1; }
.chat-profile-cover.chat-profile-has-bg { background-position: center center; background-size: cover; }
.chat-profile-cover.chat-profile-has-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(12,12,18, var(--profile-bg-overlay, 0.72));
  z-index: 0;
  border-radius: inherit;
}

.chat-profile-top { display: flex; align-items: center; gap: 14px; }
.chat-profile-avatar-wrap { position: relative; width: 76px; height: 76px; flex-shrink: 0; }
.chat-profile-avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
  border: 2px solid var(--border);
}
.chat-profile-avatar-wrap .avatar-frame-overlay { inset: -1px; }
.chat-profile-id { min-width: 0; }
.chat-profile-name { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chat-profile-role { font-size: 11.5px; color: var(--text-2); margin-top: 1px; }
.chat-profile-uname { font-size: 12px; color: var(--text-3); display: block; }

.chat-profile-stats { display: flex; gap: 8px; margin: 14px 0 10px; }
.chat-profile-stat { flex: 1; text-align: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 6px; }
.chat-profile-stat b { display: block; font-size: 15px; color: var(--primary); line-height: 1.3; }
.chat-profile-stat span { font-size: 9.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.chat-profile-last-seen { text-align: center; color: var(--text-2); font-size: 12px; margin-bottom: 12px; }

.chat-profile-note { margin: 0 2px 12px; padding: 11px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.chat-profile-note-label { display: block; font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.chat-profile-note-text { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-1); word-break: break-word; overflow-wrap: anywhere; }

.profile-btn {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 10px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  transition: var(--transition);
}
.profile-btn-main { background: var(--primary); color: #fff; margin-bottom: 4px; }
.profile-btn-main:hover { background: var(--primary-hover); }
.chat-profile-actions { display: flex; gap: 8px; margin-top: 4px; }
.chat-profile-actions .profile-btn { flex: 1; }
.profile-btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}
.profile-btn-outline:hover { background: var(--primary); color: #fff; }
.profile-btn-outline.following {
  background: transparent;
  border-color: var(--text-3);
  color: var(--text-3);
}
.profile-btn-outline.following:hover { background: var(--text-3); color: #fff; }

.chat-profile-settings { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.chat-profile-setting { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); overflow: hidden; }
.chat-profile-setting-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}
.chat-profile-setting-toggle:hover { background: var(--surface-3); }
.chat-profile-setting-toggle i { color: var(--primary); font-size: 12px; width: 18px; text-align: center; }
.chat-profile-setting-toggle::after {
  content: "\f078";
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  margin-left: auto;
  font-size: 10px;
  color: var(--text-3);
  transition: var(--transition);
}
.chat-profile-setting.open .chat-profile-setting-toggle::after { transform: rotate(180deg); }
.chat-profile-setting-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }

.chat-profile-input {
  flex: 1;
  padding: 9px 11px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}
.chat-profile-input:focus { border-color: var(--primary); }

.chat-profile-frame { margin-top: 12px; }
.chat-profile-setting-toggle-frame { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.chat-profile-setting-toggle-frame > i { color: var(--primary); }

.chat-profile-settings-msg { margin-top: 10px; font-size: 12px; min-height: 16px; text-align: center; }
.chat-profile-settings-msg.success { color: var(--green); }
.chat-profile-settings-msg.error { color: var(--red); }

/* ---- Animal icon picker ---- */
.animal-picker-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 6px;
}
.animal-picker-tabs {
  grid-column: 1 / -1;
  display: flex;
  gap: 3px;
  margin-bottom: 10px;
  padding: 3px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.animal-picker-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 4px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-3);
  background: transparent;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.2s, color 0.2s;
}
.animal-picker-tab:hover { color: var(--text-1); background: rgba(var(--primary-rgb), 0.08); }
.animal-picker-tab.active {
  background: rgba(var(--primary-rgb), 0.18);
  color: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.35);
}
.animal-picker-item {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  background: var(--surface-3);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  transition: var(--transition);
}
.animal-picker-item:hover { border-color: var(--text-3); transform: translateY(-1px); }
.animal-picker-item.selected {
  border-color: #bbe51e;
  background: rgba(187, 229, 30, 0.14);
  box-shadow: 0 0 8px rgba(187, 229, 30, 0.35);
}
.animal-picker-item.none i { color: var(--text-3); font-size: 15px; }
.animal-picker-item img { width: 30px; height: 20px; object-fit: cover; border-radius: 2px; }

/* ---- Frame picker ---- */
.frame-picker { padding-top: 10px; }
.frame-picker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; }
.frame-option {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 10px;
  transition: var(--transition);
}
.frame-option:hover { background: var(--surface-3); }
.frame-option-thumb {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  transition: var(--transition);
}
.frame-option-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.frame-option-thumb.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.25); }
.frame-check {
  position: absolute;
  top: -3px;
  right: -3px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 8px;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface-2);
}
.frame-price-badge {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a26;
  border: 1px solid var(--border);
  color: #fbbf24;
  font-size: 9px;
  padding: 0 5px;
  border-radius: 6px;
  white-space: nowrap;
}
.frame-option-name { font-size: 11px; color: var(--text-2); max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frame-option-locked .frame-option-thumb { opacity: 0.5; }

/* ---- Store modals ---- */
.store-coins { font-size: 13px; font-weight: 600; color: #fbbf24; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.store-list { display: flex; flex-direction: column; gap: 10px; }
.store-msg { font-size: 12px; margin-top: 10px; min-height: 16px; color: var(--green); }
.store-msg.msg-error { color: var(--red); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-sm { padding: 6px 10px; font-size: 11px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-warning { background: rgba(251,191,36,0.16); color: #fbbf24; }
.btn-warning:hover { background: rgba(251,191,36,0.28); }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.frame-store-empty { text-align: center; color: var(--text-3); padding: 30px 10px; font-size: 13px; }
.frame-store-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.frame-store-thumb {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.frame-store-thumb img { width: 100%; height: 100%; object-fit: cover; }
.frame-store-info { flex: 1; min-width: 0; }
.frame-store-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frame-store-price { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.frame-store-price.free { color: var(--green); }

.item-pack { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; }
.item-pack-head {
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.item-pack-head i { color: var(--primary); font-size: 12px; }
.item-pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 10px; padding: 12px; }

.item-store-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
}
.item-store-card:hover { border-color: rgba(var(--primary-rgb), 0.4); }
.item-store-thumb {
  width: 100%;
  height: 62px;
  border-radius: 10px;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--primary);
}
.item-store-info { min-width: 0; }
.item-store-name { font-weight: 600; font-size: 12.5px; }
.item-store-desc {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.item-store-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.item-store-type {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(var(--primary-rgb), 0.13);
  color: #a5b4fc;
}
.item-store-exp { font-size: 10.5px; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
.item-store-exp.never { color: var(--green); }
.item-store-exp.expired { color: var(--red); }
.item-exp-countdown { color: var(--text); font-variant-numeric: tabular-nums; }

.item-store-status.equipped {
  font-size: 11px;
  color: var(--green);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}
.item-store-card > .btn,
.item-store-card > .item-store-status { align-self: flex-start; margin-top: 2px; }

/* ---- Chat note modals ---- */
.chat-note-input {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}
.chat-note-input:focus { border-color: var(--primary); }
.chat-note-modal-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.chat-note-modal-btns .settings-btn { padding: 8px 14px; }

.chat-note-view { text-align: center; }
.chat-note-view-avatar img, .chat-note-view img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--surface-3); }
.chat-note-view-name { display: block; margin-top: 8px; font-weight: 600; font-size: 14px; }
.chat-note-view-text { margin-top: 6px; color: var(--text-2); font-size: 13px; }
.chat-note-view-bubble {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 90%;
  padding: 20px 26px;
  background: #ffffff;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}
.chat-note-view-bubble .chat-note-avatar {
  width: 52px;
  height: 52px;
  order: -1;
  background: var(--surface-3);
  cursor: default;
}
.chat-note-view-reply {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
}
.chat-note-view-reply-input {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.chat-note-view-reply-input:focus { border-color: var(--primary); }

/* ===== REACTION PICKER ===== */
.react-picker {
  display: none;
  position: fixed;
  align-items: center;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 4px 6px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.45);
  z-index: 260;
}
.react-picker.show { display: flex; }
.react-picker-emoji {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
}
.react-picker-emoji:hover { background: var(--surface-3); transform: scale(1.2); }

/* ===== REACTORS OVAL (who reacted) ===== */
.reactors-oval {
  display: none;
  position: fixed;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  z-index: 270;
  white-space: nowrap;
  max-width: calc(100vw - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
  user-select: none;
}
.reactors-oval-emoji { font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.reactors-oval-names { font-size: 0.85rem; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

/* ===== IMAGE LIGHTBOX ===== */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  cursor: pointer;
  animation: msgIn 0.15s ease;
}
.lightbox-overlay img {
  max-width: 90%;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.lightbox-close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  color: #111;
  font-size: 16px;
  cursor: pointer;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close:hover { background: #fff; color: #e0245e; }

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -300px;
    top: 0;
    z-index: 200;
    transition: left 0.3s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 30px rgba(0,0,0,0.5);
  }
  .sidebar.open { left: 0; }
  .chat-header-back { display: flex; }
  .msg-group { max-width: 88%; }
  .chat-message { max-width: 90%; }
  .pm-panel { width: 100%; }
  .color-dice-panel { right: 10px; }
}

@media (max-width: 480px) {
  .auth-card { margin: 12px; padding: 28px 20px; border-radius: 18px; }
  .chat-messages { padding: 12px; }
  .chat-input-area { padding: 6px 10px 10px; }
  .chat-msg-actions { padding-left: 44px; }
  .chat-radio-marquee { display: none !important; }
}

/* ===== SCROLLBAR GLOBAL ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }

/* ===== PROFILE FEED (WALL) ===== */
.chat-feed { flex: 0 0 100%; max-width: 100%; margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.chat-feed-head { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 10px; }
.chat-feed-following-btn { margin-left: auto; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: var(--transition); }
.chat-feed-back-btn { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: var(--transition); }
.chat-feed-following-btn:hover,
.chat-feed-back-btn:hover { color: var(--primary); border-color: var(--primary); }
.chat-feed-following-btn.active { color: var(--primary); border-color: var(--primary); background: var(--surface-3); }
.chat-feed-following-btn#btnChatFeedFollowGallery,
.chat-feed-following-btn#btnChatFeedGallery { margin-left: 0; }
.chat-feed-composer { background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 12px; }
.chat-feed-composer textarea { width: 100%; background: transparent; border: none; outline: none; color: var(--text); font-family: inherit; font-size: 13px; line-height: 1.4; resize: none; min-height: 44px; }
.chat-feed-composer-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.chat-feed-img-btn { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 6px 10px; font-size: 12px; cursor: pointer; font-family: inherit; }
.chat-feed-img-btn:hover { color: var(--primary); border-color: var(--primary); }
.chat-feed-img-btn:disabled { opacity: 0.6; cursor: default; }
.chat-feed-post-btn { background: var(--primary); color: #fff; border: none; border-radius: var(--radius-xs); padding: 6px 14px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; }
.chat-feed-post-btn:hover { background: var(--primary-hover); }
.chat-feed-post-btn:disabled { opacity: 0.6; cursor: default; }
.chat-feed-img-preview { position: relative; margin-top: 8px; }
.chat-feed-img-preview img { width: 100%; max-height: 160px; object-fit: cover; border-radius: var(--radius-xs); border: 1px solid var(--border); }
.chat-feed-img-remove { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.65); color: #fff; border: none; border-radius: 50%; cursor: pointer; font-size: 12px; }
.chat-feed-gallery-card { width: 640px; max-width: 96vw; height: 100vh; max-height: 100vh; }
.chat-feed-gallery-card .modal-body { max-height: none; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.chat-feed-gallery-card .modal-footer { flex-shrink: 0; display: flex; justify-content: center; align-items: center; margin-bottom: 5px; }
.chat-feed-gallery-more { grid-column: 1 / -1; display: block; margin: 6px auto 0; background: var(--surface-2); color: var(--primary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px; cursor: pointer; font-size: 12px; font-weight: 600; font-family: inherit; transition: var(--transition); }
.chat-feed-gallery-more:hover { background: var(--surface-3, rgba(30, 144, 255, 0.12)); border-color: var(--primary); }
.chat-feed-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.chat-feed-gallery-item { padding: 0; border: 1px solid var(--border); border-radius: var(--radius-xs); background: none; cursor: pointer; overflow: hidden; }
.chat-feed-gallery-item:hover { border-color: var(--primary); }
.chat-feed-gallery-item img { width: 100%; height: 110px; object-fit: cover; display: block; }
.chat-feed-gallery-empty { font-size: 13px; color: var(--text-2); text-align: center; padding: 20px 8px; }
.chat-feed-photo-caption { margin-top: 10px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-xs); }
.chat-feed-photo-caption-author { font-size: 12px; font-weight: 700; color: var(--primary); }
.chat-feed-photo-caption-time { font-size: 11px; color: var(--text-2); margin-left: 6px; }
.chat-feed-photo-caption-text { margin-top: 4px; font-size: 13px; line-height: 1.45; color: var(--text-1); word-break: break-word; }
.chat-feed-photo-cm { margin-top: 10px; }
.chat-feed-photo-cm-list { display: flex; flex-direction: column; gap: 8px; max-height: 200px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
.chat-feed-photo-cm-list::-webkit-scrollbar { width: 6px; }
.chat-feed-photo-cm-list::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.2); border-radius: 3px; }
.chat-feed-photo-cm-msg { font-size: 12px; color: #16a34a; min-height: 16px; }
.chat-feed-photo-cm-msg.error { color: #dc2626; }
.chat-feed-photo-cm-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 6px; }
.chat-feed-photo-cm-form textarea { flex: 1; min-width: 0; background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-xs); color: #222; font-family: inherit; font-size: 13px; line-height: 1.4; resize: none; padding: 7px 10px; }
.chat-feed-photo-cm-form textarea:focus { outline: none; border-color: var(--primary); }
#feedPhotoModal #btnFeedPhotoCmSend { background: var(--primary); color: #fff; border: none; border-radius: var(--radius-xs); padding: 8px 14px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
#feedPhotoModal #btnFeedPhotoCmSend:hover { filter: brightness(1.08); }
#feedPhotoModal #btnFeedPhotoCmSend:disabled { opacity: 0.6; cursor: default; }
.chat-feed-msg { font-size: 12px; color: var(--green); min-height: 16px; margin-bottom: 8px; display: none; }
.chat-feed-msg.error { color: var(--red); }
.chat-feed-list { display: flex; flex-direction: column; gap: 10px; }
.chat-feed-empty { text-align: center; color: var(--text-3); font-size: 13px; padding: 16px 0; }
.chat-feed-load-more { display: block; margin: 6px auto 0; background: var(--surface-2); color: var(--primary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px; cursor: pointer; font-size: 12px; font-weight: 600; font-family: inherit; transition: var(--transition); }
.chat-feed-load-more:hover { background: var(--surface-3, rgba(30, 144, 255, 0.12)); border-color: var(--primary); }
.chat-feed-post { position: relative; background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.chat-feed-react-float { position: absolute; bottom: 6px; right: 6px; z-index: 2; }
.chat-feed-react-float .chat-feed-react-btn { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; font-size: 15px; padding: 2px 6px; line-height: 1.4; cursor: pointer; }
.chat-feed-react-float .chat-feed-react-btn:hover { border-color: var(--primary); }
.chat-feed-react-float .chat-feed-react-btn.reacted { border-color: var(--primary); background: var(--surface-3); }
.chat-feed-react-float .feed-react-default { font-style: normal; font-size: 16px; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; color: #3a3f45; filter: grayscale(1); }
.chat-feed-post-head { display: flex; align-items: center; gap: 10px; }
.chat-feed-avatar-wrap { position: relative; width: 34px; height: 34px; flex-shrink: 0; }
.chat-feed-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.chat-feed-frame { position: absolute; top: -3px; left: -3px; width: 40px; height: 40px; border-radius: 50%; background-repeat: no-repeat; background-size: cover; background-position: center; pointer-events: none; }
.chat-feed-post-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chat-feed-post-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.2; }
.chat-feed-post-time { font-size: 11px; color: var(--text-3); }
.chat-feed-post-text { margin: 8px 0 2px 44px; font-size: 13px; line-height: 1.45; color: var(--text); word-break: break-word; }
.chat-feed-post-image { width: calc(100% - 44px); margin-left: 44px; margin-top: 8px; max-height: 260px; object-fit: cover; border-radius: var(--radius-xs); border: 1px solid var(--border); cursor: zoom-in; }
.chat-feed-extra { display: none; }
.chat-feed-extra.show { display: inline; }
.chat-feed-more { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 12px; padding: 2px 0; margin-left: 44px; font-family: inherit; }
.chat-feed-more:hover { text-decoration: underline; }
.chat-feed-del { background: none; border: none; color: var(--text-3); cursor: pointer; padding: 4px; font-size: 12px; opacity: 0.4; transition: opacity 0.2s; }
.chat-feed-edit { background: none; border: none; color: var(--text-3); cursor: pointer; padding: 4px; font-size: 12px; opacity: 0.4; transition: opacity 0.2s; }
.chat-feed-post-head:hover .chat-feed-del, .chat-feed-comment:hover .chat-feed-del, .chat-feed-post-head:hover .chat-feed-edit, .chat-feed-comment:hover .chat-feed-edit { opacity: 1; }
.chat-feed-del:hover, .chat-feed-edit:hover { color: var(--primary); }
.chat-feed-del:hover { color: var(--red); }
.chat-feed-edit { margin-left: auto; }
.chat-feed-edit-input { width: 100%; background: transparent; border: 1px solid var(--border); border-radius: var(--radius-xs); color: var(--text); font-family: inherit; font-size: 13px; line-height: 1.4; resize: none; padding: 6px 8px; margin-top: 8px; }
.chat-feed-edit-btns { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.chat-feed-edit-save, .chat-feed-edit-cancel { background: var(--primary); color: #fff; border: none; border-radius: var(--radius-xs); padding: 3px 10px; font-size: 11px; font-weight: 600; cursor: pointer; font-family: inherit; }
.chat-feed-edit-cancel { background: var(--primary); color: #fff; border: none; }
.chat-feed-edit-save:hover { background: var(--primary-hover); }
.chat-feed-edit-save:disabled { opacity: 0.6; cursor: default; }
.chat-feed-reactions-row { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px 44px; min-height: 24px; }
.chat-feed-react-btn { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); font-size: 13px; padding: 2px 10px; cursor: pointer; line-height: 1.7; display: inline-flex; align-items: center; gap: 4px; transition: var(--transition); font-family: inherit; }
.chat-feed-react-btn:hover { color: var(--text); border-color: var(--primary); }
.chat-feed-react-btn.reacted { color: var(--primary); border-color: var(--primary); background: var(--surface-3); }
.feed-react-default { font-style: normal; font-size: 15px; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; color: #3a3f45; filter: grayscale(1); }
.chat-feed-reactions { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.chat-feed-react-menu { position: fixed; z-index: 2000; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); display: flex; gap: 4px; padding: 6px; max-width: 90vw; flex-wrap: wrap; }
.feed-react-emoji { cursor: pointer; font-size: 20px; padding: 4px; border-radius: var(--radius-xs); transition: transform 0.12s ease, background 0.12s ease; }
.feed-react-emoji:hover { transform: scale(1.25); background: var(--surface-3); }
.chat-feed-comment-btn { background: transparent; border: none; color: var(--text-2); font-size: 13px; padding: 2px 8px; cursor: pointer; line-height: 1.7; display: inline-flex; align-items: center; gap: 6px; transition: var(--transition); font-family: inherit; }
.chat-feed-comment-btn:hover { color: var(--primary); }
.chat-feed-comment-btn .chat-feed-cm-count { font-weight: 600; }
.chat-feed-cm-modal-card { width: 720px; max-width: 96vw; }
.chat-feed-cm-post { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px; margin-bottom: 12px; }
.chat-feed-cm-auth { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.chat-feed-cm-auth-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.chat-feed-cm-auth-info { display: flex; flex-direction: column; }
.chat-feed-cm-auth-name { font-weight: 600; color: var(--text); font-size: 14px; }
.chat-feed-cm-auth-time { color: var(--text-2); font-size: 12px; }
.chat-feed-cm-post-text { color: var(--text); font-size: 14px; white-space: pre-wrap; line-height: 1.5; }
.chat-feed-cm-post-image { display: block; max-width: 100%; max-height: 280px; border-radius: var(--radius-md); margin-top: 8px; cursor: pointer; }
#feedCommentsModal .modal-body { overflow-y: auto !important; overflow-x: hidden; display: block; flex: 1 1 auto; min-height: 0; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
#feedPhotoModal .modal-body { overflow-y: auto; }
#feedCommentsModal .chat-feed-cm-list { max-height: none; min-height: 0; flex: none; overflow: visible; padding: 4px 2px; margin-bottom: 12px; }
.chat-feed-cm-list::-webkit-scrollbar { width: 6px; }
.chat-feed-cm-list::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.2); border-radius: 3px; }
.chat-feed-cm-more { display: block; width: 100%; margin: 6px 0 0; background: var(--surface-2); color: var(--primary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; cursor: pointer; font-size: 12px; font-weight: 600; font-family: inherit; transition: var(--transition); }
.chat-feed-cm-more:hover { background: var(--surface-3, rgba(30, 144, 255, 0.12)); border-color: var(--primary); }
#feedCommentsModal .chat-feed-cm-modal-card {
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
}
#feedCommentsModal .modal-footer, #feedPhotoModal .modal-footer, #chatProfileModal .modal-footer, #feedGalleryModal .modal-footer { justify-content: center; }
#feedCommentsModal .modal-footer { display: flex; align-items: center; flex-shrink: 0; padding: 8px 16px 12px; }
#feedCommentsModal .chat-feed-cm-close { display: inline-flex; justify-content: center; }
#chatProfileModal .modal-footer { padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface); position: sticky; bottom: 0; z-index: 2; flex-shrink: 0; display: flex; justify-content: center; align-items: center; margin-bottom: 5px; }
#chatProfileModal .chat-feed-cm-close { width: 100%; max-width: 240px; padding: 9px 18px; color: var(--text-2); display: inline-flex; justify-content: center; align-items: center; }
#chatProfileModal .chat-feed-cm-close:hover { color: var(--primary); border-color: var(--primary); background: var(--surface-3, rgba(30, 144, 255, 0.12)); }
.chat-feed-cm-close { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 18px; cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit; transition: var(--transition); }
.chat-feed-cm-close:hover { background: var(--surface-3, rgba(30, 144, 255, 0.12)); border-color: var(--primary); color: var(--primary); }
.chat-feed-cm-empty { color: var(--text-2); font-size: 13px; text-align: center; padding: 18px 0; }
.chat-feed-cm-form { border-top: 1px solid var(--border); padding-top: 12px; }
.chat-feed-cm-form textarea { width: 100%; resize: none; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); padding: 10px 12px; font-family: inherit; font-size: 14px; box-sizing: border-box; }
.chat-feed-cm-form textarea:focus { outline: none; border-color: var(--primary); }
.chat-feed-cm-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 6px; }
.chat-feed-cm-form textarea { flex: 1; min-width: 0; background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-xs); color: #222; font-family: inherit; font-size: 13px; line-height: 1.4; resize: none; padding: 7px 10px; }
.chat-feed-cm-form textarea:focus { outline: none; border-color: var(--primary); }
.chat-feed-cm-send { background: var(--primary); color: #fff; border: none; border-radius: var(--radius-xs); padding: 8px 14px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; font-family: inherit; }
/* ===== Feed comment sticker picker (comments modal + photo modal) ===== */
.chat-cm-sticker-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-1);
  color: var(--text-2);
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}
.chat-feed-photo-cm-form .chat-cm-sticker-btn {
  padding: 0;
  background: var(--surface-1);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  width: 34px;
  height: 34px;
}
.chat-cm-sticker-btn:hover,
.chat-feed-photo-cm-form .chat-cm-sticker-btn:hover {
  background: var(--surface-3, rgba(30, 144, 255, 0.12));
  border-color: var(--primary);
  color: var(--primary);
}
#feedCmForm,
#feedPhotoModal .chat-feed-photo-cm-form {
  position: relative;
}
.chat-cm-smiley-picker {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  left: auto;
  width: 280px;
  max-height: 220px;
  background: linear-gradient(135deg, rgba(20, 20, 20, 0.98), rgba(35, 35, 35, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 99;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.chat-cm-smiley-picker .smiley-picker-head {
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}
.chat-cm-smiley-picker .smiley-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px 12px;
  overflow-y: auto;
}
.chat-cm-smiley-picker .smiley-item {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.chat-cm-smiley-picker .smiley-item:hover {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.08);
}
.chat-cm-smiley-picker .smiley-item img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.chat-cm-smiley-picker .smiley-section-label {
  grid-column: 1 / -1;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.4);
  padding: 6px 0 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.chat-cm-smiley-picker .smiley-section-label:first-child {
  border-top: none;
  padding-top: 0;
}
.chat-cm-smiley-picker .smiley-picker-empty {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  padding: 4px;
}
.chat-feed-comment-image {
  display: block;
  max-width: 120px;
  max-height: 120px;
  border-radius: var(--radius-sm);
  margin: 6px 0;
  object-fit: contain;
}
.chat-feed-comment-sticker {
  max-width: 70px;
  max-height: 70px;
}
.chat-feed-cm-send:hover { filter: brightness(1.08); }
.chat-feed-cm-send:disabled { opacity: 0.6; cursor: default; }
.chat-feed-cm-msg { margin-top: 8px; }
.chat-feed-reactors-card { width: 360px; max-width: 96vw; }
.chat-feed-photo-card { width: 720px; max-width: 96vw; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; }
.chat-feed-photo-card .modal-body { overflow-y: auto !important; overflow-x: hidden; display: block; flex: 1 1 auto; min-height: 0; padding: 14px 18px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.chat-feed-photo-card #feedPhotoImg { width: auto; max-width: 100%; max-height: 42vh; flex-shrink: 0; object-fit: contain; border-radius: var(--radius-sm); display: block; margin: 0 auto; }
.chat-feed-photo-card .chat-feed-photo-caption { flex-shrink: 0; }
.chat-feed-photo-card .chat-feed-photo-cm { margin-top: 10px; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.chat-feed-photo-card .chat-feed-photo-cm-list { flex: none; max-height: none; min-height: 0; overflow: visible; padding-right: 2px; display: flex; flex-direction: column; gap: 8px; }
.chat-feed-photo-card .chat-feed-photo-cm-list::-webkit-scrollbar { width: 6px; }
.chat-feed-photo-card .chat-feed-photo-cm-list::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.2); border-radius: 3px; }
.chat-feed-photo-card .chat-feed-photo-cm-msg { flex-shrink: 0; }
.chat-feed-photo-card .chat-feed-photo-cm-form { flex-shrink: 0; }
.chat-feed-photo-card .modal-footer { flex-shrink: 0; display: flex; justify-content: center; align-items: center; margin-top: 5px; margin-bottom: 5px; }
.chat-notif-header-actions { display: flex; align-items: center; gap: 6px; }
.chat-notif-clear-btn { display: inline-flex; align-items: center; gap: 5px; background: var(--surface-3); color: #ff5a5f; border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.chat-notif-clear-btn:hover { background: rgba(255, 90, 95, 0.12); border-color: #ff5a5f; }
.profile-btn-bell { position: relative; width: 34px; height: 34px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface-2); color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.profile-btn-bell:hover { color: var(--primary); border-color: var(--primary); }
.chat-notif-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: #e0245e; color: #fff; font-size: 10px; font-weight: 700; line-height: 18px; text-align: center; }
.chat-notif-card { width: 420px; max-width: 96vw; }
.chat-notif-list { max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.chat-notif-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.chat-notif-item:hover { background: var(--surface-2); }
.chat-notif-item.unread { background: rgba(30, 144, 255, 0.15); }
.chat-notif-item.unread:hover { background: rgba(30, 144, 255, 0.22); }
.chat-notif-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.chat-notif-body { min-width: 0; flex: 1; }
.chat-notif-text { font-size: 12px; color: var(--text-1); line-height: 1.4; }
.chat-notif-text b { color: var(--primary); }
.chat-notif-snippet { display: block; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.chat-notif-time { display: block; font-size: 10px; color: var(--text-2); opacity: 0.8; margin-top: 1px; }
.chat-notif-empty { text-align: center; color: var(--text-2); font-size: 13px; padding: 24px 0; }
.feed-reactors-count { color: var(--primary); }
.chat-feed-reactors-list { max-height: 320px; overflow-y: auto; padding: 4px 2px; }
.chat-feed-reactor { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--radius-xs); }
.chat-feed-reactor:hover { background: var(--surface-2); }
.chat-feed-reactor-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.chat-feed-reactor-name { font-size: 14px; color: var(--text); font-weight: 500; }
.chat-feed-comments { margin-left: 44px; margin-top: 8px; }
.chat-feed-comment { position: relative; display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.chat-feed-comment-react-float { position: absolute; bottom: 4px; right: 6px; z-index: 2; }
.chat-feed-comment-react-float .chat-feed-react-btn { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; font-size: 14px; padding: 1px 5px; line-height: 1.4; cursor: pointer; }
.chat-feed-comment-react-float .chat-feed-react-btn:hover { border-color: var(--primary); }
.chat-feed-comment-react-float .chat-feed-react-btn.reacted { border-color: var(--primary); background: var(--surface-3); }
.chat-feed-comment-react-float .feed-react-default { font-style: normal; font-size: 14px; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; color: #3a3f45; filter: grayscale(1); }
.chat-feed-comment:last-of-type { margin-bottom: 0; }
.chat-feed-comment-avatar { width: 26px !important; height: 26px !important; border-radius: 50%; object-fit: cover; flex-shrink: 0; cursor: pointer; }
.chat-feed-comment-avatar:hover { opacity: 0.85; }
.chat-feed-comment-body { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; min-width: 0; flex: 1; }
.chat-feed-comment-name { display: block; font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.chat-feed-comment-text { font-size: 12px; color: var(--text); word-break: break-word; }
.chat-feed-comment-time { display: block; font-size: 10px; color: var(--text-3); margin-top: 2px; }
.chat-feed-comment-reactions { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.chat-feed-comment-reactions .chat-feed-react-btn { font-size: 12px; padding: 0 4px; line-height: 1.5; }
.chat-feed-comment-reactions .react-pill { font-size: 11px; padding: 0 6px 0 4px; }
.chat-feed-comment-del { align-self: center; }
.chat-feed-comment-actions { display: flex; flex-direction: row; align-items: center; gap: 4px; flex-shrink: 0; align-self: center; opacity: 0; transition: opacity 0.2s; }
.chat-feed-comment:hover .chat-feed-comment-actions { opacity: 1; }
.chat-feed-comment-actions .chat-feed-edit { margin-left: 0; }
.chat-feed-comment-actions .chat-feed-edit, .chat-feed-comment-actions .chat-feed-del { margin: 0; padding: 0; width: 22px; height: 22px; font-size: 10px; color: var(--primary); background: rgba(30, 144, 255, 0.12); border: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.chat-feed-comment-actions .chat-feed-edit:hover, .chat-feed-comment-actions .chat-feed-del:hover { background: var(--primary); color: #fff; }
.chat-feed-comment-form { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.chat-feed-comment-input { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-xs); color: var(--text); font-size: 12px; padding: 6px 10px; outline: none; font-family: inherit; }
.chat-feed-comment-input:focus { border-color: var(--primary); }

/* =========================================================
   MOBILE LAYOUT OPTIMIZATION
   ========================================================= */

html {
    -webkit-text-size-adjust: 100%;
}

/* Off-canvas sidebar must tuck fully off-screen regardless of its width */
@media (max-width: 768px) {
    .sidebar {
        left: -100%;
        width: min(300px, 92vw);
        min-width: min(300px, 92vw);
    }

    /* Notched phones: keep the composer above the home indicator */
    .chat-input-area {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .pm-panel {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

/* Larger tap targets on touch devices */
@media (pointer: coarse) {
    .btn-msg-delete,
    .btn-msg-pm,
    .btn-msg-reply {
        min-width: 34px;
        min-height: 34px;
        width: 34px;
        height: 34px;
        font-size: 13px;
    }

    .btn-msg-react {
        min-width: 30px;
        min-height: 30px;
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .btn-msg-delete.system {
        width: 28px;
        height: 28px;
    }

    .chat-preview-remove {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .chat-feed-img-remove {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .chat-feed-following-btn,
    .chat-feed-back-btn {
        width: 36px;
        height: 36px;
        font-size: 15px;
    }

    .chat-feed-comment-actions .chat-feed-edit,
    .chat-feed-comment-actions .chat-feed-del {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .chat-header-btn {
        width: 40px;
        height: 40px;
    }

    .chat-header-back,
    .profile-btn-bell {
        width: 40px;
        height: 40px;
    }
}

/* Small phones (<=360px): give freed-up room back to the bubbles */
@media (max-width: 360px) {
    .chat-header {
        padding: 10px 10px;
        gap: 8px;
    }

    .chat-header-info {
        padding-right: 4px;
    }

    .chat-header-title {
        font-size: 14px;
    }

    .chat-messages {
        padding: 10px;
    }

    .chat-input-area {
        padding: 8px 10px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .msg-group {
        max-width: 92%;
    }

    .chat-message {
        max-width: 93%;
    }

    .chat-msg-actions {
        padding-left: 36px;
    }

    /* Reaction picker / reactor bubbles must hug viewport edges */
    .react-picker,
    .reactors-oval {
        max-width: 94vw;
    }
}

/* Momentum scrolling for the chat scroll containers */
.sidebar-list,
.chat-messages,
.chat-pm-messages,
.chat-user-list,
.chat-feed-cm-list,
.chat-feed-photo-cm-list,
.chat-feed-reactors-list,
.chat-notif-list {
    -webkit-overflow-scrolling: touch;
}

/* ===== Profile modal: user search ===== */
.chat-profile-search-wrap {
    position: relative;
    margin-bottom: 14px;
}
.chat-profile-search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    font-size: 13px;
    pointer-events: none;
}
.chat-profile-search-input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}
.chat-profile-search-input:focus {
    border-color: var(--primary);
}
.chat-profile-search-input::placeholder {
    color: var(--text-3);
}
.chat-profile-search-results {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 60;
    max-height: 280px;
    overflow-y: auto;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    -webkit-overflow-scrolling: touch;
}
.chat-profile-search-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.chat-profile-search-result:hover {
    background: var(--surface-3);
}
.chat-profile-search-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.chat-profile-search-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.chat-profile-search-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-profile-search-uname {
    font-size: 12px;
    color: var(--text-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-profile-search-arrow {
    color: var(--text-3);
    font-size: 12px;
    flex-shrink: 0;
}
.chat-profile-search-empty {
    padding: 12px 14px;
    color: var(--text-3);
    font-size: 13px;
}

/* ===== Lock page scroll while a modal is open (mobile): only the modal box scrolls ===== */
html.chat-modal-open,
html.chat-pm-open {
    overflow: hidden !important;
}
body.chat-modal-open,
body.chat-pm-open {
    overflow: hidden !important;
    overscroll-behavior: contain;
}
html.chat-modal-open,
html.chat-pm-open,
body.chat-modal-open,
body.chat-pm-open {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
html.chat-modal-open::-webkit-scrollbar,
html.chat-pm-open::-webkit-scrollbar,
body.chat-modal-open::-webkit-scrollbar,
body.chat-pm-open::-webkit-scrollbar {
    display: none;
}
.modal-overlay {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.modal-overlay .modal-card {
    margin: auto;
    overscroll-behavior: contain;
}
.modal-overlay .modal-card .modal-body {
    overscroll-behavior-y: contain;
}
/* ===== Comments & photo comments: keep the write-comment box pinned at the bottom ===== */
#feedCommentsModal .chat-feed-cm-form,
#feedPhotoModal .chat-feed-photo-cm-form {
    position: sticky;
    bottom: 0;
    z-index: 3;
    background: var(--surface);
}
#feedPhotoModal .chat-feed-photo-cm-form {
    padding-top: 8px;
    box-shadow: 0 -6px 14px rgba(0, 0, 0, 0.18);
}

/* ===== FB-app style: comment & photo-comment composer (avatar + rounded input + circular send) ===== */
#feedCommentsModal .chat-feed-cm-form,
#feedPhotoModal .chat-feed-photo-cm-form {
    align-items: flex-end;
    gap: 8px;
    padding: 8px 12px env(safe-area-inset-bottom);
}
#feedCommentsModal .modal-body,
#feedPhotoModal .modal-body {
    padding-bottom: 0;
}
#feedCommentsModal .chat-feed-cm-form-avatar,
#feedPhotoModal .chat-feed-cm-form-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
}
#feedCommentsModal .chat-feed-cm-form textarea,
#feedPhotoModal .chat-feed-photo-cm-form textarea {
    flex: 1;
    min-width: 0;
    padding: 8px 14px;
    border-radius: 20px;
    min-height: 34px;
    max-height: 80px;
    height: 34px;
    overflow-y: hidden;
    resize: none;
    border: 1px solid transparent;
    background: #ffffff;
    color: #222;
    outline: none;
    -webkit-appearance: none;
}
#feedCommentsModal .chat-feed-cm-form textarea:focus,
#feedPhotoModal .chat-feed-photo-cm-form textarea:focus {
    border-color: var(--primary);
    background: #ffffff;
}
#feedCommentsModal .chat-feed-cm-send,
#feedPhotoModal #btnFeedPhotoCmSend {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    flex-shrink: 0;
}
#feedCommentsModal .chat-feed-cm-send i,
#feedPhotoModal #btnFeedPhotoCmSend i {
    font-size: 14px;
    margin: 0;
}

/* ===== FB-app style: bottom-sheet presentation on mobile ===== */
@media (max-width: 767.98px) {
    #feedCommentsModal .chat-feed-cm-modal-card,
    #feedPhotoModal .chat-feed-photo-card {
        border-radius: 18px 18px 0 0;
        animation: feedCmSheetUp 0.24s ease;
    }
}
@keyframes feedCmSheetUp {
    from { transform: translateY(48px); opacity: 0.4; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===== Mobile polish for chat.php ===== */
@media (max-width: 768px) {
    /* Auth: keep centered but vertically scrollable on short screens (e.g. landscape, small phones) */
    .auth-view {
        overflow-y: auto;
    }
    .auth-card {
        margin: auto;
    }

    /* Give the header title/status breathing room on phones */
    .chat-header {
        gap: 8px;
        padding: 10px 12px;
    }
    .chat-header-actions {
        gap: 2px;
    }
}

@media (max-width: 480px) {
    .chat-header-title {
        font-size: 14px;
    }
}

/* ===== Full-screen modals on mobile (chat.php messenger app) ===== */
@media (max-width: 520px) {
    #app .modal-overlay {
        align-items: stretch;
    }
    #app .modal-overlay .modal-card:not(.small-modal-card) {
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
    }
    /* Let content lists fill the full-height card */
    #app #chatNotifModal .chat-notif-list {
        max-height: none;
        flex: 1;
        min-height: 0;
    }
    #app #feedReactionsModal .chat-feed-reactors-list {
        max-height: none;
    }
}

/* =====================================================================
   MESSENGER APP CLONE — PM panel (chat.php)
   Default "Classic" theme now renders as the Messenger app look. The
   other chat themes still override these colors (they carry higher
   specificity). Layout: left Chats list + right conversation on desktop,
   full-screen single view on phones.
   ===================================================================== */

/* ---- Panel shell ---- */
.pm-panel {
    width: min(400px, 100vw);
    background: #ffffff;
    border-left: 1px solid #e4e6eb;
    box-shadow: -10px 0 48px rgba(0, 0, 0, 0.35);
}
.pm-panel .pm-appbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 12px 0 16px;
    background: #ffffff;
    border-bottom: 1px solid #e4e6eb;
}
.pm-panel .pm-appbar-brand {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: #050505;
}
.pm-panel .pm-appbar-brand i { color: #0084ff; font-size: 18px; }
.pm-panel .pm-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}
.pm-panel .pm-inbox {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}
.pm-panel .pm-thread {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #ffffff;
}
.pm-panel .pm-thread-placeholder { display: none; }

/* ---- Inbox (left column) ---- */
.pm-panel .pm-inbox-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 6px;
    background: #ffffff;
    border-bottom: 1px solid #e4e6eb;
}
.pm-panel .pm-tabs {
    flex: 1;
    display: flex;
    gap: 4px;
}
.pm-panel .pm-tab {
    background: transparent;
    border: none;
    padding: 6px 12px;
    font-family: var(--font);
    font-size: 13.5px;
    color: #65676b;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
}
.pm-panel .pm-tab:hover { background: #f0f2f5; color: #050505; }
.pm-panel .pm-tab.active { color: #0084ff; font-weight: 700; }
.pm-panel .pm-new-msg-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: #050505;
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition);
}
.pm-panel .pm-new-msg-btn:hover { background: #f0f2f5; }
.pm-panel .pm-inbox .chat-pm-search {
    margin: 10px 12px;
    background: #f5f6f7;
    border: none;
}
.pm-panel .chat-pm-thread-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0;
}
.pm-panel .chat-pm-thread-item {
    padding: 10px 14px;
    border-radius: 0;
}
.pm-panel .chat-pm-thread-item:hover { background: #f5f6f7; }
.pm-panel .chat-pm-thread-item.has-unread { background: rgba(0, 132, 255, 0.06); }
.pm-panel .chat-pm-thread-item.has-unread:hover { background: rgba(0, 132, 255, 0.1); }
.pm-panel .chat-pm-thread-item.has-unread .chat-pm-thread-name { color: #050505; }
.pm-panel .chat-pm-thread-item.has-unread .chat-pm-thread-snippet { color: #050505; }
.pm-panel .chat-pm-thread-item.has-unread .chat-pm-thread-time { color: #0084ff; font-weight: 600; }
.pm-panel .chat-pm-thread-item.has-unread .chat-pm-thread-unread { background: #0084ff; }
.pm-panel .chat-pm-thread-avatar .chat-pm-avatar { width: 52px; height: 52px; }
.pm-panel .chat-pm-thread-avatar .chatter-avatar-wrap,
.pm-panel .pm-thread-header .chatter-avatar-wrap,
.pm-panel .chat-pm-msg.theirs .chatter-avatar-wrap { width: auto; height: auto; display: inline-flex; position: relative; }
.pm-panel .chatter-avatar-wrap .avatar-frame-overlay { inset: -1px; }
.pm-panel .chat-pm-people-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0;
    background: #ffffff;
    overscroll-behavior: contain;
}
.pm-panel .chat-pm-people-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.pm-panel .chat-pm-people-item:hover { background: #f5f6f7; }
.pm-panel .chat-pm-people-start {
    margin-left: auto;
    color: #0084ff;
    font-size: 16px;
    opacity: 0.75;
    flex-shrink: 0;
}

/* ---- Thread (right column) ---- */
.pm-panel .pm-thread-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: #ffffff;
    border-bottom: 1px solid #e4e6eb;
}
.pm-panel .pm-thread-header .chat-pm-head-avatar {
    display: flex;
    align-items: center;
}
.pm-panel .pm-thread-header .chat-pm-avatar { width: 38px; height: 38px; }
.pm-panel .pm-thread-header .chatter-online-dot {
    border: 2.5px solid #ffffff;
    width: 11px;
    height: 11px;
}
.pm-panel .pm-thread-title {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.pm-panel .pm-thread-name {
    font-size: 15px;
    font-weight: 700;
    color: #050505;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pm-panel .pm-thread-status {
    font-size: 11.5px;
    color: #65676b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pm-panel .pm-thread-status.active { color: #0084ff; font-weight: 600; }

/* ---- Message area (Messenger bubbles) ---- */
.pm-panel .chat-pm-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: #f0f2f5;
    padding: 16px 18px;
    gap: 5px;
}
.pm-panel .chat-pm-msg.theirs .chat-pm-bubble {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: #050505;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}
.pm-panel:not([class*='pm-theme-']) .chat-pm-msg.theirs .chat-pm-bubble {
    background: #0a5477;
    color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom-left-radius: 6px;
    border-radius: 18px;
    padding: 9px 14px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}
.pm-panel .chat-pm-msg.mine .chat-pm-bubble {
    background: linear-gradient(90deg, #0084ff, #00c6ff);
    border: none;
    color: #ffffff;
    box-shadow: 0 2px 5px rgba(0, 132, 255, 0.35);
}
.pm-panel .chat-pm-msg-name { color: #0084ff; }
.pm-panel .chat-pm-reply-quote {
    background: rgba(0, 0, 0, 0.05);
    border-left-color: rgba(0, 132, 255, 0.5);
}
.pm-panel .chat-pm-msg.mine .chat-pm-reply-quote {
    background: rgba(255, 255, 255, 0.2);
    border-left-color: rgba(255, 255, 255, 0.55);
}
.pm-panel .chat-pm-msg.theirs .chat-pm-reply-text { color: #ffffff; }

/* Message clumping: keep the other user's avatar on every message (hide only the
   repeating name row on grouped consecutive messages) */
.pm-panel .chat-pm-msg.grouped { margin-top: -4px; }
.pm-panel .chat-pm-msg.grouped.theirs .chat-pm-msg-name-row { display: none; }
.pm-panel .chat-pm-msg.grouped:not(.group-last) .chat-pm-bubble {
    border-bottom-left-radius: 18px;
}
.pm-panel .chat-pm-msg.mine.grouped:not(.group-last) .chat-pm-bubble {
    border-bottom-right-radius: 18px;
}
.pm-panel .chat-pm-msg.grouped:not(.group-last) .chat-pm-time { display: none; }

/* Date dividers */
.pm-panel .chat-pm-date-divider {
    display: flex;
    justify-content: center;
    margin: 6px 0 2px;
}
.pm-panel .chat-pm-date-divider span {
    background: rgba(0, 0, 0, 0.06);
    color: #65676b;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 999px;
}

/* ---- Composer (Messenger input bar) ---- */
.pm-panel .chat-pm-input-row {
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    gap: 5px;
    padding: 8px 10px;
    background: #ffffff;
    border-top: 1px solid #e4e6eb;
}
.pm-panel .chat-pm-input-wrap .chat-input {
    background: #f5f6f7;
    border: 1px solid #e4e6eb;
    border-radius: 21px;
    padding: 9px 14px;
    color: #050505;
    height: 40px;
    min-height: 40px;
    max-height: 112px;
}
.pm-panel .chat-pm-input-row .send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(90deg, #0084ff, #00c6ff);
    color: #ffffff;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
    margin-left: 2px;
}
.pm-panel .chat-pm-input-row .send-btn:hover { filter: brightness(1.08); }
.pm-panel .chat-pm-input-row .send-btn:disabled { opacity: 0.6; cursor: default; }
.pm-panel .chat-pm-input-row .input-btn {
    flex-shrink: 0;
    color: #65676b;
}
.pm-panel .chat-pm-input-row .input-btn:hover { color: #050505; background: #f0f2f5; }
.pm-panel .pm-smiley-picker { bottom: 100%; margin-bottom: 6px; }

/* ---- Theme appbars (themed panels keep a consistent top bar) ---- */
.pm-panel.pm-theme-im .pm-appbar,
.pm-panel.pm-theme-twitter .pm-appbar { background: #ffffff; border-bottom-color: #e8eaed; }
.pm-panel.pm-theme-im .pm-appbar-brand { color: #202124; }
.pm-panel.pm-theme-twitter .pm-appbar-brand { color: #14171a; }
.pm-panel.pm-theme-im .pm-appbar-brand i { color: #06c755; }
.pm-panel.pm-theme-twitter .pm-appbar-brand i { color: #1da1f2; }
.pm-panel.pm-theme-im .pm-inbox { background: #f6f7f9; }
.pm-panel.pm-theme-twitter .pm-inbox { background: #ffffff; }
.pm-panel.pm-theme-neon .pm-appbar { background: rgba(255, 255, 255, 0.03); border-bottom-color: rgba(34, 211, 238, 0.25); }
.pm-panel.pm-theme-neon .pm-appbar-brand { color: #22d3ee; }
.pm-panel.pm-theme-neon .pm-appbar-brand i { color: #f472b6; }
.pm-panel.pm-theme-neon .pm-inbox-header { background: #0d0d14; border-bottom-color: rgba(34, 211, 238, 0.2); }
.pm-panel.pm-theme-neon .pm-inbox { background: #0a0a0f; }
.pm-panel.pm-theme-neon .pm-tab { color: #67e8f9; }
.pm-panel.pm-theme-neon .pm-tab.active { color: #22d3ee; }
.pm-panel.pm-theme-neon .pm-new-msg-btn { color: #67e8f9; }
.pm-panel.pm-theme-paper .pm-appbar { background: #fbf6ea; border-bottom-color: #e6d9bb; }
.pm-panel.pm-theme-paper .pm-appbar-brand { color: #6b5d3e; }
.pm-panel.pm-theme-paper .pm-appbar-brand i { color: #a8d5a2; }
.pm-panel.pm-theme-paper .pm-inbox-header { background: #fbf6ea; border-bottom-color: #e6d9bb; }
.pm-panel.pm-theme-paper .pm-inbox { background: #f3ead8; }
.pm-panel.pm-theme-paper .pm-tab { color: #9a8b68; }
.pm-panel.pm-theme-paper .pm-tab.active { color: #6b5d3e; }

/* ---- Inbox/themes keep working under other chat themes ---- */

/* Two-pane desktop layout (Messenger desktop) */
@media (min-width: 900px) {
    .pm-panel {
        width: min(980px, calc(100vw - 48px));
    }
    .pm-panel .pm-body { flex-direction: row; }
    .pm-panel .pm-inbox {
        width: 340px;
        flex: 0 0 340px;
        border-right: 1px solid #e4e6eb;
        display: flex !important;
    }
    .pm-panel .pm-thread { flex: 1 1 0px; }
    .pm-panel .pm-thread-placeholder {
        flex: 1 1 0px;
        display: none;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 10px;
        background: #f0f2f5;
        color: #b0b3b8;
        min-height: 0;
    }
    .pm-panel:not(.has-thread) .pm-thread-placeholder { display: flex; }
    .pm-panel .pm-thread-placeholder i { font-size: 46px; color: #0084ff; opacity: 0.3; }
    .pm-panel .pm-thread-placeholder span { font-size: 14px; font-weight: 600; }
}

/* Full-screen single view on phones */
@media (max-width: 899.98px) {
    .pm-panel {
        width: 100vw;
        border-left: none;
        border-right: none;
    }
    .pm-panel .pm-inbox { flex: 1; }
    .pm-panel .pm-thread {
        position: absolute;
        inset: 0;
        z-index: 3;
        display: flex;
    }
    .pm-panel .pm-thread-placeholder { display: none !important; }
}

/* =====================================================================
   DARK THEME — Messenger-clone PM panel, notes strip + note view.
   Applied by default; skipped when the user picks the light theme
   (html.chat-theme-light). Selectable per-conversation chat themes
   (im/paper/twitter/neon) keep their own colors.
   ===================================================================== */
html:not(.chat-theme-light) .pm-panel {
    background: #111118;
    border-left-color: #1f1f2b;
    box-shadow: -10px 0 48px rgba(0, 0, 0, 0.6);
}
html:not(.chat-theme-light) .pm-panel .pm-appbar { background: #111118; border-bottom-color: #22222f; }
html:not(.chat-theme-light) .pm-panel .pm-appbar-brand { color: #e8e8ee; }
html:not(.chat-theme-light) .pm-panel .pm-appbar-brand i { color: #0084ff; }
html:not(.chat-theme-light) .pm-panel .pm-inbox { background: #16161e; }
html:not(.chat-theme-light) .pm-panel .pm-thread { background: #16161e; }
html:not(.chat-theme-light) .pm-panel .pm-inbox-header { background: #16161e; border-bottom-color: #22222f; }
html:not(.chat-theme-light) .pm-panel .pm-tab { color: #a0a0b5; }
html:not(.chat-theme-light) .pm-panel .pm-tab:hover { background: #262636; color: #ffffff; }
html:not(.chat-theme-light) .pm-panel .pm-tab.active { color: #4da3ff; }
html:not(.chat-theme-light) .pm-panel .pm-new-msg-btn { color: #d0d0dd; }
html:not(.chat-theme-light) .pm-panel .pm-new-msg-btn:hover { background: #262636; }
html:not(.chat-theme-light) .pm-panel .pm-inbox .chat-pm-search {
    background: #262636;
    border-color: #30304a;
}
html:not(.chat-theme-light) .pm-panel .chat-pm-search-input,
html:not(.chat-theme-light) .pm-panel .chat-pm-search-input::placeholder { color: #e8e8ee; }
html:not(.chat-theme-light) .pm-panel .chat-pm-search-icon,
html:not(.chat-theme-light) .pm-panel .chat-pm-search-clear { color: #8b8d98; }
html:not(.chat-theme-light) .pm-panel .chat-pm-thread-item:hover { background: #1f1f2b; }
html:not(.chat-theme-light) .pm-panel .chat-pm-thread-item.has-unread { background: rgba(0, 132, 255, 0.14); }
html:not(.chat-theme-light) .pm-panel .chat-pm-thread-item.has-unread:hover { background: rgba(0, 132, 255, 0.22); }
html:not(.chat-theme-light) .pm-panel .chat-pm-thread-item.has-unread .chat-pm-thread-name,
html:not(.chat-theme-light) .pm-panel .chat-pm-thread-item.has-unread .chat-pm-thread-snippet { color: #ffffff; }
html:not(.chat-theme-light) .pm-panel .chat-pm-people-list { background: #16161e; }
html:not(.chat-theme-light) .pm-panel .chat-pm-people-item:hover { background: #1f1f2b; }
html:not(.chat-theme-light) .pm-panel .pm-thread-header { background: #111118; border-bottom-color: #22222f; }
html:not(.chat-theme-light) .pm-panel .pm-thread-header .chatter-online-dot { border-color: #111118; }
html:not(.chat-theme-light) .pm-panel .pm-thread-name { color: #e8e8ee; }
html:not(.chat-theme-light) .pm-panel .pm-thread-status { color: #8b8d98; }
html:not(.chat-theme-light) .pm-panel .pm-thread-status.active { color: #4da3ff; }
html:not(.chat-theme-light) .pm-panel .chat-pm-messages { background: #0f0f16; }
html:not(.chat-theme-light) .pm-panel:not([class*='pm-theme-']) .chat-pm-msg.theirs .chat-pm-bubble {
    background: #1e1e2a;
    border-color: rgba(255, 255, 255, 0.04);
    color: #ffffff;
    box-shadow: none;
}
html:not(.chat-theme-light) .pm-panel .chat-pm-msg-name { color: #4da3ff; }
html:not(.chat-theme-light) .pm-panel .chat-pm-reply-quote { background: rgba(255, 255, 255, 0.06); }
html:not(.chat-theme-light) .pm-panel .chat-pm-msg.mine .chat-pm-reply-quote { background: rgba(255, 255, 255, 0.18); }
html:not(.chat-theme-light) .pm-panel .chat-pm-msg.theirs .chat-pm-reply-text { color: #ffffff; }
html:not(.chat-theme-light) .pm-panel .chat-pm-date-divider span { background: rgba(255, 255, 255, 0.1); color: #a0a0b5; }
html:not(.chat-theme-light) .pm-panel .chat-pm-input-row { background: #111118; border-top-color: #22222f; }
html:not(.chat-theme-light) .pm-panel .chat-pm-input-wrap .chat-input {
    background: #262636;
    border-color: #30304a;
    color: #ffffff;
}
html:not(.chat-theme-light) .pm-panel .chat-pm-input-row .input-btn { color: #a0a0b5; }
html:not(.chat-theme-light) .pm-panel .chat-pm-input-row .input-btn:hover { color: #ffffff; background: #262636; }

/* Notes strip + cards + note view modal */
html:not(.chat-theme-light) .chat-notes { background: #16161e; border-bottom-color: #22222f; }
html:not(.chat-theme-light) .chat-note-body,
html:not(.chat-theme-light) .chat-note-body::after { background: #262636; }
html:not(.chat-theme-light) .chat-note:hover .chat-note-body,
html:not(.chat-theme-light) .chat-note:hover .chat-note-body::after { background: #2e2e3f; }
html:not(.chat-theme-light) .chat-note.mine .chat-note-body,
html:not(.chat-theme-light) .chat-note.mine .chat-note-body::after { background: #1e3a5f; }
html:not(.chat-theme-light) .chat-note.mine:hover .chat-note-body,
html:not(.chat-theme-light) .chat-note.mine:hover .chat-note-body::after { background: #2a4a75; }
html:not(.chat-theme-light) .chat-note-text { color: #e8e8ee; }
html:not(.chat-theme-light) .chat-note-avatar { border-color: #16161e; box-shadow: none; }
html:not(.chat-theme-light) .chat-note-view-bubble { background: #1e1e2a; box-shadow: 0 2px 14px rgba(0, 0, 0, 0.5); }

/* Two-pane desktop borders + placeholder */
@media (min-width: 900px) {
    html:not(.chat-theme-light) .pm-panel .pm-inbox { border-right-color: #22222f; }
    html:not(.chat-theme-light) .pm-panel .pm-thread-placeholder { background: #0f0f16; color: #6b6b80; }
}

/* ===== Live Chat wall video embed (Facebook & YouTube by link) ===== */
.chat-feed .feed-video-embed {
    position: relative;
    margin-left: 44px;
    margin-top: 8px;
    width: calc(100% - 44px);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border);
}
.chat-feed .feed-video-embed .feed-video-play {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    cursor: pointer;
    background: #000;
    font-family: inherit;
    position: relative;
}
.chat-feed .feed-video-embed .feed-video-thumb {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}
.chat-feed .feed-video-embed:hover .feed-video-thumb { opacity: 0.85; }
.chat-feed .feed-video-embed .feed-video-play .fa-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(91, 95, 234, 0.92);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    transition: transform 0.15s ease;
}
.chat-feed .feed-video-embed .feed-video-play:hover .fa-play { transform: translate(-50%, -50%) scale(1.08); }
.chat-feed .feed-video-embed .feed-video-play span {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}
.chat-feed .feed-video-embed iframe {
    display: block;
    width: 100%;
    border: 0;
    background: #000;
}
.chat-feed .feed-video-preview.fb {
    position: relative;
    margin-left: 44px;
    margin-top: 8px;
    width: calc(100% - 44px);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background: linear-gradient(145deg, #2d2f4e, #10142b);
}
.chat-feed .feed-video-preview.fb a.feed-video-open {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 150px;
    text-decoration: none;
}
.chat-feed .feed-video-preview.fb.has-thumb a.feed-video-open { min-height: 0; aspect-ratio: 16 / 10; }
.chat-feed .feed-video-preview.fb .pv-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}
.chat-feed .feed-video-preview.fb .pv-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(91, 95, 234, 0.92);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    transition: transform 0.15s ease;
}
.chat-feed .feed-video-preview.fb:hover .pv-play { transform: translate(-50%, -50%) scale(1.08); }
.chat-feed .feed-video-preview.fb .pv-label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.78);
    padding: 4px 14px;
    border-radius: 20px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 7px;
}
.chat-feed .feed-video-preview.fb .pv-label .fa-facebook { color: #8b9cff; font-size: 0.95rem; }
.chat-feed .feed-video-preview.fb .pv-player {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.chat-feed .feed-video-preview.fb .pv-player video.pv-video {
    display: block;
    width: 100%;
    height: auto;
    max-height: 560px;
    background: #000;
    cursor: pointer;
}
.chat-feed .feed-video-preview.fb .pv-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 26px 12px 9px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0));
    color: #fff;
    font-size: 0.75rem;
    transition: opacity 0.25s ease;
}
.chat-feed .feed-video-preview.fb .pv-player.playing .pv-bar { opacity: 0; }
.chat-feed .feed-video-preview.fb .pv-player.playing:hover .pv-bar,
.chat-feed .feed-video-preview.fb .pv-bar:focus-within { opacity: 1; }
.chat-feed .feed-video-preview.fb .pv-btn {
    flex: none;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}
.chat-feed .feed-video-preview.fb .pv-btn:hover { background: var(--primary); transform: scale(1.06); }
.chat-feed .feed-video-preview.fb .pv-progress { flex: 1 1 auto; min-width: 40px; }
.chat-feed .feed-video-preview.fb .pv-range {
    width: 100%;
    height: 4px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.28);
    outline: none;
    cursor: pointer;
}
.chat-feed .feed-video-preview.fb .pv-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--primary);
    cursor: pointer;
}
.chat-feed .feed-video-preview.fb .pv-range::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--primary);
    cursor: pointer;
}
.chat-feed .feed-video-preview.fb .pv-range:disabled { cursor: default; opacity: 0.5; }
.chat-feed .feed-video-preview.fb .pv-time {
    flex: none;
    min-width: 72px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: #fff;
}
.chat-feed .feed-video-preview.fb .pv-vol { flex: none; width: 58px; }
.chat-feed .feed-video-preview.fb .pv-vol-range {
    width: 100%;
    height: 4px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.28);
    outline: none;
    cursor: pointer;
}
.chat-feed .feed-video-preview.fb .pv-vol-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--primary);
    cursor: pointer;
}
.chat-feed .feed-video-preview.fb .pv-vol-range::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--primary);
    cursor: pointer;
}
.chat-feed .feed-video-preview.fb a.feed-video-open.fallback {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 90px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
}
.chat-feed .feed-video-preview.fb a.feed-video-open.fallback .fa-play-circle { color: var(--primary); font-size: 1.4rem; }

/* Link preview (other websites) inside the wall */
.chat-feed .feed-link-preview {
    display: flex;
    gap: 12px;
    margin-left: 44px;
    margin-top: 8px;
    width: calc(100% - 44px);
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: linear-gradient(145deg, #2d2f4e, #10142b);
    cursor: pointer;
    overflow: hidden;
    text-align: left;
    box-sizing: border-box;
}
.chat-feed .feed-link-preview .feed-link-thumb-wrap { flex: 0 0 116px; }
.chat-feed .feed-link-preview .feed-link-thumb {
    width: 116px;
    height: 88px;
    object-fit: cover;
    border-radius: var(--radius-xs);
    background: #000;
}
.chat-feed .feed-link-preview .feed-link-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding-top: 2px;
}
.chat-feed .feed-link-preview .feed-link-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #eef;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.chat-feed .feed-link-preview .feed-link-desc {
    font-size: 0.76rem;
    color: #a9abc6;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.chat-feed .feed-link-preview .feed-link-domain {
    font-size: 0.7rem;
    color: var(--primary);
    text-transform: lowercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
