:root {
  --green-1: #22c55e;
  --green-2: #16a34a;
  --green-deep: #15803d;
  --green-soft: #dcfce7;
  --green-soft-2: #bbf7d0;
  --bg: #eef5f0;
  --card: #ffffff;
  --ink: #1f2937;
  --ink-soft: #6b7280;
  --line: #e5e7eb;
  --shadow: 0 10px 30px rgba(22, 163, 74, .12);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, .06);
}

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

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 50% -10%, #f0fbf4 0%, var(--bg) 55%);
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

/* ---------- 顶部信息栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border-radius: 0 0 20px 20px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--green-1), var(--green-2));
  display: grid; place-items: center;
  box-shadow: 0 6px 14px rgba(22, 163, 74, .35);
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .5px; }
.brand-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--green-soft); color: var(--green-deep);
  font-size: 12px; font-weight: 600;
  padding: 6px 12px; border-radius: 999px;
}
.status-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green-2);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, .6);
}
.status-pill.listening { background: #fee2e2; color: #b91c1c; }
.status-pill.listening .dot { background: #ef4444; animation: pulseDot 1s infinite; }
.status-pill.thinking { background: #fef9c3; color: #a16207; }
.status-pill.thinking .dot { background: #eab308; }
.status-pill.speaking { background: var(--green-soft); color: var(--green-deep); }
.status-pill.speaking .dot { background: var(--green-1); animation: pulseDot 1.1s infinite; }

@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.help-btn {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; color: var(--green-2);
  font-weight: 700; cursor: pointer; font-size: 15px;
}
.help-btn:active { transform: scale(.94); }

/* ---------- 对话气泡区 ---------- */
.chat {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.msg { display: flex; gap: 8px; max-width: 100%; }
.msg.user { justify-content: flex-end; }
.msg.bot { justify-content: flex-start; }
.bubble {
  max-width: 78%;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
}
.msg.user .bubble {
  background: linear-gradient(135deg, var(--green-1), var(--green-2));
  color: #fff;
  border-bottom-right-radius: 5px;
}
.msg.bot .bubble {
  background: #fff;
  color: var(--ink);
  border-bottom-left-radius: 5px;
  border: 1px solid var(--line);
}
.msg.bot .avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--green-1), var(--green-2));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  align-self: flex-end;
}
.msg.user .avatar { display: none; }

.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%; background: #9ca3af;
  animation: blink 1.2s infinite both;
}
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---------- 中部主视觉 ---------- */
.hero {
  text-align: center;
  padding: 6px 16px 10px;
}
.hero-label {
  font-size: 13px; letter-spacing: 4px; color: var(--green-2);
  font-weight: 600; margin-bottom: 14px;
}
.orb {
  position: relative;
  width: 132px; height: 132px; border-radius: 50%;
  border: none; cursor: pointer; margin: 0 auto;
  background: radial-gradient(circle at 35% 30%, #4ade80, var(--green-2) 70%);
  color: #fff; font-size: 52px; font-weight: 800;
  display: grid; place-items: center;
  box-shadow: 0 16px 36px rgba(22, 163, 74, .38);
  transition: transform .2s ease;
}
.orb:active { transform: scale(.97); }
.orb.active { animation: orbPulse 1.6s infinite; }
@keyframes orbPulse {
  0% { box-shadow: 0 16px 36px rgba(22, 163, 74, .38), 0 0 0 0 rgba(34, 197, 94, .5); }
  70% { box-shadow: 0 16px 36px rgba(22, 163, 74, .38), 0 0 0 22px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 16px 36px rgba(22, 163, 74, .38), 0 0 0 0 rgba(34, 197, 94, 0); }
}
.orb-char { position: relative; z-index: 2; text-shadow: 0 2px 8px rgba(0,0,0,.15); }
.orb-wave {
  position: absolute; inset: 0; display: none;
  align-items: center; justify-content: center; gap: 5px; z-index: 1;
}
.orb.active .orb-char { opacity: 0; }
.orb.active .orb-wave { display: flex; }
.orb-wave i {
  width: 5px; height: 28px; border-radius: 4px; background: rgba(255,255,255,.92);
  animation: wave 1s infinite ease-in-out;
}
.orb-wave i:nth-child(2) { animation-delay: .15s; }
.orb-wave i:nth-child(3) { animation-delay: .3s; }
.orb-wave i:nth-child(4) { animation-delay: .45s; }
.orb-wave i:nth-child(5) { animation-delay: .6s; }
@keyframes wave { 0%, 100% { transform: scaleY(.4); } 50% { transform: scaleY(1); } }

.hero-hint { font-size: 13px; color: var(--ink-soft); margin-top: 16px; }

/* ---------- 底部输入区 ---------- */
.composer {
  background: var(--card);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -6px 24px rgba(0,0,0,.06);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  position: sticky; bottom: 0; z-index: 5;
}
.input-row {
  display: flex; align-items: center; gap: 8px;
  background: #f3f4f6; border-radius: 14px; padding: 6px 6px 6px 14px;
}
.text-input {
  flex: 1; border: none; background: transparent; outline: none;
  font-size: 15px; color: var(--ink); padding: 8px 0;
}
.text-input::placeholder { color: #9ca3af; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: none; cursor: pointer;
  display: grid; place-items: center; flex: none;
}
.mic-btn { background: var(--green-soft); color: var(--green-2); }
.mic-btn.active { background: #ef4444; color: #fff; animation: pulseDot 1s infinite; }
.send-btn { background: linear-gradient(135deg, var(--green-1), var(--green-2)); color: #fff; }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; }

.action-row { display: flex; gap: 10px; margin-top: 12px; }
.btn {
  flex: 1; border: none; cursor: pointer; border-radius: 14px;
  padding: 13px 16px; font-size: 15px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--green-1), var(--green-2)); color: #fff; box-shadow: 0 8px 20px rgba(22,163,74,.32); }
.btn-ghost { background: #f1f5f9; color: #64748b; flex: 0 0 110px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.tip { font-size: 12px; color: #ef4444; margin-top: 8px; min-height: 14px; text-align: center; }

/* ---------- 示例抽屉 ---------- */
.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
.drawer {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 480px; background: #fff; z-index: 21;
  border-radius: 22px 22px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 30px rgba(0,0,0,.18);
  max-height: 70vh; overflow-y: auto;
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 15px; margin-bottom: 12px;
}
.drawer-close { border: none; background: #f1f5f9; width: 30px; height: 30px; border-radius: 50%; font-size: 18px; cursor: pointer; color: #64748b; }
.q-chip {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: #f3f8f4; border: 1px solid var(--green-soft);
  color: var(--green-deep); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 10px; font-size: 14px; line-height: 1.5;
}
.q-chip:active { background: var(--green-soft); }
.q-cat { font-size: 11px; color: var(--ink-soft); display: block; margin-bottom: 2px; }

@media (max-width: 380px) {
  .orb { width: 112px; height: 112px; font-size: 44px; }
  .brand-name { font-size: 15px; }
}
