/* ============================================================
   Noir — Monochrome Design System
   A refined black & white messaging interface
   ============================================================ */

:root {
  /* Surfaces */
  --black: #000000;
  --bg: #050505;
  --surface: rgba(20, 20, 20, 0.72);
  --surface-solid: #101010;
  --surface-raised: #171717;
  --surface-inset: rgba(255, 255, 255, 0.03);
  --surface-inset-hover: rgba(255, 255, 255, 0.06);

  /* Lines */
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --line-focus: rgba(255, 255, 255, 0.45);

  /* Ink (text) */
  --white: #ffffff;
  --text-main: #f4f4f5;
  --text-muted: #a3a3a3;
  --text-dim: #6b6b6b;
  --text-faint: #4a4a4a;

  /* Message tones */
  --msg-self-bg: #f4f4f5;
  --msg-self-text: #0a0a0a;
  --msg-other-bg: rgba(255, 255, 255, 0.05);
  --msg-other-border: rgba(255, 255, 255, 0.12);

  /* Feedback (kept monochrome-friendly) */
  --error: #f5f5f5;

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-card: 0 24px 60px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-float: 0 10px 30px rgba(0, 0, 0, 0.5);

  --transition-smooth: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ------------------------------------------------------------
   Ambient background — pure monochrome
   ------------------------------------------------------------ */
.app-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 50% -10%, #1a1a1a 0%, #0a0a0a 45%, #050505 100%);
}

.grid-overlay {
  position: absolute;
  inset: -2px;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 78%);
  opacity: 0.6;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(130px);
  pointer-events: none;
}

.glow-1 {
  top: -14%;
  left: 8%;
  width: 46vw;
  height: 46vw;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.10) 0%, rgba(0, 0, 0, 0) 70%);
  animation: drift 18s infinite alternate ease-in-out;
}

.glow-2 {
  bottom: -16%;
  right: 6%;
  width: 42vw;
  height: 42vw;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.07) 0%, rgba(0, 0, 0, 0) 70%);
  animation: drift 24s infinite alternate-reverse ease-in-out;
}

@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(38px, -34px) scale(1.12); }
}

/* Subtle film grain for texture (self-contained SVG) */
.grain {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  mix-blend-mode: screen;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------
   Glass card base
   ------------------------------------------------------------ */
.glass-card {
  position: relative;
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(120%);
  -webkit-backdrop-filter: blur(24px) saturate(120%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* thin top sheen */
.glass-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  pointer-events: none;
  z-index: 2;
}

/* ------------------------------------------------------------
   Layout shell
   ------------------------------------------------------------ */
#app-container {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: 0;
}

#chat-shell {
  display: flex;
  flex-direction: row;
  gap: 0;
  width: 100%;
  height: 100%;
}

/* Chat + sidebar fill the entire window edge-to-edge (no floating card) */
#chat-screen,
#members-sidebar {
  border-radius: 0;
  border: none;
  box-shadow: none;
}

#chat-screen::before,
#members-sidebar::before {
  content: none;
}

#members-sidebar {
  border-left: 1px solid var(--line);
}

#chat-shell.hidden {
  display: none !important;
}

/* Onboarding is the lone visible child before joining */
#onboarding-screen {
  width: 100%;
  max-width: 440px;
  margin: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 36px;
}

/* ------------------------------------------------------------
   Onboarding
   ------------------------------------------------------------ */
.onboarding-header {
  text-align: center;
  margin-bottom: 40px;
}

.logo-container {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 76px;
  height: 76px;
  border-radius: 22px;
  background: linear-gradient(145deg, #ffffff 0%, #cfcfcf 100%);
  margin-bottom: 26px;
  box-shadow: 0 12px 30px rgba(255, 255, 255, 0.12), inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

.logo-icon {
  font-size: 34px;
  color: #0a0a0a;
}

.onboarding-header h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.6px;
  margin-bottom: 10px;
  color: var(--white);
}

.subtitle {
  color: var(--text-muted);
  font-size: 15px;
  letter-spacing: 0.1px;
}

/* ------------------------------------------------------------
   Inputs & form controls
   ------------------------------------------------------------ */
.input-group {
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.4px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 18px;
  color: var(--text-dim);
  font-size: 15px;
  transition: var(--transition-smooth);
}

.input-wrapper input {
  width: 100%;
  padding: 16px 16px 16px 48px;
  background: var(--surface-inset);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
  outline: none;
  transition: var(--transition-smooth);
}

.input-wrapper input::placeholder {
  color: var(--text-faint);
}

.input-wrapper input:focus {
  border-color: var(--line-focus);
  background: var(--surface-inset-hover);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.input-wrapper input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
  color: var(--text-main);
}

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.primary-btn {
  width: 100%;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--white);
  border-radius: var(--radius-md);
  color: #0a0a0a;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  transition: var(--transition-smooth);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.10);
}

.primary-btn:hover {
  transform: translateY(-2px);
  background: #eaeaea;
  box-shadow: 0 10px 28px rgba(255, 255, 255, 0.18);
}

.primary-btn:active {
  transform: translateY(0);
}

.action-btn {
  padding: 9px 16px;
  background: var(--white);
  border: 1px solid var(--white);
  border-radius: 999px;
  color: #0a0a0a;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.action-btn:hover {
  transform: translateY(-1px);
  background: #eaeaea;
  box-shadow: 0 6px 16px rgba(255, 255, 255, 0.14);
}

.action-btn:active {
  transform: translateY(0);
}

/* ------------------------------------------------------------
   Chat screen
   ------------------------------------------------------------ */
#chat-screen {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

#chat-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.015);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.logo-container-small {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(145deg, #ffffff 0%, #d0d0d0 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

.logo-icon-small {
  font-size: 18px;
  color: #0a0a0a;
}

.chat-header-info h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--white);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: var(--white);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.85); opacity: 0.7; }
  50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 12px rgba(255, 255, 255, 0.9); }
  100% { transform: scale(0.85); opacity: 0.7; }
}

#active-users-count {
  font-size: 12px;
  color: var(--text-muted);
}

.icon-btn {
  background: var(--surface-inset);
  border: 1px solid var(--line);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 15px;
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--white);
  border-color: var(--white);
  color: #0a0a0a;
}

.icon-btn.active {
  background: var(--white);
  border-color: var(--white);
  color: #0a0a0a;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.2);
}

/* ------------------------------------------------------------
   Admin tabs
   ------------------------------------------------------------ */
#admin-tabs {
  display: flex;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--line);
  gap: 8px;
}

.tab-btn {
  flex: 1;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  color: #0a0a0a;
  background: var(--white);
  border-color: var(--white);
}

/* ------------------------------------------------------------
   Admin controls
   ------------------------------------------------------------ */
#admin-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.025);
  border-bottom: 1px solid var(--line);
  gap: 12px;
}

.filter-group {
  display: flex;
  align-items: center;
  background: var(--surface-inset);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  flex: 1;
  max-width: 250px;
  gap: 8px;
  transition: var(--transition-smooth);
}

.filter-group:focus-within {
  border-color: var(--line-focus);
  background: var(--surface-inset-hover);
}

.filter-group i {
  color: var(--text-dim);
  font-size: 12px;
}

#filter-user-input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 13px;
  outline: none;
  width: 100%;
}

#filter-user-input::placeholder {
  color: var(--text-faint);
}

#clear-filter-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  font-size: 12px;
  transition: var(--transition-smooth);
}

#clear-filter-btn:hover {
  color: var(--white);
}

/* ------------------------------------------------------------
   Chat body & message viewports
   ------------------------------------------------------------ */
#chat-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.messages-viewport {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.active-view {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.hidden-view {
  opacity: 0;
  pointer-events: none;
  transform: translateX(16px);
}

/* Scrollbars */
.messages-viewport::-webkit-scrollbar,
.users-list-viewport::-webkit-scrollbar {
  width: 6px;
}

.messages-viewport::-webkit-scrollbar-track,
.users-list-viewport::-webkit-scrollbar-track {
  background: transparent;
}

.messages-viewport::-webkit-scrollbar-thumb,
.users-list-viewport::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.messages-viewport::-webkit-scrollbar-thumb:hover,
.users-list-viewport::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* ------------------------------------------------------------
   Messages
   ------------------------------------------------------------ */
.message {
  display: flex;
  flex-direction: column;
  max-width: 78%;
  animation: message-slide-up 0.32s cubic-bezier(0.18, 0.89, 0.32, 1.2) forwards;
}

@keyframes message-slide-up {
  0% { transform: translateY(12px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.message.self { align-self: flex-end; }
.message.other { align-self: flex-start; }

.message-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 5px;
  padding: 0 6px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.message.self .message-meta {
  justify-content: flex-end;
}

.msg-username {
  font-weight: 600;
  color: var(--text-muted);
}

.msg-time {
  font-size: 10px;
  color: var(--text-faint);
}

.message-content {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.message.self .message-content {
  background: var(--msg-self-bg);
  color: var(--msg-self-text);
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.message.other .message-content {
  background: var(--msg-other-bg);
  border: 1px solid var(--msg-other-border);
  border-bottom-left-radius: 4px;
  color: var(--text-main);
}

/* System messages */
.system-message {
  align-self: center;
  text-align: center;
  max-width: 90%;
  margin: 6px 0;
  animation: fade-in 0.5s ease forwards;
}

.sys-text {
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 6px 14px;
  border-radius: 999px;
  display: inline-block;
  line-height: 1.4;
}

.system-message.joined .sys-text {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
}

.system-message.left .sys-text {
  color: var(--text-faint);
  border-color: rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
}

/* Archive markers */
.message.archived-msg .message-content {
  border-style: dashed;
}

.message.archived-msg.self .message-content {
  background: rgba(244, 244, 245, 0.85);
}

.message.archived-msg.other .message-content {
  background: rgba(255, 255, 255, 0.03);
}

.archive-badge {
  font-size: 9px;
  color: #0a0a0a;
  background: var(--text-muted);
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ------------------------------------------------------------
   Chat footer / input
   ------------------------------------------------------------ */
#chat-footer {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}

#message-form {
  display: flex;
  gap: 12px;
  align-items: center;
}

.input-container-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--surface-inset);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: var(--transition-smooth);
  overflow: hidden;
}

.input-container-wrapper:focus-within {
  border-color: var(--line-focus);
  background: var(--surface-inset-hover);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

#message-input {
  flex: 1;
  padding: 14px 0 14px 20px;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 14px;
  outline: none;
}

#message-input::placeholder {
  color: var(--text-faint);
}

.input-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  outline: none;
}

.input-action-btn:hover {
  color: var(--white);
}

.primary-btn-circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--white);
  border: none;
  color: #0a0a0a;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 15px;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.14);
  flex-shrink: 0;
}

.primary-btn-circle:hover {
  transform: scale(1.06);
  background: #eaeaea;
  box-shadow: 0 6px 18px rgba(255, 255, 255, 0.22);
}

.primary-btn-circle:active {
  transform: scale(0.95);
}

/* ------------------------------------------------------------
   Members sidebar
   ------------------------------------------------------------ */
#members-sidebar {
  width: 288px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-muted);
}

.sidebar-title i {
  font-size: 13px;
  color: var(--text-dim);
}

.members-count {
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #0a0a0a;
  background: var(--white);
  border-radius: 999px;
}

.users-list-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 0;
}

#users-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  margin: 0;
}

.user-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  color: var(--text-muted);
  transition: var(--transition-smooth);
  text-align: left;
}

.user-list-item:hover {
  background: var(--surface-inset);
  color: var(--text-main);
}

.user-list-item i {
  color: var(--text-dim);
  font-size: 17px;
}

.user-list-item.self-item {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
  font-weight: 500;
}

.user-list-item.self-item i {
  color: var(--white);
}

/* ------------------------------------------------------------
   Modal
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  transition: opacity 0.3s ease;
}

.modal-content {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  position: relative;
}

.modal-header {
  text-align: center;
  margin-bottom: 22px;
  position: relative;
}

.admin-icon-container {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-strong);
  color: var(--white);
  font-size: 22px;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--white);
}

.close-btn {
  position: absolute;
  top: -14px;
  right: -14px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  transition: var(--transition-smooth);
}

.close-btn:hover {
  color: var(--white);
}

.modal-body p {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.55;
  margin-bottom: 24px;
}

.error-msg {
  color: var(--error);
  font-size: 12px;
  margin-top: 10px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.error-msg::before {
  content: "\26A0";
  font-size: 12px;
}

/* ------------------------------------------------------------
   Header alias display
   ------------------------------------------------------------ */
.user-separator {
  color: var(--text-faint);
  font-size: 10px;
  margin: 0 2px;
}

.header-user-label {
  font-size: 11px;
  color: var(--text-dim);
}

.header-user-label strong {
  color: var(--text-main);
  font-weight: 600;
}

/* ------------------------------------------------------------
   Typing indicator bubble
   ------------------------------------------------------------ */
.typing-bubble {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  padding: 12px 16px !important;
  background: var(--msg-other-bg) !important;
  border: 1px solid var(--msg-other-border) !important;
  border-bottom-left-radius: 4px !important;
  width: fit-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: var(--text-muted);
  border-radius: 50%;
  opacity: 0.4;
  animation: typing-blink 1.4s infinite both;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-blink {
  0% { opacity: 0.35; transform: scale(1); }
  20% { opacity: 1; transform: scale(1.25); }
  100% { opacity: 0.35; transform: scale(1); }
}

/* ------------------------------------------------------------
   Utilities & animations
   ------------------------------------------------------------ */
.hidden {
  display: none !important;
}

.fade-in {
  animation: fade-in 0.45s ease-out forwards;
}

.scale-up {
  animation: scale-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes fade-in {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes scale-up {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 860px) {
  #members-sidebar {
    display: none;
  }
}

@media (max-width: 560px) {
  .glass-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  #onboarding-screen {
    max-width: 100%;
    border-radius: 0;
  }
}

/* ============================================================
   Feature add-ons: announcements, slash commands, minigames
   ============================================================ */

/* --- Admin announcement banner --- */
#announcement-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid var(--line-strong);
}

.ann-icon {
  color: var(--white);
  font-size: 14px;
  flex-shrink: 0;
}

#announcement-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-main);
  font-weight: 500;
  line-height: 1.4;
  word-break: break-word;
}

.ann-dismiss {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  flex-shrink: 0;
  transition: var(--transition-smooth);
}

.ann-dismiss:hover {
  color: var(--white);
}

/* --- Action / emote messages (/me, /roll, /flip …) --- */
.action-message {
  align-self: center;
  text-align: center;
  max-width: 90%;
  margin: 2px 0;
  animation: fade-in 0.4s ease forwards;
}

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

/* --- Ghost button (used in announce modal) --- */
.ghost-btn {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.ghost-btn:hover {
  color: var(--white);
  border-color: var(--line-strong);
  background: var(--surface-inset);
}

/* --- Slash command hint bar --- */
#chat-footer {
  position: relative;
}

#command-hints {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: calc(100% - 10px);
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
  overflow: hidden;
  z-index: 20;
}

.command-hint {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  transition: var(--transition-smooth);
}

.command-hint:last-child {
  border-bottom: none;
}

.command-hint:hover {
  background: var(--surface-inset-hover);
}

.command-hint-name {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12.5px;
  color: var(--white);
  font-weight: 600;
}

.command-hint-desc {
  font-size: 11.5px;
  color: var(--text-dim);
}

/* --- Minigame: invite card --- */
.game-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  max-width: 340px;
  padding: 14px 18px;
  background: var(--surface-inset);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
}

.game-card-title {
  font-size: 13px;
  color: var(--text-main);
  font-weight: 500;
  text-align: center;
  line-height: 1.4;
}

.game-card-actions {
  display: flex;
  gap: 8px;
}

.game-btn {
  padding: 7px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.game-btn.accept {
  background: var(--white);
  color: #0a0a0a;
  border-color: var(--white);
}

.game-btn.accept:hover {
  background: #eaeaea;
}

.game-btn.decline {
  background: transparent;
  color: var(--text-muted);
}

.game-btn.decline:hover {
  color: var(--white);
  border-color: var(--line-focus);
}

.game-card-note {
  font-size: 11px;
  color: var(--text-dim);
}

/* --- Minigame: board --- */
.game-board-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  background: var(--surface-inset);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
}

.game-board-header {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
}

.game-board-status {
  font-size: 13px;
  color: var(--white);
  font-weight: 600;
  min-height: 18px;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 62px);
  grid-template-rows: repeat(3, 62px);
  gap: 6px;
}

.game-cell {
  width: 62px;
  height: 62px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--white);
  font-family: var(--font-family);
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: var(--transition-smooth);
}

.game-cell.o {
  color: var(--text-muted);
}

.game-grid.my-turn .game-cell:not(.filled) {
  cursor: pointer;
}

.game-grid.my-turn .game-cell:not(.filled):hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-focus);
}

.game-cell.win {
  background: var(--white);
  color: #0a0a0a;
  border-color: var(--white);
}

.game-grid.game-over .game-cell {
  cursor: default;
}

/* ------------------------------------------------------------
   Voice Lounge Widget in Sidebar
   ------------------------------------------------------------ */
.voice-lounge-widget {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.015);
}

.voice-btn {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.voice-btn.join-btn {
  background: var(--white);
  color: #0a0a0a;
  border: none;
  width: 100%;
}

.voice-btn.join-btn:hover {
  background: #eaeaea;
  transform: translateY(-1px);
}

.voice-controls {
  display: flex;
  gap: 8px;
  width: 100%;
}

.voice-btn.mute-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--text-main);
}

.voice-btn.mute-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.voice-btn.mute-btn.muted-active {
  background: #ea4335;
  border-color: #ea4335;
  color: white;
}

.voice-btn.leave-btn {
  flex: 1;
  background: transparent;
  border: 1px solid rgba(234, 67, 53, 0.4);
  color: #ea4335;
}

.voice-btn.leave-btn:hover {
  background: rgba(234, 67, 53, 0.1);
  border-color: #ea4335;
}

.voice-status-text {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

.pulse-dot-green {
  width: 6px;
  height: 6px;
  background-color: #2ecc71;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
  animation: pulse-green 1.6s infinite;
}

@keyframes pulse-green {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(46, 204, 113, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
  }
}

/* --- Voice roster: who is currently in the call --- */
.voice-roster {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(46, 204, 113, 0.05);
}

.voice-roster-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.voice-roster-count {
  margin-left: auto;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  color: #0a0a0a;
  background: #2ecc71;
  border-radius: 999px;
}

#voice-roster-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  margin: 0;
}

.voice-roster-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-main);
}

.voice-roster-item i {
  font-size: 13px;
  color: #2ecc71;
}

.voice-roster-item.self-item {
  color: var(--white);
  font-weight: 500;
}

/* Speaker badge on members who are in the voice call */
.user-list-item .voice-indicator {
  margin-left: auto;
  font-size: 12px;
  color: #2ecc71;
}

/* --- Settings: rows + toggle switch --- */
.setting-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 4px 0;
}

.setting-info {
  flex: 1;
  text-align: left;
}

.setting-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 3px;
}

.setting-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--surface-inset);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  transition: var(--transition-smooth);
}

.switch-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition-smooth);
}

.switch input:checked + .switch-slider {
  background: var(--white);
  border-color: var(--white);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
  background: #0a0a0a;
}

.switch input:focus-visible + .switch-slider {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

/* --- Screen Share Viewport (Docked Side-by-Side) --- */
#screen-share-viewport {
  flex: 1.3;
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(10, 10, 10, 0.45);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: flex 0.3s ease;
}

#screen-share-viewport.hidden {
  display: none !important;
}

.video-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}

#screen-share-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.video-window-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.video-window-controls .icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  transition: color 0.2s;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.video-window-controls .icon-btn:hover {
  color: var(--white);
}

#screen-share-player {
  flex: 1;
  background: #000;
  position: relative;
}

/* --- Theatre Mode Focus --- */
#chat-shell.theatre-mode #chat-screen {
  display: none !important;
}

#chat-shell.theatre-mode #screen-share-viewport {
  flex: 1;
}

/* --- Watch Stream Button (Voice Roster) --- */
.watch-stream-badge-btn {
  margin-left: auto;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  background: #3498db;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-family);
  font-weight: 600;
  transition: background 0.2s, transform 0.1s;
}

.watch-stream-badge-btn:hover {
  background: #2980b9;
  transform: scale(1.03);
}

.watch-stream-badge-btn:active {
  transform: scale(0.97);
}

/* --- Voice Controls: Share Button active state --- */
.voice-btn.share-btn.share-active {
  background: #3498db;
  color: var(--white);
  border-color: #2980b9;
  box-shadow: 0 0 10px rgba(52, 152, 219, 0.4);
}

.voice-btn.share-btn.share-active:hover {
  background: #2980b9;
}

/* --- Chat Giphy & Image Embeds --- */
.chat-embed-image {
  margin-top: 10px;
  max-width: 100%;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  display: inline-block;
  background: rgba(0, 0, 0, 0.2);
  line-height: 0;
}

.chat-embed-image img {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  vertical-align: bottom;
}

.chat-link {
  color: #3498db;
  text-decoration: underline;
  word-break: break-all;
}

.chat-link:hover {
  color: #5dade2;
}

/* --- GIF Picker Panel --- */
#gif-picker-panel {
  position: absolute;
  bottom: 85px;
  right: 20px;
  width: 320px;
  height: 380px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 12px;
  background: rgba(15, 15, 15, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.gif-picker-header {
  position: relative;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
}

.gif-picker-header .search-icon {
  position: absolute;
  left: 12px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
  pointer-events: none;
}

#gif-search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--white);
  outline: none;
  font-size: 13px;
  transition: var(--transition-smooth);
}

#gif-search-input:focus {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
}

.gif-results-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding-right: 4px;
}

.gif-results-grid img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.2s, filter 0.2s;
  background: rgba(255, 255, 255, 0.02);
}

.gif-results-grid img:hover {
  transform: scale(1.03);
  filter: brightness(1.1);
}

.gif-loading {
  grid-column: span 2;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 40px 0;
}

/* --- Changelog Modal Styling --- */
.changelog-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

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

.changelog-version:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.changelog-version h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 10px;
}

.changelog-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.changelog-list li {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}

.changelog-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 8px;
  text-transform: uppercase;
  vertical-align: middle;
}

.tag-new {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.tag-update {
  background: rgba(241, 196, 15, 0.15);
  color: #f1c40f;
  border: 1px solid rgba(241, 196, 15, 0.3);
}

.tag-fix {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.3);
}

/* --- Voice Lounge Member Kick Button --- */
.kick-member-btn {
  margin-left: 6px;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(231, 76, 60, 0.12);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.25);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  vertical-align: middle;
}

.kick-member-btn:hover {
  background: #e74c3c;
  color: #fff;
  border-color: #e74c3c;
}



