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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #f7f7f7;
  height: 100vh;
  overflow: hidden;
}

.screen {
  width: 100%;
  height: 100vh;
}

.hidden {
  display: none !important;
}

/* 文件输入框视觉隐藏（不用 display:none，避免 iOS 点击失效） */
.visually-hidden {
  position: absolute;
  opacity: 0;
  width: 0.1px;
  height: 0.1px;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

/* 登录界面 - 全新设计 */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  overflow: hidden;
}

.login-container::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  animation: float 6s ease-in-out infinite;
}

.login-container::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -5%;
  width: 400px;
  height: 400px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(5deg); }
}

.login-box {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 420px;
  padding: 50px 45px;
  animation: slideUp 0.6s ease-out;
}

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

.login-header {
  text-align: center;
  margin-bottom: 40px;
}

.login-logo {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto 20px;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
  animation: pulse 2s ease-in-out infinite;
}

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

.login-header h1 {
  color: #2d3748;
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 8px 0;
  letter-spacing: -0.5px;
}

.login-header p {
  color: #718096;
  font-size: 14px;
  margin: 0;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 35px;
  background: #f7fafc;
  border-radius: 12px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 12px 0;
  background: transparent;
  color: #718096;
  border: none;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  font-weight: 500;
  border-radius: 10px;
}

.auth-tab:hover {
  color: #667eea;
}

.auth-tab.active {
  color: white;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.input-group {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: #a0aec0;
  pointer-events: none;
  transition: color 0.3s;
  z-index: 1;
}

.auth-form input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  font-size: 15px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: white;
  transition: all 0.3s;
  color: #2d3748;
}

.auth-form input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.input-group input:focus ~ .input-icon {
  color: #667eea;
}

.auth-form input::placeholder {
  color: #cbd5e0;
}

.auth-form button {
  width: 100%;
  padding: 15px;
  font-size: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  margin-top: 10px;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  position: relative;
  overflow: hidden;
}

.auth-form button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s;
}

.auth-form button:hover::before {
  left: 100%;
}

.auth-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.auth-form button:active {
  transform: translateY(0);
}

/* 主界面 - 现代化设计 */
.app-container {
  display: flex;
  height: 100vh;
  background: #f8f9fa;
}

/* 侧边栏 */
.sidebar {
  width: 280px;
  background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.user-info {
  padding: 25px 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.user-info span {
  color: white;
  font-weight: 500;
  font-size: 15px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.user-actions {
  position: absolute;
  right: 20px;
  display: flex;
  gap: 10px;
}

.profile-btn,
.logout-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  transition: all 0.3s;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-btn:hover,
.logout-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.avatar {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 3px solid rgba(255, 255, 255, 0.3);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contacts-header {
  padding: 18px 20px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.add-contact-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.3s;
}

.add-contact-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.no-contacts {
  padding: 60px 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
}

.contacts-list {
  flex: 1;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.05);
}

.contacts-list::-webkit-scrollbar {
  width: 6px;
}

.contacts-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.contacts-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.contacts-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.contact-item {
  padding: 14px 20px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  transition: all 0.3s;
  color: white;
}

.contact-item:hover {
  background: rgba(255, 255, 255, 0.1);
  padding-left: 25px;
}

.contact-item.active {
  background: rgba(255, 255, 255, 0.2);
  border-left: 4px solid white;
  padding-left: 16px;
}

.contact-item .avatar {
  width: 50px;
  height: 50px;
  font-size: 22px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.contact-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contact-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.contact-name {
  font-weight: 600;
  font-size: 15px;
  color: white;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
  margin-left: 8px;
}

.contact-message {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.contact-item.active .contact-message {
  color: rgba(255, 255, 255, 0.85);
}

.unread-badge {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  border-radius: 12px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(245, 87, 108, 0.4);
  animation: bounce 0.5s ease;
}

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* 聊天区域 - 现代化设计 */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.chat-header {
  padding: 20px 30px;
  background: white;
  border-bottom: 1px solid #e8e8e8;
  font-weight: 600;
  font-size: 16px;
  color: #2d3748;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header::before {
  content: '💬';
  font-size: 20px;
}

.back-btn {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px 4px 0;
  color: #667eea;
  flex-shrink: 0;
}

.messages-container {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
}

.messages-container::-webkit-scrollbar {
  width: 8px;
}

.messages-container::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.messages-container::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 4px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 65%;
  align-items: flex-start;
  animation: messageSlide 0.3s ease-out;
}

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

.message.sent {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message .avatar {
  width: 42px;
  height: 42px;
  font-size: 20px;
  flex-shrink: 0;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-content {
  background: white;
  padding: 12px 16px;
  border-radius: 16px;
  word-wrap: break-word;
  line-height: 1.6;
  font-size: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #e8e8e8;
  position: relative;
}

.message.received .message-content::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 15px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 8px solid white;
}

.message.sent .message-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
}

.message.sent .message-content::before {
  content: '';
  position: absolute;
  right: -8px;
  top: 15px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 8px solid #764ba2;
}

.message-content img {
  max-width: 300px;
  max-height: 300px;
  border-radius: 12px;
  display: block;
}

.file-attachment {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
  max-width: 300px;
}

.file-attachment:hover {
  background: rgba(255, 255, 255, 0.15);
}

.message.sent .file-attachment {
  background: rgba(255, 255, 255, 0.2);
}

.message.sent .file-attachment:hover {
  background: rgba(255, 255, 255, 0.3);
}

.file-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  font-size: 12px;
  opacity: 0.8;
}

.message-time {
  font-size: 11px;
  color: #a0aec0;
  margin-top: 6px;
  text-align: center;
  font-weight: 500;
}

/* 输入区域 - 现代化设计 */
.input-area {
  padding: 20px 30px;
  background: white;
  border-top: 1px solid #e8e8e8;
  display: flex;
  gap: 12px;
  align-items: center;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.tools-toggle-btn {
  display: none; /* 桌面端隐藏 */
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 22px;
  border: none;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  flex-shrink: 0;
}

.tools-toggle-btn.open {
  transform: rotate(45deg);
}

.tools-panel {
  display: flex;
  gap: 8px;
  align-items: center;
}

.image-btn,
.file-btn,
.voice-btn {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 22px;
  border: none;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  flex-shrink: 0;
}

.image-btn:hover,
.file-btn:hover,
.voice-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.voice-btn.recording {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  animation: pulse-recording 1.5s ease-in-out infinite;
}

@keyframes pulse-recording {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.input-area input[type="text"] {
  flex: 1;
  padding: 12px 18px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  background: #f8f9fa;
  transition: all 0.3s;
  color: #2d3748;
}

.input-area input[type="text"]:focus {
  outline: none;
  border-color: #667eea;
  background: white;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.input-area input[type="text"]::placeholder {
  color: #cbd5e0;
}

.input-area button {
  padding: 12px 28px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.input-area button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.input-area button:active {
  transform: translateY(0);
}

.input-area button:disabled {
  background: #cbd5e0;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* 弹窗样式 - 现代化设计 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: white;
  padding: 35px;
  border-radius: 20px;
  width: 440px;
  max-width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlide 0.4s ease-out;
}

@keyframes modalSlide {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-content h2 {
  margin-bottom: 28px;
  color: #2d3748;
  font-size: 22px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-content h2::before {
  content: '✨';
  font-size: 24px;
}

.user-select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  margin-bottom: 28px;
  background: white;
  color: #2d3748;
  cursor: pointer;
  transition: all 0.3s;
}

.user-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.user-select:hover {
  border-color: #667eea;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-primary {
  padding: 12px 28px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary {
  padding: 12px 28px;
  background: #f7fafc;
  color: #4a5568;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.3s;
}

.btn-secondary:hover {
  background: #edf2f7;
  border-color: #cbd5e0;
}

/* 个人资料弹窗 */
.profile-modal {
  width: 520px;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 28px;
}

.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 30px 0;
  border-bottom: 2px solid #f7fafc;
  background: linear-gradient(180deg, #f8f9fa 0%, transparent 100%);
  border-radius: 12px;
  margin-bottom: 10px;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
  border: 4px solid white;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-upload-btn {
  padding: 10px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.avatar-upload-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-field label {
  font-size: 14px;
  color: #4a5568;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-field label::before {
  content: '•';
  color: #667eea;
  font-size: 18px;
}

.profile-field input,
.profile-field select,
.profile-field textarea {
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  background: white;
  color: #2d3748;
  transition: all 0.3s;
}

.profile-field input:focus,
.profile-field select:focus,
.profile-field textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.profile-field input:disabled {
  background: #f7fafc;
  color: #a0aec0;
  cursor: not-allowed;
  border-color: #e2e8f0;
}

.profile-field textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.profile-field select {
  cursor: pointer;
}

/* ===== 移动端响应式 ===== */
@media (max-width: 768px) {
  /* 登录界面适配 */
  .login-box {
    width: 92%;
    padding: 36px 24px;
    border-radius: 16px;
  }

  .login-header h1 {
    font-size: 22px;
  }

  /* 主界面：侧边栏和聊天区全屏切换 */
  .app-container {
    position: relative;
    overflow: hidden;
  }

  .sidebar {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 10;
    transition: transform 0.3s ease;
  }

  .chat-area {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }

  /* 进入聊天时：隐藏侧边栏，显示聊天区 */
  .app-container.chat-active .sidebar {
    transform: translateX(-100%);
  }

  .app-container.chat-active .chat-area {
    transform: translateX(0);
  }

  /* 返回按钮仅在移动端显示 */
  .back-btn {
    display: block;
  }

  /* 隐藏 chat-header 的 ::before 图标，让返回按钮占位 */
  .chat-header::before {
    display: none;
  }

  /* 聊天头部 */
  .chat-header {
    padding: 14px 16px;
  }

  /* 消息区域 */
  .messages-container {
    padding: 16px;
    gap: 14px;
  }

  /* 消息气泡最大宽度放宽 */
  .message {
    max-width: 85%;
  }

  /* 输入区域 */
  .input-area {
    padding: 8px 12px;
    gap: 8px;
    flex-wrap: wrap;
    position: sticky;
    bottom: 0;
  }

  /* 主输入行：展开按钮 + 输入框 + 发送 */
  .tools-toggle-btn {
    display: flex;
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  /* 工具面板默认隐藏，展开后整行显示 */
  .tools-panel {
    display: none;
    width: 100%;
    order: 3;
    padding: 6px 0 2px;
    gap: 12px;
    justify-content: flex-start;
  }

  .tools-panel.open {
    display: flex;
  }

  .image-btn,
  .file-btn,
  .voice-btn {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  .input-area input[type="text"] {
    padding: 10px 14px;
    font-size: 16px; /* 防止 iOS 自动缩放 */
    min-width: 0;
  }

  #sendBtn {
    padding: 10px 16px;
    font-size: 14px;
    flex-shrink: 0;
  }

  /* 联系人列表 */
  .user-info {
    padding: 20px 16px;
  }

  .contact-item {
    padding: 12px 16px;
  }

  /* 弹窗适配 */
  .modal-content {
    width: 95%;
    padding: 24px 20px;
    border-radius: 16px;
  }

  .profile-modal {
    width: 95%;
  }
}

/* 超小屏（375px以下） */
@media (max-width: 375px) {
  .login-box {
    padding: 28px 18px;
  }

  .image-btn,
  .file-btn,
  .voice-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .input-area button {
    padding: 10px 12px;
  }
}
