/* Джарвис в браузере: те же цвета, что у приложения на Android (MainActivity). */
:root {
  --bg: #0f1115; --panel: #171a21; --card: #1e222b; --mine: #24456b;
  --text: #e9ecf1; --dim: #8b93a1; --blue: #2f80ed; --red: #d5443b;
  --warn: #e9a23b; --ok: #34c759; --line: #2a2f3a; --code: #0c0e12;
  --font: 15px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }

#app {
  display: flex; flex-direction: column; height: 100vh; height: 100dvh;
  max-width: 820px; margin: 0 auto;
  padding: calc(6px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right))
           calc(8px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
}
header { display: flex; align-items: center; gap: 6px; }
header h1 { flex: 1; margin: 0; font-size: 22px; font-weight: 700; }
.icon {
  width: 42px; height: 42px; border: 0; border-radius: 21px; background: var(--panel);
  font-size: 18px; padding: 0; display: grid; place-items: center;
}
.icon.on { background: #2e7d32; }
.icon.off { background: none; }

#status {
  align-self: flex-start; margin-top: 6px; padding: 5px 10px; border-radius: 10px;
  background: var(--panel); color: var(--dim); font-size: 12px; max-width: 100%;
}
#status.warn { color: var(--warn); }
#status.live { color: #4caf50; }

#tabs {
  display: flex; gap: 7px; margin-top: 10px; overflow-x: auto; flex-shrink: 0;
  scrollbar-width: none; padding-bottom: 2px;
}
#tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0; padding: 7px 14px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--panel); font-size: 14px; font-weight: 700; white-space: nowrap;
}
.tab.on { border-color: transparent; color: var(--bg); }
.tab.play { color: var(--dim); font-weight: 400; }

#feed {
  flex: 1; overflow-y: auto; margin-top: 6px; padding: 6px 0;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.empty { color: var(--dim); text-align: center; padding-top: 60px; white-space: pre-line; }
.msg { display: flex; flex-direction: column; padding: 5px 0 3px; }
.msg.mine { align-items: flex-end; }
.msg.theirs { align-items: flex-start; }
.who { display: flex; align-items: center; font-size: 12px; font-weight: 700; padding: 0 6px 3px 4px; }
.who button { border: 0; background: none; color: var(--dim); font-size: 13px; padding: 2px 10px 2px 8px; }
.bubble {
  max-width: 84%; padding: 9px 12px 7px; border-radius: 16px; font-size: var(--font);
  background: var(--card); border: 1px solid var(--line);
  user-select: text; -webkit-user-select: text; overflow-wrap: anywhere;
}
.mine .bubble { background: var(--mine); border-color: transparent; }
.bubble p { margin: 0; white-space: pre-wrap; }
.bubble p + p, .bubble pre + p, .bubble p + pre, .bubble pre + pre { margin-top: 6px; }
.bubble pre {
  margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--code);
  border: 1px solid var(--line); overflow-x: auto; font-size: calc(var(--font) - 2px);
  font-family: ui-monospace, Menlo, Consolas, monospace; white-space: pre;
}
.time { text-align: right; font-size: 10px; color: var(--dim); margin-top: 2px; }
.mine .time { color: #a9c2e0; }
.thinking { color: var(--dim); font-size: 12px; padding: 4px 6px 8px; }

.choices { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding-top: 6px; max-width: 84%; }
.choices .q { color: var(--dim); font-size: 13px; padding: 8px 0 2px 4px; }
.choice {
  text-align: left; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); font-size: var(--font);
}
.choice.on { background: var(--mine); border-color: transparent; }
.choices .go { margin-top: 4px; padding: 9px 16px; border: 0; border-radius: 12px; background: var(--blue); }

#attachRow {
  margin-bottom: 6px; padding: 7px 12px; border-radius: 12px; background: var(--card);
  border: 1px solid var(--line); font-size: 13px; cursor: pointer;
}
#speakBar { display: flex; gap: 8px; margin-bottom: 6px; }
#speakBar button { flex: 1; height: 44px; border: 0; border-radius: 22px; background: var(--panel); font-size: 15px; }

footer { display: flex; align-items: flex-end; gap: 8px; margin-top: 4px; }
#box {
  flex: 1; display: flex; align-items: flex-end; background: var(--panel);
  border: 1px solid var(--line); border-radius: 22px; padding: 2px 6px 2px 4px; min-width: 0;
}
.flat { width: 40px; height: 44px; border: 0; background: none; font-size: 19px; padding: 0; flex-shrink: 0; }
#sendBtn { color: var(--blue); }
#input {
  flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: none; color: var(--text);
  font: 16px/1.35 inherit; font-family: inherit; padding: 11px 6px 11px 2px; max-height: 8.2em;
}
#input::placeholder { color: var(--dim); }
#micBtn {
  width: 56px; height: 56px; border: 0; border-radius: 28px; background: var(--blue);
  font-size: 24px; flex-shrink: 0; touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
#micBtn.rec { background: var(--red); }
#tip { text-align: center; color: var(--dim); font-size: 11px; padding-top: 6px; }

/* -- окна поверх экрана: списки, формы, вопросы ------------------------------ */
#layer:empty { display: none; }
.veil {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex;
  align-items: center; justify-content: center; z-index: 10;
  padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
}
.sheet {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  width: 100%; max-width: 480px; max-height: 100%; display: flex; flex-direction: column;
}
.sheet h2 { margin: 0; padding: 16px 20px 6px; font-size: 18px; }
.sheet .body { padding: 4px 20px 8px; overflow-y: auto; }
.sheet .foot { display: flex; justify-content: flex-end; gap: 6px; padding: 8px 12px 12px; flex-wrap: wrap; }
.sheet .foot button {
  border: 0; background: none; color: var(--blue); font-weight: 600; padding: 10px 12px; border-radius: 10px;
}
.sheet .foot button.left { margin-right: auto; color: var(--red); }
.sheet p, .sheet .note { color: var(--dim); font-size: 13px; margin: 6px 0; }
.sheet .msgtext { color: var(--text); font-size: 15px; white-space: pre-line; }
.sheet h3 { font-size: 15px; margin: 16px 0 4px; }
.row {
  display: block; width: 100%; text-align: left; padding: 12px 4px; border: 0;
  border-bottom: 1px solid var(--line); background: none; font-size: 15px; white-space: pre-line;
}
.row:last-child { border-bottom: 0; }
.row small { color: var(--dim); font-size: 12px; }
label.f { display: block; font-size: 12px; color: var(--dim); padding-top: 8px; }
.sheet input[type=text], .sheet input[type=password], .sheet input[type=number],
.sheet select, .sheet textarea {
  width: 100%; margin-top: 3px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: 16px inherit; font-family: inherit;
}
.sheet .btn {
  display: block; width: 100%; margin: 6px 0; padding: 11px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); font-size: 15px;
}
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 15px; }
.check input { width: 20px; height: 20px; }
.range { width: 100%; }
.screen {
  font: 11px/1.25 ui-monospace, Menlo, Consolas, monospace; background: var(--code);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px; height: 300px;
  overflow: auto; white-space: pre; margin: 6px 0; user-select: text; -webkit-user-select: text;
}
.keys { display: flex; gap: 6px; }
.keys button { flex: 1; padding: 9px 0; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
.line { display: flex; gap: 6px; margin-top: 6px; }
.line input { flex: 1; }
.line button { border: 0; border-radius: 10px; background: var(--blue); padding: 0 14px; }
.log { white-space: pre-wrap; font-size: 14px; color: var(--text); min-height: 120px; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 20;
  bottom: calc(96px + env(safe-area-inset-bottom)); max-width: calc(100% - 32px);
  background: #2b303b; color: var(--text); padding: 10px 16px; border-radius: 12px;
  font-size: 14px; box-shadow: 0 4px 18px rgba(0, 0, 0, .4);
}

/* Карточка файла (вложение) */
.attach{display:flex;align-items:center;gap:10px;margin-top:8px;padding:8px 10px;
  border-radius:10px;background:rgba(127,160,200,.14)}
.attach-ic{font-size:20px;line-height:1}
.attach-info{flex:1;min-width:0}
.attach-name{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.attach-size{font-size:12px;color:var(--dim)}
.attach-dl{flex:none;padding:7px 14px;border-radius:8px;background:var(--accent,#2f6bd1);
  color:#fff;text-decoration:none;font-size:14px;font-weight:600}
.attach-dl:active{opacity:.8}
