* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #14b8a6;
  --cyan: #06b6d4;
  --bg-grad-1: #e0f2fe;
  --bg-grad-2: #ccfbf1;
  --bg-grad-3: #e0e7ff;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.6);
  --text-main: #1e293b;
  --text-sub: #64748b;
  --danger: #dc2626;
  --ai-green: #059669;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  height: 100vh;
  display: flex;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-grad-1), var(--bg-grad-2), var(--bg-grad-3));
  background-size: 300% 300%;
  animation: bgShift 16s ease infinite;
}

@keyframes bgShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 装饰光斑 */
body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}
body::before {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(20,184,166,0.3), transparent);
  top: -100px; left: -100px;
  animation: float 12s ease-in-out infinite;
}
body::after {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(6,182,212,0.25), transparent);
  bottom: -80px; right: -80px;
  animation: float 14s ease-in-out infinite reverse;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, 20px); }
}

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 760px;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== 毛玻璃头部 ===== */
.header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.header-icon {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 14px rgba(13,148,136,0.35);
  animation: iconPulse 3s ease-in-out infinite;
}
@keyframes iconPulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(13,148,136,0.35); }
  50% { box-shadow: 0 4px 22px rgba(13,148,136,0.55); }
}

.header-text { flex: 1; }
.header-text h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.5px;
}
.header-text p {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 2px;
}

/* 在线状态 */
.status-dot {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  background: rgba(13,148,136,0.08);
  padding: 4px 10px;
  border-radius: 20px;
}
.status-dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--primary-light);
  animation: dotBlink 2s ease-in-out infinite;
}
@keyframes dotBlink {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(20,184,166,0.4); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(20,184,166,0); }
}

/* ===== 聊天区域 ===== */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

/* 自定义滚动条 */
.chat-area::-webkit-scrollbar { width: 5px; }
.chat-area::-webkit-scrollbar-track { background: transparent; }
.chat-area::-webkit-scrollbar-thumb {
  background: rgba(13,148,136,0.2);
  border-radius: 10px;
}
.chat-area::-webkit-scrollbar-thumb:hover { background: rgba(13,148,136,0.4); }

/* ===== 欢迎卡片 ===== */
.welcome-card {
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 6px;
  box-shadow: var(--shadow-md);
  animation: cardIn 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.welcome-card h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}
.welcome-card p {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.7;
  margin-bottom: 18px;
}

/* 功能亮点 */
.features {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.feature {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--primary-dark);
  background: rgba(13,148,136,0.06);
  padding: 5px 12px;
  border-radius: 16px;
  font-weight: 500;
}
.feature .f-icon { font-size: 14px; }

/* 快捷标签 */
.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.tag {
  padding: 8px 16px;
  border: 1.5px solid rgba(13,148,136,0.2);
  border-radius: 22px;
  background: rgba(255,255,255,0.8);
  font-size: 13px;
  color: var(--primary-dark);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  font-weight: 500;
}
.tag:hover {
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(13,148,136,0.3);
}
.tag:active { transform: translateY(0); }

/* ===== 消息气泡 ===== */
.msg {
  display: flex;
  gap: 10px;
  max-width: 86%;
  animation: msgIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.bot { align-self: flex-start; }

.msg-avatar {
  width: 36px; height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: var(--shadow-sm);
}
.msg.user .msg-avatar {
  background: linear-gradient(135deg, #64748b, #475569);
  border-radius: 50%;
}
.msg.bot .msg-avatar {
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  border-radius: 12px;
}

.msg-bubble {
  padding: 13px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  position: relative;
}
.msg.user .msg-bubble {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 3px 12px rgba(13,148,136,0.25);
}
.msg.bot .msg-bubble {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-sm);
}

/* 急症消息 - 红色脉冲 */
.msg.emergency .msg-bubble {
  background: rgba(254,242,242,0.9);
  border: 1.5px solid #fca5a5;
  animation: emergencyPulse 2s ease-in-out infinite;
}
@keyframes emergencyPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.15); }
  50% { box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}
.msg.emergency .msg-avatar {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  animation: emergencyPulse 2s ease-in-out infinite;
}

/* AI增强回答 */
.msg.ai-enhanced .msg-bubble {
  background: rgba(236,253,245,0.9);
  border: 1px solid #6ee7b7;
}
.msg.ai-enhanced .msg-avatar {
  background: linear-gradient(135deg, #10b981, #059669);
}
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #fff;
  background: linear-gradient(135deg, #10b981, #059669);
  border-radius: 6px;
  padding: 2px 8px;
  margin-bottom: 8px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* ===== 打字动画 ===== */
.typing { display: flex; gap: 5px; padding: 6px 2px; align-items: center; }
.typing span {
  width: 7px; height: 7px;
  background: var(--primary-light);
  border-radius: 50%;
  animation: bounce 1.3s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-7px); opacity: 1; }
}

/* ===== 输入区域 ===== */
.input-area {
  padding: 14px 20px 10px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}
.input-wrap { display: flex; gap: 10px; align-items: center; }
.input-wrap input {
  flex: 1;
  padding: 12px 18px;
  border: 1.5px solid rgba(13,148,136,0.15);
  border-radius: 26px;
  font-size: 14px;
  outline: none;
  background: rgba(255,255,255,0.8);
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  color: var(--text-main);
}
.input-wrap input::placeholder { color: #94a3b8; }
.input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(13,148,136,0.1);
  background: #fff;
}
.input-wrap button {
  padding: 12px 22px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  color: #fff;
  border: none;
  border-radius: 26px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 4px 14px rgba(13,148,136,0.3);
  display: flex;
  align-items: center;
  gap: 5px;
}
.input-wrap button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(13,148,136,0.4);
}
.input-wrap button:active { transform: translateY(0); }
.input-wrap button:disabled {
  background: #cbd5e1;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.disclaimer {
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 8px;
}

/* ===== 移动端适配 ===== */
@media (max-width: 480px) {
  .header { padding: 12px 16px; }
  .header-icon { width: 38px; height: 38px; font-size: 18px; }
  .header-text h1 { font-size: 15px; }
  .status-dot { display: none; }
  .chat-area { padding: 14px; }
  .msg { max-width: 92%; }
  .welcome-card { padding: 20px 16px; }
  .features { gap: 8px; }
  .feature { font-size: 11px; padding: 4px 10px; }
  .input-area { padding: 10px 14px 8px; }
  .input-wrap input { padding: 10px 14px; font-size: 13px; }
  .input-wrap button { padding: 10px 16px; font-size: 13px; }
}