/* Lyftbridge palette */
:root {
  --lb-blue: #296CAC;      /* Lyftbridge Blue, primary */
  --lb-blue-deep: #14729B; /* Casamassima Blue 3 */
  --lb-blue-mid: #5D86AD;  /* Casamassima Blue 1 */
  --lb-blue-light: #93B1D4;/* Casamassima Blue 2 */
  --lb-black: #000000;
  --lb-white: #FFFFFF;

  /* Light theme (default) */
  --bg: #F4F7FB;
  --card: var(--lb-white);
  --text: #0B1A2B;
  --muted: #5A6B7E;
  --accent: var(--lb-blue);
  --accent-hover: var(--lb-blue-deep);
  --accent-soft: #E6EEF7;
  --accent-soft-text: var(--lb-blue);
  --stop: #C0392B;
  --ok: #2E7D4F;
  --border: #D6E0EC;
  --meter-bg: #E6EEF7;
  --code-bg: #0B1A2B;
  --code-text: #E6EEF7;
  font-family: Arial, Helvetica, sans-serif;
}

[data-theme="dark"] {
  --bg: var(--lb-black);
  --card: #0E1116;
  --text: var(--lb-white);
  --muted: #9AA8B8;
  --accent: var(--lb-blue);
  --accent-hover: var(--lb-blue-mid);
  --accent-soft: #14263A;
  --accent-soft-text: var(--lb-blue-light);
  --stop: #E5533F;
  --ok: #4CAF7A;
  --border: #22303F;
  --meter-bg: #1A2532;
  --code-bg: #05080C;
  --code-text: var(--lb-blue-light);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--border);
}
h1 { font-size: 1.2rem; margin: 0; font-weight: 700; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo { height: 28px; display: block; }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }
.header-actions { display: flex; gap: 4px; }
h2 { font-size: 1rem; margin: 0 0 8px; }

main {
  display: grid; grid-template-columns: 320px 1fr; gap: 20px;
  padding: 20px 24px; height: calc(100vh - 64px);
}

.controls, .transcript-wrap {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px;
}
.controls { display: flex; flex-direction: column; gap: 16px; }
.transcript-wrap { display: flex; flex-direction: column; min-height: 0; }

button {
  font: inherit; cursor: pointer; border: none; border-radius: 8px;
  padding: 8px 14px; background: var(--accent); color: #fff;
}
button:hover:not(:disabled) { background: var(--accent-hover); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary { background: var(--accent-soft); color: var(--accent-soft-text); }
button.secondary:hover:not(:disabled) { background: var(--accent-soft); filter: brightness(0.95); }

.start-btn { font-size: 1.4rem; font-weight: 600; padding: 18px; border-radius: 12px; }
.start-btn.running, .start-btn.running:hover { background: var(--stop); }

.icon-btn, .icon-btn:hover:not(:disabled) { background: none; color: var(--text); font-size: 1.4rem; padding: 4px 8px; }

.status-row { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot.connecting { background: #f9ab00; }
.dot.listening { background: var(--ok); }
.dot.speaking { background: var(--accent); }

.meter { height: 8px; background: var(--meter-bg); border-radius: 4px; overflow: hidden; }
#micLevel { height: 100%; width: 0; background: var(--lb-blue-mid); transition: width 60ms linear; }

.preview {
  position: relative; aspect-ratio: 16 / 10; background: #0B1A2B; border-radius: 8px; overflow: hidden;
}
.preview video { width: 100%; height: 100%; object-fit: contain; }
#previewHint {
  position: absolute; inset: 0; display: grid; place-items: center; color: #8a93a6; font-size: .85rem;
}

#transcript { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.msg { line-height: 1.45; }
.msg .who { font-weight: 600; margin-right: 6px; }
.msg.user .who { color: var(--muted); }
.msg.coach .who { color: var(--accent); }
.msg.system { color: var(--muted); font-size: .85rem; font-style: italic; }
.syntax {
  background: var(--code-bg); color: var(--code-text); border-radius: 8px; padding: 10px 12px; margin: 0;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; white-space: pre-wrap;
}
.syntax-label { font-size: .75rem; color: var(--muted); margin-bottom: 4px; }

dialog { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 0; width: min(520px, 92vw); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
dialog form { padding: 24px; display: flex; flex-direction: column; gap: 8px; }
label { font-weight: 600; font-size: .9rem; margin-top: 8px; }
input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; width: 100%;
  background: var(--card); color: var(--text);
}
.key-row { display: flex; gap: 6px; }
.key-row input { flex: 1; }
.hint { font-size: .8rem; color: var(--muted); margin: 0; }
.hint.ok { color: var(--ok); }
.hint.bad { color: var(--stop); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

.app-name { color: var(--accent-soft-text); font-weight: 600; margin-left: 6px; }
.app-name:empty { display: none; }
.app-name::before { content: "· "; color: var(--muted); }
.app-pick { display: flex; flex-direction: column; gap: 6px; }
.app-pick label { margin: 0; }
.share-tip { margin-top: -6px; line-height: 1.4; }
.share-tip::before { content: "Screen sharing tip: "; font-weight: 600; }
.transcript-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.transcript-head h2 { margin: 0; }
button.small { padding: 5px 10px; font-size: .85rem; }
.btn-row { display: flex; gap: 8px; }
.btn-row button { flex: 1; }
.chat { display: flex; gap: 8px; margin-top: 12px; align-items: flex-end; }
.chat textarea { flex: 1; resize: vertical; max-height: 40vh; }
.msg.user.typed .text { white-space: pre-wrap; }

@media (max-width: 760px) {
  main { grid-template-columns: 1fr; height: auto; }
  #transcript { max-height: 60vh; }
}
