* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f5f1ed;
  color: #3d3d3d;
  line-height: 1.6;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  padding: 20px;
  text-align: center;
  background: #fff;
  border-bottom: 1px solid #e8e2dc;
}

.header h1 {
  font-size: 22px;
  color: #5c4d44;
  font-weight: 600;
}

.subtitle {
  font-size: 13px;
  color: #8c8078;
  margin-top: 4px;
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  max-width: 85%;
}

.message.bot {
  align-self: flex-start;
}

.message.user {
  align-self: flex-end;
  justify-content: flex-end;
}

.bubble {
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 15px;
  white-space: pre-wrap;
}

.message.bot .bubble {
  background: #fff;
  color: #4a4a4a;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.message.user .bubble {
  background: #8c7b6e;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.crisis-banner {
  background: #fff3f3;
  color: #8a3a3a;
  padding: 14px 20px;
  font-size: 14px;
  border-top: 1px solid #f0d6d6;
}

.crisis-banner.hidden {
  display: none;
}

.input-area {
  background: #fff;
  border-top: 1px solid #e8e2dc;
  padding: 14px 20px 20px;
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.option-btn {
  background: #f5f1ed;
  border: 1px solid #ddd5cc;
  color: #5c4d44;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.option-btn:hover {
  background: #ebe4dc;
}

.text-input-row {
  display: flex;
  gap: 10px;
}

#userInput {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #ddd5cc;
  border-radius: 24px;
  font-size: 15px;
  outline: none;
}

#userInput:focus {
  border-color: #a8988a;
}

#sendBtn {
  background: #8c7b6e;
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: 24px;
  font-size: 15px;
  cursor: pointer;
}

#sendBtn:hover {
  background: #7a6a5e;
}

.system-note {
  text-align: center;
  color: #9a9089;
  font-size: 12px;
  margin: 8px 0;
}

/* 语音按钮 */
.icon-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid #ddd5cc;
  background: #f5f1ed;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover { background: #ebe4dc; }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.icon-btn.recording {
  background: #c96a5a;
  border-color: #c96a5a;
  color: #fff;
  animation: pulse 1.2s ease-in-out infinite;
}

.icon-btn.active {
  background: #8c7b6e;
  border-color: #8c7b6e;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 106, 90, 0.45); }
  50% { box-shadow: 0 0 0 10px rgba(201, 106, 90, 0); }
}

/* AI 回复的朗读按钮：bot 消息改为纵向排列 */
.message.bot {
  flex-direction: column;
  align-items: flex-start;
}

/* 回复操作栏：朗读在左，👍/👎 在右 */
.msg-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 4px;
  gap: 8px;
}

.fb-group {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.fb-btn {
  border: 1px solid #e0d8cf;
  background: #fff;
  border-radius: 14px;
  padding: 2px 10px;
  font-size: 13px;
  cursor: pointer;
  color: #8c8078;
  transition: all 0.2s;
}

.fb-btn:hover { background: #f5f1ed; }
.fb-btn.active { background: #ebe4dc; color: #5c4d44; border-color: #a8988a; }

/* 👎 原因标签：内联展开，非弹窗 */
.fb-chips {
  display: none;
  position: absolute;
  right: 0;
  top: 32px;
  background: #fff;
  border: 1px solid #e8e2dc;
  border-radius: 12px;
  padding: 6px;
  gap: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  z-index: 5;
  white-space: nowrap;
}

.fb-chips.show { display: flex; }

.fb-chip {
  border: 1px solid #e0d8cf;
  background: #f5f1ed;
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  color: #5c4d44;
}

.fb-chip:hover { background: #ebe4dc; }

.tts-btn {
  margin-top: 0;
  padding: 2px 10px;
  border: none;
  background: transparent;
  color: #a8988a;
  font-size: 12px;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s;
}

.tts-btn:hover { background: #ebe4dc; color: #5c4d44; }
.tts-btn.speaking { color: #c96a5a; }

@media (max-width: 480px) {
  .icon-btn { width: 40px; height: 40px; font-size: 16px; }
}
