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

body {
  font-family: -apple-system, BlinkMacSystemFont, '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: 95vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 18px;
  font-weight: 600;
}

.header .subtitle {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 2px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.btn-small {
  padding: 6px 14px;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  background: rgba(255,255,255,0.2);
  color: #fff;
  transition: background 0.2s;
}

.btn-small:hover {
  background: rgba(255,255,255,0.35);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome {
  text-align: center;
  color: #888;
  padding: 40px 20px;
}

.welcome h2 {
  color: #667eea;
  font-size: 20px;
  margin-bottom: 12px;
}

.welcome p {
  line-height: 1.8;
  max-width: 480px;
  margin: 0 auto;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 85%;
  animation: fadeIn 0.3s ease;
}

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

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

.message.assistant {
  align-self: flex-start;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.message.assistant .avatar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.message.user .avatar {
  background: #e0e0e0;
}

.bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
}

.message.assistant .bubble {
  background: #f5f5f7;
  color: #333;
  border-bottom-left-radius: 4px;
}

.message.user .bubble {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble p {
  margin-bottom: 8px;
}

.bubble p:last-child {
  margin-bottom: 0;
}

.bubble strong {
  font-weight: 600;
}

.input-area {
  padding: 12px 16px 16px;
  border-top: 1px solid #eee;
  background: #fff;
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.input-row textarea {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  max-height: 120px;
  font-family: inherit;
}

.input-row textarea:focus {
  border-color: #667eea;
}

.btn-send {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.btn-send:hover {
  opacity: 0.9;
}

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

.quick-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.quick-actions button {
  padding: 6px 14px;
  border: 1px solid #ddd;
  border-radius: 16px;
  background: #f8f9fa;
  color: #555;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-actions button:hover {
  border-color: #667eea;
  color: #667eea;
  background: #f0f2ff;
}

.typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

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

.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing 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; }
}

/* Markdown 样式 */
.bubble h1, .bubble h2, .bubble h3, .bubble h4 {
  margin: 12px 0 8px;
  font-weight: 600;
}

.bubble h1 { font-size: 16px; }
.bubble h2 { font-size: 15px; }
.bubble h3 { font-size: 14px; }

.bubble ul, .bubble ol {
  margin: 8px 0;
  padding-left: 20px;
}

.bubble li {
  margin: 4px 0;
}

.bubble blockquote {
  margin: 8px 0;
  padding-left: 12px;
  border-left: 3px solid #667eea;
  color: #666;
}

.bubble code {
  background: rgba(0,0,0,0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.bubble pre {
  background: #f4f4f4;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
}

.bubble pre code {
  background: none;
  padding: 0;
}

.bubble hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 12px 0;
}

/* 滚动条 */
.messages::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}
