/* The talk, embeddable: one centered column (the orb, what's
   happening, the controls) that fits a phone, a sidebar or a page. */
:root {
  --bg: #f5f4f0; --panel: #ffffff; --ink: #1c1b18; --muted: #6a6760; --line: #e0ddd5;
  --accent: #6b4fd8; --accent-ink: #ffffff; --soft: #e6e0fb; --stop: #c2382f; --go: #23855a;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121110; --panel: #1b1a18; --ink: #ebe8e1; --muted: #a29e95; --line: #312f2b;
    --accent-ink: #110e1c; --stop: #ef6d63; --go: #4cc48c; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121110; --panel: #1b1a18; --ink: #ebe8e1; --muted: #a29e95; --line: #312f2b;
  --accent-ink: #110e1c; --stop: #ef6d63; --go: #4cc48c; color-scheme: dark;
}
:root[data-bg="transparent"] { --bg: transparent; }
* { box-sizing: border-box; }
html, body { min-height: 100%; }
:root.embedded, :root.embedded body { min-height: 0; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); }
button { font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 10px 20px; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.big { padding: 13px 28px; font-size: 17px; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.boot, .muted { color: var(--muted); }
.error { color: var(--stop); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { max-width: 560px; margin: 0 auto; padding: 24px 16px 32px; display: grid; gap: 18px; }
h1 { margin: 0; font-size: 22px; line-height: 1.25; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: grid; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* The stage: everything centered under the orb. */
.stage { display: grid; justify-items: center; text-align: center; gap: 12px; }
.stage .lede { margin: 0; max-width: 42ch; color: var(--muted); }
.stage .fine, details.fine { font-size: 13px; color: var(--muted); margin: 0; }
details.fine summary { cursor: pointer; }
details.fine .consent { text-align: left; white-space: pre-wrap; max-width: 46ch; }
canvas.orb { width: min(240px, 62vw); aspect-ratio: 1; display: block; }
.what { margin: 0; font-weight: 600; font-size: 17px; min-height: 1.5em; }

.dots { display: flex; gap: 6px; min-height: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dot.done { background: var(--accent); }
.dot.now { background: var(--accent); opacity: .45; }

.controls { display: flex; gap: 18px; margin-top: 6px; }
button.round { width: 56px; height: 56px; padding: 0; display: grid; place-items: center; border-radius: 50%; }
button.round.off { background: var(--ink); color: var(--panel); border-color: var(--ink); }
button.round.end { background: var(--stop); border-color: var(--stop); color: #fff; }
button.link { border: 0; background: none; padding: 4px; color: var(--muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.typing { width: 100%; max-width: 420px; display: grid; gap: 6px; }
form.say { display: flex; gap: 8px; }
form.say input { flex: 1; min-width: 0; font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; }
form.say input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* The review. */
.review .summary { margin: 0; font-size: 17px; }
.review dl { display: grid; gap: 4px 0; margin: 0; }
.review dt { color: var(--muted); font-size: 14px; margin-top: 8px; }
.review dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; white-space: pre-line; }
textarea { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; width: 100%; resize: vertical; }
textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { font-weight: 600; }

/* What the agent knows */
details.knows { width: 100%; max-width: 480px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; font-size: 14px; }
details.knows summary { cursor: pointer; font-weight: 600; color: var(--ink); }
details.knows dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 10px 0 2px; }
details.knows dt { color: var(--muted); }
details.knows dd { margin: 0; overflow-wrap: anywhere; }
details.knows ul { margin: 0; padding-left: 18px; }
@media (max-width: 480px) { details.knows dl { grid-template-columns: 1fr; } details.knows dd { margin-bottom: 4px; } }

/* My talks */
body.me #app { max-width: 720px; }
body.me .head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
body.me .head h1, body.me .head h2 { margin-right: auto; }
body.me h2 { margin: 0; font-size: 18px; }
body.me .lede { color: var(--muted); margin: 0; }
body.me .card.talk { gap: 10px; }
body.me .summary { font-size: 16px; margin: 0; }
body.me dl.answers { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 0; }
body.me dl.answers dt { color: var(--muted); font-size: 14px; margin-top: 6px; }
body.me dl.answers dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
body.me details summary { cursor: pointer; color: var(--muted); font-size: 14px; }
body.me ul.reads { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
body.me .chip { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
body.me .chip.completed { color: var(--go); border-color: var(--go); }
body.me .chip.review { color: var(--accent); border-color: var(--accent); }
body.me button.danger { color: var(--stop); border-color: var(--stop); }
body.me .ok { color: var(--go); }
body.me form.card .say { display: flex; gap: 8px; }
body.me form.card input { flex: 1; min-width: 0; font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; }
body.me audio { width: 100%; }

form.say.signin { width: 100%; max-width: 420px; }
form.say.signin input { flex: 1; min-width: 0; font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; }
/* Sign up (start.html) */
body.me ol.steps { display: flex; gap: 16px; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 14px; counter-reset: s; }
body.me ol.steps li { counter-increment: s; }
body.me ol.steps li::before { content: counter(s) ". "; }
body.me ol.steps li.now { color: var(--ink, inherit); font-weight: 600; }
body.me ol.steps li.done { color: var(--go); }
body.me .card label { font-weight: 600; }
body.me .card .say input { flex: 1; min-width: 0; font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; }
body.me .copy { display: grid; gap: 6px; }
body.me .copy pre { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
body.me code { font-size: 0.92em; }
/* The platform console (admin.html) */
body.admin #app { max-width: 1080px; }
body.admin .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
body.admin .stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
body.admin .stat .v { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
body.admin .stat .l { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
body.admin .stat .s { color: var(--muted); font-size: 13px; }
body.admin .scroll { overflow-x: auto; }
body.admin table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
body.admin table.grid th, body.admin table.grid td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
body.admin table.grid th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
body.admin table.grid td.n { text-align: right; font-variant-numeric: tabular-nums; }
body.admin tr.paused td { color: var(--muted); }
body.admin .chip { margin-left: 8px; font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); }
body.admin select { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: inherit; max-width: 100%; }
body.admin .notice { color: var(--go); }
body.admin .small { font-size: 13px; }
body.console #make-key { justify-self: start; width: auto; }

/* A form (form.js): one question at a time, answered by voice. */
.form .progress { width: 100%; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.form .progress span { display: block; height: 100%; background: var(--accent); transition: width .3s ease; }
.form h2.ask { margin: 6px 0 0; font-size: 24px; line-height: 1.3; max-width: 30ch; }
canvas.orb.small { width: min(150px, 40vw); }
button.mic { min-width: 180px; padding: 14px 28px; font-size: 17px; font-weight: 600; border-color: var(--accent); color: var(--accent); }
button.mic.on { background: var(--accent); color: var(--accent-ink); }
.form .chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 34px; max-width: 460px; }
.chip.anchor { display: inline-flex; align-items: center; gap: 4px; padding: 5px 6px 5px 12px; border-radius: 999px; background: var(--soft); color: var(--ink); font-size: 14px; animation: rise .35s ease both; }
.chip.anchor .x { border: 0; background: none; padding: 0 6px; font-size: 16px; line-height: 1; color: var(--muted); }
.outline .chip.anchor { padding-right: 12px; animation: none; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .chip.anchor { animation: none; } .form .progress span { transition: none; } }
.form textarea { width: 100%; max-width: 460px; font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: vertical; }
.form textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.form .consent { text-align: left; max-width: 460px; white-space: pre-wrap; }
.form .consent .check { display: flex; gap: 8px; align-items: center; font-weight: 600; white-space: normal; }
.form ol.outline { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 10px; text-align: left; }
.form ol.outline li { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; }
.form ol.outline .head { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.form ol.outline .chips { justify-content: flex-start; min-height: 0; }
.form ol.outline p { margin: 0; }
.form.result { text-align: left; justify-items: stretch; }
.form article.story { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; display: grid; gap: 10px; }
.form article.story h1 { font-size: 26px; }
.form article.story p { margin: 0; line-height: 1.65; }
.form article.story .fine { text-transform: uppercase; letter-spacing: .06em; }

/* The console's voice components: the list, and each one's three steps. */
body.console.editing #app { max-width: 980px; padding-bottom: 96px; }
body.console .head .chip { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); }
body.console .step { gap: 14px; }
body.console .step-head { display: flex; gap: 12px; align-items: flex-start; }
body.console .step-head .num { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 14px; }
body.console .step-head p { margin: 2px 0 0; }
body.console.editing .field { display: grid; gap: 6px; font-weight: 600; }
body.console.editing .field > span:first-child { font-size: 14px; }
body.console.editing .field .muted { font-weight: 400; }
body.console.editing .pair { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
body.console.editing input:not([type=checkbox]), body.console.editing select, body.console.editing textarea {
  font: inherit; font-weight: 400; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; width: 100%; min-width: 0; }
body.console.editing #c-goal { font-size: 17px; }
body.console.editing input[type=checkbox] { flex: none; width: auto; }
body.console.editing input:disabled { color: var(--muted); background: var(--bg); }
body.console.editing fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 12px; margin: 12px 0 0; }
body.console.editing legend { font-weight: 600; font-size: 14px; padding: 0 6px; }
body.console.editing .check { font-weight: 400; display: flex; gap: 8px; align-items: center; }
body.console .plan-line { margin: 0; }
body.console details.fine-tune { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 10px; }
body.console details.fine-tune[open] { gap: 10px; }
body.console details.fine-tune > summary { cursor: pointer; color: var(--muted); font-size: 14px; }
body.console details.fine-tune > * + * { margin-top: 10px; }
body.console ol.topics, body.console ol.blocks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-weight: 400; }
body.console .topic { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
body.console .topic > input[type=checkbox] { margin-top: 10px; }
body.console .topic .fields { display: grid; gap: 6px; }
body.console .topic .fields input + input { font-size: 14px; color: var(--muted); }
body.console .topic.off, body.console .block.off { opacity: .55; }
body.console .topic .moves, body.console .block .moves { display: flex; }
body.console .block { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
body.console .block label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
body.console .output-step { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 820px) { body.console .output-step { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); } }
body.console .output-frame { border: 1px dashed var(--line); border-radius: 14px; padding: 16px; background: var(--bg); display: grid; gap: 10px; }
body.console .output-frame > p { margin: 0; }
body.console .output-preview > div { display: grid; gap: 16px; }
body.console button.add { justify-self: start; }
body.console .saved { color: var(--go); margin: 0; }
body.console .try p { margin: 0; }
body.console .plan { display: grid; gap: 12px; }
body.console .plan p, body.console .plan h3 { margin: 0; }
body.console .plan h3 { font-size: 16px; }
body.console .plan .chip { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--accent); color: var(--accent); }
body.console ol.aims { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
body.console .plan .brief { font-size: 14px; border-left: 3px solid var(--soft); padding-left: 10px; }
body.console .savebar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 12px; align-items: center; justify-content: center; padding: 12px 16px; background: var(--panel); border-top: 1px solid var(--line); }
body.console:not(.editing) .savebar { display: none; }

/* An output page (the form's end, the console's preview): the component
   library's blocks, in this page's colors and type. */
.output, body.console .output-preview { --vbdb-accent: var(--accent); --vbdb-accent-ink: var(--accent-ink); --vbdb-accent-soft: var(--soft); --vbdb-focus: var(--accent);
  --vbdb-bg: var(--bg); --vbdb-surface: var(--panel); --vbdb-ink: var(--ink); --vbdb-muted: var(--muted); --vbdb-line: var(--line); --vbdb-font: var(--font); }
.stage .output { text-align: left; width: 100%; max-width: 560px; }
.stage .output > div, .stage .output { display: grid; gap: 18px; }

/* Answering a voice form: one big mic whose ring follows their voice, their
   words as they come, and their answer (play it back, change the words). */
.answering { gap: 14px; }
.answering .ask { max-width: 30ch; }
.mic-wrap { position: relative; display: grid; place-items: center; margin: 8px 0 2px; }
.mic-big { position: relative; width: 96px; height: 96px; padding: 0; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent); transition: transform .12s ease; }
.mic-big:hover:not(:disabled) { transform: scale(1.03); }
.mic-big:disabled { opacity: .6; cursor: progress; }
.mic-big svg { position: relative; z-index: 1; }
.mic-big .ring { position: absolute; inset: -8px; border-radius: 50%; border: 3px solid var(--accent); opacity: 0; transform: scale(calc(1 + var(--level, 0) * .45)); transition: transform 80ms linear, opacity .2s; }
.mic-wrap[data-state="listening"] .ring { opacity: .45; }
.mic-wrap[data-state="listening"] .mic-big { background: var(--stop); box-shadow: 0 6px 20px color-mix(in srgb, var(--stop) 35%, transparent); }
.mic-wrap[data-state="listening"] .ring { border-color: var(--stop); }
.mic-wrap[data-state="hearing"] .ring { opacity: .5; animation: hearing 1.1s ease-in-out infinite; }
.mic-wrap[data-state="done"] .mic-big { background: var(--panel); color: var(--accent); border: 2px solid var(--accent); box-shadow: none; }
@keyframes hearing { 50% { transform: scale(1.18); opacity: .15; } }
.mic-label { margin: 0; font-weight: 600; }
.mic-time { margin: -8px 0 0; min-height: 1.2em; font-variant-numeric: tabular-nums; }
.answering .live { margin: 0; max-width: 46ch; min-height: 3em; color: var(--muted); font-size: 17px; line-height: 1.45; }
.answering .notice { margin: 0; max-width: 46ch; color: var(--stop); }
.answer-card { width: 100%; max-width: 520px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 10px; }
.answer-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.answer-head audio { height: 36px; max-width: 100%; }
.answer-words { margin: 0; font-size: 17px; line-height: 1.5; white-space: pre-line; }
.answer-card .chips { justify-content: flex-start; min-height: 0; }
@media (prefers-reduced-motion: reduce) { .mic-big .ring, .mic-wrap[data-state="hearing"] .ring { animation: none; transition: none; } }

/* After the story: their clip, and what they can do with it. */
.after { display: grid; gap: 16px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line, #e5e5e5); }
.after .clips { display: grid; gap: 14px; }
.after .clips h3 { margin: 0; font-size: 15px; font-weight: 600; }
.after .clip { margin: 0; display: grid; gap: 8px; }
.after .clip figcaption { display: grid; gap: 2px; }
.after .clip audio { width: 100%; }
.after .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.after .share { display: grid; gap: 10px; }
.after .linkbox { display: flex; gap: 8px; }
.after .linkbox input { flex: 1; min-width: 0; }
.after a.button { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink); }
/* The share page (/p/...): a story to read, with its clip. */
body.share-page { margin: 0; background: var(--bg); color: var(--ink); }
body.share-page main.share { max-width: 640px; margin: 0 auto; padding: 48px 20px 64px; }
body.share-page .story h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 6px; }
body.share-page .story .byline { color: var(--muted); margin: 0 0 20px; }
body.share-page .story p { font-size: 1.1rem; line-height: 1.65; }
body.share-page .clips { margin: 32px 0 0; display: grid; gap: 12px; }
body.share-page .clips h2 { margin: 0; font-size: 16px; font-weight: 600; }
body.share-page .clip { margin: 0; display: grid; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
body.share-page .clip figcaption { display: grid; gap: 2px; }
body.share-page .clip audio { width: 100%; }
body.share-page .made { margin-top: 36px; color: var(--muted); }
.after .keep { display: grid; gap: 6px; }
.after .invite { margin-top: 8px; }
