:root {
  color-scheme: light;
  --ink: #202522;
  --muted: #6c746e;
  --line: #dfe4df;
  --paper: #f5f7f3;
  --panel: #ffffff;
  --accent: #2d6a55;
  --accent-dark: #214b3d;
  --soft-accent: #e7f0eb;
  --error: #a33c32;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); font-family: "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif; }
button, textarea { font: inherit; }
button { cursor: pointer; }

.voice-shell { width: min(780px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 30px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding-bottom: 26px; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 11px; letter-spacing: 1.5px; font-weight: 700; }
h1 { margin: 0; font-size: clamp(29px, 5vw, 46px); line-height: 1.12; font-weight: 700; }
.subtitle { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.back-link { color: var(--accent); font-size: 13px; text-decoration: none; white-space: nowrap; }
.back-link:hover { color: var(--accent-dark); }

.voice-panel { border: 1px solid var(--line); background: var(--panel); }
.persona-bar { display: flex; align-items: center; gap: 11px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.persona-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; }
.persona-bar > span:nth-child(2) { display: grid; gap: 3px; }
.persona-bar small { color: var(--muted); font-size: 11px; }
.persona-bar code { margin-left: auto; color: var(--muted); font-size: 11px; }
.chat { min-height: 430px; max-height: 56vh; overflow-y: auto; padding: 25px clamp(15px, 5vw, 46px); }
.message { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: start; margin-bottom: 22px; }
.message.user { grid-template-columns: minmax(0, 1fr) 28px; }
.message.user .message-label { grid-column: 2; grid-row: 1; text-align: right; }
.message.user .bubble, .message.user audio { grid-column: 1; grid-row: 1; justify-self: end; }
.message-label { padding-top: 8px; color: var(--muted); font-size: 12px; }
.bubble { max-width: 84%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 3px; white-space: pre-wrap; line-height: 1.7; font-size: 15px; }
.assistant .bubble { border-left: 3px solid var(--accent); background: #fbfcfa; }
.user .bubble { border-color: #d6e3dc; background: var(--soft-accent); }
.pending .bubble { color: var(--muted); }
audio { grid-column: 2; width: min(280px, 84%); margin-top: 7px; }
.message.user audio { grid-column: 1; grid-row: 2; }

.composer { border-top: 1px solid var(--line); padding: 15px 16px 13px; background: #fbfcfa; }
textarea { display: block; width: 100%; min-height: 72px; max-height: 180px; resize: vertical; padding: 11px 13px; border: 1px solid #cdd6cf; border-radius: 3px; outline: none; background: #fff; color: var(--ink); line-height: 1.6; }
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(45, 106, 85, .12); }
.composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 10px; }
#charCount { color: var(--muted); font-size: 12px; }
button { min-width: 86px; padding: 9px 18px; border: 0; border-radius: 3px; background: var(--accent); color: #fff; font-weight: 700; }
button:hover { background: var(--accent-dark); }
button:disabled { cursor: wait; opacity: .55; }
.status { min-height: 21px; margin: 11px 20px 14px; color: var(--muted); font-size: 12px; }
.status.error { color: var(--error); }
.notice { margin: 14px 0 0; color: var(--muted); font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 600px) {
  .voice-shell { width: min(100% - 20px, 780px); padding-top: 25px; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 15px; }
  .persona-bar { padding-right: 13px; padding-left: 13px; }
  .persona-bar code { display: none; }
  .chat { min-height: 54vh; padding: 20px 13px; }
  .message { grid-template-columns: 38px minmax(0, 1fr); gap: 7px; }
  .bubble { max-width: 94%; font-size: 14px; }
  audio { width: min(250px, 94%); }
  .composer { padding-right: 12px; padding-left: 12px; }
}
