: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);
}

.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;
}

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

.server.active {
  box-shadow: 0 0 0 2px #22c9b3;
}

.server.add {
  background: rgba(31, 106, 92, 0.6);
  min-width: 190px;
}

.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);
}

.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, 115, 115, 0.4);
  color: #ffb3b3;
}

.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 .channel-actions {
  display: flex;
  gap: 6px;
}

.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);
}

.profile-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  padding: 12px;
}

.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;
}

.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 {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.messages::-webkit-scrollbar {
  width: 10px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-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 {
  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;
}

.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 {
  margin-top: 8px;
  max-width: 340px;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
}

.message-media img {
  width: 100%;
  display: block;
}

.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;
}

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

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

.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%;
}

.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;
}

.online-menu.hidden {
  display: none;
}

.online-volume {
  width: 140px;
}

.online-mute {
  border-radius: 999px;
  font-size: 12px;
  padding: 6px 12px;
  text-align: center;
}

.online-menu .online-volume:disabled,
.online-menu .online-mute:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.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-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 .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.active {
  background: rgba(124, 58, 237, 0.55);
  border-color: rgba(124, 58, 237, 0.9);
}

.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;
}

.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.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;
}

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

.modal-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.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-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;
}

.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-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%;
}

.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-tests {
  display: grid;
  gap: 12px;
}

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

.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;
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .servers {
    flex-direction: row;
    justify-content: space-between;
  }

  .server-list {
    flex-direction: row;
  }

  .channels {
    order: 2;
  }

  .chat {
    order: 1;
  }
}

@media (max-width: 600px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .chat-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .composer {
    flex-direction: column;
    align-items: flex-start;
  }
}
.message .message-actions {
  display: none;
}

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

.media-expand {
  position: absolute;
  right: 10px;
  top: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 12, 18, 0.7);
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
}

.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;
}
