:root {
  --bg: #0b141a;
  --panel: #111b21;
  --panel2: #0f1a20;
  --text: #e9edef;
  --muted: #8696a0;
  --green: #00a884;
  --green2: #019875;
  --danger: #ff5a5f;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

#app {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  -webkit-touch-callout: none;
}

.noCopy,
#messages,
.pinnedBar,
.sidebar,
.authRegisterNotice,
.bubble,
.privateMessages,
.replyQuote,
.siteLogoBar {
  -webkit-user-select: none;
  user-select: none;
}

input,
textarea,
[contenteditable='true'] {
  -webkit-user-select: text;
  user-select: text;
}

.chatImage,
.siteLogo {
  -webkit-user-drag: none;
  user-drag: none;
}

.authView {
  height: 100%;
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.siteLogoBar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px 12px 8px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

.siteLogoBar--chat {
  padding: 10px 12px 2px;
  margin: 14px 14px 0;
}

.siteLogo {
  display: block;
  max-width: min(340px, 92vw);
  max-height: 80px;
  min-height: 40px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.siteLogo--compact {
  max-width: min(260px, 80vw);
  max-height: 56px;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
}

.logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--green);
  color: #0b141a;
  font-size: 20px;
}

.title {
  font-weight: 800;
  font-size: 18px;
}

.subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.authGrid {
  margin-top: 12px;
  height: calc(100% - 86px);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.authGridSingle {
  grid-template-columns: minmax(320px, 620px);
  justify-content: center;
}

.authMainCard {
  max-height: 100%;
  overflow: auto;
}

.authRegisterNotice {
  margin-top: 14px;
  padding: 14px 12px;
  border-radius: 10px;
  border: 2px solid rgba(0, 168, 132, 0.55);
  background: rgba(0, 168, 132, 0.1);
  color: #9ef0d8;
  font-weight: 800;
  font-size: clamp(12px, 3.2vw, 15px);
  line-height: 1.45;
  text-align: center;
  letter-spacing: 0.02em;
}

.authSwitch {
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.linkBtn {
  margin-left: 6px;
  background: transparent;
  color: var(--green);
  padding: 0;
  border-radius: 0;
  font-weight: 700;
}

.linkBtn:hover {
  text-decoration: underline;
}

.signupBox {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
}

.signupBox h3 {
  margin: 0 0 10px 0;
  font-size: 14px;
}

.authTabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.authTab {
  flex: 1;
  background: var(--panel2);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.authTab.active {
  background: rgba(0, 168, 132, 0.18);
  color: var(--text);
  border-color: rgba(0, 168, 132, 0.5);
}

.authMessage {
  min-height: 0;
  margin-bottom: 10px;
  font-size: 13px;
  border-radius: 8px;
  padding: 0;
}

.authMessage:not(:empty) {
  padding: 8px 10px;
  background: rgba(255, 90, 95, 0.12);
  color: #ffb4b7;
}

.authMessage.success:not(:empty) {
  background: rgba(0, 168, 132, 0.15);
  color: #9ef0d8;
}

.authHint {
  margin: 0 0 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.loginOtpBox {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
}

.otpBtnRow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.loginMethodTabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.loginMethodTab {
  flex: 1;
  padding: 8px 10px;
  font-size: 12px;
  background: var(--panel2);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.loginMethodTab.active {
  color: var(--text);
  border-color: rgba(0, 168, 132, 0.5);
  background: rgba(0, 168, 132, 0.15);
}

.sidebarTabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.sidebarTab {
  flex: 1;
  padding: 6px 8px;
  font-size: 12px;
  background: var(--panel2);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebarTab.active {
  color: var(--text);
  border-color: rgba(0, 168, 132, 0.45);
  background: rgba(0, 168, 132, 0.12);
}

.sidebarTitleRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.smallBtn {
  padding: 4px 8px;
  font-size: 11px;
}

.otpLogsList {
  max-height: calc(100vh - 180px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.otpLogItem {
  background: var(--panel2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 8px;
  font-size: 11px;
  line-height: 1.4;
}

.otpLogItem .otpLogTop {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.otpLogStatus {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10px;
}

.otpLogStatus.sent,
.otpLogStatus.success {
  color: #9ef0d8;
}

.otpLogStatus.failed,
.otpLogStatus.blocked {
  color: #ffb4b7;
}

.otpLogMeta {
  color: var(--muted);
  word-break: break-word;
}

.panel {
  background: var(--panel);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

h2 {
  margin: 0 0 12px 0;
  font-size: 15px;
  color: var(--text);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

label {
  color: var(--muted);
  font-size: 13px;
}

input,
textarea {
  background: var(--panel2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: rgba(0, 168, 132, 0.65);
}

textarea {
  resize: vertical;
  min-height: 42px;
  max-height: 140px;
  font-family: inherit;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
}

.primary {
  background: var(--green);
  color: #04110e;
}

.primary:hover {
  background: var(--green2);
}

.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin: 10px 0;
}

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  color: var(--text);
  background: rgba(0, 168, 132, 0.16);
  padding: 2px 8px;
  border-radius: 999px;
}

.otpArea {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 86px;
  bottom: 50px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  pointer-events: auto;
}

.otpArea .panel {
  width: 420px;
}

.otpActions {
  display: flex;
  gap: 10px;
}

.error {
  margin-top: 10px;
  color: var(--danger);
  font-size: 13px;
}

.infoBox {
  margin-top: 12px;
}

.chatView {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chatHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--panel);
  border-radius: 12px;
  margin: 8px 14px 14px;
}

.chatHeaderRight {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chatToggleBtn.chatToggleClosed {
  border-color: rgba(255, 90, 95, 0.55);
  color: #ffb4b7;
}

.chatClosedBar {
  margin: 0 14px 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 90, 95, 0.12);
  border: 1px solid rgba(255, 90, 95, 0.35);
  color: #ffb4b7;
  font-size: 13px;
}

.composerDisabled {
  opacity: 0.55;
  pointer-events: none;
}

.chatLayout {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 12px;
  padding: 0 14px 14px 14px;
  min-height: 0;
}

.sidebar {
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebarTitle {
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--muted);
}

#sidebarMembers {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.memberSearchWrap {
  margin: 0 0 10px;
}

.memberSearchInput {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--panel2, rgba(255, 255, 255, 0.04));
  color: var(--text);
  font-size: 13px;
}

.memberSearchInput:focus {
  outline: none;
  border-color: rgba(0, 168, 132, 0.55);
}

.userListEmpty {
  padding: 12px 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.userList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.userItem {
  padding: 10px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text);
  white-space: pre-line;
  font-weight: 700;
  font-size: 14px;
}

.userItem--admin {
  background: rgba(0, 168, 132, 0.08);
  border-color: rgba(0, 168, 132, 0.28);
}

.userNameLine {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.userRoleTag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.verifiedBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1d9bf0;
  color: #fff;
  flex-shrink: 0;
  vertical-align: middle;
}

.verifiedBadge svg {
  width: 11px;
  height: 11px;
  fill: currentColor;
}

.bubbleName {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-weight: 800;
  font-size: 13px;
  color: var(--text);
}

.replyQuoteName {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-weight: 800;
  font-size: 12px;
  color: var(--green);
  margin-bottom: 2px;
}

.userTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.userWaRow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.userWa {
  color: var(--muted);
  font-size: 12px;
  font-family: monospace;
}

.waRevealBtn {
  font-size: 11px;
  padding: 4px 8px;
}

.userActions {
  display: flex;
  gap: 6px;
}

.userActionBtn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
}

.userActionBtn.danger {
  border-color: rgba(255, 90, 95, 0.6);
  color: #ff8589;
}

.chatMain {
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.messages {
  flex: 1;
  padding: 12px 12px 0 12px;
  overflow: auto;
  min-height: 0;
}

.messagesLoadOlder {
  text-align: center;
  font-size: 12px;
  color: var(--muted, rgba(255, 255, 255, 0.45));
  padding: 8px 12px 12px;
  user-select: none;
}

.pinnedBar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 168, 132, 0.08);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

#pinnedContent {
  font-size: 13px;
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pinChip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

.pinChipJump {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-align: left;
}

.pinChipJump:hover .pinChipText {
  text-decoration: underline;
}

.pinChipText {
  font-size: 12px;
}

.pinChipRemove {
  padding: 0;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font-size: 11px;
  line-height: 1;
}

.pinBtn {
  padding: 6px 10px;
  font-size: 12px;
}

.composer {
  padding: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.12);
}

.composerInputWrap {
  position: relative;
  flex: 1;
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: stretch;
}

.composerInputWrap textarea,
.composer #messageInput,
.composer #privateMessageInput {
  width: 100%;
  box-sizing: border-box;
  resize: none;
  min-height: 42px;
  max-height: 120px;
}

.mentionPicker {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  max-height: 180px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid rgba(0, 168, 132, 0.45);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 20;
}

.mentionOption {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
}

.mentionOption:hover,
.mentionOption.active {
  background: rgba(0, 168, 132, 0.2);
}

.mention {
  color: #7ee8c8;
  font-weight: 600;
  background: rgba(0, 168, 132, 0.15);
  border-radius: 4px;
  padding: 0 2px;
}

#fileInput,
#privateFileInput,
.composer input[type="file"] {
  display: none;
}

.fileBtn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: grid;
  place-items: center;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
  background: var(--panel2);
}

.fileBtn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.filePreview {
  margin: 0 12px 12px 12px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.previewMeta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.previewImage,
.previewVideo {
  width: min(240px, 100%);
  border-radius: 8px;
  display: block;
}

.msgRow {
  display: flex;
  margin-bottom: 10px;
}

.msgRow.mine {
  justify-content: flex-end;
}

.msgRow.theirs {
  justify-content: flex-start;
}

.msgRowHighlight .bubble {
  outline: 2px solid rgba(0, 168, 132, 0.9);
  box-shadow: 0 0 0 4px rgba(0, 168, 132, 0.22);
  animation: pinJumpPulse 0.6s ease-out 2;
}

@keyframes pinJumpPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 168, 132, 0.45);
  }
  100% {
    box-shadow: 0 0 0 4px rgba(0, 168, 132, 0.22);
  }
}

.bubble {
  max-width: 72%;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}

.msgRow.mine .bubble {
  background: rgba(0, 168, 132, 0.18);
  border-color: rgba(0, 168, 132, 0.35);
}

.bubbleHeader {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  align-items: center;
}

.bubbleHeaderActions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.replyBtn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.msgRow:hover .replyBtn,
.msgRow:focus-within .replyBtn {
  opacity: 1;
}

.replyBtn:hover {
  color: var(--green);
  background: rgba(0, 168, 132, 0.12);
}

.replyQuote {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0 0 8px;
  padding: 8px 10px;
  border: none;
  border-left: 3px solid var(--green);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.replyQuote:hover {
  background: rgba(0, 168, 132, 0.12);
}

.replyQuote--deleted {
  cursor: default;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.replyQuoteText {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.replyPreview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 14px 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 168, 132, 0.35);
  background: rgba(0, 168, 132, 0.08);
}

.replyPreviewBody {
  flex: 1;
  min-width: 0;
}

.replyPreviewLabel {
  display: block;
  font-size: 12px;
  color: var(--green);
  margin-bottom: 2px;
}

.replyPreviewText {
  display: block;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.replyPreviewCancel {
  font-size: 20px;
  line-height: 1;
  padding: 4px 8px;
}

.bubbleTime {
  color: var(--muted);
  font-size: 12px;
}

.bubbleContent {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.35;
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}

.replyQuoteText,
#pinnedContent .bubbleContent {
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}

.msgActions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.msgActionBtn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
}

.msgActionBtn.danger {
  border-color: rgba(255, 90, 95, 0.6);
  color: #ff8589;
}

.chatImage,
.chatVideo {
  width: min(360px, 100%);
  border-radius: 10px;
  margin-bottom: 8px;
  display: block;
}

.chatImage {
  cursor: zoom-in;
}

.chatLink {
  color: #52b7ff;
  text-decoration: underline;
}

.noticeModal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 6000;
}

.noticeModalCard {
  position: relative;
  width: min(520px, 100%);
  background: var(--panel);
  border: 2px solid rgba(0, 168, 132, 0.55);
  border-radius: 14px;
  padding: 28px 20px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.noticeModalClose {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.noticeModalText {
  margin: 0 0 18px;
  text-align: center;
  font-weight: 800;
  font-size: clamp(14px, 3.5vw, 18px);
  line-height: 1.45;
  color: #9ef0d8;
  letter-spacing: 0.02em;
}

.noticeModalCard .primary {
  width: 100%;
}

.depositModalCard .depositModalTitle {
  color: #ffb74d;
}

.depositModalBody {
  margin: 0 0 12px;
  text-align: center;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  font-weight: 500;
}

.depositModalUser {
  margin: 0 0 16px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.depositModalSecondary {
  width: 100%;
  margin-top: 10px;
}

.imageZoomModal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 5000;
  overflow: hidden;
  cursor: zoom-out;
}

#zoomedImage {
  max-width: min(95vw, 1200px);
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
  cursor: zoom-in;
}

.zoomCloseBtn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
}

.channelBar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  min-height: 44px;
}

.channelTabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.channelTabWrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  padding-right: 4px;
}

.channelTabWrap.active {
  border-color: rgba(0, 168, 132, 0.55);
  background: rgba(0, 168, 132, 0.14);
}

.channelTab {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px 6px 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.channelTabWrap.active .channelTab,
.channelTab.active {
  color: var(--text);
}

.channelTabDelete {
  border: none;
  background: rgba(255, 90, 95, 0.15);
  color: #ff8a8e;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.channelTabDelete:hover {
  background: rgba(255, 90, 95, 0.35);
  color: #fff;
}

.channelAddBtn {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  margin-bottom: 8px;
}

.channelModalHint {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.4;
}

#createChannelName {
  width: 100%;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 14px;
}

.chatModeTabs {
  display: flex;
  gap: 8px;
  padding: 10px 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chatModeTab {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
}

.chatModeTab.active {
  color: var(--text);
  border-color: rgba(120, 190, 255, 0.55);
  background: rgba(80, 150, 255, 0.12);
}

#communityChatPanel,
#privateChatPanel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#privateSendForm.composer {
  margin-top: auto;
}

.privateChatHeader {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-weight: 800;
  font-size: 14px;
  color: var(--text);
}

.privateEmptyState {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.privateMessages {
  flex: 1;
  overflow: auto;
  padding: 12px;
}

.privateConvList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  max-height: 280px;
}

.privateConvItem {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
}

.privateConvItem.active {
  border-color: rgba(120, 190, 255, 0.55);
  background: rgba(80, 150, 255, 0.1);
}

.privateConvName {
  font-weight: 800;
  font-size: 13px;
}

.privateConvPreview {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.privateConvTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.unreadBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: #e53935;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
  flex-shrink: 0;
}

.chatModeTab {
  position: relative;
}

.chatModeTab .unreadBadge {
  margin-left: 6px;
}

.userTop .unreadBadge {
  margin-left: 4px;
}

.privateToast {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 8000;
  max-width: min(360px, calc(100vw - 32px));
  background: rgba(20, 28, 34, 0.96);
  border: 1px solid rgba(229, 57, 53, 0.55);
  border-left: 4px solid #e53935;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  animation: privateToastIn 0.25s ease-out;
}

.privateToastBody {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}

.privateToastActions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

#privateToastText {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

@keyframes privateToastIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.userActionBtn.pmBtn {
  border-color: rgba(120, 190, 255, 0.45);
  color: #9ecbff;
}

@media (max-width: 960px) {
  .authGridSingle {
    grid-template-columns: 1fr;
  }

  .chatLayout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }
}

[hidden] {
  display: none !important;
}

.mediaIconBtn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--panel2);
  color: var(--text);
  font-size: 18px;
  flex-shrink: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.mediaIconBtn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.mediaIconBtn.recording {
  background: var(--danger, #dc2626);
  color: white;
}

.voiceUploadBtn {
  cursor: pointer;
}

.voiceBar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #3f1d1d;
  border-top: 1px solid #7f1d1d;
}

.recDot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  animation: mediaRecPulse 1s infinite;
}

@keyframes mediaRecPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.voiceHint {
  color: #fecaca;
  font-size: 13px;
  flex: 1;
}

.voiceCancelBtn {
  background: transparent;
  color: #fecaca;
  border: 1px solid #7f1d1d;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
}

.stickerPicker {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #111827;
  max-height: 280px;
  display: flex;
  flex-direction: column;
}

.stickerPickerHead {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.packTabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
}

.packTab {
  background: var(--panel2);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}

.packTab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.stickerGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  padding: 10px;
  overflow-y: auto;
}

.stickerCell {
  position: relative;
}

.stickerFavBtn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.stickerFavBtn.active {
  background: #f59e0b;
  color: #111;
}

.stickerBtn {
  background: transparent;
  border: none;
  padding: 4px;
  border-radius: 10px;
  cursor: pointer;
  width: 100%;
}

.stickerBtn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.stickerBtn img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.stickerUploadRow {
  padding: 8px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.uploadStickerBtn {
  display: inline-block;
  background: var(--accent);
  color: #052e16;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.stickerEmpty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.stickerMsgWrap {
  position: relative;
  display: inline-block;
}

.stickerFavChatBtn {
  margin-top: 6px;
  background: rgba(0, 0, 0, 0.25);
  color: #fde68a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

.stickerFavChatBtn.active {
  background: #f59e0b;
  color: #111;
  border-color: #f59e0b;
}

.chatSticker {
  width: 120px;
  height: 120px;
  object-fit: contain;
  display: block;
}

.voicePlayer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.voicePlayer audio {
  width: 100%;
  max-width: 240px;
  height: 36px;
}

.voiceDur {
  font-size: 12px;
  color: var(--muted);
}
