/* ── Tokens ── */
:root {
  color-scheme: light;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: .75rem; --fs-sm: .875rem; --fs-md: 1rem; --fs-lg: 1.25rem; --fs-xl: 1.6rem;
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem; --sp-5: 1.5rem; --sp-6: 2rem;
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-full: 999px;
  --shadow-overlay: 0 8px 28px rgb(20 20 40 / .18);
  --ease: 140ms ease;

  --bg: #f7f7f8; --surface: #ffffff; --surface-2: #f0f0f3; --border: #dedee4; --border-strong: #8a8b99;
  --text: #1b1b22; --muted: #5c5d6a;
  --accent: #3f3db8; --accent-soft: #ececfb; --on-accent: #ffffff;
  --agent: #fff6e5; --agent-border: #c99a3e; --agent-text: #6a4300;
  --human-badge: #dcf2e1; --human-text: #145227;
  --ok: #17703a; --warn: #8a5300; --danger: #b3261e; --danger-soft: #fdecea;
  --focus: #3f3db8; --on-danger: #ffffff;
  /* Yappa brand: orange accent (the other person), purple (you), and the AI line color */
  --yp: #c2410c; --yp-on: #ffffff; --yp-me: #6d28d9; --yp-me-on: #ffffff; --yp-line: #7d8793;
  --frame: #16161c; /* phone frames and the hub tile on the home page */
}
/* Dark theme: only when the person picks it (public/theme.js). Light is the default. */
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #131318; --surface: #1c1c23; --surface-2: #25252e; --border: #363643; --border-strong: #74758a;
  --text: #ececf2; --muted: #a7a8b6;
  --accent: #a09fff; --accent-soft: #2a2a48; --on-accent: #12121a;
  --agent: #2e2716; --agent-border: #b38a3c; --agent-text: #f3d39a;
  --human-badge: #173a22; --human-text: #a9e6b9;
  --ok: #7ed79b; --warn: #f0c070; --danger: #ff8a80; --danger-soft: #3a1f1f;
  --focus: #b5b4ff; --on-danger: #0e1114;
  --yp: #fb923c; --yp-on: #0e1114; --yp-me: #c4b5fd; --yp-me-on: #0e1114; --yp-line: #747e8b;
  --frame: #3a3a48;
  --shadow-overlay: 0 8px 28px rgb(0 0 0 / .55);
}

/* ── Base ── */
* { box-sizing: border-box; }
body { margin: 0; font: var(--fs-md)/1.5 var(--font); color: var(--text); background: var(--bg); min-height: 100dvh; display: flex; flex-direction: column; }
h1:focus { outline: none; }
h1 { font-size: var(--fs-xl); line-height: 1.2; margin: var(--sp-2) 0 var(--sp-4); }
h2 { font-size: var(--fs-lg); margin: 0 0 var(--sp-2); }
.h3 { font-size: var(--fs-md); font-weight: 650; margin: 0 0 var(--sp-2); }
p { margin: 0 0 var(--sp-2); }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--sp-2); top: -3rem; padding: var(--sp-2) var(--sp-3); background: var(--surface); border-radius: var(--r-sm); z-index: 20; }
.skip:focus { top: var(--sp-2); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
main:focus { outline: none; }
[hidden] { display: none !important; }
.narrow { max-width: 640px; margin-inline: auto; }

button {
  font: inherit; font-size: var(--fs-sm); font-weight: 550; color: var(--text);
  padding: .5rem .9rem; min-height: 2.5rem; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer; transition: background var(--ease), border-color var(--ease);
}
button:hover { background: var(--surface-2); }
button:disabled { opacity: .55; cursor: progress; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--danger); }
button.danger-solid { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
button.ghost { border-color: transparent; background: transparent; }
button.icon { min-width: 2.5rem; padding: .4rem; }
button.link { border: 0; background: none; padding: 0; min-height: auto; color: var(--accent); text-decoration: underline; font-weight: 500; }
button.pill { border-radius: var(--r-full); box-shadow: var(--shadow-overlay); }
button[aria-busy='true']::after { content: ''; display: inline-block; width: .8em; height: .8em; margin-inline-start: .4em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -.1em; animation: spin .7s linear infinite; }

label, .label { display: block; font-size: var(--fs-sm); font-weight: 600; margin: 0 0 var(--sp-1); }
.hint-inline { font-weight: 400; color: var(--muted); margin-inline-start: .35rem; }
input, textarea, select {
  font: inherit; width: 100%; padding: .55rem .7rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
}
/* A search box looks like every other field. */
input[type='search'] { appearance: none; }
input[type='search']::-webkit-search-cancel-button { appearance: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input:user-invalid, select:user-invalid { border-color: var(--danger); }
input[type='range'] { padding: 0; border: 0; accent-color: var(--accent); }
textarea { resize: vertical; }
/* Typed text takes its direction from its first letter: a Hebrew or Arabic bio reads right to left. */
input:not([type]), input[type='text'], input[type='search'], textarea { unicode-bidi: plaintext; }

.row { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; margin-top: var(--sp-3); }
.row.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }
ul.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--sp-2); }
pre { white-space: pre-wrap; word-break: break-all; background: var(--surface-2); padding: var(--sp-3); border-radius: var(--r-sm); font-size: var(--fs-sm); margin: 0; }

/* Common region: one bordered box per group of related things. No shadows on page content. */
.card, .group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-4); }
.group { margin: 0 0 var(--sp-4); }
fieldset.group { min-width: 0; }
.group > legend { font-weight: 700; font-size: var(--fs-md); padding: 0 var(--sp-1); }
.card.token { border-color: var(--warn); }

/* Proximity: fields in a group sit close, groups sit apart. */
.field { margin: 0 0 var(--sp-4); }
.field:last-child { margin-bottom: 0; }
.field-row { display: grid; gap: var(--sp-3); grid-template-columns: 1fr 1fr; margin: 0 0 var(--sp-4); }
.field-row .field { margin: 0; }
@media (max-width: 479px) { .field-row { grid-template-columns: 1fr; } }

/* Choice pills: radio or checkbox inputs that look the same everywhere (similarity). */
.choices { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.choices.stacked { display: grid; }
.opt { display: inline-flex; align-items: center; gap: .45rem; margin: 0; padding: .45rem .75rem; border: 1px solid var(--border-strong); border-radius: var(--r-sm); font-weight: 500; cursor: pointer; }
.opt input { width: auto; margin: 0; accent-color: var(--accent); }
.opt:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.chips .opt { border-radius: var(--r-full); padding: .3rem .7rem; font-size: var(--fs-sm); }
/* Rich option: a title and one muted line, for choices that need a short reason. */
.opt.rich { align-items: flex-start; padding: var(--sp-3); }
.opt.rich input { margin-top: .2rem; }
.opt.rich span span { display: block; font-weight: 400; font-size: var(--fs-sm); color: var(--muted); }
/* Setup checklist: one folding part per stage, with its live status. */
#setup-parts { margin-top: var(--sp-3); display: grid; gap: var(--sp-3); }
.setup-part { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3); }
.setup-part > summary { display: flex; align-items: center; gap: var(--sp-2); cursor: pointer; font-weight: 700; list-style: none; }
.setup-part > summary::-webkit-details-marker { display: none; }
.setup-part[open] > summary { margin-bottom: var(--sp-3); }
.setup-part.done > summary .num { background: var(--yp-me); color: var(--yp-me-on); }
.setup-part > .row, .setup-part > p { margin-bottom: var(--sp-3); }
.setup-part .mcp-url code { white-space: normal; flex: 1 1 16rem; }
.guide li > span { display: block; margin-top: .3rem; }
.mcp-url { display: flex !important; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.mcp-url code { padding: .45rem .7rem; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-md); user-select: all; }
.dev-key summary { cursor: pointer; }
.dev-key[open] summary { margin-bottom: var(--sp-2); }
.guide { margin: var(--sp-2) 0 0; padding-inline-start: 1.25rem; display: grid; gap: var(--sp-2); }
.guide strong { display: block; }
.app-guide .guide strong { display: inline; }
/* Numbered steps: the page reads top to bottom as one setup flow (continuity). */
.step { display: flex; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-2); }
.num { flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-sm); font-weight: 700; background: var(--accent-soft); color: var(--accent); }
/* "Never mention" is a limit, not a fact: a divider sets it apart (common region). */
.field.boundary { border-top: 1px solid var(--border); padding-top: var(--sp-4); }
/* One region per step: the connection inside step 1 has no second frame (figure-ground). */
#connections .card { border: 0; padding: 0; background: none; }
.check { display: flex; gap: var(--sp-2); align-items: center; font-weight: 500; margin: 0; }
.check input { width: auto; margin: 0; accent-color: var(--accent); }
/* Autosave status: one quiet line, colored only when it needs attention. */
.save-state { font-size: var(--fs-sm); color: var(--muted); min-height: 1.5em; white-space: nowrap; margin-top: var(--sp-3); }
.save-state[data-kind='warn'] { color: var(--warn); white-space: normal; }
.save-state[data-kind='error'] { color: var(--danger); white-space: normal; }
.save-state[data-kind='ok'] { color: var(--ok); }
.save-state[data-kind='gone'] { color: var(--ok); opacity: 0; transition: opacity .4s ease; }
.group .view-head .save-state { margin-top: 0; }

/* Profile: a visibility switch, then tabs; each tab is one card (common region). */
.switch { display: flex; align-items: center; gap: var(--sp-3); cursor: pointer; font-size: var(--fs-md); font-weight: 400; }
.switch strong { display: block; }
.switch input { appearance: none; border: 0; flex: none; width: 2.75rem; height: 1.6rem; margin: 0; padding: 0; border-radius: var(--r-full); background: var(--border-strong); position: relative; cursor: pointer; transition: background var(--ease); }
.switch input::after { content: ''; position: absolute; top: .2rem; left: .2rem; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: #fff; transition: transform var(--ease); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(1.15rem); }
.tabbar { position: sticky; top: 3.4rem; z-index: 4; background: var(--bg); padding-top: var(--sp-1); }
.tabbar .save-state { margin: var(--sp-1) 0 var(--sp-2); text-align: end; }
.tabs { display: flex; gap: var(--sp-1); margin: 0; padding: var(--sp-1); background: var(--surface-2); border-radius: var(--r-md); }
.tabs [role='tab'] { flex: 1; border: 0; background: transparent; color: var(--muted); font-weight: 600; white-space: nowrap; padding-inline: var(--sp-2); }
/* Segmented control: the open tab is a raised white segment with strong text (not color alone); the others recede. */
@media (max-width: 26rem) { .tabs [role='tab'] { padding-inline: .35rem; font-size: var(--fs-sm); } }
.tabs [role='tab']:hover:not([aria-selected='true']) { color: var(--text); background: color-mix(in srgb, var(--surface) 50%, transparent); }
.tabs [role='tab'][aria-selected='true'] { background: var(--surface); color: var(--accent); font-weight: 700; box-shadow: 0 1px 3px rgb(0 0 0 / .14), inset 0 0 0 1px var(--border); }
:root[data-theme='dark'] .tabs [role='tab'][aria-selected='true'] { background: color-mix(in srgb, var(--text) 14%, var(--surface-2)); }
.tabs .dot { display: inline-block; width: .5rem; height: .5rem; margin-inline-start: .35rem; border-radius: 50%; background: var(--warn); vertical-align: .15em; }
.panel .sub { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--border); }
.panel h2.h3 { margin-bottom: var(--sp-3); }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.label-row .link { font-size: var(--fs-sm); }
.add-row { display: flex; gap: var(--sp-2); margin-top: var(--sp-2); max-width: 22rem; }
/* Two-thumb range: two native sliders on one bar; the bar between the thumbs is filled (continuity). */
.dual-range { position: relative; height: 1.5rem; --lo: 0%; --hi: 100%; }
.dual-range::before { content: ''; position: absolute; inset-inline: 0; top: 50%; height: 6px; transform: translateY(-50%); border-radius: var(--r-full);
  background: linear-gradient(to right, var(--border-strong) var(--lo), var(--accent) var(--lo) var(--hi), var(--border-strong) var(--hi)); }
.dual-range input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.dual-range input::-webkit-slider-runnable-track { height: 6px; background: transparent; }
.dual-range input::-moz-range-track { height: 6px; background: transparent; }
.dual-range input::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 18px; height: 18px; margin-top: -6px; border: 0; border-radius: 50%; background: var(--accent); cursor: pointer; }
.dual-range input::-moz-range-thumb { pointer-events: auto; width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--accent); cursor: pointer; }
.dual-range input:focus-visible { outline: none; }
.dual-range input:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--focus); outline-offset: 2px; }
.dual-range input:focus-visible::-moz-range-thumb { outline: 2px solid var(--focus); outline-offset: 2px; }
.big-value { font-size: var(--fs-lg); font-weight: 700; color: var(--accent); margin-inline-start: .35rem; }
.notice-box { padding: var(--sp-3) var(--sp-4); border: 1px solid var(--accent); border-radius: var(--r-md); background: var(--accent-soft); margin-bottom: var(--sp-4); }

/* ── Top bar ── */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1040px; margin: 0 auto; padding: var(--sp-2) var(--sp-4); display: flex; gap: var(--sp-3); align-items: center; }
.brand { display: inline-flex; align-items: center; gap: .4rem; font-size: 1.3rem; font-weight: 650; letter-spacing: -.03em; color: inherit; text-decoration: none; }
.mark { width: 1.5rem; height: 1.5rem; flex: none; }
.mark path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mark circle { fill: var(--yp); }
.mark circle:first-of-type { fill: var(--yp-me); }
.top-signin { font-weight: 600; color: inherit; text-decoration: none; padding: .7rem .25rem; }
.top-signin:hover { text-decoration: underline; text-underline-offset: 4px; }
#nav:not([hidden]) ~ .top-end .top-signin { display: none; }
/* theme.js sets data-session when this device was signed in: no flash of the public page before the app shows. */
:root[data-session='in'] #view-login, :root[data-session='in'] .top-signin { display: none; }
.top-end { flex: 1 1 0; display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); }
.theme-toggle { border-color: transparent; background: transparent; color: inherit; }
.theme-toggle .ico { width: 1.25rem; height: 1.25rem; display: block; }
.theme-toggle[aria-pressed='true'] .ico { fill: currentColor; }
/* Main navigation. Wide screens: centered in the top bar. The current page is a filled pill in the accent color,
   so it stands out from the muted links around it; each link has an icon. */
#nav { display: flex; gap: var(--sp-1); justify-content: center; min-width: 0; }
#nav [data-view] { display: flex; flex-wrap: nowrap; align-items: center; gap: .45rem; white-space: nowrap; border-color: transparent; background: transparent; color: var(--muted); border-radius: 999px; }
#nav [data-view]:hover { color: var(--text); background: var(--surface-2); }
#nav [data-view] > svg { width: 1.15rem; height: 1.15rem; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#nav [data-view][aria-current='page'] { color: var(--accent); background: var(--accent-soft); font-weight: 700; box-shadow: inset 0 0 0 1px var(--accent); }
.brand { flex: 1 1 0; }
#nav { flex: none; }

/* Phones: the links move to a fixed bar at the bottom (thumb reach). Icon above a short label; the current page
   gets an accent pill behind its icon. The top bar keeps the brand and Log out. */
:root { --navbar-h: 0px; }
@media (max-width: 599px) {
  :root { --navbar-h: calc(3.9rem + env(safe-area-inset-bottom)); }
  #nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: var(--navbar-h); gap: 0;
    padding: .3rem var(--sp-1) env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border); }
  #nav [data-view] { flex: 1 1 0; flex-direction: column; justify-content: center; gap: .2rem; padding: .25rem 0; min-width: 0;
    font-size: .72rem; border-radius: var(--r-md); }
  #nav [data-view]:hover { background: transparent; }
  #nav [data-view] > svg { width: 1.35rem; height: 1.35rem; padding: .2rem .9rem; box-sizing: content-box; border-radius: 999px; }
  #nav [data-view][aria-current='page'] { background: transparent; box-shadow: none; }
  #nav [data-view][aria-current='page'] > svg { background: var(--accent-soft); }
  .chat-head { position: static; }
}
main { max-width: 1040px; width: 100%; flex: 1 0 auto; margin: 0 auto; padding: var(--sp-4); padding-bottom: calc(5rem + var(--navbar-h)); }

/* ── Shared pieces ── */
.avatar { flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: hsl(var(--hue, 240) 40% 42%); }
.avatar.lg { width: 4rem; height: 4rem; font-size: var(--fs-lg); }
.chip { white-space: nowrap; display: inline-flex; align-items: center; gap: .3rem; font-size: var(--fs-xs); font-weight: 600; padding: .15rem .55rem; border-radius: var(--r-full); background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.chip.ok { color: var(--ok); }
.chip.warn { color: var(--warn); }
.chip.danger { color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin: 0; padding: 0; list-style: none; }
.skeleton { border-radius: var(--r-md); height: 7rem; background: var(--surface-2); animation: pulse 1.2s ease-in-out infinite; margin-bottom: var(--sp-3); }
.empty { text-align: center; padding: var(--sp-6) var(--sp-4); display: grid; justify-items: center; gap: var(--sp-2); }
.empty > p { margin: 0; max-width: 42ch; }
.empty-icon { width: 4rem; height: 4rem; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: var(--sp-2); }
.empty-icon svg { width: 1.9rem; height: 1.9rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2); margin-top: var(--sp-3); }
.empty-actions button { display: inline-flex; align-items: center; gap: .45rem; }
.empty-actions svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.empty > button.link { margin-top: var(--sp-1); }

/* Journey: one calm card (common region). Top line: the live status (dot + word) and where we are; under it a
   segmented bar, one segment per step; last line: what comes next. No numbers to decode. */
.journey { margin: var(--sp-3) 0 var(--sp-4); padding: var(--sp-3) var(--sp-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.journey-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap; }
.journey-count { color: var(--muted); font-size: var(--fs-sm); }
.journey ol { list-style: none; display: flex; gap: 4px; margin: var(--sp-2) 0; padding: 0; }
.journey li { flex: 1; height: 6px; border-radius: var(--r-full); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.journey li[data-state='done'] { background: var(--accent); box-shadow: none; }
.journey li[data-state='current'] { position: relative; overflow: hidden; background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.journey li[data-state='current']::before { content: ''; position: absolute; inset: 0 50% 0 0; background: var(--accent); }
.journey-next { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.journey-next:empty { display: none; }
/* Live status: a colored dot and a word (similarity: the same tones as the match list). */
.status { display: inline-flex; align-items: center; gap: .45rem; font-weight: 650; }
.status::before { content: ''; width: .55rem; height: .55rem; border-radius: 50%; background: var(--muted); }
.status.accent::before { background: var(--accent); }
.status.ok::before { background: var(--ok); }
.status.warn::before { background: var(--warn); }
.status.danger::before { background: var(--danger); }

/* ── Discover: one person in focus (figure-ground) ── */
.view-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-3); }
.view-head h1 { margin-bottom: var(--sp-1); }
.view-head .link { margin-top: var(--sp-3); white-space: nowrap; }
/* Discover: the preferences button sits next to the title, as a clear pill. */
.discover-head { justify-content: flex-start; align-items: center; flex-wrap: wrap; margin-bottom: var(--sp-2); }
.discover-head h1 { margin: 0; }
/* Quiet next to the nav pills: neutral outline, accent icon; the accent shows only on hover. */
button.prefs-btn { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.25rem; padding: .3rem .8rem; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
button.prefs-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.prefs-btn svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
.person { padding: 0; overflow: clip; touch-action: pan-y; user-select: none; cursor: grab; transition: transform 160ms ease, border-color var(--ease); }
.person:active { cursor: grabbing; }
.person[data-lean='like'] { border-color: var(--accent); }
.person[data-lean='pass'] { border-color: var(--danger); }
/* The profile is a column of tiles: each photo and each text part is its own rounded block, with space between (common region). */
.card.person { padding: var(--sp-2); background: var(--surface-2); }
.person > section, .person > .vitals, .person > .person-pic, .person > .person-photo { margin: 0 0 var(--sp-2); border-radius: var(--r-md); }
.person > :last-child { margin-bottom: 0; }
.person > section, .person > .vitals { padding: var(--sp-3) var(--sp-4); background: var(--surface); }
.person .vitals li { background: var(--surface-2); }
.person-pic { overflow: hidden; }
/* Small name line: shows at the top once the main photo has scrolled away (class set by JS). */
.person-name { position: sticky; top: 3.9rem; height: 0; z-index: 3; display: flex; justify-content: center; align-items: flex-start; pointer-events: none; }
.person-name span { padding: .3rem .9rem; border-radius: var(--r-full); background: rgb(10 10 16 / .7); color: #fff; font-weight: 700; opacity: 0; transition: opacity .15s ease; }
.person.scrolled .person-name span { opacity: 1; }
/* Desktop: a narrower card keeps the photos in proportion and the scroll short. */
#discover-body .stack, .discover-head { max-width: 520px; margin-inline: auto; }
/* Photo area: most of the card. A tinted placeholder with large initials until photos exist. */
.person-photo { position: relative; display: grid; place-items: center; height: min(62vh, 560px); min-height: 320px; background: hsl(var(--hue, 240) 35% 80%); overflow: hidden; }
.photo-initials { font-size: clamp(6rem, 22vw, 11rem); font-weight: 800; letter-spacing: .02em; color: hsl(var(--hue, 240) 35% 35% / .55); line-height: 1; }
.photo-caption { position: absolute; inset: auto 0 0 0; padding: var(--sp-4); background: rgb(10 10 16 / .55); color: #fff; }
/* Name, age and place on one line; the place moves under the name only when the line is too long. */
.photo-caption { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--sp-3); row-gap: .15rem; }
.photo-caption h2 { font-size: clamp(1.6rem, 6vw, 2rem); line-height: 1.1; margin: 0; }
.photo-caption p { margin: 0; color: rgb(255 255 255 / .88); font-size: var(--fs-md); }
[data-theme='dark'] .person-photo { background: hsl(var(--hue, 240) 25% 24%); }
[data-theme='dark'] .photo-initials { color: hsl(var(--hue, 240) 30% 60% / .5); }
/* Main photo: fills the area. The other photos sit full width between the text parts. */
.photo-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.person-pic { position: relative; margin: 0; }
.person-pic img { display: block; width: 100%; height: auto; max-height: 80vh; object-fit: cover; }
.person .chips li { padding: .35rem .8rem; border-radius: var(--r-full); background: var(--surface-2); font-weight: 600; }
/* Liked / Passed stamp: shows while a swipe leans to one side and on the card that flies off. Sticky, so it stays in view on a long profile. */
.stamps { position: sticky; top: 38vh; height: 0; z-index: 3; pointer-events: none; }
.stamp { position: absolute; top: 0; padding: .2rem .9rem; border: 4px solid currentColor; border-radius: var(--r-md); background: rgb(255 255 255 / .85); font-size: clamp(1.8rem, 7vw, 2.6rem); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: 0; transition: opacity .12s ease; }
.stamp.like { left: var(--sp-4); color: var(--accent); transform: rotate(-14deg); }
.stamp.pass { right: var(--sp-4); color: var(--danger); transform: rotate(14deg); }
.person[data-lean='like'] .stamp.like, .person[data-lean='pass'] .stamp.pass { opacity: 1; }
button.photo-report, button.photo-report:hover { position: absolute; top: var(--sp-2); right: var(--sp-2); display: grid; place-items: center; width: 2.25rem; height: 2.25rem; min-height: 0; padding: 0; border-radius: 50%; background: rgb(10 10 16 / .45); color: #fff; border: 0; }
button.photo-report:hover { background: rgb(10 10 16 / .7); }
.photo-report svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
/* Profile photos: 6 places in a 3 by 2 grid of 3:4 tiles; the first is the main photo. */
.photo-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.photo-slot { position: relative; aspect-ratio: 3 / 4; border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-slot.add button { width: 100%; height: 100%; border: 2px dashed var(--border-strong); background: none; font-weight: 600; }
.photo-slot.empty { display: grid; place-items: center; border: 2px dashed var(--border); color: var(--muted); font-size: 1.75rem; cursor: pointer; }
/* The main photo place: an accent frame, so it is clear which photo people see first. */
.photo-slot.main { outline: 3px solid var(--accent); outline-offset: 2px; }
.photo-slot.add.main button { border-color: var(--accent); color: var(--accent); }
/* A photo that can move: no page scroll or image menu from a finger on it, so the drag works on phones. */
.photo-slot.can-drag { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.photo-slot.dragging { z-index: 2; opacity: .85; cursor: grabbing; box-shadow: 0 8px 24px rgb(0 0 0 / .25); }
/* While a photo is dragged, the others slide to their new places. */
.photo-grid.sorting > .photo-slot { transition: transform .18s ease; }
.photo-grid.sorting > .photo-slot.dragging { transition: none; }
@media (prefers-reduced-motion: reduce) { .photo-grid.sorting > .photo-slot { transition: none; } }
.photo-main { position: absolute; bottom: var(--sp-2); left: var(--sp-2); font-size: var(--fs-xs); font-weight: 700; padding: .15rem .5rem; border-radius: var(--r-full); background: var(--accent); color: #fff; }
.photo-remove { position: absolute; top: var(--sp-2); right: var(--sp-2); }
.icon-btn { width: 2.5rem; height: 2.5rem; min-width: 0; min-height: 0; padding: 0; border-radius: 50%; background: rgb(255 255 255 / .9); color: #111; border: 0; }
.report-photo { display: block; margin-bottom: var(--sp-2); width: 120px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--r-md); }
/* Basics: icon pills, easy to scan. */
.vitals { list-style: none; margin: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2); font-size: var(--fs-md); font-weight: 600; }
.vitals li { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .75rem; border-radius: var(--r-full); background: var(--surface-2); }
.vitals svg { width: 1.15rem; height: 1.15rem; flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.quote p { font-size: 1.2rem; line-height: 1.45; margin: 0; }
.quote .prompt-q { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); margin-bottom: var(--sp-1); }
/* Prompt answers are the largest text on the card, so each prompt stands out from the bio. */
.quote.prompt p:not(.prompt-q) { font-size: clamp(1.35rem, 4.5vw, 1.6rem); font-weight: 700; line-height: 1.3; }
.person h3.prompt-q { margin: 0 0 var(--sp-2); }
/* Prompt editor: question and answer sit together in one row card (proximity). */
.prompts { display: grid; gap: var(--sp-3); }
.prompt-row { display: grid; gap: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md); }
/* Must match: one short labeled row per habit. */
.deals { display: grid; gap: var(--sp-3); }
.deal { display: grid; gap: var(--sp-1); }
.decide { position: sticky; bottom: var(--navbar-h); z-index: 2; display: flex; justify-content: center; align-items: flex-end; gap: 3rem; padding: var(--sp-3) 0; background: var(--bg); }
.decide-btn { display: grid; justify-items: center; gap: .4rem; padding: 0; border: 0; background: none; color: var(--text); font-size: var(--fs-md); font-weight: 600; }
.decide-btn:hover { background: none; }
.decide-btn .ring { width: 4rem; height: 4rem; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); background: var(--surface); color: var(--muted); transition: transform .12s ease, border-color .12s ease, color .12s ease; }
.decide-btn svg { width: 1.75rem; height: 1.75rem; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.decide-btn.like .ring { width: 4.75rem; height: 4.75rem; background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-overlay); }
.decide-btn.like svg { width: 2.1rem; height: 2.1rem; fill: currentColor; }
.decide-btn.pass:hover .ring { border-color: var(--danger); color: var(--danger); }
.decide-btn:hover .ring { transform: scale(1.06); }
.decide-btn:active .ring { transform: scale(.94); }
.decide-btn:focus-visible { outline: none; }
.decide-btn:focus-visible .ring { outline: 2px solid var(--focus); outline-offset: 3px; }
.decide-label { display: inline-flex; align-items: center; gap: .35rem; }
/* Phones: the buttons float low over the profile, with no bar behind them, so most of the screen is the profile.
   Only the buttons take taps; a scroll that starts between them still scrolls the page. The words stay as aria-labels. */
@media (max-width: 599px) {
  .decide { gap: 2.5rem; padding: var(--sp-2) 0; background: none; pointer-events: none; }
  .decide-btn { pointer-events: auto; }
  .decide-label { display: none; }
  .decide-btn .ring { width: 3.5rem; height: 3.5rem; box-shadow: var(--shadow-overlay); }
  .decide-btn.like .ring { width: 4rem; height: 4rem; }
  .stack { margin-bottom: var(--sp-2); }
}
/* Card stack: the next person waits behind, smaller and blurred. The stack takes the size of the top card. */
.stack { position: relative; --pull: 0; margin-bottom: 22px; } /* room for the peek above the Like/Pass bar */
.stack > .person:not(.next) { position: relative; z-index: 1; }
.card.person.next { position: absolute; inset: 0; margin: 0; pointer-events: none; transform-origin: 50% 100%; border-color: var(--border-strong);
  transform: translateY(calc(16px * (1 - var(--pull)))) scale(calc(.94 + .06 * var(--pull)));
  filter: blur(calc(3px * (1 - var(--pull)))) brightness(calc(.85 + .15 * var(--pull))); transition: transform 160ms ease, filter 160ms ease; }
/* After a decision the card behind comes forward (150 ms): quick, no blank frame. */
.card.person.enter { animation: card-in .15s ease-out; transform-origin: 50% 100%; }
@keyframes card-in { from { transform: translateY(16px) scale(.94); filter: blur(3px) brightness(.85); } }
/* The decided card flies off to its side (Like right, Pass left) from where it is now. Clip: no side scrollbar while it flies. */
#view-discover { overflow-x: clip; }
.card.person.leave { position: absolute; inset: 0; margin: 0; z-index: 2; pointer-events: none; transition: none; animation: card-out .3s ease-in forwards; }
.card.person.leave.pass { animation-name: card-out-pass; }
@keyframes card-out { to { transform: translateX(130%) rotate(18deg); opacity: 0; } }
@keyframes card-out-pass { to { transform: translateX(-130%) rotate(-18deg); opacity: 0; } }
/* Swipe hint: a small bump right and left every few seconds, until the member drags a card. `translate` and `rotate` leave the drag's `transform` alone. */
.card.person.hint { animation: swipe-hint 5s ease-in-out 2.5s infinite; }
.card.person.hint.enter { animation: card-in .15s ease-out, swipe-hint 5s ease-in-out 2.5s infinite; }
@keyframes swipe-hint { 0%, 16%, 100% { translate: 0; rotate: 0deg; } 4% { translate: 22px; rotate: 1.5deg; } 10% { translate: -22px; rotate: -1.5deg; } }
@media (prefers-reduced-motion: reduce) { .card.person.hint { animation: none; } .stamp { transition: none; } }
@media (prefers-reduced-motion: reduce) { .decide-btn .ring { transition: none; } .card.person.enter, .card.person.leave { animation: none; } .card.person.leave { display: none; } .card.person.next { transition: none; } }
kbd { font: inherit; font-size: var(--fs-xs); opacity: .7; padding: 0 .3rem; border: 1px solid currentColor; border-radius: 4px; }
@media (pointer: coarse) { kbd { display: none; } }

/* ── Matches: sections with compact rows ── */
.match-section { margin-bottom: var(--sp-5); }
.match-section h2 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 var(--sp-2); }
.match-rows { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.match-rows li + li { border-top: 1px solid var(--border); }
/* Archived: one closed line until opened; quieter rows. */
.match-section.archived summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) 0; border-radius: var(--r-sm); }
.match-section.archived summary::-webkit-details-marker { display: none; }
.match-section.archived summary:hover h2 { color: var(--text); }
/* Chevron after the label: down when closed, up when open. */
.match-section.archived summary::after { content: ''; width: .45rem; height: .45rem; border: solid var(--muted); border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.match-section.archived details[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.match-section.archived summary h2 { margin: 0; }
.match-section.archived p { margin: 0 0 var(--sp-2); }
.match-section.archived .match-row { opacity: .8; }
.match-row { width: 100%; display: flex; align-items: center; gap: var(--sp-3); text-align: start; border: 0; border-radius: 0; padding: var(--sp-3) var(--sp-4); min-height: 4rem; background: transparent; }
.match-row .name { font-size: var(--fs-md); font-weight: 650; display: block; }
.match-row .sub { font-size: var(--fs-sm); color: var(--muted); font-weight: 400; display: block; }
.match-row[aria-current='true'] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }

/* Wide screens (app.js uses the same breakpoint): the matches list is a side panel next to the open view, so the
   Matches tab and the chat's Back button are not needed. Signed in only: the public page keeps one column. */
@media (min-width: 1100px) {
  main:not(:has(> #view-login:not([hidden]))) { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: var(--sp-5); align-items: start; }
  main:not(:has(> #view-login:not([hidden]))) > section { grid-column: 1; grid-row: 1; min-width: 0; }
  /* !important beats the global [hidden] rule: here the panel shows whatever view is open. */
  main:not(:has(> #view-login:not([hidden]))) > #view-matches { display: block !important; grid-column: 2; position: sticky; top: 4.5rem; max-height: calc(100dvh - 5.5rem); overflow-y: auto; }
  #view-matches #matches-title { font-size: var(--fs-lg); }
  #view-matches .match-row { padding: var(--sp-2) var(--sp-3); min-height: 3.5rem; }
  #nav [data-view='matches'], #back { display: none; }
}

/* ── Chat ── */
.chat { max-width: 760px; margin-inline: auto; }
.chat-main { min-width: 0; }
.chat-head { position: sticky; top: 3.4rem; z-index: 5; display: flex; gap: var(--sp-2); align-items: center; padding: var(--sp-2) 0; background: var(--bg); }
.chat-head h1 { font-size: var(--fs-lg); margin: 0; }
.chat-sub { margin: .1rem 0 0; display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; color: var(--muted); font-size: var(--fs-sm); }
/* Facts on one line, split by a middle dot; empty facts take no space. */
.chat-sub > span:empty { display: none; }
.chat-sub > span:not(:empty) ~ span:not(:empty):not(.chip)::before { content: '·'; margin-inline-end: var(--sp-2); }
/* Phones: one fact per line, so no line starts with a separator. */
@media (max-width: 479px) { .chat-sub { flex-direction: column; align-items: flex-start; gap: 0; } .chat-sub > span::before { display: none; } }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; display: grid; place-items: center; min-width: 2.5rem; min-height: 2.5rem; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); }
.menu summary::-webkit-details-marker { display: none; }
.menu-items { position: absolute; right: 0; top: 110%; display: grid; gap: var(--sp-1); padding: var(--sp-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); box-shadow: var(--shadow-overlay); z-index: 6; min-width: 9rem; }
.notice { font-size: var(--fs-xs); color: var(--muted); margin: var(--sp-2) 0 0; text-align: center; }
.transcript-wrap { position: relative; }
#transcript { list-style: none; margin: 0; padding: var(--sp-3); height: min(58vh, 620px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); display: flex; flex-direction: column; gap: 2px; }
#transcript:empty { height: auto; min-height: 5rem; }
#transcript:empty::before { content: 'No messages yet.'; color: var(--muted); margin: auto; }
#new-msgs { position: absolute; left: 50%; bottom: var(--sp-3); transform: translateX(-50%); }
.day { align-self: center; font-size: var(--fs-xs); color: var(--muted); margin: var(--sp-3) 0 var(--sp-2); }
.msg { max-width: min(85%, 36rem); align-self: flex-start; display: flex; gap: var(--sp-2); align-items: flex-start; }
.msg.mine { flex-direction: row-reverse; }
.msg-body { min-width: 0; }
.avatar.sm, .avatar-gap { width: 2rem; height: 2rem; font-size: var(--fs-xs); flex: none; }
.msg .avatar { margin-top: 1.2rem; }
/* AI face: a gradient mesh orb in the color of its chat bubbles: mine purple, theirs orange. */
.orb { flex: none; width: 2rem; height: 2rem; margin-top: 1.2rem; border-radius: 50%; position: relative; overflow: hidden;
  background: radial-gradient(circle at 28% 28%, #fff2c4, transparent 55%), radial-gradient(circle at 74% 38%, #ff9db6, transparent 55%),
    radial-gradient(circle at 45% 82%, #ffb36b, transparent 62%), #ea580c;
  box-shadow: inset 0 0 6px rgb(255 255 255 / .55), 0 2px 6px rgb(190 70 20 / .3); }
.orb.mine { background: radial-gradient(circle at 28% 28%, #ffd6f3, transparent 55%), radial-gradient(circle at 74% 34%, #8fd8ff, transparent 55%),
    radial-gradient(circle at 50% 82%, #b48cff, transparent 62%), #6d28d9; box-shadow: inset 0 0 6px rgb(255 255 255 / .55), 0 2px 6px rgb(90 40 200 / .3); }
.orb::after { content: ''; position: absolute; inset: -30%; background: conic-gradient(from 0deg, transparent, rgb(255 255 255 / .35), transparent 40%); animation: orb-spin 7s linear infinite; }
@keyframes orb-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .orb::after { animation: none; } }
.typing.idle .dots { display: none; }
.app-guide { margin: var(--sp-3) 0; border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--sp-2) var(--sp-3); }
.app-guide summary { font-weight: 700; cursor: pointer; }
.msg.mine { align-self: flex-end; }
.msg.first { margin-top: var(--sp-3); }
.msg:first-child, .day + .msg { margin-top: 0; }
.sender { font-size: var(--fs-xs); font-weight: 650; color: var(--muted); margin: 0 .4rem .2rem; }
.msg.mine .sender { text-align: end; }
.bubble { padding: .55rem .8rem; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg:not(.mine) .bubble { border-top-left-radius: var(--r-sm); }
.msg.mine .bubble { border-top-right-radius: var(--r-sm); }
.msg-body { display: flex; flex-direction: column; align-items: flex-start; }
.msg.mine .msg-body { align-items: flex-end; }
/* Same colors as the landing page: me = purple, them = orange. AI = soft and dashed, a person = solid. */
.msg.agent .bubble { background: color-mix(in srgb, var(--yp) 9%, var(--surface)); border: 1px dashed var(--yp); }
.msg.agent.mine .bubble { background: color-mix(in srgb, var(--yp-me) 9%, var(--surface)); border-color: var(--yp-me); }
.msg.human .bubble { background: var(--yp); border-color: var(--yp); color: var(--yp-on); }
.msg.human.mine .bubble { background: var(--yp-me); border-color: var(--yp-me); color: var(--yp-me-on); }
.meta { font-size: var(--fs-xs); color: var(--muted); margin: .15rem .4rem 0; display: flex; gap: .4rem; align-items: center; }
.msg.mine .meta { justify-content: flex-end; }
.meta button { min-height: 1.6rem; padding: 0 .4rem; font-size: var(--fs-xs); border: 0; background: none; color: var(--danger); }
.typing { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--muted); margin: var(--sp-2) .25rem; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--agent-border); animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
.state-card { margin: var(--sp-3) 0; padding: var(--sp-4); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); }
/* Handoff: one tinted region (common region), centered, the AI orbs passing to the people, one strong CTA. */
.state-card.handoff { text-align: center; border: 0; padding: var(--sp-6) var(--sp-5); background: linear-gradient(135deg, var(--accent-soft), var(--agent));
  box-shadow: 0 0 0 2px var(--accent), 0 12px 32px rgb(63 61 184 / .18); }
.handoff-faces { display: flex; justify-content: center; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.handoff-faces .pair { display: flex; }
.handoff-faces .pair > * + * { margin-inline-start: -.7rem; }
.handoff-faces .orb, .handoff-faces .avatar { margin: 0; width: 2.75rem; height: 2.75rem; box-shadow: 0 0 0 3px var(--surface); }
.handoff-arrow { color: var(--accent); font-size: var(--fs-lg); font-weight: 700; }
.handoff .eyebrow { margin: 0 0 var(--sp-1); font-size: var(--fs-xs); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.handoff h2 { margin: 0 0 var(--sp-2); font-size: var(--fs-xl); line-height: 1.2; text-wrap: balance; }
.handoff .muted { max-width: 32rem; margin: 0 auto var(--sp-5); }
.handoff .cta { display: flex; margin-inline: auto; min-height: 3rem; padding: 0 var(--sp-6); border-radius: var(--r-full); font-size: var(--fs-md); font-weight: 700; box-shadow: 0 6px 18px rgb(63 61 184 / .35); }
@media (prefers-reduced-motion: no-preference) { .state-card.handoff { animation: handoff-in .45s ease-out; } }
@keyframes handoff-in { from { opacity: 0; transform: translateY(10px); } }
.state-card .choices { margin: var(--sp-2) 0; border: 0; padding: 0; min-width: 0; }
.chat-bar { display: flex; gap: var(--sp-2); margin: var(--sp-3) 0; flex-wrap: wrap; }
.chat-bar .primary { margin-inline-start: auto; }
.compose { display: flex; gap: var(--sp-2); align-items: flex-end; margin-top: var(--sp-3); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); padding: var(--sp-2); }
.compose textarea { border: 0; padding: .45rem .5rem; min-height: 2.4rem; max-height: 9rem; background: transparent; resize: none; overflow-y: auto; }
.compose textarea:focus-visible { outline: none; }
.compose:focus-within { border-color: var(--accent); }
.hint { margin: var(--sp-1) var(--sp-2); }
/* ── Toasts and dialogs (overlays: the only places with shadows) ── */
.toasts { position: fixed; z-index: 30; left: 50%; top: calc(env(safe-area-inset-top) + 4.25rem); transform: translateX(-50%); display: grid; gap: var(--sp-2); width: min(92vw, 420px); pointer-events: none; }
.toast { pointer-events: auto; animation: toast-in .2s ease-out; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--text); color: var(--bg); box-shadow: var(--shadow-overlay); font-size: var(--fs-sm); border-inline-start: 4px solid var(--accent); }
.toast.error { border-inline-start-color: var(--danger); }
.toast.success { border-inline-start-color: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-.5rem); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
dialog { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-5); width: min(92vw, 420px); background: var(--surface); color: var(--text); box-shadow: var(--shadow-overlay); }
dialog::backdrop { background: rgb(10 10 20 / .45); }
/* The other person's profile: the Discover card in a modal, with a close button above it. */
.profile-dialog { width: min(94vw, 480px); max-height: 92dvh; overflow-y: auto; padding: var(--sp-3); }
.profile-close { display: flex; justify-content: flex-end; margin-bottom: var(--sp-2); }
.profile-dialog .card.person { margin: 0; }
/* Chat header: face and name open the profile. */
.who { padding: 0; border: 0; background: none; border-radius: 50%; min-width: 0; min-height: 0; }
.who:hover .avatar { box-shadow: 0 0 0 3px var(--accent-soft); }
.who-name, .msg .tappable { cursor: pointer; }
.menu-sep { width: 100%; margin: var(--sp-1) 0; border: 0; border-top: 1px solid var(--border); }
dialog label { margin-top: var(--sp-3); }

/* ── Motion ── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
#profile-notice { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
/* Field icons: one accent color everywhere, so every field reads as the same kind of thing. */
[data-icon] { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
[data-icon] > svg { width: 1.1rem; height: 1.1rem; flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* City search list: one row per city, the name first (what people scan for), then the local name and the place. */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 8; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: var(--sp-1); list-style: none; max-height: 18rem; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-overlay); }
.combo-list [role='option'] { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; padding: .55rem .7rem; border-radius: var(--r-sm); cursor: pointer; }
.combo-list [role='option'][aria-selected='true'], .combo-list [role='option']:hover { background: var(--accent-soft); }
.combo-list .matched { color: var(--accent); }
.combo-list .empty-option { padding: .55rem .7rem; }

/* ── Legal pages (terms.html, privacy-policy.html): one readable column ── */
.legal { max-width: 720px; line-height: 1.6; }
.legal h2 { margin-top: var(--sp-5); }

/* ── Public home page (view-login): the concept as an animated chat ──
   Line rule (brand): solid 2px stroke = a person, dashed = AI, a dot = an agent. Text never fades: it is revealed
   with clip-path or switched with visibility, so it keeps AA contrast in every frame. The base styles are the end
   state; motion runs only with prefers-reduced-motion: no-preference, two times (about 36 s), then stops on the end
   state (WCAG 2.2.2: no endless motion). */
main:has(> #view-login:not([hidden])) { display: flex; flex-direction: column; padding-bottom: var(--sp-4); }
.home { flex: 1 0 auto; display: flex; flex-direction: column; width: 100%; max-width: 1080px; margin: 0 auto; --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace; --t: 18s; }
.hero { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: var(--sp-6) 3.5rem; align-items: center; align-content: center; flex: 1 0 auto; padding: var(--sp-6) 0 var(--sp-5); }
.home h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); line-height: 1; font-weight: 650; letter-spacing: -.04em; margin: 0 0 var(--sp-4); }
.lede { font-size: 1.25rem; line-height: 1.5; color: var(--muted); max-width: 22em; margin: 0 0 var(--sp-6); }
.cta { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.btn-yp { display: inline-flex; align-items: center; justify-content: center; min-height: 3.5rem; min-width: 14rem; padding: 0 2.5rem; font-size: 1.125rem; border-radius: var(--r-full); background: var(--yp); color: var(--yp-on); font-weight: 600; text-decoration: none; }
.btn-yp, .btn-yp:hover { background: var(--yp); border-color: var(--yp); }
.btn-yp:hover { filter: brightness(1.08); }
.note { color: var(--muted); font-size: var(--fs-sm); }

/* The example chat */
.demo { position: relative; margin: 0; display: grid; place-items: center; padding: var(--sp-6) var(--sp-4); }
.demo-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 32px; }
.demo-card { position: relative; container-type: inline-size; width: 100%; max-width: 25rem; margin-inline: auto; padding: var(--sp-4) var(--sp-4) var(--sp-3); background: var(--surface); border: 7px solid var(--frame); border-radius: 36px; box-shadow: 0 34px 60px -24px rgb(70 20 60 / .45); }
.demo-head { display: flex; align-items: center; gap: var(--sp-2); font-weight: 600; font-size: var(--fs-sm); }
.who { display: inline-flex; align-items: center; gap: .4rem; flex: none; }
.face { width: 1.5rem; height: 1.5rem; border: 2px solid var(--yp); border-radius: 50%; object-fit: cover; }
/* Opening scene: the two photos meet, then fly up into the header. Hidden in the end state. */
.match-yp { position: absolute; inset: 0; z-index: 1; display: grid; align-content: start; justify-content: center; justify-items: center; gap: var(--sp-3); padding-top: 8rem; background: var(--surface); border-radius: 29px; visibility: hidden; }
.match-yp .pair { display: flex; }
.match-yp img { width: 5.5rem; height: 5.5rem; border-radius: 50%; object-fit: cover; border: 3px solid var(--yp-me); }
.match-yp .p2 { margin-inline-start: -1rem; border-color: var(--yp); }
.match-yp p { display: inline-flex; align-items: center; gap: .4rem; margin: 0; font: 600 var(--fs-sm)/1.4 var(--mono); }
.match-yp .ico { width: 1.1rem; height: 1.1rem; color: var(--yp); }
.who.you .face { border-color: var(--yp-me); }
.link-yp { flex: 1; min-width: 0; height: 1.5rem; }
.link-yp path { fill: none; stroke-width: 2; stroke-linecap: round; }
.ai-line { stroke: var(--yp-line); stroke-dasharray: 4 6; }
.human-line { stroke: var(--yp-me); stroke-dasharray: 1; stroke-dashoffset: 0; }
.node { fill: var(--text); }
.demo-state { display: grid; justify-items: center; margin: var(--sp-1) 0 0; font: var(--fs-xs)/1.4 var(--mono); color: var(--muted); }
.demo-state > span { grid-area: 1 / 1; }
.st-ai { visibility: hidden; }
.thread { list-style: none; margin: var(--sp-3) 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.sys { align-self: center; display: inline-flex; align-items: center; gap: .35rem; font: var(--fs-xs)/1.4 var(--mono); color: var(--muted); }
.sys .ico { width: 1rem; height: 1rem; color: var(--yp); }
.took { align-self: stretch; gap: var(--sp-2); }
.took::before, .took::after { content: ''; flex: 1; border-top: 2px solid var(--yp-me); }
.msg-yp { position: relative; display: flex; align-items: flex-end; gap: .4rem; max-width: 85%; }
.pic { flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%; object-fit: cover; }
.msg-yp.you { align-self: flex-end; justify-content: flex-end; }
.msg-yp .b { padding: .5rem .85rem; border: 2px solid var(--text); border-radius: 18px; font-size: .95rem; line-height: 1.35; }
.msg-yp.them .b { border-bottom-left-radius: 6px; }
.msg-yp.you .b { border-bottom-right-radius: 6px; }
.msg-yp.ai .b, .typing-yp, .bub.ai { --mesh-a: var(--yp); --mesh-b: var(--yp-me); background: radial-gradient(at 0% 0%, color-mix(in srgb, var(--mesh-a) 22%, transparent), transparent 65%), radial-gradient(at 100% 100%, color-mix(in srgb, var(--mesh-b) 18%, transparent), transparent 65%), radial-gradient(at 100% 0%, color-mix(in srgb, var(--mesh-a) 10%, transparent), transparent 55%), var(--surface); }
.msg-yp.you.ai .b, .you .typing-yp, .bub.ai.me { --mesh-a: var(--yp-me); --mesh-b: var(--yp); }
.msg-yp.ai .b { border-style: dashed; border-color: var(--yp); }
.msg-yp.you.ai .b { border-color: var(--yp-me); }
.msg-yp.human .b { background: var(--yp); border-color: var(--yp); color: var(--yp-on); }
.msg-yp.you.human .b { background: var(--yp-me); border-color: var(--yp-me); color: var(--yp-me-on); }
.by { display: block; margin-bottom: .1rem; font: .7rem/1.3 var(--mono); color: var(--muted); }
.typing-yp { position: absolute; bottom: 0; display: flex; gap: .25rem; padding: .7rem .8rem; border: 2px dashed var(--yp); color: var(--yp); border-radius: 18px; visibility: hidden; }
.them .typing-yp { left: 0; border-bottom-left-radius: 6px; }
.you .typing-yp { right: 0; border-bottom-right-radius: 6px; border-color: var(--yp-me); color: var(--yp-me); }
.typing-yp i { width: .4rem; height: .4rem; border-radius: 50%; background: currentColor; }
.composer { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--sp-2); padding: .35rem .4rem .35rem 1rem; border: 2px solid var(--text); border-radius: var(--r-full); color: var(--muted); font-size: var(--fs-sm); }
.composer > span { grid-area: 1 / 1; }
.c-ai { visibility: hidden; font-family: var(--mono); font-size: var(--fs-xs); }
.caret { display: inline-block; width: 2px; height: 1.1em; margin-inline-start: 2px; vertical-align: -.2em; background: var(--yp-me); }
.send { width: 2rem; height: 2rem; padding: .3rem; color: var(--text); }

/* Shared outline icons: 24 grid, 2px stroke */
.ico { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico .d { stroke-dasharray: 2.5 3.5; }
.ico .fill { fill: currentColor; stroke: none; }

/* Scenes: one picture and one line each. People are photos, AI is a mesh gradient and a dashed line. */
.scene { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: var(--sp-6) 4rem; align-items: center; padding: 4.5rem 0; }
.scene.flip .art { order: 2; }
.n { font: var(--fs-xs)/1.4 var(--mono); color: var(--yp); }
.home h2 { font-size: clamp(2rem, 4.4vw, 3.2rem); line-height: 1.05; letter-spacing: -.03em; font-weight: 650; margin: var(--sp-2) 0 var(--sp-3); }
.copy p { font-size: 1.15rem; line-height: 1.5; color: var(--muted); max-width: 24em; margin: 0; }
.art { position: relative; }
.bub { display: inline-block; padding: .5rem .85rem; border-radius: 18px; font-size: .95rem; line-height: 1.35; white-space: nowrap; }
.bub.ai { border: 2px dashed var(--yp); }
.bub.ai.me { border-color: var(--yp-me); }
.bub.human { box-shadow: 0 12px 24px -12px rgb(0 0 0 / .45); font-weight: 500; }
.bub.human.me { background: var(--yp-me); color: var(--yp-me-on); border-bottom-right-radius: 6px; }
.bub.human.them { background: var(--yp); color: var(--yp-on); border-bottom-left-radius: 6px; }

/* 01: a stack of photo cards */
.like-art { display: grid; place-items: center; min-height: 22rem; }
.pcard { grid-area: 1 / 1; position: relative; width: 14rem; aspect-ratio: 3 / 4; border-radius: 24px; overflow: hidden; background: var(--surface-2); box-shadow: 0 22px 40px -20px rgb(0 0 0 / .4); }
.pcard img { width: 100%; height: 100%; object-fit: cover; }
.c1 { transform: translateX(-5.5rem) rotate(-10deg) scale(.88); }
.c2 { transform: translateX(5.5rem) rotate(9deg) scale(.88); }
.c3::after { content: ''; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, rgb(0 0 0 / .6)); }
.c3 b { position: absolute; z-index: 1; left: 1rem; bottom: 1.1rem; color: #fff; font-size: 1.25rem; }
.heart { position: absolute; z-index: 1; right: .9rem; bottom: .8rem; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; background: var(--yp); color: var(--yp-on); }
.heart .ico { width: 1.5rem; height: 1.5rem; fill: currentColor; }

/* 02: two phones, two agents, one dashed line */
.ice-art { display: grid; grid-template-columns: minmax(0, 1fr) minmax(3rem, .8fr) minmax(0, 1fr); align-items: center; }
.phone { container-type: inline-size; display: grid; justify-items: center; align-content: space-between; gap: .6rem; aspect-ratio: 9 / 16; padding: 1.1rem .6rem 1rem; background: var(--surface); border: 6px solid var(--frame); border-radius: 28px; }
.phone img { width: 3rem; height: 3rem; border-radius: 50%; object-fit: cover; border: 2px solid var(--yp-me); }
.phone:last-child img { border-color: var(--yp); }
.phone small { font: var(--fs-xs)/1.3 var(--mono); color: var(--muted); text-align: center; }
.orb { width: 62cqw; height: 62cqw; border-radius: 50%; background: radial-gradient(circle at 30% 28%, rgb(255 255 255 / .7), transparent 32%), radial-gradient(circle at 72% 70%, var(--yp), transparent 62%), radial-gradient(circle at 25% 78%, var(--yp-me), transparent 60%), radial-gradient(circle at 80% 22%, #f9a8d4, transparent 55%), var(--surface-2); box-shadow: 0 0 44px color-mix(in srgb, var(--yp-me) 45%, transparent); }
.orb.o2 { background: radial-gradient(circle at 30% 28%, rgb(255 255 255 / .7), transparent 32%), radial-gradient(circle at 72% 70%, var(--yp-me), transparent 62%), radial-gradient(circle at 25% 78%, var(--yp), transparent 60%), radial-gradient(circle at 80% 22%, #fde68a, transparent 55%), var(--surface-2); box-shadow: 0 0 44px color-mix(in srgb, var(--yp) 45%, transparent); }
.wire { width: 100%; height: 5rem; overflow: visible; }
.wire path, .wires path { fill: none; stroke: var(--yp-line); stroke-width: 2; stroke-dasharray: 4 6; vector-effect: non-scaling-stroke; }
.ice-art .bub { position: absolute; left: 50%; font-size: .85rem; }
.ice-art .b1 { top: 12%; transform: translateX(-60%); }
.ice-art .b2 { bottom: 12%; transform: translateX(-40%); }

/* 03: the café, the two of them */
.take-art img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 28px; }
.take-art .bub { position: absolute; }
.take-art .me { right: 1.2rem; top: 1.4rem; }
.take-art .them { left: 1.2rem; bottom: 1.4rem; }

/* Safety: three small pictures */
.safety, .own-ai { padding: 4.5rem 0; }
.safety h2 { text-align: center; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); margin-top: var(--sp-5); }
.tile { margin: 0; display: grid; grid-template-rows: 10rem auto; gap: var(--sp-3); padding: var(--sp-3); border: 2px solid var(--border); border-radius: 24px; background: var(--surface); }
.tile-art { display: grid; place-content: center; justify-items: center; gap: var(--sp-2); padding: var(--sp-2); border-radius: 16px; background: radial-gradient(at 0% 0%, color-mix(in srgb, var(--yp) 12%, transparent), transparent 60%), radial-gradient(at 100% 100%, color-mix(in srgb, var(--yp-me) 12%, transparent), transparent 60%), var(--surface-2); }
.tile figcaption { padding: 0 var(--sp-1) var(--sp-1); font-weight: 600; }
.tile s { text-decoration-thickness: 2px; text-decoration-color: var(--danger); }
.chip-yp { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .75rem; border-radius: var(--r-full); background: var(--text); color: var(--surface); font: var(--fs-xs)/1.4 var(--mono); }
.chip-yp .ico { width: 1rem; height: 1rem; }
.ai-tag { display: inline-block; margin-inline-end: .45rem; padding: 0 .4rem; border-radius: 6px; background: var(--yp); color: var(--yp-on); font: 700 .7rem/1.6 var(--mono); vertical-align: .1em; }
.controls { display: inline-flex; gap: .25rem; padding: .3rem; border: 2px solid var(--border); border-radius: var(--r-full); background: var(--surface); }
.controls span { padding: .45rem .85rem; border-radius: var(--r-full); font-size: var(--fs-sm); font-weight: 600; }
.controls .on { background: var(--yp-me); color: var(--yp-me-on); }

/* Bring your own AI: apps wired to Yappa */
.own-ai { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: var(--sp-6) 4rem; align-items: center; }
.hub-art { display: grid; grid-template-columns: auto minmax(3rem, 1fr) auto; grid-template-rows: repeat(3, 4.5rem); align-items: center; }
.app { grid-column: 1; justify-self: stretch; padding: .75rem 1.2rem; border: 2px solid var(--border); border-radius: 16px; background: var(--surface); font-weight: 600; text-align: center; }
.a3 { border: 2px dashed var(--yp); }
.wires { grid-column: 2; grid-row: 1 / 4; width: 100%; height: 100%; }
.hub { grid-column: 3; grid-row: 1 / 4; display: grid; place-items: center; width: 6.5rem; height: 6.5rem; border-radius: 30px; background: var(--frame); color: #fff; }
.hub .mark { width: 3.4rem; height: 3.4rem; }

/* Join: faces over the beach */
.join-band { display: grid; justify-items: center; gap: var(--sp-3); margin: 2rem 0 var(--sp-6); padding: 4.5rem var(--sp-4); border-radius: 32px; text-align: center; background: linear-gradient(color-mix(in srgb, var(--bg) 35%, transparent), color-mix(in srgb, var(--bg) 70%, transparent)), url(/demo/beach.webp) center / cover; }
.join-band h2 { margin: var(--sp-2) 0; }
.faces { display: inline-flex; }
.faces img { width: 4.5rem; height: 4.5rem; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface); }
.faces img + img { margin-inline-start: -1rem; }

/* Sign-in dialog */
.signin-dialog { width: min(92vw, 400px); padding: var(--sp-3) var(--sp-5) var(--sp-5); text-align: center; }
.signin-dialog .profile-close { margin-bottom: 0; }
.signin-faces { display: inline-flex; }
.signin-faces img { width: 3.5rem; height: 3.5rem; border-radius: 50%; object-fit: cover; border: 3px solid var(--yp-me); }
.signin-faces img + img { margin-inline-start: -.8rem; border-color: var(--yp); }
.signin-dialog h2 { margin: var(--sp-2) 0 var(--sp-1); }
.stack-form { display: grid; gap: var(--sp-2); margin-top: var(--sp-3); }
.dev-signin { margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--border); text-align: start; }
.dev-signin summary { cursor: pointer; color: var(--muted); font-size: var(--fs-sm); }
.dev-signin .row { flex-wrap: wrap; margin-top: var(--sp-2); }
.top-signin { border: 0; background: none; min-height: auto; }

.site-foot { display: flex; gap: var(--sp-5); flex-wrap: wrap; margin-top: auto; padding-bottom: var(--sp-2); padding-top: var(--sp-4); border-top: 2px solid var(--border); color: var(--muted); font-size: var(--fs-sm); }
.site-foot span { margin-inline-end: auto; font-weight: 600; }

@media (max-width: 760px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-top: var(--sp-4); }
  .lede { font-size: 1.1rem; margin-bottom: var(--sp-5); }
  .btn-yp { width: 100%; } /* phones: full width, easy to tap */
  .scene, .own-ai { grid-template-columns: minmax(0, 1fr); padding: 3rem 0; }
  .scene.flip .art { order: 0; }
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .pcard { width: 11rem; }
  .c1 { transform: translateX(-4rem) rotate(-10deg) scale(.88); }
  .c2 { transform: translateX(4rem) rotate(9deg) scale(.88); }
  .like-art { min-height: 17rem; }
  .ice-art .bub { font-size: .75rem; padding: .35rem .6rem; }
  .ice-art .b1 { top: 4%; }
  .ice-art .b2 { bottom: 30%; }
  .demo { padding: var(--sp-4) var(--sp-3); }
}

@media (prefers-reduced-motion: no-preference) {
  .match-yp { animation: yp-scene var(--t) step-end 2; }
  .match-yp p { animation: yp-scene-text var(--t) step-end 2; }
  .match-yp .p1 { animation: yp-p1 var(--t) ease-in-out 2; }
  .match-yp .p2 { animation: yp-p2 var(--t) ease-in-out 2; }
  .m2 .b { animation: yp-m2 var(--t) ease-out 2; }
  .m3 .b { animation: yp-m3 var(--t) ease-out 2; }
  .m4 .b { animation: yp-m4 var(--t) ease-out 2; }
  .m5 { animation: yp-m5 var(--t) ease-out 2; }
  .m6 { animation: yp-m6 var(--t) ease-out 2; }
  .m7 { animation: yp-m7 var(--t) ease-out 2; }
  .t2 { animation: yp-t2 var(--t) step-end 2; }
  .t3 { animation: yp-t3 var(--t) step-end 2; }
  .t4 { animation: yp-t4 var(--t) step-end 2; }
  .typing-yp i { animation: yp-dot 1s ease-in-out 36; }
  .typing-yp i:nth-child(2) { animation-delay: .15s; }
  .typing-yp i:nth-child(3) { animation-delay: .3s; }
  .st-ai, .c-ai { animation: yp-ai-phase var(--t) step-end 2; }
  .st-you, .c-you { animation: yp-you-phase var(--t) step-end 2; }
  .composer { animation: yp-composer var(--t) step-end 2; }
  .human-line { animation: yp-draw var(--t) ease-in-out 2; }
  .ai-line { animation: yp-flow 1s linear 36; }
  .caret { animation: yp-blink 1s step-end 36; }
  .wire path, .wires path { animation: yp-flow 1s linear 36; }
  .heart { animation: yp-pulse 1.6s ease-in-out 8; }
  .orb { animation: yp-orb 4s ease-in-out 10 alternate; }
  @supports (animation-timeline: view()) {
    .art, .tile, .join-band .faces { animation: yp-rise linear both; animation-timeline: view(); animation-range: entry 0% entry 70%; }
  }
}
@keyframes yp-scene { 0% { visibility: visible; } 12% { visibility: hidden; } }
@keyframes yp-scene-text { 0% { visibility: hidden; } 3% { visibility: visible; } 9% { visibility: hidden; } }
@keyframes yp-p1 { 0% { transform: translateX(-5rem); opacity: 0; } 3%, 8% { transform: none; opacity: 1; } 11.5%, 100% { transform: translate(calc(48px - 50cqw), -144px) scale(.27); } }
@keyframes yp-p2 { 0% { transform: translateX(5rem); opacity: 0; } 3%, 8% { transform: none; opacity: 1; } 11.5%, 100% { transform: translate(calc(50cqw - 95px), -144px) scale(.27); } }
@keyframes yp-t2 { 0% { visibility: hidden; } 12% { visibility: visible; } 15% { visibility: hidden; } }
@keyframes yp-m2 { 0%, 15% { clip-path: inset(0 0 100% 0); transform: translateY(.4rem); } 17%, 95% { clip-path: inset(-.5rem); transform: none; } 97%, 100% { clip-path: inset(0 0 100% 0); transform: translateY(.4rem); } }
@keyframes yp-t3 { 0% { visibility: hidden; } 20% { visibility: visible; } 27% { visibility: hidden; } }
@keyframes yp-m3 { 0%, 27% { clip-path: inset(0 0 100% 0); transform: translateY(.4rem); } 29%, 95% { clip-path: inset(-.5rem); transform: none; } 97%, 100% { clip-path: inset(0 0 100% 0); transform: translateY(.4rem); } }
@keyframes yp-t4 { 0% { visibility: hidden; } 32% { visibility: visible; } 39% { visibility: hidden; } }
@keyframes yp-m4 { 0%, 39% { clip-path: inset(0 0 100% 0); transform: translateY(.4rem); } 41%, 95% { clip-path: inset(-.5rem); transform: none; } 97%, 100% { clip-path: inset(0 0 100% 0); transform: translateY(.4rem); } }
@keyframes yp-m5 { 0%, 47% { clip-path: inset(0 0 100% 0); transform: translateY(.4rem); } 49%, 95% { clip-path: inset(-.5rem); transform: none; } 97%, 100% { clip-path: inset(0 0 100% 0); transform: translateY(.4rem); } }
@keyframes yp-m6 { 0%, 55% { clip-path: inset(0 0 100% 0); transform: translateY(.4rem); } 57%, 95% { clip-path: inset(-.5rem); transform: none; } 97%, 100% { clip-path: inset(0 0 100% 0); transform: translateY(.4rem); } }
@keyframes yp-m7 { 0%, 63% { clip-path: inset(0 0 100% 0); transform: translateY(.4rem); } 65%, 95% { clip-path: inset(-.5rem); transform: none; } 97%, 100% { clip-path: inset(0 0 100% 0); transform: translateY(.4rem); } }
@keyframes yp-ai-phase { 0% { visibility: visible; } 47% { visibility: hidden; } 96% { visibility: visible; } }
@keyframes yp-you-phase { 0% { visibility: hidden; } 47% { visibility: visible; } 96% { visibility: hidden; } }
@keyframes yp-composer { 0% { border-style: dashed; border-color: var(--yp-line); } 47% { border-style: solid; border-color: var(--text); } 96% { border-style: dashed; border-color: var(--yp-line); } }
@keyframes yp-draw { 0%, 47% { stroke-dashoffset: 1; } 53%, 95% { stroke-dashoffset: 0; } 97%, 100% { stroke-dashoffset: 1; } }
@keyframes yp-flow { to { stroke-dashoffset: -20; } }
@keyframes yp-dot { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-.2rem); } }
@keyframes yp-blink { 50% { visibility: hidden; } }
@keyframes yp-pulse { 50% { transform: scale(1.12); } }
@keyframes yp-orb { to { transform: scale(1.07) rotate(30deg); } }
@keyframes yp-rise { from { opacity: 0; transform: translateY(2rem); } }

/* Touch screens: controls and footer links at least 44px high (WCAG 2.5.5). */
@media (pointer: coarse) {
  button:not(.link), select, .menu summary { min-height: 2.75rem; }
  button.icon, .menu summary { min-width: 2.75rem; }
  .icon-btn { width: 2.75rem; height: 2.75rem; } /* round, not stretched */
  .site-foot a { display: inline-flex; align-items: center; min-height: 2.75rem; }
  .meta button { min-height: 1.6rem; } /* small Report link in each message: 24px+ (WCAG 2.5.8) keeps the transcript compact */
}

/* ── Connect your AI: app picker and visual steps ── */
.app-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); margin: var(--sp-2) 0 var(--sp-3); }
.app-tile { position: relative; display: grid; justify-items: center; gap: var(--sp-1); padding: var(--sp-3) var(--sp-2); border: 2px solid var(--border); border-radius: var(--r-md); background: var(--surface); cursor: pointer; font-weight: 650; font-size: var(--fs-sm); text-align: center; }
.app-tile input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.app-tile:hover { border-color: var(--border-strong); }
.app-tile:has(input:checked) { border-color: var(--yp-me); background: color-mix(in srgb, var(--yp-me) 7%, var(--surface)); }
.app-tile:has(input:focus-visible) { outline: 3px solid var(--yp-me); outline-offset: 2px; }
.app-tile .chip { font-weight: 600; }
/* My agent card: name and state on the left, its actions grouped on the right (they wrap below on narrow screens). */
.agent-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-2); }
.agent-head > .grow { flex: 1 1 14rem; }
.agent-head h2 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin: 0; }
.agent-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.app-logo { width: 2.25rem; height: 2.25rem; display: grid; place-items: center; color: var(--text); }
.app-logo svg { width: 100%; height: 100%; }
.vsteps { list-style: none; counter-reset: vstep; margin: 0; padding: 0; display: grid; gap: var(--sp-4); }
.vstep { counter-increment: vstep; display: grid; gap: var(--sp-2); }
.vstep-text { position: relative; padding-inline-start: 2.1rem; font-size: var(--fs-sm); line-height: 1.5; }
.vstep-text::before { content: counter(vstep); position: absolute; inset-inline-start: 0; top: -.05rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 700; background: var(--yp-me); color: var(--yp-me-on); }
.vstep > :not(.vstep-text) { margin-inline-start: 2.1rem; }
.mock { border: 1px solid var(--border-strong); border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); font-size: var(--fs-xs); max-width: 30rem; user-select: none; }
.mock-bar { display: flex; align-items: center; gap: .3rem; padding: .35rem .5rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.mock-bar i { width: .5rem; height: .5rem; border-radius: 50%; background: var(--border-strong); }
.mock-url { margin-inline-start: .4rem; flex: 1; padding: .1rem .5rem; border-radius: var(--r-full); background: var(--surface-2); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mock-body { display: flex; min-height: 5.5rem; }
.mock-side { display: grid; align-content: start; gap: .15rem; padding: .5rem; border-inline-end: 1px solid var(--border); min-width: 7rem; color: var(--muted); }
.mock-side span { padding: .2rem .4rem; border-radius: var(--r-sm); }
.mock-side .on { background: var(--surface); color: var(--text); font-weight: 650; }
.mock-main { flex: 1; display: grid; align-content: start; gap: .45rem; padding: .6rem .7rem; min-width: 0; }
.mock-main p { margin: 0; color: var(--muted); }
.mock-title { font-size: var(--fs-sm); }
.mock-row { display: flex; gap: .4rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.mock-row .mock-btn:last-child { margin-inline-start: auto; }
.mock-btn { display: inline-block; padding: .25rem .6rem; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); font-weight: 650; width: fit-content; }
.mock-btn.primary { background: var(--text); color: var(--surface); border-color: var(--text); }
.mock-field { display: grid; gap: .1rem; padding: .3rem .45rem; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); min-width: 0; }
.mock-field small { color: var(--muted); font-size: .65rem; }
.mock-field span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mock-toggle { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: .3rem .45rem; border-radius: var(--r-sm); background: var(--surface); }
.mock-toggle i { width: 1.6rem; height: .9rem; border-radius: var(--r-full); background: var(--yp-me); position: relative; }
.mock-toggle i::after { content: ''; position: absolute; right: .12rem; top: .12rem; width: .66rem; height: .66rem; border-radius: 50%; background: #fff; }
.mock-check { display: flex; gap: .35rem; align-items: center; }
.mock-check i { width: .8rem; height: .8rem; border-radius: 3px; background: var(--yp-me); }
.mock-dialog { flex: 1; display: grid; gap: .4rem; margin: .5rem auto; padding: .6rem .7rem; width: min(100% - 1rem, 22rem); background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-overlay, 0 6px 20px rgb(0 0 0 / .15)); }
.mock-chat { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-top: auto; padding: .4rem .6rem; border: 1px solid var(--border-strong); border-radius: var(--r-full); background: var(--surface); }
.mock-chat i { width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--text); flex: none; }
/* The thing to click: a purple ring, gently pulsing. */
.mock .target { outline: 2px solid var(--yp-me); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) { .mock .target { animation: target-pulse 1.6s ease-out infinite; } }
@keyframes target-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--yp-me) 50%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }
@media (max-width: 480px) { .mock-side { display: none; } }

/* "Add to home screen" hint: phones only (app.js decides), one line, closes for good. */
.install-hint { display: flex; align-items: center; gap: var(--sp-3); margin-block-end: var(--sp-3); padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); }
.install-hint[hidden] { display: none; }
.install-hint span { flex: 1; }
