/**
 * Zyss Chat 프론트 스타일
 * 검정·다크 배경과 흰색·회색 글자만 사용합니다.
 */

.zyss-chat-page .zyss-theme__layout {
  display: block !important;
  width: min(calc(100% - 24px), 1480px) !important;
  max-width: 1480px !important;
}

.zyss-chat-page .zyss-theme__layout-sidebar,
.zyss-chat-page .zyss-theme__single-header {
  display: none !important;
}

.zyss-chat-page .zyss-theme__layout-content,
.zyss-chat-page .zyss-theme__single,
.zyss-chat-page .zyss-theme__single-content {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.zyss-chat,
.zyss-chat * {
  box-sizing: border-box;
}

.zyss-chat {
  --chat-bg: #090909;
  --chat-sidebar: #0d0d0d;
  --chat-surface: #141414;
  --chat-elevated: #1c1c1c;
  --chat-hover: #222222;
  --chat-border: #292929;
  --chat-text: #f3f3f3;
  --chat-muted: #979797;
  --chat-dim: #686868;
  position: relative;
  width: 100%;
  color: var(--chat-text);
  font-size: 15px;
  line-height: 1.55;
}

/* display:flex/grid 선언보다 HTML hidden 속성이 항상 우선하도록 처리합니다. */
.zyss-chat [hidden] {
  display: none !important;
}

.zyss-chat button,
.zyss-chat textarea,
.zyss-chat input {
  font: inherit;
}

.zyss-chat button,
.zyss-chat a {
  -webkit-tap-highlight-color: transparent;
}

.zyss-chat__shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 680px;
  height: min(78vh, 860px);
  overflow: hidden;
  border: 1px solid var(--chat-border);
  border-radius: 14px;
  background: var(--chat-bg);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.28);
}

.zyss-chat__channels {
  position: relative;
  z-index: 30;
  display: flex;
  min-width: 0;
  flex-direction: column;
  background: var(--chat-sidebar);
  border-right: 1px solid var(--chat-border);
}

.zyss-chat__brand {
  display: flex;
  min-height: 56px;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--chat-border);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.zyss-chat__brand-mark {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: #242424;
  color: #fff;
  font-size: 14px;
}

.zyss-chat__group-title {
  margin: 18px 16px 7px;
  color: var(--chat-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.zyss-chat__channel-list {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  padding: 0 9px 16px;
}

.zyss-chat__channel {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--chat-muted);
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.zyss-chat__channel > span:first-child {
  color: var(--chat-dim);
  font-size: 18px;
  line-height: 1;
}

.zyss-chat__channel:hover,
.zyss-chat__channel:focus-visible {
  background: var(--chat-hover);
  color: #fff;
  outline: none;
}

.zyss-chat__channel.is-active {
  background: var(--chat-elevated);
  color: #fff;
}

.zyss-chat__account {
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--chat-border);
  background: #0a0a0a;
}

.zyss-chat__account-avatar,
.zyss-chat__guest-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  object-fit: cover;
}

.zyss-chat__guest-avatar {
  display: grid;
  place-items: center;
  background: #252525;
  color: var(--chat-muted);
}

.zyss-chat__account > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.zyss-chat__account strong {
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zyss-chat__account small {
  color: var(--chat-dim);
  font-size: 11px;
}

.zyss-chat__main {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: var(--chat-surface);
}

.zyss-chat__header {
  display: flex;
  min-height: 56px;
  align-items: center;
  gap: 11px;
  padding: 0 18px;
  border-bottom: 1px solid var(--chat-border);
  background: #121212;
}

.zyss-chat__header-hash {
  color: var(--chat-muted);
  font-size: 22px;
}

.zyss-chat__header-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: baseline;
  gap: 12px;
}

.zyss-chat__header-copy strong {
  color: #fff;
  white-space: nowrap;
}

.zyss-chat__header-copy small {
  overflow: hidden;
  color: var(--chat-dim);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zyss-chat__online {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--chat-muted);
  font-size: 12px;
  white-space: nowrap;
}

.zyss-chat__online i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b5b5b5;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.07);
}

.zyss-chat__online b {
  color: #fff;
  font-weight: 600;
}

.zyss-chat__messages-wrap {
  position: relative;
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.zyss-chat__messages {
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px 26px 26px;
  scrollbar-color: #3a3a3a transparent;
  scrollbar-width: thin;
}

.zyss-chat__messages::-webkit-scrollbar,
.zyss-chat__channel-list::-webkit-scrollbar {
  width: 7px;
}

.zyss-chat__messages::-webkit-scrollbar-thumb,
.zyss-chat__channel-list::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: #353535;
}

.zyss-chat__message {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 11px;
  margin: 0 -10px;
  padding: 9px 10px;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.zyss-chat__message:hover,
.zyss-chat__message:focus-within {
  background: rgba(255, 255, 255, 0.025);
}

.zyss-chat__message.is-highlighted {
  animation: zyss-chat-highlight 1.2s ease;
}

@keyframes zyss-chat-highlight {
  0%, 100% { background: transparent; }
  35% { background: rgba(255, 255, 255, 0.1); }
}

.zyss-chat__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #242424;
  object-fit: cover;
}

.zyss-chat__message-main {
  min-width: 0;
}

.zyss-chat__message-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.zyss-chat__author {
  overflow: hidden;
  max-width: 55%;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zyss-chat__time,
.zyss-chat__edited {
  color: var(--chat-dim);
  font-size: 11px;
}

.zyss-chat__content {
  margin-top: 2px;
  color: #d4d4d4;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.zyss-chat__content.is-deleted {
  color: var(--chat-dim);
  font-style: italic;
}

.zyss-chat__content a {
  color: #f0f0f0;
  text-decoration: underline;
  text-decoration-color: #6d6d6d;
  text-underline-offset: 3px;
}

.zyss-chat__reply-preview {
  display: flex;
  max-width: 680px;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  padding-left: 9px;
  border-left: 2px solid #494949;
  color: var(--chat-muted);
  font-size: 12px;
  cursor: pointer;
}

.zyss-chat__reply-preview strong {
  flex: 0 0 auto;
  color: #c9c9c9;
}

.zyss-chat__reply-preview span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zyss-chat__image-link {
  display: inline-block;
  max-width: min(520px, 100%);
  margin-top: 9px;
  overflow: hidden;
  border: 1px solid var(--chat-border);
  border-radius: 10px;
  background: #090909;
}

.zyss-chat__image-link img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 380px;
  object-fit: contain;
}

.zyss-chat__actions {
  position: absolute;
  top: -13px;
  right: 12px;
  z-index: 3;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--chat-border);
  border-radius: 7px;
  background: var(--chat-elevated);
  opacity: 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  transform: translateY(3px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.zyss-chat__message:hover .zyss-chat__actions,
.zyss-chat__message:focus-within .zyss-chat__actions {
  opacity: 1;
  transform: translateY(0);
}

.zyss-chat__action {
  display: grid;
  width: 34px;
  height: 31px;
  place-items: center;
  border: 0;
  border-right: 1px solid var(--chat-border);
  background: transparent;
  color: var(--chat-muted);
  font-size: 14px;
  cursor: pointer;
}

.zyss-chat__action:last-child {
  border-right: 0;
}

.zyss-chat__action:hover,
.zyss-chat__action:focus-visible {
  background: #292929;
  color: #fff;
  outline: none;
}

.zyss-chat__reactions {
  display: flex;
  margin-top: 5px;
}

.zyss-chat__reaction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  padding: 2px 8px;
  border: 1px solid var(--chat-border);
  border-radius: 8px;
  background: #1b1b1b;
  color: var(--chat-muted);
  cursor: pointer;
}

.zyss-chat__reaction.is-active {
  border-color: #606060;
  background: #2a2a2a;
  color: #fff;
}

.zyss-chat__load-older {
  align-self: center;
  margin: 10px 0 -5px;
  padding: 6px 13px;
  border: 1px solid var(--chat-border);
  border-radius: 999px;
  background: #191919;
  color: var(--chat-muted);
  font-size: 12px;
  cursor: pointer;
}

.zyss-chat__new-messages {
  position: absolute;
  right: 18px;
  bottom: 14px;
  z-index: 4;
  padding: 7px 12px;
  border: 1px solid #4a4a4a;
  border-radius: 999px;
  background: #262626;
  color: #fff;
  font-size: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.36);
  cursor: pointer;
}

.zyss-chat__composer {
  position: relative;
  padding: 0 20px 14px;
  background: var(--chat-surface);
}

.zyss-chat__composer-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  padding: 7px;
  border: 1px solid #363636;
  border-radius: 11px;
  background: #202020;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.zyss-chat__composer-row:focus-within {
  border-color: #5a5a5a;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.zyss-chat__composer textarea {
  min-height: 36px;
  max-height: 150px;
  min-width: 0;
  flex: 1;
  resize: none;
  overflow-y: auto;
  padding: 7px 4px 5px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f2f2f2;
  line-height: 1.45;
}

.zyss-chat__composer textarea::placeholder {
  color: #747474;
}

.zyss-chat__attach,
.zyss-chat__emoji-toggle,
.zyss-chat__send {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--chat-muted);
  cursor: pointer;
}

.zyss-chat__attach:hover,
.zyss-chat__emoji-toggle:hover,
.zyss-chat__send:hover {
  background: #303030;
  color: #fff;
}

.zyss-chat__attach input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.zyss-chat__attach span {
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
}

.zyss-chat__send {
  background: #ededed;
  color: #111;
}

.zyss-chat__send:hover {
  background: #fff;
  color: #000;
}

.zyss-chat__send:disabled {
  opacity: 0.45;
  cursor: wait;
}

.zyss-chat__context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 8px;
  padding: 7px 10px;
  border: 1px solid var(--chat-border);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #181818;
  color: var(--chat-muted);
  font-size: 12px;
}

.zyss-chat__context button {
  border: 0;
  background: transparent;
  color: var(--chat-muted);
  cursor: pointer;
}

.zyss-chat__file-preview {
  margin: 0 8px;
  padding: 7px 10px;
  border: 1px solid var(--chat-border);
  border-bottom: 0;
  background: #181818;
  color: var(--chat-muted);
  font-size: 12px;
}

.zyss-chat__file-preview button {
  margin-left: 8px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.zyss-chat__composer-help {
  margin: 5px 4px 0;
  color: #5f5f5f;
  font-size: 10px;
}

.zyss-chat__emoji-panel {
  position: absolute;
  right: 62px;
  bottom: 67px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(6, 34px);
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--chat-border);
  border-radius: 10px;
  background: #1b1b1b;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.zyss-chat__emoji-panel button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.zyss-chat__emoji-panel button:hover {
  background: #313131;
}

.zyss-chat__login-bar,
.zyss-chat__login-required {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px;
  border-top: 1px solid var(--chat-border);
  background: #111;
  color: var(--chat-muted);
}

.zyss-chat__login-bar a,
.zyss-chat__login-required a {
  padding: 7px 12px;
  border-radius: 7px;
  background: #2b2b2b;
  color: #fff;
  text-decoration: none;
}

.zyss-chat__loading {
  display: flex;
  min-height: 220px;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.zyss-chat__loading span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #858585;
  animation: zyss-chat-loading 0.9s infinite alternate;
}

.zyss-chat__loading span:nth-child(2) { animation-delay: 0.15s; }
.zyss-chat__loading span:nth-child(3) { animation-delay: 0.3s; }

@keyframes zyss-chat-loading {
  to { opacity: 0.25; transform: translateY(-5px); }
}

.zyss-chat__empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: var(--chat-dim);
  font-size: 13px;
}

.zyss-chat__toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100000;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 15px;
  border: 1px solid #454545;
  border-radius: 10px;
  background: #171717;
  color: #fff;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.45);
}

.zyss-chat__sidebar-open,
.zyss-chat__sidebar-close,
.zyss-chat__sidebar-backdrop {
  display: none;
}

@media (max-width: 900px) {
  .zyss-chat-page .zyss-theme__layout {
    width: min(calc(100% - 16px), 1480px) !important;
  }

  .zyss-chat__shell {
    grid-template-columns: 1fr;
    min-height: 620px;
    height: calc(100dvh - 155px);
    max-height: 820px;
    border-radius: 10px;
  }

  .zyss-chat__channels {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(280px, 84vw);
    border-right: 1px solid #333;
    box-shadow: 18px 0 45px rgba(0, 0, 0, 0.55);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  .zyss-chat.is-sidebar-open .zyss-chat__channels {
    transform: translateX(0);
  }

  .zyss-chat__sidebar-open,
  .zyss-chat__sidebar-close {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--chat-muted);
    cursor: pointer;
  }

  .zyss-chat__sidebar-close {
    margin-left: auto;
    font-size: 22px;
  }

  .zyss-chat__sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(0, 0, 0, 0.7);
  }

  .zyss-chat.is-sidebar-open .zyss-chat__sidebar-backdrop {
    display: block;
  }

  .zyss-chat__header {
    padding: 0 10px;
  }

  .zyss-chat__header-hash {
    display: none;
  }

  .zyss-chat__header-copy {
    display: block;
  }

  .zyss-chat__header-copy strong,
  .zyss-chat__header-copy small {
    display: block;
  }

  .zyss-chat__online {
    font-size: 11px;
  }

  .zyss-chat__messages {
    padding: 16px 13px 20px;
  }

  .zyss-chat__composer {
    padding: 0 9px 9px;
  }

  .zyss-chat__composer-help {
    display: none;
  }
}

@media (max-width: 520px) {
  .zyss-chat__shell {
    height: calc(100dvh - 132px);
    min-height: 560px;
  }

  .zyss-chat__header-copy small {
    max-width: 150px;
  }

  .zyss-chat__message {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    margin-inline: -6px;
    padding-inline: 6px;
  }

  .zyss-chat__avatar {
    width: 32px;
    height: 32px;
  }

  .zyss-chat__actions {
    position: static;
    float: right;
    margin: 4px 0 0 8px;
    opacity: 1;
    transform: none;
  }

  .zyss-chat__action {
    width: 31px;
    height: 28px;
  }

  .zyss-chat__image-link img {
    max-height: 270px;
  }

  .zyss-chat__emoji-panel {
    right: 10px;
    grid-template-columns: repeat(6, 32px);
  }

  .zyss-chat__attach,
  .zyss-chat__emoji-toggle,
  .zyss-chat__send {
    width: 33px;
    height: 33px;
    flex-basis: 33px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .zyss-chat *,
  .zyss-chat *::before,
  .zyss-chat *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
