/* Отмечаю непрочитанные сообщения в списках и внутри истории. */
.unread-badge {
  margin-left: auto;
  background: #e6325d;
  color: white;
  border-radius: 12px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.has-unread {
  color: #fff;
  font-weight: 700;
}
.new-messages {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ff799b;
  font-size: 12px;
  padding: 14px 0;
}
.new-messages::before,
.new-messages::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #94465b;
}
.server-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.server-icon:has(img) {
  padding: 0;
  overflow: hidden;
}
.file-message {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 8px 0;
  border: 1px solid #554150;
  border-radius: 9px;
  padding: 14px;
  background: #26232c;
  color: #f9c1d4;
  overflow-wrap: anywhere;
  text-decoration: none;
}
.file-message:hover {
  border-color: var(--accent);
}
#chat-send,
.call-chat #chat-send,
#close-screen,
.screen-expand {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#chat-send .icon,
#close-screen .icon,
.screen-expand .icon,
.attach-file .icon {
  width: 22px;
  height: 22px;
}
.attach-file {
  align-self: flex-end;
  width: 38px;
  min-width: 38px;
  height: 44px;
  border-radius: 9px;
  background: #3a2b40;
  font-size: 24px;
}
.pack-emoji {
  width: 32px;
  height: 32px;
  vertical-align: middle;
  object-fit: contain;
}
.emoji-option img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}
.emoji-credit {
  display: block;
  color: #b9aabb;
  font-size: 10px;
  margin: 8px 0 16px;
}
#call-duration {
  align-self: center;
  color: #dfcbd5;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  padding: 0 6px;
}
/* Чат занимает всю высоту рабочей области; поле ввода остаётся снизу. */
.chat-view {
  padding: 0;
  overflow: hidden;
}
.chat-view #chat-pane {
  min-height: 0;
  padding: 20px 24px 12px;
}
.chat-heading {
  flex-shrink: 0;
}
.chat-messages {
  max-height: none;
  min-height: 0;
}
.chat-view .chat-messages {
  padding: 18px 0;
}
#chat-form {
  background: #28232e;
  border: 1px solid #493546;
  border-radius: 12px;
  padding: 8px;
  gap: 8px;
}
#chat-input {
  background: transparent;
  border: 0;
  resize: none;
  min-height: 44px;
  max-height: 160px;
}
.chat-view #chat-input {
  flex: 1;
}
.call-chat {
  padding: 16px 14px 12px;
}
.call-chat #chat-form {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 36px;
}
.call-chat #attach-file {
  grid-column: 1;
  grid-row: 1;
}
.call-chat #chat-input {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
}
.call-chat #emoji-toggle {
  grid-column: 3;
  grid-row: 1;
}
.call-chat #chat-send {
  grid-column: 2 / 4;
  justify-self: end;
}
/* В развёрнутой демонстрации оставляю доступными все элементы управления. */
body.viewing-screen #call-controls {
  display: flex !important;
  position: fixed;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 125;
  width: max-content;
  max-width: calc(100vw - 24px);
  margin: 0;
  flex-wrap: wrap;
}
body.viewing-screen .screen-focused {
  padding-bottom: 110px;
}
body.viewing-screen .screen-focused video {
  height: calc(100% - 110px) !important;
}
body.viewing-screen #call-chat {
  position: fixed;
  inset: 12px 12px 120px auto;
  width: 350px;
  max-width: calc(100vw - 24px);
  z-index: 120;
  border: 1px solid #644459;
  border-radius: 12px;
}
body.viewing-screen .workspace.chat-open .screen-focused {
  padding-right: 374px;
}
body.viewing-screen .workspace.chat-open .screen-focused video {
  width: calc(100% - 374px) !important;
  left: 0;
}
body.viewing-screen #close-screen {
  z-index: 126;
}
@media (max-width: 760px) {
  .chat-view #chat-pane {
    padding: 12px 10px;
  }
  .chat-view #chat-form {
    flex-wrap: wrap;
  }
  .chat-view #chat-input {
    flex-basis: calc(100% - 100px);
  }
  .chat-view #chat-send {
    margin-left: auto;
  }
  body.viewing-screen .workspace.chat-open .screen-focused {
    padding-right: 0;
  }
  body.viewing-screen .workspace.chat-open .screen-focused video {
    width: 100% !important;
  }
  body.viewing-screen #call-chat {
    bottom: 140px;
  }
  #call-duration {
    font-size: 10px;
  }
}
