/* NODAL Cortex — design tokens & layout */
:root {
  --bg: #0a0814;
  --bg-2: #0f0c1d;
  --panel: rgba(20, 16, 38, 0.65);
  --panel-2: rgba(28, 22, 50, 0.55);
  --border: rgba(120, 100, 200, 0.12);
  --border-2: rgba(120, 100, 200, 0.22);
  --text: #e7e5f5;
  --text-dim: #9b97b8;
  --text-mute: #6b6789;
  --violet: #8b5cf6;
  --violet-2: #a855f7;
  --blue: #6366f1;
  --cyan: #22d3ee;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --pink: #ec4899;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* Background canvas decorations */
body {
  background:
    radial-gradient(1200px 600px at 50% -100px, rgba(139, 92, 246, 0.15), transparent 60%),
    radial-gradient(800px 400px at 0% 100%, rgba(99, 102, 241, 0.08), transparent 70%),
    var(--bg);
  overflow-x: hidden;
}
.wave-deco { position: fixed; left: 0; bottom: 0; width: 320px; height: 200px; opacity: 0.5; pointer-events: none; z-index: 0; }
.wave-deco canvas { width: 100%; height: 100%; }

/* Layout grid: sidebar | main | rail */
.app {
  display: grid;
  grid-template-columns: 240px 1fr 360px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ─── Sidebar ─────────────────────────────────────── */
.sidebar {
  padding: 22px 16px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: linear-gradient(180deg, rgba(20,16,38,0.4), rgba(20,16,38,0));
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 50%;
  background: conic-gradient(from 0deg, #8b5cf6, #6366f1, #22d3ee, #ec4899, #8b5cf6);
  position: relative;
}
.brand-mark::after {
  content: ''; position: absolute; inset: 6px; border-radius: 50%;
  background: var(--bg);
}
.brand-name { font-weight: 800; letter-spacing: 0.04em; font-size: 15px; }
.brand-sub { font-size: 9px; letter-spacing: 0.3em; color: var(--text-mute); margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-md);
  color: var(--text-dim); transition: all 0.15s ease;
  cursor: pointer;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(120, 100, 200, 0.08); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(139,92,246,0.22), rgba(139,92,246,0.06)); color: var(--text); box-shadow: inset 3px 0 0 var(--violet); }
.nav-label { font-size: 13px; font-weight: 500; line-height: 1.2; }
.nav-sub { font-size: 10px; color: var(--text-mute); margin-top: 1px; }

.user-card {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--r-md);
  background: rgba(120, 100, 200, 0.06);
  border: 1px solid var(--border);
  cursor: pointer;
}
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #f59e0b, #ec4899); flex-shrink: 0; }
.user-meta { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; line-height: 1.2; }
.user-role { font-size: 10px; color: var(--text-mute); }
.chev { width: 14px; height: 14px; color: var(--text-mute); }

/* ─── Main ───────────────────────────────────────── */
.main { padding: 22px 28px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.greeting { font-size: 16px; font-weight: 500; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: rgba(20,16,38,0.6); border: 1px solid var(--border);
  padding: 8px 12px; border-radius: 10px; min-width: 280px;
}
.search svg { width: 14px; height: 14px; color: var(--text-mute); }
.search input { flex: 1; background: transparent; border: 0; color: var(--text); outline: none; font-size: 13px; }
.search input::placeholder { color: var(--text-mute); }
.search kbd { font-size: 10px; color: var(--text-mute); background: rgba(255,255,255,0.04); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border); }
.icon-btn { position: relative; width: 36px; height: 36px; border-radius: 10px; background: rgba(20,16,38,0.6); border: 1px solid var(--border); color: var(--text-dim); display: grid; place-items: center; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { color: var(--text); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 6px; height: 6px; background: var(--violet); border-radius: 50%; }
.user-bubble { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #8b5cf6, #6366f1); }

/* Hero */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; }
.hero-title { font-size: 56px; font-weight: 800; letter-spacing: 0.06em; margin: 8px 0 4px; }
.gradient-text { background: linear-gradient(90deg, #22d3ee, #8b5cf6, #ec4899); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--text-dim); font-size: 15px; margin: 0 0 24px; }

/* Glowing orb */
.orb-wrap {
  position: relative;
  width: 280px; height: 280px;
  margin: 8px 0 28px;
  display: grid; place-items: center;
}
.orb-core {
  position: absolute;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.4), rgba(139,92,246,0.6) 30%, rgba(99,102,241,0.4) 60%, transparent 80%);
  box-shadow: 0 0 60px rgba(139,92,246,0.6), inset 0 0 30px rgba(139,92,246,0.4);
  filter: drop-shadow(0 0 40px rgba(139,92,246,0.5));
  animation: orbPulse 4s ease-in-out infinite;
}
@keyframes orbPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 40px rgba(139,92,246,0.5)); }
  50% { transform: scale(1.05); filter: drop-shadow(0 0 60px rgba(139,92,246,0.8)); }
}
.orb-ring { position: absolute; border-radius: 50%; border: 1px solid rgba(139,92,246,0.2); }
.orb-ring.r1 { width: 160px; height: 160px; animation: spin 18s linear infinite; }
.orb-ring.r2 { width: 200px; height: 200px; border-style: dashed; border-color: rgba(99,102,241,0.18); animation: spin 26s linear infinite reverse; }
.orb-ring.r3 { width: 240px; height: 240px; border-color: rgba(34,211,238,0.12); animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.orb-waves { position: absolute; width: 360px; height: 80px; opacity: 0.85; }

/* Prompt */
.prompt {
  width: min(640px, 92%);
  display: flex; align-items: center; gap: 8px;
  background: rgba(20,16,38,0.7);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  padding: 8px 10px 8px 18px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.prompt:focus-within { border-color: rgba(139,92,246,0.5); }
.prompt input {
  flex: 1; background: transparent; border: 0; outline: none;
  color: var(--text); font-size: 15px; padding: 12px 0;
}
.prompt input::placeholder { color: var(--text-mute); }
.prompt-tools { display: flex; gap: 4px; }
.tool {
  width: 36px; height: 36px; border-radius: 10px; background: transparent; border: 0; color: var(--text-mute);
  display: grid; place-items: center;
}
.tool svg { width: 16px; height: 16px; }
.tool:hover { background: rgba(120,100,200,0.1); color: var(--text); }
.tool.mic { color: var(--violet); }
.tool.mic.recording { background: rgba(239,68,68,0.2); color: var(--red); animation: micPulse 1.2s ease-in-out infinite; }
@keyframes micPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5);} 50% { box-shadow: 0 0 0 8px rgba(239,68,68,0);} }
.send {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  border: 0; color: white;
  display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(139,92,246,0.4);
}
.send svg { width: 16px; height: 16px; }
.send:hover { transform: translateY(-1px); }
.send:disabled { opacity: 0.5; cursor: wait; transform: none; }

/* Suggestions */
.suggestions { width: min(640px, 92%); margin-top: 16px; }
.suggest-label { color: var(--text-mute); font-size: 12px; margin-bottom: 8px; text-align: left; }
.suggest-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: rgba(20,16,38,0.6);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 12px; border-radius: 999px;
  font-size: 12px;
  transition: all 0.15s;
}
.chip:hover { background: rgba(139,92,246,0.1); border-color: rgba(139,92,246,0.3); color: var(--text); }

/* Reply thread */
.thread { width: min(640px, 92%); margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.msg {
  text-align: left;
  padding: 14px 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(10px);
  line-height: 1.6;
  animation: msgIn 0.3s ease;
}
.msg.user { background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(99,102,241,0.08)); border-color: rgba(139,92,246,0.3); }
.msg.assistant { background: var(--panel); }
.msg .role { font-size: 11px; color: var(--text-mute); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.1em; }
.msg .body { white-space: pre-wrap; }
.msg .body code { background: rgba(255,255,255,0.08); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.msg .body pre { background: rgba(0,0,0,0.4); padding: 10px; border-radius: 8px; overflow-x: auto; }
.msg .body p { margin: 0 0 8px; }
.msg .body p:last-child { margin-bottom: 0; }
.msg .actions { display: flex; gap: 6px; margin-top: 8px; }
.msg .actions button { background: transparent; border: 1px solid var(--border); color: var(--text-mute); font-size: 11px; padding: 4px 8px; border-radius: 6px; }
.msg .actions button:hover { color: var(--text); border-color: var(--border-2); }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.typing { display: inline-flex; gap: 3px; align-items: center; padding: 4px 0; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--violet); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }

/* Photo upload previews */
.photo-btn { color: var(--cyan); }
.photo-btn:hover { background: rgba(34,211,238,0.15); color: white; }

.photo-previews {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0 0;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}
.photo-previews[hidden] { display: none; }
.photo-thumb {
  position: relative;
  width: 72px; height: 72px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-2);
  background: rgba(20,16,38,0.6);
  flex-shrink: 0;
}
.photo-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.photo-thumb .remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: white;
  border: 0;
  display: grid; place-items: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.photo-thumb .remove:hover { background: var(--red); }

/* Image inside a chat message bubble */
.msg .body img.uploaded-img {
  max-width: 100%;
  max-height: 280px;
  border-radius: 8px;
  margin: 4px 0 8px;
  display: block;
  border: 1px solid var(--border);
}

/* Recent projects */
.recent { width: 100%; margin-top: 32px; text-align: left; }
.recent-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.recent h3 { margin: 0; font-size: 15px; font-weight: 600; }
.link { color: var(--violet); font-size: 12px; }
.link:hover { text-decoration: underline; }
.project-list { display: flex; flex-direction: column; gap: 8px; }
.project {
  display: grid; grid-template-columns: 36px 1fr auto auto auto;
  align-items: center; gap: 14px;
  padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: all 0.15s;
}
.project:hover { background: var(--panel-2); border-color: var(--border-2); transform: translateX(2px); }
.proj-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: color-mix(in srgb, var(--c) 18%, transparent);
  color: var(--c);
  display: grid; place-items: center;
  font-size: 18px;
}
.proj-name { font-weight: 500; font-size: 13px; }
.proj-desc { font-size: 11px; color: var(--text-mute); margin-top: 2px; }
.status { font-size: 11px; padding: 3px 10px; border-radius: 999px; font-weight: 500; }
.status.in-progress { background: rgba(139,92,246,0.15); color: #c4b5fd; }
.status.planning { background: rgba(99,102,241,0.15); color: #a5b4fc; }
.status.review { background: rgba(245,158,11,0.15); color: #fcd34d; }
.proj-time { font-size: 11px; color: var(--text-mute); }
.chev-r { color: var(--text-mute); font-size: 18px; }

/* ─── Right rail ─────────────────────────────────── */
.rail { padding: 22px 22px 22px 0; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  backdrop-filter: blur(10px);
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; gap: 12px; }
.card-title { font-size: 13px; font-weight: 600; }
.card-sub { font-size: 11px; color: var(--text-mute); margin-top: 2px; }
.pill { background: rgba(20,16,38,0.8); border: 1px solid var(--border); color: var(--text-dim); font-size: 11px; padding: 5px 10px; border-radius: 8px; }

.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.metric {
  background: rgba(20,16,38,0.4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  position: relative;
}
.metric-label { font-size: 11px; color: var(--text-mute); }
.metric-value { font-size: 24px; font-weight: 700; margin: 6px 0; letter-spacing: -0.02em; }
.spark { width: 100%; height: 24px; display: block; margin-bottom: 4px; }
.spark polyline { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.s-green { stroke: var(--green); }
.s-blue { stroke: var(--blue); }
.s-purple { stroke: var(--violet); }
.s-red { stroke: var(--red); }
.metric-delta { font-size: 11px; }
.metric-delta.up { color: var(--green); }
.metric-delta.down { color: var(--red); }

.activity { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.activity li { display: flex; align-items: center; gap: 10px; }
.dot-icon {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 13px;
  flex-shrink: 0;
}
.dot-icon.green { background: rgba(16,185,129,0.15); color: var(--green); }
.dot-icon.purple { background: rgba(139,92,246,0.15); color: var(--violet); }
.dot-icon.blue { background: rgba(99,102,241,0.15); color: var(--blue); }
.dot-icon.amber { background: rgba(245,158,11,0.15); color: var(--amber); }
.act-meta { flex: 1; min-width: 0; }
.act-title { font-size: 12px; font-weight: 500; }
.act-sub { font-size: 10px; color: var(--text-mute); margin-top: 1px; }
.act-time { font-size: 10px; color: var(--text-mute); white-space: nowrap; }

.decisions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.decisions li {
  padding: 12px;
  background: rgba(20,16,38,0.4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.dec-row1 { display: flex; justify-content: space-between; margin-bottom: 6px; }
.dec-id { font-size: 10px; color: var(--text-mute); font-family: ui-monospace, monospace; }
.dec-tag { font-size: 10px; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.dec-tag.high { background: rgba(239,68,68,0.15); color: #fca5a5; }
.dec-tag.medium { background: rgba(245,158,11,0.15); color: #fcd34d; }
.dec-title { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.dec-desc { font-size: 11px; color: var(--text-mute); line-height: 1.4; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(20,16,38,0.95); border: 1px solid var(--border-2);
  padding: 10px 16px; border-radius: 10px; font-size: 12px;
  box-shadow: var(--shadow);
  z-index: 100;
  animation: toastIn 0.3s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Responsive */
@media (max-width: 1200px) {
  .app { grid-template-columns: 220px 1fr; }
  .rail { display: none; }
}
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 16px; }
  .hero-title { font-size: 40px; }
  .search { min-width: 0; }
  .topbar-right .search { display: none; }
}

/* ─── Live Talk Panel ─────────────────────────────────────────── */
.tool.live-talk-btn { color: var(--violet-2); }
.tool.live-talk-btn:hover { background: rgba(168,85,247,0.15); color: white; }

.live-talk {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-height: 70vh;
  background: linear-gradient(180deg, rgba(28, 22, 50, 0.95), rgba(20, 16, 38, 0.95));
  border: 1px solid var(--border-2);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(139,92,246,0.15);
  backdrop-filter: blur(20px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  animation: ltSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes ltSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: none; }
}

.lt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.lt-title {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 14px;
}
.lt-pulse {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 0 0 rgba(139,92,246, 0.6);
}
.live-talk.active .lt-pulse { animation: ltDot 1.5s infinite; }
.live-talk.speaking .lt-pulse { background: var(--green); }
.live-talk.thinking .lt-pulse { background: var(--blue); }
@keyframes ltDot {
  0%,100% { box-shadow: 0 0 0 0 rgba(139,92,246, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(139,92,246, 0); }
}
.lt-actions { display: flex; gap: 6px; }
.lt-icon-btn {
  /* Slightly larger than the old 28px so the touch target is at
     least 36×36px (Material Design minimum, close to Apple HIG 44pt). */
  width: 36px; height: 36px;
  border: 0; background: transparent;
  color: var(--text-dim); border-radius: 8px;
  display: grid; place-items: center;
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(120,100,200,0.2);
  touch-action: manipulation;
}
.lt-icon-btn svg { width: 16px; height: 16px; }
.lt-icon-btn:hover { background: rgba(120,100,200,0.1); color: var(--text); }
.lt-icon-btn:active { transform: scale(0.92); }
.lt-icon-close { color: var(--red); }
.lt-icon-close:hover { background: rgba(239,68,68,0.15); color: var(--red); }
.lt-icon-btn.muted { background: rgba(239,68,68,0.18); color: var(--red); }
.lt-icon-btn.muted:hover { background: rgba(239,68,68,0.28); }
.lt-mute-x {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.lt-mute-x svg { width: 16px; height: 16px; }

.lt-mic-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  color: var(--green);
  position: relative;
}
.lt-mic-state svg { width: 12px; height: 12px; }
.lt-mic-state.muted { color: var(--red); }
.lt-mic-state::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 6px;
  background: currentColor;
  opacity: 0.12;
}

.lt-status {
  padding: 8px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.lt-state {
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.live-talk.active .lt-state { color: var(--violet); }
.live-talk.speaking .lt-state { color: var(--green); }
.live-talk.thinking .lt-state { color: var(--blue); }
.lt-meter {
  height: 3px; background: rgba(120,100,200,0.15);
  border-radius: 2px; margin-top: 8px; overflow: hidden;
}
.lt-meter-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  border-radius: 2px;
  transition: width 80ms ease;
}

.lt-transcript {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
  max-height: 360px;
}
.lt-transcript::-webkit-scrollbar { width: 4px; }
.lt-transcript::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

.lt-empty {
  color: var(--text-mute);
  font-size: 12px;
  text-align: center;
  padding: 20px 0;
  line-height: 1.5;
}

.lt-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: ltFadeIn 0.3s ease;
}
@keyframes ltFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.lt-msg .lt-role {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
}
.lt-msg.user .lt-role { color: var(--violet); }
.lt-msg.assistant .lt-role { color: var(--green); }
.lt-msg .lt-body {
  font-size: 13px;
  line-height: 1.5;
  background: rgba(20,16,38,0.6);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.lt-msg.user .lt-body {
  background: rgba(139,92,246,0.12);
  border-color: rgba(139,92,246,0.3);
}
.lt-msg.thinking .lt-body { color: var(--text-mute); font-style: italic; }
.lt-msg.interim .lt-body { opacity: 0.6; border-style: dashed; }

.lt-controls {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--border);
}
.lt-mic {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--blue));
  border: 0;
  color: white;
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(139,92,246,0.4);
  transition: all 0.2s;
  flex-shrink: 0;
}
.lt-mic svg { width: 22px; height: 22px; }
.lt-mic:hover { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(139,92,246,0.5); }
.lt-mic.listening {
  background: linear-gradient(135deg, #ef4444, #f59e0b);
  animation: ltMicPulse 1.2s infinite;
}
@keyframes ltMicPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68, 0.6); }
  50% { box-shadow: 0 0 0 14px rgba(239,68,68, 0); }
}
.lt-mic.busy { opacity: 0.5; cursor: wait; }

.lt-send {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: rgba(120,100,200,0.15);
  border: 1px solid var(--border-2);
  color: var(--violet);
  display: grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.lt-send svg { width: 16px; height: 16px; }
.lt-send:hover { background: rgba(139,92,246,0.25); border-color: var(--violet); color: white; }
.lt-send:disabled { opacity: 0.3; cursor: not-allowed; }

.lt-hint { font-size: 11px; color: var(--text-mute); line-height: 1.4; }

.lt-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--blue));
  border: 0;
  color: white;
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(139,92,246,0.4);
  z-index: 999;
  animation: ltBob 2s ease-in-out infinite;
  transition: width 0.3s, border-radius 0.3s, padding 0.3s;
}
.lt-launcher svg { width: 22px; height: 22px; transition: opacity 0.3s, transform 0.3s; }
@keyframes ltBob {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.lt-launcher:hover { animation: none; transform: scale(1.05); }

/* When a session is live, the launcher stretches into a pill with status */
.lt-launcher.lt-launcher-live {
  width: auto;
  padding: 0 16px 0 14px;
  height: 48px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: none;
}
.lt-launcher.lt-launcher-live::before {
  content: '';
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(16,185,129,0.6);
  flex-shrink: 0;
}
.lt-launcher.lt-launcher-live::after {
  content: 'Tap to return to call';
  font-size: 12px;
  white-space: nowrap;
}
.lt-launcher.lt-launcher-live svg {
  opacity: 0.85;
  margin-right: 2px;
}

@media (max-width: 768px) {
  .live-talk { width: calc(100vw - 24px); right: 12px; bottom: 12px; }
  .lt-launcher { right: 12px; bottom: 12px; }
  .lt-launcher.lt-launcher-live { bottom: 12px; right: 12px; }
}

/* Minimized mode (used on mobile after openLiveTalk). Hides the body
   of the panel; shows only a compact bar with status + tap-to-expand. */
.live-talk.lt-minimized .lt-header,
.live-talk.lt-minimized .lt-status,
.live-talk.lt-minimized .lt-transcript,
.live-talk.lt-minimized .lt-controls {
  display: none;
}

.lt-min-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(120,100,200,0.2);
  touch-action: manipulation;
}
.lt-min-bar[hidden] { display: none; }
.live-talk.lt-minimized .lt-min-bar { display: flex; }

.lt-min-pulse {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 0 0 rgba(139,92,246, 0.6);
  animation: ltDot 1.5s infinite;
  flex-shrink: 0;
}
.live-talk.speaking .lt-min-pulse { background: var(--green); }
.live-talk.thinking .lt-min-pulse { background: var(--blue); }
.live-talk.muted .lt-min-pulse { background: var(--red); animation: none; }

.lt-min-label {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.lt-min-state {
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.live-talk.speaking .lt-min-state { color: var(--green); }
.live-talk.thinking .lt-min-state { color: var(--blue); }

/* When minimized, the panel itself becomes a narrow bar instead of a big card */
.live-talk.lt-minimized {
  width: auto;
  max-width: calc(100vw - 24px);
  min-width: 260px;
}
