/* Native text callouts are replaced only on chat bubbles; composing stays editable. */
#live-chat-messages .chat-message-content,
#live-chat-messages .chat-message-content * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#live-chat-messages .chat-message-content { touch-action: pan-y; }
#live-chat-messages .chat-message-content:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
  border-radius: 14px;
}
#live-chat-messages .message-menu-selected .chat-message-content > p {
  box-shadow: 0 0 0 2px var(--accent), 0 4px 16px #00000012;
}

.chat-message-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #00000014;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}
.chat-message-action-menu {
  position: fixed;
  z-index: 91;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  width: 216px;
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 36px #00000032, 0 2px 6px #0000001a;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  animation: chat-message-menu-in .14s ease-out;
}
body .chat-message-action-menu .chat-message-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 44px;
  min-height: 64px;
  padding: 10px 5px;
  margin: 0;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: none !important;
  transition: background-color .12s ease, color .12s ease;
}
.chat-message-action-menu .chat-message-action svg,
.chat-forward-target > svg {
  display: block;
  flex-shrink: 0;
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
body .chat-message-action-menu .chat-message-action:disabled {
  opacity: .36;
  cursor: default;
}
body .chat-message-action-menu .chat-message-action:not(:disabled):active,
body .chat-forward-list .chat-forward-target:not(:disabled):active {
  background: var(--accent-soft);
  color: var(--accent);
  translate: none;
  transform: none;
  box-shadow: none !important;
}
body .chat-message-action-menu .chat-message-action:focus-visible,
body .chat-forward-list .chat-forward-target:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
[data-theme="light"] .chat-message-action-menu {
  box-shadow: 0 12px 36px #244c8520, 0 2px 6px #244c8510;
}

.chat-forward-list {
  display: grid;
  gap: 4px;
  max-height: min(52dvh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 12px -6px 0;
  padding: 4px 6px;
}
body .chat-forward-list .chat-forward-target {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 66px;
  padding: 10px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 15px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: none !important;
  transition: background-color .12s ease;
}
.chat-forward-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
}
.chat-forward-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.chat-forward-target > span:not(.chat-forward-avatar) {
  display: grid;
  gap: 5px;
  flex: 1;
  min-width: 0;
}
.chat-forward-target b,
.chat-forward-target small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-forward-target b { font-size: 14px; font-weight: 550; line-height: 1.5; }
.chat-forward-target small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.chat-forward-target > svg { width: 17px; height: 17px; color: var(--muted); }
body .chat-forward-list .chat-forward-target:disabled { cursor: wait; opacity: .5; }

@media (hover: hover) and (pointer: fine) {
  body .chat-message-action-menu .chat-message-action:not(:disabled):hover,
  body .chat-forward-list .chat-forward-target:not(:disabled):hover {
    background: var(--accent-soft);
    color: var(--accent);
    filter: none;
  }
}
@keyframes chat-message-menu-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .chat-message-action-menu { animation: none; }
  body .chat-message-action-menu .chat-message-action,
  body .chat-forward-list .chat-forward-target { transition: none; }
}
