/* ============================
   VORTEX - ULTIMATE UI STYLES
   VORTEX ARCHITECTURAL SPEC
   ============================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

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

:root {
  /* VORTEX Core Palette */
  --bg-main:        #0a0514;
  --bg-sidebar-deep:#05020a;
  --bg-sidebar-sec: #0d071a;
  --bg-chat:        #11091f;
  --bg-secondary:   #130a20;
  --bg-tertiary:    #1a1129;
  --bg-hover:       #1f1535;
  --bg-active:      #271a3d;

  /* Legacy vars (mapped to VORTEX palette) */
  --bg-primary:     #0a0514;

  /* Accent Colors */
  --accent:         #8b5cf6;
  --accent-hover:   #7c3aed;
  --accent-light:   #a78bfa;
  --neon-green:     #22c55e;
  --rose:           #f43f5e;
  --accent-blue:    #6366f1;

  /* Legacy color vars */
  --green:          #22c55e;
  --red:            #f43f5e;
  --yellow:         #f59e0b;

  /* Text */
  --text-primary:   #f1f0ff;
  --text-secondary: #c4b5fd;
  --text-muted:     #6b5a8e;

  /* Borders - glass separation */
  --border:         rgba(255, 255, 255, 0.05);
  --border-accent:  rgba(139, 92, 246, 0.35);

  /* Spacing & Shape */
  --server-rail-width: 72px;
  --sidebar-width:     240px;
  --voice-panel-width: 240px;
  --members-width:     220px;
  --radius:            8px;
  --radius-lg:         16px;
  --radius-xl:         24px;

  /* Shadows & Glow */
  --shadow:         0 8px 32px rgba(0, 0, 0, 0.6);
  --glow-purple:    0 0 30px rgba(139, 92, 246, 0.4);
  --glow-green:     0 0 20px rgba(34, 197, 94, 0.4);

  /* Animation Speed */
  --transition-speed: 0.2s;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.4); }

/* ============================
   LOADING SCREEN
   ============================ */
.vortex-loader {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #1a0a2e 0%, #0a0514 70%);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.vortex-loader.fade-out { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-content { text-align: center; }
.loader-logo { margin-bottom: 24px; }
.logo-spin {
  animation: logoSpin 3s linear infinite, logoPulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.7));
}
@keyframes logoSpin { to { transform: rotate(360deg); } }
@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 15px rgba(139,92,246,0.4)); }
  50% { filter: drop-shadow(0 0 35px rgba(139,92,246,0.9)); }
}
.loader-title {
  font-size: 32px; font-weight: 800; letter-spacing: 8px;
  background: linear-gradient(135deg, #a78bfa, #8b5cf6, #6366f1);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 8px;
}
.loader-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }
.loader-bar { width: 200px; height: 3px; background: rgba(139,92,246,0.15); border-radius: 2px; margin: 0 auto; overflow: hidden; }
.loader-bar-fill { height: 100%; background: linear-gradient(90deg, #8b5cf6, #6366f1, #a78bfa); border-radius: 2px; animation: barLoad 2s ease-in-out infinite; }
@keyframes barLoad { 0% { width: 0; margin-left: 0; } 50% { width: 60%; } 100% { width: 0; margin-left: 100%; } }

/* Page transition */
.page-transition { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ============================
   AUTH PAGES
   ============================ */
.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 20% 50%, rgba(139,92,246,0.12) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(99,102,241,0.08) 0%, transparent 50%),
              var(--bg-main);
  padding: 20px; overflow-y: auto;
}
.auth-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow); overflow: hidden;
  display: flex; width: 100%; max-width: 900px; min-height: 540px;
}
.auth-panel-left {
  flex: 0 0 42%; padding: 48px 40px;
  background: linear-gradient(135deg, rgba(139,92,246,0.12), rgba(99,102,241,0.06));
  display: flex; flex-direction: column; justify-content: center;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 40px; }
.auth-brand-icon svg { filter: drop-shadow(0 0 14px rgba(139,92,246,0.8)); }
.auth-brand-name {
  font-size: 28px; font-weight: 900; letter-spacing: 4px;
  background: linear-gradient(135deg, #a78bfa, #8b5cf6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.auth-tagline { font-size: 22px; font-weight: 700; color: var(--text-primary); margin-bottom: 12px; }
.auth-desc { color: var(--text-secondary); font-size: 14px; line-height: 1.7; margin-bottom: 32px; }
.auth-features { list-style: none; }
.auth-features li {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-secondary); font-size: 13px; margin-bottom: 10px;
}
.auth-features li::before {
  content: ''; width: 6px; height: 6px;
  background: var(--accent-light); border-radius: 50%; flex-shrink: 0;
}
.auth-panel-right {
  flex: 1; padding: 40px 48px;
  display: flex; flex-direction: column; justify-content: center; overflow-y: auto;
}
.auth-form-title { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.auth-form-subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: 28px; }
.auth-field { margin-bottom: 16px; }
.auth-field label {
  display: block; font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px;
}
.auth-field input {
  width: 100%; padding: 11px 14px;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
  font-size: 14px; outline: none; transition: border-color var(--transition-speed);
  font-family: inherit;
}
.auth-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(139,92,246,0.15); }
.auth-field .input-wrap { position: relative; }
.auth-field .pw-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px;
}
.auth-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pw-strength { height: 4px; border-radius: 2px; background: var(--bg-active); margin-top: 6px; overflow: hidden; }
.pw-strength-bar { height: 100%; border-radius: 2px; transition: width 0.3s, background 0.3s; }
.auth-btn {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-blue));
  border: none; border-radius: var(--radius); color: white;
  font-size: 15px; font-weight: 700; cursor: pointer;
  transition: opacity var(--transition-speed), transform 0.1s; margin-top: 8px;
  font-family: inherit;
}
.auth-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.auth-btn:active { transform: scale(0.99); }
.auth-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-switch { text-align: center; margin-top: 16px; color: var(--text-secondary); font-size: 13px; }
.auth-switch a { color: var(--accent-light); text-decoration: none; font-weight: 600; cursor: pointer; }
.auth-switch a:hover { text-decoration: underline; }
.auth-error {
  background: rgba(244,63,94,0.1); border: 1px solid rgba(244,63,94,0.3);
  color: #fda4af; padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 16px; display: none;
}
.auth-success {
  background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3);
  color: #86efac; padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 16px; display: none;
}
.auth-error.show, .auth-success.show { display: block; }

/* ============================
   MAIN APP LAYOUT — TRIPLE PANE
   ============================ */
.app-layout {
  display: flex; height: 100vh; overflow: hidden;
  background: var(--bg-main);
}

/* ============================
   PANE 1: SERVER RAIL (Left)
   ============================ */
.server-rail {
  width: var(--server-rail-width);
  background: var(--bg-sidebar-deep);
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; gap: 4px; overflow-y: auto; flex-shrink: 0;
  border-right: 1px solid var(--border);
}

/* Main Logo/Home Icon with permanent glow */
.server-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: border-radius 0.2s cubic-bezier(0.4,0,0.2,1), background var(--transition-speed), box-shadow var(--transition-speed);
  position: relative; font-size: 16px; font-weight: 700;
  color: var(--text-primary); flex-shrink: 0; overflow: hidden;
}
.server-icon:hover {
  border-radius: var(--radius-lg);
  background: var(--accent);
  box-shadow: var(--glow-purple);
}
.server-icon.active {
  border-radius: var(--radius-lg);
  background: var(--accent);
  box-shadow: var(--glow-purple);
}
.server-icon.home-icon {
  background: linear-gradient(135deg, var(--accent), var(--accent-blue));
  box-shadow: 0 0 16px rgba(139,92,246,0.5);
}
.server-icon.home-icon:hover {
  box-shadow: 0 0 28px rgba(139,92,246,0.7);
}
.server-icon img { width: 100%; height: 100%; object-fit: cover; }
.server-icon .badge {
  position: absolute; bottom: -2px; right: -2px;
  background: var(--rose); color: white; border-radius: 10px;
  font-size: 10px; font-weight: 700; padding: 1px 5px;
  border: 2px solid var(--bg-sidebar-deep);
}
.server-rail-divider { width: 32px; height: 1px; background: var(--border); margin: 4px 0; }
.server-add-btn {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--bg-tertiary); border: 2px dashed rgba(34,197,94,0.3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted); font-size: 20px;
  transition: all var(--transition-speed);
}
.server-add-btn:hover {
  border-color: var(--neon-green); color: var(--neon-green);
  border-radius: var(--radius-lg); background: rgba(34,197,94,0.08);
  box-shadow: 0 0 16px rgba(34,197,94,0.2);
}

/* ============================
   PANE 2: CHANNEL / DM SIDEBAR
   ============================ */
.channel-sidebar, .dm-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar-sec);
  display: flex; flex-direction: column; flex-shrink: 0;
  border-right: 1px solid var(--border);
}
.sidebar-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-header-title { font-size: 15px; font-weight: 800; color: var(--text-primary); }
.sidebar-header-actions { display: flex; gap: 6px; }

.icon-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 4px; border-radius: 4px; font-size: 16px;
  transition: color var(--transition-speed);
}
.icon-btn:hover { color: var(--text-primary); }

.channel-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.channel-section { margin-bottom: 4px; }
.channel-section-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 8px 4px 16px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted); cursor: pointer;
}
.channel-section-title:hover { color: var(--text-secondary); }
.channel-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 8px 8px 14px; cursor: pointer;
  border-radius: var(--radius); margin: 0 8px;
  color: var(--text-secondary); font-size: 15px;
  transition: background var(--transition-speed), color var(--transition-speed);
}
.channel-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.channel-item.active {
  background: rgba(139,92,246,0.2);
  color: var(--text-primary);
}
.channel-item .ch-icon { color: var(--text-muted); font-size: 14px; }
.channel-item.active .ch-icon { color: var(--accent-light); }

/* Voice channel users in sidebar */
.voice-channel-users { padding: 0 8px 4px 28px; }
.voice-user {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 6px; border-radius: 4px;
  font-size: 13px; color: var(--text-secondary); cursor: pointer;
}
.voice-user:hover { background: var(--bg-hover); color: var(--text-primary); }
.voice-user-freq {
  display: flex; align-items: center; gap: 2px; margin-left: auto;
}
.voice-user-freq .bar {
  width: 3px; background: var(--neon-green); border-radius: 2px;
  animation: freqBounce 0.8s ease-in-out infinite;
}
.voice-user-freq .bar:nth-child(1) { height: 6px; animation-delay: 0s; }
.voice-user-freq .bar:nth-child(2) { height: 10px; animation-delay: 0.15s; }
.voice-user-freq .bar:nth-child(3) { height: 7px; animation-delay: 0.3s; }
@keyframes freqBounce {
  0%, 100% { transform: scaleY(0.5); opacity: 0.6; }
  50% { transform: scaleY(1.3); opacity: 1; }
}

/* User Panel */
.user-panel {
  display: none; /* Hidden from sidebar — now in bottom-right corner */
}
.user-panel-info { flex: 1; min-width: 0; }
.user-panel-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-panel-status { font-size: 11px; color: var(--text-muted); }
.user-panel-actions { display: flex; gap: 4px; }

/* ── Profile Corner Widget (bottom-right) ── */
#profile-corner-widget {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 190;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(13,7,26,0.97) 0%, rgba(26,17,41,0.97) 100%);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 50px;
  padding: 8px 12px 8px 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55), 0 0 20px rgba(139,92,246,0.15);
  backdrop-filter: blur(12px);
  cursor: default;
  transition: box-shadow 0.25s, transform 0.25s, border-color 0.25s;
  min-width: 160px;
  max-width: 220px;
}

#profile-corner-widget:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.7), 0 0 30px rgba(139,92,246,0.3);
  border-color: rgba(139,92,246,0.55);
  transform: translateY(-2px);
}

#profile-corner-widget .pcw-avatar {
  flex-shrink: 0;
  position: relative;
}

#profile-corner-widget .pcw-avatar .avatar-status-dot {
  position: absolute;
  bottom: -1px; right: -1px;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(13,7,26,0.97);
}

#profile-corner-widget .pcw-info {
  flex: 1;
  min-width: 0;
}

#profile-corner-widget .pcw-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#profile-corner-widget .pcw-username {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#profile-corner-widget .pcw-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

#profile-corner-widget .pcw-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px 6px;
  border-radius: 6px;
  font-size: 14px;
  transition: color 0.2s, background 0.2s;
  font-family: inherit;
}

#profile-corner-widget .pcw-btn:hover {
  color: var(--text-primary);
  background: rgba(139,92,246,0.12);
}

#profile-corner-widget .pcw-btn.pcw-logout:hover {
  color: var(--rose);
  background: rgba(244,63,94,0.1);
}

/* Mobile: hide desktop profile corner widget — mobile nav has Profile button */
body.is-mobile #profile-corner-widget {
  display: none !important;
}

/* Status dot colors */
.pcw-status-online { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.6); }
.pcw-status-away { background: #f59e0b; }
.pcw-status-busy { background: #ef4444; }
.pcw-status-offline { background: #6b7280; }

/* DM Section Header */
.dm-section-header {
  display: flex;
  align-items: center;
  padding: 8px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  user-select: none;
}

.dm-list { flex: 1; overflow-y: auto; }
.dm-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; cursor: pointer;
  border-radius: var(--radius); margin: 0 8px;
  transition: background var(--transition-speed);
}
.dm-item:hover { background: var(--bg-hover); }
.dm-item.active { background: var(--bg-active); }
.dm-item-info { flex: 1; min-width: 0; }
.dm-item-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-item-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-create-group {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  cursor: pointer; color: var(--text-secondary); font-size: 13px;
  border-top: 1px solid var(--border);
  margin-bottom: 4px;
}
.dm-create-group:hover { color: var(--neon-green); }

/* Search Bar */
.search-bar-wrap { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.search-bar-inner { position: relative; }
.search-input {
  width: 100%; padding: 7px 12px 7px 32px;
  background: rgba(0,0,0,0.3); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
  font-size: 13px; outline: none; font-family: inherit;
}
.search-input:focus { border-color: var(--accent); }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 12px; }
.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); z-index: 100;
  max-height: 300px; overflow-y: auto;
}
.search-result-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.search-result-item:hover { background: var(--bg-hover); }
.search-result-name { font-size: 14px; font-weight: 600; }
.search-result-sub { font-size: 12px; color: var(--text-muted); }

/* ============================
   PANE 3: CHAT AREA (Center)
   ============================ */
.chat-area {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-width: 0;
  background: var(--bg-chat);
}
.chat-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  background: rgba(0,0,0,0.2); flex-shrink: 0;
  backdrop-filter: blur(4px);
}
.chat-header-icon { color: var(--text-muted); font-size: 18px; }
.chat-header-name { font-size: 16px; font-weight: 800; }
.chat-header-desc { font-size: 13px; color: var(--text-secondary); margin-left: 8px; }
.chat-header-actions { margin-left: auto; display: flex; gap: 8px; }

/* Messages */
.messages-container {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 2px;
}
.message-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 3px 8px; border-radius: var(--radius);
  transition: background var(--transition-speed);
}
.message-row:hover { background: rgba(139,92,246,0.04); }
.message-content { flex: 1; min-width: 0; }
.message-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.message-author {
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: opacity 0.15s;
}
.message-author:hover { opacity: 0.8; text-decoration: underline; }
.message-time { font-size: 10px; color: var(--text-muted); }
.message-text {
  color: var(--text-primary); font-size: 14px;
  line-height: 1.55; word-break: break-word;
}
.message-text.edited::after {
  content: ' (edited)'; color: var(--text-muted); font-size: 11px;
}
.message-actions { opacity: 0; display: flex; gap: 4px; margin-left: auto; }
.message-row:hover .message-actions { opacity: 1; }
.message-action-btn {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text-muted); cursor: pointer;
  padding: 3px 7px; font-size: 12px;
}
.message-action-btn:hover { color: var(--rose); border-color: var(--rose); }

/* Typing Indicator */
.typing-indicator {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; color: var(--text-muted); font-size: 12px;
}
.typing-dots { display: flex; gap: 4px; }
.typing-dots span {
  width: 6px; height: 6px; background: var(--accent-light);
  border-radius: 50%; animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Chat Input Area - VORTEX spec */
.chat-input-area { padding: 8px 16px 16px; flex-shrink: 0; }
.chat-input-wrap {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 8px 12px;
  transition: border-color var(--transition-speed);
}
.chat-input-wrap:focus-within { border-color: var(--border-accent); }
.chat-input-icons { display: flex; gap: 4px; }
.chat-input-icon {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 4px 5px; font-size: 16px; border-radius: 4px;
  transition: color var(--transition-speed);
}
.chat-input-icon:hover { color: var(--text-secondary); }
.chat-input {
  flex: 1; background: none; border: none;
  color: var(--text-primary); font-size: 14px; outline: none;
  resize: none; max-height: 120px; min-height: 24px;
  font-family: inherit; line-height: 1.5;
}
.chat-input::placeholder { color: var(--text-muted); }
.send-btn {
  background: none; border: none; cursor: pointer;
  padding: 5px 8px; font-size: 16px; border-radius: 6px;
  color: var(--text-muted); transition: color var(--transition-speed);
  flex-shrink: 0;
}
.send-btn.has-content { color: var(--accent); }
.send-btn:hover.has-content { color: var(--accent-light); }

/* Welcome Screen */
.welcome-screen {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 40px; color: var(--text-secondary);
}
.welcome-screen h2 { font-size: 24px; font-weight: 800; color: var(--text-primary); margin-bottom: 8px; }
.welcome-screen p { max-width: 360px; }

/* ============================
   PANE 4: MEMBERS / VOICE PANEL (Right)
   ============================ */
.members-sidebar {
  width: var(--members-width);
  background: var(--bg-sidebar-sec);
  border-left: 1px solid var(--border);
  overflow-y: auto; padding: 16px 8px; flex-shrink: 0;
}
.members-section-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted);
  padding: 8px 8px 4px; margin-bottom: 4px;
}
.member-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: var(--radius);
  cursor: pointer; color: var(--text-secondary);
  transition: all var(--transition-speed);
}
.member-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.member-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-tag { font-size: 11px; color: var(--text-muted); }

/* VOICE ACTIVE SIDEBAR — fixed 240px dedicated panel */
.voice-active-panel {
  width: var(--voice-panel-width);
  background: var(--bg-sidebar-sec);
  border-left: 1px solid var(--border);
  flex-shrink: 0; display: flex; flex-direction: column;
  overflow: hidden;
}
.voice-panel-header {
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}
.voice-panel-header .voice-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 6px rgba(34,197,94,0.7);
  animation: voiceDotPulse 2s ease-in-out infinite;
}
@keyframes voiceDotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.voice-panel-list { flex: 1; overflow-y: auto; padding: 8px; }

/* Voice User Cards */
.voice-user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px; border-radius: var(--radius);
  margin-bottom: 4px; cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-speed);
  position: relative;
}
.voice-user-card:hover { background: var(--bg-hover); }
/* Speaking state */
.voice-user-card.speaking {
  background: rgba(34,197,94,0.06);
  border-color: rgba(34,197,94,0.2);
}
/* Muted state */
.voice-user-card.muted {
  opacity: 0.6;
}
/* Self user card */
.voice-user-card.self {
  border-color: rgba(139,92,246,0.3);
  background: rgba(139,92,246,0.05);
}
.voice-user-card-info { flex: 1; min-width: 0; }
.voice-user-card-name {
  font-size: 13px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.voice-user-card-status {
  font-size: 11px; margin-top: 2px;
}
.voice-user-card-status.speaking-text { color: var(--neon-green); }
.voice-user-card-status.muted-text { color: var(--rose); }
.voice-user-card-badge {
  font-size: 9px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.05em; background: var(--accent); color: white;
  padding: 1px 5px; border-radius: 4px;
}
.voice-user-card-icon { font-size: 13px; }
/* Speaking avatar ring */
.voice-avatar-speaking .avatar {
  box-shadow: 0 0 0 2px rgba(34,197,94,0.5), 0 0 12px rgba(34,197,94,0.3);
}

/* ============================
   AVATARS
   ============================ */
.avatar {
  border-radius: 50%; object-fit: cover; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: white; text-transform: uppercase; overflow: hidden;
}
.avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-status { position: relative; }
.avatar-status::after {
  content: ''; position: absolute; bottom: 0; right: 0;
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--bg-sidebar-sec);
}
.avatar-status.online::after { background: var(--neon-green); }
.avatar-status.away::after { background: var(--yellow); }
.avatar-status.busy::after { background: var(--rose); }
.avatar-status.offline::after { background: var(--text-muted); }

/* Speaking glow on avatar */
.avatar-speaking {
  box-shadow: 0 0 0 2px rgba(34,197,94,0.7), 0 0 10px rgba(34,197,94,0.4) !important;
  animation: speakPulse 0.8s ease-in-out infinite;
}
@keyframes speakPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(34,197,94,0.8), 0 0 10px rgba(34,197,94,0.3); }
  50% { box-shadow: 0 0 0 4px rgba(34,197,94,0.4), 0 0 20px rgba(34,197,94,0.5); }
}

/* ============================
   MODALS
   ============================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 16px; backdrop-filter: blur(6px);
}
.modal {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow);
  width: 100%; max-width: 460px;
  animation: modalIn 0.25s cubic-bezier(0.4,0,0.2,1);
}
.modal-lg { max-width: 560px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 20px 20px 0; display: flex; align-items: flex-start; justify-content: space-between;
}
.modal-title { font-size: 20px; font-weight: 800; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 20px; padding: 4px; transition: color var(--transition-speed);
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 16px 20px; }
.modal-footer { padding: 0 20px 20px; display: flex; justify-content: flex-end; gap: 10px; }

.form-field { margin-bottom: 16px; }
.form-field label {
  display: block; font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px;
}
.form-field input, .form-field select, .form-field textarea {
  width: 100%; padding: 10px 12px;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
  font-size: 14px; outline: none; transition: border-color var(--transition-speed);
  font-family: inherit;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  border-color: var(--accent);
}
.form-field textarea { resize: vertical; min-height: 80px; }
.form-field select option { background: var(--bg-secondary); }

.btn {
  padding: 10px 18px; border-radius: var(--radius); border: none;
  cursor: pointer; font-size: 14px; font-weight: 700;
  transition: all var(--transition-speed); min-height: 44px;
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--glow-purple); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger { background: rgba(244,63,94,0.12); color: var(--rose); border: 1px solid rgba(244,63,94,0.3); }
.btn-danger:hover { background: var(--rose); color: white; }
.btn-sm { padding: 7px 14px; font-size: 13px; min-height: 36px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================
   WARP-IN INCOMING CALL POPUP
   VORTEX SPEC COMPONENT 2
   ============================ */
.incoming-call-popup {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10000;
  display: none;
}
.incoming-call-popup.visible {
  display: block;
  animation: warpIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes warpIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Backdrop blur overlay */
.call-popup-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  z-index: 9999;
}

.popup-card-incoming {
  background: linear-gradient(180deg, #251347 0%, #120924 100%);
  border-radius: 40px;
  padding: 32px 28px;
  width: 360px;
  box-shadow:
    0 0 50px rgba(139,92,246,0.4),
    0 20px 60px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.05);
}

/* Neon glow radial behind popup */
.popup-card-incoming::before {
  content: '';
  position: absolute;
  top: -60%; left: 50%;
  transform: translateX(-50%);
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,0.35) 0%, transparent 70%);
  pointer-events: none;
}

.popup-avatar-wrap {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  z-index: 1; padding: 12px;
}
.popup-avatar-pulse {
  position: absolute;
  width: 88px; height: 88px; border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,0.5) 0%, transparent 70%);
  animation: popupPulsate 2s cubic-bezier(0.4,0,0.6,1) infinite;
}
@keyframes popupPulsate {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.4); opacity: 0; }
}
.popup-avatar-wrap .avatar,
.popup-avatar-wrap img.avatar {
  width: 64px !important; height: 64px !important;
  border: 3px solid rgba(139,92,246,0.8) !important;
  box-shadow: 0 0 0 6px rgba(139,92,246,0.2), 0 8px 24px rgba(139,92,246,0.5) !important;
  position: relative; z-index: 1;
}

.popup-caller-info {
  text-align: center; z-index: 1; width: 100%;
}
.popup-caller-name {
  font-size: 22px; font-weight: 800; color: #f1f0ff;
  margin-bottom: 6px;
  text-shadow: 0 2px 12px rgba(139,92,246,0.5);
}
.popup-call-type {
  font-size: 13px; color: #c4b5fd;
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-bottom: 16px;
}

/* Signal Dots — staggered 3-dot pulse */
.popup-ringing-dots {
  display: flex; gap: 8px; justify-content: center; align-items: center;
}
.popup-ringing-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-light);
  animation: signalPulse 1.4s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(167,139,250,0.8);
}
.popup-ringing-dots span:nth-child(1) { animation-delay: 0s; }
.popup-ringing-dots span:nth-child(2) { animation-delay: 0.2s; }
.popup-ringing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes signalPulse {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.4; }
  40% { transform: scale(1.3); opacity: 1; }
}

/* Accept / Decline Buttons */
.popup-actions {
  display: flex; gap: 16px; width: 100%; z-index: 1;
}
.popup-btn-accept, .popup-btn-decline {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  padding: 16px 12px; border: none; border-radius: 20px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.4,0,0.2,1), box-shadow 0.2s;
  min-height: 72px; font-family: inherit;
}
.popup-btn-accept {
  background: var(--neon-green);
  color: white;
  box-shadow: 0 4px 16px rgba(34,197,94,0.4);
}
.popup-btn-accept:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 28px rgba(34,197,94,0.6);
}
.popup-btn-accept i { font-size: 22px; }
.popup-btn-decline {
  background: #1a0b2e;
  color: var(--rose);
  box-shadow: 0 4px 16px rgba(244,63,94,0.2);
  border: 1px solid rgba(244,63,94,0.3);
}
.popup-btn-decline:hover {
  transform: scale(1.05);
  background: #22103b;
  box-shadow: 0 8px 28px rgba(244,63,94,0.4);
}
.popup-btn-decline i {
  font-size: 22px;
  transform: rotate(135deg);
  display: inline-block;
}

/* ============================
   CALL OVERLAY (Full Screen) — REDESIGNED
   High-fidelity call-to-screen-share journey
   ============================ */

/* ── Base Overlay ── */
.call-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: linear-gradient(145deg, #110d1a 0%, #0d0915 55%, #0a0612 100%);
  display: flex; flex-direction: column;
  font-family: 'Inter', 'Geist Sans', system-ui, sans-serif;
  overflow: hidden;
}
.call-overlay.hidden { display: none; }

/* ── Ambient background noise texture ── */
.call-overlay::before {
  content: '';
  position: absolute; inset: 0; z-index: 0;
  background-image:
    radial-gradient(ellipse 80% 60% at 20% 30%, rgba(99,102,241,0.07) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 80% 70%, rgba(168,85,247,0.05) 0%, transparent 60%);
  pointer-events: none;
}

/* ── Sharing Toast Banner ── */
.call-sharing-toast {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  background: rgba(99,102,241,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(99,102,241,0.4);
  transform: translateY(-100%);
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
  font-size: 13px; font-weight: 600; color: #fff; letter-spacing: 0.2px;
}
.call-sharing-toast.visible { transform: translateY(0); }
.call-sharing-toast-stop {
  padding: 4px 12px; border-radius: 6px; font-size: 11px;
  font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.25);
  color: #fff; cursor: pointer; transition: all 0.18s ease;
}
.call-sharing-toast-stop:hover { background: rgba(255,255,255,0.2); transform: translateY(-1px); filter: brightness(1.1); }

/* ── Fullscreen Header ── */
.call-fs-header {
  position: relative; z-index: 10;
  padding: 14px 24px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  flex-shrink: 0;
  transition: padding-top 0.35s ease;
}
.call-fs-header-left { display: flex; align-items: center; gap: 14px; }
.call-fs-logo { opacity: 0.8; }
.call-fs-header-right { display: flex; align-items: center; gap: 16px; }
.call-subtitle-wrap { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.call-fs-minimize-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.5); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.call-fs-minimize-btn:hover {
  background: rgba(139,92,246,0.2); border-color: rgba(139,92,246,0.4);
  color: #a78bfa; transform: translateY(-2px) scale(1.05); filter: brightness(1.1);
}
.call-fs-minimize-btn svg { width: 16px; height: 16px; }

/* legacy */
.call-header {
  padding: 16px 20px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.call-info { display: flex; align-items: center; gap: 12px; }
.call-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--neon-green); animation: blink 1.5s infinite; flex-shrink: 0; }
.call-status-dot.ringing, .call-status-dot.connecting { background: var(--yellow); }
.call-status-dot.calling { background: var(--yellow); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.call-title { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; }
.call-subtitle { font-size: 12px; color: rgba(255,255,255,0.4); }
.call-timer { font-size: 13px; color: rgba(255,255,255,0.35); font-variant-numeric: tabular-nums; font-weight: 500; }

/* ── Participants Area ── */
.call-participants-area {
  position: relative; z-index: 5;
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 24px 20px 12px; overflow: hidden;
}

/* ── GRID VIEW (>2 participants) ── */
.call-participants-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; width: 100%; max-width: 900px;
}
.call-participant-tile {
  background: rgba(255,255,255,0.04); border-radius: 16px; padding: 24px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  border: 2px solid transparent; transition: border-color 0.3s, box-shadow 0.3s;
  position: relative; backdrop-filter: blur(8px);
}
.call-participant-tile.speaking { border-color: #22c55e; box-shadow: 0 0 0 1px rgba(34,197,94,0.3), 0 0 24px rgba(34,197,94,0.15); }
.call-participant-tile .tile-name { font-size: 14px; font-weight: 600; text-align: center; color: rgba(255,255,255,0.85); }
.call-participant-tile .tile-status { display: flex; gap: 6px; }
.tile-muted-icon, .tile-deafened-icon {
  font-size: 11px; color: #f87171; background: rgba(248,113,113,0.12);
  padding: 3px 6px; border-radius: 4px;
}

/* ── DM LAYOUT (2 participants — Avatar Grid View) ── */
.call-dm-layout {
  display: flex; flex-direction: column; align-items: center;
  gap: 32px; width: 100%;
}
.call-dm-avatars {
  display: flex; gap: 48px; flex-wrap: wrap; justify-content: center;
  align-items: center;
  transition: all 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
/* When screen sharing: avatars shrink and move to strip */
.call-dm-avatars.strip-mode {
  gap: 16px;
}
.call-dm-avatar-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
}
.call-dm-avatar-inner {
  position: relative; width: 96px; height: 96px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
/* Active speaker glow ring */
.call-dm-avatar-inner.speaking .avatar {
  border: 4px solid #22c55e !important;
  box-shadow: 0 0 0 4px rgba(34,197,94,0.15), 0 0 24px rgba(34,197,94,0.25) !important;
}
.call-dm-name {
  font-size: 13px; font-weight: 400; color: rgba(255,255,255,0.45);
  text-align: center; letter-spacing: 0.1px;
  white-space: nowrap;
}
.call-dm-avatar-wrap .avatar {
  width: 96px !important; height: 96px !important;
  font-size: 28px !important; font-weight: 700;
  border: 4px solid transparent;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
/* Strip mode: smaller avatars */
.strip-mode .call-dm-avatar-wrap .avatar {
  width: 48px !important; height: 48px !important;
  font-size: 16px !important;
}
.strip-mode .call-dm-name { font-size: 11px; }

/* ── MAIN STAGE (Screen Share) ── */
.call-main-stage-wrap {
  position: relative; z-index: 5;
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 12px 24px 8px;
  gap: 16px;
}
.call-main-stage {
  position: relative; width: 100%; max-width: 1100px;
  aspect-ratio: 16/9; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  overflow: hidden;
  background: linear-gradient(135deg, #16101f 0%, #0e0a18 50%, #13101c 100%);
  box-shadow:
    0 0 0 1px rgba(99,102,241,0.15),
    0 40px 80px -20px rgba(99,102,241,0.25),
    0 20px 40px rgba(0,0,0,0.6);
  transform: scale(0.92);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
}
.call-main-stage.visible { transform: scale(1); opacity: 1; }

/* Carbon mesh texture */
.call-main-stage::before {
  content: '';
  position: absolute; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.6;
}
/* Gradient border shimmer */
.call-main-stage::after {
  content: '';
  position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(135deg,
    rgba(255,255,255,0.04) 0%,
    transparent 40%,
    transparent 60%,
    rgba(255,255,255,0.02) 100%);
  pointer-events: none;
}

/* Stage center icon */
.call-stage-centerpiece {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
}
.call-stage-centerpiece svg {
  width: 96px; height: 96px;
  color: rgba(255,255,255,0.4);
  filter: drop-shadow(0 0 24px rgba(255,255,255,0.1));
}

/* Screen video element */
.call-screen-video {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%; object-fit: contain;
  background: #0a0514;
}
.call-screen-video.hidden { display: none; }

/* ── LIVE Badge ── */
.call-live-badge {
  position: absolute; top: 14px; left: 14px; z-index: 10;
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 4px 10px 4px 8px;
  opacity: 0; transform: scale(0.8);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.call-live-badge.visible { opacity: 1; transform: scale(1); }
.call-live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239,68,68,0.8);
  animation: livePulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 6px rgba(239,68,68,0.8); }
  50% { opacity: 0.7; transform: scale(0.85); box-shadow: 0 0 3px rgba(239,68,68,0.4); }
}
.call-live-text {
  font-size: 10px; font-weight: 700; color: #fff;
  letter-spacing: 1.2px; text-transform: uppercase;
}

/* ── Controls Bar (Dock) ── */
.call-controls {
  position: relative; z-index: 10;
  padding: 12px 20px 16px;
  display: flex; align-items: center; justify-content: center;
  gap: 0; flex-shrink: 0;
}
.call-dock {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 8px 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
}
.call-dock-divider {
  width: 1px; height: 28px;
  background: rgba(255,255,255,0.1);
  margin: 0 6px; flex-shrink: 0;
}

/* ── Dock Buttons ── */
.call-ctrl-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: transparent; border: none; border-radius: 14px;
  padding: 10px 14px; cursor: pointer; color: rgba(255,255,255,0.75);
  transition: all 0.2s ease;
  min-width: 56px; height: 52px;
  font-family: inherit; position: relative;
}
.call-ctrl-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
  transform: translateY(-2px);
  filter: brightness(1.1);
}
.call-ctrl-btn:active { transform: translateY(0) scale(0.96); }

/* Mic ON state */
.call-ctrl-btn.mic-on { background: rgba(99,102,241,0.2); color: #a5b4fc; }
.call-ctrl-btn.mic-on:hover { background: rgba(99,102,241,0.3); }
/* Mic MUTED state */
.call-ctrl-btn.mic-muted { background: rgba(248,113,113,0.15); color: #f87171; }
.call-ctrl-btn.mic-muted:hover { background: rgba(248,113,113,0.25); }

/* Deafen active state */
.call-ctrl-btn.deafen-active {
  border: 1px solid rgba(255,255,255,0.3); color: #fff;
}
.call-ctrl-btn.deafen-active:hover { border-color: rgba(255,255,255,0.5); }

/* Screen share ACTIVE state */
.call-ctrl-btn.screen-active {
  background: #16a34a;
  color: #fff;
  box-shadow: 0 4px 20px rgba(22,163,74,0.4), 0 0 0 1px rgba(22,163,74,0.5);
}
.call-ctrl-btn.screen-active:hover {
  background: #15803d;
  box-shadow: 0 6px 24px rgba(22,163,74,0.5), 0 0 0 1px rgba(22,163,74,0.6);
}
/* Screen share hover tooltip */
.call-ctrl-btn.screen-hover:not(.screen-active) { background: rgba(99,102,241,0.2); color: #a5b4fc; }

/* Leave button */
.call-ctrl-btn.leave-btn { color: #f87171; min-width: 52px; }
.call-ctrl-btn.leave-btn:hover { background: #ef4444; color: #fff; box-shadow: 0 4px 20px rgba(239,68,68,0.4); }

.call-ctrl-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.call-ctrl-label { font-size: 10px; font-weight: 500; letter-spacing: 0.2px; line-height: 1; }

/* ── Old compat (legacy) ── */
.call-ctrl-btn.active { background: rgba(99,102,241,0.2); color: #a5b4fc; }
.call-ctrl-btn.danger { background: rgba(244,63,94,0.12); color: var(--rose); }
.call-ctrl-btn.danger:hover { background: var(--rose); color: white; }

/* ── Participant Strip (screen share mode) ── */
.call-participant-strip {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; padding: 0 20px;
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.35s ease 0.1s, transform 0.35s cubic-bezier(0.34,1.56,0.64,1) 0.1s;
  flex-shrink: 0;
}
.call-participant-strip.visible { opacity: 1; transform: translateY(0); }
.call-strip-participant {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.call-strip-participant .avatar {
  width: 48px !important; height: 48px !important;
  font-size: 16px !important; font-weight: 700;
  border: 3px solid transparent;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.call-strip-participant.speaking .avatar {
  border-color: #22c55e !important;
  box-shadow: 0 0 12px rgba(34,197,94,0.3) !important;
}
.call-strip-name {
  font-size: 10px; font-weight: 400; color: rgba(255,255,255,0.4);
  max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center;
}

/* ============================
   CALL FLOATING PANEL (Minimized Mode)
   ============================ */
.call-floating-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1050;
  width: 340px;
  background: linear-gradient(135deg, #1a0d2e 0%, #110821 50%, #0e0719 100%);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(139,92,246,0.1), inset 0 1px 0 rgba(255,255,255,0.05);
  overflow: hidden;
  cursor: grab;
  user-select: none;
  /* Start hidden, off-screen to the right */
  opacity: 0;
  transform: translateX(120%) scale(0.85);
  transition: opacity 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.2s ease,
              border-color 0.2s ease;
  pointer-events: none;
}
.call-floating-panel.visible {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: all;
}
.call-floating-panel.dragging {
  cursor: grabbing;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.8), 0 0 0 2px rgba(139,92,246,0.5);
  transform: scale(1.02);
  transition: box-shadow 0.1s ease;
}
.call-floating-panel:hover {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(139,92,246,0.2);
}

/* Top accent glow bar */
.cfp-glow-bar {
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(139,92,246,0.8) 30%, rgba(99,102,241,0.9) 60%, rgba(34,197,94,0.5) 100%);
  animation: cfpGlowBar 3s ease-in-out infinite;
}
@keyframes cfpGlowBar {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.cfp-body {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 12px;
}
.cfp-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

/* Avatar stack */
.cfp-avatars {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.cfp-avatars .avatar:first-child {
  z-index: 2;
  position: relative;
  box-shadow: 0 0 0 2px #1a0d2e;
}
.cfp-avatars .avatar:not(:first-child) {
  margin-left: -8px;
  z-index: 1;
  box-shadow: 0 0 0 2px #1a0d2e;
}

.cfp-info {
  flex: 1;
  min-width: 0;
}
.cfp-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cfp-status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}
.cfp-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--neon-green);
  animation: blink 1.5s infinite;
  flex-shrink: 0;
}
.cfp-status-dot.calling, .cfp-status-dot.ringing { background: var(--yellow); }
.cfp-status-dot.idle { background: var(--text-muted); animation: none; }
.cfp-status-text {
  font-size: 11px;
  color: var(--text-secondary);
}
.cfp-timer {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}
.cfp-timer::before {
  content: '·';
  margin-right: 4px;
  color: var(--text-muted);
}

/* Control buttons */
.cfp-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.cfp-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.07);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  flex-shrink: 0;
}
.cfp-btn svg {
  width: 16px;
  height: 16px;
  pointer-events: none;
}
.cfp-btn:hover {
  background: rgba(255,255,255,0.13);
  color: var(--text-primary);
  transform: scale(1.08);
}
.cfp-btn:active { transform: scale(0.95); }
.cfp-btn-muted {
  background: rgba(244,63,94,0.18) !important;
  color: var(--rose) !important;
}
.cfp-btn-muted:hover {
  background: rgba(244,63,94,0.3) !important;
}
.cfp-btn-end {
  background: rgba(244, 63, 94, 0.15);
  color: var(--rose);
}
.cfp-btn-end:hover {
  background: var(--rose);
  color: white;
  box-shadow: 0 4px 16px rgba(244,63,94,0.4);
}
.cfp-btn-expand {
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent-light);
  border: 1px solid rgba(139,92,246,0.25);
}
.cfp-btn-expand:hover {
  background: rgba(139, 92, 246, 0.25);
  border-color: rgba(139,92,246,0.5);
  box-shadow: 0 4px 16px rgba(139,92,246,0.3);
}

/* Drag hint */
.cfp-drag-hint {
  text-align: center;
  color: rgba(255,255,255,0.1);
  font-size: 11px;
  padding: 0 0 6px;
  letter-spacing: 4px;
  pointer-events: none;
  transition: color 0.2s;
}
.call-floating-panel:hover .cfp-drag-hint {
  color: rgba(255,255,255,0.2);
}
.call-floating-panel.dragging .cfp-drag-hint {
  color: rgba(139,92,246,0.4);
}

/* Mobile: floating becomes pill at bottom */
@media (max-width: 600px) {
  .call-floating-panel {
    bottom: 16px;
    right: 16px;
    left: 16px;
    width: auto;
    border-radius: 14px;
  }
}

/* Legacy incoming call alert (still hidden by default) */
.incoming-call-alert {
  position: fixed; bottom: 24px; right: 24px; z-index: 1100;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 20px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px; min-width: 300px;
  animation: slideIn 0.3s ease;
}
.incoming-call-alert.hidden { display: none; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.incoming-call-info { flex: 1; }
.incoming-call-name { font-weight: 700; font-size: 15px; }
.incoming-call-type { font-size: 13px; color: var(--text-secondary); }
.incoming-call-actions { display: flex; gap: 8px; }
.call-accept-btn {
  background: var(--neon-green); border: none; border-radius: var(--radius);
  color: white; padding: 8px 14px; cursor: pointer; font-weight: 700; font-size: 13px;
  min-height: 44px;
}
.call-reject-btn {
  background: var(--rose); border: none; border-radius: var(--radius);
  color: white; padding: 8px 14px; cursor: pointer; font-weight: 700; font-size: 13px;
  min-height: 44px;
}

/* ============================
   TOASTS
   ============================ */
.toast-container {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 11000; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
}
.toast {
  padding: 10px 20px; border-radius: var(--radius-lg); font-size: 14px;
  font-weight: 600; color: white; box-shadow: var(--shadow);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  pointer-events: all;
}
.toast.success { background: rgba(34,197,94,0.9); backdrop-filter: blur(8px); }
.toast.error { background: rgba(244,63,94,0.9); backdrop-filter: blur(8px); }
.toast.info { background: rgba(99,102,241,0.9); backdrop-filter: blur(8px); }
.toast.warning { background: rgba(245,158,11,0.9); backdrop-filter: blur(8px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-8px); } }

/* ============================
   FRIENDS PAGE
   ============================ */
.friends-page { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.friends-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.15); display: flex; align-items: center;
  gap: 12px; flex-wrap: wrap;
}
.friends-tab {
  padding: 6px 14px; border-radius: var(--radius); border: none;
  background: transparent; color: var(--text-secondary);
  cursor: pointer; font-size: 14px; font-weight: 600;
  transition: all var(--transition-speed); min-height: 36px; font-family: inherit;
}
.friends-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.friends-tab.active { background: var(--bg-active); color: var(--text-primary); }
.friends-tab .tab-badge {
  background: var(--rose); color: white; border-radius: 10px;
  font-size: 10px; font-weight: 800; padding: 1px 5px; margin-left: 4px;
}
.friends-content { flex: 1; overflow-y: auto; padding: 16px; }
.add-friend-form {
  display: flex; gap: 10px; margin-bottom: 20px; align-items: flex-end; flex-wrap: wrap;
}
.add-friend-form input {
  flex: 1; min-width: 200px; padding: 10px 14px;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary); font-size: 14px; outline: none;
  font-family: inherit;
}
.add-friend-form input:focus { border-color: var(--accent); }
.friend-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius);
  background: var(--bg-secondary); border: 1px solid var(--border); margin-bottom: 8px;
}
.friend-item-info { flex: 1; min-width: 0; }
.friend-item-name { font-size: 14px; font-weight: 700; }
.friend-item-username { font-size: 12px; color: var(--text-muted); }
.friend-item-actions { display: flex; gap: 8px; }

/* ============================
   SETTINGS PAGE
   ============================ */
.settings-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(6px);
  display: flex; align-items: stretch;
}
.settings-layout {
  display: flex; width: 100%; height: 100%;
  background: var(--bg-main);
  animation: fadeIn 0.2s ease;
}
.settings-sidebar {
  width: 220px; min-width: 220px;
  background: var(--bg-sidebar-sec);
  padding: 60px 8px 24px; overflow-y: auto;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.settings-sidebar-section-label {
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); padding: 0 8px 6px; margin-top: 12px;
}
.settings-sidebar-divider { height: 1px; background: var(--border); margin: 8px 0; }
.settings-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius);
  cursor: pointer; color: var(--text-secondary);
  font-size: 14px; font-weight: 500;
  transition: background var(--transition-speed), color var(--transition-speed);
}
.settings-nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.settings-nav-item.active { background: var(--bg-active); color: var(--text-primary); }
.settings-nav-item i { width: 18px; text-align: center; font-size: 14px; }
.settings-logout-item { color: var(--rose) !important; margin-top: auto; }
.settings-logout-item:hover { background: rgba(244,63,94,0.1) !important; }
.settings-main { flex: 1; overflow-y: auto; padding: 60px 40px 40px; max-width: 740px; }
.settings-section-title {
  font-size: 20px; font-weight: 800; color: var(--text-primary);
  margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 12px;
}
.settings-close-wrap { padding: 60px 20px 0; }
.settings-close-btn {
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); color: var(--text-muted);
  cursor: pointer; padding: 12px; display: flex; flex-direction: column;
  align-items: center; gap: 4px; font-size: 20px; width: 48px;
  transition: all var(--transition-speed);
}
.settings-close-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }
.settings-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px; margin-bottom: 12px;
}
.settings-card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px; font-size: 14px; font-weight: 700; color: var(--text-primary);
}
.settings-card-value { font-size: 13px; color: var(--text-secondary); }
.settings-label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.1em; margin-bottom: 8px;
}
.settings-input {
  width: 100%; padding: 10px 12px;
  background: var(--bg-main); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
  font-size: 14px; outline: none; font-family: inherit;
  transition: border-color var(--transition-speed);
}
.settings-input:focus { border-color: var(--accent); }
.settings-textarea { min-height: 80px; resize: vertical; }
.settings-select {
  width: 100%; padding: 10px 12px;
  background: var(--bg-main); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
  font-size: 14px; outline: none; cursor: pointer;
}
.settings-select:focus { border-color: var(--accent); }
.settings-select option { background: var(--bg-secondary); }
.settings-edit-btn {
  background: var(--bg-active); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-secondary);
  cursor: pointer; padding: 4px 10px; font-size: 12px;
  transition: all var(--transition-speed); font-family: inherit;
}
.settings-edit-btn:hover { color: var(--text-primary); border-color: var(--accent); }
.settings-edit-field { margin-top: 12px; }
.settings-edit-field.hidden { display: none; }
.settings-edit-actions { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; }
.settings-account-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 16px;
}
.settings-account-banner { height: 60px; }
.settings-account-body { display: flex; align-items: flex-start; gap: 16px; padding: 0 16px 16px; }
.settings-account-avatar-wrap { margin-top: -30px; }
.settings-account-info { padding-top: 8px; }
.settings-account-name { font-size: 18px; font-weight: 800; }
.settings-account-username { font-size: 13px; color: var(--text-muted); }
.settings-account-thought { font-size: 12px; color: var(--text-secondary); font-style: italic; margin-top: 4px; }
.settings-avatar-section { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.settings-avatar-upload { position: relative; cursor: pointer; }
.settings-avatar-upload .avatar-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--transition-speed);
}
.settings-avatar-upload:hover .avatar-overlay { opacity: 1; }
.settings-avatar-upload input[type=file] { display: none; }
.settings-avatar-upload-btn {
  position: relative; cursor: pointer; display: inline-block; border-radius: 50%;
}
.settings-avatar-upload-btn .avatar-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--transition-speed); color: white; font-size: 18px;
}
.settings-avatar-upload-btn:hover .avatar-overlay { opacity: 1; }
.settings-profile-layout { display: grid; grid-template-columns: 1fr 280px; gap: 24px; }
.profile-preview-card {
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; position: sticky; top: 20px;
}
.profile-preview-banner { height: 60px; }
.profile-preview-body { padding: 0 16px 16px; }
.profile-preview-avatar { margin-top: -30px; margin-bottom: 8px; }
.profile-preview-name { font-size: 16px; font-weight: 800; }
.profile-preview-username { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.profile-preview-thought { font-size: 12px; color: var(--accent-light); font-style: italic; margin-bottom: 6px; }
.profile-preview-field { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.profile-preview-about {
  font-size: 13px; color: var(--text-secondary);
  background: var(--bg-secondary); border-radius: var(--radius); padding: 8px; margin-top: 8px;
}
.settings-status-options { display: flex; gap: 8px; flex-wrap: wrap; }
.settings-status-option {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius);
  background: var(--bg-main); border: 2px solid var(--border);
  cursor: pointer; font-size: 13px; transition: all var(--transition-speed);
}
.settings-status-option:hover { border-color: var(--text-muted); }
.settings-status-option.selected { border-color: var(--accent); background: rgba(139,92,246,0.12); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.settings-color-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; transition: transform var(--transition-speed), border-color var(--transition-speed);
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: white; transform: scale(1.1); }
.settings-toggle {
  position: relative; display: inline-flex; align-items: center; cursor: pointer;
}
.settings-toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: relative; display: inline-block;
  width: 40px; height: 22px; background: var(--bg-active); border-radius: 22px;
  transition: background 0.3s;
}
.toggle-slider::after {
  content: ''; position: absolute;
  width: 16px; height: 16px; left: 3px; top: 3px;
  background: white; border-radius: 50%; transition: transform 0.3s;
}
.settings-toggle input:checked + .toggle-slider { background: var(--accent); }
.settings-toggle input:checked + .toggle-slider::after { transform: translateX(18px); }
.settings-slider-row { display: flex; align-items: center; gap: 10px; }
.settings-slider {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 4px; background: var(--bg-active); border-radius: 2px; outline: none;
}
.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px;
  background: var(--accent); border-radius: 50%; cursor: pointer;
}
.settings-slider-val { font-size: 13px; color: var(--text-secondary); min-width: 40px; text-align: right; }
.settings-theme-options { display: flex; gap: 12px; }
.settings-theme-option {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; padding: 8px; border-radius: var(--radius);
  border: 2px solid var(--border); transition: border-color var(--transition-speed);
  font-size: 12px; color: var(--text-secondary);
}
.settings-theme-option:hover { border-color: var(--text-muted); }
.settings-theme-option.selected { border-color: var(--accent); color: var(--text-primary); }
.theme-preview { width: 80px; height: 50px; border-radius: var(--radius); }
.theme-dark { background: linear-gradient(135deg, #0a0514, #130a20); border: 1px solid rgba(255,255,255,0.05); }
.theme-darker { background: linear-gradient(135deg, #040209, #0d071a); border: 1px solid rgba(255,255,255,0.03); }
.theme-midnight { background: linear-gradient(135deg, #030818, #0a0f24); border: 1px solid rgba(99,102,241,0.1); }
.settings-danger-zone { margin-top: 24px; }
.settings-content-wrap { max-width: 680px; }
.font-size-preview { font-size: 16px; margin-top: 12px; padding: 12px; background: var(--bg-main); border-radius: var(--radius); color: var(--text-primary); }

/* ============================
   PROFILE MODAL
   ============================ */
.profile-modal-banner { height: 80px; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
.profile-modal-body { padding: 0 20px 20px; }
.profile-modal-avatar { margin-top: -40px; margin-bottom: 12px; }
.profile-modal-name { font-size: 20px; font-weight: 800; }
.profile-modal-username { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }
.profile-modal-section {
  background: var(--bg-tertiary); border-radius: var(--radius);
  padding: 12px; margin-bottom: 10px;
}
.profile-modal-section-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 8px;
}
.profile-modal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-modal-thought { font-size: 13px; color: var(--accent-light); font-style: italic; margin-bottom: 8px; }
.profile-modal-gender { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.profile-modal-about { font-size: 13px; color: var(--text-secondary); background: var(--bg-main); border-radius: var(--radius); padding: 10px; margin-top: 4px; }

/* ============================
   SEARCH & MISC
   ============================ */
.invite-banner {
  background: rgba(139,92,246,0.1); border: 1px solid rgba(139,92,246,0.25);
  padding: 10px 16px; display: flex; align-items: center; gap: 10px; font-size: 13px;
}
.invite-banner-text { flex: 1; }
.friend-select-list { max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.friend-select-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; }
.friend-select-item:hover { background: var(--bg-hover); }
.friend-select-item.selected { background: rgba(139,92,246,0.12); }
.friend-select-item input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.emoji-hint { color: var(--text-muted); font-size: 20px; margin-bottom: 8px; }

/* Voice Glow */
.avatar-voice-glow {
  box-shadow: 0 0 0 3px rgba(139,92,246,0.8), 0 0 16px rgba(139,92,246,0.4);
  animation: voiceGlow 0.8s ease-in-out infinite;
}
@keyframes voiceGlow {
  0%, 100% { box-shadow: 0 0 0 3px rgba(139,92,246,0.8), 0 0 16px rgba(139,92,246,0.4); }
  50% { box-shadow: 0 0 0 5px rgba(139,92,246,0.5), 0 0 28px rgba(139,92,246,0.7); }
}

/* ============================
   RESPONSIVE & MOBILE
   ============================ */
@media (max-width: 1100px) {
  :root { --members-width: 0px; }
  .members-sidebar { display: none; }
  .voice-active-panel { display: none; }
}

@media (max-width: 768px) {
  :root { --server-rail-width: 60px; --sidebar-width: 200px; }
  .auth-card { flex-direction: column; }
  .auth-panel-left { flex: none; padding: 28px 24px 20px; min-height: auto; }
  .auth-panel-right { padding: 20px 24px 28px; }
  .auth-features { display: none; }
  .auth-field-row { grid-template-columns: 1fr; }
  .settings-profile-layout { grid-template-columns: 1fr; }
  .settings-profile-preview { display: none; }
  .settings-sidebar { width: 180px; min-width: 180px; padding: 48px 6px 16px; }
  .settings-main { padding: 48px 20px 20px; }
}

@media (max-width: 640px) {
  :root { --server-rail-width: 52px; --sidebar-width: 0px; }
  .channel-sidebar, .dm-sidebar { display: none; }
  .channel-sidebar.mobile-open, .dm-sidebar.mobile-open {
    display: flex; position: fixed; left: 52px; top: 0; bottom: 0;
    z-index: 200; width: 240px;
  }
  .mobile-sidebar-toggle { display: flex !important; }
  .auth-card { border-radius: 0; min-height: 100vh; }
  .auth-panel-left { display: none; }
  .popup-card-incoming { width: calc(100vw - 32px); max-width: 360px; padding: 24px 20px; }
  .settings-layout { flex-direction: column; }
  .settings-sidebar {
    width: 100%; min-width: unset; padding: 12px 8px;
    flex-direction: row; flex-wrap: wrap; gap: 4px;
    border-right: none; border-bottom: 1px solid var(--border);
    max-height: 120px; overflow-y: auto;
  }
  .settings-sidebar-section-label, .settings-sidebar-divider { display: none; }
  .settings-nav-item { flex: 0 0 auto; padding: 6px 10px; font-size: 12px; }
  .settings-close-wrap { display: none; }
  .settings-main { padding: 16px; }
}

.mobile-sidebar-toggle { display: none; }
.hidden { display: none !important; }

/* ============================
   MISC UTILITIES
   ============================ */
.dm-item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.dm-item-time { font-size: 11px; color: var(--text-muted); }
.dm-unread {
  background: var(--accent); color: white; border-radius: 10px;
  font-size: 11px; font-weight: 700; padding: 1px 6px;
  min-width: 16px; text-align: center;
}
.ch-unread-dot {
  width: 8px; height: 8px; background: var(--accent-light);
  border-radius: 50%; margin-left: auto; flex-shrink: 0;
}

/* Voice Active Panel - in server view sidebar  */
.voice-sidebar-section {
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.voice-sidebar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px 5px 14px; border-radius: var(--radius); margin: 0 8px;
  font-size: 13px; color: var(--text-secondary);
  transition: background var(--transition-speed);
}
.voice-sidebar-user:hover { background: var(--bg-hover); }
.voice-sidebar-user.speaking { color: var(--neon-green); }
.voice-sidebar-user.muted { color: var(--rose); opacity: 0.7; }

/* ============================
   INVITE PREVIEW POPUP OVERLAY
   ============================ */
.inv-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5,2,10,0.75);
  backdrop-filter: blur(6px);
  padding: 20px;
  opacity: 0; transition: opacity 0.3s ease;
}
.inv-overlay.visible { opacity: 1; }
.inv-overlay.hiding { opacity: 0; }

.inv-popup {
  background: linear-gradient(155deg, rgba(26,17,41,0.99) 0%, rgba(10,5,20,0.99) 100%);
  border: 1px solid rgba(139,92,246,0.28);
  border-radius: 20px;
  width: 100%; max-width: 440px;
  box-shadow: 0 40px 100px rgba(0,0,0,0.75), 0 0 80px rgba(139,92,246,0.18);
  overflow: hidden;
  position: relative;
  transform: translateY(30px) scale(0.94);
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
}
.inv-overlay.visible .inv-popup {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.inv-overlay.hiding .inv-popup {
  transform: translateY(20px) scale(0.96);
  opacity: 0;
}

.inv-close-btn {
  position: absolute; top: 14px; right: 14px; z-index: 10;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted); cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.inv-close-btn:hover { background: rgba(244,63,94,0.25); border-color: rgba(244,63,94,0.4); color: #f43f5e; }

.inv-banner {
  height: 90px;
  background: linear-gradient(135deg, #3b0764 0%, #4c1d95 35%, #312e81 70%, #1e1b4b 100%);
  position: relative; overflow: hidden;
}
.inv-banner::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(168,85,247,0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(99,102,241,0.2) 0%, transparent 50%);
}
.inv-banner::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 40px;
  background: linear-gradient(to bottom, transparent, rgba(10,5,20,0.99));
}

.inv-body {
  padding: 0 28px 28px;
}
.inv-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  border: 5px solid #0a0514;
  margin-top: -40px; margin-bottom: 12px;
  position: relative; z-index: 2;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(139,92,246,0.55), 0 8px 24px rgba(0,0,0,0.5);
  display: inline-flex; align-items: center; justify-content: center;
  transition: box-shadow 0.3s, transform 0.3s;
}
.inv-avatar:hover {
  box-shadow: 0 0 50px rgba(139,92,246,0.85), 0 8px 24px rgba(0,0,0,0.5);
  transform: scale(1.06);
}
.inv-avatar-img { width:100%; height:100%; object-fit:cover; border-radius:50%; }
.inv-avatar-initials {
  width:100%; height:100%; display:flex; align-items:center; justify-content:center;
  font-size:26px; font-weight:800; color:#fff; border-radius:50%;
}

/* Mirror the popup avatar classes used by the inline HTML in app.js */
.inv-popup-avatar-img { width:100%; height:100%; object-fit:cover; border-radius:50%; }
.inv-popup-avatar-initials {
  width:100%; height:100%; display:flex; align-items:center; justify-content:center;
  font-size:26px; font-weight:800; color:#fff; border-radius:50%;
}

.inv-you-invited {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 3px;
}
.inv-server-name {
  font-size: 24px; font-weight: 800; color: var(--text-primary);
  line-height: 1.2; margin-bottom: 6px;
}
.inv-server-desc {
  font-size: 13px; color: var(--text-secondary);
  font-style: italic; margin-bottom: 14px; line-height: 1.5;
}
.inv-stats {
  display: flex; gap: 20px; margin-bottom: 20px;
}
.inv-stat {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--text-secondary);
}
.inv-stat strong { color: var(--text-primary); }
.inv-stat-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0;
}
.inv-stat-dot.online  { background: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,0.6); }
.inv-stat-dot.members { background: var(--text-muted); }

.inv-go-btn {
  display: flex; width: 100%; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px;
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
  color: #fff; font-size: 15px; font-weight: 700;
  border: none; border-radius: 12px; cursor: pointer;
  text-align: center;
  transition: all 0.25s;
  box-shadow: 0 4px 20px rgba(124,58,237,0.4);
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}
.inv-go-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #6d28d9 0%, #4f46e5 100%);
  box-shadow: 0 6px 30px rgba(124,58,237,0.65);
  transform: translateY(-2px);
}
.inv-go-btn:active:not(:disabled) { transform: translateY(0); }
.inv-go-btn:disabled { opacity: 0.7; cursor: not-allowed; }

.inv-link-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 14px;
}
.inv-link-box {
  flex: 1; padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(139,92,246,0.18);
  border-radius: 10px;
  color: var(--text-secondary); font-size: 11px;
  font-family: 'Courier New', monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  user-select: all;
}
.inv-copy-btn {
  padding: 10px 14px;
  background: rgba(139,92,246,0.12);
  border: 1px solid rgba(139,92,246,0.28);
  border-radius: 10px;
  color: var(--accent-light); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
  flex-shrink: 0;
}
.inv-copy-btn:hover {
  background: rgba(139,92,246,0.28); border-color: rgba(139,92,246,0.5); color: #fff;
}
.inv-copy-btn.copied {
  background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.4); color: #22c55e;
}

.inv-brand {
  text-align: center; font-size: 11px; color: var(--text-muted); letter-spacing: 0.05em;
}
.inv-brand span { color: var(--accent-light); font-weight: 700; }

/* copy btn flash for the invite modal */
.btn-success-flash {
  background: rgba(34,197,94,0.2) !important;
  border-color: rgba(34,197,94,0.4) !important;
  color: #22c55e !important;
}

@media (max-width: 480px) {
  .inv-popup { border-radius: 16px; }
  .inv-body  { padding: 0 18px 22px; }
  .inv-server-name { font-size: 20px; }
}

/* ============================
   INVITE MEMBERS MODAL
   ============================ */

/* Modal container overrides */
.invite-members-modal .modal-body {
  padding: 0 !important;
  overflow: hidden;
}
.invite-members-modal {
  max-width: 500px;
}

/* Server header card inside modal */
.inv-server-header-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(99,102,241,0.06));
  border-bottom: 1px solid rgba(139,92,246,0.15);
  padding: 18px 20px;
}
.inv-server-header-avatar { flex-shrink: 0; }
.inv-server-header-info { flex: 1; min-width: 0; }
.inv-server-header-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-server-header-desc {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tabs */
.inv-tabs {
  display: flex;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.inv-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.inv-tab:hover { color: var(--text-primary); }
.inv-tab.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
}

/* Panel container */
.inv-panel {
  display: flex;
  flex-direction: column;
  max-height: 360px;
}

/* Search bar */
.inv-search-wrap {
  position: relative;
  padding: 14px 16px 10px;
  flex-shrink: 0;
}
.inv-search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
  margin-top: 7px;
}
.inv-search-input {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid rgba(139,92,246,0.2);
  border-radius: 8px;
  padding: 9px 12px 9px 34px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.inv-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(139,92,246,0.15);
}

/* Friends list */
.inv-friends-list {
  overflow-y: auto;
  padding: 4px 12px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* No friends placeholder */
.inv-no-friends {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  gap: 6px;
}

/* Friend card */
.inv-friend-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background 0.15s;
}
.inv-friend-card:hover { background: var(--bg-hover); }
.inv-friend-card.inv-friend-card-sent { opacity: 0.55; }

.inv-friend-avatar { flex-shrink: 0; }
.inv-friend-info { flex: 1; min-width: 0; }
.inv-friend-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-friend-username {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Invite friend button */
.inv-friend-btn {
  flex-shrink: 0;
  background: rgba(139,92,246,0.15);
  border: 1px solid rgba(139,92,246,0.35);
  border-radius: 8px;
  color: var(--accent-light);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.inv-friend-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px rgba(139,92,246,0.45);
  transform: translateY(-1px);
}
.inv-friend-btn:active:not(:disabled) { transform: translateY(0); }
.inv-friend-btn:disabled { opacity: 0.6; cursor: default; }
.inv-friend-btn.inv-friend-btn-sent {
  background: rgba(34,197,94,0.15);
  border-color: rgba(34,197,94,0.35);
  color: #22c55e;
}

/* ============================
   INVITE CHAT WIDGET
   In-chat invite link preview
   ============================ */

.invite-chat-widget {
  margin-top: 6px;
  display: inline-block;
  min-width: 260px;
  max-width: 360px;
  width: 100%;
}

.icw-inner {
  background: linear-gradient(135deg, rgba(26,17,41,0.95) 0%, rgba(13,7,26,0.95) 100%);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45), 0 0 20px rgba(139,92,246,0.08);
  transition: box-shadow 0.2s, transform 0.2s;
  opacity: 1;
  transform: translateY(0) scale(1);
}
/* Animation only fires once via JS-added class */
.icw-inner.icw-animate-in {
  animation: icwSlideIn 0.35s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
.icw-inner:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.55), 0 0 30px rgba(139,92,246,0.2);
  transform: translateY(-1px);
}

@keyframes icwSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.icw-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px 12px;
}

/* Server avatar in widget */
.icw-avatar-wrap { flex-shrink: 0; }
.icw-server-avatar-img {
  width: 52px; height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(139,92,246,0.35);
  box-shadow: 0 0 12px rgba(139,92,246,0.3);
}
.icw-server-avatar-initials {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow: 0 0 14px rgba(139,92,246,0.35);
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.icw-server-details { flex: 1; min-width: 0; }
.icw-server-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
  text-shadow: 0 0 20px rgba(139,92,246,0.3);
}
.icw-server-desc {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}
.icw-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.icw-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
}
.icw-stat.online { color: #22c55e; }
.icw-stat.members { color: var(--text-muted); }

.icw-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.online-dot {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34,197,94,0.7);
  animation: onlinePulse 2s ease-in-out infinite;
}
.member-dot { background: var(--text-muted); }
@keyframes onlinePulse {
  0%,100% { box-shadow: 0 0 4px rgba(34,197,94,0.6); }
  50%      { box-shadow: 0 0 10px rgba(34,197,94,0.9); }
}

/* Action buttons row */
.icw-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 16px 14px;
}

.icw-go-btn {
  flex: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-blue));
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  letter-spacing: 0.01em;
}
.icw-go-btn:hover {
  background: linear-gradient(135deg, var(--accent-hover), #4f46e5);
  box-shadow: 0 0 18px rgba(139,92,246,0.5);
  transform: translateY(-1px);
}
.icw-go-btn:active { transform: translateY(0); }

.icw-copy-btn {
  flex-shrink: 0;
  background: rgba(139,92,246,0.12);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 10px;
  color: var(--accent-light);
  font-size: 12px;
  font-weight: 600;
  padding: 9px 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.icw-copy-btn:hover {
  background: rgba(139,92,246,0.25);
  border-color: rgba(139,92,246,0.5);
  box-shadow: 0 0 12px rgba(139,92,246,0.25);
  color: #fff;
}
.icw-copy-btn.icw-copy-btn-success {
  background: rgba(34,197,94,0.15);
  border-color: rgba(34,197,94,0.4);
  color: #22c55e;
}

/* Loading / error states */
.icw-loading, .icw-error {
  padding: 16px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.icw-error { color: var(--rose); }

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 600px) {
  .invite-members-modal { max-width: 98vw; margin: 8px; }
  .inv-panel { max-height: 280px; }
  .invite-chat-widget { max-width: 100%; min-width: 0; }
  .icw-go-btn { font-size: 12px; padding: 8px 10px; }
  .icw-copy-btn { padding: 8px 10px; font-size: 11px; }
}

/* ============================
   MOBILE LAYOUT (only activated when .is-mobile on body)
   Desktop layout remains completely unchanged.
   ============================ */

/* Mobile bottom navigation bar */
body.is-mobile .mobile-nav-bar {
  display: flex !important;
}

.mobile-nav-bar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 56px;
  background: var(--bg-sidebar-deep);
  border-top: 1px solid var(--border-accent);
  z-index: 200;
  align-items: stretch;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
}

.mobile-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
  position: relative;
  font-family: inherit;
  letter-spacing: 0.04em;
  padding: 4px 0;
}

.mobile-nav-btn i { font-size: 18px; }
.mobile-nav-btn.active { color: var(--accent-light); }
.mobile-nav-btn .mobile-nav-badge {
  position: absolute;
  top: 6px; right: calc(50% - 18px);
  background: var(--rose);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  padding: 1px 4px;
  min-width: 14px;
  text-align: center;
  line-height: 1.4;
  display: none;
}
.mobile-nav-btn .mobile-nav-badge.show { display: block; }

/* Mobile: main app layout overrides */
body.is-mobile .app-layout {
  flex-direction: column;
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
  padding-bottom: 56px; /* reserve space for bottom nav */
}

/* Hide desktop server rail on mobile */
body.is-mobile #server-rail {
  display: none !important;
}

/* Mobile panel: show/hide via class */
body.is-mobile #channel-sidebar-wrap {
  position: fixed;
  top: 0; left: 0; bottom: 56px;
  width: 80vw;
  max-width: 300px;
  background: var(--bg-sidebar-sec);
  z-index: 150;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.is-mobile #channel-sidebar-wrap.mobile-open {
  transform: translateX(0);
  box-shadow: 4px 0 24px rgba(0,0,0,0.6);
}

/* Mobile: members sidebar hidden by default */
body.is-mobile #members-sidebar-wrap {
  position: fixed;
  top: 0; right: 0; bottom: 56px;
  width: 75vw;
  max-width: 260px;
  background: var(--bg-sidebar-sec);
  z-index: 150;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.is-mobile #members-sidebar-wrap.mobile-open {
  transform: translateX(0);
  box-shadow: -4px 0 24px rgba(0,0,0,0.6);
}

/* Overlay backdrop for mobile panels */
body.is-mobile .mobile-panel-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 140;
  -webkit-tap-highlight-color: transparent;
}

body.is-mobile .mobile-panel-backdrop.show {
  display: block;
}

/* Mobile: main content fills full width */
body.is-mobile #main-content {
  flex: 1;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

/* Mobile: sidebar width 100% when shown as panel */
body.is-mobile .channel-sidebar,
body.is-mobile .dm-sidebar {
  width: 100%;
  height: 100%;
  border-right: none;
}

/* Mobile: user panel inside sidebar on mobile */
body.is-mobile .user-panel {
  display: none; /* hidden from sidebar on mobile — profile is in bottom-right */
}

/* Mobile: members sidebar full-height */
body.is-mobile .members-sidebar {
  width: 100%;
  height: 100%;
}

/* Mobile: chat header adjustments */
body.is-mobile .chat-header {
  padding: 10px 12px;
  gap: 8px;
  min-height: 52px;
}

body.is-mobile .chat-header-name {
  font-size: 14px;
}

body.is-mobile .chat-header-desc {
  display: none;
}

/* Mobile: message input bar — taller for comfortable typing */
body.is-mobile .chat-input-area {
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
}

body.is-mobile .chat-input-wrap {
  border-radius: 26px;
  padding: 10px 14px;
  min-height: 52px;
}

body.is-mobile .chat-input {
  font-size: 15px;
  padding: 8px 12px;
  min-height: 30px;
  line-height: 1.6;
}

/* Mobile: messages */
body.is-mobile .messages-container {
  padding: 8px 10px;
}

body.is-mobile .message-row {
  margin-bottom: 4px;
}

/* Mobile: make modals full-screen */
body.is-mobile .modal {
  width: 98vw !important;
  max-width: 100vw !important;
  margin: 4px;
  border-radius: 14px !important;
  max-height: 92dvh;
  max-height: 92vh;
  overflow-y: auto;
}

body.is-mobile .modal-overlay {
  align-items: flex-end;
  padding: 0;
}

/* Mobile: auth pages */
body.is-mobile .auth-card {
  flex-direction: column;
  max-width: 100%;
  border-radius: 14px;
  min-height: auto;
}

body.is-mobile .auth-panel-left {
  flex: none;
  padding: 24px 24px 16px;
}

body.is-mobile .auth-panel-right {
  padding: 16px 24px 32px;
}

body.is-mobile .auth-panel-left .auth-features,
body.is-mobile .auth-panel-left .auth-desc {
  display: none;
}

body.is-mobile .auth-tagline {
  font-size: 16px;
  margin-bottom: 0;
}

/* Mobile: server rail as horizontal scroll in sidebar header */
body.is-mobile .mobile-server-rail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

body.is-mobile .mobile-server-rail-row::-webkit-scrollbar { height: 3px; }
body.is-mobile .mobile-server-rail-row::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.2); border-radius: 2px; }

body.is-mobile .mobile-server-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-tertiary);
  overflow: hidden;
  transition: border-radius 0.2s, box-shadow 0.2s;
  position: relative;
}

body.is-mobile .mobile-server-icon.active {
  border-radius: 10px;
  box-shadow: 0 0 12px rgba(139,92,246,0.5);
}

body.is-mobile .mobile-server-icon img {
  width: 100%; height: 100%; object-fit: cover;
}

/* Mobile: welcome screen */
body.is-mobile .welcome-screen {
  padding: 24px 16px;
}

body.is-mobile .welcome-screen h2 {
  font-size: 20px;
}

/* Mobile: friends page */
body.is-mobile .friends-header {
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
}

body.is-mobile .friends-tab {
  font-size: 12px;
  padding: 5px 10px;
}

/* Mobile: DM list scroll */
body.is-mobile .dm-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.is-mobile .channel-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mobile: hide search bar label text */
body.is-mobile .search-bar-wrap {
  padding: 6px 8px;
}

/* Mobile swipe indicator for sidebar */
body.is-mobile #channel-sidebar-wrap::after {
  content: '';
  position: absolute;
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 40px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.5;
}

/* Mobile: call overlay */
body.is-mobile .call-overlay {
  z-index: 220;
}

body.is-mobile .call-floating-panel {
  bottom: 64px !important; /* above mobile nav bar */
}

/* Mobile: hide old mobile-profile-corner — profile is accessible from bottom nav */
body.is-mobile #mobile-profile-corner {
  display: none !important;
}

#mobile-profile-corner {
  display: none;
  position: fixed;
  bottom: 64px; /* above mobile nav bar */
  right: 12px;
  z-index: 160;
  align-items: center;
  gap: 8px;
  background: rgba(13,7,26,0.95);
  border: 1px solid var(--border-accent);
  border-radius: 50px;
  padding: 6px 10px 6px 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
}

#mobile-profile-corner:hover {
  box-shadow: 0 6px 28px rgba(139,92,246,0.4);
  transform: translateY(-1px);
}

#mobile-profile-corner .mob-prof-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#mobile-profile-corner .mob-prof-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

#mobile-profile-corner .mob-prof-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s;
}

#mobile-profile-corner .mob-prof-btn:hover { color: var(--text-primary); }

/* ── Mobile: search bar on top ───────────── */
body.is-mobile .search-bar-wrap {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-sidebar-sec);
}

/* ============================
   PROFILE PREVIEW POPUP (Bottom-Right Corner Click)
   ============================ */
.ppp-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.28s ease;
}

.ppp-overlay.ppp-visible {
  opacity: 1;
  pointer-events: auto;
}

.ppp-overlay.ppp-hiding {
  opacity: 0;
  pointer-events: none;
}

.ppp-card {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 280px;
  background: linear-gradient(160deg, #0e0720 0%, #160c28 100%);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.75), 0 0 40px rgba(139, 92, 246, 0.2);
  transform: translateY(10px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease;
  pointer-events: auto;
}

.ppp-overlay.ppp-visible .ppp-card {
  transform: translateY(0) scale(1);
}

body.is-mobile .ppp-card {
  bottom: 72px;
  right: 8px;
  width: calc(100vw - 16px);
  max-width: 320px;
}

/* Banner */
.ppp-banner {
  height: 70px;
  position: relative;
  flex-shrink: 0;
}

.ppp-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: rgba(255, 255, 255, 0.8);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
}

.ppp-close-btn:hover {
  background: rgba(244, 63, 94, 0.7);
  color: white;
}

/* Avatar overlapping banner */
.ppp-avatar-wrap {
  position: relative;
  margin-top: -32px;
  margin-left: 16px;
  display: inline-block;
}

.ppp-avatar-ring {
  border: 3px solid #7c3aed;
  border-radius: 50%;
  display: inline-flex;
  padding: 2px;
  background: #0e0720;
  transition: border-color 0.3s;
}

.ppp-avatar-ring .avatar {
  display: block !important;
}

.ppp-status-dot {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2.5px solid #0e0720;
}

/* Body */
.ppp-body {
  padding: 8px 16px 16px;
}

.ppp-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 2px;
  line-height: 1.3;
}

.ppp-username {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.ppp-status-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.ppp-status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ppp-thought {
  font-size: 12px;
  color: var(--accent-light);
  font-style: italic;
  margin-bottom: 8px;
  padding: 6px 10px;
  background: rgba(139, 92, 246, 0.08);
  border-left: 2px solid rgba(139, 92, 246, 0.4);
  border-radius: 0 6px 6px 0;
  line-height: 1.5;
}

.ppp-field {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ppp-field-icon {
  font-size: 11px;
  color: var(--accent-light);
  width: 14px;
  text-align: center;
}

.ppp-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
  margin-top: 10px;
}

.ppp-about {
  font-size: 13px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 8px 10px;
  line-height: 1.5;
  margin-bottom: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.ppp-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.ppp-action-btn {
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: opacity 0.2s, transform 0.15s;
}

.ppp-action-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.ppp-action-btn:active {
  transform: scale(0.98);
}

.ppp-action-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-blue));
  color: white;
}

.ppp-action-secondary {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ppp-action-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

/* ============================
   MOBILE SETTINGS – Back/Exit Button
   ============================ */
.settings-back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  margin-right: 4px;
  transition: color 0.2s, background 0.2s;
  font-family: inherit;
  display: none; /* Hidden on desktop */
}

body.is-mobile .settings-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.settings-back-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

/* Mobile home bar strip below header */
.settings-mobile-home-bar {
  display: none;
}

body.is-mobile .settings-mobile-home-bar {
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: rgba(139, 92, 246, 0.06);
  border-bottom: 1px solid rgba(139, 92, 246, 0.15);
}

.settings-home-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-light);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s;
}

.settings-home-btn:hover {
  color: var(--text-primary);
}

/* Mobile footer exit button */
.settings-exit-home-btn {
  display: none !important;
}

body.is-mobile .settings-exit-home-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
}

/* Mobile settings back row (at the top of sidebar) */
.settings-mobile-back-row {
  display: none;
}

body.is-mobile .settings-mobile-back-row {
  display: flex;
  padding: 4px 0 8px;
}

.settings-mobile-back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: var(--accent-light);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  transition: background 0.2s, color 0.2s;
}

.settings-mobile-back-btn:hover {
  background: rgba(139, 92, 246, 0.18);
  color: var(--text-primary);
}

.settings-mobile-back-btn i {
  font-size: 14px;
}

/* Mobile settings Home nav item */
.settings-home-nav-item {
  color: var(--neon-green) !important;
}

.settings-home-nav-item:hover {
  background: rgba(34, 197, 94, 0.1) !important;
  color: var(--neon-green) !important;
}

.settings-home-nav-item i {
  color: var(--neon-green) !important;
}

/* Mobile: Home button in close-wrap area */
.settings-home-close-btn {
  display: none !important;
}

body.is-mobile .settings-home-close-btn {
  display: flex !important;
  background: rgba(34, 197, 94, 0.12) !important;
  border: 1px solid rgba(34, 197, 94, 0.3) !important;
  color: var(--neon-green) !important;
}

body.is-mobile .settings-home-close-btn:hover {
  background: rgba(34, 197, 94, 0.22) !important;
}

/* Make profile corner widget cursor clickable */
#profile-corner-widget {
  cursor: pointer;
}

#profile-corner-widget .pcw-actions {
  cursor: default;
}

/* Highlight PCW when popup is open */
#profile-corner-widget.ppp-open {
  border-color: rgba(139, 92, 246, 0.7);
  box-shadow: 0 12px 40px rgba(0,0,0,0.7), 0 0 30px rgba(139,92,246,0.4);
}


/* ============================================
   EMOJI & STICKER PICKER
   ============================================ */
.emoji-sticker-picker {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 500;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: linear-gradient(180deg, #120825 0%, #0d0620 100%);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 16px;
  box-shadow: 0 -4px 40px rgba(0,0,0,0.7), 0 0 20px rgba(139,92,246,0.15);
  backdrop-filter: blur(20px);
  overflow: hidden;
  animation: pickerSlideIn 0.18s ease;
  user-select: none;
}

.emoji-sticker-picker.hidden {
  display: none;
}

@keyframes pickerSlideIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Tabs */
.esp-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 10px 0;
  border-bottom: 1px solid rgba(139,92,246,0.15);
}

.esp-tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 10px 10px 0 0;
  transition: color 0.2s, background 0.2s;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.esp-tab-btn:hover {
  color: var(--text-secondary);
  background: rgba(139,92,246,0.08);
}

.esp-tab-btn.active {
  color: var(--accent-light);
  background: rgba(139,92,246,0.15);
  border-bottom: 2px solid var(--accent-light);
}

/* Category bar */
.esp-cats {
  display: flex;
  gap: 2px;
  padding: 8px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid rgba(139,92,246,0.1);
}

.esp-cats::-webkit-scrollbar { display: none; }

.esp-cat-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 5px 7px;
  border-radius: 8px;
  transition: background 0.15s, transform 0.15s;
  flex-shrink: 0;
  line-height: 1;
}

.esp-cat-btn:hover {
  background: rgba(139,92,246,0.12);
  transform: scale(1.15);
}

.esp-cat-btn.active {
  background: rgba(139,92,246,0.22);
  box-shadow: 0 0 0 1.5px rgba(139,92,246,0.4);
}

/* Content area */
.esp-content {
  padding: 6px 8px 10px;
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(139,92,246,0.3) transparent;
}

.esp-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 4px 4px 6px;
}

/* Emoji grid */
.esp-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

.esp-emoji-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  padding: 5px 3px;
  border-radius: 6px;
  transition: background 0.1s, transform 0.1s;
  line-height: 1;
  text-align: center;
}

.esp-emoji-btn:hover {
  background: rgba(139,92,246,0.15);
  transform: scale(1.3);
}

.esp-emoji-btn:active {
  transform: scale(1.1);
}

/* Sticker grid */
.esp-sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 4px 0;
}

.esp-sticker-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
  border-radius: 10px;
  transition: transform 0.15s;
}

.esp-sticker-btn:hover {
  transform: scale(1.08);
}

.esp-sticker-btn:hover .esp-sticker-inner {
  box-shadow: 0 4px 16px rgba(0,0,0,0.5), 0 0 12px rgba(139,92,246,0.35);
}

.esp-sticker-inner {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: box-shadow 0.15s;
}

.esp-sticker-emoji {
  font-size: 28px;
  line-height: 1;
}

.esp-sticker-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 62px;
}

/* Empty state */
.esp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

/* Toggle button active state */
.chat-input-icon.emoji-picker-toggle.active {
  color: var(--accent-light);
  background: rgba(139,92,246,0.15);
  border-radius: 6px;
}

/* Mobile: make picker full width at bottom */
body.is-mobile .emoji-sticker-picker {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  border-radius: 20px 20px 0 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  max-height: 55dvh;
  max-height: 55vh;
  display: flex;
  flex-direction: column;
  z-index: 600;
}

body.is-mobile .emoji-sticker-picker.hidden {
  display: none;
}

body.is-mobile .esp-content {
  flex: 1;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.is-mobile .esp-emoji-grid {
  grid-template-columns: repeat(9, 1fr);
}

body.is-mobile .esp-sticker-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 6px 4px;
}

body.is-mobile .esp-sticker-inner {
  width: 68px;
  height: 68px;
}

body.is-mobile .esp-sticker-emoji {
  font-size: 32px;
}

/* Mobile: backdrop behind picker */
body.is-mobile .emoji-sticker-picker::before {
  content: '';
  position: fixed;
  inset: 0;
  bottom: 100%;
  background: rgba(0,0,0,0.4);
  z-index: -1;
  pointer-events: none;
}

/* On mobile, the chat-input-area needs relative positioning */
body.is-mobile .chat-input-area {
  position: relative;
}
