* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  fill: none;
}

:root {
  --bg: #050505;
  --surface: #0a0a0c;
  --surface-darker: #000;
  --surface-light: #141419;
  --surface-hover: #1f1f26;
  --border: #2a2a33;
  --text: #ededed;
  --text-dim: #a0a0a0;
  --primary: #4e5058;
  --primary-hover: #586068;
  --danger: #ed4245;
  --warning: #faa61a;
  --success: #3ba55c;
  --link: #00a8fc;
  --mention: #9b87f5;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
  --font-main: "gg sans", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --message-font-size: 15px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-df: 25px;
  --radius-pill: 999px;
  --border-radius: var(--radius-md);
  --chat-radius: var(--radius-lg);
  --avatar-radius: 50%;

  --space-0: 0px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;
  --space-10: 56px;
  --space-11: 64px;

  --anim-instant: 100ms;
  --anim-fast: 120ms;
  --anim-normal: 180ms;
  --anim-slow: 240ms;
  --anim-slower: 300ms;
  --ease-standard: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  --shadow-1: 0 8px 16px rgba(0, 0, 0, 0.45);
  --shadow-2: 0 12px 24px rgba(0, 0, 0, 0.5);
  --shadow-3: 0 20px 40px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 4px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.7);

  --layer-app-bg: var(--bg);
  --layer-sidebar-bg: var(--surface-light);
  --layer-panel-bg: var(--surface);
  --layer-subtle-bg: color-mix(
    in srgb,
    var(--surface-light) 70%,
    var(--surface) 30%
  );

  --z-base: 1;
  --z-dropdown: 1000;
  --z-sticky: 100;
  --z-fixed: 1000;
  --z-modal-backdrop: 10000;
  --z-modal: 10001;
  --z-popover: 10002;
  --z-tooltip: 10003;
  --z-context-menu: 10010;

  --font-xs: 11px;
  --font-sm: 12px;
  --font-base: 13px;
  --font-md: 14px;
  --font-lg: 15px;
  --font-xl: 16px;
  --font-2xl: 18px;
  --font-3xl: 24px;

  --size-icon-xs: 16px;
  --size-icon-sm: 18px;
  --size-icon-md: 20px;
  --size-icon-lg: 24px;
  --size-icon-xl: 32px;

  --size-avatar-xs: 24px;
  --size-avatar-sm: 28px;
  --size-avatar-md: 32px;
  --size-avatar-lg: 40px;
  --size-avatar-xl: 64px;

  --interactive-hover-bg: rgba(255, 255, 255, 0.05);
  --interactive-active-bg: rgba(255, 255, 255, 0.08);
  --interactive-selected-bg: rgba(255, 255, 255, 0.1);
  --overlay-bg: rgba(0, 0, 0, 0.85);

  --primary-08: rgba(78, 80, 88, 0.08);
  --primary-10: rgba(78, 80, 88, 0.1);
  --primary-12: rgba(78, 80, 88, 0.12);
  --primary-15: rgba(78, 80, 88, 0.15);
  --primary-20: rgba(78, 80, 88, 0.2);
  --primary-25: rgba(78, 80, 88, 0.25);
  --primary-30: rgba(78, 80, 88, 0.3);
}

body {
  background: var(--layer-app-bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  height: 100dvh;
  touch-action: pan-y;
}

body.no-animations * {
  animation: none !important;
  transition: none !important;
}

body.reduce-motion * {
  animation-duration: calc(var(--anim-fast) / 2);
}

#auth-screen,
#chat-screen {
  display: none;
  height: 100dvh;
}

#auth-screen.active,
#chat-screen.active {
  display: flex;
}

#auth-screen {
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
  text-align: center;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-10px);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scaleOut {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

@keyframes slideInCenter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

.transition-standard {
  transition:
    background-color var(--anim-normal) var(--ease-standard),
    color var(--anim-normal) var(--ease-standard),
    border-color var(--anim-normal) var(--ease-standard),
    box-shadow var(--anim-normal) var(--ease-standard),
    transform var(--anim-normal) var(--ease-standard),
    opacity var(--anim-normal) var(--ease-standard);
}

.transition-fast {
  transition:
    background-color var(--anim-fast) var(--ease-standard),
    color var(--anim-fast) var(--ease-standard),
    border-color var(--anim-fast) var(--ease-standard),
    box-shadow var(--anim-fast) var(--ease-standard),
    transform var(--anim-fast) var(--ease-standard),
    opacity var(--anim-fast) var(--ease-standard);
}

.transition-instant {
  transition:
    background-color var(--anim-instant) var(--ease-standard),
    color var(--anim-instant) var(--ease-standard),
    border-color var(--anim-instant) var(--ease-standard),
    box-shadow var(--anim-instant) var(--ease-standard),
    transform var(--anim-instant) var(--ease-standard),
    opacity var(--anim-instant) var(--ease-standard);
}

.focus-ring:focus-visible {
  outline: var(--space-1) solid var(--primary);
  outline-offset: var(--space-1);
}

.hover-bg:hover {
  background-color: var(--interactive-hover-bg);
}

.active-bg:active {
  background-color: var(--interactive-active-bg);
}

.selected-bg {
  background-color: var(--interactive-selected-bg);
}

.cursor-pointer {
  cursor: pointer;
}

.cursor-default {
  cursor: default;
}

.flex,
.flex-col {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 {
  gap: var(--space-1);
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.p-1 {
  padding: var(--space-1);
}

.p-2 {
  padding: var(--space-2);
}

.p-3 {
  padding: var(--space-3);
}

.p-4 {
  padding: var(--space-4);
}

.px-2 {
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}

.px-3 {
  padding-left: var(--space-3);
  padding-right: var(--space-3);
}

.px-4 {
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.py-1 {
  padding-bottom: var(--space-1);
  padding-top: var(--space-1);
}

.py-2 {
  padding-bottom: var(--space-2);
  padding-top: var(--space-2);
}

.py-3 {
  padding-bottom: var(--space-3);
  padding-top: var(--space-3);
}

.m-0 {
  margin: var(--space-0);
}

.m-1 {
  margin: var(--space-1);
}

.m-2 {
  margin: var(--space-2);
}

.m-3 {
  margin: var(--space-3);
}

.mt-1 {
  margin-top: var(--space-1);
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-3 {
  margin-top: var(--space-3);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mb-1 {
  margin-bottom: var(--space-1);
}

.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-3 {
  margin-bottom: var(--space-3);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.rounded-sm {
  border-radius: var(--radius-sm);
}

.rounded-md {
  border-radius: var(--radius-md);
}

.rounded-lg {
  border-radius: var(--radius-lg);
}

.rounded-pill {
  border-radius: var(--radius-pill);
}

.shadow-sm {
  box-shadow: var(--shadow-sm);
}

.shadow-1 {
  box-shadow: var(--shadow-1);
}

.shadow-2 {
  box-shadow: var(--shadow-2);
}

.text-xs {
  font-size: var(--font-xs);
}

.text-sm {
  font-size: var(--font-sm);
}

.text-base {
  font-size: var(--font-base);
}

.text-md {
  font-size: var(--font-md);
}

.text-lg {
  font-size: var(--font-lg);
}

h1 {
  font-size: 32px;
  margin-bottom: 10px;
}

p {
  color: var(--text-dim);
  margin-bottom: 30px;
}

.btn {
  align-items: center;
  background-color: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-size: var(--font-md);
  font-weight: 600;
  gap: var(--space-2);
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
  transition:
    background-color var(--anim-normal) var(--ease-standard),
    color var(--anim-normal) var(--ease-standard),
    border-color var(--anim-normal) var(--ease-standard),
    transform var(--anim-fast) var(--ease-standard);
  white-space: nowrap;
}

.btn svg {
  flex-shrink: 0;
  height: var(--size-icon-xs);
  width: var(--size-icon-xs);
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn:hover:not(:disabled) {
  background-color: var(--interactive-hover-bg);
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--surface-light);
  border-color: var(--border);
  color: var(--text-dim);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--interactive-hover-bg);
  color: var(--text);
}

.icon-btn {
  border-radius: var(--radius-sm);
  height: var(--size-icon-lg);
  padding: var(--space-1);
  transition:
    background-color var(--anim-fast) var(--ease-standard),
    color var(--anim-fast) var(--ease-standard),
    transform var(--anim-fast) var(--ease-standard);
  width: var(--size-icon-lg);
}

.icon-btn svg {
  height: var(--size-icon-md);
  width: var(--size-icon-md);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.icon-btn:hover {
  background-color: var(--interactive-hover-bg);
  transform: scale(1.05);
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

#chat-screen {
  flex-direction: column;
}

.channels-list {
  display: flex;
  flex-direction: column;
  padding: 10px;
}

.content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.channels {
  transition: transform 0.3s ease;
}

@media (max-width: 768px) {
  .channels {
    background: var(--layer-sidebar-bg);
  }
}

.channel-header {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: 12px;
  padding: 12px 16px;
}

@media (max-width: 768px) {
  .channel-header {
    border-bottom: 1px solid var(--border);
  }
}

.main-content-wrapper {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.main-content-wrapper.thread-panel-with-members {
  flex-direction: row;
}

.main-content-wrapper.thread-panel-with-members .members-list {
  flex: 1;
  max-width: 300px;
}

.right-panel {
  overflow: scroll;
  display: flex;
  flex-direction: column;
}

.right-panel-header {
  align-items: center;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  display: flex;
  font-size: 14px;
  font-weight: 600;
  gap: 8px;
  padding: 12px 16px;
  flex-shrink: 0;
}

.right-panel-close {
  align-items: center;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  display: none;
  justify-content: center;
  margin-left: auto;
  padding: 4px 6px;
  transition:
    background var(--anim-fast) ease,
    color var(--anim-fast) ease;
}

.right-panel-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.right-panel-search-input {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.right-panel-search-input input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  flex: 1;
  font-size: 13px;
  outline: none;
  padding: 6px 10px;
}

.right-panel-search-input input:focus {
  border-color: var(--mention);
}

.search-submit-btn {
  align-items: center;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  justify-content: center;
  padding: 6px 8px;
  transition: all var(--anim-fast) ease;
}

.search-submit-btn:hover {
  background: var(--border);
  color: var(--text);
}

.right-panel-content {
  max-width: 360px;
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.right-panel-content .messageGroup {
  background: var(--surface-light);
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 8px;
  padding: 12px;
  transition: background 0.15s ease;
}

.right-panel-content .messageGroup:hover {
  background: var(--surface-hover);
}

.right-panel-content .messageGroup .avatar {
  height: 24px;
  margin-right: 8px;
  margin-top: 0;
  width: 24px;
}

.right-panel-content .messageGroup .messageGroupContent {
  min-width: 0;
}

.right-panel-content .messageGroup .messageHeader {
  margin-bottom: 4px;
  margin-top: 0;
}

.right-panel-content .messageGroup .username {
  font-size: 13px;
}

.right-panel-content .messageGroup .timestamp {
  font-size: 11px;
}

.right-panel-empty {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.right-panel-unsupported {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  font-size: 0.9em;
}

.right-panel-message {
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 8px 10px;
  transition: background var(--anim-fast) ease;
}

.right-panel-message:hover {
  background: var(--surface-hover);
}

.right-panel-message-header {
  align-items: center;
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}

.right-panel-avatar {
  border-radius: 50%;
  height: 20px;
  object-fit: cover;
  width: 20px;
}

.right-panel-username {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.right-panel-time {
  color: var(--text-dim);
  font-size: 11px;
  margin-left: auto;
}

.right-panel-message-content {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.right-panel-message-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.right-panel-unpin-btn {
  align-items: center;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  padding: 4px;
  transition: color var(--anim-fast) ease;
}

.right-panel-unpin-btn:hover {
  color: var(--text);
}

.highlight-message {
  animation: highlightFade 2s ease-out;
}

@keyframes highlightFade {
  0% {
    background: color-mix(in srgb, var(--mention, #9b87f5) 25%, transparent);
  }

  100% {
    background: transparent;
  }
}

.main-content-area {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.dm-tabs {
  background: var(--surface-light);
  border-radius: calc(var(--border-radius, 12px) - 4px);
  display: flex;
  gap: 4px;
  padding: 4px;
  transition: border-radius 0.2s ease;
}

.dm-tab {
  background: transparent;
  border: none;
  border-radius: calc(var(--border-radius, 12px) - 6px);
  color: var(--text-dim);
  cursor: pointer;
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  text-align: center;
  transition:
    all 0.2s ease,
    border-radius 0.2s ease;
}

.dm-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.dm-tab.active {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  color: var(--text);
}

.dm-action-btn {
  align-items: center;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  justify-content: center;
  padding: 4px;
  transition: all 0.2s ease;
}

.dm-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.dm-action-btn.accept-btn:hover {
  background: rgba(59, 165, 92, 0.2);
  color: var(--status-green, #23a559);
}

.dm-action-btn.reject-btn:hover {
  background: rgba(237, 66, 69, 0.2);
  color: var(--danger, #ed4245);
}

.dm-action-btn.unblock-btn:hover {
  background: rgba(59, 165, 92, 0.2);
  color: var(--status-green, #23a559);
}

.dm-friends-container {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.dm-friends-header {
  align-items: center;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  display: flex;
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 600;
  gap: 8px;
  height: 48px;
  min-height: 48px;
  padding: 0 16px;
}

.dm-friends-container .dm-tabs {
  flex-shrink: 0;
  margin: 12px 16px 0;
}

.dm-tab-count {
  background: var(--surface-hover);
  border-radius: 10px;
  font-size: 11px;
  margin-left: 4px;
  min-width: 18px;
  padding: 1px 6px;
}

.dm-tab-count-pending {
  background: var(--danger, #ed4245);
  color: #fff;
}

.dm-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

.dm-friend-item {
  align-items: center;
  border-radius: 8px;
  cursor: default;
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  transition: background 0.15s;
}

.dm-friend-item:hover {
  background: var(--surface-hover);
}

.dm-avatar {
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  height: 36px;
  object-fit: cover;
  width: 36px;
}

.dm-username {
  color: var(--text);
  cursor: pointer;
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.dm-action-accept:hover {
  background: rgba(59, 165, 92, 0.2) !important;
  color: #23a559 !important;
}

.dm-action-danger:hover {
  background: rgba(237, 66, 69, 0.2) !important;
  color: #ed4245 !important;
}

.dm-empty {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.dm-empty h3 {
  color: var(--text);
  font-size: 16px;
  margin: 8px 0 0;
}

.dm-empty p {
  font-size: 13px;
  margin: 0;
}

/* ── Add friend / search row ─────────────────────────────────────────────── */
.dm-add-friend {
  padding: 8px 12px 4px;
}

.dm-add-friend-row {
  display: flex;
  gap: 6px;
}

.dm-add-friend-input {
  background: var(--input-bg, var(--surface));
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  flex: 1;
  font-size: 13px;
  min-width: 0;
  outline: none;
  padding: 6px 10px;
  transition: border-color 0.15s;
}

.dm-add-friend-input:focus {
  border-color: var(--accent);
}

.dm-add-friend-btn {
  align-items: center;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  justify-content: center;
  padding: 6px 10px;
  transition: opacity 0.15s;
}

.dm-add-friend-btn:hover:not(:disabled) {
  opacity: 0.85;
}

.dm-add-friend-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dm-add-friend-error {
  color: #ed4245;
  font-size: 12px;
  margin-top: 4px;
}

.dm-add-friend-success {
  color: #3ba55c;
  font-size: 12px;
  margin-top: 4px;
}

/* ── Friend item info + status ───────────────────────────────────────────── */
.dm-friend-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.dm-friend-info .dm-username {
  flex: unset;
}

.dm-friend-status {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  font-size: 12px;
  gap: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-friend-status-emoji {
  flex-shrink: 0;
  font-size: 13px;
}

/* ── Groups tab ──────────────────────────────────────────────────────────── */
.groups-tab {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.group-item {
  align-items: center;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  padding: 8px 12px;
  transition: background 0.15s;
}

.group-item:hover {
  background: var(--surface-hover);
}

.group-item-icon {
  align-items: center;
  background: var(--surface-3, var(--surface));
  border-radius: 50%;
  color: var(--text-dim);
  display: flex;
  flex-shrink: 0;
  height: 36px;
  justify-content: center;
  overflow: hidden;
  width: 36px;
}

.group-item-icon img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.group-item-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
}

.group-item-name {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-item-tag {
  color: var(--text-dim);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-item-desc {
  color: var(--text-dim);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-item-members {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  font-size: 11px;
  gap: 3px;
}

/* ============= DM HOME PAGE ============= */
.dm-home-container {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.dm-home-header {
  align-items: center;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  display: flex;
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 600;
  gap: 8px;
  height: 48px;
  min-height: 48px;
  padding: 0 16px;
}

.dm-home-container .home-content {
  flex: 1;
  overflow-y: auto;
}

.dm-home-card-badge {
  background: var(--danger, #ed4245);
  border-radius: 10px;
  color: #fff;
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  margin-left: 6px;
  min-width: 18px;
  padding: 3px 6px;
  text-align: center;
  vertical-align: middle;
}

/* ============= INBOX RIGHT PANEL ============= */
.inbox-panel-total {
  background: var(--primary);
  border-radius: 10px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  margin-left: 4px;
  min-width: 18px;
  padding: 3px 6px;
  text-align: center;
}

.inbox-ping-group-header {
  align-items: center;
  background: color-mix(in srgb, var(--surface-light) 60%, var(--surface));
  border-radius: var(--radius-md, 8px) var(--radius-md, 8px) 0 0;
  color: var(--text-dim);
  display: flex;
  font-size: 11px;
  font-weight: 600;
  gap: 4px;
  letter-spacing: 0.03em;
  margin-top: 6px;
  padding: 6px 10px 5px;
  text-transform: uppercase;
}

.inbox-ping-card {
  background: color-mix(in srgb, var(--surface-light) 60%, var(--surface));
  border-radius: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 10px 8px;
  transition: background var(--anim-fast);
}

.inbox-ping-card--last {
  border-radius: 0 0 var(--radius-md, 8px) var(--radius-md, 8px);
  margin-bottom: 4px;
}

.inbox-ping-card:hover {
  background: color-mix(
    in srgb,
    var(--surface-hover) 80%,
    var(--surface-light)
  );
}

.inbox-ping-card-channel {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-ping-card-time {
  color: var(--text-dim);
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.inbox-ping-card-reply {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  font-size: 12px;
  gap: 5px;
  margin-bottom: 2px;
  overflow: hidden;
  padding: 2px 0;
}

.inbox-ping-card-reply-avatar {
  border-radius: 50%;
  flex-shrink: 0;
  height: 14px;
  object-fit: cover;
  width: 14px;
}

.inbox-ping-card-reply-user {
  color: var(--text);
  flex-shrink: 0;
  font-weight: 600;
}

.inbox-ping-card-reply-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-ping-card-body {
  align-items: flex-start;
  display: flex;
  gap: 8px;
}

.inbox-ping-card-avatar {
  border-radius: var(--avatar-radius, 50%);
  flex-shrink: 0;
  height: 30px;
  object-fit: cover;
  width: 30px;
}

.inbox-ping-card-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.inbox-ping-card-header {
  align-items: baseline;
  display: flex;
  gap: 6px;
}

.inbox-ping-card-username {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.inbox-ping-card-text {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
  word-break: break-word;
}

.inbox-panel-load-more {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  margin: 8px 10px 4px;
  padding: 6px 12px;
  transition:
    background var(--anim-fast),
    color var(--anim-fast);
  width: calc(100% - 20px);
}

.inbox-panel-load-more:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.inbox-panel-load-more:disabled {
  cursor: default;
  opacity: 0.5;
}

/* ============= NEW MESSAGE TAB ============= */
.new-message-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.new-message-search {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  padding: 12px 16px;
}

.new-message-search label {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
}

.new-message-search input {
  background: transparent;
  border: none;
  color: var(--text);
  flex: 1;
  font-size: 14px;
  outline: none;
}

.new-message-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.new-message-item {
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  transition: background 0.15s;
}

.new-message-item:hover {
  background: var(--surface-hover);
}

.new-message-item-avatar {
  align-items: center;
  border-radius: 50%;
  display: flex;
  flex-shrink: 0;
  height: 36px;
  justify-content: center;
  object-fit: cover;
  width: 36px;
}

.new-message-item-direct .new-message-item-avatar {
  background: var(--accent);
  color: #fff;
}

.new-message-item-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.new-message-item-name {
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.new-message-item-hint {
  color: var(--text-dim);
  font-size: 12px;
}

.new-message-item > svg {
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ============= NEW MESSAGE BUTTON IN CHANNEL LIST ============= */
.dm-new-message-btn {
  color: var(--text-dim) !important;
  font-size: 13px;
}

.dm-new-message-btn:hover {
  color: var(--text) !important;
}

.unified-picker-tabs {
  background: var(--surface-light);
  border-radius: calc(var(--border-radius, 12px) - 13px);
  display: flex;
  flex: 1;
  gap: 4px;
  margin-bottom: 8px;
  padding: 4px;
  transition: border-radius 0.2s ease;
}

.unified-picker-header {
  gap: 8px;
  padding: 12px 0 0 0;
  position: relative;
  z-index: 1;
}

.unified-picker-header,
.unified-picker-close {
  align-items: center;
  display: flex;
  margin-bottom: 8px;
}

.unified-picker-close {
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
  justify-content: center;
  padding: 6px;
  transition: all 0.2s ease;
}

.unified-picker-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.unified-picker-close svg {
  height: 18px;
  width: 18px;
}

.unified-tab {
  align-items: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  gap: 6px;
  justify-content: center;
  padding: 10px 16px;
  transition: all 0.2s ease;
}

.unified-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.unified-tab.active {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  color: var(--text);
}

.unified-tab svg {
  height: 16px;
  width: 16px;
}

.gif-tabs {
  border-bottom: 1px solid var(--border);
  padding: 8px 12px 0 12px;
}

.gif-tab {
  border-radius: 6px 6px 0 0;
  font-size: 13px;
}

.close-members {
  align-items: center;
  background: none;
  border: none;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  padding: 8px;
  transition: all 0.2s ease;
}

.close-members:hover {
  background: var(--surface-hover);
  color: var(--text);
}

@media (max-width: 768px) {
  .right-panel {
    display: none;
  }

  .right-panel.open {
    display: flex;
    background: var(--surface);
    bottom: 0;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 102;
  }

  .dm-profile-panel {
    display: none;
  }

  .dm-profile-panel.open {
    display: block;
  }

  .right-panel-close {
    display: flex;
  }

  /* Channel list offset to the right of guild sidebar when both open */
  .channels.open {
    left: 56px;
    width: calc(100% - 56px);
  }

  /* ── Channel list: slides in from the left, sits on top of everything ── */
  .channels {
    bottom: 0;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.5);
    left: 0;
    position: fixed;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    width: calc(100% - 56px);
    z-index: 102;
  }

  .channels.open {
    transform: translateX(0);
  }

  /* ── Overlay ── */
  .overlay {
    background: rgba(0, 0, 0, 0.75);
    bottom: 0;
    display: none;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 101;
  }

  .overlay.active {
    display: block;
  }

  /* ── Layout helpers ── */
  .main-content-wrapper {
    flex: 1;
    min-width: 0;
  }

  .main-content-area {
    flex-direction: column;
  }

  .main-content-area > .messages-container {
    border-radius: 0;
    margin: 0;
  }

  /* inline right panel inside flow (overridden above to be fixed) */
  .main-content-area > .members-list {
    border-left: none;
    border-top: 1px solid var(--border);
    min-width: 0;
  }
}

.messages-container {
  background-color: var(--layer-panel-bg);
  /* border-radius: 50px; */
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  position: relative;
  margin: var(--space-4) !important;
}

.main-content-area > .messages-container {
  border-radius: 20px;
  margin: 0;
}

.scroll-to-bottom-btn {
  align-items: center;
  background: var(--surface-light);
  border: none;
  border-radius: 50%;
  bottom: 90px;
  box-shadow: var(--shadow-1);
  color: var(--text);
  cursor: pointer;
  display: flex;
  height: 40px;
  justify-content: center;
  position: absolute;
  right: 16px;
  transition: all var(--anim-fast) var(--ease-standard);
  width: 40px;
  z-index: 10;
}

.scroll-to-bottom-btn:hover {
  background: var(--primary);
  transform: scale(1.05);
}

.scroll-to-bottom-btn svg {
  height: 20px;
  width: 20px;
}

.messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0;
  overflow-y: scroll;
  overscroll-behavior-y: contain;
  padding: 0;
  position: relative;
}

.messages::before {
  content: "";
  min-height: 0;
}

.message {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.avatar {
  border: 2px solid var(--border);
  border-radius: var(--avatar-radius, 50%);
  height: 36px;
  width: 36px;
}

.avatar,
.avatar-small {
  background: var(--surface-light);
  flex-shrink: 0;
  transition: border-radius 0.2s ease;
}

.avatar-small {
  border: 1px solid var(--border);
  border-radius: var(--avatar-radius, 50%);
  height: 8px;
  width: 8px;
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-header {
  gap: 8px;
  margin-bottom: 4px;
}

.username.clickable,
.avatar.clickable {
  cursor: pointer;
}

.username.clickable:hover {
  text-decoration: underline;
}

.edited-indicator {
  color: var(--text-dim);
  font-size: var(--font-xs);
  font-style: italic;
  opacity: 0.5;
  transition: opacity var(--anim-fast) var(--ease-out);
}

.edited-indicator:empty {
  display: none;
}

.edited-indicator:hover {
  opacity: 0.8;
}

.pinned-indicator {
  align-items: center;
  display: inline-flex;
  margin-left: 6px;
  opacity: 0.6;
}

.pinned-indicator:hover {
  opacity: 1;
}

.pinned-indicator svg {
  color: var(--accent, #7289da);
  height: 14px;
  width: 14px;
}

.message-text {
  display: inline;
  font-size: var(--message-font-size, 15px);
  line-height: 1.5;
  word-wrap: break-word;
  color: var(--text, #ededed);
  margin-left: 0;
  max-width: 100%;
  padding: 2px 0;
  user-select: text;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: text;
}

.message-text p {
  margin: 0 0 8px 0;
}

.message-text p:last-child {
  margin-bottom: 0;
}

.message-text ul,
.message-text ol {
  margin: 8px 0;
  padding-left: 20px;
}

.message-text li {
  margin: 4px 0;
}

.message-text blockquote {
  background: rgba(155, 135, 245, 0.1);
  border-left: 4px solid var(--primary);
  border-radius: 0 8px 8px 0;
  margin: 8px 0;
  padding: 8px 12px;
}

.message-text code {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 0.9em;
  padding: 2px 6px;
}

.message-text pre {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  margin: 8px 0;
  overflow-x: auto;
  padding: 12px;
}

.message-text pre code {
  background: transparent;
  padding: 0;
}

.message-group:hover,
.message-single:hover {
  cursor: default;
}

.message-group:hover .messageActionButtons,
.message-single:hover .messageActionButtons {
  opacity: 1;
}

.message-text a {
  color: var(--link, #00a8fc);
  text-decoration: none;
}

.message-text a:hover {
  text-decoration: underline;
}

blockquote {
  background: color-mix(
    in srgb,
    var(--link, #00a8fc) 5%,
    transparent
  ) !important;
  border-left-color: var(--link, #00a8fc) !important;
  cursor: pointer;
  display: block;
  margin-top: 8px;
  max-height: 400px;
  max-width: 100%;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-radius 0.2s ease;
}

.inline-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.inline-images .message-image {
  margin-top: 0;
  max-height: 300px;
}

.message-image:hover {
  box-shadow: 0 0 12px rgba(155, 135, 245, 0.3);
}

.spoiler {
  background: var(--border);
  border-radius: 4px;
  color: transparent;
  cursor: pointer;
  padding: 0 4px;
  transition:
    background var(--anim-fast) var(--ease-standard),
    color var(--anim-fast) var(--ease-standard);
  user-select: none;
}

.spoiler:hover {
  background: var(--primary);
}

.spoiler.revealed {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.channel-mention {
  background: rgba(88, 101, 242, 0.15);
  border-radius: 4px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  padding: 2px 6px;
  transition: all 0.15s ease;
}

.channel-mention:hover {
  background: rgba(88, 101, 242, 0.25);
  text-decoration: underline;
}

.mention.me {
  animation: mentionGlow 2s ease-in-out infinite;
  background: color-mix(in srgb, var(--danger, #ed4245) 15%, transparent);
  color: var(--danger, #ed4245);
}

@keyframes mentionGlow {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(239, 68, 68, 0);
  }

  50% {
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
  }
}

a {
  color: var(--primary);
  text-decoration: none;
}

.input-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  padding-bottom: max(5px, env(safe-area-inset-bottom));
  position: relative;
}

.pending-images-container {
  background: var(--bg-secondary);
  border-radius: 24px;
  display: flex;
  flex-direction: row;
  gap: 8px;
  max-height: 120px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px;
}

.pending-images-container::-webkit-scrollbar {
  height: 6px;
}

.pending-images-container::-webkit-scrollbar-track {
  background: var(--surface);
  border-radius: 3px;
}

.pending-images-container::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}

.pending-image-wrapper {
  background: var(--surface-light);
  border: 3px solid var(--border);
  border-radius: 15px;
  flex-shrink: 0;
  height: 80px;
  overflow: hidden;
  position: relative;
  width: 80px;
}

.pending-image-preview {
  cursor: pointer;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.pending-image-remove {
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  height: 20px;
  justify-content: center;
  opacity: 0;
  position: absolute;
  right: 4px;
  top: 4px;
  transition: opacity 0.15s ease;
  width: 20px;
}

.pending-image-wrapper:hover .pending-image-remove {
  opacity: 1;
}

.pending-image-remove:hover {
  background: var(--danger);
}

.pending-image-remove svg {
  color: #fff;
  height: 12px;
  width: 12px;
}

.pending-attachments-container {
  background: var(--bg-secondary);
  border-radius: 24px;
  display: flex;
  flex-direction: row;
  gap: 8px;
  max-height: 120px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px;
}

.pending-attachments-container::-webkit-scrollbar {
  height: 6px;
}

.pending-attachments-container::-webkit-scrollbar-track {
  background: var(--surface);
  border-radius: 3px;
}

.pending-attachments-container::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}

.pending-attachment-wrapper {
  background: var(--surface-light);
  border: 3px solid var(--border);
  border-radius: 15px;
  flex-shrink: 0;
  height: 80px;
  overflow: hidden;
  position: relative;
  width: 80px;
}

.pending-attachment-preview {
  cursor: pointer;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.pending-attachment-loading {
  align-items: center;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  width: 100%;
  position: relative;
}

.upload-progress-ring {
  width: 48px;
  height: 48px;
  transform: rotate(-90deg);
}

.upload-progress-bg {
  stroke: var(--border);
}

.upload-progress-fill {
  stroke: var(--primary);
  stroke-linecap: round;
  transition: stroke-dasharray 0.2s ease;
}

.upload-progress-text {
  position: absolute;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.pending-attachment-loading .spinner {
  animation: spin 1s linear infinite;
  border: 3px solid var(--border);
  border-radius: 50%;
  border-top-color: var(--primary);
  height: 24px;
  width: 24px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.pending-attachment-file {
  align-items: center;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  padding: 8px;
  width: 100%;
}

.pending-attachment-name {
  color: var(--text-secondary);
  font-size: 10px;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
  text-align: center;
}

.pending-attachment-expiry {
  background: rgba(0, 0, 0, 0.8);
  border-radius: 4px;
  bottom: 4px;
  color: var(--warning, #f59e0b);
  font-size: 9px;
  left: 50%;
  padding: 2px 6px;
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

.pending-attachment-remove {
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  height: 20px;
  justify-content: center;
  opacity: 0;
  position: absolute;
  right: 4px;
  top: 4px;
  transition: opacity 0.15s ease;
  width: 20px;
}

.pending-attachment-wrapper:hover .pending-attachment-remove {
  opacity: 1;
}

.pending-attachment-remove:hover {
  background: var(--danger);
}

.pending-attachment-remove svg {
  color: #fff;
  height: 12px;
  width: 12px;
}

.message-attachments {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  max-width: 400px;
}

.message-attachments.no-margin {
  margin-top: 0;
}

.message-attachments-images {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-attachments-images.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.message-attachments-images.no-bg {
  gap: 4px;
}

.message-attachment {
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-light);
  border: 1px solid var(--border);
}

.message-attachment.no-bg {
  background: transparent;
  border: none;
  border-radius: 8px;
}

.message-attachment-image {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  cursor: pointer;
  border-radius: 8px;
  display: block;
}

.message-attachment-image.expanded {
  max-height: none;
}

.message-attachment-image.grid-item {
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-height: none;
  aspect-ratio: 1;
}

.message-attachment-expiry {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: var(--warning, #f59e0b);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
}

.message-attachment-expiry-inline {
  color: var(--warning, #f59e0b);
  font-weight: 500;
}

.message-attachment-video {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  display: block;
}

.audio-player {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
}

.audio-player-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.audio-player-play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark, var(--primary)) 100%
  );
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.audio-player-play-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.audio-player-play-btn:active {
  transform: scale(0.95);
}

.audio-player-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.audio-player-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-player-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.audio-player-size {
  font-size: 12px;
  color: var(--text-dim);
}

.audio-player-dot {
  opacity: 0.5;
  color: var(--text-dim);
}

.audio-player-time {
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.audio-player-download {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition:
    background 0.15s ease,
    color 0.15s ease;
  flex-shrink: 0;
}

.audio-player-download:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.audio-player-progress {
  height: 24px;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 6px 0;
}

.audio-player-progress-bg {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}

.audio-player-progress-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--primary) 0%,
    var(--primary-light, var(--primary)) 100%
  );
  border-radius: 3px;
  transition: width 0.05s linear;
}

.audio-player-progress-handle {
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.15s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.audio-player-progress:hover .audio-player-progress-handle {
  opacity: 1;
}

.message-attachment-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s ease;
  border-radius: 8px;
}

.message-attachment-file:hover {
  background: var(--surface);
}

.message-attachment-file-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}

.message-attachment-file-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.message-attachment-file-name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-attachment-file-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.message-attachment-file-type {
  font-weight: 500;
  color: var(--text-secondary);
}

.message-attachment-file-dot {
  opacity: 0.5;
}

.message-attachment-file-size {
  font-size: 12px;
  color: var(--text-secondary);
}

.message-attachment-file-download {
  opacity: 0.5;
  transition: opacity 0.15s ease;
  color: var(--text-secondary);
}

.message-attachment-file:hover .message-attachment-file-download {
  opacity: 1;
}

.drag-drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  pointer-events: none;
}

.drag-drop-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text);
  background: var(--surface);
  padding: 32px 48px;
  border-radius: 16px;
  border: 2px dashed var(--primary);
}

.drag-drop-content span {
  font-size: 16px;
  font-weight: 500;
}

.reply-bar {
  align-items: center;
  background: var(--surface-light);
  border-radius: var(--radius-pill);
  box-sizing: border-box;
  display: none;
  font-size: 14px;
  gap: 10px;
  justify-content: space-between;
  overflow: hidden;
  padding: 7px 8px 7px 12px;
  position: relative;
  transition:
    background var(--anim-fast) var(--ease-out),
    border-color var(--anim-fast) var(--ease-out);
  margin-left: var(--space-3);
  margin-right: var(--space-3);
}

.reply-bar.active {
  align-items: center;
  display: flex;
  flex-direction: row;
}

.reply-bar:hover {
  background: var(--surface-hover);
}

/* Reply mode */
.reply-bar:not(.editing-mode) {
  border-left-color: var(--mention);
}

.reply-bar:not(.editing-mode):hover {
  border-left-color: color-mix(in srgb, var(--mention) 80%, transparent);
}

/* Edit mode */
.reply-bar.editing-mode {
  background: rgba(59, 165, 92, 0.07);
  border-left-color: var(--success);
}

.reply-bar.editing-mode:hover {
  background: rgba(59, 165, 92, 0.11);
}

.reply-bar-icon {
  align-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  display: flex;
  flex-shrink: 0;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.reply-bar:not(.editing-mode) .reply-bar-icon {
  color: var(--mention);
}

.reply-bar.editing-mode .reply-bar-icon {
  color: var(--success);
}

.reply-bar-body {
  display: flex;
  flex-direction: row;
  flex: 1;
  gap: 10px;
  min-width: 0;
  align-items: center;
}

.reply-bar-label {
  color: var(--text-dim);
  font-size: var(--font-sm);
  font-weight: 600;
  letter-spacing: 0.3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-bar:not(.editing-mode) .reply-bar-label {
  color: var(--mention);
}

.reply-bar.editing-mode .reply-bar-label {
  color: var(--success);
}

.reply-bar-preview {
  color: var(--text-dim);
  font-size: var(--font-sm);
  line-height: 1.35;
  max-width: 100%;
  opacity: 0.75;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-bar-ping {
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  flex-shrink: 0;
  opacity: 0.5;
  padding: 4px;
  transition:
    color var(--anim-fast) var(--ease-out),
    opacity var(--anim-fast) var(--ease-out),
    background var(--anim-fast) var(--ease-out);
}

.reply-bar-ping:hover {
  background: var(--interactive-hover-bg);
  color: var(--text);
  opacity: 1;
}

.reply-bar-ping.active {
  color: var(--mention);
  opacity: 1;
}

.reply-bar-ping.active:hover {
  background: rgba(155, 135, 245, 0.1);
  color: var(--mention);
}

.reply-bar-close {
  align-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  justify-content: center;
  opacity: 0.5;
  padding: 4px;
  transition:
    color var(--anim-fast) var(--ease-out),
    opacity var(--anim-fast) var(--ease-out),
    background var(--anim-fast) var(--ease-out);
}

.reply-bar-close:hover {
  background: var(--interactive-hover-bg);
  color: var(--text);
  opacity: 1;
}

.reply-bar-close svg {
  height: 14px;
  width: 14px;
}

/* Legacy close-reply alias */
.close-reply {
  align-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  justify-content: center;
  opacity: 0.5;
  padding: 4px;
  transition:
    color var(--anim-fast) var(--ease-out),
    opacity var(--anim-fast) var(--ease-out),
    background var(--anim-fast) var(--ease-out);
}

.close-reply:hover {
  background: var(--interactive-hover-bg);
  color: var(--text);
  opacity: 1;
}

.close-reply svg {
  height: 14px;
  width: 14px;
}

.input-wrapper {
  position: relative;
  align-items: center;
  background: var(--surface-light);
  border: 1px solid transparent;
  border-radius: var(--radius-df);
  display: flex;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  transition:
    background-color var(--anim-normal) var(--ease-standard),
    border-color var(--anim-normal) var(--ease-standard),
    box-shadow var(--anim-normal) var(--ease-standard);
  width: 100%;
}

.input-wrapper:focus-within {
  background: var(--surface-hover);
  box-shadow: 0 0 0 2px rgba(78, 80, 88, 0.1);
}

#message-input {
  background: transparent;
  border: none;
  color: var(--text);
  flex: 1;
  font-family: inherit;
  font-size: var(--font-lg);
  line-height: 1.4;
  max-height: 200px;
  overflow-y: auto;
  padding: var(--space-2);
  resize: none;
}

#message-input::placeholder {
  color: var(--text-dim);
}

#message-input:focus {
  outline: none;
}

#message-input.disabled-input {
  color: var(--text-dim);
  cursor: not-allowed;
}

#message-input.disabled-input::placeholder {
  color: var(--text-dim);
  opacity: 0.6;
}

.input-toolbar-right {
  gap: var(--space-1);
}

.input-toolbar-right,
#upload-btn {
  align-items: center;
  display: flex;
}

#upload-btn {
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  height: var(--size-icon-lg);
  justify-content: center;
  padding: var(--space-1);
  transition:
    background-color var(--anim-fast) var(--ease-standard),
    color var(--anim-fast) var(--ease-standard),
    transform var(--anim-fast) var(--ease-standard);
  width: var(--size-icon-lg);
}

#upload-btn svg {
  height: var(--size-icon-md);
  width: var(--size-icon-md);
}

#upload-btn:hover {
  background-color: var(--interactive-hover-bg);
  color: var(--text);
  transform: scale(1.05);
}

#upload-btn:active {
  transform: scale(0.95);
}

#upload-dropdown {
  min-width: 180px;
}

#upload-dropdown .context-menu-item {
  cursor: pointer;
}

.gift-modal {
  align-items: center;
  justify-content: center;
}

.gift-modal-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-height: 90vh;
  max-width: 480px;
  overflow-y: auto;
  position: relative;
  width: 90%;
}

.gift-modal-header {
  border-bottom: 1px solid var(--border);
  padding: 24px 24px 20px;
}

.gift-modal-header h2 {
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.gift-modal-header p {
  color: var(--text-dim);
  font-size: 14px;
}

.gift-modal-content {
  padding: 24px;
}

.gift-form-group {
  margin-bottom: 20px;
}

.gift-form-group label {
  color: var(--text);
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.gift-form-group input,
.gift-form-group textarea {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 16px;
  padding: 12px 16px;
  transition: border-color var(--anim-fast) var(--ease-standard);
  width: 100%;
}

.gift-form-group input:focus,
.gift-form-group textarea:focus {
  border-color: var(--accent, #9b87f5);
  outline: none;
}

.gift-form-group textarea {
  font-family: inherit;
  min-height: 60px;
  resize: vertical;
}

.char-count {
  color: var(--text-dim);
  display: block;
  font-size: 12px;
  margin-top: 4px;
  text-align: right;
}

.gift-expiry-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.expiry-option {
  align-items: center;
  background: var(--surface-light);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex: 1;
  font-size: 14px;
  gap: 6px;
  justify-content: center;
  min-width: 80px;
  padding: 10px 16px;
  transition: all var(--anim-fast) var(--ease-standard);
}

.expiry-option:hover {
  border-color: var(--interactive-hover-bg);
}

.expiry-option input[type="radio"] {
  display: none;
}

.expiry-option.selected {
  background: rgba(155, 135, 245, 0.1);
  border-color: var(--accent, #9b87f5);
}

.gift-summary {
  background: var(--surface-light);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  padding: 16px;
}

.summary-row {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  font-size: 15px;
  justify-content: space-between;
  padding: 8px 0;
}

.summary-row.total {
  border-top: 1px solid var(--border);
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  margin-top: 8px;
  padding-top: 12px;
}

.gift-embed {
  max-width: 400px !important;
}

.gift-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  padding: 20px;
  position: relative;
}

.gift-card::before {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(155, 135, 245, 0.3),
    transparent
  );
  content: "";
  height: 1px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.gift-error {
  background: var(--surface-light);
  border-color: var(--danger);
}

.gift-card-header {
  gap: 12px;
  /* margin-bottom: 16px; */
}

.gift-card-header,
.gift-icon {
  align-items: center;
  display: flex;
}

.gift-icon {
  background: linear-gradient(
    135deg,
    rgba(155, 135, 245, 0.3) 0%,
    rgba(61, 165, 92, 0.3) 100%
  );
  border-radius: 12px;
  color: var(--text);
  height: 48px;
  justify-content: center;
  width: 48px;
}

.gift-card-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
}

.gift-card-body {
  margin-bottom: 16px;
}

.gift-amount {
  color: var(--text);
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
  margin-top: 10px;
}

.gift-note {
  font-size: 14px;
  font-style: italic;
  margin-bottom: 8px;
}

.gift-note,
.gift-expiry {
  color: var(--text-dim);
}

.gift-expiry {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  display: inline-block;
  font-size: 13px;
  padding: 6px 12px;
}

.gift-claim-btn {
  background: var(--accent, #9b87f5);
  border: none;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  padding: 14px;
  transition: all var(--anim-fast) var(--ease-standard);
  width: 100%;
}

.gift-claim-btn:hover:not(:disabled) {
  background: rgba(155, 135, 245, 0.8);
  transform: translateY(-1px);
}

.gift-claim-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.gift-status {
  align-items: center;
  border-radius: 12px;
  display: flex;
  font-size: 15px;
  font-weight: 600;
  gap: 8px;
  justify-content: center;
  padding: 14px;
}

.gift-status.claimed {
  background: var(--success);
  color: #fff;
}

.gift-status.cancelled {
  background: var(--danger);
  color: #fff;
}

.gift-status.expired {
  background: var(--warning);
  color: #000000;
}

.gift-modal .modal-close-btn {
  height: 32px;
  right: 12px;
  top: 12px;
  width: 32px;
}

/* Plus button dropdown */
.plus-btn-wrapper {
  position: relative;
}

.plus-dropdown {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  bottom: calc(100% + 8px);
  box-shadow: var(--shadow-2);
  left: 0;
  min-width: 190px;
  overflow: hidden;
  position: absolute;
  z-index: 200;
}

.plus-dropdown-item {
  align-items: center;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-size: 14px;
  gap: 10px;
  padding: 9px 14px;
  transition: background var(--anim-fast) var(--ease-standard);
}

.plus-dropdown-item:hover {
  background: var(--interactive-hover-bg);
}

.plus-dropdown-item svg {
  flex-shrink: 0;
}

/* Gift modal (Preact) */
.modal {
  animation: scaleIn var(--anim-normal) var(--ease-standard);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  max-height: 90vh;
  max-width: 480px;
  overflow-y: auto;
  width: 90%;
}

.modal-header {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  padding: 18px 20px;
}

.modal-title {
  align-items: center;
  color: var(--text);
  display: flex;
  font-size: 16px;
  font-weight: 700;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 20px;
}

.form-input {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 14px;
  outline: none;
  padding: 9px 12px;
  transition: border-color var(--anim-fast) var(--ease-standard);
  width: 100%;
}

.form-input:focus {
  border-color: var(--accent, #9b87f5);
}

.form-error {
  border-radius: var(--radius-sm);
  color: var(--danger, #ed4245);
  font-size: 13px;
  margin-top: 8px;
}

.gift-expiry-radio {
  align-items: center;
  background: var(--surface-light);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-size: 13px;
  gap: 6px;
  padding: 7px 12px;
  transition: all var(--anim-fast) var(--ease-standard);
}

.gift-expiry-radio:has(input:checked) {
  background: rgba(155, 135, 245, 0.1);
  border-color: var(--accent, #9b87f5);
}

.gift-expiry-radio input[type="radio"] {
  accent-color: var(--accent, #9b87f5);
}

.gift-summary {
  background: var(--surface-light);
  border-radius: var(--radius-md);
  margin-top: 16px;
  padding: 14px 16px;
}

.gift-summary-row {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  font-size: 14px;
  justify-content: space-between;
  padding: 4px 0;
}

.gift-summary-row.gift-summary-total {
  border-top: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  margin-top: 6px;
  padding-top: 8px;
}

.modal-overlay {
  align-items: center;
  backdrop-filter: blur(8px);
  background: var(--overlay-bg);
  bottom: 0;
  display: none;
  justify-content: center;
  left: 0;
  opacity: 0;
  position: fixed;
  right: 0;
  top: 0;
  transition: opacity var(--anim-normal) var(--ease-standard);
  z-index: var(--z-modal-backdrop);
}

.modal-overlay.active {
  display: flex !important;
  opacity: 1;
}

/* ---- Compact dialog (confirm / prompt) ---- */
.dialog {
  animation: scaleIn var(--anim-normal) var(--ease-standard);
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
  width: 100%;
}

.dialog-sm {
  max-width: 360px;
}

.dialog-md {
  max-width: 480px;
}

.dialog-lg {
  max-width: 600px;
}

.dialog-xl {
  max-width: 720px;
}

.dialog-header {
  align-items: center;
  display: flex;
  gap: var(--space-2);
  justify-content: space-between;
}

.dialog-title {
  color: var(--text);
  font-size: var(--font-xl);
  font-weight: 600;
}

.dialog-close {
  color: var(--text-dim);
  flex-shrink: 0;
  margin-left: auto;
}

.dialog-message {
  color: var(--text-dim);
  font-size: var(--font-md);
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

.dialog .input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--font-md);
  outline: none;
  padding: var(--space-2) var(--space-3);
  transition: border-color var(--anim-fast) var(--ease-standard);
  width: 100%;
}

.dialog .input:focus {
  border-color: var(--primary);
}

@media (max-width: 768px) {
  .dialog {
    border-radius: var(--radius-md);
    margin: 0 var(--space-4);
    padding: var(--space-4);
  }
}

.modal-close-btn {
  align-items: center;
  background: var(--surface-light);
  border: 2px solid var(--border);
  border-radius: 50%;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  height: 40px;
  justify-content: center;
  margin: 0;
  position: relative;
  right: 0;
  top: 0;
  transition:
    all 0.2s ease,
    border-radius 0.2s ease;
  width: 40px;
}

.modal-close-btn:hover {
  background: var(--surface-hover);
  border-color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  color: var(--text);
  transform: rotate(90deg) scale(1.1);
}

.modal-close-btn svg {
  height: 22px;
  transition: transform 0.2s ease;
  width: 22px;
}

.modal-close-btn:hover svg {
  transform: rotate(90deg);
}

.form-actions {
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 16px;
}

.server-list-item {
  align-items: center;
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 16px;
  transition: all 0.2s ease;
}

.server-list-item:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
}

.server-list-info {
  flex: 1;
}

.server-list-name {
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.server-list-url {
  color: var(--text-dim);
  font-family: "Consolas", "Monaco", monospace;
  font-size: 13px;
}

.server-list-actions,
.server-list-toggle {
  display: flex;
  gap: 8px;
}

.server-list-toggle {
  align-items: center;
}

.toggle-switch {
  background: var(--surface-hover);
  border-radius: 12px;
  cursor: pointer;
  height: 24px;
  position: relative;
  transition: background 0.2s ease;
  width: 44px;
}

.toggle-switch.active {
  background: var(--success);
}

.toggle-switch::after {
  background: #fff;
  border-radius: 50%;
  content: "";
  height: 20px;
  left: 2px;
  position: absolute;
  top: 2px;
  transition: transform 0.2s ease;
  width: 20px;
}

.toggle-switch.active::after {
  transform: translateX(20px);
}

.toggle-switch.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Ensure the label wrapper itself uses a pointer cursor */
.appearance-toggle-row {
  cursor: pointer;
}

.header-row {
  align-items: center;
  display: flex;
  gap: 12px;
}

.param-row {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.param-row input {
  flex: 1;
}

.param-row .btn-small {
  flex-shrink: 0;
  padding: 8px;
}

.input-wrapper.rate-limited {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
  user-select: none;
}

.input-wrapper.rate-limited::before {
  background: rgba(23, 11, 11, 0.3);
  border-radius: 12px;
  bottom: 0;
  content: "";
  left: 0;
  pointer-events: auto;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 100;
}

.input-wrapper.rate-limited #message-input {
  cursor: not-allowed;
}

.input-wrapper.rate-limited button,
.input-wrapper.rate-limited .icon-btn,
.input-wrapper.rate-limited .send-btn {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.3;
}

.input-wrapper.rate-limited .rate-limit-message {
  align-items: center;
  background: rgba(23, 11, 11, 0.9);
  border: 1px solid var(--danger);
  border-radius: 8px;
  color: var(--danger);
  display: flex;
  font-size: 14px;
  font-weight: 500;
  gap: 8px;
  left: 50%;
  padding: 12px 20px;
  pointer-events: auto;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  z-index: 101;
}

.input-wrapper.rate-limited .rate-limit-message svg {
  animation: pulse 2s ease-in-out infinite;
  height: 18px;
  width: 18px;
}

#gif-btn {
  color: var(--text-dim);
  transition: color 0.2s ease;
}

#gif-btn,
.send-btn {
  border-radius: 50%;
  cursor: pointer;
  height: 36px;
  width: 36px;
}

.send-btn {
  align-items: center;
  background: none;
  border: none;
  color: white;
  display: flex;
  flex-shrink: 0;
  justify-content: center;
  /* transition: all 0.2s; */
  padding: 0;
}

.send-btn svg {
  height: 18px;
  transform: translateXY(-2px, -2px);
  width: 18px;
}

.send-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.send-btn:active {
  transform: scale(0.95);
}

.loading {
  align-items: center;
  display: flex;
  justify-content: center;
  padding: 20px;
}

.spinner {
  animation: spin 1s linear infinite;
  border: 3px solid var(--surface-light);
  border-radius: 50%;
  border-top-color: var(--primary);
  height: 30px;
  width: 30px;
}

.error {
  padding: 10px;
  text-align: center;
}

.error,
.server-error {
  color: var(--ping);
}

.server-disconnected .guild-icon {
  outline: 2px solid var(--danger);
  outline-offset: -2px;
}

.server-connecting .guild-icon {
  outline: 2px solid var(--warning, #faa61a);
  outline-offset: -2px;
}

.server-connecting .guild-icon::after {
  animation: spin 0.8s linear infinite;
  border: 2px solid transparent;
  border-radius: 50%;
  border-top-color: var(--warning, #faa61a);
  content: "";
  inset: 4px;
  position: absolute;
}

.error-banner {
  align-items: center;
  background: linear-gradient(135deg, var(--danger, #ed4245) 0%, #c03537 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(237, 66, 69, 0.25);
  color: #fff;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 16px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Warning variant */
.error-banner--warning {
  background: linear-gradient(135deg, #faa61a 0%, #d4870e 100%);
  box-shadow: 0 4px 12px rgba(250, 166, 26, 0.3);
}

/* Info / success variant */
.error-banner--info {
  background: linear-gradient(135deg, #43b581 0%, #2d8049 100%);
  box-shadow: 0 4px 12px rgba(67, 181, 129, 0.3);
}

/* Stack container — sits at the top of the messages column */
.error-banner-stack {
  flex-shrink: 0;
  width: 100%;
  z-index: 10;
}

.error-banner-action {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.error-banner-action:hover {
  background: rgba(255, 255, 255, 0.32);
}

.error-banner.active {
  transform: translateY(0);
}

.error-banner span {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.error-close {
  align-items: center;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  height: 28px;
  justify-content: center;
  transition: all 0.2s ease;
  width: 28px;
}

.error-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.error-close:active {
  transform: scale(0.95);
}

::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--surface);
}

::-webkit-scrollbar-thumb {
  background: var(--surface-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--surface-hover);
}

.message-group {
  align-items: flex-start;
  border-radius: var(--radius-md);
  display: flex;
  padding: var(--space-1) var(--space-0) var(--space-1) var(--space-2);
  position: relative;
  z-index: var(--z-base);
  margin: var(--space-2);
}

.message-group.has-reply {
  flex-direction: column;
}

.message-group-body {
  align-items: flex-start;
  display: flex;
  min-height: 0;
  width: 100%;
}

.message-group:hover,
.message-single:hover {
  background-color: var(--interactive-hover-bg);
}

.message-group::before {
  border-radius: var(--radius-df);
  content: "";
  height: 100%;
  left: -8px;
  position: absolute;
  top: 0;
  width: calc(100% + 28px);
  z-index: -1;
}

.message-group .avatar {
  border-radius: var(--avatar-radius);
  cursor: pointer;
  flex-shrink: 0;
  height: var(--size-avatar-lg);
  margin-right: var(--space-3);
  margin-top: var(--space-1);
  transition: transform var(--anim-normal) var(--ease-standard);
  width: var(--size-avatar-lg);
}

.message-group .avatar:hover {
  transform: scale(1.05);
}

.message-group-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  overflow: visible;
  width: 100%;
}

.message-header {
  align-items: baseline;
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
  margin-top: var(--space-1);
}

.username {
  color: var(--text);
  cursor: pointer;
  font-size: var(--font-lg);
  font-weight: 600;
  transition: color var(--anim-fast) var(--ease-standard);
}

.message-header .username:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.timestamp {
  color: var(--text-dim);
  cursor: default;
  font-size: var(--font-base);
  font-weight: 400;
  transition: color var(--anim-fast) var(--ease-standard);
}

.message-group:hover .timestamp {
  color: var(--text);
}

.timestamp:hover {
  text-decoration: underline;
}

.webhook-badge {
  align-items: center;
  background: var(--primary-12);
  border-radius: 3px;
  color: var(--text-dim);
  display: inline-flex;
  font-size: 10px;
  font-weight: 600;
  gap: 4px;
  height: 18px;
  margin-left: 6px;
  padding: 0 6px;
  text-transform: uppercase;
  vertical-align: middle;
}

.webhook-badge svg {
  flex-shrink: 0;
}

.webhook-badge-text {
  letter-spacing: 0.02em;
}

.message-embed {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
  max-width: min(520px, 100%);
  padding: 12px 16px;
  position: relative;
}

.message-embed.has-thumbnail {
  flex-direction: row;
}

.message-embed.square-thumbnail {
  flex-direction: row;
}

.embed-thumbnail {
  border-radius: 4px;
  flex-shrink: 0;
  height: auto;
  max-height: 120px;
  max-width: 120px;
  object-fit: cover;
  width: auto;
}

.embed-thumbnail--right {
  margin-left: 12px;
}

.embed-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.embed-author {
  align-items: center;
  display: flex;
  gap: 8px;
}

.embed-author-icon {
  border-radius: 50%;
  height: 24px;
  width: 24px;
}

.embed-author-name {
  color: var(--link);
  font-size: var(--font-sm);
  font-weight: 500;
  text-decoration: none;
}

.embed-author-name:hover {
  text-decoration: underline;
}

.embed-title {
  color: var(--text);
  font-size: var(--font-lg);
  font-weight: 600;
  line-height: 1.3;
}

.embed-title a {
  color: var(--link);
  text-decoration: none;
}

.embed-title a:hover {
  text-decoration: underline;
}

.embed-description {
  color: var(--text-dim);
  font-size: var(--font-md);
  line-height: 1.5;
}

.embed-description a {
  color: var(--link);
}

.embed-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

.embed-field {
  flex: 1 1 100%;
  min-width: 150px;
}

.embed-field.inline {
  flex: 1 1 auto;
  min-width: 100px;
}

.embed-field-name {
  color: var(--text);
  font-size: var(--font-md);
  font-weight: 600;
  margin-bottom: 4px;
}

.embed-field-value {
  color: var(--text-dim);
  font-size: var(--font-sm);
  line-height: 1.4;
}

.embed-field-value a {
  color: var(--link);
}

.embed-image {
  border-radius: 4px;
  margin-top: 4px;
  max-height: 400px;
  max-width: 100%;
  object-fit: contain;
}

.embed-footer {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  font-size: var(--font-xs);
  gap: 8px;
  margin-top: 8px;
}

.embed-footer-icon {
  border-radius: 50%;
  height: 16px;
  width: 16px;
}

.embed-footer-text {
  font-size: var(--font-xs);
}

.embed-footer-separator {
  color: var(--text-dim);
  opacity: 0.5;
}

.embed-footer-timestamp {
  font-size: var(--font-xs);
}

.timestamp-tooltip {
  background: var(--surface);
  border-radius: var(--radius-sm);
  bottom: 100%;
  box-shadow: var(--shadow-2);
  color: white;
  font-size: var(--font-sm);
  left: 50%;
  margin-bottom: var(--space-1);
  opacity: 0;
  padding: var(--space-1) var(--space-2);
  pointer-events: none;
  position: absolute;
  transform: translateX(-50%);
  transition: opacity var(--anim-fast) var(--ease-standard);
  white-space: nowrap;
  z-index: var(--z-tooltip);
}

.timestamp:hover .timestamp-tooltip {
  opacity: 1;
}

.message-single {
  align-items: flex-start;
  border-radius: var(--radius-df);
  display: flex;
  padding-left: 60px;
  position: relative;
  z-index: var(--z-base);
  margin: var(--space-2);
}

.message-single::before {
  border-radius: var(--radius-df);
  content: "";
  height: 100%;
  left: -60px;
  position: absolute;
  top: 0;
  width: calc(100% + 80px);
  z-index: -1;
}

.message-single .hover-timestamp {
  color: transparent;
  font-size: var(--font-xs);
  max-width: 120px;
  overflow: hidden;
  padding-right: var(--space-2);
  pointer-events: none;
  position: absolute;
  text-overflow: ellipsis;
  top: var(--space-1);
  transform: translateX(-100%);
  white-space: nowrap;
}

.message-single:hover > .message-group-content > .hover-timestamp {
  color: var(--text-dim);
}

.message-single:hover::before {
  background: rgba(255, 255, 255, 0.02);
}

#chat-container {
  background: var(--bg, #050505);
  display: grid;
  grid-template-columns: 1fr 240px;
  /* main chat + sidebar */
  height: 100%;
}

#messages-container {
  overflow-y: auto;
  padding: 16px;
}

.channels {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: var(--space-2);
}

@media (min-width: 769px) {
  .channels {
    position: relative;
    width: 340px;
  }
}

.channels-list {
  flex: 1;
  overflow-y: auto;
}

.user-menu {
  animation: slideUp 0.2s ease;
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  bottom: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  display: none;
  left: 0;
  margin-bottom: 8px;
  position: absolute;
  right: 0;
  z-index: 1000;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-menu.active {
  display: block;
}

.user-menu-item {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-size: 14px;
  gap: 10px;
  padding: 12px;
  transition: background 0.2s ease;
}

.user-menu-item:first-child {
  border-radius: 8px 8px 0 0;
}

.user-menu-item:last-child {
  border-radius: 0 0 8px 8px;
}

.user-menu-item:hover {
  background: var(--surface-hover);
}

.user-menu-item.danger {
  color: var(--ping);
}

.user-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.ping-badge {
  background: var(--danger, #ed4245);
  border-radius: var(--radius-pill);
  color: #fff;
  font-size: var(--font-xs);
  font-weight: 600;
  line-height: 1;
  margin-left: auto;
  min-width: 20px;
  padding: var(--space-1) var(--space-2);
  text-align: center;
}

.unread-indicator {
  background: #fff;
  border-radius: 50%;
  flex-shrink: 0;
  height: 6px;
  margin-left: auto;
  width: 6px;
}

.message-text.mentioned {
  background: color-mix(in srgb, var(--mention, #9b87f5) 10%, transparent);
  border-left: 3px solid var(--mention, #9b87f5);
  margin-left: calc(-1 * var(--space-2));
  padding-left: var(--space-2);
}

.message-reply {
  align-items: center;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  gap: 6px;
  overflow: hidden;
  padding: 2px 17px 4px 17px;
  position: relative;
  width: 100%;
}

.message-reply:hover {
  background: var(--interactive-hover-bg);
}

.message-reply.reply-not-found {
  opacity: 0.5;
}

.message-reply svg {
  color: var(--text-dim);
  flex-shrink: 0;
  opacity: 0.5;
  width: 16px;
}

.message-reply .avatar-small {
  background: var(--surface);
  border: none;
  border-radius: 50%;
  flex-shrink: 0;
  height: 18px !important;
  margin: 0 !important;
  opacity: 0.85;
  width: 18px !important;
}

.message-reply .reply-text {
  align-items: baseline;
  color: var(--text-dim);
  display: flex;
  flex: 1;
  font-size: var(--font-sm);
  gap: 5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-reply .reply-username {
  flex-shrink: 0;
  font-size: var(--font-sm);
  font-weight: 600;
  /* color overridden inline per user */
}

.message-reply .reply-content {
  color: var(--text-dim);
  font-size: var(--font-sm);
  opacity: 0.8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.interaction-command {
  background: var(--surface-2, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-sm, 4px);
  color: var(--text);
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
}

/* ─── Swipe-to-reply / swipe-to-edit ──────────────────────────────────────── */

.swipe-wrapper {
  position: relative;
  touch-action: pan-y;
  user-select: none;
  width: 100%;
}

.swipe-inner {
  will-change: transform;
  /* No CSS transition — spring physics handled in JS */
}

/* Icon that appears on the side being swiped */
.swipe-action-icon {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
  transform: scale(0.4);
  /* Instant update to follow JS values */
  transition: none;
  width: 52px;
  z-index: 0;
}

.swipe-action-icon--left {
  left: 4px;
}

.swipe-action-icon--right {
  right: 4px;
}

.swipe-action-icon-bg {
  border-radius: 50%;
  height: 36px;
  inset: 50% auto auto 50%;
  opacity: 0.18;
  position: absolute;
  transform: translate(-50%, -50%);
  width: 36px;
}

.swipe-action-icon svg {
  color: var(--text);
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.5));
  position: relative;
  z-index: 1;
}

/* When the threshold has been crossed — icon bounces */
.swipe-triggered .swipe-action-icon {
  animation: swipe-icon-pop 0.22s var(--ease-standard) forwards;
}

@keyframes swipe-icon-pop {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.35);
  }

  70% {
    transform: scale(0.9);
  }

  100% {
    transform: scale(1);
  }
}

.context-menu {
  animation: fadeScaleIn var(--anim-fast) var(--ease-out);
  backdrop-filter: blur(8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  display: none;
  min-width: 200px;
  padding: var(--space-1);
  position: fixed;
  z-index: var(--z-context-menu);

  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.emoji {
  height: var(--size-icon-md);
  vertical-align: middle;
  width: var(--size-icon-md);
}

.context-menu-item {
  align-items: center;
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-size: var(--font-md);
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  transition:
    background-color var(--anim-fast) var(--ease-standard),
    color var(--anim-fast) var(--ease-standard);
  user-select: none;
}

.context-menu-item:hover {
  background-color: var(--interactive-hover-bg);
}

.context-menu-item.danger {
  color: var(--danger);
}

.context-menu-item.danger:hover {
  background-color: rgba(237, 66, 69, 0.15);
}

.context-menu-item.danger:hover svg {
  color: var(--danger);
}

.context-menu-item svg {
  color: var(--text-dim);
  flex-shrink: 0;
  height: var(--size-icon-xs);
  transition: color var(--anim-fast) var(--ease-standard);
  width: var(--size-icon-xs);
}

.context-menu-item:hover svg {
  color: var(--text);
}

.context-menu-separator {
  background: var(--border);
  height: 1px;
  margin: var(--space-1) 0;
}

/* ============= Input Autocomplete ============= */

.input-autocomplete {
  animation: fadeScaleIn var(--anim-fast) var(--ease-out);
  backdrop-filter: blur(8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  bottom: calc(100% + 6px);
  box-shadow: var(--shadow-3);
  left: 0;
  max-height: 380px;
  max-width: 420px;
  min-width: 260px;
  overflow-y: auto;
  padding: var(--space-1);
  position: absolute;
  right: 0;
  transform-origin: bottom center;
  z-index: var(--z-popover);
  margin-left: 10px;
}

/* Slash variant: flex row with sidebar + scrollable body */
.input-autocomplete--slash {
  display: flex;
  flex-direction: row;
  overflow: hidden;
  padding: 0;
  max-height: 440px;
  max-width: 500px;
  min-width: 320px;
}

.autocomplete-header {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: var(--space-2) var(--space-3) var(--space-1);
  text-transform: uppercase;
  user-select: none;
}

.autocomplete-list {
  display: flex;
  flex-direction: column;
}

.autocomplete-item {
  align-items: center;
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-size: var(--font-md);
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  transition:
    background-color var(--anim-fast) var(--ease-standard),
    color var(--anim-fast) var(--ease-standard);
  user-select: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background-color: var(--interactive-hover-bg);
}

.autocomplete-avatar {
  border-radius: 50%;
  flex-shrink: 0;
  height: 22px;
  object-fit: cover;
  width: 22px;
}

.autocomplete-emoji-icon {
  flex-shrink: 0;
  height: 22px;
  object-fit: contain;
  pointer-events: none;
  width: 22px;
}

.autocomplete-icon-hash {
  color: var(--text-dim);
  flex-shrink: 0;
  font-size: var(--font-md);
  font-weight: 700;
  text-align: center;
  transition: color var(--anim-fast) var(--ease-standard);
  width: 22px;
}

.autocomplete-role-dot {
  border-radius: 50%;
  flex-shrink: 0;
  height: 12px;
  margin: 0 5px;
  width: 12px;
}

.autocomplete-item:hover .autocomplete-icon-hash,
.autocomplete-item.selected .autocomplete-icon-hash {
  color: var(--text);
}

.autocomplete-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Slash command autocomplete extras ─────────────────────────────────────── */

.autocomplete-icon-slash {
  color: var(--primary);
  flex-shrink: 0;
  font-size: var(--font-md);
  font-weight: 700;
  text-align: center;
  transition: color var(--anim-fast) var(--ease-standard);
  width: 22px;
}

.autocomplete-item:hover .autocomplete-icon-slash,
.autocomplete-item.selected .autocomplete-icon-slash {
  color: var(--text);
}

.autocomplete-description {
  color: var(--text-dim);
  font-size: 11px;
  flex-shrink: 0;
  margin-left: auto;
  overflow: hidden;
  padding-left: var(--space-2);
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

/* ── Slash autocomplete: Discord-style sidebar ─────────────────────────────── */

/* Left sidebar column */
.autocomplete-slash-sidebar {
  align-items: center;
  background: var(--surface-light);
  border-right: 1px solid var(--border);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: var(--space-1);
  overflow-y: auto;
  padding: var(--space-2) var(--space-1);
  scrollbar-width: none;
  width: 48px;
}

.autocomplete-slash-sidebar::-webkit-scrollbar {
  display: none;
}

/* Individual pfp button in sidebar */
.autocomplete-slash-sidebar-btn {
  background: none;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition:
    border-color var(--anim-fast) var(--ease-standard),
    border-radius var(--anim-fast) var(--ease-standard);
}

.autocomplete-slash-sidebar-btn:hover {
  border-color: var(--primary);
  border-radius: var(--radius-md);
}

.autocomplete-slash-sidebar-btn.active {
  border-color: var(--primary);
  border-radius: var(--radius-md);
}

.autocomplete-slash-sidebar-avatar {
  border-radius: inherit;
  display: block;
  height: 32px;
  object-fit: cover;
  width: 32px;
}

/* Right body: scrollable command list */
.autocomplete-slash-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.autocomplete-slash-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-1);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Group: one per registeredBy user */
.autocomplete-slash-group {
  margin-bottom: var(--space-1);
}

/* Group header row: avatar + username */
.autocomplete-slash-group-header {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  font-size: 11px;
  font-weight: 700;
  gap: var(--space-2);
  letter-spacing: 0.06em;
  padding: var(--space-2) var(--space-3) var(--space-1);
  text-transform: uppercase;
  user-select: none;
}

.autocomplete-slash-group-avatar {
  border-radius: 50%;
  flex-shrink: 0;
  height: 16px;
  object-fit: cover;
  width: 16px;
}

.autocomplete-slash-group-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Slash command input (replaces .input-wrapper when active) ─────────────── */

.slash-cmd-input-wrapper {
  align-items: center;
  background: var(--surface-light);
  border: 1px solid var(--primary);
  border-radius: var(--radius-pill);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent);
  display: flex;
  gap: var(--space-2);
  min-height: 44px;
  overflow: hidden;
  padding: var(--space-1) var(--space-2);
  width: 100%;
}

/* The uneditable "/commandname" pill on the left */
.slash-cmd-badge {
  align-items: center;
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  border-radius: var(--radius-pill);
  color: var(--text);
  display: flex;
  flex-shrink: 0;
  font-size: var(--font-md);
  font-weight: 600;
  gap: 1px;
  padding: 2px var(--space-2) 2px var(--space-2);
  user-select: none;
  white-space: nowrap;
}

.slash-cmd-slash {
  color: var(--primary);
  font-weight: 700;
}

.slash-cmd-name {
  color: var(--text);
}

/* Scrollable row of argument fields */
.slash-cmd-args {
  align-items: center;
  display: flex;
  flex: 1;
  gap: var(--space-2);
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.slash-cmd-args::-webkit-scrollbar {
  display: none;
}

/* Individual arg field */
.slash-cmd-arg {
  align-items: center;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-shrink: 0;
  gap: 0;
  overflow: hidden;
}

.slash-cmd-arg-label {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border-right: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px var(--space-2);
  text-transform: uppercase;
  user-select: none;
  white-space: nowrap;
}

.slash-cmd-arg-input,
.slash-cmd-arg-select {
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: var(--font-md);
  min-width: 80px;
  outline: none;
  padding: 4px var(--space-2);
}

.slash-cmd-arg-select {
  cursor: pointer;
}

.slash-cmd-arg-input::placeholder {
  color: var(--text-dim);
}

/* "Press Enter to run" hint for arg-less commands */
.slash-cmd-no-args {
  color: var(--text-dim);
  flex: 1;
  font-size: var(--font-md);
  font-style: italic;
  padding: 0 var(--space-2);
  user-select: none;
}

/* Dismiss (X) button */
.slash-cmd-dismiss {
  flex-shrink: 0;
}

.typing {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  margin-left: 52px;
  margin-bottom: 5px;
  min-height: 20px;
  pointer-events: none;
  position: relative;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  z-index: 1;
  align-items: center;
  display: flex;
  gap: 5px;
}

.typing-avatars {
  display: flex;
  flex-shrink: 0;
  gap: -4px;
}

.typing-avatar {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--avatar-radius, 50%);
  flex-shrink: 0;
  height: 16px;
  margin-left: -4px;
  transition: border-radius 0.2s ease;
  width: 16px;
}

.typing-avatars .typing-avatar:first-child {
  margin-left: 0;
}

.typing-name {
  font-weight: 700;
}

.home-content {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-7) var(--space-5);
  text-align: center;
}

.home-heading-icon {
  height: 64px;
  margin-bottom: var(--space-3);
  opacity: 0.5;
  width: 64px;
}

.home-heading-title {
  color: var(--text);
  font-size: 28px;
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.home-heading-subtitle {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: var(--space-6);
}

.home-options-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 600px;
  width: 100%;
}

.home-option-card {
  align-items: flex-start;
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  min-height: 120px;
  padding: var(--space-4);
  text-align: left;
  transition:
    background-color var(--anim-fast) var(--ease-standard),
    border-color var(--anim-fast) var(--ease-standard),
    transform var(--anim-fast) var(--ease-standard),
    box-shadow var(--anim-fast) var(--ease-standard);
}

.home-option-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-1);
  transform: translateY(-2px);
}

.home-option-icon {
  align-items: center;
  display: flex;
  height: 40px;
  justify-content: center;
  margin-bottom: var(--space-3);
  width: 40px;
}

.home-option-icon i {
  color: var(--text);
  height: 20px;
  width: 20px;
}

.home-option-title {
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.home-option-description {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0;
}

.empty-channel-message {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  height: 100%;
  justify-content: center;
  padding: var(--space-6) var(--space-4);
  text-align: center;
}

.empty-channel-icon {
  font-size: 48px;
  margin-bottom: var(--space-3);
  opacity: 0.3;
}

.empty-channel-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.empty-channel-text {
  font-size: 14px;
}

.mention {
  background: color-mix(in srgb, var(--mention, #9b87f5) 10%, transparent);
  border-radius: 6px;
  color: var(--mention, #9b87f5);
  cursor: pointer;
  font-weight: 600;
  padding: 2px 6px;
}

.mention:hover {
  background: color-mix(in srgb, var(--mention, #9b87f5) 20%, transparent);
}

.role-mention {
  background: color-mix(in srgb, var(--mention, #9b87f5) 10%, transparent);
  border-radius: 6px;
  color: var(--mention, #9b87f5);
  cursor: default;
  font-weight: 600;
  padding: 2px 6px;
}

.role-mention:hover {
  background: color-mix(in srgb, var(--mention, #9b87f5) 20%, transparent);
}

.embed-container {
  margin-bottom: 8px;
  margin-top: 8px;
  position: static;
  z-index: auto;
}

.embed-container,
.youtube-embed {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: block;
  max-width: min(520px, 100%);
  overflow: hidden;
  width: 100%;
}

.youtube-embed {
  position: relative;
  z-index: 1;
}

.youtube-thumbnail {
  background-position: center;
  background-size: cover;
  cursor: pointer;
  display: block;
  height: 0;
  padding-bottom: 56.25%;
  position: relative;
  transition: filter 0.2s ease;
  width: 100%;
}

.youtube-thumbnail:hover {
  filter: brightness(1.1);
}

.embed-play-button {
  left: 50%;
  opacity: 0.9;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  z-index: 10;
}

.youtube-thumbnail:hover .embed-play-button {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

.youtube-iframe {
  display: block;
  height: 0;
  padding-bottom: 56.25%;
  position: relative;
  width: 100%;
}

.youtube-iframe iframe {
  border: none;
  display: block;
  height: 100%;
  left: 0;
  position: absolute !important;
  top: 0;
  width: 100%;
  z-index: auto !important;
}

.youtube-title {
  background: var(--surface-light);
  border-top: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  padding: 10px 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-embed {
  background: var(--bg, #050505);
}

.video-player {
  display: block;
  max-height: 400px;
  width: 100%;
}

.image-embed {
  background: transparent;
  border: none;
}

.image-embed .message-image {
  border-radius: 8px;
  cursor: pointer;
  display: block;
  max-height: 400px;
  max-width: 100%;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.image-embed .message-image:hover {
  box-shadow: 0 0 12px rgba(155, 135, 245, 0.3);
}

.tenor-embed {
  background: transparent;
  border: none;
}

.tenor-gif {
  border-radius: 8px;
  cursor: pointer;
  display: block;
  max-height: 350px;
  max-width: 100%;
}

@media (max-width: 768px) {
  .embed-container,
  .youtube-embed {
    border-radius: 12px;
    display: block;
    margin-top: 8px;
    max-width: 100%;
  }

  .youtube-thumbnail {
    border-radius: 12px 12px 0 0;
    display: block;
  }

  .video-player {
    max-height: 250px;
  }

  .image-embed .message-image {
    max-height: 300px;
  }

  .tenor-gif {
    max-height: 250px;
  }
}

/* GitHub Embed Styles */
.gh-embed {
  background: var(--surface-light);
  border-left: 4px solid var(--border);
  border-radius: 6px;
  color: inherit;
  display: block;
  max-width: 480px;
  padding: 14px 16px;
  text-decoration: none;
}

.gh-embed--commit {
  border-left-color: var(--border);
}

.gh-embed__header {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.gh-embed__avatar {
  border-radius: 50%;
  flex-shrink: 0;
  height: 28px;
  object-fit: cover;
  width: 28px;
}

.gh-embed__title {
  align-items: baseline;
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  font-size: 15px;
  font-weight: 600;
  gap: 2px;
  min-width: 0;
}

.gh-embed__owner {
  color: var(--text-dim);
  font-weight: 400;
}

.gh-embed__owner--sub {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 400;
  margin-left: 4px;
}

.gh-embed__sep {
  color: var(--text-dim);
}

.gh-embed__repo {
  color: var(--text);
}

.gh-embed__sha {
  background: var(--surface);
  border-radius: 3px;
  color: var(--text-dim);
  font-family: monospace;
  font-size: 12px;
  padding: 1px 5px;
}

.gh-embed__badge {
  background: var(--link);
  border-radius: 3px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
  padding: 2px 7px;
}

.gh-embed__badge--muted {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.gh-embed__desc {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gh-embed__desc--message {
  color: var(--text);
  font-style: italic;
  white-space: normal;
}

.gh-embed__meta {
  align-items: center;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding-top: 10px;
}

.gh-embed__stat {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  font-size: 13px;
  gap: 4px;
}

.gh-embed__stat svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.gh-embed__stat--diff {
  gap: 6px;
  margin-left: auto;
}

.gh-embed__additions {
  color: #3fb950;
  font-weight: 600;
}

.gh-embed__deletions {
  color: #f85149;
  font-weight: 600;
}

.gh-embed__lang {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  font-size: 13px;
  gap: 5px;
}

.gh-embed__topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.gh-embed__topic {
  background: color-mix(in srgb, var(--link) 15%, transparent);
  border-radius: 20px;
  color: var(--link);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
}

.gh-embed__stat--pushed {
  margin-left: auto;
}

.gh-embed__lang-dot {
  background: var(--text-dim);
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  height: 10px;
  width: 10px;
}

/* Common language colors */
.gh-embed__lang-dot[data-lang="JavaScript"] {
  background: #f1e05a;
}

.gh-embed__lang-dot[data-lang="TypeScript"] {
  background: #3178c6;
}

.gh-embed__lang-dot[data-lang="Python"] {
  background: #3572a5;
}

.gh-embed__lang-dot[data-lang="Rust"] {
  background: #dea584;
}

.gh-embed__lang-dot[data-lang="Go"] {
  background: #00add8;
}

.gh-embed__lang-dot[data-lang="Java"] {
  background: #b07219;
}

.gh-embed__lang-dot[data-lang="C"] {
  background: #555555;
}

.gh-embed__lang-dot[data-lang="C++"] {
  background: #f34b7d;
}

.gh-embed__lang-dot[data-lang="C#"] {
  background: #178600;
}

.gh-embed__lang-dot[data-lang="PHP"] {
  background: #4f5d95;
}

.gh-embed__lang-dot[data-lang="Ruby"] {
  background: #701516;
}

.gh-embed__lang-dot[data-lang="Swift"] {
  background: #f05138;
}

.gh-embed__lang-dot[data-lang="Kotlin"] {
  background: #a97bff;
}

.gh-embed__lang-dot[data-lang="Dart"] {
  background: #00b4ab;
}

.gh-embed__lang-dot[data-lang="Shell"] {
  background: #89e051;
}

.gh-embed__lang-dot[data-lang="HTML"] {
  background: #e34c26;
}

.gh-embed__lang-dot[data-lang="CSS"] {
  background: #563d7c;
}

.gh-embed__lang-dot[data-lang="Vue"] {
  background: #41b883;
}

.gh-embed__lang-dot[data-lang="Svelte"] {
  background: #ff3e00;
}

.gh-embed__deletions {
  color: #f85149;
}

.gh-embed--pr .gh-embed__badge--open {
  background: rgba(63, 185, 80, 0.15);
  color: #3fb550;
}

.gh-embed--pr .gh-embed__badge--merged {
  background: rgba(163, 113, 247, 0.15);
  color: #a371f7;
}

.gh-embed--pr .gh-embed__badge--closed {
  background: rgba(248, 81, 73, 0.15);
  color: #f85149;
}

.gh-embed--pr .gh-embed__badge--draft {
  background: rgba(110, 118, 129, 0.15);
  color: #8b949e;
}

.gh-embed__body {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
  margin: 4px 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile styles for GitHub embeds */
@media (max-width: 768px) {
  .gh-embed {
    padding: 10px 14px;
  }

  .voice-name {
    font-size: 13px;
  }
}

/* ===== Wikipedia embed ===== */
.wiki-embed {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-left: 4px solid #bbb;
  border-radius: 8px;
  color: var(--text);
  display: block;
  max-width: min(520px, 100%);
  overflow: hidden;
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.wiki-embed:hover {
  border-left-color: #aaa;
}

.wiki-embed__body {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  padding: 12px 14px;
}

.wiki-embed__text {
  flex: 1;
  min-width: 0;
}

.wiki-embed__header {
  align-items: center;
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.wiki-embed__logo {
  align-items: center;
  background: var(--text);
  border-radius: 50%;
  color: var(--surface-light);
  display: flex;
  font-size: 10px;
  font-weight: 700;
  height: 18px;
  justify-content: center;
  width: 18px;
}

.wiki-embed__source {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.wiki-embed__title {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.wiki-embed__description {
  color: var(--text-dim);
  font-size: 12px;
  font-style: italic;
  margin-bottom: 6px;
}

.wiki-embed__extract {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  color: var(--text-muted, var(--text-dim));
  display: -webkit-box;
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  overflow: hidden;
}

.wiki-embed__thumb {
  border-radius: 4px;
  flex-shrink: 0;
  height: 70px;
  object-fit: cover;
  width: 100px;
}

@media (max-width: 480px) {
  .wiki-embed__thumb {
    display: none;
  }
}

/* ===== Spotify embed ===== */
.spotify-embed {
  border-radius: 12px;
  max-width: min(520px, 100%);
  overflow: hidden;
}

.spotify-embed iframe {
  display: block;
}

/* ===== Steam embed ===== */
.steam-embed {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  display: block;
  max-width: min(460px, 100%);
  overflow: hidden;
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.steam-embed:hover {
  border-color: #4a90d9;
}

.steam-embed__header {
  display: block;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  width: 100%;
}

.steam-embed__body {
  padding: 10px 12px 12px;
}

.steam-embed__meta {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.steam-embed__badge {
  background: rgba(100, 160, 220, 0.2);
  border-radius: 4px;
  color: #7bb8e8;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  text-transform: uppercase;
}

.steam-embed__price {
  color: #7bb8e8;
  font-size: 13px;
  font-weight: 600;
  margin-left: auto;
}

.steam-embed__name {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.steam-embed__desc {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--text-dim);
  display: -webkit-box;
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  overflow: hidden;
}

/* ===== MistWarp embed ===== */
.mistwarp-embed {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-left: 4px solid #9c6fe0;
  border-radius: 8px;
  color: var(--text);
  display: block;
  max-width: min(480px, 100%);
  overflow: hidden;
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    filter 0.15s ease;
}

.mistwarp-embed:hover {
  filter: brightness(1.07);
}

.mistwarp-embed__top {
  display: flex;
  gap: 0;
  min-height: 105px;
}

.mistwarp-embed__thumb {
  display: block;
  flex-shrink: 0;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.mistwarp-embed__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 10px 12px 10px;
}

.mistwarp-embed__header {
  align-items: center;
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.mistwarp-embed__source {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.mistwarp-embed__modified {
  color: var(--text-dim);
  font-size: 11px;
  margin-left: auto;
}

.mistwarp-embed__title {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mistwarp-embed__author {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  font-size: 12px;
  gap: 5px;
  margin-bottom: 5px;
}

.mistwarp-embed__avatar {
  border-radius: 50%;
  flex-shrink: 0;
  height: 16px;
  width: 16px;
}

.mistwarp-embed__desc {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  color: var(--text-dim);
  display: -webkit-box;
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  overflow: hidden;
}

.mistwarp-embed__stats {
  align-items: center;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 14px;
  padding: 7px 12px;
}

.mistwarp-embed__stat {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  font-size: 12px;
  gap: 4px;
}

.mistwarp-embed__stat svg {
  flex-shrink: 0;
}

/* Discord-style Voice Channel User List */
.voice-channel-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.voice-user-count {
  background-color: rgba(79, 84, 92, 0.6);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
  padding: 1px 6px;
}

.voice-channel-user-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
  padding-left: 28px;
}

.voice-channel-user {
  align-items: center;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  padding: 6px 8px;
  transition: background-color 0.1s ease;
}

.voice-channel-user:hover {
  background-color: var(--surface-hover);
}

.voice-channel-user-avatar {
  align-items: center;
  background: linear-gradient(
    135deg,
    var(--primary, #4e5058) 0%,
    var(--primary-hover, #586068) 100%
  );
  border-radius: 50%;
  color: white;
  display: flex;
  font-size: 10px;
  font-weight: 600;
  height: 24px;
  justify-content: center;
  min-width: 24px;
  overflow: hidden;
  text-transform: uppercase;
  width: 24px;
}

.voice-channel-user-avatar img {
  border-radius: 50%;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.voice-channel-username {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-channel-user:hover .voice-channel-username {
  color: var(--text);
}

/* Active voice channel indicator */
.voice-channel-wrapper .channel-item.active {
  background-color: rgba(255, 255, 255, 0.06);
}

.voice-channel-wrapper .channel-item.active .voice-user-count {
  background-color: var(--text);
  color: var(--surface);
}

/* Speaking animation for voice channel user */
.voice-channel-user.speaking .voice-channel-user-avatar {
  position: relative;
}

.voice-channel-user.speaking .voice-channel-user-avatar::before {
  animation: speaking-ring 1.5s ease-in-out infinite;
  background-color: rgba(59, 165, 92, 0.5);
  border-radius: 50%;
  content: "";
  inset: -3px;
  position: absolute;
  z-index: -1;
}

@keyframes speaking-ring {
  0% {
    opacity: 0.7;
    transform: scale(1);
  }

  50% {
    opacity: 0.3;
    transform: scale(1.1);
  }

  100% {
    opacity: 0.7;
    transform: scale(1);
  }
}

/* Muted state for voice channel user */
.voice-channel-user.muted .voice-channel-username {
  color: var(--text-dim);
  position: relative;
}

/* Muted icon overlay */
.voice-muted-icon {
  align-items: center;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  bottom: -4px;
  color: var(--text-dim);
  display: flex;
  height: 14px;
  justify-content: center;
  position: absolute;
  right: -4px;
  width: 14px;
  z-index: 1;
}

.voice-muted-icon svg {
  height: 10px;
  width: 10px;
}

/* Voice Panel (appears at bottom of channels when connected) */
.voice-panel {
  background: var(--surface-light);
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding: 12px;
  border-radius: 10px;
  margin: 8px;
}

.voice-panel.active {
  display: flex;
}

.voice-panel-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.voice-panel-status {
  align-items: center;
  color: var(--success, #3ba55c);
  display: flex;
  font-size: 13px;
  font-weight: 600;
  gap: 6px;
}

.voice-panel-channel {
  color: var(--text-dim);
  font-size: 12px;
  overflow: hidden;
  padding-left: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Voice Panel Controls */
.voice-panel-controls {
  display: flex;
  gap: 6px;
}

.voice-control-btn {
  align-items: center;
  background: var(--surface-light);
  border: none;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: center;
  padding: 8px;
  transition: all 0.15s ease;
}

.voice-control-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.voice-control-btn:active {
  transform: scale(0.95);
}

.voice-control-btn.active {
  background: var(--success);
  color: white;
}

.voice-control-btn.muted {
  background: var(--danger);
  color: white;
}

.voice-leave-btn {
  background: var(--surface-light);
  color: var(--text);
}

.voice-leave-btn:hover {
  background: rgba(237, 66, 69, 0.15);
  color: var(--danger);
}

@media (max-width: 768px) {
  .voice-panel-controls {
    gap: 8px;
  }

  .voice-control-btn {
    padding: 10px;
  }
}

.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
  margin-top: 6px;
}

.reaction {
  align-items: center;
  background: var(--surface-light);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  gap: 4px;
  padding: 6px 8px;
  position: relative;
  transition: all 0.15s ease;
  user-select: none;
}

.reaction:hover {
  background: var(--surface-hover);
}

.reaction.reacted {
  background: color-mix(in srgb, var(--primary, #4e5058) 20%, transparent);
}

.reaction-emoji {
  width: 20px;
  height: 20px;
  object-fit: contain;
  vertical-align: middle;
  flex-shrink: 0;
}

.reaction-emoji-container {
  overflow: scroll;
}

.reaction-count {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
}

.reaction.reacted .reaction-count {
  color: var(--primary);
}

.reaction-tooltip {
  background: var(--surface, #0a0a0c);
  border: 1px solid var(--border);
  border-radius: 10px;
  bottom: calc(100% + 8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  color: var(--text, #ededed);
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 6px;
  opacity: 0;
  padding: 8px 10px;
  pointer-events: none;
  transition: opacity 0.15s ease;
  white-space: nowrap;
  z-index: var(--z-tooltip, 10003);
}

.reaction-tooltip,
.reaction-tooltip::after {
  left: 50%;
  position: absolute;
  transform: translateX(-50%);
  max-width: 160px;
}

.reaction-tooltip::after {
  border: 6px solid transparent;
  border-top-color: var(--border);
  content: "";
  top: 100%;
}

.reaction:hover .reaction-tooltip {
  opacity: 1;
  pointer-events: auto;
}

.reaction-tooltip-avatars {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.reaction-tooltip-avatar {
  border-radius: 50%;
  height: 22px;
  object-fit: cover;
  width: 22px;
  flex-shrink: 0;
}

.reaction-tooltip-names {
  color: var(--text-dim);
  font-size: 11px;
  text-align: center;
}

/* ---- Reaction modal ---- */
.reaction-modal {
  animation: scaleIn var(--anim-normal) var(--ease-standard);
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  overflow: hidden;
  width: 300px;
}

.reaction-modal-header {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}

.reaction-modal-header-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.reaction-modal-subtitle {
  color: var(--text-dim);
  font-size: 12px;
}

.reaction-modal-empty {
  color: var(--text-dim);
  font-size: 13px;
  padding: var(--space-4);
  text-align: center;
}

.reaction-modal-emoji {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.reaction-modal-title {
  color: var(--text);
  flex: 1;
  font-size: var(--font-md);
  font-weight: 600;
}

.reaction-modal-close {
  color: var(--text-dim);
  flex-shrink: 0;
}

.reaction-modal-list {
  overflow-y: auto;
  padding: var(--space-2);
}

.reaction-modal-user {
  align-items: center;
  border-radius: var(--radius-md);
  display: flex;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  transition: background-color var(--anim-fast) var(--ease-standard);
}

.reaction-modal-user:hover {
  background: var(--interactive-hover-bg);
}

.reaction-modal-avatar {
  border-radius: 50%;
  flex-shrink: 0;
  height: var(--size-avatar-md);
  object-fit: cover;
  width: var(--size-avatar-md);
}

.reaction-modal-username {
  color: var(--text);
  font-size: var(--font-md);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .reaction-modal {
    margin: 0 var(--space-4);
    max-height: 60vh;
    width: 100%;
  }
}

.message-options {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.message-options .message-reactions {
  margin-top: 0;
}

.message-action-buttons .action-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.quick-reactions-wrapper {
  position: relative;
}

.quick-reactions-popup {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  display: flex;
  gap: 2px;
  padding: 4px;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 10;
  margin-top: 4px;
}

.quick-reaction-btn {
  align-items: center;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  font-size: 18px;
  height: 32px;
  justify-content: center;
  padding: 4px;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
  width: 32px;
}

.quick-reaction-btn:hover {
  background: var(--surface-hover);
  transform: scale(1.15);
}

.quick-reaction-more {
  align-items: center;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  height: 32px;
  justify-content: center;
  padding: 4px;
  transition:
    background 0.15s ease,
    color 0.15s ease;
  width: 32px;
}

.quick-reaction-more:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.message-group,
.message-single {
  position: relative;
  transition:
    transform 0.15s ease,
    background 0.15s ease;
}

.message-group:hover,
.message-single:hover {
  background: var(--surface-hover);
}

.message-group.swiping,
.message-single.swiping {
  transition: none;
}

.swipe-action {
  align-items: center;
  border-radius: var(--radius-md);
  display: flex;
  font-size: var(--font-xs);
  font-weight: 600;
  gap: 5px;
  opacity: 0;
  padding: 6px 10px;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition: opacity 0.12s var(--ease-out);
  white-space: nowrap;
}

.swipe-action-reply {
  background: var(--mention);
  box-shadow: 0 2px 8px rgba(155, 135, 245, 0.35);
  color: #fff;
  margin-right: 10px;
  right: 100%;
}

.swipe-action-edit {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text);
  left: 100%;
  margin-left: 10px;
}

.message-group.swipe-reveal-reply .swipe-action-reply,
.message-single.swipe-reveal-reply .swipe-action-reply,
.message-group.swipe-reveal-edit .swipe-action-edit,
.message-single.swipe-reveal-edit .swipe-action-edit {
  opacity: 1;
}

.gif-picker {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  bottom: 100%;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
  display: none;
  flex-direction: column;
  height: 450px;
  left: 10px;
  overflow: hidden;
  position: absolute;
  width: 360px;
  z-index: 1000;
}

.gif-picker.active {
  display: flex;
}

.gif-picker-header {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  padding: 12px 16px;
}

.gif-picker-header input {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  flex: 1;
  font-size: 14px;
  padding: 8px 12px;
}

.gif-picker-close {
  align-items: center;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  display: none;
  justify-content: center;
  margin-left: auto;
  padding: 6px;
  transition: all 0.2s ease;
}

.gif-picker-close:hover {
  background: var(--surface-light);
  color: var(--text);
}

.close-gif-picker {
  align-items: center;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
}

.gif-search-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px;
}

.gif-search-bar input {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  transition: all 0.2s ease;
  width: 100%;
}

.gif-search-bar input:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(78, 80, 88, 0.2);
  outline: none;
}

.gif-search-bar input::placeholder {
  color: var(--text-dim);
}

.gif-results {
  align-content: start;
  background: transparent;
  column-count: 2;
  column-gap: 12px;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px;
}

.gif-item-wrapper {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  break-inside: avoid;
  cursor: pointer;
  margin-bottom: 12px;
  overflow: hidden;
  position: relative;
  transition: all 0.2s ease;
  width: 100%;
}

.gif-item-wrapper:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.gif-result {
  background: var(--surface-light);
  border-radius: 8px;
  cursor: pointer;
  display: block;
  height: auto;
  min-height: 80px;
  object-fit: cover;
  width: 100%;
}

.gif-result:hover {
  opacity: 0.9;
}

.gif-loading,
.gif-error,
.gif-empty,
.gif-placeholder {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  font-size: 14px;
  gap: 12px;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  width: 100%;
}

.gif-loading::before {
  animation: spin 1s linear infinite;
  border: 3px solid var(--border);
  border-radius: 50%;
  border-top-color: var(--primary);
  content: "";
  height: 32px;
  width: 32px;
}

.gif-error {
  color: var(--danger);
}

.gif-empty,
.icon-btn {
  color: var(--text-dim);
}

.icon-btn {
  align-items: center;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  padding: 4px;
  transition:
    color 0.2s,
    background 0.2s;
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.section-owner h2 {
  color: #ffd700;
}

.section-owner .member .name {
  color: #ffd700;
  font-weight: 600;
}

.close-members {
  color: var(--text-dim);
  cursor: pointer;
  display: block;
}

.gif-tabs {
  align-items: center;
  display: flex;
  flex: 1;
  gap: 4px;
}

.gif-tab {
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  transition: all 0.2s ease;
}

.gif-tab:hover {
  background: var(--surface-light);
  color: var(--text);
}

.gif-tab.active {
  background: var(--surface);
  border-bottom: 2px solid var(--primary);
  color: var(--text);
  margin-bottom: -1px;
}

.chat-image-wrapper {
  display: inline-block;
  position: relative;
}

.chat-image-wrapper.image-loading {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.chat-fav-btn {
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  display: flex;
  justify-content: center;
  opacity: 0;
  padding: 4px;
  position: absolute;
  right: 5px;
  top: 5px;
  transition: all 0.2s;
  z-index: 10;
}

.chat-image-wrapper:hover .chat-fav-btn,
.chat-fav-btn.active {
  opacity: 1;
}

.chat-fav-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.chat-fav-btn.active svg {
  color: #ffd700;
  fill: #ffd700;
}

pre {
  overflow-x: auto !important;
  position: relative;
  z-index: 2;
}

.image-modal {
  align-items: center;
  background: rgba(0, 0, 0, 0.9);
  bottom: 0;
  cursor: zoom-out;
  display: none;
  justify-content: center;
  left: 0;
  opacity: 0;
  position: fixed;
  right: 0;
  top: 0;
  transition: opacity 0.2s ease;
  z-index: 20000;
}

.image-modal.active {
  display: flex;
  opacity: 1;
}

.image-modal-content {
  cursor: default;
  max-height: 90vh;
  max-width: 90vw;
  position: relative;
}

.image-modal-content img {
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  max-height: 90vh;
  max-width: 90vw;
  object-fit: contain;
}

.image-modal-buttons {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.image-modal .modal-close-btn {
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  height: 36px;
  justify-content: center;
  opacity: 0.7;
  padding: 8px;
  transition: all 0.2s;
  width: 36px;
  position: static;
}

.image-modal .modal-close-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  opacity: 1;
}

.image-modal .modal-close-btn svg {
  height: 18px;
  width: 18px;
}

.modal-fav-btn {
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  height: 36px;
  justify-content: center;
  opacity: 0.7;
  transition: all 0.2s;
  width: 36px;
  position: static;
}

.modal-fav-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  opacity: 1;
}

.modal-fav-btn.active svg {
  color: #ffd700;
  fill: #ffd700;
}

.image-modal-expiry {
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 18px;
  color: #ff6b6b;
  display: flex;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  white-space: nowrap;
}

.image-error {
  align-items: center;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  padding: 40px;
}

.image-error p {
  font-size: 14px;
  margin: 0;
}

@media (max-width: 768px) {
  .modal-close-btn {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    right: 10px;
    top: 10px;
  }
}

.older-messages-loader {
  align-items: center;
  display: flex;
  justify-content: center;
  padding: 12px 0;
}

.older-messages-loader .loading-throbber {
  height: 32px;
  width: 32px;
}

.older-messages-loader .loading-throbber::after {
  height: 24px;
  width: 24px;
}

.channel-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--background-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.channel-loading-overlay .loading-throbber {
  height: 48px;
  width: 48px;
}

.channel-loading-overlay .loading-throbber::after {
  height: 48px;
  width: 48px;
}

.loading-throbber {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: center;
  width: 100%;
}

.loading-throbber::after {
  animation: spin 0.8s linear infinite;
  border: 4px solid var(--surface-hover);
  border-radius: 50%;
  border-top-color: var(--primary);
  content: "";
  height: 40px;
  width: 40px;
}

/* Dimmed blocked messages */
.message-group.blocked-dimmed,
.message-single.blocked-dimmed {
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

.message-group.blocked-dimmed:hover,
.message-single.blocked-dimmed:hover {
  opacity: 0.5;
}

.blocked-dimmed .username,
.blocked-dimmed .message-text,
.blocked-dimmed .timestamp {
  color: var(--text-dim);
}

.guild-sidebar {
  /* background: #0a0a0c; */
  display: flex;
  flex-direction: column;
  min-width: 72px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px 0;
  width: 72px;
}

.guild-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 0 12px;
}

.guild-item {
  cursor: pointer;
  margin: 0 auto;
}

.guild-item,
.guild-icon {
  align-items: center;
  display: flex;
  height: var(--space-9);
  justify-content: center;
  position: relative;
  width: var(--space-9);
}

.guild-icon {
  background: var(--surface);
  border-radius: var(--radius-pill);
  outline: 2px solid transparent;
  outline-offset: -2px;
  overflow: hidden;
  transition:
    background-color var(--anim-normal) var(--ease-standard),
    border-radius var(--anim-normal) var(--ease-standard),
    outline-color var(--anim-normal) var(--ease-standard),
    transform var(--anim-normal) var(--ease-standard),
    box-shadow var(--anim-normal) var(--ease-standard);
}

.guild-icon img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.guild-icon svg {
  color: var(--primary);
  height: var(--size-icon-lg);
  transition: color var(--anim-normal) var(--ease-standard);
  width: var(--size-icon-lg);
}

.guild-pill {
  background: transparent;
  border-radius: var(--radius-pill);
  height: var(--space-2);
  left: -14px;
  opacity: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition:
    height var(--anim-normal) var(--ease-standard),
    background-color var(--anim-normal) var(--ease-standard),
    opacity var(--anim-normal) var(--ease-standard),
    box-shadow var(--anim-normal) var(--ease-standard),
    width var(--anim-normal) var(--ease-standard),
    border-radius var(--anim-normal) var(--ease-standard);
  width: 4px;
}

.guild-item.active .guild-pill {
  background: #fff;
  box-shadow: var(--shadow-sm);
  height: var(--space-8);
  opacity: 1;
}

.guild-item:hover .guild-pill {
  height: var(--space-4);
  opacity: 1;
}

.guild-pill.unread,
.guild-item:hover .guild-pill.unread,
.guild-item.active .guild-pill.unread {
  display: none;
}

.guild-unread-dot {
  background: #fff;
  z-index: 2;
}

.guild-unread-dot,
.guild-ping {
  border-radius: 50%;
  bottom: -2px;
  box-shadow: 0 0 0 3px var(--surface);
  height: 12px;
  position: absolute;
  right: -2px;
  width: 12px;
}

.guild-ping {
  background: var(--danger);
  z-index: 3;
}

.guild-ping-badge {
  align-items: center;
  background: var(--danger, #ed4245);
  border-radius: 10px;
  bottom: -4px;
  box-shadow: 0 0 0 3px var(--surface);
  color: #fff;
  display: flex;
  font-size: 11px;
  font-weight: 700;
  height: 18px;
  justify-content: center;
  min-width: 18px;
  padding: 0 4px;
  position: absolute;
  right: -6px;
  z-index: 3;
}

.dm-ping-badge {
  animation: dm-badge-in 0.2s var(--ease-standard) both;
  transform-origin: bottom right;
}

@keyframes dm-badge-in {
  from {
    opacity: 0;
    transform: scale(0.4);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.dm-ping-badge--fade-out {
  animation: dm-badge-out 0.35s var(--ease-standard) both;
  pointer-events: none;
}

@keyframes dm-badge-out {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(0.4);
  }
}

.guild-item:hover .guild-icon {
  background: var(--primary);
  border-radius: var(--radius-md);
}

.guild-item:hover .guild-icon svg {
  color: white;
}

.guild-item.active .guild-icon {
  background: var(--primary);
  border-radius: var(--radius-md);
}

.guild-item.active .guild-icon svg {
  color: white;
}

.guild-item.drag-over {
  position: relative;
}

.guild-item.drag-over::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: -1px;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}

.guild-divider {
  background: var(--primary);
  border-radius: var(--radius-sm);
  height: var(--space-1);
  margin: var(--space-2) auto;
  width: var(--space-6);
}

.home-guild .guild-icon {
  background: var(--surface-light);
}

.home-guild:hover .guild-icon,
.home-guild.active .guild-icon {
  background: var(--primary);
}

.home-guild.server-error .guild-icon {
  background: var(--surface);
  border: var(--space-1) solid var(--danger);
}

.home-guild.server-error .guild-warning {
  display: flex;
}

.home-guild.server-disconnected .guild-icon {
  outline: 2px solid var(--danger);
  outline-offset: -2px;
}

.home-guild.server-connecting .guild-icon {
  outline: 2px solid var(--warning, #faa61a);
  outline-offset: -2px;
}

.home-guild.server-connecting .guild-icon::after {
  animation: spin 0.8s linear infinite;
  border: 2px solid transparent;
  border-radius: 50%;
  border-top-color: var(--warning, #faa61a);
  content: "";
  inset: 4px;
  position: absolute;
}

.add-guild .guild-icon {
  background: var(--surface-light);
  border: 2px dashed var(--text-dim);
}

.add-guild .guild-icon svg {
  color: var(--success);
}

.add-guild:hover .guild-icon {
  background: color-mix(in srgb, var(--success) 15%, transparent);
  border-color: var(--success);
}

.add-guild:hover .guild-icon svg {
  color: var(--success);
}

.add-folder .guild-icon {
  background: var(--surface-light);
  border: 2px dashed var(--text-dim);
}

.add-folder .guild-icon svg {
  color: var(--primary);
}

.add-folder:hover .guild-icon {
  background: color-mix(in srgb, var(--primary) 15%, transparent);
  border-color: var(--primary);
}

.add-folder:hover .guild-icon svg {
  color: var(--primary);
}

.folder-item {
  position: relative;
}

.folder-icon {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: center;
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius-pill);
  transition:
    border-radius var(--anim-normal) var(--ease-standard),
    background-color var(--anim-normal) var(--ease-standard);
}

.folder-icon svg {
  color: var(--text);
}

.folder-item:hover .folder-icon {
  border-radius: var(--radius-md);
}

.folder-item.active .folder-icon {
  border-radius: var(--radius-md);
}

.folder-item.active .folder-icon svg {
  color: #fff;
}

.folder-servers {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 4px 0;
}

.folder-server {
  width: 36px;
  height: 36px;
  margin: 0 auto;
}

.folder-server .guild-icon {
  width: 36px;
  height: 36px;
}

.drag-over-folder .folder-icon {
  background: var(--primary);
  border-radius: var(--radius-md);
  box-shadow: 0 0 8px rgba(155, 135, 245, 0.5);
}

.user-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 12px 12px 12px;
}

.user-profile-icon {
  background: var(--surface);
  overflow: hidden;
  transition: border-radius 0.2s ease;
}

.user-profile-icon img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.guild-item::after {
  background: var(--surface, #0a0a0c);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  color: var(--text, #ededed);
  content: attr(title);
  font-size: 14px;
  left: calc(100% + 12px);
  opacity: 0;
  padding: 8px 12px;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition: opacity 0.15s;
  white-space: nowrap;
  z-index: 1000;
}

.guild-item:hover::after {
  opacity: 1;
}

.guild-item.error .guild-icon {
  background: var(--surface, #0a0a0c);
  border: 2px solid var(--danger, #ed4245);
}

.guild-item.error .guild-warning {
  display: flex;
}

.guild-item.server-disconnected .guild-icon {
  outline: 2px solid var(--danger);
  outline-offset: -2px;
}

.guild-item.server-connecting .guild-icon {
  outline: 2px solid var(--warning, #faa61a);
  outline-offset: -2px;
}

.guild-item.server-connecting .guild-icon::after {
  animation: spin 0.8s linear infinite;
  border: 2px solid transparent;
  border-radius: 50%;
  border-top-color: var(--warning, #faa61a);
  content: "";
  inset: 4px;
  position: absolute;
}

.discover-guild {
  cursor: pointer;
}

.discover-guild .guild-icon {
  background: var(--surface-light);
}

.discover-guild:hover .guild-icon {
  background: var(--primary);
}

.discover-guild:hover .guild-icon svg {
  color: white;
}

.discovery-modal {
  align-items: center;
  bottom: 0;
  display: none;
  justify-content: center;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 10000;
}

.discovery-modal.active {
  display: flex;
}

.discovery-overlay {
  background: var(--overlay-bg);
  bottom: 0;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.discovery-container {
  background: var(--surface, #0a0a0c);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  max-width: 800px;
  overflow: hidden;
  position: relative;
  width: 90%;
}

.discovery-close {
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 8px;
  position: absolute;
  right: 16px;
  top: 16px;
  transition: all 0.2s ease;
  z-index: 10;
}

.discovery-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.discovery-header {
  border-bottom: 1px solid var(--border);
  padding: 24px 24px 16px;
}

.discovery-header h2 {
  align-items: center;
  color: var(--text);
  display: flex;
  font-size: 24px;
  gap: 12px;
  margin: 0 0 8px;
}

.discovery-header p {
  color: var(--text-dim);
  margin: 0;
}

.discovery-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 24px;
}

.discovery-option-btn {
  align-items: center;
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  gap: 16px;
  padding: 16px;
  text-align: left;
  transition:
    background 0.15s,
    border-color 0.15s;
  width: 100%;
}

.discovery-option-btn:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
}

.discovery-option-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.discovery-option-desc {
  color: var(--text-dim);
  font-size: 13px;
}

.discovery-back {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  margin-bottom: 8px;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.discovery-back:hover {
  color: var(--text);
}

.discovery-error-text {
  color: var(--danger);
  font-size: 13px;
  margin-top: 6px;
}

.discovery-loading {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 20px;
}

.discovery-loading .loading-spinner {
  animation: spin 1s linear infinite;
  border: 3px solid var(--surface-light);
  border-radius: 50%;
  border-top-color: var(--primary);
  height: 40px;
  margin-bottom: 16px;
  width: 40px;
}

.discovery-loading p {
  margin: 0;
}

.discovery-error {
  align-items: center;
  display: none;
  flex-direction: column;
  padding: 60px 20px;
  text-align: center;
}

.discovery-error i {
  color: var(--ping);
  height: 48px;
  margin-bottom: 16px;
  width: 48px;
}

.discovery-error p {
  color: var(--text-dim);
  margin: 0 0 16px;
}

.discovery-empty {
  color: var(--text-dim);
  padding: 60px 20px;
  text-align: center;
}

.discovery-list {
  display: grid;
  gap: 12px;
}

.discovery-card {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  gap: 16px;
  padding: 16px;
  transition: border-color 0.2s ease;
}

.discovery-card:hover {
  border-color: var(--primary);
}

.discovery-icon {
  align-items: center;
  background: var(--surface-light);
  border-radius: 50%;
  display: flex;
  flex-shrink: 0;
  height: 64px;
  justify-content: center;
  overflow: hidden;
  width: 64px;
}

.discovery-icon img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.discovery-icon span {
  font-size: 24px;
  font-weight: 600;
}

.discovery-info {
  flex: 1;
  min-width: 0;
}

.discovery-info h3 {
  color: var(--text);
  font-size: 16px;
  margin: 0 0 8px;
}

.discovery-meta {
  color: var(--text-dim);
  display: flex;
  font-size: 13px;
  gap: 16px;
}

.discovery-meta span {
  align-items: center;
  display: flex;
  gap: 6px;
}

.discovery-meta i {
  height: 14px;
  width: 14px;
}

.discovery-actions {
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Discovery Page ───────────────────────────────────────── */

.discovery-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  min-height: 0;
}

.discovery-page-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  flex-shrink: 0;
  transition:
    color var(--anim-fast),
    background var(--anim-fast);
}

.discovery-page-back:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.discovery-page-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  flex-shrink: 0;
}

.discovery-page-hero-center {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.discovery-page-hero-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.discovery-page-tab {
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-main);
  font-weight: 500;
  padding: 5px 10px;
  transition:
    color var(--anim-fast),
    background var(--anim-fast);
}

.discovery-page-tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.discovery-page-tab.active {
  color: var(--text);
  background: var(--surface-hover);
}

.discovery-page-hero-inner {
  max-width: 640px;
}

.discovery-page-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.discovery-page-title svg {
  color: var(--accent);
  flex-shrink: 0;
}

.discovery-page-subtitle {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0 0 22px;
  line-height: 1.5;
}

.discovery-page-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 10px;
  max-width: 320px;
  width: 100%;
  transition:
    border-color var(--anim-fast),
    box-shadow var(--anim-fast);
}

.discovery-page-search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.discovery-page-search-wrap > svg {
  color: var(--text-dim);
  flex-shrink: 0;
}

.discovery-page-search {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  padding: 7px 0;
  font-family: var(--font-main);
}

.discovery-page-search::placeholder {
  color: var(--text-dim);
}

.discovery-page-search-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  padding: 2px;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: color var(--anim-fast);
}

.discovery-page-search-clear:hover {
  color: var(--text);
}

.discovery-page-body {
  flex: 1;
  padding: 20px 40px 40px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.discovery-featured-section {
  margin-bottom: 28px;
}

.discovery-featured-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 16px;
}

.discovery-featured-title svg {
  color: var(--accent);
}

.discovery-featured-carousel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  overflow: hidden;
}

.discovery-featured-card {
  display: none;
  align-items: center;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}

.discovery-featured-card.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.discovery-featured-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-light);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-dim);
}

.discovery-featured-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discovery-featured-content {
  flex: 1;
  min-width: 0;
}

.discovery-featured-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}

.discovery-featured-url {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0 0 8px;
}

.discovery-featured-stats {
  display: flex;
  gap: 16px;
  color: var(--text-dim);
  font-size: 13px;
}

.discovery-featured-stats span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.discovery-featured-owner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.discovery-featured-owner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discovery-featured-dot {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}

.discovery-featured-indicators {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
}

.discovery-featured-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface-light);
  border: none;
  cursor: pointer;
  transition: background var(--anim-fast);
}

.discovery-featured-indicator:hover {
  background: var(--surface-hover);
}

.discovery-featured-indicator.active {
  background: var(--accent);
}

.discovery-page-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.discovery-page-sort-label {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}

.discovery-page-sort-btn {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  transition:
    background var(--anim-fast),
    color var(--anim-fast),
    border-color var(--anim-fast);
}

.discovery-page-sort-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.discovery-page-sort-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent, #fff);
}

.discovery-page-count {
  margin-left: auto;
}

.discovery-page-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.discovery-tag-pill {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 14px;
  transition:
    background var(--anim-fast),
    color var(--anim-fast),
    border-color var(--anim-fast);
}

.discovery-tag-pill:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.discovery-tag-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent, #fff);
}

.discovery-tag-pill.small {
  font-size: 11px;
  padding: 2px 10px;
}

.discovery-page-count {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 16px;
}

.discovery-page-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

@media (max-width: 900px) {
  .discovery-page-grid {
    grid-template-columns: 1fr;
  }
}

.discovery-page-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition:
    border-color var(--anim-fast),
    box-shadow var(--anim-fast);
}

.discovery-page-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.discovery-page-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.discovery-page-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.discovery-page-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-light);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dim);
}

.discovery-page-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discovery-page-card-meta {
  flex: 1;
  min-width: 0;
}

.discovery-page-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discovery-page-card-url {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discovery-page-card-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.discovery-page-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.discovery-page-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.discovery-page-card-info {
  display: flex;
  gap: 12px;
  color: var(--text-dim);
  font-size: 12px;
  flex-wrap: wrap;
}

.discovery-page-card-info span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.discovery-page-card-owner-info img {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
}

.discovery-page-card-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: -4px;
}

.discovery-page-loading,
.discovery-page-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 80px 20px;
  color: var(--text-dim);
  text-align: center;
}

.discovery-page-empty svg {
  opacity: 0.4;
}

.discovery-page-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--surface-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.discovery-page-footer {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.discovery-page-footer .btn {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── End Discovery Page ──────────────────────────────────── */

/* ── Discovery Conditions ────────────────────────────────── */

.discovery-conditions {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.discovery-conditions-section h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 10px;
}

.discovery-conditions-section h2 svg {
  color: var(--accent);
  flex-shrink: 0;
}

.discovery-conditions-section > p {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 16px;
}

.discovery-conditions-section ul,
.discovery-conditions-section ol {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.discovery-conditions-section ul li,
.discovery-conditions-section ol li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
}

.discovery-conditions-section ul li svg {
  color: var(--success);
  flex-shrink: 0;
  margin-top: 2px;
}

.discovery-conditions-section ul li strong {
  color: var(--text);
}

.discovery-conditions-step {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  background: var(--surface-light);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-top: 1px;
}

.discovery-conditions-section a {
  color: var(--link);
  text-decoration: none;
}

.discovery-conditions-section a:hover {
  text-decoration: underline;
}

.discovery-conditions-section code {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
  color: var(--text);
}

/* ── End Discovery Conditions ────────────────────────────── */

.user-section-settings {
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  display: none;
  padding: 8px;
}

.user-section-settings:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.user-section-settings svg {
  height: 18px;
  width: 18px;
}

.home-guild .guild-icon svg {
  color: var(--text-dim);
}

.home-guild:hover .guild-icon svg,
.home-guild.active .guild-icon svg {
  color: white;
}

@media (max-width: 768px) {
  /* Guild sidebar: hidden by default, slides in with .open alongside the channel list */
  .guild-sidebar {
    background: var(--layer-sidebar-bg);
    bottom: 0;
    left: 0;
    min-width: 68px;
    padding: 12px 0;
    position: fixed;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    visibility: hidden;
    width: 68px;
    z-index: 103;
  }

  .guild-sidebar.open {
    transform: translateX(0);
    visibility: visible;
  }

  /* Channel list offset to the right of guild sidebar when both open */
  .channels.open {
    left: 68px;
    width: calc(100% - 68px);
  }

  .guild-list {
    gap: 10px;
    padding: 0 10px;
  }

  .guild-item,
  .guild-icon {
    height: 48px;
    width: 48px;
  }

  .guild-icon svg {
    height: 24px;
    width: 24px;
  }

  .guild-pill {
    left: -12px;
    width: 4px;
  }

  .guild-item.active .guild-pill {
    height: 40px;
  }

  .guild-unread-dot,
  .guild-ping {
    height: 14px;
    width: 14px;
  }

  .guild-ping-badge {
    font-size: 12px;
    height: 20px;
    min-width: 20px;
  }

  /* Disable tooltips on touch devices */
  .guild-item::after {
    display: none;
  }

  .user-sidebar {
    padding: 0 8px 8px 8px;
  }

  .user-profile-icon img {
    border-width: 1px;
  }

  /* Disable drag and drop on mobile */
  .guild-item {
    -webkit-user-drag: none;
    user-select: none;
  }
}

.channel-voice {
  opacity: 0.9;
}

.channel-voice:hover {
  opacity: 1;
}

.channel-voice i[data-lucide="volume-2"] {
  color: var(--success);
}

.channel-text i[data-lucide="hash"] {
  color: var(--text-dim);
}

html,
body,
.content,
.messages-container,
.messages {
  overflow-x: hidden;
  touch-action: pan-y;
}

.content,
.messages-container,
.messages {
  overscroll-behavior-x: none;
}

.account-modal {
  align-items: center;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(8px);
  background: rgba(0, 0, 0, 0.85);
  bottom: 0;
  display: none;
  justify-content: center;
  left: 0;
  padding: 20px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 50000;
}

.account-modal.active {
  display: flex;
}

.account-overlay {
  bottom: 0;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.account-card {
  animation: scaleIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  max-width: 500px;
  width: 100%;
}

.account-card,
.account-banner {
  overflow: hidden;
  position: relative;
}

.account-banner {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  height: 120px;
}

.account-banner::before {
  background: url('data:image/svg+xml,<svg xmlns="https://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="white" d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/><path fill="white" d="M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"/></svg>');
  background-size: cover;
  bottom: 0;
  content: "";
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.account-banner img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.account-header {
  display: none;
}

.account-avatar-section {
  display: flex;
  justify-content: center;
  margin-top: -50px;
  padding-bottom: 16px;
}

.account-avatar {
  background: var(--surface-light);
  border: 6px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  height: 100px;
  overflow: visible;
  position: relative;
  width: 100px;
}

.account-avatar img {
  border-radius: 50%;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.account-status-indicator {
  background: var(--status-color, #43b581);
  border: 5px solid var(--surface);
  border-radius: 50%;
  bottom: 6px;
  height: 24px;
  position: absolute;
  right: 6px;
  width: 24px;
}

.account-status-indicator.online {
  --status-color: #43b581;
}

.account-status-indicator.offline {
  --status-color: #555;
}

.account-status-indicator.idle {
  --status-color: #faa61a;
}

.account-names-section {
  margin-bottom: 20px;
  padding: 0 16px;
  text-align: center;
}

.account-username-text {
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
}

.account-global-name {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 400;
  margin-top: 4px;
}

.account-stats {
  background: var(--border);
  border-radius: 8px;
  display: grid;
  gap: 2px;
  grid-template-columns: repeat(2, 1fr);
  margin: 0 20px 20px;
  overflow: hidden;
}

.account-stat {
  background: var(--surface);
  padding: 16px 12px;
  text-align: center;
  transition: background 0.15s;
}

.account-stat:active {
  background: var(--surface-hover);
}

.account-stat-value {
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
}

.account-stat-label {
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0.5px;
  margin-top: 2px;
  text-transform: uppercase;
}

.account-follow-btn {
  align-items: center;
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-size: 13px;
  gap: 6px;
  justify-content: center;
  margin: 0 20px 4px;
  padding: 7px 14px;
  transition:
    background 0.15s,
    border-color 0.15s;
  width: calc(100% - 40px);
}

.account-follow-btn:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
}

.account-follow-btn.following {
  border-color: var(--primary);
  color: var(--primary);
}

.account-follow-btn.following:hover {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.account-follows-me-pill {
  background: color-mix(in srgb, var(--text-dim) 15%, transparent);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 500;
  margin-left: auto;
  padding: 2px 7px;
}

.account-section {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
}

.account-section-title {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.account-bio {
  line-height: 1.4;
  white-space: pre-wrap;
}

.account-bio,
.account-meta {
  color: var(--text);
  font-size: 14px;
}

.account-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.account-meta-item {
  align-items: center;
  display: flex;
  gap: 6px;
}

.account-meta-item svg {
  color: var(--text-dim);
  height: 16px;
  width: 16px;
}

.account-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.account-role {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
}

.account-close-btn {
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  display: flex;
  height: 36px;
  justify-content: center;
  position: absolute;
  right: 16px;
  top: 16px;
  transition: all 0.2s ease;
  width: 36px;
  z-index: 20;
}

.account-close-btn:hover {
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.account-close-btn:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.account-close-btn svg {
  height: 20px;
  width: 20px;
}

#account-content {
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.account-loading {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 20px;
  justify-content: center;
  padding: 100px 20px;
}

.account-loading-spinner {
  animation: spin 1s linear infinite;
  border: 4px solid var(--surface-light);
  border-radius: 50%;
  border-top-color: var(--primary);
  height: 48px;
  width: 48px;
}

.account-loading-text {
  color: var(--text-dim);
  font-size: 14px;
}

.account-error {
  color: var(--danger);
  font-size: 14px;
  padding: 100px 20px;
  text-align: center;
}

.account-actions-section {
  background: var(--surface-light);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  padding: 20px;
}

.account-actions-section button {
  min-height: 48px;
  min-width: 48px;
}

.account-logout-button {
  border: 1px solid var(--danger, #ed4245);
  color: var(--danger, #ed4245);
  width: auto;
}

.account-logout-button:hover {
  background: var(--danger, #ed4245);
}

.account-logout-button:focus {
  outline: 2px solid var(--danger, #ed4245);
}

.account-actions-section button.account-logout-button {
  all: unset;
  align-items: center;
  background: transparent;
  border: 1px solid var(--danger, #ed4245);
  border-radius: 8px;
  color: var(--danger, #ed4245);
  cursor: pointer;
  display: flex;
  font-size: 15px;
  font-weight: 600;
  gap: 10px;
  justify-content: center;
  line-height: 1;
  min-width: 200px;
  padding: 14px 32px;
  text-decoration: none;
  transition: all 0.2s ease;
  width: auto;
}

.account-actions-section button {
  appearance: none;
  border: none;
  margin: 0;
  padding: 0;
  -webkit-appearance: none;
  -moz-appearance: none;
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

.account-logout-button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--danger);
  border-radius: 8px;
  color: var(--danger);
  cursor: pointer;
  display: flex;
  font-size: 15px;
  font-weight: 600;
  gap: 10px;
  justify-content: center;
  line-height: 1;
  min-width: 200px;
  padding: 14px 32px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.account-logout-button:hover {
  background: var(--danger);
  box-shadow: 0 4px 12px rgba(237, 66, 69, 0.3);
  color: white;
  transform: translateY(-2px);
}

.account-logout-button:active {
  box-shadow: none;
  transform: translateY(0);
}

.account-logout-button:focus {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

.account-logout-button svg {
  height: 18px;
  width: 18px;
}

.account-profile-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 340px;
}

@media (max-width: 768px) {
  .account-modal {
    align-items: flex-end;
    overflow: hidden;
    padding: 0;
  }

  .account-card {
    animation: slideUpFull 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 20px 20px 0 0;
    margin-top: auto;
    max-height: 90vh;
    max-width: 100%;
    overflow: hidden;
    position: relative;
    width: 100%;
    z-index: 10;
  }

  .account-overlay {
    z-index: 1;
  }

  @keyframes slideUpFull {
    from {
      opacity: 0;
      transform: translateY(100%);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Twemoji Emoji Support */

  img.emoji,
  .account-bio img.emoji,
  .message-content img.emoji,
  .reply-bar-text img.emoji,
  .embed-description img.emoji,
  .embed-title img.emoji,
  .account-username-text img.emoji,
  .account-global-name img.emoji,
  .profile-card-inline img.emoji {
    height: 1em;
    margin: 0 0.05em 0 0.1em;
    vertical-align: -0.1em;
    width: 1em;
  }

  /* Override account modal styles for sidebar context */
  .members-list .account-banner {
    border-radius: 8px;
    height: 60px;
  }

  .members-list .account-avatar-section {
    margin-top: -30px;
    padding-bottom: 8px;
  }

  .members-list .account-avatar {
    border-width: 4px;
    height: 60px;
    width: 60px;
  }

  .members-list .account-avatar img {
    height: 100%;
    width: 100%;
  }

  .members-list .account-status-indicator {
    border-width: 2px;
    height: 12px;
    width: 12px;
  }

  .members-list .account-names-section {
    padding: 0 4px;
  }

  .members-list .account-username-text {
    font-size: 15px;
  }

  .members-list .account-global-name {
    font-size: 12px;
  }

  .members-list .account-stats {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, 1fr);
    padding: 8px 0;
  }

  .members-list .account-stat {
    background: var(--surface-light);
    border-radius: 6px;
    padding: 4px;
    text-align: center;
  }

  .members-list .account-section {
    margin-top: 4px;
  }

  .members-list .account-section-title {
    font-size: 10px;
    margin-bottom: 4px;
  }

  .members-list .account-bio {
    font-size: 12px;
    line-height: 1.4;
  }

  .members-list .account-roles {
    font-size: 11px;
  }

  .members-list .account-role {
    font-size: 10px;
    padding: 2px 6px;
  }

  .members-list .account-meta-item {
    font-size: 11px;
  }

  .members-list .account-meta-item i {
    height: 12px;
    width: 12px;
  }

  .members-list .account-logout-button {
    font-size: 12px;
    padding: 8px;
  }

  .members-list .account-logout-button svg {
    height: 14px;
    width: 14px;
  }

  .members-list .account-error,
  .members-list .account-empty {
    color: var(--text-dim);
    font-size: 13px;
    padding: 20px;
    text-align: center;
  }

  .account-banner {
    height: 160px;
  }

  .account-avatar-section {
    margin-top: -60px;
  }

  .account-avatar {
    border: 8px solid var(--surface);
    height: 120px;
    width: 120px;
  }

  .account-role {
    font-size: 13px;
    padding: 6px 12px;
    transition: background 0.15s;
  }

  .account-role:active {
    background: var(--surface-hover);
  }

  .account-status-indicator {
    border: 6px solid var(--surface);
    height: 28px;
    width: 28px;
  }

  .account-username-text {
    font-size: 28px;
  }

  .account-stats {
    grid-template-columns: repeat(2, 1fr);
    margin: 0 24px 24px;
  }

  .account-section {
    padding: 20px 24px;
  }

  .channel-header-actions {
    gap: 4px;
  }

  .channel-header-actions,
  .channel-action-btn {
    align-items: center;
    display: flex;
  }

  .channel-action-btn {
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-dim);
    cursor: pointer;
    height: 28px;
    justify-content: center;
    transition: all 0.15s ease;
    width: 28px;
  }

  .channel-action-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
  }

  .channel-action-btn i {
    height: 16px;
    width: 16px;
  }

  .account-close-btn {
    background: rgba(0, 0, 0, 0.5);
    height: 44px;
    right: 20px;
    top: 20px;
    width: 44px;
    z-index: 30;
  }

  .account-close-btn:hover {
    background: rgba(0, 0, 0, 0.6);
  }

  .account-card::before {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.15), transparent);
    content: "";
    height: 60px;
    left: 0;
    pointer-events: none;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 5;
  }

  #account-content {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  #account-content,
  .account-section:last-child {
    padding-bottom: 40px;
  }

  .close-members {
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    height: 36px;
    justify-content: center;
    transition: background 0.2s;
    width: 36px;
  }

  .close-members:hover {
    background: rgba(255, 255, 255, 0.2);
  }

  .section {
    padding: 16px;
  }

  .section h2 {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-left: 12px;
  }

  .member {
    gap: 12px;
    margin-bottom: 4px;
    padding: 10px 12px;
  }

  .member:hover {
    background: rgba(255, 255, 255, 0.08);
  }

  .member img {
    height: 44px;
    width: 44px;
  }

  .member .name {
    font-size: 16px;
  }

  .member::after {
    border: 2px solid var(--surface, #0a0a0c);
    bottom: 8px;
    height: 12px;
    right: 8px;
    width: 12px;
  }

  /* Mobile Message Styling Improvements */
  .messages {
    gap: 0;
    padding: 0;
  }

  .message-group {
    padding: 4px 0;
  }

  .message-group .avatar {
    height: 44px;
    margin-left: 5px;
    margin-right: 10px;
    width: 44px;
  }

  .message-group-content {
    min-width: 0;
  }

  .message-header {
    gap: 8px;
    margin-bottom: 4px;
    margin-top: 4px;
  }

  .username {
    font-size: 15px;
  }

  .timestamp {
    font-size: 12px;
  }

  .message-text {
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    color: var(--text, #ededed);
    max-width: 100%;
    overflow: visible;
    white-space: pre-wrap;
    word-break: break-word;
  }

  .message-text p {
    margin: 0 0 8px 0;
  }

  .message-text p:last-child {
    margin-bottom: 0;
  }

  .message-text ul,
  .message-text ol {
    margin: 8px 0;
    padding-left: 20px;
  }

  .message-text li {
    margin: 4px 0;
  }

  .message-text blockquote {
    background: rgba(155, 135, 245, 0.1);
    border-left: 4px solid var(--primary);
    border-radius: 0 8px 8px 0;
    margin: 8px 0;
    padding: 8px 12px;
  }

  .message-text code {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-family: "Consolas", "Monaco", monospace;
    font-size: 0.9em;
    padding: 2px 6px;
  }

  .message-text pre {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin: 8px 0;
    overflow-x: auto;
    padding: 12px;
  }

  .message-text pre code {
    background: transparent;
    padding: 0;
  }

  .message-text ::selection {
    background: rgba(155, 135, 245, 0.3);
  }

  .message-reply .reply-text {
    color: var(--text-dim);
    font-size: var(--font-sm);
  }

  .message-reply .reply-username {
    font-size: var(--font-sm);
    font-weight: 600;
  }

  .message-reply div {
    font-size: var(--font-base);
  }

  .message-image {
    border-radius: 12px;
    margin-top: 8px;
    max-height: 300px;
  }

  .embed-container {
    position: static;
  }

  .embed-container,
  .youtube-embed {
    border-radius: 12px;
    margin-top: 8px;
    max-width: 100%;
  }

  .youtube-thumbnail {
    border-radius: 12px 12px 0 0;
  }

  .message-reactions {
    gap: 8px;
    margin-top: 8px;
  }

  .reaction {
    font-size: 16px;
    padding: 6px 10px;
  }

  .reaction-count {
    font-size: 13px;
  }

  /* Mobile Context Menu - Bottom Sheet Style */

  .context-menu {
    border-bottom: none;
    border-radius: 16px 16px 0 0;
    bottom: 0 !important;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
    left: 0 !important;
    max-width: 100%;
    padding: 12px 0 24px 0;
    right: 0 !important;
    top: auto !important;
    width: 100%;
  }

  .context-menu-item {
    border-bottom: 1px solid var(--border);
    font-size: 16px;
    justify-content: center;
    padding: 16px 20px;
  }

  .context-menu-item:last-child {
    border-bottom: none;
  }

  /* Mobile Input Area */

  /* ============= Input Autocomplete (mobile overrides) ============= */

  .input-autocomplete {
    left: var(--space-2);
    max-height: 240px;
    right: var(--space-2);
  }

  .input-area {
    padding: 12px;
  }

  .input-wrapper {
    gap: 6px;
    padding: 6px;
  }

  #message-input {
    font-size: 16px;
    min-height: 44px;
    padding: 10px;
  }

  .icon-btn {
    height: 40px;
    width: 40px;
  }

  .icon-btn svg {
    height: 24px;
    width: 24px;
  }

  .send-btn {
    height: 44px;
    width: 44px;
  }

  .send-btn svg {
    height: 22px;
    width: 22px;
  }

  /* Mobile Typing Indicator */
  .typing {
    font-size: 13px;
    margin-left: 12px;
    padding: 2px 0;
  }

  .messages-container {
    border-radius: 0;
    margin: 0;
  }

  /* Mobile Reply Bar */
  .reply-bar {
    font-size: var(--font-md);
    padding: 8px 10px 8px 12px;
  }
}

.mention-name {
  font-size: 16px;
}

.channel-mention-item {
  padding: 8px;
}

.channel-mention-name {
  font-size: 16px;
}

@keyframes slideUpFull {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.gif-star-btn {
  border-radius: 8px;
  opacity: 1;
  padding: 8px;
  right: 10px;
  top: 10px;
}

.gif-star-btn svg {
  height: 20px;
  width: 20px;
}

.gif-loading,
.gif-error,
.gif-empty {
  font-size: 16px;
  padding: 60px 20px;
}

.voice-participant.speaking .voice-avatar {
  animation: speaking-pulse 1.5s ease-in-out infinite;
}

/* Voice Participants Container */
#voice-participants {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px 0;
}

#voice-participants::-webkit-scrollbar {
  width: 6px;
}

#voice-participants::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 3px;
}

#voice-participants::-webkit-scrollbar-thumb {
  background: var(--surface-light);
  border-radius: 3px;
}

#voice-participants::-webkit-scrollbar-thumb:hover {
  background: var(--surface-hover);
}

/* Empty State */
#voice-participants:empty::before {
  color: var(--text-dim);
  content: "No one else is in this channel";
  display: block;
  font-size: 13px;
  padding: 24px 12px;
  text-align: center;
}

.members-list .search-wrapper,
.members-list .pinned-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  width: 300px;
}

.members-list .search-header {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-shrink: 0;
  justify-content: space-between;
  padding: 16px 16px 12px;
}

.members-list .search-header h3 {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.members-list .close-search {
  align-items: center;
  border-radius: 50%;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  height: 24px;
  justify-content: center;
  transition: all 0.15s ease;
  width: 24px;
}

.members-list .close-search:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.members-list .search-input-wrapper {
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  padding: 12px 16px;
}

.members-list .search-input {
  background: var(--surface-light);
  border: none;
  border-radius: 6px;
  color: var(--text);
  flex: 1;
  font-size: 14px;
  outline: none;
  padding: 8px 12px;
  transition: border-color 0.15s ease;
}

.members-list .search-input::placeholder {
  color: var(--text-dim);
}

.members-list .search-submit-btn {
  align-items: center;
  background: var(--bg-primary);
  border: none;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: center;
  padding: 0 6px;
  transition: background 0.15s ease;
}

.members-list .search-submit-btn:hover {
  background: var(--primary-hover);
}

.members-list .search-submit-btn i {
  height: 16px;
  width: 16px;
}

.members-list .search-results,
.members-list .pinned-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.members-list .search-result-item {
  background: var(--surface-light);
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 8px;
  padding: 12px;
  transition: background 0.15s ease;
}

.members-list .search-result-item:hover {
  background: var(--surface-hover);
}

.members-list .search-result-item.pinned-item {
  border-left: 3px solid var(--mention);
}

.members-list .search-result-header {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.members-list .search-result-avatar {
  border-radius: 50%;
  height: 24px;
  object-fit: cover;
  width: 24px;
}

.members-list .search-result-username {
  color: var(--text);
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.members-list .search-result-time {
  color: var(--text-dim);
  flex-shrink: 0;
  font-size: 11px;
}

.members-list .search-result-content {
  color: var(--text-dim);
  display: -webkit-box;
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
}

.highlight-message {
  animation: highlightPulse 2s ease-out;
}

@keyframes highlightPulse {
  0% {
    background: rgba(155, 135, 245, 0.4);
  }

  100% {
    background: transparent;
  }
}

@media (min-width: 769px) {
  .members-header-mobile {
    display: none;
  }
}

@media (max-width: 768px) {
  .members-list .search-header {
    padding: 12px;
  }

  .members-list .search-header h3 {
    font-size: 13px;
  }

  .members-list .search-input-wrapper {
    padding: 10px 12px;
  }

  .members-list .search-input {
    font-size: 13px;
    padding: 6px 10px;
  }

  .members-list .search-result-item {
    padding: 10px;
  }

  .members-list .search-result-username,
  .members-list .search-result-content {
    font-size: 12px;
  }

  .members-list .message-group,
  .members-list .message-single {
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 4px;
    padding: 8px 12px;
    transition: background 0.15s ease;
  }

  .members-list .message-group:hover,
  .members-list .message-single:hover {
    background: var(--interactive-hover-bg);
  }

  .members-list .message-group .avatar {
    height: 32px;
    margin-right: 10px;
    width: 32px;
  }

  .members-list .message-text {
    font-size: 13px;
    line-height: 1.4;
  }

  .members-list .message-header .username {
    font-size: 13px;
  }

  .members-list .message-header .timestamp {
    font-size: 11px;
  }

  .members-list .message-reply {
    font-size: 12px;
    padding: 4px 8px;
  }

  .voice-panel {
    left: 0;
    overflow-y: auto;
    right: 0;
    top: 48px;
    width: auto;
  }

  .voice-participant {
    padding: 10px 12px;
  }

  .voice-avatar {
    font-size: 14px;
    height: 36px;
    min-width: 36px;
    width: 36px;
  }

  .voice-name {
    font-size: 13px;
  }

  .members-header-mobile {
    align-items: center;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-shrink: 0;
    gap: 8px;
    padding: 16px 16px 12px;
  }

  .members-header-mobile .right-panel-close {
    margin-left: auto;
  }

  .members-header-mobile h3 {
    color: var(--text);
    font-size: 18px;
    font-weight: 600;
    margin: 0;
  }

  .members-count {
    color: var(--text-dim);
    font-size: 13px;
  }

  .members-list-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px 16px;
    -webkit-overflow-scrolling: touch;
  }

  .members-empty {
    align-items: center;
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
    padding: 48px 20px;
    text-align: center;
  }

  .member {
    padding: 12px;
    margin-bottom: 4px;
    position: relative;
  }

  .member-avatar-wrapper {
    position: relative;
  }

  .member img {
    height: 48px;
    width: 48px;
    border-radius: var(--avatar-radius, 50%);
  }

  .member-status-indicator {
    background: #23a559;
    border: 3px solid var(--surface);
    border-radius: 50%;
    bottom: 0;
    height: 14px;
    position: absolute;
    right: 0;
    width: 14px;
  }

  .member .name {
    font-size: 16px;
    font-weight: 500;
  }

  .member.offline {
    opacity: 0.5;
  }

  .member.offline .member-status-indicator {
    display: none;
  }

  .members-list h2 {
    font-size: 12px;
    font-weight: 700;
    margin: 16px 0 8px 4px;
    padding: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  /* ============= MOBILE INBOX PANEL IMPROVEMENTS ============= */
  .inbox-ping-group-header {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 12px 16px;
    margin-top: 0;
    border-radius: 0;
  }

  .inbox-ping-card {
    padding: 16px;
    gap: 10px;
    margin-bottom: 8px;
    border-radius: 12px;
    background: var(--surface-light);
  }

  .inbox-ping-card--last {
    border-radius: 12px;
  }

  .inbox-ping-card-reply {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-bottom: 8px;
    gap: 8px;
  }

  .inbox-ping-card-reply-avatar {
    height: 20px;
    width: 20px;
  }

  .inbox-ping-card-reply-user {
    font-size: 14px;
  }

  .inbox-ping-card-reply-text {
    font-size: 13px;
  }

  .inbox-ping-card-avatar {
    height: 44px;
    width: 44px;
  }

  .inbox-ping-card-username {
    font-size: 15px;
  }

  .inbox-ping-card-text {
    font-size: 15px;
    line-height: 1.5;
  }

  .inbox-ping-card-time {
    font-size: 12px;
  }

  .inbox-panel-load-more {
    margin: 16px;
    padding: 14px 20px;
    font-size: 15px;
    border-radius: 12px;
  }

  .inbox-panel-total {
    font-size: 12px;
    padding: 4px 8px;
  }

  .right-panel-content {
    max-width: 100%;
    padding: 0;
  }

  /* ============= MOBILE RIGHT PANEL COMMON IMPROVEMENTS ============= */
  .right-panel-header {
    padding: 16px;
    font-size: 18px;
    gap: 10px;
  }

  .right-panel-header svg {
    width: 20px;
    height: 20px;
  }

  .right-panel-close {
    display: flex;
    margin-left: auto;
    padding: 8px;
    border-radius: 8px;
  }

  .right-panel-close svg {
    width: 20px;
    height: 20px;
  }

  .right-panel-search-input {
    padding: 12px 16px;
    gap: 10px;
  }

  .right-panel-search-input input {
    font-size: 16px;
    padding: 12px 14px;
    border-radius: 10px;
  }

  .search-submit-btn {
    padding: 12px 14px;
    border-radius: 10px;
  }

  .right-panel-empty {
    padding: 60px 24px;
    gap: 16px;
  }

  .right-panel-empty svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
  }

  .right-panel-empty span {
    font-size: 15px;
  }

  .right-panel-message {
    padding: 14px 16px;
    border-radius: 12px;
    margin: 0 12px 10px;
  }

  .right-panel-message-header {
    gap: 10px;
    margin-bottom: 8px;
  }

  .right-panel-avatar {
    height: 36px;
    width: 36px;
  }

  .right-panel-username {
    font-size: 15px;
  }

  .right-panel-time {
    font-size: 12px;
  }

  .right-panel-message-content {
    font-size: 15px;
    line-height: 1.5;
  }

  .right-panel-message {
    position: relative;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .right-panel-message:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  .right-panel-message-action {
    align-items: center;
    color: var(--text-dim);
    display: flex;
    height: 100%;
    justify-content: center;
    opacity: 0;
    position: absolute;
    right: 12px;
    top: 0;
    transition: opacity 0.15s ease;
  }

  .right-panel-message:hover .right-panel-message-action,
  .right-panel-message:active .right-panel-message-action {
    opacity: 0.6;
  }

  .loading-throbber {
    width: 32px;
    height: 32px;
  }

  /* Inbox card wrapper for proper structure */
  .inbox-ping-card-wrapper {
    display: contents;
  }

  /* Inbox card click indicator */
  .inbox-ping-card {
    position: relative;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .inbox-ping-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  .inbox-ping-card-action {
    align-items: center;
    color: var(--text-dim);
    display: flex;
    height: 100%;
    justify-content: center;
    opacity: 0;
    position: absolute;
    right: 12px;
    top: 0;
    transition: opacity 0.15s ease;
  }

  .inbox-ping-card:hover .inbox-ping-card-action,
  .inbox-ping-card:active .inbox-ping-card-action {
    opacity: 0.6;
  }

  /* Highlight flash animation for jump to message */
  @keyframes highlight-flash {
    0% {
      background: var(--mention, #9b87f5);
      background: color-mix(in srgb, var(--mention, #9b87f5) 30%, transparent);
    }

    100% {
      background: transparent;
    }
  }

  .highlight-flash {
    animation: highlight-flash 2s ease-out;
  }
}

/* ============= UNIFIED PICKER ============= */
.unified-picker {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  height: 420px;
  position: fixed;
  width: 380px;
  z-index: 10000;
}

.unified-picker-header {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-shrink: 0;
  justify-content: space-between;
  padding: 8px 12px;
}

.unified-picker-tabs {
  display: flex;
  gap: 4px;
}

.unified-tab {
  align-items: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  font-size: 13px;
  font-weight: 500;
  gap: 6px;
  padding: 6px 12px;
  transition: all 0.15s ease;
}

.unified-tab:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.unified-tab.active {
  background: var(--primary);
  color: #fff;
}

.unified-picker-close {
  align-items: center;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  padding: 4px;
}

.unified-picker-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.unified-picker-search {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  padding: 8px 12px;
}

.unified-picker-search svg {
  color: var(--text-dim);
  flex-shrink: 0;
}

.unified-picker-search input {
  background: transparent;
  border: none;
  color: var(--text);
  flex: 1;
  font-size: 13px;
  outline: none;
}

.unified-picker-search input::placeholder {
  color: var(--text-dim);
}

.unified-picker-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.emoji-sidebar {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  padding: 8px;
  width: 48px;
}

.emoji-sidebar-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 18px;
  height: 32px;
  line-height: 1;
  padding: 0;
  transition: background 0.15s;
  width: 32px;
}

.emoji-sidebar-btn:hover {
  background: var(--surface-hover);
}

.emoji-sidebar-btn.active {
  background: var(--surface-light);
}

.emoji-sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.emoji-section-label {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.emoji-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.emoji-grid-container {
  display: flex;
  height: 100%;
}

.emoji-grid {
  display: grid;
  gap: 2px;
  grid-template-columns: repeat(8, 1fr);
  margin-bottom: 8px;
}

.emoji-button {
  align-items: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  font-size: 22px;
  height: 36px;
  justify-content: center;
  transition: background 0.1s;
  width: 100%;
}

.emoji-button:hover {
  background: var(--surface-hover);
  transform: scale(1.15);
}

.twemoji-picker-img {
  height: 22px;
  pointer-events: none;
  width: 22px;
}

.emoji-cat-btn .twemoji-picker-img {
  height: 18px;
  width: 18px;
}

.gif-section-label {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  font-size: 11px;
  font-weight: 600;
  gap: 4px;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.gif-grid {
  column-gap: 6px;
  columns: 2;
}

.gif-item {
  break-inside: avoid;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 6px;
  overflow: hidden;
  position: relative;
}

.gif-item img {
  border-radius: 8px;
  display: block;
  transition: transform 0.15s;
  width: 100%;
}

.gif-item:hover img {
  transform: scale(1.03);
}

.gif-fav-btn {
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  opacity: 0;
  padding: 4px;
  position: absolute;
  right: 6px;
  top: 6px;
  transition:
    opacity 0.15s,
    color 0.15s;
}

.gif-item:hover .gif-fav-btn {
  opacity: 1;
}

.gif-fav-btn.active {
  color: #fbbf24;
  opacity: 1;
}

.picker-loading {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 12px;
  justify-content: center;
  padding: 40px 20px;
}

.picker-empty {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.picker-empty p {
  font-size: 14px;
  margin: 0;
}

.picker-empty-hint {
  font-size: 12px !important;
  opacity: 0.6;
}

@media (max-width: 768px) {
  .unified-picker {
    border-radius: 16px 16px 0 0;
    bottom: 0 !important;
    height: 55vh;
    left: 0 !important;
    max-height: 55vh;
    position: fixed;
    right: 0;
    top: auto !important;
    width: 100%;
  }
}

/* ========================================
   Voice Call View (Fullscreen)
   ======================================== */

/* ── Embedded voice panel (inside chat channels) ── */

.voice-call-view--embedded {
  /* Sits above the messages area, takes up ~40% of the available height */
  flex: 0 0 40%;
  max-height: 40%;
  min-height: 220px;
  border-bottom: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  /* Don't inherit the bg from the fullscreen version — blend with the panel */
  background: var(--surface, #1e1e2e);
}

/* When the embedded panel is present the main-content-wrapper becomes a split
   flex column: [voice panel 40%] + [content area 60%] */
.main-content-wrapper:has(.voice-call-view--embedded) .main-content-area {
  flex: 1;
  min-height: 0;
}

/* Tighten the embedded header — it doesn't need as much padding */
.voice-call-view--embedded .voice-call-header {
  padding: 8px 16px;
}

/* Compact participant tiles in embedded mode */
.voice-call-view--embedded .voice-call-participants {
  padding: 12px 16px;
  gap: 10px;
}

.voice-call-view--embedded .voice-call-tile {
  min-width: 80px;
  width: 100px;
  padding: 10px 10px 8px;
}

.voice-call-view--embedded .voice-call-tile-avatar {
  height: 44px;
  width: 44px;
}

/* Slimmer controls bar in embedded mode */
.voice-call-view--embedded .voice-call-controls {
  padding: 8px 16px;
  gap: 10px;
}

.voice-call-view--embedded .voice-call-control-btn {
  height: 36px;
  width: 36px;
}

.voice-call-view--embedded .voice-call-control-btn svg {
  width: 18px;
  height: 18px;
}

.voice-call-view {
  background: var(--bg, #1a1a2e);
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

/* Header */
.voice-call-header {
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-shrink: 0;
  justify-content: space-between;
  padding: 12px 20px;
}

.voice-call-header-left {
  align-items: center;
  display: flex;
  gap: 10px;
}

.voice-call-header-left svg {
  color: var(--success, #3ba55c);
}

.voice-call-channel-name {
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

.voice-call-participant-count {
  color: var(--text-dim);
  font-size: 13px;
}

.voice-call-minimize-btn {
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  justify-content: center;
  padding: 8px;
  transition: all 0.15s ease;
}

.voice-call-minimize-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

/* Video area */
.voice-call-video-area {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  overflow: auto;
  padding: 12px;
  max-height: 100%;
}

.voice-call-video-tile {
  background: #000;
  border: 2px solid var(--border);
  border-radius: 12px;
  flex: 1 1 45%;
  min-height: 200px;
  min-width: 280px;
  overflow: hidden;
  position: relative;
}

.voice-call-video-self {
  border-color: var(--primary, #5865f2);
}

.voice-call-video-camera {
  border-color: var(--success, #3ba55c);
}

.voice-call-video-camera.voice-call-video-self {
  border-color: var(--success, #3ba55c);
}

.voice-call-video-camera .voice-call-video-element {
  object-fit: cover;
  transform: scaleX(-1);
}

.voice-call-video-element {
  display: block;
  object-fit: contain;
  height: 100%;
}

.voice-call-video-label {
  background: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  bottom: 8px;
  color: white;
  font-size: 12px;
  font-weight: 500;
  left: 8px;
  padding: 4px 8px;
  position: absolute;
}

/* Participants grid */
.voice-call-participants {
  align-content: center;
  align-items: center;
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  overflow-y: auto;
  padding: 24px;
}

/* Participant tile */
.voice-call-tile {
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid transparent;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 100px;
  padding: 20px 16px 14px;
  transition: all 0.2s ease;
  width: 140px;
}

.voice-call-participants.compact .voice-call-tile {
  gap: 6px;
  min-width: 80px;
  padding: 12px 10px 10px;
  width: 100px;
}

.voice-call-tile:hover {
  background: rgba(255, 255, 255, 0.06);
}

.voice-call-tile.speaking {
  border-color: var(--success, #3ba55c);
}

.voice-call-tile.muted .voice-call-tile-status svg {
  color: var(--danger, #ed4245);
}

/* Avatar wrap + speaking ring */
.voice-call-tile-avatar-wrap {
  align-items: center;
  display: flex;
  justify-content: center;
  position: relative;
}

.voice-call-tile-speaking-ring {
  border: 3px solid transparent;
  border-radius: 50%;
  inset: -5px;
  position: absolute;
  transition: border-color 0.2s ease;
}

.voice-call-tile-speaking-ring.active {
  animation: vc-speaking-glow 1.2s ease-in-out infinite;
  border-color: var(--success, #3ba55c);
}

@keyframes vc-speaking-glow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(59, 165, 92, 0.4);
  }

  50% {
    box-shadow: 0 0 12px 4px rgba(59, 165, 92, 0.25);
  }
}

.voice-call-tile-avatar {
  border-radius: 50%;
  height: 64px;
  object-fit: cover;
  width: 64px;
}

.voice-call-participants.compact .voice-call-tile-avatar {
  height: 48px;
  width: 48px;
}

.voice-call-tile-name {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-call-tile-status {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  justify-content: center;
}

.voice-call-tile.speaking .voice-call-tile-status svg {
  color: var(--success, #3ba55c);
}

/* Controls bar */
.voice-call-controls {
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid var(--border);
  display: flex;
  flex-shrink: 0;
  gap: 12px;
  justify-content: center;
  padding: 16px;
}

.voice-call-control-btn {
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  display: flex;
  height: 48px;
  justify-content: center;
  transition: all 0.15s ease;
  width: 48px;
}

.voice-call-control-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.05);
}

.voice-call-control-btn:active {
  transform: scale(0.95);
}

.voice-call-control-btn.muted {
  background: var(--danger, #ed4245);
  color: white;
}

.voice-call-control-btn.active {
  background: var(--success, #3ba55c);
  color: white;
}

.voice-call-control-btn.danger {
  background: var(--danger, #ed4245);
  color: white;
}

.voice-call-control-btn.danger:hover {
  background: #c53030;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .voice-call-participants {
    gap: 10px;
    padding: 16px;
  }

  .voice-call-tile {
    min-width: 80px;
    padding: 14px 10px 10px;
    width: 100px;
  }

  .voice-call-tile-avatar {
    height: 48px;
    width: 48px;
  }

  .voice-call-tile-name {
    font-size: 12px;
    max-width: 80px;
  }

  .voice-call-controls {
    gap: 10px;
    padding: 12px;
  }

  .voice-call-control-btn {
    height: 44px;
    width: 44px;
  }

  .voice-call-video-tile {
    min-height: 150px;
    min-width: 200px;
  }
}

/* ============= USER POPOUT ============= */

.user-popout {
  animation: popoutIn 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: var(--z-popover, 10002);
}

@keyframes popoutIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-4px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ── Guild sidebar user panel ────────────────────────────────────────────── */
.guild-user-panel {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0 12px;
}

.guild-user-avatar-btn {
  background: none;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  height: var(--space-9);
  padding: 0;
  position: relative;
  transition:
    border-radius var(--anim-normal) var(--ease-standard),
    transform var(--anim-normal) var(--ease-standard);
  width: var(--space-9);
}

.guild-user-avatar-btn:hover {
  border-radius: var(--radius-md);
  transform: translateY(-1px);
}

.guild-user-avatar {
  border-radius: inherit;
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.guild-user-status-emoji {
  background: var(--surface);
  border-radius: 50%;
  bottom: -3px;
  font-size: 12px;
  line-height: 1;
  padding: 2px;
  pointer-events: none;
  position: absolute;
  right: -3px;
}

.guild-user-settings-btn {
  align-items: center;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  height: 28px;
  justify-content: center;
  transition:
    background var(--anim-fast) var(--ease-standard),
    color var(--anim-fast) var(--ease-standard),
    border-radius var(--anim-normal) var(--ease-standard);
  width: var(--space-9);
}

.guild-user-settings-btn:hover {
  background: var(--surface-hover);
  border-radius: var(--radius-pill);
  color: var(--text);
}

/* ── Status modal ────────────────────────────────────────────────────────── */
.status-modal-overlay {
  align-items: center;
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 900;
}

.status-modal {
  background: var(--surface-light, #141419);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  min-width: 300px;
  max-width: 380px;
  width: calc(250px - 16px);
}

.status-modal-header {
  align-items: center;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  display: flex;
  font-size: 13px;
  font-weight: 600;
  justify-content: space-between;
  padding: 10px 14px;
}

.status-modal-close {
  align-items: center;
  background: none;
  border: none;
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  padding: 2px;
  transition: color 0.15s;
}

.status-modal-close:hover {
  color: var(--text);
}

.status-modal-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
}

.status-modal-row {
  display: flex;
  gap: 8px;
}

.status-modal-emoji {
  background: var(--input-bg, var(--surface));
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  flex-shrink: 0;
  font-size: 16px;
  outline: none;
  padding: 6px 8px;
  text-align: center;
  transition: border-color 0.15s;
  width: 46px;
}

.status-modal-emoji:focus {
  border-color: var(--accent);
}

.status-modal-text {
  background: var(--input-bg, var(--surface));
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  flex: 1;
  font-size: 13px;
  min-width: 0;
  outline: none;
  padding: 6px 10px;
  transition: border-color 0.15s;
}

.status-modal-text:focus {
  border-color: var(--accent);
}

.status-modal-error {
  color: #ed4245;
  font-size: 12px;
}

.status-modal-footer {
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px 14px;
}

.status-modal-btn {
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  transition: opacity 0.15s;
}

.status-modal-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.status-modal-btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.status-modal-btn.secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.status-modal-btn.primary {
  background: var(--accent, var(--primary));
  color: #fff;
}

.status-modal-btn.primary:hover:not(:disabled) {
  opacity: 0.85;
}

/* ── Loading screen ───────────────────────────────────────────────────────── */

.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  background: var(--bg);
  color: var(--text);
  gap: var(--space-8);
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
}

.loading-logo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  animation: pulse-logo 2s ease-in-out infinite;
}

@keyframes pulse-logo {
  0%,
  100% {
    opacity: 0.8;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
}

.loading-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  color: var(--text-dim);
}

.loading-status svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-tip {
  position: absolute;
  bottom: 48px;
  max-width: 480px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-dim);
  line-height: 1.5;
  padding: 0 var(--space-4);
}

.tip-label {
  color: var(--mention);
  font-weight: 600;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
}

.loading-spinner {
  width: 48px;
  height: 48px;
}

.spinner-ring {
  width: 100%;
  height: 100%;
  border: 4px solid var(--surface-light);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dim);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* ── Offline screen ──────────────────────────────────────────────────────── */

.offline-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.offline-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
  padding: var(--space-7);
  max-width: 380px;
}

.offline-icon {
  color: var(--text-dim);
  opacity: 0.5;
}

.offline-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.offline-body {
  font-size: 0.9375rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.offline-retry-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--border-radius);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--anim-fast);
  margin-top: var(--space-2);
}

.offline-retry-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}

.offline-retry-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Thread Panel */
.thread-panel {
  flex: 1;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.thread-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.thread-panel-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.thread-panel-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.thread-panel-close:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.thread-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2);
}

.thread-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-dim);
  text-align: center;
}

.thread-empty svg {
  margin-bottom: var(--space-3);
  opacity: 0.5;
}

.thread-empty p {
  margin: 0;
}

.thread-empty-hint {
  font-size: 0.875rem;
  margin-top: var(--space-1);
}

.thread-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-radius: var(--radius-sm);
  padding-left: 30px;
  cursor: pointer;
  transition: background var(--anim-fast);
}

.thread-item:hover {
  background: var(--surface-hover);
}

.thread-item.active {
  background: var(--surface-light);
}

.thread-item-icon {
  color: var(--text-dim);
  display: flex;
  align-items: center;
}

.thread-item-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.thread-item-content {
  flex: 1;
  min-width: 0;
}

.thread-item-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-item-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.thread-item-locked {
  color: var(--warning);
  display: flex;
  align-items: center;
}

.thread-item-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity var(--anim-fast);
}

.thread-item:hover .thread-item-delete {
  opacity: 1;
}

.thread-item-delete:hover {
  color: var(--danger);
}

.thread-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
  padding: var(--space-3);
}

.thread-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  cursor: pointer;
  transition: all var(--anim-fast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.thread-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.thread-card.active {
  border-color: var(--primary);
  background: var(--surface-light);
}

.thread-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.thread-card-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.thread-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.thread-card-username {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-card-time {
  font-size: 0.625rem;
  color: var(--text-dim);
}

.thread-card-locked {
  color: var(--warning);
  display: flex;
  align-items: center;
}

.thread-card-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.thread-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.thread-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.thread-card-participants {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.thread-card-replies {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.thread-card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  opacity: 0;
  transition: opacity var(--anim-fast);
}

.thread-card:hover .thread-card-actions {
  opacity: 1;
}

.thread-card-join,
.thread-card-leave {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: all var(--anim-fast);
}

.thread-card-join:hover {
  color: var(--success);
  background: rgba(59, 165, 92, 0.1);
}

.thread-card-leave:hover {
  color: var(--warning);
  background: rgba(250, 166, 26, 0.1);
}

.thread-card-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  opacity: 0;
  transition: all var(--anim-fast);
}

.thread-card:hover .thread-card-delete {
  opacity: 1;
}

.thread-card-delete:hover {
  color: var(--danger);
  background: rgba(var(--danger-rgb), 0.1);
}

.thread-create {
  padding: var(--space-3);
  border-top: 1px solid var(--border);
}

.thread-create-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--surface-light);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--anim-fast);
}

.thread-create-btn:hover {
  background: var(--surface-hover);
}

.thread-create-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.thread-create-form input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
}

.thread-create-form input:focus {
  outline: none;
  border-color: var(--primary);
}

.thread-create-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

.thread-create-actions button {
  padding: var(--space-2) var(--space-3);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  cursor: pointer;
}

.thread-create-actions button:first-child {
  background: var(--surface-light);
  color: var(--text);
}

.thread-create-actions button:last-child {
  background: var(--primary);
  color: #fff;
}

.thread-create-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Thread View */
.thread-view {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.thread-view-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.thread-view-back {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
}

.thread-view-back:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.thread-view-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  min-width: 0;
}

.thread-view-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.thread-view-participants {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: var(--space-1) var(--space-2);
  background: var(--surface-light);
  border-radius: var(--radius-sm);
}

.thread-view-join,
.thread-view-leave {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--anim-fast);
}

.thread-view-join {
  background: var(--success);
  color: #fff;
}

.thread-view-join:hover {
  background: #2d8049;
}

.thread-view-leave {
  background: var(--surface-light);
  color: var(--text-dim);
}

.thread-view-leave:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.thread-view-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

/* Forum channel in channel list */

.channel-list .thread-item {
  position: relative;
  padding-left: var(--space-7);
}

.channel-list .thread-item::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
  width: 2px;
  height: 100%;
  background: var(--border);
}

.channel-list .thread-item:first-child::before {
  height: 50%;
  top: 50%;
}

.channel-list .thread-item:last-child::before {
  height: 50%;
  bottom: 50%;
  top: auto;
}

.channel-list .thread-item .thread-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.thread-item svg {
  width: 16px;
  height: 16px;
}

.thread-name {
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
