@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-base: #080A0F;
  --bg-surface: #0E131E;
  --bg-card: rgba(18, 24, 38, 0.7);
  --bg-card-hover: rgba(28, 36, 56, 0.8);
  --glass-bg: rgba(15, 21, 33, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-focus: rgba(108, 99, 255, 0.4);

  --accent-primary: #6C63FF;
  --accent-secondary: #3CF0C5;
  --accent-glow: rgba(108, 99, 255, 0.35);
  --gradient-brand: linear-gradient(135deg, #6C63FF 0%, #3CF0C5 100%);
  --gradient-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 100%);

  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 35px var(--accent-glow);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(108, 99, 255, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(60, 240, 197, 0.08) 0%, transparent 40%);
}

/* ═══ APP CONTAINER ═════════════════════════════════════════════ */
.app-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  height: 100dvh;
  padding: 0;
}

@media (min-width: 768px) {
  .app-container {
    padding: 24px;
  }
}

.app-frame {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 520px;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

@media (min-width: 768px) {
  .app-frame {
    height: 92vh;
    max-height: 840px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md), 0 0 60px rgba(0, 0, 0, 0.5);
  }
}

/* ═══ SCREEN TRANSITIONS ═════════════════════════════════════════ */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px) scale(0.99);
  transition: opacity 0.28s var(--transition), transform 0.28s var(--transition), visibility 0.28s var(--transition);
  background: var(--bg-surface);
  z-index: 1;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  z-index: 10;
}

/* ═══ GLASS UTILITY ═════════════════════════════════════════════ */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
}

/* ═══ BUTTONS ═══════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--gradient-brand);
  color: #FFFFFF;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 18px rgba(108, 99, 255, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(108, 99, 255, 0.5);
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger-icon:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-sm {
  padding: 7px 14px !important;
  font-size: 13px !important;
  border-radius: var(--radius-sm) !important;
}

/* ═══ SCREEN: ONBOARDING ════════════════════════════════════════ */
.onboard-container {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: calc(36px + env(safe-area-inset-top, 0px)) calc(28px + env(safe-area-inset-right, 0px)) 28px calc(28px + env(safe-area-inset-left, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y pinch-zoom;
  overscroll-behavior-y: contain;
}

.onboard-header {
  text-align: center;
  margin-bottom: 28px;
  flex-shrink: 0;
}

.logo-badge {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-badge-icon {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  box-shadow: 0 10px 30px var(--accent-glow);
}

.onboard-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}

.onboard-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 320px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 18px;
}

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

.form-input, .form-select {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: rgba(10, 14, 23, 0.6);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  transition: var(--transition);
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.2);
  background: rgba(10, 14, 23, 0.9);
}

.privacy-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-top: 10px;
  margin-bottom: 24px;
  border-radius: var(--radius-md);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--success);
  font-size: 12px;
}

/* ═══ SCREEN: LOBBY ═════════════════════════════════════════════ */
.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(16px + env(safe-area-inset-top, 0px)) calc(20px + env(safe-area-inset-right, 0px)) 16px calc(20px + env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--glass-border);
  background: rgba(15, 21, 33, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 5;
  flex-shrink: 0;
}

.lobby-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.brand-location {
  font-size: 12px;
  color: var(--text-secondary);
}

.lobby-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lobby-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y pinch-zoom;
  overscroll-behavior-y: contain;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.lobby-body > * {
  flex-shrink: 0;
}

/* Action Cards */
.lobby-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.action-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
}

.action-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.icon-purple {
  background: rgba(108, 99, 255, 0.15);
  color: var(--accent-primary);
}

.icon-teal {
  background: rgba(60, 240, 197, 0.15);
  color: var(--accent-secondary);
}

.action-card-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.action-card-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* Group Room Expandable Panel */
.room-panel {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(60, 240, 197, 0.2);
  background: rgba(18, 24, 38, 0.85);
  animation: slide-in 0.25s ease;
}

.room-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.room-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.room-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-secondary);
  background: rgba(60, 240, 197, 0.12);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.room-join-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.room-input {
  flex: 1;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
}

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

/* Lists */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-count {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: var(--text-primary);
  margin-left: 6px;
}

.online-list, .contacts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.candidate-item, .contact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
}

.candidate-item:hover, .contact-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(2px);
}

.item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #FFF;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.empty-state {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ═══ SCREEN: SEARCHING (RADAR) ═════════════════════════════════ */
.search-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
}

.radar {
  position: relative;
  width: 170px;
  height: 170px;
  margin-bottom: 32px;
}

.radar-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  border: 1.5px solid var(--accent-primary);
  transform: translate(-50%, -50%);
  animation: radar-sweep 2.4s ease-out infinite;
}

.ring-1 { width: 45px; height: 45px; animation-delay: 0s; }
.ring-2 { width: 45px; height: 45px; animation-delay: 0.8s; }
.ring-3 { width: 45px; height: 45px; animation-delay: 1.6s; }

@keyframes radar-sweep {
  0% { width: 45px; height: 45px; opacity: 1; border-width: 2px; }
  100% { width: 170px; height: 170px; opacity: 0; border-width: 0.5px; }
}

.radar-center-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 20px var(--accent-primary);
  transform: translate(-50%, -50%);
}

.search-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.search-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

/* ═══ SCREEN: INVITATION MODAL ══════════════════════════════════ */
.invitation-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.invitation-card {
  width: 100%;
  max-width: 340px;
  padding: 32px 24px;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-md), 0 0 40px var(--accent-glow);
}

.invitation-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.invitation-msg {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.invitation-actions {
  display: flex;
  gap: 10px;
}

.invitation-actions button {
  flex: 1;
}

/* ═══ SCREEN: CHAT ══════════════════════════════════════════════ */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top, 0px)) calc(18px + env(safe-area-inset-right, 0px)) 14px calc(18px + env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--glass-border);
  background: rgba(15, 21, 33, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 5;
  flex-shrink: 0;
}

.chat-peer-info {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.peer-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Connection state indicator: connecting (amber pulse) · live (green) · disconnected (red) */
.peer-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--success);
  transition: color var(--transition);
}

.peer-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  flex-shrink: 0;
}

.peer-status[data-state="connecting"] {
  color: var(--warning);
}

.peer-status[data-state="connecting"]::before {
  animation: status-pulse 1.1s ease-in-out infinite;
}

.peer-status[data-state="disconnected"] {
  color: var(--danger);
}

.peer-status[data-state="disconnected"]::before {
  box-shadow: none;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y pinch-zoom;
  overscroll-behavior-y: contain;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  max-width: 82%;
  padding: 10px 15px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  animation: msg-appear 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}

@keyframes msg-appear {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Bubbles grow out of their own corner */
.message.sent { transform-origin: bottom right; }
.message.received { transform-origin: bottom left; }

.message.sent {
  align-self: flex-end;
  background: var(--accent-primary);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}

.message.received {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.message-sender {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-secondary);
  margin-bottom: 2px;
  display: block;
}

.message-time {
  font-size: 10px;
  opacity: 0.65;
  margin-top: 4px;
  display: block;
}

.message-system {
  align-self: center;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  animation: sys-appear 0.3s ease-out both;
}

@keyframes sys-appear {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

/* "New messages" pill — shown when a message arrives while scrolled up */
.jump-latest {
  position: absolute;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--glass-border-focus);
  background: rgba(15, 21, 33, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-md), 0 0 18px var(--accent-glow);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity var(--transition), transform var(--transition);
}

.jump-latest.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.jump-latest:hover {
  border-color: var(--accent-primary);
}

/* Typing Indicator */
.chat-typing {
  padding: 4px 16px 8px;
  flex-shrink: 0;
}

.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-jump 1.2s infinite ease-in-out;
}

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

@keyframes typing-jump {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Input Area */
.chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--glass-border);
  background: rgba(15, 21, 33, 0.9);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--glass-border);
  background: rgba(10, 14, 23, 0.6);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  outline: none;
}

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

.btn-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--gradient-brand);
  color: #FFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
  flex-shrink: 0;
}

.btn-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}

.btn-send:not(:disabled):hover {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(108, 99, 255, 0.5);
}

/* Copy-room button confirmation */
.btn-icon .icon-check {
  display: none;
}

.btn-icon.is-copied {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.12);
}

.btn-icon.is-copied .icon-copy {
  display: none;
}

.btn-icon.is-copied .icon-check {
  display: block;
  animation: pop-in 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

@keyframes pop-in {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ═══ TOAST & MODALS ════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 1000;
  transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
}

.toast::before {
  content: 'i';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  background: rgba(108, 99, 255, 0.2);
  color: var(--accent-primary);
}

.toast[data-type="success"] {
  border-color: rgba(16, 185, 129, 0.35);
}

.toast[data-type="success"]::before {
  content: '✓';
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.toast[data-type="error"] {
  border-color: rgba(239, 68, 68, 0.35);
}

.toast[data-type="error"]::before {
  content: '!';
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.toast.show {
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

/* ═══ OFFLINE / RECONNECT BANNER ════════════════════════════════ */
.net-banner {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 24px);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -16px);
  transition: opacity var(--transition), transform var(--transition), border-color var(--transition);
}

.net-banner.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.net-banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--warning);
  box-shadow: 0 0 8px var(--warning);
  animation: status-pulse 1.1s ease-in-out infinite;
}

.net-banner[data-state="online"] {
  border-color: rgba(16, 185, 129, 0.4);
}

.net-banner[data-state="online"] .net-banner-dot {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: none;
}

/* ═══ REDUCED MOTION ════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .message,
  .message-system,
  .btn-icon.is-copied .icon-check,
  .peer-status[data-state="connecting"]::before,
  .net-banner-dot {
    animation: none;
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
