/* .chat_open span {
  position: absolute;
  top: -10px;
  right: -10px;
  font-weight: 700;
  width: 25px;
  height: 25px;
  display: flex;
  border-radius: 50%;
  color: var(--span-color);
  border: solid 2px var(--span);
  font-size: 12px;
  background-color: var(--bg);
  justify-content: center;
  align-items: center;
} */
/* .chat_peoples {
  display: flex;
  gap: 5px;
  height: 25px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}
.chat_peoples .ava {
  cursor: pointer;
  width: 25px;
  height: 25px;
  border-radius: 6px;
  opacity: 0.6;
  transition: 0.5s;
  object-fit: cover;
}
.chat_peoples .ava:hover {
  opacity: 1;
} */

.chat_footer_send > form {
  width: 100%;
}
.chat_smile_btn {
  user-select: none;
}

.chat_smile_btn:hover svg {
  fill: var(--span);
}

.chat_menu_smile .smiley_js {
  cursor: pointer;
  width: 30px;
  height: 30px;
  font-size: 20px;
  opacity: 0.5;
  transition: 0.5s;
  display: flex;
  justify-content: center;
  align-items: center;
}
.chat_menu_smile .smiley_js:hover {
  opacity: 1;
}
/* .block-chat-my {
  display: flex;
  gap: 15px;
  background-color: var(--card);
  margin-bottom: 30px;
  padding: 15px;
  border-radius: 6px;
  align-items: center;
  position: relative;
}
.block-chat-my h5 {
  display: grid;
  gap: 5px;
}
.block-chat-my .block-chat-ava-my {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  opacity: 0.6;
  transition: 0.5s;
  object-fit: cover;
}
.block-chat-my .block-chat-ava-my:hover {
  opacity: 1;
}
.block-chat-my h5 div {
  font-size: 8px;
  color: var(--text-custom);
} */
/* .onlines_mess div h4 {
  cursor: pointer;
  transition: 0.5s;
}
.onlines_mess div h4:hover {
  color: var(--span);
} */
/* .block-chat-back > h2 {
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
} */
#chat_main_content::-webkit-scrollbar {
  height: 2px;
  width: 2px;
}

.chat_footer_send > button:hover {
  color: var(--bg);
  background-color: var(--span);
}
.chat_footer_send > button:hover svg {
  fill: var(--bg);
}
.chat_line {
  font-weight: 700;
  color: var(--text-custom);
  font-size: 10px;
  display: flex;
  margin: 10px 5px;
  justify-content: space-between;
  align-items: center;
}
#chat_send_message > textarea {
  word-wrap: break-word;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  overflow-wrap: break-word;
}
[contentEditable="true"]:empty:not(:focus):before {
  content: attr(data-text);
  color: var(--text-custom);
}
div:empty:before {
  content: attr(data-text);
  color: var(--text-custom);
}
.chat_message .padding,
.chat_message_my .padding {
  padding: 10px;
  background-color: var(--bg);
  border-radius: 6px;
  position: relative;
}
.chat_message div > a > img,
.chat_message_my div > a > img {
  width: 25px;
  height: 25px;
  cursor: pointer;
  border-radius: 6px;
  opacity: 0.6;
  transition: 0.5s;
  object-fit: cover;
}
.chat_message div > a > img {
  float: left;
}
.chat_message_my div > a > img {
  float: right;
}
.chat_message div > a > img:hover,
.chat_message_my div > a > img:hover {
  opacity: 1;
}
.chat_message .chat_info,
.chat_message_my .chat_info {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: flex-end;
}
.chat_message .chat_info {
  margin-left: 35px;
}
.chat_message_my .chat_info {
  margin-right: 35px;
}
.chat_message div > .chat_message_content {
  padding: 5px 5px 10px 0px;
  margin-left: 35px;
  font-size: var(--font-size-m);
  min-width: 200px;
  white-space: pre-line;
  overflow-wrap: anywhere;
  text-align: left;
  color: var(--text-default);
}
.chat_message_my div > .chat_message_content {
  padding: 5px 0px 10px 5px;
  margin-right: 35px;
  font-size: var(--font-size-m);
  min-width: 150px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.chat_message a:hover,
.chat_message_my a:hover {
  color: var(--span);
}
.chat_message .chat_message_date,
.chat_message_my .chat_message_date {
  display: flex;
  gap: 10px;
  font-size: 8px;
  justify-content: flex-end;
}
.chat_role {
  font-size: 8px;
  background-color: var(--bg);
  border-radius: 4px;
  padding: 3px 10px;
}
.chat_nickname {
  cursor: pointer;
  font-weight: 700;
  font-size: var(--font-size-m);
  color: var(--text-default);
  transition: 0.5s;
  white-space: nowrap;
  text-transform: uppercase;
}
.chat_nickname:hover {
  color: var(--span);
}
.chat_message_date > stats {
  opacity: 0.1;
}
.chat_message_date > .mention_chat {
  color: var(--span);
  cursor: pointer;
  transition: 0.5s;
}
.chat_message_date > .mention_chat:hover {
  color: green;
}
.chat_message_date > .del_chat {
  color: var(--span);
  cursor: pointer;
  transition: 0.5s;
}
.chat_message_date > .del_chat:hover {
  color: red;
}
#chat_profile {
  background-color: var(--bg);
  display: flex;
  padding: 10px;
  flex-direction: row;
  border-radius: 6px;
  position: relative;
}
#chat_profile > img {
  height: 30px;
  width: 30px;
  border-radius: 6px;
}
#chat_profile > .chat_profile_container {
  margin-left: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat_profile_close {
  position: absolute;
  right: 10px;
  cursor: pointer;
}
.chat_profile_container > h4 {
  margin: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.block-chat-my label {
  position: absolute;
  right: 0px;
  margin-right: 15px;
}
.chat_checkbox {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}
.chat_checkbox:disabled + .toggle-track {
  cursor: not-allowed;
  opacity: 0.7;
}
.toggle-track {
  background-color: var(--bg);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  height: 20px;
  position: relative;
  width: 40px;
  align-items: center;
}
.toggle-indicator {
  color: var(--bg);
  background-color: var(--span);
  border-radius: 6px;
  display: flex;
  position: absolute;
  transition: 0.25s;
}
.checkMark {
  fill: var(--text-default);
  height: 20px;
  width: 20px;
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
}
.chat_checkbox:checked + .toggle-track .toggle-indicator {
  color: var(--bg);
  background-color: var(--span);
  transform: translateX(20px);
}
.chat_checkbox:checked + .toggle-track .toggle-indicator .checkMark {
  opacity: 1;
  transition: opacity 0.25s ease-in-out;
}
label[for="chat_checkbox_call"] {
  display: flex;
  gap: 15px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  align-items: center;
}
.margin-30-online {
  margin-left: 5px;
  margin-top: 30px;
  margin-bottom: 30px;
}
.wbold {
  display: flex;
  background-color: var(--bg);
  height: 40px;
  border-radius: 6px;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: 0.5s;
}
.wbold:hover {
  color: var(--bg);
  background-color: var(--span);
}
@media (min-width: 1075px) {
  .position-block-sticky {
    height: fit-content;
    position: sticky;
    top: 75px;
  }
}
.role-chat-my {
  position: absolute;
  font-size: 8px;
  right: 5px;
  bottom: -15px;
}
.block-chat-info {
  display: flex;
  height: 60px;
  gap: 15px;
  z-index: 1;
  padding: 15px;
  border-radius: 6px;
  margin-right: 15px;
  font-size: 10px;
  border: solid 2px var(--span);
  background-color: var(--bg);
  position: absolute;
  justify-content: center;
  align-items: center;
}
.block-chat-info > a {
  color: var(--span);
}
.block-chat-info > svg {
  width: 40px;
  height: 40px;
  fill: var(--span);
}
.block-chat-online {
  display: flex;
  padding: 0px 5px;
  justify-content: space-between;
  align-items: center;
}
.margin-bottom-15px {
  margin-bottom: 15px;
}
.reload-mess {
  display: flex;
  height: 100%;
  color: green;
  align-items: center;
  justify-content: center;
}
.chat_no_msg {
  display: flex;
  height: 100%;
  color: red;
  align-items: center;
  justify-content: center;
}
.chat_message_content emoji {
  font-size: 15px;
}

/* Aside chat integration v14
   Чат закреплен справа и больше не зависит от состояния левого sidebar.
   Пока чат открыт, margin-left фиксируется отдельным классом чата,
   поэтому сворачивание/разворачивание sidebar не двигает центр в сторону чата. */
html,
body.has-main-chat-aside {
  overflow-x: hidden;
}

html.main-chat-restoring *,
body.main-chat-restoring,
body.main-chat-restoring * {
  transition: none !important;
}

/* Не двигаем основную сетку через transform: sidebar/container/navbar остаются на своих местах. */
body.chat-aside-open .sidebar,
body.chat-aside-open .global-container,
body.chat-aside-open .container-fluid,
body.chat-aside-open .navbar {
  transform: none !important;
}

/* Фиксируем положение центра только состоянием чата.
   Не используем :has(.sidebar.opened).sidebar-collapse, чтобы sidebar можно было закрывать независимо. */
body.chat-aside-open,
body.main-chat-layout-locked {
  margin-left: clamp(-5rem, calc((1900px - 100vw)), -5rem) !important;
  transition: margin-left var(--transition-duration, 0.25s) ease;
}

body.main-chat-restoring.chat-aside-open,
body.main-chat-restoring.main-chat-layout-locked {
  transition: none !important;
}

@media (max-width: 768px) {
  body.chat-aside-open,
  body.main-chat-layout-locked {
    margin-left: 0 !important;
  }
}

/* Если JS физически переносит чат внутрь .sidebar, родитель не должен его резать. */
.sidebar {
  overflow: visible !important;
}

.navbar_chat_open.chat_open {
  position: relative;
  inset: auto;
  overflow: hidden;
  flex: 0 0 var(--input-height);
  transition:
    width 0.25s ease,
    min-width 0.25s ease,
    flex-basis 0.25s ease,
    opacity 0.2s ease,
    visibility 0.2s ease,
    transform 0.2s ease,
    padding 0.25s ease,
    margin 0.25s ease,
    border-width 0.25s ease,
    background-color var(--transition-duration, 0.2s),
    color var(--transition-duration, 0.2s);
}

.navbar_chat_open.chat_open.chat_open_hidden,
body.chat-aside-open .navbar_chat_open.chat_open {
    width: 0;
    min-width: 0;
    flex-basis: 0;
    padding: 0;
    margin: 0;
    border-width: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(0.92);
    overflow: hidden;
}

.navbar_usermenu {
    overflow: visible;
}

.navbar_chat_open.chat_open {
    position: relative;
    overflow: visible;
}

.chat_count, #chat_count {
    position: absolute;
    top: -0.35rem;
    right: -0.35rem;
    min-width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--br-50);
    background-color: var(--red);
    color: var(--text-default);
    font-size: 0.55rem;
    font-weight: var(--font-weight-5);
    line-height: 1;
    border: 2px solid var(--bg);
    pointer-events: none;
    z-index: 10;
}

.modal_okno_chat {
  position: fixed;
  top: 0;
  right: 0;
  left: auto;
  width: 300px;
  max-width: 300px;
  height: 100dvh;
  max-height: 100dvh;
  margin-left: clamp(-5rem, calc((1900px - 100vw)), -5rem);
  margin-right: 0;
  padding: 0;
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.35s ease;
  background: var(--bg);
  border-left: 1px solid var(--transparent-3-w);
  overflow: hidden;
  pointer-events: none;
}

body.chat-aside-open .modal_okno_chat,
.modal_okno_chat.show {
  transform: translateX(0);
  pointer-events: auto;
}

.modal_okno_chat .block-chat-back {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  margin-top: 0;
  padding: 1rem;
  border-radius: 0;
  background-color: var(--card);
}

.chat_aside_head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--transparent-5-w);
  height: 54px;
}

.chat_aside_head h2 {
  font-size: var(--font-size-l);
  font-weight: var(--font-weight-7);
  color: var(--text-custom);
}

.modal_okno_chat .block-chat-info {
  position: static;
  width: 100%;
  min-height: 4rem;
  height: auto;
  margin: 1rem 0 0;
  padding: 0.8rem 1rem;
  justify-content: flex-start;
}

.modal_okno_chat .block-chat-info > svg {
  width: 1.6rem;
  height: 1.6rem;
  min-width: 1.6rem;
}

.modal_okno_chat .block-chat-online {
  flex: 0 0 auto;
  gap: 0.75rem;
  padding: 0 0.25rem;
}

.modal_okno_chat .chat_footer_send {
  flex: 0 0 auto;
}

.chat_background,
.chat_background.show {
  display: none !important;
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0;
  pointer-events: none !important;
  background: transparent !important;
  backdrop-filter: none !important;
}

@media (max-width: 768px) {
  .modal_okno_chat {
    width: 100vw;
    max-width: 100vw;
    margin-left: 0;
    border-left: 0;
  }

  .modal_okno_chat .block-chat-back {
    padding: 0.75rem;
  }
}

/* Chat v15: pinned message, reply button and guest login */
.block-chat-pinned {
  display: block;
  flex: 0 0 auto;
  margin-top: 1rem;
}

.block-chat-pinned.is-empty,
.block-chat-pinned:empty {
  display: none;
}

.chat_pinned_inner {
  display: grid;
  gap: 0.45rem;
}

.chat_pinned_label {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--money);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-6);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat_pinned_label svg {
  width: 0.75rem;
  height: 0.75rem;
  fill: currentColor;
}

.chat_pinned_body {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border-radius: var(--br-8, 8px);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.1), transparent);
}

.chat_pinned_icon {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--br-8);
  background: rgba(245, 158, 11, 0.15);
  color: var(--money);
}

.chat_pinned_icon svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.chat_pinned_content {
  min-width: 0;
  display: grid;
  gap: 0.25rem;
}

.chat_pinned_meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  font-size: var(--font-size-xs);
  line-height: 1.2;
}

.chat_pinned_meta b {
  color: var(--money);
  font-weight: 800;
}

.chat_pinned_meta span {
  min-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-custom);
  text-transform: uppercase;
}

.chat_pinned_text {
  color: var(--text-default);
  font-weight: var(--font-weight-5);
  font-size: var(--font-size-m);
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.chat_pinned_unpin {
  width: max-content;
  height: 0.9rem;
  padding: 0 0.6rem;
  border-radius: var(--br-8);
  border: 1px solid rgb(255 255 255 / 8%);
  background: rgb(255 255 255 / 5%);
  color: var(--text-custom);
  font-size: 0.6rem;
  cursor: pointer;
  transition: var(--transition-duration, 0.2s);
}

.chat_pinned_unpin:hover {
  background: var(--span);
  color: var(--bg);
}

.chat_message_date > .reply_chat,
.chat_message_date > .pin_chat {
  color: var(--span);
  cursor: pointer;
  transition: 0.5s;
}

.chat_message_date > .reply_chat:hover,
.chat_message_date > .pin_chat:hover {
  color: var(--text-default);
}

.chat_footer_login {
  display: grid;
  gap: 0.75rem;
  flex: 0 0 auto;
  padding: 0.8rem;
  border-radius: var(--br-8);
  background-color: var(--bg);
  border: 1px solid var(--transparent-5-w);
}

.chat_footer_login_text {
  color: var(--text-custom);
  font-size: 0.8rem;
  line-height: 1.35;
}

.modal_okno_chat .steam-login-btn {
  width: 100%;
}

/* Chat v16: role icons, ban modal and chat settings */
.chat_aside_actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Кнопки как sidebar__toggle, но внутри иконка */
.chat_aside_settings.button-icon,
.chat_aside_close.button-icon {
  background-color: var(--transparent-5-w);
  cursor: pointer;
  border: 1px solid var(--transparent-10-w);
  height: 1.5rem !important;
  width: 1.5rem !important;
  min-width: 1.5rem !important;
  flex: 0 0 1.5rem;
  padding: 0 !important;
  margin: 0;
  border-radius: var(--br-6);
  transition: var(--transition-duration);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-custom);
}

/* Убираем внутренний квадрат / ползунок */
.chat_aside_settings.button-icon::after,
.chat_aside_close.button-icon::after {
  content: none !important;
  display: none !important;
}

/* Иконка по центру */
.chat_aside_settings.button-icon svg,
.chat_aside_close.button-icon svg {
  width: 0.75rem;
  height: 0.75rem;
  fill: currentColor;
  color: currentColor;
  position: static;
  left: auto;
  top: auto;
  transform: none;
  transition: var(--transition-duration);
}

/* Hover как у sidebar__toggle */
.chat_aside_settings.button-icon:hover,
.chat_aside_close.button-icon:hover {
  border-color: var(--transparent-20-w);
  background-color: var(--transparent-10-w);
  color: var(--text-default);
}

/* Легкая анимация шестерёнки */
.chat_aside_settings.button-icon:hover svg {
  transform: rotate(45deg);
}

/* Кнопка закрытия с красным hover */
.chat_aside_close.button-icon:hover {
  background-color: var(--red-10);
  border-color: var(--red-20);
  color: var(--red);
}

.chat_aside_close.button-icon:active,
.chat_aside_settings.button-icon:active {
  transform: scale(0.94);
}

.chat_user_line {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.chat_role_icons {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  flex: 0 0 auto;
}

.chat_role_icon {
  width: 0.9rem;
  height: 0.9rem;
  min-width: 0.9rem;
  fill: currentColor;
  color: var(--text-custom);
  filter: drop-shadow(0 0 0.4rem currentColor);
}

.chat_role_icon_admin {
  color: var(--orange);
}

.chat_role_icon_moderator {
  color: var(--ct);
}

.chat_role_icon_vip,
.vip-svg {
  color: var(--top-one);
}

.chat_message_date > .ban_chat {
  color: var(--red);
  cursor: pointer;
  transition: 0.2s;
}

.chat_message_date > .ban_chat:hover {
  color: #fff;
}

.chat_ban_notice {
  display: grid;
  gap: 0.35rem;
  flex: 0 0 auto;
  padding: 0.9rem 1rem;
  border-radius: var(--br-8);
  border: 1px solid rgb(255 95 95 / 25%);
  background: linear-gradient(
    90deg,
    rgb(255 95 95 / 14%),
    rgb(255 255 255 / 3%)
  );
}

.chat_ban_notice__title {
  color: #ff7a7a;
  font-weight: 800;
  font-size: 0.85rem;
}

.chat_ban_notice__reason,
.chat_ban_notice__time {
  color: var(--text-default);
  font-size: 0.75rem;
  line-height: 1.35;
}

/* Chat modal uses the global NEO popup system: .popup_modal + .popup_modal_content */
.chat_modal.popup_modal {
  z-index: 100000;
}

.chat_modal .popup_modal_content.chat_modal_card {
  width: min(28rem, 96vw);
  min-width: min(28rem, 96vw);
  max-width: 850px;
  max-height: 96dvh;
  overflow: auto;
}

.chat_modal .popup_modal_content.chat_settings_card {
  width: min(42rem, 96vw);
  min-width: min(42rem, 96vw);
}

.chat_modal_head {
  align-items: flex-start;
}

.chat_modal_head h3 {
  margin: 0;
  color: var(--text-default);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-7);
}

.chat_modal_head p {
  margin: 0.25rem 0 0;
  color: var(--text-custom);
  font-size: var(--font-size-xs);
}

.chat_modal_close {
  flex: 0 0 auto;
}

.chat_modal_form,
.chat_admin_form {
  display: grid;
  gap: 0.75rem;
}

.chat_modal_form label,
.chat_admin_form label {
  display: grid;
  gap: 0.35rem;
  color: var(--text-custom);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-7);
  margin-bottom: 0px !important;
}

.chat_modal_form input,
.chat_modal_form select,
.chat_modal_form textarea,
.chat_admin_form input {
  width: 100%;
  min-height: var(--input-height);
  padding: 0.7rem 0.8rem;
  border-radius: var(--br-8);
  border: 1px solid var(--transparent-5-w);
  background: var(--input-form, var(--bg));
  color: var(--text-default);
  outline: none;
}

.chat_modal_form textarea {
  min-height: 5rem;
  resize: vertical;
}

.chat_custom_seconds.is-hidden {
  display: none;
}

.chat_admin_section {
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem;
  border: 1px solid var(--transparent-5-w);
  margin-top: 0.75rem;
  border-radius: var(--br-8);
}

.chat_admin_section h4 {
  margin: 0;
  color: var(--text-default);
  font-size: 0.9rem;
  font-weight: 800;
}

.chat_admin_form {
  grid-template-columns: 1fr auto;
  align-items: end;
}

#chat_colors_form {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
}

.chat_admin_list {
  display: grid;
  gap: 0.5rem;
}

.chat_admin_row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem;
  border-radius: var(--br-8);
  background: var(--bg);
}

.chat_admin_row div {
  min-width: 0;
  display: grid;
  gap: 0.15rem;
}

.chat_admin_row b {
  color: var(--text-default);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat_admin_row span,
.chat_admin_row em,
.chat_admin_empty {
  color: var(--text-custom);
  font-size: 0.7rem;
  font-style: normal;
  overflow-wrap: anywhere;
}

.chat_admin_row button {
  min-width: max-content;
  height: 2.2rem;
  background-color: var(--red-10);
  color: var(--red);
  transition: var(--transition-duration);
}

.chat_admin_row button:hover {
  background-color: var(--red-20);
  color: var(--red);
}

@media (max-width: 768px) {
  .chat_admin_form,
  #chat_colors_form {
    grid-template-columns: 1fr;
  }

  .chat_admin_row {
    align-items: stretch;
    flex-direction: column;
  }
}

/* === Live Chat UI v28: сообщения, отправка, emoji, mentions, automute === */
#chat_main_content {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  padding: 0.75rem 0.15rem 0.75rem 0;
  width: 100%;
  height: auto;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin: .3rem 0;
}

.chat_loading_state {
  width: 100%;
  min-height: 8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat_loading_state span {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  border: 2px solid var(--transparent-10-w, rgb(255 255 255 / 10%));
  border-top-color: var(--span, #81c756);
  animation: chat-loading-spin 0.75s linear infinite;
}

@keyframes chat-loading-spin {
  to { transform: rotate(360deg); }
}

.chat_no_msg {
  margin: auto;
  padding: 0.85rem 1rem;
  border-radius: var(--br-8, 8px);
  background: var(--transparent-5-w, rgb(255 255 255 / 5%));
  color: var(--text-custom);
  font-size: 0.78rem;
  text-align: center;
}

.chat_message.chat_message_live,
.chat_message_my.chat_message_live {
  position: relative;
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  background-color: var(--bg);
  padding: 0.42rem 0.35rem;
  margin: 0 !important;
  border-radius: var(--br-8);
  transition: background-color var(--transition-duration), opacity var(--transition-duration);
}

.chat_message.chat_message_live:hover,
.chat_message_my.chat_message_live:hover {
  background: var(--transparent-5-w) !important;
}

.chat_message.chat_message_system,
.chat_message_my.chat_message_system {
  background: linear-gradient(90deg, rgb(255 255 255 / 6%), transparent) !important;
}

.chat_message_live .padding {
  display: contents !important;
}

.chat_message_avatar {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  border-radius: var(--br-8);
  overflow: hidden;
  display: block;
  background: var(--bg);
  border: 1px solid var(--transparent-5-w);
}

.chat_message_avatar img,
.chat_message_live > a > img,
.chat_message_live div > a > img {
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  object-fit: cover;
  border-radius: inherit;
  opacity: 1;
}

.chat_message_bubble {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  gap: 0.2rem;
  padding-right: 0.1rem;
}

.chat_message_meta {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.chat_message_author,
.chat_user_line {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.chat_role_icons {
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
  flex: 0 0 auto;
}

.chat_role_icon {
  width: 0.82rem;
  height: 0.82rem;
  min-width: 0.82rem;
  fill: currentColor;
  color: var(--text-custom);
  filter: drop-shadow(0 0 0.35rem currentColor);
}

.chat_role_icon_admin,
.chat_nickname_admin {
  color: var(--chat-admin-color, var(--orange, #ff7a45)) !important;
}

.chat_role_icon_moderator,
.chat_nickname_moderator {
  color: var(--chat-moderator-color, var(--ct, #4da3ff)) !important;
}

.chat_role_icon_vip,
.vip-svg,
.chat_nickname_vip {
  color: var(--chat-vip-color, var(--top-one, #f3d35b)) !important;
}

.chat_nickname {
  max-width: 8.4rem;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-default);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.1;
}

.chat_message_time {
  flex: 0 0 auto;
  color: var(--text-custom);
  opacity: 0.72;
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1;
}

.chat_message_text,
.chat_message_content {
  color: var(--text-default);
  font-size: 0.76rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
  padding: 0;
  margin: 0;
  background: transparent;
}

.chat_message_text emoji,
.chat_message_content emoji {
  font-size: 1rem;
  line-height: 1;
  vertical-align: -0.1rem;
}

.chat_message_actions {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%) translateX(0.35rem);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: var(--transition-duration);
  padding: 0.25rem;
  border-radius: var(--br-8);
  background: var(--card, #111820);
  border: 1px solid var(--transparent-5-w);
  box-shadow: 0 0.6rem 1.6rem rgb(0 0 0 / 28%);
  z-index: 4;
}

.chat_message_live:hover .chat_message_actions {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}

.chat_message_action {
  height: 1.55rem;
  min-height: 1.55rem;
  padding: 0 0.45rem;
  border: 0;
  border-radius: var(--br-6, 6px);
  background: var(--transparent-5-w);
  color: var(--text-custom);
  font-size: 0.62rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition-duration);
}

.chat_message_action:hover {
  background: var(--transparent-10-w);
  color: var(--text-default);
}

.chat_message_action_danger:hover,
.ban_chat.chat_message_action:hover,
.del_chat.chat_message_action:hover {
  background: var(--red-10);
  color: var(--red);
}

.chat_footer_send.chat_footer_send_live {
  flex: 0 0 auto !important;
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  padding: 0.55rem !important;
  border-radius: var(--br-8, 8px) !important;
  background: var(--bg, #070a0d) !important;
  border: 1px solid var(--transparent-5-w, rgb(255 255 255 / 5%));
}

.chat_footer_send_live > form {
  min-width: 0;
  flex: 1 1 auto;
  position: relative;
}

#chat_send_message > textarea#msg_input {
  height: 2.3rem;
  min-height: 2.3rem;
  max-height: 2.3rem;
  resize: none;
  overflow: hidden;
  white-space: nowrap;
  width: 100%;
  float: left;
  border-radius: var(--br-8);
  padding: 0.55rem 0.75rem;
  line-height: 1.15rem;
  background: var(--card);
  color: var(--text-default);
  border: 1px solid transparent;
  outline: none;
  box-shadow: none;
}

#chat_send_message > textarea#msg_input:focus {
  border-color: var(--transparent-10-w, rgb(255 255 255 / 10%)) !important;
}

#chat_send_message > textarea#msg_input::placeholder {
  color: var(--text-custom, #9ca3af);
  opacity: 0.8;
}

.chat_smile_btn.button-icon,
.chat_send_btn.button-icon {
  position: relative;
  inset: auto;
  width: 2.3rem;
  min-width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  border-radius: var(--br-8);
  background: var(--card);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-custom);
  cursor: pointer;
  transition: var(--transition-duration);
}

.chat_smile_btn.button-icon:hover,
.chat_send_btn.button-icon:hover {
  color: var(--text-default);
  background: var(--button-hover, var(--transparent-10-w));
  border-color: var(--transparent-10-w);
}

.chat_smile_btn.button-icon svg,
.chat_send_btn.button-icon svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
  z-index: auto;
  transition: 0.5s;
  user-select: none;
}

.chat_menu_smile {
  position: absolute;
  right: 0.55rem;
  bottom: 3.35rem;
  width: 244px;
  max-height: 220px;
  padding: 0;
  display: block;
  flex-wrap: nowrap;
  overflow: hidden;
  border-radius: var(--br-8);
  border: 1px solid var(--transparent-5-w);
  background: color-mix(in srgb, var(--card) 95%, transparent);
  box-shadow: 0 1rem 2.5rem rgb(0 0 0 / 42%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(0.45rem) scale(0.98);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
  z-index: 10;
  user-select: none;
}

.chat_menu_smile.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  bottom: 62px;
}

.chat_emoji_scroll {
  max-height: 220px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat_emoji_category_title {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.45rem 0.75rem;
  background: color-mix(in srgb, var(--card, #181818) 95%, transparent);
  backdrop-filter: blur(10px);
  color: var(--text-custom, #9ca3af);
  border-bottom: 1px solid var(--transparent-5-w, rgb(255 255 255 / 5%));
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chat_emoji_grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.125rem;
  padding: 0.375rem;
}

.chat_menu_smile .smiley_js {
  width: 2.5rem !important;
  height: 2.5rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 0 !important;
  border-radius: var(--br-8, 8px) !important;
  background: transparent !important;
  color: var(--text-default, #fff) !important;
  font-size: 1.38rem !important;
  line-height: 1 !important;
  opacity: 1 !important;
  cursor: pointer !important;
  transition: background-color var(--transition-duration), transform var(--transition-duration) !important;
}

.chat_menu_smile .smiley_js:hover {
  background: var(--transparent-10-w);
}

.chat_menu_smile .smiley_js:active {
  background: var(--transparent-20-w);
  transform: scale(0.92);
}

.chat_mentions_popup {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 0.5rem);
  max-height: 14rem;
  overflow-y: auto;
  display: none;
  border-radius: var(--br-8);
  border: 1px solid var(--transparent-5-w);
  background: var(--card);
  box-shadow: 0 1rem 2.5rem rgb(0 0 0 / 42%);
  padding: 0.35rem;
  z-index: 12;
}

.chat_mentions_popup.active {
  display: grid;
  gap: 0.2rem;
}

.chat_mentions_title {
  padding: 0.35rem 0.45rem;
  color: var(--text-custom, #9ca3af);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chat_mention_item {
  width: 100%;
  min-height: 2.4rem;
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr);
  grid-template-areas: "ava name" "ava tag";
  column-gap: 0.55rem;
  align-items: center;
  text-align: left;
  padding: 0.38rem;
  border: 0;
  border-radius: var(--br-8, 8px);
  background: transparent;
  cursor: pointer;
  transition: var(--transition-duration);
}

.chat_mention_item:hover {
  background: var(--transparent-10-w, rgb(255 255 255 / 10%));
}

.chat_mention_item img {
  grid-area: ava;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--br-6, 6px);
  object-fit: cover;
}

.chat_mention_item span {
  grid-area: name;
  color: var(--text-default, #fff);
  font-size: 0.75rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat_mention_item em {
  grid-area: tag;
  color: var(--text-custom, #9ca3af);
  font-size: 0.65rem;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat_admin_form_grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto !important;
}

.chat_admin_checkbox {
  display: flex !important;
  align-items: center;
  gap: 0.5rem !important;
  min-height: var(--input-height, 2.8rem);
}

.chat_admin_checkbox input {
  width: auto !important;
  min-height: auto !important;
}

.chat_admin_hint {
  color: var(--text-custom, #9ca3af);
  font-size: 0.7rem;
  line-height: 1.35;
}

@media (max-width: 768px) {
  .chat_admin_form_grid {
    grid-template-columns: 1fr !important;
  }
  .chat_message_actions {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    margin-top: 0.25rem;
    justify-content: flex-start;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }
}
