* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #0a0a0f;
  color: #c8c8d0;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  height: 100vh;
  overflow: hidden;
}

#app {
  display: grid;
  grid-template-columns: 30% 70%;
  grid-template-rows: 1fr auto auto;
  height: 100vh;
}

/* ── Left Panel: Transcript + LLM ──────────────────── */

#left-panel {
  grid-row: 1;
  grid-column: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1a1a2e;
  overflow: hidden;
}

#transcript-panel {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
}

#transcript-panel::-webkit-scrollbar { width: 4px; }
#transcript-panel::-webkit-scrollbar-thumb { background: #2a2a3e; border-radius: 2px; }

#transcript .interim { color: #8888a0; }
#transcript .final { color: #d0d0e0; }

#llm-panel {
  flex: 1;
  overflow-y: auto;
  padding: 0.8rem 1rem;
  font-size: 0.75rem;
  line-height: 1.5;
  border-top: 1px solid #1a1a2e;
  background: #0c0c14;
  color: #7a7a90;
}

#llm-panel::-webkit-scrollbar { width: 4px; }
#llm-panel::-webkit-scrollbar-thumb { background: #2a2a3e; border-radius: 2px; }

#llm-panel:empty::before {
  content: 'LLM output will appear here';
  color: #333348;
  font-style: italic;
}

.llm-entry {
  margin-bottom: 0.8rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid #15151f;
}

.llm-entry:last-child { border-bottom: none; }

.llm-entry .llm-time {
  color: #444458;
  font-size: 0.65rem;
  margin-bottom: 0.3rem;
}

.llm-entry .llm-text {
  color: #8a8aa0;
  white-space: pre-wrap;
}

.llm-entry .llm-concepts {
  margin-top: 0.3rem;
  color: #6a9a7a;
  font-size: 0.7rem;
}

/* ── Canvas ────────────────────────────────────────── */

#canvas-panel {
  grid-row: 1;
  grid-column: 2;
  position: relative;
  overflow: hidden;
}

#canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Glyph Rail ────────────────────────────────────── */

#glyph-rail {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 0;
  border-top: 1px solid #1a1a2e;
  background: #0c0c14;
  scrollbar-width: none;
}

#glyph-rail::-webkit-scrollbar { display: none; }

#glyph-rail:empty { display: none; }

.glyph {
  flex-shrink: 0;
  padding: 0.3rem 0.7rem;
  border-radius: 12px;
  font-size: 0.72rem;
  cursor: pointer;
  border: 1px solid;
  opacity: 0.85;
  transition: opacity 0.15s, transform 0.15s;
  white-space: nowrap;
}

.glyph:hover {
  opacity: 1;
  transform: scale(1.05);
}

.glyph-warm {
  background: rgba(240, 120, 90, 0.2);
  border-color: rgba(240, 120, 90, 0.5);
  color: #f0a090;
}

.glyph-cool {
  background: rgba(90, 150, 240, 0.2);
  border-color: rgba(90, 150, 240, 0.5);
  color: #90b8f0;
}

.glyph-neutral {
  background: rgba(180, 180, 200, 0.15);
  border-color: rgba(180, 180, 200, 0.4);
  color: #b8b8d0;
}

/* ── Controls ───────────────────────────────────────── */

#controls {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: #0e0e16;
  border-top: 1px solid #1a1a2e;
  font-size: 0.8rem;
}

#controls button {
  background: #1a1a2e;
  color: #c8c8d0;
  border: 1px solid #2a2a3e;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  transition: background 0.15s, border-color 0.15s;
}

#controls button:hover { background: #2a2a3e; }

#mic-btn.active {
  background: #2a1a1e;
  border-color: #e04060;
  color: #e04060;
}

#freeze-btn.active {
  background: #1a1a2e;
  border-color: #3a7bd5;
  color: #3a7bd5;
}

#llm-btn.active {
  background: #1a2a1e;
  border-color: #40c060;
  color: #40c060;
}

#llm-btn.processing {
  animation: llm-pulse 1s ease-in-out infinite;
}

@keyframes llm-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

#view-mode-btn.active {
  background: #1a1e2a;
  border-color: #a080d0;
  color: #a080d0;
}

#llm-status {
  font-size: 0.7rem;
  color: #666680;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.llm-status-info { color: #40c060; }
.llm-status-error { color: #e04060; }

#controls label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #666680;
}

#controls input[type="range"] {
  width: 80px;
  accent-color: #3a7bd5;
}

/* ── Settings Overlay ───────────────────────────────── */

.hidden { display: none !important; }

#settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#settings-panel {
  background: #12121e;
  border: 1px solid #2a2a3e;
  border-radius: 8px;
  padding: 1.5rem;
  width: 380px;
  max-width: 90vw;
}

#settings-panel h3 {
  margin-bottom: 1rem;
  font-size: 1rem;
  color: #e0e0e8;
}

#settings-panel label {
  display: block;
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.4rem;
}

#api-key-input {
  width: 100%;
  padding: 0.5rem;
  background: #0a0a14;
  border: 1px solid #2a2a3e;
  border-radius: 4px;
  color: #c8c8d0;
  font-family: inherit;
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
}

#api-key-input:focus {
  outline: none;
  border-color: #3a7bd5;
}

.settings-warning {
  font-size: 0.7rem;
  color: #666680;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.settings-warning a {
  color: #5a9bf5;
  text-decoration: none;
}

.settings-warning a:hover {
  text-decoration: underline;
}

.settings-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.settings-actions button {
  background: #1a1a2e;
  color: #c8c8d0;
  border: 1px solid #2a2a3e;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
}

.settings-actions button:hover { background: #2a2a3e; }

#save-key-btn { border-color: #40c060; color: #40c060; }
#clear-key-btn { border-color: #e04060; color: #e04060; }

#token-counter {
  font-size: 0.7rem;
  color: #555568;
}
