/* build-modal.css: the public builder over the live site, the "Studio"
   (docs/design-pov.md, 5.5; web/static/build-modal.js). On base.css tokens,
   aliased here as --bm-* so the Studio can be themed on its own. Desktop: a
   square sheet docked right, the site still alive behind a scrim. Phones and
   tablets: a bottom sheet with a grabber. Its own type (upright Instrument
   Sans for display, Geist Mono for labels; no italics) and a neutral
   off-white in light mode, so it doesn't read as the site's serif identity. */
@font-face { font-family: "Geist Mono"; src: url("/static/fonts/geist-mono.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
:root {
  --bm-font-display: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --bm-font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --bm-field: var(--bg);
  --bm-bg: var(--bg-raised);
  --bm-fg: var(--fg);
  --bm-muted: var(--fg-2);
  --bm-faint: var(--fg-3);
  --bm-rule: var(--rule);
  --bm-rule-strong: var(--rule-strong);
  --bm-accent: var(--accent);
  --bm-accent-fg: var(--accent-ink);
  --bm-backdrop: var(--scrim);
  --bm-shadow: 0 40px 120px -40px rgb(0 0 0 / .6);
  --bm-width: clamp(440px, 36vw, 560px);
  --bm-inset: 12px;
  --bm-pad: var(--s-5);
  --bm-z: var(--z-modal);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bm-shadow: 0 30px 80px -40px rgb(21 21 19 / .35);
    --bm-bg: #FAFAF8; --bm-field: #FFFFFF; --bm-muted: #5F5F5B; --bm-faint: #8E8E89;
    --bm-rule: rgb(20 20 18 / .1); --bm-rule-strong: rgb(20 20 18 / .26);
  }
}
:root[data-theme="light"] {
  --bm-bg: #FAFAF8; --bm-field: #FFFFFF; --bm-muted: #5F5F5B; --bm-faint: #8E8E89;
  --bm-rule: rgb(20 20 18 / .1); --bm-rule-strong: rgb(20 20 18 / .26);
}

html.bm-open, html.bm-open body { overflow: hidden; }
/* the site steps back a touch while the Studio is open */
html.bm-open #frontend { transform: scale(.985); }

.bm-root[hidden], .bm-pill[hidden], .bm-root [hidden] { display: none !important; }
.bm-root {
  position: fixed; inset: 0; z-index: var(--bm-z);
  font-family: var(--font-text); font-size: var(--t-ui); line-height: 1.45; color: var(--bm-fg);
  -webkit-text-size-adjust: 100%;
}
.bm-root *, .bm-pill * { box-sizing: border-box; }
.bm-backdrop {
  position: absolute; inset: 0; background: var(--bm-backdrop);
  animation: bm-fade var(--d-3) var(--ease-out) backwards;
}

/* ── the sheet ── */
.bm-dialog {
  position: absolute; display: flex; flex-direction: column; overflow: hidden;
  top: var(--bm-inset); right: var(--bm-inset); bottom: var(--bm-inset);
  width: var(--bm-width); max-width: calc(100vw - 2 * var(--bm-inset));
  background: var(--bm-bg); color: var(--bm-fg);
  border: 1px solid var(--bm-rule); border-radius: var(--r-0); box-shadow: var(--bm-shadow);
  outline: none;
  animation: bm-wipe var(--d-4) var(--ease-out) backwards;
}
@keyframes bm-wipe { from { clip-path: inset(0 0 0 100%); transform: translateX(24px); } to { clip-path: inset(0); transform: none; } }
@keyframes bm-fade { from { opacity: 0; } }
@keyframes bm-rise { from { opacity: 0; transform: translateY(12px); } }
/* contents arrive in sequence */
.bm-head, .bm-body { animation: bm-rise var(--d-4) var(--ease-out) backwards; }
.bm-head { animation-delay: 120ms; }
.bm-body { animation-delay: 190ms; }
/* exits are faster than entrances, and unstaggered */
.bm-leaving .bm-backdrop { animation: bm-out var(--d-3) var(--ease-in) forwards; }
.bm-leaving .bm-dialog { animation: bm-wipe-out 300ms var(--ease-in) forwards; }
@keyframes bm-out { to { opacity: 0; } }
@keyframes bm-wipe-out { to { opacity: 0; transform: translateX(24px); } }
.bm-leaving .bm-head, .bm-leaving .bm-body, .bm-leaving .bm-composer { animation: none; }

/* phones and tablets: a bottom sheet over the dimmed site */
@media (max-width: 1023px) {
  .bm-dialog {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-width: none;
    height: 92vh; height: 92svh; border-width: 1px 0 0;
    animation: bm-sheet var(--d-4) var(--ease-out) backwards;
    transition: transform 350ms var(--ease-out);
  }
  .bm-dialog.bm-dragging { transition: none; }
  @keyframes bm-sheet { from { transform: translateY(100%); } }
  .bm-leaving .bm-dialog { animation: bm-sheet-out 300ms var(--ease-in) forwards; }
  @keyframes bm-sheet-out { to { transform: translateY(100%); } }
}

/* the working line: a 30% segment travelling along the top edge */
.bm-runline { position: absolute; top: 0; left: 0; right: 0; height: 1px; overflow: hidden; pointer-events: none; z-index: 2; }
.bm-runline::before {
  content: ""; position: absolute; top: 0; left: 0; width: 30%; height: 1px; background: var(--bm-accent);
  transform: translateX(-100%); opacity: 0;
}
.bm-busy .bm-runline::before { opacity: 1; animation: bm-run 1.4s var(--ease-inout) infinite; }
@keyframes bm-run { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

.bm-grab { display: none; }
@media (max-width: 1023px) {
  .bm-grab {
    display: block; flex: none; width: 36px; height: 4px; margin: 10px auto 0;
    border-radius: var(--r-pill); background: var(--bm-rule-strong); touch-action: none; cursor: grab;
  }
  .bm-head { touch-action: none; }
}

/* ── header: mono meta ── */
.bm-head {
  flex: none; display: flex; align-items: center; gap: var(--s-4);
  min-height: 56px; padding: 0 var(--s-3) 0 var(--bm-pad);
  border-bottom: 1px solid var(--bm-rule);
}
.bm-title, .bm-head-meta, .bm-state, .bm-icon-text, .bm-chip, .bm-fe-count, .bm-rev-top, .bm-label, .bm-keys,
.bm-steps, .bm-notes summary, .bm-h3, .bm-starter, .bm-pill, .bm-foot {
  font-family: var(--bm-font-mono); font-size: var(--t-meta); font-weight: 400; line-height: 1.3;
  letter-spacing: .06em; text-transform: uppercase; font-variant-numeric: tabular-nums;
}
.bm-title { margin: 0; color: var(--bm-fg); white-space: nowrap; }
.bm-head-meta { flex: 1; min-width: 0; color: var(--bm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-state { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--bm-muted); white-space: nowrap; }
.bm-state::before { content: ""; width: 6px; height: 6px; border-radius: var(--r-pill); border: 1px solid var(--bm-muted); }
.bm-busy .bm-state { color: var(--bm-fg); }
.bm-busy .bm-state::before { border-color: var(--bm-accent); background: var(--bm-accent); animation: bm-blink 1.2s steps(2, jump-none) infinite; }
@keyframes bm-blink { 50% { opacity: .35; } }
.bm-icon {
  display: inline-flex; align-items: center; gap: var(--s-2); min-height: 40px; padding: 0 var(--s-3);
  border: 0; background: none; color: var(--bm-muted); cursor: pointer;
  transition: color var(--d-2) var(--ease-quint);
}
.bm-icon:hover { color: var(--bm-fg); }
@media (max-width: 599px) {
  .bm-head { gap: var(--s-3); }
  .bm-head-meta { display: none; }
  .bm-state { margin-left: auto; }
  .bm-icon .bm-icon-text { display: none; }
  .bm-icon { padding: 0 var(--s-2); min-width: 40px; justify-content: center; }
  .bm-head { padding-right: var(--s-2); }
}

/* ── body: scrolls; the transcript of what you've made ── */
.bm-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: var(--s-6) var(--bm-pad) var(--s-6);
  display: flex; flex-direction: column; gap: var(--s-6);
  scrollbar-width: thin; scrollbar-color: var(--bm-rule-strong) transparent;
}
.bm-body > * { margin: 0; }

/* under the prompt: ideas to start from, and one quiet line on how it works */
.bm-intro { display: grid; gap: var(--s-4); margin-top: calc(var(--s-2) * -1); }
.bm-desc { margin: 0; color: var(--bm-muted); max-width: 46ch; text-wrap: pretty; font-size: var(--t-ui); }
.bm-intro:not(.bm-intro-empty) .bm-desc { display: none; }
.bm-starters { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.bm-starter {
  padding: 7px 9px 6px; border: 1px solid var(--bm-rule-strong); border-radius: var(--r-1);
  background: none; color: var(--bm-fg); cursor: pointer; text-align: left;
  transition: background-color var(--d-2) var(--ease-quint), color var(--d-2) var(--ease-quint);
}
.bm-starter:hover { background: var(--bm-fg); color: var(--bm-bg); }

.bm-notice, .bm-live {
  margin: 0; padding: var(--s-3) 0 var(--s-3) var(--s-4);
  border-left: 1px solid var(--bm-rule-strong); color: var(--bm-fg);
}
.bm-notice { border-left-color: var(--bm-accent); }
.bm-live { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); }
.bm-live-text { flex: 1 1 14rem; color: var(--bm-fg); text-wrap: pretty; }
.bm-live-text::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 .7em .1em 0;
  border-radius: var(--r-pill); background: var(--bm-accent);
}

/* ── buttons ── */
.bm-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px;
  padding: 0 var(--s-4); margin: 0; font: 500 var(--t-ui)/1.2 var(--font-text); font-stretch: 90%;
  color: var(--bm-fg); background: none; border: 1px solid var(--bm-rule-strong); border-radius: var(--r-1);
  cursor: pointer; transition: background-color var(--d-1) var(--ease-quint), color var(--d-1) var(--ease-quint), border-color var(--d-1) var(--ease-quint), transform var(--d-1) var(--ease-quint);
}
.bm-btn:active:not(:disabled) { transform: scale(.97); }
.bm-btn-primary { color: var(--bm-accent-fg); background: var(--bm-accent); border-color: var(--bm-accent); padding: 0 var(--s-5); }
.bm-btn-primary:hover:not(:disabled) { background: color-mix(in oklab, var(--bm-accent) 88%, var(--bm-fg)); }
.bm-btn-primary:disabled { color: var(--bm-muted); background: none; border-color: var(--bm-rule-strong); }
.bm-btn-outline:hover:not(:disabled) { border-color: var(--bm-fg); }
.bm-btn-text, .bm-btn-quiet {
  border-color: transparent; padding: 0 var(--s-1);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .25em; text-decoration-color: var(--bm-rule-strong);
}
.bm-btn-text:hover:not(:disabled), .bm-btn-quiet:hover:not(:disabled) { text-decoration-color: var(--bm-fg); }
.bm-btn:disabled { cursor: default; color: var(--bm-muted); }
.bm-link {
  padding: 0; border: 0; background: none; font: inherit; color: var(--bm-fg); cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; text-decoration-color: var(--bm-rule-strong);
}
.bm-root :focus-visible, .bm-pill:focus-visible { outline: 2px solid var(--bm-accent); outline-offset: 2px; }

/* ── progress: the status line and a mono log ── */
.bm-progress { display: grid; gap: var(--s-3); }
.bm-progress > * { margin: 0; }
.bm-status { font-size: var(--t-body); color: var(--bm-fg); text-wrap: pretty; }
.bm-status.bm-error { padding-left: var(--s-4); border-left: 1px solid var(--bm-accent); }
.bm-steps {
  list-style: none; margin: 0; padding: var(--s-1) 0 var(--s-1) var(--s-4);
  border-left: 1px solid var(--bm-rule-strong); color: var(--bm-muted);
  display: grid; gap: var(--s-1); max-height: 9.5em; overflow-y: auto;
}
.bm-steps:empty { display: none; }
.bm-step { display: flex; gap: 1.2em; animation: bm-type var(--d-2) var(--ease-out) backwards; }
@keyframes bm-type { from { opacity: 0; transform: translateX(8px); } }
.bm-step-verb { flex: none; min-width: 5.5em; color: var(--bm-fg); }
.bm-step-what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; letter-spacing: .02em; }
.bm-busy .bm-step:last-child::after {
  content: ""; flex: none; align-self: center; width: .55em; height: 1em; margin-left: -.6em; background: var(--bm-accent);
  animation: bm-blink 1s steps(2, jump-none) infinite;
}
.bm-notes summary { cursor: pointer; color: var(--bm-muted); list-style: none; }
.bm-notes summary::-webkit-details-marker { display: none; }
.bm-notes summary::before { content: "+ "; }
.bm-notes[open] summary::before { content: "\2013  "; }
.bm-thinking, .bm-text { margin-top: var(--s-2); white-space: pre-wrap; color: var(--bm-muted); max-height: 10rem; overflow-y: auto; }
.bm-thinking:empty, .bm-text:empty { display: none; }

/* ── your creations: below the fold, folded behind its title; each a title, then its versions as a numbered log ── */
.bm-mine { display: grid; gap: var(--s-4); margin-top: auto; padding-top: var(--s-4); border-top: 1px solid var(--bm-rule); }
.bm-mine-sum {
  display: flex; align-items: center; gap: var(--s-3); min-height: 44px; cursor: pointer; list-style: none;
  color: var(--bm-muted); transition: color var(--d-2) var(--ease-quint);
}
.bm-mine-sum::-webkit-details-marker { display: none; }
.bm-mine-sum::after { /* a chevron that turns when it opens */
  content: ""; margin-left: auto; width: 7px; height: 7px; border: solid currentColor; border-width: 0 1.5px 1.5px 0;
  transform: translateY(-2px) rotate(45deg); transition: transform var(--d-2) var(--ease-quint);
}
.bm-mine[open] > .bm-mine-sum::after { transform: translateY(2px) rotate(-135deg); }
.bm-mine-sum:hover, .bm-mine[open] > .bm-mine-sum { color: var(--bm-fg); }
.bm-mine-count { color: var(--bm-faint); font-family: var(--bm-font-mono); font-size: var(--t-meta); letter-spacing: .06em; }
.bm-h3 { margin: 0; color: inherit; }
.bm-empty { margin: 0; color: var(--bm-muted); max-width: 46ch; }
.bm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-7); }
.bm-fe { display: grid; gap: var(--s-3); }
.bm-fe-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-2) var(--s-4);
  padding-bottom: var(--s-3); border-bottom: 1px solid var(--bm-rule-strong);
}
.bm-fe-title {
  flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere;
  font-family: var(--bm-font-display); font-weight: 560; font-stretch: 92%; font-size: calc(var(--t-title) * .72);
  line-height: 1.08; letter-spacing: -.02em;
}
.bm-fe-count { color: var(--bm-muted); }
.bm-chip { display: inline-block; color: var(--bm-muted); white-space: nowrap; }
.bm-chip::before { content: "[ "; }
.bm-chip::after { content: " ]"; }
.bm-chip-pending, .bm-chip-approved { color: var(--bm-fg); }
.bm-chip-rejected { color: var(--bm-muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.bm-fe-note, .bm-hint { margin: 0; color: var(--bm-muted); font-size: var(--t-ui); }
.bm-working { color: var(--bm-fg); }
.bm-working::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 .6em .1em 0;
  border-radius: var(--r-pill); background: var(--bm-accent); animation: bm-blink 1.2s steps(2, jump-none) infinite;
}

.bm-revs { list-style: none; margin: 0; padding: 0; }
.bm-rev-item + .bm-rev-item { border-top: 1px solid var(--bm-rule); }
.bm-rev {
  position: relative; display: grid; gap: var(--s-2); width: 100%;
  padding: var(--s-4) 0 var(--s-4) var(--s-5); margin: 0;
  text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: none; border: 0; border-radius: 0;
}
.bm-rev-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-1) var(--s-3); color: var(--bm-muted); }
.bm-rev-mark {
  position: absolute; left: 2px; top: calc(var(--s-4) + .35em); width: 6px; height: 6px;
  border-radius: var(--r-pill); border: 1px solid var(--bm-rule-strong);
}
.bm-rev-n { color: var(--bm-fg); }
.bm-rev-state { margin-left: auto; color: var(--bm-muted); transition: color var(--d-2) var(--ease-quint); }
.bm-rev-prompt {
  font-family: var(--bm-font-display); font-weight: 450; font-size: calc(var(--t-lede) * .66);
  line-height: 1.3; letter-spacing: -.005em;
  color: var(--bm-muted); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  transition: color var(--d-2) var(--ease-quint);
}
.bm-rev:hover .bm-rev-prompt, .bm-rev:hover .bm-rev-state { color: var(--bm-fg); }
.bm-rev[aria-pressed="true"] .bm-rev-mark { border-color: var(--bm-accent); background: var(--bm-accent); }
.bm-rev[aria-pressed="true"] .bm-rev-prompt { color: var(--bm-fg); }
.bm-rev[aria-pressed="true"] .bm-rev-state { color: var(--bm-fg); }
.bm-rev .bm-chip { justify-self: start; }
.bm-fe-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); padding-top: var(--s-2); }

.bm-foot { margin: 0; padding-top: var(--s-2); color: var(--bm-muted); text-transform: none; letter-spacing: .02em; }

/* ── the prompt: first and largest; the reason the dialog exists ── */
.bm-composer-off { display: none; }
.bm-form { display: grid; gap: var(--s-4); }
.bm-label {
  font-family: var(--bm-font-display); font-weight: 580; font-stretch: 90%; text-transform: none; letter-spacing: -.025em;
  font-size: calc(var(--t-lede) * 1.05); line-height: 1.12; text-wrap: balance;
  color: var(--bm-fg);
}
.bm-input {
  display: block; width: 100%; min-height: 5.4em; max-height: 40vh; resize: none; field-sizing: content;
  margin: 0; padding: var(--s-4); border: 1px solid var(--bm-rule-strong); border-radius: var(--r-1); background: var(--bm-field); color: var(--bm-fg);
  font-family: var(--bm-font-display); font-weight: 420; font-size: calc(var(--t-lede) * .8);
  line-height: 1.3; letter-spacing: -.008em;
  caret-color: var(--bm-accent);
  transition: border-color var(--d-2) var(--ease-quint);
}
.bm-input:focus { border-color: var(--bm-fg); }
.bm-form-change .bm-label { font-size: calc(var(--t-lede) * .78); }
.bm-input::placeholder { color: var(--bm-faint); opacity: 1; }
.bm-root .bm-input:focus-visible { outline: none; }
.bm-input:disabled { color: var(--bm-muted); }
.bm-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.bm-row .bm-build { min-height: 48px; padding-inline: var(--s-6); }
.bm-keys { flex: 1 1 auto; margin: 0; color: var(--bm-muted); }
.bm-hint:empty { display: none; }
@media (hover: none), (pointer: coarse) { .bm-keys { display: none; } }
@media (max-width: 599px) {
  .bm-body { padding-top: var(--s-5); gap: var(--s-5); }
  .bm-form { gap: var(--s-3); }
  .bm-label { font-size: 1.6rem; }
  .bm-input { font-size: 1.25rem; min-height: 4.6em; }
  .bm-hint { font-size: var(--t-meta); }
  .bm-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
  .bm-keys { grid-column: 1 / -1; }
  .bm-row .bm-btn { width: 100%; min-height: 48px; }
  .bm-row .bm-build:only-child, .bm-row .bm-new[hidden] + .bm-build { grid-column: 1 / -1; }
  .bm-row .bm-new { border-color: var(--bm-rule-strong); text-decoration: none; }
}

/* ── minimized while it builds: takes the corner button's place ── */
.bm-pill {
  position: fixed; z-index: var(--bm-z);
  right: max(min(var(--m), 32px), env(safe-area-inset-right)); bottom: max(min(var(--m), 32px), env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: var(--s-3); height: 44px; max-width: calc(100vw - 2 * var(--m));
  padding: 0 18px 0 14px; border: 1px solid var(--rule-strong); border-radius: var(--r-pill); cursor: pointer;
  color: var(--fg); background: var(--bg-raised);
  animation: bm-rise var(--d-3) var(--ease-out) backwards;
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .bm-pill {
    background: color-mix(in oklab, var(--bg) 72%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  }
}
.bm-pill-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-pill-dot { width: 8px; height: 8px; flex: none; border-radius: var(--r-pill); background: var(--accent); animation: bm-blink 1.2s steps(2, jump-none) infinite; }
.bm-pill-done .bm-pill-dot { animation: none; }

@media (prefers-reduced-motion: reduce) {
  html.bm-open #frontend { transform: none; }
  .bm-dialog, .bm-backdrop, .bm-head, .bm-body, .bm-composer, .bm-step { animation: none; }
  .bm-busy .bm-runline::before { animation: none; width: 100%; transform: none; }
  .bm-pill-dot, .bm-busy .bm-state::before, .bm-working::before, .bm-busy .bm-step:last-child::after { animation: none; }
}

/* attached images (attach.js): an "Image" button and thumbnails, left of the keys */
.bm-attach { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.bm-attach .attach-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 var(--s-3);
  border: 1px solid var(--bm-rule-strong); border-radius: 999px; background: none; color: var(--bm-fg);
  font: inherit; cursor: pointer;
}
.bm-attach .attach-btn:hover:not(:disabled) { border-color: var(--bm-fg); }
.bm-attach .attach-btn:disabled { opacity: .45; cursor: default; }
.bm-attach .attach-btn:focus-visible { outline: 2px solid var(--bm-accent); outline-offset: 2px; }
.attach-thumbs { display: flex; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.attach-thumbs li { position: relative; }
.attach-thumbs img { display: block; width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--bm-rule-strong, var(--rule-strong)); }
.attach-remove {
  position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%;
  background: var(--bm-fg, var(--fg)); color: var(--bm-bg, var(--bg)); font: 600 13px/20px var(--font-text); cursor: pointer;
}
.bm-input.attach-over { border-color: var(--bm-accent); border-style: dashed; }
@media (max-width: 599px) { .bm-row .bm-attach { grid-column: 1 / -1; } }

/* "Credit me as": how the visitor is credited in the site bar if Ben approves */
.bm-credit { display: grid; gap: var(--s-1); padding-top: var(--s-3); }
.bm-credit-label { color: var(--bm-muted); font-family: var(--bm-font-mono); font-size: var(--t-meta); letter-spacing: .06em; text-transform: uppercase; }
.bm-credit-input {
  width: 100%; min-height: 40px; padding: 0 var(--s-3); border: 1px solid var(--bm-rule-strong); border-radius: 6px;
  background: transparent; color: var(--bm-fg); font: inherit;
}
.bm-credit-input::placeholder { color: var(--bm-faint); }
.bm-credit-input:focus { outline: none; border-color: var(--bm-fg); }

/* a creation's versions: folded away by default */
.bm-versions { margin-top: var(--s-2); }
.bm-versions-sum {
  display: inline-flex; align-items: center; gap: var(--s-2); min-height: 36px; cursor: pointer; list-style: none;
  color: var(--bm-muted); font-family: var(--bm-font-mono); font-size: var(--t-meta); letter-spacing: .06em; text-transform: uppercase;
  transition: color var(--d-2) var(--ease-quint);
}
.bm-versions-sum::-webkit-details-marker { display: none; }
.bm-versions-sum::after {
  content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0;
  transform: translateY(-2px) rotate(45deg); transition: transform var(--d-2) var(--ease-quint);
}
.bm-versions[open] > .bm-versions-sum::after { transform: translateY(1px) rotate(-135deg); }
.bm-versions-sum:hover, .bm-versions[open] > .bm-versions-sum { color: var(--bm-fg); }
.bm-versions-sum:focus-visible { outline: 2px solid var(--bm-accent); outline-offset: 2px; }

/* ── a build in progress (v1.11): the sheet turns into animated diagonal
   stripes, the prompt being built sits on a solid card with a clear Cancel,
   and the prompt box waits (the site bar stripes too: site.css) ── */
@keyframes bm-stripes { to { background-position: 50.91px 0; } }
html.bm-generating .bm-dialog {
  --bm-stripe: var(--bm-accent); /* the accent alternating with the theme colour */
  background-color: var(--bm-bg);
  background-image: repeating-linear-gradient(-45deg, var(--bm-bg) 0 18px, var(--bm-stripe) 18px 36px);
  background-size: 50.91px 50.91px; /* one stripe period along the diagonal */
  animation: bm-stripes 1.4s linear infinite;
}
html.bm-generating .bm-head { background: color-mix(in oklab, var(--bm-bg) 92%, transparent); }
/* text on the stripes sits on a wash of the theme colour */
html.bm-generating .bm-composer, html.bm-generating .bm-notice, html.bm-generating .bm-live,
html.bm-generating .bm-progress, html.bm-generating .bm-mine, html.bm-generating .bm-intro {
  background: color-mix(in oklab, var(--bm-bg) 90%, transparent); border-radius: var(--r-1);
  padding: var(--s-3); margin-inline: calc(var(--s-3) * -1);
}
.bm-gen {
  display: grid; gap: var(--s-3); padding: var(--s-5); margin-bottom: var(--s-2);
  background: var(--bm-field); color: var(--bm-fg);
  border: 1px solid var(--bm-rule-strong); border-radius: var(--r-1);
  box-shadow: 0 18px 40px -28px rgb(0 0 0 / .45);
}
.bm-gen-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.bm-gen-label {
  margin: 0; display: inline-flex; align-items: center; gap: .6em;
  font-family: var(--bm-font-mono); font-size: var(--t-meta); letter-spacing: .08em; text-transform: uppercase; color: var(--bm-fg);
}
.bm-gen-label::before {
  content: ""; width: 8px; height: 8px; border-radius: var(--r-pill); background: var(--bm-accent);
  animation: bm-blink 1.2s steps(2, jump-none) infinite;
}
/* the countdown (v1.13): a naive 15:00, then "any minute now" */
.bm-gen-clock { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2em .6em; }
.bm-gen-time {
  font-family: var(--bm-font-mono); font-size: calc(var(--t-lede) * 1.6); font-weight: 500; line-height: 1;
  letter-spacing: -.02em; color: var(--bm-fg); font-variant-numeric: tabular-nums;
}
.bm-gen-clock-note { color: var(--bm-muted); font-size: var(--t-ui); }
.bm-gen-clock.bm-over .bm-gen-time { font-family: var(--bm-font-display); font-size: calc(var(--t-lede) * 1.1); font-weight: 600; letter-spacing: -.01em; }
/* "email me when it's ready" (v1.13) */
.bm-gen-notify {
  display: grid; gap: var(--s-2); padding: var(--s-4); margin: 0;
  background: color-mix(in oklab, var(--bm-accent) 9%, var(--bm-field));
  border: 1px solid color-mix(in oklab, var(--bm-accent) 35%, transparent); border-radius: var(--r-1);
}
.bm-gen-notify[hidden], .bm-gen-notify [hidden] { display: none; }
.bm-gen-notify-lead { margin: 0; font-weight: 600; color: var(--bm-fg); }
.bm-gen-notify-row { display: flex; gap: var(--s-2); }
.bm-gen-notify-input {
  flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 var(--s-3);
  font: inherit; color: var(--bm-fg); background: var(--bm-bg);
  border: 1px solid var(--bm-rule-strong); border-radius: var(--r-1);
}
.bm-gen-notify-input:focus-visible { outline: 2px solid var(--bm-accent); outline-offset: 1px; }
.bm-gen-notify-send { flex: none; min-height: 44px; }
.bm-gen-notify-fine { margin: 0; color: var(--bm-muted); font-size: var(--t-meta); }
.bm-gen-notify-err { margin: 0; color: #B42318; font-size: var(--t-ui); }
.bm-gen-notify-done { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-2) var(--s-4); }
.bm-gen-notify-done-text { margin: 0; flex: 1 1 100%; font-weight: 600; color: var(--bm-fg); }
.bm-gen-prompt {
  margin: 0; font-family: var(--bm-font-display); font-weight: 520; font-stretch: 94%;
  font-size: calc(var(--t-lede) * .9); line-height: 1.25; letter-spacing: -.015em; overflow-wrap: anywhere;
  max-height: 9.5em; overflow: auto;
}
.bm-gen-note { margin: 0; color: var(--bm-muted); font-size: var(--t-ui); }
.bm-cancel {
  justify-self: start; gap: .5em; min-height: 44px; padding: 0 var(--s-5);
  color: #B42318; border-color: color-mix(in oklab, #B42318 55%, transparent); font-weight: 600;
}
.bm-cancel:hover:not(:disabled) { color: #FFFFFF; background: #B42318; border-color: #B42318; }
.bm-cancel:focus-visible { outline: 2px solid #B42318; outline-offset: 2px; }
.bm-cancel:disabled { opacity: .6; cursor: progress; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bm-cancel { color: #FF8A80; border-color: color-mix(in oklab, #FF8A80 55%, transparent); }
}
:root[data-theme="dark"] .bm-cancel { color: #FF8A80; border-color: color-mix(in oklab, #FF8A80 55%, transparent); }
/* the waiting prompt box reads as paused, not broken */
html.bm-generating .bm-composer { background: var(--bm-bg); }
html.bm-generating .bm-form > * { opacity: .55; }
html.bm-generating .bm-pill {
  background-image: repeating-linear-gradient(-45deg, var(--bg-raised) 0 8px, var(--accent) 8px 16px);
  background-size: 22.63px 22.63px; animation: bm-rise var(--d-3) var(--ease-out) backwards, bm-stripes-sm 1s linear infinite;
}
@keyframes bm-stripes-sm { to { background-position: 22.63px 0; } }
@media (prefers-reduced-motion: reduce) {
  html.bm-generating .bm-dialog, html.bm-generating .bm-pill { animation: none; }
}

/* what the prompt applies to (v1.11): a two-way switch above the prompt */
.bm-target {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 0;
  border: 1px solid var(--bm-rule-strong); border-radius: var(--r-1); overflow: hidden;
}
.bm-target-opt {
  display: grid; gap: 2px; align-content: center; min-height: 54px; min-width: 0; margin: 0; padding: 8px var(--s-4);
  text-align: left; font: inherit; color: var(--bm-muted); background: var(--bm-field); border: 0; cursor: pointer;
  transition: background-color var(--d-2) var(--ease-quint), color var(--d-2) var(--ease-quint);
}
.bm-target-opt + .bm-target-opt { border-left: 1px solid var(--bm-rule-strong); }
.bm-target-kicker { font-family: var(--bm-font-mono); font-size: var(--t-meta); letter-spacing: .08em; text-transform: uppercase; }
.bm-target-name {
  font-family: var(--bm-font-display); font-weight: 560; font-stretch: 94%; font-size: var(--t-ui); letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bm-target-opt[aria-checked="true"] { background: var(--bm-fg); color: var(--bm-bg); }
.bm-target-opt[aria-checked="true"] .bm-target-kicker::before { content: "\25CF  "; color: var(--bm-accent); }
.bm-target-opt:hover:not(:disabled):not([aria-checked="true"]) { color: var(--bm-fg); background: color-mix(in oklab, var(--bm-fg) 6%, var(--bm-field)); }
.bm-target-opt:focus-visible { outline: 2px solid var(--bm-accent); outline-offset: -2px; }
.bm-target-opt:disabled { cursor: default; }
/* a new site reads as a fresh start: the box takes the accent edge */
.bm-form-new .bm-input { border-style: dashed; }

/* Copy, wherever a prompt is (the full text) */
.bm-copy {
  display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 0 8px; margin: 0;
  font-family: var(--bm-font-mono); font-size: var(--t-meta); letter-spacing: .06em; text-transform: uppercase;
  color: var(--bm-muted); background: none; border: 1px solid var(--bm-rule); border-radius: var(--r-pill); cursor: pointer;
  transition: color var(--d-2) var(--ease-quint), border-color var(--d-2) var(--ease-quint);
}
.bm-copy:hover, .bm-copy:focus-visible { color: var(--bm-fg); border-color: var(--bm-rule-strong); }
.bm-copy:focus-visible { outline: 2px solid var(--bm-accent); outline-offset: 2px; }
.bm-copy.bm-copied { color: var(--bm-accent); border-color: var(--bm-accent); }
.bm-gen-head .bm-copy { margin-left: auto; }
.bm-gen-head { align-items: center; }
.bm-rev-item { position: relative; }
.bm-rev-item > .bm-copy { margin: 0 0 var(--s-3) var(--s-5); }

/* ── building paused for the budget (v1.12; build-modal.js): the prompt box
   gives way to a calm note of when the studio reopens, what still works, and
   an idea kept in this browser. No alarm colours: a hollow dot, the Studio's
   own type, and the accent only where something can be done ── */
.bm-paused { display: grid; gap: var(--s-4); }
.bm-paused > * { margin: 0; }
.bm-paused-kicker {
  display: inline-flex; align-items: center; gap: .6em; margin: 0;
  font-family: var(--bm-font-mono); font-size: var(--t-meta); line-height: 1.3; letter-spacing: .08em;
  text-transform: uppercase; color: var(--bm-muted);
}
.bm-paused > .bm-paused-kicker:first-child::before {
  content: ""; flex: none; width: 8px; height: 8px; border-radius: var(--r-pill); border: 1.5px solid var(--bm-muted);
}
.bm-paused-h {
  font-family: var(--bm-font-display); font-weight: 580; font-stretch: 90%; letter-spacing: -.025em;
  font-size: calc(var(--t-lede) * 1.05); line-height: 1.12; text-wrap: balance; color: var(--bm-fg);
}
.bm-paused-h:focus { outline: none; }
.bm-paused-h:focus-visible { outline: 2px solid var(--bm-accent); outline-offset: 4px; }
.bm-paused-text { color: var(--bm-muted); max-width: 46ch; text-wrap: pretty; font-size: var(--t-ui); }
.bm-paused-mean { margin-top: var(--s-3); }
.bm-paused-list { list-style: none; padding: 0; border-top: 1px solid var(--bm-rule); }
.bm-paused-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4);
  padding: var(--s-3) 0; border-bottom: 1px solid var(--bm-rule);
}
.bm-paused-what { flex: 1 1 14rem; color: var(--bm-fg); text-wrap: pretty; }
.bm-paused-row .bm-btn { flex: none; }
.bm-idea { display: grid; gap: var(--s-3); margin-top: var(--s-3); }
.bm-idea-form { display: grid; gap: var(--s-3); }
.bm-idea-label { font-size: calc(var(--t-lede) * .78); }
/* an idea, not yet a build: the box is dashed, like a new site's */
.bm-idea .bm-input { border-style: dashed; min-height: 4.4em; }
.bm-idea .bm-row { justify-content: flex-end; }
.bm-idea-kept {
  display: grid; gap: var(--s-2); padding: var(--s-4);
  background: var(--bm-field); border: 1px dashed var(--bm-rule-strong); border-radius: var(--r-1);
}
.bm-idea-kept > * { margin: 0; }
.bm-idea-quote {
  font-family: var(--bm-font-display); font-weight: 450; font-size: calc(var(--t-lede) * .7);
  line-height: 1.3; letter-spacing: -.005em; color: var(--bm-fg); overflow-wrap: anywhere;
  max-height: 9.5em; overflow: auto; white-space: pre-wrap;
}
.bm-idea-kept .bm-fe-actions { padding-top: 0; }
.bm-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
@media (max-width: 599px) {
  .bm-paused-h { font-size: 1.6rem; }
  .bm-paused-row .bm-btn { width: 100%; }
  .bm-idea .bm-row { display: grid; grid-template-columns: 1fr; }
  .bm-idea .bm-row .bm-btn { width: 100%; min-height: 48px; }
}

/* an email's link asks before moving a build here (v1.13) */
.bm-claim {
  display: grid; gap: var(--s-4); padding: var(--s-5); margin-bottom: var(--s-2);
  background: var(--bm-field); border: 1px solid var(--bm-rule-strong); border-radius: var(--r-1);
}
.bm-claim[hidden] { display: none; }
.bm-claim > * { margin: 0; }
.bm-claim-row { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.bm-claim-row .bm-btn { min-height: 44px; }
html.bm-claiming .bm-composer, html.bm-claiming .bm-intro, html.bm-claiming .bm-progress,
html.bm-claiming .bm-mine, html.bm-claiming .bm-paused, html.bm-claiming .bm-live { display: none; }
.bm-claim .bm-paused-h:focus-visible { outline: none; } /* focused so it is read first, not as a control */
