/* =========================================================
   AI问谱 · 精细化设计
   谱牒宣纸风 × AI对话科技感 × 高龄友好
   ========================================================= */

/* ---------- 全局氛围 ---------- */
.ai-page {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(166,43,31,0.04) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 100%, rgba(201,168,76,0.06) 0%, transparent 50%),
    linear-gradient(180deg, #FDF8ED 0%, #FAF2DE 100%) !important;
  position: relative;
}
/* 宣纸纹理 */
.ai-page::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent 0, transparent 48px, rgba(180,140,90,0.025) 48px, rgba(180,140,90,0.025) 49px),
    repeating-linear-gradient(90deg, transparent 0, transparent 48px, rgba(180,140,90,0.02) 48px, rgba(180,140,90,0.02) 49px);
  pointer-events: none; z-index: 0;
}
/* 四角回纹饰角 */
.ai-page::after {
  content: ''; position: fixed; inset: 16px;
  pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(90deg, #C9A84B 0 24px, transparent 24px calc(100% - 24px), #C9A84B calc(100% - 24px) 100%),
    linear-gradient(0deg, #C9A84B 0 24px, transparent 24px calc(100% - 24px), #C9A84B calc(100% - 24px) 100%);
  opacity: 0.15;
  border-radius: 8px;
}

/* ---------- 工具栏 ---------- */
.ai-toolbar { position: relative; z-index: 1; }
.back-btn {
  padding: 10px 18px !important;
  background: linear-gradient(135deg, #FFFFFF, #FFF8E8) !important;
  border: 1.5px solid #D4A84B !important;
  border-radius: 10px !important;
  color: #6B5842 !important;
  font-size: 15px !important;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(212,168,75,0.15);
  transition: all .25s ease;
}
.back-btn:hover {
  color: #A62B1F !important;
  border-color: #A62B1F !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(166,43,31,0.15);
}
.back-btn .back-arrow { font-size: 20px !important; }

.ai-breadcrumb { font-size: 15px !important; }
.ai-breadcrumb a { color: #8B6914 !important; }
.ai-breadcrumb .current { color: #A62B1F !important; font-family: KaiTi, serif; font-size: 16px; }

.clear-btn {
  padding: 10px 18px !important;
  background: linear-gradient(135deg, #FFFFFF, #FFF8E8) !important;
  border: 1.5px solid #E8C97A !important;
  border-radius: 10px !important;
  color: #8B6914 !important;
  font-size: 15px !important;
  box-shadow: 0 2px 8px rgba(212,168,75,0.12);
}
.clear-btn:hover:not(:disabled) {
  color: #A62B1F !important;
  border-color: #A62B1F !important;
  background: #FFE9E2 !important;
}

/* ---------- 欢迎区 ---------- */
.welcome-section {
  position: relative; z-index: 1;
  padding: 60px 20px 32px !important;
}
.welcome-icon {
  width: 96px !important; height: 96px !important;
  background: linear-gradient(135deg, #A62B1F, #C0503F, #A62B1F) !important;
  border: 3px solid #D4A84B !important;
  box-shadow: 0 8px 28px rgba(166,43,31,0.35), 0 0 0 6px rgba(212,168,75,0.15) !important;
  position: relative;
  animation: sealPulse 3s ease-in-out infinite;
}
@keyframes sealPulse {
  0%,100% { box-shadow: 0 8px 28px rgba(166,43,31,0.35), 0 0 0 6px rgba(212,168,75,0.15); }
  50% { box-shadow: 0 12px 36px rgba(166,43,31,0.45), 0 0 0 10px rgba(212,168,75,0.08); }
}
.welcome-icon img { width: 56px !important; height: 56px !important; filter: brightness(0) invert(0.95); }

.welcome-title {
  font-size: 30px !important;
  font-family: KaiTi, STKaiti, serif !important;
  color: #A62B1F !important;
  letter-spacing: 6px;
  margin-bottom: 10px !important;
  text-shadow: 0 2px 4px rgba(166,43,31,0.15);
}
.welcome-desc {
  font-size: 16px !important;
  color: #6B5842 !important;
  letter-spacing: 1px;
  margin-bottom: 24px !important;
}

.welcome-tips { gap: 10px !important; margin-bottom: 28px !important; }
.tip-item {
  font-size: 15px !important;
  color: #6B5842 !important;
  padding: 4px 0;
}
.tip-item .check {
  color: #A62B1F !important;
  font-size: 17px;
  margin-right: 4px;
}

/* 快捷问题 — 书签式 */
.quick-questions { gap: 12px !important; }
.quick-question {
  padding: 12px 20px !important;
  background: linear-gradient(135deg, #FFFFFF, #FFF8E8) !important;
  border: 1.5px solid #E8DCC3 !important;
  border-radius: 12px !important;
  font-size: 15px !important;
  color: #6B5842 !important;
  cursor: pointer;
  transition: all .25s ease;
  position: relative;
  box-shadow: 0 2px 6px rgba(212,168,75,0.08);
  font-family: KaiTi, STKaiti, serif;
  letter-spacing: 1px;
}
.quick-question::before {
  content: '◆';
  color: #C9A84B;
  margin-right: 8px;
  font-size: 11px;
  opacity: 0.7;
}
.quick-question:hover {
  color: #A62B1F !important;
  border-color: #A62B1F !important;
  background: linear-gradient(135deg, #FFF5F0, #FFFFFF) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(166,43,31,0.15);
}

/* ---------- 对话消息 ---------- */
.chat-scroll { position: relative; z-index: 1; }

.time-divider { margin: 24px 0 12px !important; }
.time-text {
  font-size: 13px !important;
  color: #8B6914 !important;
  background: rgba(201,168,75,0.1) !important;
  padding: 3px 14px !important;
  border-radius: 12px !important;
  letter-spacing: 2px;
}

.message-item { margin: 14px 0 !important; gap: 12px !important; }

/* 头像 */
.bubble-avatar {
  width: 44px !important; height: 44px !important;
  border-radius: 10px !important;
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}
.ai-avatar {
  background: linear-gradient(135deg, #A62B1F, #C0503F) !important;
  border: 2px solid #D4A84B !important;
}
.ai-avatar .avatar-img { padding: 8px !important; filter: brightness(0) invert(0.95); }
.message-item.user .bubble-avatar {
  background: linear-gradient(135deg, #8B6914, #C9A84B) !important;
  border: 2px solid #E8DCC3 !important;
}
.message-item.user .bubble-avatar::after {
  content: '我';
  color: #FFE9B8;
  font-size: 16px;
  font-family: KaiTi, serif;
  font-weight: bold;
}
.message-item.user .avatar-img { display: none; }

/* 气泡 */
.message-bubble {
  max-width: 72% !important;
  padding: 14px 18px !important;
  border-radius: 14px !important;
  font-size: 15px !important;
  line-height: 1.8 !important;
}
.message-bubble.user {
  background: linear-gradient(135deg, #A62B1F, #C0503F) !important;
  color: #FFE9B8 !important;
  border: 1.5px solid #8B4638 !important;
  border-top-right-radius: 4px !important;
  box-shadow: 0 4px 14px rgba(166,43,31,0.25);
  font-family: KaiTi, STKaiti, serif;
}
.message-bubble.user::after {
  content: '';
  position: absolute; right: -8px; top: 14px;
  width: 0; height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 10px solid #C0503F;
}
.message-bubble.ai {
  background: linear-gradient(135deg, #FFFBF0, #FFF5E0) !important;
  color: #3C2A1E !important;
  border: 1.5px solid #E8DCC3 !important;
  border-left: 3px solid #D4A84B !important;
  border-top-left-radius: 4px !important;
  box-shadow: 0 2px 10px rgba(201,168,75,0.12) !important;
}
.message-bubble.ai::before {
  content: '譜';
  position: absolute;
  top: -10px; left: 10px;
  width: 20px; height: 20px;
  background: #FFF7E6;
  border: 1px solid #E8DCC3;
  border-radius: 4px;
  font-size: 12px;
  color: #C9A84B;
  font-family: KaiTi, serif;
  display: flex; align-items: center; justify-content: center;
}
.message-bubble.loading { padding: 14px 20px !important; }

/* 候选者 */
.candidates-list {
  background: rgba(255,251,240,0.6);
  border: 1px dashed #D4A84B;
  border-radius: 10px;
  padding: 14px;
  margin-top: 14px !important;
}
.candidates-tip {
  font-size: 14px !important;
  color: #8B6914 !important;
  margin-bottom: 12px !important;
  font-family: KaiTi, serif;
}
.candidate-item {
  background: linear-gradient(135deg, #FFFFFF, #FFF8E8) !important;
  border: 1.5px solid #E8DCC3 !important;
  border-radius: 10px !important;
  padding: 14px 16px !important;
  margin-bottom: 10px !important;
  transition: all .25s ease;
}
.candidate-item:hover {
  border-color: #A62B1F !important;
  background: linear-gradient(135deg, #FFF5F0, #FFFFFF) !important;
  transform: translateX(4px) !important;
  box-shadow: 0 4px 14px rgba(166,43,31,0.12);
}
.candidate-name {
  font-size: 17px !important;
  color: #A62B1F !important;
  font-family: KaiTi, serif !important;
  font-weight: bold !important;
  letter-spacing: 2px;
}
.candidate-badge {
  font-size: 13px !important;
  padding: 2px 10px !important;
}
.candidate-info { font-size: 14px !important; }

/* ---------- 输入区 ---------- */
.input-area {
  position: relative; z-index: 2;
  padding: 16px 0 20px !important;
  background: linear-gradient(180deg, transparent, rgba(253,248,237,0.95) 30%) !important;
  backdrop-filter: blur(6px);
  border-top: 1.5px solid #D4A84B !important;
}
.input-wrapper { gap: 12px !important; }
.chat-input {
  padding: 14px 18px !important;
  border: 1.5px solid #D4A84B !important;
  border-radius: 12px !important;
  font-size: 16px !important;
  min-height: 52px !important;
  max-height: 160px !important;
  background: linear-gradient(135deg, #FFFFFF, #FFFBF0) !important;
  box-shadow: 0 2px 10px rgba(212,168,75,0.1) inset;
  transition: all .25s ease;
}
.chat-input:focus {
  border-color: #A62B1F !important;
  box-shadow: 0 0 0 4px rgba(166,43,31,0.1), 0 2px 10px rgba(212,168,75,0.1) inset !important;
}
.send-btn {
  padding: 0 28px !important;
  height: 52px !important;
  background: linear-gradient(135deg, #A62B1F, #C0503F, #A62B1F) !important;
  color: #FFE9B8 !important;
  border: 2px solid #D4A84B !important;
  border-radius: 12px !important;
  font-size: 16px !important;
  font-weight: bold !important;
  letter-spacing: 3px;
  font-family: KaiTi, serif;
  box-shadow: 0 4px 14px rgba(166,43,31,0.3);
  transition: all .25s ease;
}
.send-btn:hover:not(.disabled) {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 22px rgba(166,43,31,0.4) !important;
}
.send-btn.disabled {
  background: linear-gradient(135deg, #C9B896, #B0A080) !important;
  border-color: #B0A080 !important;
  color: #FFE9B8 !important;
}
.input-tip {
  font-size: 13px !important;
  color: #A08060 !important;
  margin-top: 10px !important;
  letter-spacing: 1px;
}

/* ---------- 加载动画 ---------- */
.loading-text { font-size: 15px !important; color: #8B6914 !important; font-family: KaiTi, serif; }
.loading-dots .dot {
  width: 8px !important; height: 8px !important;
  background: linear-gradient(135deg, #A62B1F, #C9A84B) !important;
}

/* ---------- 错误 ---------- */
.message-bubble.ai.error {
  background: linear-gradient(135deg, #FBF1F1, #FFE9E2) !important;
  border-color: #EAD2D2 !important;
  color: #A62B1F !important;
}
.error-retry {
  color: #A62B1F !important;
  font-size: 15px !important;
  font-weight: 500;
}

/* ---------- 引导弹窗 ---------- */
.guide-content {
  border: 2px solid #D4A84B !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 60px rgba(166,43,31,0.25) !important;
  background: linear-gradient(180deg, #FFFBF0, #FFFFFF) !important;
}
.guide-icon {
  width: 80px !important; height: 80px !important;
  background: linear-gradient(135deg, #A62B1F, #C0503F) !important;
  border: 3px solid #D4A84B !important;
  margin-bottom: 16px !important;
}
.guide-icon-img { width: 48px !important; height: 48px !important; filter: brightness(0) invert(0.95); }
.guide-title {
  font-size: 22px !important;
  color: #A62B1F !important;
  font-family: KaiTi, serif !important;
  letter-spacing: 4px;
}
.guide-step {
  width: 30px !important; height: 30px !important;
  font-size: 15px !important;
  background: linear-gradient(135deg, #A62B1F, #C0503F) !important;
  border: 2px solid #D4A84B;
}
.guide-item-title { font-size: 16px !important; color: #3C2A1E !important; font-weight: 600; }
.guide-item-desc { font-size: 15px !important; color: #8B6914 !important; }
.guide-btn {
  padding: 14px !important;
  background: linear-gradient(135deg, #A62B1F, #C0503F, #A62B1F) !important;
  border: 2px solid #D4A84B !important;
  border-radius: 12px !important;
  font-size: 16px !important;
  font-family: KaiTi, serif;
  letter-spacing: 4px;
  box-shadow: 0 6px 18px rgba(166,43,31,0.3);
}
.guide-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(166,43,31,0.4); }

/* ---------- 滚动条 ---------- */
.chat-scroll::-webkit-scrollbar { width: 8px !important; }
.chat-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #D4A84B, #E8C97A) !important;
  border-radius: 4px !important;
}
.chat-scroll::-webkit-scrollbar-track { background: rgba(201,168,75,0.08) !important; }

/* ---------- 入场动画 ---------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.message-wrapper { animation: fadeInUp .4s cubic-bezier(.2,.8,.2,1) !important; }
.welcome-section { animation: fadeInUp .6s ease-out; }
.quick-question { animation: fadeInUp .5s ease-out both; }
.quick-question:nth-child(1) { animation-delay: .05s; }
.quick-question:nth-child(2) { animation-delay: .1s; }
.quick-question:nth-child(3) { animation-delay: .15s; }
.quick-question:nth-child(4) { animation-delay: .2s; }
.quick-question:nth-child(5) { animation-delay: .25s; }
.quick-question:nth-child(6) { animation-delay: .3s; }
