.wtf-chat-native-hidden {
  display: none !important;
}

.hub-chat-page .wtf-chat-layout ~ .wtf-chat-layout {
  display: none !important;
}

.hub-chat-page {
  min-height: 0 !important;
}

.wtf-chat-layout {
  position: relative;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  width: 100%;
  height: clamp(560px, calc(100dvh - 210px), 780px);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--hub-line, rgba(255, 255, 255, 0.08));
  border-radius: 19px;
  background: #090a10;
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.24);
}

.wtf-chat-layout::after {
  content: attr(data-error);
  position: absolute;
  z-index: 12;
  right: 18px;
  bottom: 76px;
  max-width: min(420px, calc(100% - 36px));
  padding: 10px 13px;
  border: 1px solid rgba(255, 99, 127, 0.42);
  border-radius: 10px;
  color: #ffabb9;
  background: rgba(63, 18, 31, 0.94);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: 180ms ease;
}

.wtf-chat-layout.has-error::after {
  opacity: 1;
  transform: translateY(0);
}

.wtf-chat-layout > aside {
  min-height: 0;
  padding: 18px 10px;
  overflow-y: auto;
  border-right: 1px solid var(--hub-line, rgba(255, 255, 255, 0.08));
  scrollbar-width: thin;
  scrollbar-color: rgba(126, 94, 235, 0.42) transparent;
}

.wtf-chat-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 6px;
  margin: 0 2px 12px;
}

.wtf-chat-search input {
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  outline: 0;
  color: #ddd8e8;
  background: #0d0e15;
  font: 500 10px Manrope, sans-serif;
}

.wtf-chat-search input:focus {
  border-color: rgba(132, 105, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(116, 83, 227, 0.09);
}

.wtf-chat-search button {
  width: 34px;
  height: 36px;
  border: 1px solid rgba(132, 105, 255, 0.22);
  border-radius: 9px;
  color: #b5a8f5;
  background: rgba(111, 81, 219, 0.12);
  cursor: pointer;
}

.wtf-chat-sidebar-label {
  display: block;
  padding: 0 10px 13px;
  color: #665f83;
  font: 600 8px "JetBrains Mono", monospace;
  letter-spacing: 0.12em;
}

.wtf-chat-rooms {
  display: grid;
  gap: 3px;
}

.wtf-chat-rooms > button,
.wtf-chat-search-results > button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px;
  border: 0;
  border-radius: 11px;
  color: #878390;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.wtf-chat-rooms > button:hover,
.wtf-chat-search-results > button:hover {
  color: #d8d4df;
  background: rgba(112, 83, 221, 0.1);
}

.wtf-chat-rooms > button.active {
  color: #d8d4df;
  background: rgba(113, 84, 226, 0.12);
  box-shadow: inset 2px 0 #8567f3;
}

.wtf-chat-rooms > button > i,
.wtf-chat-search-results > button > i,
.wtf-chat-layout > article > header > i {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  overflow: hidden;
  border: 1px solid rgba(139, 111, 255, 0.19);
  border-radius: 11px;
  color: #a293ed;
  background: #151521;
  font: 700 9px Sora, sans-serif;
  font-style: normal;
}

.wtf-chat-rooms img,
.wtf-chat-search-results img,
.wtf-chat-layout > article > header img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wtf-chat-rooms b,
.wtf-chat-rooms small,
.wtf-chat-search-results b,
.wtf-chat-search-results small {
  display: block;
}

.wtf-chat-rooms b,
.wtf-chat-search-results b {
  color: inherit;
  font-size: 10px;
}

.wtf-chat-rooms small,
.wtf-chat-search-results small {
  margin-top: 4px;
  color: #5d5966;
  font-size: 8px;
}

.wtf-chat-rooms em {
  position: absolute;
  right: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5fc78f;
}

.wtf-chat-search-results {
  display: grid;
  gap: 4px;
  margin: 0 2px 13px;
  padding: 6px;
  border: 1px solid rgba(132, 105, 255, 0.14);
  border-radius: 11px;
  background: #0b0c12;
}

.wtf-chat-search-results[hidden] {
  display: none;
}

.wtf-chat-search-results > button {
  padding: 8px;
  border-radius: 8px;
}

.wtf-chat-search-results > button > i {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.wtf-chat-search-results > p {
  margin: 8px;
  color: #706b79;
  font-size: 10px;
}

.wtf-chat-layout > article {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.wtf-chat-layout > article > header {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
  padding: 16px 20px;
  border-bottom: 1px solid var(--hub-line, rgba(255, 255, 255, 0.08));
}

.wtf-chat-layout > article > header h3 {
  margin: 0 0 4px;
  color: #e6e2eb;
  font-size: 12px;
}

.wtf-chat-layout > article > header span {
  color: #65616d;
  font-size: 9px;
}

.wtf-chat-messages {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 17px;
  min-height: 0;
  padding: 22px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(126, 94, 235, 0.48) transparent;
}

.wtf-chat-messages::-webkit-scrollbar {
  width: 8px;
}

.wtf-chat-messages::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  background: rgba(126, 94, 235, 0.48);
  background-clip: padding-box;
}

.wtf-chat-messages > div:not(.wtf-chat-empty) {
  display: flex;
  gap: 11px;
  max-width: min(82%, 760px);
}

.wtf-chat-messages > div.mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.wtf-chat-messages > div > img {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  object-fit: cover;
  background: #141520;
}

.wtf-chat-messages > div > section {
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 5px 14px 14px;
  background: #11121a;
}

.wtf-chat-messages > div.mine > section {
  border-color: rgba(124, 96, 238, 0.18);
  border-radius: 14px 5px 14px 14px;
  background: rgba(103, 76, 211, 0.13);
}

.wtf-chat-messages > div.is-pending {
  opacity: 0.66;
}

.wtf-chat-messages > div.is-failed {
  opacity: 0.82;
}

.wtf-chat-messages > div.is-failed > section {
  border-color: rgba(255, 92, 123, 0.42);
}

.wtf-chat-messages section > header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wtf-chat-messages section > header b {
  font-size: 9px;
}

.wtf-chat-messages section > header i {
  padding: 3px 5px;
  border-radius: 5px;
  color: #9d8fe3;
  background: rgba(118, 88, 227, 0.1);
  font: 600 7px "JetBrains Mono", monospace;
  font-style: normal;
}

.wtf-chat-messages section > header time {
  margin-left: auto;
  color: #6b6674;
  font: 500 8px "JetBrains Mono", monospace;
  white-space: nowrap;
}

.wtf-chat-messages section p {
  margin: 7px 0 0;
  color: #c5c1cc;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.wtf-chat-messages section > img {
  display: block;
  max-width: min(420px, 100%);
  max-height: 320px;
  margin-top: 9px;
  border-radius: 10px;
  object-fit: cover;
  cursor: zoom-in;
  transition: filter 160ms ease, transform 160ms ease;
}

.wtf-chat-messages section > img:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.wtf-chat-empty {
  display: grid;
  flex: 1;
  place-items: center;
  color: #625d6b;
  font-size: 11px;
  text-align: center;
}

.wtf-chat-composer {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 14px;
  border-top: 1px solid var(--hub-line, rgba(255, 255, 255, 0.08));
  background: rgba(9, 10, 16, 0.96);
}

.wtf-chat-composer > input:not([type="file"]) {
  flex: 1;
  min-width: 0;
  height: 43px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  outline: 0;
  color: #d3d0da;
  background: #0e0f16;
  font-size: 11px;
}

.wtf-chat-composer > input:not([type="file"]):focus {
  border-color: rgba(133, 105, 255, 0.38);
  box-shadow: 0 0 0 3px rgba(116, 83, 227, 0.08);
}

.wtf-chat-composer > button {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  flex: none;
  border: 1px solid rgba(132, 105, 255, 0.22);
  border-radius: 11px;
  color: #b9adf6;
  background: rgba(111, 81, 219, 0.12);
  cursor: pointer;
}

.wtf-chat-composer > button.send {
  border: 0;
  color: #fff;
  background: linear-gradient(145deg, #7655e8, #6045c7);
  box-shadow: 0 8px 22px rgba(91, 61, 201, 0.3);
}

.wtf-chat-attachment {
  position: absolute;
  z-index: 4;
  left: 14px;
  bottom: 68px;
  padding: 5px;
  border: 1px solid var(--hub-line, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  background: #101118;
}

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

.wtf-chat-attachment img {
  display: block;
  width: 70px;
  height: 54px;
  border-radius: 7px;
  object-fit: cover;
  cursor: zoom-in;
}

.wtf-chat-attachment button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 19px;
  height: 19px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: #6f55dd;
  cursor: pointer;
}

body.wtf-chat-lightbox-open {
  overflow: hidden !important;
}

.wtf-chat-lightbox {
  position: fixed;
  z-index: 100000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 34px;
  background: rgba(3, 3, 8, 0.91);
  cursor: zoom-out;
  animation: wtf-chat-lightbox-in 160ms ease both;
  backdrop-filter: blur(10px);
}

.wtf-chat-lightbox > img {
  max-width: min(94vw, 1500px);
  max-height: 92vh;
  border-radius: 14px;
  object-fit: contain;
  box-shadow: 0 35px 110px rgba(0, 0, 0, 0.7);
  cursor: default;
}

.wtf-chat-lightbox-close {
  position: fixed;
  top: 22px;
  right: 24px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  color: #fff;
  background: rgba(24, 20, 35, 0.82);
  font-size: 25px;
  cursor: pointer;
}

@keyframes wtf-chat-lightbox-in {
  from {
    opacity: 0;
  }
}

@media (max-width: 760px) {
  .wtf-chat-layout {
    grid-template-columns: 104px minmax(0, 1fr);
    height: calc(100dvh - 155px);
    min-height: 500px;
  }

  .wtf-chat-layout > aside {
    padding: 12px 7px;
  }

  .wtf-chat-search {
    grid-template-columns: 1fr;
  }

  .wtf-chat-search button,
  .wtf-chat-sidebar-label,
  .wtf-chat-rooms button > div,
  .wtf-chat-rooms em {
    display: none;
  }

  .wtf-chat-rooms > button {
    justify-content: center;
    padding: 8px;
  }

  .wtf-chat-messages {
    padding: 14px 11px;
  }

  .wtf-chat-messages > div:not(.wtf-chat-empty) {
    max-width: 96%;
  }

  .wtf-chat-messages > div > img {
    display: none;
  }

  .wtf-chat-messages section > header {
    flex-wrap: wrap;
  }

  .wtf-chat-messages section > header time {
    width: 100%;
    margin-left: 0;
  }

  .wtf-chat-lightbox {
    padding: 14px;
  }
}
