.mobile-chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  flex-direction: column;
  background: linear-gradient(135deg, #0a0f1a 0%, #1a1f2e 50%, #0d1420 100%);
}

.mobile-chat-overlay.active {
  display: flex;
}

.mobile-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(13, 17, 23, 0.95);
  border-bottom: 1px solid rgba(0, 255, 157, 0.2);
  flex-shrink: 0;
  padding-top: max(12px, env(safe-area-inset-top));
}

.mobile-chat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Syne Mono', monospace;
  color: #00ff9d;
  font-size: 16px;
}

.mobile-chat-title .pulse {
  width: 8px;
  height: 8px;
  background: #00ff9d;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.mobile-chat-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 107, 107, 0.2);
  border: 1px solid rgba(255, 107, 107, 0.4);
  color: #ff6b6b;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.mobile-chat-close:active {
  background: rgba(255, 107, 107, 0.4);
  transform: scale(0.95);
}

.mobile-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.chat-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-family: 'Syne Mono', monospace;
  font-size: 14px;
  line-height: 1.5;
  animation: messageIn 0.3s ease-out;
}

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

.chat-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #00ff9d 0%, #00cc7a 100%);
  color: #0a0f1a;
  border-bottom-right-radius: 4px;
}

.chat-message.assistant {
  align-self: flex-start;
  background: rgba(45, 55, 72, 0.8);
  color: #e2e8f0;
  border: 1px solid rgba(0, 255, 157, 0.2);
  border-bottom-left-radius: 4px;
}

.chat-message.system {
  align-self: center;
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
  font-size: 12px;
  padding: 8px 16px;
}

.chat-message.error {
  align-self: center;
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: rgba(45, 55, 72, 0.8);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #00ff9d;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

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

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

.mobile-chat-input-area {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(13, 17, 23, 0.98);
  border-top: 1px solid rgba(0, 255, 157, 0.2);
  flex-shrink: 0;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.mobile-chat-input {
  flex: 1;
  background: rgba(45, 55, 72, 0.6);
  border: 1px solid rgba(0, 255, 157, 0.3);
  border-radius: 24px;
  padding: 12px 20px;
  color: #e2e8f0;
  font-family: 'Syne Mono', monospace;
  font-size: 16px;
  outline: none;
  transition: all 0.2s;
}

.mobile-chat-input:focus {
  border-color: #00ff9d;
  box-shadow: 0 0 0 3px rgba(0, 255, 157, 0.1);
}

.mobile-chat-input::placeholder {
  color: rgba(226, 232, 240, 0.4);
}

.mobile-chat-send {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00ff9d 0%, #00cc7a 100%);
  border: none;
  color: #0a0f1a;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.mobile-chat-send:active {
  transform: scale(0.95);
}

.mobile-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mobile-chat-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00ff9d 0%, #00cc7a 100%);
  border: none;
  color: #0a0f1a;
  font-size: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 255, 157, 0.4);
  z-index: 1000;
  transition: all 0.3s;
}

.mobile-chat-fab:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  .mobile-chat-fab {
    display: flex;
  }
}

.welcome-message {
  text-align: center;
  padding: 40px 20px;
  color: rgba(226, 232, 240, 0.6);
  font-family: 'Syne Mono', monospace;
}

.welcome-message h2 {
  color: #00ff9d;
  font-size: 24px;
  margin-bottom: 12px;
}

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

.welcome-message .hint {
  margin-top: 20px;
  font-size: 12px;
  color: rgba(167, 139, 250, 0.8);
}
