:root {
  --bg: #04060d;
  --panel: rgba(10, 20, 34, 0.55);
  --cyan: #35e2ff;
  --dim: #6b7d94;
  --text: #dfeaff;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: radial-gradient(circle at 50% 22%, #0a1626 0%, var(--bg) 70%);
  color: var(--text);
  font-family: "SF Mono", "Roboto Mono", ui-monospace, monospace;
  overflow: hidden;
}
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* --- Orb --- */
#orb-wrap { position: relative; height: 34vh; min-height: 200px; flex: none; }
#scene { position: absolute; inset: 0; }
#orb-hit { position: absolute; inset: 0; background: transparent; border: none; cursor: pointer; z-index: 2; }
#status {
  position: absolute; bottom: 8px; left: 0; right: 0; text-align: center;
  text-transform: uppercase; letter-spacing: 0.32em; font-size: 11px;
  color: var(--cyan); opacity: 0.85; text-shadow: 0 0 12px rgba(53,226,255,0.6);
  pointer-events: none;
}
.state-listening #status { color: #7CFFB2; }
.state-thinking #status { color: #ffd166; }
.state-speaking #status { color: var(--cyan); }

/* --- Chat log --- */
#chat {
  flex: 1; overflow-y: auto; padding: 16px 14px 8px;
  display: flex; flex-direction: column; gap: 10px;
  -webkit-overflow-scrolling: touch;
}
.bubble {
  max-width: 88%; padding: 10px 13px; border-radius: 14px;
  font-size: 15px; line-height: 1.5; word-wrap: break-word; overflow-wrap: anywhere;
}
.bubble.user { align-self: flex-end; background: rgba(53,226,255,0.14); border: 1px solid rgba(53,226,255,0.3); }
.bubble.bot { align-self: flex-start; background: var(--panel); border: 1px solid rgba(120,150,190,0.18); }
.bubble.bot.thinking { color: var(--dim); font-style: italic; }

/* markdown inside bot bubbles */
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 6px 0 8px 20px; } .bubble li { margin: 3px 0; }
.bubble img { max-width: 100%; border-radius: 10px; margin: 6px 0; display: block; }
.bubble a { color: var(--cyan); }
.bubble code { background: rgba(255,255,255,0.08); padding: 1px 5px; border-radius: 5px; font-size: 0.9em; }
.bubble pre { background: rgba(0,0,0,0.35); padding: 10px; border-radius: 10px; overflow-x: auto; margin: 6px 0; }
.bubble pre code { background: none; padding: 0; }
.bubble table { border-collapse: collapse; margin: 6px 0; font-size: 0.9em; }
.bubble th, .bubble td { border: 1px solid rgba(120,150,190,0.3); padding: 4px 8px; }
.bubble blockquote { border-left: 3px solid var(--cyan); margin: 6px 0; padding-left: 10px; color: #b9cae6; }

/* --- Composer --- */
#composer {
  flex: none; display: flex; gap: 8px; align-items: center;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(4,8,15,0.8); border-top: 1px solid rgba(120,150,190,0.15);
}
#composer input {
  flex: 1; background: rgba(255,255,255,0.06); border: 1px solid rgba(120,150,190,0.25);
  color: var(--text); padding: 11px 14px; border-radius: 22px; font-size: 15px; outline: none;
  font-family: inherit;
}
#composer input:focus { border-color: var(--cyan); }
#composer button {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  font-size: 18px; display: grid; place-items: center;
}
#mic { background: rgba(53,226,255,0.14); color: var(--cyan); }
#mic.on { background: #7CFFB2; color: #04121a; }
#send { background: var(--cyan); color: #04121a; }
