:root {
  --bg: #0e0e10; --panel: #18181b; --text: #efeff1; --muted: #adadb8; --line: #2f2f35;
  --accent: #bf94ff; --pending: .55; --link: #bf94ff;
  font-family: Inter, "Segoe UI", Roboto, system-ui, sans-serif; font-size: 14px;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f7f7f8; --panel: #fff; --text: #0e0e10; --muted: #53535f; --line: #e5e5ea; --accent: #772ce8; --link: #5c16c5; }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); display: flex; flex-direction: column; }
header {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel);
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
h1 { font-size: 15px; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font: inherit; }
.toggle { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 4px; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#captions {
  padding: 8px 12px; background: color-mix(in srgb, var(--accent) 14%, var(--panel)); border-bottom: 1px solid var(--line);
  font-size: 15px; font-weight: 600; line-height: 1.4; display: flex; gap: 8px; align-items: baseline;
}
#captions[hidden] { display: none; }
#captions.interim #caption-text { opacity: .7; font-style: italic; }
#captions .from { margin-right: 6px; }
#status { padding: 6px 12px; font-size: 12px; color: var(--muted); background: var(--panel); border-bottom: 1px solid var(--line); }
#chat { flex: 1; overflow-y: auto; padding: 6px 0; overflow-wrap: anywhere; }
.msg { padding: 4px 12px; line-height: 1.45; }
.msg:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.msg.pending .body { opacity: var(--pending); }
.msg.action .body { font-style: italic; }
.user { font-weight: 700; }
.from {
  display: inline-block; font-size: 10px; font-weight: 600; color: var(--muted); border: 1px solid var(--line);
  border-radius: 4px; padding: 0 4px; margin-right: 4px; vertical-align: 1px; cursor: help; text-transform: uppercase;
}
.orig { display: none; color: var(--muted); font-size: 12px; padding-top: 2px; }
.msg.open .orig, body.show-orig .orig { display: block; }
.emote { height: 28px; vertical-align: middle; margin: -4px 0; }
.mention { font-weight: 600; }
a { color: var(--link); }
.notice { color: var(--muted); font-style: italic; text-align: center; padding: 6px; }
#resume {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff;
  border: 0; border-radius: 16px; padding: 6px 14px; font: inherit; font-weight: 600; cursor: pointer;
}

/* Page studio */
.studio-main { flex: 1; overflow-y: auto; padding: 16px; display: grid; gap: 16px; align-content: start; max-width: 900px; width: 100%; margin: 0 auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.card h2 { font-size: 15px; margin: 0 0 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row input { flex: 1; min-width: 200px; }
input, button { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font: inherit; }
button { cursor: pointer; font-weight: 600; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.big { background: var(--accent); color: #fff; border: 0; padding: 10px 22px; font-size: 16px; }
button.big.on { background: #e91916; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.state { font-weight: 600; margin: 10px 0 0; }
.state.on { color: #e91916; }
.state.error { color: #f5a623; }
.alert { background: #e91916; color: #fff; padding: 10px 14px; border-radius: 8px; margin: 0; }
.transcript { max-height: 300px; overflow-y: auto; font-size: 15px; }
.transcript p { margin: 4px 0; }
.transcript .interim { color: var(--muted); font-style: italic; }
.transcript .failed { color: #f5a623; text-decoration: line-through; }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }
