/* ============================================================
   会心 MeetMind · 语音前台（访客页）
   视觉方向：东方精致 · 自然高端
   品牌：果邦翡翠绿 + 宋体展示字 + 玻璃高光质感
   ============================================================ */

/* ============================================================
   会心 MeetMind · 语音前台（多场景换壳主题）
   由 frontdesk.css 派生：色相参数化（--h），各场景页面内联设置 --h 换色
   ============================================================ */

:root {
  /* —— 场景主色：色相 --h（页面内联覆盖） —— */
  --h: 150;
  --sat: 50%;

  --gb-950: hsl(var(--h) 58% 9%);
  --gb-900: hsl(var(--h) 52% 16%);
  --gb-800: hsl(var(--h) 48% 24%);
  --gb-700: hsl(var(--h) 48% 30%);   /* 品牌主色 */
  --gb-600: hsl(var(--h) 50% 39%);
  --gb-500: hsl(var(--h) 54% 50%);   /* 亮色 */
  --gb-300: hsl(var(--h) 55% 78%);
  --gb-200: hsl(var(--h) 55% 88%);
  --gb-100: hsl(var(--h) 55% 94%);
  --gb-50:  hsl(var(--h) 55% 97%);

  /* —— 中性（带主色调的墨色，避免纯黑） —— */
  --ink:    hsl(var(--h) 22% 15%);
  --ink-2:  hsl(var(--h) 14% 32%);
  --muted:  hsl(var(--h) 8% 50%);
  --bg:     hsl(var(--h) 30% 97%);
  --card:   #FFFFFF;
  --border: hsl(var(--h) 18% 90%);

  --danger: #D64545;
  --danger-soft: #FBECEC;

  /* —— 字体 —— */
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "Noto Serif CJK SC", "SimSun", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;

  /* —— 缓动 —— */
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(120% 55% at 50% -8%, hsla(var(--h) 48% 27% / 0.12), transparent 62%),
    radial-gradient(90% 40% at 50% 112%, hsla(var(--h) 48% 27% / 0.07), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.fd-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100dvh;
  margin: 0 auto;
  max-width: 640px;
  position: relative;
}

/* ============================================================
   顶部品牌条
   ============================================================ */
.fd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px 14px;
  background: rgba(255, 255, 255, 0.88);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 10;
}

.fd-brand { display: flex; align-items: center; gap: 13px; }

.fd-logo {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 13px;
  background:
    linear-gradient(160deg, rgba(255,255,255,0.28), rgba(255,255,255,0) 42%),
    linear-gradient(135deg, var(--gb-600), var(--gb-800));
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    0 6px 16px hsla(var(--h) 48% 27% / 0.28);
}
.fd-logo svg { filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15)); }

.fd-brand__name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  line-height: 1.25;
}
.fd-brand__sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.04em;
}

.fd-brand__badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--gb-50);
  border: 1px solid var(--gb-100);
  color: var(--gb-700);
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.02em;
  transition: background .3s var(--ease), border-color .3s var(--ease), color .3s var(--ease);
}
.fd-brand__badge--live { background: var(--gb-100); border-color: var(--gb-200); }
.fd-brand__badge--busy { background: #FBF3E4; border-color: #F1E2C0; color: #B7791F; }

.fd-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #A4AAA0;
  transition: background .3s var(--ease);
}
.fd-brand__badge--live .fd-dot {
  background: var(--gb-500);
  box-shadow: 0 0 0 4px hsla(var(--h) 54% 50% / 0.16);
  animation: fd-blink 1.3s var(--ease) infinite;
}
.fd-brand__badge--busy .fd-dot { background: #E29A2B; }

@keyframes fd-blink { 0%,100%{opacity:1;} 50%{opacity:.35;} }

/* ============================================================
   中央舞台：翡翠头像 + 波形 + 字幕
   ============================================================ */
.fd-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 34px 22px 8px;
  overflow: hidden;
  position: relative;
}

/* 场景标签 */
.fd-stage::before {
  content: "智 能 语 音 接 待";
  font-family: var(--font-sans);
  font-size: 13px;
  letter-spacing: 0.32em;
  color: var(--gb-700);
  opacity: 0.62;
  margin-bottom: 22px;
}

/* —— 头像 —— */
.fd-avatar {
  position: relative;
  width: 156px; height: 156px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* 待机时的呼吸光晕（外层） */
.fd-avatar::before {
  content: "";
  position: absolute; inset: -14px;
  border-radius: 50%;
  background: radial-gradient(circle, hsla(var(--h) 54% 50% / 0.14) 0%, transparent 68%);
  animation: fd-halo 3.6s var(--ease) infinite;
}
@keyframes fd-halo {
  0%, 100% { transform: scale(0.96); opacity: 0.7; }
  50%      { transform: scale(1.05); opacity: 1; }
}

/* 对话中的扩散脉冲（由 js 加 .on 触发） */
.fd-avatar__pulse {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gb-200) 0%, transparent 68%);
  opacity: 0;
}
.fd-avatar__pulse.on { animation: fd-pulse 1.7s var(--ease-expo) infinite; }
@keyframes fd-pulse {
  0%   { transform: scale(0.82); opacity: 0.9; }
  100% { transform: scale(1.32); opacity: 0; }
}

/* 头像主体：翡翠质感 */
.fd-avatar__face {
  position: relative;
  width: 108px; height: 108px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(120% 120% at 30% 22%, rgba(255,255,255,0.34), rgba(255,255,255,0) 46%),
    linear-gradient(150deg, hsl(var(--h) 54% 44%) 0%, var(--gb-700) 55%, var(--gb-900) 100%);
  color: #fff;
  box-shadow:
    inset 0 2px 3px rgba(255,255,255,0.35),
    inset 0 -6px 12px hsla(var(--h) 58% 9% / 0.35),
    0 18px 42px hsla(var(--h) 48% 27% / 0.34),
    0 2px 6px hsla(var(--h) 58% 9% / 0.18);
  z-index: 2;
}
.fd-avatar__face::after {
  content: "";
  position: absolute; inset: 6px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.22);
  pointer-events: none;
}

.fd-avatar__char {
  font-family: var(--font-serif);
  font-size: 46px;
  font-weight: 700;
  line-height: 1;
  transform: translateY(-1px);
  text-shadow: 0 2px 8px hsla(var(--h) 58% 9% / 0.3);
}

/* —— 波形 —— */
.fd-wave {
  position: absolute;
  bottom: -10px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: flex-end; gap: 5px;
  height: 28px; z-index: 3;
}
.fd-wave i {
  width: 5px; height: 7px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--gb-300), var(--gb-500));
  box-shadow: 0 1px 3px hsla(var(--h) 48% 27% / 0.35);
  opacity: 0;
  transform-origin: bottom;
}
.fd-wave.on i { animation: fd-wave 1.05s var(--ease) infinite; }
.fd-wave.on i:nth-child(1){animation-delay:0s;}
.fd-wave.on i:nth-child(2){animation-delay:.12s;}
.fd-wave.on i:nth-child(3){animation-delay:.24s;}
.fd-wave.on i:nth-child(4){animation-delay:.36s;}
.fd-wave.on i:nth-child(5){animation-delay:.48s;}
@keyframes fd-wave {
  0%, 100% { height: 7px;  opacity: .35; }
  50%      { height: 26px; opacity: 1; }
}

/* ============================================================
   字幕区
   ============================================================ */
.fd-subtitle {
  width: 100%;
  margin-top: 22px;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.fd-subtitle__empty {
  text-align: center;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.8;
  padding: 22px 8px;
  letter-spacing: 0.01em;
}
.fd-subtitle__list { list-style: none; margin: 0; padding: 0 4px 16px; }

.fd-msg { display: flex; margin-bottom: 14px; animation: fd-rise .4s var(--ease) both; }
@keyframes fd-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fd-msg--agent { justify-content: flex-start; }
.fd-msg--user  { justify-content: flex-end; }

.fd-msg__bubble {
  max-width: 82%;
  padding: 11px 15px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.65;
  word-break: break-word;
  white-space: pre-wrap;
}
.fd-msg--agent .fd-msg__bubble {
  background: var(--card);
  border: 1px solid var(--border);
  border-top-left-radius: 5px;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(18, 36, 26, 0.05);
}
.fd-msg--user .fd-msg__bubble {
  background: linear-gradient(135deg, var(--gb-600), var(--gb-700));
  color: #fff;
  border-top-right-radius: 5px;
  box-shadow: 0 6px 16px hsla(var(--h) 48% 27% / 0.22);
}

/* ============================================================
   底部控制区
   ============================================================ */
.fd-controls {
  padding: 14px 22px calc(18px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.90);
  background: color-mix(in srgb, var(--card) 90%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  backdrop-filter: saturate(140%) blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 10;
}

.fd-hint {
  min-height: 18px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.01em;
  transition: color .25s var(--ease);
}

/* —— 按钮基座 —— */
.fd-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 56px;
  padding: 0 34px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 17px; font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  font-family: inherit;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: transform .18s var(--ease), box-shadow .28s var(--ease), background .28s var(--ease), border-color .28s var(--ease), color .28s var(--ease);
}
.fd-btn svg { width: 20px; height: 20px; flex-shrink: 0; }

/* —— 主按钮「开始对话」：翡翠质感 —— */
.fd-btn--talk {
  width: 100%;
  max-width: 320px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0) 46%),
    linear-gradient(135deg, var(--gb-500) 0%, var(--gb-700) 68%, var(--gb-800) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.38),
    inset 0 -2px 0 hsla(var(--h) 58% 9% / 0.28),
    0 10px 26px hsla(var(--h) 48% 27% / 0.34);
}
/* 待机呼吸光晕（吸引点击） */
.fd-btn--talk::after {
  content: "";
  position: absolute; inset: -5px;
  border-radius: inherit;
  background: radial-gradient(60% 100% at 50% 50%, hsla(var(--h) 54% 50% / 0.28), transparent 72%);
  opacity: 0;
  z-index: -1;
  transition: opacity .4s var(--ease);
  animation: fd-btn-halo 3.2s var(--ease) infinite;
}
@keyframes fd-btn-halo {
  0%, 100% { opacity: 0.35; transform: scale(0.99); }
  50%      { opacity: 0.8;  transform: scale(1.03); }
}
.fd-btn--talk:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.42),
    inset 0 -2px 0 hsla(var(--h) 58% 9% / 0.28),
    0 16px 34px hsla(var(--h) 48% 27% / 0.42);
}
.fd-btn--talk:not(:disabled):active {
  transform: translateY(0) scale(0.98);
  box-shadow:
    inset 0 2px 6px hsla(var(--h) 58% 9% / 0.3),
    0 5px 14px hsla(var(--h) 48% 27% / 0.28);
}
/* 对话中：按钮保持翡翠绿（表示进行中），仅停呼吸光晕 */
.fd-btn--talk:disabled {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0) 46%),
    linear-gradient(135deg, var(--gb-600), var(--gb-800));
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.28),
    inset 0 -2px 0 hsla(var(--h) 58% 9% / 0.24),
    0 6px 16px hsla(var(--h) 48% 27% / 0.22);
  cursor: default;
}
.fd-btn--talk:disabled::after { animation: none; opacity: 0; }

/* —— 次按钮「结束」：克制的描边按钮 —— */
.fd-btn--end {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  padding: 0 24px;
}
.fd-btn--end:not(:disabled):hover {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--danger-soft);
  transform: translateY(-1px);
}
.fd-btn--end:not(:disabled):active { transform: translateY(0) scale(0.97); }
.fd-btn--end:disabled { color: #C6CEC8; border-color: #EAEFEB; cursor: not-allowed; }

/* ============================================================
   非安全上下文横幅
   ============================================================ */
.fd-secure-banner {
  padding: 11px 16px;
  background: #FBECEC;
  border: 1px solid #F0C4C4;
  color: #A32D2D;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
  margin: 12px 20px 0;
  border-radius: 12px;
}

/* ============================================================
   响应式
   ============================================================ */
@media (min-width: 480px) {
  .fd-avatar { width: 178px; height: 178px; }
  .fd-avatar__face { width: 124px; height: 124px; }
  .fd-avatar__char { font-size: 52px; }
  .fd-brand__name { font-size: 17px; }
}

/* 偏好减少动效 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
