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

.boot-guard-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

body {
  background: #0a0a0a;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 16px 90px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.brand h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 1px;
}

.brand p {
  font-size: 11px;
  letter-spacing: 2px;
  color: #888;
  margin-top: 4px;
}

.menu-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 12px;
  border-radius: 24px;
  border: none;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  text-align: center;
}

.tab.active {
  background: #fff;
  color: #000;
}

.tab:not(.active) {
  background: #1c1c1c;
  color: #fff;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.fav-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fav-btn.active {
  color: #ff4d6d;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal {
  background: #141414;
  border-radius: 20px;
  padding: 28px 24px;
  width: 100%;
  max-width: 360px;
}

.modal h2 {
  font-size: 22px;
  margin-bottom: 6px;
}

.modal p {
  color: #888;
  margin-bottom: 20px;
  font-size: 14px;
}

.modal input {
  width: 100%;
  padding: 14px;
  margin-bottom: 12px;
  border-radius: 12px;
  border: 1px solid #333;
  background: #1c1c1c;
  color: #fff;
  font-size: 16px;
}

.modal button {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  margin-top: 8px;
}

#login-btn {
  background: #fff;
  color: #000;
}

.secondary-btn {
  background: transparent;
  color: #888;
}

.error-msg {
  color: #ff4d6d;
  font-size: 13px;
  margin-top: 8px;
}

.hidden {
  display: none !important;
}

.loading {
  text-align: center;
  padding: 40px;
  color: #888;
}

.new-chat-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: #1c1c1c;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  margin-bottom: 16px;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: #141414;
  margin-bottom: 8px;
  cursor: pointer;
}

.conversation-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

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

.conversation-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-preview {
  font-size: 13px;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 12px;
  border-bottom: 1px solid #222;
}

.thread-header button {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

#thread-username {
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.1px;
}

.thread-status-text {
  font-weight: 400;
  letter-spacing: 0.1px;
  font-size: 10px;
  -webkit-text-stroke: 0.3px rgba(255,255,255,0.3);
}

#message-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 300px;
  padding-bottom: 12px;
}

.msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}

.msg-bubble.mine {
  align-self: flex-end;
  background: #fff;
  color: #000;
  border-bottom-right-radius: 4px;
}

.msg-bubble.theirs {
  align-self: flex-start;
  background: #1c1c1c;
  color: #fff;
  border-bottom-left-radius: 4px;
}

.message-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: #0a0a0a;
  padding: 12px 0;
}

.message-input-row textarea {
  flex: 1;
  height: 40px;
  max-height: 100px;
  padding: 9px 16px;
  border-radius: 20px;
  border: 1px solid #333;
  background: #1c1c1c;
  color: #fff;
  font-size: 16px;
  font-family: inherit;
  line-height: 20px;
  box-sizing: border-box;
  resize: none;
  overflow-y: hidden;
}

.message-input-row button:not(.icon-circle-btn) {
  padding: 12px 20px;
  border-radius: 24px;
  border: none;
  background: #fff;
  color: #000;
  font-weight: 700;
  cursor: pointer;
}

.msg-status {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  vertical-align: middle;
}

.msg-status svg {
  width: 14px;
  height: 14px;
}

.status-sending {
  width: 10px;
  height: 10px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: rgba(0,0,0,0.8);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

.status-check { color: rgba(0,0,0,0.5); }
.status-check.read { color: #2b7fff; }

.conversation-preview.unread {
  color: #fff;
  font-weight: 600;
}

.unread-badge {
  background: #ff4d6d;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  flex-shrink: 0;
}

.conversation-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.conversation-time {
  font-size: 11px;
  color: #8a8a8a;
}

body.chat-open .app > header,
body.chat-open #main-tabs {
  display: none;
}

body.chat-open .app {
  padding: 0;
  max-width: 100%;
}

body.chat-open #chat-view {
  display: block;
}

#thread-view.fullscreen {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
}

#thread-view.fullscreen .thread-header {
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
  margin-bottom: 0;
  border-bottom: 1px solid #1a1a1a;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.thread-title-block {
  flex: 1;
  min-width: 0;
}

.thread-call-btn {
  margin-left: auto;
}

#thread-view.fullscreen .thread-header button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #1c1c1c;
}

.thread-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.message-list-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#thread-view.fullscreen #message-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  min-height: 0;
}

.scroll-to-bottom-btn {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(28,28,28,0.9);
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  animation: scrollBtnPopIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scroll-to-bottom-btn.hidden {
  display: none;
}

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

@keyframes scrollBtnPopIn {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

.scroll-to-bottom-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: #5b8def;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: reactionPop 0.2s ease;
}

.scroll-to-bottom-badge.hidden {
  display: none;
}

#thread-view.fullscreen .message-input-row {
  flex-shrink: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid #1a1a1a;
  margin-top: 0;
}

#conversation-list-view.fullscreen {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #0a0a0a;
  padding: calc(20px + env(safe-area-inset-top)) 16px 20px;
  max-width: 480px;
  margin: 0 auto;
  overflow-y: auto;
}

.chat-list-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.chat-list-header button {
  background: #1c1c1c;
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}

.chat-list-header h2 {
  font-size: 22px;
  font-weight: 800;
}

#friends-view {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #0a0a0a;
  padding: calc(20px + env(safe-area-inset-top)) 16px 20px;
  max-width: 480px;
  margin: 0 auto;
  overflow-y: auto;
}

.icon-btn-right {
  margin-left: auto;
  background: #1c1c1c;
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#friends-search-row {
  margin: 16px 0;
}

#friends-search-row input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 24px;
  border: 1px solid #333;
  background: #1c1c1c;
  color: #fff;
  font-size: 16px;
}

.search-result-item, .friend-item, .request-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #141414;
  margin-bottom: 8px;
}

.friend-item-info, .request-item-info {
  flex: 1;
  min-width: 0;
}

.friend-item-name {
  font-weight: 600;
  font-size: 15px;
}

.friend-item-username {
  font-size: 13px;
  color: #888;
}

.pill-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: none;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.pill-btn.accept {
  background: #fff;
  color: #000;
}

.pill-btn.decline, .pill-btn.cancel {
  background: #1c1c1c;
  color: #888;
}

.pill-btn.add {
  background: #fff;
  color: #000;
}

.pill-btn.pending {
  background: #1c1c1c;
  color: #666;
  cursor: default;
}

.friends-subheading {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  margin: 20px 0 10px;
}

.icon-circle-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1c1c1c;
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s ease, background 0.15s ease;
}

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

.icon-circle-btn:active {
  transform: scale(0.9);
  background: #2a2a2a;
}

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

.icon-btn-right:active,
.pill-btn:active,
.tab:active,
.new-chat-btn:active,
#send-btn:active {
  transform: scale(0.95);
}

.icon-btn-right,
.pill-btn,
.tab,
.new-chat-btn,
#send-btn {
  transition: transform 0.1s ease;
}

.send-mic-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: #fff;
  color: #000;
}

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

.send-mic-btn:active {
  background: #eee;
}

#send-btn.send-mic-btn {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
}

#send-btn.send-mic-btn svg {
  width: 18px !important;
  height: 18px !important;
}

#profile-view {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: #0a0a0a;
  padding: calc(20px + env(safe-area-inset-top)) 16px 20px;
  max-width: 480px;
  margin: 0 auto;
  overflow-y: auto;
}

.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 24px 0 32px;
}

.profile-avatar-large {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 36px;
  color: #fff;
  overflow: hidden;
}

.profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.secondary-btn-small {
  background: #1c1c1c;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.profile-avatar-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* The picker for ready-made avatars (Profile > Choose avatar). */
.avatar-picker-hint { font-size: 13px; opacity: 0.7; margin: 0 0 4px; }
.avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 14px 0;
  padding: 4px;
  max-height: 46vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* (The #id in front outranks the general rule that turns every pop-up button into a wide white one.) */
#avatar-picker-modal .avatar-picker-item {
  width: 100%;
  padding: 0;
  margin: 0;
  border: 2px solid transparent;
  background: #1c1c1c;
  border-radius: 50%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#avatar-picker-modal .avatar-picker-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
#avatar-picker-modal .avatar-picker-item:not(:disabled):active { transform: scale(0.94); }
#avatar-picker-modal .avatar-picker-item:disabled { opacity: 0.45; cursor: default; }

.profile-field {
  margin-bottom: 18px;
}

.profile-field label {
  display: block;
  font-size: 13px;
  color: #888;
  margin-bottom: 6px;
}

.profile-field input {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #333;
  background: #1c1c1c;
  color: #fff;
  font-size: 16px;
}

.profile-readonly {
  padding: 14px;
  border-radius: 12px;
  background: #141414;
  color: #888;
  font-size: 16px;
}

.skeleton {
  background: linear-gradient(90deg, #1c1c1c 25%, #262626 37%, #1c1c1c 63%);
  background-size: 400% 100%;
  animation: skeleton-pulse 1.4s ease infinite;
}

@keyframes skeleton-pulse {
  0% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.skeleton-text {
  height: 16px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.recording-active {
  background: #ff4d4d !important;
  animation: recording-pulse 1s ease-in-out infinite;
}

@keyframes recording-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.recording-indicator {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: #1c1c1c;
  border-radius: 24px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 200;
  max-width: 480px;
}

.recording-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff4d4d;
  animation: recording-pulse 1s ease-in-out infinite;
}

.recording-timer {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  min-width: 40px;
}

.recording-hint {
  font-size: 12px;
  color: #888;
}

.voice-msg-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.voice-play-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.msg-bubble.mine .voice-play-btn {
  background: #000;
  color: #fff;
}

.msg-bubble.theirs .voice-play-btn {
  background: #fff;
  color: #000;
}

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

.voice-waveform {
  flex: 1;
  height: 24px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.voice-waveform-bar {
  flex: 1;
  background: currentColor;
  opacity: 0.4;
  border-radius: 2px;
  min-height: 3px;
}

.voice-duration {
  font-size: 12px;
  opacity: 0.7;
  flex-shrink: 0;
}

.voice-loading {
  font-size: 12px;
  opacity: 0.6;
}

.msg-time {
  font-size: 10px;
  opacity: 0.5;
  margin-top: 2px;
  display: block;
}

.msg-bubble.mine .msg-time {
  text-align: right;
}

.date-divider {
  text-align: center;
  margin: 16px 0;
}

.date-divider span {
  background: #1c1c1c;
  color: #888;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 12px;
  display: inline-block;
}

.avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 12px;
  height: 12px;
  background: #4caf7d;
  border: 2px solid #0a0a0a;
  border-radius: 50%;
}

.thread-header .online-dot {
  border-color: #0a0a0a;
}

.thread-status-text {
  color: #888;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  direction: rtl;
  text-align: left;
  unicode-bidi: plaintext;
}

.thread-status-text.online {
  color: #4caf7d;
}

.thread-title-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.attach-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: #fff;
  color: #000;
}

.attach-btn svg {
  width: 18px;
  height: 18px;
  stroke: #000 !important;
}

.attach-menu {
  position: absolute;
  bottom: 70px;
  left: 16px;
  background: #1c1c1c;
  border-radius: 16px;
  padding: 8px;
  z-index: 60;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.attach-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 10px;
  text-align: left;
}

.attach-menu-item:active {
  background: #262626;
}

.attach-menu-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.file-msg-bubble {
  display: flex;
  gap: 12px;
  min-width: 220px;
  max-width: 260px;
}

.file-upload-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.msg-bubble.theirs .file-upload-icon {
  background: rgba(255,255,255,0.08);
}

.file-preview-area {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.15);
}

.file-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-msg-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.file-msg-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-msg-meta {
  font-size: 11px;
  opacity: 0.6;
}

.file-progress-track {
  height: 4px;
  background: rgba(0,0,0,0.15);
  border-radius: 2px;
  overflow: hidden;
  margin: 2px 0;
}

.msg-bubble.theirs .file-progress-track {
  background: rgba(255,255,255,0.15);
}

.file-progress-fill {
  height: 100%;
  background: currentColor;
  transition: width 0.2s ease;
}

.file-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.file-actions .pill-btn {
  padding: 5px 12px;
  font-size: 11px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.96);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img,
.lightbox-content video {
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  touch-action: pinch-zoom pan-x pan-y;
}

.lightbox-close-btn, .lightbox-save-btn {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 501;
  cursor: pointer;
}

.lightbox-close-btn { left: 16px; }
.lightbox-save-btn { right: 16px; }

.lightbox-close-btn svg, .lightbox-save-btn svg {
  width: 20px;
  height: 20px;
}

/* WhatsApp-style image/video bubble */
.media-msg-bubble {
  padding: 3px;
  width: 226px;
  cursor: pointer;
  position: relative;
}

.media-msg-img-wrap {
  position: relative;
  border-radius: 13px;
  overflow: hidden;
  background: rgba(255,255,255,0.05);
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-msg-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: blur(8px);
  transform: scale(1.02);
  transition: filter 0.3s ease;
}

.media-msg-img-wrap img.loaded {
  filter: blur(0);
}

.media-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-play-overlay svg {
  width: 22px;
  height: 22px;
  fill: white;
}

.media-msg-caption {
  position: absolute;
  bottom: 6px;
  right: 8px;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.msg-skeleton-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}

.msg-skeleton-bubble {
  height: 38px;
  border-radius: 16px;
  max-width: 65%;
}

.msg-skeleton-bubble.theirs {
  align-self: flex-start;
  width: 45%;
}

.msg-skeleton-bubble.mine {
  align-self: flex-end;
  width: 38%;
}

#message-list {
  position: relative;
}

.thread-skeleton-overlay {
  position: absolute;
  inset: 0;
  background: #0a0a0a;
  z-index: 5;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity 0.15s ease;
}

.thread-skeleton-overlay.fading {
  opacity: 0;
  pointer-events: none;
}

.thread-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: auto;
}

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

.msg-enter-anim {
  animation: msgFadeInUp 0.25s ease both;
}

/* Spinner at the top of a chat while older messages load. The row is there
   whenever more history exists and only shows while a page is coming in. */
.older-loader {
  align-self: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin: 4px 0;
  border-radius: 50%;
  background: rgba(28, 28, 28, 0.9);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.older-loader.spinning {
  opacity: 1;
  transform: scale(1);
}

.older-loader span {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.18);
  border-top-color: #fff;
  border-radius: 50%;
}

.older-loader.spinning span {
  animation: spin 0.8s linear infinite;
}

/* Older messages settle in from above once their page arrives. */
@keyframes msgFadeInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-older-anim {
  animation: msgFadeInDown 0.3s ease both;
}

.call-screen {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
}

.call-avatar-wrap {
  margin-bottom: 20px;
}

.call-avatar-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 44px;
  color: #fff;
  overflow: hidden;
}

.call-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.call-remote-name {
  color: #fff;
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
}

.call-status-text {
  color: #888;
  font-size: 15px;
  margin-bottom: 40px;
}

.call-remote-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.call-local-video {
  position: absolute;
  bottom: 120px;
  right: 16px;
  width: 100px;
  height: 140px;
  border-radius: 12px;
  object-fit: cover;
  z-index: 3;
  border: 2px solid rgba(255,255,255,0.2);
}

.call-actions {
  position: absolute;
  bottom: calc(40px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 24px;
  z-index: 5;
}

.call-action-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.call-action-btn svg {
  width: 26px;
  height: 26px;
}

.call-action-btn.accept {
  background: #4caf7d;
}

.call-action-btn.decline {
  background: #e74c3c;
}

.call-action-btn.small {
  width: 52px;
  height: 52px;
  background: rgba(255,255,255,0.15);
}

.call-action-btn.small.active {
  background: #fff;
}

.call-action-btn.small.active svg {
  stroke: #000 !important;
  fill: #000 !important;
}

.msg-action-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  max-width: 480px;
  margin: 0 auto;
}

.msg-action-sheet {
  width: 100%;
  background: #141414;
  border-radius: 20px 20px 0 0;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.msg-action-overlay.open .msg-action-sheet {
  transform: translateY(0);
}

.msg-action-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.msg-action-item:active {
  background: #1c1c1c;
}

.msg-action-item.danger {
  color: #e74c3c;
}

.msg-action-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.msg-bubble.selected-for-action {
  position: relative;
  z-index: 251;
  transform: scale(1.05);
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.msg-focus-backdrop {
  position: fixed;
  inset: 0;
  z-index: 240;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.22s ease-out;
  pointer-events: none;
}

.msg-focus-backdrop.show {
  opacity: 1;
}

.msg-bubble {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.msg-bubble img,
.msg-bubble video {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: auto;
}

.msg-bubble.deleted-placeholder {
  display: flex;
  align-items: center;
  gap: 6px;
  font-style: italic;
  opacity: 0.6;
  font-size: 13px;
}

.msg-bubble.deleted-placeholder svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.typing-indicator-bubble {
  align-self: flex-start;
  background: #1c1c1c;
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  gap: 4px;
  align-items: center;
  width: fit-content;
  animation: indicatorPopIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom left;
}

@keyframes indicatorPopIn {
  from { opacity: 0; transform: translateY(10px) scale(0.85); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes indicatorPopOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(6px) scale(0.85); }
}

.typing-indicator-bubble.indicator-leaving {
  animation: indicatorPopOut 0.18s ease forwards;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #999;
  animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-of-type(2) { animation-delay: 0.15s; }
.typing-dot:nth-of-type(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.recording-indicator-bubble svg {
  color: #ff4444;
  animation: recordingPulse 1.2s infinite ease-in-out;
}

@keyframes recordingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.reply-preview-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1c1c1c;
  border-radius: 12px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.reply-preview-accent {
  width: 3px;
  align-self: stretch;
  background: #5b8def;
  border-radius: 2px;
  flex-shrink: 0;
}

.reply-preview-content {
  flex: 1;
  min-width: 0;
}

.reply-preview-name {
  font-size: 12px;
  font-weight: 600;
  color: #5b8def;
}

.reply-preview-text {
  font-size: 12px;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-preview-cancel {
  background: none;
  border: none;
  color: #888;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reply-preview-cancel svg {
  width: 16px;
  height: 16px;
}

.msg-quoted-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.15);
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 6px;
  cursor: pointer;
}

.msg-bubble.theirs .msg-quoted-strip {
  background: rgba(255,255,255,0.08);
}

.msg-quoted-accent {
  width: 3px;
  align-self: stretch;
  background: #5b8def;
  border-radius: 2px;
  flex-shrink: 0;
}

.msg-quoted-content {
  flex: 1;
  min-width: 0;
}

.msg-quoted-name {
  font-size: 11px;
  font-weight: 600;
  color: #5b8def;
}

.msg-quoted-text {
  font-size: 12px;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes highlightPulse {
  0%, 100% { background: transparent; }
  30% { background: rgba(91,141,239,0.3); }
}

.msg-bubble.highlight-jump {
  animation: highlightPulse 1s ease;
}

.msg-bubble {
  position: relative;
  transition: transform 0.15s ease, padding-bottom 0.15s ease;
}

.swipe-reply-icon {
  position: absolute;
  left: -34px;
  top: 50%;
  transform: translateY(-50%) scale(0.5);
  opacity: 0;
  transition: opacity 0.1s ease, transform 0.1s ease;
  color: #5b8def;
  pointer-events: none;
}

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

.reaction-popover {
  position: fixed;
  background: #1c1c1c;
  border-radius: 30px;
  padding: 8px 10px;
  display: flex;
  gap: 6px;
  z-index: 310;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  transform: scale(0.7);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.18s ease-out;
}

.reaction-popover.open {
  transform: scale(1);
  opacity: 1;
}

.reaction-popover-emoji {
  font-size: 26px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  transition: transform 0.1s ease;
  line-height: 1;
}

.reaction-popover-emoji:active {
  transform: scale(1.3);
}

/* Reserves room for the badge inside the bubble's own box instead of letting
   it float past the bottom edge, where it used to overlap the next bubble in
   a tightly-grouped run of messages. The eased padding-bottom transition on
   .msg-bubble above makes that extra room appear smoothly, not as a jump. */
.msg-bubble.has-reaction {
  padding-bottom: 26px;
}

.msg-reaction-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: #1c1c1c;
  border: 1.5px solid #0a0a0a;
  border-radius: 10px;
  padding: 0px 4px;
  font-size: 10px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 1px;
  cursor: pointer;
}

.msg-bubble.theirs .msg-reaction-badge {
  right: auto;
  left: 8px;
}

.msg-reaction-count {
  font-size: 10px;
  color: #aaa;
  font-weight: 600;
}

.reaction-popover,
.msg-action-sheet,
.msg-action-overlay {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.incoming-call-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 700;
  max-width: 480px;
  margin: 0 auto;
  background: #1c1c1c;
  padding: calc(12px + env(safe-area-inset-top)) 14px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

.incoming-call-banner.show {
  transform: translateY(0);
}

.banner-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.banner-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.banner-name {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.banner-subtext {
  color: #999;
  font-size: 12px;
}

/* A notice at the top of the app for a message that arrives while the person is not looking at that chat
   (people on the 'normal' notification setting; see inAppNotice.js). Solid, not translucent: no backdrop blur. */
.in-app-notice {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 650;
  max-width: 480px;
  margin: 0 auto;
  background: #1c1c1c;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  transform: translateY(-100%);
  transition: transform 0.25s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.in-app-notice.show {
  transform: translateY(0);
}

.in-app-notice-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8a8a8a;
  font-size: 24px;
  line-height: 1;
}

.banner-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.banner-btn.accept {
  background: #4caf7d;
}

.banner-btn.decline {
  background: #e74c3c;
}

.call-log-bubble {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  opacity: 0.85;
}

.call-log-bubble.missed {
  color: #e74c3c;
}

.call-log-bubble svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

.secondary-btn .btn-spinner,
.danger-btn .btn-spinner {
  border-color: rgba(255,255,255,0.25);
  border-top-color: #fff;
}

.avatar-img-fade {
  opacity: 0;
  transition: opacity 0.25s ease;
}

.avatar-img-fade.loaded {
  opacity: 1;
}

@keyframes bubbleArrive {
  0% { opacity: 0; transform: translateY(16px) scale(0.92); }
  60% { opacity: 1; transform: translateY(-2px) scale(1.015); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.msg-bubble-arrive {
  animation: bubbleArrive 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom center;
}

@keyframes reactionPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); }
}

.msg-reaction-badge.pop-in {
  animation: reactionPop 0.3s ease;
}

.profile-field-hint {
  font-size: 11px;
  color: #777;
  margin-top: 4px;
}

.username-input-wrap {
  position: relative;
}

.username-status-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  margin-top: -8px;
  font-size: 16px;
  pointer-events: none;
  line-height: 16px;
}

.username-status-icon.valid {
  color: #4caf7d;
}

.username-status-icon.invalid {
  color: #e74c3c;
}

.username-status-text {
  font-size: 11px;
  margin-top: 4px;
}

.username-status-text.valid {
  color: #4caf7d;
}

.username-status-text.invalid {
  color: #e74c3c;
}

.username-status-icon.btn-spinner {
  width: 13px;
  height: 13px;
  margin-right: 0;
  border-color: rgba(255,255,255,0.25);
  border-top-color: #fff;
}

.caption-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: #000;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
}

.caption-cancel-btn {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  left: 14px;
  z-index: 5;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.caption-preview-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 60px 16px;
}

.caption-preview-area img,
.caption-preview-area video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.caption-preview-area .file-preview-generic {
  color: #fff;
  text-align: center;
  padding: 30px;
}

.caption-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: #0a0a0a;
}

.caption-viewonce-btn,
.caption-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.caption-viewonce-btn {
  background: rgba(255,255,255,0.12);
}

.caption-viewonce-btn.active {
  background: #5b8def;
}

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

.caption-send-btn {
  background: #5b8def;
}

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

#caption-text-input {
  flex: 1;
  min-width: 0;
  background: #1c1c1c;
  border: none;
  border-radius: 22px;
  padding: 11px 16px;
  color: #fff;
  font-size: 15px;
}

#caption-text-input:focus {
  outline: none;
}

.media-msg-caption-text {
  padding: 6px 4px 2px;
  font-size: 14px;
  color: inherit;
  word-break: break-word;
}

.file-msg-caption-text {
  font-size: 13px;
  color: inherit;
  opacity: 0.75;
  margin-top: 4px;
  word-break: break-word;
}

.edited-label {
  font-size: 11px;
  opacity: 0.6;
  font-style: italic;
  margin-left: 2px;
}

.forward-friends-list {
  max-height: 300px;
  overflow-y: auto;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.forward-friend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  cursor: pointer;
  border-radius: 10px;
}

.forward-friend-item:active {
  background: #1c1c1c;
}

.forwarded-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  opacity: 0.6;
  font-style: italic;
  margin-bottom: 3px;
}

.forwarded-label svg {
  width: 11px;
  height: 11px;
}

.forward-progress {
  text-align: center;
  padding: 30px 10px;
}

.forward-progress-percent {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.forward-progress-label {
  font-size: 13px;
  color: #888;
}

.forward-progress-track {
  height: 6px;
  background: #1c1c1c;
  border-radius: 3px;
  margin-top: 16px;
  overflow: hidden;
}

.forward-progress-fill {
  height: 100%;
  background: #5b8def;
  transition: width 0.15s ease;
  width: 0%;
}

.caption-hd-btn {
  height: 42px;
  padding: 0 12px;
  border-radius: 21px;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.caption-hd-btn.active {
  background: #5b8def;
}

.caption-size-badge {
  position: absolute;
  bottom: 76px;
  right: 24px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  z-index: 5;
}

.caption-compress-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
}

.caption-compress-label {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.view-once-bubble {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  cursor: pointer;
}

.view-once-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #5b8def;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.view-once-icon svg {
  width: 18px;
  height: 18px;
}

.view-once-label {
  font-size: 14px;
}

.view-once-bubble.opened {
  cursor: default;
  opacity: 0.6;
}

.view-once-bubble.opened .view-once-icon {
  background: #444;
}

.media-upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
}

.media-upload-ring {
  width: 44px;
  height: 44px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-upload-ring-track {
  fill: none;
  stroke: rgba(255,255,255,0.25);
  stroke-width: 3;
}

.media-upload-ring-progress {
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.25s linear;
}

.media-upload-percent {
  position: absolute;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.thread-header-tap-area {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.contact-info-name {
  font-size: 20px;
  font-weight: 700;
  margin-top: 10px;
}

.contact-info-username {
  font-size: 14px;
  color: #888;
  margin-top: 2px;
}

.contact-info-actions {
  display: flex;
  justify-content: center;
  gap: 30px;
  padding: 24px 0;
}

.contact-info-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: #5b8def;
  font-size: 12px;
}

.contact-info-action-btn svg {
  width: 24px;
  height: 24px;
  padding: 12px;
  background: #1c1c1c;
  border-radius: 50%;
  box-sizing: content-box;
}

.contact-info-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid #1c1c1c;
}

.contact-info-list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: none;
  border: none;
  border-bottom: 1px solid #1c1c1c;
  color: #fff;
  font-size: 15px;
  text-align: left;
}

.contact-info-list-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.contact-info-list-item.danger {
  color: #e74c3c;
}

#contact-info-view {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: #0a0a0a;
  padding: calc(20px + env(safe-area-inset-top)) 16px 20px;
  max-width: 480px;
  margin: 0 auto;
  overflow-y: auto;
}


.main-menu-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 78%;
  max-width: 320px;
  background: #0a0a0a;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: calc(20px + env(safe-area-inset-top)) 0 20px;
  display: flex;
  flex-direction: column;
}

#main-menu-overlay.open .main-menu-drawer {
  transform: translateX(0);
}

.main-menu-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px 24px;
  border-bottom: 1px solid #1c1c1c;
}

.main-menu-header-tappable {
  cursor: pointer;
}

.main-menu-header-tappable:active {
  opacity: 0.7;
}

.main-menu-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  flex-shrink: 0;
  background: #333;
}

.main-menu-name {
  font-size: 16px;
  font-weight: 700;
}

.main-menu-status {
  font-size: 13px;
  color: #888;
  margin-top: 2px;
}

.main-menu-list {
  padding-top: 8px;
}

.main-menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 14px 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 15px;
  text-align: left;
}

.main-menu-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.main-menu-legal-link {
  display: block;
  margin-top: auto;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  text-decoration: none;
}

.main-menu-legal-link:hover {
  color: rgba(255, 255, 255, 0.75);
}

.header-right-btns {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== Lifecolo — Live / Breathing UI (v3: header-only containment) ===== */

html, body {
  overflow-x: hidden;
}

@keyframes lc-breathe {
  0%, 100% { transform: scale(1); opacity: 0.35; }
  50% { transform: scale(1.18); opacity: 0.6; }
}
@keyframes lc-breathe2 {
  0%, 100% { transform: scale(1.1); opacity: 0.3; }
  50% { transform: scale(0.92); opacity: 0.5; }
}

header {
  position: relative;
  overflow: hidden;
}

header::before,
header::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 999px;
  filter: blur(30px);
  pointer-events: none;
}

header::before {
  top: -10px;
  left: -10px;
  width: 90px;
  height: 90px;
  background: #5b8def;
  opacity: 0.45;
}

header::after {
  top: -10px;
  right: -10px;
  width: 90px;
  height: 90px;
  background: #ff4d6d;
  opacity: 0.4;
}

@keyframes lc-tabglow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.25); }
  50% { box-shadow: 0 0 14px 2px rgba(255,255,255,0.35); }
}

.tab.active {
  box-shadow: 0 0 12px 1px rgba(255,255,255,0.28);
}

@keyframes lc-cardfloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes lc-shimmer {
  0% { transform: translateX(-120%) skewX(-12deg); }
  100% { transform: translateX(220%) skewX(-12deg); }
}

@keyframes lc-heartpulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.fav-btn.active {
  animation: lc-heartpulse 0.5s ease-in-out 1;
}

@keyframes lc-dotpulse {
  0% { box-shadow: 0 0 0 0 rgba(76,175,125,0.6); }
  70% { box-shadow: 0 0 0 8px rgba(76,175,125,0); }
  100% { box-shadow: 0 0 0 0 rgba(76,175,125,0); }
}

.online-dot {
  animation: lc-dotpulse 1.6s ease-out 1;
}

@keyframes lc-inputglow {
  0%, 100% { border-color: #333; box-shadow: 0 0 0 0 rgba(91,141,239,0); }
  50% { border-color: #5b8def; box-shadow: 0 0 0 3px rgba(91,141,239,0.15); }
}

.message-input-row textarea {
  animation: lc-inputglow 3.6s ease-in-out infinite;
}

@keyframes lc-sendpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.25); }
  50% { box-shadow: 0 0 14px 3px rgba(255,255,255,0.35); }
}

.send-mic-btn {
  animation: lc-sendpulse 2.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  header::before, header::after, .tab.active, .fav-btn.active, .online-dot,
  .message-input-row textarea, .send-mic-btn {
    animation: none !important;
  }
}
/* ===== end Live / Breathing UI ===== */


@media (min-width: 720px) {
  body:not(.chat-open) .app {
    max-width: 1200px;
    padding-left: 32px;
    padding-right: 32px;
  }

  

  
}

/* ===== UI polish (Sept 2026) ===== */

/* Every main action in a pop-up reads as a button, not just "Sign In". */
.modal button:not(.secondary-btn):not(.password-toggle-btn) {
  background: #fff;
  color: #000;
  transition: transform 0.12s ease, opacity 0.2s ease;
}
.modal button:disabled { opacity: 0.5; cursor: default; }
.modal button:not(:disabled):active { transform: scale(0.98); }
.modal .secondary-btn { transition: color 0.15s ease, background-color 0.15s ease; }
.modal .secondary-btn:hover { color: #ccc; }

/* One rhythm for all pop-ups. */
.modal h2 { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.modal p { line-height: 1.5; margin-bottom: 14px; }
.modal .error-msg:empty,
.modal [data-backup-status]:empty,
.modal [data-approve-error]:empty { display: none; }
.modal .modal-center { text-align: center; }

/* Pop-ups rise in like a sheet; the backdrop fades. */
@keyframes lc-overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes lc-sheet-in {
  from { opacity: 0; transform: translateY(28px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-overlay:not(.hidden) { animation: lc-overlay-in 0.2s ease-out; }
.modal-overlay:not(.hidden) .modal { animation: lc-sheet-in 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.15); }

/* Photo bubbles: caption and time share the same inset. */
.media-msg-bubble .media-msg-caption-text { padding: 8px 9px 0; }
.media-msg-bubble > .msg-time { padding: 3px 9px 6px; text-align: right; }

/* Text bubbles: time tucked into the last line, bottom-right. */
.msg-bubble:not(.media-msg-bubble) > .msg-time {
  display: inline-block;
  float: right;
  margin: 7px 0 -4px 12px;
  white-space: nowrap;
}
.msg-bubble:not(.media-msg-bubble)::after { content: ""; display: block; clear: both; }

/* Consecutive messages from the same person hug together. */
.msg-bubble.mine + .msg-bubble.mine,
.msg-bubble.theirs + .msg-bubble.theirs { margin-top: -5px; }
.msg-bubble.mine + .msg-bubble.mine { border-top-right-radius: 6px; }
.msg-bubble.theirs + .msg-bubble.theirs { border-top-left-radius: 6px; }
.msg-bubble.mine:has(+ .msg-bubble.mine) { border-bottom-right-radius: 16px; }
.msg-bubble.theirs:has(+ .msg-bubble.theirs) { border-bottom-left-radius: 16px; }

/* "Today" / "Yesterday" stay visible while scrolling that day. */
.date-divider { position: sticky; top: 6px; z-index: 3; pointer-events: none; }
.date-divider span { background: rgba(28, 28, 28, 0.96); color: #aaa; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

/* End-to-end encryption note at the top of every chat. */
.e2e-banner {
  align-self: center;
  max-width: 300px;
  margin: 6px auto 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(232, 184, 75, 0.1);
  color: #d9c18a;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
  cursor: pointer;
}

/* Message box: calm until you tap it; send button only pulses when there's something to send. */
.message-input-row textarea { animation: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.message-input-row textarea:focus { outline: none; border-color: #5a5a5a; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.07); }
.send-mic-btn { animation: none; transition: transform 0.12s ease; }
.send-mic-btn.has-text { animation: lc-sendpulse 0.8s ease-in-out 1; }
.send-mic-btn:active { transform: scale(0.92); }

/* Header glow: each light is an ellipse that fades to nothing before any edge of
   the header (which clips with overflow: hidden), so no hard edges show. */
header::before,
header::after {
  filter: none;
  inset: 0;
  width: auto;
  height: auto;
  border-radius: 0;
}
header::before { background: radial-gradient(ellipse 150px 40px at 150px 50%, rgba(91, 141, 239, 0.4), rgba(91, 141, 239, 0) 85%); }
header::after { background: radial-gradient(ellipse 130px 40px at calc(100% - 130px) 50%, rgba(255, 77, 109, 0.35), rgba(255, 77, 109, 0) 85%); }


.tab.active { animation: none; }

/* A tab bar with a single visible tab does nothing - hide it until a second
   tab (Community) is actually shown. */
#main-tabs:has(#tab-chat.hidden) { display: none; }

/* Category row: fade the edge that has more chips scrolled out of view. */

/* Heart buttons: 40px, a comfortable tap target (was 34px). */
.fav-btn { width: 40px; height: 40px; bottom: 8px; right: 8px; }

/* Chat list search + empty state. */
.chat-search {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 38px;
  margin: 0 0 12px;
  border-radius: 12px;
  border: 1px solid #262626;
  background: #151515 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23777' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 12px center / 17px;
  color: #fff;
  font-size: 15px;
  transition: border-color 0.2s ease;
}
.chat-search:focus { outline: none; border-color: #444; }
.conversation-preview.typing { color: #4caf7d; font-style: italic; }
.chat-empty {
  text-align: center;
  color: #777;
  padding: 48px 20px;
  font-size: 14px;
  line-height: 1.5;
}
.chat-empty svg { width: 44px; height: 44px; margin: 0 auto 12px; display: block; opacity: 0.5; }
.unread-badge { box-shadow: 0 0 0 3px #0a0a0a; }
/* On a chat-list card the ring must be the card's colour, not the page's. */
.conversation-item .unread-badge { box-shadow: 0 0 0 3px #141414; }
.conversation-item .online-dot, .friend-item .online-dot { border-color: #141414; }

/* Loading shimmer instead of a spinner. */
@keyframes lc-skeleton { 0% { background-position: -200px 0; } 100% { background-position: calc(200px + 100%) 0; } }
.skeleton-bubble {
  height: 38px;
  border-radius: 16px;
  background: #161616 linear-gradient(90deg, #161616 0, #222 60px, #161616 120px) no-repeat;
  background-size: 200px 100%;
  animation: lc-skeleton 1.2s ease-in-out infinite;
}
.skeleton-bubble.mine { align-self: flex-end; }
.skeleton-bubble.theirs { align-self: flex-start; }

/* Notices: icon, and info-only ones fade away on their own. */
@keyframes lc-notice-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
#e2e-notice { animation: lc-notice-in 0.28s ease-out; }
#e2e-notice.fading { transition: opacity 0.4s ease; opacity: 0; }
.notice-icon { display: inline-block; margin-right: 8px; }

/* Linked devices and backup status. */
.device-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); text-align: left; }
.device-icon { width: 38px; height: 38px; border-radius: 12px; background: #1f1f1f; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.device-icon svg { width: 20px; height: 20px; }
.device-badge { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: rgba(76, 175, 125, 0.15); color: #6fd39c; font-size: 11px; font-weight: 600; vertical-align: middle; }
.backup-card { text-align: left; background: #1b1b1b; border-radius: 14px; padding: 14px; margin: 12px 0; font-size: 14px; line-height: 1.5; }
.backup-card .backup-ok { color: #6fd39c; font-weight: 600; }
.backup-card .backup-muted { color: #888; font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  .modal-overlay:not(.hidden),
  .modal-overlay:not(.hidden) .modal,
  .send-mic-btn.has-text,
  .skeleton-bubble,
  #e2e-notice,
  .msg-bubble-arrive,
  .msg-enter-anim,
  .msg-older-anim { animation: none !important; }
  
}
/* ===== end UI polish ===== */

/* ===== Photo editing (crop / draw), opened from the caption screen ===== */

.caption-edit-tools {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  z-index: 5;
  display: flex;
  gap: 10px;
}

.caption-edit-tool-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.caption-edit-tool-btn svg {
  width: 18px;
  height: 18px;
}

.media-editor {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: #000;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
}

.media-editor-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 14px 14px;
  flex-shrink: 0;
}

.media-editor-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-editor-icon-btn svg {
  width: 18px;
  height: 18px;
}

.media-editor-done-btn {
  margin-left: auto;
  background: #5b8def;
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 14px;
  padding: 9px 20px;
  border-radius: 999px;
}

.media-editor-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 8px 16px;
}

#crop-image,
#draw-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.crop-box {
  position: absolute;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.55);
  touch-action: none;
}

.crop-box::before,
.crop-box::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.35);
}

.crop-box::before {
  left: 0;
  right: 0;
  top: 33.33%;
  height: 1px;
  box-shadow: 0 33.33% 0 rgba(255, 255, 255, 0.35);
}

.crop-box::after {
  top: 0;
  bottom: 0;
  left: 33.33%;
  width: 1px;
  box-shadow: 33.33% 0 0 rgba(255, 255, 255, 0.35);
}

.crop-handle {
  position: absolute;
  width: 26px;
  height: 26px;
  touch-action: none;
}

.crop-handle::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 3px;
}

.crop-handle[data-handle="nw"] { top: -13px; left: -13px; cursor: nwse-resize; }
.crop-handle[data-handle="ne"] { top: -13px; right: -13px; cursor: nesw-resize; }
.crop-handle[data-handle="sw"] { bottom: -13px; left: -13px; cursor: nesw-resize; }
.crop-handle[data-handle="se"] { bottom: -13px; right: -13px; cursor: nwse-resize; }
.crop-handle[data-handle="nw"]::after { top: 4px; left: 4px; border-right: none; border-bottom: none; }
.crop-handle[data-handle="ne"]::after { top: 4px; right: 4px; border-left: none; border-bottom: none; }
.crop-handle[data-handle="sw"]::after { bottom: 4px; left: 4px; border-right: none; border-top: none; }
.crop-handle[data-handle="se"]::after { bottom: 4px; right: 4px; border-left: none; border-top: none; }

#draw-canvas {
  position: absolute;
  touch-action: none;
}

.draw-tools-row {
  flex-shrink: 0;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.draw-size-group {
  display: flex;
  justify-content: center;
  gap: 22px;
}

.draw-size-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.draw-size-btn span {
  display: block;
  border-radius: 50%;
  background: #fff;
}

.draw-size-btn.active {
  background: rgba(91, 141, 239, 0.35);
}

.draw-color-group {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 4px;
  scrollbar-width: none;
}

.draw-color-group::-webkit-scrollbar {
  display: none;
}

.draw-color-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.draw-color-btn.active {
  border-color: #fff;
  transform: scale(1.15);
}

/* ===== Text / sticker annotation, sharing the draw-size-btn / draw-color-btn
   look above for the size and color rows. ===== */

.annotate-tools-row {
  flex-shrink: 0;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#annotate-layers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.annotate-layer {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  touch-action: none;
  text-align: center;
  padding-top: 22px;
}

.annotate-layer.active .annotate-layer-content {
  outline: 1.5px dashed rgba(255, 255, 255, 0.6);
  outline-offset: 6px;
}

.annotate-layer-handle {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 34px;
  height: 20px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.annotate-layer.active .annotate-layer-handle {
  display: flex;
}

.annotate-layer-handle::after {
  content: '';
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: #fff;
  box-shadow: 0 5px 0 #fff, 0 -5px 0 #fff;
}

.annotate-text-content {
  min-width: 20px;
  max-width: 70vw;
  color: #fff;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.25;
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.annotate-sticker-content {
  line-height: 1;
  user-select: none;
}

.annotate-sticker-panel {
  flex-shrink: 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid #1a1a1a;
}

.annotate-emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  max-height: 40vh;
  overflow-y: auto;
}

.annotate-emoji-btn {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  padding: 8px 0;
  border-radius: 10px;
}

.annotate-emoji-btn:active {
  background: rgba(255, 255, 255, 0.1);
}

/* ===== Sticker picker + sticker message bubbles ===== */

.sticker-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
}

.sticker-panel {
  position: absolute;
  bottom: 70px;
  left: 16px;
  right: 16px;
  max-height: 46vh;
  background: #1c1c1c;
  border-radius: 16px;
  padding: 10px;
  z-index: 60;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sticker-panel-tabs {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  overflow-x: auto;
}

.sticker-panel-tab {
  background: #262626;
  color: #aaa;
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.sticker-panel-tab.active {
  background: #5b8def;
  color: #fff;
}

.sticker-panel-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  overflow-y: auto;
  padding: 4px 2px;
}

.sticker-thumb-btn {
  background: #262626;
  border: none;
  border-radius: 12px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.sticker-thumb-btn:active {
  background: #333;
  transform: scale(0.95);
}

.sticker-thumb-btn img,
.sticker-thumb-btn video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Stickers float without the normal bubble chrome - no background, no padding. */
.msg-bubble.sticker-msg-bubble.mine,
.msg-bubble.sticker-msg-bubble.theirs {
  background: transparent;
  padding: 0;
  border-radius: 0;
  max-width: 140px;
}

.sticker-msg-content {
  width: 128px;
  height: 128px;
  position: relative;
}

.sticker-msg-content img,
.sticker-msg-content video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sticker-msg-time {
  position: absolute;
  bottom: 2px;
  right: 4px;
  background: rgba(0, 0, 0, 0.45);
  color: #eee;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Visible keyboard focus. Only shows for keyboard navigation (not taps or mouse clicks),
   so the touch look is unchanged. */
:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.fav-btn:focus-visible{
  outline-color: #7aa7ff;
}

/* ===== Status ===== */
.status-strip {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 2px 2px 14px;
  margin-bottom: 6px;
  scrollbar-width: none;
}
.status-strip::-webkit-scrollbar { display: none; }
.status-item {
  flex: 0 0 auto;
  width: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.status-item.muted { opacity: 0.5; }
.status-ring-wrap {
  position: relative;
  width: 64px;
  height: 64px;
}
.status-ring { position: absolute; inset: 0; }
.status-avatar-slot {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  overflow: hidden;
  background: #222;
}
.status-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  flex: 0 0 auto;
}
.status-avatar img { width: 100%; height: 100%; object-fit: cover; }
.status-muted-chip { background: #1c1c1c; font-size: 18px; }
.status-add-badge {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #0a0a0a;
  background: #1d9bf0;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
}
.status-name {
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  max-width: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  color: #fff;
  background: #000;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  touch-action: manipulation;
}
.status-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 8px;
  position: relative;
  z-index: 2;
}
.status-icon-btn {
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.25);
  color: #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.status-icon-btn svg { width: 20px; height: 20px; }
.status-icon-btn.hidden { display: none; }
.status-bottombar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 16px;
}
.status-send-btn {
  width: 50px;
  height: 50px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #1d9bf0;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.status-send-btn svg { width: 22px; height: 22px; }
.status-send-btn:disabled { opacity: 0.4; }
.status-text-input {
  flex: 1;
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: #fff;
  text-align: center;
  font-weight: 600;
  padding: 20vh 24px 0;
  line-height: 1.3;
}
.status-text-input::placeholder { color: rgba(255,255,255,0.6); }
.status-caption-input,
.status-reply-input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 13px 16px;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(20,20,20,0.85);
  color: #fff;
  font-size: 15px;
}
.status-media-stage,
.status-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.status-media-stage img,
.status-media-stage video,
.status-stage img,
.status-stage video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.status-stage { user-select: none; -webkit-user-select: none; }
.status-busy {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 14px;
}

.status-viewer .status-viewer-top { padding-top: 6px; }
.status-progress {
  display: flex;
  gap: 4px;
  padding: 10px 10px 0;
  position: relative;
  z-index: 2;
}
.status-progress-seg {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.3);
  overflow: hidden;
}
.status-progress-fill { height: 100%; background: #fff; }
.status-who {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.status-who .status-avatar { width: 38px; height: 38px; }
.status-who-name { font-weight: 700; font-size: 15px; }
.status-who-time { font-size: 12px; opacity: 0.7; }
.status-text-view {
  padding: 24px;
  text-align: center;
  font-weight: 600;
  line-height: 1.3;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 100%;
  overflow: hidden;
}
.status-caption {
  text-align: center;
  padding: 10px 20px;
  font-size: 15px;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  white-space: pre-wrap;
  word-break: break-word;
}
.status-caption.hidden { display: none; }
.status-footer { padding: 8px 16px 16px; min-height: 40px; }
.status-reply-row { display: flex; gap: 10px; align-items: center; }
.status-views-btn {
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  width: auto;
  padding: 10px 18px;
  border: none;
  border-radius: 20px;
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 14px;
}
.status-views-btn svg { width: 18px; height: 18px; }

.status-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.status-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 75vh;
  overflow-y: auto;
  background: #141414;
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  color: #fff;
}
.status-sheet-title { font-weight: 700; font-size: 16px; margin-bottom: 10px; }
.status-sheet > button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 0;
  padding: 13px 6px;
  border: none;
  border-radius: 12px;
  background: none;
  color: #fff;
  font-size: 15px;
  text-align: left;
}
.status-sheet > button:active { background: rgba(255,255,255,0.06); }
.status-sheet .status-sheet-cancel { justify-content: center; margin-top: 6px; background: #1c1c1c; }
.status-sheet-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex: 0 0 auto;
}
.status-sheet-icon svg { width: 20px; height: 20px; }
.status-viewer-row { display: flex; align-items: center; gap: 12px; padding: 8px 2px; }
.avatar-wrapper.has-status { cursor: pointer; }
.status-avatar-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.status-avatar-ring .status-ring { position: static; display: block; }
.avatar-wrapper.has-status .online-dot { z-index: 1; }

/* Password fields inside modals: the input's bottom margin moves to the
   wrapper, so the show/hide eye centres on the input itself. */
.modal .password-field-wrap { margin-bottom: 12px; }
.modal .password-field-wrap > input { margin-bottom: 0; }


:root {
  --glass-bg: rgba(30, 30, 36, 0.26);
  --glass-bg-strong: rgba(18, 18, 22, 0.46);
  --glass-light: rgba(255, 255, 255, 0.10);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --glass-blur: blur(16px) saturate(180%);
}

/* Home: the chip row sticks to the top and floats as glass over the grid. */

.fav-btn {
  background: var(--glass-light);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-edge);
  -webkit-backdrop-filter: blur(14px) saturate(170%);
  backdrop-filter: blur(14px) saturate(170%);
}

/* Menu, popups and sheets. */
.modal-overlay {
  background: rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
.main-menu-drawer,
.modal,
.status-sheet {
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-edge), var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}
.main-menu-drawer { border-width: 0 0 0 1px; border-radius: 22px 0 0 22px; }
.status-sheet { border-width: 1px 0 0; }
.status-sheet-overlay { background: rgba(0, 0, 0, 0.4); }
.modal input,
.status-sheet input {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
}
.status-sheet .status-sheet-cancel { background: rgba(255, 255, 255, 0.08); }

/* Status viewer: glass controls over the photo, video or colour. */
.status-icon-btn,
.status-views-btn {
  background: var(--glass-light);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-edge);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}
.status-caption-input,
.status-reply-input {
  background: var(--glass-bg);
  border-color: var(--glass-border);
  box-shadow: var(--glass-edge);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}
.status-caption {
  background: none;
  margin: 0 16px 6px;
  border-radius: 14px;
  background-color: var(--glass-bg);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}
.status-busy {
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* Phones that can't blur get the solid versions instead of see-through ones. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .main-menu-drawer, .modal, .status-sheet { background: #141414; }
  
  .fav-btn,
  .status-icon-btn, .status-views-btn { background: rgba(0, 0, 0, 0.55); }
  .status-caption-input, .status-reply-input, .status-caption { background: rgba(20, 20, 20, 0.9); }
}


.status-ambient {
  position: absolute;
  inset: -60px;
  width: calc(100% + 120px);
  height: calc(100% + 120px);
  object-fit: cover;
  filter: blur(40px) brightness(0.5) saturate(1.4);
  pointer-events: none;
  z-index: 0;
}
.status-ambient.hidden { display: none; }
.status-viewer { overflow: hidden; }
.status-viewer > :not(.status-ambient) { position: relative; z-index: 1; }
.status-viewer > .status-progress,
.status-viewer > .status-topbar { z-index: 2; }

/* ===== In-app camera ===== */
.camera-view {
  position: fixed;
  inset: 0;
  z-index: 10002;
  background: #000;
  color: #fff;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.camera-source { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.camera-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 16px 10px;
  z-index: 2;
}
.camera-round-btn {
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-light);
  box-shadow: var(--glass-edge);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.camera-round-btn svg { width: 22px; height: 22px; }
.camera-round-btn.active { background: rgba(255, 255, 255, 0.9); color: #000; }
.camera-rec {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 16px;
  background: rgba(229, 72, 107, 0.85);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.camera-rec.hidden { display: none; }
.camera-rec-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: lc-rec-blink 1s steps(2) infinite; }
@keyframes lc-rec-blink { 50% { opacity: 0; } }
.camera-beauty {
  position: absolute;
  top: calc(72px + env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 22px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  font-size: 13px;
  font-weight: 600;
}
.camera-beauty.hidden { display: none; }
.camera-beauty input { flex: 1; margin: 0; padding: 0; accent-color: #fff; background: none; border: none; }
.camera-beauty [data-beauty-value] { width: 26px; text-align: right; font-variant-numeric: tabular-nums; }
.camera-filter-label {
  position: absolute;
  top: 40%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}
.camera-filter-label.show { animation: lc-filter-label 1.1s ease-out; }
@keyframes lc-filter-label { 0% { opacity: 0; transform: scale(0.9); } 15%, 60% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.camera-message {
  position: absolute;
  top: 38%;
  left: 24px;
  right: 24px;
  z-index: 3;
  padding: 16px;
  border-radius: 16px;
  text-align: center;
  font-size: 14px;
  line-height: 1.4;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}
.camera-message.hidden { display: none; }
.camera-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 0 0 calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.45));
}
.camera-filters {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 10px 16px 14px;
  scrollbar-width: none;
}
.camera-filters::-webkit-scrollbar { display: none; }
.camera-filter {
  flex: 0 0 auto;
  width: 58px;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.75;
}
.camera-filter img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid transparent;
}
.camera-filter.active { opacity: 1; }
.camera-filter.active img { border-color: #fff; }
.camera-controls {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 24px;
}
.camera-shutter {
  position: relative;
  width: 84px;
  height: 84px;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.camera-shutter-ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.camera-shutter-ring circle { fill: none; stroke: #fff; stroke-width: 5; transition: stroke 0.2s; }
.camera-shutter-core {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  transition: transform 0.15s ease, background 0.2s, border-radius 0.2s;
}
.camera-shutter:active .camera-shutter-core { transform: scale(0.9); }
.camera-view.recording .camera-shutter-core { background: #e5486b; transform: scale(0.62); border-radius: 30%; }
.camera-view.recording .camera-shutter-ring circle { stroke: #e5486b; }
.camera-view.recording .camera-filters { visibility: hidden; }
.camera-hint { text-align: center; font-size: 12px; opacity: 0.75; margin-top: 10px; }
.camera-view.camera-flash::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  z-index: 5;
  animation: lc-camera-flash 0.25s ease-out forwards;
}
@keyframes lc-camera-flash { from { opacity: 0.85; } to { opacity: 0; } }
.camera-view.recording .camera-shutter-ring .camera-ring-track { stroke: rgba(255, 255, 255, 0.35); }

.chat-wp-picker {
  position: fixed;
  inset: 0;
  z-index: 10003;
  background: #0a0a0a;
  color: #fff;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
}
.chat-wp-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 12px;
}
.chat-wp-top h2 { font-size: 20px; font-weight: 800; }
.chat-wp-preview {
  position: relative;
  flex: 1;
  min-height: 160px;
  margin: 0 16px;
  border-radius: 20px;
  overflow: hidden;
  background: #141414;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px;
}
.chat-wp-bubble { max-width: 75%; padding: 10px 14px; border-radius: 18px; font-size: 14px; }
.chat-wp-bubble.theirs { align-self: flex-start; background: #1c1c1c; }
.chat-wp-bubble.mine { align-self: flex-end; background: #fff; color: #000; }
.chat-wp-sheet { padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); }
.chat-wp-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 74px;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none;
}
.chat-wp-grid::-webkit-scrollbar { display: none; }
.chat-wp-loading { opacity: 0.6; font-size: 13px; padding: 30px 0; }
.chat-wp-tile {
  width: 74px;
  height: 120px;
  margin: 0;
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid transparent;
  background: #1c1c1c;
  color: #bbb;
  font-size: 13px;
  font-weight: 600;
}
.chat-wp-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-wp-tile.active { border-color: #fff; }
.chat-wp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
}
.chat-wp-row input[type=range] { flex: 1; margin: 0; padding: 0; border: none; background: none; accent-color: #fff; }
.chat-wp-check input { width: 20px; height: 20px; margin: 0; accent-color: #fff; }
.chat-wp-save {
  width: 100%;
  margin-top: 16px;
  padding: 15px;
  border: none;
  border-radius: 26px;
  background: #fff;
  color: #000;
  font-weight: 700;
  font-size: 15px;
}

/* ===== Search in chat ===== */
.chat-search-view {
  position: fixed;
  inset: 0;
  z-index: 10003;
  background: #0a0a0a;
  color: #fff;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
}
.chat-search-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid #1a1a1a;
}
.chat-search-top input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 12px 16px;
  border-radius: 22px;
  border: 1px solid #333;
  background: #1c1c1c;
  color: #fff;
  font-size: 16px;
}
.chat-search-results { flex: 1; overflow-y: auto; padding: 8px 12px 24px; }
.chat-search-empty { opacity: 0.6; text-align: center; padding: 40px 20px; font-size: 14px; }
.chat-search-hit {
  display: block;
  width: 100%;
  margin: 0 0 6px;
  padding: 12px 14px;
  border: none;
  border-radius: 14px;
  background: #141414;
  color: #fff;
  text-align: left;
}
.chat-search-hit:active { background: #1f1f1f; }
.chat-search-meta { display: flex; justify-content: space-between; font-size: 12px; opacity: 0.6; margin-bottom: 4px; }
.chat-search-snippet { font-size: 14px; line-height: 1.4; word-break: break-word; }
.chat-search-snippet mark { background: rgba(29, 155, 240, 0.35); color: #fff; border-radius: 3px; padding: 0 2px; }
.status-sheet > .status-privacy-row { border-top: 1px solid rgba(255, 255, 255, 0.08); margin-top: 6px; }
.status-privacy-row small { display: block; font-size: 12px; opacity: 0.6; margin-top: 2px; }
.status-privacy-option { display: flex; align-items: center; gap: 12px; padding: 12px 4px; font-size: 15px; }
.status-privacy-option input { width: 20px; height: 20px; margin: 0; accent-color: #1d9bf0; }
.status-privacy-hint { font-size: 13px; opacity: 0.7; margin: 10px 0 4px; }
.status-privacy-list { max-height: 38vh; overflow-y: auto; }
.status-privacy-list input[type=checkbox] { width: 22px; height: 22px; margin: 0; accent-color: #1d9bf0; }
.chat-search-top input:focus { outline: none; border-color: #5a5a5a; }
.status-sheet > .chat-wp-save { justify-content: center; background: #fff; color: #000; font-weight: 700; margin-top: 12px; }

/* ===== Media download ring + swipe viewer ===== */
.media-dl-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  transform: translate(-50%, -50%);
  z-index: 3;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.media-dl-ring svg { position: absolute; inset: 6px; transform: rotate(-90deg); }
.media-dl-ring circle { fill: none; stroke-width: 3; }
.media-dl-track { stroke: rgba(255, 255, 255, 0.25); }
.media-dl-bar { stroke: #fff; stroke-linecap: round; transition: stroke-dashoffset 0.15s linear; }
.media-dl-ring span { font-size: 11px; font-weight: 700; color: #fff; }
.lightbox { touch-action: pinch-zoom; }
.lightbox-counter {
  position: fixed;
  top: calc(26px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  pointer-events: none;
  z-index: 2;
}
.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-light);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.lightbox-nav svg { width: 20px; height: 20px; }
.lightbox-nav:disabled { opacity: 0.25; }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
@media (hover: hover) and (pointer: fine) {
  .lightbox.has-gallery .lightbox-nav { display: flex; }
}
.lightbox-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; color: #fff; font-size: 13px; }
#open-friends-btn { position: relative; }
#open-friends-btn.has-badge::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #1d9bf0;
  border: 2px solid #0a0a0a;
}

/* Easter egg: decoy global community (see decoyCommunity.js) */
.decoy-community { position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column; background: #0f0f14; color: #fff; }
.decoy-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #181820; border-bottom: 1px solid rgba(255,255,255,.08); }
.decoy-back { width: auto; background: none; border: 0; color: #fff; font-size: 30px; line-height: 1; padding: 0 8px; }
.decoy-title-main { font-weight: 600; font-size: 16px; }
.decoy-title-sub { font-size: 12px; color: #4ade80; }
.decoy-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.decoy-row { display: flex; gap: 8px; align-items: flex-end; max-width: 85%; animation: decoy-in .25s ease-out; }
.decoy-row.mine { align-self: flex-end; }
.decoy-avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; }
.decoy-bubble { background: #22222c; border-radius: 14px; padding: 7px 11px; }
.decoy-row.mine .decoy-bubble { background: #3b5bdb; }
.decoy-name { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.decoy-text { font-size: 15px; word-break: break-word; }
.decoy-time { font-size: 10px; opacity: .5; text-align: right; margin-top: 2px; }
.decoy-typing { min-height: 18px; padding: 0 16px 4px; font-size: 12px; color: rgba(255,255,255,.55); }
.decoy-bar { display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: #181820; }
.decoy-input { flex: 1; margin: 0; border-radius: 20px; }
.decoy-send { width: 44px; border-radius: 50%; padding: 0; }
@keyframes decoy-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .decoy-row { animation: none; } }

/* Chat header glass lives on its own layer behind the content, so the avatar,
   name and status are never drawn inside the backdrop-filter element (iOS Safari
   renders those hazy). */


#thread-username { color: #fff; }

/* Glass chat header in every conversation: it floats over the messages, so they
   scroll under it and blur. */
#thread-view.fullscreen .thread-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  background: none;
  border-bottom: 1px solid var(--glass-border);
  isolation: isolate;
}
#thread-view.fullscreen .thread-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(12, 12, 14, 0.5);
  box-shadow: var(--glass-edge);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  pointer-events: none;
}
#thread-view.fullscreen #message-list {
  padding-top: calc(84px + env(safe-area-inset-top));
}

/* Glass message input bar: sits over the bottom of the message list, so messages
   scroll under it and blur. While a reply/edit bar is open it falls back to a
   normal in-flow bar so the two never overlap. */
#thread-view.fullscreen .message-input-row {
  position: relative;
  z-index: 5;
  background: none;
  border-top: 1px solid var(--glass-border);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  isolation: isolate;
}
#thread-view.fullscreen .message-input-row::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(12, 12, 14, 0.5);
  box-shadow: var(--glass-edge);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  pointer-events: none;
}
#thread-view.fullscreen:not(:has(.reply-preview-bar:not(.hidden))) .message-input-row {
  margin-top: calc(-70px - env(safe-area-inset-bottom));
}
#thread-view.fullscreen:not(:has(.reply-preview-bar:not(.hidden))) #message-list {
  padding-bottom: calc(86px + env(safe-area-inset-bottom));
}

/* No "+ New Chat" until the chat is unlocked (JS adds body.chat-unlocked). */
body:not(.chat-unlocked) #new-chat-btn { display: none; }

/* Chat list header: "+" (new chat) sits beside the add-friend button. */
.chat-list-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.chat-list-actions .icon-btn-right { margin-left: 0; }

/* The send/mic button: a finger resting on it is a voice recording, so the browser must not take the touch for
   scrolling or zooming, and the phone must not offer to select or copy it. */
#send-btn {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* What a quick tap on the mic button says. */
.mic-hint {
  position: fixed;
  bottom: calc(86px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 9px 16px;
  border-radius: 20px;
  background: #1c1c1c;
  color: #fff;
  font-size: 13px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  z-index: 200;
  pointer-events: none;
  animation: micHintIn 0.2s ease;
}
@keyframes micHintIn { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .mic-hint { animation: none; } }

/* Profile > "Check microphone and calls": what it found on top, the steps one under the other (they scroll), the buttons always in view. */
.call-check-modal { max-width: 420px; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); display: flex; flex-direction: column; }
.modal .call-check-summary { margin: 4px 0 0; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.07); color: #fff; font-size: 14px; font-weight: 600; line-height: 1.45; }
.modal .call-check-summary:empty { display: none; }
.modal .call-check-summary.ok { background: rgba(60, 170, 110, 0.18); }
.modal .call-check-summary.bad { background: rgba(230, 70, 100, 0.2); }
.call-check-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; margin: 14px 0 4px; }
.call-check-list:empty { display: none; }
.call-check-actions { flex: 0 0 auto; padding-top: 4px; }
.call-check-row { display: flex; gap: 10px; align-items: flex-start; }
.call-check-mark {
  flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; line-height: 1; margin-top: 1px;
  background: #2a2a2a; color: #bbb;
}
.call-check-mark.ok { background: #1f4d34; color: #6fe0a1; }
.call-check-mark.bad { background: #5a1f2a; color: #ff7d92; }
.call-check-mark.wait { background: #2a2a2a; color: #bbb; animation: callCheckPulse 1s ease-in-out infinite; }
.call-check-body { min-width: 0; }
.call-check-name { font-size: 14px; font-weight: 600; color: #fff; }
.call-check-text { font-size: 13px; color: #aaa; line-height: 1.4; overflow-wrap: anywhere; }
.modal .call-check-run { background: #fff; color: #000; }
@keyframes callCheckPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .call-check-mark.wait { animation: none; } }

/* In a call: five buttons (mute, camera, speaker, screen off, end) must fit the narrowest phones. */
#call-active-actions { gap: 14px; }
@media (max-width: 340px) { #call-active-actions { gap: 8px; } }

/* "Screen off" in a voice call: a page cannot use the proximity sensor, so this is a black cover that ignores touches (an ear cannot
   press anything) until it is double-tapped. Above everything, including the notices (z-index 9999). */
.call-screen-off {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #000;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.call-screen-off-hint {
  margin-bottom: calc(60px + env(safe-area-inset-bottom));
  color: #555;
  font-size: 14px;
  transition: opacity 0.6s ease;
}
.call-screen-off-hint.gone { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .call-screen-off-hint { transition: none; } }

/* Profile > Mode: the chosen one is filled */
.mode-btn { opacity: 0.6; }
.mode-btn.mode-btn-on { background: #fff; color: #000; opacity: 1; font-weight: 700; }

/* ===== Groups ===== */
.group-avatar { display: flex; align-items: center; justify-content: center; background: #1f1f24; color: #fff; }
.group-avatar svg { width: 55%; height: 55%; }
.group-chat { position: fixed; inset: 0; z-index: 60; background: #0a0a0a; display: flex; flex-direction: column; }
.group-chat.hidden { display: none; }
.group-chat-header { padding: calc(14px + env(safe-area-inset-top)) 16px 14px; border-bottom: 1px solid #1a1a1a; display: flex; align-items: center; gap: 10px; }
.group-chat-list { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.group-chat .message-input-row { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.group-readonly { padding: 16px calc(16px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)); text-align: center; color: #888; font-size: 14px; }
.group-sender { color: #5b8def; font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.group-quote { border-left: 3px solid #5b8def; background: rgba(128,128,128,.18); border-radius: 6px; padding: 4px 8px; margin-bottom: 4px; font-size: 12px; opacity: .85; max-height: 3.2em; overflow: hidden; }
.group-reply-btn { background: none; border: 0; color: inherit; opacity: .55; cursor: pointer; font-size: 13px; padding: 0 2px; }
.group-info { max-height: 88vh; overflow-y: auto; }
.group-info input[type=text] { width: 100%; box-sizing: border-box; margin: 6px 0; }
.group-add { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.group-add .new-chat-btn { width: auto; padding: 0 16px; }
.group-members { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.group-member { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.06); }
.group-member-name { flex: 1; text-align: left; }
.group-member-name small { opacity: .6; }
.group-admin-tag { color: #4caf7d; font-size: 12px; font-weight: 600; }
.group-member-menu { background: none; border: 0; color: inherit; font-size: 20px; cursor: pointer; }
.group-toggle { display: flex; gap: 8px; align-items: center; margin: 8px 0; text-align: left; }
.group-leave { color: #ff6b6b; }
.group-media { position: relative; width: 240px; max-width: 100%; min-height: 120px; border-radius: 12px; overflow: hidden; background: rgba(128,128,128,.2); cursor: pointer; margin-bottom: 4px; }
.group-media img { display: block; width: 100%; max-height: 320px; object-fit: cover; }
.group-media.loading { opacity: .6; }
.group-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 34px; color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.group-voice, .group-file { background: rgba(128,128,128,.18); border: 0; color: inherit; border-radius: 12px; padding: 10px 14px; cursor: pointer; font: inherit; display: block; margin-bottom: 4px; text-align: left; }
.group-voice small, .group-file small { opacity: .65; margin-left: 6px; }
.group-reacts { font-size: 14px; margin-top: 2px; }
.group-deleted { opacity: .65; }
.group-progress { padding: 8px 16px; font-size: 13px; color: #5b8def; }
.group-react-row { display: flex; justify-content: space-around; margin-bottom: 8px; }
.group-react-row button { background: none; border: 0; font-size: 28px; cursor: pointer; }
.group-info-avatar { width: 84px; height: 84px; margin: 0 auto 8px; overflow: hidden; }
.group-description { white-space: pre-wrap; opacity: .85; }
.group-admin-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 8px 0; }
.group-admin-row .secondary-btn { width: auto; padding: 8px 14px; margin: 0; }
#gc-mic.recording { color: #ff4d4d; animation: lc-pulse 1s infinite; }
.group-actions-overlay { z-index: 90; }
@keyframes lc-pulse { 50% { opacity: .35; } }
.group-dialog-overlay { z-index: 120; }
.group-dialog-input { width: 100%; box-sizing: border-box; margin: 8px 0; }
.group-danger { background: #ff5b5b; color: #fff; }
.group-at { color: #4caf7d; font-weight: 700; }
.group-muted { font-size: 12px; opacity: .7; }
.group-mute-row { text-align: left; }
.group-mention { color: #5b8def; font-weight: 600; }
.group-mentions { display: flex; gap: 8px; overflow-x: auto; padding: 6px 16px; }
.group-mentions.hidden { display: none; }
.group-mentions button { background: rgba(91,141,239,.18); color: #cfe0ff; border: 0; border-radius: 16px; padding: 6px 12px; white-space: nowrap; cursor: pointer; }
.group-call-banner { background: #12301f; color: #fff; padding: 10px 16px; cursor: pointer; font-size: 14px; }
.group-call-banner.hidden { display: none; }
.group-call { position: fixed; inset: 0; z-index: 70; background: #0a0a0a; display: flex; flex-direction: column; padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); }
.group-call-head { text-align: center; color: #fff; padding: 8px; } .group-call-head span { color: #999; font-size: 13px; }
.group-call-grid { flex: 1; display: grid; gap: 8px; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; min-height: 0; }
.group-call-grid[data-n="0"], .group-call-grid[data-n="1"] { grid-template-columns: 1fr; }
.group-call-grid .waiting { grid-column: 1 / -1; align-self: center; text-align: center; color: #999; }
.group-call-tile { position: relative; background: #1b1b20; border-radius: 16px; overflow: hidden; min-height: 0; }
.group-call-tile video { width: 100%; height: 100%; object-fit: cover; }
.group-call-tile.audio-only video { opacity: 0; }
.group-call-tile.audio-only::before { content: '🎙'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 42px; }
.group-call-tile.connecting::after { content: 'connecting…'; position: absolute; top: 8px; right: 10px; font-size: 12px; color: #ccc; }
.group-call-name { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.6); color: #fff; border-radius: 8px; padding: 2px 8px; font-size: 12px; }
.group-call-me { position: absolute; top: calc(60px + env(safe-area-inset-top)); right: 16px; width: 90px; height: 130px; object-fit: cover; border-radius: 12px; transform: scaleX(-1); background: #000; }
.group-call-controls { display: flex; justify-content: center; gap: 18px; padding: 14px 0 4px; }
.group-call-controls button { width: 62px; height: 62px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 22px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.group-call-controls button small { font-size: 10px; margin-top: 3px; opacity: .8; }
.group-call-controls button.on { background: #fff; color: #000; }
.group-call-controls button.end { background: #e5484d; }
.group-sticker { max-width: 150px; align-self: flex-start; }
.group-sticker.mine { align-self: flex-end; }
.group-sticker img, .group-sticker video { width: 140px; height: 140px; object-fit: contain; display: block; }
.group-sticker .msg-time { display: block; text-align: right; font-size: 11px; opacity: .6; }
.group-sticker-panel { position: static; margin: 0 16px 8px; max-height: 40vh; overflow: hidden; display: flex; flex-direction: column; }
.group-sticker-panel.hidden { display: none; }
.view-once-caption { margin-top: 6px; white-space: pre-wrap; word-break: break-word; }

/* ===== Community on a computer: the list on the left, the open chat on the right (like the website of other messengers) ===== */
.desktop-empty { display: none; }
@media (min-width: 900px) {
  :root { --lc-side: 400px; }
  body.chat-open #conversation-list-view.fullscreen { right: auto; width: var(--lc-side); max-width: none; margin: 0; border-right: 1px solid #1a1a1a; }
  body.chat-open #thread-view.fullscreen { left: var(--lc-side); right: 0; max-width: none; margin: 0; width: auto; }
  body.chat-open .group-chat { left: var(--lc-side); }
  body.chat-open #desktop-empty { display: flex; position: fixed; top: 0; bottom: 0; left: var(--lc-side); right: 0; z-index: 41; align-items: center; justify-content: center; background: #0d0d0f; text-align: center; padding: 24px; }
  body.chat-open #chat-view:has(#thread-view:not(.hidden)) #desktop-empty, body.group-chat-open #desktop-empty { display: none; }
  .desktop-empty-card { max-width: 420px; color: #8a8a93; }
  .desktop-empty-card svg { width: 72px; height: 72px; color: #3a3a44; margin-bottom: 12px; }
  .desktop-empty-card h3 { color: #fff; font-size: 24px; font-weight: 800; margin: 0 0 8px; }
  .desktop-empty-card p { margin: 0 0 8px; line-height: 1.5; }
  .desktop-empty-lock { font-size: 13px; color: #6b6b75; margin-top: 18px !important; }
  /* long lines are hard to read across a wide pane: keep the messages in a comfortable column */
  body.chat-open #thread-view.fullscreen #message-list, .group-chat-list { width: 100%; max-width: 900px; margin-left: auto; margin-right: auto; }
  body.chat-open #thread-view.fullscreen .message-input-row, .group-chat .message-input-row { width: 100%; max-width: 900px; margin-left: auto; margin-right: auto; box-sizing: border-box; }
  .msg-bubble { max-width: min(75%, 560px); }
  .sticker-panel { right: auto; width: 440px; }
  .group-chat-list { padding-left: 24px; padding-right: 24px; }
  .group-call { left: var(--lc-side); }
}
@media (min-width: 1500px) { :root { --lc-side: 440px; } }
@media (min-width: 900px) {
  body.chat-open #back-to-list-btn, body.chat-open #gc-back { display: none; }       /* nothing to go back to: the list is always there (Escape closes a chat) */
  .conversation-item.active { background: #1d1d24; box-shadow: inset 3px 0 0 #5b8def; }
}
#gc-mic { width: 40px; height: 40px; min-width: 40px; background: #fff; color: #000; display: flex; align-items: center; justify-content: center; }
#gc-mic.recording { background: #ff4d4d; color: #fff; }

/* ===== Friends, Profile, contact info on a computer: a centred card over a dimmed page, not a phone-wide strip ===== */
@media (min-width: 900px) {
  #friends-view, #profile-view, #contact-info-view{
    inset: 5vh auto 5vh 50%; transform: translateX(-50%);
    width: min(720px, 92vw); max-width: none; margin: 0;
    border: 1px solid #24242c; border-radius: 22px;
    box-shadow: 0 0 0 200vmax rgba(0, 0, 0, .62), 0 30px 80px rgba(0, 0, 0, .6);
    padding: 28px 32px;
  }
  
  #profile-view > :not(.chat-list-header) { max-width: 520px; margin-left: auto; margin-right: auto; }
  #contact-info-view > :not(.chat-list-header) { max-width: 520px; margin-left: auto; margin-right: auto; }
  /* stories: the picture keeps a phone shape in the middle, the rest of the screen goes dark */
  .status-fullscreen { inset: 0 auto 0 50%; transform: translateX(-50%); width: min(480px, calc(100vh * 9 / 16)); box-shadow: 0 0 0 200vmax rgba(0, 0, 0, .94); }
  /* the side menu: a proper panel */
  .main-menu-drawer { width: 340px; max-width: 340px; }
}
@media (min-width: 900px) {
  #profile-view > button, #contact-info-view > button { display: block; width: 100%; box-sizing: border-box; }
}

/* ===== Media, links and docs ===== */
.shared-view { position: fixed; inset: 0; z-index: 80; background: #0a0a0a; padding: calc(20px + env(safe-area-inset-top)) 16px 0; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; }
.shared-view.hidden { display: none; }
.shared-tabs { display: flex; gap: 8px; padding-bottom: 12px; }
.shared-tab { flex: 1; background: #1c1c1c; color: #cfcfd6; border: 0; border-radius: 22px; padding: 10px 0; font-weight: 700; cursor: pointer; }
.shared-tab.active { background: #fff; color: #000; }
.shared-tab small { opacity: .6; margin-left: 4px; }
.shared-body { flex: 1; overflow-y: auto; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
.shared-month { color: #8a8a93; font-size: 13px; font-weight: 700; padding: 12px 2px 6px; }
.shared-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.shared-cell { position: relative; aspect-ratio: 1; background: #1b1b20; border: 0; padding: 0; cursor: pointer; overflow: hidden; border-radius: 4px; }
.shared-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shared-cell.loading { opacity: .6; }
.shared-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 26px; color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.7); }
.shared-link, .shared-doc { display: flex; flex-direction: column; gap: 2px; width: 100%; box-sizing: border-box; text-align: left; background: #141414; border: 0; border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; color: #fff; text-decoration: none; cursor: pointer; }
.shared-url { color: #5b8def; font-size: 13px; word-break: break-all; }
.shared-link small, .shared-doc small { color: #8a8a93; }
.shared-doc { flex-direction: row; align-items: center; gap: 12px; }
.shared-doc.loading { opacity: .6; }
.shared-doc-icon { font-size: 24px; width: 40px; text-align: center; }
.shared-doc-info { display: flex; flex-direction: column; min-width: 0; }
.shared-doc-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shared-empty { text-align: center; color: #8a8a93; padding: 60px 20px; }
@media (min-width: 900px) {
  .shared-view { inset: 5vh auto 5vh 50%; transform: translateX(-50%); width: min(720px, 92vw); max-width: none; margin: 0; border: 1px solid #24242c; border-radius: 22px; box-shadow: 0 0 0 200vmax rgba(0,0,0,.62), 0 30px 80px rgba(0,0,0,.6); padding: 28px 32px 0; }
  .shared-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ===== Create account ===== */
.signup-link { background: none; border: 0; color: #5b8def; font-weight: 600; cursor: pointer; padding: 10px 0 2px; width: 100%; }
.signup-form { max-height: 92vh; overflow-y: auto; }
.signup-form input[type=text], .signup-form input[type=password] { width: 100%; box-sizing: border-box; margin: 6px 0; }
.signup-google { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; border-radius: 12px; padding: 12px; font-weight: 700; text-decoration: none; margin: 10px 0 4px; }
.signup-or { display: flex; align-items: center; gap: 10px; color: #777; font-size: 12px; margin: 10px 0 4px; }
.signup-or::before, .signup-or::after { content: ''; flex: 1; height: 1px; background: #2a2a30; }
.signup-google-info { background: rgba(76,175,125,.12); border: 1px solid rgba(76,175,125,.3); color: #9be0bb; border-radius: 12px; padding: 10px 12px; margin: 10px 0 4px; font-size: 14px; }
.signup-google-info.hidden, #su-google-box.hidden { display: none; }
.signup-status { font-size: 12px; min-height: 16px; color: #8a8a93; margin: 0 2px 4px; }
.signup-status.ok { color: #5dd58a; } .signup-status.bad { color: #ff7a7a; }
.signup-hint { font-size: 12px; color: #8a8a93; margin: 4px 0 10px; }

/* ===== sign-in / create-account: frosted glass card that slides between its two halves (same look as VateChat) ===== */
.auth-overlay {
  --a-blue: #3b82f6; --a-blue-d: #1d4ed8; --a-ease: cubic-bezier(.2, .8, .2, 1);
  position: fixed; inset: 0; z-index: 1000; overflow-y: auto; overscroll-behavior: contain;
  display: grid; place-items: center;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
  background: #0b0b0e; color: #f4f4f5;
}
.auth-overlay:not(.hidden) { animation: lc-overlay-in .25s ease-out; }
body.auth-open { overflow: hidden; }
.auth-wrap { width: min(940px, 100%); display: flex; flex-direction: column; align-items: center; gap: 18px; margin: auto; animation: authRise .6s var(--a-ease); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 700; letter-spacing: -.3px; color: #fff; }
.auth-brand img { width: 40px; height: 40px; }
.auth-brand em { font-style: normal; color: var(--a-blue); }
.auth {
  position: relative; width: 100%; min-height: 600px; display: grid; grid-template-columns: 1fr 1fr;
  border-radius: 28px; overflow: hidden; isolation: isolate;
  background: rgba(24, 24, 27, .72); border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.auth .blob { position: absolute; border-radius: 50%; filter: blur(60px); z-index: -1; opacity: .85; animation: authFloat 9s ease-in-out infinite; pointer-events: none; }
.auth .b1 { width: 320px; height: 320px; background: #2563eb; left: -60px; top: -80px; }
.auth .b2 { width: 280px; height: 280px; background: #3b82f6; right: -50px; bottom: -70px; animation-delay: -3s; }
.auth .b3 { width: 200px; height: 200px; background: #6366f1; left: 42%; top: 38%; opacity: .45; animation-delay: -6s; }
.auth-close {
  position: absolute; top: 12px; right: 12px; z-index: 8; width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .08); color: #d4d4d8; font-size: 24px; line-height: 1; display: grid; place-items: center;
  transition: background .2s, transform .2s;
}
.auth-close:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.auth-close:active { transform: scale(.92); }
.auth .panel { padding: 38px 40px; display: flex; flex-direction: column; justify-content: center; transition: opacity .5s var(--a-ease), transform .7s var(--a-ease); }
.auth .panel form { display: flex; flex-direction: column; gap: 10px; }
.auth .panel h2 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -.5px; }
.auth .sub { margin: 0 0 8px; color: #a1a1aa; font-size: 14px; line-height: 1.45; }
.auth .fine { margin: 0; color: #8a8a96; font-size: 12.5px; line-height: 1.45; }
.gf {
  display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 50px; border-radius: 14px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); cursor: text;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.gf:focus-within { border-color: var(--a-blue); box-shadow: 0 0 0 4px rgba(59, 130, 246, .2); background: rgba(255, 255, 255, .1); }
.gf > svg { width: 20px; height: 20px; color: #8a8a96; flex: none; transition: color .2s; }
.gf:focus-within > svg { color: #60a5fa; }
.gf input { flex: 1; min-width: 0; width: auto; height: 100%; margin: 0; padding: 0; background: none; border: 0; outline: 0; color: #fff; font-size: 16px; }
.gf input::placeholder { color: #71717a; }
.gf .eye { flex: none; width: 32px; height: 32px; margin: 0; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: #a1a1aa; cursor: pointer; }
.gf .eye:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.auth .password-field-wrap { position: relative; }
.auth-btn {
  width: 100%; height: 50px; margin-top: 6px; border: 0; border-radius: 14px; cursor: pointer; color: #fff; font-size: 15px; font-weight: 700;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8); box-shadow: 0 10px 24px rgba(37, 99, 235, .35);
  transition: filter .2s, transform .15s, box-shadow .2s;
}
.auth-btn:hover:not(:disabled) { filter: brightness(1.1); }
.auth-btn:active:not(:disabled) { transform: scale(.98); }
.auth-btn:disabled { opacity: .55; cursor: default; box-shadow: none; }
.auth-btn:focus-visible, .auth-ghost:focus-visible, .auth-link:focus-visible, .auth-google:focus-visible, .auth-close:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
.auth-error { margin: 2px 2px 0; padding: 10px 12px; border-radius: 12px; font-size: 13px; color: #fecaca; background: rgba(239, 68, 68, .14); border: 1px solid rgba(239, 68, 68, .3); animation: authShake .35s; }
.auth-google {
  display: flex; align-items: center; justify-content: center; gap: 10px; height: 48px; border-radius: 14px; text-decoration: none; color: #f4f4f5; font-weight: 600; font-size: 14.5px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .14); transition: background .2s, transform .15s;
}
.auth-google:hover { background: rgba(255, 255, 255, .13); }
.auth-google:active { transform: scale(.98); }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; color: #71717a; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: rgba(255, 255, 255, .1); }
.auth-google-info { padding: 10px 12px; border-radius: 12px; font-size: 13px; color: #bbf7d0; background: rgba(34, 197, 94, .12); border: 1px solid rgba(34, 197, 94, .3); }
.auth .signup-status { min-height: 16px; margin: -4px 4px 0; font-size: 12.5px; color: #a1a1aa; }
.auth .signup-status.ok { color: #4ade80; }
.auth .signup-status.bad { color: #fca5a5; }
.auth .m-switch { display: none; text-align: center; margin: 10px 0 0; color: #a1a1aa; font-size: 14px; }
.auth-link { background: none; border: 0; padding: 4px; margin: 0; cursor: pointer; font: inherit; font-weight: 600; color: #60a5fa; }
/* the frosted sheet that slides between the halves */
.glass {
  position: absolute; top: 0; left: 0; width: 50%; height: 100%; z-index: 5; transform: translateX(100%);
  transition: transform .8s cubic-bezier(.65, .05, .2, 1); will-change: transform;
  background: rgba(255, 255, 255, .1); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  border-left: 1px solid rgba(255, 255, 255, .18); border-right: 1px solid rgba(255, 255, 255, .18); box-shadow: 0 0 60px rgba(0, 0, 0, .35);
  display: grid; place-items: center; text-align: center; padding: 30px;
}
.is-login .glass { transform: translateX(0); }
.glass-in { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 300px; transition: opacity .45s, transform .6s var(--a-ease); }
.glass-in h3 { margin: 6px 0 0; font-size: 28px; font-weight: 700; letter-spacing: -.5px; }
.glass-in p { margin: 0 0 6px; color: #d4d4d8; line-height: 1.5; }
.auth-ghost { padding: 12px 22px; border-radius: 14px; cursor: pointer; font-size: 15px; font-weight: 600; color: #fff; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .25); transition: background .2s, transform .15s; }
.auth-ghost:hover { background: rgba(255, 255, 255, .26); }
.auth-ghost:active { transform: scale(.96); }
.gi-login { opacity: 0; transform: translateX(-24px); pointer-events: none; }
.is-login .gi-login { opacity: 1; transform: none; pointer-events: auto; }
.is-login .gi-signup { opacity: 0; transform: translateX(24px); pointer-events: none; }
.is-login .p-signup, .auth:not(.is-login) .p-login { opacity: 0; pointer-events: none; transform: scale(.97); }
@keyframes authRise { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes authFloat { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(24px, 18px); } }
@keyframes authShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; min-height: 0; border-radius: 24px; }
  .glass { display: none; }
  .auth .panel { padding: 30px 20px 24px; transform: none !important; opacity: 1 !important; pointer-events: auto !important; }
  .auth .m-switch { display: block; }
  .auth:not(.is-login) .p-login, .auth.is-login .p-signup { display: none; }
  .auth .panel h2 { font-size: 26px; padding-right: 36px; }
  .auth-brand { font-size: 22px; }
  .auth-wrap { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .glass, .glass-in, .auth .panel, .auth .blob, .auth-wrap, .auth-error { transition-duration: .01ms !important; animation: none !important; }
}
#login-btn.auth-btn, #su-create.auth-btn { background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; }
.auth .signup-status:empty { display: none; }
.auth .btn-spinner { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }

/* ===== chat list: pinned, archived, marked as unread ===== */
.conversation-item[hidden] { display: none !important; }
.conversation-item.is-pinned { background: rgba(255, 255, 255, .025); }
.conversation-meta .pin-icon { display: inline-flex; color: #8a8a96; margin-top: 4px; }
.conversation-meta .unread-dot { width: 11px; height: 11px; margin-top: 4px; border-radius: 50%; background: #ff4d6d; box-shadow: 0 0 0 3px #141414; animation: lcPop .25s ease-out; }
.archived-row, .archived-head {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; margin-bottom: 8px; border: 0; border-radius: 14px; cursor: pointer; text-align: left;
  background: #141414; color: #d4d4d8; font: inherit; font-size: 15px; font-weight: 600; transition: background .15s, transform .12s;
}
.archived-row:hover, .archived-head:hover { background: #1c1c1c; }
.archived-row:active, .archived-head:active { transform: scale(.985); }
.archived-row svg { color: #8a8a96; }
.archived-row b { margin-left: auto; font-weight: 600; color: #8a8a96; font-size: 13px; }
@keyframes lcPop { from { transform: scale(0); } to { transform: scale(1); } }

/* ===== disappearing messages ===== */
.system-line { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 10px auto; padding: 7px 14px; max-width: 86%; width: fit-content; border-radius: 14px; background: rgba(255, 255, 255, .06); color: #a1a1aa; font-size: 12.5px; line-height: 1.4; text-align: center; animation: lcPop .25s ease-out; }
.system-line svg { width: 14px; height: 14px; flex: none; }
.msg-vanish { opacity: 0; transform: scale(.92); transition: opacity .3s, transform .3s; pointer-events: none; }
.thread-timer { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 2px 7px; border-radius: 10px; background: rgba(255, 255, 255, .08); color: #a1a1aa; font-size: 11px; font-weight: 600; vertical-align: middle; }
.thread-timer[hidden] { display: none; }
.thread-timer svg { width: 12px; height: 12px; }
.contact-info-list-item .row-value { margin-left: auto; font-style: normal; color: #8a8a96; font-size: 13px; }
.timer-sheet-title { padding: 14px 18px 8px; font-weight: 700; font-size: 16px; }
.timer-sheet-title small { display: block; margin-top: 4px; font-weight: 400; font-size: 12.5px; line-height: 1.4; color: #8a8a96; }
.timer-choice .timer-check { margin-left: auto; color: #4ade80; }
.timer-choice.current { color: #fff; }
/* a notice (e.g. "Turn on notifications") must not sit on top of an open menu or sheet */
body:has(.msg-action-overlay.open) #e2e-notice { opacity: 0; pointer-events: none; transition: opacity .15s; }

/* ===== link previews, shared locations and contacts ===== */
.msg-link { color: #8ab4ff; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.msg-bubble.mine .msg-link { color: inherit; }
.rich-card { display: flex; gap: 10px; margin: 6px 0 2px; border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, .22); color: inherit; text-decoration: none; text-align: left; transition: background .15s, transform .12s; }
.rich-card:hover { background: rgba(0, 0, 0, .3); }
.rich-card:active { transform: scale(.985); }
.rich-card img { width: 72px; height: 72px; object-fit: cover; flex: none; }
.rich-card .rc-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 8px 10px 8px 0; }
.rich-card.link-card .rc-text, .rich-card.loc-card .rc-text { padding-left: 0; }
.rich-card .rc-text b { font-size: 13.5px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rich-card .rc-desc { font-size: 12px; opacity: .8; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rich-card .rc-site { font-size: 11px; opacity: .6; }
.link-card:not(:has(img)) .rc-text { padding-left: 10px; }
.loc-art { width: 72px; min-height: 72px; flex: none; display: grid; place-items: center; color: #fff; background: radial-gradient(circle at 30% 30%, #3aa57a, #1f6e51); }
.loc-art svg { width: 30px; height: 30px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .4)); }
.contact-card { align-items: center; padding: 8px 10px; }
.contact-card .rc-text { padding: 0; flex: 1; }
.cc-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; overflow: hidden; }
.cc-avatar.sm { width: 34px; height: 34px; font-size: 14px; }
.cc-btn { flex: none; padding: 7px 12px; border: 0; border-radius: 16px; background: #3b82f6; color: #fff; font-weight: 700; font-size: 12.5px; cursor: pointer; }
.cc-btn:disabled { opacity: .6; }
.contact-pick { max-height: 46vh; overflow-y: auto; }
.contact-pick .msg-action-item span small { display: block; opacity: .6; font-size: 12px; }
.link-preview-bar { display: flex; align-items: center; gap: 10px; margin: 0 8px 6px; padding: 8px 10px; border-radius: 14px; background: #1c1c1c; border: 1px solid rgba(255, 255, 255, .08); animation: lcPop .2s ease-out; }
.link-preview-bar.hidden { display: none; }
.link-preview-bar img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.link-preview-bar .lpb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.link-preview-bar .lpb-text b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-preview-bar .lpb-text span { font-size: 11.5px; color: #8a8a96; }
.link-preview-bar .lpb-x { width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .08); color: #ccc; display: grid; place-items: center; cursor: pointer; }
.link-preview-bar .lpb-x svg { width: 14px; height: 14px; }
.thread-title-block .thread-timer { align-self: flex-start; margin: 2px 0 0; }

/* ===== polls ===== */
.poll-card { flex-direction: column; gap: 6px; padding: 10px 12px; min-width: 220px; }
.poll-card .poll-q { font-size: 14px; line-height: 1.35; }
.poll-card .poll-sub { font-size: 11.5px; opacity: .65; margin-bottom: 2px; }
.poll-opt { position: relative; display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px; background: transparent; color: inherit; font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; overflow: hidden; transition: border-color .15s, background .15s; }
.poll-opt:hover { background: rgba(255, 255, 255, .05); }
.poll-opt.on { border-color: #3b82f6; }
.poll-opt .poll-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: #3b82f6; transition: width .4s var(--a-ease, ease); }
.poll-opt .poll-label { flex: 1; min-width: 0; overflow-wrap: anywhere; position: relative; }
.poll-opt .poll-n { font-size: 12px; opacity: .7; position: relative; }
.poll-mark { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .4); position: relative; }
.poll-mark.multi { border-radius: 4px; }
.poll-opt.on .poll-mark { border-color: #3b82f6; background: #3b82f6; box-shadow: inset 0 0 0 3px #1c1c1c; }
.poll-form input[type=text] { margin-bottom: 8px; }
.poll-form .poll-multi { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; font-size: 14px; color: #ccc; }
.poll-form .poll-multi input { width: auto; margin: 0; }

/* ===== starred messages ===== */
.star-mark { color: #fbbf24; font-size: .95em; }

/* ===== settings panels ===== */
.app-panel { position: fixed; inset: 0; z-index: 900; display: flex; flex-direction: column; background: #0a0a0a; color: #f4f4f5; transform: translateX(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.app-panel.in { transform: none; }
.app-panel .chat-list-header { flex: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.app-panel .chat-list-header h2 { font-size: 20px; }
.panel-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 28px; max-width: 640px; width: 100%; margin: 0 auto; }
.panel-empty, .panel-loading { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 60px 20px; text-align: center; color: #8a8a96; }
.panel-empty svg { width: 44px; height: 44px; opacity: .6; }
.panel-empty small { font-size: 13px; }
.settings-list { display: flex; flex-direction: column; gap: 8px; }
.settings-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 15px 14px; border: 0; border-radius: 14px; background: #141414; color: inherit; font: inherit; font-size: 15px; cursor: pointer; text-align: left; transition: background .15s, transform .12s; }
.settings-row:hover { background: #1c1c1c; }
.settings-row:active { transform: scale(.985); }
.settings-row > svg:first-child { width: 22px; height: 22px; color: #8ab4ff; flex: none; }
.settings-row .sr-label { flex: 1; }
.settings-row .sr-value { font-style: normal; color: #8a8a96; font-size: 13px; }
.settings-row .row-arrow { width: 18px; height: 18px; color: #6b6b76; flex: none; }
.settings-group { margin-top: 18px; padding: 16px; border-radius: 16px; background: #141414; }
.settings-group h3 { font-size: 15px; margin-bottom: 4px; }
.settings-group p { color: #8a8a96; font-size: 13px; line-height: 1.45; margin-bottom: 12px; }
.settings-note { min-height: 20px; margin-top: 12px; text-align: center; color: #8a8a96; font-size: 13px; }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: #0a0a0a; }
.seg-btn { flex: 1; padding: 10px 6px; border: 0; border-radius: 9px; background: transparent; color: #a1a1aa; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background .2s, color .2s; }
.seg-btn.on { background: #3b82f6; color: #fff; }
.starred-list { display: flex; flex-direction: column; gap: 8px; }
.starred-item { display: block; width: 100%; padding: 12px 14px; border: 0; border-radius: 14px; background: #141414; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background .15s; }
.starred-item:hover { background: #1c1c1c; }
.starred-item .si-top { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: #8a8a96; margin-bottom: 4px; }
.starred-item .si-top b { color: #8ab4ff; }
.starred-item .si-text { font-size: 14.5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; word-break: break-word; }
.msg-flash { animation: msgFlash 1.6s ease; }
@keyframes msgFlash { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 20%, 60% { box-shadow: 0 0 0 4px rgba(59, 130, 246, .55); } }
@media (prefers-reduced-motion: reduce) { .app-panel { transition: none; } }

/* ===== report ===== */
.report-form { display: flex; flex-direction: column; gap: 16px; padding-top: 8px; }
.report-lead { color: #a1a1aa; font-size: 14px; line-height: 1.5; }
.report-lead b { color: #fff; } .report-lead span { opacity: .7; }
.report-reasons { border: 0; display: flex; flex-direction: column; gap: 6px; }
.report-reasons legend { font-size: 13px; color: #8a8a96; margin-bottom: 8px; }
.report-reason { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: #141414; cursor: pointer; transition: background .15s; }
.report-reason:hover { background: #1c1c1c; }
.report-reason input { accent-color: #3b82f6; width: 18px; height: 18px; margin: 0; }
.report-reason:has(input:checked) { box-shadow: inset 0 0 0 1.5px #3b82f6; }
.report-field { display: flex; flex-direction: column; gap: 8px; }
.report-field > span { font-size: 13px; color: #8a8a96; }
.report-field small { font-size: 12px; color: #6b6b76; line-height: 1.45; }
.report-field textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid #2a2a2a; background: #141414; color: #fff; font: inherit; font-size: 15px; resize: vertical; }
.report-field textarea:focus { outline: 0; border-color: #3b82f6; }
.report-shots { display: flex; gap: 10px; flex-wrap: wrap; }
.report-shot { position: relative; width: 84px; height: 84px; border-radius: 12px; overflow: hidden; animation: lcPop .2s ease-out; }
.report-shot img { width: 100%; height: 100%; object-fit: cover; }
.report-shot button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .7); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.report-add { padding: 12px; border: 1.5px dashed #3a3a44; border-radius: 12px; background: transparent; color: #8ab4ff; font: inherit; font-weight: 600; cursor: pointer; transition: background .15s; }
.report-add:hover { background: rgba(59, 130, 246, .08); }
.report-add.hidden { display: none; }
.report-done { gap: 14px; } .report-done svg { color: #4ade80; opacity: 1; } .report-done p { color: #fff; font-size: 17px; font-weight: 600; }
.report-done .auth-btn { max-width: 320px; }
.pill-btn.report-link { background: transparent; color: #f87171; }

/* ===== invite links and QR ===== */
.invite-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 20px 16px; border-radius: 18px; background: #141414; }
.invite-qr { width: 200px; height: 200px; border-radius: 14px; background: #fff; padding: 8px; image-rendering: pixelated; }
.invite-url { max-width: 100%; font-size: 13px; color: #8ab4ff; word-break: break-all; text-align: center; }
.invite-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }
.group-invite { margin: 10px 0; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .04); text-align: left; }
.group-invite h3 { font-size: 14px; margin: 6px 0; }
.group-invite p { font-size: 13px; color: #8a8a96; margin-bottom: 8px; }
.group-invite .invite-card { background: transparent; padding: 8px 0; }
.group-invite .invite-qr { width: 150px; height: 150px; }
.scan-overlay { position: fixed; inset: 0; z-index: 1100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: #000; color: #fff; }
.scan-overlay video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: relative; width: min(70vw, 280px); aspect-ratio: 1; border: 3px solid #fff; border-radius: 24px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .55); }
.scan-overlay p, .scan-overlay button { position: relative; }
.scan-overlay p { text-shadow: 0 1px 6px #000; }
.call-action-btn.on { background: #3b82f6; }

/* ===== language picker ===== */
.auth-lang { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 20px; background: rgba(255, 255, 255, .06); color: #d4d4d8; font: inherit; font-size: 13px; cursor: pointer; transition: background .2s; }
.auth-lang:hover { background: rgba(255, 255, 255, .12); }
.auth-lang svg { width: 16px; height: 16px; }
.lang-choice.current { color: #fff; }

/* ===== GIF picker ===== */
.gif-search { margin: 8px 0 12px; }
.gif-grid { display: flex; gap: 8px; align-items: flex-start; }
.gif-col { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.gif-item { position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: #1c1c1c; cursor: pointer; animation: lcPop .2s ease-out; transition: transform .12s; }
.gif-item:active { transform: scale(.97); }
.gif-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gif-item.busy::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .5) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M12 3a9 9 0 1 0 9 9' stroke-linecap='round'/%3E%3C/svg%3E") center / 30px no-repeat; }
.gif-more { text-align: center; color: #8a8a96; font-size: 13px; padding: 14px; min-height: 20px; }
.gif-credit { text-align: center; color: #6b6b76; font-size: 11px; padding: 8px 0 20px; }

/* ===== polish: loading, motion, touch ===== */
.skeleton-card { border-radius: 14px; background: linear-gradient(90deg, #161616 25%, #232323 37%, #161616 63%); background-size: 400% 100%; animation: skeleton-pulse 1.4s ease infinite; min-height: 120px; }
.conv-skeleton { pointer-events: none; animation: lcRise .35s both; }
.conv-skeleton .conversation-avatar { background: none; }
.conv-skeleton .sk-line { height: 12px; border-radius: 6px; margin: 6px 0; }
.conv-skeleton .sk-line.short { height: 10px; }
.list-intro .conversation-item { animation: lcRise .38s cubic-bezier(.2, .8, .2, 1) both; }
.list-intro .conversation-item:nth-child(2) { animation-delay: .04s; } .list-intro .conversation-item:nth-child(3) { animation-delay: .08s; }
.list-intro .conversation-item:nth-child(4) { animation-delay: .12s; } .list-intro .conversation-item:nth-child(5) { animation-delay: .16s; }
.list-intro .conversation-item:nth-child(n+6) { animation-delay: .2s; }
@keyframes lcRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
/* pictures fade in as they arrive instead of popping */
img[loading="lazy"] { animation: lcFade .35s ease both; }
@keyframes lcFade { from { opacity: 0; } to { opacity: 1; } }
/* the tap itself feels like something happened */
button:not(:disabled), [role="button"], .conversation-item, .settings-row, .starred-item { touch-action: manipulation; }
.conversation-item { transition: background-color .15s ease, transform .12s ease; }
.conversation-item:active { transform: scale(.985); }
.icon-circle-btn, .attach-menu-item, .msg-action-item, .main-menu-item, .contact-info-list-item { transition: background-color .15s ease, transform .12s ease; }
.icon-circle-btn:active, .msg-action-item:active { transform: scale(.94); }
/* keyboard users can see where they are */
:focus-visible { outline: 2px solid #60a5fa; outline-offset: 2px; }
input:focus-visible, textarea:focus-visible { outline-offset: 0; }
/* smoother, calmer scrolling in the long lists */
#message-list, .group-chat-list, .panel-body, #conversation-list, .contact-pick { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
html { scroll-padding-top: 72px; }
/* people who ask their phone for less motion get none */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
.locked-row svg { color: #8ab4ff; }

/* ===== display fixes found in the audit ===== */
/* a notice must not sit on top of a menu, a sheet, a panel or a dialog */
body:has(.attach-menu:not(.hidden)) #e2e-notice,
body:has(#main-menu-overlay.open) #e2e-notice,
body:has(.app-panel.in) #e2e-notice,
body:has(.modal-overlay:not(.hidden)) #e2e-notice,
body:has(.auth-overlay:not(.hidden)) #e2e-notice { opacity: 0; pointer-events: none; transition: opacity .15s; }
/* the attach menu now has more entries: it scrolls on a short screen instead of running off it */
.attach-menu { max-height: calc(100dvh - 190px); overflow-y: auto; overscroll-behavior: contain; }

/* Settings: links, delete account */
a.settings-row { text-decoration: none; }
.settings-row.danger { color: #ff8a8a; }
.settings-row.danger > svg:first-child { color: #ff8a8a; }
.settings-input { width: 100%; margin: 12px 0 10px; padding: 13px 14px; border: 1px solid #2a2a2a; border-radius: 12px; background: #101010; color: inherit; font: inherit; font-size: 16px; }
.settings-input:focus-visible { outline: 2px solid #93c5fd; outline-offset: 1px; }
.settings-check { display: flex; align-items: flex-start; gap: 10px; margin: 6px 0 14px; font-size: 14px; color: #cfcfd6; }
.settings-check input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.settings-danger-btn { width: 100%; padding: 14px; border: 0; border-radius: 999px; background: #d93a3a; color: #fff; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; transition: filter .15s, transform .12s; }
.settings-danger-btn:hover:not(:disabled) { filter: brightness(1.1); }
.settings-danger-btn:active:not(:disabled) { transform: scale(.98); }
.settings-danger-btn:disabled { opacity: .45; cursor: default; }
