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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

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

.header h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
}

.header p {
  opacity: 0.9;
  font-size: 1.1em;
}

.content {
  padding: 30px;
}

.preset-selector {
  margin-bottom: 30px;
}

.preset-selector label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #333;
}

.preset-selector select {
  width: 100%;
  padding: 12px;
  border: 2px solid #e1e5e9;
  border-radius: 10px;
  font-size: 16px;
  background: white;
  transition: border-color 0.3s;
}

.preset-selector select:focus {
  outline: none;
  border-color: #667eea;
}

.chat-container {
  border: 2px solid #e1e5e9;
  border-radius: 15px;
  height: 400px;
  overflow-y: auto;
  padding: 20px;
  margin-bottom: 20px;
  background: #f8f9fa;
}

.message {
  margin-bottom: 15px;
  padding: 12px 16px;
  border-radius: 15px;
  max-width: 80%;
  word-wrap: break-word;
}

.message.user {
  background: #667eea;
  color: white;
  margin-left: auto;
  text-align: right;
}

.message.assistant {
  background: white;
  color: #333;
  border: 1px solid #e1e5e9;
}

.message.system {
  background: #f8f9fa;
  color: #666;
  font-style: italic;
  text-align: center;
  margin: 0 auto;
}

.input-container {
  display: flex;
  gap: 10px;
}

.input-container input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e1e5e9;
  border-radius: 25px;
  font-size: 16px;
  transition: border-color 0.3s;
}

.input-container input:focus {
  outline: none;
  border-color: #667eea;
}

.input-container button {
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

.input-container button:hover {
  transform: translateY(-2px);
}

.input-container button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.stream-indicator {
  display: none;
  color: #667eea;
  font-size: 14px;
  margin-top: 10px;
  text-align: center;
}

.stream-indicator.active {
  display: block;
}

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.error {
  background: #ff6b6b;
  color: white;
  padding: 10px;
  border-radius: 10px;
  margin: 10px 0;
}

.preset-info {
  background: #e8f4fd;
  border: 1px solid #b3d9ff;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 20px;
}

.preset-info h3 {
  color: #0066cc;
  margin-bottom: 5px;
}

.preset-info p {
  color: #666;
  font-size: 14px;
}

/* 流式相关样式 */
.input-container {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.input-container button {
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
  white-space: nowrap;
}

.input-container button:hover {
  transform: translateY(-2px);
}

.input-container button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

#streamButton {
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

#stopButton {
  background: linear-gradient(135deg, #ff6b6b 0%, #ff5252 100%);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }

  100% {
    opacity: 1;
  }
}

/* 设置面板样式 */
.settings-panel {
  margin-top: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  border: 1px solid #e1e5e9;
}

.settings-panel h4 {
  margin-bottom: 15px;
  color: #333;
  font-size: 16px;
}

.setting-item {
  margin-bottom: 10px;
}

.setting-item label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  color: #555;
}

.setting-item input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.1);
}

/* 消息时间戳样式 */
.message-timestamp {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 5px;
}

/* 流式消息动画 */
.message.assistant.streaming {
  position: relative;
}

.message.assistant.streaming::after {
  content: '▋';
  animation: blink 1s infinite;
  color: #667eea;
}

@keyframes blink {

  0%,
  50% {
    opacity: 1;
  }

  51%,
  100% {
    opacity: 0;
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .input-container {
    flex-direction: column;
  }

  .input-container button {
    width: 100%;
    margin-top: 5px;
  }

  .container {
    margin: 10px;
    border-radius: 15px;
  }

  .header {
    padding: 20px;
  }

  .header h1 {
    font-size: 2em;
  }

  .content {
    padding: 20px;
  }

  .chat-container {
    height: 300px;
  }
}
