:root {
  --bg: #f6f7f9; --card: #fff; --text: #1f2328; --muted: #565f6b; --line: #dce2e9;
  --primary: #235bb4; --primary-weak: #eaf1fd; --ok: #14643e; --ok-weak: #e7f6ed;
  --bad: #9e3428; --bad-weak: #fceeea; --radius: 10px;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow-wrap: anywhere;
}
a { color: var(--primary); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-in, main, footer { width: min(100%, 1080px); margin: auto; padding-inline: 16px; }
.topbar-in { min-height: 58px; padding-block: 8px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 18px; }
.brand { font-size: 19px; font-weight: 650; text-decoration: none; color: var(--text); align-content: center; }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
nav a { padding-block: 7px; text-decoration: none; }
nav a:hover { text-decoration: underline; }
main { padding-block: 22px 8px; }
footer { padding-block: 10px 24px; color: var(--muted); }
h1, h2, h3, p { margin: 0 0 10px; }
h1 { font-size: clamp(22px, 5.8vw, 30px); line-height: 1.25; }
h2 { font-size: 19px; line-height: 1.4; }
h3 { font-size: 16px; }
button, input, select, textarea { font: inherit; color: inherit; min-width: 0; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; padding: 7px 13px; min-height: 44px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); text-decoration: none;
  color: var(--text); cursor: pointer; white-space: normal; text-align: center;
}
button:hover, .btn:hover { background: var(--primary-weak); }
button:disabled { opacity: .58; cursor: default; }
.primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.primary:hover { background: #1e4a92; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(14px, 3vw, 22px); margin-bottom: 14px; min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.chat-grid { align-items: start; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.row.spread { justify-content: space-between; }
.list { padding: 0; margin: 0 0 12px; list-style: none; }
.list > li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.detail { color: var(--muted); }
.mode-links button { width: 100%; justify-content: flex-start; }
.state { margin-block: 0 12px; color: var(--muted); }
.fields label, .field { display: block; margin-bottom: 6px; }
input:not([type=radio]):not([type=checkbox]), select, textarea {
  width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--card);
}
textarea { min-height: 102px; resize: vertical; }
#chat-log { overflow-y: auto; max-block-size: min(46dvh, 32rem); overscroll-behavior: contain; margin-block-end: 12px; }
#chat-log > .transcript { margin-bottom: 0; }
.voice-tools { margin-block: 10px; }
.voice-tools p { margin-block: 6px; }
.voice-tools select { min-inline-size: 115px; }
audio { display: block; width: min(100%, 24rem); margin-block: 8px; }
fieldset { margin: 0 0 12px; min-inline-size: 0; border: 1px solid var(--line); border-radius: 8px; }
legend { font-weight: 600; }
.option { display: flex; align-items: baseline; gap: 8px; padding: 7px 4px; }
progress { accent-color: var(--primary); width: 100%; height: 12px; margin: 0 0 10px; }
.notification { background: var(--primary-weak); border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.notification.good { color: var(--ok); background: var(--ok-weak); }
.notification.error { color: var(--bad); background: var(--bad-weak); }
.transcript, .passage { white-space: pre-wrap; }
.passage { margin-top: 12px; }
mark { color: #352500; background: #ffe7a0; padding-inline: 1px; border-radius: 2px; }
.quote { border-inline-start: 3px solid var(--line); padding-inline-start: 10px; margin: 8px 0; }
.break { overflow-wrap: anywhere; }
@media (max-width: 680px) {
  .grid, .chat-grid, .fields { grid-template-columns: minmax(0, 1fr); }
  .topbar-in, main, footer { padding-inline: 12px; }
}
