:root {
  --bg: #fff7f9; --card: #ffffff; --text: #3a2e39; --muted: #8a7f89; --line: #f1e3e8;
  --pink: #ff8fab; --pink-d: #f06292; --green: #34c759; --red: #ff3b30; --blue: #4f8cff; --yellow: #ffcc00;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1d1a1e; --card: #2a252b; --text: #f2eaf0; --muted: #a99fa8; --line: #3a333b; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
#topbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.logo { font-weight: 700; font-size: 18px; }
.pill { font-size: 12px; padding: 2px 10px; border-radius: 99px; background: var(--line); color: var(--muted); }
.pill.on { background: #d9f7e1; color: #1d8a3c; }
main { padding: 12px 16px calc(84px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }
nav#tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
nav#tabs a { flex: 1; text-align: center; padding: 8px 0 6px; text-decoration: none; color: var(--muted); font-size: 22px; }
nav#tabs a span { display: block; font-size: 11px; }
nav#tabs a.active { color: var(--pink-d); }
.card { background: var(--card); border-radius: 16px; padding: 16px; margin-bottom: 12px; border: 1px solid var(--line); }
.card h3 { margin: 0 0 10px; font-size: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--bg); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 22px; }
button, .btn { border: 0; border-radius: 12px; padding: 10px 16px; font-size: 15px; background: var(--line); color: var(--text); cursor: pointer; }
button.primary { background: var(--pink); color: #fff; }
button.big { width: 100%; padding: 16px; font-size: 18px; }
button.danger { background: #ffe1df; color: var(--red); }
button:disabled { opacity: .5; }
input, textarea, select { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 15px; font-family: inherit; }
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.switch { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; }
.switch input { width: auto; transform: scale(1.3); }
.list-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--line); margin-right: 4px; }
.tag.red { background: #ffe1df; color: var(--red); }
.tag.green { background: #d9f7e1; color: #1d8a3c; }
.persona { border: 2px solid var(--line); border-radius: 14px; padding: 10px; margin-bottom: 8px; }
.persona.active { border-color: var(--pink); }
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 28px; flex: none; }
.banner { background: var(--yellow); color: #3a2e00; text-align: center; padding: 10px; font-weight: 600; cursor: pointer; }
.hidden { display: none !important; }
#toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: rgba(0,0,0,.8); color: #fff;
  padding: 10px 18px; border-radius: 12px; z-index: 50; max-width: 90%; text-align: center; }
#call { position: fixed; inset: 0; z-index: 40; background: linear-gradient(160deg, #ffb3c6, #a0c4ff);
  display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; }
.call-face { font-size: 110px; animation: bob 1.6s ease-in-out infinite; }
.call-title { font-size: 30px; font-weight: 700; margin-top: 8px; }
.call-state { font-size: 18px; opacity: .9; margin: 6px 0 60px; }
.call-actions { display: flex; gap: 60px; }
.round { width: 76px; height: 76px; border-radius: 50%; font-size: 30px; color: #fff; }
.round.green { background: var(--green); }
.round.red { background: var(--red); }
@keyframes bob { 50% { transform: translateY(-10px); } }
.rec-btn { width: 120px; height: 120px; border-radius: 50%; font-size: 44px; background: var(--pink); color: #fff;
  display: block; margin: 10px auto; user-select: none; -webkit-user-select: none; touch-action: none; }
.rec-btn.recording { background: var(--red); transform: scale(1.08); }
.chat-bubble { padding: 8px 12px; border-radius: 12px; margin: 6px 0; max-width: 85%; }
.chat-bubble.user { background: var(--line); }
.chat-bubble.assistant { background: #ffe3ea; margin-left: auto; color: #3a2e39; }
.chat-bubble.flagged { border: 2px solid var(--red); }
.login { max-width: 360px; margin: 60px auto; text-align: center; }
.login .big-star { font-size: 72px; }
