:root {
  --purple: #890de7;
  --grey: #3e3e3e;
  --lavender: #eee8f2;
  --mid-purple: #af79e2;
  --violet: #c895f4;
  --amber: #fec601;
  --white: #ffffff;
  --muted: #7a7480;
  --danger: #b3261e;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }

body {
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #faf7fc;
  color: var(--grey);
  font-family: Roboto, system-ui, sans-serif;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

h1, h2 { font-family: Manrope, system-ui, sans-serif; margin: 0; }

/* --- animated background --- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55; }
.b1 { width: 46vmax; height: 46vmax; background: var(--violet); top: -18vmax; left: -12vmax; animation: drift1 22s ease-in-out infinite alternate; }
.b2 { width: 38vmax; height: 38vmax; background: #d9c2f7; bottom: -16vmax; right: -10vmax; animation: drift2 26s ease-in-out infinite alternate; }
.b3 { width: 20vmax; height: 20vmax; background: #ffe58a; top: 55%; left: 8%; opacity: 0.35; animation: drift3 30s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(8vmax, 6vmax) scale(1.08); } }
@keyframes drift2 { to { transform: translate(-7vmax, -5vmax) scale(1.1); } }
@keyframes drift3 { to { transform: translate(10vmax, -8vmax) scale(0.9); } }

/* --- header: language flags --- */
.topbar { display: flex; justify-content: flex-end; padding: 20px clamp(16px, 4vw, 40px) 0; }
.flags { display: flex; gap: 10px; }
.flag {
  width: 52px; height: 36px; padding: 0; border: 0; border-radius: 8px; overflow: hidden; cursor: pointer;
  background: none; opacity: 0.45; filter: grayscale(0.4);
  box-shadow: 0 0 0 2px transparent;
  transition: opacity 250ms var(--ease), transform 250ms var(--ease), box-shadow 250ms var(--ease), filter 250ms;
}
.flag svg { display: block; width: 100%; height: 100%; }
.flag:hover { opacity: 0.8; transform: translateY(-1px); }
.flag[aria-pressed="true"] { opacity: 1; filter: none; box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--purple); }
.flag:disabled { cursor: not-allowed; }
.flag:disabled:not([aria-pressed="true"]) { opacity: 0.2; }
.flag:focus-visible { outline: 3px solid var(--amber); outline-offset: 4px; }

/* --- stage --- */
.stage {
  min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(14px, 2.6vh, 28px);
  padding: 0 clamp(16px, 5vw, 64px);
  text-align: center;
}
h1 {
  max-width: 100%;
  text-wrap: balance;
  font-size: clamp(1.9rem, 5.2vw, 3.6rem);
  font-weight: 800; line-height: 1.12; letter-spacing: -0.015em;
  color: #1f1a24;
  animation: rise 700ms var(--ease) both;
}
h1 .line { display: block; }
h1 .line-2 { font-size: 0.72em; margin-top: 0.12em; }
@media (min-width: 720px) { h1 .line { white-space: nowrap; } }

/* hand-drawn yellow underline under "Ask me anything", drawn in on load */
h1 .ul { position: relative; display: inline-block; white-space: nowrap; isolation: isolate; }
h1 .ul svg {
  position: absolute; left: -3%; bottom: -0.24em; width: 106%; height: 0.36em;
  z-index: -1; overflow: visible;
  clip-path: inset(-50% 100% -50% -2%);
  animation: draw 900ms 450ms cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
h1 .ul path {
  fill: none; stroke: var(--amber); stroke-width: 7px; stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
@keyframes draw { to { clip-path: inset(-50% -2% -50% -2%); } }

h1 .hl {
  background: linear-gradient(100deg, var(--purple) 0%, #b14cf0 50%, var(--purple) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 6s linear infinite;
  white-space: nowrap;
}
@keyframes shimmer { to { background-position: -200% center; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* --- summit offer pill --- */
.offer {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 16px 6px 6px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.8); border: 1px solid rgba(137, 13, 231, 0.12);
  backdrop-filter: blur(8px);
  font: 600 0.95rem Manrope, sans-serif; color: var(--grey);
  animation: rise 700ms 120ms var(--ease) both;
}
.offer-chip {
  padding: 4px 10px; border-radius: 999px; background: var(--amber); color: #1a1a1a;
  font-weight: 800; font-size: 0.9rem;
}

/* --- orb --- */
.talk { display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 1.8vh, 18px); width: 100%; max-width: 640px; animation: rise 700ms 220ms var(--ease) both; }
.orb {
  --size: clamp(132px, 22vh, 188px);
  position: relative; width: var(--size); height: var(--size);
  border: 0; padding: 0; border-radius: 50%; background: none; cursor: pointer; color: var(--white);
  margin: clamp(8px, 2vh, 20px) 0;
}
.orb-core {
  position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 32% 28%, #d7a8ff 0%, #a43cf2 38%, var(--purple) 70%, #6a08b5 100%);
  box-shadow: 0 18px 50px -12px rgba(137, 13, 231, 0.55), inset 0 -6px 18px rgba(0, 0, 0, 0.15);
  transition: transform 300ms var(--ease), box-shadow 300ms var(--ease);
  animation: breathe 3.2s ease-in-out infinite;
}
.orb-wave { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--violet); opacity: 0; }
.orb:hover .orb-core { transform: scale(1.05); box-shadow: 0 24px 60px -12px rgba(137, 13, 231, 0.65), inset 0 -6px 18px rgba(0, 0, 0, 0.15); }
.orb:active .orb-core { transform: scale(0.97); }
.orb:focus-visible { outline: 3px solid var(--amber); outline-offset: 10px; }

/* idle: gentle breathing + slow ripples inviting a tap */
.orb[data-state="idle"] .w1 { animation: ripple 3.2s var(--ease) infinite; }
.orb[data-state="idle"] .w2 { animation: ripple 3.2s 1.6s var(--ease) infinite; }
/* connecting: spinning dashed ring */
.orb[data-state="connecting"] .orb-core { animation: none; }
.orb[data-state="connecting"] .w1 { opacity: 1; inset: -10px; border: 3px dashed var(--mid-purple); animation: spin 1.4s linear infinite; }
/* listening: fast ripples */
.orb[data-state="listening"] .orb-core { animation: none; }
.orb[data-state="listening"] .w1 { animation: ripple 1.6s var(--ease) infinite; }
.orb[data-state="listening"] .w2 { animation: ripple 1.6s 0.8s var(--ease) infinite; }
/* speaking: core pulses like a voice */
.orb[data-state="speaking"] .orb-core { animation: talk 0.45s ease-in-out infinite alternate; }
.orb[data-state="speaking"] .w1 { opacity: 0.5; inset: -12px; border-width: 6px; border-color: rgba(200, 149, 244, 0.5); animation: talkring 0.9s ease-in-out infinite alternate; }
.orb:not([data-state="idle"]) { cursor: default; }

@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
@keyframes ripple { from { transform: scale(1); opacity: 0.6; } to { transform: scale(1.55); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes talk { from { transform: scale(0.98); } to { transform: scale(1.06); } }
@keyframes talkring { from { transform: scale(1); } to { transform: scale(1.08); } }

.status { margin: 0; font: 700 clamp(1.1rem, 2.2vh, 1.35rem) Manrope, sans-serif; color: var(--purple); transition: opacity 200ms; }

/* --- captions --- */
.captions {
  width: 100%; display: grid; gap: 6px; text-align: center;
  max-height: 22vh; overflow: hidden;
  animation: rise 400ms var(--ease) both;
}
.cap { margin: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; }
.cap-agent { font-size: clamp(1rem, 2.2vh, 1.25rem); color: var(--grey); -webkit-line-clamp: 3; }
.cap-user { font-size: 0.95rem; color: var(--muted); font-style: italic; -webkit-line-clamp: 2; }
.cap:empty, .cap span:empty { display: none; }

.actions { display: flex; gap: 24px; justify-content: center; }
.link {
  background: none; border: 0; padding: 6px 2px; cursor: pointer;
  font: 600 1rem Manrope, sans-serif; color: var(--purple);
  background-image: linear-gradient(currentColor, currentColor); background-size: 0% 2px;
  background-repeat: no-repeat; background-position: left bottom;
  transition: background-size 300ms var(--ease);
}
.link:hover, .link:focus-visible { background-size: 100% 2px; outline: none; }
#endBtn { color: var(--muted); }

.error { margin: 0; color: var(--danger); font-weight: 500; max-width: 46ch; }

/* --- footer: logos --- */
.foot { display: grid; justify-items: center; gap: 8px; padding: 12px 16px max(16px, env(safe-area-inset-bottom)); }
.logos { display: flex; align-items: center; gap: 22px; }
.logo { display: block; height: auto; }
.logo-100 { width: clamp(120px, 14vw, 170px); }
.logo-ww { width: clamp(96px, 11vw, 132px); }
.logo-sep { width: 1px; height: 26px; background: rgba(62, 62, 62, 0.2); }
.foot p { margin: 0; font-size: 0.75rem; font-weight: 300; color: var(--muted); }

/* --- password screen --- */
.gate {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(250, 247, 252, 0.72); backdrop-filter: blur(18px);
  animation: rise 400ms var(--ease) both;
}
body.locked .stage, body.locked .foot { visibility: hidden; }
.gate-card {
  width: min(380px, 100%); display: grid; gap: 14px; justify-items: center; text-align: center;
  background: var(--white); border-radius: 24px; padding: 32px 28px;
  box-shadow: 0 30px 80px -24px rgba(60, 10, 100, 0.35);
}
.gate-card h2 { font-size: 1.3rem; font-weight: 800; color: #1f1a24; }
.gate-card input {
  width: 100%; font: 400 1.1rem Roboto, sans-serif; padding: 13px 14px; border-radius: 12px;
  border: 1.5px solid #e0d8e6; text-align: center; letter-spacing: 0.1em;
}
.gate-card input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 4px rgba(137, 13, 231, 0.12); }
.gate-card .btn { width: 100%; }
.gate-lock { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--lavender); color: var(--purple); }
.shake { animation: shake 380ms var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* --- lead dialog --- */
.lead {
  width: min(540px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  border: 0; border-radius: 24px; padding: 0; color: var(--grey);
  box-shadow: 0 30px 80px -20px rgba(60, 10, 100, 0.45);
}
.lead[open] { animation: pop 350ms var(--ease) both; }
.lead::backdrop { background: rgba(40, 14, 64, 0.45); backdrop-filter: blur(4px); }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }
.lead form, .thanks { padding: 28px; display: grid; gap: 14px; }
.lead h2 { font-size: 1.6rem; font-weight: 800; color: var(--purple); }
.muted { margin: 0; color: var(--muted); }
.lead label { display: grid; gap: 6px; font-weight: 500; text-align: left; }
.lead input:not([type]), .lead input[type="email"] {
  font: 400 1.1rem Roboto, sans-serif; padding: 13px 14px; border-radius: 12px;
  border: 1.5px solid #e0d8e6; color: var(--grey); background: #fdfbfe;
  transition: border-color 200ms, box-shadow 200ms;
}
.lead input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 4px rgba(137, 13, 231, 0.12); }
.lead fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.lead legend { font-weight: 500; margin-bottom: 6px; padding: 0; }
.chip { display: inline-flex !important; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; background: var(--lavender); cursor: pointer; transition: background 200ms; }
.chip:has(input:checked) { background: #e2d0f5; }
.chip input { accent-color: var(--purple); margin: 0; }
.consent { grid-template-columns: auto 1fr; align-items: start; font-weight: 400 !important; font-size: 0.88rem; }
.consent input { width: 20px; height: 20px; accent-color: var(--purple); margin: 2px 0 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.btn { font: 700 1rem Manrope, sans-serif; border-radius: 12px; padding: 13px 22px; cursor: pointer; border: 0; min-height: 50px; transition: transform 150ms var(--ease), filter 150ms; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--purple); color: var(--white); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }
.btn-ghost { background: var(--lavender); color: var(--grey); }
.btn:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.thanks { justify-items: center; text-align: center; padding: 44px 28px; }
.thanks p { margin: 0; font-size: 1.1rem; }
.check {
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  background: var(--purple); color: var(--white);
  animation: pop 450ms var(--ease) both;
}

@media (max-width: 560px) {
  .topbar { padding-top: 14px; }
  .flag { width: 44px; height: 30px; }
  .logos { gap: 14px; }
  .form-actions .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  h1 .ul svg { clip-path: none; }
}
