/* Ephemeral room chat: docked in lobbies and overlaid directly during matches. */
.chat-overlay {
  position: fixed;
  z-index: calc(var(--hud-z) + 4);
  left: 50%;
  bottom: calc(var(--bottom-hud-height) + 28px);
  transform: translateX(-50%);
  width: clamp(280px, 42vw, 640px);
  max-width: calc(100vw - 24px);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.35;
  pointer-events: none;
  text-shadow: 0 1px 2px #000, 1px 1px 0 #000;
}

.chat-overlay[data-scope="lobby"] { bottom: 28px; }

.chat-messages {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
  min-height: 1.35em;
  margin-bottom: 5px;
}

.chat-message {
  overflow-wrap: anywhere;
  transition: opacity 0.45s ease;
}

.chat-message-team,
.chat-channel { color: #b7d7a8; }

.chat-message.is-fading { opacity: 0; }

.chat-composer {
  display: flex;
  align-items: baseline;
  gap: 7px;
  pointer-events: auto;
}

.chat-composer[hidden] { display: none; }

.chat-channel {
  flex: 0 0 auto;
  font-weight: 700;
}

#chat-input {
  appearance: none;
  min-width: 0;
  flex: 1 1 auto;
  border: 0;
  border-radius: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-shadow: inherit;
  caret-color: var(--accent);
}

#chat-input::placeholder { color: var(--ink-faint); }

.chat-overlay .chat-send {
  display: none;
}

.lobby-chat-panel .chat-overlay {
  position: static;
  z-index: auto;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 14px;
  transform: none;
  color: var(--ink);
  background: rgba(17, 17, 15, 0.32);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  pointer-events: auto;
  text-shadow: none;
}

.lobby-chat-panel .chat-messages {
  min-height: 220px;
  max-height: 100%;
  justify-content: flex-start;
  gap: 8px;
  margin: 0 0 12px;
  overflow-y: auto;
}

.lobby-chat-panel .chat-messages:empty::before {
  content: "No messages yet";
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

.lobby-chat-panel .chat-message {
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(91, 83, 65, 0.42);
}

.lobby-chat-panel .chat-composer {
  align-items: stretch;
  gap: 7px;
}

.lobby-chat-panel .chat-channel {
  display: none;
}

.lobby-chat-panel #chat-input {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-sm);
  background: var(--void);
  color: var(--ink);
  font-family: var(--font);
  text-shadow: none;
}

.lobby-chat-panel #chat-input:focus {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(199, 208, 122, 0.22);
}

.lobby-chat-panel .chat-send {
  display: inline-flex;
  min-height: 38px;
  padding: 8px 12px;
}
