/* Arcanus — Arcane Lineage chatbot styles */

:root {
  --violet-50: #f5f3ff;
  --violet-200: #ddd6fe;
  --violet-300: #c4b5fd;
  --violet-400: #a78bfa;
  --violet-500: #8b5cf6;
  --violet-700: #6d28d9;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: #0a0612;
  color: #eee;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100%;
  overflow-x: hidden;
}

.font-cinzel {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.05em;
}

/* Animated mystical background */
#bg-grad {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(124, 58, 237, 0.35), transparent 60%),
    radial-gradient(900px 500px at 90% 20%, rgba(67, 56, 202, 0.35), transparent 60%),
    radial-gradient(800px 600px at 50% 100%, rgba(139, 92, 246, 0.25), transparent 60%),
    linear-gradient(180deg, #0a0612 0%, #0e0820 60%, #060410 100%);
  animation: bgshift 18s ease-in-out infinite alternate;
}

@keyframes bgshift {
  0% { filter: hue-rotate(0deg) saturate(1); }
  100% { filter: hue-rotate(20deg) saturate(1.15); }
}

/* Faint rune particles */
#bg-runes {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(196, 181, 253, 0.18) 1px, transparent 1px),
    radial-gradient(rgba(196, 181, 253, 0.08) 1px, transparent 1px);
  background-size: 60px 60px, 25px 25px;
  background-position: 0 0, 30px 30px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  opacity: 0.6;
  animation: drift 30s linear infinite;
}

@keyframes drift {
  from { background-position: 0 0, 30px 30px; }
  to { background-position: 600px 600px, 630px 630px; }
}

/* Quick prompt buttons */
.qp-btn {
  font-size: 12px;
  color: #ddd6fe;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.qp-btn:hover {
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(167, 139, 250, 0.5);
  color: #fff;
  transform: translateY(-1px);
}

/* Chat messages */
.msg {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: fadein 0.25s ease-out;
}

@keyframes fadein {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  ring: 1px solid rgba(255, 255, 255, 0.1);
}

.msg-avatar.bot {
  background: linear-gradient(135deg, #8b5cf6, #4338ca);
  color: white;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
}

.msg-avatar.user {
  background: rgba(255, 255, 255, 0.08);
  color: #ddd6fe;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.msg-bubble {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border-radius: 14px;
  line-height: 1.55;
  font-size: 14.5px;
  word-wrap: break-word;
}

.msg.bot .msg-bubble {
  background: rgba(139, 92, 246, 0.10);
  border: 1px solid rgba(167, 139, 250, 0.18);
  color: #f3f0ff;
}

.msg.user .msg-bubble {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #fff;
}

.msg-bubble p { margin: 0 0 8px; }
.msg-bubble p:last-child { margin: 0; }

.msg-bubble strong { color: #ede9fe; }
.msg-bubble code {
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.9em;
  color: #c4b5fd;
}
.msg-bubble pre {
  background: rgba(0, 0, 0, 0.45);
  padding: 10px 12px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85em;
  border: 1px solid rgba(255,255,255,0.08);
}
.msg-bubble ul, .msg-bubble ol {
  margin: 6px 0 8px 20px;
  padding: 0;
}
.msg-bubble li { margin: 3px 0; }
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 {
  margin: 10px 0 6px;
  color: #ede9fe;
}
.msg-bubble h3 { font-size: 1em; font-weight: 600; }
.msg-bubble a { color: #c4b5fd; text-decoration: underline; }

/* Typing indicator */
.typing {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}
.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c4b5fd;
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* Scrollbar */
#chat-window::-webkit-scrollbar { width: 8px; }
#chat-window::-webkit-scrollbar-track { background: transparent; }
#chat-window::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.25);
  border-radius: 4px;
}
#chat-window::-webkit-scrollbar-thumb:hover {
  background: rgba(167, 139, 250, 0.5);
}

/* Textarea autoexpand */
#chat-input {
  max-height: 180px;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
}

/* Mobile tweaks */
@media (max-width: 640px) {
  .qp-btn { font-size: 11px; padding: 5px 10px; }
  .msg-bubble { font-size: 14px; padding: 10px 13px; }
}
