:root {
  --fc-purple-900: #1e0c3a;
  --fc-purple-800: #2a1352;
  --fc-purple-700: #3a1d6e;
  --fc-purple-600: #5a32a3;
  --fc-purple-500: #7b4fc4;
  --fc-purple-100: #ece4f7;
  --fc-purple-50: #f6f1fb;
  --fc-ink: #1a1a1a;
  --fc-muted: #6b6478;
  --fc-line: #e8e3ef;
  --fc-bg: #faf8fc;
  --fc-white: #ffffff;
  --shadow-lg: 0 20px 50px rgba(30, 12, 58, 0.18), 0 8px 16px rgba(30, 12, 58, 0.08);
  --shadow-md: 0 8px 24px rgba(30, 12, 58, 0.16);
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--fc-ink);
  background: var(--fc-bg);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Host page ---------- */
.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}
.page__inner {
  max-width: 640px;
}
.page__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 600;
  color: var(--fc-purple-600);
  margin: 0 0 12px;
}
.page__title {
  font-size: 40px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  color: var(--fc-purple-900);
}
.page__lede {
  font-size: 17px;
  line-height: 1.55;
  color: var(--fc-muted);
  margin: 0;
}

/* ---------- Widget container ---------- */
.lumina {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  font-family: inherit;
}

/* Launcher (collapsed state) */
.lumina__launcher {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: var(--fc-purple-900);
  color: var(--fc-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.lumina__launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 56px rgba(30, 12, 58, 0.28);
}
.lumina__launcher .lumina__sparkle {
  width: 28px;
  height: 28px;
  fill: var(--fc-white);
}
.lumina--collapsed .lumina__panel { display: none; }
.lumina--expanded .lumina__launcher { display: none; }

/* Panel (expanded state) */
.lumina__panel {
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 48px);
  background: var(--fc-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: lumina-rise 0.22s ease-out;
}
@keyframes lumina-rise {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.lumina__header {
  background: linear-gradient(135deg, var(--fc-purple-900), var(--fc-purple-800));
  color: var(--fc-white);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.lumina__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lumina__avatar--header {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--fc-white);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lumina__avatar--header svg {
  width: 18px;
  height: 18px;
  fill: var(--fc-purple-900);
}
.lumina__brand-text h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.lumina__brand-text p {
  margin: 1px 0 0;
  font-size: 11px;
  opacity: 0.78;
  font-weight: 400;
}
.lumina__controls {
  display: flex;
  gap: 4px;
}
.lumina__icon-btn {
  background: transparent;
  border: none;
  color: var(--fc-white);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.lumina__icon-btn:hover { background: rgba(255,255,255,0.12); opacity: 1; }
.lumina__icon-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Body / message stream */
.lumina__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 16px 8px;
  background: var(--fc-bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lumina__body::-webkit-scrollbar { width: 6px; }
.lumina__body::-webkit-scrollbar-thumb { background: var(--fc-line); border-radius: 3px; }

.msg { display: flex; gap: 8px; max-width: 100%; }
.msg__avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--fc-purple-900);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
}
.msg__avatar svg { width: 14px; height: 14px; fill: var(--fc-white); }
.msg__bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-width: 80%;
}

/* Assistant */
.msg--bot { justify-content: flex-start; }
.msg--bot .msg__bubble {
  background: var(--fc-white);
  color: var(--fc-ink);
  border-top-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(30, 12, 58, 0.04);
}

/* User */
.msg--user { justify-content: flex-end; }
.msg--user .msg__bubble {
  background: var(--fc-purple-900);
  color: var(--fc-white);
  border-top-right-radius: 4px;
}

/* Timestamp under each bubble group */
.msg__time {
  font-size: 10px;
  color: var(--fc-muted);
  margin: -4px 36px 0;
  align-self: flex-start;
}
.msg--user + .msg__time { align-self: flex-end; margin: -4px 4px 0; }

/* Typing indicator */
.typing { display: inline-flex; gap: 3px; padding: 4px 0; }
.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--fc-purple-500);
  opacity: 0.4;
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

/* Welcome product menu */
.menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-left: 36px;
}
.menu__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--fc-white);
  border: 1px solid var(--fc-line);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  color: var(--fc-ink);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.menu__item:hover {
  border-color: var(--fc-purple-500);
  transform: translateX(2px);
}
.menu__icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--fc-purple-50);
  color: var(--fc-purple-700);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.menu__icon svg { width: 18px; height: 18px; fill: currentColor; }
.menu__text { flex: 1; }
.menu__title { font-weight: 600; }
.menu__sub { font-size: 12px; color: var(--fc-muted); margin-top: 2px; }
.menu__chev { color: var(--fc-purple-700); }
.menu__chev svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

/* Suggestion chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -4px 0 4px 36px;
}
.chip {
  background: var(--fc-white);
  border: 1px solid var(--fc-purple-500);
  color: var(--fc-purple-700);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}
.chip:hover { background: var(--fc-purple-500); color: var(--fc-white); }

/* Footer / input */
.lumina__footer {
  padding: 10px 12px 12px;
  background: var(--fc-white);
  border-top: 1px solid var(--fc-line);
  flex-shrink: 0;
}
.lumina__input-row {
  display: flex;
  align-items: center;
  background: var(--fc-bg);
  border: 1px solid var(--fc-line);
  border-radius: 999px;
  padding: 4px 4px 4px 16px;
  transition: border-color 0.15s ease;
}
.lumina__input-row:focus-within { border-color: var(--fc-purple-500); }
.lumina__input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  padding: 8px 0;
  font-size: 14px;
  font-family: inherit;
  color: var(--fc-ink);
}
.lumina__input::placeholder { color: var(--fc-muted); }
.lumina__send {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--fc-purple-900);
  color: var(--fc-white);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease;
}
.lumina__send:hover { background: var(--fc-purple-700); }
.lumina__send:disabled { background: var(--fc-purple-100); color: var(--fc-purple-500); cursor: not-allowed; }
.lumina__send svg { width: 14px; height: 14px; fill: currentColor; }

.lumina__disclaimer {
  margin: 8px 4px 0;
  font-size: 10px;
  color: var(--fc-muted);
  text-align: center;
}

/* Mobile */
@media (max-width: 480px) {
  .lumina { right: 12px; bottom: 12px; }
  .lumina__panel { width: calc(100vw - 24px); height: calc(100vh - 24px); }
}
