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

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f0f2f5;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.chat-container {
  width: 100%;
  max-width: 720px;
  height: 90vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 16px 24px;
  background: #4f46e5;
  color: #fff;
}

.chat-header h1 {
  font-size: 1.1rem;
  font-weight: 600;
}

/* 消息列表区，超出时滚动 */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 单条消息气泡 */
.message {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.6;
  font-size: 0.95rem;
  white-space: pre-wrap;   /* 保留换行符 */
  word-break: break-word;
}

.message.user {
  align-self: flex-end;
  background: #4f46e5;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.assistant {
  align-self: flex-start;
  background: #f1f3f5;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
}

/* 底部输入区 */
.input-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid #e9ecef;
  background: #fff;
}

.input-area textarea {
  flex: 1;
  resize: none;
  border: 1px solid #ced4da;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.2s;
  max-height: 160px;
  overflow-y: auto;
}

.input-area textarea:focus {
  border-color: #4f46e5;
}

.input-area button {
  padding: 10px 20px;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.input-area button:hover {
  background: #4338ca;
}

.input-area button:disabled {
  background: #a5b4fc;
  cursor: not-allowed;
}
