* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Microsoft Yahei', sans-serif;
}

body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}

.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 24px;
  text-align: center;
}

.header h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 14px;
  opacity: 0.9;
}

.chat-container {
  padding: 20px;
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.status {
  text-align: center;
  padding: 12px;
  background: #f5f5f5;
  border-radius: 8px;
  margin-bottom: 16px;
  color: #666;
}

.messages {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 16px;
  padding: 12px;
  background: #fafafa;
  border-radius: 8px;
}

.message {
  margin-bottom: 12px;
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 16px;
  line-height: 1.4;
}

.message.self {
  background: #667eea;
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.message.other {
  background: #e5e5ea;
  color: #333;
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

.message .time {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 4px;
  text-align: right;
}

.input-area {
  display: flex;
  gap: 8px;
}

#messageInput {
  flex: 1;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 24px;
  outline: none;
  transition: border-color 0.3s;
}

#messageInput:focus {
  border-color: #667eea;
}

#sendBtn {
  background: #667eea;
  color: white;
  border: none;
  padding: 0 20px;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.3s;
}

#sendBtn:hover {
  background: #5568d3;
}

#sendBtn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.footer {
  padding: 16px 20px;
  text-align: center;
  border-top: 1px solid #eee;
}

.footer p {
  color: #999;
  font-size: 14px;
  margin-bottom: 12px;
}

#reconnectBtn {
  background: #667eea;
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.3s;
}

#reconnectBtn:hover {
  background: #5568d3;
}