:root {
  color-scheme: dark;
  --ink: #f3f4fb;
  --muted: #9aa3b8;
  --muted-strong: #bdc4d6;
  --navy-950: #050a12;
  --navy-900: #080f1a;
  --navy-850: #0b1323;
  --navy-800: #111b2e;
  --violet: #8b5cf6;
  --indigo: #4c3aff;
  --cyan: #22d3ee;
  --green: #22f59e;
  --error: #fb7185;
  --line: rgba(157, 170, 209, .16);
  --line-strong: rgba(157, 170, 209, .27);
  --glass: rgba(10, 17, 31, .78);
  --radius-lg: 28px;
  --radius-md: 18px;
  --shadow: 0 28px 80px rgba(0, 0, 0, .4);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--navy-950);
}

body {
  min-width: 320px;
  max-width: 100vw;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 72% 36%, rgba(76, 58, 255, .14), transparent 34rem),
    radial-gradient(circle at 18% 88%, rgba(34, 211, 238, .06), transparent 28rem),
    linear-gradient(145deg, #060b14 0%, #080f1a 48%, #070c16 100%);
}

button, textarea { font: inherit; }
button { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--navy-800);
  border: 1px solid var(--violet);
  border-radius: 10px;
  transform: translateY(-150%);
  transition: transform .16s ease;
}
.skip-link:focus { transform: translateY(0); }

.ambient {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(90px);
  opacity: .22;
}
.ambient-one {
  width: 420px;
  height: 420px;
  right: -140px;
  top: 9%;
  background: var(--indigo);
  animation: breathe 10s ease-in-out infinite alternate;
}
.ambient-two {
  width: 320px;
  height: 320px;
  left: -170px;
  bottom: 2%;
  background: var(--cyan);
  opacity: .07;
}

.grid-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .2;
  background-image:
    linear-gradient(rgba(129, 142, 181, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(129, 142, 181, .05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .8), transparent 88%);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 1500px);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: 0 clamp(22px, 4vw, 70px);
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(152, 165, 201, .1);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -.02em;
}
.brand-mark {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(139, 92, 246, .42);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(139, 92, 246, .15), rgba(34, 211, 238, .06));
  box-shadow: inset 0 1px rgba(255, 255, 255, .08), 0 0 30px rgba(76, 58, 255, .13);
}
.brand-mark svg { width: 28px; height: 28px; }
.brand-word { font-size: 1.16rem; font-weight: 740; }

.topbar-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(34, 245, 158, .2);
  border-radius: 999px;
  color: #b6fbdc;
  background: rgba(34, 245, 158, .055);
  font-size: .77rem;
  font-weight: 650;
  letter-spacing: .02em;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 11px rgba(34, 245, 158, .74);
}
.topbar-status[data-state="connecting"] .status-dot { background: #fbbf24; box-shadow: 0 0 11px rgba(251, 191, 36, .68); animation: pulse 1.25s ease-in-out infinite; }
.topbar-status[data-state="error"] { color: #fecdd3; border-color: rgba(251, 113, 133, .25); background: rgba(251, 113, 133, .06); }
.topbar-status[data-state="error"] .status-dot { background: var(--error); box-shadow: 0 0 11px rgba(251, 113, 133, .68); }

.hero {
  flex: 1;
  min-height: calc(100svh - 142px);
  display: grid;
  grid-template-columns: minmax(0, .88fr) minmax(500px, 1.12fr);
  align-items: center;
  gap: clamp(46px, 6vw, 96px);
  padding: clamp(38px, 6vh, 76px) 0 clamp(32px, 5vh, 60px);
}

.hero-copy { min-width: 0; max-width: 590px; padding-bottom: 3vh; }
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #b8a8ff;
  font-size: .73rem;
  line-height: 1;
  font-weight: 720;
  letter-spacing: .18em;
}
.eyebrow span {
  width: 24px;
  height: 1px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  box-shadow: 0 0 10px rgba(139, 92, 246, .7);
}

h1 {
  margin: 24px 0 21px;
  max-width: 720px;
  font-size: clamp(3.2rem, 5.2vw, 5.8rem);
  line-height: .98;
  letter-spacing: -.065em;
  font-weight: 720;
  overflow-wrap: anywhere;
}
h1 span {
  color: transparent;
  background: linear-gradient(100deg, #a78bfa 3%, #736dff 52%, #4adee9 100%);
  background-clip: text;
  -webkit-background-clip: text;
  filter: drop-shadow(0 10px 32px rgba(102, 78, 255, .16));
}

.hero-lead {
  max-width: 530px;
  margin: 0;
  color: var(--muted-strong);
  font-size: clamp(1rem, 1.22vw, 1.16rem);
  line-height: 1.7;
}

.proof-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 30px 0 0;
  color: #d5d9e7;
  font-size: .82rem;
  font-weight: 570;
}
.proof-row span { display: inline-flex; align-items: center; gap: 7px; }
.proof-row i {
  width: 5px;
  height: 5px;
  display: inline-block;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(34, 211, 238, .66);
}
.proof-row span:first-child i { background: var(--green); box-shadow: 0 0 10px rgba(34, 245, 158, .66); }

.network-note {
  max-width: 520px;
  margin: 30px 0 0;
  padding: 17px 18px;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.58;
  border-left: 1px solid rgba(139, 92, 246, .62);
  background: linear-gradient(90deg, rgba(139, 92, 246, .065), transparent);
}

.chat-card {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: min(680px, calc(100svh - 154px));
  min-height: 520px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .025), transparent 32%),
    var(--glass);
  box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, .045), 0 0 0 1px rgba(76, 58, 255, .04);
  backdrop-filter: blur(26px) saturate(125%);
}
.chat-card::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(115deg, rgba(167, 139, 250, .15), transparent 24%, transparent 76%, rgba(34, 211, 238, .07));
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  padding: 1px;
}
.chat-glow {
  position: absolute;
  z-index: -1;
  width: 280px;
  height: 280px;
  right: -90px;
  top: -120px;
  border-radius: 50%;
  background: rgba(76, 58, 255, .22);
  filter: blur(70px);
  pointer-events: none;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 79px;
  padding: 17px 21px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 15, 26, .52);
  min-width: 0;
}
.assistant-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.assistant-identity > span:last-child { display: grid; gap: 2px; min-width: 0; }
.assistant-identity strong { font-size: .96rem; line-height: 1.25; letter-spacing: -.01em; }
.assistant-identity small { overflow: hidden; color: var(--muted); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.assistant-avatar,
.message-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  font-weight: 750;
  background: linear-gradient(145deg, var(--violet), var(--indigo) 62%, #286fc3);
  box-shadow: 0 8px 22px rgba(76, 58, 255, .28), inset 0 1px rgba(255, 255, 255, .24);
}
.assistant-avatar { width: 41px; height: 41px; border-radius: 14px; font-size: .9rem; }

.context-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 31px;
  padding: 6px 10px;
  color: #b8c2db;
  font-size: .68rem;
  font-weight: 620;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .025);
}
.context-badge svg { width: 14px; height: 14px; fill: none; stroke: var(--cyan); stroke-width: 1.4; stroke-linecap: round; }

.message-viewport {
  position: relative;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, .35) transparent;
}
.message-viewport::-webkit-scrollbar { width: 8px; }
.message-viewport::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 99px; background: rgba(139, 92, 246, .35); background-clip: padding-box; }

.message-list {
  min-height: 100%;
  padding: 24px 22px 30px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 21px;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 88%;
  animation: message-in .25s ease-out both;
}
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message-avatar { width: 29px; height: 29px; margin-top: 18px; border-radius: 10px; font-size: .67rem; }
.message.user .message-avatar { color: #ced5e8; background: #1a253a; box-shadow: inset 0 0 0 1px var(--line-strong); }
.message-body { min-width: 0; }
.message-author { margin: 0 0 6px 3px; color: var(--muted); font-size: .64rem; font-weight: 650; letter-spacing: .03em; }
.message.user .message-author { margin-right: 3px; text-align: right; }
.message-bubble {
  position: relative;
  padding: 13px 15px;
  color: #dce1ef;
  font-size: .89rem;
  line-height: 1.58;
  border: 1px solid var(--line);
  border-radius: 7px 17px 17px 17px;
  background: rgba(18, 29, 49, .74);
  box-shadow: 0 9px 28px rgba(0, 0, 0, .14);
  overflow-wrap: anywhere;
}
.message.user .message-bubble {
  color: #f3f1ff;
  border-color: rgba(139, 92, 246, .26);
  border-radius: 17px 7px 17px 17px;
  background: linear-gradient(145deg, rgba(99, 73, 218, .5), rgba(69, 53, 157, .48));
}
.message.error .message-bubble { border-color: rgba(251, 113, 133, .3); background: rgba(81, 24, 42, .34); }
.message-bubble p { margin: 0; white-space: pre-wrap; }
.message-bubble p + p { margin-top: 9px; }
.welcome-prompt { color: #aeb7ce; font-size: .78rem; }

.message-actions { min-height: 22px; margin-top: 5px; padding-left: 3px; }
.copy-button {
  min-height: 25px;
  padding: 3px 7px;
  color: var(--muted);
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: .65rem;
  cursor: pointer;
}
.copy-button:hover,
.copy-button:focus-visible { color: var(--ink); background: rgba(255, 255, 255, .055); outline: none; }

.typing-bubble { min-width: 66px; padding-block: 16px; }
.typing-dots { display: flex; align-items: center; gap: 5px; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: #9f91ed; animation: typing 1.15s ease-in-out infinite; }
.typing-dots i:nth-child(2) { animation-delay: .14s; }
.typing-dots i:nth-child(3) { animation-delay: .28s; }

.jump-latest {
  position: sticky;
  z-index: 3;
  left: 50%;
  bottom: 9px;
  transform: translateX(-50%);
  min-height: 32px;
  padding: 6px 12px;
  color: #e2e5f1;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(17, 27, 46, .94);
  box-shadow: 0 8px 25px rgba(0, 0, 0, .28);
  cursor: pointer;
}

.composer {
  position: relative;
  margin: 0 16px 16px;
  padding: 12px 54px 33px 15px;
  border: 1px solid rgba(157, 170, 209, .22);
  border-radius: var(--radius-md);
  background: rgba(14, 23, 40, .92);
  box-shadow: inset 0 1px rgba(255, 255, 255, .035), 0 13px 35px rgba(0, 0, 0, .18);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.composer:focus-within {
  border-color: rgba(139, 92, 246, .62);
  box-shadow: inset 0 1px rgba(255, 255, 255, .04), 0 0 0 3px rgba(139, 92, 246, .08), 0 16px 38px rgba(0, 0, 0, .2);
}
.composer textarea {
  width: 100%;
  min-height: 29px;
  max-height: 138px;
  padding: 3px 0;
  resize: none;
  overflow-y: auto;
  color: var(--ink);
  caret-color: #a78bfa;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: .91rem;
  line-height: 1.52;
}
.composer textarea::placeholder { color: #778199; }

.send-button {
  position: absolute;
  right: 10px;
  top: 9px;
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(167, 139, 250, .38);
  border-radius: 13px;
  background: linear-gradient(145deg, #8b5cf6, #5546e8);
  box-shadow: 0 8px 22px rgba(76, 58, 255, .3), inset 0 1px rgba(255, 255, 255, .24);
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease, opacity .16s ease;
}
.send-button svg { width: 20px; height: 20px; fill: none; stroke: white; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.send-button:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.09); }
.send-button:active:not(:disabled) { transform: translateY(1px); }
.send-button:disabled { opacity: .42; cursor: wait; }
.send-button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.composer-footer {
  position: absolute;
  left: 15px;
  right: 56px;
  bottom: 9px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #69748c;
  font-size: .61rem;
}

.chat-error {
  position: absolute;
  z-index: 6;
  left: 18px;
  right: 18px;
  bottom: 101px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  color: #fecdd3;
  border: 1px solid rgba(251, 113, 133, .3);
  border-radius: 12px;
  background: rgba(52, 15, 28, .95);
  box-shadow: 0 13px 30px rgba(0, 0, 0, .3);
  font-size: .73rem;
}
.chat-error[hidden] { display: none; }
.chat-error button { flex: none; padding: 5px 8px; color: #fff; border: 1px solid rgba(255, 255, 255, .18); border-radius: 8px; background: rgba(255, 255, 255, .08); cursor: pointer; }

.footer {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  color: #667087;
  border-top: 1px solid rgba(152, 165, 201, .08);
  font-size: .68rem;
}
.footer b { margin-left: 5px; color: #a69acd; font-weight: 620; }

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 9px 13px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(17, 27, 46, .96);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .38);
  font-size: .73rem;
}

@keyframes breathe { from { transform: translate3d(0, -2%, 0) scale(.95); } to { transform: translate3d(-7%, 5%, 0) scale(1.08); } }
@keyframes pulse { 50% { opacity: .38; transform: scale(.76); } }
@keyframes typing { 0%, 60%, 100% { opacity: .28; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@keyframes message-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1080px) {
  .hero { grid-template-columns: minmax(0, .8fr) minmax(480px, 1.2fr); gap: 38px; }
  h1 { font-size: clamp(3rem, 5.7vw, 4.7rem); }
  .network-note { margin-top: 24px; }
}

@media (max-width: 900px) {
  .page-shell { padding-inline: clamp(18px, 4vw, 36px); }
  .hero {
    grid-template-columns: minmax(0, 1fr);
    min-height: auto;
    gap: 34px;
    padding-top: 42px;
  }
  .hero-copy { width: 100%; max-width: 720px; padding-bottom: 0; }
  h1 { max-width: 720px; font-size: clamp(3.25rem, 9vw, 5.25rem); }
  .chat-card { height: min(700px, 78svh); min-height: 560px; }
}

@media (max-width: 600px) {
  .page-shell { padding-inline: 14px; }
  .topbar { min-height: 66px; }
  .brand-mark { width: 33px; height: 33px; border-radius: 11px; }
  .brand-word { font-size: 1.03rem; }
  .topbar-status { max-width: 126px; min-height: 31px; padding: 6px 9px; overflow: hidden; font-size: .68rem; white-space: nowrap; }
  .topbar-status span:last-child { overflow: hidden; text-overflow: ellipsis; }
  .hero { gap: 20px; padding: 25px 0 20px; }
  .eyebrow { font-size: .65rem; letter-spacing: .15em; }
  h1 { margin: 16px 0 14px; font-size: clamp(2.28rem, 11.3vw, 3.25rem); line-height: 1.01; }
  .hero-lead { font-size: .94rem; line-height: 1.62; }
  .proof-row { margin-top: 22px; gap: 9px 14px; font-size: .74rem; }
  .network-note { display: none; }
  .chat-card { height: min(520px, 58svh); min-height: 460px; border-radius: 22px; }
  .chat-header { min-height: 67px; padding: 13px 14px; }
  .assistant-avatar { width: 36px; height: 36px; border-radius: 12px; }
  .context-badge { padding: 5px 8px; font-size: .61rem; }
  .context-badge svg { display: none; }
  .message-list { padding: 19px 13px 24px; gap: 17px; }
  .message { max-width: 94%; gap: 7px; }
  .message-avatar { width: 25px; height: 25px; margin-top: 17px; border-radius: 8px; font-size: .58rem; }
  .message-bubble { padding: 11px 12px; font-size: .83rem; line-height: 1.54; }
  .composer { margin: 0 10px 10px; padding: 11px 49px 30px 12px; border-radius: 16px; }
  .composer textarea { font-size: 16px; }
  .send-button { right: 8px; top: 8px; width: 39px; height: 39px; }
  .composer-footer { left: 12px; right: 52px; bottom: 7px; }
  #composer-hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-error { left: 12px; right: 12px; bottom: 91px; }
  .footer { min-height: 50px; font-size: .62rem; }
  .footer span:last-child { text-align: right; }
}

@media (max-width: 390px) {
  .proof-row { display: grid; grid-template-columns: 1fr 1fr; }
  .proof-row span:last-child { grid-column: 1 / -1; }
  .context-badge { max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
  .chat-card { min-height: 450px; }
}

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