/* chat.css: replies, reactions and @mentions in rooms and parties. One flat feed, no
   threads: a reply is a normal message with a small quote of what it answers. */

.party-messages .pmsg { position: relative; }
.party-messages .pmsg:not(.sys) { border-radius: 12px; padding: 4px 6px; margin: 0 -6px; transition: background 160ms ease; }
@media (hover: hover) { .party-messages .pmsg:not(.sys):hover { background: rgba(255, 255, 255, 0.04); } }

/* Actions: show on hover (desktop) or after a tap (phones). */
.pm-actions { position: absolute; top: -16px; right: 8px; z-index: 5; display: none; gap: 2px; padding: 3px; border-radius: 12px;
  background: rgba(20, 20, 28, 0.94); border: 1px solid rgba(255, 255, 255, 0.12); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
@media (hover: hover) { .party-messages .pmsg:hover > .pm-actions { display: flex; } }
.party-messages .pmsg.show-actions > .pm-actions { display: flex; }
.pm-actions button { min-width: 36px; height: 32px; padding: 0 8px; border: none; border-radius: 9px; background: transparent; color: #fff; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.pm-actions button:hover, .pm-actions button:focus-visible { background: rgba(255, 255, 255, 0.12); color: #fff; outline: none; }
@media (hover: none) { .pm-actions button { min-width: 44px; height: 40px; } }

/* Emoji picker and the More menu. */
.pm-pop { position: absolute; right: 8px; top: 20px; z-index: 6; padding: 6px; border-radius: 14px; background: rgba(20, 20, 28, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55); animation: pm-pop 140ms ease-out; }
@keyframes pm-pop { from { opacity: 0; transform: translateY(-4px) scale(0.97); } to { opacity: 1; transform: none; } }
.pm-picker { display: flex; gap: 2px; }
.pm-picker button { width: 40px; height: 40px; border: none; border-radius: 10px; background: transparent; font-size: 21px; cursor: pointer; }
.pm-picker button:hover { background: rgba(255, 255, 255, 0.12); transform: scale(1.12); }
.pm-menu { display: flex; flex-direction: column; min-width: 190px; }
.pm-menu button { text-align: left; min-height: 40px; padding: 0 12px; border: none; border-radius: 9px; background: transparent; color: #fff; font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.pm-menu button:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

/* The quote above a reply. Tapping it jumps to the original message. */
.pm-quote { display: block; max-width: 100%; margin: 2px 0 4px; padding: 4px 10px; border: none; border-left: 3px solid #ff2d87; border-radius: 4px 10px 10px 4px;
  background: rgba(255, 255, 255, 0.05); color: rgba(255, 255, 255, 0.62); font: inherit; font-size: 13px; line-height: 1.4; text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-quote b { color: rgba(255, 255, 255, 0.85); font-weight: 700; }
.pm-quote:hover { background: rgba(255, 255, 255, 0.09); }
.pmsg.me .pm-quote { margin-left: auto; }
.is-room .pmsg.me .pm-quote { margin-left: 0; }

/* Reactions under a message. */
.pm-reacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pm-reacts[hidden] { display: none; }
.pmsg.me:not(.is-room *) .pm-reacts { justify-content: flex-end; }
.pm-react { min-height: 28px; padding: 0 9px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.06);
  color: #fff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.pm-react:hover { border-color: rgba(255, 255, 255, 0.3); }
.pm-react.mine { border-color: rgba(255, 45, 135, 0.7); background: rgba(255, 45, 135, 0.18); }

/* @mentions: names stand out; a mention of YOU is highlighted, and so is its message. */
.pm-mention { color: #ff7ab3; font-weight: 700; }
.pm-mention.me { color: #fff; background: rgba(255, 45, 135, 0.35); border-radius: 5px; padding: 0 3px; }
.party-messages .pmsg.mentions-me { background: rgba(255, 45, 135, 0.08); box-shadow: inset 3px 0 0 #ff2d87; }

/* A jumped-to message flashes briefly. */
.party-messages .pmsg.flash { animation: pm-flash 1.4s ease-out; }
@keyframes pm-flash { 0%, 30% { background: rgba(255, 45, 135, 0.22); } 100% { background: transparent; } }

/* Reply preview and mention suggestions, both sitting just above the message box. */
.reply-bar { display: flex; align-items: center; gap: 8px; margin: 0 10px; padding: 8px 8px 8px 12px; border-radius: 12px 12px 0 0;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); border-bottom: none; border-left: 3px solid #ff2d87; font-size: 13.5px; color: rgba(255, 255, 255, 0.7); }
.reply-bar[hidden] { display: none; }
.rb-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-text b { color: #fff; }
.rb-x { flex: none; width: 36px; height: 36px; border: none; border-radius: 50%; background: transparent; color: rgba(255, 255, 255, 0.8); font-size: 15px; cursor: pointer; }
.rb-x:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.mention-box { display: flex; flex-direction: column; margin: 0 10px 6px; padding: 4px; border-radius: 12px; background: rgba(20, 20, 28, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); max-width: 280px; }
.mention-box[hidden] { display: none; }
.mention-opt { text-align: left; min-height: 40px; padding: 0 12px; border: none; border-radius: 9px; background: transparent; color: #fff; font: inherit; font-size: 14.5px; font-weight: 700; cursor: pointer; }
.mention-opt.sel, .mention-opt:hover { background: rgba(255, 45, 135, 0.22); color: #fff; }

@media (prefers-reduced-motion: reduce) { .pm-pop, .party-messages .pmsg.flash { animation: none; } .pm-picker button:hover { transform: none; } }
/* "you" tag next to your own name. */
.pm-you { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.28); font-size: 10.5px; font-weight: 800;
  letter-spacing: 0.4px; text-transform: uppercase; color: rgba(255, 255, 255, 0.8); vertical-align: 2px; }
.pmsg-handle .pm-you + time { margin-left: 6px; }

/* Members-only room, opened by a guest. */
.members-only { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(8, 8, 12, 0.82);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-radius: inherit; }
.room-chat { position: relative; }
.mo-card { max-width: 360px; text-align: center; padding: 24px 20px; border-radius: 20px; background: rgba(20, 20, 28, 0.96); border: 1px solid rgba(255, 255, 255, 0.12); color: #fff; }
.mo-badge { display: inline-block; padding: 4px 10px; border-radius: 999px; background: rgba(255, 45, 135, 0.18); border: 1px solid rgba(255, 45, 135, 0.6); color: #ff7ab3; font-size: 12px; font-weight: 800; letter-spacing: 0.4px; text-transform: uppercase; }
.mo-card h2 { font-family: "Outfit", sans-serif; font-size: 24px; margin: 12px 0 6px; }
.mo-card p { color: rgba(255, 255, 255, 0.72); font-size: 15px; line-height: 1.5; margin: 0 0 16px; }
.mo-btns { display: flex; gap: 8px; }
.mo-btns button { flex: 1; min-height: 48px; border-radius: 14px; font: inherit; font-weight: 700; font-size: 15.5px; cursor: pointer; }
.mo-up { background: #ff2d87; color: #fff; border: none; }
.mo-up:hover { background: #ff479a; color: #fff; }
.mo-in { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.3); }
.mo-in:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.mo-back { display: inline-block; margin-top: 12px; color: rgba(255, 255, 255, 0.7); font-size: 14px; text-decoration: none; padding: 8px; }
.mo-back:hover { color: #fff; text-decoration: underline; }

/* Emoji button and picker in the message box. */
.composer { position: relative; }
.emoji-btn { flex: none; width: 44px; height: 44px; border: none; border-radius: 12px; background: transparent; font-size: 22px; cursor: pointer; align-self: center; }
.emoji-btn:hover { background: rgba(255, 255, 255, 0.1); }
.emoji-box { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; margin: 0 10px 6px; padding: 8px; max-width: 380px; max-height: 240px; overflow-y: auto;
  border-radius: 16px; background: rgba(20, 20, 28, 0.97); border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5); }
.emoji-box[hidden] { display: none; }
.emoji-box button { height: 40px; border: none; border-radius: 10px; background: transparent; font-size: 22px; cursor: pointer; }
.emoji-box button:hover { background: rgba(255, 255, 255, 0.12); }
@media (max-width: 420px) { .emoji-box { grid-template-columns: repeat(7, 1fr); } }
/* Not enough room below (last messages): the menu opens upward, above the action bar. */
.pm-pop.up { top: auto; bottom: calc(100% + 20px); }
/* Room header on phones: Random chat drops out first, then Rooms (the "All rooms" link covers it). */
@media (max-width: 480px) { .app-topbar-right .nav-random { display: none; } }
/* "guest" tag next to a guest's name (no account yet), in messages and the member list. */
.pm-guest { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.4px; text-transform: uppercase; color: rgba(255, 255, 255, 0.7); vertical-align: 2px; }
.pmsg-handle .pm-guest + time { margin-left: 6px; }
.m-badge.guest { border-radius: 999px; padding: 3px 9px; background: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.75); }
