:root {
  --bg: #0b1020;
  --bg2: #141b33;
  --accent: #34c759;
  --danger: #ff3b30;
  --text: #f5f7fb;
  --muted: #93a0bd;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: radial-gradient(120% 80% at 50% 0%, #1b2445 0%, var(--bg) 60%);
  color: var(--text);
  -webkit-user-select: none; user-select: none;
}

.phone {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 24px 20px 32px;
}

.status-bar { display: flex; justify-content: center; padding: 8px 0 4px; }
.engine-tag {
  font-size: 12px; color: var(--muted);
  background: rgba(255,255,255,.06);
  padding: 4px 12px; border-radius: 999px;
}

.callee {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
}
.avatar {
  width: 116px; height: 116px; border-radius: 50%;
  background: radial-gradient(circle at 50% 36%, #fff4e8, #ffdcc6);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  box-shadow: 0 12px 40px rgba(255,122,69,.35);
}
.avatar .doudou { width: 100%; height: 100%; display: block; }
/* 卡通小豆表情动画 */
.dd-sprout { transform-box: fill-box; transform-origin: 50% 100%; animation: ddSway 3.2s ease-in-out infinite; }
.dd-eyes   { transform-box: fill-box; transform-origin: center; animation: ddBlink 4.6s infinite; }
.dd-open   { opacity: 0; transform-box: fill-box; transform-origin: center; }
.avatar.speaking .dd-smile { opacity: 0; }
.avatar.speaking .dd-open  { opacity: 1; animation: ddTalk .3s ease-in-out infinite; }
@keyframes ddSway  { 0%,100% { transform: rotate(-5deg);} 50% { transform: rotate(5deg);} }
@keyframes ddBlink { 0%,92%,100% { transform: scaleY(1);} 96% { transform: scaleY(.12);} }
@keyframes ddTalk  { 0%,100% { transform: scaleY(.4);} 50% { transform: scaleY(1);} }
.local-video {
  width: 240px; max-width: 72vw; aspect-ratio: 4 / 3;
  border-radius: 18px; object-fit: cover; transform: scaleX(-1); /* 镜像,更自然 */
  box-shadow: 0 12px 40px rgba(0,0,0,.28); background: #000;
}
.local-video.hidden, .avatar.hidden { display: none; }
.avatar.speaking { animation: pulse 1s ease-in-out infinite; }
.avatar.listening { box-shadow: 0 0 0 0 rgba(52,199,89,.6); animation: ring 1.4s ease-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.06);} }
@keyframes ring {
  0% { box-shadow: 0 0 0 0 rgba(52,199,89,.5);} 100% { box-shadow: 0 0 0 24px rgba(52,199,89,0);} }

.name { font-size: 30px; font-weight: 600; }
.sub { color: var(--muted); font-size: 15px; }
.timer { color: var(--accent); font-size: 15px; height: 18px; font-variant-numeric: tabular-nums; }

.transcript {
  min-height: 110px; max-height: 240px; overflow-y: auto;
  margin: 12px 0; padding: 8px 4px;
  display: flex; flex-direction: column; gap: 8px;
}
/* 空闲时的占位提示,提示用户通话文字会显示在这里 */
.transcript:empty::before {
  content: "通话中,你和小豆说的话会实时显示在这里…";
  margin: auto; color: var(--muted); font-size: 13px; text-align: center;
}
/* 发言人小标签 */
.bubble { position: relative; }
.bubble.user::after, .bubble.ai::after {
  position: absolute; top: -15px; font-size: 11px; color: var(--muted);
}
.bubble.user::after { content: "我"; right: 4px; }
.bubble.ai::after { content: "小豆"; left: 4px; }
.bubble {
  max-width: 82%; padding: 9px 13px; border-radius: 14px;
  font-size: 15px; line-height: 1.45; word-break: break-word;
}
.bubble.user { align-self: flex-end; background: #2563eb; }
.bubble.ai { align-self: flex-start; background: var(--bg2); }

.controls {
  display: flex; align-items: center; justify-content: center; gap: 40px;
  padding: 18px 0 8px;
}
.btn {
  border: none; cursor: pointer; color: #fff;
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 12px; transition: transform .1s ease, opacity .2s;
}
.btn .ico { font-size: 26px; line-height: 1; }
.btn:active { transform: scale(.92); }
.btn-call { background: var(--accent); }
.btn-hang { background: var(--danger); }
.btn-secondary { background: rgba(255,255,255,.14); }
.btn-secondary.active { background: #ffcc00; color: #222; }

.hint { text-align: center; color: var(--muted); font-size: 13px; margin-top: 10px; min-height: 18px; }
.hidden { display: none !important; }
