:root {
  --bg: #f4f5f7; --card: #ffffff; --text: #1b1d22; --muted: #6a707c; --line: #dfe2e7;
  --accent: #2f6fde; --accent-text: #ffffff; --ok: #1f9d55; --warn: #c2410c; --me: #eef4ff; --them: #f7f7f9;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14161a; --card: #1d2026; --text: #e7e9ee; --muted: #9aa1ad; --line: #2e323a;
    --accent: #5b8ff0; --accent-text: #0d1117; --ok: #3ccf7f; --warn: #fb923c; --me: #1f2a3d; --them: #23262d; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", "Noto Sans HK", "PingFang HK", sans-serif; }
header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
h1 { font-size: 18px; margin: 0; } h1 .sub { color: var(--muted); font-weight: 400; margin-left: 6px; }
h2 { font-size: 15px; margin: 0 0 12px; }
main { padding: 16px; max-width: 1200px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
#join { max-width: 420px; margin: 40px auto; }
label { display: block; margin: 10px 0; color: var(--muted); font-size: 13px; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; }
input:not([type]), input[type=text], select { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit;
  color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
input[type=range] { width: 100%; }
button { font: inherit; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); width: 100%; margin-top: 8px; }
button.on { background: var(--warn); color: #fff; border-color: var(--warn); }
.hint { color: var(--muted); font-size: 13px; } .warn { color: var(--warn); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; margin: 0; }
.pill { font-size: 12px; padding: 2px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: var(--ok); } .pill.off { color: var(--warn); border-color: var(--warn); }
.pill.talk { background: var(--ok); color: #fff; border-color: var(--ok); }
.grid { display: grid; grid-template-columns: 300px 1fr; gap: 16px; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }
#users { list-style: none; padding: 0; margin: 0 0 14px; }
#users li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
#users li.speaking .n::before { content: "● "; color: var(--ok); }
#users .l { color: var(--muted); font-size: 12px; }
.meter { position: relative; height: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; margin-bottom: 10px; }
#level { height: 100%; width: 0; background: var(--ok); transition: width 60ms linear; }
#thresh { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--warn); left: 0; }
.main { display: flex; flex-direction: column; height: calc(100vh - 120px); min-height: 420px; }
#log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.msg { padding: 8px 12px; border-radius: 8px; background: var(--them); max-width: 85%; }
.msg.me { background: var(--me); align-self: flex-end; }
.msg .who { font-size: 12px; color: var(--muted); }
.msg .src { color: var(--muted); }
.msg .dst { font-size: 17px; }
.msg .dst.pending { color: var(--muted); font-style: italic; font-size: 14px; }
.msg .t { font-size: 11px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.msg.err { background: transparent; color: var(--warn); font-size: 13px; align-self: center; }
dl { font-size: 12px; margin: 8px 0 0; } dt { color: var(--muted); } dd { margin: 0 0 6px; word-break: break-all; }
summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-top: 10px; }
button.testBtn { width: 100%; margin-top: 8px; }
.row button.testBtn { width: auto; margin-top: 0; }
dialog { width: min(520px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px;
  background: var(--card); color: var(--text); }
dialog::backdrop { background: rgb(0 0 0 / 0.45); }
dialog .row { margin: 10px 0; flex-wrap: wrap; }
.dhead { display: flex; justify-content: space-between; align-items: center; }
.dhead h2 { margin: 0; }
.dhead button { border: none; background: none; font-size: 18px; padding: 4px 8px; }
#tLevel { height: 100%; width: 0; background: var(--ok); transition: width 60ms linear; }
#tResult { margin-top: 12px; padding: 12px; background: var(--bg); border-radius: 8px; }
#tResult .src { color: var(--muted); } #tResult .dst { font-size: 18px; margin: 4px 0; }
#tResult .t { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
button.primary.live { width: auto; margin-top: 0; }
#tLive { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 8px;
  background: var(--bg); border-radius: 8px; }
#tLive .item .src { color: var(--muted); font-size: 13px; }
#tLive .item .dst { font-size: 16px; }
#tLive .item .t { font-size: 11px; color: var(--muted); }
h1 .ver { font-size: 12px; font-weight: 500; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; vertical-align: middle; }
[hidden] { display: none !important; }
.status { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
#models { display: flex; gap: 6px; flex-wrap: wrap; }
header { gap: 12px; flex-wrap: wrap; }
.rooms { margin: -4px 0 10px; }
#roomList { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.roomItem { text-align: left; display: flex; flex-direction: column; padding: 6px 10px; }
.msg .src.live { font-style: italic; }
.msg .dst.pending { color: var(--muted); }
.tlog .msg { max-width: 100%; }
a { color: var(--accent); }
a.home { color: inherit; text-decoration: none; }
.pill.link { text-decoration: none; color: var(--accent); border-color: var(--accent); }
label.check.inline { display: inline-flex; margin: 0; font-size: 13px; }
.rec { margin-bottom: 10px; }
.rec .who { font-size: 12px; color: var(--muted); }
.rec .src { color: var(--muted); margin-top: 4px; } .rec .dst { font-size: 17px; }
.rec .t { font-size: 11px; color: var(--muted); }
.rec .players { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0; font-size: 12px; color: var(--muted); align-items: center; }
.rec .players span { display: flex; gap: 6px; align-items: center; }
.rec audio { height: 32px; max-width: 100%; }
.rec .row { flex-wrap: wrap; font-size: 13px; }
.rec .models { margin-left: auto; font-size: 11px; }
.rec .again { margin-top: 8px; padding: 8px 10px; background: var(--bg); border-radius: 8px; }
code { font-size: 12px; }
