/* In-game communication (Vault board 1575): quick chat in a match, friend chat, the Safety block. */

/* ---- quick chat: bubbles sit on the seat's own yard, inside the seat-label layer (pointer-events: none) ---- */
.quick-chat-bubble {
  position: absolute;
  max-width: 31%;
  padding: 4px 9px;
  border-radius: 12px;
  background: #fff;
  color: #14142b;
  font: 800 12px/1.2 system-ui, sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
  animation: quick-chat-pop .18s ease-out;
}
.quick-chat-bubble.quick-chat-reaction { padding: 2px 8px; font-size: 22px; line-height: 1.15; }
.quick-chat-bubble[data-seat="blue"] { left: 4.4%; top: 25%; }
.quick-chat-bubble[data-seat="yellow"] { right: 4.4%; top: 25%; }
.quick-chat-bubble[data-seat="red"] { left: 4.4%; bottom: 10.5%; }
.quick-chat-bubble[data-seat="green"] { right: 4.4%; bottom: 10.5%; }
@keyframes quick-chat-pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .quick-chat-bubble { animation: none; } }
body.calm-mode .quick-chat-bubble { animation: none; }
@media (max-width: 720px) {
  .quick-chat-bubble { font-size: 11px; padding: 3px 7px; }
  .quick-chat-bubble.quick-chat-reaction { font-size: 18px; }
}

/* ---- quick chat: the palette covers the bottom bar while open, never the board (comms.js places it) ---- */
.quick-chat-palette {
  position: fixed;
  z-index: 60;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) 12px;
  background: #14142b;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 14px 14px 0 0;
  color: #fff;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.quick-chat-palette[hidden] { display: none; }
.comms-palette-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.comms-status { flex: 0 0 auto; margin: 0; color: #ffd27a; font-size: .78rem; font-weight: 700; }
.comms-chat-panel .comms-status { min-height: 1.2em; }
.comms-close {
  flex: 0 0 auto; width: 40px; height: 40px; border: 1px solid rgba(255, 255, 255, .4); border-radius: 10px;
  background: transparent; color: #fff; font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.quick-chat-palette[data-layout="rows"] .comms-chips.comms-row { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding-bottom: 1px; }
.quick-chat-palette[data-layout="rows"] .comms-chips.comms-row::-webkit-scrollbar { display: none; }
.quick-chat-palette[data-layout="rows"] .comms-chips.comms-row .comms-chip { flex: 0 0 auto; white-space: nowrap; }
.comms-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.comms-chip {
  min-height: 40px; padding: 6px 12px; border: 1px solid rgba(255, 255, 255, .34); border-radius: 999px;
  background: rgba(255, 255, 255, .08); color: #fff; font: 800 .84rem/1.1 inherit; cursor: pointer;
}
.comms-chip.comms-reaction { min-width: 44px; padding: 2px 8px; font-size: 1.25rem; }
.comms-chip:hover, .comms-chip:focus-visible { background: #f3ff20; color: #11132f; outline: none; }
.comms-recent { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.comms-recent-line { display: flex; align-items: center; gap: 6px; font-size: .8rem; }
.comms-recent-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comms-quiet {
  flex: 0 0 auto; min-height: 32px; padding: 4px 10px; border: 1px solid rgba(255, 255, 255, .3); border-radius: 8px;
  background: transparent; color: rgba(255, 255, 255, .86); font: 700 .72rem/1 inherit; cursor: pointer;
}
.comms-quiet:hover, .comms-quiet:focus-visible { border-color: #fff; color: #fff; outline: none; }
.comms-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- friend chat ---- */
.comms-chat-overlay {
  position: fixed; inset: 0; z-index: 400; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(3, 3, 24, .72);
}
.comms-chat-overlay[hidden] { display: none; }
.comms-chat-panel {
  box-sizing: border-box; display: flex; flex-direction: column; gap: 8px;
  width: min(520px, 100vw); max-height: min(640px, 100dvh); padding: 14px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  border-radius: 18px 18px 0 0; background: #1b1b3a; color: #fff;
}
@media (min-width: 720px) { .comms-chat-overlay { align-items: center; } .comms-chat-panel { border-radius: 18px; } }
.comms-thread-head { display: flex; align-items: center; gap: 8px; }
.comms-thread-head h2 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 1.05rem; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comms-messages {
  flex: 1 1 auto; min-height: 120px; margin: 0; padding: 4px 2px; list-style: none; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.comms-msg { display: flex; align-items: center; gap: 6px; max-width: 86%; align-self: flex-start; }
.comms-msg.comms-mine { align-self: flex-end; }
.comms-msg-text {
  padding: 7px 11px; border-radius: 14px; background: rgba(255, 255, 255, .12); font-size: .9rem; font-weight: 600;
  overflow-wrap: anywhere; user-select: text;
}
.comms-msg.comms-mine .comms-msg-text { background: #f3ff20; color: #11132f; }
.comms-empty { color: rgba(255, 255, 255, .62); font-size: .84rem; }
.comms-thread-chips { flex: 0 0 auto; max-height: 96px; overflow-y: auto; }
.comms-text-form { display: flex; gap: 8px; }
.comms-text-form input {
  flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 12px; border: 1px solid rgba(255, 255, 255, .3); border-radius: 12px;
  background: rgba(10, 8, 36, .6); color: #fff; font: inherit; font-size: 16px;
}
.comms-send { min-height: 44px; padding: 0 16px; border: 1px solid #f3ff20; border-radius: 12px; background: #f3ff20; color: #11132f; font-weight: 900; cursor: pointer; }
.comms-note { margin: 0; color: rgba(255, 255, 255, .62); font-size: .72rem; }

/* ---- Safety block and the Chat button in the Friends panel ---- */
.comms-safety { position: relative; z-index: 3; width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 0 0 24px; color: #fff; }
.comms-safety[hidden] { display: none; }
.comms-safety h3 { margin: 0 0 6px; color: rgba(255, 255, 255, .72); font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.comms-safety-row { display: flex; align-items: center; gap: 10px; max-width: 560px; min-height: 44px; padding: 8px 10px; border-radius: 12px; background: rgba(10, 8, 36, .45); }
.comms-safety-copy { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.comms-safety-copy strong { font-weight: 800; }
.comms-safety-copy small { color: rgba(255, 255, 255, .7); font-size: .76rem; }
.friends-btn.friends-chat[data-unread="true"]::after {
  content: ''; display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: #ff5d73; vertical-align: 1px;
}
