:root {
  --ink: #0b0a0f;
  --paper: #f5f1ea;
  --sand: #d6cbb8;
  --clay: #b79ddc;
  --ember: #7c3aed;
  --sage: #3f2b73;
  --deep: #0f1f2e;
  --night: #0b1117;
  --card: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 255, 255, 0.16);
  --text: #eef1f5;
  --muted: rgba(238, 241, 245, 0.68);
  --glow: rgba(124, 58, 237, 0.55);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Space Grotesk", sans-serif;
  background: radial-gradient(circle at top, #1a2231 0%, #0b1117 46%, #07090c 100%);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

.bg-blobs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.blob {
  position: absolute;
  filter: blur(0px);
  opacity: 0.8;
  border-radius: 999px;
  mix-blend-mode: screen;
  animation: float 16s ease-in-out infinite;
}

.blob-a {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.8), rgba(124, 58, 237, 0));
  top: -160px;
  left: -80px;
}

.blob-b {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.8), rgba(79, 70, 229, 0));
  bottom: -220px;
  right: -120px;
  animation-delay: -5s;
}

.blob-c {
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(191, 148, 255, 0.8), rgba(191, 148, 255, 0));
  top: 35%;
  right: 15%;
  animation-delay: -9s;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 4vw 14px;
  backdrop-filter: blur(10px);
  background: rgba(11, 17, 23, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.status-banner {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-banner.ok {
  color: #c9ffe9;
  border-color: rgba(34, 201, 179, 0.6);
  background: rgba(34, 201, 179, 0.15);
}

.status-banner.bad {
  color: #ffd2d2;
  border-color: rgba(255, 92, 92, 0.5);
  background: rgba(255, 92, 92, 0.15);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-logo {
  width: 50px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.35));
}

.logo {
  font-family: "Syne", sans-serif;
  font-size: 22px;
  font-weight: 800;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--ember), var(--clay));
  color: #1a0f08;
}

.brand-title {
  font-family: "Syne", sans-serif;
  font-size: 20px;
  font-weight: 700;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--muted);
}

.cta,
.ghost,
.pill {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  border-radius: 999px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.cta {
  padding: 12px 22px;
  background: linear-gradient(135deg, var(--ember), #c4b5fd);
  color: #1a0b2e;
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.4);
}

.cta.send-btn {
  background: rgba(124, 58, 237, 0.22);
  color: #efe9ff;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.25);
  border: 1px solid rgba(124, 58, 237, 0.55);
}

.cta.send-btn:hover {
  background: rgba(124, 58, 237, 0.32);
}

.ghost {
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.pill {
  padding: 8px 14px;
  background: rgba(31, 106, 92, 0.4);
  color: var(--text);
  border: 1px solid rgba(31, 106, 92, 0.7);
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr) minmax(220px, 280px);
  grid-template-rows: auto 1fr;
  gap: 10px;
  padding: 12px 1.5vw 16px;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
}

.server-tabs {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(9, 13, 19, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
  overflow: visible;
}

.server-list {
  display: flex;
  gap: 10px;
  align-items: center;
  overflow-x: auto;
  padding: 4px 6px;
  flex: 1;
}

.server {
  height: 44px;
  min-width: 150px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  transition: transform 0.2s ease, background 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  justify-content: flex-start;
  flex: 0 0 auto;
  outline-offset: 0;
  position: relative;
  z-index: 0;
}

.server.active,
.server:hover {
  background: rgba(124, 58, 237, 0.18);
  color: #f4f0ff;
  transform: translateY(-2px);
}

.server.active {
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.6);
  border-color: rgba(124, 58, 237, 0.55);
}

.server.add {
  background: rgba(34, 201, 179, 0.18);
  border-color: rgba(34, 201, 179, 0.6);
  color: #c9ffe9;
  min-width: 0;
  box-shadow: 0 0 16px rgba(34, 201, 179, 0.35);
}

.server-plus {
  font-size: 18px;
  line-height: 1;
}

.server-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(124, 58, 237, 0.3);
  color: #efe9ff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  background-size: cover;
  background-position: center;
  flex: 0 0 auto;
}

.server-avatar.has-image {
  color: transparent;
}

.channels,
.chat,
.right-rail {
  grid-row: 2;
}

.channels,
.chat,
.right-rail {
  background: rgba(9, 13, 19, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 26px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100%;
  min-height: 0;
  overflow: hidden;
  backdrop-filter: blur(14px);
}

.channels-scroll {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
}

.members-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.right-rail .panel-header {
  justify-content: center;
  text-align: center;
}

.right-rail .panel-header > div {
  width: 100%;
}

.panel-actions {
  display: flex;
  gap: 10px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-size: 16px;
  padding: 0;
  line-height: 1;
}

#serverGearBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

.ghost.danger {
  border-color: rgba(255, 92, 92, 0.6);
  color: #ffd2d2;
  background: rgba(255, 92, 92, 0.18);
  box-shadow: none;
}

.ghost.danger:hover {
  background: rgba(255, 92, 92, 0.28);
}

.panel-header h2 {
  font-size: 18px;
  font-family: "Syne", sans-serif;
  margin-bottom: 4px;
  text-align: center;
}

.panel-header p {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  font-weight: 600;
}

.panel-block h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 12px;
}

.panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-row h3 {
  margin-bottom: 0;
}

.channel {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  justify-content: space-between;
}

.channel.dragging {
  opacity: 0.5;
}

.channel-placeholder {
  height: 38px;
  border-radius: 12px;
  border: 1px dashed rgba(124, 58, 237, 0.5);
  background: rgba(124, 58, 237, 0.12);
  margin: 2px 0;
}

.channel .channel-actions {
  display: flex;
  gap: 6px;
}

.channel-label {
  min-width: 0;
  flex: 1;
}

.voice-channel-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.voice-channel-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  font-size: 11px;
  color: rgba(226, 232, 240, 0.8);
}

.voice-channel-count svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.server-voice-indicator {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #22c9b3;
  border: 2px solid #1a1b1e;
  color: #0b0d12;
  box-shadow: 0 0 12px rgba(34, 201, 179, 0.45);
  flex-shrink: 0;
}

.server-voice-indicator svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.channel .action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
}

.admin-list .channel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-list .action {
  min-width: 120px;
  text-align: center;
  white-space: nowrap;
}

.action.reset {
  background: rgba(124, 58, 237, 0.2);
  border-color: rgba(124, 58, 237, 0.6);
  color: #c4b5fd;
  border-radius: 999px;
}

.action.delete {
  background: rgba(255, 115, 115, 0.2);
  border-color: rgba(255, 115, 115, 0.5);
  color: #ffb3b3;
  border-radius: 999px;
}

.admin-controls .ghost {
  border-radius: 999px;
}

.channel.active,
.channel:hover {
  background: rgba(255, 255, 255, 0.08);
}

.channel.active-voice {
  box-shadow: inset 0 0 0 1px rgba(34, 201, 179, 0.6);
  background: rgba(34, 201, 179, 0.12);
}

.profile-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  padding: 12px;
}

.profile-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  background: transparent;
  padding: 0;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, #c4b5fd, #7c3aed);
  border: 2px solid rgba(255, 255, 255, 0.4);
  align-self: center;
}

.avatar.has-image {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.avatar.alt {
  background: linear-gradient(135deg, #7fffd4, #1f6a5c);
}

.profile-name {
  font-weight: 600;
}

.profile-status {
  font-size: 12px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
}

.profile-status.ok {
  color: #c9ffe9;
  border-color: rgba(34, 201, 179, 0.6);
  background: rgba(34, 201, 179, 0.18);
}

.profile-status.bad {
  color: #ffd2d2;
  border-color: rgba(255, 92, 92, 0.5);
  background: rgba(255, 92, 92, 0.15);
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-block {
  margin-top: auto;
}

.profile-voice-actions {
  order: -1;
  margin-bottom: 6px;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 16px;
}

.chat-header h1 {
  font-family: "Syne", sans-serif;
  font-size: 24px;
}

.chat-header p {
  color: var(--muted);
  font-size: 14px;
}

.chat-actions {
  display: flex;
  gap: 10px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  padding-bottom: 64px;
  scroll-padding-bottom: 64px;
}

/* Modern scrollbar styling */
.messages,
.channels-scroll,
.members-scroll,
.emoji-picker,
.admin-list,
.modal-userlist,
.voice-volume {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.messages::-webkit-scrollbar,
.channels-scroll::-webkit-scrollbar,
.members-scroll::-webkit-scrollbar,
.emoji-picker::-webkit-scrollbar,
.admin-list::-webkit-scrollbar,
.modal-userlist::-webkit-scrollbar,
.voice-volume::-webkit-scrollbar {
  width: 10px;
}

.messages::-webkit-scrollbar-track,
.channels-scroll::-webkit-scrollbar-track,
.members-scroll::-webkit-scrollbar-track,
.emoji-picker::-webkit-scrollbar-track,
.admin-list::-webkit-scrollbar-track,
.modal-userlist::-webkit-scrollbar-track,
.voice-volume::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-webkit-scrollbar-thumb,
.channels-scroll::-webkit-scrollbar-thumb,
.members-scroll::-webkit-scrollbar-thumb,
.emoji-picker::-webkit-scrollbar-thumb,
.admin-list::-webkit-scrollbar-thumb,
.modal-userlist::-webkit-scrollbar-thumb,
.voice-volume::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.messages::-webkit-scrollbar-thumb:hover,
.channels-scroll::-webkit-scrollbar-thumb:hover,
.members-scroll::-webkit-scrollbar-thumb:hover,
.emoji-picker::-webkit-scrollbar-thumb:hover,
.admin-list::-webkit-scrollbar-thumb:hover,
.modal-userlist::-webkit-scrollbar-thumb:hover,
.voice-volume::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.55);
  background-clip: content-box;
}

.admin-list {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.input-shell textarea {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.input-shell textarea::-webkit-scrollbar {
  width: 10px;
}

.input-shell textarea::-webkit-scrollbar-track {
  background: transparent;
}

.input-shell textarea::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.input-shell textarea::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.55);
  background-clip: content-box;
}

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

.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.message .message-body {
  display: grid;
  gap: 8px;
  padding-left: 58px;
}

.message-actions {
  margin-top: 6px;
  display: none;
}

.attachment-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(124, 58, 237, 0.35);
  margin-bottom: 10px;
}

.attachment-preview {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.attachment-preview::-webkit-scrollbar {
  display: none;
}

.attachment-preview.hidden {
  display: none;
}

.attachment-thumb {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: visible; /* Show remove button outside */
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  flex: 0 0 auto;
  position: relative;
}

.attachment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

.attachment-remove-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background: var(--ember);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  z-index: 5;
}

.attachment-remove-btn:hover {
  background: #ff4d4d;
}

.attachment-meta {
  display: none; /* Removed for multi-attachment thumb-only style */
}

.message-actions .action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  border-radius: 10px;
  padding: 4px 10px;
  font-size: 11px;
}

.message-media-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
  width: fit-content;
  max-width: 100%;
}

.message-media {
  position: relative;
  max-width: 400px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  margin-top: 8px;
}

.message-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.message-media iframe {
  width: 100%;
  height: 220px;
  border: 0;
}

.media-expand {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 5;
}

.message-media:hover .media-expand {
  opacity: 1;
}

.message.highlight {
  padding: 12px;
  border-radius: 16px;
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(124, 58, 237, 0.25);
}

.meta {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin: 0;
}

.message-header .meta-name {
  font-weight: 700 !important;
  color: #ffffff;
  font-size: 16px !important;
}

.message-header .meta-time {
  font-weight: 600 !important;
  color: rgba(226, 232, 240, 0.8);
  font-size: 13px !important;
}

.message-body p {
  font-size: 14px !important;
}

.meta span {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}

.message p {
  line-height: 1.5;
  margin-top: 6px;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message-body > p {
  margin-top: 6px;
}

.composer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.attachments {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.attachments.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.composer-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.composer input,
.composer textarea {
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 14px;
  outline: none;
  width: 100%;
}

.composer textarea {
  resize: none;
  line-height: 1.4;
  min-height: 20px;
  max-height: 140px;
}

.composer label {
  font-size: 12px;
  color: var(--muted);
}

.input-shell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.message-actions {
  display: none;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.reaction-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
}

.reaction-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

.reaction-pill.active {
  background: rgba(124, 58, 237, 0.22);
  border-color: rgba(124, 58, 237, 0.5);
}

.reaction-bar {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.input-shell p {
  font-weight: 600;
  font-size: 14px;
}

.input-shell span {
  font-size: 12px;
  color: var(--muted);
}

.right-rail .dm-card {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 16px;
  background: transparent;
  border: 1px solid transparent;
}

.right-rail .dm-card.active,
.right-rail .dm-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.dm-name {
  font-weight: 600;
}

.admin-star {
  margin-left: 6px;
  color: #f5d76e;
  text-shadow: 0 0 8px rgba(245, 215, 110, 0.35);
}

.dm-status {
  font-size: 12px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
}

.dm-status.online {
  color: #c9ffe9;
  border-color: rgba(34, 201, 179, 0.6);
  background: rgba(34, 201, 179, 0.18);
}

.dm-status.offline {
  color: rgba(226, 232, 240, 0.7);
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.12);
}

.dm-status.header {
  border-color: transparent;
  background: transparent;
  padding: 0;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  display: block;
  width: 100%;
}

.server-member-count {
  cursor: help;
}

.modal-userlist .dm-status.header {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.members-count {
  margin: 6px auto 8px;
  font-weight: 600;
}

.section-divider {
  position: relative;
}

.section-divider::before,
.section-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
}

.section-divider::before {
  left: 0;
}

.section-divider::after {
  right: 0;
}

.dm-meta {
  min-width: 0;
}

.online-menu {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  min-width: 140px;
  grid-column: 1 / -1;
  margin-left: 64px;
  margin-top: 6px;
}

.voice-volume {
  width: 100%;
  margin-top: 8px;
  display: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #7c3aed 0%,
    #7c3aed var(--slider-fill, 0%),
    rgba(255, 255, 255, 0.18) var(--slider-fill, 0%),
    rgba(255, 255, 255, 0.18) 100%
  );
}

.voice-volume.visible {
  display: block;
}

.voice-volume::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: transparent;
}

.voice-volume::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #8b5cf6;
  border: 2px solid #1f2937;
  margin-top: -3px;
  box-shadow: 0 0 4px rgba(139, 92, 246, 0.5);
  cursor: pointer;
}

.voice-volume::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.voice-volume::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: #7c3aed;
}

.voice-volume::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #8b5cf6;
  border: 2px solid #1f2937;
  box-shadow: 0 0 4px rgba(139, 92, 246, 0.5);
  cursor: pointer;
}

.self-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  margin-left: 4px;
  vertical-align: middle;
  color: rgba(255, 255, 255, 0.6);
}

.dm-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.voice-card {
  margin-top: auto;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(22, 18, 36, 0.7));
  border: 1px solid rgba(124, 58, 237, 0.5);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.voice-actions {
  display: grid;
  grid-template-columns: repeat(4, 36px);
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  width: 100%;
  align-content: center;
}

.voice-actions > .icon-btn {
  margin-top: 0 !important;
}

.voice-actions .icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  border-radius: 12px;
  line-height: 0;
  flex: 0 0 auto;
  align-self: center;
  margin: 0;
  box-sizing: border-box;
  place-self: center;
  vertical-align: middle;
  line-height: 0 !important;
}

.voice-actions .voice-svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: #c9c2ff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  line-height: 0;
  transform: translateY(-1px);
}

.voice-actions .voice-svg .mute-slash {
  opacity: 0;
}

.voice-actions .icon-btn.is-active .voice-svg .mute-slash {
  opacity: 1;
}

.voice-actions .icon-btn.is-active {
  background: rgba(124, 92, 255, 0.25);
  border: 1px solid rgba(124, 92, 255, 0.55);
  box-shadow: 0 0 12px rgba(124, 92, 255, 0.35);
}

.voice-actions .icon-btn.is-active .voice-svg {
  stroke: #efe9ff;
}

.voice-actions .icon-btn.leave-voice {
  background: rgba(255, 92, 92, 0.2);
  border: 1px solid rgba(255, 92, 92, 0.45);
  color: #ffd2d2;
}

.voice-actions .voice-svg.danger {
  stroke: #ffd2d2;
}

.voice-members {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.voice-channel-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.voice-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(226, 232, 240, 0.85);
  font-size: 12px;
  font-weight: 600;
}

.voice-count-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(226, 232, 240, 0.7);
}

.voice-count-icon svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.voice-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.voice-member .avatar {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border-width: 1px;
}

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

.voice-member .voice-meta {
  flex: 1;
  min-width: 0;
}

.voice-member .name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.voice-status {
  display: inline-flex;
  gap: 4px;
}

.voice-status.hidden {
  display: none;
}

.status-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.85;
}

.status-muted {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c9c2ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3a3 3 0 0 1 3 3v6a3 3 0 1 1-6 0V6a3 3 0 0 1 3-3z'/><path d='M5 12a7 7 0 0 0 14 0'/><path d='M12 19v3'/><path d='M8 22h8'/><line x1='4' y1='4' x2='20' y2='20'/></svg>");
}

.status-screen {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c9c2ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='12' rx='2'/><line x1='8' y1='20' x2='16' y2='20'/><line x1='12' y1='16' x2='12' y2='20'/></svg>");
}

.status-camera {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c9c2ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='1' y='5' width='15' height='14' rx='2'/><path d='M23 7l-7 5 7 5V7z'/></svg>");
}

.voice-member.speaking .avatar {
  outline: 2px solid #38d972;
  outline-offset: 2px;
}

.video-stage {
  margin: 0 0 18px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: grid;
  gap: 10px;
}

.video-popout-placeholder {
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 15, 25, 0.65);
  display: grid;
  gap: 10px;
  text-align: center;
}

.video-popout-title {
  font-size: 16px;
  font-weight: 700;
}

.video-stage.hidden {
  display: none;
}

.video-rejoin {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(17, 24, 39, 0.6);
  border: 1px solid rgba(124, 58, 237, 0.35);
  color: rgba(255, 255, 255, 0.85);
}

.video-rejoin.hidden {
  display: none;
}

.video-stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.7);
}

.video-stage-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.video-stage-actions .icon-btn {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.video-tile {
  position: relative;
  background: #0b1117;
  border-radius: 12px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 180px;
}

.video-tile video {
  width: 100%;
  height: 100%;
  max-height: 280px;
  border-radius: 10px;
  background: #0b1117;
  object-fit: contain;
}

.video-stage:fullscreen {
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 0;
  padding: 16px;
}

.video-stage:fullscreen .video-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  height: 100%;
  align-content: stretch;
}

.video-stage:fullscreen .video-tile {
  min-height: 0;
}

.video-stage:fullscreen .video-tile video {
  max-height: 100%;
}

.video-tile-label {
  position: absolute;
  left: 14px;
  bottom: 14px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

#leaveVoiceBtn {
  margin-top: 10px;
}

#muteVoiceBtn {
  margin-top: 6px;
}

.auth {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top, #1a2231 0%, #0b1117 60%, #07090c 100%);
  z-index: 20;
  padding: 24px;
}

.auth.hidden {
  display: none;
}

.auth-card {
  width: min(420px, 100%);
  background: rgba(12, 18, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 26px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}

.auth-card h1 {
  font-family: "Syne", sans-serif;
  font-size: 28px;
}

.auth-logo {
  width: 120px;
  max-width: 100%;
  align-self: center;
  object-fit: contain;
  background: transparent;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.45));
}

.auth-card p {
  color: var(--muted);
  font-size: 14px;
}

.auth-tabs {
  display: flex;
  gap: 10px;
}

.auth-tabs .pill {
  background: rgba(34, 201, 179, 0.18);
  border: 1px solid rgba(34, 201, 179, 0.6);
  color: #c9ffe9;
  box-shadow: 0 0 16px rgba(34, 201, 179, 0.35);
  padding: 8px 16px;
}

.auth-tabs .pill:hover {
  background: rgba(34, 201, 179, 0.26);
}

.auth-tabs .pill.active {
  background: rgba(124, 58, 237, 0.22);
  border-color: rgba(124, 58, 237, 0.55);
  color: #efe9ff;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.25);
}

.auth-tabs .pill.active:hover {
  background: rgba(124, 58, 237, 0.32);
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-card form.hidden {
  display: none;
}
.auth-card input {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.auth-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: -4px;
}

.auth-card input.hidden,
.auth-card label.hidden {
  display: none !important;
}

.auth-link {
  align-self: flex-start;
}

.auth-reset,
.auth-qr {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.auth-reset.hidden,
.auth-qr.hidden {
  display: none;
}

.auth-qr img {
  width: 180px;
  height: 180px;
  align-self: center;
  border-radius: 12px;
  background: #fff;
  padding: 6px;
}

.auth-secret {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  word-break: break-all;
}

.auth-hint {
  font-size: 12px;
  color: var(--muted);
}

.shell.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 14, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 24px;
}

.modal.open {
  display: flex;
}

.modal-card {
  width: min(520px, 100%);
  background: #0c131b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 44px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.modal-card h2,
.modal-card #modalSubtitle {
  margin-left: 0;
  text-align: center;
}

.modal-install-guide {
  margin-left: 34px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.modal-install-steps {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.install-check {
  list-style: none;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
}

.install-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  border-radius: 999px;
  padding: 4px 10px;
  text-transform: uppercase;
  border: 1px solid transparent;
  width: max-content;
}

.install-badge.ok {
  color: #0b2912;
  background: rgba(52, 211, 153, 0.9);
  border-color: rgba(52, 211, 153, 0.9);
}

.install-badge.fail {
  color: #2b0b0b;
  background: rgba(248, 113, 113, 0.9);
  border-color: rgba(248, 113, 113, 0.9);
}

.install-check-text {
  display: grid;
  gap: 4px;
}

.install-check-detail {
  color: rgba(226, 232, 240, 0.6);
  font-size: 12px;
}

.install-check-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.device-save-row {
  justify-content: center;
  margin-top: 12px;
}

.device-save-btn {
  width: 100%;
  padding: 10px 18px;
  border-radius: 999px;
  justify-content: center;
  font-weight: 600;
  background: rgba(124, 58, 237, 0.22);
  border-color: rgba(124, 58, 237, 0.55);
  color: #efe9ff;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.25);
}

.device-save-btn:hover {
  background: rgba(124, 58, 237, 0.32);
}

.modal-card input {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  outline: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-actions.hidden {
  display: none;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.modal-back {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.modal-back.hidden {
  display: none;
}

.modal-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.modal-actions-grid.server-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.modal-actions-grid.emoji-picker {
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
  padding: 8px 4px;
}

.modal-actions-grid.emoji-picker .ghost {
  font-size: 24px;
  padding: 8px;
  height: 44px;
  width: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.modal-actions-grid.hidden {
  display: none;
}

.modal-actions-grid .ghost {
  width: 100%;
}

.modal-invite {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.modal-invite input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.modal-invite.hidden {
  display: none;
}

.modal-userlist {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.modal-userlist.hidden {
  display: none;
}

.composer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.composer .pill {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#attachBtn {
  background: rgba(34, 201, 179, 0.15);
  border: 1px solid rgba(34, 201, 179, 0.4);
  color: #22c9b3;
}

#emojiBtn {
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.composer .send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  flex-shrink: 0;
}

.composer .send-btn::after {
  content: "➤";
  font-size: 18px;
}

.composer-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.modal-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .modal-user {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .modal-user .left {
    width: 100%;
  }

  .modal-user .channel-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }

  .modal-user .action {
    flex: 1;
    min-width: 100px;
    text-align: center;
  }
}

.modal-user .left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-controls {
  margin-bottom: 16px;
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

.modal-user .channel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-user .action {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.modal-user .action.reset {
  background: rgba(124, 58, 237, 0.22);
  border-color: rgba(124, 58, 237, 0.55);
  color: #efe9ff;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.25);
}

.modal-user .action.reset:hover {
  background: rgba(124, 58, 237, 0.32);
}

.modal-user .action.delete {
  background: rgba(255, 92, 92, 0.2);
  border-color: rgba(255, 92, 92, 0.55);
  color: #ffd2d2;
  box-shadow: 0 6px 18px rgba(255, 92, 92, 0.2);
}

.modal-user .action.delete:hover {
  background: rgba(255, 92, 92, 0.28);
}

.modal-user.selected {
  border-color: rgba(124, 58, 237, 0.6);
  box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.4) inset;
}

.modal-invite-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-invite-actions.hidden {
  display: none;
}

.modal-user .add-member-btn {
  background: rgba(34, 201, 179, 0.18);
  border: 1px solid rgba(34, 201, 179, 0.6);
  color: #c9ffe9;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 600;
  box-shadow: 0 0 16px rgba(34, 201, 179, 0.35);
}

.modal-user .add-member-btn:hover {
  background: rgba(34, 201, 179, 0.26);
}
.modal-image {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.modal-image.hidden {
  display: none;
}

.device-settings {
  display: grid;
  gap: 12px;
}

.device-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.device-tabs .pill {
  padding: 8px 14px;
}

.device-pane {
  display: none;
  gap: 12px;
}

.device-pane.active {
  display: grid;
}

.device-settings .device-row {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.device-gate-slider {
  position: relative;
  display: grid;
  gap: 10px;
}

.device-gate-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(
    90deg,
    rgba(239, 68, 68, 0.45) 0%,
    rgba(239, 68, 68, 0.45) var(--gate-threshold, 50%),
    rgba(34, 197, 94, 0.4) var(--gate-threshold, 50%),
    rgba(34, 197, 94, 0.4) 100%
  );
}

.device-gate-level {
  position: absolute;
  inset: 0;
  width: 0;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 rgba(34, 197, 94, 0);
  transition: box-shadow 0.2s ease;
}

.device-gate-label {
  font-size: 12px;
  color: rgba(226, 232, 240, 0.7);
}

.device-gate-level.active {
  background: rgba(34, 197, 94, 0.45);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.9);
}

.device-gate-slider .device-slider {
  width: 100%;
}

.device-settings select {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  outline: none;
}

.device-slider {
  width: 100%;
  appearance: none;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #7c3aed 0%,
    #7c3aed var(--slider-fill, 0%),
    rgba(255, 255, 255, 0.18) var(--slider-fill, 0%),
    rgba(255, 255, 255, 0.18) 100%
  );
}

.device-slider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: transparent;
}

.device-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #8b5cf6;
  border: 2px solid #1f2937;
  margin-top: -4px;
  box-shadow: 0 0 6px rgba(139, 92, 246, 0.5);
}

.device-slider::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.device-slider::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: #7c3aed;
}

.device-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #8b5cf6;
  border: 2px solid #1f2937;
  box-shadow: 0 0 6px rgba(139, 92, 246, 0.5);
}

.device-value {
  font-size: 12px;
  color: rgba(226, 232, 240, 0.7);
  margin-top: -4px;
  text-align: right;
}

.device-settings option {
  background: #0c131b;
  color: var(--text);
}

.device-test-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.device-test-row .ghost {
  width: 100%;
}

.device-meter {
  flex: 1;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.device-meter span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c9b3, #7c3aed);
  border-radius: 999px;
  transition: width 0.08s ease;
}

.device-preview {
  width: 100%;
  margin-top: 10px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.cropper-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 18, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

.cropper-card {
  width: min(420px, 92vw);
  background: #0c131b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 18px;
  display: grid;
  gap: 12px;
}

.cropper-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cropper-canvas {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.cropper-controls {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.toast-host {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: grid;
  gap: 10px;
  z-index: 70;
}

.toast {
  background: rgba(18, 22, 32, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 14px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.exit {
  opacity: 0;
  transform: translateY(8px);
}

.device-note {
  color: var(--muted);
  font-size: 0.85rem;
}

#modalImagePreview {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  object-fit: cover;
  display: none;
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 70px minmax(180px, 230px) minmax(0, 1fr);
  }

  .right-rail {
    display: none;
  }
}

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(12, 18, 26, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  justify-content: space-around;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px;
  transition: all 0.2s ease;
}

.nav-item svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

.nav-item.active {
  color: #a78bfa;
}

.nav-item.active svg {
  stroke: #a78bfa;
  filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.5));
}

@media (max-width: 768px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    padding: 0;
    gap: 0;
    height: calc(100dvh - 64px);
    overflow: hidden;
    width: 100%;
  }

  .mobile-nav {
    display: flex;
  }

  .server-tabs {
    grid-column: 1;
    grid-row: 1;
    padding: 12px 0; /* Vertical padding only to contain the bar */
    border-radius: 0;
    background: rgba(11, 17, 23, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 110;
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .server-list {
    display: flex;
    /* Put horizontal padding here so shadows have room but don't get clipped by the scroll viewport */
    padding: 8px 16px;
    gap: 12px;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1;
    align-items: center;
  }

  .server-list::-webkit-scrollbar {
    display: none;
  }

  .server {
    min-width: 48px;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible; /* Show glow/shadows */
    position: relative;
    border: none;
    background: rgba(255, 255, 255, 0.03); /* Faint background for empty servers */
  }

  .server.active {
    border-radius: 14px;
    background: transparent; /* Fix background bleed */
    /* Use box-shadow for both border and glow */
    box-shadow: 0 0 0 2px #a78bfa, 0 0 15px rgba(167, 139, 250, 0.5);
    border: none;
    z-index: 2; /* Ensure active server glow stays above neighbors */
  }

  .server-voice-indicator {
    position: absolute;
    bottom: -4px;
    right: -4px;
    margin-left: 0;
    z-index: 10;
    width: 18px;
    height: 18px;
    box-shadow: 0 0 8px rgba(34, 201, 179, 0.6);
    border-color: #0b0d12; /* Darker border for mobile icons */
  }

  .server-voice-indicator svg {
    width: 10px;
    height: 10px;
  }

  .server-avatar {
    width: 100% !important;
    height: 100% !important;
    border-radius: inherit;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    margin: 0 !important;
    overflow: hidden; /* Ensure avatar clips to rounded shape */
  }

  .server.add {
    min-width: 48px;
    width: 48px;
    height: 48px;
    margin: 0 16px 0 0; /* Add right margin to balance the list's left padding */
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(34, 201, 179, 0.15);
    border-radius: 14px;
    box-shadow: 0 0 0 2px rgba(34, 201, 179, 0.5), 0 0 15px rgba(34, 201, 179, 0.3);
    color: #22c9b3;
  }

  .server-title {
    display: none !important;
  }

  .channels, .chat, .right-rail {
    display: none;
    grid-column: 1;
    grid-row: 2;
    padding: 20px 16px 16px;
    border-radius: 0;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    background: transparent;
  }

  .channels.active-tab, .chat.active-tab, .right-rail.active-tab {
    display: flex;
    flex-direction: column;
  }

  .channels-scroll {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 12px;
  }

  .chat-header {
    padding: 0 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    width: 100%;
  }

  .chat-header h1 {
    font-size: 1.4rem;
    font-family: "Syne", sans-serif;
  }

  .messages {
    flex: 1;
    overflow-y: auto;
    width: 100%;
  }

  .composer {
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(20, 26, 35, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 999px;
    z-index: 10;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .composer .pill {
    width: 36px;
    height: 36px;
    border-radius: 50%;
  }

  #sendBtn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
  }

  .right-rail {
    padding-top: 24px;
  }

  .right-rail .panel-header {
    margin-bottom: 20px;
  }

  .members-scroll {
    flex: 1;
    overflow-y: auto;
  }

  /* Fix glitched settings menu */
  .modal-card {
    padding: 40px 16px 20px;
    gap: 20px;
    max-height: 85vh;
    overflow-y: auto;
  }

  .modal-actions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .modal-actions-grid .ghost {
    padding: 12px 8px;
    font-size: 13px;
    height: auto;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  /* Member list cleanup */
  .dm-card {
    padding: 12px;
    border-radius: 16px;
  }

  .dm-card .avatar {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  .message p {
    font-size: 14px;
    line-height: 1.4;
  }
}
.message .message-actions {
  display: none;
}

.message.show-actions .message-actions {
  display: flex;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 14, 0.85);
  display: grid;
  place-items: center;
  z-index: 80;
  padding: 24px;
}

.image-lightbox img {
  max-width: 92vw;
  max-height: 86vh;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.image-lightbox .close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(17, 24, 39, 0.85);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
}
