* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f4f6fb; color: #1a1a1a;
  display: flex; flex-direction: column; height: 100dvh; overflow: hidden;
}
#app { display: flex; flex-direction: column; height: 100%; max-width: 560px; margin: 0 auto; width: 100%; }
header { padding: 14px 16px 8px; text-align: center; }
header h1 { margin: 0; font-size: 22px; }
#status {
  margin-top: 8px; display: inline-block; padding: 6px 18px; border-radius: 20px;
  font-size: 14px; background: #e8f0fe; color: #1a73e8; font-weight: 600;
}
#status.rec { background: #fdecea; color: #d93025; animation: pulse 1.2s infinite; }
#status.busy { background: #fef7e0; color: #b06000; }
@keyframes pulse { 50% { opacity: .55; } }

#log {
  flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px;
}
.msg { max-width: 92%; padding: 10px 14px; border-radius: 16px; font-size: 16px; line-height: 1.5; }
.msg .orig { font-size: 13px; opacity: .65; margin-bottom: 4px; }
.msg.me { align-self: flex-end; background: #1a73e8; color: #fff; border-bottom-right-radius: 4px; }
.msg.them { align-self: flex-start; background: #fff; color: #1a1a1a; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.msg.sys { align-self: center; background: transparent; color: #888; font-size: 13px; padding: 4px; }
.msg .play { margin-top: 6px; font-size: 13px; opacity: .8; }

#controls { display: flex; gap: 12px; padding: 12px 14px calc(10px + env(safe-area-inset-bottom)); }
.big-btn {
  flex: 1; border: none; border-radius: 20px; padding: 20px 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-family: inherit; touch-action: none; user-select: none; -webkit-user-select: none;
}
.big-btn .emoji { font-size: 38px; }
.big-btn .label { font-size: 18px; font-weight: 700; }
.big-btn .sub { font-size: 12px; opacity: .75; }
.big-btn.speak { background: linear-gradient(135deg, #d93025, #b3140f); color: #fff; }
.big-btn.speak.holding { transform: scale(.96); filter: brightness(1.15); }
.big-btn.listen { background: linear-gradient(135deg, #1a73e8, #0d47a1); color: #fff; }
.big-btn.listen.listening { animation: pulse 1.2s infinite; }
.big-btn:disabled { opacity: .45; }

footer { display: flex; justify-content: space-between; align-items: center; padding: 4px 16px calc(12px + env(safe-area-inset-bottom)); }
.link-btn { background: none; border: none; color: #888; font-size: 13px; cursor: pointer; font-family: inherit; }
.hint { font-size: 12px; color: #aaa; }
