:root {
  --bg: #f6f6f9;
  --panel: #ffffff;
  --text: #1c1c24;
  --muted: #6b6b7b;
  --line: #e4e4ec;
  --accent: #5b5bd6;
  --accent-soft: #ececfb;
  --me: #8a6d1f;
  --client: #1f6f5c;
  --warn: #b4531a;
  --danger: #c23b3b;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121218;
    --panel: #1c1c25;
    --text: #ececf3;
    --muted: #9a9aac;
    --line: #2d2d3a;
    --accent: #8f8ff0;
    --accent-soft: #26264a;
    --me: #e0c068;
    --client: #6fd0b5;
    --warn: #f0a060;
    --danger: #f07070;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121218; --panel: #1c1c25; --text: #ececf3; --muted: #9a9aac; --line: #2d2d3a;
  --accent: #8f8ff0; --accent-soft: #26264a; --me: #e0c068; --client: #6fd0b5; --warn: #f0a060; --danger: #f07070;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}
[hidden] { display: none !important; }

button, .button {
  font: inherit;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.danger { border-color: var(--danger); color: var(--danger); }
button:disabled { opacity: .5; cursor: default; }
kbd { font: 12px ui-monospace, monospace; border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }

.bar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel);
  flex-wrap: wrap;
}
.brand { font-weight: 700; }
.meta { color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; gap: 8px; align-items: center; }
.chip { font-size: 13px; line-height: 1.4; padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; flex: none; }
.chip.warn { background: transparent; border: 1px solid var(--warn); color: var(--warn); }
.chip.on::before { content: "● "; color: var(--danger); }
.actions { display: flex; gap: 8px; }

.setup { max-width: 560px; margin: 48px auto; padding: 0 16px; width: 100%; }
.setup h1 { font-size: 28px; margin: 0 0 24px; }
.setup label { display: block; margin-bottom: 16px; color: var(--muted); font-size: 14px; }
.setup input, .setup select {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 17px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px;
}
.consent { color: var(--muted); font-size: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.error { color: var(--danger); }
button.small { padding: 6px 12px; font-size: 14px; }
.who-am-i { color: var(--muted); font-size: 14px; align-self: center; }
.active-box { margin-top: 24px; padding: 16px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft); }
.active-box p { margin: 0; }

.live {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; padding: 16px;
}
.hint-col, .transcript-col { min-height: 0; display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px 28px; transition: opacity .2s;
}
.card.thinking { opacity: .55; }
.card.fresh { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.topic { color: var(--accent); font-weight: 600; font-size: 15px; text-transform: uppercase; letter-spacing: .03em; }
.question { font-size: clamp(24px, 2.6vw, 34px); line-height: 1.25; font-weight: 600; margin: 12px 0 14px; }
.question:empty { display: none; }
.backup { font-size: 18px; color: var(--text); opacity: .8; }
.backup:not(:empty)::before { content: "или: "; color: var(--muted); }
.why { margin-top: 10px; color: var(--muted); font-size: 14px; }
.card-foot { margin-top: 14px; font-size: 12px; color: var(--muted); }

.history { list-style: none; margin: 0; padding: 0; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.history li { color: var(--muted); font-size: 14px; padding: 8px 12px; border-left: 3px solid var(--line); }

.transcript {
  flex: 1; overflow: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px;
}
.seg { padding: 6px 0; display: grid; grid-template-columns: 48px 64px 1fr; gap: 8px; }
.seg .ts { color: var(--muted); font: 12px ui-monospace, monospace; padding-top: 4px; }
.seg .who { font-size: 13px; font-weight: 600; padding-top: 2px; }
.seg.me .who { color: var(--me); }
.seg.client .who { color: var(--client); }
.seg.me .text { color: var(--muted); }
.interim { color: var(--muted); font-style: italic; min-height: 1.5em; padding: 0 4px; }

@media (max-width: 820px) {
  .live { grid-template-columns: 1fr; grid-template-rows: auto minmax(240px, 1fr); }
  .history { display: none; }
  .meta { display: none; }
}
