.mcf-chat {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  border: 1px solid #263746;
  border-radius: 8px;
  color: #d7e2ea;
  background: #091018;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(154, 200, 224, 0.04);
  user-select: text;
}

.mcf-chat button,
.mcf-chat a,
.mcf-chat input {
  -webkit-tap-highlight-color: rgba(116, 166, 200, 0.18);
  touch-action: manipulation;
}

.mcf-chat button:not(:disabled),
.mcf-chat a {
  cursor: pointer;
}

.mcf-chat[data-collapsed="true"] {
  grid-template-rows: 1fr;
  border-radius: 8px;
  background: #0d1721;
}

.mcf-chat__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid #243443;
  background: #0d1721;
}

.mcf-chat__title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.mcf-chat__title strong,
.mcf-chat__room {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mcf-chat__room {
  color: #8ea6b8;
  font-size: 11px;
}

.mcf-chat__collapse {
  width: 30px;
  height: 30px;
  border: 1px solid #355066;
  border-radius: 7px;
  background: #111f2b;
  color: #cde6ff;
}

.mcf-chat__body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.mcf-chat__status {
  padding: 7px 10px;
  border-bottom: 1px solid #1d2b38;
  color: #a9bfce;
  font-size: 12px;
  line-height: 1.3;
  user-select: text;
}

.mcf-chat__status[data-tone="warn"] {
  color: #ffd38a;
}

.mcf-chat__messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 10px;
  overflow-y: auto;
  user-select: text;
}

.mcf-chat__message {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.mcf-chat__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #8fa6b8;
  font-size: 11px;
}

.mcf-chat__sender {
  color: #d9edf7;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mcf-chat__text {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.35;
  user-select: text;
}

.mcf-chat__private {
  padding: 7px 8px;
  border: 1px solid #31475a;
  border-radius: 7px;
  background: #101b25;
}

.mcf-chat__private .mcf-chat__meta {
  color: #ffd38a;
}

.mcf-chat__private-visual {
  display: block;
  margin: 6px 0 0;
  min-width: 0;
}

.mcf-chat__private-image {
  display: block;
  width: 100%;
  max-height: 220px;
  border: 1px solid #375066;
  border-radius: 7px;
  background: #081018;
  object-fit: contain;
  user-select: none;
}

.mcf-chat__private-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mcf-chat__private-link {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid #42627a;
  border-radius: 7px;
  color: #d7f0ff;
  background: #142333;
  font-size: 12px;
  line-height: 1.2;
  text-decoration: none;
}

.mcf-chat__private-link:focus-visible {
  border-color: #74a6c8;
  color: #ffffff;
  text-decoration: underline;
}

@media (hover: hover) and (pointer: fine) {
  .mcf-chat__private-link:hover {
    border-color: #74a6c8;
    color: #ffffff;
    text-decoration: underline;
  }
}

.mcf-chat__vip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 15px;
  padding: 0 5px;
  flex: 0 0 auto;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  user-select: none;
}

.mcf-chat__mod-badge {
  display: inline-flex;
  align-items: center;
  height: 15px;
  padding: 0 5px;
  border: 1px solid rgba(255, 211, 138, 0.72);
  border-radius: 999px;
  background: rgba(83, 52, 15, 0.72);
  color: #ffd38a;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
}

.mcf-chat__composer {
  position: relative;
  display: grid;
  gap: 0;
  padding: 7px 8px 8px;
  border-top: 1px solid #243443;
  background: #0b121a;
}

.mcf-chat__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.mcf-chat__input {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #355066;
  border-radius: 7px;
  background: #09131d;
  color: #dbeaf2;
}

.mcf-chat__send {
  padding: 0 12px;
  border: 1px solid #3e637f;
  border-radius: 7px;
  background: #15304a;
  color: #dff2ff;
  font-weight: 700;
}

.mcf-chat__input:disabled,
.mcf-chat__send:disabled {
  opacity: 0.55;
}

.mcf-chat__suggestions {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% - 4px);
  display: grid;
  gap: 4px;
  max-height: 172px;
  padding: 6px;
  border: 1px solid #345064;
  border-radius: 7px;
  background: #0c1721;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  overflow-y: auto;
  z-index: 8;
}

.mcf-chat__suggestion {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #101e2a;
  color: #d9e8f0;
  text-align: left;
}

.mcf-chat__suggestion:focus {
  border-color: #4d7693;
}

@media (hover: hover) and (pointer: fine) {
  .mcf-chat__suggestion:hover {
    border-color: #4d7693;
  }
}

@media (hover: none), (pointer: coarse) {
  .mcf-chat button:hover {
    filter: none;
  }

  .mcf-chat__collapse:hover {
    border-color: #355066;
    background: #111f2b;
    color: #cde6ff;
  }

  .mcf-chat__send:hover {
    border-color: #3e637f;
    background: #15304a;
    color: #dff2ff;
  }

  .mcf-chat__private-link:hover {
    border-color: #42627a;
    color: #d7f0ff;
    text-decoration: none;
  }

  .mcf-chat__suggestion:hover {
    border-color: transparent;
  }
}

.mcf-chat__mod {
  color: #ffd38a;
  font-size: 10px;
}

.mcf-chat[data-collapsed="true"] .mcf-chat__body,
.mcf-chat[data-collapsed="true"] .mcf-chat__composer {
  display: none;
}

.mcf-chat[data-collapsed="true"] .mcf-chat__header {
  grid-template-columns: 1fr;
  align-content: start;
  justify-items: center;
  min-height: 100%;
  padding: 8px 5px;
  border-bottom: 0;
  background: #0d1721;
  writing-mode: vertical-rl;
}

.mcf-chat[data-collapsed="true"] .mcf-chat__collapse {
  writing-mode: horizontal-tb;
}

.mcf-chat[data-presentation="portrait"] {
  border-radius: 8px;
}

.mcf-chat[data-presentation="portrait"] .mcf-chat__collapse {
  display: none;
}
