.message-ctx-menu {
  position: fixed;
  z-index: 12050;
  min-width: 11.5rem;
  max-width: min(18rem, calc(100vw - 16px));
  padding: 0.35rem 0;
  border-radius: 12px;
  background: var(--surface-elevated, #1e1f24);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: scale(0.96) translateY(4px);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.message-ctx-menu.is-open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.message-ctx-menu__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.message-ctx-menu__item:hover,
.message-ctx-menu__item:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.message-ctx-menu__item--danger {
  color: #f87171;
}

.message-ctx-menu__sep {
  height: 1px;
  margin: 0.25rem 0.5rem;
  background: rgba(255, 255, 255, 0.08);
}

.bubble--selection-mode {
  cursor: pointer;
}

.bubble--selection-mode::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  opacity: 0;
  transition: opacity 0.12s ease, background 0.12s ease;
}

.bubble--selection-mode.bubble--forward-selected::before,
.bubble--selection-mode.bubble--msg-selected::before {
  opacity: 1;
  background: var(--accent, #5b8def);
  border-color: var(--accent, #5b8def);
  box-shadow: inset 0 0 0 3px #fff;
}

.bubble-context--reply .bubble-context-author {
  font-weight: 600;
  font-size: 12px;
}

.bubble-context--reply .bubble-context-snippet {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.msg-tools--selection .msg-tools-count {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-right: 0.35rem;
  white-space: nowrap;
}

@media (min-width: 921px) {
  .msg-tools--selection .msg-tools-count {
    font-size: 12px;
    opacity: 1;
    margin-right: 0;
  }
}

@media (max-width: 768px) {
  .message-ctx-menu {
    left: 8px !important;
    right: 8px !important;
    bottom: max(12px, env(safe-area-inset-bottom, 12px)) !important;
    top: auto !important;
    width: auto;
    max-width: none;
    border-radius: 16px 16px 12px 12px;
    transform: translateY(12px);
  }
  .message-ctx-menu.is-open {
    transform: translateY(0);
  }
}
