:root {
  --purple: #5F348A;
  --purple-dark: #332561;
  --mint: #53FFA3;
  --mint-text: #432461;
  --surface: #F3EFFF;
  --bg: #FFFFFF;
  --line: #E7DFF5;
  --muted: #6B6484;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(51, 37, 97, 0.10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #FBFAFF 0%, #F3EFFF 100%);
  color: var(--purple-dark);
  font-family: 'Lato', ui-sans-serif, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  min-height: 100vh;
}

h1, h2, h3, .logo-text { font-family: 'Poppins', ui-sans-serif, system-ui, sans-serif; }

/* ---- top bar ---- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo { height: 34px; width: auto; display: block; }
.tagline {
  margin-left: auto;
  color: var(--purple);
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 14px;
}

/* ---- layout ---- */
.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 34px 20px 56px;
}
.intro { text-align: center; margin-bottom: 22px; }
.intro h1 {
  font-size: 40px;
  line-height: 1.1;
  margin: 0 0 10px;
  color: var(--purple-dark);
  font-weight: 700;
}
.intro .sub { margin: 0 auto; max-width: 620px; color: var(--muted); font-size: 18px; }
.intro .sub strong { color: var(--purple); }

/* ---- chat card ---- */
.chat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.chat-head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.chat-head[hidden] { display: none; }
.newchat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--purple);
  padding: 7px 15px;
  border-radius: 999px;
  font-family: 'Lato', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.newchat:hover { background: var(--surface); border-color: var(--purple); transform: translateY(-1px); }

.messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 90px;
  max-height: 56vh;
  overflow-y: auto;
  padding: 4px 4px 6px;
}
.messages:empty { display: none; }

.msg { display: flex; gap: 12px; align-items: flex-start; max-width: 100%; }
.msg .avatar {
  flex: 0 0 34px;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  overflow: hidden;
  background: var(--surface);
}
.msg .avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msg .avatar svg { width: 19px; height: 19px; display: block; }
.msg.bot .avatar { background: #5F348A; }
.bubble {
  border-radius: 14px;
  padding: 12px 16px;
  max-width: 78%;
}
.msg.bot .bubble { background: var(--surface); color: var(--purple-dark); border-top-left-radius: 4px; }
.msg.user { flex-direction: row-reverse; }
.msg.user .avatar { background: var(--purple-dark); color: #fff; }
.msg.user .bubble { background: var(--purple); color: #fff; border-top-right-radius: 4px; }
.bubble p { margin: 0 0 10px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul { margin: 6px 0; padding-left: 20px; }
.bubble li { margin: 3px 0; }
.bubble strong { font-weight: 700; }

/* typing */
.dots { display: inline-flex; gap: 5px; padding: 4px 2px; }
.dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--purple);
  opacity: .35;
  animation: blink 1.3s infinite both;
}
.dots span:nth-child(2) { animation-delay: .2s; }
.dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: .9; } }

/* sources */
.sources { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.sources .src-label { flex-basis: 100%; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.src {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--purple);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  text-decoration: none;
  font-weight: 700;
  transition: background .15s, border-color .15s;
}
.src:hover { background: var(--surface); border-color: var(--purple); }
.src::before { content: "🔗"; font-size: 11px; }

/* ---- starters ---- */
.starters { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 2px 4px; }
.chip {
  background: var(--surface);
  color: var(--purple-dark);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .1s, background .15s, border-color .15s;
}
.chip:hover { background: #fff; border-color: var(--purple); transform: translateY(-1px); }

/* ---- composer ---- */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 16px;
  background: #fff;
  border: 2px solid var(--purple);
  border-radius: 26px;
  padding: 6px 6px 6px 18px;
}
.composer textarea {
  flex: 1;
  border: 0;
  outline: none;
  resize: none;
  font-family: 'Lato', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--purple-dark);
  background: transparent;
  max-height: 140px;
  padding: 8px 0;
}
.composer textarea::placeholder { color: #9b93b3; }
.send {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--mint);
  color: var(--mint-text);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .1s, filter .15s;
}
.send:hover { filter: brightness(.95); transform: translateY(-1px); }
.send:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.disclaimer { margin: 14px 2px 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.disclaimer a { color: var(--purple); }
.demo-note { text-align: center; color: #9b93b3; font-size: 13px; margin-top: 26px; }
.demo-note strong { color: var(--purple); }

@media (max-width: 560px) {
  .intro h1 { font-size: 30px; }
  .bubble { max-width: 84%; }
  .tagline { display: none; }
}
