:root {
  --bg: #f4f7fc; --bg2: #ffffff; --text: #0b1220; --muted: #5a6577; --line: rgba(11, 18, 32, .1);
  --blue: #0a84ff; --river: #7cc8ff; --soft: rgba(10, 132, 255, .1);
  --shadow: 0 30px 80px rgba(20, 50, 110, .22), 0 4px 14px rgba(20, 50, 110, .08);
  --bubble-them: #e9e9ee; --chat-bg: #ffffff; --frame: #11151c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #06080d; --bg2: #10141c; --text: #f2f5fa; --muted: #98a2b3; --line: rgba(255, 255, 255, .1);
    --soft: rgba(10, 132, 255, .2);
    --shadow: 0 30px 80px rgba(0, 0, 0, .65), 0 4px 14px rgba(0, 0, 0, .4);
    --bubble-them: #26272d; --chat-bg: #000; --frame: #2a2f3a;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
svg { display: block; }
a { color: inherit; }

.nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 12px max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left)); backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6); background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.logo { width: 24px; height: 30px; }
.nav nav { display: flex; align-items: center; gap: 22px; font-weight: 600; font-size: 15px; }
.nav nav a:not(.btn) { text-decoration: none; color: var(--muted); }
.nav nav a:not(.btn):hover { color: var(--text); }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 14px 24px; border: 0; border-radius: 999px; background: var(--blue); color: #fff; font: 700 16px/1 inherit; font-family: inherit; text-decoration: none; cursor: pointer; box-shadow: 0 10px 26px rgba(10, 132, 255, .35); transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(10, 132, 255, .45); }
.btn:active { transform: scale(.97); }
.btn.small { padding: 10px 16px; font-size: 14px; }
.btn.ghost { background: var(--soft); color: var(--blue); box-shadow: none; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* hero */
.hero { max-width: 1160px; margin: 0 auto; padding: clamp(32px, 6vw, 80px) 20px 40px; display: flex; flex-direction: column; gap: 28px; }
.how { display: contents; }
.copy { order: 0; }
.how h2 { order: 1; margin: 0; }
.stage { order: 2; }
.steps { order: 3; }
h1 { margin: 0; font-size: clamp(2.5rem, 7.4vw, 4.7rem); line-height: 1.02; font-weight: 850; letter-spacing: -.045em; text-wrap: balance; }
.sub { margin: 22px 0 0; max-width: 34em; font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: var(--muted); text-wrap: pretty; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; margin-top: 28px; }
.note { color: var(--muted); font-size: 14px; }
.how h2 { font-size: 1.35rem; letter-spacing: -.02em; }
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 34px 1fr; column-gap: 12px; padding: 12px 14px; border-radius: 16px; border: 1px solid transparent; transition: background .3s, border-color .3s, opacity .3s; opacity: .62; }
.steps li::before { content: counter(s); grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--soft); color: var(--blue); }
.steps li b { font-size: 1rem; line-height: 1.3; }
.steps li span { color: var(--muted); font-size: .95rem; line-height: 1.4; }
.steps li.on { opacity: 1; background: var(--bg2); border-color: var(--line); box-shadow: 0 8px 24px rgba(10, 60, 140, .08); }
.steps li.on::before { background: var(--blue); color: #fff; }

.stage { position: relative; display: grid; place-items: center; padding: 10px 0 20px; }

@media (min-width: 900px) {
  .hero { display: grid; grid-template-columns: 1.05fr .95fr; grid-template-rows: auto auto 1fr; column-gap: 56px; row-gap: 22px; align-items: start; padding-top: 70px; }
  .copy { grid-column: 1; grid-row: 1; }
  .how h2 { grid-column: 1; grid-row: 2; align-self: end; margin-top: 18px; }
  .steps { grid-column: 1; grid-row: 3; align-content: start; }
  .stage { grid-column: 2; grid-row: 1 / 4; position: sticky; top: 96px; align-self: start; }
}

/* desktop-style live demo */
.desk { width: min(560px, 100%); }
.window { position: relative; width: 100%; height: 400px; border-radius: 14px; background: var(--chat-bg); border: 1px solid var(--line); overflow: hidden; box-shadow: var(--shadow); isolation: isolate; }
.titlebar { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; background: color-mix(in srgb, var(--bg2) 85%, var(--bubble-them)); border-bottom: 1px solid var(--line); }
.titlebar i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.titlebar i:nth-child(2) { background: #febc2e; } .titlebar i:nth-child(3) { background: #28c840; }
.titlebar span { margin-left: 10px; color: var(--muted); font-size: 13px; font-weight: 600; }
.chat { display: flex; flex-direction: column; gap: 8px; padding: 18px 22px; }
.day { align-self: center; margin-bottom: 4px; font-size: 11px; font-weight: 600; color: var(--muted); }
.bubble { max-width: 72%; padding: 10px 15px; border-radius: 20px; font-size: 15px; line-height: 1.38; }
.bubble p { margin: 0; }
.bubble.them { align-self: flex-start; background: var(--bubble-them); border-bottom-left-radius: 6px; transition: background .4s, max-width .5s cubic-bezier(.3, 1.2, .5, 1), border-radius .4s, box-shadow .3s; }
.bubble.me { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 6px; }
.bubble.target.armed { box-shadow: 0 0 0 2px var(--blue), 0 0 0 6px var(--soft); }
.bubble.target.open { max-width: 100%; border-radius: 20px; background: color-mix(in srgb, var(--blue) 12%, var(--bubble-them)); box-shadow: 0 0 0 2px var(--blue); }
.analysis { max-height: 0; opacity: 0; overflow: hidden; transition: max-height .6s cubic-bezier(.3, 1, .5, 1), opacity .3s; }
.bubble.open .analysis { max-height: 300px; opacity: 1; }
.a-head { display: flex; align-items: center; gap: 6px; margin: 10px 0 4px; padding-top: 9px; border-top: 1px solid var(--line); color: var(--blue); font-weight: 700; font-size: 13px; }
.a-head svg { width: 12px; height: 15px; }
.a-text { font-size: 14px; line-height: 1.45; min-height: 1.45em; }
.a-text.caret::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--blue); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.river, .cursor, .mini { position: absolute; left: 0; top: 0; }
.river { z-index: 5; width: 44px; height: 44px; pointer-events: none; transition: transform 1s cubic-bezier(.45, .05, .25, 1), opacity .3s, scale .25s cubic-bezier(.3, 1.6, .5, 1); }
.river svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 3px 4px rgba(0, 30, 80, .35)); animation: float 3.6s ease-in-out infinite; }
.river.grab { scale: 1.1; }
.river.grab svg { animation: none; }
.river.away { opacity: 0; scale: .5; }
@keyframes float { 50% { transform: translateY(-3px); } }
.cursor { z-index: 9; width: 22px; height: 22px; pointer-events: none; transition: transform 1s cubic-bezier(.45, .05, .25, 1); filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .3)); }

.mini { z-index: 7; width: 214px; padding: 14px; border-radius: 20px; background: color-mix(in srgb, var(--bg2) 92%, transparent); backdrop-filter: blur(24px) saturate(1.6); -webkit-backdrop-filter: blur(24px) saturate(1.6); border: 1px solid var(--line); box-shadow: var(--shadow); opacity: 0; scale: .6; transform-origin: bottom right; pointer-events: none; transition: opacity .2s, scale .32s cubic-bezier(.3, 1.35, .5, 1); }
.mini.show { opacity: 1; scale: 1; }
.m-who { display: grid; gap: 1px; margin-top: 10px; padding: 8px 11px; border-radius: 12px; background: var(--soft); font-size: 12px; }
.m-who b { font-weight: 600; }
.m-who span { color: var(--muted); }
.m-top { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 14px; }
.m-top svg { width: 18px; height: 22px; }
.m-top span { margin-left: auto; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--blue); font-size: 10px; }
.m-ring { position: relative; width: 104px; height: 104px; margin: 10px auto 8px; }
.m-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.m-ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.m-ring .bg { stroke: var(--soft); } .m-ring .fg { stroke: var(--blue); }
.m-ring div { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.m-ring b { font-size: 26px; line-height: 1; letter-spacing: -.02em; }
.m-ring span { font-size: 10px; color: var(--muted); }
.m-rows { border-radius: 12px; background: var(--soft); padding: 2px 11px; }
.m-rows p { display: flex; justify-content: space-between; margin: 0; padding: 6px 0; font-size: 11px; }
.m-rows p + p { border-top: 1px solid var(--line); }
.m-rows span { color: var(--muted); }
.m-cancel { margin-top: 8px; text-align: center; color: #ff453a; font-size: 12px; font-weight: 600; }

/* pricing */
.pricing { max-width: 1160px; margin: 0 auto; padding: 70px 20px 40px; text-align: center; scroll-margin-top: 60px; }
.pricing h2 { margin: 0; font-size: clamp(1.8rem, 4.4vw, 2.8rem); letter-spacing: -.035em; line-height: 1.1; text-wrap: balance; }
.lead { margin: 14px auto 36px; max-width: 36em; color: var(--muted); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; text-align: left; }
.plan { position: relative; display: flex; flex-direction: column; padding: 28px; border-radius: 28px; background: var(--bg2); border: 1px solid var(--line); }
.plan.featured { border: 2px solid var(--blue); box-shadow: 0 20px 50px rgba(10, 132, 255, .2); }
.tag { position: absolute; top: -13px; right: 22px; padding: 4px 12px; border-radius: 999px; background: var(--blue); color: #fff; font-size: 12px; font-weight: 700; }
.plan h3 { margin: 0; font-size: 1.1rem; color: var(--muted); }
.price { margin: 8px 0 0; font-size: 2.8rem; font-weight: 850; letter-spacing: -.04em; line-height: 1.1; }
.price small { font-size: 1rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.credits { margin: 4px 0 14px; color: var(--blue); font-size: 1.1rem; }
.credits b { font-size: 1.5rem; }
.plan ul { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 8px; color: var(--muted); font-size: .95rem; flex: 1; }
.plan li::before { content: "✓"; margin-right: 8px; color: var(--blue); font-weight: 800; }
.fine { margin-top: 22px; color: var(--muted); font-size: 14px; }
footer { padding: 40px 20px 50px; text-align: center; color: var(--muted); font-size: 14px; }

/* checkout dialog */
dialog { width: min(420px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 28px; background: var(--bg2); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .45); backdrop-filter: blur(6px); }
dialog form { display: grid; gap: 14px; padding: 28px; }
dialog h3 { margin: 0; font-size: 1.5rem; letter-spacing: -.02em; }
.plan-label { margin: -8px 0 4px; color: var(--blue); font-weight: 700; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
input { padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 16px; }
input:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.error { min-height: 1.2em; margin: 0; color: #ff453a; font-size: 14px; }

/* welcome page */
.card-center { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; text-align: center; }
.card-center h1 { font-size: clamp(2rem, 6vw, 3rem); }
.card-center p { margin: 0; max-width: 28em; color: var(--muted); }
.big-r { width: 64px; height: 80px; filter: drop-shadow(0 4px 6px rgba(0, 30, 80, .3)); animation: float 3.6s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition-duration: .01s !important; } html { scroll-behavior: auto; } }
@media (max-width: 520px) { .nav nav a[href='#pricing']:not(.btn) { display: none; } .nav nav { gap: 16px; } .window { height: 420px; } .chat { padding: 14px; } .bubble { max-width: 84%; } }

/* faq dialog */
dialog#faq, dialog#install { max-height: none; height: fit-content; overflow: hidden; }
dialog#faq { width: min(640px, calc(100vw - 24px)); }
.faq { display: flex; flex-direction: column; max-height: min(80vh, 760px); }
.faq-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px 14px; border-bottom: 1px solid var(--line); }
.faq-head h3 { margin: 0; }
.faq-head button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--soft); color: var(--blue); font-size: 22px; line-height: 1; cursor: pointer; }
.faq-body { overflow-y: auto; padding: 8px 26px 24px; max-height: calc(min(80vh, 760px) - 80px); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { display: flex; justify-content: space-between; gap: 16px; padding: 15px 0; font-weight: 600; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--blue); font-size: 20px; line-height: 1; }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin: 0 0 16px; color: var(--muted); font-size: 15px; line-height: 1.6; }
dialog#install { width: min(480px, calc(100vw - 24px)); }
.install-body { color: var(--muted); font-size: 15px; line-height: 1.6; }
.install-body ol { padding-left: 20px; display: grid; gap: 12px; color: var(--text); }
.install-body .btn.small { display: inline-flex; margin-right: 6px; color: #fff; }
.install-body .note { font-size: 13px; }
