/* ============================================================================
   THE REEF — Liquid Glass UI
   Reference: Discord with Vencord translucency theme
   Key: warm purple atmosphere, wallpaper bleeds through all glass panels,
   real frosted blur, compact density matching Discord's DM layout
   ============================================================================ */

:root {
  /* Warm purple atmosphere — pulled from the reference screenshot */
  --atmo-1: #1a0f2e;
  --atmo-2: #2d1b4e;
  --atmo-3: #3d2060;
  --atmo-warm: #8b4a9c;
  --atmo-rose: #c4627a;

  /* Glass surfaces — warm-tinted, NOT cold blue */
  --g0: rgba(30, 15, 50, 0.00);
  --g1: rgba(30, 15, 50, 0.45);
  --g2: rgba(30, 15, 50, 0.60);
  --g3: rgba(40, 20, 65, 0.72);
  --g4: rgba(50, 25, 80, 0.82);
  --g-modal: rgba(22, 10, 38, 0.88);

  /* Accent — jellyfish bioluminescent */
  --accent:      #a78bfa;
  --accent-dim:  #7c3aed;
  --accent-glow: rgba(167, 139, 250, 0.30);
  --accent-pop:  rgba(167, 139, 250, 0.10);
  --teal:        #5eead4;
  --teal-glow:   rgba(94, 234, 212, 0.22);
  --pink:        #f472b6;

  /* Borders — warm white, very subtle */
  --b0: rgba(255, 255, 255, 0.04);
  --b1: rgba(255, 255, 255, 0.08);
  --b2: rgba(255, 255, 255, 0.14);
  --b3: rgba(255, 255, 255, 0.22);
  --b-accent: rgba(167, 139, 250, 0.30);

  /* Specular rim — the Apple glass edge */
  --rim: rgba(255, 255, 255, 0.16);
  --rim-soft: rgba(255, 255, 255, 0.07);

  /* Status */
  --online:  #23a55a;
  --idle:    #f0b232;
  --dnd:     #f23f43;
  --offline: #80848e;

  /* Text */
  --t0: rgba(255, 255, 255, 0.92);
  --t1: rgba(255, 255, 255, 0.68);
  --t2: rgba(255, 255, 255, 0.42);
  --t3: rgba(255, 255, 255, 0.24);

  /* Layout */
  --rail-w:    66px;
  --sidebar-w: 240px;
  --members-w: 240px;

  /* Motion */
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Blur levels — wallpaper bleeds through */
  --blur-rail:    blur(20px) saturate(140%) brightness(0.7);
  --blur-sidebar: blur(28px) saturate(150%) brightness(0.72);
  --blur-header:  blur(20px) saturate(140%) brightness(0.75);
  --blur-input:   blur(24px) saturate(150%) brightness(0.8);
  --blur-modal:   blur(48px) saturate(180%) brightness(0.65);
  --blur-ctx:     blur(40px) saturate(180%) brightness(0.6);

  /* Radius */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 28px;
}

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

html, body {
  width: 100%; height: 100%; overflow: hidden;
  color: var(--t0);
  font-family: -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(167,139,250,0.35); color: #fff; }

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

button { font-family: inherit; cursor: pointer; border: none; }
input, textarea, select { font-family: inherit; }

/* --------------------------------------------------------------------------
   WALLPAPER BACKGROUND — the foundational layer everything bleeds through
   -------------------------------------------------------------------------- */
body {
  background:
    /* Warm atmospheric glow — top centre */
    radial-gradient(ellipse 120% 60% at 50% 0%,
      rgba(180, 100, 140, 0.35) 0%, transparent 60%),
    /* Left purple depth */
    radial-gradient(ellipse 80% 100% at 0% 60%,
      rgba(80, 20, 120, 0.50) 0%, transparent 65%),
    /* Right cool depth */
    radial-gradient(ellipse 70% 80% at 100% 80%,
      rgba(40, 10, 80, 0.60) 0%, transparent 60%),
    /* Bottom horizon */
    radial-gradient(ellipse 100% 50% at 50% 100%,
      rgba(120, 40, 100, 0.40) 0%, transparent 55%),
    /* Base */
    linear-gradient(170deg, #2a1040 0%, #1a0a30 35%, #120820 70%, #0e0618 100%);
}

/* Ambient floating orbs — atmospheric depth */
#ocean-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  overflow: hidden;
}

.drift-orb {
  position: absolute; border-radius: 50%; pointer-events: none;
  animation: orbFloat 18s ease-in-out infinite;
}

.drift-orb:nth-child(1) {
  width: 600px; height: 400px; top: -10%; left: 20%;
  background: radial-gradient(ellipse, rgba(180,80,160,0.18) 0%, transparent 70%);
  filter: blur(40px);
  animation-duration: 22s;
}

.drift-orb:nth-child(2) {
  width: 500px; height: 350px; bottom: 10%; right: 10%;
  background: radial-gradient(ellipse, rgba(80,20,160,0.22) 0%, transparent 70%);
  filter: blur(50px);
  animation-duration: 18s; animation-delay: -7s;
}

.drift-orb:nth-child(3) {
  width: 300px; height: 300px; top: 40%; left: 55%;
  background: radial-gradient(ellipse, rgba(100,50,200,0.12) 0%, transparent 70%);
  filter: blur(30px);
  animation-duration: 14s; animation-delay: -12s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0); }
  33%       { transform: translate(25px, -35px); }
  66%       { transform: translate(-15px, 18px); }
}

/* --------------------------------------------------------------------------
   APP SHELL
   -------------------------------------------------------------------------- */
#app { display: none; width: 100%; height: 100vh; position: relative; z-index: 1; }
#app.show { display: flex; }

/* --------------------------------------------------------------------------
   AUTH SCREEN
   -------------------------------------------------------------------------- */
#auth-screen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

.auth-card {
  position: relative; z-index: 2;
  width: 400px; max-width: 92vw;
  background: var(--g-modal);
  backdrop-filter: var(--blur-modal);
  -webkit-backdrop-filter: var(--blur-modal);
  border: 0.5px solid var(--b2);
  border-radius: var(--r-2xl);
  padding: 44px 40px;
  box-shadow:
    0 40px 80px rgba(0,0,0,0.7),
    inset 0 1px 0 var(--rim),
    inset 1px 0 0 var(--rim-soft),
    inset -1px 0 0 var(--rim-soft);
}

.auth-logo {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-bottom: 30px;
}

.auth-logo .emoji {
  font-size: 52px;
  filter: drop-shadow(0 0 28px rgba(167,139,250,0.7))
          drop-shadow(0 0 10px rgba(94,234,212,0.4));
  animation: logoPulse 3.5s ease-in-out infinite;
}

@keyframes logoPulse {
  0%,100% { filter: drop-shadow(0 0 22px rgba(167,139,250,0.6)) drop-shadow(0 0 8px rgba(94,234,212,0.35)); }
  50%      { filter: drop-shadow(0 0 40px rgba(167,139,250,0.9)) drop-shadow(0 0 18px rgba(94,234,212,0.55)); }
}

.auth-logo h1 {
  font-size: 26px; font-weight: 700; letter-spacing: -0.5px;
  color: var(--t0);
}

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

.auth-field { margin-bottom: 14px; }

.auth-field label {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: 0.65px; text-transform: uppercase;
  color: var(--t2); margin-bottom: 7px;
}

.auth-field input {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 0.5px solid var(--b2);
  border-radius: var(--r-sm);
  padding: 12px 15px; color: var(--t0); font-size: 14.5px; outline: none;
  transition: all 0.2s var(--ease);
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.15);
}

.auth-field input:focus {
  border-color: var(--accent);
  background: rgba(167,139,250,0.08);
  box-shadow: 0 0 0 3px var(--accent-glow), inset 0 1px 0 rgba(0,0,0,0.1);
}

.auth-field input::placeholder { color: var(--t3); }
.auth-field .field-error { font-size: 12px; color: var(--dnd); margin-top: 5px; min-height: 14px; }

.auth-submit {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  border: none; border-radius: var(--r-sm);
  color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer; margin-top: 8px;
  transition: all 0.2s var(--ease);
  box-shadow: 0 4px 20px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15);
  position: relative; overflow: hidden;
}

.auth-submit::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 55%);
  pointer-events: none;
}

.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 8px 30px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15); }
.auth-submit:active { transform: scale(0.98); }
.auth-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.auth-submit .spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.7s linear infinite;
  display: inline-block; vertical-align: -2px; margin-right: 7px;
}

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

.auth-switch { text-align: center; font-size: 13.5px; color: var(--t2); margin-top: 18px; }
.auth-switch a { color: var(--accent); font-weight: 600; cursor: pointer; }
.auth-switch a:hover { color: var(--pink); }

.auth-banner {
  border-radius: var(--r-sm); padding: 11px 14px;
  font-size: 13.5px; line-height: 1.5;
  margin-bottom: 16px; display: none;
}

.auth-banner.show { display: block; }
.auth-banner.error { background: rgba(242,63,67,0.14); border: 0.5px solid rgba(242,63,67,0.30); color: #fca5a5; }
.auth-banner.success { background: rgba(35,165,90,0.14); border: 0.5px solid rgba(35,165,90,0.30); color: #86efac; }

/* --------------------------------------------------------------------------
   SERVER RAIL — narrow left strip, heaviest blur so wallpaper shows through
   -------------------------------------------------------------------------- */
#server-rail {
  width: var(--rail-w); min-width: var(--rail-w); height: 100%;
  background: rgba(10, 5, 20, 0.50);
  backdrop-filter: var(--blur-rail);
  -webkit-backdrop-filter: var(--blur-rail);
  border-right: 0.5px solid var(--b0);
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; gap: 4px;
  overflow-y: auto; overflow-x: hidden; z-index: 10;
}

#server-rail::-webkit-scrollbar { width: 0; }

.server-icon {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; cursor: pointer; flex-shrink: 0; position: relative;
  transition: border-radius 0.22s var(--spring), transform 0.18s var(--spring), box-shadow 0.18s;
  background: rgba(255,255,255,0.08);
  border: 0.5px solid var(--b1);
  user-select: none;
  box-shadow: inset 0 1px 0 var(--rim-soft), 0 2px 8px rgba(0,0,0,0.3);
}

.server-icon:hover {
  border-radius: 14px; transform: scale(1.06);
  background: rgba(255,255,255,0.12); border-color: var(--b2);
  box-shadow: inset 0 1px 0 var(--rim), 0 4px 16px rgba(0,0,0,0.4);
}

.server-icon.active {
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(167,139,250,0.28), rgba(94,234,212,0.14));
  border-color: var(--b-accent);
  box-shadow: 0 0 20px var(--accent-glow), inset 0 1px 0 var(--rim), 0 4px 16px rgba(0,0,0,0.5);
}

.server-icon.active::before {
  content: ''; position: absolute; left: -12px; top: 50%;
  transform: translateY(-50%);
  width: 4px; border-radius: 0 4px 4px 0;
  height: 28px;
  background: linear-gradient(180deg, var(--accent), var(--teal));
  box-shadow: 0 0 8px var(--accent-glow);
}

.server-icon .badge {
  position: absolute; bottom: -2px; right: -2px;
  background: var(--dnd); color: #fff;
  font-size: 9px; font-weight: 700; border-radius: 50%;
  min-width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(10,5,20,0.8); padding: 0 2px;
}

.server-sep { width: 32px; height: 0.5px; background: var(--b1); margin: 2px 0; flex-shrink: 0; }

.server-add {
  background: rgba(255,255,255,0.05) !important;
  border: 1.5px dashed rgba(255,255,255,0.12) !important;
  color: var(--t2); font-size: 20px;
}

.server-add:hover {
  border-style: solid !important; border-color: var(--accent) !important;
  color: var(--accent); background: var(--accent-pop) !important;
}

/* --------------------------------------------------------------------------
   SIDEBAR — channel list, see-through with wallpaper
   -------------------------------------------------------------------------- */
#sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w); height: 100%;
  background: var(--g2);
  backdrop-filter: var(--blur-sidebar);
  -webkit-backdrop-filter: var(--blur-sidebar);
  border-right: 0.5px solid var(--b0);
  display: flex; flex-direction: column; z-index: 9;
}

#sidebar-header {
  height: 48px; padding: 0 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 0.5px solid var(--b0);
  background: rgba(0,0,0,0.12);
  cursor: pointer; flex-shrink: 0;
  transition: background 0.15s;
}

#sidebar-header:hover { background: rgba(255,255,255,0.04); }
#sidebar-header h2 { font-size: 14px; font-weight: 700; color: var(--t0); }
#sidebar-header .chevron { color: var(--t2); font-size: 11px; }

#channel-list { flex: 1; overflow-y: auto; padding: 4px 0; }

.channel-category {
  padding: 14px 8px 4px 12px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.65px;
  color: var(--t3); text-transform: uppercase;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none; transition: color 0.15s;
}

.channel-category:hover { color: var(--t1); }
.channel-category .cat-add { opacity: 0; font-size: 14px; transition: opacity 0.15s; }
.channel-category:hover .cat-add { opacity: 1; }

.channel-item {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px 5px 12px;
  border-radius: var(--r-sm); margin: 1px 6px;
  cursor: pointer; color: var(--t2); font-size: 14px; font-weight: 500;
  transition: all 0.12s; user-select: none; position: relative;
}

.channel-item:hover { background: rgba(255,255,255,0.06); color: var(--t1); }

.channel-item.active {
  background: rgba(167,139,250,0.16); color: var(--t0);
  box-shadow: inset 0 0.5px 0 var(--rim-soft);
}

.channel-item.active::before {
  content: ''; position: absolute; left: -6px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 55%;
  background: var(--accent); border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px var(--accent-glow);
}

.ch-icon { font-size: 15px; opacity: 0.55; min-width: 16px; }
.ch-ping { margin-left: auto; background: var(--dnd); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 20px; }

/* Boost bar */
.boost-bar-wrap {
  padding: 8px 12px;
  background: rgba(167,139,250,0.06);
  border-bottom: 0.5px solid var(--b0);
}

.boost-bar-label { font-size: 10.5px; color: var(--t3); margin-bottom: 4px; display: flex; justify-content: space-between; }
.boost-bar { height: 4px; background: rgba(255,255,255,0.07); border-radius: 2px; overflow: hidden; }
.boost-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--teal)); border-radius: 2px; }

/* --------------------------------------------------------------------------
   USER PANEL — matches Discord's bottom user strip
   -------------------------------------------------------------------------- */
#user-panel {
  height: 52px; flex-shrink: 0; padding: 0 8px;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 0.5px solid var(--b0);
  display: flex; align-items: center; gap: 6px;
}

.up-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; cursor: pointer; position: relative;
  transition: transform 0.18s var(--spring);
}

.up-avatar:hover { transform: scale(1.08); }

.up-status {
  position: absolute; bottom: -1px; right: -1px;
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid rgba(5,2,12,0.9);
}

.up-info { flex: 1; min-width: 0; }
.up-name { font-size: 13px; font-weight: 700; color: var(--t0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-tag { font-size: 11px; color: var(--t3); }

.up-actions { display: flex; }

.up-btn {
  background: none; color: var(--t2); padding: 6px; border-radius: var(--r-xs);
  font-size: 16px; transition: all 0.12s;
}

.up-btn:hover { background: rgba(255,255,255,0.08); color: var(--t0); }
.up-btn.active { color: var(--dnd); }

/* --------------------------------------------------------------------------
   MAIN AREA
   -------------------------------------------------------------------------- */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }

/* Header */
#chat-header {
  height: 48px; flex-shrink: 0; z-index: 5;
  background: var(--g2);
  backdrop-filter: var(--blur-header);
  -webkit-backdrop-filter: var(--blur-header);
  border-bottom: 0.5px solid var(--b0);
  display: flex; align-items: center; padding: 0 16px; gap: 10px;
  box-shadow: inset 0 -0.5px 0 var(--b0);
}

.ch-name { font-size: 15px; font-weight: 700; color: var(--t0); }

.ch-topic {
  font-size: 13px; color: var(--t3);
  border-left: 0.5px solid var(--b1); padding-left: 10px; margin-left: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px;
}

.header-icons { margin-left: auto; display: flex; gap: 2px; }

.header-btn {
  background: none; color: var(--t2); padding: 6px; border-radius: var(--r-xs);
  font-size: 17px; transition: all 0.12s;
}

.header-btn:hover { background: rgba(255,255,255,0.08); color: var(--t0); }

/* --------------------------------------------------------------------------
   MESSAGES — transparent area, wallpaper shows through fully
   -------------------------------------------------------------------------- */
#messages {
  flex: 1; overflow-y: auto;
  padding: 20px 16px 10px;
  display: flex; flex-direction: column; gap: 1px;
  /* No background — wallpaper shows */
}

.msg-group { display: flex; flex-direction: column; gap: 0; margin-bottom: 14px; }

.msg-row { display: flex; align-items: flex-start; }

.msg-avatar-col { width: 40px; flex-shrink: 0; }

.msg-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; cursor: pointer;
  transition: transform 0.18s var(--spring);
}

.msg-avatar:hover { transform: scale(1.1); }

.msg-spacer { width: 40px; flex-shrink: 0; }
.msg-body { flex: 1; min-width: 0; }

.msg-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }

.msg-name {
  font-size: 14.5px; font-weight: 700; cursor: pointer;
  color: var(--t0);
  background: linear-gradient(90deg, var(--accent) 0%, var(--teal) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.msg-ts { font-size: 11px; color: var(--t3); }
.msg-text { font-size: 14.5px; color: var(--t1); line-height: 1.55; word-wrap: break-word; }
.msg-text:hover { color: var(--t0); }
.msg-edited { font-size: 10.5px; color: var(--t3); margin-left: 4px; }

.system-msg {
  text-align: center; font-size: 12px; color: var(--t3);
  padding: 8px 0; display: flex; align-items: center; gap: 10px;
}

.system-msg::before, .system-msg::after { content: ''; flex: 1; height: 0.5px; background: var(--b0); }

/* Reactions */
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }

.reaction {
  display: flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.07);
  border: 0.5px solid var(--b1);
  border-radius: 20px; padding: 2px 9px; font-size: 13px; cursor: pointer;
  color: var(--t2); transition: all 0.12s;
}

.reaction:hover { background: rgba(255,255,255,0.12); color: var(--t0); }
.reaction.mine { background: rgba(167,139,250,0.16); border-color: var(--b-accent); color: var(--t0); }

/* Voice message */
.voice-msg {
  display: inline-flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.07);
  border: 0.5px solid var(--b1);
  border-radius: 24px; padding: 8px 14px; margin-top: 4px; max-width: 260px;
  box-shadow: inset 0 0.5px 0 var(--rim-soft);
}

.voice-play {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(145deg, var(--accent), var(--accent-dim));
  color: #fff; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px var(--accent-glow);
  transition: transform 0.18s var(--spring);
}

.voice-play:hover { transform: scale(1.1); }

.voice-wave { flex: 1; height: 28px; display: flex; align-items: center; gap: 2px; }

.voice-bar {
  width: 3px; background: linear-gradient(180deg, var(--teal), var(--accent));
  border-radius: 2px; opacity: 0.55;
}

.voice-bar.playing { animation: waveAnim 1s ease-in-out infinite; opacity: 1; }

@keyframes waveAnim { 0%,100%{transform:scaleY(0.35)} 50%{transform:scaleY(1)} }

.voice-dur { font-size: 11px; color: var(--t3); }

.msg-img {
  max-width: 380px; max-height: 280px; border-radius: var(--r-md);
  margin-top: 5px; display: block; cursor: pointer; object-fit: cover;
  border: 0.5px solid var(--b1);
  transition: transform 0.18s var(--spring);
}

.msg-img:hover { transform: scale(1.01); }

/* --------------------------------------------------------------------------
   INPUT — Discord-style pill, frosted glass
   -------------------------------------------------------------------------- */
#chat-input-area { padding: 0 16px 16px; flex-shrink: 0; }

.typing-indicator {
  font-size: 12px; color: var(--t3); padding: 3px 0 6px;
  height: 22px; display: flex; align-items: center; gap: 6px;
}

.typing-dots { display: flex; gap: 3px; }
.typing-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--t3); animation: tBounce 1.2s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes tBounce { 0%,100%{transform:translateY(0);opacity:.3} 50%{transform:translateY(-4px);opacity:1} }

#input-box {
  display: flex; align-items: flex-end; gap: 3px; padding: 7px 8px;
  background: rgba(30,15,50,0.65);
  backdrop-filter: var(--blur-input);
  -webkit-backdrop-filter: var(--blur-input);
  border: 0.5px solid var(--b2);
  border-radius: 24px;
  transition: all 0.18s var(--ease);
  box-shadow: inset 0 1px 0 var(--rim-soft), 0 4px 16px rgba(0,0,0,0.3);
}

#input-box:focus-within {
  border-color: var(--b-accent);
  box-shadow: 0 0 0 3px var(--accent-glow), inset 0 1px 0 var(--rim-soft), 0 4px 16px rgba(0,0,0,0.3);
}

.input-btn {
  background: none; color: var(--t2); padding: 6px; border-radius: var(--r-xs);
  font-size: 18px; flex-shrink: 0; transition: all 0.12s;
}

.input-btn:hover { color: var(--accent); background: rgba(255,255,255,0.05); }
.input-btn.recording { color: var(--dnd); animation: recPulse 1s infinite; }
@keyframes recPulse { 0%,100%{opacity:1} 50%{opacity:.4} }

#msg-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--t0); font-size: 14.5px; resize: none;
  max-height: 200px; min-height: 26px; line-height: 1.5; padding: 3px 6px;
}

#msg-input::placeholder { color: var(--t3); }

.send-btn {
  background: var(--accent); color: #fff; padding: 7px 12px;
  border-radius: 18px; font-size: 15px; flex-shrink: 0;
  transition: all 0.18s var(--spring);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.send-btn:hover { background: var(--accent-dim); transform: scale(1.06); }
.send-btn:active { transform: scale(0.97); }

/* Emoji picker */
#emoji-picker {
  position: absolute; bottom: calc(100% + 8px); right: 0;
  background: var(--g-modal);
  backdrop-filter: var(--blur-ctx);
  -webkit-backdrop-filter: var(--blur-ctx);
  border: 0.5px solid var(--b2);
  border-radius: var(--r-xl); padding: 14px; width: 290px;
  display: none; z-index: 100;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7), inset 0 1px 0 var(--rim);
}

#emoji-picker.show { display: block; }
.emoji-grid { display: grid; grid-template-columns: repeat(8,1fr); gap: 3px; margin-top: 8px; }
.emoji-btn { font-size: 19px; padding: 5px; border-radius: var(--r-xs); background: none; cursor: pointer; transition: all .12s var(--spring); }
.emoji-btn:hover { background: rgba(255,255,255,0.10); transform: scale(1.22); }

/* --------------------------------------------------------------------------
   MEMBERS PANEL
   -------------------------------------------------------------------------- */
#members-panel {
  width: var(--members-w); min-width: var(--members-w);
  background: var(--g2);
  backdrop-filter: var(--blur-sidebar);
  -webkit-backdrop-filter: var(--blur-sidebar);
  border-left: 0.5px solid var(--b0);
  display: flex; flex-direction: column; overflow: hidden;
}

.members-list { flex: 1; overflow-y: auto; padding: 4px 0 10px; }

.member-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 12px; border-radius: var(--r-sm);
  margin: 1px 8px; cursor: pointer; transition: background .12s;
}

.member-item:hover { background: rgba(255,255,255,0.05); }

.m-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; position: relative;
}

.m-status {
  position: absolute; bottom: -1px; right: -1px;
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid rgba(20,10,35,0.9);
}

.m-name { font-size: 13.5px; font-weight: 500; color: var(--t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --------------------------------------------------------------------------
   DM SIDEBAR
   -------------------------------------------------------------------------- */
#dm-sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w); height: 100%;
  background: var(--g2);
  backdrop-filter: var(--blur-sidebar);
  -webkit-backdrop-filter: var(--blur-sidebar);
  border-right: 0.5px solid var(--b0);
  display: flex; flex-direction: column;
}

.dm-header { padding: 12px 12px; border-bottom: 0.5px solid var(--b0); }

.dm-search {
  width: 100%; background: rgba(0,0,0,0.25);
  border: 0.5px solid var(--b1); border-radius: 18px;
  padding: 7px 12px; color: var(--t0); font-size: 13.5px; outline: none;
  transition: all .18s var(--ease);
}

.dm-search:focus { border-color: var(--b-accent); }
.dm-search::placeholder { color: var(--t3); }

.dm-section {
  padding: 12px 8px 4px 12px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .65px;
  color: var(--t3); text-transform: uppercase;
  display: flex; justify-content: space-between; align-items: center;
}

.dm-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: var(--r-sm);
  margin: 1px 6px; cursor: pointer; position: relative;
  transition: background .12s;
}

.dm-item:hover { background: rgba(255,255,255,0.06); }
.dm-item.active { background: rgba(167,139,250,0.14); }

.dm-av {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; position: relative;
}

.dm-info { flex: 1; min-width: 0; }
.dm-name { font-size: 13.5px; font-weight: 600; color: var(--t0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-preview { font-size: 12px; color: var(--t3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-icon { background: linear-gradient(145deg, rgba(167,139,250,.4), rgba(94,234,212,.25)); border-radius: 30%; }

/* --------------------------------------------------------------------------
   MODALS
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.60);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal {
  background: var(--g-modal);
  backdrop-filter: var(--blur-modal);
  -webkit-backdrop-filter: var(--blur-modal);
  border: 0.5px solid var(--b2);
  border-radius: var(--r-xl);
  padding: 28px;
  min-width: 380px; max-width: 560px; max-height: 82vh;
  overflow-y: auto; position: relative;
  box-shadow: 0 40px 80px rgba(0,0,0,0.8),
    inset 0 1px 0 var(--rim), inset 1px 0 0 var(--rim-soft),
    inset -1px 0 0 var(--rim-soft);
}

.modal h2 { font-size: 19px; font-weight: 700; color: var(--t0); margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }

.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: rgba(255,255,255,0.07);
  border: 0.5px solid var(--b1); border-radius: 50%;
  width: 28px; height: 28px; color: var(--t2); cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}

.modal-close:hover { background: rgba(255,255,255,0.14); color: var(--t0); }

.modal-input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 0.5px solid var(--b2);
  border-radius: var(--r-sm); padding: 11px 14px;
  color: var(--t0); font-size: 14px; outline: none; margin-bottom: 12px;
  transition: all .18s var(--ease);
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.15);
}

.modal-input:focus { border-color: var(--accent); background: rgba(167,139,250,0.06); box-shadow: 0 0 0 3px var(--accent-glow), inset 0 1px 0 rgba(0,0,0,0.1); }
.modal-input::placeholder { color: var(--t3); }

.modal-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  border: none; color: #fff; padding: 11px 22px;
  border-radius: var(--r-sm); cursor: pointer; font-size: 14px; font-weight: 600;
  transition: all .2s var(--spring); margin-top: 4px;
  box-shadow: 0 4px 16px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15);
  position: relative; overflow: hidden;
}

.modal-btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.10) 0%, transparent 50%);
  pointer-events: none;
}

.modal-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 28px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15); }
.modal-btn:active { transform: scale(0.98); }
.modal-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.modal-btn.danger { background: linear-gradient(135deg, var(--dnd), #b91c1c); box-shadow: 0 4px 16px rgba(242,63,67,0.3), inset 0 1px 0 rgba(255,255,255,0.12); }
.modal-btn.ghost { background: rgba(255,255,255,0.07); border: 0.5px solid var(--b2); box-shadow: inset 0 1px 0 var(--rim-soft); }

.modal-label { font-size: 11px; font-weight: 700; letter-spacing: .65px; text-transform: uppercase; color: var(--t2); margin-bottom: 7px; display: block; }
.modal-error { font-size: 13px; color: var(--dnd); margin: -6px 0 10px; }

/* --------------------------------------------------------------------------
   CALL MODAL
   -------------------------------------------------------------------------- */
#call-modal {
  display: none; position: fixed; inset: 0; z-index: 900;
  background: rgba(5,2,15,0.92);
  backdrop-filter: blur(40px) saturate(150%);
  -webkit-backdrop-filter: blur(40px) saturate(150%);
}

#call-modal.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }

.call-ring-name { font-size: 23px; font-weight: 700; color: var(--t0); margin-bottom: 6px; }
.call-ring-status { font-size: 14px; color: var(--t2); margin-bottom: 32px; }

.call-avatar {
  width: 78px; height: 78px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; position: relative;
  border: 1px solid var(--b-accent);
  box-shadow: 0 0 36px var(--accent-glow), inset 0 1px 0 var(--rim);
}

.call-pulse::after {
  content: ''; position: absolute; inset: -10px; border-radius: 50%;
  border: 1.5px solid rgba(167,139,250,.38);
  animation: cPulse 1.8s ease-out infinite;
}

@keyframes cPulse { 0%{transform:scale(1);opacity:1} 100%{transform:scale(1.5);opacity:0} }

.call-controls { display: flex; gap: 14px; }

.call-btn {
  width: 58px; height: 58px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  transition: all .2s var(--spring);
}

.call-btn:hover { transform: scale(1.1); }
.call-btn:active { transform: scale(0.95); }
.call-btn.end { background: linear-gradient(145deg, var(--dnd), #b91c1c); color: #fff; box-shadow: 0 6px 22px rgba(242,63,67,.35); }
.call-btn.accept { background: linear-gradient(145deg, var(--online), #15803d); color: #fff; box-shadow: 0 6px 22px rgba(35,165,90,.35); }
.call-btn.mute { background: rgba(255,255,255,0.10); border: 0.5px solid var(--b2); color: var(--t0); }
.call-btn.active { background: rgba(167,139,250,.28); border-color: var(--b-accent); }

.call-video-grid { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 26px; }

.call-video-tile {
  background: rgba(255,255,255,0.06); border: 0.5px solid var(--b2);
  border-radius: var(--r-lg); overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 32px rgba(0,0,0,.5), inset 0 1px 0 var(--rim-soft);
}

.call-video-tile video { width: 100%; height: 100%; object-fit: cover; }
.call-video-tile .tile-name { position: absolute; bottom: 8px; left: 10px; font-size: 12px; font-weight: 600; color: #fff; background: rgba(0,0,0,.5); backdrop-filter: blur(8px); padding: 2px 9px; border-radius: 20px; }

/* --------------------------------------------------------------------------
   CONTEXT MENU
   -------------------------------------------------------------------------- */
#ctx-menu {
  position: fixed; z-index: 2000; display: none;
  background: rgba(18,10,32,0.92);
  backdrop-filter: var(--blur-ctx);
  -webkit-backdrop-filter: var(--blur-ctx);
  border: 0.5px solid var(--b2); border-radius: var(--r-md);
  padding: 5px; min-width: 186px;
  box-shadow: 0 24px 60px rgba(0,0,0,.7), inset 0 1px 0 var(--rim);
}

#ctx-menu.show { display: block; }

.ctx-item { padding: 7px 12px; border-radius: var(--r-xs); cursor: pointer; font-size: 13.5px; color: var(--t1); display: flex; align-items: center; gap: 8px; transition: all .1s; }
.ctx-item:hover { background: rgba(255,255,255,0.08); color: var(--t0); }
.ctx-item.danger { color: var(--dnd); }
.ctx-item.danger:hover { background: rgba(242,63,67,0.12); }
.ctx-sep { height: 0.5px; background: var(--b1); margin: 4px 0; }

/* --------------------------------------------------------------------------
   STATUS MENU
   -------------------------------------------------------------------------- */
.status-menu {
  position: absolute; bottom: 58px; left: 76px;
  background: rgba(18,10,32,0.92);
  backdrop-filter: var(--blur-ctx);
  -webkit-backdrop-filter: var(--blur-ctx);
  border: 0.5px solid var(--b2); border-radius: var(--r-md);
  padding: 6px; min-width: 190px; z-index: 500;
  box-shadow: 0 24px 60px rgba(0,0,0,.7), inset 0 1px 0 var(--rim);
  display: none;
}

.status-menu.show { display: block; }
.status-item { display: flex; align-items: center; gap: 9px; padding: 7px 11px; border-radius: var(--r-xs); cursor: pointer; font-size: 13.5px; color: var(--t1); transition: all .1s; }
.status-item:hover { background: rgba(255,255,255,0.08); color: var(--t0); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* --------------------------------------------------------------------------
   SIDE PANEL
   -------------------------------------------------------------------------- */
#side-panel {
  position: absolute; right: var(--members-w); top: 48px; bottom: 0; width: 320px;
  background: var(--g3);
  backdrop-filter: var(--blur-sidebar);
  -webkit-backdrop-filter: var(--blur-sidebar);
  border-left: 0.5px solid var(--b1);
  z-index: 20; display: none; flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,.3);
}

#side-panel.show { display: flex; }
.sp-header { padding: 14px 16px; font-size: 14px; font-weight: 700; color: var(--t0); border-bottom: 0.5px solid var(--b0); display: flex; align-items: center; justify-content: space-between; }
.sp-content { flex: 1; overflow-y: auto; padding: 14px; }

/* --------------------------------------------------------------------------
   SETTINGS
   -------------------------------------------------------------------------- */
.settings-tabs { display: flex; gap: 4px; margin-bottom: 18px; flex-wrap: wrap; }
.stab { background: none; border: 0.5px solid var(--b1); border-radius: var(--r-sm); padding: 6px 14px; color: var(--t2); cursor: pointer; font-size: 13px; transition: all .15s; }
.stab:hover { background: rgba(255,255,255,0.06); color: var(--t1); }
.stab.active { background: rgba(167,139,250,0.16); border-color: var(--b-accent); color: var(--t0); }

.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 13px; background: rgba(255,255,255,0.05); border: 0.5px solid var(--b0); border-radius: var(--r-sm); margin-bottom: 6px; }
.toggle-row span { font-size: 13.5px; color: var(--t1); }
.toggle { width: 38px; height: 22px; border-radius: 11px; background: var(--t3); cursor: pointer; position: relative; border: none; transition: all .2s; }
.toggle.on { background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s var(--spring); box-shadow: 0 1px 4px rgba(0,0,0,0.3); }
.toggle.on::after { transform: translateX(16px); }
.color-row { display: flex; gap: 9px; margin-top: 6px; }
.color-swatch { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: all .18s var(--spring); }
.color-swatch:hover, .color-swatch.selected { border-color: #fff; transform: scale(1.18); }

/* --------------------------------------------------------------------------
   TOASTS
   -------------------------------------------------------------------------- */
#toast-area { position: fixed; top: 14px; right: 14px; display: flex; flex-direction: column; gap: 7px; z-index: 3000; pointer-events: none; }

.toast {
  background: rgba(18,10,32,0.90);
  backdrop-filter: var(--blur-ctx);
  -webkit-backdrop-filter: var(--blur-ctx);
  border: 0.5px solid var(--b2); border-radius: var(--r-md);
  padding: 12px 14px; display: flex; align-items: center; gap: 10px;
  min-width: 280px; pointer-events: all;
  box-shadow: 0 20px 50px rgba(0,0,0,.65), inset 0 1px 0 var(--rim);
  animation: toastIn .3s var(--spring);
}

@keyframes toastIn { from{transform:translateX(110px);opacity:0} to{transform:translateX(0);opacity:1} }

.toast-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.toast-body { flex: 1; min-width: 0; }
.toast-name { font-size: 13px; font-weight: 700; color: var(--t0); }
.toast-preview { font-size: 12px; color: var(--t2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast-dismiss { background: none; color: var(--t3); cursor: pointer; font-size: 16px; padding: 2px; border-radius: var(--r-xs); }
.toast-dismiss:hover { color: var(--t1); }

/* --------------------------------------------------------------------------
   MISC
   -------------------------------------------------------------------------- */
.invite-link { background: rgba(255,255,255,0.05); border: 0.5px solid var(--b1); border-radius: var(--r-sm); padding: 10px 13px; font-size: 13px; color: var(--teal); font-family: 'SF Mono', monospace; word-break: break-all; display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.copy-link-btn { background: rgba(255,255,255,0.08); border: 0.5px solid var(--b1); border-radius: var(--r-xs); padding: 5px 10px; color: var(--t1); cursor: pointer; font-size: 12px; white-space: nowrap; transition: all .15s; }
.copy-link-btn:hover { border-color: var(--b-accent); color: var(--accent); }

.screenshare-badge { background: rgba(35,165,90,0.14); border: 0.5px solid rgba(35,165,90,0.28); border-radius: 20px; padding: 3px 10px; font-size: 12px; color: var(--online); display: flex; align-items: center; gap: 5px; }
.ss-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--online); animation: ssBlink 1s infinite; }
@keyframes ssBlink { 0%,100%{opacity:1} 50%{opacity:.3} }

.loading-screen { position: fixed; inset: 0; z-index: 50; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.loading-screen.show { display: flex; }
.loading-screen .emoji { font-size: 48px; animation: logoPulse 2s ease-in-out infinite; }
.loading-screen p { color: var(--t2); font-size: 14px; }

#scroll-bottom { position: absolute; bottom: 88px; right: 22px; background: var(--accent); color: #fff; border: none; border-radius: 50%; width: 36px; height: 36px; cursor: pointer; font-size: 15px; display: none; align-items: center; justify-content: center; box-shadow: 0 6px 18px var(--accent-glow); z-index: 30; transition: transform .18s var(--spring); }
#scroll-bottom:hover { transform: scale(1.12); }

.empty-state { flex: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; color: var(--t3); padding: 40px; text-align: center; }
.empty-state .icon { font-size: 52px; opacity: 0.55; }
.empty-state h3 { font-size: 16px; color: var(--t2); font-weight: 700; }
.empty-state p { font-size: 13.5px; max-width: 280px; line-height: 1.5; }

/* Voice view */
.voice-join-btn { background: linear-gradient(135deg, var(--accent), var(--teal)); border: none; color: #fff; padding: 13px 32px; border-radius: 30px; cursor: pointer; font-size: 15px; font-weight: 600; transition: all .2s var(--spring); box-shadow: 0 8px 26px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15); }
.voice-join-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 38px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15); }

/* Forum */
.forum-post { background: rgba(255,255,255,0.05); border: 0.5px solid var(--b1); border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 8px; cursor: pointer; transition: all .18s; }
.forum-post:hover { background: rgba(255,255,255,0.09); border-color: var(--b-accent); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.fp-title { font-size: 14.5px; font-weight: 700; color: var(--t0); margin-bottom: 7px; }
.fp-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.fp-tag { background: rgba(167,139,250,0.12); border: 0.5px solid rgba(167,139,250,0.22); border-radius: 20px; padding: 2px 9px; font-size: 11px; color: var(--accent); }
.fp-meta { font-size: 12px; color: var(--t3); display: flex; gap: 12px; }

.thread-badge { font-size: 11px; background: rgba(167,139,250,0.12); border: 0.5px solid rgba(167,139,250,0.22); border-radius: 10px; padding: 1px 7px; color: var(--accent); margin-left: 6px; }

@media (max-width: 900px) { #members-panel { display: none; } }
@media (max-width: 640px) { #server-rail { display: none; } #sidebar { width: 200px; min-width: 200px; } }
