/* ================================
   FIONEKS — Vivid Dark Refresh
================================ */
:root {
  --bg-main: #040814;
  --bg-2: #060d1c;
  --bg-elevated: #0b1426;
  --bg-elevated-soft: #0f1a30;
  --bg-panel: #0e182c;
  --bg-panel-2: #111d34;
  --bg-panel-3: #0f1f3b;
  --panel: var(--bg-panel);
  --panel-2: var(--bg-panel-2);
  --panel-3: var(--bg-panel-3);
  --accent-primary: #8b7bff;
  --accent-secondary: #2de4c6;
  --accent-soft: rgba(139, 123, 255, 0.12);
  --accent-soft-strong: rgba(139, 123, 255, 0.22);
  --text-main: #e8f0ff;
  --text-muted: #9fb2d6;
  --text-subtle: #7586a6;
  --text-danger: #ff7b9f;
  --text-success: #4ade80;
  --text-warning: #f4d267;
  --stroke: #14243c;
  --stroke-2: #1e2f4d;
  --border-soft: rgba(255, 255, 255, 0.05);
  --border-strong: rgba(139, 123, 255, 0.35);
  --glass: rgba(8, 14, 26, 0.7);
  --glass-strong: rgba(10, 16, 30, 0.82);
  --glass-border: rgba(148, 163, 255, 0.2);
  --glass-border-strong: rgba(45, 228, 198, 0.3);
  --blur-lg: 18px;
  --shadow-soft: 0 12px 38px rgba(0, 0, 0, 0.42);
  --shadow-strong: 0 20px 60px rgba(0, 0, 0, 0.58);
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --rail-w: 78px;
  --left-w: 270px;
  --right-w: 300px;
  --center-max: 1240px;
  --font-xs: 12px;
  --font-sm: 13px;
  --font-md: 14px;
  --font-lg: 16px;
  --font-xl: 20px;
}

/* Accent variants */
:root[data-accent="indigo"] {
  --accent-primary: #8b7bff;
  --accent-secondary: #2de4c6;
  --accent-soft: rgba(139, 123, 255, 0.12);
  --accent-soft-strong: rgba(139, 123, 255, 0.22);
}

:root[data-accent="teal"] {
  --accent-primary: #24dfc4;
  --accent-secondary: #7cf2e2;
  --accent-soft: rgba(36, 223, 196, 0.14);
  --accent-soft-strong: rgba(36, 223, 196, 0.24);
}

:root[data-accent="amber"] {
  --accent-primary: #f7c948;
  --accent-secondary: #ffd86b;
  --accent-soft: rgba(247, 201, 72, 0.16);
  --accent-soft-strong: rgba(247, 201, 72, 0.26);
}

:root[data-accent="rose"] {
  --accent-primary: #f472b6;
  --accent-secondary: #ff9ed1;
  --accent-soft: rgba(244, 114, 182, 0.16);
  --accent-soft-strong: rgba(244, 114, 182, 0.26);
}

/* Light theme fallback */
:root[data-theme="light"] {
  --bg-main: #f5f7fb;
  --bg-2: #eef2f8;
  --bg-elevated: #ffffff;
  --bg-elevated-soft: #f8fafc;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --panel-3: #eef3fb;
  --accent-soft: rgba(109, 123, 255, 0.12);
  --accent-soft-strong: rgba(109, 123, 255, 0.2);
  --text-main: #0f172a;
  --text-muted: #4b5563;
  --text-subtle: #6b7280;
  --stroke: rgba(15, 23, 42, 0.1);
  --stroke-2: rgba(15, 23, 42, 0.18);
  --glass: rgba(255, 255, 255, 0.92);
  --glass-strong: rgba(255, 255, 255, 0.98);
  --glass-border: rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 12px 28px rgba(15, 23, 42, 0.08);
  --shadow-strong: 0 24px 48px rgba(15, 23, 42, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(139, 123, 255, 0.08), transparent 30%),
    radial-gradient(circle at 82% 0%, rgba(45, 228, 198, 0.08), transparent 26%),
    linear-gradient(140deg, #050914 0%, #060d1b 45%, #040813 100%);
  color: var(--text-main);
  font: 400 var(--font-md)/1.6 "Space Grotesk", "Inter", "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: -20%;
  background: radial-gradient(circle at 50% 40%, rgba(139, 123, 255, 0.08), transparent 35%), radial-gradient(circle at 20% 80%, rgba(45, 228, 198, 0.06), transparent 40%);
  filter: blur(28px);
  z-index: -1;
}

::selection {
  background: var(--accent-soft-strong);
  color: var(--text-main);
}

a {
  color: var(--accent-primary);
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

textarea {
  resize: vertical;
}

.hidden {
  display: none !important;
}

.mobile-only,
.tablet-only {
  display: none;
}

/* Utility */
.card {
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(var(--blur-lg));
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font-weight: 700;
  cursor: pointer;
  transition: .16s ease;
}

.pill.primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #050914;
  border-color: transparent;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4);
}

.pill.ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--stroke);
}

.pill:hover {
  border-color: var(--border-strong);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  cursor: pointer;
  transition: .16s ease;
}

.icon-btn.ghost {
  background: rgba(255, 255, 255, 0.02);
}

.icon-btn:hover {
  border-color: var(--accent-soft-strong);
  color: var(--accent-primary);
  background: linear-gradient(135deg, rgba(139, 123, 255, 0.12), rgba(45, 228, 198, 0.08));
  box-shadow: var(--shadow-soft);
}

.btn {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  cursor: pointer;
  transition: .16s ease;
  font-weight: 700;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  border-color: transparent;
  color: #050914;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.btn.danger {
  background: linear-gradient(135deg, rgba(255, 123, 159, 0.2), rgba(255, 123, 159, 0.1));
  border-color: rgba(255, 123, 159, 0.4);
  color: #ffdce7;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.02);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.divider {
  height: 1px;
  width: 100%;
  background: var(--stroke);
  opacity: .6;
}

.scroll-y {
  overflow-y: auto;
}

/* Layout */
#main {
  height: 100vh;
  width: 100vw;
  display: grid;
  grid-template-columns: var(--rail-w) var(--left-w) minmax(0, 1fr) var(--right-w);
  gap: 12px;
  padding: 12px;
  align-items: stretch;
}

#leftRail,
#left,
#center,
#right {
  min-height: calc(100vh - 24px);
}

/* Mobile shell */
.mobile-menu-btn {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 900;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(139, 123, 255, 0.16), rgba(45, 228, 198, 0.1));
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.mobile-backdrop {
  position: fixed;
  inset: 0;
  z-index: 880;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: .25s ease;
}

.mobile-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.mobile-sidebar {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 890;
  transform: translateX(-110%);
  transition: transform .28s ease, opacity .28s ease;
}

.mobile-sidebar.open {
  transform: translateX(0);
  display: block;
}

#mobileSidebarInner {
  height: 100%;
}

/* Rail */
#leftRail {
  background: linear-gradient(180deg, rgba(18, 28, 48, 0.92), rgba(8, 12, 24, 0.94));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  backdrop-filter: blur(var(--blur-lg));
  position: relative;
}

.badge-round {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #0f172a, #0b1020);
  border: 1px solid var(--stroke-2);
  color: #e3ecff;
  font-weight: 800;
  letter-spacing: .2px;
  cursor: pointer;
  transition: .16s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.badge-round::after {
  content: "";
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.14), transparent 42%);
  opacity: 0;
  transition: .2s ease;
}

.badge-round:hover {
  transform: translateY(-2px);
  border-color: var(--glass-border);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
}

.badge-round:hover::after {
  opacity: 1;
}

.badge-round.selected,
#btnFriends.active {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

#btnAddGuildRail {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px dashed var(--stroke-2);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  cursor: pointer;
  transition: .14s ease;
}

#btnAddGuildRail:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Left (channels) */
#left {
  background: linear-gradient(180deg, rgba(12, 18, 32, 0.94), rgba(8, 14, 26, 0.96));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  backdrop-filter: blur(var(--blur-lg));
}

#serverTitle {
  margin: var(--space-4) var(--space-4) var(--space-2);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  letter-spacing: .05em;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(139, 123, 255, 0.22), rgba(45, 228, 198, 0.14));
  border: 1px solid var(--glass-border-strong);
  color: var(--text-main);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

#serverTitle::after {
  content: "⋯";
  margin-left: auto;
  color: var(--text-subtle);
  font-size: var(--font-sm);
}

#currentGuildName {
  padding: 0 var(--space-4) var(--space-3);
  color: var(--text-main);
  font-weight: 900;
  letter-spacing: .08em;
}

#categoryList {
  padding: 0 var(--space-3) var(--space-4);
  overflow: auto;
}

#categoryList::-webkit-scrollbar {
  width: 10px;
}

#categoryList::-webkit-scrollbar-thumb {
  background: rgba(139, 123, 255, 0.18);
  border-radius: 10px;
  border: 2px solid transparent;
}

.category-footer {
  padding: 0 var(--space-3) var(--space-4);
  display: flex;
  justify-content: center;
}

.category-add-inline {
  width: 100%;
  max-width: 220px;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--glass-border);
  background: linear-gradient(135deg, rgba(139, 123, 255, 0.16), rgba(45, 228, 198, 0.12));
  color: var(--text-main);
  font-weight: 800;
  letter-spacing: .02em;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.category-add-inline:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.38);
  transform: translateY(-1px);
}

.cat {
  margin: var(--space-3) var(--space-1) var(--space-4);
}

.cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  text-transform: uppercase;
  font-size: var(--font-xs);
  letter-spacing: .14em;
  color: var(--text-subtle);
  border-radius: var(--radius-sm);
}

.cat-header:hover {
  background: rgba(255, 255, 255, 0.03);
}

.cat-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.cat-arrow {
  font-size: 12px;
  opacity: .8;
  transition: transform .18s ease, opacity .18s ease;
}

.cat.collapsed .cat-arrow {
  transform: rotate(-90deg);
  opacity: .6;
}

.cat-title {
  font-weight: 800;
  letter-spacing: .16em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: .8;
  transition: .12s;
}

.cat-header:hover .category-actions {
  opacity: 1;
}

.category-action {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-strong);
  color: var(--text-main);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: .16s ease;
}

.category-action:hover {
  transform: scale(1.05);
  background: var(--accent-soft-strong);
}

.cat-channels {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cat.collapsed .cat-channels {
  display: none;
}

.channel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  transition: .16s ease;
}

.channel:hover {
  background: linear-gradient(90deg, rgba(139, 123, 255, 0.12), rgba(45, 228, 198, 0.08));
  border-color: var(--accent-soft-strong);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
}

.channel.selected {
  background: linear-gradient(120deg, rgba(139, 123, 255, 0.16), rgba(45, 228, 198, 0.12));
  border-color: var(--glass-border-strong);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(139, 123, 255, 0.2);
}

.channel-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.channel-icon {
  width: 24px;
  height: 24px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke-2);
  color: var(--text-subtle);
  font-size: 12px;
}

.channel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.row-actions {
  opacity: 0;
  display: flex;
  gap: 6px;
  transition: .16s;
}

.channel:hover .row-actions,
.channel.selected .row-actions {
  opacity: 1;
}

.btn-icon {
  padding: 4px 6px;
  border-radius: 9px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: pointer;
  transition: .14s ease;
}

.btn-icon:hover {
  border-color: var(--accent-soft-strong);
  color: var(--accent-primary);
}

/* Center */
#center {
  background: linear-gradient(160deg, rgba(8, 12, 22, 0.96), rgba(10, 16, 28, 0.92));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-strong);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4) var(--space-4);
  overflow: hidden;
  min-width: 0;
  backdrop-filter: blur(var(--blur-lg));
}

.center-main {
  width: 100%;
  max-width: var(--center-max);
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 0;
}

.center-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Header */
#centerHeader {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px 14px;
  background: linear-gradient(120deg, rgba(14, 22, 40, 0.9), rgba(10, 16, 30, 0.9));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(139, 123, 255, 0.08);
  backdrop-filter: blur(var(--blur-lg));
}

.ch-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.crumbs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.crumb-guild {
  font-size: var(--font-xs);
  letter-spacing: .12em;
  color: var(--text-subtle);
}

.crumb-channel {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: var(--font-lg);
  color: var(--text-main);
}

.crumb-channel .hash {
  color: var(--text-subtle);
  font-weight: 800;
}

#currentChannelName {
  position: relative;
  font-weight: 800;
  letter-spacing: .2px;
}

#currentChannelName::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary));
  border-radius: 999px;
  transform-origin: left;
  animation: channelUnderline 3s ease-in-out infinite alternate;
}

#btnToggleLeft {
  display: none !important;
}

.center-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.accent-dots {
  display: flex;
  gap: 6px;
}

.accent-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  background: var(--accent-primary);
  cursor: pointer;
  transition: .16s;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}

.accent-dot[data-accent="teal"] {
  background: #24dfc4;
}

.accent-dot[data-accent="amber"] {
  background: #f7c948;
}

.accent-dot[data-accent="rose"] {
  background: #f472b6;
}

.accent-dot:hover {
  transform: translateY(-1px) scale(1.04);
  border-color: var(--accent-secondary);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

.accent-dot.active {
  outline: 2px solid var(--accent-secondary);
  outline-offset: 2px;
}

#btnToggleMembers {
  display: none !important;
}

/* Search */
#messageTools {
  display: flex;
  gap: 8px;
}

#messageTools input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
  color: var(--text-main);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: .14s ease;
}

#messageTools input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: rgba(255, 255, 255, 0.06);
}

/* Empty state */
#centerEmpty {
  position: relative;
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  text-align: center;
  padding: 40px 36px;
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  background: radial-gradient(circle at 30% 20%, rgba(139, 123, 255, 0.18), rgba(10, 18, 32, 0.95));
  box-shadow: var(--shadow-strong), 0 0 0 1px rgba(139, 123, 255, 0.08);
  overflow: hidden;
  isolation: isolate;
  color: var(--text-muted);
}

#centerEmpty::before {
  content: "";
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle at 30% 20%, rgba(139, 123, 255, 0.24), transparent 40%), radial-gradient(circle at 72% 60%, rgba(45, 228, 198, 0.18), transparent 38%);
  filter: blur(20px);
  opacity: .7;
  animation: heroDrift 18s ease-in-out infinite alternate;
}

#centerEmpty::after {
  content: "";
  position: absolute;
  inset: -6px;
  background: conic-gradient(from 120deg, rgba(45, 228, 198, 0.16), rgba(139, 123, 255, 0.2), rgba(45, 228, 198, 0.16));
  opacity: .5;
  filter: blur(14px);
  animation: heroSpin 16s linear infinite;
}

.ce-logo {
  width: 90px;
  height: 90px;
  border-radius: 24px;
  background: radial-gradient(circle at 30% 20%, #101827, #0a0f19);
  background-image: url("assets/logo.png");
  background-size: 70%;
  background-repeat: no-repeat;
  background-position: center;
  box-shadow: 0 15px 32px rgba(0, 0, 0, .45), 0 0 30px rgba(139, 123, 255, .2);
}

.ce-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.ce-sub {
  max-width: 520px;
  font-size: var(--font-md);
  line-height: 1.6;
  margin: 0;
  color: var(--text-muted);
}

/* Pinned */
.pinned-messages {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(125deg, rgba(15, 25, 43, 0.9), rgba(10, 18, 32, 0.92));
  box-shadow: var(--shadow-soft);
  padding: 12px 12px 10px;
  gap: 10px;
  display: flex;
  flex-direction: column;
}

.pinned-messages-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-main);
  font-weight: 800;
}

.pinned-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.pinned-list .pinned-card {
  padding: 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
  color: var(--text-main);
  font-size: var(--font-sm);
  line-height: 1.5;
}

/* Messages */
.messages-list,
#messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 14px 14px;
  overflow-y: auto;
  min-height: 0;
  background: rgba(255, 255, 255, 0.01);
}

.messages-list::-webkit-scrollbar,
#messages::-webkit-scrollbar {
  width: 12px;
}

.messages-list::-webkit-scrollbar-thumb,
#messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(139, 123, 255, 0.32), rgba(45, 228, 198, 0.28));
  border-radius: 12px;
  border: 3px solid transparent;
}

/* message card */
.message-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  border: 1px solid var(--stroke);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  transition: .16s ease;
}

.message-row:hover {
  background: linear-gradient(135deg, rgba(139, 123, 255, 0.08), rgba(45, 228, 198, 0.06));
  border-color: var(--glass-border);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
  transform: translateY(-1px);
}

.message-row.mine {
  border-color: rgba(139, 123, 255, 0.35);
}

.message-row.pending {
  opacity: .75;
  border-style: dashed;
}

.message-row.continued {
  margin-top: -4px;
  padding-top: 4px;
}

.message-row.continued .message-avatar {
  opacity: 0;
  height: 10px;
  margin-top: 4px;
}

.message-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, #1a2540, #0d1426);
  color: #dfe7ff;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--stroke-2);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, .35), 0 0 0 3px rgba(139, 123, 255, 0.08);
}

.message-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-sm);
  color: var(--text-subtle);
}

.msg-author {
  font-weight: 800;
  color: var(--text-main);
}

.msg-dot {
  color: var(--text-subtle);
}

.msg-time {
  font-size: var(--font-xs);
  color: var(--text-subtle);
}

.verify-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  margin-left: 6px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  box-sizing: border-box;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.verify-badge svg {
  width: 12px;
  height: 12px;
}

.verify-badge--on {
  background: #1da1f2;
  color: #fff;
  box-shadow: 0 0 8px rgba(29, 161, 242, .8);
}

.verify-badge--off {
  background: transparent;
  color: #64748b;
  border: 1px solid rgba(148, 163, 184, .8);
}

.verify-badge--clickable {
  cursor: pointer;
}

.verify-badge--clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 12px rgba(59, 130, 246, .9);
}

.message-content {
  font-size: var(--font-md);
  line-height: 1.65;
  color: var(--text-main);
  word-break: break-word;
}

.message-edited {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.message-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.msg-reactions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg-reaction {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-strong);
  color: var(--text-main);
  font-size: var(--font-xs);
  cursor: pointer;
  transition: .14s ease;
}

.msg-reaction:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.msg-reaction.active {
  border-color: var(--accent-primary);
  background: linear-gradient(135deg, rgba(139, 123, 255, 0.18), rgba(45, 228, 198, 0.14));
  color: #fff;
}

.message-reply {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-xs);
  color: var(--text-muted);
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--stroke);
  cursor: pointer;
}

.message-reply .reply-label {
  font-weight: 700;
  color: var(--text-subtle);
}

.message-reply .reply-author {
  font-weight: 700;
  color: var(--text-main);
}

.message-reply .reply-snippet {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-attachment {
  margin-top: 6px;
}

.message-attachment img {
  max-width: 320px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
}

.message-row.highlight {
  box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.4), 0 12px 28px rgba(0, 0, 0, 0.4);
}

.msg-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  opacity: 0;
  transition: .14s ease;
}

.message-row:hover .msg-actions {
  opacity: 1;
}

.msg-action-btn {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  cursor: pointer;
  transition: .14s ease;
  font-size: var(--font-xs);
  font-weight: 700;
}

.msg-action-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Messages – hover actions & pinned indicator */
.message-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  opacity: .15;
  pointer-events: none;
  transition: opacity .14s ease;
}

.message-row:hover .message-actions {
  opacity: 1;
  pointer-events: auto;
}

.message-actions button {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--font-xs);
  font-weight: 700;
  transition: .14s ease;
}

.message-actions button:hover {
  border-color: var(--accent-soft-strong);
  color: var(--accent-primary);
  background: linear-gradient(135deg, rgba(139, 123, 255, 0.1), rgba(45, 228, 198, 0.08));
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.message-pinned-indicator {
  margin-left: 6px;
  color: var(--accent-secondary);
  font-size: var(--font-xs);
  letter-spacing: .02em;
  text-shadow: 0 0 10px rgba(45, 228, 198, 0.35);
}

/* Mentions */
.mention-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: var(--font-xs);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--stroke);
}

.mention-user {
  background: rgba(139, 123, 255, 0.18);
  border-color: rgba(139, 123, 255, 0.3);
  color: #e9e5ff;
}

.mention-role {
  background: rgba(45, 228, 198, 0.18);
  border-color: rgba(45, 228, 198, 0.3);
  color: #d9fff8;
}

.mention-everyone {
  background: rgba(255, 123, 159, 0.16);
  border-color: rgba(255, 123, 159, 0.3);
  color: #ffe4ed;
}

.msg-badge-everyone {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--font-xs);
  background: rgba(255, 0, 80, 0.2);
  color: #ff6f9b;
  border: 1px solid rgba(255, 0, 80, 0.35);
}

/* Scroll to latest */
#scrollLatestBtn {
  position: fixed;
  right: max(18px, calc((100vw - var(--center-max))/2 + 18px));
  bottom: 110px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: linear-gradient(135deg, rgba(139, 123, 255, 0.18), rgba(45, 228, 198, 0.14));
  color: var(--text-main);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  font-weight: 800;
  display: none;
  z-index: 20;
  transition: .16s ease;
}

#scrollLatestBtn.show {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#scrollLatestBtn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-strong);
}

/* Composer */
#composer {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "preview preview" "input send";
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  background: linear-gradient(145deg, rgba(12, 18, 32, 0.92), rgba(10, 16, 30, 0.9));
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(var(--blur-lg));
}

#replyPreview {
  grid-area: preview;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--stroke);
  color: var(--text-muted);
}

#replyPreview .reply-title {
  font-weight: 800;
  color: var(--text-main);
}

#replyPreview .reply-snippet {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
}

#replyPreview .icon-btn {
  border-color: var(--stroke);
}

#composer .wrap {
  grid-area: input;
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  padding: 10px 12px 10px 40px;
  display: flex;
  align-items: center;
}

#composer .wrap::before {
  content: "➕";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: .6;
}

#msgBox {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: var(--font-md);
  line-height: 1.6;
  max-height: 280px;
}

#msgBox::placeholder {
  color: var(--text-subtle);
}

#sendBtn {
  grid-area: send;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  color: #050914;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  transition: .14s ease;
}

#sendBtn:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow: var(--shadow-strong);
}

#sendBtn:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Voice panel */
#voicePanel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#voicePanel.hidden {
  display: none;
}

.vc-shell {
  position: relative;
  border-radius: var(--radius-xl);
  padding: 18px;
  background: linear-gradient(140deg, rgba(12, 18, 32, 0.96), rgba(8, 14, 26, 0.94));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-strong);
  overflow: hidden;
  backdrop-filter: blur(var(--blur-lg));
  isolation: isolate;
}

.vc-shell::before {
  content: "";
  position: absolute;
  inset: -30%;
  background:
    radial-gradient(circle at 18% 20%, rgba(139, 123, 255, 0.18), transparent 40%),
    radial-gradient(circle at 80% 45%, rgba(45, 228, 198, 0.16), transparent 42%);
  filter: blur(24px);
  opacity: .7;
  z-index: 0;
}

.vc-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.vc-particles span {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(139, 123, 255, 0.5), rgba(45, 228, 198, 0.5));
  opacity: .18;
  animation: float 12s ease-in-out infinite alternate;
}

.vc-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--stroke);
}

.vc-title {
  font-weight: 900;
  font-size: var(--font-lg);
  display: flex;
  align-items: center;
  gap: 8px;
}

.vc-count {
  font-size: var(--font-sm);
  color: var(--text-subtle);
}

.vc-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vc-wave {
  display: inline-flex;
  gap: 3px;
  align-items: flex-end;
  height: 14px;
}

.vc-wave span {
  width: 3px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent-secondary);
  opacity: .5;
  animation: wave 1.2s ease-in-out infinite;
}

.vc-wave.active span {
  opacity: 1;
}

.vc-actions {
  display: flex;
  gap: 6px;
}

.vc-meta-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  margin: 6px 6px 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
}

.vc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
  color: var(--text-main);
  font-size: var(--font-xs);
  font-weight: 700;
}

.vc-chip .mini-icon {
  opacity: .8;
  font-size: 12px;
}

.vc-main {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
  padding: 12px 6px 0;
}

.voice-screen {
  grid-column: 1/2;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.38);
  min-height: 300px;
}

.voice-screen.empty {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.voice-screen-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.voice-screen-title {
  font-weight: 800;
  color: var(--text-main);
}

.voice-screen-full {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  cursor: pointer;
  transition: .14s ease;
}

.voice-screen-full:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.voice-screen-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.16), transparent);
  border: 1px solid var(--glass-border);
  display: grid;
  place-items: center;
  font-size: 30px;
  color: var(--text-main);
  opacity: .9;
  margin: 0 auto;
}

.voice-screen-empty-text {
  font-size: var(--font-sm);
  color: var(--text-subtle);
}

.screen-share-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.screen-share-btn {
  padding: 14px 20px;
  border-radius: 12px;
  border: 1px solid var(--accent-soft-strong);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #050914;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
  transition: .14s ease;
}

.screen-share-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-strong);
}

.voice-users {
  grid-column: 2/3;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--stroke);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
}

.voice-users-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-weight: 800;
  color: var(--text-main);
}

.voice-users-sub {
  font-size: var(--font-xs);
  color: var(--text-subtle);
}

.user-card {
  padding: 12px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: .16s ease;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}

.user-card:hover {
  transform: translateY(-1px);
  border-color: var(--glass-border);
}

.user-card.speaking {
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 1px rgba(45, 228, 198, 0.35), 0 12px 30px rgba(0, 0, 0, 0.4);
}

.user-card .avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(140deg, #1e293b, #0d1626);
  border: 1px solid var(--stroke-2);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #e8f0ff;
  position: relative;
  overflow: hidden;
}

.user-card .status-dot {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #0c1324;
  background: #4ade80;
  box-shadow: 0 0 0 6px rgba(74, 222, 128, 0.12);
}

.status-dot.status-idle {
  background: #facc15;
  box-shadow: 0 0 0 6px rgba(250, 204, 21, 0.12);
}

.status-dot.status-dnd {
  background: #f43f5e;
  box-shadow: 0 0 0 6px rgba(244, 63, 94, 0.12);
}

.status-dot.status-offline {
  background: #4b5563;
  box-shadow: 0 0 0 6px rgba(75, 85, 99, 0.12);
}

.u-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.u-name {
  font-weight: 800;
}

.u-flags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.u-flag {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke-2);
  display: grid;
  place-items: center;
}

.status-pill {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: var(--font-xs);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke);
}

.audio-bar {
  height: 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  position: relative;
}

.audio-bar span {
  display: block;
  width: 100%;
  height: 34%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  transition: height .2s ease;
}

.vd-empty {
  grid-column: 1/-1;
  text-align: center;
  color: var(--text-subtle);
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--stroke);
}

.vc-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-top: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
}

.conn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-sm);
  color: var(--text-muted);
}

.conn .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 6px rgba(74, 222, 128, 0.14);
}

.conn.ping-warn .dot {
  background: #facc15;
  box-shadow: 0 0 0 6px rgba(250, 204, 21, 0.14);
}

.conn.ping-bad .dot {
  background: #f43f5e;
  box-shadow: 0 0 0 6px rgba(244, 63, 94, 0.14);
}

/* Voice controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ctrl-btn {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  cursor: pointer;
  transition: .14s ease;
  position: relative;
  overflow: hidden;
}

.ctrl-btn.primary {
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  border-color: transparent;
  color: #050914;
}

.ctrl-btn.danger {
  background: linear-gradient(135deg, rgba(255, 123, 159, 0.18), rgba(255, 123, 159, 0.1));
  border-color: rgba(255, 123, 159, 0.4);
  color: #ffdce7;
}

.ctrl-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.4);
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  transform: scale(0);
  animation: ripple .6s ease-out;
}

/* Voice – layout & header */
.voice-layout {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  min-height: 0;
  padding: 16px 20px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--glass-border);
  background: linear-gradient(150deg, rgba(12, 18, 32, 0.95), rgba(8, 14, 26, 0.92));
  box-shadow: var(--shadow-strong);
}

.voice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 6px;
  background: linear-gradient(90deg, rgba(139, 123, 255, 0.08), rgba(0, 0, 0, 0));
  border-bottom: 1px solid var(--stroke);
  border-radius: var(--radius-md);
}

.voice-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.voice-header-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.voice-header-title small {
  font-size: var(--font-xs);
  color: var(--text-subtle);
}

.voice-header-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.voice-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke);
  font-size: var(--font-xs);
  color: var(--text-main);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.voice-body {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 14px;
  min-height: 0;
  align-items: start;
}

@media (max-width:900px) {
  .voice-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }
}

/* Voice – screen area */
.voice-screen {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.voice-screen .voice-screen-video {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: #0b1220;
  object-fit: contain;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.voice-screen-badge-live {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--font-xs);
  letter-spacing: .03em;
  text-transform: uppercase;
  background: rgba(255, 60, 80, 0.25);
  border: 1px solid rgba(255, 60, 80, 0.5);
  color: #ffdfe8;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
}

.voice-screen-stop {
  align-self: flex-start;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 123, 159, 0.5);
  background: linear-gradient(135deg, rgba(255, 123, 159, 0.2), rgba(255, 123, 159, 0.12));
  color: #ffdce7;
  cursor: pointer;
  transition: .14s ease;
}

.voice-screen-stop:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.35);
}

.voice-screen-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.voice-screen-toolbar {
  gap: 10px;
}

/* Voice – users & list */
.voice-users {
  min-height: 260px;
}

.voice-users .divider {
  opacity: .4;
}

.voice-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
  transition: .14s ease;
}

.voice-user-row:hover {
  background: linear-gradient(135deg, rgba(139, 123, 255, 0.08), rgba(45, 228, 198, 0.06));
  border-color: var(--glass-border);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32);
  transform: translateY(-1px);
}

.voice-user-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 6px rgba(74, 222, 128, 0.12);
}

.voice-user-dot.away {
  background: #f4d267;
  box-shadow: 0 0 0 6px rgba(244, 210, 103, 0.12);
}

.voice-user-dot.dnd {
  background: #f43f5e;
  box-shadow: 0 0 0 6px rgba(244, 63, 94, 0.12);
}

.voice-user-dot.offline {
  background: #4b5563;
  box-shadow: 0 0 0 6px rgba(75, 85, 99, 0.12);
}

.voice-user-name-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.voice-user-name-wrap strong {
  font-weight: 800;
  color: var(--text-main);
}

.voice-user-role {
  font-size: var(--font-xs);
  color: var(--text-subtle);
}

.voice-volume-slider {
  flex: 1;
  accent-color: var(--accent-primary);
  height: 4px;
}

/* Voice – mini list & chips */
.voice-mini-panel {
  margin: 4px 0 12px 12px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--stroke);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.voice-mini-users {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.voice-mini-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
  transition: .12s ease;
}

.voice-mini-user:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--glass-border);
}

.voice-mini-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1e2b44, #0f182a);
  color: #e8f0ff;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 1px solid var(--stroke-2);
}

.voice-mini-name {
  font-size: var(--font-sm);
  color: var(--text-main);
}

.voice-mini-empty {
  font-size: var(--font-xs);
  color: var(--text-subtle);
}

.voice-mini-action {
  margin-left: auto;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  cursor: pointer;
  transition: .12s ease;
}

.voice-mini-action:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.voice-peer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke);
  color: var(--text-main);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.28);
}

.voice-peer.off {
  opacity: .55;
}

.voice-peer.muted {
  filter: saturate(.6);
}

/* Voice – channel info bar */
.voice-channel-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
}

.voice-channel-info-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.voice-channel-info-title {
  font-weight: 800;
  color: var(--text-main);
}

.voice-channel-info-sub {
  font-size: var(--font-xs);
  color: var(--text-subtle);
}

.voice-channel-info-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.info-pill {
  font-size: var(--font-xs);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke);
}

.voice-channel-info-ping {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: var(--font-xs);
  color: var(--text-subtle);
}

.voice-channel-info-ping .ping-value {
  font-weight: 800;
  color: var(--text-main);
}

.ping-good {
  color: #4ade80;
}

.ping-warn {
  color: #f4d267;
}

.ping-bad {
  color: #f43f5e;
}

/* Voice – footer */
.voice-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.voice-footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-sm);
  color: var(--text-main);
}

.voice-footer-left-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(100, 200, 140, 0.18);
  border: 1px solid rgba(100, 200, 140, 0.35);
  display: grid;
  place-items: center;
  font-size: 11px;
}

.voice-footer-info {
  color: var(--text-main);
  font-size: var(--font-sm);
}

.voice-footer-desc {
  color: var(--text-subtle);
  font-size: var(--font-xs);
}

.voice-leave-btn,
.voice-leave {
  margin-left: auto;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 123, 159, 0.45);
  background: linear-gradient(135deg, rgba(255, 123, 159, 0.2), rgba(255, 123, 159, 0.12));
  color: #ffdce7;
  cursor: pointer;
  font-weight: 800;
  transition: .14s ease;
}

.voice-leave-btn:hover,
.voice-leave:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.35);
}

/* Right (members) */
#right {
  background: linear-gradient(180deg, rgba(12, 18, 32, 0.94), rgba(10, 16, 28, 0.96));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow: hidden;
  min-width: 0;
  backdrop-filter: blur(var(--blur-lg));
}

#memberList {
  padding: 8px 6px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#memberList::-webkit-scrollbar {
  width: 10px;
}

#memberList::-webkit-scrollbar-thumb {
  background: rgba(139, 123, 255, 0.2);
  border-radius: 10px;
  border: 2px solid transparent;
}

.member-heading {
  font-size: var(--font-xs);
  letter-spacing: .14em;
  color: var(--text-subtle);
  margin: 6px 4px;
}

.member-section-title {
  font-size: var(--font-sm);
  font-weight: 800;
  color: var(--text-main);
  margin: 8px 4px 4px;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--stroke);
  cursor: pointer;
  transition: .14s ease;
}

.member-row:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--glass-border);
}

.member-row .avatar.small {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1e2b44, #0f182a);
  color: #e8f0ff;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 1px solid var(--stroke-2);
  position: relative;
  overflow: hidden;
}

.member-row .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #0c1324;
}

.member-row .dot.online {
  background: #4ade80;
}

.member-row .dot.away {
  background: #facc15;
}

.member-row .dot.dnd {
  background: #f43f5e;
}

.member-row .dot.offline {
  background: #4b5563;
}

.member-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.member-name.role-owner {
  color: #f5d142;
}

.member-name.role-admin {
  color: #c47aff;
}

.member-name.role-mod {
  color: #42e0c4;
}

.member-roles {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.role-bubble {
  width: 22px;
  height: 22px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  border: 1px solid var(--stroke-2);
}

.role-pill {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: var(--font-xs);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke);
  color: var(--text-main);
}

/* Profile footer */
#profileFooter {
  margin-top: auto;
  border: 1px solid var(--glass-border);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(145deg, rgba(12, 18, 32, 0.94), rgba(8, 14, 26, 0.92));
  backdrop-filter: blur(var(--blur-lg));
  position: sticky;
  bottom: 10px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

#meBox {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
  cursor: pointer;
  transition: .14s ease;
  position: relative;
}

#meBox:hover {
  border-color: var(--accent-soft-strong);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

#voiceFooter {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border-radius: var(--radius-md);
  background: transparent;
  border: 0;
  box-shadow: none;
}

#voiceFooterPeers {
  display: none;
}

.voice-footer-actions {
  display: flex;
  gap: 6px;
}

.nexus-voice-controls {
  display: flex;
  gap: 6px;
}

.nexus-voice-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  cursor: pointer;
  transition: .14s ease;
}

.nexus-voice-btn svg {
  width: 13px;
  height: 13px;
  opacity: .85;
}

.nexus-voice-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.nexus-voice-btn.off {
  border-color: rgba(255, 123, 159, 0.5);
  background: rgba(255, 123, 159, 0.1);
  color: #ffdce7;
}

/* User card */
#userCard {
  padding: 12px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-soft);
}

#ucAvatar {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  background: #1b2a42 center/cover no-repeat;
  border: 1px solid var(--stroke-2);
}

#ucName {
  font-weight: 800;
  font-size: var(--font-lg);
  margin-top: 6px;
}

#ucBio {
  color: var(--text-muted);
  font-size: var(--font-sm);
}

/* Menus */
.menu {
  position: fixed;
  z-index: 1200;
  min-width: 200px;
  padding: 10px 10px 8px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: var(--shadow-strong);
  color: var(--text-main);
  display: none;
  backdrop-filter: blur(var(--blur-lg));
}

.menu .menu-item {
  padding: 8px 10px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: .12s ease;
  color: var(--text-main);
}

.menu .menu-item:hover {
  background: linear-gradient(135deg, rgba(139, 123, 255, 0.12), rgba(45, 228, 198, 0.08));
}

.menu .menu-sep {
  height: 1px;
  margin: 6px 0;
  background: var(--stroke);
}

#profileFooterMenu,
#serverMenu,
#plusMenu {
  box-shadow: var(--shadow-strong);
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
}

.modal.show {
  display: grid;
}

.modal .card {
  width: min(540px, 92vw);
  background: linear-gradient(150deg, rgba(12, 18, 32, 0.96), rgba(8, 14, 26, 0.98));
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow-strong);
  animation: pop .18s ease-out;
}

.modal .title {
  font-weight: 900;
  margin-bottom: 12px;
  font-size: var(--font-lg);
}

.modal .row {
  display: flex;
  gap: 8px;
  margin: 8px 0;
  align-items: center;
}

.modal input,
.modal select,
.modal textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font-size: var(--font-sm);
}

.modal input:focus,
.modal select:focus,
.modal textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Mobile members toggle */
.mobile-members-btn {
  display: none;
  width: 100%;
  margin: 0 var(--space-4) var(--space-2);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--stroke);
  color: var(--text-main);
  cursor: pointer;
  transition: .14s ease;
}

.mobile-members-btn .mm-icon {
  width: 26px;
  height: 26px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(139, 123, 255, 0.16), rgba(45, 228, 198, 0.12));
  border: 1px solid var(--glass-border);
  display: grid;
  place-items: center;
}

.mobile-members-btn .mm-title {
  font-weight: 800;
}

.mobile-members-btn .mm-sub {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.mobile-members-btn:hover {
  border-color: var(--accent-primary);
}

/* Mentions dropdown (for @ suggestions) */
#mention-suggestions {
  position: absolute;
  bottom: 64px;
  left: 50px;
  min-width: 220px;
  max-height: 260px;
  padding: 6px 0;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--shadow-strong);
  overflow-y: auto;
  z-index: 2000;
  backdrop-filter: blur(var(--blur-lg));
}

#mention-suggestions.hidden {
  display: none;
}

.mention-suggestion {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  font-size: var(--font-sm);
  color: var(--text-main);
}

.mention-suggestion:hover,
.mention-suggestion.is-active {
  background: linear-gradient(135deg, rgba(139, 123, 255, 0.14), rgba(45, 228, 198, 0.12));
}

.mention-suggestion .ms-name {
  font-weight: 700;
}

.mention-suggestion .ms-meta {
  font-size: var(--font-xs);
  color: var(--text-subtle);
}

/* Reaction popover */
.reaction-pop {
  position: absolute;
  z-index: 40;
  padding: 8px 10px;
  display: flex;
  gap: 6px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(var(--blur-lg));
}

.reaction-pop.hidden {
  display: none;
}

.reaction-pop button {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-radius: 10px;
  padding: 6px 8px;
  cursor: pointer;
  transition: .12s ease;
}

.reaction-pop button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-soft-strong);
}

/* Pin button */
.message-pin-action {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: 10px;
  font-size: var(--font-xs);
  cursor: pointer;
  transition: .14s ease;
}

.message-pin-action:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-soft-strong);
}

.message-pin-action[data-pinned="1"] {
  color: var(--accent-secondary);
  border-color: var(--accent-secondary);
}

/* Drag & presence states */
.nx-dragging {
  opacity: .6;
  filter: saturate(.8);
}

.nx-drag-over {
  outline: 1px dashed var(--accent-primary);
  background: rgba(139, 123, 255, 0.06);
  border-radius: var(--radius-md);
}

.online {
  color: #4ade80;
}

.away {
  color: #f4d267;
}

.dnd {
  color: #f43f5e;
}

.offline {
  color: #64748b;
}

/* Unread badges */
.unread-badge {
  display: inline-block;
  min-width: 16px;
  padding: 0 6px;
  font-size: 11px;
  line-height: 18px;
  border-radius: 9px;
  background: #d34d4d;
  color: #fff;
  text-align: center;
  margin-left: 6px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.guild-unread {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #d34d4d;
  color: #fff;
  font-size: 10px;
  line-height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px #0b1220, 0 6px 16px rgba(0, 0, 0, .35);
}

/* Responsive */
@media (max-width:1280px) {
  #main {
    grid-template-columns: var(--rail-w) var(--left-w) minmax(0, 1fr);
    grid-template-rows: 1fr;
    grid-auto-rows: 1fr;
  }

  #right {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(360px, 88vw);
    transform: translateX(110%);
    transition: transform .28s ease, opacity .28s ease;
    z-index: 850;
    border-radius: 0;
    box-shadow: var(--shadow-strong);
  }

  body.show-members #right {
    transform: translateX(0);
  }

  .tablet-only {
    display: inline-flex;
  }
}

@media (max-width:1024px) {
  #main {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }

  #leftRail {
    display: none;
  }

  #left {
    position: fixed;
    inset: 0;
    max-width: 320px;
    transform: translateX(-110%);
    z-index: 895;
    border-radius: 0;
    transition: transform .28s ease;
  }

  body.mobile-sidebar-open #left {
    transform: translateX(0);
  }

  .mobile-menu-btn {
    display: flex;
  }

  .mobile-only {
    display: inline-flex;
  }
}

/* === MOBILE PRO polish v2 === */
@media (max-width:860px) {
  #center {
    padding: 12px;
  }

  .center-actions .icon-btn {
    padding: 8px;
  }

  #composer {
    grid-template-columns: 1fr;
    grid-template-areas: "preview" "input" "send";
  }

  #sendBtn {
    width: 100%;
  }

  #centerHeader {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    background: rgba(7, 10, 18, 0.92);
    border-radius: 22px;
    border: 1px solid rgba(139, 123, 255, 0.18);
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(20px);
  }

  .crumbs {
    width: 100%;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
  }

  .crumb-guild,
  .crumb-channel,
  .crumb-channel span {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .crumb-channel {
    flex: 1;
  }

  .center-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
  }

  .center-actions>* {
    flex: none;
  }

  body.mobile-sidebar-open {
    overflow: hidden;
  }

  .mobile-backdrop {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(12px);
  }

  #centerEmpty {
    padding: 20px;
    gap: 18px;
  }

  .ce-card {
    padding: 24px 20px;
    border-radius: 26px;
    background: linear-gradient(165deg, rgba(7, 11, 19, 0.96), rgba(6, 9, 17, 0.95));
    border: 1px solid rgba(139, 123, 255, 0.12);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(139, 123, 255, 0.09);
  }

  .ce-logo {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6), 0 0 32px rgba(94, 228, 212, 0.16);
  }

  .ce-title {
    font-size: 22px;
    line-height: 1.3;
    letter-spacing: .01em;
  }

  .ce-sub {
    font-size: 14px;
    line-height: 1.65;
    color: rgba(180, 199, 225, 0.92);
  }

  .messages-list,
  #messages {
    padding-bottom: 140px;
  }

  .message-row {
    gap: 8px;
    padding: 8px 10px;
    border-radius: 18px;
    background: rgba(10, 16, 26, 0.65);
  }

  .message-row:hover {
    box-shadow: none;
    background: rgba(10, 16, 26, 0.8);
  }

  .message-avatar {
    width: 28px;
    height: 28px;
  }

  .message-body {
    gap: 4px;
  }
}

@media (max-width:640px) {
  #main {
    padding: 10px;
  }

  #centerHeader {
    flex-direction: column;
    align-items: flex-start;
  }

  .center-actions {
    width: 100%;
    justify-content: flex-start;
  }

  #messageTools input {
    padding: 12px 14px;
    border-radius: 18px;
    font-size: 13px;
  }

  #composer {
    padding: 14px 12px 10px;
    background: rgba(3, 5, 12, 0.98);
    box-shadow: 0 -12px 35px rgba(0, 0, 0, 0.7);
    border-top: 1px solid rgba(139, 123, 255, 0.14);
  }

  #composer .wrap {
    padding: 10px 12px;
    border-radius: 18px;
  }

  #msgBox {
    max-height: 170px;
    overflow-y: auto;
    font-size: 15px;
  }

  #sendBtn {
    width: 100%;
    min-height: 46px;
    border-radius: 16px;
    font-size: 14px;
  }

  .messages-list,
  #messages {
    padding-bottom: 180px;
  }
}

@media (max-width:480px) {
  #center {
    padding: 10px;
  }

  #centerHeader {
    padding: 10px 12px;
  }

  #centerEmpty {
    padding: 16px;
  }

  .ce-card {
    padding: 22px 18px;
  }

  .message-row {
    padding: 9px 8px;
  }

  #composer {
    padding: 12px 10px 8px;
  }
}

/* Keyframes */
@keyframes heroDrift {
  0% {
    transform: translate3d(-6px, -6px, 0) scale(1);
  }

  100% {
    transform: translate3d(8px, 10px, 0) scale(1.06);
  }
}

@keyframes heroSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes channelUnderline {
  0% {
    transform: scaleX(.45);
    opacity: .8;
  }

  100% {
    transform: scaleX(1);
    opacity: 1;
  }
}

@keyframes float {
  0% {
    transform: translateY(0);
  }

  100% {
    transform: translateY(-10px);
  }
}

@keyframes wave {

  0%,
  100% {
    height: 6px;
  }

  50% {
    height: 14px;
  }
}

@keyframes ripple {
  to {
    transform: scale(2.6);
    opacity: 0;
  }
}

@keyframes pop {
  from {
    transform: translateY(6px) scale(.98);
    opacity: 0;
  }

  to {
    transform: none;
    opacity: 1;
  }
}

/* Friends panel */
.friends-root {
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.friends-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.friends-title {
  font-size: var(--font-lg);
  font-weight: 800;
  color: var(--text-main);
}

.friends-subtitle {
  font-size: var(--font-sm);
  color: var(--text-subtle);
}

.friends-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.friends-toolbar .pill {
  border-color: var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

.friends-toolbar .pill.primary {
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  border-color: transparent;
  color: #050914;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
}

.friends-toolbar .pill:hover {
  border-color: var(--accent-soft-strong);
}

.friends-section {
  padding-top: 4px;
}

.friends-section-title {
  font-size: var(--font-xs);
  font-weight: 800;
  color: var(--text-subtle);
  letter-spacing: .14em;
  text-transform: uppercase;
  margin: 10px 0 6px;
}

.friends-empty {
  font-size: var(--font-sm);
  color: var(--text-subtle);
}

.friends-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.friends-dm-list {
  margin-top: 10px;
  border-top: 1px solid var(--stroke);
  padding-top: 8px;
}

/* Theme toggles (body classes) */
body.theme-teal {
  --accent-primary: #24dfc4;
  --accent-secondary: #7cf2e2;
  --accent-soft: rgba(36, 223, 196, 0.14);
  --accent-soft-strong: rgba(36, 223, 196, 0.24);
}

body.theme-amber {
  --accent-primary: #f7c948;
  --accent-secondary: #ffd86b;
  --accent-soft: rgba(247, 201, 72, 0.16);
  --accent-soft-strong: rgba(247, 201, 72, 0.26);
}

body.theme-rose {
  --accent-primary: #f472b6;
  --accent-secondary: #ff9ed1;
  --accent-soft: rgba(244, 114, 182, 0.16);
  --accent-soft-strong: rgba(244, 114, 182, 0.26);
}

body.theme-indigo {
  --accent-primary: #8b7bff;
  --accent-secondary: #2de4c6;
  --accent-soft: rgba(139, 123, 255, 0.12);
  --accent-soft-strong: rgba(139, 123, 255, 0.22);
}

body.theme-compact #center {
  padding: 12px;
}

body.theme-compact .message-row {
  padding: 10px 12px;
}

body.theme-compact .channel {
  padding: 8px 10px;
  border-radius: 12px;
}

body.theme-compact #centerHeader {
  padding: 10px 12px;
}

body.theme-compact #composer {
  padding: 10px;
  border-radius: 14px;
}

/* === MOBILE PRO polish v3 (EMPTY STATE + BUTTONS + CLEANUP) === */
@media (max-width: 480px) {

  /* 1) Empty state background softer */
  #centerEmpty {
    padding: 14px !important;
    gap: 14px !important;
  }

  /* 2) Empty card becomes more premium glass */
  .ce-card {
    padding: 22px 18px !important;
    border-radius: 22px !important;
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
    background:
      radial-gradient(circle at 20% 10%, rgba(139, 123, 255, 0.18), transparent 55%),
      radial-gradient(circle at 80% 90%, rgba(45, 228, 198, 0.12), transparent 60%),
      rgba(10, 16, 28, 0.92) !important;
    box-shadow:
      0 18px 42px rgba(0, 0, 0, 0.55),
      inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
    backdrop-filter: blur(16px) !important;
  }

  /* 3) Logo becomes an actual app icon badge */
  .ce-logo {
    width: 84px !important;
    height: 84px !important;
    border-radius: 22px !important;
    background-size: 74% !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow:
      0 14px 30px rgba(0, 0, 0, 0.48),
      0 0 24px rgba(139, 123, 255, 0.18) !important;
  }

  /* 4) Typography hierarchy */
  .ce-title {
    font-size: 22px !important;
    line-height: 1.25 !important;
    letter-spacing: .01em !important;
    margin-top: 6px !important;
  }

  .ce-sub {
    font-size: 13.5px !important;
    line-height: 1.6 !important;
    color: rgba(175, 190, 215, 0.95) !important;
    margin-top: 4px !important;
  }

  /* 5) Make welcome actions premium (buttons full width & consistent) */
  #centerEmpty .ce-card button,
  #centerEmpty .ce-card .btn,
  #centerEmpty .ce-card .pill {
    min-height: 46px !important;
    border-radius: 16px !important;
    font-weight: 800 !important;
    letter-spacing: .01em !important;
  }

  /* 6) Primary CTA full width */
  #centerEmpty .ce-card .pill.primary,
  #centerEmpty .ce-card .btn.primary {
    width: 100% !important;
    max-width: 320px !important;
    margin: 6px auto 0 !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55) !important;
  }

  /* 7) Secondary actions as clean grid */
  #centerEmpty .ce-card .welcome-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    margin-top: 12px !important;
  }

  /* 8) If actions arent inside welcome-actions, fallback */
  #centerEmpty .ce-card .ce-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    margin-top: 12px !important;
  }

  /* 9) Clean up bottom debug loading texts if visible */
  body>.loading-text,
  body>.loading-status,
  body>.loading-debug {
    display: none !important;
  }

  /* 10) Make app loading overlay text smaller & cleaner */
  .app-loading-progress-label,
  .app-loading-tip {
    font-size: 11px !important;
    opacity: .75 !important;
  }

}

/* === MOBILE PRO polish v4 (FIXED SELECTORS) === */
@media (max-width: 480px) {

  /* Empty state container tighter */
  #centerEmpty {
    padding: 18px 14px !important;
    gap: 14px !important;
    border-radius: 22px !important;
  }

  /* Premium glass background + less dirty gradient */
  #centerEmpty {
    background:
      radial-gradient(circle at 18% 12%, rgba(139, 123, 255, 0.20), transparent 55%),
      radial-gradient(circle at 82% 88%, rgba(45, 228, 198, 0.14), transparent 60%),
      rgba(8, 12, 22, 0.94) !important;
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
    box-shadow:
      0 18px 44px rgba(0, 0, 0, 0.62),
      inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(18px) !important;
  }

  /* Logo badge more meaningful */
  .ce-logo {
    width: 78px !important;
    height: 78px !important;
    border-radius: 20px !important;
    background-size: 72% !important;
    box-shadow:
      0 14px 28px rgba(0, 0, 0, 0.55),
      0 0 24px rgba(139, 123, 255, 0.16) !important;
  }

  /* Typography */
  .ce-title {
    font-size: 22px !important;
    line-height: 1.22 !important;
    letter-spacing: .01em !important;
    margin-top: 6px !important;
  }

  .ce-sub {
    font-size: 13.5px !important;
    line-height: 1.55 !important;
    color: rgba(175, 190, 215, 0.92) !important;
    margin-top: 6px !important;
    max-width: 320px !important;
  }

  /* Buttons  make them feel native & aligned */
  #centerEmpty .pill,
  #centerEmpty .btn {
    width: 100% !important;
    max-width: 340px !important;
    margin: 0 auto !important;
    min-height: 46px !important;
    border-radius: 16px !important;
    font-weight: 900 !important;
    letter-spacing: .01em !important;
  }

  /* Space between buttons */
  #centerEmpty .pill+.pill,
  #centerEmpty .btn+.btn {
    margin-top: 10px !important;
  }

  /* If there are multiple buttons in a row, stack cleanly */
  #centerEmpty .welcome-actions,
  #centerEmpty .ce-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
    align-items: center !important;
    margin-top: 14px !important;
  }

  /* Cleanup  hide bottom debug loading lines on mobile */
  body>p:last-child,
  body>div:last-child {
    display: none !important;
  }

  /* If there is a known loading text container, hide it */
  .loading-text,
  .loading-status,
  .loading-debug {
    display: none !important;
  }

}

/* ===========================================
   VISUAL CLEANUP FIXES - Loading & Socket Status
=========================================== */

/* Fix: App loading overlay proper positioning and visibility */
.app-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 20, 0.96);
  backdrop-filter: blur(14px);
}

.app-loading-overlay.visible {
  display: flex;
}

.app-loading-card {
  background: linear-gradient(145deg, rgba(15, 26, 48, 0.95), rgba(8, 14, 28, 0.98));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 32px 40px;
  box-shadow: var(--shadow-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 400px;
  width: 90%;
}

.app-loading-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-loading-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--stroke);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.app-loading-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-loading-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.app-loading-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.app-loading-progress {
  width: 100%;
}

.app-loading-progress-bar {
  height: 4px;
  background: var(--stroke);
  border-radius: 4px;
  overflow: hidden;
}

.app-loading-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  width: 0;
  transition: width 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}

.app-loading-progress-label {
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 6px;
  text-align: center;
}

.app-loading-skeletons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.loading-skeleton-line {
  height: 10px;
  background: linear-gradient(90deg, var(--stroke), var(--stroke-2), var(--stroke));
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: 4px;
  width: var(--width, 100%);
}

@keyframes skeleton-pulse {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.app-loading-tip {
  font-size: 11px;
  color: var(--text-subtle);
  text-align: center;
  display: none;
}

.app-loading-overlay.visible .app-loading-tip.show {
  display: block;
}

.app-loading-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.app-loading-btn {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.16s ease;
}

.app-loading-btn.ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke);
  color: var(--text-muted);
}

.app-loading-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Fix: Socket status pill styling */
.socket-pill {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(45, 228, 198, 0.12), rgba(139, 123, 255, 0.08));
  border: 1px solid rgba(45, 228, 198, 0.25);
  border-top: none;
  border-radius: 0 0 12px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-secondary);
  z-index: 100;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.socket-pill.visible {
  display: block;
  opacity: 1;
}

/* ===========================================
   GLOBAL: Hide any debug/loading text outside overlays
=========================================== */
body>p:not([class]),
body>div:not([id]):not([class]),
body>.loading-text,
body>.loading-status,
body>.loading-debug {
  display: none !important;
}

/* Welcome card improvements */
.welcome-card {
  background: linear-gradient(145deg, rgba(15, 26, 48, 0.95), rgba(8, 14, 28, 0.98));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 32px 40px;
  box-shadow: var(--shadow-strong);
  max-width: 480px;
  width: 90%;
  margin: 0 auto;
  text-align: center;
}

.welcome-card__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.welcome-card__logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 900;
  color: #050914;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.welcome-card__subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 6px;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}

.welcome-action {
  flex: 1 1 140px;
  max-width: 180px;
}

.welcome-continue {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--stroke);
}

.welcome-continue__btn {
  width: 100%;
}

.welcome-tips {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-subtle);
  font-style: italic;
}

.welcome-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.welcome-quick__btn {
  font-size: 12px;
  padding: 6px 12px;
}

/* Center empty state styling */
#centerEmpty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 24px;
}

#centerEmpty.hidden {
  display: none !important;
}

/* Voice footer hidden by default */
#voiceFooter {
  display: none;
}

#voiceFooter.active {
  display: flex;
}


/* ============================================
   VOICE CHANNEL PREMIUM UI - FIONEKS
   ============================================ */

/* Speaking animation keyframes */
@keyframes speakGlow {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(45, 228, 198, 0), 0 8px 24px rgba(0, 0, 0, 0.35);
  }

  50% {
    box-shadow: 0 0 20px 4px rgba(45, 228, 198, 0.5), 0 12px 32px rgba(0, 0, 0, 0.4);
  }
}

@keyframes pulseRing {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.6;
  }

  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

/* Voice Participant Grid - Premium Cards */
.voice-participants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  padding: 20px;
}

.voice-participant-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px;
  background: linear-gradient(145deg, rgba(20, 28, 48, 0.85), rgba(12, 18, 32, 0.92));
  border: 1px solid rgba(148, 163, 255, 0.15);
  border-radius: 20px;
  backdrop-filter: blur(16px);
  transition: all 0.24s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.voice-participant-card:hover {
  transform: translateY(-4px);
  border-color: rgba(148, 163, 255, 0.3);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.voice-participant-card.speaking {
  border-color: rgba(45, 228, 198, 0.6);
  animation: speakGlow 1.5s ease-in-out infinite;
}

/* Avatar container */
.voice-avatar-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 12px;
}

.voice-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e2b44, #0f182a);
  border: 3px solid rgba(148, 163, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: #e8f0ff;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.voice-participant-card.speaking .voice-avatar {
  border-color: rgba(45, 228, 198, 0.7);
}

.voice-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Speaking ring animation */
.voice-avatar-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(45, 228, 198, 0.5);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.voice-participant-card.speaking .voice-avatar-ring {
  opacity: 1;
  animation: pulseRing 1.2s ease-in-out infinite;
}

/* Participant name */
.voice-participant-name {
  font-size: 14px;
  font-weight: 700;
  color: #e8f0ff;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 8px;
}

/* Status icons bar */
.voice-status-icons {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.voice-status-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(148, 163, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #9fb2d6;
  transition: all 0.16s ease;
}

.voice-status-icon.muted {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.voice-status-icon.deafened {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

/* Screen Share Stage - Premium */
.voice-screenshare-stage {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto 24px;
  background: linear-gradient(145deg, rgba(12, 18, 32, 0.95), rgba(8, 14, 26, 0.98));
  border: 1px solid rgba(148, 163, 255, 0.2);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.voice-screenshare-stage.active {
  border-color: rgba(139, 123, 255, 0.5);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(139, 123, 255, 0.15);
}

.voice-screenshare-video {
  width: 100%;
  aspect-ratio: 16/9;
  background: #0a0f1a;
  border-radius: 16px;
}

.voice-screenshare-presenter {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.voice-screenshare-presenter-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.voice-screenshare-presenter-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.voice-screenshare-presenter-badge {
  font-size: 10px;
  padding: 3px 8px;
  background: linear-gradient(135deg, #ef4444, #f43f5e);
  border-radius: 6px;
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.voice-screenshare-controls {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.voice-screenshare-btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}

.voice-screenshare-btn.stop {
  background: linear-gradient(135deg, #ef4444, #f43f5e);
  color: #fff;
}

.voice-screenshare-btn.stop:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.35);
}

.voice-screenshare-btn.fullscreen {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.voice-screenshare-btn.fullscreen:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Mini Games Section - Premium */
.voice-minigame-section {
  background: linear-gradient(145deg, rgba(20, 28, 48, 0.8), rgba(12, 18, 32, 0.9));
  border: 1px solid rgba(148, 163, 255, 0.12);
  border-radius: 20px;
  padding: 20px;
  margin-top: 16px;
}

.voice-minigame-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.voice-minigame-title {
  font-size: 16px;
  font-weight: 800;
  color: #e8f0ff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-minigame-title-icon {
  font-size: 20px;
}

/* Game selection grid */
.voice-minigame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.voice-minigame-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 255, 0.1);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.voice-minigame-card:hover {
  background: rgba(139, 123, 255, 0.1);
  border-color: rgba(139, 123, 255, 0.3);
  transform: translateY(-3px);
}

.voice-minigame-card.selected {
  background: rgba(139, 123, 255, 0.15);
  border-color: rgba(139, 123, 255, 0.5);
  box-shadow: 0 8px 20px rgba(139, 123, 255, 0.2);
}

.voice-minigame-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.voice-minigame-name {
  font-size: 12px;
  font-weight: 700;
  color: #e8f0ff;
  text-align: center;
}

/* Start game button */
.voice-minigame-start {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  transition: all 0.2s ease;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.voice-minigame-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.45);
}

.voice-minigame-start:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Premium voice control buttons */
.voice-ctrl-premium {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 16px;
}

.voice-ctrl-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: #e8f0ff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.voice-ctrl-btn:hover {
  background: rgba(139, 123, 255, 0.12);
  border-color: rgba(139, 123, 255, 0.35);
  transform: translateY(-2px);
}

.voice-ctrl-btn.active {
  background: linear-gradient(135deg, rgba(139, 123, 255, 0.25), rgba(45, 228, 198, 0.15));
  border-color: rgba(139, 123, 255, 0.5);
}

.voice-ctrl-btn.danger {
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.voice-ctrl-btn.danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

.voice-ctrl-btn-icon {
  font-size: 18px;
}

/* Voice connection status */
.voice-connection-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 255, 0.1);
  border-radius: 14px;
  margin-bottom: 16px;
}

.voice-connection-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

.voice-connection-dot.connecting {
  background: #facc15;
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
  animation: pulseRing 1s ease-in-out infinite;
}

.voice-connection-dot.disconnected {
  background: #f43f5e;
  box-shadow: 0 0 8px rgba(244, 63, 94, 0.5);
}

.voice-connection-text {
  font-size: 13px;
  font-weight: 600;
  color: #9fb2d6;
}

.voice-connection-ping {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: #4ade80;
}

.voice-connection-ping.warn {
  color: #facc15;
}

.voice-connection-ping.bad {
  color: #f43f5e;
}

/* =========================================
   WHATSAPP STYLE MESSAGES (New)
   ========================================= */

/* ROW LAYOUT */
.message-row {
  display: flex !important;
  width: 100%;
  margin-bottom: 4px;
  padding: 0 4% !important;
  /* Side gutters */
  align-items: flex-end;
  /* Align bottom */
  position: relative;
  background: transparent !important;
  /* Remove old hover bg */
  border: none !important;
}

.message-row:hover {
  background: transparent !important;
}

/* ALIGNMENT */
.message-row.mine {
  justify-content: flex-end;
}

.message-row.theirs {
  justify-content: flex-start;
}

/* BUBBLE */
.message-bubble {
  position: relative;
  max-width: 65%;
  /* WhatsApp web width approx */
  min-width: 120px;
  padding: 6px 7px 8px 9px;
  border-radius: 7.5px;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  font-size: 14.2px;
  line-height: 19px;
  color: #e9edef;
  display: flex;
  flex-direction: column;
}

/* COLORS */
/* Mine: Dark Green */
.message-row.mine .message-bubble {
  background-color: #005c4b;
  /* WhatsApp Dark Green */
  border-top-right-radius: 0;
}

/* Theirs: Dark Gray */
.message-row.theirs .message-bubble {
  background-color: #202c33;
  /* WhatsApp Dark Gray */
  border-top-left-radius: 0;
}

/* TAILS (Optional CSS triangles) */
.message-row.mine .message-bubble::after {
  content: '';
  position: absolute;
  top: 0;
  right: -8px;
  width: 0;
  height: 0;
  border-top: 10px solid #005c4b;
  border-right: 10px solid transparent;
}

.message-row.theirs .message-bubble::after {
  content: '';
  position: absolute;
  top: 0;
  left: -8px;
  width: 0;
  height: 0;
  border-top: 10px solid #202c33;
  border-left: 10px solid transparent;
}

/* AUTHOR NAME (Theirs only) */
.message-author {
  font-size: 12.8px;
  font-weight: 500;
  line-height: 22px;
  margin-bottom: 2px;
  color: #d8687a;
  /* Fallback color */
  cursor: pointer;
}

.message-author:hover {
  text-decoration: underline;
}

/* CONTENT */
.message-content {
  word-wrap: break-word;
  white-space: pre-wrap;
  color: #e9edef;
  margin-bottom: 2px;
  /* Space for meta */
}

.message-content img {
  border-radius: 6px;
  max-width: 100%;
  display: block;
  margin-bottom: 4px;
  cursor: pointer;
}

/* META: Time + Check */
.message-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 3px;
  margin-top: -4px;
  /* Pull up into line if possible, simplified here */
  margin-left: auto;
  /* Push to right */
  opacity: 0.8;
  float: right;
  /* Allow wrapping text to flow around it if we used float */
}

/* Timestamp */
.message-time {
  font-size: 11px;
  color: rgba(241, 241, 242, 0.6);
  min-width: fit-content;
}

/* Check Icon */
.message-check {
  font-size: 14px;
  line-height: 1;
  color: rgba(241, 241, 242, 0.6);
  /* Gray check */
}

.message-check.read {
  color: #53bdeb;
  /* Blue double check */
}

/* RESET OLD STYLES */
.message-avatar {
  display: none !important;
}

/* Hide avatars */
.message-header {
  display: none !important;
}

/* Hide old header */
.msg-lines,
.msg-line {
  display: block !important;
}

/* PENDING */
.message-row.pending .message-bubble {
  opacity: 0.7;
}

/* --- FORCED WHATSAPP STYLES (Fixes & Overrides) --- */
.message-row {
  display: flex !important;
  width: 100% !important;
  margin-bottom: 2px !important;
  padding: 0 10px !important;
  box-sizing: border-box !important;
  border: none !important;
  background: transparent !important;
}

.message-row:hover {
  background: transparent !important;
}

.message-row.mine {
  justify-content: flex-end !important;
}

.message-row.theirs {
  justify-content: flex-start !important;
}

.message-bubble {
  position: relative;
  max-width: 85%;
  /* Slightly wider */
  padding: 6px 7px 8px 9px;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, .13);
  font-size: 14.2px;
  line-height: 19px;
  color: #111b21;
  display: flex;
  flex-direction: column;
}

.message-row.mine .message-bubble {
  background-color: #d9fdd3 !important;
  /* WhatsApp Green */
  border-radius: 8px 0 8px 8px !important;
}

.message-row.theirs .message-bubble {
  background-color: #ffffff !important;
  /* White */
  border-radius: 0 8px 8px 8px !important;
}

.message-content {
  word-wrap: break-word;
  white-space: pre-wrap;
  /* Ensure text is black/dark */
  color: #111b21 !important;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 2px;
  margin-left: auto;
  /* Push to right */
  font-size: 11px;
  color: rgba(0, 0, 0, 0.45);
}

.message-time {
  font-size: 11px;
  color: rgba(0, 0, 0, 0.45) !important;
}

.message-check {
  color: #53bdeb;
  font-size: 12px;
}

.message-author {
  font-size: 12.8px;
  font-weight: 500;
  line-height: 22px;
  margin-bottom: 2px;
  cursor: pointer;
}

.message-attachment img {
  border-radius: 6px;
  margin-top: 4px;
  max-width: 100%;
  cursor: pointer;
}


/* Emoji Picker */
.emoji-picker {
  position: absolute;
  background: #202225;
  border: 1px solid #3a3f46;
  border-radius: 10px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(6, 32px);
  gap: 6px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  z-index: 10050;
}

.emoji-picker button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  font-size: 18px;
  color: #fff;
}

.emoji-picker button:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* GIF Modal */
.gif-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10060;
}

.gif-modal-content {
  width: 520px;
  max-width: 92%;
  background: #2b2f36;
  border-radius: 10px;
  padding: 16px;
  color: #fff;
  max-height: 80vh;
  overflow: auto;
}

.gif-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.gif-grid img {
  width: 100%;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #3a3f46;
}

.gif-search {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.gif-search input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #3a3f46;
  background: #202225;
  color: #dcddde;
}

.gif-search button {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: #5865f2;
  color: #fff;
  cursor: pointer;
}

.gif-hint {
  font-size: 12px;
  color: #9aa0a6;
  margin-bottom: 10px;
}

.attachment-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed #3a3f46;
  margin-bottom: 8px;
}

.attachment-preview img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
}

.attachment-preview button {
  border: none;
  background: #3a3f46;
  color: #fff;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
}