* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; background: #0f1419; color: #e6e6e6; }
header { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid #232b35; }
h1 { font-size: 18px; margin: 0; }
h1 span { font-weight: 400; color: #8b98a8; font-size: 14px; margin-left: 8px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: #8b98a8; margin: 16px 0 6px; }
main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; padding: 20px; }
.stage { display: flex; flex-direction: column; gap: 12px; align-items: center; }
canvas, #rtcVideo { width: min(100%, 640px); aspect-ratio: 1; background: #000; border-radius: 12px; object-fit: contain; }
[hidden] { display: none !important; }
.controls { display: flex; gap: 12px; width: min(100%, 640px); }
.col { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.file { width: 84px; height: 84px; border: 1px dashed #3a4654; border-radius: 8px; display: grid; place-items: center; cursor: pointer; overflow: hidden; position: relative; }
.file input { display: none; }
.file img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.file img:not([src]) { display: none; }
.file span { font-size: 12px; color: #8b98a8; }
button { background: #ff9900; color: #111; border: 0; border-radius: 6px; padding: 7px 12px; font-weight: 600; cursor: pointer; }
button:disabled { background: #3a4654; color: #8b98a8; cursor: default; }
button#btnStop { background: #d13212; color: #fff; }
button#btnStop:disabled { background: #3a4654; color: #8b98a8; }
input, select, textarea { background: #1a212b; color: #e6e6e6; border: 1px solid #3a4654; border-radius: 6px; padding: 6px 8px; font: inherit; }
#textIn { flex: 1; }
details { width: min(100%, 640px); }
textarea { width: 100%; }
aside { min-width: 0; }
#stats { width: 100%; border-collapse: collapse; }
#stats td { padding: 3px 0; border-bottom: 1px solid #1f2731; }
#stats td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
#transcript { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.msg { padding: 6px 10px; border-radius: 8px; max-width: 90%; }
.msg.USER { background: #1f3a5f; align-self: flex-end; }
.msg.ASSISTANT { background: #26303b; align-self: flex-start; }
#log { max-height: 180px; overflow-y: auto; font-size: 11px; color: #8b98a8; white-space: pre-wrap; margin: 0; }
.pill { padding: 3px 10px; border-radius: 999px; font-size: 12px; }
.pill.off { background: #3a4654; }
.pill.on { background: #1d8102; }

.muted { color: #8b98a8; font-size: 12px; }
a { color: #ff9900; font-size: 12px; }
