/* Стили веб-клиента — отдельным файлом: строгий CSP (style-src 'self') не пускает встроенные <style>. */
:root { color-scheme: dark; }
html, body { margin: 0; height: 100%; background: #0b0d10; color: #dde; font: 14px/1.4 system-ui, sans-serif; }
#app { display: flex; gap: 16px; padding: 16px; box-sizing: border-box; height: 100%; align-items: flex-start; justify-content: center; flex-wrap: wrap; }
#screen { width: min(480px, calc(100vw - 32px), calc(100vh - 32px)); aspect-ratio: 1; background: #000; touch-action: none; border-radius: 6px; box-shadow: 0 0 0 1px #223; }
/* каналы коммуникации: колонка блоков рядом с холстом — переключатели, текстовый чат, голосовой блок */
#comm { display: flex; flex-direction: column; gap: 12px; width: min(360px, calc(100vw - 32px)); height: min(480px, calc(100vh - 32px)); min-height: 240px; }
#comm[hidden], #comm [hidden] { display: none !important; }
.channel { border: 1px solid #223; border-radius: 6px; }
#chat-text { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#chat-text .feed { flex: 1; overflow-y: auto; padding: 8px 10px; }
#chat-text .msg { margin: 0 0 6px; overflow-wrap: anywhere; white-space: pre-wrap; }
#chat-text .msg b { margin-right: 6px; }
#chat-text .msg.human b { color: #8cf; }
#chat-text .msg.mine b { color: #8e8; }
#chat-text .msg.agent b { color: #fc6; }
#chat-text .msg.room { color: #abc; font-style: italic; }
#chat-text .msg.room b { color: #9ab; font-style: normal; }
#chat-text .status { min-height: 1.4em; padding: 2px 10px; color: #89a; font-size: 12px; border-top: 1px solid #1a2028; }
#chat-text .status.note { color: #c86; }
#chat-text input { border: 0; border-top: 1px solid #223; background: #12161b; color: inherit; padding: 10px; font: inherit; border-radius: 0 0 6px 6px; }
#chat-text input:disabled { opacity: .5; }
/* переключатели каналов: ввод [текст, голос], вывод [текст, голос] */
#channel-bar:empty { display: none; }
#channel-bar { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12px; color: #9ab; }
#channel-bar .grp { color: #678; }
#channel-bar label { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; user-select: none; }
#channel-bar label.blocked { opacity: .45; cursor: not-allowed; }
/* голосовой блок: кнопка записи ядра (не на холсте) и строка состояния */
#chat-voice { display: flex; align-items: center; gap: 14px; padding: 10px 12px; }
#chat-voice .ptt { --level: 0; position: relative; flex: none; width: 72px; height: 72px; border-radius: 50%; border: 0;
  background: #1d2733; color: #cde; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; padding: 0; transition: background .15s, color .15s; }
#chat-voice .ptt svg { width: 36px; height: 36px; display: block; margin: auto; }
#chat-voice .ptt .icon { display: block; }
#chat-voice .ptt .ring { position: absolute; inset: -4px; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 calc(2px + var(--level) * 10px) rgba(255, 80, 80, calc(.25 + var(--level) * .5)); opacity: 0; transition: box-shadow .08s; }
#chat-voice .ptt .mute { position: absolute; right: -4px; bottom: -4px; width: 24px; height: 24px; border-radius: 50%;
  background: #0b0d10; color: #e96; box-shadow: 0 0 0 1px #334; }
#chat-voice .ptt .mute svg { width: 18px; height: 18px; margin: 3px; }
#chat-voice .ptt[data-state="ready"]:hover { background: #26354a; }
#chat-voice .ptt[data-state="recording"] { background: #d33; color: #fff; }
#chat-voice .ptt[data-state="recording"] .ring { opacity: 1; }
#chat-voice .ptt[data-state="recognizing"] svg { animation: spin 1s linear infinite; }
#chat-voice .ptt[data-state="stop"] { background: #3a4a5c; color: #fff; }
#chat-voice .ptt[data-state="busy"] { color: #678; animation: breathe 2.4s ease-in-out infinite; }
#chat-voice .ptt[data-state="unavailable"] { color: #a77; background: #241b1f; }
#chat-voice .ptt[data-state="offline"], #chat-voice .ptt[data-state="waiting"] { opacity: .35; cursor: default; }
#chat-voice .ptt.shake { animation: shake .3s linear; }
#chat-voice .vstatus { flex: 1; min-width: 0; color: #89a; font-size: 13px; overflow-wrap: anywhere; }
#chat-voice .vstatus.note { color: #c86; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { opacity: .45; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 17%, 50%, 83% { transform: translateX(-6px); } 33%, 67% { transform: translateX(6px); } }
