:root {
  color-scheme: light;
  --eml-navy: #000040;
  --eml-purple: #82109F;
  --eml-cyan: #00FFFF;
  --eml-gold: #FFD700;
  --ink: #17172f;
  --muted: #727286;
  --line: rgba(0, 0, 64, .12);
  --ease: cubic-bezier(.23, 1, .32, 1);
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 88% -4%, rgba(0,255,255,.10), transparent 34rem),
    radial-gradient(ellipse at -12% 13%, rgba(130,16,159,.07), transparent 32rem),
    #fbfaff;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
button, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(130,16,159,.30);
  outline-offset: 3px;
}

.header {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 960px;
  min-height: 76px;
  margin: auto;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  box-shadow: 0 5px 20px rgba(0,0,64,.035);
  backdrop-filter: blur(12px);
}
.header::before {
  position: absolute;
  bottom: -1px;
  left: 28px;
  width: 74px;
  height: 2px;
  background: linear-gradient(90deg, var(--eml-purple), var(--eml-cyan));
  content: "";
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { display: block; width: 42px; height: 42px; flex: 0 0 auto; object-fit: contain; }
.brand strong { display: block; color: var(--eml-navy); font-size: .85rem; letter-spacing: .1em; }
.brand small { display: block; margin-top: 3px; color: var(--eml-purple); font-size: .53rem; font-weight: 700; letter-spacing: .14em; }
.header-tools { display: flex; align-items: center; gap: 15px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #c4cad0; }
.dot.ready { background: #38b980; box-shadow: 0 0 0 4px rgba(56,185,128,.12); }
.dot.offline { background: var(--eml-cyan); box-shadow: 0 0 0 4px rgba(0,255,255,.18); }
.reset {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  color: var(--eml-navy);
  background: transparent;
  font-size: 1.15rem;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.reset:hover { color: var(--eml-navy); background: rgba(255,215,0,.18); transform: rotate(-12deg); }

main { width: min(100%, 760px); margin: auto; padding: 46px 28px 36px; }
.intro {
  position: relative;
  overflow: hidden;
  margin-bottom: 34px;
  padding: 23px 25px 22px;
  border: 1px solid rgba(130,16,159,.12);
  border-left: 4px solid var(--eml-purple);
  border-radius: 16px;
  background: linear-gradient(118deg, rgba(130,16,159,.07), rgba(0,255,255,.07) 100%);
  box-shadow: 0 10px 28px rgba(0,0,64,.045);
}
.intro::after {
  position: absolute;
  top: 23px;
  right: 24px;
  width: 38px;
  height: 3px;
  border-radius: 4px;
  background: var(--eml-gold);
  content: "";
}
.intro h1 {
  margin: 0;
  color: var(--eml-navy);
  font-size: clamp(2.2rem, 5.1vw, 3.55rem);
  font-weight: 650;
  line-height: .98;
  letter-spacing: -.065em;
}
.intro p { margin: 12px 0 0; color: var(--muted); font-size: .96rem; }
.thread { min-height: 340px; }
.message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  animation: enter .21s var(--ease) both;
}
.message.user { justify-content: flex-end; }
.sem-label {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  min-height: 38px;
  padding: 2px 0 0 9px;
  color: var(--eml-purple);
  font-size: .59rem;
  font-weight: 800;
  letter-spacing: .08em;
}
.sem-label::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 30px;
  border-radius: 2px;
  background: linear-gradient(var(--eml-cyan), var(--eml-purple));
  content: "";
}
.content {
  max-width: min(610px, calc(100% - 48px));
  padding: 13px 16px;
  border: 1px solid rgba(0,0,64,.08);
  border-radius: 4px 14px 14px 14px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 6px 18px rgba(0,0,64,.045);
}
.message.user .content {
  max-width: min(500px, 80%);
  border: 1px solid rgba(255,215,0,.30);
  border-radius: 14px 14px 4px 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--eml-navy), #20104f);
  box-shadow: 0 7px 18px rgba(0,0,64,.14);
}
.content > p { margin: 0; color: #28283f; font-size: 1rem; line-height: 1.68; white-space: pre-wrap; }
.message.user .content > p { color: #fff; line-height: 1.55; }
.message-tools { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.listen { display: inline-flex; align-items: center; gap: 5px; padding: 5px 0; color: #737388; background: transparent; font-size: .71rem; font-weight: 650; }
.listen:hover, .listen.active { color: var(--eml-purple); }
.intent { color: #9696a9; font-size: .58rem; font-weight: 800; letter-spacing: .1em; text-transform: capitalize; }
.sources { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 13px; }
.sources a { color: var(--eml-purple); font-size: .72rem; text-decoration: underline; text-decoration-color: rgba(130,16,159,.28); text-underline-offset: 3px; }
.sources a:hover { color: var(--eml-navy); }

.suggestions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.suggestions.initial { max-width: 620px; margin: -5px 0 38px 48px; }
.suggestions.initial::before {
  flex-basis: 100%;
  margin-bottom: 2px;
  color: #85859a;
  content: "Try asking";
  font-size: .59rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.suggestions button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border: 1px solid rgba(0,0,64,.13);
  border-radius: 9px;
  color: #45455c;
  background: rgba(255,255,255,.84);
  font-size: .73rem;
  line-height: 1.2;
  transition: color .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease);
}
.suggestions button:hover { border-color: rgba(130,16,159,.35); color: var(--eml-navy); background: rgba(0,255,255,.08); }
.suggestions button:active, .voice:active, .send:active { transform: scale(.97); }
.follow-up { margin-top: 13px !important; color: #55556d !important; font-size: .86rem !important; font-weight: 500; }
.thinking { display: flex; align-items: center; gap: 8px; margin: 4px 0 26px 48px; color: var(--muted); font-size: .82rem; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(130,16,159,.14); border-top-color: var(--eml-purple); border-radius: 50%; animation: spin .8s linear infinite; }

form { position: sticky; bottom: 0; padding: 18px 0 8px; background: linear-gradient(180deg, rgba(251,250,255,0), #fbfaff 22%); }
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 10px 10px 16px;
  border: 1px solid rgba(0,0,64,.15);
  border-radius: 14px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 5px 18px rgba(0,0,64,.065);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.composer:focus-within { border-color: rgba(130,16,159,.42); box-shadow: 0 6px 20px rgba(130,16,159,.1); }
textarea { flex: 1; min-height: 46px; max-height: 186px; padding: 9px 0; border: 0; outline: 0; color: #28283f; background: transparent; resize: none; font-size: 1rem; line-height: 1.5; }
textarea::placeholder { color: #9999aa; }
.voice, .send { display: grid; flex: 0 0 auto; width: 41px; height: 41px; place-items: center; border-radius: 50%; transition: color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease); }
.voice { color: var(--eml-navy); background: rgba(0,0,64,.06); }
.voice:hover:not(:disabled), .voice.listening { color: #fff; background: var(--eml-purple); box-shadow: 0 0 0 5px rgba(130,16,159,.12); }
.voice.listening { animation: voice 1.05s ease-in-out infinite; }
.send { color: #fff; background: linear-gradient(135deg, var(--eml-purple), var(--eml-navy)); }
.send:hover:not(:disabled) { box-shadow: 0 0 0 5px rgba(0,255,255,.17); }
.hint { margin: 10px 3px 0; color: #85859a; font-size: .69rem; }
.notice { position: fixed; z-index: 5; right: 22px; bottom: 22px; max-width: 315px; padding: 12px 14px; border: 1px solid rgba(0,255,255,.28); border-radius: 10px; color: #fff; background: var(--eml-navy); box-shadow: 0 10px 26px rgba(0,0,64,.22); font-size: .78rem; line-height: 1.4; }

@keyframes enter { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes voice { 50% { transform: scale(1.07); box-shadow: 0 0 0 8px rgba(130,16,159,.12); } }

@media (max-width: 620px) {
  .header { min-height: 68px; padding: 0 18px; }
  .header::before { left: 18px; }
  .brand strong { font-size: .76rem; }
  main { padding: 34px 18px 24px; }
  .intro { margin-bottom: 28px; padding: 20px 19px; }
  .intro::after { top: 19px; right: 19px; width: 30px; }
  .intro h1 { max-width: 90%; font-size: clamp(2.4rem, 12vw, 3.35rem); }
  .message { gap: 9px; margin-bottom: 16px; }
  .message.user .content { max-width: 87%; }
  .content { max-width: calc(100% - 42px); padding: 11px 13px; }
  .content > p { font-size: .97rem; line-height: 1.62; }
  .suggestions.initial { margin-left: 45px; }
  .suggestions button { font-size: .7rem; }
  .composer { gap: 6px; padding: 8px 8px 8px 13px; }
  .voice, .send { width: 38px; height: 38px; }
  .notice { right: 16px; bottom: 16px; left: 16px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
