/* Site floating chat — Better Messages-inspired mini panel */
.ysc {
  --ysc-bg: #242526;
  --ysc-bg2: #1c1e21;
  --ysc-line: #3a3b3c;
  --ysc-text: #e4e6eb;
  --ysc-muted: #b0b3b8;
  --ysc-accent: #2d88ff;
  --ysc-online: #31a24c;
  --ysc-bubble: #3a3b3c;
  --ysc-self: #0084ff;
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 99990;
  font-family: Segoe UI, Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: var(--ysc-text);
  pointer-events: none;
}
.ysc * { box-sizing: border-box; }
.ysc-fab,
.ysc-panel {
  pointer-events: auto;
}

.ysc-fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  background: var(--ysc-accent);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
  position: relative;
}
.ysc-fab:hover { filter: brightness(1.08); }
.ysc-fab__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e41e3f;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.ysc-panel {
  width: min(360px, calc(100vw - 24px));
  height: min(520px, calc(100vh - 80px));
  background: var(--ysc-bg);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 10px;
}

.ysc-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid var(--ysc-line);
  background: var(--ysc-bg2);
  padding: 0 4px 0 8px;
  flex-shrink: 0;
}
.ysc-tab {
  border: 0;
  background: transparent;
  color: var(--ysc-muted);
  font-weight: 600;
  font-size: 13px;
  padding: 12px 10px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}
.ysc-tab.is-on {
  color: var(--ysc-accent);
}
.ysc-tab.is-on::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--ysc-accent);
}
.ysc-collapse {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--ysc-muted);
  padding: 8px;
  cursor: pointer;
}
.ysc-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--ysc-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}

.ysc-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* Author display:flex beats the hidden attribute, so rooms + DM + composer stacked. */
.ysc-view[hidden],
.ysc-panel[hidden],
#yan-site-chat[hidden] {
  display: none !important;
}
.ysc-search {
  padding: 10px 12px;
  flex-shrink: 0;
}
.ysc-search input {
  width: 100%;
  border: 0;
  border-radius: 18px;
  background: #3a3b3c;
  color: var(--ysc-text);
  padding: 9px 14px;
  outline: none;
}
.ysc-search input::placeholder { color: #8a8d91; }

.ysc-list {
  list-style: none;
  margin: 0;
  padding: 0 0 8px;
  overflow: auto;
  flex: 1;
}
.ysc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 10px 14px;
  cursor: pointer;
}
.ysc-item:hover { background: rgba(255, 255, 255, .04); }
.ysc-item__av {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #3a3b3c;
  flex-shrink: 0;
}
.ysc-item__body { flex: 1; min-width: 0; }
.ysc-item__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  margin-bottom: 2px;
}
.ysc-item__joined {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  background: #fff;
  color: #111;
  padding: 2px 6px;
  border-radius: 3px;
}
.ysc-item__meta {
  color: var(--ysc-muted);
  font-size: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.ysc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ysc-online);
  display: inline-block;
  margin-right: 4px;
}
.ysc-item__badge {
  margin-left: auto;
  background: var(--ysc-accent);
  color: #fff;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0 6px;
}
.ysc-empty {
  color: var(--ysc-muted);
  text-align: center;
  padding: 28px 16px;
  margin: 0;
}

.ysc-view--thread { background: var(--ysc-bg2); }
.ysc-thread-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ysc-line);
  flex-shrink: 0;
}
.ysc-back {
  border: 0;
  background: transparent;
  color: var(--ysc-text);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
}
.ysc-thread-av {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #3a3b3c;
}
.ysc-thread-meta { min-width: 0; }
.ysc-thread-meta strong {
  display: block;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ysc-thread-meta span {
  color: var(--ysc-online);
  font-size: 12px;
}

.ysc-log {
  flex: 1;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ysc-msg {
  display: flex;
  gap: 8px;
  max-width: 92%;
}
.ysc-msg.is-self {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.ysc-msg__av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: #3a3b3c;
  flex-shrink: 0;
}
.ysc-msg__col { min-width: 0; }
.ysc-msg__name {
  font-size: 11px;
  color: var(--ysc-muted);
  margin-bottom: 2px;
}
.ysc-msg__bubble {
  background: var(--ysc-bubble);
  padding: 8px 11px;
  border-radius: 16px;
  line-height: 1.35;
  word-break: break-word;
}
.ysc-msg.is-self .ysc-msg__bubble {
  background: var(--ysc-self);
  color: #fff;
}

.ysc-composer {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--ysc-line);
  flex-shrink: 0;
}
.ysc-composer input {
  flex: 1;
  border: 0;
  border-radius: 18px;
  background: #3a3b3c;
  color: var(--ysc-text);
  padding: 10px 14px;
  outline: none;
}
.ysc-composer button {
  border: 0;
  width: 36px;
  border-radius: 50%;
  background: var(--ysc-accent);
  color: #fff;
  cursor: pointer;
}

.ysc-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--ysc-line);
  background: var(--ysc-bg2);
  flex-shrink: 0;
}
.ysc-foot-edit {
  border: 0;
  background: transparent;
  color: var(--ysc-muted);
  cursor: pointer;
  padding: 4px;
}
.ysc-me {
  margin-left: auto;
  text-align: right;
  line-height: 1.2;
}
.ysc-me-name {
  font-weight: 700;
  display: inline-block;
}
.ysc-me-status {
  display: block;
  color: var(--ysc-online);
  font-size: 11px;
}
.ysc-me-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ysc-online);
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
}

.ysc.is-open .ysc-fab { display: none; }
.ysc:not(.is-open) .ysc-panel { display: none !important; }

@media (max-width: 480px) {
  .ysc {
    right: 8px;
    bottom: 8px;
  }
  .ysc-panel {
    width: calc(100vw - 16px);
    height: min(70vh, 560px);
  }
}
