* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #f5f5f5;
}

.container {
  width: 100%;
  height: 100%;
  max-width: 750px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: #fff;
  position: relative;
  overflow: hidden;
}

/* 导航状态栏 */
.nav-bar {
  display: none;
  background: #FFF5F0;
  padding: 24px 32px;
  align-items: center;
  border-bottom: 2px solid #FFE4D6;
}

.nav-bar.show {
  display: flex;
}

.nav-icon {
  font-size: 36px;
  margin-right: 24px;
}

.nav-info {
  flex: 1;
}

.nav-title {
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

.nav-direction {
  font-size: 16px;
  color: #E8824C;
  margin-top: 4px;
}

.nav-stop {
  color: #FF6B6B;
  font-size: 16px;
  padding: 10px 24px;
  background: #fff;
  border-radius: 40px;
  font-weight: 500;
  cursor: pointer;
}

/* 聊天区域 */
.chat-area {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* 欢迎页面 */
.welcome-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 24px 20px;
  background: linear-gradient(180deg, #FFF8F5 0%, #FFFFFF 100%);
}

.welcome-page.hide {
  display: none;
}

.welcome-icon {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(232, 130, 76, 0.2);
  border: 4px solid #fff;
  object-fit: cover;
}

.welcome-subtitle {
  font-size: 26px;
  color: #333;
  font-weight: 600;
  margin-bottom: 24px;
}

/* 快捷操作 */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 600px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 12px;
  background: #FFF9F5;
  border-radius: 20px;
  border: 2px solid #FFE8D8;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.quick-action:active {
  background: #FFE8D8;
  transform: scale(0.98);
}

.quick-action-icon {
  font-size: 36px;
}

.quick-action span {
  font-size: 18px;
  color: #666;
  font-weight: 500;
}

/* 消息列表 */
.message-list {
  padding: 16px 0 20px;
  display: none;
}

.message {
  margin-bottom: 24px;
  display: flex;
  width: 100%;
  padding: 0 16px;
}

.message.user {
  justify-content: flex-end;
}

.message.ai {
  justify-content: flex-start;
}

.message-content {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  max-width: 80%;
}

.message.user .message-content {
  flex-direction: row-reverse;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: #f5f5f5;
  flex-shrink: 0;
  overflow: hidden;
}

.ai-avatar {
  border: 2px solid #fff;
  box-shadow: 0 4px 12px rgba(232, 130, 76, 0.15);
}

.ai-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.message-bubble {
  max-width: 100%;
  padding: 20px 24px;
  border-radius: 24px;
  font-size: 22px;
  line-height: 1.6;
  word-break: break-word;
  display: inline-block;
}

.message.user .message-bubble {
  background: linear-gradient(135deg, #E8824C 0%, #F5A66B 100%);
  color: #fff;
  border-bottom-right-radius: 8px;
}

.message.ai .message-bubble {
  background: #F5F5F5;
  color: #333;
  border-bottom-left-radius: 8px;
}

/* 底部语音区域 - 统一背景 */
.voice-area {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF8F5 100%);
  padding: 16px 24px calc(20px + env(safe-area-inset-bottom));
  flex-shrink: 0;
}

.recognized-text {
  text-align: center;
  font-size: 20px;
  color: #ccc;
  margin-bottom: 12px;
  min-height: 30px;
  transition: all 0.3s;
}

.recognized-text.show {
  color: #E8824C;
  font-weight: 500;
}

.voice-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 36px;
}

.side-btn {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f8f8f8;
  cursor: pointer;
  user-select: none;
}

.side-btn span {
  font-size: 28px;
  color: #999;
  line-height: 1;
}

.more-btn span {
  font-size: 24px;
}

.mic-btn-wrapper {
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.mic-btn {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E8824C 0%, #F5A66B 100%);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(232, 130, 76, 0.35);
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
  cursor: pointer;
}

.mic-btn.active {
  background: linear-gradient(135deg, #FF6B6B 0%, #FF8E8E 100%);
  box-shadow: 0 8px 24px rgba(255, 107, 107, 0.4);
}

.mic-btn.speaking {
  background: linear-gradient(135deg, #4ECDC4 0%, #7EDDD6 100%);
  box-shadow: 0 8px 24px rgba(78, 205, 196, 0.4);
}

.mic-btn.listening {
  animation: breathe 1.5s ease-in-out infinite;
}

.mic-icon {
  font-size: 36px;
  line-height: 1;
}

.pulse-ring {
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid rgba(232, 130, 76, 0.4);
  animation: pulseRing 2s ease-out infinite;
  pointer-events: none;
}

.pulse-ring.delay {
  animation-delay: 1s;
}

@keyframes pulseRing {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.voice-hint {
  text-align: center;
  font-size: 20px;
  color: #999;
  margin-top: 20px;
  font-weight: 500;
}

.end-tip {
  text-align: center;
  font-size: 18px;
  color: #ccc;
  margin-top: 12px;
}

.count-hint {
  font-size: 12px;
  text-align: center;
  color: #999;
  margin-top: 2px;
}

/* 遮罩层 */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 50;
}

/* 更多菜单 */
.more-menu {
  position: fixed;
  top: 100px;
  right: 24px;
  width: 200px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  z-index: 100;
  overflow: hidden;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 24px 24px;
  gap: 16px;
  font-size: 22px;
  color: #333;
  border-bottom: 2px solid #f5f5f5;
  font-weight: 500;
  cursor: pointer;
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-item:active {
  background: #FFF9F5;
}

.menu-icon {
  font-size: 24px;
}

/* 设置弹窗 */
.settings-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-content {
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 2px solid #f5f5f5;
}

.settings-title {
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

.settings-close {
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.settings-section {
  margin-bottom: 24px;
}

.section-title {
  font-size: 16px;
  color: #E8824C;
  font-weight: 600;
  margin-bottom: 16px;
}

.config-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.config-btn {
  flex: 1;
  height: 48px;
  background: #f5f5f5;
  color: #666;
  border: 2px solid #eee;
  border-radius: 24px;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
}

.config-btn.active {
  background: linear-gradient(135deg, #E8824C 0%, #FFA07A 100%);
  color: #fff;
  border-color: transparent;
}

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

.setting-item label {
  display: block;
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}

.setting-item input {
  width: 100%;
  height: 44px;
  background: #f8f8f8;
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  font-size: 16px;
  outline: none;
}

.setting-item input:focus {
  background: #fff;
  box-shadow: 0 0 0 2px rgba(232, 130, 76, 0.3);
}

.save-btn {
  width: 100%;
  height: 52px;
  background: linear-gradient(135deg, #E8824C 0%, #FFA07A 100%);
  color: #fff;
  border: none;
  border-radius: 26px;
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 16px;
}

.save-btn:active {
  opacity: 0.9;
}

.tip-text {
  font-size: 13px;
  color: #999;
  line-height: 1.8;
  padding: 12px;
  background: #f9f9f9;
  border-radius: 8px;
}

/* 响应式适配 */
@media (max-width: 480px) {
  .welcome-icon {
    width: 140px;
    height: 140px;
  }
  
  .welcome-title {
    font-size: 28px;
  }
  
  .quick-actions {
    gap: 12px;
  }
  
  .quick-action {
    padding: 16px 8px;
  }
  
  .quick-action-icon {
    font-size: 32px;
  }
  
  .quick-action span {
    font-size: 13px;
  }
  
  .message-bubble {
    font-size: 17px;
  }
  
  .mic-btn-wrapper {
    width: 80px;
    height: 80px;
  }
  
  .mic-btn {
    width: 80px;
    height: 80px;
  }
  
  .pulse-ring {
    width: 90px;
    height: 90px;
  }
}
