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

/* ═════════════════════════════════════════════════════════════════
   ENTERPRISE DESIGN SYSTEM (Team-Developed Product Architecture)
   ═════════════════════════════════════════════════════════════════ */
:root {
  /* Color Palette - Light Mode (Linear / Vercel Slate Palette) */
  --bg-canvas:         #f8fafc;
  --bg-pattern:        radial-gradient(ellipse at 50% -20%, rgba(37, 99, 235, 0.08) 0%, rgba(248, 250, 252, 0) 70%);
  --surface:           #ffffff;
  --surface-2:         #f1f5f9;
  --surface-3:         #e2e8f0;
  --surface-hover:     #e2e8f0;
  
  /* Borders */
  --border:            #e2e8f0;
  --border-subtle:     rgba(15, 23, 42, 0.06);
  --border-strong:     #cbd5e1;
  
  /* Typography */
  --text:              #0f172a;
  --text-2:            #475569;
  --text-muted:        #94a3b8;
  --text-inverse:      #ffffff;
  
  /* Brand Accent */
  --accent:            #2563eb;
  --accent-hover:      #1d4ed8;
  --accent-active:     #1e40af;
  --accent-subtle:     rgba(37, 99, 235, 0.08);
  --accent-glow:       rgba(37, 99, 235, 0.18);
  --accent-gradient:   linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  
  /* Chat Bubbles */
  --bubble-me-bg:      linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  --bubble-me-txt:     #ffffff;
  --bubble-me-shadow:  0 2px 8px rgba(37, 99, 235, 0.22);
  --bubble-them-bg:    #ffffff;
  --bubble-them-border:#e2e8f0;
  --bubble-them-txt:   #0f172a;
  --bubble-them-shadow:0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  
  /* Receipts & Badges */
  --receipt:           rgba(255, 255, 255, 0.7);
  --receipt-seen:      #38bdf8;
  --status-online:     #10b981;
  
  /* Reactions */
  --reaction-bg:       #f8fafc;
  --reaction-border:   #e2e8f0;
  
  /* Elevation Shadows */
  --shadow-xs:         0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm:         0 2px 4px rgba(15, 23, 42, 0.06);
  --shadow-md:         0 4px 14px -1px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg:         0 16px 36px -4px rgba(15, 23, 42, 0.12), 0 6px 14px -2px rgba(15, 23, 42, 0.05);
  --shadow-floating:   0 20px 48px rgba(15, 23, 42, 0.16);
  
  /* Component Geometry */
  --radius-xs:         4px;
  --radius-sm:         6px;
  --radius:            10px;
  --radius-lg:         16px;
  --radius-xl:         22px;
  --radius-full:       9999px;
  --header-h:          56px;
  --footer-h:          64px;
  
  /* Micro-transitions */
  --ease-spring:       cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth:       cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast:   all 0.12s var(--ease-smooth);
  --transition:        all 0.2s var(--ease-spring);
}

[data-theme="dark"] {
  /* Color Palette - Dark Mode (Twilight Obsidian Slate) */
  --bg-canvas:         #090d16;
  --bg-pattern:        radial-gradient(ellipse at 50% -20%, rgba(59, 130, 246, 0.12) 0%, rgba(9, 13, 22, 0) 75%);
  --surface:           #0f172a;
  --surface-2:         #1e293b;
  --surface-3:         #334155;
  --surface-hover:     #24334a;
  
  /* Borders */
  --border:            #1e293b;
  --border-subtle:     rgba(255, 255, 255, 0.06);
  --border-strong:     #334155;
  
  /* Typography */
  --text:              #f8fafc;
  --text-2:            #94a3b8;
  --text-muted:        #64748b;
  --text-inverse:      #0f172a;
  
  /* Brand Accent */
  --accent:            #3b82f6;
  --accent-hover:      #60a5fa;
  --accent-active:     #2563eb;
  --accent-subtle:     rgba(59, 130, 246, 0.14);
  --accent-glow:       rgba(59, 130, 246, 0.28);
  --accent-gradient:   linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
  
  /* Chat Bubbles */
  --bubble-me-bg:      linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  --bubble-me-txt:     #ffffff;
  --bubble-me-shadow:  0 2px 10px rgba(0, 0, 0, 0.4);
  --bubble-them-bg:    #172033;
  --bubble-them-border:#223049;
  --bubble-them-txt:   #f8fafc;
  --bubble-them-shadow:0 2px 6px rgba(0, 0, 0, 0.25);
  
  /* Receipts & Badges */
  --receipt:           rgba(255, 255, 255, 0.45);
  --receipt-seen:      #38bdf8;
  --status-online:     #10b981;
  
  /* Reactions */
  --reaction-bg:       #172033;
  --reaction-border:   #273752;
  
  /* Elevation Shadows */
  --shadow-xs:         0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm:         0 2px 5px rgba(0, 0, 0, 0.45);
  --shadow-md:         0 6px 18px rgba(0, 0, 0, 0.5);
  --shadow-lg:         0 18px 40px rgba(0, 0, 0, 0.65);
  --shadow-floating:   0 24px 54px rgba(0, 0, 0, 0.75);
}

/* ══ Global Reset & Typography ══ */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-canvas);
  background-image: var(--bg-pattern);
  color: var(--text);
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.hidden { display: none !important; }

/* ══ Precision Scrollbars ══ */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ═════════════════════════════════════════════════════════════════
   NAME ENTRY & ROOM SELECTION SCREENS (Apple / Linear Auth Feel)
   ═════════════════════════════════════════════════════════════════ */
#name-screen, #private-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  padding: 20px;
  position: relative;
}

.name-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow-lg);
  animation: modalPop 0.28s var(--ease-spring);
  position: relative;
}

@keyframes modalPop {
  0% { opacity: 0; transform: scale(0.97) translateY(6px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.name-card-icon {
  font-size: 2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.name-card h1 {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.2;
}

.name-card p {
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.45;
  margin-top: -6px;
}

.name-card input {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-family: inherit;
  background: var(--bg-canvas);
  color: var(--text);
  outline: none;
  transition: var(--transition-fast);
}
.name-card input::placeholder {
  color: var(--text-muted);
}
.name-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--surface);
}

.name-card button {
  padding: 12px 18px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.name-card button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.name-card button:active {
  transform: translateY(0);
}

/* ── Discreet Top-Right Nav Button ── */
.top-right-nav {
  position: fixed;
  top: 18px;
  right: 20px;
  z-index: 100;
}

.discreet-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}
.discreet-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* ── Private Room Specifics ── */
.private-card-header {
  display: flex;
  align-items: center;
  margin-bottom: -6px;
}

.back-text-btn {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s;
}
.back-text-btn:hover {
  color: var(--accent);
}

.private-code-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#room-code-input {
  text-transform: uppercase;
  letter-spacing: 5px;
  text-align: center;
  font-weight: 700;
  font-size: 1.25rem;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
}

.private-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.secondary-btn {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
}
.secondary-btn:hover {
  background: var(--surface-hover) !important;
  border-color: var(--border-strong) !important;
}

/* ═════════════════════════════════════════════════════════════════
   CHAT HEADER & STATUS CONTROLS (Glassmorphic Enterprise Nav)
   ═════════════════════════════════════════════════════════════════ */
#chat-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.chat-header {
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 50;
  transition: background 0.25s ease, border-color 0.25s ease;
}
[data-theme="dark"] .chat-header {
  background: rgba(15, 23, 42, 0.88);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo {
  font-weight: 700;
  font-size: 0.94rem;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.room-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  user-select: none;
}
.room-badge.public {
  background: var(--accent-subtle);
  border: 1px solid rgba(37, 99, 235, 0.22);
  color: var(--accent);
}
.room-badge.private {
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.25);
  color: #0284c7;
  letter-spacing: 0.5px;
}
[data-theme="dark"] .room-badge.private {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
}
.room-badge:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.header-center {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
  overflow: hidden;
}

.presence-user {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px 9px 3px 7px;
  transition: var(--transition);
}
.presence-dot {
  width: 6px;
  height: 6px;
  background: var(--status-online);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.header-action-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 0.76rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.header-action-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  color: var(--text-2);
}
.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s;
}
.dot.online {
  background: var(--status-online);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.protocol-badge {
  font-size: 0.69rem;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  white-space: nowrap;
}
.protocol-badge.testing {
  border-style: dashed;
  animation: pulse 1.5s infinite;
}
.protocol-badge.websocket {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.28);
  color: #059669;
}
.protocol-badge.polling {
  background: rgba(234, 179, 8, 0.08);
  border-color: rgba(234, 179, 8, 0.28);
  color: #ca8a04;
}
.protocol-badge.failed {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.28);
  color: #dc2626;
}

[data-theme="dark"] .protocol-badge.websocket {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

@keyframes pulse {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

#user-count-label {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}

/* ═════════════════════════════════════════════════════════════════
   MESSAGES FEED & BUBBLE ARCHITECTURE (Slack & Linear Polish)
   ═════════════════════════════════════════════════════════════════ */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 22px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scroll-behavior: smooth;
}

.msg-system {
  text-align: center;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 0;
  letter-spacing: 0.2px;
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 66%;
  position: relative;
  animation: bubbleFade 0.18s var(--ease-spring);
}
.msg-row.me  { align-self: flex-end;   align-items: flex-end; }
.msg-row.them { align-self: flex-start; align-items: flex-start; }

@keyframes bubbleFade {
  0% { opacity: 0; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}

.msg-row + .msg-row.me   { margin-top: 2px; }
.msg-row + .msg-row.them { margin-top: 2px; }
.msg-row.them + .msg-row.me,
.msg-row.me  + .msg-row.them { margin-top: 10px; }

.msg-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 3px;
  padding: 0 4px;
}

/* ── Refined Chat Bubbles ── */
.msg-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
  cursor: default;
  transition: box-shadow 0.15s ease;
}

/* Outgoing "Me" Bubbles */
.msg-row.me .msg-bubble {
  background: var(--bubble-me-bg);
  color: var(--bubble-me-txt);
  border-bottom-right-radius: 4px;
  box-shadow: var(--bubble-me-shadow);
}

/* Incoming "Them" Bubbles */
.msg-row.them .msg-bubble {
  background: var(--bubble-them-bg);
  color: var(--bubble-them-txt);
  border: 1px solid var(--bubble-them-border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--bubble-them-shadow);
}

/* Image Bubbles */
.msg-bubble img {
  max-width: 250px;
  max-height: 250px;
  border-radius: var(--radius);
  display: block;
  cursor: zoom-in;
  object-fit: cover;
  transition: transform 0.15s;
}
.msg-bubble img:hover {
  transform: scale(1.01);
}

/* Metadata & Read Receipts */
.msg-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  padding: 0 4px;
}
.msg-time {
  font-size: 0.68rem;
  color: var(--text-muted);
}
.msg-receipt {
  font-size: 0.68rem;
  color: var(--text-muted);
  transition: color 0.25s;
}
.msg-receipt.seen {
  color: var(--receipt-seen);
}

/* ── Reaction Picker (Floating Pill) ── */
.bubble-wrapper {
  position: relative;
  display: inline-block;
}

.reaction-picker {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 4px 8px;
  display: flex;
  gap: 4px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px) scale(0.95);
  transition: opacity 0.15s, transform 0.15s var(--ease-spring);
  z-index: 20;
  white-space: nowrap;
}
.msg-row.me .reaction-picker {
  left: auto;
  right: 0;
}

.bubble-wrapper.show-picker .reaction-picker {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}
.bubble-wrapper.show-picker .msg-bubble {
  box-shadow: 0 0 0 2px var(--accent) !important;
}

.reaction-emoji {
  font-size: 1.05rem;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: var(--radius-sm);
  transition: transform 0.12s, background 0.12s;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.reaction-emoji:hover {
  transform: scale(1.22);
  background: var(--surface-2);
}

/* ── Reaction Badges ── */
.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  padding: 0 2px;
}
.reaction-pill {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--reaction-bg);
  border: 1px solid var(--reaction-border);
  border-radius: var(--radius-full);
  padding: 2px 7px;
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}
.reaction-pill:hover {
  background: var(--surface-hover);
  transform: scale(1.05);
}
.reaction-pill.mine {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

/* ── Typing Indicator ── */
.typing-indicator {
  padding: 2px 20px 6px;
  font-size: 0.75rem;
  font-style: italic;
  color: var(--text-2);
  min-height: 22px;
}

/* ═════════════════════════════════════════════════════════════════
   CHAT FOOTER & INPUT ARCHITECTURE (Floating Pill Feel)
   ═════════════════════════════════════════════════════════════════ */
.chat-footer {
  height: var(--footer-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  flex-shrink: 0;
  transition: background 0.25s ease, border-color 0.25s ease;
}

#message-form {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.attach-btn {
  color: var(--text-2);
  cursor: pointer;
  padding: 7px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  transition: var(--transition-fast);
  flex-shrink: 0;
}
.attach-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

#message-input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--bg-canvas);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.25s;
}
#message-input::placeholder {
  color: var(--text-muted);
}
#message-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--surface);
}

#send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
#send-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}
#send-btn:active {
  transform: scale(0.95);
}

/* ═════════════════════════════════════════════════════════════════
   VOICE NOTES & FILE ATTACHMENTS (Engineered Cards)
   ═════════════════════════════════════════════════════════════════ */
.recording-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  animation: fadeUp 0.15s ease;
}
.recording-bar.hidden {
  display: none !important;
}
.recording-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  animation: pulseRecording 1s infinite alternate;
  flex-shrink: 0;
}
@keyframes pulseRecording {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0.3; transform: scale(0.8); }
}
.recording-time {
  font-size: 0.86rem;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, monospace;
  color: var(--text);
}
.recording-label {
  flex: 1;
  font-size: 0.78rem;
  color: var(--text-2);
}
.recording-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  transition: var(--transition);
}
.recording-action-btn:hover {
  transform: scale(1.08);
}
.recording-action-btn.cancel {
  background: var(--surface);
  color: #ef4444;
  border: 1px solid var(--border);
}
.recording-action-btn.send {
  background: #10b981;
  color: #ffffff;
}

/* File Attachment Card */
.msg-file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
  min-width: 190px;
  max-width: 270px;
}
.msg-file-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
[data-theme="dark"] .msg-file-icon {
  background: rgba(255, 255, 255, 0.1);
}
.msg-row.me .msg-file-icon {
  background: rgba(255, 255, 255, 0.22);
}
.msg-file-info {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.msg-file-name {
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-file-size {
  font-size: 0.7rem;
  opacity: 0.75;
  margin-top: 1px;
}
.msg-file-download-btn {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, background 0.15s;
}
.msg-file-download-btn:hover {
  transform: scale(1.12);
  background: rgba(0, 0, 0, 0.08);
}
.msg-row.me .msg-file-download-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Audio Memo Player Card */
.msg-audio-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 210px;
  max-width: 280px;
}
.msg-audio-player {
  width: 100%;
  height: 36px;
  outline: none;
}

/* ═════════════════════════════════════════════════════════════════
   MARKDOWN, REPLIES & IN-CHAT SEARCH
   ═════════════════════════════════════════════════════════════════ */
.msg-inline-code {
  background: rgba(0, 0, 0, 0.08);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 0.84em;
}
[data-theme="dark"] .msg-inline-code {
  background: rgba(255, 255, 255, 0.12);
}
.msg-row.me .msg-inline-code {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.msg-code-block {
  margin: 6px 0;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 0.82em;
  line-height: 1.45;
}
[data-theme="dark"] .msg-code-block {
  background: #090d16;
  border: 1px solid var(--border);
}
.msg-row.me .msg-code-block {
  background: rgba(0, 0, 0, 0.25);
  color: #ffffff;
}

.msg-quote {
  border-left: 3px solid var(--accent);
  background: rgba(0, 0, 0, 0.04);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 4px 8px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.78rem;
}
[data-theme="dark"] .msg-quote {
  background: rgba(255, 255, 255, 0.06);
}
.msg-row.me .msg-quote {
  border-left-color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
}
.msg-quote-sender {
  font-weight: 600;
  font-size: 0.71rem;
  margin-bottom: 1px;
}
.msg-quote-text {
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

@keyframes flashGlow {
  0% { transform: scale(1); box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 6px var(--accent-glow); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 var(--accent-glow); }
}
.msg-row.flash-highlight .msg-bubble {
  animation: flashGlow 0.9s ease-out;
}

.reply-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 7px 16px;
  font-size: 0.8rem;
  animation: fadeUp 0.15s ease;
}
.reply-preview-bar.hidden {
  display: none !important;
}
.reply-preview-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.reply-preview-user {
  font-weight: 600;
  font-size: 0.74rem;
  color: var(--accent);
}
.reply-preview-text {
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
.cancel-reply-btn {
  background: transparent;
  border: none;
  color: var(--text-2);
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.cancel-reply-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.search-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  animation: fadeUp 0.15s ease;
}
.search-bar.hidden {
  display: none !important;
}
.search-bar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 12px;
}
.search-bar-inner svg {
  color: var(--text-2);
  flex-shrink: 0;
}
.search-bar-inner input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.85rem;
  color: var(--text);
  font-family: inherit;
}
.search-count {
  font-size: 0.74rem;
  color: var(--text-2);
  white-space: nowrap;
}
.search-close-btn {
  background: transparent;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0 4px;
}
.search-close-btn:hover {
  color: var(--text);
}
.msg-row.search-dimmed {
  display: none !important;
}
.msg-row.search-matched .msg-bubble {
  box-shadow: 0 0 0 2px var(--accent) !important;
}

/* ═════════════════════════════════════════════════════════════════
   MODALS (Share, Admin, Help) - Frosted Glass & Precision Frames
   ═════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-overlay.hidden {
  display: none !important;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.modal-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 390px;
  padding: 24px;
  box-shadow: var(--shadow-floating);
  z-index: 2;
  animation: modalPop 0.22s var(--ease-spring);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-2);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}
.modal-close-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px 10px;
  margin-bottom: 16px;
}
#qr-code-img {
  width: 160px;
  height: 160px;
  object-fit: contain;
  display: block;
}
.qr-instructions {
  font-size: 0.74rem;
  color: #64748b;
  margin-top: 8px;
  margin-bottom: 0;
}
.share-info-block {
  margin-bottom: 12px;
}
.share-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
}
.share-copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.share-code-pill {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-align: center;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, monospace;
}
.share-copy-row input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.8rem;
  color: var(--text);
  outline: none;
}
.share-copy-btn {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}
.share-copy-btn:hover {
  background: var(--accent-hover);
}

.danger-zone {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.purge-btn {
  width: 100%;
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}
.purge-btn:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

/* ═════════════════════════════════════════════════════════════════
   ADMIN CONSOLE MODAL
   ═════════════════════════════════════════════════════════════════ */
.admin-card {
  max-width: 580px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.admin-body {
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.admin-desc {
  font-size: 0.84rem;
  color: var(--text-2);
}
.admin-input-group {
  display: flex;
  gap: 8px;
  align-items: center;
}
.admin-input-group input {
  flex: 1;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-canvas);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
}
.admin-input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.admin-input-group button {
  padding: 9px 15px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}
.admin-input-group button:hover {
  background: var(--accent-hover);
}
.admin-error {
  color: #ef4444;
  font-size: 0.8rem;
  font-weight: 500;
}

.admin-telemetry-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.telemetry-pill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.telemetry-label {
  font-size: 0.68rem;
  color: var(--text-2);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.4px;
}
.telemetry-val {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.admin-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-section-header h4 {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
}
.admin-small-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 4px 9px;
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}
.admin-small-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
}
.admin-small-btn.secondary {
  color: var(--text-2);
}

.admin-rooms-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
}
.admin-room-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}
.admin-room-id {
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, monospace;
  color: var(--accent);
}
.admin-room-meta {
  color: var(--text-2);
  font-size: 0.74rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-transcript-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.transcript-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.transcript-box-header h4 {
  font-size: 0.8rem;
  font-weight: 600;
}
.transcript-box-actions {
  display: flex;
  gap: 6px;
}
.transcript-content {
  background: var(--bg-canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.76rem;
  line-height: 1.45;
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-wrap;
  color: var(--text);
}

/* ── Admin Tab Bar Navigation ── */
.admin-tab-bar {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
}
.admin-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}
.admin-tab-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.admin-tab-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}
.admin-tab-badge {
  background: rgba(255, 255, 255, 0.25);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
}
.admin-tab-btn:not(.active) .admin-tab-badge {
  background: var(--surface-3);
  color: var(--text);
}

.admin-tab-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Live Users Inspector ── */
.admin-users-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}
.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}
.admin-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  overflow: hidden;
}
.admin-user-name {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.admin-user-room {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 2px 7px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
}
.admin-user-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.admin-user-actions {
  display: flex;
  gap: 6px;
}
.admin-kick-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}
.admin-kick-btn:hover {
  background: #ef4444;
  color: #ffffff;
}
.admin-ban-btn {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.4);
  color: #dc2626;
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}
.admin-ban-btn:hover {
  background: #dc2626;
  color: #ffffff;
}

/* ── Remote Room Purge Button ── */
.admin-purge-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}
.admin-purge-btn:hover {
  background: #ef4444;
  color: #ffffff;
}

/* ── Server Controls: Slow Mode & Maintenance ── */
.admin-slowmode-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.slowmode-option-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: var(--transition-fast);
}
.slowmode-option-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.slowmode-option-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.admin-status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.admin-status-badge.active-warn {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #ef4444;
}

.admin-danger-toggle-btn {
  padding: 9px 14px;
  background: #ef4444;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}
.admin-danger-toggle-btn:hover {
  background: #dc2626;
}
.admin-danger-toggle-btn.deactivate {
  background: #10b981;
}
.admin-danger-toggle-btn.deactivate:hover {
  background: #059669;
}

.admin-action-status {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  animation: fadeUp 0.15s ease;
}
.admin-empty-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 16px 0;
}

/* ═════════════════════════════════════════════════════════════════
   SYSTEM ANNOUNCEMENT FULL-WIDTH DROPDOWN BAR
   ═════════════════════════════════════════════════════════════════ */
.dev-broadcast-banner {
  position: fixed;
  top: 50px;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  transform: translateY(-100%);
  z-index: 10000;
  background: var(--surface-2);
  color: var(--text);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-left: none;
  border-right: none;
  border-radius: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  user-select: none;
}
.dev-broadcast-banner.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
}
.banner-icon-svg {
  color: var(--accent);
  flex-shrink: 0;
}
.banner-tag {
  background: var(--accent);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.banner-text {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
}
.banner-dismiss {
  font-size: 0.85rem;
  color: var(--text-2);
  padding: 3px 8px;
  border-radius: 3px;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.banner-dismiss:hover {
  background: var(--surface);
  color: var(--text);
}

/* ═════════════════════════════════════════════════════════════════
   HELP MODAL & ARCHITECTURE GUIDE
   ═════════════════════════════════════════════════════════════════ */
.help-card {
  max-width: 700px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.help-body {
  padding: 18px 24px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.help-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.help-heading {
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.help-num {
  background: var(--accent);
  color: #ffffff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.help-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.help-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.help-item strong {
  color: var(--text);
  font-size: 0.84rem;
}
.help-item p {
  color: var(--text-2);
  line-height: 1.42;
  margin: 0;
}
.help-item code {
  background: var(--surface-2);
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--accent);
}

.eli5-section {
  border-top: 1px solid var(--border);
  padding-top: 18px;
}
.eli5-intro {
  font-size: 0.84rem;
  color: var(--text-2);
  margin: 0;
}
.eli5-steps {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.eli5-step {
  display: flex;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  align-items: flex-start;
}
.eli5-step-badge {
  background: var(--accent);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.4px;
  flex-shrink: 0;
  margin-top: 2px;
}
.eli5-step-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.82rem;
}
.eli5-step-content strong {
  color: var(--text);
  font-size: 0.84rem;
}
.eli5-step-content p {
  color: var(--text-2);
  margin: 0;
  line-height: 1.42;
}
.eli5-step-content code {
  background: var(--surface);
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--accent);
}

/* ═════════════════════════════════════════════════════════════════
   CORNER ACTIONS (Console & Help Triggers)
   ═════════════════════════════════════════════════════════════════ */
.admin-trigger-btn {
  position: fixed;
  bottom: 12px;
  left: 16px;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--text-2);
  text-decoration: underline;
  cursor: pointer;
  z-index: 999;
  opacity: 0.65;
  transition: var(--transition-fast);
}
.admin-trigger-btn:hover {
  opacity: 1;
  color: var(--accent);
}

.help-trigger-btn {
  position: fixed;
  bottom: 12px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999;
  box-shadow: var(--shadow-sm);
  opacity: 0.85;
  transition: var(--transition);
  padding: 0;
}
.help-trigger-btn:hover {
  opacity: 1;
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  transform: scale(1.1);
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* ═════════════════════════════════════════════════════════════════
   LIGHTBOX & TOAST
   ═════════════════════════════════════════════════════════════════ */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
#lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
}
#lightbox-img {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius);
  object-fit: contain;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.15s ease;
}
#lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background 0.15s;
}
#lightbox-close:hover {
  background: rgba(0, 0, 0, 0.85);
}

.toast {
  position: fixed;
  bottom: 86px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  z-index: 500;
  max-width: 90vw;
  animation: fadeUp 0.2s var(--ease-spring);
}

/* ══ Animations ══ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-link {
  color: inherit;
  text-decoration: underline;
  font-weight: 500;
}
.msg-row.me .chat-link {
  color: #ffffff;
}
.msg-row.them .chat-link {
  color: var(--accent);
}

.deleted-animation {
  opacity: 0 !important;
  transform: scale(0.92) !important;
  transition: opacity 0.25s ease, transform 0.25s ease !important;
}

#chat-screen.drag-over {
  box-shadow: inset 0 0 0 3px var(--accent) !important;
}

/* ══ Responsive Breakpoints ══ */
@media (max-width: 600px) {
  .msg-row { max-width: 86%; }
  .name-card { margin: 12px; padding: 30px 22px; }
  .header-center { display: none; }
  .help-grid { grid-template-columns: 1fr; }
  .dev-broadcast-banner { top: 48px; }
  .banner-inner { padding: 8px 14px; gap: 8px; }
  .banner-tag { font-size: 0.62rem; padding: 2px 6px; }
  .banner-text { font-size: 0.82rem; }
}
