:root {
  --bg: #ffffff;
  --soft: #f5f5f7;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --faint: #86868b;
  --line: #d2d2d7;
  --hair: #e8e8ed;
  --live: #0a84ff;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.5 var(--font); letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--live); outline-offset: 3px; border-radius: 6px; }

/* ---------------------------------------------------------------- top + foot */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px clamp(20px, 4vw, 44px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
}
.brand { font-weight: 600; font-size: 17px; text-decoration: none; letter-spacing: -0.02em; }
.top-link { font-size: 14px; color: var(--muted); text-decoration: none; }
.top-link:hover { color: var(--text); }

.foot {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px;
  padding: 28px clamp(20px, 4vw, 44px) max(28px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--hair); font-size: 13px; color: var(--faint);
}
.foot a { text-decoration: none; margin-left: 20px; }
.foot a:first-child { margin-left: 0; }
.foot a:hover { color: var(--text); }

/* ---------------------------------------------------------------- stage */
.stage {
  min-height: 78vh; min-height: 78svh;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 112px 20px 24px; text-align: center;
}
.intro { max-width: 980px; transition: all .6s cubic-bezier(.2, .7, .2, 1); }
h1 {
  margin: 0; font-weight: 600; letter-spacing: -0.045em; line-height: 1.03;
  font-size: clamp(42px, 7.6vw, 96px); text-wrap: balance;
}
.sub {
  margin: 22px 0 0; color: var(--muted); font-weight: 400; letter-spacing: -0.02em;
  font-size: clamp(20px, 2.4vw, 28px);
}

.ask-wrap { width: 100%; max-width: 640px; margin-top: 56px; }
.ask {
  display: flex; align-items: center; gap: 6px;
  height: 64px; padding: 0 8px 0 24px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg);
  transition: border-color .2s, box-shadow .2s;
}
.ask:focus-within { border-color: var(--text); box-shadow: 0 8px 30px -12px rgba(0, 0, 0, .18); }
.ask input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none;
  font: 18px var(--font); letter-spacing: -0.01em; color: var(--text);
}
.ask input::placeholder { color: var(--faint); }
.ask button {
  width: 46px; height: 46px; flex: none; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center;
}
.ask-mic { background: none; color: var(--muted); }
.ask-mic:hover { background: var(--soft); color: var(--text); }
.ask-send { background: var(--text); color: #fff; }
.ask-send:disabled { opacity: .25; cursor: default; }
.hint { margin: 18px 0 0; font-size: 14px; color: var(--faint); }
.hint a { color: var(--muted); text-underline-offset: 3px; }

/* voice pill (replaces the input while talking) */
.voice {
  display: flex; align-items: center; gap: 16px;
  height: 64px; padding: 0 8px 0 24px;
  border: 1px solid var(--text); border-radius: 999px; background: var(--bg);
}
.voice canvas { width: 120px; height: 36px; flex: none; }
.voice-state { flex: 1; text-align: left; font-size: 16px; color: var(--muted); }
.voice[data-phase="speaking"] .voice-state, .voice[data-phase="hearing"] .voice-state { color: var(--text); }
.voice-end {
  height: 46px; padding: 0 20px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--soft); color: var(--text); font: 500 15px var(--font);
}
.voice-end:hover { background: var(--hair); }

/* ---------------------------------------------------------------- conversation */
.thread { width: 100%; max-width: 680px; text-align: left; display: none; }
body.talking .stage { min-height: 0; justify-content: flex-start; padding-top: 96px; padding-bottom: 40px; }
body.talking .foot { display: none; }
body.talking .intro { display: none; }
body.talking .thread { display: flex; flex-direction: column; gap: 22px; margin-top: 8px; padding-bottom: 8px; }
body.talking .ask-wrap {
  position: sticky; bottom: 0; margin-top: 20px; padding: 14px 0 max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 26%);
}
body.talking .beliefs, body.talking .closing { display: none; }

.m-user {
  align-self: flex-end; max-width: 82%;
  background: var(--soft); border-radius: 22px; padding: 11px 18px;
  font-size: 17px; white-space: pre-wrap; word-wrap: break-word;
}
.m-bot { font-size: 19px; line-height: 1.55; letter-spacing: -0.015em; white-space: pre-wrap; word-wrap: break-word; }
.m-bot.err { color: var(--muted); }
.m-bot .dots { display: inline-flex; gap: 5px; padding: 8px 0; }
.m-bot .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite; }
.m-bot .dots i:nth-child(2) { animation-delay: .2s; } .m-bot .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .2; } }

.m-card { border: 1px solid var(--hair); border-radius: 18px; padding: 16px 20px; max-width: 520px; }
.m-card small { display: block; font-size: 12px; color: var(--faint); letter-spacing: .02em; text-transform: uppercase; margin-bottom: 6px; }
.m-card b { display: block; font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.m-card p { margin: 0; font-size: 15px; color: var(--muted); }
.m-card a { display: inline-block; margin-top: 8px; font-size: 14px; color: var(--live); text-decoration: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 50px; padding: 0 28px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--text); color: #fff; font: 500 17px var(--font); text-decoration: none; letter-spacing: -0.01em;
}
.btn:hover { background: #000; }
.m-next { display: flex; gap: 10px; flex-wrap: wrap; align-self: flex-start; }
.btn-quiet { background: var(--soft); color: var(--text); }
.btn-quiet:hover { background: var(--hair); }
.closing .alt { margin: 18px 0 0; font-size: 15px; color: var(--muted); }
.closing .alt a { color: var(--text); text-underline-offset: 3px; }

/* ---------------------------------------------------------------- beliefs + closing */
.beliefs {
  max-width: 1080px; margin: 0 auto; padding: 56px 24px 72px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 56px;
  border-top: 1px solid var(--hair);
}
.belief h2 { margin: 0 0 12px; font-size: 32px; font-weight: 600; letter-spacing: -0.035em; line-height: 1.1; }
.belief p { margin: 0; color: var(--muted); font-size: 17px; line-height: 1.55; }

.closing { text-align: center; padding: 8px 24px 96px; }
.closing h2 { margin: 0 0 32px; font-size: clamp(40px, 6vw, 72px); font-weight: 600; letter-spacing: -0.045em; line-height: 1.05; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 760px) {
  .top { padding: 16px 20px; }
  .stage { padding: 104px 20px 48px; }
  .ask-wrap { margin-top: 40px; }
  .ask { height: 58px; padding-left: 20px; }
  .ask input { font-size: 17px; }
  .beliefs { grid-template-columns: 1fr; gap: 36px; padding: 48px 24px 64px; }
  .belief h2 { font-size: 28px; }
  .foot { flex-direction: column; }
  .foot a { margin: 0 18px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
