/* ═══════════════════════════════════════════════════════════
   HAVEN — Multi-Theme Stylesheet
   Themes: Haven (default), Discord, Matrix, Tron, HALO, LoTR
   ═══════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=VT323&family=Share+Tech+Mono&display=swap');

/* ─── THEME: Haven (Default) ───────────────────────────── */
:root, [data-theme="haven"] {
  --bg-primary:    #191b28;
  --bg-secondary:  #1e2035;
  --bg-tertiary:   #252840;
  --bg-hover:      #2c2f4a;
  --bg-active:     #333660;
  --bg-input:      #15172a;
  --bg-card:       #1c1e33;

  --accent:        #7c5cfc;
  --accent-hover:  #9478ff;
  --accent-dim:    #5a3fd4;
  --accent-glow:   rgba(124, 92, 252, 0.25);

  --text-primary:  #e2e4f0;
  --text-secondary:#9498b3;
  --text-muted:    #5d6180;
  --text-link:     #82aaff;

  --border:        #2d3050;
  --border-light:  #383b5e;

  --success:       #43b581;
  --danger:        #f04747;
  --warning:       #faa61a;

  --led-on:        #43b581;
  --led-off:       #555;
  --led-glow:      rgba(67, 181, 129, 0.5);

  --font-main:     'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:     'Consolas', 'Courier New', monospace;
  --font-heading:  'Segoe UI', system-ui, sans-serif;

  --radius:        8px;
  --radius-sm:     4px;
  --transition:    0.15s ease;
  --sidebar-width: 250px;
  --right-width:   220px;

  --theme-logo:    "⬡";
  --msg-glow:      none;
  --scanline:      none;
}

/* ─── THEME: Discord ───────────────────────────────────── */
[data-theme="discord"] {
  --bg-primary:    #313338;
  --bg-secondary:  #2b2d31;
  --bg-tertiary:   #383a40;
  --bg-hover:      #3a3c42;
  --bg-active:     #43454d;
  --bg-input:      #1e1f22;
  --bg-card:       #2b2d31;

  --accent:        #5865f2;
  --accent-hover:  #6d78f5;
  --accent-dim:    #4752c4;
  --accent-glow:   rgba(88, 101, 242, 0.25);

  --text-primary:  #f2f3f5;
  --text-secondary:#b5bac1;
  --text-muted:    #6d6f78;
  --text-link:     #00a8fc;

  --border:        #3f4147;
  --border-light:  #4e5058;

  --success:       #23a55a;
  --danger:        #f23f43;
  --warning:       #f0b232;

  --led-on:        #23a55a;
  --led-glow:      rgba(35, 165, 90, 0.5);

  --theme-logo:    "🎮";
}

/* ─── THEME: Matrix ────────────────────────────────────── */
[data-theme="matrix"] {
  --bg-primary:    #0a0a0a;
  --bg-secondary:  #0d0d0d;
  --bg-tertiary:   #141414;
  --bg-hover:      #1a1a1a;
  --bg-active:     #002200;
  --bg-input:      #050505;
  --bg-card:       #0d0d0d;

  --accent:        #00ff41;
  --accent-hover:  #33ff66;
  --accent-dim:    #00cc33;
  --accent-glow:   rgba(0, 255, 65, 0.3);

  --text-primary:  #00ff41;
  --text-secondary:#00bb30;
  --text-muted:    #006618;
  --text-link:     #00ff99;

  --border:        #003300;
  --border-light:  #004400;

  --success:       #00ff41;
  --danger:        #ff0040;
  --warning:       #ccff00;

  --led-on:        #00ff41;
  --led-glow:      rgba(0, 255, 65, 0.6);

  --font-main:     'Courier New', 'Consolas', monospace;
  --font-heading:  'Courier New', monospace;
  --font-mono:     'Courier New', monospace;

  --theme-logo:    "Ⅿ";
  --msg-glow:      0 0 4px rgba(0, 255, 65, 0.15);
  --scanline:      repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 65, 0.015) 2px,
    rgba(0, 255, 65, 0.015) 4px
  );
}

/* Matrix accent overrides — glitch aesthetic */
[data-theme="matrix"] .brand-text { text-shadow: 0 0 8px rgba(0, 255, 65, 0.4); }
[data-theme="matrix"] .channel-badge { background: #00ff41; color: #000; }
[data-theme="matrix"] .message-avatar, [data-theme="matrix"] .message-avatar-img { border: 1px solid rgba(0, 255, 65, 0.3); }

/* ─── THEME: Tron ──────────────────────────────────────── */
[data-theme="tron"] {
  --bg-primary:    #0c141f;
  --bg-secondary:  #0a1018;
  --bg-tertiary:   #111d2b;
  --bg-hover:      #162536;
  --bg-active:     #0d3a5c;
  --bg-input:      #060d16;
  --bg-card:       #0a1018;

  --accent:        #6fecff;
  --accent-hover:  #9df3ff;
  --accent-dim:    #3ec6df;
  --accent-glow:   rgba(111, 236, 255, 0.3);

  --text-primary:  #d4f6ff;
  --text-secondary:#7ab8cc;
  --text-muted:    #3a6a7a;
  --text-link:     #6fecff;

  --border:        #1a3344;
  --border-light:  #244455;

  --success:       #6fecff;
  --danger:        #ff6f3f;
  --warning:       #ffe76f;

  --led-on:        #6fecff;
  --led-glow:      rgba(111, 236, 255, 0.6);

  --font-main:     'Segoe UI', system-ui, sans-serif;
  --font-heading:  'Segoe UI', system-ui, sans-serif;

  --theme-logo:    "◈";
  --msg-glow:      0 0 4px rgba(111, 236, 255, 0.08);
}

/* Tron accent overrides — identity disc glow */
[data-theme="tron"] .brand-text { text-shadow: 0 0 10px rgba(111, 236, 255, 0.4); color: #6fecff; }
[data-theme="tron"] .server-icon.home { background: transparent; border: 2px solid #6fecff; box-shadow: 0 0 8px rgba(111, 236, 255, 0.4); }
[data-theme="tron"] .channel-item.active::before { background: #6fecff; box-shadow: 0 0 6px rgba(111, 236, 255, 0.5); }
[data-theme="tron"] .btn-send { box-shadow: 0 0 8px rgba(111, 236, 255, 0.3); }
[data-theme="tron"] .message-avatar, [data-theme="tron"] .message-avatar-img { border: 1px solid rgba(111, 236, 255, 0.25); }

/* ─── THEME: HALO ──────────────────────────────────────── */
[data-theme="halo"] {
  --bg-primary:    #0d1a0d;
  --bg-secondary:  #0a150a;
  --bg-tertiary:   #142214;
  --bg-hover:      #1a2e1a;
  --bg-active:     #1f3a1f;
  --bg-input:      #070e07;
  --bg-card:       #0c170c;

  --accent:        #d4a020;
  --accent-hover:  #e8b832;
  --accent-dim:    #b08818;
  --accent-glow:   rgba(212, 160, 32, 0.35);

  --text-primary:  #d4e0c8;
  --text-secondary:#8aaa78;
  --text-muted:    #4a6a3a;
  --text-link:     #4fc3f7;

  --border:        #1a3318;
  --border-light:  #264a22;

  --success:       #4ca64c;
  --danger:        #cc3333;
  --warning:       #d4a020;

  --led-on:        #d4a020;
  --led-glow:      rgba(212, 160, 32, 0.5);

  --font-main:     'Segoe UI', system-ui, sans-serif;
  --font-heading:  'Segoe UI', system-ui, sans-serif;
  --font-mono:     'Consolas', monospace;

  --theme-logo:    "⌁";
  --msg-glow:      0 0 4px rgba(212, 160, 32, 0.06);
}

/* HALO accent overrides — energy sword blue highlights */
[data-theme="halo"] .channel-item.active::before { background: #4fc3f7; }
[data-theme="halo"] .btn-send { background: #4fc3f7; }
[data-theme="halo"] .btn-send:hover { background: #6fd4ff; }
[data-theme="halo"] .mention { background: rgba(79, 195, 247, 0.15); color: #4fc3f7; }
[data-theme="halo"] .reaction-badge.own { background: rgba(79, 195, 247, 0.2); border-color: #4fc3f7; }
[data-theme="halo"] .reaction-badge:hover { background: rgba(79, 195, 247, 0.15); border-color: #4fc3f7; }
[data-theme="halo"] .channel-badge { background: #4fc3f7; }
[data-theme="halo"] .server-icon.home { background: linear-gradient(135deg, #4ca64c, #d4a020); }
[data-theme="halo"] .server-icon:hover { background: #4fc3f7; }
[data-theme="halo"] .brand-text { background: linear-gradient(90deg, #4ca64c, #d4a020, #4fc3f7); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
[data-theme="halo"] .inline-code { color: #4fc3f7; }

/* ─── THEME: LoTR ──────────────────────────────────────── */
[data-theme="lotr"] {
  --bg-primary:    #1a1510;
  --bg-secondary:  #1e1812;
  --bg-tertiary:   #2a221a;
  --bg-hover:      #342a20;
  --bg-active:     #3e3225;
  --bg-input:      #140f0a;
  --bg-card:       #1e1812;

  --accent:        #d4a844;
  --accent-hover:  #e0be66;
  --accent-dim:    #b08830;
  --accent-glow:   rgba(212, 168, 68, 0.3);

  --text-primary:  #e8dcc8;
  --text-secondary:#b0a088;
  --text-muted:    #6e6050;
  --text-link:     #e0c070;

  --border:        #3a3028;
  --border-light:  #4a3e32;

  --success:       #6e9e3a;
  --danger:        #b03030;
  --warning:       #d4a844;

  --led-on:        #d4a844;
  --led-glow:      rgba(212, 168, 68, 0.5);

  --font-main:     'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, serif;
  --font-heading:  'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  --font-mono:     'Consolas', monospace;

  --theme-logo:    "⚜";

  /* Worn parchment scanlines */
  --scanline:      repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(212, 168, 68, 0.008) 3px,
    rgba(212, 168, 68, 0.008) 6px
  );
}

/* LoTR accent overrides — elvish warmth */
[data-theme="lotr"] .brand-text { font-style: italic; }
[data-theme="lotr"] .welcome-icon { color: #d4a844; }
[data-theme="lotr"] .server-icon.home { background: linear-gradient(135deg, #8a6a20, #d4a844); }

/* ─── THEME: Cyberpunk ─────────────────────────────────── */
[data-theme="cyberpunk"] {
  --bg-primary:    #0a0a12;
  --bg-secondary:  #0e0e1a;
  --bg-tertiary:   #151525;
  --bg-hover:      #1c1c32;
  --bg-active:     #2a1a3a;
  --bg-input:      #06060e;
  --bg-card:       #0e0e1a;

  --accent:        #ff2d6f;
  --accent-hover:  #ff5a90;
  --accent-dim:    #cc1a55;
  --accent-glow:   rgba(255, 45, 111, 0.3);

  --text-primary:  #f0e6ff;
  --text-secondary:#b090d0;
  --text-muted:    #5a4080;
  --text-link:     #00f0ff;

  --border:        #2a1a40;
  --border-light:  #3a2a55;

  --success:       #00ff88;
  --danger:        #ff2d6f;
  --warning:       #ffe14d;

  --led-on:        #00ff88;
  --led-glow:      rgba(0, 255, 136, 0.5);

  --font-main:     'Segoe UI', system-ui, sans-serif;
  --font-heading:  'Segoe UI', system-ui, sans-serif;
  --font-mono:     'Consolas', monospace;

  --theme-logo:    "⚡";
  --msg-glow:      0 0 4px rgba(255, 45, 111, 0.08);
}

/* Cyberpunk accent splashes — neon contrasts */
[data-theme="cyberpunk"] .channel-item.active::before { background: #00f0ff; }
[data-theme="cyberpunk"] .inline-code { color: #00f0ff; }
[data-theme="cyberpunk"] .brand-text { background: linear-gradient(90deg, #ff2d6f, #00f0ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
[data-theme="cyberpunk"] .server-icon.home { background: linear-gradient(135deg, #ff2d6f, #00f0ff); }

/* ─── THEME: Nord ──────────────────────────────────────── */
[data-theme="nord"] {
  --bg-primary:    #2e3440;
  --bg-secondary:  #3b4252;
  --bg-tertiary:   #434c5e;
  --bg-hover:      #4c566a;
  --bg-active:     #5e6a82;
  --bg-input:      #2a2f3b;
  --bg-card:       #3b4252;

  --accent:        #88c0d0;
  --accent-hover:  #8fbcbb;
  --accent-dim:    #5e81ac;
  --accent-glow:   rgba(136, 192, 208, 0.25);

  --text-primary:  #eceff4;
  --text-secondary:#d8dee9;
  --text-muted:    #7b88a1;
  --text-link:     #88c0d0;

  --border:        #4c566a;
  --border-light:  #5e6a82;

  --success:       #a3be8c;
  --danger:        #bf616a;
  --warning:       #ebcb8b;

  --led-on:        #a3be8c;
  --led-glow:      rgba(163, 190, 140, 0.5);

  --font-main:     'Segoe UI', system-ui, sans-serif;
  --font-heading:  'Segoe UI', system-ui, sans-serif;
  --font-mono:     'Consolas', monospace;

  --theme-logo:    "❄";
}

/* Nord accent splashes — aurora colors */
[data-theme="nord"] .mention { background: rgba(180, 142, 173, 0.2); color: #b48ead; }
[data-theme="nord"] .brand-text { color: #88c0d0; }

/* ─── THEME: Dracula ───────────────────────────────────── */
[data-theme="dracula"] {
  --bg-primary:    #1a1b26;
  --bg-secondary:  #16171f;
  --bg-tertiary:   #22232e;
  --bg-hover:      #2a2c3a;
  --bg-active:     #32344a;
  --bg-input:      #12131a;
  --bg-card:       #16171f;

  --accent:        #bd93f9;
  --accent-hover:  #caa6fc;
  --accent-dim:    #9d73d9;
  --accent-glow:   rgba(189, 147, 249, 0.3);

  --text-primary:  #f8f8f2;
  --text-secondary:#b0b0c0;
  --text-muted:    #565a7a;
  --text-link:     #8be9fd;

  --border:        #2a2c40;
  --border-light:  #383a52;

  --success:       #50fa7b;
  --danger:        #ff5555;
  --warning:       #f1fa8c;

  --led-on:        #50fa7b;
  --led-glow:      rgba(80, 250, 123, 0.5);

  --font-main:     'Segoe UI', system-ui, sans-serif;
  --font-heading:  'Segoe UI', system-ui, sans-serif;
  --font-mono:     'Consolas', monospace;

  --theme-logo:    "🧛";
  --msg-glow:      0 0 4px rgba(189, 147, 249, 0.06);
}

/* Dracula accent splashes */
[data-theme="dracula"] .inline-code { color: #50fa7b; }
[data-theme="dracula"] .mention { background: rgba(255, 121, 198, 0.15); color: #ff79c6; }
[data-theme="dracula"] .brand-text { background: linear-gradient(90deg, #bd93f9, #ff79c6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* ─── THEME: Bloodborne (Red & Black) ──────────────────── */
[data-theme="bloodborne"] {
  --bg-primary:    #0a0000;
  --bg-secondary:  #110808;
  --bg-tertiary:   #1a0c0c;
  --bg-hover:      #2a1010;
  --bg-active:     #3a1515;
  --bg-input:      #060000;
  --bg-card:       #110808;

  --accent:        #cc0020;
  --accent-hover:  #ff1a3a;
  --accent-dim:    #990018;
  --accent-glow:   rgba(204, 0, 32, 0.4);

  --text-primary:  #f0d0d0;
  --text-secondary:#b08080;
  --text-muted:    #6a3a3a;
  --text-link:     #ff4060;

  --border:        #2a1515;
  --border-light:  #3a2020;

  --success:       #cc0020;
  --danger:        #ff0030;
  --warning:       #ff6600;

  --led-on:        #ff0030;
  --led-off:       #330000;
  --led-glow:      rgba(255, 0, 48, 0.6);

  --font-main:     'Segoe UI', system-ui, sans-serif;
  --font-heading:  'Segoe UI', system-ui, sans-serif;
  --font-mono:     'Consolas', monospace;

  --theme-logo:    "🩸";
  --msg-glow:      0 0 6px rgba(204, 0, 32, 0.12);
}

/* Bloodborne accent overrides — blood and darkness */
[data-theme="bloodborne"] .brand-text { color: #cc0020; text-shadow: 0 0 12px rgba(204, 0, 32, 0.5); }
[data-theme="bloodborne"] .server-icon.home { background: linear-gradient(135deg, #660010, #cc0020); box-shadow: 0 0 10px rgba(204, 0, 32, 0.4); }
[data-theme="bloodborne"] .channel-item.active::before { background: #ff0030; box-shadow: 0 0 8px rgba(255, 0, 48, 0.6); }
[data-theme="bloodborne"] .btn-send { box-shadow: 0 0 8px rgba(204, 0, 32, 0.4); }
[data-theme="bloodborne"] .message-avatar, [data-theme="bloodborne"] .message-avatar-img { border: 1px solid rgba(204, 0, 32, 0.3); }
[data-theme="bloodborne"] .channel-badge { background: #cc0020; color: #fff; }
[data-theme="bloodborne"] .inline-code { color: #ff4060; }

/* ─── THEME: Ice (Ice Blue) ────────────────────────────── */
[data-theme="ice"] {
  --bg-primary:    #0a1520;
  --bg-secondary:  #0c1a28;
  --bg-tertiary:   #102030;
  --bg-hover:      #142838;
  --bg-active:     #183040;
  --bg-input:      #060e18;
  --bg-card:       #0c1a28;

  --accent:        #00d4ff;
  --accent-hover:  #40e0ff;
  --accent-dim:    #00a8cc;
  --accent-glow:   rgba(0, 212, 255, 0.35);

  --text-primary:  #d8f0ff;
  --text-secondary:#80b8d8;
  --text-muted:    #3a6a88;
  --text-link:     #00d4ff;

  --border:        #1a3048;
  --border-light:  #224058;

  --success:       #00d4ff;
  --danger:        #ff3060;
  --warning:       #ffcc00;

  --led-on:        #00d4ff;
  --led-off:       #0a1a2a;
  --led-glow:      rgba(0, 212, 255, 0.6);

  --font-main:     'Segoe UI', system-ui, sans-serif;
  --font-heading:  'Segoe UI', system-ui, sans-serif;
  --font-mono:     'Consolas', monospace;

  --theme-logo:    "🧊";
  --msg-glow:      0 0 4px rgba(0, 212, 255, 0.08);
}

/* Ice accent overrides — frozen glow */
[data-theme="ice"] .brand-text { color: #00d4ff; text-shadow: 0 0 12px rgba(0, 212, 255, 0.5); }
[data-theme="ice"] .server-icon.home { background: linear-gradient(135deg, #005580, #00d4ff); box-shadow: 0 0 10px rgba(0, 212, 255, 0.3); }
[data-theme="ice"] .channel-item.active::before { background: #00d4ff; box-shadow: 0 0 8px rgba(0, 212, 255, 0.5); }
[data-theme="ice"] .btn-send { box-shadow: 0 0 8px rgba(0, 212, 255, 0.3); }
[data-theme="ice"] .message-avatar, [data-theme="ice"] .message-avatar-img { border: 1px solid rgba(0, 212, 255, 0.25); }
[data-theme="ice"] .channel-badge { background: #00d4ff; color: #0a1520; }
[data-theme="ice"] .inline-code { color: #40e0ff; }

/* ─── THEME: Abyss (Deep Ocean / Navy Blue) ────────────── */
[data-theme="abyss"] {
  --bg-primary:    #040810;
  --bg-secondary:  #060c18;
  --bg-tertiary:   #0a1220;
  --bg-hover:      #0e1830;
  --bg-active:     #122040;
  --bg-input:      #020610;
  --bg-card:       #060c18;

  --accent:        #1a5aff;
  --accent-hover:  #3a70ff;
  --accent-dim:    #0040cc;
  --accent-glow:   rgba(26, 90, 255, 0.35);

  --text-primary:  #c8d8f0;
  --text-secondary:#7088b0;
  --text-muted:    #384868;
  --text-link:     #4488ff;

  --border:        #101830;
  --border-light:  #182240;

  --success:       #00cc88;
  --danger:        #ff2050;
  --warning:       #ff8800;

  --led-on:        #1a5aff;
  --led-off:       #0a0e1a;
  --led-glow:      rgba(26, 90, 255, 0.6);

  --font-main:     'Segoe UI', system-ui, sans-serif;
  --font-heading:  'Segoe UI', system-ui, sans-serif;
  --font-mono:     'Consolas', monospace;

  --theme-logo:    "🌊";
  --msg-glow:      0 0 4px rgba(26, 90, 255, 0.08);
}

/* Abyss accent overrides — deep ocean pressure */
[data-theme="abyss"] .brand-text { color: #4488ff; text-shadow: 0 0 12px rgba(26, 90, 255, 0.5); }
[data-theme="abyss"] .server-icon.home { background: linear-gradient(135deg, #0a2060, #1a5aff); box-shadow: 0 0 10px rgba(26, 90, 255, 0.3); }
[data-theme="abyss"] .channel-item.active::before { background: #1a5aff; box-shadow: 0 0 8px rgba(26, 90, 255, 0.5); }
[data-theme="abyss"] .btn-send { box-shadow: 0 0 8px rgba(26, 90, 255, 0.3); }
[data-theme="abyss"] .message-avatar, [data-theme="abyss"] .message-avatar-img { border: 1px solid rgba(26, 90, 255, 0.25); }
[data-theme="abyss"] .channel-badge { background: #1a5aff; color: #fff; }
[data-theme="abyss"] .inline-code { color: #4488ff; }

/* ─── THEME: Dark Souls ────────────────────────────────── */
[data-theme="darksouls"] {
  --bg-primary:    #0c0a08;
  --bg-secondary:  #110e0b;
  --bg-tertiary:   #1a1510;
  --bg-hover:      #241e16;
  --bg-active:     #2e261c;
  --bg-input:      #080604;
  --bg-card:       #110e0b;

  --accent:        #c8a84e;
  --accent-hover:  #dcc06a;
  --accent-dim:    #a08030;
  --accent-glow:   rgba(200, 168, 78, 0.35);

  --text-primary:  #d8ccb0;
  --text-secondary:#9a8a70;
  --text-muted:    #5a4e3a;
  --text-link:     #d4a844;

  --border:        #2a2218;
  --border-light:  #3a3020;

  --success:       #b0a030;
  --danger:        #a03020;
  --warning:       #c8a84e;

  --led-on:        #c8a84e;
  --led-off:       #1a1208;
  --led-glow:      rgba(200, 168, 78, 0.5);

  --font-main:     'Palatino Linotype', Georgia, serif;
  --font-heading:  'Palatino Linotype', Georgia, serif;
  --font-mono:     'Consolas', monospace;

  --theme-logo:    "🔥";
  --msg-glow:      0 0 6px rgba(200, 168, 78, 0.08);
}

[data-theme="darksouls"] .brand-text { color: #c8a84e; text-shadow: 0 0 10px rgba(200, 168, 78, 0.4); }
[data-theme="darksouls"] .server-icon.home { background: linear-gradient(135deg, #5a4420, #c8a84e); box-shadow: 0 0 8px rgba(200, 168, 78, 0.3); }
[data-theme="darksouls"] .channel-item.active::before { background: #c8a84e; box-shadow: 0 0 6px rgba(200, 168, 78, 0.5); }
[data-theme="darksouls"] .inline-code { color: #dcc06a; }
[data-theme="darksouls"] .message-avatar, [data-theme="darksouls"] .message-avatar-img { border: 1px solid rgba(200, 168, 78, 0.2); }

/* ─── THEME: Elden Ring ────────────────────────────────── */
[data-theme="eldenring"] {
  --bg-primary:    #08080e;
  --bg-secondary:  #0c0c16;
  --bg-tertiary:   #14141e;
  --bg-hover:      #1c1c2a;
  --bg-active:     #242438;
  --bg-input:      #060608;
  --bg-card:       #0c0c16;

  --accent:        #d4a832;
  --accent-hover:  #e8c050;
  --accent-dim:    #b08820;
  --accent-glow:   rgba(212, 168, 50, 0.35);

  --text-primary:  #e0d8c8;
  --text-secondary:#a098a0;
  --text-muted:    #584860;
  --text-link:     #80a0d0;

  --border:        #1e1e30;
  --border-light:  #2a2a40;

  --success:       #60b060;
  --danger:        #c03020;
  --warning:       #d4a832;

  --led-on:        #d4a832;
  --led-off:       #0a0a10;
  --led-glow:      rgba(212, 168, 50, 0.5);

  --font-main:     'Palatino Linotype', Georgia, serif;
  --font-heading:  'Palatino Linotype', Georgia, serif;
  --font-mono:     'Consolas', monospace;

  --theme-logo:    "💍";
  --msg-glow:      0 0 4px rgba(212, 168, 50, 0.06);
}

[data-theme="eldenring"] .brand-text { background: linear-gradient(90deg, #d4a832, #8080c0); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
[data-theme="eldenring"] .server-icon.home { background: linear-gradient(135deg, #3a3060, #d4a832); box-shadow: 0 0 10px rgba(212, 168, 50, 0.3); }
[data-theme="eldenring"] .channel-item.active::before { background: #d4a832; box-shadow: 0 0 8px rgba(212, 168, 50, 0.5); }
[data-theme="eldenring"] .inline-code { color: #80a0d0; }
[data-theme="eldenring"] .message-avatar, [data-theme="eldenring"] .message-avatar-img { border: 1px solid rgba(212, 168, 50, 0.2); }

/* ─── THEME: Minecraft ─────────────────────────────────── */
[data-theme="minecraft"] {
  --bg-primary:    #1a1a1a;
  --bg-secondary:  #222222;
  --bg-tertiary:   #2e2e2e;
  --bg-hover:      #3a3a3a;
  --bg-active:     #444444;
  --bg-input:      #141414;
  --bg-card:       #222222;

  --accent:        #55bb55;
  --accent-hover:  #70d070;
  --accent-dim:    #3a8a3a;
  --accent-glow:   rgba(85, 187, 85, 0.3);

  --text-primary:  #e8e8e8;
  --text-secondary:#aaaaaa;
  --text-muted:    #666666;
  --text-link:     #55bbff;

  --border:        #3a3a3a;
  --border-light:  #4a4a4a;

  --success:       #55bb55;
  --danger:        #cc3333;
  --warning:       #ffaa00;

  --led-on:        #55bb55;
  --led-off:       #1a1a1a;
  --led-glow:      rgba(85, 187, 85, 0.5);

  --font-main:     'Segoe UI', system-ui, sans-serif;
  --font-heading:  'Segoe UI', system-ui, sans-serif;
  --font-mono:     'Consolas', monospace;

  --theme-logo:    "⛏️";
}

[data-theme="minecraft"] .brand-text { color: #55bb55; text-shadow: 2px 2px 0 #2a5a2a; }
[data-theme="minecraft"] .server-icon.home { background: #55bb55; box-shadow: 2px 2px 0 #2a5a2a; border-radius: 4px; }
[data-theme="minecraft"] .server-icon:hover { border-radius: 4px; }
[data-theme="minecraft"] .channel-item.active::before { background: #55bb55; }
[data-theme="minecraft"] .inline-code { color: #55bbff; }
[data-theme="minecraft"] .message-avatar, [data-theme="minecraft"] .message-avatar-img { border: 2px solid #3a3a3a; border-radius: 4px; }
[data-theme="minecraft"] .channel-badge { background: #55bb55; color: #1a1a1a; }

/* ─── THEME: Final Fantasy X ───────────────────────────── */
[data-theme="ffx"] {
  --bg-primary:    #080e1a;
  --bg-secondary:  #0b1325;
  --bg-tertiary:   #101a30;
  --bg-hover:      #16223e;
  --bg-active:     #1c2a4a;
  --bg-input:      #060a14;
  --bg-card:       #0b1325;

  --accent:        #40a8e0;
  --accent-hover:  #60c0f0;
  --accent-dim:    #2080b0;
  --accent-glow:   rgba(64, 168, 224, 0.3);

  --text-primary:  #d0e4f0;
  --text-secondary:#80a0c0;
  --text-muted:    #3a5a78;
  --text-link:     #60c0f0;

  --border:        #1a2a40;
  --border-light:  #223450;

  --success:       #40c8a0;
  --danger:        #e0504a;
  --warning:       #f0c040;

  --led-on:        #40a8e0;
  --led-off:       #0a1020;
  --led-glow:      rgba(64, 168, 224, 0.5);

  --font-main:     'Segoe UI', system-ui, sans-serif;
  --font-heading:  'Segoe UI', system-ui, sans-serif;
  --font-mono:     'Consolas', monospace;

  --theme-logo:    "⚔️";
  --msg-glow:      0 0 4px rgba(64, 168, 224, 0.06);
}

[data-theme="ffx"] .brand-text { background: linear-gradient(90deg, #40a8e0, #c0a040); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
[data-theme="ffx"] .server-icon.home { background: linear-gradient(135deg, #1a4070, #40a8e0); box-shadow: 0 0 10px rgba(64, 168, 224, 0.3); }
[data-theme="ffx"] .channel-item.active::before { background: #40a8e0; box-shadow: 0 0 8px rgba(64, 168, 224, 0.4); }
[data-theme="ffx"] .inline-code { color: #60c0f0; }
[data-theme="ffx"] .message-avatar, [data-theme="ffx"] .message-avatar-img { border: 1px solid rgba(64, 168, 224, 0.25); }

/* ─── THEME: Legend of Zelda ───────────────────────────── */
[data-theme="zelda"] {
  --bg-primary:    #0a120a;
  --bg-secondary:  #0e180e;
  --bg-tertiary:   #142014;
  --bg-hover:      #1c2c1c;
  --bg-active:     #243424;
  --bg-input:      #060e06;
  --bg-card:       #0e180e;

  --accent:        #44bb44;
  --accent-hover:  #60d060;
  --accent-dim:    #2a8a2a;
  --accent-glow:   rgba(68, 187, 68, 0.3);

  --text-primary:  #d8e8d0;
  --text-secondary:#90b088;
  --text-muted:    #4a6a42;
  --text-link:     #70c870;

  --border:        #1c2e1c;
  --border-light:  #283a28;

  --success:       #44bb44;
  --danger:        #cc3030;
  --warning:       #e8c030;

  --led-on:        #44bb44;
  --led-off:       #0a140a;
  --led-glow:      rgba(68, 187, 68, 0.5);

  --font-main:     'Segoe UI', system-ui, sans-serif;
  --font-heading:  'Segoe UI', system-ui, sans-serif;
  --font-mono:     'Consolas', monospace;

  --theme-logo:    "🗡️";
}

[data-theme="zelda"] .brand-text { background: linear-gradient(90deg, #44bb44, #e8c030); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
[data-theme="zelda"] .server-icon.home { background: linear-gradient(135deg, #1a6a1a, #e8c030); box-shadow: 0 0 8px rgba(68, 187, 68, 0.3); }
[data-theme="zelda"] .channel-item.active::before { background: #44bb44; box-shadow: 0 0 6px rgba(68, 187, 68, 0.5); }
[data-theme="zelda"] .inline-code { color: #70c870; }
[data-theme="zelda"] .mention { background: rgba(68, 187, 68, 0.15); color: #60d060; }
[data-theme="zelda"] .message-avatar, [data-theme="zelda"] .message-avatar-img { border: 1px solid rgba(68, 187, 68, 0.25); }
[data-theme="zelda"] .channel-badge { background: #44bb44; color: #0a120a; }

/* ─── THEME: Fallout / PIP-Boy ─────────────────────────── */
[data-theme="fallout"] {
  --bg-primary:    #0a0e08;
  --bg-secondary:  #0e1410;
  --bg-tertiary:   #141c14;
  --bg-hover:      #1a2818;
  --bg-active:     #1e3020;
  --bg-input:      #060a04;
  --bg-card:       #0c1208;

  --accent:        #14fe17;
  --accent-hover:  #44ff44;
  --accent-dim:    #0abc0e;
  --accent-glow:   rgba(20, 254, 23, 0.25);

  --text-primary:  #14fe17;
  --text-secondary:#0ecc12;
  --text-muted:    #0a6e0c;
  --text-link:     #44ff44;

  --border:        #0f5e10;
  --border-light:  #148014;

  --success:       #14fe17;
  --danger:        #ff4444;
  --warning:       #cccc00;

  --led-on:        #14fe17;
  --led-off:       #0a1408;
  --led-glow:      rgba(20, 254, 23, 0.6);

  --font-main:     'Share Tech Mono', 'Courier New', monospace;
  --font-heading:  'Share Tech Mono', 'Courier New', monospace;
  --font-mono:     'Share Tech Mono', 'Courier New', monospace;

  --theme-logo:    "☢️";
  --scanline:      repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(20, 254, 23, 0.03) 2px,
    rgba(20, 254, 23, 0.03) 4px
  );
}
[data-theme="fallout"] .brand-text { color: #14fe17; text-shadow: 0 0 8px rgba(20, 254, 23, 0.6); letter-spacing: 2px; text-transform: uppercase; }
[data-theme="fallout"] .server-icon.home { background: #0a1a08; border: 1px solid #14fe17; box-shadow: 0 0 8px rgba(20, 254, 23, 0.3); color: #14fe17; }
[data-theme="fallout"] .channel-item.active::before { background: #14fe17; box-shadow: 0 0 8px rgba(20, 254, 23, 0.6); }
[data-theme="fallout"] .message-avatar, [data-theme="fallout"] .message-avatar-img { border: 1px solid #14fe17; border-radius: 2px; }
[data-theme="fallout"] .inline-code { color: #14fe17; background: rgba(20, 254, 23, 0.08); border: 1px solid rgba(20, 254, 23, 0.2); }
[data-theme="fallout"] .channel-badge { background: #14fe17; color: #0a0e08; }
[data-theme="fallout"] .btn-voice { border: 1px solid rgba(20, 254, 23, 0.3); }
[data-theme="fallout"] .btn-voice.active { background: #14fe17; color: #0a0e08; text-shadow: none; }
[data-theme="fallout"] .sidebar { border-right: 1px solid rgba(20, 254, 23, 0.2); }
[data-theme="fallout"] .channel-header { border-bottom: 1px solid rgba(20, 254, 23, 0.2); }
[data-theme="fallout"] .message-row { text-shadow: 0 0 2px rgba(20, 254, 23, 0.15); }
[data-theme="fallout"] .modal { border: 1px solid rgba(20, 254, 23, 0.3); box-shadow: 0 0 20px rgba(20, 254, 23, 0.15); }
[data-theme="fallout"] input, [data-theme="fallout"] textarea { border: 1px solid rgba(20, 254, 23, 0.15) !important; }
[data-theme="fallout"] .message-input-container { border: 1px solid rgba(20, 254, 23, 0.2); border-radius: 2px; }
[data-theme="fallout"] ::selection { background: #14fe17; color: #0a0e08; }

/* ─── THEME: CRT ───────────────────────────────────────── */
[data-theme="crt"] {
  --bg-primary:    #080808;
  --bg-secondary:  #0a0a0a;
  --bg-tertiary:   #111111;
  --bg-hover:      #1a1a1a;
  --bg-active:     #222222;
  --bg-input:      #050505;
  --bg-card:       #0a0a0a;

  --accent:        #ffb000;
  --accent-hover:  #ffc844;
  --accent-dim:    #cc8800;
  --accent-glow:   rgba(255, 176, 0, 0.3);

  --text-primary:  #ffb000;
  --text-secondary:#cc8800;
  --text-muted:    #664400;
  --text-link:     #ffc844;

  --border:        #332800;
  --border-light:  #4a3a10;

  --success:       #00cc00;
  --danger:        #ff2222;
  --warning:       #ffcc00;

  --led-on:        #ffb000;
  --led-off:       #221800;
  --led-glow:      rgba(255, 176, 0, 0.5);

  --font-main:     'VT323', 'Courier New', monospace;
  --font-heading:  'VT323', 'Courier New', monospace;
  --font-mono:     'VT323', 'Courier New', monospace;

  --theme-logo:    "📺";
  --scanline:      repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0, 0, 0, 0.25) 1px,
    rgba(0, 0, 0, 0.25) 2px
  );
}
[data-theme="crt"] .brand-text { color: #ffb000; text-shadow: 0 0 6px rgba(255, 176, 0, 0.5); letter-spacing: 3px; text-transform: uppercase; }
[data-theme="crt"] .server-icon.home { background: #111; border: 2px solid #ffb000; box-shadow: 0 0 10px rgba(255, 176, 0, 0.2); color: #ffb000; }
[data-theme="crt"] .channel-item.active::before { background: #ffb000; box-shadow: 0 0 6px rgba(255, 176, 0, 0.5); }
[data-theme="crt"] .message-avatar, [data-theme="crt"] .message-avatar-img { border: 1px solid rgba(255, 176, 0, 0.3); border-radius: 0; }
[data-theme="crt"] .inline-code { color: #ffb000; background: rgba(255, 176, 0, 0.08); }
[data-theme="crt"] .channel-badge { background: #ffb000; color: #080808; }
[data-theme="crt"] .sidebar { border-right: 1px solid rgba(255, 176, 0, 0.15); }
[data-theme="crt"] .channel-header { border-bottom: 1px solid rgba(255, 176, 0, 0.15); }
[data-theme="crt"] .message-row { text-shadow: 0 0 1px rgba(255, 176, 0, 0.3); }
[data-theme="crt"] .modal { border: 2px solid #ffb000; box-shadow: 0 0 30px rgba(255, 176, 0, 0.15), inset 0 0 60px rgba(255, 176, 0, 0.03); border-radius: 0; }
[data-theme="crt"] input, [data-theme="crt"] textarea { border: 1px solid rgba(255, 176, 0, 0.2) !important; border-radius: 0 !important; }
[data-theme="crt"] .btn-voice { border: 1px solid rgba(255, 176, 0, 0.3); border-radius: 0; }
[data-theme="crt"] .btn-sm { border-radius: 0; }
[data-theme="crt"] .message-input-container { border: 1px solid rgba(255, 176, 0, 0.2); border-radius: 0; }
[data-theme="crt"] ::selection { background: #ffb000; color: #080808; }

/* ─── THEME: Windows 95 ────────────────────────────────── */
[data-theme="win95"] {
  --bg-primary:    #c0c0c0;
  --bg-secondary:  #c0c0c0;
  --bg-tertiary:   #c0c0c0;
  --bg-hover:      #000080;
  --bg-active:     #000080;
  --bg-input:      #ffffff;
  --bg-card:       #ffffff;

  --accent:        #000080;
  --accent-hover:  #0000aa;
  --accent-dim:    #000066;
  --accent-glow:   rgba(0, 0, 128, 0.2);

  --text-primary:  #000000;
  --text-secondary:#000000;
  --text-muted:    #808080;
  --text-link:     #000080;

  --border:        #808080;
  --border-light:  #dfdfdf;

  --success:       #008000;
  --danger:        #cc0000;
  --warning:       #808000;

  --led-on:        #008000;
  --led-off:       #808080;
  --led-glow:      rgba(0, 128, 0, 0.4);

  --font-main:     'MS Sans Serif', 'Tahoma', 'Arial', sans-serif;
  --font-heading:  'MS Sans Serif', 'Tahoma', 'Arial', sans-serif;
  --font-mono:     'Fixedsys', 'Courier New', monospace;

  --theme-logo:    "🪟";
  --scanline:      none;
}
[data-theme="win95"] .brand-text { color: #fff; font-weight: 700; text-shadow: none; }
[data-theme="win95"] .server-icon.home { background: #c0c0c0; border: 2px outset #fff; color: #000; border-radius: 0; box-shadow: none; }
[data-theme="win95"] .server-icon { border-radius: 0 !important; }
[data-theme="win95"] .channel-item.active::before { background: #000080; }
[data-theme="win95"] .inline-code { color: #000080; background: #fff; border: 1px inset #808080; }
[data-theme="win95"] .channel-badge { background: #000080; color: #fff; border-radius: 0; }
[data-theme="win95"] .sidebar { background: #c0c0c0; border-right: 2px outset #fff; }
[data-theme="win95"] .sidebar-header { background: linear-gradient(90deg, #000080, #1084d0); border-bottom: 2px outset #fff; }
[data-theme="win95"] .sidebar-header .brand-text { color: #fff; }
[data-theme="win95"] .sidebar .section-label,
[data-theme="win95"] .sidebar .panel-title { color: #000; font-weight: 700; }
[data-theme="win95"] .sidebar .channel-item { color: #000; border-radius: 0; }
[data-theme="win95"] .sidebar .channel-item:hover { background: #000080; color: #fff; }
[data-theme="win95"] .sidebar .channel-item.active { background: #000080; color: #fff; }
[data-theme="win95"] .sidebar .user-item-name { color: #000; }
[data-theme="win95"] .sidebar .channel-item.active .user-item-name,
[data-theme="win95"] .sidebar .channel-item:hover .user-item-name { color: #fff; }
[data-theme="win95"] .sidebar .current-user { color: #000; }
[data-theme="win95"] .sidebar .muted-text { color: #808080; }
[data-theme="win95"] .sidebar-bottom-bar { background: #c0c0c0; border-top: 2px outset #fff; }
[data-theme="win95"] .sidebar-bottom-btn { color: #000; background: #c0c0c0; border: 2px outset #fff; border-radius: 0; margin: 2px; }
[data-theme="win95"] .sidebar-bottom-btn:hover { background: #dfdfdf; }
[data-theme="win95"] .channel-header { background: #c0c0c0; border-bottom: 2px outset #fff; color: #000; }
[data-theme="win95"] .channel-header * { color: #000; }
[data-theme="win95"] .channel-code-tag { background: #fff; color: #000; border: 1px inset #808080; border-radius: 0; }
[data-theme="win95"] .btn-voice { background: #c0c0c0; color: #000; border: 2px outset #fff; border-radius: 0; }
[data-theme="win95"] .btn-voice:hover { background: #dfdfdf; }
[data-theme="win95"] .btn-voice.active { background: #c0c0c0; color: #000; border: 2px inset #808080; }
[data-theme="win95"] .btn-voice.btn-danger { background: #c0c0c0; color: #cc0000; border: 2px outset #fff; font-weight: 700; }
[data-theme="win95"] .btn-sm { border: 2px outset #fff; border-radius: 0; }
[data-theme="win95"] .btn-sm:active { border: 2px inset #808080; }
[data-theme="win95"] .btn-sm.btn-accent { background: #c0c0c0; color: #000; border: 2px outset #fff; }
[data-theme="win95"] .modal { background: #c0c0c0; border: 2px outset #fff; border-radius: 0; box-shadow: 2px 2px 0 #000; }
[data-theme="win95"] .modal h3 { background: linear-gradient(90deg, #000080, #1084d0); color: #fff; margin: -20px -24px 16px -24px; padding: 4px 8px; border-radius: 0; font-weight: 700; font-size: 12px; }
[data-theme="win95"] .message-row { border-bottom: 1px solid #808080; }
[data-theme="win95"] .message-row:hover { background: #dfdfdf; }
[data-theme="win95"] .message-author { color: #000080; font-weight: 700; }
[data-theme="win95"] .message-input-container { background: #fff; border: 2px inset #808080; border-radius: 0; }
[data-theme="win95"] input[type="text"], [data-theme="win95"] textarea { background: #fff; border: 2px inset #808080 !important; border-radius: 0 !important; }
[data-theme="win95"] .right-sidebar { background: #c0c0c0; border-left: 2px outset #fff; }
[data-theme="win95"] .user-item-avatar { border-radius: 0; }
[data-theme="win95"] .message-avatar, [data-theme="win95"] .message-avatar-img { border-radius: 0; border: 2px outset #fff; }
[data-theme="win95"] ::selection { background: #000080; color: #fff; }
[data-theme="win95"] ::-webkit-scrollbar-thumb { background: #c0c0c0; border: 2px outset #fff; border-radius: 0; }
[data-theme="win95"] ::-webkit-scrollbar-track { background: repeating-conic-gradient(#c0c0c0 0% 25%, #fff 0% 50%) 50%/4px 4px; }
[data-theme="win95"] .server-bar { background: #c0c0c0; border-right: 2px outset #fff; }
[data-theme="win95"] .server-bar .server-icon { border-radius: 0; }
[data-theme="win95"] .status-bar { background: #c0c0c0; border-top: 2px outset #fff; }
[data-theme="win95"] .status-bar .status-item { border: 1px inset #808080; border-radius: 0; }
[data-theme="win95"] * { border-radius: 0 !important; }


/* ═══════════════════════════════════════════════════════════
   RESET
   ═══════════════════════════════════════════════════════════ */

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

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

/* Scanline overlay for Matrix theme */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--scanline);
  pointer-events: none;
  z-index: 99999;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, textarea { font-family: inherit; outline: none; border: none; }
::selection { background: var(--accent); color: white; }

/* ── Range Input Track (slider background) ──────────────── */
/* Slider classes set --track-bg / --track-h / --track-r to override
   the defaults below. Themed tracks use --track-bg for colouring.  */
input[type="range"]:not(.rgb-slider)::-webkit-slider-runnable-track {
  background: var(--track-bg, var(--bg-tertiary));
  height: var(--track-h, 4px);
  border-radius: var(--track-r, 2px);
  border: var(--track-border, none);
}
input[type="range"]:not(.rgb-slider)::-moz-range-track {
  background: var(--track-bg, var(--bg-tertiary));
  height: var(--track-h, 4px);
  border-radius: var(--track-r, 2px);
  border: var(--track-border, none);
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }


/* ═══════════════════════════════════════════════════════════
   LED / STATUS INDICATORS
   ═══════════════════════════════════════════════════════════ */

.led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.3s ease;
  border: 1px solid rgba(0,0,0,0.3);
}

.led.on {
  background: var(--led-on);
  box-shadow: 0 0 6px var(--led-glow), inset 0 -1px 2px rgba(0,0,0,0.2);
}

.led.off { background: var(--led-off); }

.led.warn {
  background: var(--warning);
  box-shadow: 0 0 6px rgba(250, 166, 26, 0.5);
}

.led.danger {
  background: var(--danger);
  box-shadow: 0 0 6px rgba(240, 71, 71, 0.5);
}

.led.pulse { animation: ledPulse 1.5s ease-in-out infinite; }

@keyframes ledPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Status Bar (bottom of app) ────────────────────────── */

.status-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 5px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  min-height: 28px;
  user-select: none;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.status-item .label {
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
  font-size: 10px;
}

.status-item .value {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
}

.status-bar .spacer { flex: 1; }

#status-version {
  opacity: 0.5;
  font-size: 10px;
}

.status-bar .divider {
  width: 1px;
  height: 14px;
  background: var(--border);
}


/* ═══════════════════════════════════════════════════════════
   SIDEBAR BOTTOM BAR & THEME POPUP
   ═══════════════════════════════════════════════════════════ */

.sidebar-bottom {
  margin-top: auto;
  position: relative;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-bottom-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
}

.sidebar-bottom-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.2s;
  line-height: 1;
}
.sidebar-bottom-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

.theme-popup {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 12px;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  max-height: 60vh;
  overflow-y: auto;
}

.theme-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.theme-popup-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════
   THEME SELECTOR
   ═══════════════════════════════════════════════════════════ */

.theme-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 4px 0;
}

.theme-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
}

.theme-btn:hover {
  border-color: var(--text-secondary);
  transform: scale(1.15);
}

.theme-btn.active {
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  transform: scale(1.1);
}

.theme-btn[data-theme="haven"]   { background: #191b28; color: #7c5cfc; }
.theme-btn[data-theme="discord"] { background: #313338; color: #5865f2; }
.theme-btn[data-theme="matrix"]  { background: #0a0a0a; color: #00ff41; }
.theme-btn[data-theme="tron"]    { background: #0c141f; color: #6fecff; }
.theme-btn[data-theme="halo"]    { background: #0d1a0d; color: #d4a020; }
.theme-btn[data-theme="lotr"]    { background: #1a1510; color: #d4a844; }
.theme-btn[data-theme="cyberpunk"] { background: #0a0a12; color: #ff2d6f; }
.theme-btn[data-theme="nord"]    { background: #2e3440; color: #88c0d0; }
.theme-btn[data-theme="dracula"] { background: #1a1b26; color: #bd93f9; }
.theme-btn[data-theme="bloodborne"] { background: #0a0000; color: #cc0020; }
.theme-btn[data-theme="darksouls"] { background: #0c0a08; color: #c8a84e; }
.theme-btn[data-theme="eldenring"] { background: #08080e; color: #d4a832; }
.theme-btn[data-theme="ice"]    { background: #0a1520; color: #00d4ff; }
.theme-btn[data-theme="abyss"]  { background: #040810; color: #1a5aff; }
.theme-btn[data-theme="minecraft"] { background: #1a1a1a; color: #55bb55; }
.theme-btn[data-theme="ffx"]    { background: #080e1a; color: #40a8e0; }
.theme-btn[data-theme="zelda"]  { background: #0a120a; color: #44bb44; }
.theme-btn[data-theme="fallout"]{ background: #0a0e08; color: #14fe17; text-shadow: 0 0 4px rgba(20,254,23,0.6); }
.theme-btn[data-theme="crt"]    { background: #080808; color: #ffb000; text-shadow: 0 0 4px rgba(255,176,0,0.5); }
.theme-btn[data-theme="win95"]  { background: #c0c0c0; color: #000; border: 2px outset #fff; }
.theme-btn[data-theme="custom"] { background: linear-gradient(135deg, #ff2d6f, #faa61a, #43b581, #7c5cfc); color: #fff; }
.theme-btn[data-theme="rgb"] {
  background: linear-gradient(90deg, #ff0000, #ff8800, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
  background-size: 200% 100%;
  animation: rgb-btn-cycle 3s linear infinite;
  color: #fff;
  text-shadow: 0 0 2px rgba(0,0,0,0.6);
}
@keyframes rgb-btn-cycle {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.theme-btn .theme-icon { pointer-events: none; }

/* ─── Theme Creative Effects ─────────────────────────── */

/* ── Fallout: Phosphor glow + vignette burn ────────── */
[data-theme="fallout"] .main {
  position: relative;
  box-shadow: inset 0 0 120px rgba(20, 254, 23, 0.12);
}
[data-theme="fallout"] .main::before {
  content: ''; position: fixed; inset: 0; z-index: 99998; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 10, 0, 0.55) 100%);
}

/* ── CRT: Screen curvature + flicker + phosphor bloom ── */
[data-theme="crt"] .main {
  position: relative;
  border-radius: 14px;
  box-shadow:
    inset 0 0 120px rgba(255, 176, 0, 0.1),
    inset 0 0 12px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}
[data-theme="crt"] .main::before {
  content: ''; position: fixed; inset: 0; z-index: 99998; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.6) 100%);
  animation: crt-flicker calc(0.06s * var(--fx-mult, 1)) infinite alternate;
}
@keyframes crt-flicker {
  0%   { opacity: 0.97; }
  100% { opacity: 1; }
}

/* ── Win95: No effects — sharp, clean, period-correct ─ */

/* ── FFX: Flowing water overlay ────────────────────── */
[data-theme="ffx"] .sidebar { position: relative; }
[data-theme="ffx"] .sidebar::after {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(64, 168, 224, 0.25) 15%,
    transparent 30%,
    rgba(64, 168, 224, 0.20) 50%,
    transparent 65%,
    rgba(64, 168, 224, 0.15) 80%,
    transparent 100%
  );
  background-size: 100% 200%;
  animation: ffx-water calc(5s * var(--fx-mult, 1)) ease-in-out infinite;
}
[data-theme="ffx"] .main { position: relative; }
[data-theme="ffx"] .main::after {
  content: ''; position: fixed; bottom: 0; left: 0; right: 0; height: 6px;
  pointer-events: none; z-index: 99998;
  background: linear-gradient(90deg,
    transparent, rgba(64,168,224,0.6), rgba(100,200,255,0.8), rgba(64,168,224,0.6), transparent
  );
  background-size: 200% 100%;
  animation: ffx-wave-bar calc(3s * var(--fx-mult, 1)) ease-in-out infinite;
  filter: blur(1px);
}
@keyframes ffx-water {
  0%, 100% { background-position: 0% 0%; }
  50%      { background-position: 0% 100%; }
}
@keyframes ffx-wave-bar {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 200% 50%; }
}

/* ── Ice: Icicles + frost shimmer ──────────────────── */
[data-theme="ice"] .channel-header { position: relative; overflow: visible !important; }
[data-theme="ice"] .channel-header::after {
  content: '';
  position: absolute; bottom: -12px; left: 0; right: 0; height: 12px;
  pointer-events: none; z-index: 2;
  background:
    linear-gradient(180deg, rgba(180,230,255,0.7), rgba(180,230,255,0.0));
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'%3E%3Cpolygon points='0,0 8,0 10,10 12,0 20,0 22,7 24,0 32,0 35,12 38,0 46,0 48,8 50,0 58,0 61,11 64,0 72,0 74,6 76,0 84,0 87,12 90,0 98,0 100,9 102,0 110,0 113,11 116,0 124,0 126,7 128,0 136,0 139,12 142,0 150,0 152,8 154,0 162,0 165,10 168,0 176,0 178,6 180,0 188,0 191,12 194,0 200,0 200,0 0,0'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'%3E%3Cpolygon points='0,0 8,0 10,10 12,0 20,0 22,7 24,0 32,0 35,12 38,0 46,0 48,8 50,0 58,0 61,11 64,0 72,0 74,6 76,0 84,0 87,12 90,0 98,0 100,9 102,0 110,0 113,11 116,0 124,0 126,7 128,0 136,0 139,12 142,0 150,0 152,8 154,0 162,0 165,10 168,0 176,0 178,6 180,0 188,0 191,12 194,0 200,0 200,0 0,0'/%3E%3C/svg%3E");
  -webkit-mask-size: 200px 12px;
  mask-size: 200px 12px;
  -webkit-mask-repeat: repeat-x;
  mask-repeat: repeat-x;
  animation: ice-drip calc(3s * var(--fx-mult, 1)) ease-in-out infinite;
}
[data-theme="ice"] .sidebar-header { position: relative; overflow: visible !important; }
[data-theme="ice"] .sidebar-header::after {
  content: '';
  position: absolute; bottom: -10px; left: 0; right: 0; height: 10px;
  pointer-events: none; z-index: 2;
  background:
    linear-gradient(180deg, rgba(180,230,255,0.6), rgba(180,230,255,0.0));
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'%3E%3Cpolygon points='0,0 8,0 10,10 12,0 20,0 22,7 24,0 32,0 35,12 38,0 46,0 48,8 50,0 58,0 61,11 64,0 72,0 74,6 76,0 84,0 87,12 90,0 98,0 100,9 102,0 110,0 113,11 116,0 124,0 126,7 128,0 136,0 139,12 142,0 150,0 152,8 154,0 162,0 165,10 168,0 176,0 178,6 180,0 188,0 191,12 194,0 200,0 200,0 0,0'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'%3E%3Cpolygon points='0,0 8,0 10,10 12,0 20,0 22,7 24,0 32,0 35,12 38,0 46,0 48,8 50,0 58,0 61,11 64,0 72,0 74,6 76,0 84,0 87,12 90,0 98,0 100,9 102,0 110,0 113,11 116,0 124,0 126,7 128,0 136,0 139,12 142,0 150,0 152,8 154,0 162,0 165,10 168,0 176,0 178,6 180,0 188,0 191,12 194,0 200,0 200,0 0,0'/%3E%3C/svg%3E");
  -webkit-mask-size: 200px 10px;
  mask-size: 200px 10px;
  -webkit-mask-repeat: repeat-x;
  mask-repeat: repeat-x;
}
@keyframes ice-drip {
  0%, 100% { transform: scaleY(1); opacity: 0.7; }
  50%      { transform: scaleY(1.3); opacity: 1; }
}
[data-theme="ice"] .main { position: relative; }
[data-theme="ice"] .main::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 99998;
  background:
    radial-gradient(3px 3px at 10% 25%, rgba(200,235,255,0.8), transparent),
    radial-gradient(2px 2px at 25% 60%, rgba(200,235,255,0.6), transparent),
    radial-gradient(3px 3px at 45% 15%, rgba(200,235,255,0.7), transparent),
    radial-gradient(2px 2px at 60% 70%, rgba(200,235,255,0.5), transparent),
    radial-gradient(3px 3px at 75% 35%, rgba(200,235,255,0.6), transparent),
    radial-gradient(2px 2px at 90% 80%, rgba(200,235,255,0.7), transparent),
    radial-gradient(3px 3px at 35% 45%, rgba(200,235,255,0.5), transparent),
    radial-gradient(2px 2px at 80% 10%, rgba(200,235,255,0.6), transparent);
  animation: ice-shimmer calc(4s * var(--fx-mult, 1)) ease-in-out infinite;
}
@keyframes ice-shimmer {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 0.9; }
}

/* ── Nord: Snowfall particles ──────────────────────── */
[data-theme="nord"] .main { position: relative; }
[data-theme="nord"] .main::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 99998;
  background-image:
    radial-gradient(3px 3px at 10% 0%, #d8dee9, transparent),
    radial-gradient(2px 2px at 25% 0%, #d8dee9, transparent),
    radial-gradient(3px 3px at 40% 0%, #d8dee9, transparent),
    radial-gradient(2px 2px at 55% 0%, #d8dee9, transparent),
    radial-gradient(3px 3px at 70% 0%, #d8dee9, transparent),
    radial-gradient(2px 2px at 85% 0%, #d8dee9, transparent),
    radial-gradient(2px 2px at 5%  0%, #d8dee9, transparent),
    radial-gradient(3px 3px at 95% 0%, #d8dee9, transparent),
    radial-gradient(2px 2px at 18% 0%, #d8dee9, transparent),
    radial-gradient(3px 3px at 33% 0%, #d8dee9, transparent),
    radial-gradient(2px 2px at 48% 0%, #d8dee9, transparent),
    radial-gradient(3px 3px at 63% 0%, #d8dee9, transparent),
    radial-gradient(2px 2px at 78% 0%, #d8dee9, transparent),
    radial-gradient(3px 3px at 92% 0%, #d8dee9, transparent);
  background-size:
    100% 100vh, 100% 80vh, 100% 110vh, 100% 90vh,
    100% 120vh, 100% 70vh, 100% 95vh, 100% 105vh,
    100% 85vh, 100% 115vh, 100% 75vh, 100% 100vh,
    100% 88vh, 100% 108vh;
  opacity: 0.7;
  animation: nord-snow calc(6s * var(--fx-mult, 1)) linear infinite;
}
@keyframes nord-snow {
  0%   { background-position:
    10%  -10vh, 25%  -20vh, 40%  -5vh,  55%  -15vh,
    70%  -8vh,  85%  -25vh, 5%   -12vh, 95%  -18vh,
    18%  -22vh, 33%  -7vh,  48%  -14vh, 63%  -3vh,
    78%  -20vh, 92%  -11vh; }
  100% { background-position:
    12%  110vh, 22%  100vh, 43%  115vh, 52%  105vh,
    68%  108vh, 88%  95vh,  8%   112vh, 93%  102vh,
    15%  98vh,  36%  113vh, 45%  96vh,  66%  110vh,
    75%  103vh, 90%  107vh; }
}

/* ── Dark Souls: Campfire glow (muted, sporadic flicker) ── */
[data-theme="darksouls"] .sidebar::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 55vh;
  pointer-events: none; z-index: 1;
  background: linear-gradient(0deg,
    rgba(180, 70, 10, 0.22) 0%,
    rgba(140, 45, 5, 0.12) 25%,
    rgba(100, 30, 0, 0.05) 50%,
    transparent 100%
  );
  animation: ds-ember calc(4s * var(--fx-mult, 1)) ease-in-out infinite;
}
[data-theme="darksouls"] .main { position: relative; }
[data-theme="darksouls"] .main::before {
  content: ''; position: fixed; bottom: 0; left: 0; right: 0; height: 10px;
  pointer-events: none; z-index: 99998;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(180, 60, 5, 0.25) 15%,
    rgba(200, 110, 20, 0.4) 35%,
    rgba(210, 140, 40, 0.5) 50%,
    rgba(200, 110, 20, 0.4) 65%,
    rgba(180, 60, 5, 0.25) 85%,
    transparent 100%
  );
  filter: blur(5px);
  animation: ds-fireline calc(3s * var(--fx-mult, 1)) ease-in-out infinite alternate;
}
[data-theme="darksouls"] .main::after {
  content: ''; position: fixed; bottom: 0; left: 0; right: 0; height: 50vh;
  pointer-events: none; z-index: 99997;
  background: radial-gradient(ellipse 80% 70% at 50% 100%,
    rgba(180, 70, 10, 0.10) 0%,
    rgba(140, 45, 5, 0.05) 40%,
    transparent 100%
  );
  animation: ds-ambient calc(5s * var(--fx-mult, 1)) ease-in-out infinite;
}
@keyframes ds-ember {
  0%       { opacity: 0.5; }
  8%       { opacity: 0.85; }
  15%      { opacity: 0.35; }
  22%      { opacity: 0.7; }
  30%      { opacity: 0.45; }
  45%      { opacity: 0.9; }
  52%      { opacity: 0.30; }
  60%      { opacity: 0.65; }
  70%      { opacity: 0.85; }
  78%      { opacity: 0.40; }
  88%      { opacity: 0.75; }
  100%     { opacity: 0.5; }
}
@keyframes ds-fireline {
  0%   { opacity: 0.3; filter: blur(4px); height: 8px; }
  12%  { opacity: 0.55; filter: blur(6px); height: 12px; }
  28%  { opacity: 0.2; filter: blur(3px); height: 6px; }
  45%  { opacity: 0.5; filter: blur(5px); height: 11px; }
  60%  { opacity: 0.15; filter: blur(3px); height: 7px; }
  75%  { opacity: 0.45; filter: blur(6px); height: 13px; }
  90%  { opacity: 0.25; filter: blur(4px); height: 9px; }
  100% { opacity: 0.35; filter: blur(5px); height: 10px; }
}
@keyframes ds-ambient {
  0%, 100% { opacity: 0.3; }
  15%      { opacity: 0.55; }
  30%      { opacity: 0.2; }
  50%      { opacity: 0.6; }
  65%      { opacity: 0.25; }
  80%      { opacity: 0.5; }
}

/* ── Bloodborne: Blood vignette pulse ──────────────── */
[data-theme="bloodborne"] .main { position: relative; }
[data-theme="bloodborne"] .main::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 99998;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(120, 10, 10, 0.35) 100%);
  animation: bb-vignette calc(4s * var(--fx-mult, 1)) ease-in-out infinite;
}
@keyframes bb-vignette {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

/* ── Matrix: Digital rain shimmer ──────────────────── */
[data-theme="matrix"] .sidebar { position: relative; overflow: hidden; }
[data-theme="matrix"] .sidebar::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: repeating-linear-gradient(0deg,
    transparent 0px, transparent 18px,
    rgba(0, 255, 0, 0.15) 18px, rgba(0, 255, 0, 0.15) 20px
  );
  animation: matrix-rain calc(1.5s * var(--fx-mult, 1)) linear infinite;
}
@keyframes matrix-rain {
  0%   { transform: translateY(-20px); }
  100% { transform: translateY(0); }
}

/* ── Cyberpunk: Glitch effect on header ────────────── */
[data-theme="cyberpunk"] .brand-text {
  animation: cp-glitch calc(4s * var(--fx-mult, 1)) infinite;
}
@keyframes cp-glitch {
  0%, 92%, 100% { transform: none; text-shadow: 0 0 8px rgba(255,0,100,0.6); }
  93% { transform: translate(-3px, 1px) skewX(-3deg); text-shadow: -3px 0 #ff0066, 3px 0 #00ffff; }
  95% { transform: translate(3px, -1px) skewX(2deg); text-shadow: 3px 0 #ff0066, -3px 0 #00ffff; }
  97% { transform: translate(-2px, 0) skewX(-1deg); text-shadow: -2px 0 #ff0066, 2px 0 #00ffff; }
}

/* ── Minecraft: Pixelated border style ─────────────── */
[data-theme="minecraft"] .message-avatar,
[data-theme="minecraft"] .message-avatar-img { image-rendering: pixelated; border-radius: 0 !important; }
[data-theme="minecraft"] .server-icon { border-radius: 2px; image-rendering: pixelated; }
[data-theme="minecraft"] .user-item-avatar { border-radius: 2px; image-rendering: pixelated; }
[data-theme="minecraft"] .sidebar { border-right: 3px solid #3a3a2a; }
[data-theme="minecraft"] .channel-header { border-bottom: 3px solid #3a3a2a; }

/* ── LOTR: Warm candlelight glow ───────────────────── */
[data-theme="lotr"] .sidebar { position: relative; }
[data-theme="lotr"] .sidebar::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse at 50% 100%, rgba(220, 170, 60, 0.2), transparent 60%);
  animation: lotr-candle calc(3s * var(--fx-mult, 1)) ease-in-out infinite;
}
@keyframes lotr-candle {
  0%, 100% { opacity: 0.4; }
  25%      { opacity: 1; }
  50%      { opacity: 0.6; }
  75%      { opacity: 0.9; }
}

/* ── Abyss: Deep ocean pressure vignette ───────────── */
[data-theme="abyss"] .main { position: relative; }
[data-theme="abyss"] .main::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 99998;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 40, 0.35) 100%);
}


/* ─── Custom Theme Triangle Picker ───────────────────── */
#custom-theme-editor {
  margin-top: 8px;
  padding: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
#custom-hue-bar {
  width: 100%;
  height: 18px;
  border-radius: var(--radius-sm);
  cursor: crosshair;
  display: block;
  margin-bottom: 6px;
}
#custom-triangle {
  width: 100%;
  height: 180px;
  cursor: crosshair;
  display: block;
  border-radius: var(--radius-sm);
}

/* ─── RGB Theme Editor ───────────────────────── */
.rgb-theme-editor {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.rgb-slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  cursor: default;
}
.rgb-slider-row:last-child { margin-bottom: 0; }
.rgb-slider-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 50px;
}
.rgb-slider {
  flex: 1;
  height: 4px;
  accent-color: var(--accent);
  cursor: pointer;
}


/* ═══════════════════════════════════════════════════════════
   AUTH PAGE
   ═══════════════════════════════════════════════════════════ */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
  overflow: auto;
}

.auth-container { width: 100%; max-width: 400px; padding: 20px; }

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.auth-header { text-align: center; margin-bottom: 28px; }

.auth-header .logo { font-size: 48px; color: var(--accent); line-height: 1; }

.auth-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--text-primary);
  margin: 8px 0 4px;
  font-family: var(--font-heading);
}

.auth-header .tagline { color: var(--text-secondary); font-size: 14px; }

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}

.auth-tab:hover { color: var(--text-primary); }
.auth-tab.active { background: var(--accent); color: white; }

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

.form-group { display: flex; flex-direction: column; gap: 4px; }

.form-group label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.form-group input {
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  transition: border-color var(--transition);
}

.form-group input:focus { border-color: var(--accent); }
.form-group small { font-size: 11px; color: var(--text-muted); }

.btn-primary {
  padding: 11px 20px;
  background: var(--accent);
  color: white;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  transition: background var(--transition);
  margin-top: 4px;
}

.btn-primary:hover { background: var(--accent-hover); }

.auth-error {
  margin-top: 16px;
  padding: 10px 14px;
  background: rgba(240,71,71,0.12);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
  text-align: center;
}

.auth-theme-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.auth-theme-bar .theme-btn { width: 24px; height: 24px; font-size: 10px; }


/* ═══════════════════════════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════════════════════════ */

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh; /* dynamic viewport height — accounts for mobile browser chrome */
  width: 100vw;
  overflow: hidden;
}

#app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ── Left Sidebar ──────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header { padding: 16px; border-bottom: 1px solid var(--border); }

.brand { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.logo-sm { font-size: 24px; color: var(--accent); }

.brand-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--text-primary);
  font-family: var(--font-heading);
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
}

.user-names {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

.current-user {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-name {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.icon-btn.small { font-size: 13px; }
.icon-btn.danger:hover { color: var(--danger); }

.sidebar-section { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.sidebar-section.channel-section {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.input-row { display: flex; gap: 6px; }

.input-row input {
  flex: 1;
  padding: 7px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  min-width: 0;
}

.input-row input:focus { border-color: var(--accent); }

.btn-sm {
  padding: 7px 12px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-sm:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-sm.btn-accent { background: var(--accent); color: white; font-size: 16px; padding: 7px 10px; line-height: 1; }
.btn-sm.btn-accent:hover { background: var(--accent-hover); }

/* ── Channel List ──────────────────────────────────────── */

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

.channel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}

.channel-item:hover { background: var(--bg-hover); }
.channel-item.active { background: var(--bg-active); }

.channel-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.channel-hash { color: var(--text-muted); font-weight: 700; font-size: 16px; flex-shrink: 0; }

.channel-name {
  font-size: 14px;
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-item.active .channel-name,
.channel-item:hover .channel-name { color: var(--text-primary); }

.channel-badge {
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ── Channel voice indicator (sidebar) ─── */
.channel-voice-indicator {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--success);
  margin-left: auto;
  flex-shrink: 0;
}
.channel-voice-indicator .voice-icon { font-size: 12px; }

/* ── Main Content ──────────────────────────────────────── */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-primary);
}

.channel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  min-height: 52px;
  gap: 12px;
}

.channel-info { display: flex; align-items: center; gap: 10px; min-width: 0; }

.header-left-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

/* Channel context menu (sidebar "..." hover button) */
.channel-item { position: relative; }
.channel-more-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  line-height: 1;
}
.channel-item:hover .channel-more-btn,
.channel-item .channel-more-btn:focus {
  opacity: 1;
  pointer-events: auto;
}
.channel-more-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.channel-ctx-menu {
  position: fixed;
  z-index: 9999;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  min-width: 170px;
  padding: 4px;
}
.channel-ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  width: 100%;
  text-align: left;
}
.channel-ctx-item:hover { background: var(--bg-hover); }
.channel-ctx-item.danger { color: var(--danger); }
.channel-ctx-item.danger:hover { background: #3a1515; }
.channel-ctx-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3px 6px;
}

.channel-info h3 {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-heading);
}

.channel-code-tag {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.channel-code-tag:empty { display: none; }

.voice-controls { display: flex; gap: 5px; flex-shrink: 0; align-items: center; margin-left: auto; }

.btn-voice {
  padding: 5px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  line-height: 1.3;
  height: 30px;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}

.btn-voice:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-voice.active { background: var(--success); color: white; }
.btn-voice.btn-danger { background: var(--danger); color: white; padding: 5px 10px; font-size: 14px; }
.btn-voice.btn-danger:hover { background: #d93636; }
.btn-voice.muted { background: var(--warning); color: #1a1a2e; }

/* ── Voice Controls Dropdown ────────────────── */
.voice-active-btn { background: var(--success); color: white; }
.voice-active-btn:hover { background: var(--success); opacity: 0.9; color: white; }

/* Backdrop (only visible on mobile via media query) */
.voice-dropdown-backdrop { display: none; }

.voice-dropdown-panel {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 100;
  min-width: 140px;
}
.voice-dropdown-panel .btn-voice {
  width: 100%;
  text-align: left;
  white-space: nowrap;
}
.voice-dropdown-panel .voice-ns-wrap {
  width: 100%;
}

/* ── Noise Suppression Slider ───────────────── */
.voice-ns-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius);
  background: var(--bg-tertiary);
}
.ns-label {
  font-size: 14px;
  line-height: 1;
  cursor: default;
}
.ns-slider {
  width: 60px;
  height: 14px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.ns-slider::-webkit-slider-runnable-track {
  background: var(--track-bg, var(--bg-tertiary));
  height: 4px;
  border-radius: 2px;
}
.ns-slider::-moz-range-track {
  background: var(--track-bg, var(--bg-tertiary));
  height: 4px;
  border-radius: 2px;
}
.ns-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  margin-top: -3px;
  box-shadow: 0 0 4px var(--accent-glow, rgba(124,92,252,0.3));
}
.ns-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}
/* ── Welcome Screen ────────────────────────────────────── */

.welcome-screen { flex: 1; display: flex; align-items: center; justify-content: center; }

.welcome-content { text-align: center; color: var(--text-secondary); }

.welcome-icon { font-size: 72px; color: var(--accent); opacity: 0.5; margin-bottom: 16px; }

.welcome-content h2 {
  font-size: 24px;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-family: var(--font-heading);
}

.welcome-content p { font-size: 14px; line-height: 1.6; }

/* ── Message Area ──────────────────────────────────────── */

.message-area { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.message {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  box-shadow: var(--msg-glow);
}

.message:hover { background: rgba(255,255,255,0.02); }

.message-row {
  display: flex;
  gap: 12px;
  padding: 4px 8px;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
  margin-top: 2px;
}

.message-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 2px;
}

/* User list avatars */
/* Discord-style avatar wrapper with overlaid status dot */
.user-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.user-status-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg-secondary);
  box-sizing: border-box;
}

/* Away: half-circle (dome) — visually distinct from full circle */
.user-status-dot.away {
  background: #faa61a;
  border-radius: 2px 2px 50% 50%;
}

/* DND: square — immediately distinguishable */
.user-status-dot.dnd {
  background: var(--danger);
  border-radius: 2px;
}

/* Invisible / Offline: hollow circle outline */
.user-status-dot.invisible {
  background: transparent;
  border: 2px solid var(--text-muted);
}

.user-item.offline .user-status-dot {
  background: transparent;
  border: 2px solid var(--text-muted);
}

.user-item-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 10px;
  color: white;
  flex-shrink: 0;
}

.user-item-avatar-img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* Avatar settings */
.avatar-settings { padding: 4px 0; }
.avatar-preview-row { display: flex; align-items: center; gap: 16px; }
.avatar-preview-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.avatar-preview-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.avatar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Custom sounds admin */
.custom-sound-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.custom-sound-item:last-child { border-bottom: none; }
.custom-sound-name { flex: 1; font-size: 13px; color: var(--text-primary); }
.btn-xs {
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-xs:hover { background: var(--bg-tertiary); }

.message-body { flex: 1; min-width: 0; }

.message-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.message-author { font-weight: 600; font-size: 14px; }
.message-time { font-size: 11px; color: var(--text-muted); }

.message-content {
  font-size: 14px;
  color: var(--text-primary);
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.45;
}

.message-content a { color: var(--text-link); }

.message-compact {
  display: flex;
  padding: 1px 8px 1px 56px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  box-shadow: var(--msg-glow);
}

.message-compact:hover { background: rgba(255,255,255,0.02); }

.message-compact .compact-time {
  display: none;
  font-size: 10px;
  color: var(--text-muted);
  min-width: 44px;
  text-align: right;
  margin-right: 8px;
  padding-top: 2px;
}

.message-compact:hover .compact-time { display: block; }

.system-message {
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
}

.typing-indicator {
  padding: 0 20px;
  height: 20px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

/* ── Message Input ─────────────────────────────────────── */

.message-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 20px 16px;
  position: relative;
}

.message-input-area textarea {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  transition: border-color var(--transition);
}

.message-input-area textarea:focus { border-color: var(--accent); }
.message-input-area textarea::placeholder { color: var(--text-muted); }

.btn-send {
  width: 38px;
  height: 38px;
  background: var(--accent);
  color: white;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  flex-shrink: 0;
}

.btn-send:hover { background: var(--accent-hover); }

/* ── Right Sidebar ─────────────────────────────────────── */

.right-sidebar {
  width: var(--right-width);
  min-width: var(--right-width);
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.panel { padding: 16px; border-bottom: 1px solid var(--border); }

.panel-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.user-list { display: flex; flex-direction: column; gap: 4px; }

.muted-text { font-size: 12px; color: var(--text-muted); font-style: italic; }

.user-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}

.user-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.user-dot.voice { background: var(--accent); }

.user-item-name {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   TOASTS
   ═══════════════════════════════════════════════════════════ */

#toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 18px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  animation: toastIn 0.25s ease, toastOut 0.3s ease 3.5s forwards;
  pointer-events: auto;
  max-width: 360px;
  word-break: break-word;
}

.toast.error { border-color: var(--danger); background: rgba(240,71,71,0.15); }
.toast.success { border-color: var(--success); background: rgba(67,181,129,0.15); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateY(-10px); }
}

/* ═══════════════════════════════════════════════════════════
   SERVER BAR (far left, Discord-style)
   ═══════════════════════════════════════════════════════════ */

.server-bar {
  width: 56px;
  min-width: 56px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
}

.server-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-tertiary);
  position: relative;
  flex-shrink: 0;
}

.server-icon:hover { border-radius: 12px; background: var(--accent); }
.server-icon.home { border-radius: 12px; background: var(--accent); }

.server-icon.home.bounce {
  animation: serverBounce 0.4s ease;
}

@keyframes serverBounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
  60% { transform: translateY(-3px); }
}

.server-icon-text {
  font-size: 18px;
  color: var(--text-primary);
  pointer-events: none;
  font-weight: 700;
}

.server-icon.add-server {
  background: transparent;
  border: 2px dashed var(--border-light);
}

.server-icon.add-server:hover {
  border-color: var(--accent);
  background: transparent;
  border-radius: 12px;
}

.server-icon.add-server .server-icon-text {
  font-size: 22px;
  color: var(--accent);
}

.server-status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

.server-status-dot.online  { background: var(--success); }
.server-status-dot.offline { background: var(--text-muted); }
.server-status-dot.unknown { background: var(--warning); }

.server-separator {
  width: 24px;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  margin: 4px 0;
  flex-shrink: 0;
}

.server-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  font-size: 12px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--bg-secondary);
  padding: 0;
}

.server-icon.remote:hover .server-remove { display: flex; }


/* ═══════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 28px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
}

.modal h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-family: var(--font-heading);
}

.modal .modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.modal .form-group { margin-bottom: 14px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}


/* ═══════════════════════════════════════════════════════════
   CHAT IMAGES
   ═══════════════════════════════════════════════════════════ */

.chat-image {
  max-width: 400px;
  max-height: 300px;
  border-radius: var(--radius);
  margin-top: 4px;
  cursor: pointer;
  transition: opacity 0.15s ease;
  display: block;
}

.chat-image:hover { opacity: 0.85; }


/* ═══════════════════════════════════════════════════════════
   UPLOAD BUTTON + DRAG-DROP
   ═══════════════════════════════════════════════════════════ */

.btn-upload {
  width: 38px;
  height: 38px;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-upload:hover { color: var(--text-primary); background: var(--bg-tertiary); }

.message-area.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
  background: rgba(124, 92, 252, 0.04);
}


/* ═══════════════════════════════════════════════════════════
   VOICE VOLUME SLIDERS
   ═══════════════════════════════════════════════════════════ */

.voice-user-item { display: flex; align-items: center; flex-wrap: wrap; }

.voice-user-item.talking {
  background: rgba(124, 92, 252, 0.12);
  border-radius: var(--radius-sm);
}

.voice-user-item.talking .user-dot.voice {
  box-shadow: 0 0 6px 2px var(--accent);
  animation: voice-pulse 0.8s ease-in-out infinite alternate;
}

.voice-user-item.talking .user-item-name {
  color: var(--accent);
  font-weight: 600;
}

@keyframes voice-pulse {
  from { box-shadow: 0 0 4px 1px var(--accent); }
  to   { box-shadow: 0 0 10px 4px var(--accent); }
}

.you-tag {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: auto;
}

.volume-slider {
  width: 100%;
  height: 14px;
  margin-top: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-runnable-track {
  background: var(--track-bg, var(--bg-tertiary));
  height: 4px;
  border-radius: 2px;
}

.volume-slider::-moz-range-track {
  background: var(--track-bg, var(--bg-tertiary));
  height: 4px;
  border-radius: 2px;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  margin-top: -4px;
}

.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}


/* ═══════════════════════════════════════════════════════════
   NOTIFICATION SETTINGS
   ═══════════════════════════════════════════════════════════ */

.notif-settings { display: flex; flex-direction: column; gap: 10px; }

.toggle-row, .volume-row, .select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  gap: 8px;
}

.toggle-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.slider-sm {
  width: 80px;
  height: 14px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.slider-sm::-webkit-slider-runnable-track {
  background: var(--track-bg, var(--bg-tertiary));
  height: 4px;
  border-radius: 2px;
}

.slider-sm::-moz-range-track {
  background: var(--track-bg, var(--bg-tertiary));
  height: 4px;
  border-radius: 2px;
}

.slider-sm::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  margin-top: -4px;
  box-shadow: 0 0 4px var(--accent-glow, rgba(124,92,252,0.3));
}

.slider-sm::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 4px var(--accent-glow, rgba(124,92,252,0.3));
}

.select-row select {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

.select-row select:focus { border-color: var(--accent); }


/* ═══════════════════════════════════════════════════════════
   EMOJI PICKER
   ═══════════════════════════════════════════════════════════ */

.btn-emoji {
  width: 38px;
  height: 38px;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
  font-size: 18px;
}

.btn-emoji:hover { color: var(--text-primary); background: var(--bg-tertiary); }

.emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 48px;
  margin-bottom: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  width: 340px;
  max-height: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 1000;
}

.emoji-search-row {
  padding: 0 2px 6px;
}

.emoji-search-input {
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}
.emoji-search-input:focus {
  border-color: var(--accent);
}

.emoji-tab-row {
  display: flex;
  gap: 2px;
  padding: 0 2px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.emoji-tab {
  flex: 1;
  padding: 4px 0;
  font-size: 16px;
  text-align: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  border: none;
  opacity: 0.5;
  transition: opacity var(--transition), background var(--transition);
}
.emoji-tab:hover { opacity: 0.8; background: var(--bg-tertiary); }
.emoji-tab.active { opacity: 1; background: var(--bg-tertiary); }

.emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  overflow-y: auto;
  max-height: 240px;
  padding: 2px;
}

.emoji-item {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  border: none;
  transition: background var(--transition), transform 0.1s ease;
}

.emoji-item:hover {
  background: var(--bg-tertiary);
  transform: scale(1.2);
}


/* ═══════════════════════════════════════════════════════════
   GIF PICKER
   ═══════════════════════════════════════════════════════════ */

.btn-gif {
  width: 38px;
  height: 26px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--text-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  align-self: center;
}

.btn-gif:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--bg-tertiary);
}

.gif-picker {
  position: absolute;
  bottom: 100%;
  left: 88px;
  margin-bottom: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  width: 340px;
  max-height: 420px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 1000;
  overflow: hidden;
}

.gif-picker-header {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.gif-picker-header input {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

.gif-picker-header input:focus {
  border-color: var(--accent);
}

.gif-picker-grid {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  min-height: 200px;
}

.gif-picker-grid img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.2s;
  display: block;
}

.gif-picker-grid img:hover {
  transform: scale(1.03);
  opacity: 0.85;
}

.gif-picker-footer {
  padding: 4px 10px;
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.gif-picker-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 10px;
  color: var(--text-muted);
  font-size: 13px;
}

/* GIF setup guide (shown when GIPHY key not configured) */
.gif-setup-guide {
  grid-column: 1 / -1;
  padding: 16px 20px;
  text-align: left;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
}
.gif-setup-guide h3 {
  margin: 0 0 8px;
  font-size: 15px;
}
.gif-setup-guide ol {
  margin: 8px 0;
  padding-left: 20px;
}
.gif-setup-guide li {
  margin-bottom: 4px;
}
.gif-setup-guide a {
  color: var(--accent);
}
.gif-setup-input-row {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}
.gif-setup-input-row input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  font-family: monospace;
}
.gif-setup-input-row button {
  padding: 6px 16px;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.gif-setup-input-row button:hover {
  opacity: 0.9;
}
.gif-setup-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}


/* ═══════════════════════════════════════════════════════════
   MESSAGE REACTIONS
   ═══════════════════════════════════════════════════════════ */

.reactions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.reaction-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.reaction-badge:hover {
  background: rgba(124, 92, 252, 0.15);
  border-color: var(--accent);
}

.reaction-badge.own {
  background: rgba(124, 92, 252, 0.2);
  border-color: var(--accent);
  color: var(--text-primary);
}

.reaction-picker {
  position: absolute;
  top: -44px;
  right: 8px;
  display: flex;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 4px 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  z-index: 100;
}

.reaction-pick-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  border: none;
  transition: background 0.15s, transform 0.1s;
}

.reaction-pick-btn:hover {
  background: var(--bg-tertiary);
  transform: scale(1.15);
}


/* ═══════════════════════════════════════════════════════════
   MESSAGE HOVER TOOLBAR
   ═══════════════════════════════════════════════════════════ */

.message, .message-compact { position: relative; }

.msg-toolbar {
  position: absolute;
  top: -6px;
  right: 8px;
  display: none;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 10;
}

.message:hover .msg-toolbar,
.message-compact:hover .msg-toolbar { display: flex; }

/* Hide toolbar while in edit mode */
.message.editing .msg-toolbar,
.message-compact.editing .msg-toolbar { display: none !important; }

.msg-toolbar button {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  border: none;
  transition: background var(--transition);
}

.msg-toolbar button:hover { background: var(--bg-tertiary); }


/* ═══════════════════════════════════════════════════════════
   REPLY BANNER (on messages + input area)
   ═══════════════════════════════════════════════════════════ */

.reply-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 56px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  overflow: hidden;
}

.reply-banner:hover { text-decoration: underline; }

.reply-line {
  width: 2px;
  height: 14px;
  border-radius: 1px;
  flex-shrink: 0;
}

.reply-author { font-weight: 600; flex-shrink: 0; }

.reply-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Reply bar above input */
.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 20px;
  background: var(--bg-tertiary);
  border-top: 2px solid var(--accent);
  font-size: 13px;
  color: var(--text-secondary);
}

.reply-bar-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-bar-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  flex-shrink: 0;
  transition: all var(--transition);
}

.reply-bar-close:hover { color: var(--text-primary); background: var(--bg-secondary); }


/* ═══════════════════════════════════════════════════════════
   @MENTION STYLES
   ═══════════════════════════════════════════════════════════ */

.mention {
  background: rgba(124, 92, 252, 0.15);
  color: var(--accent);
  padding: 0 3px;
  border-radius: 4px;
  font-weight: 600;
  cursor: default;
}

.mention.mention-self {
  background: rgba(124, 92, 252, 0.3);
}

/* @mention autocomplete dropdown */
.mention-dropdown {
  position: absolute;
  bottom: 100%;
  left: 48px;
  margin-bottom: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  min-width: 180px;
  max-width: 260px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  z-index: 1001;
}

.mention-item {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition);
}

.mention-item:hover, .mention-item.active {
  background: var(--accent);
  color: white;
}

/* /slash command autocomplete dropdown */
.slash-dropdown {
  position: absolute;
  bottom: 100%;
  left: 48px;
  margin-bottom: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow-y: auto;
  max-height: 320px;
  min-width: 280px;
  max-width: 400px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  z-index: 1002;
}

.slash-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border-light);
}

.slash-item:last-child { border-bottom: none; }

.slash-item:hover, .slash-item.active {
  background: var(--accent);
  color: white;
}

.slash-cmd {
  font-weight: 700;
  color: var(--accent);
  min-width: 82px;
  flex-shrink: 0;
}

.slash-item:hover .slash-cmd,
.slash-item.active .slash-cmd {
  color: white;
}

.slash-args {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  flex-shrink: 0;
}

.slash-item:hover .slash-args,
.slash-item.active .slash-args {
  color: rgba(255,255,255,0.7);
}

.slash-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slash-item:hover .slash-desc,
.slash-item.active .slash-desc {
  color: rgba(255,255,255,0.7);
}


/* ═══════════════════════════════════════════════════════════
   SEARCH
   ═══════════════════════════════════════════════════════════ */

.search-container {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 2px 6px;
  margin-right: 8px;
}

.search-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  width: 160px;
  outline: none;
  padding: 4px 2px;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-results-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 340px;
  max-height: 100%;
  background: var(--bg-card);
  border-left: 1px solid var(--border-light);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -4px 0 12px rgba(0,0,0,0.2);
}

.search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.search-results-list {
  overflow-y: auto;
  flex: 1;
}

.search-result-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
}

.search-result-item:hover {
  background: var(--bg-hover);
}

.search-result-author {
  font-weight: 600;
  font-size: 12px;
  margin-right: 6px;
}

.search-result-time {
  font-size: 10px;
  color: var(--text-muted);
}

.search-result-content {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.search-result-content mark {
  background: rgba(250, 166, 26, 0.35);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

/* Highlight flash on message when clicking search result */
@keyframes highlightFlash {
  0%, 100% { background: transparent; }
  30% { background: rgba(250, 166, 26, 0.25); }
}

.highlight-flash {
  animation: highlightFlash 2s ease;
}


/* ═══════════════════════════════════════════════════════════
   EDITED MESSAGE TAG
   ═══════════════════════════════════════════════════════════ */

.edited-tag {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 6px;
  font-style: italic;
  cursor: default;
  user-select: none;
}


/* ═══════════════════════════════════════════════════════════
   INLINE EDIT TEXTAREA
   ═══════════════════════════════════════════════════════════ */

.edit-textarea {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  outline: none;
}

.edit-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.edit-save-btn, .edit-cancel-btn {
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

.edit-save-btn {
  background: var(--accent);
  color: white;
}

.edit-save-btn:hover { background: var(--accent-hover); }

.edit-cancel-btn {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.edit-cancel-btn:hover { background: var(--bg-hover); color: var(--text-primary); }


/* ═══════════════════════════════════════════════════════════
   SPOILER TEXT
   ═══════════════════════════════════════════════════════════ */

.spoiler {
  background: var(--text-muted);
  color: transparent;
  border-radius: 3px;
  padding: 0 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.spoiler.revealed {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  user-select: auto;
}


/* ═══════════════════════════════════════════════════════════
   /me ACTION TEXT
   ═══════════════════════════════════════════════════════════ */

.action-text {
  color: var(--text-secondary);
  font-style: italic;
}


/* ═══════════════════════════════════════════════════════════
   MARKDOWN / INLINE CODE
   ═══════════════════════════════════════════════════════════ */

.inline-code {
  background: var(--bg-tertiary);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.9em;
}


/* ═══════════════════════════════════════════════════════════
   ADMIN PANEL / MODERATION
   ═══════════════════════════════════════════════════════════ */

.admin-settings {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-full {
  width: 100%;
  text-align: center;
}

.btn-danger-fill {
  background: var(--danger) !important;
  color: white !important;
}

.btn-danger-fill:hover {
  background: #d93636 !important;
}

.notif-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.user-admin-actions {
  display: none;
  gap: 2px;
  margin-left: auto;
  flex-shrink: 0;
}

.user-item:hover .user-admin-actions {
  display: flex;
}

.user-action-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  border: none;
  transition: background var(--transition);
  padding: 0;
}

.user-action-btn:hover {
  background: var(--bg-tertiary);
}

.user-item.offline { opacity: 0.5; }
.user-dot.away { background: var(--text-muted); border-radius: 2px 2px 50% 50%; }


/* ═══════════════════════════════════════════════════════════
   BANS MODAL
   ═══════════════════════════════════════════════════════════ */

.modal-wide { max-width: 500px; }

/* ═══════════════════════════════════════════════════════════
   SETTINGS POPOUT MODAL
   ═══════════════════════════════════════════════════════════ */

.modal-settings {
  max-width: 460px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 0;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
  border-bottom: 1px solid var(--border);
}

.settings-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-heading);
  margin: 0;
}

.settings-close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}
.settings-close-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.settings-section {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.settings-section:last-child { border-bottom: none; }

.settings-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.settings-section-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.settings-number-input {
  width: 70px;
  padding: 4px 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
}

.settings-hint {
  color: var(--text-muted);
  font-size: 10px;
  display: block;
  margin-top: -2px;
}
.settings-hint.error { color: #e94560; }
.settings-hint.success { color: #43b581; }

.password-change-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.password-change-form .form-group.compact {
  margin: 0;
}
.password-change-form input {
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}
.password-change-form input:focus {
  border-color: var(--accent);
}

.sidebar-settings-panel {
  margin-top: auto;
  border-top: 1px solid var(--border);
  border-bottom: none;
  padding: 10px 16px;
}

.btn-settings-popout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
}
.btn-settings-popout:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}
.btn-settings-popout svg {
  flex-shrink: 0;
  opacity: 0.7;
}
.btn-settings-popout:hover svg { opacity: 1; }

.bans-list {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.ban-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.ban-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.ban-info strong {
  font-size: 13px;
  color: var(--text-primary);
}

.ban-reason {
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ban-date {
  font-size: 10px;
  color: var(--text-muted);
}

.btn-unban {
  flex-shrink: 0;
  background: var(--success) !important;
  color: white !important;
}

.btn-unban:hover { opacity: 0.85; }

.ban-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  align-items: center;
}

.btn-delete-user {
  flex-shrink: 0;
  background: var(--danger) !important;
  color: white !important;
  font-size: 12px;
  padding: 4px 8px !important;
}

.btn-delete-user:hover { opacity: 0.85; }

.chat-image[src$=".gif"],
.chat-image[src*=".gif?"] {
  border: 1px solid var(--border);
}


/* ═══════════════════════════════════════════════════════════
   MOBILE MENU BUTTONS
   ═══════════════════════════════════════════════════════════ */

.mobile-menu-btn,
.mobile-users-btn {
  display: none;  /* hidden on desktop */
  width: 40px;
  height: 40px;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn:hover,
.mobile-users-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Mobile overlay (dim background when sidebar open) */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  -webkit-tap-highlight-color: transparent;
}

.mobile-overlay.active { display: block; }

/* Mobile-only voice join button (inside right sidebar) */
.mobile-voice-join {
  display: none;     /* hidden on desktop, shown via mobile media query */
  width: 100%;
  margin-bottom: 8px;
  justify-content: center;
}


/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (≤ 900px)
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .right-sidebar { display: none; }
  .mobile-users-btn { display: flex; }
}


/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Small Tablet (≤ 768px)
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* Show hamburger and users button */
  .mobile-menu-btn,
  .mobile-users-btn { display: flex; }

  /* Collapse server bar */
  .server-bar { width: 0; min-width: 0; overflow: hidden; border: none; padding: 0; }

  /* Main area takes full width on mobile */
  .main { width: 100%; min-width: 0; }

  /* Welcome screen centered properly */
  .welcome-screen { width: 100%; justify-content: center; align-items: center; }
  .welcome-content { max-width: 90vw; padding: 0 16px; }

  /* Left sidebar — slide out as overlay (! overrides theme [data-theme] .sidebar { position: relative }) */
  .sidebar {
    position: fixed !important;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    min-width: 280px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }

  #app-body.mobile-sidebar-open .sidebar {
    transform: translateX(0);
  }

  /* Bring server bar back inside the sidebar overlay */
  #app-body.mobile-sidebar-open .server-bar {
    position: fixed;
    left: 280px;
    top: 0;
    bottom: 0;
    width: 52px;
    min-width: 52px;
    z-index: 100;
    overflow-y: auto;
    transform: translateX(-332px);
    transition: transform 0.25s ease;
    border-right: 1px solid var(--border);
    padding: 8px 0;
  }

  #app-body.mobile-sidebar-open .server-bar {
    transform: translateX(0);
  }

  /* Right sidebar — slide in from right as overlay */
  .right-sidebar {
    display: flex !important;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    min-width: 260px;
    z-index: 100;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
  }

  #app-body.mobile-right-open .right-sidebar {
    transform: translateX(0);
  }

  /* Channel header adjustments */
  .channel-header {
    padding: 8px 12px;
    min-height: 48px;
    gap: 8px;
  }

  .channel-info h3 { font-size: 14px; }
  .channel-code-tag { display: none; }

  /* Voice buttons — smaller on tablet */
  .btn-voice { padding: 5px 10px; font-size: 12px; }
  .voice-label-text { display: none; }

  /* Hide header clutter — search/pin/delete tucked into long-press or sidebar */
  #delete-channel-btn,
  #search-toggle-btn,
  #pinned-toggle-btn,
  #copy-code-btn { display: none !important; }

  /* Voice join moves to right sidebar on mobile */
  #voice-join-btn { display: none !important; }
  .mobile-voice-join { display: flex !important; }

  /* Message toolbar — hidden until tapped */
  .msg-toolbar {
    position: static;
    display: none;
    margin-top: 4px;
    box-shadow: none;
    border: none;
    background: none;
    padding: 0;
    gap: 4px;
  }

  .msg-selected .msg-toolbar { display: flex; }
  .msg-selected { background: rgba(255,255,255,0.04); border-radius: var(--radius); }

  .msg-toolbar button {
    width: 34px; height: 34px; font-size: 16px;
    background: var(--bg-tertiary); border-radius: var(--radius);
  }

  /* Messages area */
  .messages { padding: 12px; }
  .message-input-area { padding: 8px 12px 12px; gap: 6px; }

  /* GIF picker — constrained on tablet */
  .gif-picker { max-width: 360px; }

  /* Screen share — constrained */
  .screen-share-container { max-height: 40vh; }

  /* Status bar — hidden on mobile to save vertical space */
  .status-bar { display: none; }
}


/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Phone (≤ 480px)
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  /* Safe area insets for notched phones */
  #app {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  /* Sidebar full width on phones */
  .sidebar { width: 85vw; min-width: 85vw; }

  #app-body.mobile-sidebar-open .server-bar {
    left: 85vw;
    transform: translateX(calc(-85vw - 52px));
  }

  #app-body.mobile-sidebar-open .server-bar {
    transform: translateX(0);
  }

  .right-sidebar { width: 85vw; min-width: 85vw; }

  /* Channel header — tight */
  .channel-header {
    padding: 6px 8px;
    min-height: 44px;
    gap: 4px;
  }

  .channel-info h3 { font-size: 13px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Voice buttons — compact on phone */
  .voice-controls { gap: 4px; flex-wrap: nowrap; flex-shrink: 1; overflow: visible; }
  .btn-voice {
    padding: 4px 8px;
    font-size: 12px;
    min-width: 0;
  }
  .voice-label-text { display: none; }

  /* Voice dropdown — bottom-sheet on mobile */
  .voice-dropdown-panel {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    margin-top: 0 !important;
    border-radius: 16px 16px 0 0;
    padding: 16px;
    gap: 6px;
    z-index: 9999;
    min-width: 100vw;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.6);
    animation: slideUpSheet 0.2s ease-out;
  }
  .voice-dropdown-panel .btn-voice {
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 10px;
  }
  .voice-dropdown-panel .voice-ns-wrap {
    padding: 10px 12px;
    border-radius: 10px;
  }
  .voice-dropdown-panel .ns-slider {
    width: 100%;
    flex: 1;
  }

  @keyframes slideUpSheet {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  /* Backdrop overlay when voice dropdown is open */
  .voice-dropdown-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
  }

  /* Messages */
  .messages { padding: 8px; }
  .message-row { gap: 8px; padding: 4px; }
  .message-avatar { width: 30px; height: 30px; font-size: 12px; }
  .message-avatar-img { width: 30px; height: 30px; }
  .user-item-avatar, .user-item-avatar-img { width: 20px; height: 20px; font-size: 9px; }
  .user-avatar-wrapper { width: 20px; height: 20px; }
  .user-status-dot { width: 8px; height: 8px; bottom: -2px; right: -2px; }
  .message-author { font-size: 13px; }
  .message-content { font-size: 14px; line-height: 1.45; word-break: break-word; }
  .message-time { font-size: 10px; }
  .message-compact { padding-left: 46px; }

  /* Chat images — full width on mobile */
  .chat-image { max-width: 100%; max-height: 250px; }

  /* Input area — touch-friendly */
  .message-input-area {
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    gap: 3px;
  }

  .message-input-area textarea {
    padding: 8px 12px;
    font-size: 16px; /* prevents iOS zoom on focus */
    border-radius: 20px;
    min-height: 36px;
  }

  .btn-send,
  .btn-upload,
  .btn-emoji,
  .btn-gif {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    font-size: 14px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  /* GIF picker — full width on phone */
  .gif-picker {
    left: 4px;
    right: 4px;
    bottom: 56px;
    max-width: none;
    width: auto;
    max-height: 50vh;
  }

  .gif-picker-grid { max-height: 40vh; }

  /* Emoji picker — full width on phone */
  .emoji-picker {
    left: 4px;
    right: 4px;
    max-width: none;
    width: auto;
  }

  .emoji-grid { max-height: 200px; }
  .emoji-item { width: 40px; height: 40px; font-size: 22px; }

  /* Mention dropdown — wider */
  .mention-dropdown {
    left: 8px;
    right: 8px;
    max-width: none;
    min-width: 0;
  }

  .mention-item { padding: 12px 14px; font-size: 14px; }

  /* Reply bar */
  .reply-bar { padding: 6px 8px; font-size: 12px; }
  .reply-banner { padding-left: 46px; }

  /* Reaction badges — touch-friendly */
  .reaction-badge { padding: 4px 10px; font-size: 14px; }
  .reaction-picker { gap: 4px; padding: 6px 8px; }
  .reaction-pick-btn { width: 38px; height: 38px; font-size: 20px; }

  /* Message toolbar — hidden until message is tapped */
  .msg-toolbar {
    position: static;
    display: none;
    margin-top: 4px;
    box-shadow: none;
    border: none;
    background: none;
    padding: 0;
    gap: 4px;
  }

  .msg-selected .msg-toolbar {
    display: flex;
  }

  .msg-selected {
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius);
  }

  .msg-toolbar button {
    width: 34px;
    height: 34px;
    font-size: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
  }

  /* Screen share — smaller on phone */
  .screen-share-container { max-height: 35vh; min-height: 120px; }

  /* Status bar — hidden on phones */
  .status-bar { display: none; }

  /* Welcome screen */
  .welcome-icon { font-size: 48px; }
  .welcome-content h2 { font-size: 18px; }
  .welcome-content p { font-size: 13px; }

  /* Modal — wider on phone */
  .modal { padding: 20px; width: 95%; max-height: 85vh; overflow-y: auto; }
  .modal h3 { font-size: 18px; }

  /* Settings modal — scrollable on phone */
  .modal-settings { max-height: 80vh; overflow-y: auto; }

  /* Toasts — full width */
  #toast-container { left: 50%; right: auto; top: calc(8px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); }
  .toast { max-width: none; }

  /* Typing indicator */
  .typing-indicator { padding: 0 8px; font-size: 11px; }

  /* Search container */
  .search-container { flex: 1; }
  .search-input { font-size: 14px; }

  /* Stream audio controls — always visible on touch */
  .stream-audio-controls { opacity: 1; }
  .stream-vol-slider { width: 50px; }
  .music-panel-header { padding: 4px 8px; font-size: 11px; }
  .music-embed-container { max-height: 180px; }
}


/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Tiny Phone (≤ 360px)
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 360px) {
  .channel-info h3 { font-size: 12px; max-width: 90px; }
  .btn-voice { font-size: 11px; padding: 5px 6px; }
  .message-avatar { width: 26px; height: 26px; font-size: 11px; }
  .message-avatar-img { width: 26px; height: 26px; }
  .user-item-avatar, .user-item-avatar-img { width: 18px; height: 18px; font-size: 8px; }
  .user-avatar-wrapper { width: 18px; height: 18px; }
  .user-status-dot { width: 7px; height: 7px; bottom: -2px; right: -2px; }
  .message-compact { padding-left: 40px; }
  .message-row { gap: 6px; }
  .message-content { font-size: 13px; }

  /* Voice controls stack to two rows if needed */
  .voice-controls { gap: 3px; }

  /* Hide non-critical status items */
  .status-bar .status-item:nth-child(n+3) { display: none; }

  /* Sidebar slightly narrower */
  .sidebar { width: 80vw; min-width: 80vw; }
  .right-sidebar { width: 80vw; min-width: 80vw; }
}


/* ═══════════════════════════════════════════════════════════
   TOUCH & ACCESSIBILITY
   ═══════════════════════════════════════════════════════════ */

@media (hover: none) and (pointer: coarse) {
  /* Prevent pull-to-refresh on chat app */
  html, body { overscroll-behavior-y: contain; }

  /* Touch devices — larger tap targets */
  .channel-item { padding: 12px 16px; min-height: 44px; }
  .btn-sm { min-height: 44px; padding: 10px 14px; }
  .icon-btn { min-width: 40px; min-height: 40px; font-size: 18px; }
  .theme-btn { width: 36px; height: 36px; }
  .toggle-row input[type="checkbox"] { width: 20px; height: 20px; }
  .server-icon { width: 44px; height: 44px; }
  .btn-voice { min-height: 36px; }

  /* Disable hover-only interactions */
  .message:hover, .message-compact:hover { background: transparent; }
  .message-compact:hover .compact-time { display: none; }

  /* Message toolbar — hidden until message is tapped */
  .msg-toolbar {
    display: none;
    position: static;
    box-shadow: none;
    border: none;
    background: none;
    padding: 0;
    margin-top: 4px;
  }

  .msg-selected .msg-toolbar {
    display: flex;
  }

  .msg-selected {
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius);
  }

  .msg-toolbar button {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    min-width: 34px;
    min-height: 34px;
  }

  /* Smoother scrolling on touch */
  .messages, .sidebar, .right-sidebar, .modal {
    -webkit-overflow-scrolling: touch;
  }
}


/* ═══════════════════════════════════════════════════════════
   LANDSCAPE PHONE
   ═══════════════════════════════════════════════════════════ */

@media (max-height: 500px) and (orientation: landscape) {
  .status-bar { display: none; }
  .channel-header { min-height: 40px; padding: 4px 8px; }
  .messages { padding: 4px 8px; }
  .message-input-area { padding: 4px 8px 6px; }
  .welcome-icon { font-size: 36px; }
  .welcome-content h2 { font-size: 16px; }
}

/* ═══════════════════════════════════════════════════════════
   USER LIST: Group Labels & Score Badges
   ═══════════════════════════════════════════════════════════ */

.user-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  padding: 8px 6px 4px;
  user-select: none;
}

.user-group-label.offline-label {
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.user-score-badge {
  font-size: 10px;
  color: var(--accent);
  background: var(--bg-tertiary);
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: auto;
  flex-shrink: 0;
  font-weight: 600;
  opacity: 0.8;
}

/* ═══════════════════════════════════════════════════════════
   EULA
   ═══════════════════════════════════════════════════════════ */

.eula-notice {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.eula-check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.eula-check-row + .eula-check-row { margin-top: 10px; }

.eula-check-row input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.eula-check-row a {
  color: var(--accent);
  text-decoration: underline;
}

.eula-check-row a:hover {
  color: var(--accent-hover);
}

.eula-modal {
  max-width: 700px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.eula-content {
  overflow-y: auto;
  max-height: 55vh;
  padding: 16px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin: 12px 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.eula-content p { margin: 8px 0; }
.eula-content ol { padding-left: 20px; }
.eula-content ol li { margin: 10px 0; }
.eula-content ul { padding-left: 20px; margin: 6px 0; }
.eula-content ul li { margin: 4px 0; list-style: disc; }
.eula-content h4 {
  margin: 18px 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}
.eula-content strong { color: var(--text-primary); }
.eula-content em { color: var(--text-muted); }

.eula-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--danger);
}

/* ═══════════════════════════════════════════════════════════
   GAME BUTTON
   ═══════════════════════════════════════════════════════════ */

.btn-game {
  margin-top: 20px;
  padding: 10px 24px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-game:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════
   TTS MESSAGE INDICATOR
   ═══════════════════════════════════════════════════════════ */

.tts-tag {
  font-size: 10px;
  color: var(--accent);
  margin-left: 6px;
  opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════
   SCREEN SHARE
   ═══════════════════════════════════════════════════════════ */

.screen-share-container {
  display: none;
  flex-direction: column;
  background: #000;
  border-bottom: 2px solid var(--accent);
  max-height: 50vh;
  min-height: 180px;
  position: relative;
}

.screen-share-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 11px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  margin-left: 8px;
  animation: pulse-glow 2s ease-in-out infinite;
  white-space: nowrap;
}
.screen-share-indicator:hover { filter: brightness(1.2); }
@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.screen-share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.screen-share-header .icon-btn {
  color: var(--text-muted);
}

.screen-share-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stream-size-slider {
  width: 70px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border-radius: 2px;
  cursor: pointer;
  vertical-align: middle;
  outline: none;
}
.stream-size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 4px var(--accent-glow, rgba(124,92,252,0.3));
}
.stream-size-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}
.screen-share-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2px;
  max-height: calc(50vh - 32px);
  overflow-y: auto;
  background: #000;
}

.screen-share-tile {
  position: relative;
  background: #111;
}

.screen-share-tile video {
  width: 100%;
  display: block;
  object-fit: contain;
  max-height: 45vh;
  background: #000;
}

.screen-share-tile-label {
  position: absolute;
  bottom: 4px;
  left: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  pointer-events: none;
}

/* ── Stream Audio Controls (per-tile overlay) ──────────── */

.stream-audio-controls {
  position: absolute;
  bottom: 4px;
  right: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.75);
  padding: 3px 8px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 2;
}
.screen-share-tile:hover .stream-audio-controls { opacity: 1; }

.stream-mute-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}
.stream-mute-btn:hover { background: rgba(255,255,255,0.15); }
.stream-mute-btn.muted { color: var(--danger, #e74c3c); }

.stream-vol-slider {
  --track-bg: rgba(255,255,255,0.2);
  width: 60px;
  height: 14px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border-radius: 2px;
  cursor: pointer;
  outline: none;
  vertical-align: middle;
}
.stream-vol-slider::-webkit-slider-runnable-track {
  background: var(--track-bg, rgba(255,255,255,0.2));
  height: 4px;
  border-radius: 2px;
}
.stream-vol-slider::-moz-range-track {
  background: var(--track-bg, rgba(255,255,255,0.2));
  height: 4px;
  border-radius: 2px;
}
.stream-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent, #7c5cfc);
  cursor: pointer;
  margin-top: -3px;
  box-shadow: 0 0 4px rgba(124,92,252,0.4);
}
.stream-vol-slider::-moz-range-thumb {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent, #7c5cfc);
  cursor: pointer;
  border: none;
}
.stream-vol-pct {
  color: rgba(255,255,255,0.7);
  font-size: 10px;
  min-width: 28px;
  text-align: center;
  user-select: none;
}

.stream-audio-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  background: rgba(0,0,0,0.65);
  color: var(--accent, #7c5cfc);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 3px;
}

.stream-no-audio-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  background: rgba(0,0,0,0.75);
  color: var(--text-muted, #888);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0.85;
}

/* ── Stream Focus Mode (double-click to expand) ──────── */

.stream-focus-mode {
  max-height: none !important;
  flex: 1 1 auto;
  min-height: 0;
}

.stream-focus-mode .screen-share-grid {
  max-height: none !important;
  flex: 1 1 auto;
  min-height: 0;
}

.stream-focus-mode .screen-share-tile:not(.stream-focused) {
  display: none;
}

.stream-focus-mode .screen-share-tile.stream-focused {
  width: 100%;
  height: 100%;
}

.stream-focus-mode .screen-share-tile.stream-focused video {
  max-height: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Stream Pop-out Button ──────────────────────────── */

.stream-popout-btn {
  position: absolute;
  top: 4px;
  left: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 3;
  line-height: 1;
}
.screen-share-tile:hover .stream-popout-btn { opacity: 1; }
.stream-popout-btn:hover { background: rgba(255,255,255,0.2); }

/* ── Stream Hide Button ─────────────────────────────── */

.stream-hide-btn {
  position: absolute;
  top: 4px;
  left: 34px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 3;
  line-height: 1;
}
.screen-share-tile:hover .stream-hide-btn { opacity: 1; }
.stream-hide-btn:hover { background: rgba(255,255,255,0.2); }

/* ── Hidden Streams Bar (inside voice-controls) ──────── */

.hidden-streams-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  flex-wrap: nowrap;
  white-space: nowrap;
}

.hidden-stream-restore-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius);
  background: var(--danger);
  color: #fff;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s;
  height: 30px;
  box-sizing: border-box;
  line-height: 1.3;
}
.hidden-stream-restore-btn:hover {
  filter: brightness(1.2);
}

/* Collapse tile when popped out — free up Haven space */
.screen-share-tile.stream-popped-out {
  height: 28px !important;
  min-height: 0 !important;
  overflow: hidden;
  flex: none !important;
}
.screen-share-tile.stream-popped-out video { display: none; }
.screen-share-tile.stream-popped-out .stream-controls { display: none; }
.screen-share-tile.stream-popped-out::after {
  content: '⧉ Popped out — click to restore';
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 28px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-tertiary);
}

/* ═══════════════════════════════════════════════════════════
   MUSIC PANEL
   ═══════════════════════════════════════════════════════════ */

.music-panel {
  display: none;
  flex-direction: column;
  background: var(--bg-tertiary);
  border-bottom: 2px solid var(--accent);
}
.music-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.music-panel-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.music-panel-header-left #music-popout-btn {
  flex-shrink: 0;
}
.music-panel-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.music-panel-controls .stream-vol-slider { width: 80px; }
.music-embed-container {
  min-height: 80px;
  max-height: 260px;
  overflow: hidden;
  background: #000;
}
.music-embed-container iframe {
  width: 100%;
  border: none;
  display: block;
}

/* Overlay blocks direct clicks on the iframe — sync goes through Haven controls only */
.music-embed-wrapper {
  position: relative;
  width: 100%;
}
.music-embed-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  cursor: default;
  /* Transparent but captures all clicks / pointer events */
}

/* ── Music Active Indicator (minimized panel) ──────────── */

.music-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  animation: pulse-glow 2s ease-in-out infinite;
  white-space: nowrap;
  height: 30px;
  box-sizing: border-box;
  line-height: 1.3;
}
.music-indicator:hover { filter: brightness(1.2); }

/* ── Music PiP Overlay ─────────────────────────────────── */

.music-pip-overlay {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 340px;
  z-index: 10000;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  resize: both;
  min-width: 260px;
  min-height: 140px;
}
.music-pip-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border-bottom: 2px solid var(--accent);
  cursor: grab;
  user-select: none;
}
.music-pip-header:active { cursor: grabbing; }
.music-pip-label {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.music-pip-btn {
  background: rgba(255,255,255,0.08);
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}
.music-pip-btn:hover { background: rgba(255,255,255,0.18); }
.music-pip-embed {
  flex: 1;
  overflow: hidden;
  background: #000;
  min-height: 80px;
}
.music-pip-embed .music-embed-wrapper {
  width: 100%;
  height: 100%;
}
.music-pip-embed iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.music-pip-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-tertiary);
}
.music-pip-vol-icon {
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.music-pip-vol {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--bg-primary);
  border-radius: 2px;
  outline: none;
  flex: 1;
  max-width: 120px;
}
.music-pip-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

@media (max-width: 768px) {
  .music-pip-overlay {
    width: 280px;
    bottom: 12px;
    right: 12px;
  }
}

/* ── Music Modal extras ────────────────────────────────── */

.music-link-preview {
  min-height: 0;
  transition: all 0.2s;
}
.music-link-preview.active {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.music-platforms-hint {
  display: flex;
  gap: 6px;
  margin: 8px 0 4px;
  flex-wrap: wrap;
}
.platform-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.platform-badge.spotify { background: rgba(29,185,84,0.15); color: #1db954; }
.platform-badge.youtube { background: rgba(255,0,0,0.12); color: #ff4444; }
.platform-badge.soundcloud { background: rgba(255,85,0,0.12); color: #ff5500; }

.btn-voice.sharing {
  background: var(--danger) !important;
  color: #fff !important;
}

/* ═══════════════════════════════════════════════════════════
   WHITELIST PANEL
   ═══════════════════════════════════════════════════════════ */

.whitelist-add-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.whitelist-add-row input {
  flex: 1;
  min-width: 0;
}

.settings-text-input {
  padding: 6px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
}

.settings-text-input:focus {
  outline: none;
  border-color: var(--accent);
}

.whitelist-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.whitelist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.whitelist-username {
  color: var(--text-primary);
  font-weight: 500;
}

.btn-danger-sm {
  padding: 2px 8px !important;
  font-size: 11px;
  background: var(--danger) !important;
  color: #fff !important;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 0;
  line-height: 1.4;
}

.btn-danger-sm:hover { opacity: 0.85; }

/* ═══════════════════════════════════════════════════════════
   PINNED MESSAGES
   ═══════════════════════════════════════════════════════════ */

.message.pinned,
.message-compact.pinned {
  border-left: 3px solid var(--accent);
  background: rgba(124, 92, 252, 0.04);
}

.pinned-tag {
  font-size: 11px;
  margin-left: 4px;
  opacity: 0.7;
  cursor: default;
}

.pinned-panel {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  max-height: 300px;
  overflow-y: auto;
}

.pinned-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
}

.pinned-list { padding: 4px 0; }

.pinned-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background var(--transition);
}

.pinned-item:hover { background: rgba(255,255,255,0.04); }

.pinned-item-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.pinned-item-author { font-weight: 600; font-size: 13px; }
.pinned-item-time { font-size: 11px; color: var(--text-muted); }

.pinned-item-content {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
  max-height: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pinned-item-footer {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════
   CODE BLOCKS & BLOCKQUOTES
   ═══════════════════════════════════════════════════════════ */

.code-block {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin: 6px 0;
  position: relative;
  overflow: hidden;
}

.code-block pre {
  margin: 0;
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
}

.code-block code {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  color: var(--text-primary);
  background: none;
  padding: 0;
}

.code-block-lang {
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.inline-code {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  background: var(--bg-tertiary);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.9em;
  color: var(--accent);
}

.chat-blockquote {
  border-left: 3px solid var(--text-muted);
  padding: 2px 0 2px 10px;
  margin: 4px 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════
   LINK PREVIEWS
   ═══════════════════════════════════════════════════════════ */

.link-preview {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  padding: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  max-width: 480px;
  overflow: hidden;
  transition: background var(--transition);
}

.link-preview:hover {
  background: rgba(255,255,255,0.04);
}

.link-preview-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.link-preview-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.link-preview-site {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.link-preview-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-link);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-preview-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════
   Channel Topic Bar
   ═══════════════════════════════════════════════════════════ */

.channel-topic-bar {
  padding: 4px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 24px;
  line-height: 24px;
}

.channel-topic-bar:hover {
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════
   User Status Dots
   ═══════════════════════════════════════════════════════════ */

/* DND: square — distinct shape */
.user-dot.dnd {
  background-color: var(--danger) !important;
  box-shadow: 0 0 4px var(--danger);
  border-radius: 2px;
}

/* Away: half-circle dome */
.user-dot.away {
  background-color: #faa61a !important;
  box-shadow: 0 0 4px rgba(250, 166, 26, 0.4);
  border-radius: 2px 2px 50% 50%;
}

/* Invisible: hollow circle */
.user-dot.invisible {
  background-color: transparent !important;
  border: 2px solid var(--text-muted);
  box-shadow: none;
  box-sizing: border-box;
}

.user-status-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}

/* ═══════════════════════════════════════════════════════════
   Status Picker
   ═══════════════════════════════════════════════════════════ */

.status-picker-dot {
  cursor: pointer;
  transition: transform 0.15s;
}

.status-picker-dot:hover {
  transform: scale(1.4);
}

.status-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 0;
  min-width: 180px;
  z-index: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.status-option {
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
}

.status-option:hover {
  background: var(--bg-hover);
}

.status-option .user-dot {
  position: static;
  flex-shrink: 0;
}

.status-text-row {
  padding: 6px 12px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 8px;
}

.status-text-row input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}

.status-text-row input:focus {
  border-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════
   DM Section in Sidebar
   ═══════════════════════════════════════════════════════════ */

.dm-section-label {
  margin-top: 12px !important;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.dm-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
  transition: color 0.15s;
}

.dm-toggle:hover {
  color: var(--text-secondary);
}

.dm-toggle-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 10px;
}

.dm-toggle-arrow.collapsed {
  transform: rotate(-90deg);
}

.dm-unread-count {
  font-size: 9px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: auto;
}

.dm-item .channel-hash {
  color: var(--accent);
}

.user-dm-btn {
  font-size: 12px !important;
  opacity: 0;
  transition: opacity 0.15s;
}

.user-item:hover .user-dm-btn {
  opacity: 0.7;
}

.user-dm-btn:hover {
  opacity: 1 !important;
}

/* ═══════════════════════════════════════════════════════════
   File Attachments
   ═══════════════════════════════════════════════════════════ */

#file-upload-btn {
  font-size: 16px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  opacity: 0.6;
  transition: opacity 0.15s;
}

#file-upload-btn:hover {
  opacity: 1;
}

.file-attachment {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  max-width: 400px;
  margin: 4px 0;
}

.file-download-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-primary);
  transition: color 0.15s;
}

.file-download-link:hover {
  color: var(--accent);
}

.file-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.file-name {
  font-weight: 500;
  word-break: break-all;
}

.file-size {
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
}

.file-download-arrow {
  margin-left: auto;
  font-size: 16px;
  opacity: 0.5;
}

.file-download-link:hover .file-download-arrow {
  opacity: 1;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 13px;
}

.file-attachment audio {
  width: 100%;
  height: 32px;
}

.file-video {
  max-width: 100%;
  max-height: 300px;
  border-radius: 4px;
  margin-top: 4px;
}

.user-bar {
  position: relative;
}

/* ═══════════════════════════════════════════════════════════
   PERSISTENT VOICE BAR (sidebar bottom)
   ═══════════════════════════════════════════════════════════ */

.voice-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  margin-left: auto;
  padding: 5px 10px;
  background: var(--success);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  animation: voice-bar-pulse 2s ease-in-out infinite;
}

.voice-bar-icon { font-size: 14px; }

.voice-bar-channel {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-bar-leave {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s;
}

.voice-bar-leave:hover { color: #fff; }

@keyframes voice-bar-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.3); }
  50% { box-shadow: 0 0 8px 2px rgba(46, 204, 113, 0.15); }
}

/* ═══════════════════════════════════════════════════════════
   THEMED SLIDER EFFECTS
   ═══════════════════════════════════════════════════════════ */

/* Bloodborne / Dark Souls — health bar red glow */
[data-theme="bloodborne"] .slider-sm,
[data-theme="bloodborne"] .ns-slider {
  --track-bg: #1a0c0c;
}
[data-theme="bloodborne"] .slider-sm::-webkit-slider-thumb,
[data-theme="bloodborne"] .ns-slider::-webkit-slider-thumb {
  box-shadow: 0 0 8px rgba(204, 0, 32, 0.6);
}

[data-theme="darksouls"] .slider-sm,
[data-theme="darksouls"] .ns-slider {
  --track-bg: #1a1510;
}
[data-theme="darksouls"] .slider-sm::-webkit-slider-thumb,
[data-theme="darksouls"] .ns-slider::-webkit-slider-thumb {
  box-shadow: 0 0 8px rgba(200, 168, 78, 0.5);
}

/* Elden Ring — golden estus glow */
[data-theme="eldenring"] .slider-sm,
[data-theme="eldenring"] .ns-slider {
  --track-bg: #14141e;
}
[data-theme="eldenring"] .slider-sm::-webkit-slider-thumb,
[data-theme="eldenring"] .ns-slider::-webkit-slider-thumb {
  box-shadow: 0 0 10px rgba(212, 168, 50, 0.6);
}

/* Minecraft — blocky green bar */
[data-theme="minecraft"] .slider-sm,
[data-theme="minecraft"] .ns-slider {
  --track-bg: #2e2e2e;
  --track-h: 6px;
  --track-r: 0;
  --track-border: 1px solid #3a3a3a;
  height: 6px;
  border-radius: 0;
  border: 1px solid #3a3a3a;
}
[data-theme="minecraft"] .slider-sm::-webkit-slider-thumb,
[data-theme="minecraft"] .ns-slider::-webkit-slider-thumb {
  border-radius: 2px;
  box-shadow: 2px 2px 0 #2a5a2a;
}
[data-theme="minecraft"] .slider-sm::-moz-range-thumb,
[data-theme="minecraft"] .ns-slider::-moz-range-thumb {
  border-radius: 2px;
}

/* Final Fantasy X — blue mana bar */
[data-theme="ffx"] .slider-sm,
[data-theme="ffx"] .ns-slider {
  --track-bg: #101a30;
  --track-h: 5px;
  height: 5px;
}
[data-theme="ffx"] .slider-sm::-webkit-slider-thumb,
[data-theme="ffx"] .ns-slider::-webkit-slider-thumb {
  box-shadow: 0 0 8px rgba(64, 168, 224, 0.5);
}

/* Zelda — green heart / stamina bar */
[data-theme="zelda"] .slider-sm,
[data-theme="zelda"] .ns-slider {
  --track-bg: #142014;
  --track-h: 5px;
  height: 5px;
}
[data-theme="zelda"] .slider-sm::-webkit-slider-thumb,
[data-theme="zelda"] .ns-slider::-webkit-slider-thumb {
  box-shadow: 0 0 8px rgba(68, 187, 68, 0.5);
}

/* Matrix — green terminal glow */
[data-theme="matrix"] .slider-sm,
[data-theme="matrix"] .ns-slider {
  --track-bg: #0a0a0a;
}
[data-theme="matrix"] .slider-sm::-webkit-slider-thumb,
[data-theme="matrix"] .ns-slider::-webkit-slider-thumb {
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.5);
}

/* Tron — neon blue trail */
[data-theme="tron"] .slider-sm,
[data-theme="tron"] .ns-slider {
  --track-bg: #0c141f;
}
[data-theme="tron"] .slider-sm::-webkit-slider-thumb,
[data-theme="tron"] .ns-slider::-webkit-slider-thumb {
  box-shadow: 0 0 10px rgba(111, 236, 255, 0.6);
}

/* Cyberpunk — neon pink */
[data-theme="cyberpunk"] .slider-sm,
[data-theme="cyberpunk"] .ns-slider {
  --track-bg: #0a0a12;
}
[data-theme="cyberpunk"] .slider-sm::-webkit-slider-thumb,
[data-theme="cyberpunk"] .ns-slider::-webkit-slider-thumb {
  box-shadow: 0 0 8px rgba(255, 45, 111, 0.5);
}

/* Halo — UNSC blue-green */
[data-theme="halo"] .slider-sm,
[data-theme="halo"] .ns-slider {
  --track-bg: #0d1a0d;
}
[data-theme="halo"] .slider-sm::-webkit-slider-thumb,
[data-theme="halo"] .ns-slider::-webkit-slider-thumb {
  box-shadow: 0 0 8px rgba(79, 195, 247, 0.5);
}

/* Ice — frozen blue */
[data-theme="ice"] .slider-sm,
[data-theme="ice"] .ns-slider {
  --track-bg: #102030;
}
[data-theme="ice"] .slider-sm::-webkit-slider-thumb,
[data-theme="ice"] .ns-slider::-webkit-slider-thumb {
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
}

/* LoTR — golden warmth */
[data-theme="lotr"] .slider-sm,
[data-theme="lotr"] .ns-slider {
  --track-bg: #2a221a;
}
[data-theme="lotr"] .slider-sm::-webkit-slider-thumb,
[data-theme="lotr"] .ns-slider::-webkit-slider-thumb {
  box-shadow: 0 0 6px rgba(212, 168, 68, 0.5);
}

/* Dracula — purple accent */
[data-theme="dracula"] .slider-sm,
[data-theme="dracula"] .ns-slider {
  --track-bg: #22232e;
}
[data-theme="dracula"] .slider-sm::-webkit-slider-thumb,
[data-theme="dracula"] .ns-slider::-webkit-slider-thumb {
  box-shadow: 0 0 8px rgba(189, 147, 249, 0.5);
}
