:root {
  --bg: #07070c;
  --bg-soft: #0e0e17;
  --card: #15151f;
  --card-2: #1c1c2a;
  --line: #26263a;
  --text: #ececf3;
  --muted: #9a9ab0;
  --violet: #8b5cf6;
  --violet-2: #a78bfa;
  --violet-glow: rgba(139, 92, 246, 0.35);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(139, 92, 246, 0.18), transparent 60%),
    var(--bg);
  color: var(--text);
  height: 100dvh;
  overflow: hidden;
}

.app {
  max-width: 720px;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 7, 12, 0.7);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.logo-ai {
  background: linear-gradient(90deg, var(--violet), var(--violet-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-left: 2px;
}
.tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.12em;
  color: var(--violet-2);
  border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 8px;
}
.status { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Chat */
.chat {
  flex: 1;
  overflow-y: auto;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.msg { display: flex; max-width: 86%; animation: rise 0.25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg.bot { align-self: flex-start; }
.msg.user { align-self: flex-end; }
.bubble {
  padding: 12px 15px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.bot .bubble {
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}
.msg.user .bubble {
  background: linear-gradient(135deg, var(--violet), #6d28d9);
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow: 0 6px 20px var(--violet-glow);
}
.bubble strong { font-weight: 700; }
.bubble em { color: var(--violet-2); font-style: normal; }

/* Typing indicator */
.typing .bubble { display: flex; gap: 5px; padding: 15px; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: blink 1.3s infinite both;
}
.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.25; } 30% { opacity: 1; } }

/* Composer */
.composer {
  display: flex; gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}
.input {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 16px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-glow); }
.input::placeholder { color: var(--muted); }
.send {
  display: grid; place-items: center;
  width: 48px; height: 48px;
  border: none; border-radius: 14px;
  background: linear-gradient(135deg, var(--violet), #6d28d9);
  color: #fff; cursor: pointer;
  transition: transform 0.12s, opacity 0.12s;
}
.send:hover { transform: translateY(-1px); }
.send:disabled { opacity: 0.45; cursor: default; transform: none; }
.footer {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 0 20px 12px;
}
.footer strong { color: var(--violet-2); }

@media (max-width: 600px) {
  .bubble { font-size: 14.5px; }
  .msg { max-width: 92%; }
}
