:root {
  --sj-chat-bg: #080d13;
  --sj-chat-panel: #0e151d;
  --sj-chat-panel-2: #121b25;
  --sj-chat-line: #24313d;
  --sj-chat-text: #edf4f7;
  --sj-chat-muted: #8fa2ad;
  --sj-chat-accent: #21d6bd;
  --sj-chat-accent-2: #7ce9da;
  --sj-chat-danger: #ff6474;
}

body.sj-irc-page-active .sj-content-card > h1:first-child {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
}

body.sj-irc-page-active .sj-content-card {
  max-width: 1480px;
  padding: 18px !important;
  background: transparent;
  border: 0;
}

body.sj-irc-page-active { overflow: hidden; }

.sj-irc-shell,
.sj-irc-shell * { box-sizing: border-box; }

.sj-irc-shell {
  position: relative;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 230px;
  width: 100%;
  height: var(--sj-chat-height, clamp(640px, calc(100vh - 126px), 860px));
  overflow: hidden;
  color: var(--sj-chat-text);
  background: var(--sj-chat-bg);
  border: 1px solid var(--sj-chat-line);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sj-irc-sidebar,
.sj-irc-presence {
  min-width: 0;
  background: var(--sj-chat-panel);
}

.sj-irc-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sj-chat-line);
}

.sj-irc-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 74px;
  padding: 16px;
  border-bottom: 1px solid var(--sj-chat-line);
}

.sj-irc-brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  color: #03100e;
  background: var(--sj-chat-accent);
  border-radius: 7px;
  font-size: 20px;
  font-weight: 900;
}

.sj-irc-brand strong,
.sj-irc-brand small { display: block; letter-spacing: 0; }
.sj-irc-brand strong { font-size: 15px; }
.sj-irc-brand small { margin-top: 2px; color: var(--sj-chat-muted); font-size: 11px; }

.sj-irc-section-label {
  padding: 18px 16px 8px;
  color: var(--sj-chat-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.sj-irc-channel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 45px;
  margin: 2px 9px;
  padding: 0 11px;
  color: #b9c8d0;
  border: 1px solid transparent;
  border-radius: 6px;
  text-decoration: none !important;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}

.sj-irc-channel:hover {
  color: #fff;
  background: #15212b;
  transform: translateX(2px);
}

.sj-irc-channel.is-active {
  color: #fff;
  background: #172630;
  border-color: #285148;
}

.sj-irc-channel.is-active::before {
  position: absolute;
  inset: 8px auto 8px -10px;
  width: 3px;
  content: "";
  background: var(--sj-chat-accent);
  border-radius: 0 3px 3px 0;
}

.sj-irc-channel strong { min-width: 0; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.sj-irc-hash { margin-right: 8px; color: var(--sj-chat-accent); font-weight: 900; }
.sj-irc-channel em {
  padding: 3px 6px;
  color: var(--sj-chat-accent-2);
  background: #102620;
  border-radius: 4px;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.sj-irc-sidebar-foot {
  margin-top: auto;
  padding: 14px 16px;
  color: var(--sj-chat-muted);
  border-top: 1px solid var(--sj-chat-line);
  font-size: 11px;
  line-height: 1.5;
}

.sj-irc-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-width: 0;
  min-height: 0;
  background: #0a1017;
  overflow: hidden;
}

.sj-irc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  padding: 13px 18px;
  background: #0d141c;
  border-bottom: 1px solid var(--sj-chat-line);
}

.sj-irc-room-heading { min-width: 0; }
.sj-irc-header h1 {
  margin: 0;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}
.sj-irc-header p {
  max-width: 680px;
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--sj-chat-muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sj-irc-header-actions { display: flex; align-items: center; gap: 8px; }
.sj-irc-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #a9bbbF;
  font-size: 11px;
  font-weight: 750;
}
.sj-irc-live::before {
  width: 7px;
  height: 7px;
  content: "";
  background: var(--sj-chat-accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(33, 214, 189, .11);
}
.sj-irc-shell[data-connection="offline"] .sj-irc-live::before { background: var(--sj-chat-danger); box-shadow: 0 0 0 4px rgba(255, 100, 116, .1); }
.sj-irc-shell[data-connection="connecting"] .sj-irc-live::before { animation: sj-chat-pulse 1s infinite alternate; }

.sj-irc-icon-button {
  display: none;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #c9d6dc;
  background: #121c25;
  border: 1px solid var(--sj-chat-line);
  border-radius: 6px;
  cursor: pointer;
  font-size: 17px;
}

.sj-irc-log {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 20px 22px 30px;
  scrollbar-color: #33434f transparent;
  scrollbar-width: thin;
}

.sj-irc-log::-webkit-scrollbar { width: 10px; }
.sj-irc-log::-webkit-scrollbar-track { background: #080e14; }
.sj-irc-log::-webkit-scrollbar-thumb { background: #344651; border: 2px solid #080e14; border-radius: 8px; }
.sj-irc-log::-webkit-scrollbar-thumb:hover { background: #49606d; }

.sj-irc-message {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 11px;
  max-width: 860px;
  padding: 8px 0;
}
.sj-irc-avatar,
.sj-irc-system-avatar {
  display: grid;
  place-items: center;
  width: 36px !important;
  height: 36px !important;
  object-fit: cover;
  color: var(--sj-chat-accent);
  background: #16232d;
  border: 1px solid #2c3b46;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 900;
}
.sj-irc-message-content { min-width: 0; }
.sj-irc-message-content header { display: flex; align-items: baseline; gap: 8px; min-height: 20px; }
.sj-irc-message-content header strong { color: #eef5f7; font-size: 13px; }
.sj-irc-message time { color: #657985; font-size: 10px; }
.sj-irc-message p { margin: 1px 0 0; color: #cad5da; font-size: 14px; line-height: 1.48; overflow-wrap: anywhere; }
.sj-irc-message button {
  margin-left: auto;
  padding: 0;
  color: #748893;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 10px;
  text-decoration: underline;
}
.sj-irc-message button:hover { color: var(--sj-chat-danger); }
.sj-irc-type-system {
  grid-template-columns: 26px minmax(0, 1fr);
  margin: 7px 0;
  padding: 8px 11px;
  background: #0e1c20;
  border-left: 2px solid #2b8f82;
  border-radius: 0 5px 5px 0;
}
.sj-irc-type-system .sj-irc-avatar,
.sj-irc-type-system .sj-irc-system-avatar { width: 24px !important; height: 24px !important; font-size: 10px; }
.sj-irc-type-system p { color: #9fcac3; font-size: 12px; }

.sj-irc-empty,
.sj-irc-error,
.sj-irc-loading {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 100%;
  color: var(--sj-chat-muted);
  text-align: center;
}
.sj-irc-empty strong { color: #dce8ec; font-size: 16px; }
.sj-irc-empty span { margin-top: 5px; font-size: 12px; }
.sj-irc-error { color: #ff9ba6; }

.sj-irc-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 0 18px 18px;
  padding: 8px;
  background: #101923;
  border: 1px solid #2a3944;
  border-radius: 8px;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.sj-irc-compose:focus-within { border-color: #347d70; box-shadow: 0 0 0 3px rgba(33, 214, 189, .08); }
.sj-irc-compose textarea {
  width: 100%;
  min-height: 42px;
  max-height: 120px;
  resize: none;
  padding: 10px 8px;
  color: #edf5f7;
  background: transparent;
  border: 0;
  outline: 0;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
}
.sj-irc-compose textarea::placeholder { color: #637985; }
.sj-irc-compose button {
  align-self: end;
  height: 42px;
  padding: 0 19px;
  color: #03100e;
  background: var(--sj-chat-accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 850;
}
.sj-irc-compose button:hover { background: var(--sj-chat-accent-2); }
.sj-irc-compose button:active { transform: translateY(1px); }

.sj-irc-readonly {
  margin: 0 18px 18px;
  padding: 13px 15px;
  color: #aebdc4;
  background: #101923;
  border: 1px solid var(--sj-chat-line);
  border-radius: 7px;
  font-size: 13px;
  text-align: center;
}
.sj-irc-readonly a { color: var(--sj-chat-accent); font-weight: 800; }

.sj-irc-ops {
  margin: 0 18px 18px;
  color: #b6c5cc;
  background: #0e171f;
  border: 1px solid var(--sj-chat-line);
  border-radius: 7px;
}
.sj-irc-ops summary { padding: 10px 13px; cursor: pointer; color: #d7e2e6; font-size: 12px; font-weight: 800; }
.sj-irc-ops-grid { display: grid; grid-template-columns: minmax(150px, 2fr) auto minmax(120px, 1fr) minmax(120px, 1fr); gap: 8px; padding: 0 12px 12px; }
.sj-irc-ops label { color: var(--sj-chat-muted); font-size: 10px; font-weight: 750; }
.sj-irc-ops input { width: 100%; height: 34px; margin-top: 4px; padding: 0 9px; color: #eaf2f5; background: #080e14; border: 1px solid #293944; border-radius: 4px; }
.sj-irc-ops button { align-self: end; height: 34px; padding: 0 10px; color: #cad8dd; background: #18232c; border: 1px solid #30414d; border-radius: 4px; cursor: pointer; font-size: 11px; font-weight: 750; }
.sj-irc-ops button:hover { color: #fff; border-color: #3c7168; }
.sj-irc-ops > p { margin: 0; padding: 0 12px 11px; color: #627783; font-size: 10px; }

.sj-irc-presence {
  min-width: 0;
  border-left: 1px solid var(--sj-chat-line);
}
.sj-irc-presence-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 0 15px;
  border-bottom: 1px solid var(--sj-chat-line);
}
.sj-irc-presence-head strong { font-size: 13px; }
.sj-irc-presence-head span { min-width: 24px; padding: 3px 7px; color: var(--sj-chat-accent); background: #10251f; border-radius: 10px; font-size: 10px; font-weight: 850; text-align: center; }
.sj-irc-people { padding: 10px; }
.sj-irc-person { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr) 7px; align-items: center; gap: 9px; min-height: 52px; padding: 7px; border-radius: 6px; }
.sj-irc-person:hover { background: #141f28; }
.sj-irc-person-avatar { display: grid; place-items: center; width: 32px; height: 32px; color: #ccece7; background: #1b3033; border-radius: 50%; font-size: 10px; font-weight: 900; }
.sj-irc-person strong,
.sj-irc-person small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sj-irc-person strong { color: #dce7eb; font-size: 12px; }
.sj-irc-person small { margin-top: 2px; color: #687d88; font-size: 9px; }
.sj-irc-person i { width: 7px; height: 7px; background: var(--sj-chat-accent); border-radius: 50%; }
.sj-irc-no-people { padding: 12px; color: var(--sj-chat-muted); font-size: 11px; line-height: 1.5; }
.sj-irc-panel-close { display: none; }

@keyframes sj-chat-pulse { to { opacity: .35; transform: scale(.8); } }

@media (max-width: 980px) {
  body.sj-irc-page-active .sj-content-card { padding: 10px !important; }
  .sj-irc-shell { grid-template-columns: 190px minmax(0, 1fr); height: calc(100dvh - 104px); min-height: 560px; }
  .sj-irc-presence { position: absolute; z-index: 20; inset: 0 0 0 auto; width: min(300px, 86vw); transform: translateX(102%); transition: transform .2s ease; box-shadow: -18px 0 50px rgba(0,0,0,.36); }
  .sj-irc-shell.show-people .sj-irc-presence { transform: translateX(0); }
  .sj-irc-icon-button[data-sj-toggle-people],
  .sj-irc-panel-close { display: grid; }
  .sj-irc-panel-close { width: 30px; height: 30px; padding: 0; color: #b9c7cd; background: transparent; border: 1px solid var(--sj-chat-line); border-radius: 5px; cursor: pointer; }
}

@media (max-width: 680px) {
  body.sj-irc-page-active .sj-content-card { padding: 0 !important; }
  .sj-irc-shell { display: block; height: var(--sj-chat-height, calc(100dvh - 162px)); min-height: 420px; border-right: 0; border-left: 0; border-radius: 0; }
  .sj-irc-main { height: 100%; }
  .sj-irc-sidebar { position: absolute; z-index: 30; inset: 0 auto 0 0; width: min(300px, 88vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: 18px 0 50px rgba(0,0,0,.4); }
  .sj-irc-shell.show-rooms .sj-irc-sidebar { transform: translateX(0); }
  .sj-irc-icon-button[data-sj-toggle-rooms] { display: grid; }
  .sj-irc-header { min-height: 66px; padding: 10px 12px; }
  .sj-irc-header h1 { font-size: 16px; }
  .sj-irc-header p { max-width: 58vw; font-size: 10px; }
  .sj-irc-live { display: none; }
  .sj-irc-log { padding: 14px 12px 22px; }
  .sj-irc-message { grid-template-columns: 32px minmax(0, 1fr); gap: 9px; }
  .sj-irc-avatar,
  .sj-irc-system-avatar { width: 30px !important; height: 30px !important; }
  .sj-irc-message p { font-size: 13px; }
  .sj-irc-compose { margin: 0 10px 10px; }
  .sj-irc-compose button { width: 44px; padding: 0; font-size: 0; }
  .sj-irc-compose button::before { content: "\2191"; font-size: 20px; }
  .sj-irc-readonly,
  .sj-irc-ops { margin: 0 10px 10px; }
  .sj-irc-ops-grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .sj-irc-channel,
  .sj-irc-sidebar,
  .sj-irc-presence { transition: none !important; }
  .sj-irc-live::before { animation: none !important; }
}
.sj-irc-channel[data-unread]::after {
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  content: attr(data-unread);
  color: #04110f;
  background: var(--sj-chat-accent);
  border-radius: 10px;
  font-size: 9px;
  font-weight: 900;
}

.sj-irc-compose.is-readonly {
  opacity: .62;
  border-style: dashed;
}
.sj-irc-compose.is-readonly button { background: #52646c; cursor: not-allowed; }

.sj-irc-message-content > p a {
  color: #72d7ff;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.sj-irc-link-preview {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  width: min(100%, 620px);
  min-height: 96px;
  margin-top: 9px;
  overflow: hidden;
  color: var(--sj-chat-text) !important;
  background: #101a23;
  border: 1px solid #2a3b47;
  border-radius: 7px;
  text-decoration: none !important;
  transition: border-color .16s ease, background-color .16s ease, transform .16s ease;
}

.sj-irc-link-preview:hover,
.sj-irc-link-preview:focus-visible {
  color: #fff !important;
  background: #14212b;
  border-color: #3c756d;
  transform: translateY(-1px);
}

.sj-irc-link-preview > img {
  width: 132px;
  height: 100%;
  min-height: 96px;
  object-fit: cover;
  background: #080d13;
}

.sj-irc-link-preview-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 11px 13px;
}

.sj-irc-link-preview-copy small {
  overflow: hidden;
  color: var(--sj-chat-accent-2);
  font-size: 10px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sj-irc-link-preview-copy strong {
  display: -webkit-box;
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sj-irc-link-preview-copy > span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--sj-chat-muted);
  font-size: 11px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sj-irc-link-preview-loading {
  display: block;
  margin-top: 7px;
  color: var(--sj-chat-muted);
  font-size: 10px;
}

@media (max-width: 560px) {
  .sj-irc-link-preview {
    grid-template-columns: 92px minmax(0, 1fr);
    min-height: 82px;
  }

  .sj-irc-link-preview > img {
    width: 92px;
    min-height: 82px;
  }

  .sj-irc-link-preview-copy {
    padding: 9px 10px;
  }

  .sj-irc-link-preview-copy > span {
    -webkit-line-clamp: 1;
  }
}