/* ==============================================================================
   PaiN Chat - Pixel Edition Theme
   Retro 8-bit / 16-bit Cyber-Dark Fantasy Voice & Video Engine
============================================================================== */

:root {
  --pain-500: #ff2233;
  --pain-700: #cc0011;
  --pain-900: #660006;
  --pain-950: #330003;
  --bg-darkest: #050507;
  --bg-dark: #0c0c0e;
  --bg-panel: #121316;
  --bg-box: #1a1a1c;
  --border-pixel: #000000;
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --accent-green: #10b981;
  --accent-gold: #f59e0b;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
}

/* Pixel Fonts */
.pixel-font {
  font-family: 'Press Start 2P', monospace;
}

.chat-font {
  font-family: 'VT323', monospace;
  font-size: 20px;
  letter-spacing: 0.5px;
}

button, input, select, textarea {
  font-family: inherit;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'VT323', monospace;
}

/* Custom Pixel Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #111;
  border-left: 2px solid #000;
}

::-webkit-scrollbar-thumb {
  background: var(--pain-700);
  border: 2px solid #000;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--pain-500);
}

/* Chunky Pixel Buttons */
.pixel-btn {
  border: 2px solid #000 !important;
  box-shadow: 2px 2px 0px #000 !important;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  font-family: 'Press Start 2P', monospace;
  cursor: pointer;
}

.pixel-btn:hover {
  filter: brightness(1.15);
}

.pixel-btn:active {
  transform: translate(2px, 2px) !important;
  box-shadow: 0px 0px 0px #000 !important;
}

/* Pixel Boxes */
.pixel-box-dark {
  background-color: var(--bg-box);
  border: 3px solid #000;
  box-shadow: 4px 4px 0px #000;
}

/* ==============================================================================
   Titlebar
============================================================================== */
.titlebar {
  height: 34px;
  background-color: var(--bg-darkest);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid #000;
  z-index: 1000;
}

.titlebar-drag {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  padding-left: 12px;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--pain-500);
  gap: 10px;
  letter-spacing: 0.05em;
  -webkit-app-region: drag;
}

.pixel-logo-icon {
  width: 24px;
  height: 24px;
  background: #141418;
  border: 2px solid #000;
  box-shadow: 1px 1px 0px #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 1px;
}

.pixel-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.window-controls {
  display: flex;
  height: 100%;
  -webkit-app-region: no-drag;
}

.window-controls button {
  width: 40px;
  height: 100%;
  background: transparent;
  border: none;
  border-left: 2px solid #000;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  transition: all 0.1s ease;
}

.window-controls button:hover {
  background: #222;
  color: #fff;
}

.window-controls button.close-btn:hover {
  background: var(--pain-700);
  color: #fff;
}

/* ==============================================================================
   App Layout
============================================================================== */
.app-layout {
  flex: 1;
  display: flex;
  height: calc(100vh - 34px);
  overflow: hidden;
}

/* 1. Retro Realm / Server Sidebar */
.guild-rail {
  width: 76px;
  background-color: var(--bg-darkest);
  border-right: 4px solid #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  justify-content: space-between;
  shrink-0: 0;
  z-index: 20;
}

.guild-rail-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.guild-icon {
  width: 48px;
  height: 48px;
  background: #202024;
  border: 3px solid #000;
  box-shadow: 2px 2px 0px #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.1s ease;
}

.guild-icon:hover {
  background: var(--pain-700);
  color: #fff;
  transform: translate(1px, 1px);
}

.guild-icon.active {
  background: var(--pain-900);
  border-color: var(--pain-500);
  color: var(--pain-500);
  box-shadow: 3px 3px 0px #000;
}

.guild-logo-img {
  width: 32px;
  height: 38px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 0 4px rgba(255, 34, 51, 0.45));
  transition: transform 0.15s ease;
}

.guild-icon:hover .guild-logo-img {
  transform: scale(1.1);
}

.guild-separator {
  width: 36px;
  height: 2px;
  background: #2a2a2e;
  margin: 4px 0;
}

.guild-icon.add-guild {
  background: #18181b;
  color: var(--pain-500);
  font-size: 14px;
}

.guild-icon.add-guild:hover {
  background: var(--pain-700);
  color: #fff;
}

/* 2. Channels Sidebar */
.channels-sidebar {
  width: clamp(220px, 19vw, 270px);
  min-width: 210px;
  background-color: var(--bg-panel);
  border-right: 4px solid #000;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.server-header {
  height: 52px;
  padding: 0 16px;
  border-bottom: 4px solid #000;
  background: var(--bg-darkest);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.server-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.server-title-logo {
  width: 20px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 0 3px rgba(255, 34, 51, 0.4));
}

.server-header h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--pain-500);
  letter-spacing: 0.05em;
}

.badge-vds {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  background: var(--pain-900);
  border: 2px solid #000;
  box-shadow: 1px 1px 0px #000;
  color: var(--pain-500);
  padding: 3px 6px;
}

.channels-list {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.channel-category {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 4px 2px 4px;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(30, 30, 36, 0.4);
  border: 2px solid #000;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.1s ease;
  font-family: 'VT323', monospace;
  font-size: 19px;
}

.channel-item:hover {
  background: rgba(50, 50, 60, 0.8);
  color: #fff;
}

.channel-item.active {
  background: rgba(102, 0, 6, 0.7);
  border-color: var(--pain-500);
  color: var(--pain-500);
  box-shadow: 2px 2px 0px #000;
}

.channel-icon {
  font-size: 14px;
}

.channel-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-live {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  background: var(--pain-700);
  color: #fff;
  padding: 2px 5px;
  border: 1px solid #000;
}

/* Connected Voice Members List under Channel */
.voice-members-list {
  display: flex;
  flex-direction: column;
  padding-left: 14px;
  margin-bottom: 4px;
  gap: 4px;
}

.voice-member-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: #17181c;
  border: 2px solid #000;
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.1s ease;
}

.voice-member-item:hover {
  background: #25262c;
  border-color: var(--pain-500);
}

.voice-member-avatar {
  width: 24px;
  height: 24px;
  background: var(--pain-700);
  border: 2px solid #000;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-member-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* User Panel Footer - Scalable and Flex-safe */
.user-panel {
  height: 56px;
  background-color: var(--bg-darkest);
  border-top: 4px solid #000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  gap: 6px;
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
  flex-shrink: 0;
}

.user-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.user-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  max-width: 34px;
  max-height: 34px;
  flex-shrink: 0;
  aspect-ratio: 1 / 1;
  background: var(--pain-700);
  border: 2px solid #000;
  box-shadow: 1px 1px 0px #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: #fff;
  position: relative;
  border-radius: 50% !important;
  overflow: hidden !important;
}

.status-indicator {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 9px;
  height: 9px;
  background-color: var(--accent-green);
  border: 2px solid #111216;
  border-radius: 50% !important;
  z-index: 5;
}

.user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  overflow: hidden;
  gap: 2px;
}

.username {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--text-main);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.user-tag {
  font-family: 'VT323', monospace;
  font-size: 13px;
  line-height: 1.1;
  color: var(--pain-500);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.user-panel-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.profile-edit-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  background: #1c1d22;
  border: 2px solid #000;
  box-shadow: 1px 1px 0px #000;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.1s ease;
  flex-shrink: 0;
  border-radius: 4px;
}

.profile-edit-btn:hover {
  background: var(--pain-700);
  color: #fff;
}

.user-controls {
  display: flex;
  gap: 4px;
}

.control-btn {
  width: 28px;
  height: 28px;
  background: #1c1d22;
  border: 2px solid #000;
  box-shadow: 1px 1px 0px #000;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.1s ease;
}

.control-btn:hover {
  background: #2a2b33;
  color: #fff;
}

.control-btn.muted,
.control-btn.deafened {
  background: var(--pain-900);
  color: var(--pain-500);
  border-color: var(--pain-700);
}

.control-btn.live-btn {
  color: var(--accent-green);
}

/* ==============================================================================
   Main Conference Room Stage (PaiN Pixel Theme)
============================================================================== */
.stage-container {
  flex: 1;
  background-color: var(--bg-dark);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

/* Call Header */
.call-header {
  height: 54px;
  padding: 0 20px;
  border-bottom: 4px solid #000;
  background: var(--bg-darkest);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.call-info h3 {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: var(--pain-500);
  letter-spacing: 0.05em;
}

.status-connected {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: var(--accent-green);
}

.call-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mic-level-meter {
  width: 60px;
  height: 8px;
  background: #111;
  border: 2px solid #000;
  overflow: hidden;
}

.mic-level-fill {
  width: 0%;
  height: 100%;
  background: var(--accent-green);
  transition: width 0.05s ease;
}

.action-button {
  padding: 6px 12px;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 2px solid #000;
  box-shadow: 2px 2px 0px #000;
  transition: all 0.08s ease;
}

.action-button:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px #000;
}

.action-button.primary {
  background: var(--pain-700);
  color: #fff;
}

.action-button.primary:hover {
  background: var(--pain-500);
}

.action-button.secondary {
  background: #23242a;
  color: var(--text-main);
}

.action-button.secondary:hover {
  background: #32343c;
}

/* ==============================================================================
   Video Grid (Retro Multi-Stream 60 FPS)
============================================================================== */
.video-grid {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  position: relative;
  overflow-y: auto;
  align-items: center;
  justify-content: center;
}

.stream-card {
  flex: 1 1 calc(50% - 16px);
  min-width: 0 !important;
  max-width: 100%;
  width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-box);
  border: 3px solid #000;
  box-shadow: 4px 4px 0px #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: all 0.15s ease;
  cursor: pointer;
}

.stream-card:hover {
  border-color: var(--pain-500);
}

.stream-card.single-tile {
  flex: 1 1 100%;
  max-width: 100%;
  max-height: 100%;
}

/* Focus / Stage View */
.video-grid.has-focused {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 12px;
  padding: 12px;
}

.video-grid.has-focused .stream-card.focused-tile {
  flex: 1 1 auto;
  width: 100%;
  max-height: calc(100% - 140px);
  aspect-ratio: auto;
  border-color: var(--pain-500);
  box-shadow: 0 0 20px rgba(255, 34, 51, 0.4), 4px 4px 0px #000;
}

.video-grid.has-focused .stream-card:not(.focused-tile) {
  flex: 0 0 auto;
  width: 220px;
  height: 124px;
  min-width: 0;
  max-height: 124px;
  aspect-ratio: 16 / 9;
}

.stream-card video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.stream-overlay-header {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}

.streamer-tag {
  background: var(--pain-900);
  border: 2px solid #000;
  box-shadow: 2px 2px 0px #000;
  color: #fff;
  padding: 4px 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
}

.fps-counter {
  background: #064e3b;
  border: 2px solid #000;
  box-shadow: 2px 2px 0px #000;
  color: #34d399;
  padding: 4px 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  letter-spacing: 0.05em;
}

.stream-specs {
  background: #111;
  border: 2px solid #000;
  color: var(--text-muted);
  padding: 4px 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
}

.tile-actions {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.tile-btn {
  background: #111;
  border: 2px solid #000;
  box-shadow: 2px 2px 0px #000;
  color: #fff;
  padding: 4px 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  cursor: pointer;
  transition: all 0.08s ease;
}

.tile-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px #000;
}

.tile-btn:hover {
  background: var(--pain-700);
}

/* Discord-like Voice Stage Grid (Avatars of Talking Users) */
.stage-voice-container {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: radial-gradient(circle at center, #17181f 0%, #0a0a0d 100%);
  overflow-y: auto;
  z-index: 10;
}

.stage-voice-header {
  position: absolute;
  top: 16px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stage-voice-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--pain-500);
  letter-spacing: 0.05em;
}

.stage-voice-count {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--accent-green);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--accent-green);
  padding: 2px 6px;
}

.stage-voice-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 28px;
  max-width: 960px;
  width: 100%;
  padding: 20px 10px;
}

.stage-voice-user-card {
  width: 170px;
  height: 195px;
  background: #141419;
  border: 3px solid #000;
  box-shadow: 4px 4px 0px #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 10px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  position: relative;
  user-select: none;
}

.stage-voice-user-card:hover {
  transform: translateY(-4px);
  border-color: var(--pain-500);
  box-shadow: 6px 6px 0px #000;
  background: #191a21;
}

/* Discord Active Speaker Glowing Halo Effect */
.stage-voice-user-card.speaking {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 2px #10b981, 4px 4px 0px #000, 0 0 24px rgba(16, 185, 129, 0.45) !important;
}

.stage-voice-avatar-wrap {
  position: relative;
  margin-bottom: 14px;
}

.stage-voice-avatar {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 3px solid #000;
  background: var(--pain-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 22px;
  color: #fff;
  box-shadow: 2px 2px 0px #000;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.stage-voice-user-card.speaking .stage-voice-avatar {
  border-color: #10b981;
  box-shadow: 0 0 0 3px #10b981, 0 0 20px rgba(16, 185, 129, 0.85);
  transform: scale(1.06);
}

.stage-voice-mic-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #18181b;
  border: 2px solid #000;
  box-shadow: 1px 1px 0px #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
}

.stage-voice-mic-badge.muted {
  background: #dc2626;
  color: #fff;
}

.stage-voice-user-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
}

.stage-voice-username {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: #fff;
  text-align: center;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-voice-vol-tag {
  font-family: 'VT323', monospace;
  font-size: 17px;
  color: var(--text-muted);
}

/* Stream Placeholder */
.stream-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: radial-gradient(circle at center, #1b1b22 0%, #0a0a0d 100%);
}

.placeholder-icon {
  font-size: 48px;
  margin-bottom: 12px;
  filter: drop-shadow(4px 4px 0px #000);
}

.stream-placeholder h3 {
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  color: var(--pain-500);
  margin-bottom: 10px;
  letter-spacing: 0.05em;
}

.stream-placeholder p {
  color: var(--text-muted);
  font-family: 'VT323', monospace;
  font-size: 20px;
  max-width: 480px;
  margin-bottom: 22px;
  line-height: 1.3;
}

.launch-share-btn {
  background: var(--pain-700);
  color: #fff;
  padding: 10px 20px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  border: 3px solid #000;
  box-shadow: 3px 3px 0px #000;
  cursor: pointer;
  transition: all 0.08s ease;
}

.launch-share-btn:hover {
  background: var(--pain-500);
}

.launch-share-btn:active {
  transform: translate(3px, 3px);
  box-shadow: 0px 0px 0px #000;
}

/* Call Control Pill Bar (Pixel Edition) */
.bottom-call-bar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--bg-panel);
  border-top: 4px solid #000;
}

.call-pill-btn {
  padding: 8px 16px;
  background: #23242a;
  border: 2px solid #000;
  box-shadow: 2px 2px 0px #000;
  color: var(--text-main);
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.08s ease;
}

.call-pill-btn:hover {
  background: #33353e;
}

.call-pill-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px #000;
}

.call-pill-btn.active {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
  border-color: var(--accent-green);
}

.call-pill-btn.highlight {
  background: var(--pain-700);
  color: #fff;
}

.call-pill-btn.highlight:hover {
  background: var(--pain-500);
}

.call-pill-btn.danger {
  background: var(--pain-900);
  color: var(--pain-500);
}

.call-pill-btn.danger:hover {
  background: var(--pain-700);
  color: #fff;
}

.call-pill-btn.deafened {
  background: var(--pain-900);
  color: var(--pain-500);
  border-color: var(--pain-500);
}

/* ==============================================================================
   Active Speaker Halo (Retro Pixel Glow)
============================================================================== */
@keyframes pixel-pulse {
  0% {
    box-shadow: 0 0 0 2px var(--accent-green), 2px 2px 0px #000;
  }
  50% {
    box-shadow: 0 0 0 4px var(--accent-green), 0 0 10px rgba(16, 185, 129, 0.8), 2px 2px 0px #000;
  }
  100% {
    box-shadow: 0 0 0 2px var(--accent-green), 2px 2px 0px #000;
  }
}

.voice-member-avatar.speaking,
.user-avatar.speaking {
  animation: pixel-pulse 0.9s infinite ease-in-out !important;
  border-color: var(--accent-green) !important;
}

.stream-card.speaking {
  border-color: var(--accent-green) !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.5), 4px 4px 0px #000 !important;
}

/* ==============================================================================
   Modals & Popovers (Chunky Pixel Boxes)
============================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-dialog {
  width: 640px;
  max-width: 92vw;
  background: var(--bg-box);
  border: 4px solid #000;
  box-shadow: 6px 6px 0px #000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 14px 18px;
  background: var(--bg-darkest);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid #000;
}

.modal-header h3 {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--pain-500);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

.modal-tabs {
  display: flex;
  padding: 10px 18px 0 18px;
  gap: 16px;
  background: var(--bg-panel);
  border-bottom: 3px solid #000;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding-bottom: 10px;
  cursor: pointer;
  position: relative;
}

.tab-btn.active {
  color: var(--pain-500);
}

.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--pain-500);
}

.sources-grid {
  padding: 16px 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  max-height: 240px;
  overflow-y: auto;
}

.source-item {
  background: #121316;
  border: 2px solid #000;
  box-shadow: 2px 2px 0px #000;
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.1s ease;
}

.source-item:hover {
  border-color: var(--text-muted);
}

.source-item.selected {
  border-color: var(--pain-500);
  background: var(--pain-950);
}

.source-preview {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border: 1px solid #000;
  object-fit: cover;
}

.source-title {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stream-quality-settings {
  padding: 14px 18px;
  background: var(--bg-panel);
  border-top: 3px solid #000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-group label {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #94a3b8;
}

.options-pills {
  display: flex;
  gap: 8px;
}

.pill {
  padding: 6px 10px;
  background: #17181c;
  border: 2px solid #000;
  box-shadow: 2px 2px 0px #000;
  color: var(--text-muted);
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  cursor: pointer;
  transition: all 0.08s ease;
}

.pill:hover {
  color: #fff;
}

.pill.active {
  background: var(--pain-700);
  color: #fff;
  border-color: #000;
}

.pill.special-pill.active {
  background: var(--pain-500);
  color: #fff;
}

.checkbox-setting {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: var(--text-main);
  cursor: pointer;
}

.modal-footer {
  padding: 12px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-darkest);
  border-top: 3px solid #000;
}

/* ==============================================================================
   User Volume Popover (Retro Pixel Box)
============================================================================== */
.user-volume-popover {
  position: fixed;
  bottom: 80px;
  left: 80px;
  width: 290px;
  background: var(--bg-box);
  border: 3px solid #000;
  box-shadow: 5px 5px 0px #000;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.popover-header {
  padding: 10px 14px;
  background: var(--bg-darkest);
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 2px solid #000;
}

.popover-avatar {
  width: 28px;
  height: 28px;
  background: var(--pain-700);
  border: 2px solid #000;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popover-user-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.popover-username {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.popover-status {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: var(--accent-green);
}

.popover-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
}

.popover-close:hover {
  color: #fff;
}

.popover-button, input, select, textarea {
  font-family: inherit;
}

body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.volume-slider-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.volume-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.volume-slider-header label {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: #94a3b8;
}

.volume-percent-badge {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--pain-500);
  background: #111;
  border: 1px solid #000;
  padding: 2px 6px;
}

.discord-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  background: #111;
  border: 2px solid #000;
  outline: none;
  cursor: pointer;
}

.discord-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 18px;
  background: var(--pain-500);
  border: 2px solid #000;
  cursor: pointer;
}

.popover-actions {
  display: flex;
  gap: 8px;
}

.action-btn-sm {
  flex: 1;
  padding: 6px 8px;
  background: #23242a;
  border: 2px solid #000;
  box-shadow: 2px 2px 0px #000;
  color: var(--text-main);
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  cursor: pointer;
  transition: all 0.08s ease;
}

.action-btn-sm:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px #000;
}

.action-btn-sm.danger {
  background: var(--pain-900);
  color: var(--pain-500);
}

/* VDS Modal Form */
.vds-form {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vds-desc {
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: var(--text-muted);
  line-height: 1.3;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--text-main);
}

.form-group input {
  padding: 8px 10px;
  background: #111;
  border: 2px solid #000;
  color: var(--text-main);
  font-family: 'VT323', monospace;
  font-size: 18px;
  outline: none;
}

.form-group input:focus {
  border-color: var(--pain-500);
}

.vds-status-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #111;
  border: 2px solid #000;
  font-family: 'VT323', monospace;
  font-size: 17px;
}

.status-indicator-vds {
  width: 8px;
  height: 8px;
  background: var(--accent-gold);
  border: 1px solid #000;
}

/* ==============================================================================
   RETRO INTRO SPLASH OVERLAY (anim.gif)
   ============================================================================== */
.intro-splash-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: #09090c;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: default;
  user-select: none;
  overflow: hidden;
}

.intro-splash-overlay.fade-out {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

/* CRT scanlines effect on splash screen */
.intro-splash-overlay::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.35) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  z-index: 2;
  background-size: 100% 4px, 6px 100%;
  pointer-events: none;
}

.intro-card {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #111115;
  border: 4px solid #000;
  box-shadow: 6px 6px 0px #000, 0 0 40px rgba(220, 38, 38, 0.25);
  padding: 24px 32px;
  max-width: 520px;
  width: 90%;
  text-align: center;
  animation: introPopIn 0.35s ease-out;
}

@keyframes introPopIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.intro-badge {
  font-size: 10px;
  color: var(--pain-500);
  background: var(--pain-950);
  border: 2px solid #000;
  box-shadow: 2px 2px 0px #000;
  padding: 5px 14px;
  margin-bottom: 16px;
  letter-spacing: 0.12em;
}

.intro-anim-wrap {
  width: 100%;
  max-width: 440px;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 3px solid #000;
  box-shadow: inset 0 0 24px rgba(0,0,0,0.9), 3px 3px 0px #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.intro-anim-gif {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.intro-text {
  font-size: 11px;
  color: #fff;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  text-shadow: 2px 2px 0px #000;
}

.intro-subtext {
  font-size: 17px;
  color: #888;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.intro-progress-bar {
  width: 100%;
  height: 14px;
  background: #08080a;
  border: 2px solid #000;
  box-shadow: inset 1px 1px 0px #000;
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
}

.intro-progress-fill {
  height: 100%;
  width: 0%;
  background: repeating-linear-gradient(
    90deg,
    var(--pain-600),
    var(--pain-600) 10px,
    var(--pain-500) 10px,
    var(--pain-500) 20px
  );
  box-shadow: 0 0 10px var(--pain-500);
  transition: width 0.1s linear;
}


/* Voice Member Indicators (Mute & Deafen) */
.voice-member-indicators {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.indicator-mute {
  color: #ef4444;
  font-size: 11px;
  display: flex;
  align-items: center;
  filter: drop-shadow(0 0 3px rgba(239, 68, 68, 0.7));
}

.indicator-deaf {
  color: #ef4444;
  font-size: 11px;
  display: flex;
  align-items: center;
  filter: drop-shadow(0 0 3px rgba(239, 68, 68, 0.7));
}

/* Stage Disconnected Box */
.stage-disconnected-box {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  background: radial-gradient(circle at center, #17181f 0%, #0a0a0d 100%);
  z-index: 10;
}

.stage-disconnected-icon {
  font-size: 48px;
  margin-bottom: 16px;
  filter: drop-shadow(3px 3px 0px #000);
  animation: pulse-radio 2.5s infinite ease-in-out;
}

@keyframes pulse-radio {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.stage-disconnected-box h3 {
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  color: var(--pain-500);
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}

.stage-disconnected-box p {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.3;
}


/* ==============================================================================
   Noise Suppression Modes, Gate Visualizer & Mic Monitor (OBS & Discord style)
============================================================================== */
.noise-modes-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.noise-section-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.noise-mode-pills {
  display: flex;
  gap: 6px;
}

.noise-mode-btn {
  flex: 1;
  background: #18191c;
  border: 1px solid #35373c;
  color: #949ba4;
  font-family: 'VT323', monospace;
  font-size: 15px;
  padding: 5px 6px;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-align: center;
}

.noise-mode-btn:hover {
  background: #2b2d31;
  color: #f2f3f5;
  border-color: #4e5058;
}

.noise-mode-btn.active {
  background: var(--pain-900);
  border-color: var(--pain-500);
  color: #fff;
  font-weight: bold;
  box-shadow: 0 0 8px rgba(255, 68, 68, 0.45);
}

.mic-listen-btn {
  width: 100%;
  margin-top: 10px;
  background: #1e1f22;
  border: 1px solid #3b3e45;
  color: #dbdee1;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 9px 10px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.mic-listen-btn:hover {
  background: #2b2d31;
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.mic-listen-btn.active {
  background: rgba(35, 165, 89, 0.2);
  border-color: var(--accent-green);
  color: var(--accent-green);
  box-shadow: 0 0 10px rgba(35, 165, 89, 0.35);
}

.noise-meter-close-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #eab308;
  box-shadow: 0 0 5px #eab308;
  pointer-events: none;
  transform: translateX(-50%);
  z-index: 2;
}

.noise-meter-fill.hold {
  background: #eab308;
  box-shadow: 0 0 6px #eab308;
}

/* ==============================================================================
   Noise Meter and Gate Visualizer (Discord style)
============================================================================== */
.noise-meter-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
}

.noise-meter-bar-wrap {
  position: relative;
  width: 100%;
  height: 12px;
  background: #111;
  border: 2px solid #000;
  overflow: hidden;
}

.noise-meter-fill {
  width: 0%;
  height: 100%;
  background: #475569;
  transition: width 0.04s ease, background-color 0.1s ease;
}

.noise-meter-fill.open {
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
}

.noise-meter-threshold-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--pain-500);
  box-shadow: 0 0 4px var(--pain-500);
  pointer-events: none;
  transform: translateX(-50%);
}

.noise-meter-labels {
  display: flex;
  justify-content: space-between;
  font-family: 'VT323', monospace;
  font-size: 15px;
  color: var(--text-muted);
}


/* ==============================================================================
   Authentication & Registration (PaiN Retro Theme)
============================================================================== */
.auth-error-box {
  background: var(--pain-900);
  border: 2px solid var(--pain-500);
  color: var(--pain-500);
  padding: 8px 12px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  line-height: 1.4;
  margin-top: 10px;
}

.auth-error-box.success {
  background: rgba(16, 185, 129, 0.2);
  border: 2px solid var(--accent-green);
  color: var(--accent-green);
}

.auth-notice {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: #f59e0b;
  line-height: 1.3;
  margin: 10px 0 4px 0;
}

/* ==============================================================================
   Admin Panel & Management (PaiN Retro Theme)
============================================================================== */
.admin-btn {
  background: var(--pain-900) !important;
  border-color: var(--pain-500) !important;
  color: var(--pain-500) !important;
}

.admin-btn:hover {
  background: var(--pain-700) !important;
  color: #fff !important;
}

.badge-pending {
  background: #ef4444;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 2px 5px;
  border-radius: 2px;
  box-shadow: 1px 1px 0px #000;
  vertical-align: middle;
}

.admin-users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding: 10px 4px;
}

.admin-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(25, 25, 32, 0.8);
  border: 2px solid #000;
  box-shadow: 2px 2px 0px #000;
  gap: 12px;
}

.admin-user-card:hover {
  background: rgba(35, 35, 45, 0.9);
}

.admin-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-user-avatar {
  width: 32px;
  height: 32px;
  background: var(--pain-700);
  border: 2px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: #fff;
}

.admin-user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-user-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--text-main);
}

.admin-user-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.badge-role-admin {
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  background: var(--pain-700);
  color: #fff;
  padding: 2px 5px;
  border: 1px solid #000;
}

.badge-role-user {
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  background: #334155;
  color: #94a3b8;
  padding: 2px 5px;
  border: 1px solid #000;
}

.badge-status-pending {
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  background: #78350f;
  color: #fef08a;
  padding: 2px 5px;
  border: 1px solid #000;
}

.badge-status-approved {
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  background: #064e3b;
  color: #6ee7b7;
  padding: 2px 5px;
  border: 1px solid #000;
}

.admin-user-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-btn-action {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 6px 10px;
  border: 2px solid #000;
  box-shadow: 2px 2px 0px #000;
  cursor: pointer;
  transition: all 0.08s ease;
}

.admin-btn-action:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px #000;
}

.admin-btn-action.approve {
  background: var(--accent-green);
  color: #000;
}

.admin-btn-action.approve:hover {
  background: #34d399;
}

.admin-btn-action.reject {
  background: var(--pain-900);
  color: var(--pain-500);
}

.admin-btn-action.reject:hover {
  background: var(--pain-700);
  color: #fff;
}


/* ==============================================================================
   PaiN Chat - Text Channels, User Profiles, Avatars & Text Chat Styles
============================================================================== */

/* Category header with Admin add button */
.channel-category-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 2px 4px;
}

.btn-category-add {
  background: #1c1d22;
  border: 1px solid #000;
  box-shadow: 1px 1px 0px #000;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 6px;
  line-height: 1;
  transition: all 0.1s ease;
}

.btn-category-add:hover {
  background: var(--pain-700);
  color: #fff;
}

/* Text channels list */
.text-channels-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.text-channel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(25, 26, 30, 0.5);
  border: 2px solid #000;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.1s ease;
  font-family: 'VT323', monospace;
  font-size: 19px;
  position: relative;
}

.text-channel-item:hover {
  background: rgba(45, 46, 54, 0.85);
  color: #fff;
}

.text-channel-item.active {
  background: rgba(102, 0, 6, 0.65);
  border-color: var(--pain-500);
  color: #fff;
  box-shadow: 2px 2px 0px #000;
}

.text-channel-item .channel-icon {
  font-size: 16px;
  font-weight: bold;
  color: #888;
}

.text-channel-item.active .channel-icon {
  color: var(--pain-500);
}

.channel-actions-inline {
  display: none;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.text-channel-item:hover .channel-actions-inline {
  display: flex;
}

.btn-inline-action {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 3px;
  transition: color 0.1s;
}

.btn-inline-action:hover {
  color: #fff;
}

.btn-inline-action.danger:hover {
  color: var(--pain-500);
}

/* Profile button in User Panel */
.profile-edit-btn {
  width: 32px;
  height: 32px;
  background: #1c1d22;
  border: 2px solid #000;
  box-shadow: 1px 1px 0px #000;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.1s ease;
  flex-shrink: 0;
}

.profile-edit-btn:hover {
  background: var(--pain-700);
  color: #fff;
}

/* Avatar images across the app */
.user-avatar-img,
.stage-voice-avatar-img,
.voice-member-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  display: block;
}

.avatar-upload-section {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
  background: #111216;
  border: 2px solid #000;
  padding: 12px;
}

.avatar-preview-box {
  width: 64px;
  height: 64px;
  min-width: 64px;
  min-height: 64px;
  background: var(--pain-700);
  border: 2px solid #000;
  box-shadow: 2px 2px 0px #000;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.avatar-upload-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-hint {
  font-family: 'VT323', monospace;
  font-size: 15px;
  color: #64748b;
  margin-top: 3px;
  display: block;
}

/* Text Chat View in Stage */
.text-chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0f1013;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.chat-header {
  height: 48px;
  background: var(--bg-darkest);
  border-bottom: 2px solid #000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-info .chat-hash {
  font-size: 24px;
  color: var(--pain-500);
  font-weight: bold;
}

.chat-header-info h3 {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: #fff;
  letter-spacing: 0.5px;
}

.chat-header-info .chat-desc {
  font-family: 'VT323', monospace;
  font-size: 17px;
  color: var(--text-muted);
  margin-left: 8px;
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-voice-active-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--accent-green);
  padding: 3px 8px;
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: var(--accent-green);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-empty-msg {
  text-align: center;
  color: var(--text-muted);
  font-family: 'VT323', monospace;
  font-size: 20px;
  margin: auto;
  padding: 20px;
}

.chat-message-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(22, 23, 27, 0.6);
  border: 1px solid #1a1a20;
  border-left: 3px solid #333;
  transition: background 0.1s ease;
}

.chat-message-row:hover {
  background: rgba(30, 31, 38, 0.95);
  border-left-color: var(--pain-500);
}

.chat-msg-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  background: var(--pain-700);
  border: 2px solid #000;
  box-shadow: 1px 1px 0px #000;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.chat-msg-content-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chat-msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-msg-author {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #fff;
}

.chat-msg-author.admin-author {
  color: var(--pain-500);
}

.chat-msg-role-tag {
  font-family: 'VT323', monospace;
  font-size: 13px;
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 0 4px;
}

.chat-msg-time {
  font-family: 'VT323', monospace;
  font-size: 15px;
  color: #64748b;
  margin-left: auto;
}

.chat-msg-text {
  font-family: 'VT323', monospace;
  font-size: 19px;
  line-height: 1.35;
  color: #e2e8f0;
  word-break: break-word;
  white-space: pre-wrap;
}

.chat-input-wrapper {
  background: var(--bg-darkest);
  border-top: 2px solid #000;
  padding: 10px 16px;
  flex-shrink: 0;
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-input {
  flex: 1;
  height: 38px;
  background: #14151a;
  border: 2px solid #282a32;
  color: #fff;
  padding: 0 12px;
  font-family: 'VT323', monospace;
  font-size: 20px;
  outline: none;
}

.chat-input:focus {
  border-color: var(--pain-500);
}

.chat-send-btn {
  height: 38px;
  padding: 0 16px;
  background: var(--pain-700);
  border: 2px solid #000;
  box-shadow: 1px 1px 0px #000;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.1s ease;
}

.chat-send-btn:hover {
  background: var(--pain-500);
}

/* Hide any residual fps counters */
.fps-counter {
  display: none !important;
}


/* ==============================================================================
   Audio Settings & Output Device Selection (Anti-Echo Stream Routing)
============================================================================== */
.user-panel-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.discord-select {
  width: 100%;
  height: 38px;
  background: #14151a;
  border: 2px solid #282a32;
  color: #fff;
  padding: 0 10px;
  font-family: 'VT323', monospace;
  font-size: 19px;
  outline: none;
  cursor: pointer;
}

.discord-select:focus {
  border-color: var(--pain-500);
}

.stream-echo-tip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(245, 158, 11, 0.1);
  border: 2px solid var(--accent-gold);
  box-shadow: 2px 2px 0px #000;
  padding: 10px 12px;
  margin-top: 8px;
}

.stream-echo-tip .tip-icon {
  color: var(--accent-gold);
  font-size: 20px;
  margin-top: 2px;
  flex-shrink: 0;
}

.stream-echo-tip .tip-text {
  font-family: 'VT323', monospace;
  font-size: 17px;
  line-height: 1.35;
  color: #fde68a;
}

.device-test-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.test-status-msg {
  font-family: 'VT323', monospace;
  font-size: 17px;
  color: var(--accent-green);
}

.test-mic-meter-wrap {
  width: 100%;
  height: 14px;
  background: #111;
  border: 2px solid #000;
  overflow: hidden;
}

.test-mic-meter-fill {
  width: 0%;
  height: 100%;
  background: var(--accent-green);
  transition: width 0.05s linear;
}

/* ==============================================================================
   ROUND AVATARS SYSTEM (Круглые аватарки по всему приложению)
   ============================================================================== */
.user-avatar,
.user-avatar-wrap .user-avatar,
#current-user-avatar-box,
.voice-member-avatar,
.stage-voice-avatar,
.popover-avatar,
.admin-user-avatar,
.avatar-preview-box,
#profile-avatar-preview,
.member-avatar {
  border-radius: 50% !important;
  overflow: hidden !important;
  aspect-ratio: 1 / 1 !important;
}

.user-avatar img,
.user-avatar-img,
.voice-member-avatar img,
.voice-member-avatar-img,
.stage-voice-avatar img,
.stage-voice-avatar-img,
.popover-avatar img,
.admin-user-avatar img,
.admin-user-avatar-img,
.avatar-preview-box img,
.member-avatar img,
.member-avatar-img {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  display: block !important;
}

/* Круглые индикаторы статуса для круглых аватарок */
.user-avatar .status-indicator {
  position: absolute;
  bottom: 0px !important;
  right: 0px !important;
  width: 9px !important;
  height: 9px !important;
  border-radius: 50% !important;
  background-color: var(--accent-green) !important;
  border: 2px solid #111216 !important;
  z-index: 5;
}

.member-avatar-wrap {
  position: relative;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.member-avatar {
  width: 34px;
  height: 34px;
  background: var(--pain-700);
  border: 2px solid #000;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.member-status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50% !important;
  border: 2px solid #16171d;
  z-index: 4;
}

.member-status-dot.online {
  background-color: #23a55a;
  box-shadow: 0 0 4px rgba(35, 165, 90, 0.6);
}

.member-status-dot.offline {
  background-color: #747f8d;
}

/* ==============================================================================
   RIGHT MEMBERS SIDEBAR (Правая колонка списка пользователей - Discord-стиль)
   ============================================================================== */
.members-sidebar {
  width: clamp(190px, 16vw, 240px);
  min-width: 180px;
  max-width: 260px;
  flex-shrink: 0;
  background: #16171d;
  border-left: 2px solid #000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

.members-sidebar-header {
  height: 48px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #000;
  background: #111216;
}

.members-sidebar-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--text-normal);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.5px;
}

.members-sidebar-title i {
  color: var(--pain-500);
  font-size: 11px;
}

.members-sidebar-badge {
  background: #1e1f26;
  border: 1px solid #000;
  padding: 2px 6px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--accent-green);
}

.members-sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
}

.members-section-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--text-muted);
  padding: 4px 6px;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.members-cards-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.member-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.member-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.member-card.in-voice {
  background: rgba(35, 165, 90, 0.08);
  border-color: rgba(35, 165, 90, 0.35);
}

.member-card.in-voice:hover {
  background: rgba(35, 165, 90, 0.14);
}

.member-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.member-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.member-name {
  font-family: 'VT323', monospace;
  font-size: 18px;
  line-height: 1.1;
  color: var(--text-normal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-name.admin-name {
  color: #f59e0b;
  text-shadow: 1px 1px 0px #000;
}

.member-role-badge {
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  padding: 1px 4px;
  border-radius: 2px;
  border: 1px solid #000;
  background: #f59e0b;
  color: #000;
  font-weight: bold;
}

.member-activity {
  font-family: 'VT323', monospace;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-sub-voice {
  color: #23a55a;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: bold;
}

.member-sub-online {
  color: var(--text-muted);
}

.member-sub-offline {
  color: #636773;
}

/* ==============================================================================
   VOICE CHANNELS LIST & CRUD BUTTONS
   ============================================================================== */
.voice-channels-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.channel-actions-inline {
  margin-left: auto;
  display: none;
  align-items: center;
  gap: 4px;
}

.channel-item:hover .channel-actions-inline {
  display: flex;
}

.btn-inline-action {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 11px;
  border-radius: 2px;
  transition: color 0.12s ease, background 0.12s ease;
}

.btn-inline-action:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.btn-inline-action.danger:hover {
  color: #ed4245;
  background: rgba(237, 66, 69, 0.15);
}

/* ==============================================================================
   RESPONSIVE / SCALABLE INTERFACE ADAPTATIONS
   ============================================================================== */
.call-header {
  min-width: 0;
  overflow: hidden;
}

.call-info {
  min-width: 0;
  flex-shrink: 1;
  overflow: hidden;
}

.call-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

@media (max-width: 1100px) {
  .channels-sidebar {
    width: 220px;
    min-width: 200px;
  }
  .members-sidebar {
    width: 190px;
    min-width: 170px;
  }
  .action-button {
    padding: 6px 8px;
    font-size: 8px;
  }
  .call-pill-btn {
    padding: 6px 10px;
    font-size: 8px;
  }
}

@media (max-width: 920px) {
  .members-sidebar {
    display: none;
  }
  .stage-container {
    min-width: 0;
  }
}

/* ==============================================================================
   Mobile Adaptation & Discord Mobile Layout (m.153.52.69.29.sslip.io & phones)
============================================================================== */
.mobile-top-bar,
.mobile-call-strip,
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px), (pointer: coarse) and (max-width: 900px) {
  /* Hide desktop titlebar in browser / mobile */
  .titlebar {
    display: none !important;
  }

  /* Show mobile top bar */
  .mobile-top-bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    background: #111214;
    border-bottom: 2px solid #000;
    padding: 0 12px;
    padding-top: env(safe-area-inset-top, 0px);
    z-index: 100;
    flex-shrink: 0;
  }

  .mobile-header-btn {
    background: #1e1f22;
    border: 1px solid #35373c;
    color: var(--text-normal);
    width: 38px;
    height: 38px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    position: relative;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-header-btn:active {
    background: var(--pain-700);
    color: #fff;
  }

  .mobile-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--pain-500);
    color: #fff;
    font-size: 9px;
    font-family: 'Press Start 2P', monospace;
    padding: 2px 4px;
    border-radius: 4px;
    min-width: 14px;
    text-align: center;
  }

  .mobile-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    color: #f2f3f5;
    letter-spacing: 0.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
  }

  .mobile-header-logo {
    width: 22px;
    height: 22px;
    object-fit: contain;
  }

  /* App layout container on mobile */
  .app-layout {
    height: calc(100dvh - 52px - 60px) !important;
    height: calc(100vh - 52px - 60px) !important;
    width: 100vw !important;
    max-width: 100vw !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    position: relative !important;
  }

  /* Hide server sidebar on mobile */
  .guild-rail {
    display: none !important;
  }

  /* Mobile view switching (Channels, Call, Members) */
  body:not(.mobile-view-call):not(.mobile-view-members) .channels-sidebar,
  body.mobile-view-channels .channels-sidebar {
    display: flex !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    border-right: none !important;
    flex: 1 !important;
    height: 100% !important;
  }

  body:not(.mobile-view-call):not(.mobile-view-members) .stage-container,
  body.mobile-view-channels .stage-container,
  body:not(.mobile-view-call):not(.mobile-view-members) .members-sidebar,
  body.mobile-view-channels .members-sidebar {
    display: none !important;
  }

  body.mobile-view-call .stage-container {
    display: flex !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    flex: 1 !important;
    height: 100% !important;
    position: relative !important;
  }

  body.mobile-view-call .channels-sidebar,
  body.mobile-view-call .members-sidebar {
    display: none !important;
  }

  body.mobile-view-members .members-sidebar {
    display: flex !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    border-left: none !important;
    flex: 1 !important;
    height: 100% !important;
  }

  body.mobile-view-members .channels-sidebar,
  body.mobile-view-members .stage-container {
    display: none !important;
  }

  /* Mobile Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 60px !important;
    background: #111214 !important;
    border-top: 2px solid #000 !important;
    z-index: 200 !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  }

  .mobile-nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: #949ba4;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 7.5px;
    position: relative;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-tab i {
    font-size: 17px;
    transition: transform 0.15s ease;
  }

  .mobile-nav-tab.active {
    color: var(--accent-green);
  }

  .mobile-nav-tab.active i {
    transform: scale(1.15);
    color: var(--accent-green);
  }

  .mobile-nav-call-dot {
    position: absolute;
    top: 8px;
    right: 28%;
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--accent-green);
  }

  .mobile-nav-count {
    position: absolute;
    top: 6px;
    right: 20%;
    background: #35373c;
    color: #dbdee1;
    font-size: 7px;
    padding: 1px 4px;
    border-radius: 4px;
  }

  /* Mobile Call Strip */
  .mobile-call-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    height: 48px;
    background: rgba(18, 48, 28, 0.95);
    border-top: 1px solid var(--accent-green);
    backdrop-filter: blur(8px);
    z-index: 199;
    padding: 0 12px;
  }

  .mobile-call-strip-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    cursor: pointer;
    overflow: hidden;
  }

  .mobile-call-dot {
    color: var(--accent-green);
    font-size: 14px;
  }

  .mobile-call-strip-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .mobile-call-strip-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-call-strip-subtitle {
    font-family: 'VT323', monospace;
    font-size: 13px;
    color: #a3e635;
  }

  .mobile-call-strip-controls {
    display: flex;
    gap: 6px;
  }

  .mobile-strip-btn {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: #1e1f22;
    border: 1px solid #35373c;
    color: #f2f3f5;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
  }

  .mobile-strip-btn.danger {
    background: var(--pain-900);
    border-color: var(--pain-500);
    color: var(--pain-500);
  }

  /* Call controls at bottom of Stage on mobile */
  .bottom-call-bar {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: rgba(17, 18, 20, 0.96) !important;
    border-top: 2px solid #000 !important;
    padding: 8px 10px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    justify-content: center !important;
    backdrop-filter: blur(8px) !important;
    z-index: 50 !important;
  }

  .call-pill-btn {
    flex: 1 1 28% !important;
    min-height: 44px !important;
    font-size: 8px !important;
    padding: 6px 8px !important;
    justify-content: center !important;
    text-align: center !important;
  }

  .call-pill-btn.danger {
    flex: 1 1 100% !important;
  }

  /* Stage Voice Grid on Mobile */
  .stage-voice-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
    gap: 10px !important;
    padding: 12px !important;
    max-height: calc(100vh - 210px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .stage-user-card {
    min-height: 130px !important;
    padding: 12px 8px !important;
  }

  .stage-user-avatar-wrap {
    width: 60px !important;
    height: 60px !important;
  }

  /* Top call header on mobile */
  .call-header {
    padding: 8px 12px !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .call-actions {
    gap: 6px !important;
  }

  .call-actions .action-button {
    padding: 6px 8px !important;
    font-size: 8px !important;
  }

  /* Popovers and modals on mobile */
  .user-volume-popover {
    position: fixed !important;
    bottom: 70px !important;
    left: 10px !important;
    right: 10px !important;
    top: auto !important;
    width: auto !important;
    max-width: none !important;
    z-index: 5000 !important;
  }

  .modal-dialog {
    width: 94vw !important;
    max-width: 94vw !important;
    margin: 12px auto !important;
  }

  /* Prevent auto zoom on iOS Safari */
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* Active Camera & Stream button styling across all viewports */
.action-button.active,
.call-pill-btn.active,
.mobile-strip-btn.active,
.mobile-header-btn.active {
  background: rgba(35, 165, 89, 0.25) !important;
  border-color: var(--accent-green) !important;
  color: var(--accent-green) !important;
  box-shadow: 0 0 8px rgba(35, 165, 89, 0.4) !important;
}

#btn-toggle-cam-top.active,
#btn-cam-bar.active,
#btn-mobile-strip-cam.active,
#btn-mobile-top-cam.active {
  background: rgba(35, 165, 89, 0.3) !important;
  border-color: var(--accent-green) !important;
  color: var(--accent-green) !important;
  box-shadow: 0 0 10px rgba(35, 165, 89, 0.5) !important;
}

#btn-share-screen-top.active,
#btn-screen-bar.active {
  background: rgba(88, 101, 242, 0.3) !important;
  border-color: #5865f2 !important;
  color: #fff !important;
  box-shadow: 0 0 10px rgba(88, 101, 242, 0.5) !important;
}

/* ==============================================================================
   PaiN Chat - E2EE Google Drive Vault, Text Channels & Direct Messages (DMs)
============================================================================== */

/* Badges */
.badge-vault-e2ee {
  font-size: 8px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid var(--accent-green);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: auto;
  font-family: 'Press Start 2P', monospace;
}

.dm-empty-hint {
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 12px;
  font-style: italic;
  line-height: 1.3;
}

.dm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s ease;
  position: relative;
}

.dm-item:hover, .dm-item.active {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.dm-item.active {
  background: rgba(255, 34, 51, 0.15);
  color: #fff;
  border-left: 3px solid var(--pain-500);
}

.dm-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-box);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  flex-shrink: 0;
}

.dm-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dm-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.dm-name {
  font-size: 15px;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-last-msg {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chat Container */
.chat-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-height: 0;
  background: var(--bg-dark);
  position: relative;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--bg-panel);
  border-bottom: 2px solid var(--border-pixel);
  min-height: 48px;
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-header-icon {
  font-size: 20px;
  color: var(--text-muted);
}

.chat-header-title {
  color: #fff;
  margin: 0;
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
}

.chat-header-badge {
  font-size: 11px;
  color: var(--accent-green);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
}

.chat-header-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-header-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Messages Wrap */
.chat-messages-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.chat-messages-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: min-content;
}

.chat-welcome-msg {
  text-align: center;
  padding: 24px 20px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.chat-message-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.1s ease;
}

.chat-message-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.chat-msg-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-box);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 15px;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.chat-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-msg-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.chat-msg-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.chat-msg-author {
  font-weight: bold;
  font-size: 16px;
  color: #fff;
}

.chat-msg-author.admin {
  color: var(--pain-500);
}

.chat-msg-time {
  font-size: 12px;
  color: var(--text-muted);
}

.chat-msg-text {
  font-size: 18px;
  color: var(--text-main);
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
  user-select: text;
}

/* Attachments */
.chat-attachment-wrap {
  margin-top: 6px;
}

.chat-attached-image {
  max-width: 380px;
  max-height: 280px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
  display: block;
}

.chat-attached-image:hover {
  transform: scale(1.01);
  filter: brightness(1.05);
}

.chat-attached-doc {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-box);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  max-width: 420px;
}

.chat-attached-doc-icon {
  font-size: 26px;
  color: var(--pain-500);
}

.chat-attached-doc-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.chat-attached-doc-name {
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-attached-doc-size {
  font-size: 12px;
  color: var(--text-muted);
}

.chat-doc-download-btn {
  background: var(--pain-500);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease;
  text-decoration: none;
}

.chat-doc-download-btn:hover {
  background: var(--pain-700);
}

/* Attachment preview bar */
.chat-attachment-bar {
  padding: 8px 16px;
  background: var(--bg-panel);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.attachment-preview-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg-box);
  border: 1px solid var(--pain-500);
  border-radius: 6px;
}

.attachment-preview-box .attachment-icon {
  color: var(--pain-500);
  font-size: 18px;
}

.attachment-preview-box .attachment-info {
  display: flex;
  flex-direction: column;
}

.attachment-preview-box .attachment-name {
  font-size: 14px;
  font-weight: bold;
  color: #fff;
}

.attachment-preview-box .attachment-size {
  font-size: 11px;
  color: var(--text-muted);
}

.attachment-remove-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
}

.attachment-remove-btn:hover {
  color: var(--pain-500);
}

/* Input Row */
.chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-panel);
  border-top: 2px solid var(--border-pixel);
  flex-shrink: 0;
}

.chat-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.chat-action-btn:hover {
  color: var(--pain-500);
}

.chat-text-input {
  flex: 1;
  background: var(--bg-box);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 10px 14px;
  color: #fff;
  font-size: 18px;
  outline: none;
  transition: border-color 0.15s ease;
  user-select: text;
}

.chat-text-input:focus {
  border-color: var(--pain-500);
}

.chat-send-btn {
  background: var(--pain-500);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.chat-send-btn:hover {
  background: var(--pain-700);
}

/* Drag overlay */
.chat-drag-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 12, 0.88);
  border: 3px dashed var(--pain-500);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 50;
  color: #fff;
  font-size: 18px;
  pointer-events: none;
}

.chat-drag-overlay i {
  font-size: 48px;
  color: var(--pain-500);
}

.chat-messages-wrap.dragover .chat-drag-overlay {
  display: flex;
}

/* Lightbox Modal */
.image-lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}

.lightbox-content {
  position: relative;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
  gap: 14px;
}

.lightbox-content img {
  max-width: 85vw;
  max-height: 80vh;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  object-fit: contain;
}

.lightbox-actions {
  display: flex;
  gap: 12px;
}

/* ==============================================================================
   ROLES, DELETION, COMPRESSION & CLEAN UI STYLES
   ============================================================================== */

/* Message hover actions */
.chat-message-item {
  position: relative;
}

.chat-msg-actions {
  position: absolute;
  right: 12px;
  top: 6px;
  display: none;
  gap: 6px;
  background: var(--bg-card, #1e1f22);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 3px 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  z-index: 10;
}

.chat-message-item:hover .chat-msg-actions {
  display: flex;
}

.chat-action-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  font-size: 14px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.chat-action-icon-btn:hover {
  color: #ff3344;
  background: rgba(255, 51, 68, 0.1);
}

/* Delete confirmation dropdown/modal */
.msg-del-dropdown {
  position: absolute;
  right: 12px;
  top: 36px;
  background: #18191c;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 100;
  min-width: 180px;
}

.msg-del-btn {
  padding: 7px 12px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.12s ease;
}

.msg-del-btn.danger {
  background: rgba(237, 66, 69, 0.15);
  color: #ff4d4f;
}

.msg-del-btn.danger:hover {
  background: #ed4245;
  color: #fff;
}

.msg-del-btn.neutral {
  background: rgba(255, 255, 255, 0.06);
  color: #dbdee1;
}

.msg-del-btn.neutral:hover {
  background: rgba(255, 255, 255, 0.12);
}

.msg-del-btn.cancel {
  background: transparent;
  color: var(--text-muted, #94a3b8);
  font-size: 12px;
}

.msg-del-btn.cancel:hover {
  color: #fff;
}

/* Role Badges */
.member-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-left: 6px;
  white-space: nowrap;
}

.chat-msg-role-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}

/* Attachment Compress Checkbox */
.attachment-compress-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-main, #fff);
  cursor: pointer;
  margin-left: 12px;
  user-select: none;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.attachment-compress-label input {
  accent-color: var(--pain-500, #ff2233);
  cursor: pointer;
  width: 16px;
  height: 16px;
}

/* Back button from DM to Channels */
#btn-close-dm {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

#btn-close-dm:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--pain-500, #ff2233);
}

/* Roles Manager in Admin Modal */
.roles-manager-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.roles-list-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.role-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-card, #1e1f22);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.role-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.role-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.role-card-name {
  font-weight: bold;
  font-size: 15px;
  color: #fff;
}

.role-card-perms {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  margin-top: 2px;
}

.role-card-actions {
  display: flex;
  gap: 8px;
}

.role-editor-card {
  background: var(--bg-card, #1e1f22);
  border: 1px solid var(--pain-500, #ff2233);
  border-radius: 8px;
  padding: 16px;
  margin-top: 14px;
}

.role-perms-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.role-perms-grid label {
  font-size: 13px;
  color: var(--text-main, #dbdee1);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 10px;
  border-radius: 6px;
}

.role-perms-grid label input {
  accent-color: var(--pain-500, #ff2233);
  width: 16px;
  height: 16px;
}

.role-channels-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  max-height: 140px;
  overflow-y: auto;
}

.role-channels-checklist label {
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.role-channels-checklist label input {
  accent-color: var(--pain-500, #ff2233);
}

.user-roles-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.user-role-chip {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}

.btn-assign-roles {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-main, #dbdee1);
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-assign-roles:hover {
  border-color: var(--pain-500, #ff2233);
  color: #fff;
  background: rgba(255, 34, 51, 0.15);
}

/* Quick Scroll to Bottom Button */
.chat-scroll-bottom-btn {
  position: absolute;
  bottom: 74px;
  right: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card, #2b2d31);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  z-index: 100;
  transition: all 0.15s ease;
}

.chat-scroll-bottom-btn:hover {
  background: var(--pain-500, #ff2233);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 34, 51, 0.5);
}

.member-name {
  font-family: inherit;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ==============================================================================
   UI Refinements 3.0 (Deafen, Split View, Emoji Popover, Mini Profile, Load GIF)
   ============================================================================== */

/* 1. Deafen Button explicitly bright red */
.call-pill-btn.deafened,
.call-pill-btn.danger.active,
#btn-deafen-bar.deafened,
#btn-deafen-bar.danger {
  background: #ed4245 !important;
  color: #ffffff !important;
  border-color: #ed4245 !important;
  box-shadow: 0 0 10px rgba(237, 66, 69, 0.5) !important;
}

#btn-mobile-strip-deafen.danger {
  background: #ed4245 !important;
  color: #ffffff !important;
}

/* 2. View Mode Group (ЧАТ - ГОЛОС - ГОЛОС + ЧАТ) */
.view-mode-group {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.view-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.view-mode-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.view-mode-btn.active {
  background: var(--pain-500, #ff2233) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(255, 34, 51, 0.45);
}

/* 3. Split Screen Mode (ГОЛОС + ЧАТ) - Pixel-perfect layout with 0 overflow */
.stage-container.mode-split {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  max-height: 100% !important;
  overflow: hidden !important;
  min-height: 0 !important;
  box-sizing: border-box !important;
}

.stage-container.mode-split .call-header {
  flex: 0 0 52px !important;
  height: 52px !important;
  min-height: 52px !important;
  max-height: 52px !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}

.stage-container.mode-split #video-grid {
  display: flex !important;
  flex: 0 0 var(--split-voice-height, 50%) !important;
  height: var(--split-voice-height, 50%) !important;
  min-height: 80px !important;
  max-height: calc(100% - 180px) !important;
  overflow-y: auto !important;
  border-bottom: none !important;
  position: relative !important;
  box-sizing: border-box !important;
}

.stage-container.mode-split .stage-disconnected-box {
  padding: 8px !important;
}

.stage-container.mode-split .stage-disconnected-icon {
  font-size: 24px !important;
  margin-bottom: 4px !important;
}

.stage-container.mode-split .stage-disconnected-box h3 {
  font-size: 10px !important;
  margin-bottom: 4px !important;
}

.stage-container.mode-split .stage-disconnected-box p {
  font-size: 14px !important;
  line-height: 1.2 !important;
}

.stage-container.mode-split .bottom-call-bar {
  display: flex !important;
  flex: 0 0 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  padding: 4px 10px !important;
  border-bottom: none !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}

/* Split Resizer Divider */
.split-resizer {
  display: none !important;
  flex: 0 0 9px;
  height: 9px;
  background: #111214;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(0, 0, 0, 0.6);
  cursor: row-resize;
  position: relative;
  z-index: 25;
  transition: background 0.15s;
  user-select: none;
}

.stage-container.mode-split .split-resizer {
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0 !important;
}

.split-resizer:hover,
body.resizing-split .split-resizer {
  background: var(--pain-500, #5865f2) !important;
}

.split-resizer-handle {
  width: 44px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.35);
  transition: background 0.15s, width 0.15s;
}

.split-resizer:hover .split-resizer-handle,
body.resizing-split .split-resizer-handle {
  background: #ffffff !important;
  width: 56px;
}

body.resizing-split {
  cursor: row-resize !important;
  user-select: none !important;
}

body.resizing-split iframe,
body.resizing-split video {
  pointer-events: none !important;
}

.stage-container.mode-split #chat-container {
  display: flex !important;
  flex: 1 1 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

/* 4. Chat Message Timestamp & Hover Actions (Prevent Overlap) */
.chat-msg-time {
  font-size: 14px !important;
  color: var(--text-muted, #94a3b8) !important;
  margin-left: 8px !important;
  white-space: nowrap;
}

.chat-msg-edited {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  margin-left: 6px;
  font-style: italic;
  white-space: nowrap;
}

.chat-message-item {
  position: relative !important;
  padding-right: 90px !important;
}

.chat-msg-actions {
  position: absolute !important;
  right: 14px !important;
  top: -10px !important;
  display: none;
  gap: 4px;
  background: var(--bg-card, #1e1f22) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 6px !important;
  padding: 3px 6px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6) !important;
  z-index: 25 !important;
}

.chat-message-item:hover .chat-msg-actions {
  display: flex !important;
}

/* Inline Message Editor */
.chat-msg-inline-edit {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-msg-edit-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--pain-500, #ff2233);
  border-radius: 6px;
  padding: 8px 12px;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  outline: none;
  box-sizing: border-box;
}

.chat-msg-edit-actions {
  display: flex;
  gap: 8px;
  font-size: 12px;
  align-items: center;
}

.chat-msg-edit-save-btn {
  background: var(--pain-500, #ff2233);
  border: none;
  color: #fff;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.15s ease;
}

.chat-msg-edit-save-btn:hover {
  opacity: 0.9;
}

.chat-msg-edit-cancel-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
}

/* 5. Role Hierarchy Arrow Reorder Buttons */
.role-reorder-btns {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  margin-right: 8px;
}

.role-arrow-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted, #94a3b8);
  border-radius: 4px;
  width: 22px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.role-arrow-btn:hover:not(:disabled) {
  background: var(--pain-500, #ff2233);
  color: #fff;
  border-color: var(--pain-500, #ff2233);
}

.role-arrow-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* 6. User Mini Profile Card Popover */
.user-mini-profile-card {
  position: fixed;
  width: 300px;
  background: #111214;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85);
  z-index: 10000;
  overflow: hidden;
  font-family: inherit;
  animation: popoverFadeIn 0.15s ease-out;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.mini-profile-banner {
  width: 100%;
  aspect-ratio: 17 / 6;
  min-height: 105px;
  background: linear-gradient(135deg, #ff2233 0%, #3b82f6 100%);
  position: relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.mini-profile-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-profile-body {
  padding: 0 16px 16px 16px;
  position: relative;
}

.mini-profile-avatar-wrap {
  position: relative;
  margin-top: -32px;
  margin-bottom: 10px;
  width: 64px;
  height: 64px;
}

.mini-profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid #111214;
  background: #2b2d31;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 22px;
  color: #fff;
}

.mini-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-profile-status-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid #111214;
  background: #23a55a;
}

.mini-profile-details {
  margin-bottom: 8px;
}

.mini-profile-nick {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.mini-profile-login {
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
}

.mini-profile-role-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.mini-profile-section-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted, #94a3b8);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.mini-profile-status-text {
  font-size: 13px;
  color: var(--text-main, #dbdee1);
  margin-bottom: 14px;
}

.mini-profile-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mini-profile-dm-btn {
  width: 100%;
  justify-content: center;
  padding: 8px 12px;
  font-size: 13px;
}

/* 7. Apple-style Chat Emoji Popover */
.chat-emoji-popover {
  position: fixed;
  width: 360px;
  height: 420px;
  background: #1e1f22;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.85);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popoverFadeIn 0.15s ease-out;
  font-family: -apple-system, BlinkMacSystemFont, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.emoji-picker-top {
  padding: 10px 12px 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #18191c;
}

.emoji-search-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.emoji-search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted, #94a3b8);
  font-size: 13px;
  pointer-events: none;
}

.emoji-search-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 6px 10px 6px 30px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

.emoji-search-input:focus {
  border-color: var(--pain-500, #ff2233);
}

.emoji-category-tabs {
  display: flex;
  padding: 4px 8px;
  gap: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #141517;
  overflow-x: auto;
}

.emoji-cat-tab {
  background: transparent;
  border: none;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s ease;
  line-height: 1;
}

.emoji-cat-tab:hover {
  background: rgba(255, 255, 255, 0.1);
}

.emoji-cat-tab.active {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.15);
}

.emoji-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 2px 6px;
}

.emoji-close-btn:hover {
  color: #fff;
}

.emoji-picker-grid {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.emoji-item-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, background 0.12s ease;
  line-height: 1.2;
}

.emoji-item-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.28);
}

/* Voice section in mini profile */
.mini-profile-voice-section {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.mini-profile-vol-slider {
  width: 100%;
  accent-color: var(--pain-500, #ff2233);
  cursor: pointer;
  margin: 6px 0;
}

.mini-profile-mute-btn {
  width: 100%;
  justify-content: center;
  margin-top: 6px;
  padding: 6px 12px;
  font-size: 12px;
}

.mini-profile-mute-btn.danger {
  background: #ed4245 !important;
  color: #fff !important;
  border-color: #ed4245 !important;
}

/* Chat File Attachment format badge and hover title */
.chat-attached-img-wrap {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.chat-img-meta-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.chat-attached-doc {
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.chat-attached-doc:hover {
  border-color: var(--pain-500, #ff2233) !important;
  background: rgba(255, 34, 51, 0.06) !important;
}

.chat-attached-doc-name {
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* 8. Load Chat GIF Animations & Progress Bars */
.chat-media-loader {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-muted, #94a3b8);
  font-size: 13px;
  margin-top: 6px;
}

.chat-media-loader-header {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.chat-loading-gif {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
}

.chat-progress-pct {
  color: #fff;
  font-weight: 600;
  margin-left: 4px;
}

.chat-progress-bar-wrap {
  width: 170px;
  max-width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  overflow: hidden;
  margin-left: 34px;
}

.chat-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff2233 0%, #3b82f6 100%);
  border-radius: 2px;
  transition: width 0.15s ease-out;
}

.chat-sending-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  margin-left: 10px;
}

/* Banner preview in profile settings */
.banner-preview-box {
  width: 100%;
  aspect-ratio: 17 / 6;
  min-height: 105px;
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  background: #1e1f22;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.apple-emoji-img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  pointer-events: none;
  vertical-align: middle;
  display: inline-block;
}

.chat-inline-apple-emoji {
  width: 22px;
  height: 22px;
  object-fit: contain;
  vertical-align: -4px;
  margin: 0 1.5px;
  display: inline-block;
}

.emoji-item-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s ease;
}

.emoji-item-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}


/* Square Card for Historical Chat Images */
.chat-historical-img-card {
  width: 220px;
  height: 220px;
  background: #141518;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
  user-select: none;
}

.chat-historical-img-card:hover {
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.chat-historical-img-backdrop {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(255, 34, 51, 0.05) 0%, rgba(0, 0, 0, 0.45) 100%);
  pointer-events: none;
}

.chat-historical-bg-icon {
  font-size: 64px;
  color: rgba(255, 255, 255, 0.07);
}

.chat-historical-center-btn {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: rgba(30, 31, 35, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: all 0.15s ease;
}

.chat-historical-img-card:hover .chat-historical-center-btn {
  background: var(--pain-500, #ff2233);
  border-color: var(--pain-500, #ff2233);
  box-shadow: 0 4px 16px rgba(255, 34, 51, 0.4);
}

.chat-historical-meta-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 11px;
  color: #cbd5e1;
  font-weight: 500;
  z-index: 2;
  backdrop-filter: blur(4px);
}

.chat-historical-loading-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(20, 21, 24, 0.92);
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}


/* ==============================================================================
   CHAT SEARCH BAR (Ctrl + F)
   ============================================================================== */
.chat-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #111216;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  animation: slideDownSearch 0.15s ease-out;
  z-index: 10;
}

@keyframes slideDownSearch {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-search-bar .search-bar-icon {
  color: var(--text-muted);
  font-size: 14px;
}

#chat-search-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  padding: 6px 12px;
  outline: none;
  transition: border-color 0.15s ease;
}

#chat-search-input:focus {
  border-color: var(--pain-500, #ff2233);
  box-shadow: 0 0 0 2px rgba(255, 34, 51, 0.25);
}

.search-results-count {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 45px;
  text-align: center;
}

.search-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.15s ease;
}

.search-nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Highlight matching messages */
.chat-msg-row.search-match {
  background: rgba(255, 255, 255, 0.04) !important;
}

.chat-msg-row.search-active-match {
  background: rgba(255, 34, 51, 0.22) !important;
  box-shadow: inset 4px 0 0 var(--pain-500, #ff2233);
  transition: background 0.15s ease;
}

/* ==============================================================================
   USER STATUS POPOVER (В сети / Не беспокоить)
   ============================================================================== */
.user-status-popover {
  position: fixed;
  bottom: 60px;
  left: 10px;
  width: 220px;
  background: #141518;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  padding: 8px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 4px;
  backdrop-filter: blur(12px);
  animation: popoverFadeIn 0.15s ease-out;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.status-popover-header {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 4px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 2px;
}

.status-option-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.status-option-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.status-indicator-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-indicator-dot.online {
  background-color: var(--accent-green, #23a55a);
  box-shadow: 0 0 6px rgba(35, 165, 90, 0.6);
}

.status-indicator-dot.dnd {
  background-color: #ed4245;
  box-shadow: 0 0 6px rgba(237, 66, 69, 0.6);
}

.status-option-info {
  flex: 1;
}

.status-option-title {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.status-option-desc {
  font-size: 10px;
  color: var(--text-muted);
}

.status-check-icon {
  font-size: 11px;
  color: var(--pain-500, #ff2233);
}

.status-indicator.status-dnd {
  background-color: #ed4245 !important;
}

.status-indicator.status-online {
  background-color: var(--accent-green, #23a55a) !important;
}

.user-status-text {
  font-size: 10px;
  font-weight: 600;
  margin-top: 1px;
  display: inline-block;
}
.user-status-text.online {
  color: var(--accent-green, #23a55a);
}
.user-status-text.dnd {
  color: #ed4245;
}

/* ==========================================================================
   UNREAD & MENTIONS & USER STATUS BADGES
   ========================================================================== */
.user-status-badge-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 2px 6px;
  margin-top: 2px;
  border-radius: 4px;
  width: fit-content;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}
.user-status-badge-wrap:hover {
  background: rgba(255, 255, 255, 0.09);
}
.status-chevron {
  font-size: 8px;
  opacity: 0.6;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}
.user-status-badge-wrap:hover .status-chevron {
  opacity: 1;
}

.channel-item.has-unread {
  position: relative;
}
.channel-item.has-unread .channel-name {
  color: #ffffff !important;
  font-weight: 700 !important;
}
.channel-item.has-unread .channel-icon {
  color: #ffffff !important;
}
.channel-item.has-unread::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 8px;
  border-radius: 0 4px 4px 0;
  background: #ffffff;
}

.channel-mention-badge {
  background: #ed4245;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  line-height: 16px;
  text-align: center;
  margin-left: auto;
  margin-right: 4px;
  box-shadow: 0 2px 6px rgba(237, 66, 69, 0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: badgePop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dm-unread-badge {
  background: #ed4245;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  line-height: 16px;
  text-align: center;
  margin-left: auto;
  margin-right: 4px;
  box-shadow: 0 2px 6px rgba(237, 66, 69, 0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: badgePop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.member-unread-badge {
  background: #ed4245;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  min-width: 14px;
  height: 14px;
  line-height: 12px;
  text-align: center;
  margin-left: auto;
  margin-right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.member-status-dot.dnd {
  background-color: #ed4245 !important;
}

@keyframes badgePop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   DIRECT CALLS & SCREEN SHARING BADGE & MENTION AUTOCOMPLETE
   ========================================================================== */
.mini-profile-call-btn {
  background: #23a55a !important;
  color: #ffffff !important;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.mini-profile-call-btn:hover {
  background: #1f8b4c !important;
}

/* Voice streaming badge in voice channels */
.voice-streaming-badge {
  background: #ed4245 !important;
  color: #ffffff !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  padding: 2px 7px !important;
  border-radius: 4px !important;
  margin-left: auto !important;
  margin-right: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  box-shadow: 0 0 8px rgba(237, 66, 69, 0.5) !important;
  animation: streamPulse 2s infinite ease-in-out;
  z-index: 2;
}
@keyframes streamPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.88; transform: scale(0.98); }
}

/* Incoming Call Modal */
.incoming-call-modal {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  background: rgba(22, 23, 27, 0.96);
  border: 1px solid rgba(35, 165, 90, 0.45);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.85), 0 0 20px rgba(35, 165, 90, 0.2);
  backdrop-filter: blur(16px);
  padding: 16px;
  animation: callModalSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes callModalSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.incoming-call-box {
  display: flex;
  align-items: center;
  gap: 14px;
}
.incoming-call-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #23a55a;
  background: #1e1f22;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(35, 165, 90, 0.4);
}
.incoming-call-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.incoming-call-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}
.incoming-call-badge {
  font-size: 10px;
  font-weight: 700;
  color: #23a55a;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.incoming-call-caller {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}
.incoming-call-sub {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
}
.incoming-call-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
}
.call-btn-accept {
  background: #23a55a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 4px 12px rgba(35, 165, 90, 0.4);
}
.call-btn-accept:hover {
  background: #1f8b4c;
  transform: scale(1.03);
}
.call-btn-decline {
  background: #ed4245;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 4px 12px rgba(237, 66, 69, 0.4);
}
.call-btn-decline:hover {
  background: #c03537;
  transform: scale(1.03);
}

/* Outgoing Call Banner */
.outgoing-call-banner {
  position: fixed;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: rgba(30, 31, 34, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  padding: 8px 20px;
  backdrop-filter: blur(12px);
  animation: bannerDrop 0.25s ease-out;
}
@keyframes bannerDrop {
  from { opacity: 0; transform: translate(-50%, -15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.outgoing-call-content {
  display: flex;
  align-items: center;
  gap: 14px;
}
.outgoing-call-icon {
  font-size: 16px;
  color: #23a55a;
}
.outgoing-call-text {
  display: flex;
  flex-direction: column;
  font-size: 13px;
}
.outgoing-call-name {
  color: #ffffff;
  font-weight: 600;
}
.outgoing-call-sub {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
}
.outgoing-call-cancel-btn {
  background: #ed4245;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}
.outgoing-call-cancel-btn:hover {
  background: #c03537;
}

/* Mention Autocomplete Popover */
.chat-input-wrap {
  position: relative;
  flex-shrink: 0;
  width: 100%;
}
.mention-autocomplete-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 16px;
  width: 320px;
  max-height: 280px;
  overflow-y: auto;
  background: #2b2d31;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  z-index: 2500;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mention-popover-header {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted, #94a3b8);
  padding: 4px 8px;
  letter-spacing: 0.5px;
}
.mention-popover-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s ease;
  user-select: none;
}
.mention-popover-item:hover,
.mention-popover-item.active {
  background: rgba(255, 255, 255, 0.08);
}
.mention-item-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  background: #1e1f22;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  color: #fff;
  flex-shrink: 0;
}
.mention-item-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mention-item-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mention-item-name {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.mention-item-tag {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
}


/* Discord-style Floating In-App Toast Notifications */
.toast-notifications-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
  max-width: 360px;
}

.discord-toast {
  pointer-events: auto;
  width: 340px;
  background: #111214;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  animation: toastSlideIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  transition: opacity 0.2s, transform 0.2s;
  user-select: none;
}

.discord-toast:hover {
  background: #232428;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.discord-toast.closing {
  opacity: 0;
  transform: translateX(120%);
}

@keyframes toastSlideIn {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.discord-toast-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  background: #5865f2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: bold;
  color: #fff;
  flex-shrink: 0;
}

.discord-toast-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discord-toast-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.discord-toast-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--pain-500, #ff4655);
  letter-spacing: 0.5px;
}

.discord-toast-title {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.discord-toast-body {
  font-size: 13px;
  color: #dbdee1;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.discord-toast-close {
  background: transparent;
  border: none;
  color: #949ba4;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}

.discord-toast-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}


/* Mention Pills with Role Colors (Discord Style) */
.chat-mention-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: all;
  margin: 0 2px;
}
.chat-mention-pill:hover {
  filter: brightness(1.2);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.2);
}
.chat-mention-pill.mention-everyone {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #f59e0b !important;
  border-left: 2px solid #f59e0b !important;
}
.chat-mention-pill.mention-online {
  background: rgba(35, 165, 90, 0.2) !important;
  color: #23a55a !important;
  border-left: 2px solid #23a55a !important;
}

/* Call Event Badge in Chat */
.chat-call-event-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #dbdee1;
  margin: 6px 0;
  border-left: 3px solid #23a55a;
}
.chat-call-event-badge.missed {
  border-left-color: #ed4245;
}

/* Left Guild Rail DMs (Discord Style) */
.guild-rail-dms {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.guild-dm-badge-item {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2b2d31;
}
.guild-dm-badge-item:hover {
  border-radius: 16px;
  border-color: var(--pain-500, #ff4655);
  transform: translateY(-1px);
}
.guild-dm-badge-avatar {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  color: #fff;
  background: #313338;
}
.guild-dm-badge-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.guild-dm-badge-pill {
  position: absolute;
  bottom: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #ed4245;
  color: #ffffff;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #111214;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  animation: badgePopIn 0.2s ease;
}

/* Custom Status Styling */
.member-custom-status {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
  line-height: 1.2;
}
.custom-status-card {
  width: 440px;
  max-width: 95vw;
}
.custom-status-input-row {
  display: flex;
  gap: 8px;
}
.custom-status-emoji-input {
  width: 54px;
  text-align: center;
  font-size: 20px;
  background: #1e1f22;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #fff;
}
.custom-status-text-input {
  flex: 1;
  background: #1e1f22;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #fff;
  padding: 8px 12px;
  font-size: 14px;
}
.custom-status-counter {
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.custom-status-colors {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.cs-color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}
.cs-color-btn:hover {
  transform: scale(1.15);
}
.cs-color-btn.active {
  border-color: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}
.custom-status-preview-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 14px;
}
.cs-preview-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 4px;
}
.cs-preview-content {
  font-size: 14px;
  font-weight: 600;
}

/* App Settings Modal */
.app-settings-card {
  width: 480px;
  max-width: 95vw;
}
.settings-section {
  margin-bottom: 18px;
}
.settings-section h4 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--pain-500);
  margin-bottom: 8px;
}
.settings-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.settings-toggle-row input {
  margin-top: 4px;
  accent-color: var(--pain-500);
  transform: scale(1.2);
}
.settings-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-toggle-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}
.settings-toggle-sub {
  font-size: 11px;
  color: var(--text-muted);
}
.settings-slider-row {
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.settings-slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}


/* ==============================================================================
   Titlebar Download Button for Web Users
============================================================================== */
.titlebar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-app-region: no-drag;
}

.btn-download-desktop {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, #23a55a 0%, #1a7a42 100%);
  color: #ffffff !important;
  text-decoration: none;
  font-family: 'Press Start 2P', monospace, sans-serif;
  font-size: 8px;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid #2ecc71;
  box-shadow: 0 0 10px rgba(35, 165, 90, 0.4);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-download-desktop:hover {
  background: linear-gradient(135deg, #28bd68 0%, #208e4d 100%);
  box-shadow: 0 0 14px rgba(46, 204, 113, 0.7);
  transform: translateY(-1px);
}

.btn-download-desktop i {
  font-size: 10px;
}

/* Profile Custom Status Editor */
.profile-status-emoji-btn {
  width: 44px;
  height: 38px;
  min-width: 44px;
  background: #111216;
  border: 2px solid #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: transform 0.1s, border-color 0.1s;
}
.profile-status-emoji-btn:hover {
  border-color: var(--pain-500);
  transform: scale(1.05);
}
.custom-color-input-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.custom-color-btn-label {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
  transition: transform 0.1s, border-color 0.1s;
}
.custom-color-btn-label:hover {
  transform: scale(1.15);
  border-color: #fff;
}
.custom-color-btn-label.active {
  border-color: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.profile-status-remove-emoji-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ed4245;
  color: #fff;
  border: 1px solid #000;
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  padding: 0;
  line-height: 1;
  transition: transform 0.1s;
}
.profile-status-remove-emoji-btn:hover {
  transform: scale(1.2);
  background: #ff5c5c;
}


/* ==============================================================================
   DEEP BACKGROUND / MINIMIZED FREEZE ENGINE (Drops CPU to 0.0% - 0.1%)
   ============================================================================== */
body.app-inactive *,
body.app-inactive *::before,
body.app-inactive *::after,
body.app-minimized *,
body.app-minimized *::before,
body.app-minimized *::after {
  animation-play-state: paused !important;
  transition: none !important;
}

body.app-minimized #video-grid {
  display: none !important;
}


/* ==============================================================================
   BROWSER AUTOPLAY UNLOCK BANNER (Chrome Autoplay Policy)
   ============================================================================== */
.browser-audio-banner {
  position: fixed;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  background: rgba(30, 31, 34, 0.96);
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 15px rgba(245, 158, 11, 0.2);
  padding: 8px 18px;
  backdrop-filter: blur(12px);
  animation: bannerDrop 0.25s ease-out;
}
.browser-audio-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
}
.browser-audio-banner-icon {
  color: #f59e0b;
  font-size: 16px;
}
.browser-audio-banner-text {
  color: #f3f4f6;
  font-size: 13px;
  font-weight: 500;
}
.browser-audio-banner-btn {
  background: var(--accent-green, #23a55a);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, transform 0.1s;
}
.browser-audio-banner-btn:hover {
  background: #1f914f;
  transform: scale(1.03);
}
.browser-audio-banner-btn:active {
  transform: scale(0.97);
}
