/* Mobile app shell layout (Instagram/WeChat-style bottom tabs) */

:root {
  --nav-height: 60px;
  --nav-bg: rgba(18, 18, 18, 0.92);
  --nav-border: rgba(255,255,255,0.08);
  --nav-active: #42a5f5;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.mobile-app-body *,
.mobile-app-body *::before,
.mobile-app-body *::after {
  box-sizing: border-box;
}

.mobile-app-body {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: #0f1115;
  color: #fff;
  min-height: 100dvh;
}

.mobile-app-body { --topbar-clearance: 56px; }

.app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(18,18,18,0.92);
  border-bottom: 1px solid var(--nav-border);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.topbar-left { display:flex; align-items:center; gap:10px; min-width:0; }
.topbar-logo { width: 24px; height: 24px; border-radius: 6px; }
.topbar-title { font-weight: 700; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display:flex; align-items:center; gap: 10px; }
.mobile-chat-toast {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top) + var(--topbar-clearance, 56px) - 8px);
  transform: translate3d(-50%, 0, 0);
  /* Use the same red accent as other danger UI */
  background: linear-gradient(135deg, #ef5350, #e53935);
  color: #fff;
  padding: 7px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.2px;
  box-shadow: 0 14px 32px rgba(229, 57, 53, 0.32);
  opacity: 0;
  pointer-events: none;
  z-index: 60;
  animation: none;
}
.mobile-chat-toast.visible {
  animation: mobileChatToastFloat 2.6s linear forwards;
}
.mobile-chat-toast::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
  /* subtle ring matching red theme */
  box-shadow: 0 0 0 1px rgba(229, 57, 53, 0.35);
  pointer-events: none;
}

@keyframes mobileChatToastFloat {
  0% {
    opacity: 0;
    transform: translate3d(-50%, 96px, 0);
  }
  12% {
    opacity: 1;
    transform: translate3d(-50%, 48px, 0);
  }
  100% {
    opacity: 0;
    transform: translate3d(-50%, -88px, 0);
  }
}
.topbar-lang {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  border-radius: 8px;
  padding: 6px 8px;
  min-width: 86px;
}

.app-content {
  /* Default uses measured topbar clearance; JS updates --topbar-clearance early */
  padding: calc(var(--topbar-clearance) + 4px) 2px calc(var(--nav-height) + 4px) 2px;
}
@supports (padding: max(0px)) {
  /* On iOS (Dynamic Island/notch), ensure initial paint clears the status bar area
     even before JS measurement settles. Use max() to avoid shrinking once JS sets
     an accurate --topbar-clearance. */
  .app-content {
    padding-top: max(
      calc(var(--topbar-clearance) + 4px),
      calc(56px + env(safe-area-inset-top) + 4px)
    );
  }
}

/* Ensure the iOS Add-to-Home-Screen banner clears the fixed header on mobile */
.mobile-app-body #a2hsBanner {
  /* push the banner below the fixed topbar so it doesn’t get overlapped */
  margin-top: calc(var(--topbar-clearance) + 8px) !important;
}
@supports (margin: max(0px)) {
  .mobile-app-body #a2hsBanner {
    margin-top: calc(var(--topbar-clearance) + env(safe-area-inset-top) + 8px) !important;
  }
}

/* When the A2HS banner is visible directly above content, remove the extra top padding
   so the banner and content sit back-to-back without a large gap. */
/* Only trim top padding when the banner is actually visible (not .hidden) */
.mobile-app-body #a2hsBanner:not(.hidden) + .app-content {
  padding-top: 8px !important;
}

/* When we move the section title into the topbar, hide the logo */
body[data-topbar-title="chat"] .topbar-logo,
body[data-topbar-title="friends"] .topbar-logo,
body[data-topbar-title="groups"] .topbar-logo,
body[data-topbar-title="notifications"] .topbar-logo,
body[data-topbar-title="settings"] .topbar-logo {
  display: none !important;
}

/* Hide original in-page titles when topbar hosts them */
body[data-topbar-title="chat"] #tab-chat #chatListView .conversation-management h4 { display: none !important; }
body[data-topbar-title="friends"] #tab-friends #friendsListView .friends-list-header h4 { display: none !important; }
body[data-topbar-title="groups"] #tab-groups #groupsListView .friends-list-header h4 { display: none !important; }
body[data-topbar-title="notifications"] #tab-notifications .notifications-header h4 { display: none !important; }

/* Ensure topbar stays visible when scrolling inside main content areas */
/* topbar position is fixed globally; no sticky override here */

@supports (padding: max(0px)) {
  .app-topbar {
    padding-top: calc(10px + env(safe-area-inset-top));
  }
}

/* Center the entire app frame by viewport width on all screens */
.app-topbar { width: 100%; margin-left: 0; margin-right: 0; }
.app-content { width: 100%; max-width: none; margin-left: 0; margin-right: 0; }
.bottom-nav { left: 0; right: 0; transform: none; border-radius: 0; }

.screen { display: none; }
.screen.active { display: block; }

/* Ensure content clears the fixed topbar on mobile for key sections */
.mobile-app-body #tab-groups > .container,
.mobile-app-body #tab-settings > .container {
  /* Use one-third of the previous offset to avoid excessive spacing */
  padding-top: calc((var(--topbar-clearance) + 8px) / 3) !important;
}
@supports (padding: max(0px)) {
  .mobile-app-body #tab-groups > .container,
  .mobile-app-body #tab-settings > .container {
    padding-top: calc((var(--topbar-clearance) + env(safe-area-inset-top) + 8px) / 3) !important;
  }
}

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--nav-height);
  background: transparent; /* background moved to nav-inner for centering */
  border-top: none;
  display: block;
  z-index: 20;
}

.bottom-nav .nav-inner {
  width: 100%;
  height: var(--nav-height);
  margin: 0;
  background: var(--nav-bg);
  border-top: 1px solid var(--nav-border);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 12px 12px 0 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
}

.bottom-nav .nav-item {
  appearance: none; border: none; outline: none;
  background: transparent; color: #e6e6e6; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; font-size: 12px;
  position: relative;
}
.bottom-nav .nav-item .nav-icon { font-size: 20px; line-height: 1; }
.bottom-nav .nav-item.active { color: var(--nav-active); }

.bottom-nav .nav-item.has-badge[data-count]:not([data-count=""])::after,
.bottom-nav .nav-item[data-count]:not([data-count=""])::after {
  content: attr(data-count);
  position: absolute;
  top: 4px;
  right: 14px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(17,24,39,0.6);
}

/* Tighten common containers for mobile */
.container { padding: 2px; border-radius: 12px; background: transparent; }
.conversation-list { padding: 2px; border-radius: 12px; }

/* Chat conversations history list should expand with page; not scroll itself */
#conversationsList { max-height: none !important; overflow: visible !important; }
.conversations-list { overflow: visible !important; }

/* Ensure input rows above keyboard have room */
/* Posts: composer UX tweaks */
.post-input-wrap { position: relative; }
#postComposer { font-size: 16px; line-height: 1.4; text-align: left; padding-bottom: 28px !important; }
.post-word-counter { position: absolute; right: 12px; bottom: 10px; font-size: 12px; opacity: .8; color: #fff; pointer-events: none; }

/* Ensure input rows above keyboard have room */
@supports (padding: max(0px)) {
  .mobile-app-body { padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav { padding-bottom: env(safe-area-inset-bottom); height: calc(var(--nav-height) + env(safe-area-inset-bottom)); }
  .bottom-nav .nav-inner { height: var(--nav-height); }
  .app-content { padding-bottom: calc(var(--nav-height) + 4px + env(safe-area-inset-bottom)); }
}

/* Mobile mascot (Me page only) */
.mobile-app-body #mascotBuddyWrap {
  position: fixed;
  right: 12px;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 10px);
  width: clamp(120px, 28vw, 180px);
  max-width: 42vw;
  z-index: 19; /* below bottom nav (20), above content */
  pointer-events: auto;
}

.mobile-app-body #mascotBuddyWrap svg#mascotBuddy,
.mobile-app-body #mascotBuddyWrap img#mascotBuddy {
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mobile-app-body #mascotBuddyWrap #mascotEnergy {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 8px);
  width: clamp(110px, 34vw, 150px);
  height: 8px;
  background: rgba(255,255,255,0.16);
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.38);
  overflow: hidden;
  pointer-events: auto;
}

.mobile-app-body #mascotBuddyWrap #mascotEnergy .bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #f97316, #ef4444);
  transition: width .32s ease, background .3s ease;
}

.mobile-app-body #mascotBuddyWrap.mascot-low #mascotBuddy {
  animation: mascotStarve 2.6s ease-in-out infinite;
}

.mobile-app-body #mascotBuddyWrap .mascot-bubble {
  position: absolute;
  right: 4px;
  bottom: calc(100% + 44px);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  text-shadow: 0 2px 6px rgba(15,23,42,0.55);
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px) scale(.9);
  animation: mascotBubble 1.25s ease-out forwards;
}

@keyframes mascotBubble {
  0% { opacity: 0; transform: translateY(10px) scale(.9); }
  15% { opacity: 1; transform: translateY(0) scale(1); }
  85% { opacity: 1; transform: translateY(-22px) scale(1.02); }
  100% { opacity: 0; transform: translateY(-34px) scale(1.02); }
}

@keyframes mascotStarve {
  0% { transform: translateY(0) scale(1); filter: drop-shadow(0 8px 18px rgba(0,0,0,.35)); }
  50% { transform: translateY(2px) scale(.995); filter: drop-shadow(0 6px 14px rgba(0,0,0,.3)); }
  100% { transform: translateY(0) scale(1); filter: drop-shadow(0 8px 18px rgba(0,0,0,.35)); }
}

.mobile-app-body #mascotBuddyWrap #mascotCoinTooltip {
  position: absolute;
  bottom: calc(100% + 70px);
  left: 50%;
  transform: translate(-50%, 12px);
  background: rgba(15, 23, 42, 0.93);
  border: 1px solid rgba(99, 102, 241, 0.45);
  border-radius: 12px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #f8fafc;
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 12px 28px rgba(15,23,42,0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 3;
}

.mobile-app-body #mascotBuddyWrap #mascotCoinTooltip .coin-icon { font-size: 18px; }
.mobile-app-body #mascotBuddyWrap #mascotCoinTooltip .coin-label { font-size: 12px; letter-spacing: 0.4px; opacity: 0.85; }

.mobile-app-body #mascotBuddyWrap #mascotCoinTooltip.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.mobile-app-body #mascotBuddyWrap .mascot-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 148px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.45);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 2;
}

.mobile-app-body #mascotBuddyWrap .mascot-menu.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.mobile-app-body #mascotBuddyWrap .mascot-menu-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #f8fafc;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
}

.mobile-app-body #mascotBuddyWrap .mascot-menu-item:focus,
.mobile-app-body #mascotBuddyWrap .mascot-menu-item:hover {
  background: rgba(79, 70, 229, 0.22);
  outline: none;
}


/* Keep emoji button on the left in Friends chat on small screens */
.mobile-app-body #friendsChatView .dm-input-row {
  flex-wrap: nowrap !important; /* default: single row (matches Groups behavior) */
}
.mobile-app-body #friendsChatView #dmEmojiBtn {
  order: 0 !important; /* ensure emoji appears before input */
  flex: 0 0 auto;
}
.mobile-app-body #friendsChatView .dm-input-wrap {
  order: 1 !important;
  flex: 1 1 auto;
  min-width: 0;
  width: auto !important; /* override desktop 100% width so emoji + input can share a row */
}
.mobile-app-body #friendsChatView #dmSendBtn { order: 2 !important; flex: 0 0 auto; }
.mobile-app-body #friendsChatView .dm-actions { order: 3 !important; flex: 0 0 auto; }

/* On narrow screens, wrap and push Friends actions to second row (right) */
@media (max-width: 480px) {
  .mobile-app-body #friendsChatView .dm-input-row { flex-wrap: wrap !important; }
  .mobile-app-body #friendsChatView .dm-actions {
    flex-basis: 100% !important;
    justify-content: flex-end !important;
  }
}

/* Groups: default single row; keep send next to input; wrap actions row on small screens */
.mobile-app-body #groupsChatView .dm-input-row { flex-wrap: nowrap !important; }
.mobile-app-body #groupsChatView #groupEmojiBtn { order: 0 !important; flex: 0 0 auto; }
.mobile-app-body #groupsChatView .dm-input-wrap { order: 1 !important; flex: 1 1 auto; min-width: 0; width: auto !important; }
.mobile-app-body #groupsChatView #groupSendBtn { order: 2 !important; }
.mobile-app-body #groupsChatView .dm-actions { order: 3 !important; flex: 0 0 auto; }
@media (max-width: 480px) {
  .mobile-app-body #groupsChatView .dm-input-row { flex-wrap: wrap !important; }
  .mobile-app-body #groupsChatView .dm-actions { flex-basis: 100% !important; justify-content: flex-end !important; }
}

/* Ultra-tight gutters when in the mobile shell */
.mobile-app-body .container,
.mobile-app-body .conversation-list,
.mobile-app-body .conversations-list {
  padding: 6px 0 !important;
}

/* Prevent group list flash: disable list-item fade/transition on mobile */
.mobile-app-body #groupsListView .conversation-item,
.mobile-app-body #groupsList .conversation-item,
.mobile-app-body #tab-groups .conversation-item,
.mobile-app-body #tab-posts .conversation-item {
  animation: none !important;
  transition: none !important;
}
.mobile-app-body #groupsList .group-item-row,
.mobile-app-body #groupsListView .group-item-row {
  transition: none !important;
}

/* Apply the same no-fade rule to Friends list on mobile */
.mobile-app-body #friendsListView .conversation-item,
.mobile-app-body #friendsList .conversation-item,
.mobile-app-body #tab-friends .conversation-item {
  animation: none !important;
  transition: none !important;
}

/* Me page: prevent bumpy flash on posts rebuild */
.mobile-app-body #meProfilePosts.rendering .post-card {
  animation: none !important;
  transition: none !important;
}
.mobile-app-body #meProfilePosts.rendering {
  will-change: contents;
}

.mobile-app-body #postsWrapper,
.mobile-app-body #conversationList,
.mobile-app-body #friendsList,
.mobile-app-body #chatConvView .conversation-list,
.mobile-app-body #friendsListView .conversation-list {
  padding: 6px 0 !important;
}

.notify-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pending-empty {
  padding:12px;
  text-align:center;
  opacity:0.75;
  font-size:0.9rem;
}

.notify-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.notify-card.unread {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(37, 99, 235, 0.18);
}

.notify-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.notify-card .notify-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255,255,255,0.12);
}

.notify-card .notify-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.notify-card-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notify-card .notify-actor {
  background: none;
  border: none;
  color: #e0f2fe;
  font-weight: 700;
  font-size: 14px;
  padding: 0;
  text-align: left;
}

.notify-card .notify-context {
  font-size: 13px;
  opacity: 0.85;
}

.notify-card-body {
  font-size: 13.5px;
  line-height: 1.45;
  opacity: 0.92;
}

.notify-card-meta {
  display: flex;
  gap: 6px;
  font-size: 11px;
  opacity: 0.7;
  align-items: center;
}

.notify-card .notify-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}
.notify-card .notify-action {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.notify-card .notify-action.approve { background:#22c55e; color:#0b1b0f; }
.notify-card .notify-action.reject { background:#ef4444; color:#290808; }

.notify-card-meta .notify-icon { font-size: 12px; }

.notify-footer {
  display: flex;
  justify-content: center;
  padding: 12px 0 20px;
}

.notify-footer .control-button[disabled] {
  opacity: 0.6;
  pointer-events: none;
}

.mobile-app-body .post-card,
.mobile-app-body .conversation-item,
.mobile-app-body .dm-message,
.mobile-app-body .friends-list .conversation-item,
.mobile-app-body .conversation-area {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.mobile-app-body .game-share-card {
  margin: 12px 0;
  padding: 12px;
  border-radius: 14px;
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid rgba(59, 130, 246, 0.24);
}
.mobile-app-body .game-share-card .game-share-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  margin-bottom: 6px;
}
.mobile-app-body .game-share-card .game-share-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 6px;
}
.mobile-app-body .game-share-card .game-share-stats strong {
  font-weight: 800;
}
.mobile-app-body .game-share-card .game-share-langs {
  font-size: 12px;
  opacity: 0.8;
  margin-bottom: 10px;
}
.mobile-app-body .game-share-card .game-share-actions {
  display: flex;
  gap: 8px;
}

.mobile-app-body .conversation-item { margin: 8px 0 !important; }
.mobile-app-body #dmMessages .conversation-item:first-of-type { margin-top: 0 !important; }
.mobile-app-body #dmMessages .conversation-item:last-of-type { margin-bottom: 0 !important; }

.mobile-app-body .conversation-management {
  margin: 10px 0 !important;
  padding: 8px 6px !important;
}

.mobile-app-body .conversation-area {
  margin-top: 12px !important;
}

/* Voice custom panel toggle */
.voice-custom-panel {
  margin-top: 18px;
  background: rgba(15, 23, 42, 0.18);
  border-radius: 12px;
  padding: 12px;
}

.voice-custom-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.voice-quota {
  font-size: 12px;
  color: rgba(226, 232, 240, 0.8);
}

.voice-profiles-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin: 4px 0 10px;
  background: rgba(30, 41, 59, 0.35);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 10px;
  color: rgba(226, 232, 240, 0.9);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.voice-profiles-toggle:hover,
.voice-profiles-toggle:focus,
.voice-profiles-toggle.expanded {
  border-color: rgba(248, 113, 113, 0.6);
  background: rgba(30, 41, 59, 0.5);
  color: rgba(248, 250, 252, 0.95);
  outline: none;
}

.voice-profiles-toggle:focus-visible {
  outline: 2px solid rgba(248, 113, 113, 0.8);
  outline-offset: 2px;
}

.voice-toggle-count {
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.35);
  color: rgba(226, 232, 240, 0.9);
  font-size: 12px;
  text-align: center;
}

.voice-toggle-icon {
  font-size: 16px;
  line-height: 1;
}

.voice-profiles {
  display: grid;
  gap: 10px;
}

.voice-profiles.collapsed {
  display: none;
}

.mobile-app-body .friends-columns {
  gap: 8px !important;
}

.mobile-app-body .post-card {
  width: 100%;
  box-sizing: border-box;
}

/* Hide desktop-only header/tabs if ever present in fragments */
.header-bar, .tabs { display: none !important; }

/* Keep badges minimal */
.features-badge { margin-top: 6px; font-size: 12px; }

/* Topbar Me button */
.topbar-me {
  appearance: none; border: none; background: transparent;
  padding: 0; margin: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.topbar-me:focus-visible {
  outline: 2px solid rgba(148,163,255,0.85);
  outline-offset: 2px;
}
.topbar-me-avatar-wrap {
  width: 32px; height: 32px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.24);
  transition: background 0.2s ease, border 0.2s ease;
}
.topbar-me-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.topbar-me-avatar-initial {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #fff;
}
.topbar-me-avatar-wrap.topbar-avatar-fallback {
  border: none;
}
.topbar-me-avatar-wrap.topbar-avatar-fallback .topbar-me-avatar-initial {
  display: flex;
}

/* Hide Posts "Scrollable" toggle in mobile app */
#postsTopRight { display: none !important; }

/* Friends DM panel compact */
.friends-panel .friends-columns { gap: 12px !important; }
.dm-input-row { gap: 8px !important; }

/* WeChat-style friend views */
.friends-view { display: none; }
.friends-view.active {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Avoid iOS auto-zoom when focusing chat textareas */
#groupInput,
#dmInput {
  font-size: 16px; /* >=16px prevents focus zoom on iOS */
  line-height: 1.35;
}

#tab-friends .container {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--nav-height) - 54px);
  padding: 12px 10px 16px;
}

#friendsListView { flex: 0 0 auto; }
#friendsOutgoingView,
#friendsIncomingView {
  flex: 1;
}

/* Chat views (list ↔ conversation) */
.chat-view { display: none; }
.chat-view.active { display: block; }

body.chat-conv-open .app-topbar,
body.chat-conv-open #bottomNav { display:none !important; }
body.chat-conv-open .app-content { padding:0 !important; }
body.chat-conv-open #tab-chat .container { margin-bottom:0 !important; padding:0 !important; }
body.chat-conv-open #chatConvView,
body.chat-conv-open #chatControlView {
  position:fixed;
  inset:0;
  z-index:40;
  display:none;
  flex-direction:column;
  background:#0f1115;
  height:100dvh;
  min-height:0;
}
body.chat-conv-open #chatConvView.active,
body.chat-conv-open #chatControlView.active {
  display:flex;
}
@supports (padding: max(0px)) {
  body.chat-conv-open #chatConvView,
  body.chat-conv-open #chatControlView {
    padding-top:env(safe-area-inset-top);
    padding-bottom:env(safe-area-inset-bottom);
  }
}

.chat-conv-shell {
  flex:1 1 auto;
  min-height:0;
  display:flex;
  flex-direction:column;
  gap:0;
}

.chat-conv-topbar {
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 14px;
  background:rgba(15,17,21,0.9);
  border-bottom:1px solid rgba(255,255,255,0.08);
  position:sticky;
  top:0;
  z-index:5;
  backdrop-filter:blur(12px);
}

.chat-status-pill {
  flex:0 1 48vw;
  min-width:0;
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 12px;
  border-radius:999px;
  font-size:13px;
  line-height:1.2;
  background:rgba(148,163,184,0.18);
  border:1px solid rgba(148,163,184,0.28);
  color:#e2e8f0;
  max-width:48vw;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.chat-status-pill.monitoring { background: rgba(243,156,18,0.2); border-color: rgba(243,156,18,0.45); color:#fbbf24; }
.chat-status-pill.recording { background: rgba(220,38,38,0.22); border-color: rgba(248,113,113,0.45); color:#fca5a5; }
.chat-status-pill.processing { background: rgba(59,130,246,0.18); border-color: rgba(96,165,250,0.4); color:#93c5fd; }
.chat-status-pill.playing { background: rgba(16,185,129,0.2); border-color: rgba(52,211,153,0.45); color:#6ee7b7; }
.chat-status-pill.stopped { background: rgba(148,163,184,0.18); border-color: rgba(148,163,184,0.28); color:#e2e8f0; }

.chat-conv-topbar.has-status {
  display:grid;
  grid-template-columns:auto minmax(0, 1fr) auto;
  align-items:center;
  gap:12px;
}
.chat-conv-topbar.has-status .chat-status-pill {
  justify-self:center;
  max-width:100%;
}
.chat-conv-topbar.has-status .chat-topbar-spacer { display:none; }

@media (max-width:540px) {
  .chat-conv-topbar.has-status {
    gap:8px;
  }
  .chat-conv-topbar.has-status .chat-status-pill {
    justify-content:center;
  }
}

.chat-nav-btn {
  appearance:none;
  border:none;
  background:transparent;
  color:#fff;
  font-size:16px;
  font-weight:600;
  cursor:pointer;
  display:flex;
  align-items:center;
  gap:4px;
  padding:6px 8px;
}

.chat-back-icon {
  font-size:18px;
  line-height:1;
}

.chat-back-label {
  display:inline-flex;
  align-items:center;
  gap:4px;
  font-weight:600;
}

.chat-back-emoji {
  font-size:16px;
  line-height:1;
}

.chat-nav-icon {
  appearance:none;
  border:none;
  background:rgba(255,255,255,0.08);
  color:#fff;
  font-size:18px;
  line-height:1;
  cursor:pointer;
  padding:6px 10px;
  border-radius:999px;
}

.chat-topbar-title {
  flex:1 1 auto;
  text-align:center;
  font-weight:600;
  font-size:16px;
  color:#fff;
}

.chat-topbar-spacer { flex:1 1 auto; }

.chat-conv-body {
  flex:1 1 auto;
  min-height:0;
  padding:12px 12px 0;
  display:flex;
  flex-direction:column;
  gap:0;
  overflow:hidden;
  position:relative;
}

.chat-conv-body > .conversation-list {
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  padding:6px 0 96px !important;
}

/* Neutralize desktop defaults that add large gaps in mobile chat */
.mobile-app-body #chatConvView .conversation-list,
.mobile-app-body #conversationList.conversation-list {
  min-height: 0 !important;
  max-height: none !important;
  background: transparent !important;
  border: none !important;
}

/* Trim bottom spacing on the final bubble */
.mobile-app-body #conversationList .conversation-item:last-of-type {
  margin-bottom: 0 !important;
}

.chat-conv-title {
  font-size:18px;
  font-weight:700;
  padding:0 4px;
}

.chat-conv-footer {
  position:sticky;
  bottom:0;
  padding:12px 14px calc(16px + env(safe-area-inset-bottom, 0));
  background:rgba(15,17,21,0.92);
  border-top:1px solid rgba(255,255,255,0.08);
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:10px;
  backdrop-filter:blur(12px);
}

.chat-footer-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:nowrap;
}

.chat-timer-wrap {
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  min-width:88px;
}

.chat-timer {
  font-size:1.8rem;
  font-weight:700;
  color:#ff6b6b;
  font-family:'Inter','Segoe UI',system-ui,sans-serif;
  line-height:1;
}

.chat-timer.monitoring { color:#fbbf24; }
.chat-timer.recording { color:#f87171; }
.chat-timer.processing { color:#93c5fd; }
.chat-timer.playing { color:#6ee7b7; }
.chat-timer.stopped { color:#ff6b6b; }

.chat-footer-row .start-button {
  flex:1 1 auto;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:16px;
  padding:10px 16px;
}

.chat-footer-row .stop-button {
  flex:0 0 auto;
  min-width:120px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:15px;
  padding:10px 16px;
}

.chat-mini-waveform {
  display:none;
  position:absolute;
  left:12px;
  right:12px;
  bottom:12px;
  height:58px;
  background:rgba(15,23,42,0.85);
  border:1px solid rgba(148,163,184,0.25);
  border-radius:12px;
  padding:8px;
  align-items:flex-end;
  justify-content:center;
  overflow:hidden;
  pointer-events:none;
}

.chat-mini-waveform.waveform-active {
  display:flex;
}

.chat-mini-waveform .waveform-bar {
  transform-origin: bottom center;
  transform: scaleY(0.6);
}

@media (max-width:480px) {
  .chat-footer-row {
    flex-wrap:wrap;
  }
  .chat-footer-row {
    gap:8px;
  }
}

.chat-footer-row .start-button,
.chat-footer-row .stop-button {
  flex:1 1 0;
  min-width:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.chat-control-body {
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  padding:16px 16px 24px;
  display:flex;
  flex-direction:column;
  gap:16px;
}

.chat-control-buttons {
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.chat-control-buttons .main-button {
  flex:1 1 100%;
}

.chat-control-buttons .control-button {
  flex:1 1 calc(50% - 10px);
  min-width:140px;
}

.chat-control-body .status {
  margin-top:4px;
}

.chat-control-body .waveform {
  min-height:160px;
  border-radius:16px;
  padding:12px;
  background:rgba(255,255,255,0.04);
}

.chat-control-body .waveform > div {
  width:100%;
}

.mobile-app-body .chat-control-body .enh-row,
.mobile-app-body .posts-appearance-modal .enh-row {
  flex-direction:column;
  gap:14px;
}

.mobile-app-body .chat-control-body .enh-col,
.mobile-app-body .posts-appearance-modal .enh-col {
  flex:1 1 100%;
}

.mobile-app-body .chat-control-body .enh-inline,
.mobile-app-body .posts-appearance-modal .enh-inline,
.mobile-app-body #dmPalettePanel .enh-inline,
.mobile-app-body #groupPalettePanel .enh-inline {
  flex-wrap:wrap;
  align-items:flex-start;
  gap:10px;
}

.mobile-app-body .chat-control-body .enh-inline input[type="color"],
.mobile-app-body .posts-appearance-modal .enh-inline input[type="color"],
.mobile-app-body #dmPalettePanel .enh-inline input[type="color"],
.mobile-app-body #groupPalettePanel .enh-inline input[type="color"] {
  flex:0 0 52px;
  width:52px;
  height:52px;
  border-radius:10px;
}

.mobile-app-body .chat-control-body .enh-inline .enh-opacity,
.mobile-app-body .posts-appearance-modal .enh-inline .enh-opacity,
.mobile-app-body #dmPalettePanel .enh-inline .enh-opacity,
.mobile-app-body #groupPalettePanel .enh-inline .enh-opacity {
  flex:1 1 100%;
  display:flex;
  align-items:center;
  gap:8px;
}

.mobile-app-body .chat-control-body .enh-inline .enh-opacity input[type="range"],
.mobile-app-body .posts-appearance-modal .enh-inline .enh-opacity input[type="range"],
.mobile-app-body #dmPalettePanel .enh-inline .enh-opacity input[type="range"],
.mobile-app-body #groupPalettePanel .enh-inline .enh-opacity input[type="range"] {
  flex:1 1 auto;
  min-width:0;
}

.mobile-app-body .chat-control-body .enh-inline .enh-opacity span,
.mobile-app-body .posts-appearance-modal .enh-inline .enh-opacity span,
.mobile-app-body #dmPalettePanel .enh-inline .enh-opacity span,
.mobile-app-body #groupPalettePanel .enh-inline .enh-opacity span {
  white-space:nowrap;
}

.dm-edit-banner,
.group-edit-banner {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  background:rgba(59,130,246,0.18);
  border:1px solid rgba(59,130,246,0.35);
  border-radius:12px;
  padding:8px 12px;
  margin-bottom:8px;
  font-size:13px;
  color:#fff;
}

.dm-edit-banner .edit-cancel-btn,
.group-edit-banner .edit-cancel-btn {
  appearance:none;
  border:none;
  border-radius:10px;
  padding:4px 12px;
  background:rgba(59,130,246,0.35);
  color:#fff;
  font-size:13px;
  cursor:pointer;
  transition:background 0.15s ease;
}

.dm-edit-banner .edit-cancel-btn:hover,
.group-edit-banner .edit-cancel-btn:hover {
  background:rgba(59,130,246,0.55);
}

.dm-actions-column .message-more-btn {
  appearance:none;
  border:1px solid rgba(255,255,255,0.18);
  background:rgba(255,255,255,0.06);
  color:#fff;
  border-radius:999px;
  width:30px;
  height:30px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:16px;
  cursor:pointer;
  transition:background 0.15s ease;
}

.dm-actions-column .message-more-btn:hover {
  background:rgba(255,255,255,0.16);
}

.message-action-overlay {
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  background:rgba(10,12,18,0.6);
  backdrop-filter:blur(2px);
  z-index:1200;
}

.message-action-overlay.active {
  display:flex;
}

.message-action-sheet {
  display:none;
  background:rgba(13,19,32,0.95);
  border:1px solid rgba(148,163,184,0.25);
  border-radius:16px;
  min-width:220px;
  max-width:90vw;
  padding:10px;
  box-shadow:0 24px 40px rgba(0,0,0,0.45);
}

.message-action-sheet.active {
  display:flex;
  flex-direction:column;
  gap:8px;
}

.message-action-sheet.mobile {
  align-self:flex-end;
  margin:0 14px 20px;
  width:calc(100% - 28px);
}

.message-action-sheet.desktop {
  position:fixed;
}

.message-action-btn {
  appearance:none;
  border:none;
  border-radius:12px;
  padding:10px 14px;
  background:rgba(255,255,255,0.08);
  color:#fff;
  text-align:left;
  font-size:15px;
  cursor:pointer;
  transition:background 0.15s ease;
}

.message-action-btn:hover {
  background:rgba(255,255,255,0.18);
}

.message-action-btn.destructive {
  color:#f87171;
}

.message-action-btn.destructive:hover {
  background:rgba(248,113,113,0.18);
}

.chat-control-body .status,
.chat-control-body #vadStatus,
.chat-control-body [data-waveform-variant="full"] {
  display:none !important;
}

.conversation-settings-inline {
  margin-top:8px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.conversation-settings-inline label {
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.conversation-settings-inline .range-inline {
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.conversation-settings-inline .value-display {
  font-weight:600;
}

.conversation-item-list {
  display: flex;
  align-items: center;
  gap: 10px;
}

.conversation-item-list .conversation-info {
  flex: 1 1 75%;
  min-width: 0;
}

.conversation-item-list .conversation-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-item-list .conversation-meta {
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-item-list .conv-actions {
  flex: 0 0 auto;
}

@media (max-width: 520px) {
  .conversation-item-list {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .conversation-item-list .conversation-info {
    flex: 1 1 100%;
  }
  .conversation-item-list .conv-actions {
    flex: 0 0 100%;
    margin-left: 0;
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
  }
  .conversation-item-list .conv-actions button {
    flex: 0 0 auto;
  }
}

.chat-conv-header { display:flex; align-items:center; gap:8px; padding: 6px 6px 8px 6px; border-bottom: 1px solid var(--nav-border); }
.chat-conv-header .back-btn { appearance:none;border:none;background:transparent;color:#fff;font-size:18px; cursor:pointer; padding:6px 8px; }
.friends-chat-header { display:flex; align-items:center; justify-content: space-between; gap:12px; padding: 8px 4px; border-bottom: 1px solid var(--nav-border); }
.friends-chat-header.group-chat-header { flex-direction: column; align-items: stretch; gap: 6px; }
.friends-chat-header.group-chat-header { padding: 4px 4px; }
.group-header-name-row { display:none; }
.group-header-main-row { display:flex; align-items:center; justify-content: space-between; gap: 8px; }
.group-header-main-row .group-head-mobile { flex: 1 1 auto; min-width: 0; }
.group-header-main-row .group-chat-actions { flex: 0 0 auto; }
.friends-chat-header .back-btn { appearance:none;border:none;background:transparent;color:#fff;font-size:18px; cursor:pointer; padding:6px 8px; }
.friends-chat-header .friend-head { display:flex; align-items:center; gap:10px; }
.friends-chat-header .friend-avatar { width:32px; height:32px; border-radius:50%; object-fit:cover; }
.friends-chat-header .friend-avatar-wrap { width:32px; height:32px; border-radius:50%; overflow:hidden; display:flex; align-items:center; justify-content:center; text-decoration:none; position:relative; flex-shrink:0; }
.friends-chat-header .friend-avatar-wrap img.friend-avatar { width:100%; height:100%; object-fit:cover; display:block; border-radius:inherit; }
.friends-chat-header .friend-avatar-initial { position:absolute; inset:0; display:none; align-items:center; justify-content:center; font-weight:700; color:#fff; font-size:16px; }
.friends-chat-header .friend-avatar-wrap.fallback img.friend-avatar { display:none; }
.friends-chat-header .friend-avatar-wrap.fallback .friend-avatar-initial { display:flex; }
.friends-chat-header .group-head-mobile {
  flex:1 1 auto;
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}
.friends-chat-header .group-head-mobile .friend-meta {
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
  align-items:center;
  text-align:center;
}
.friends-chat-header .group-head-mobile .group-avatar-button {
  background:none;
  border:none;
  padding:0;
  display:flex;
  align-items:center;
  justify-content:center;
}
.friends-chat-header .group-head-mobile .group-avatar {
  width:40px;
  height:40px;
  border-radius:12px;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(255,255,255,0.12);
}
.friends-chat-header .group-head-mobile .group-avatar img {
  width:100%;
  height:100%;
  object-fit:cover;
}
.group-title-row {
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  width:100%;
}
.group-chat-actions {
  display:flex;
  align-items:center;
  gap:8px;
  flex-shrink:0;
}
.group-chat-actions .translate-dropdown { position: relative; }
.group-chat-actions #groupTranslateMenu.dropdown {
  position: absolute;
  right: 0;
  top: 120%;
  z-index: 30;
  background: rgba(15,23,42,0.96);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 6px;
  min-width: 170px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
.group-chat-actions #groupTranslateMenu .dropdown-item {
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.group-chat-actions #groupTranslateMenu .dropdown-item:hover { background: rgba(255,255,255,0.06); }
.friends-chat-header .friend-name { font-weight:700; font-size:16px; }
.friends-chat-header .friend-presence { font-size:12px; opacity:.8; }
.group-avatar-button {
  background:none;
  border:none;
  padding:0;
  display:flex;
  align-items:center;
  justify-content:center;
}
.group-avatar-button:focus-visible {
  outline:2px solid rgba(148,163,255,0.85);
  outline-offset:2px;
}

.friends-list-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.friends-add-bar {
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:nowrap;
  padding:10px;
  border-radius:12px;
  background:rgba(15,23,42,0.32);
  border:1px solid rgba(255,255,255,0.08);
  margin-bottom:14px;
}
.friends-add-bar input {
  flex:1;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.18);
  background:rgba(17,24,39,0.55);
  color:#fff;
  font-size:15px;
}
.friends-add-bar input::placeholder { color:rgba(255,255,255,0.55); }
.control-button.icon-only { width:42px; justify-content:center; padding:10px; }
.control-button.primary {
  background: linear-gradient(135deg, rgba(96,165,250,0.92), rgba(59,130,246,0.92));
  border-color: rgba(96,165,250,0.7);
  color: #fff;
}
.control-button.primary:hover,
.control-button.primary:focus-visible {
  border-color: rgba(147,197,253,0.9);
}

.friends-request-shortcuts { display:flex; gap:10px; margin-bottom:14px; }
.friends-request-btn {
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:12px;
  border-radius:12px;
  background:rgba(30,41,59,0.52);
  border:1px solid rgba(148,163,184,0.25);
  color:#f8fafc;
  font-weight:600;
}
.friends-request-btn .icon { font-size:18px; }
.friends-request-btn:active,
.friends-request-btn:focus-visible {
  border-color:rgba(96,165,250,0.65);
  outline:none;
}
.badge-alert {
  background:#ef4444;
  color:#fff;
  border-radius:999px;
  padding:2px 8px;
  font-size:12px;
  font-weight:700;
}

.friends-list-full,
.friends-requests-list {
  flex:1;
  overflow-y:auto;
  padding:4px 0 12px;
  display:flex;
  flex-direction:column;
  gap:4px;
}

#friendsListView .friends-list-full,
#groupsListView #groupsList {
  flex:0 0 auto;
  max-height:none;
  overflow:visible;
}

.mobile-app-body #friendsList .conversation-item:last-of-type {
  margin-bottom: 0 !important;
}

/* Make Groups list use the full page height (between header and bottom nav) */
#tab-groups .container {
  display: flex;
  flex-direction: column;
  /* mirror friends container sizing */
  min-height: calc(100dvh - var(--nav-height) - 54px);
  padding: 12px 10px 16px;
}
#tab-groups #groupsListView {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}
#tab-groups #groupsListView .friends-panel,
#tab-groups #groupsListView .conversation-management,
#tab-groups #groupsListView .friends-columns {
  flex: 1 1 auto;
}

#friendsOutgoingView .friends-requests-list,
#friendsIncomingView .friends-requests-list,
#groupsOutgoingView .friends-requests-list,
#groupsIncomingView .friends-requests-list {
  flex:0 0 auto;
  max-height:none;
  overflow:visible;
}

.friends-subheader { display:flex; align-items:center; gap:12px; padding:12px 0; }
.friends-subheader h4 { margin:0; font-size:18px; font-weight:700; }

#friendsOutgoingView .friends-requests-list,
#friendsIncomingView .friends-requests-list {
  border-top:1px solid rgba(255,255,255,0.08);
  padding-top:12px;
}

.friends-chat-actions { display:flex; align-items:center; gap:10px; }
.translate-dropdown { position:relative; display:inline-flex; }
.translate-dropdown .dropdown {
  display:none;
  position:absolute;
  right:0;
  top:110%;
  z-index:25;
  background:rgba(15,23,42,0.96);
  border:1px solid rgba(255,255,255,0.15);
  border-radius:10px;
  padding:6px;
  min-width:170px;
}

.group-chat-name {
  display:block;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-weight:800;
}
/* Constrain name within the central meta region on mobile */
.friends-chat-header .group-head-mobile .group-meta { min-width:0; }
.friends-chat-header .group-head-mobile .group-meta .group-chat-name { max-width:100%; }

.group-members-more-btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  font-size:0.85rem;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.1);
  background:rgba(255,255,255,0.06);
  color:inherit;
  min-width:0;
  white-space:nowrap;
  line-height:1.2;
}

.group-avatar-button {
  flex:0 0 auto;
}

.friends-chat-body { flex:1; display:flex; flex-direction:column; overflow:hidden; min-height:0; padding-bottom:0; position:relative; }
.friends-chat-body #dmMessages {
  flex:1;
  overflow-y:auto;
  padding:0 4px 2px;
  min-height:0;
  display:flex;
  flex-direction:column;
  background:transparent !important;
  border:none !important;
  max-height:none !important;
}
.friends-chat-body #groupMessages {
  flex:1;
  overflow-y:auto;
  padding:0 4px 2px;
  min-height:0;
  display:flex;
  flex-direction:column;
  background:transparent !important;
  border:none !important;
  max-height:none !important;
}

.scroll-bottom-btn {
  position:absolute;
  left:50%;
  bottom:72px;
  transform:translate(-50%,0) scale(0.94);
  display:flex;
  align-items:center;
  justify-content:center;
  width:42px;
  height:42px;
  border-radius:999px;
  border:none;
  background:linear-gradient(135deg, rgba(79,70,229,0.95), rgba(14,165,233,0.92));
  color:#fff;
  font-size:20px;
  cursor:pointer;
  opacity:0;
  pointer-events:none;
  box-shadow:0 12px 28px rgba(15,23,42,0.28);
  transition:opacity 0.2s ease, transform 0.2s ease;
  z-index:35;
}

.scroll-bottom-btn.show {
  opacity:1;
  pointer-events:auto;
  transform:translate(-50%,0) scale(1);
}

.scroll-bottom-btn:focus-visible {
  outline:2px solid rgba(255,255,255,0.9);
  outline-offset:3px;
}
.friends-chat-body #dmMessages::before {
  content:"";
  flex-grow:1;
  flex-shrink:1;
  pointer-events: none;
}
.friends-chat-body #groupMessages::before {
  content:"";
  flex-grow:1;
  flex-shrink:1;
  pointer-events: none;
}
.friends-chat-body #dmMessages > * {
  flex-shrink:0;
}
.friends-chat-body #groupMessages > * {
  flex-shrink:0;
}

.friends-view:not(.active) .group-chat-only {
  display:none !important;
}
/* Ensure group chat-only controls never show on the list screen
   unless the chat pane is explicitly opened on mobile shell */
/* Default: hide all group chat-only panels on Groups screen */
#tab-groups .group-chat-only { display:none !important; }
/* In chat: show only the composer by default */
.mobile-app-body.groups-chat-open #tab-groups .dm-input-row.group-chat-only { display:flex !important; }
/* Palette panel container */
.mobile-app-body.groups-chat-open.groups-palette-open #tab-groups #groupPalettePanel { display:block !important; }
.friends-chat-body #dmQuotePreview,
.friends-chat-body #groupQuotePreview {
  margin:0 4px 10px;
}
.friends-chat-body #dmQuotePreview.hidden,
.friends-chat-body #groupQuotePreview.hidden {
  display:none !important;
  margin:0;
  padding:0;
  border:none;
}

.friends-chat-composer {
  flex-shrink:0;
  padding:8px 6px calc(6px + env(safe-area-inset-bottom));
  border-top:1px solid rgba(255,255,255,0.08);
  background:rgba(12,18,28,0.88);
  backdrop-filter:blur(12px);
}
.friends-chat-composer .dm-input-row { display:flex; align-items:center; gap:10px; }
.friends-chat-composer .dm-input-wrap { flex:1; position:relative; }
.friends-chat-composer textarea {
  width:100%;
  min-height:44px;
  max-height:160px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(148,163,184,0.3);
  background:rgba(17,24,39,0.65);
  color:#fff;
  resize:none;
}
.friends-chat-composer .dm-actions { display:flex; align-items:center; gap:8px; }
#dmPaletteBtn { font-size:18px; }
#groupPaletteBtn { font-size:18px; }
#dmPalettePanel {
  display:none;
  margin-top:12px;
  background:rgba(17,24,39,0.72);
  border:1px solid rgba(255,255,255,0.12);
  border-radius:12px;
  padding:12px;
  max-height:45vh;
  overflow-y:auto;
}
#groupPalettePanel {
  display:none;
  background:rgba(17,24,39,0.72);
  border:1px solid rgba(255,255,255,0.12);
  border-radius:12px;
  padding:12px;
  margin-top:12px;
  max-height:min(60vh, 520px);
  overflow-y:auto;
  backdrop-filter:blur(10px);
}
#groupPalettePanel .setting-group { margin-top:0; }
#groupPalettePanel .dm-fonts { margin-top:12px; }

/* ------------------------------------------------------------
   Mobile-only: lock Groups chat container to vertical scroll
   Prevent horizontal dragging/overscroll "drift" on iOS/Android
   without affecting desktop behaviour.
------------------------------------------------------------- */
.mobile-app-body #groupsChatView,
.mobile-app-body #groupMessages {
  /* Limit touch gestures to vertical panning */
  touch-action: pan-y !important;
  /* Disallow horizontal overscroll chaining */
  overscroll-behavior-x: none;
  /* Never allow horizontal scrollbars */
  overflow-x: hidden;
  max-width: 100vw;
}

.mobile-app-body #groupMessages.conversation-list {
  /* Keep smooth native scroll while containing bounce to list */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

/* Mirror the same behaviour for Friends chat view */
.mobile-app-body #friendsChatView,
.mobile-app-body #dmMessages {
  touch-action: pan-y !important;
  overscroll-behavior-x: none;
  overflow-x: hidden;
  max-width: 100vw;
}

.mobile-app-body #dmMessages.conversation-list {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

/* Prevent accidental image dragging within the chat area */
.mobile-app-body #groupMessages img,
.mobile-app-body #groupsChatView img {
  -webkit-user-drag: none;
}
.friends-chat-composer .enh-font-grid { gap:12px; }

body.friends-palette-open #dmPalettePanel { display:block; }

body.friends-chat-open .app-topbar,
body.friends-chat-open #bottomNav { display:none !important; }
body.friends-chat-open .app-content { padding:0; }
body.friends-chat-open,
body.groups-chat-open {
  overflow:hidden;
  overscroll-behavior:none;
}
body.friends-chat-open #appContent,
body.groups-chat-open #appContent {
  overflow:hidden;
  height:100vh;
  max-height:100vh;
}
@supports (height: 100dvh) {
  body.friends-chat-open #appContent,
  body.groups-chat-open #appContent {
    height:100dvh;
    max-height:100dvh;
  }
}
body.friends-chat-open #friendsChatView {
  position:fixed;
  inset:0;
  z-index:40;
  display:flex;
  flex-direction:column;
  background:#0f1115;
  height:100dvh;
}
body.friends-chat-open #tab-friends .container {
  margin-bottom:0 !important;
  padding:0 !important;
  min-height:0 !important;
}
body.friends-chat-open #friendsChatView .friends-chat-composer {
  padding-bottom:calc(6px + env(safe-area-inset-bottom));
}
body.friends-chat-open #friendsChatView .friends-chat-body #dmMessages { padding-bottom:0; }
/* Reduce top padding for mobile chat headers while respecting safe area */
body.friends-chat-open .friends-chat-header { padding-top: max(6px, env(safe-area-inset-top)); }
@supports (padding: max(0px)) {
  body.friends-chat-open #friendsChatView { padding-top:env(safe-area-inset-top); }
}

body.friends-chat-open .app-content {
  padding:0 !important;
}

/* Groups chat full-screen behavior mirrors friends chat */
body.groups-chat-open .app-topbar,
body.groups-chat-open #bottomNav { display:none !important; }
body.groups-chat-open .app-content { padding:0; }
body.groups-chat-open #groupsChatView {
  position:fixed;
  inset:0;
  z-index:40;
  display:flex;
  flex-direction:column;
  background:#0f1115;
  height:100dvh;
  min-height:0;
}
body.groups-chat-open #tab-groups .container {
  margin-bottom:0 !important;
  padding:0 !important;
  min-height:0 !important;
}
/* Respect safe-area at top/bottom on iOS */
/* Groups chat: keep top padding minimal while respecting safe-area */
body.groups-chat-open .friends-chat-header { padding-top: 4px; }
@supports (padding: max(0px)) {
body.groups-chat-open .friends-chat-header.group-chat-header { padding-top: max(4px, env(safe-area-inset-top)); }
}
@supports (padding: max(0px)) {
  body.groups-chat-open #groupsChatView { padding-top:env(safe-area-inset-top); }
}
/* Use the same flex rules as DM for the groups body */
body.groups-chat-open #groupsChatView .friends-chat-body {
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  min-height:0;
  padding-bottom:0;
}
body.groups-chat-open #groupsChatView .conversation-area {
  margin-top:0 !important;
  padding:0;
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
  min-height:0;
}
body.groups-chat-open #groupsChatView #groupMessages {
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  padding:0 6px 0;
  margin:0;
  display:flex;
  flex-direction:column;
  gap:6px;
  background:transparent !important;
  border:none !important;
}
body.groups-chat-open #groupsChatView #groupMessages > * {
  flex-shrink:0;
}

body.groups-chat-open #groupsChatView .conversation-area {
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
  min-height:0;
  margin:0 !important;
  padding:0;
}
body.groups-chat-open #groupsChatView .conversation-area .conversation-list {
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  padding:0 6px 0;
  margin:0;
  display:flex;
  flex-direction:column;
  gap:6px;
  background:transparent !important;
  border:none !important;
}
body.groups-chat-open #groupsChatView .conversation-area .conversation-list > * {
  flex-shrink:0;
}

body.groups-chat-open #groupsChatView .friends-chat-composer {
  flex-shrink:0;
  padding:8px 6px calc(6px + env(safe-area-inset-bottom));
  border-top:1px solid rgba(255,255,255,0.08);
  background:rgba(12,18,28,0.88);
  backdrop-filter:blur(12px);
}
body.groups-chat-open #groupsChatView .friends-chat-composer .dm-input-row {
  margin:0;
  padding:0;
  gap:10px;
  align-items:flex-end;
}
body.groups-chat-open #groupsChatView .friends-chat-composer .dm-actions { gap:10px; }
body.groups-chat-open #groupsChatView .friends-chat-composer textarea {
  min-height:44px;
  max-height:160px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(148,163,184,0.3);
  background:rgba(17,24,39,0.65);
  color:#fff;
  resize:none;
}
/* Align message margins with DM (no extra gap) */
.mobile-app-body #groupMessages .conversation-item:first-of-type { margin-top: 0 !important; }
.mobile-app-body #groupMessages .conversation-item:last-of-type { margin-bottom: 0 !important; }
body.groups-chat-open #groupsChatView .setting-group.group-chat-only,
body.groups-chat-open #groupsChatView .dm-fonts.group-chat-only {
  margin:0;
  padding:12px 16px;
  border-top:1px solid rgba(255,255,255,0.08);
  background:rgba(17,24,39,0.92);
}

/* Groups styling */
.group-avatar-logo {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(255,255,255,0.1);
}
.group-avatar-grid {
  display:grid;
  gap:2px;
  width:32px;
  border-radius:12px;
  overflow:hidden;
  background: rgba(255,255,255,0.12);
}
.group-avatar-grid.grid-2x2 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  height:32px;
}
.group-avatar-grid.grid-3x3 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  height:32px;
}
.group-avatar-cell {
  display:block;
  width:100%;
  height:100%;
  background: rgba(255,255,255,0.18);
}
.group-avatar-cell.photo img {
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
}
.group-info-card {
  background: rgba(0,0,0,0.18);
  border:1px solid rgba(255,255,255,0.08);
  border-radius:12px;
  padding:10px;
  margin-top:8px;
}
.group-info-header { display:flex; align-items:center; gap:10px; margin-bottom:8px; }
.group-info-name-row { display:flex; align-items:center; gap:8px; }
.group-info-name { font-weight:600; font-size:14px; }
.group-info-qr {
  width:26px;
  height:26px;
  border-radius:50%;
  border:1px solid rgba(255,255,255,0.25);
  background:rgba(99,102,241,0.2);
  color:#fff;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.group-info-qr:active,
.group-info-qr:focus {
  background:rgba(99,102,241,0.35);
  outline:none;
}
.group-info-count { font-size:12px; opacity:0.8; }
.group-info-members { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.group-info-members .group-info-members-btn { margin-left:auto; }
.group-settings-block {
  margin-top:10px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.group-setting-row {
  display:flex;
  align-items:center;
  gap:10px;
  padding:6px 10px;
  border-radius:10px;
  background:rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.08);
}
.group-pending-row { justify-content:space-between; }

.group-list-column {
  display:flex;
  flex-direction:column;
  gap:10px;
}
#tab-groups #groupsList {
  max-height:none;
  overflow:visible;
}
.group-list-item {
  padding:0;
}
.group-item-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:12px 14px;
}
.conversation-item.group-list-item.selected .group-item-row {
  background:rgba(255,255,255,0.08);
}
.group-item-left {
  display:flex;
  align-items:center;
  gap:10px;
  flex:1 1 auto;
  min-width:0;
}
.group-item-text {
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
}
.group-item-actions {
  display:flex;
  align-items:center;
  gap:8px;
}
.group-item-actions .badge {
  background: #e53935;
  color: #fff;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(229,57,53,0.4);
}
.group-item-name {
  font-weight:600;
  font-size:14px;
  color:#fff;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.group-item-meta {
  font-size:12px;
  opacity:0.75;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.group-list-options {
  background:transparent;
  border:none;
  color:rgba(255,255,255,0.75);
  font-size:18px;
  cursor:pointer;
  padding:4px 6px;
  border-radius:8px;
}
.group-list-options:focus,
.group-list-options:hover {
  background:rgba(255,255,255,0.1);
  color:#fff;
}
.group-setting-label { font-size:13px; opacity:0.9; }
.group-setting-note {
  font-size:12px;
  opacity:0.85;
  background:rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.08);
  border-radius:10px;
  padding:8px 10px;
}
.group-alias-row {
  flex-wrap:wrap;
  gap:8px;
}
.group-alias-row input#groupAliasInput {
  flex:1 1 180px;
  min-width:150px;
  padding:6px 10px;
  border-radius:8px;
  border:1px solid rgba(255,255,255,0.15);
  background:rgba(255,255,255,0.05);
  color:#fff;
}
.group-alias-row #groupAliasSave {
  flex:0 0 auto;
}
.group-header-avatar {
  display:flex;
  align-items:center;
  justify-content:center;
  width:34px;
  height:34px;
}
.group-header-avatar img.avatar-32 {
  width:34px;
  height:34px;
  border-radius:50%;
}
.group-header-avatar .group-avatar-grid {
  width:34px;
  height:34px;
  border-radius:11px;
}
.group-info-actions {
  margin-top:12px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.group-actions-section {
  display:flex;
  flex-direction:column;
  gap:6px;
}
.group-actions-title {
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:0.04em;
  opacity:0.75;
}
.group-actions-row {
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap:8px;
}
.group-actions-row .control-button {
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  text-align:center;
}
/* Danger zone styling: make Delete Group stand out (mobile) */
#groupsDeleteBtn.control-button {
  background: linear-gradient(45deg, #ef5350, #e53935);
  color: #fff;
  border: none;
}
#groupsDeleteBtn.control-button:hover,
#groupsDeleteBtn.control-button:focus-visible {
  box-shadow: 0 6px 18px rgba(229,57,53,0.35);
  transform: translateY(-1px);
}
.group-request-indicator { display:inline-flex; align-items:center; justify-content:center; min-width:16px; padding:2px 6px; border-radius:999px; background:#f87171; color:#200909; font-size:11px; font-weight:600; margin-left:4px; }
.group-request-indicator.small { font-size:10px; padding:1px 4px; }
.group-item-actions { display:flex; align-items:center; gap:6px; }
.group-role-pill {
  display:inline-block;
  margin-left:6px;
  padding:2px 6px;
  font-size:11px;
  border-radius:999px;
  background:rgba(125,200,255,0.18);
  border:1px solid rgba(125,200,255,0.35);
  color:#9bd3ff;
}
.group-member-chip {
  display:inline-flex;
  align-items:center;
  padding:4px 8px;
  font-size:11px;
  border-radius:999px;
  background: rgba(255,255,255,0.1);
  border:1px solid rgba(255,255,255,0.12);
}
.group-member-chip.online {
  background:rgba(34,197,94,0.18);
  border-color:rgba(34,197,94,0.42);
  color:#e7ffef;
}
.group-member-chip.offline {
  opacity:0.82;
}
.group-member-chip .presence-dot {
  width:7px;
  height:7px;
  border-radius:50%;
  display:inline-block;
  background:rgba(255,255,255,0.4);
  margin-right:4px;
}
.group-member-chip.online .presence-dot { background:#22c55e; box-shadow:0 0 4px rgba(34,197,94,0.6); }
.group-member-chip.offline .presence-dot { background:rgba(148,163,184,0.6); }
.group-members-inline {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:6px;
  margin-top:4px;
}
.group-members-more-btn {
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:4px 10px;
  border-radius:999px;
  font-size:11px;
  background:rgba(255,255,255,0.1);
  border:1px solid rgba(255,255,255,0.16);
  color:inherit;
}
.group-members-more-btn:active {
  background:rgba(255,255,255,0.18);
}
.group-members-modal {
  max-height:65vh;
  overflow:auto;
  padding:12px;
}
.group-members-modal-list {
  display:flex;
  flex-direction:column;
  gap:10px;
}
.group-members-modal-item {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:9px 10px;
  border-radius:10px;
  background:rgba(255,255,255,0.08);
  border:1px solid rgba(255,255,255,0.12);
}
.group-members-modal-item .member-main {
  display:flex;
  align-items:center;
  gap:10px;
  flex:1;
  min-width:0;
}
.member-avatar-wrapper {
  position:relative;
  width:34px;
  height:34px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.member-avatar-wrapper .member-avatar,
.member-avatar-wrapper .avatar-32,
.member-avatar-wrapper img {
  width:32px;
  height:32px;
  border-radius:50%;
  object-fit:cover;
}
.member-avatar-wrapper .presence-dot {
  position:absolute;
  bottom:-2px;
  right:-2px;
  width:8px;
  height:8px;
  border-radius:50%;
  border:2px solid rgba(17,24,39,0.85);
  box-shadow:0 0 4px rgba(0,0,0,0.3);
}
.group-members-modal-item.online .presence-dot {
  background:#22c55e;
}
.group-members-modal-item.offline .presence-dot {
  background:rgba(148,163,184,0.65);
}
.group-members-modal-item.online {
  border-color:rgba(34,197,94,0.4);
  background:rgba(34,197,94,0.12);
}
.member-info { display:flex; flex-direction:column; gap:2px; min-width:0; }
.member-name-line { display:flex; align-items:center; gap:6px; min-width:0; }
.member-name { font-weight:600; font-size:12.5px; max-width:170px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.member-handle { font-size:11px; opacity:0.72; }
.member-role { font-size:10px; padding:2px 6px; border-radius:999px; border:1px solid rgba(255,255,255,0.18); opacity:0.8; }
.member-status { font-size:10.5px; opacity:0.68; }
.member-actions { display:flex; align-items:center; gap:6px; }
.member-action { width:28px; height:28px; display:flex; align-items:center; justify-content:center; border-radius:999px; border:1px solid transparent; background:rgba(255,255,255,0.08); color:inherit; font-weight:700; font-size:16px; cursor:pointer; }
.member-action:disabled { opacity:0.45; cursor:not-allowed; }
.member-action.add-friend { background:rgba(34,197,94,0.2); border-color:rgba(34,197,94,0.45); color:#bdfcc7; width:auto; min-width:38px; padding:0 8px; gap:4px; }
.member-action.add-friend .member-action-icon { display:flex; align-items:center; justify-content:center; }
.member-action.add-friend .member-action-icon svg { width:16px; height:16px; display:block; }
.member-action.add-friend .member-action-plus { font-size:15px; line-height:1; }
.member-action.remove-member { background:rgba(229,57,53,0.2); border-color:rgba(229,57,53,0.45); color:#ffbab6; }
.member-action.action-complete { background:rgba(34,197,94,0.35); border-color:rgba(34,197,94,0.55); color:#ffffff; }
.group-chip-hint {
  margin-left:6px;
  font-size:10px;
  opacity:0.7;
}
#groupsList .conversation-item.selected {
  background:linear-gradient(45deg, rgba(66,165,245,0.28), rgba(33,150,243,0.28));
  border-color:rgba(66,165,245,0.6);
}
.group-members { display:flex; align-items:center; flex-wrap:wrap; gap:6px; margin:8px 0; }
.group-header-name { font-weight:600; font-size:14px; }
.group-header-members { font-size:12px; opacity:0.9; display:flex; flex-direction:column; gap:4px; }
.group-members-summary { font-size:11px; line-height:1.3; color:rgba(255,255,255,0.72); }
.group-members-summary .summary-label { display:block; font-size:10px; text-transform:uppercase; letter-spacing:0.05em; opacity:0.65; margin-bottom:2px; }
.group-members-summary .summary-names { display:block; font-size:11px; }
.conv-actions-icons { display:flex; align-items:center; gap:8px; }
.control-button.icon-button { width:38px; height:38px; padding:0; display:flex; align-items:center; justify-content:center; font-size:18px; }
.toggle-icon-wrap { display:flex; align-items:center; gap:6px; }
.toggle-icon { font-size:18px; }
.toggle-icon-wrap .toggle-switch { margin:0; }
.group-friend-row {
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 8px;
  border-radius:10px;
  background: rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.08);
  margin-bottom:6px;
}
.group-friend-row input { margin:0; }
#groupColorPreview {
  display:grid;
  grid-template-columns: repeat(4, 16px);
  gap:5px;
  margin:6px 0 10px;
}
#groupColorPreview span {
  display:block;
  width:16px;
  height:16px;
  border-radius:5px;
  background: rgba(255,255,255,0.25);
}
.dm-handle {
  margin-left:6px;
  font-size:11px;
  opacity:0.8;
}
.dm-role-badge {
  display:inline-block;
  margin-left:6px;
  padding:2px 6px;
  font-size:10px;
  border-radius:999px;
  background:rgba(255,255,255,0.12);
  border:1px solid rgba(255,255,255,0.2);
}
.group-rename-input {
  width:100%;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.12);
  background:rgba(255,255,255,0.05);
  color:#fff;
}
#groupsChatAvatar img,
#groupsChatAvatar .group-avatar-grid { width:32px; height:32px; border-radius:50%; }
#groupsChatAvatar .group-avatar-logo { width:32px; height:32px; border-radius:12px; }

/* Settings subsections visual separation */
.settings-subsection { margin: 14px 0; }
.settings-subsection > h4 { margin: 0 0 8px 0; color: #ffa726; }

/* Settings mini tabs */
.settings-mini-tabs { display:flex; gap:6px; margin-bottom:10px; }
.settings-mini-tabs .mini-tab { appearance:none; border:1px solid var(--nav-border); background: rgba(255,255,255,0.06); color:#fff; border-radius:10px; padding:6px 10px; cursor:pointer; font-size:13px; }
.settings-mini-tabs .mini-tab.active { background: rgba(66,165,245,0.15); border-color: #42a5f5; color: #42a5f5; }

/* Ensure scroll on large lists does not hit nav */
#dmMessages { height: 55vh !important; }
#conversationList { max-height: 68vh; }

/* Me page */
.me-card { background: rgba(255,255,255,0.06); border:1px solid var(--nav-border); border-radius:14px; padding:12px; }
.me-header { display:flex; align-items:center; justify-content: space-between; }
.me-id { display:flex; align-items:center; gap:10px; }
.me-avatar-wrap {
  width:56px;
  height:56px;
  border-radius:50%;
  position:relative;
  overflow:hidden;
  border:1px solid rgba(255,255,255,0.2);
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(15,23,42,0.45);
  flex-shrink:0;
  transition:box-shadow 0.2s ease;
}
.me-avatar {
  width:100%;
  height:100%;
  border-radius:50%;
  object-fit:cover;
  display:block;
}
.me-avatar-initial {
  position:absolute;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  font-weight:700;
  font-size:20px;
  letter-spacing:.4px;
  text-transform:uppercase;
  color:rgba(17,24,39,0.9);
}
.me-avatar-wrap.me-avatar-fallback {
  border:1px solid rgba(255,255,255,0.35);
}
.me-avatar-wrap.me-avatar-fallback .me-avatar {
  display:none;
}
.me-avatar-wrap.me-avatar-fallback .me-avatar-initial {
  display:flex;
}
.mini-user-row {
  display:flex;
  gap:8px;
  align-items:center;
  padding:6px 0;
}
.mini-user-empty {
  opacity:0.8;
  padding:6px 0;
}
.mini-avatar {
  width:28px;
  height:28px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:600;
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:.2px;
  color:rgba(17,24,39,0.92);
  background:rgba(255,255,255,0.35);
  border:1px solid rgba(255,255,255,0.25);
  overflow:hidden;
  flex-shrink:0;
}
.mini-avatar-img {
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.mini-avatar-photo {
  background:transparent;
  border-color:rgba(255,255,255,0.25);
}
.mini-avatar-fallback {
  border-color:rgba(255,255,255,0.35);
}
.post-avatar {
  width:24px;
  height:24px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:600;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.2px;
  color:rgba(17,24,39,0.92);
  background:rgba(255,255,255,0.3);
  border:1px solid rgba(255,255,255,0.22);
  overflow:hidden;
  flex-shrink:0;
  margin-right:6px;
}
.post-header .post-avatar { margin-right:8px; }
.post-avatar-img {
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  border-radius:inherit;
}
.post-avatar-photo {
  background:transparent;
  border-color:rgba(255,255,255,0.2);
}
.post-avatar-fallback {
  border-color:rgba(255,255,255,0.3);
}
.me-gear { appearance:none; border:1px solid var(--nav-border); background: rgba(255,255,255,0.08); color:#fff; border-radius:10px; padding:6px 10px; cursor:pointer; }

/* Emoji picker: larger touch targets on mobile */
.mobile-app-body .emoji-picker { max-width: 360px; max-height: 260px; }
.mobile-app-body .emoji-grid { grid-template-columns: repeat(6, 1fr); gap: 10px; }
.mobile-app-body .emoji-item { font-size: 30px; line-height: 36px; }

/* Make Scan/QR buttons larger and higher contrast on any background */
#meScanBtn.me-gear, #meQrBtn.me-gear {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  background: rgba(15,23,42,0.78);
  border: 1px solid rgba(255,255,255,0.38);
  color: #ffffff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 6px 14px rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
}
#meScanBtn.me-gear:hover, #meQrBtn.me-gear:hover {
  background: rgba(15,23,42,0.9);
}
#meScanBtn.me-gear:active, #meQrBtn.me-gear:active {
  transform: translateY(0.5px);
}
.me-username { font-weight: 800; font-size: 16px; }
.me-bio { font-size: 12px; opacity:.85; }
.me-stats { display:flex; gap: 16px; margin-top:10px; }
.me-stat { flex:1; text-align:center; background: rgba(255,255,255,0.05); border:1px solid var(--nav-border); border-radius:10px; padding:8px; }
.me-stat-num { font-size: 16px; font-weight: 700; }
.me-stat-label { font-size: 12px; opacity: .8; }
.me-coins { display:flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.me-coin { flex:1 1 140px; display:flex; align-items:center; gap: 10px; padding:10px 12px; border-radius:12px; border:1px solid var(--nav-border); background: rgba(255,255,255,0.05); }
.me-coin-icon { font-size:20px; }
.me-coin-value { font-size: 17px; font-weight: 700; }
.me-coin-label { font-size: 12px; opacity: .8; letter-spacing: 0.3px; }
.me-coin-today .me-coin-value { color: #7dd87d; }
.me-progress { margin-top: 8px; display:flex; flex-direction:column; gap:6px; }
.me-progress-label { font-size: 12px; opacity: .75; letter-spacing: 0.3px; }
.me-progress-bar { position: relative; width: 100%; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.12); overflow: hidden; }
.me-progress-fill { position:absolute; inset:0; width:0%; background: linear-gradient(90deg, #f97316, #ef4444); transition: width 0.35s ease, background .3s ease; border-radius: 999px; }
.me-auth { display:flex; gap:8px; margin-top:12px; }
.me-actions .control-button { border: 1px solid rgba(229,57,53,0.35); }
body.me-viewing-other #meActions,
body.me-viewing-other #meSettingsBtn {
  display: none !important;
}
.post-menu-container.owner-hidden {
  display: none !important;
}

/* Inline auth modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal-card { background: rgba(18,18,18,0.95); border:1px solid var(--nav-border); border-radius: 14px; width: 100%; max-width: 380px; box-shadow: 0 10px 30px rgba(0,0,0,0.4); display:flex; flex-direction:column; max-height: 90dvh; }
.modal-header { display:flex; align-items:center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--nav-border); }
.modal-close { appearance:none; border:none; background:transparent; color:#fff; font-size:18px; cursor:pointer; }
.modal-tabs { display:flex; gap: 8px; }
.modal-tab { appearance:none; border:1px solid var(--nav-border); background: rgba(255,255,255,0.06); color:#fff; border-radius: 10px; padding:6px 10px; cursor:pointer; font-size:13px; }
.modal-tab.active { border-color: #42a5f5; color:#42a5f5; background: rgba(66,165,245,0.15); }
.modal-body { padding: 12px; flex: 1 1 auto; overflow-y: auto; }
.auth-form { display:flex; flex-direction: column; gap: 10px; }
.auth-form label { display:flex; flex-direction: column; gap: 6px; font-size: 13px; }
.auth-form input { padding:8px; border-radius:8px; border:1px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.06); color:#fff; }
.me-register-row { display:flex; align-items:flex-start; gap:10px; }
.me-register-names { flex:0 0 180px; max-width:180px; display:flex; flex-direction:column; gap:10px; }
.me-register-avatar { flex:0 0 120px; display:flex; flex-direction:column; align-items:center; gap:8px; padding:8px; border-radius:12px; border:1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.05); }
.me-register-avatar-trigger { position:relative; width:92px; height:92px; border-radius:50%; border:2px dashed rgba(255,255,255,0.35); background: rgba(66,66,96,0.25); display:flex; align-items:center; justify-content:center; overflow:hidden; cursor:pointer; transition: border-color 0.2s ease, background 0.2s ease; }
.me-register-avatar-trigger:hover { border-color: rgba(66,165,245,0.85); background: rgba(66,165,245,0.18); }
.me-register-avatar-trigger img { width:100%; height:100%; object-fit:cover; border-radius:50%; }
.me-register-avatar-trigger::after { content:'+'; position:absolute; bottom:6px; right:6px; width:26px; height:26px; border-radius:50%; background:#42a5f5; color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:18px; box-shadow:0 3px 10px rgba(0,0,0,0.35); pointer-events:none; }
.me-register-avatar-trigger.has-image { border-style:solid; border-color: rgba(255,255,255,0.45); }
.me-register-avatar input[type="file"] { display:none; }
.me-avatar-hint { font-size:12px; opacity:0.85; text-align:center; max-width:110px; }
@media (max-width: 440px) {
  .me-register-row { flex-wrap: wrap; }
  .me-register-names,
  .me-register-avatar { flex:1 1 100%; max-width:100%; }
  .me-register-avatar { margin-top:6px; }
}
.modal-msg { font-size: 13px; padding: 8px; border-radius: 8px; margin-bottom: 8px; }
.modal-msg.error { background: rgba(229,57,53,0.15); border: 1px solid rgba(229,57,53,0.35); }
.modal-msg.success { background: rgba(76,175,80,0.15); border: 1px solid rgba(76,175,80,0.35); }
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1200; background: rgba(0,0,0,0.55); padding: 20px; overflow-y: auto; min-height: 100vh; }
.modal.hidden { display: none; }
.mobile-app-body #groupCreateModal .modal-content,
.mobile-app-body #groupAddModal .modal-content,
.mobile-app-body #inviteModal .modal-content {
  background: rgba(15,23,42,0.96);
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,0.35);
  color: #f8fafc;
  box-shadow: 0 30px 60px rgba(2,6,23,0.55);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
}
[data-theme="light"] .mobile-app-body #groupCreateModal .modal-content,
[data-theme="light"] .mobile-app-body #groupAddModal .modal-content,
[data-theme="light"] .mobile-app-body #inviteModal .modal-content,
[data-theme="bright"] .mobile-app-body #groupCreateModal .modal-content,
[data-theme="bright"] .mobile-app-body #groupAddModal .modal-content,
[data-theme="bright"] .mobile-app-body #inviteModal .modal-content,
[data-theme="vivid"] .mobile-app-body #groupCreateModal .modal-content,
[data-theme="vivid"] .mobile-app-body #groupAddModal .modal-content,
[data-theme="vivid"] .mobile-app-body #inviteModal .modal-content,
[data-theme="dawn"] .mobile-app-body #groupCreateModal .modal-content,
[data-theme="dawn"] .mobile-app-body #groupAddModal .modal-content,
[data-theme="dawn"] .mobile-app-body #inviteModal .modal-content,
[data-theme="legacy"] .mobile-app-body #groupCreateModal .modal-content,
[data-theme="legacy"] .mobile-app-body #groupAddModal .modal-content,
[data-theme="legacy"] .mobile-app-body #inviteModal .modal-content,
[data-theme="aurora"] .mobile-app-body #groupCreateModal .modal-content,
[data-theme="aurora"] .mobile-app-body #groupAddModal .modal-content,
[data-theme="aurora"] .mobile-app-body #inviteModal .modal-content,
html:not([data-theme]) body.mobile-app-body #groupCreateModal .modal-content,
html:not([data-theme]) body.mobile-app-body #groupAddModal .modal-content,
html:not([data-theme]) body.mobile-app-body #inviteModal .modal-content {
  background: #ffffff;
  color: #111318;
  border: 1px solid rgba(17,19,24,0.12);
  box-shadow: 0 30px 60px rgba(15,23,42,0.18);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
}
.mobile-app-body #groupCreateModal .modal-body,
.mobile-app-body #groupAddModal .modal-body,
.mobile-app-body #inviteModal .modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  max-height: none;
}
.mobile-app-body #groupFriendList,
.mobile-app-body #groupAddFriendList {
  max-height: min(340px, 45vh);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(148,163,184,0.35);
  border-radius: 12px;
  background: rgba(15,23,42,0.55);
}
[data-theme="light"] .mobile-app-body #groupFriendList,
[data-theme="light"] .mobile-app-body #groupAddFriendList,
[data-theme="bright"] .mobile-app-body #groupFriendList,
[data-theme="bright"] .mobile-app-body #groupAddFriendList,
[data-theme="vivid"] .mobile-app-body #groupFriendList,
[data-theme="vivid"] .mobile-app-body #groupAddFriendList,
[data-theme="dawn"] .mobile-app-body #groupFriendList,
[data-theme="dawn"] .mobile-app-body #groupAddFriendList,
[data-theme="legacy"] .mobile-app-body #groupFriendList,
[data-theme="legacy"] .mobile-app-body #groupAddFriendList,
[data-theme="aurora"] .mobile-app-body #groupFriendList,
[data-theme="aurora"] .mobile-app-body #groupAddFriendList,
html:not([data-theme]) body.mobile-app-body #groupFriendList,
html:not([data-theme]) body.mobile-app-body #groupAddFriendList {
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(17,19,24,0.12);
}
.modal-dialog { background: rgba(20,20,20,0.95); border: 1px solid var(--nav-border); border-radius: 16px; width: 100%; max-width: 420px; box-shadow: 0 18px 40px rgba(0,0,0,0.45); max-height: calc(100vh - 40px); overflow: hidden; display:flex; flex-direction:column; margin:auto; }
.modal-header { display:flex; align-items:center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.12); }
.modal-content { padding: 14px; flex:1 1 auto; overflow-y: auto; }
.modal-footer { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,0.12); display:flex; justify-content:flex-end; gap:10px; }
.modal-close { appearance:none; border:none; background:transparent; color:#fff; font-size:18px; cursor:pointer; }
body.modal-open,
.mobile-app-body.modal-open {
  overflow: hidden;
}

html.modal-open {
  overflow: hidden;
}

.invite-list { display:flex; flex-direction: column; gap:10px; }
.invite-item { display:flex; flex-direction:column; gap:10px; background: rgba(255,255,255,0.06); border: 1px solid var(--nav-border); border-radius: 14px; padding:12px; }
.invite-item.invite-empty { justify-content:center; align-items:center; font-size:13px; opacity:0.75; min-height:56px; }

.invite-primary-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.invite-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.invite-actions-compact { margin-top:6px; }

.invite-toggle-row {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  margin-top:8px;
}
.invite-toggle-row label {
  display:flex;
  align-items:center;
  gap:8px;
  font-size:13px;
}

.code-chip,
.invite-code-badge {
  appearance:none;
  border:1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color:#fff;
  border-radius: 8px;
  padding:6px 10px;
  font-size: 13px;
  max-width: 52vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.code-chip { cursor:pointer; transition: background 0.2s ease; }
.code-chip:hover { background: rgba(59,130,246,0.25); }
.invite-code-badge { cursor: default; display:inline-flex; align-items:center; }

.invite-lang-chip,
.invite-usage-count,
.invite-remaining-chip {
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  background: rgba(255,255,255,0.08);
  border:1px solid rgba(255,255,255,0.18);
  color:#fff;
}

.invite-usage-count { font-weight:600; }

.invite-pill {
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:600;
  border:1px solid transparent;
}
.invite-pill-unused { background: rgba(34,197,94,0.16); border-color: rgba(34,197,94,0.35); color:#bbf7d0; }
.invite-pill-used { background: rgba(59,130,246,0.2); border-color: rgba(59,130,246,0.4); color:#dbeafe; }
.invite-pill-inactive { background: rgba(239,68,68,0.18); border-color: rgba(239,68,68,0.4); color:#fecaca; }
.invite-pill-exhausted { background: rgba(249,115,22,0.22); border-color: rgba(249,115,22,0.45); color:#fed7aa; }
.invite-pill-group { background: rgba(99,102,241,0.24); border-color: rgba(99,102,241,0.45); color:#e0e7ff; }
.invite-pill-warning { background: rgba(234,179,8,0.24); border-color: rgba(234,179,8,0.45); color:#fef08a; }

.invite-actions .control-button { padding:4px 10px; font-size:13px; }

.invite-inline-field {
  display:flex;
  align-items:center;
  gap:6px;
  margin-top:6px;
  width:100%;
}
.invite-inline-field input {
  flex:1 1 auto;
  min-width:0;
}
.invite-inline-field .control-button {
  flex:0 0 auto;
  white-space:nowrap;
}
.invite-inline-nowrap {
  flex-wrap:nowrap;
}

.invite-more { margin:10px 0; text-align:center; }
.invite-more.hidden { display:none; }
.invite-more .control-button { padding:6px 16px; font-size:13px; }

.control-button.outline { background: transparent; border:1px solid rgba(255,255,255,0.22); color:#fff; }
.control-button.outline:hover { background: rgba(255,255,255,0.12); }
.control-button.danger { background: linear-gradient(45deg, #ef5350, #e53935); border:none; color:#fff; }
.control-button.danger:hover { box-shadow: 0 6px 18px rgba(229,57,53,0.35); }

.invite-options { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:4px; }

.invite-links-group { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:6px 0; }
.invite-links-group .invite-links-label { font-size:13px; opacity:0.8; }
.invite-links-group .control-button { padding:4px 10px; font-size:13px; }
.conversation-item.system-item {
  display: flex;
  justify-content: center;
}

/* Light/bright themes: ensure invite management has dark text on light backgrounds */
html:not([data-theme]) .invite-item,
[data-theme="light"] .invite-item,
[data-theme="bright"] .invite-item,
[data-theme="vivid"] .invite-item {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #0f172a !important;
}
html:not([data-theme]) .invite-item .invite-primary-row,
[data-theme="light"] .invite-item .invite-primary-row,
[data-theme="bright"] .invite-item .invite-primary-row,
[data-theme="vivid"] .invite-item .invite-primary-row,
html:not([data-theme]) .invite-item .invite-options,
[data-theme="light"] .invite-item .invite-options,
[data-theme="bright"] .invite-item .invite-options,
[data-theme="vivid"] .invite-item .invite-options,
html:not([data-theme]) .invite-item label,
[data-theme="light"] .invite-item label,
[data-theme="bright"] .invite-item label,
[data-theme="vivid"] .invite-item label,
html:not([data-theme]) .invite-item span,
[data-theme="light"] .invite-item span,
[data-theme="bright"] .invite-item span,
[data-theme="vivid"] .invite-item span { color:#0f172a !important; }
html:not([data-theme]) .invite-item .control-button.outline,
[data-theme="light"] .invite-item .control-button.outline,
[data-theme="bright"] .invite-item .control-button.outline,
[data-theme="vivid"] .invite-item .control-button.outline {
  color: #0f172a;
  border-color: rgba(15,23,42,0.25);
}
html:not([data-theme]) .invite-item .control-button.outline:hover,
[data-theme="light"] .invite-item .control-button.outline:hover,
[data-theme="bright"] .invite-item .control-button.outline:hover,
[data-theme="vivid"] .invite-item .control-button.outline:hover {
  background: rgba(15,23,42,0.06);
}
html:not([data-theme]) .invite-links-group .invite-links-label,
[data-theme="light"] .invite-links-group .invite-links-label,
[data-theme="bright"] .invite-links-group .invite-links-label,
[data-theme="vivid"] .invite-links-group .invite-links-label {
  color: #334155;
  opacity: .9;
}
/* Inputs inside invite config on light themes */
html:not([data-theme]) .invite-item .invite-config input[type="text"],
[data-theme="light"] .invite-item .invite-config input[type="text"],
[data-theme="bright"] .invite-item .invite-config input[type="text"],
[data-theme="vivid"] .invite-item .invite-config input[type="text"] {
  background:#ffffff;
  color:#0f172a;
  border:1px solid #cbd5e1;
}
/* Pill readability on light backgrounds */
html:not([data-theme]) .invite-pill-unused,
[data-theme="light"] .invite-pill-unused,
[data-theme="bright"] .invite-pill-unused,
[data-theme="vivid"] .invite-pill-unused { background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.45); color:#166534; }
html:not([data-theme]) .invite-pill-used,
[data-theme="light"] .invite-pill-used,
[data-theme="bright"] .invite-pill-used,
[data-theme="vivid"] .invite-pill-used { background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.45); color:#1e3a8a; }
html:not([data-theme]) .invite-pill-inactive,
[data-theme="light"] .invite-pill-inactive,
[data-theme="bright"] .invite-pill-inactive,
[data-theme="vivid"] .invite-pill-inactive { background: rgba(239,68,68,0.10); border-color: rgba(239,68,68,0.45); color:#7f1d1d; }
html:not([data-theme]) .invite-pill-exhausted,
[data-theme="light"] .invite-pill-exhausted,
[data-theme="bright"] .invite-pill-exhausted,
[data-theme="vivid"] .invite-pill-exhausted { background: rgba(249,115,22,0.12); border-color: rgba(249,115,22,0.45); color:#9a3412; }
html:not([data-theme]) .invite-pill-group,
[data-theme="light"] .invite-pill-group,
[data-theme="bright"] .invite-pill-group,
[data-theme="vivid"] .invite-pill-group { background: rgba(99,102,241,0.12); border-color: rgba(99,102,241,0.45); color:#3730a3; }
html:not([data-theme]) .invite-pill-warning,
[data-theme="light"] .invite-pill-warning,
[data-theme="bright"] .invite-pill-warning,
[data-theme="vivid"] .invite-pill-warning { background: rgba(234,179,8,0.12); border-color: rgba(234,179,8,0.45); color:#854d0e; }

.group-system-message {
  max-width: 92%;
  margin: 8px auto;
  padding: 7px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  text-align: center;
  font-size: 0.82rem;
  line-height: 1.3;
  color: inherit;
}

.group-system-message .system-actor,
.group-system-message .system-target {
  font-weight: 600;
}

.group-system-message .system-alias {
  font-style: italic;
}

.group-system-message .system-group-name {
  font-weight: 600;
}

.group-system-message .system-group-name.previous {
  opacity: 0.7;
}

.group-system-time {
  margin-top: 4px;
  font-size: 0.7rem;
  opacity: 0.7;
}

/* High-contrast buttons inside system bubbles on mobile (invites/results) */
.mobile-app-body .group-system-message .control-button,
.mobile-app-body .group-system-message .control-button.tiny {
  background: linear-gradient(135deg, #22d3ee, #a78bfa);
  border: none;
  color: #0b1220;
  font-weight: 700;
}
html:not([data-theme]) .mobile-app-body .group-system-message .control-button,
html:not([data-theme]) .mobile-app-body .group-system-message .control-button.tiny,
[data-theme="light"] .mobile-app-body .group-system-message .control-button,
[data-theme="light"] .mobile-app-body .group-system-message .control-button.tiny,
[data-theme="bright"] .mobile-app-body .group-system-message .control-button,
[data-theme="bright"] .mobile-app-body .group-system-message .control-button.tiny,
[data-theme="vivid"] .mobile-app-body .group-system-message .control-button,
[data-theme="vivid"] .mobile-app-body .group-system-message .control-button.tiny {
  background: linear-gradient(135deg, #22d3ee, #a78bfa);
  color: #0b1220;
  border: none;
}
.friends-chat-header .group-head-mobile .group-meta .group-members {
  justify-content:center;
}
.mobile-app-body .message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 0;
  align-items: center;
}

.mobile-app-body .message-reactions.empty {
  display: none;
}

.mobile-app-body .message-reactions .reaction-chip,
.mobile-app-body .message-reactions .reaction-add-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #f8fafc;
  font-size: 13px;
  padding: 2px 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.mobile-app-body .message-reactions .reaction-chip.mine {
  background: rgba(96, 165, 250, 0.32);
  border-color: rgba(96, 165, 250, 0.6);
  color: #fff;
}

.mobile-app-body .message-reactions .reaction-chip .reaction-count {
  font-size: 12px;
  opacity: 0.9;
}

.mobile-app-body .message-reactions .reaction-add-btn {
  display: none;
}

.mobile-app-body .reaction-burst {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
  pointer-events: none;
  font-size: 30px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}

.mobile-app-body .reaction-burst.visible {
  animation: reactionBurstMobile 650ms ease-out forwards;
}

@keyframes reactionBurstMobile {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0.6; }
  45% { transform: translate(-50%, -65%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -82%) scale(0.85); opacity: 0; }
}

.reaction-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 1600;
  padding: 0 16px 24px;
}

.reaction-picker-overlay.visible {
  display: flex;
}

.reaction-picker-panel {
  width: 100%;
  max-width: 420px;
  background: rgba(17, 17, 18, 0.97);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 20px 55px rgba(0,0,0,0.55);
  padding: 16px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  max-height: 50vh;
  overflow-y: auto;
}

.reaction-picker-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 22px;
  padding: 8px 0;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.reaction-picker-btn:active {
  background: rgba(96,165,250,0.22);
  transform: scale(0.95);
}

.message-action-sheet .reaction-quick-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  flex-wrap: wrap;
  width: 100%;
  row-gap: 8px;
}

.message-action-sheet .reaction-quick-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 18px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.2s ease;
  flex: 0 1 auto;
}

.message-action-preview {
  width: 100%;
  padding: 10px 6px 0;
  display: flex;
  justify-content: center;
}

.message-action-preview-bubble {
  max-width: 100%;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.45;
  color: #eef2ff;
  max-height: 160px;
  overflow: hidden;
  overflow-y: auto;
  box-shadow: inset 0 0 0 1px rgba(10,14,24,0.08);
}

.message-action-preview-bubble.mine {
  background: linear-gradient(135deg, rgba(59,130,246,0.3), rgba(129,140,248,0.32));
  border-color: rgba(96,165,250,0.45);
  color: #f8fafc;
}

.message-action-preview-bubble img {
  max-width: 170px;
  max-height: 130px;
  border-radius: 10px;
  display: block;
  margin: 8px auto 0;
}

.message-preview-quote {
  font-size: 13px;
  font-style: italic;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-preview-text {
  margin-top: 6px;
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-preview-image {
  margin-top: 8px;
  text-align: center;
}

.message-preview-voice {
  margin-top: 6px;
  font-size: 13px;
  opacity: 0.9;
}

.message-preview-empty {
  text-align: center;
  font-size: 13px;
  opacity: 0.5;
}

.message-action-sheet .reaction-quick-btn:active {
  background: rgba(96,165,250,0.24);
}
.mobile-app-body .user-message, .mobile-app-body .ai-message {
  position: relative;
}
/* Posts tabs (mobile) */
.posts-tabs { display:flex; justify-content:center; align-items:center; gap:10px; margin:10px 0 6px; }
.posts-tabs .posts-tab { cursor:pointer; padding:6px 12px; border-radius:999px; border:1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.1); color:#fff; }
.posts-tabs .posts-tab.active { background:#6366f1; color:#fff; border-color: rgba(99,102,241,0.8); }
/* Sticky variant under mobile topbar */
/* Sticky (if needed) */
.posts-tabs.sticky { position: sticky; top: var(--posts-sticky-top, 56px); z-index: 50; padding: 6px 8px; backdrop-filter: blur(6px); background: rgba(0,0,0,0.35); border-bottom: 1px solid rgba(255,255,255,0.12); }
/* Fixed at bottom above footer (mobile requirement) */
.posts-tabs.mobile-fixed {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--posts-fixed-bottom, 60px);
  z-index: 60;
  padding: 4px 0;
  background: transparent;         /* transparent container, show only buttons */
  backdrop-filter: none;
  border-top: none;
  box-shadow: none;
}


/* Mother tongue settings layout */
.mother-settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.mother-select-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  flex: 1 1 180px;
  min-width: 150px;
}

.mother-select-wrap span { white-space: nowrap; }
.mother-select-wrap select {
  width: auto;
  flex: 1 1 200px;
  min-width: 150px;
  max-width: 100%;
}

.mother-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 160px;
  min-width: 150px;
}

.mother-toggle-wrap span {
  flex: 1 1 auto;
}

/* On small screens, force the translate toggle block to its own row
   so it won’t collide with the dropdown */
@media (max-width: 600px) {
  .mother-toggle-wrap {
    flex: 1 1 100%;
    min-width: 100%;
  }
}

.mother-toggle-text {
  display: inline-block;
  margin-left: 6px;
}

.mother-sync-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* Welcome guide overlay */
.welcome-guide {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  z-index: 5000;
  overflow: auto;
}

/* Generic profile @username link pill (mobile) */
.mobile-app-body a.profile-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  color: #0b1220;
  background: rgba(209,213,219,0.92);
  border: 1px solid rgba(148,163,184,0.45);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.1px;
  transition: background .2s ease, transform .05s ease-in-out, box-shadow .2s ease;
}
.mobile-app-body a.profile-link:hover { background: rgba(229,231,235,0.95); box-shadow: 0 2px 8px rgba(0,0,0,0.18); }
.mobile-app-body a.profile-link:active { transform: translateY(1px); }
.mobile-app-body a.profile-link:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(96,165,250,0.45); }

.welcome-guide.hidden {
  display: none !important;
}

.welcome-guide-container {
  position: relative;
  width: min(100%, 440px);
  background: rgba(17, 26, 44, 0.96);
  border: 1px solid rgba(79, 70, 229, 0.35);
  border-radius: 16px;
  padding: 22px 18px 20px;
  color: #f8fafc;
  box-shadow: 0 22px 54px rgba(15, 23, 42, 0.55);
  display: flex;
  flex-direction: column;
  max-height: min(94vh, 620px);
  overflow: hidden;
}

.welcome-guide-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: rgba(226, 232, 240, 0.72);
  font-size: 20px;
  cursor: pointer;
}

.welcome-guide-close:hover,
.welcome-guide-close:focus-visible {
  color: #ffffff;
  outline: none;
}

.welcome-guide-header {
  text-align: center;
  margin-bottom: 16px;
}

.welcome-guide-steps {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-bottom: 16px;
}

.welcome-guide-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(148, 163, 255, 0.35);
  transition: transform 0.2s ease, background 0.2s ease;
}

.welcome-guide-dot.active {
  background: #6366f1;
  transform: scale(1.12);
}

.welcome-guide-subtitle {
  margin: 6px 0 0;
  color: rgba(226, 232, 240, 0.8);
  font-size: 0.95rem;
}

.welcome-guide-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 6px;
}

.guide-step {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-step.hidden {
  display: none;
}

.guide-detected {
  font-size: 0.92rem;
  color: rgba(226, 232, 240, 0.8);
}

.guide-detected strong {
  color: #ffffff;
}

.guide-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guide-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 500;
}

.guide-form select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 255, 0.35);
  background: rgba(17, 24, 39, 0.82);
  color: #f8fafc;
}

.guide-form select:focus-visible {
  outline: 2px solid rgba(129, 140, 248, 0.85);
  outline-offset: 1px;
}

.guide-sync-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.guide-hint {
  margin: 0;
  font-size: 0.86rem;
  color: rgba(226, 232, 240, 0.75);
}

.guide-enh-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.guide-enh-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(129, 140, 248, 0.35);
  background: rgba(79, 70, 229, 0.12);
  color: #e0e7ff;
  flex: 1 1 calc(50% - 10px);
  min-width: 150px;
}

.guide-enh-option input {
  accent-color: #6366f1;
}

.guide-subscribe {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.guide-subscribe a,
.guide-link {
  color: #a5b4fc;
  text-decoration: underline;
  font-weight: 600;
}

.enhancement-card[data-type="english"] .enhancement-content span + span,
.enhancement-card[data-type="vietnamese"] .enhancement-content span + span,
.enhancement-card[data-type="arabic"] .enhancement-content span + span {
  margin-left: 0.25em;
}

.welcome-guide-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-shrink: 0;
}

.guide-nav-buttons {
  display: flex;
  gap: 10px;
}

.guide-btn {
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.guide-btn:focus-visible {
  outline: 2px solid rgba(148, 163, 255, 0.85);
  outline-offset: 2px;
}

.guide-back {
  background: transparent;
  border: 1px solid rgba(148, 163, 255, 0.45);
  color: #e0e7ff;
}

.guide-next {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  color: #ffffff;
}

.guide-skip {
  background: none;
  border: none;
  color: rgba(226, 232, 240, 0.75);
  padding: 0;
  text-decoration: underline;
  font-size: 0.85rem;
}

.guide-skip.hidden {
  display: none !important;
}

.guide-complete-group {
  margin-top: 8px;
}

.guide-complete-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: rgba(226, 232, 240, 0.85);
}

/* Make the settings "Welcome guide completed" row readable on light surfaces */
[data-theme="light"] .guide-complete-row,
[data-theme="vivid"] .guide-complete-row,
[data-theme="bright"] .guide-complete-row {
  color: #0f172a !important;
}

.guide-complete-row input {
  accent-color: #6366f1;
}

[data-theme="light"] .mobile-app-body .friends-chat-header .back-btn,
[data-theme="light"] .mobile-app-body .chat-conv-header .back-btn,
[data-theme="light"] .mobile-app-body .friends-chat-actions button,
[data-theme="light"] .mobile-app-body .group-chat-actions button,
[data-theme="light"] .mobile-app-body .translate-dropdown > .control-button {
  color: #111318;
  border-color: rgba(17,19,24,0.16);
  background-color: rgba(17,19,24,0.06);
}

[data-theme="light"] .mobile-app-body .group-members-more-btn {
  border-color: rgba(17,19,24,0.16);
  background: rgba(17,19,24,0.06);
  color: #111318;
}

[data-theme="light"] .mobile-app-body .friends-chat-header .friend-presence,
[data-theme="light"] .mobile-app-body .friends-chat-header .group-meta,
[data-theme="light"] .mobile-app-body .friends-chat-header .group-meta span {
  color: rgba(17,19,24,0.65);
}

[data-theme="light"] .mobile-app-body .friends-chat-header .group-head-mobile .group-avatar {
  background: rgba(17,19,24,0.08);
  border: 1px solid rgba(17,19,24,0.12);
}

[data-theme="light"] .mobile-app-body .translate-dropdown .dropdown,
[data-theme="light"] .mobile-app-body .group-chat-actions #groupTranslateMenu.dropdown {
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(17,19,24,0.16);
  box-shadow: 0 12px 28px rgba(15,19,24,0.12);
  color: #111318;
}

[data-theme="light"] .mobile-app-body .translate-dropdown .dropdown button,
[data-theme="light"] .mobile-app-body .translate-dropdown .dropdown .dropdown-item,
[data-theme="light"] .mobile-app-body .group-chat-actions #groupTranslateMenu .dropdown-item {
  color: #111318;
}

[data-theme="light"] .mobile-app-body .translate-dropdown .dropdown button:hover,
[data-theme="light"] .mobile-app-body .translate-dropdown .dropdown .dropdown-item:hover,
[data-theme="light"] .mobile-app-body .group-chat-actions #groupTranslateMenu .dropdown-item:hover {
  background: rgba(17,19,24,0.08);
}

/* Bright theme: ensure translation dropdowns are readable (white panel, dark text) */
[data-theme="bright"] .mobile-app-body .translate-dropdown .dropdown,
[data-theme="bright"] .mobile-app-body .group-chat-actions #groupTranslateMenu.dropdown {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 28px rgba(17,24,39,0.10);
  color: #111318;
}
[data-theme="bright"] .mobile-app-body #dmTranslateMenu.dropdown {  /* DM menu */
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 28px rgba(17,24,39,0.10);
  color: #111318;
}
[data-theme="bright"] .mobile-app-body .translate-dropdown .dropdown button,
[data-theme="bright"] .mobile-app-body .translate-dropdown .dropdown .dropdown-item,
[data-theme="bright"] .mobile-app-body .group-chat-actions #groupTranslateMenu .dropdown-item,
[data-theme="bright"] .mobile-app-body #dmTranslateMenu .dropdown-item {
  color: #111318;
}
[data-theme="bright"] .mobile-app-body .translate-dropdown .dropdown button:hover,
[data-theme="bright"] .mobile-app-body .translate-dropdown .dropdown .dropdown-item:hover,
[data-theme="bright"] .mobile-app-body .group-chat-actions #groupTranslateMenu .dropdown-item:hover,
[data-theme="bright"] .mobile-app-body #dmTranslateMenu .dropdown-item:hover {
  background: #f3f4f6;
}

/* Vivid theme: treat as light for dropdown contrast */
[data-theme="vivid"] .mobile-app-body .translate-dropdown .dropdown,
[data-theme="vivid"] .mobile-app-body .group-chat-actions #groupTranslateMenu.dropdown {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 28px rgba(17,24,39,0.10);
  color: #111318;
}
[data-theme="vivid"] .mobile-app-body #dmTranslateMenu.dropdown {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 28px rgba(17,24,39,0.10);
  color: #111318;
}
[data-theme="vivid"] .mobile-app-body .translate-dropdown .dropdown button,
[data-theme="vivid"] .mobile-app-body .translate-dropdown .dropdown .dropdown-item,
[data-theme="vivid"] .mobile-app-body .group-chat-actions #groupTranslateMenu .dropdown-item,
[data-theme="vivid"] .mobile-app-body #dmTranslateMenu .dropdown-item {
  color: #111318;
}
[data-theme="vivid"] .mobile-app-body .translate-dropdown .dropdown button:hover,
[data-theme="vivid"] .mobile-app-body .translate-dropdown .dropdown .dropdown-item:hover,
[data-theme="vivid"] .mobile-app-body .group-chat-actions #groupTranslateMenu .dropdown-item:hover,
[data-theme="vivid"] .mobile-app-body #dmTranslateMenu .dropdown-item:hover {
  background: #f3f4f6;
}

/* Default (Sea Blue) theme: when no data-theme is set, use light dropdown styling */
html:not([data-theme]) body.mobile-app-body .translate-dropdown .dropdown,
html:not([data-theme]) body.mobile-app-body .group-chat-actions #groupTranslateMenu.dropdown {
  background: rgba(255,255,255,0.98);
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 28px rgba(17,24,39,0.10);
  color: #111318;
}
html:not([data-theme]) body.mobile-app-body #dmTranslateMenu.dropdown {
  background: rgba(255,255,255,0.98);
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 28px rgba(17,24,39,0.10);
  color: #111318;
}
html:not([data-theme]) body.mobile-app-body .translate-dropdown .dropdown button,
html:not([data-theme]) body.mobile-app-body .translate-dropdown .dropdown .dropdown-item,
html:not([data-theme]) body.mobile-app-body .group-chat-actions #groupTranslateMenu .dropdown-item,
html:not([data-theme]) body.mobile-app-body #dmTranslateMenu .dropdown-item {
  color: #111318;
}
html:not([data-theme]) body.mobile-app-body .translate-dropdown .dropdown button:hover,
html:not([data-theme]) body.mobile-app-body .translate-dropdown .dropdown .dropdown-item:hover,
html:not([data-theme]) body.mobile-app-body .group-chat-actions #groupTranslateMenu .dropdown-item:hover,
html:not([data-theme]) body.mobile-app-body #dmTranslateMenu .dropdown-item:hover {
  background: rgba(17,19,24,0.08);
}

/* Dawn theme and other light variants (legacy, aurora): use light dropdown style */
[data-theme="dawn"] .mobile-app-body .translate-dropdown .dropdown,
[data-theme="dawn"] .mobile-app-body .group-chat-actions #groupTranslateMenu.dropdown,
[data-theme="dawn"] .mobile-app-body #dmTranslateMenu.dropdown,
[data-theme="legacy"] .mobile-app-body .translate-dropdown .dropdown,
[data-theme="legacy"] .mobile-app-body .group-chat-actions #groupTranslateMenu.dropdown,
[data-theme="legacy"] .mobile-app-body #dmTranslateMenu.dropdown,
[data-theme="aurora"] .mobile-app-body .translate-dropdown .dropdown,
[data-theme="aurora"] .mobile-app-body .group-chat-actions #groupTranslateMenu.dropdown,
[data-theme="aurora"] .mobile-app-body #dmTranslateMenu.dropdown {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 28px rgba(17,24,39,0.10);
  color: #111318;
}
[data-theme="dawn"] .mobile-app-body .translate-dropdown .dropdown button,
[data-theme="dawn"] .mobile-app-body .translate-dropdown .dropdown .dropdown-item,
[data-theme="dawn"] .mobile-app-body .group-chat-actions #groupTranslateMenu .dropdown-item,
[data-theme="dawn"] .mobile-app-body #dmTranslateMenu .dropdown-item,
[data-theme="legacy"] .mobile-app-body .translate-dropdown .dropdown button,
[data-theme="legacy"] .mobile-app-body .translate-dropdown .dropdown .dropdown-item,
[data-theme="legacy"] .mobile-app-body .group-chat-actions #groupTranslateMenu .dropdown-item,
[data-theme="legacy"] .mobile-app-body #dmTranslateMenu .dropdown-item,
[data-theme="aurora"] .mobile-app-body .translate-dropdown .dropdown button,
[data-theme="aurora"] .mobile-app-body .translate-dropdown .dropdown .dropdown-item,
[data-theme="aurora"] .mobile-app-body .group-chat-actions #groupTranslateMenu .dropdown-item,
[data-theme="aurora"] .mobile-app-body #dmTranslateMenu .dropdown-item {
  color: #111318;
}
[data-theme="dawn"] .mobile-app-body .translate-dropdown .dropdown button:hover,
[data-theme="dawn"] .mobile-app-body .translate-dropdown .dropdown .dropdown-item:hover,
[data-theme="dawn"] .mobile-app-body .group-chat-actions #groupTranslateMenu .dropdown-item:hover,
[data-theme="dawn"] .mobile-app-body #dmTranslateMenu .dropdown-item:hover,
[data-theme="legacy"] .mobile-app-body .translate-dropdown .dropdown button:hover,
[data-theme="legacy"] .mobile-app-body .translate-dropdown .dropdown .dropdown-item:hover,
[data-theme="legacy"] .mobile-app-body .group-chat-actions #groupTranslateMenu .dropdown-item:hover,
[data-theme="legacy"] .mobile-app-body #dmTranslateMenu .dropdown-item:hover,
[data-theme="aurora"] .mobile-app-body .translate-dropdown .dropdown button:hover,
[data-theme="aurora"] .mobile-app-body .translate-dropdown .dropdown .dropdown-item:hover,
[data-theme="aurora"] .mobile-app-body .group-chat-actions #groupTranslateMenu .dropdown-item:hover,
[data-theme="aurora"] .mobile-app-body #dmTranslateMenu .dropdown-item:hover {
  background: #f3f4f6;
}

[data-theme="light"] .mobile-app-body .friends-chat-composer {
  background: rgba(255,255,255,0.92);
  border-top: 1px solid rgba(17,19,24,0.12);
  color: #111318;
}

[data-theme="light"] .mobile-app-body .friends-chat-composer textarea {
  background: rgba(17,19,24,0.05);
  border-color: rgba(17,19,24,0.18);
  color: #111318;
}

[data-theme="light"] .mobile-app-body .friends-chat-composer textarea::placeholder {
  color: rgba(17,19,24,0.55);
}

[data-theme="light"] .mobile-app-body .friends-chat-composer .dm-actions button,
[data-theme="light"] .mobile-app-body .friends-chat-composer .dm-actions .control-button {
  color: #111318;
}

[data-theme="light"] .mobile-app-body #dmPalettePanel,
[data-theme="light"] .mobile-app-body #groupPalettePanel {
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(17,19,24,0.16);
  color: #111318;
}

[data-theme="light"] .mobile-app-body #dmPalettePanel .setting-group h4,
[data-theme="light"] .mobile-app-body #groupPalettePanel .setting-group h4 {
  color: #111318;
}

[data-theme="light"] .mobile-app-body .bottom-nav .nav-item .nav-icon {
  color: inherit;
}

@media (max-width: 520px) {
  .welcome-guide-container {
    width: 100%;
    border-radius: 0;
    border-width: 0;
    padding: 22px 16px 18px;
    max-height: calc(100vh - 20px);
  }
  .guide-enh-option {
    flex: 1 1 100%;
    min-width: 0;
  }
  .welcome-guide-body {
    padding-right: 4px;
  }
}
