/* The editor for builder projects (builder-editor.mjs). It lives in the
   editor shell from styles.css; body.builder-mode hides what only the earlier
   Agent used (branches, pages, Visual Edit, the Time Machine). The chat and
   the preview render into their own elements (#builderThread in the chat
   thread, #builderCanvas next to #appCanvas). */

body.builder-mode #branchSelect, body.builder-mode #newBranchBtn, body.builder-mode #manageBranchesBtn,
body.builder-mode #versionHistoryBtn, body.builder-mode #pageSelect,
body.builder-mode .editor-mode-tabs [data-editor-mode="edit"], body.builder-mode .editor-inspector,
body.builder-mode #editorCategory, body.builder-mode #editorWorkMode, body.builder-mode #editorAttachBtn,
body.builder-mode #editorCategoryHint, body.builder-mode .editor-intelligence-tools,
body.builder-mode .editor-panel-tabs [data-editor-panel="changes"],
body.builder-mode #historyDrawer, body.builder-mode #buildProgress, body.builder-mode #appCanvas,
body.builder-mode #editorChatThread > :not(.builder-thread) { display: none !important; }
body.builder-mode .editor-workspace {
  --builder-chat-width: 480px;
  grid-template-columns: minmax(380px, var(--builder-chat-width)) 1px minmax(0, 1fr);
}
body.builder-mode.editor-chat-collapsed .editor-workspace { grid-template-columns: 0 0 minmax(0,1fr); }

.builder-agent-header,
.editor-chat-resizer { display: none; }
body.builder-mode .builder-agent-header {
  min-height: 64px;
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--bh-border-soft, rgba(255,255,255,.07));
  background: rgba(17,15,20,.94);
}
.builder-agent-core {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(240,68,145,.24);
  border-radius: 11px;
  background: rgba(240,68,145,.07);
}
.builder-agent-core::before {
  content: "♥";
  color: var(--bh-action, #f04491);
  font-size: 15px;
  filter: drop-shadow(0 0 8px rgba(240,68,145,.26));
}
.builder-agent-core i {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255,111,174,.72);
}
.builder-agent-core i:nth-child(1) { top: 6px; right: 7px; }
.builder-agent-core i:nth-child(2) { right: 5px; bottom: 8px; opacity: .55; }
.builder-agent-core i:nth-child(3) { left: 6px; bottom: 7px; opacity: .38; }
.builder-agent-identity { min-width: 0; display: grid; gap: 2px; }
.builder-agent-identity strong { color: var(--bh-text, #f7f4fa); font-size: 13.5px; letter-spacing: -.01em; }
.builder-agent-identity small { color: var(--bh-muted, #aaa4b3); font-size: 11.5px; }
.builder-agent-level {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid rgba(240,68,145,.18);
  border-radius: 999px;
  background: rgba(240,68,145,.055);
  color: #e8bed2;
  font-size: 10.5px;
  font-weight: 720;
  white-space: nowrap;
}
body.builder-agent-working .builder-agent-core::before { animation: builderAgentPulse 1.1s ease-in-out infinite; }
body.builder-agent-working .builder-agent-status { color: #f0a9ca; }
@keyframes builderAgentPulse {
  0%,100% { transform: scale(1); opacity: .82; }
  45% { transform: scale(1.12); opacity: 1; }
}
body.builder-mode .editor-chat-resizer {
  display: block;
  position: relative;
  z-index: 8;
  width: 1px;
  min-width: 1px;
  cursor: col-resize;
  background: var(--bh-border-soft, rgba(255,255,255,.07));
  touch-action: none;
}
.editor-chat-resizer::before {
  content: "";
  position: absolute;
  inset: 0 -5px;
}
.editor-chat-resizer:hover,
.editor-chat-resizer:focus-visible {
  background: rgba(240,68,145,.55);
  outline: none;
  box-shadow: 0 0 0 1px rgba(240,68,145,.22);
}
body.editor-chat-collapsed .editor-chat-resizer { opacity: 0; pointer-events: none; }

.builder-thread, .builder-canvas, .builder-legacy-note { display: none; }
body.builder-mode .builder-thread { display: grid; align-content: start; gap: 10px; min-width: 0; }
body.builder-mode .builder-canvas { display: block; }
body.builder-mode.editor-code-open .builder-canvas, body.builder-mode.editor-secrets-open .builder-canvas { display: none !important; }

.builder-empty { display: grid; gap: 6px; padding: 16px; border: 1px dashed var(--border-soft); border-radius: 12px; color: #9a9a94; font-size: 12.5px; line-height: 1.5; }
.builder-empty strong { color: #f4f4ef; font-size: 14px; }

/* M2 — conversation hierarchy: customer intent is compact; Agent output reads like work. */
.builder-message { min-width: 0; display: grid; gap: 8px; }
.builder-message-assistant {
  width: 100%;
  padding: 3px 2px 16px;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,.055);
  border-radius: 0;
  background: transparent;
}
.builder-message-user {
  justify-self: end;
  width: fit-content;
  max-width: min(86%, 620px);
  padding: 9px 11px;
  border: 1px solid rgba(240,68,145,.23);
  border-radius: 13px 13px 4px 13px;
  background: rgba(240,68,145,.075);
  box-shadow: inset 0 1px rgba(255,255,255,.025);
}
html[dir="rtl"] .builder-message-user { border-radius: 13px 13px 13px 4px; }
.builder-message-head {
  min-height: 24px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--bh-muted, #aaa4b3);
}
.builder-message-head strong {
  color: #e8e4ec;
  font-size: 11.5px;
  font-weight: 720;
  letter-spacing: .01em;
}
.builder-message-agent-mark {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(240,68,145,.2);
  border-radius: 7px;
  background: rgba(240,68,145,.055);
  color: var(--bh-action, #f04491);
  font-size: 10px;
}
.builder-message-text { margin: 0; color: #f2eef4; font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.builder-message.builder-working {
  padding: 12px;
  border: 1px solid rgba(255,255,255,.085);
  border-radius: 14px;
  background: rgba(24,20,26,.78);
}

.builder-md { display: grid; gap: 8px; color: #d7d2dc; font-size: 13.25px; line-height: 1.62; overflow-wrap: anywhere; }
.builder-md p, .builder-md ul, .builder-md ol { margin: 0; }
.builder-md ul, .builder-md ol { padding-left: 18px; display: grid; gap: 3px; }
.builder-md code { padding: 2px 5px; border-radius: 5px; background: rgba(255,255,255,.055); color: #efbfd5; font-size: 12px; }
.builder-md pre { margin: 2px 0; padding: 11px 12px; overflow-x: auto; border: 1px solid rgba(255,255,255,.065); border-radius: 10px; background: rgba(7,6,9,.62); }
.builder-md pre code { padding: 0; background: none; color: #d7d2dc; white-space: pre; }
.builder-md-heading { color: #f4f4ef; font-weight: 700; }

/* M3 — live Agent work reads as progress, not as a spinner log. */
.builder-status { display: flex; align-items: center; gap: 8px; margin: 0; color: #c9c9c3; font-size: 12.5px; }
.builder-work-head {
  display: grid;
  grid-template-columns: 24px minmax(0,1fr) auto;
  gap: 9px;
  align-items: center;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(255,255,255,.065);
}
.builder-work-signal {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(240,68,145,.2);
  border-radius: 8px;
  background: rgba(240,68,145,.06);
}
.builder-work-copy { min-width: 0; display: grid; gap: 2px; }
.builder-work-copy strong {
  min-width: 0;
  overflow: hidden;
  color: #f0eaf2;
  font-size: 12.5px;
  font-weight: 710;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.builder-work-progress {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #85808b;
  font-size: 10.5px;
}
.builder-work-progress b {
  color: #b8b1bd;
  font-variant-numeric: tabular-nums;
}
.builder-work-steps {
  position: relative;
  gap: 4px;
  padding: 2px 0 0 4px;
}
.builder-work-steps .builder-tool {
  min-height: 30px;
  padding: 4px 6px;
  border-radius: 8px;
}
.builder-work-steps .builder-tool-running {
  background: rgba(240,68,145,.055);
  color: #e8dce3;
}
.builder-work-steps .builder-tool-done {
  color: #96919a;
}
.builder-live-text:not(:empty) {
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.045);
}
.builder-stop-button { margin-left: auto; min-height: 28px; padding: 4px 12px; border: 1px solid rgba(255,255,255,.16); border-radius: 8px; background: rgba(255,255,255,.06); color: #f4f4ef; font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }
.builder-stop-button:hover:not(:disabled) { background: rgba(240,68,145,.16); border-color: rgba(240,68,145,.45); }
.builder-stop-button:focus-visible { outline: 2px solid #f04491; outline-offset: 2px; }
.builder-stop-button:disabled { opacity: .6; cursor: default; }
html[dir="rtl"] .builder-stop-button { margin-left: 0; margin-right: auto; }
.builder-spinner { width: 12px; height: 12px; flex: none; border: 2px solid rgba(242,80,116,.25); border-top-color: var(--heart-strong, #f25074); border-radius: 50%; animation: builderSpin .8s linear infinite; }
@keyframes builderSpin { to { transform: rotate(360deg); } }

/* M4 — completed technical work collapses into a quiet, inspectable work log. */
.builder-tools { border-radius: 10px; }
.builder-work-log {
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.018);
  overflow: hidden;
}
.builder-work-log[open] { background: rgba(255,255,255,.025); }
.builder-tools-summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  color: #96909b;
  font-size: 11.5px;
  cursor: pointer;
  list-style: none;
}
.builder-tools-summary::-webkit-details-marker { display: none; }
.builder-tools-summary-main { min-width: 0; flex: 1; display: inline-flex; align-items: center; gap: 7px; }
.builder-tools-summary-icon {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(127,200,155,.07);
  color: #7fc89b;
  font-size: 10px;
}
.builder-tools-chevron { color: #716b77; transition: transform .14s ease; }
.builder-work-log[open] .builder-tools-chevron { transform: rotate(180deg); }
.builder-tool-list { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; }
.builder-tools .builder-tool-list {
  max-height: 240px;
  margin: 0;
  padding: 2px 8px 8px;
  overflow-y: auto;
  border-top: 1px solid rgba(255,255,255,.045);
}
.builder-tool { display: grid; grid-template-columns: 16px auto minmax(0, 1fr) auto; gap: 6px; align-items: center; min-height: 24px; color: #b9b9b3; font-size: 12px; }
.builder-tool-icon { display: grid; place-items: center; width: 16px; height: 16px; color: #6fcf97; font-size: 11px; }
.builder-tool-running .builder-tool-icon { border: 2px solid rgba(242,80,116,.25); border-top-color: var(--heart-strong, #f25074); border-radius: 50%; width: 11px; height: 11px; animation: builderSpin .8s linear infinite; }
.builder-tool-failed .builder-tool-icon, .builder-tool-failed .builder-tool-result { color: #f09a9a; }
.builder-tool .builder-tool-detail { overflow: hidden; color: #8f8f89; font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.builder-tool-result { color: #8f8f89; font-size: 11.5px; }

/* M5 — changed files are real result objects and open the exact file in Code. */
.builder-files-card {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 11px;
  background: rgba(255,255,255,.02);
}
.builder-files-head {
  min-height: 25px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 3px;
}
.builder-files-head strong { color: #c9c3ce; font-size: 11.5px; font-weight: 680; }
.builder-files-mark {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(240,68,145,.06);
  color: #d876a2;
  font-size: 10px;
}
.builder-files-list { display: grid; gap: 3px; }
.builder-file-row {
  min-width: 0;
  min-height: 34px;
  display: grid;
  grid-template-columns: 18px minmax(0,1fr) auto 12px;
  gap: 7px;
  align-items: center;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #bcb6c1;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.builder-file-row:hover {
  border-color: rgba(240,68,145,.18);
  background: rgba(240,68,145,.045);
  color: #f2edf4;
}
.builder-file-row:focus-visible { outline: 2px solid var(--bh-action, #f04491); outline-offset: 1px; }
.builder-file-icon { color: #7f7885; font-size: 10px; }
.builder-file-path {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.builder-file-action { color: #8f8994; font-size: 10.5px; white-space: nowrap; }
.builder-file-arrow { color: #746e79; font-size: 11px; }
html[dir="rtl"] .builder-file-arrow { transform: scaleX(-1); }
.builder-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; color: #7f7f79; font-size: 11.5px; }
.builder-count { margin-left: 4px; padding: 0 6px; border-radius: 999px; background: #333330; color: #d6d6d0; font-size: 11px; }
.builder-hearts { color: #f2a5b8; }
/* M6 — explicit final state separates successful delivery from stopped/error runs. */
.builder-result-banner {
  min-height: 42px;
  display: grid;
  grid-template-columns: 24px minmax(0,1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px;
  background: rgba(255,255,255,.02);
}
.builder-result-icon {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
}
.builder-result-copy { min-width: 0; display: grid; gap: 2px; }
.builder-result-copy strong { color: #e8e4eb; font-size: 11.75px; font-weight: 720; }
.builder-result-complete {
  border-color: rgba(127,200,155,.18);
  background: rgba(127,200,155,.035);
}
.builder-result-complete .builder-result-icon {
  background: rgba(127,200,155,.10);
  color: #8fd0a7;
}
.builder-result-error {
  border-color: rgba(233,127,151,.22);
  background: rgba(233,127,151,.04);
}
.builder-result-error .builder-result-icon {
  background: rgba(233,127,151,.10);
  color: #eb8ca2;
}
.builder-result-stopped {
  border-color: rgba(221,179,106,.18);
  background: rgba(221,179,106,.035);
}
.builder-result-stopped .builder-result-icon {
  background: rgba(221,179,106,.10);
  color: #ddb36a;
}
.builder-result-action {
  min-height: 29px;
  padding: 4px 9px;
  border: 1px solid rgba(127,200,155,.18);
  border-radius: 8px;
  background: rgba(127,200,155,.055);
  color: #abd9bc;
  font: inherit;
  font-size: 10.5px;
  font-weight: 680;
  cursor: pointer;
}
.builder-result-action:hover { border-color: rgba(127,200,155,.34); background: rgba(127,200,155,.09); color: #d7f0df; }
.builder-result-action:focus-visible { outline: 2px solid var(--bh-action, #f04491); outline-offset: 1px; }
.builder-note { margin: 0; color: #d6b278; font-size: 12px; line-height: 1.5; }
.builder-note-error { color: #f09a9a; }
.builder-secrets-request { display: grid; gap: 6px; justify-items: start; padding: 10px 11px; border: 1px solid rgba(214,178,120,.4); border-radius: 12px; background: rgba(214,178,120,.07); color: #d6d6d0; font-size: 12.5px; }
.builder-secrets-request p { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* M7 — questions and intervention states read as decisions, not generic chat bubbles. */
.builder-questions {
  position: relative;
  display: grid;
  gap: 12px;
  margin: 2px 0;
  padding: 13px;
  border: 1px solid rgba(240,68,145,.20);
  border-radius: 13px;
  background: rgba(25,21,28,.80);
  box-shadow: inset 3px 0 0 rgba(240,68,145,.42);
}
html[dir="rtl"] .builder-questions { box-shadow: inset -3px 0 0 rgba(240,68,145,.42); }
.builder-questions-title {
  margin: 0;
  color: #e9bfd3;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.builder-question { display: grid; gap: 7px; min-width: 0; margin: 0; padding: 0; border: 0; }
.builder-question + .builder-question { padding-top: 10px; border-top: 1px solid rgba(255,255,255,.055); }
.builder-question legend { margin-bottom: 4px; padding: 0; color: #f2edf4; font-size: 13px; font-weight: 680; line-height: 1.45; overflow-wrap: anywhere; }
.builder-choice {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 39px;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 9px;
  background: rgba(255,255,255,.025);
  color: #cac4ce;
  font-size: 12.5px;
  line-height: 1.35;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.builder-choice:hover { border-color: rgba(240,68,145,.28); background: rgba(240,68,145,.035); }
.builder-choice:has(input:checked) { border-color: rgba(240,68,145,.52); background: rgba(240,68,145,.09); color: #f5eff5; box-shadow: 0 0 0 2px rgba(240,68,145,.055); }
.builder-choice input { flex: none; margin: 0; accent-color: var(--bh-action, #f04491); }
.builder-question-other, .builder-question-text {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 9px;
  background: rgba(8,7,10,.44);
  color: #f0eaf2;
  font: inherit;
  font-size: 12.5px;
  resize: vertical;
}
.builder-question-other:focus-visible, .builder-question-text:focus-visible, .builder-choice:focus-within { outline: 2px solid var(--bh-action, #f04491); outline-offset: 1px; }
.builder-questions-send { justify-self: start; min-height: 36px; padding: 7px 15px; }
.builder-questions-asked { display: grid; gap: 5px; padding: 8px 0 2px; }
.builder-questions-asked ol { margin: 0; padding-left: 18px; display: grid; gap: 3px; color: #a9a3ae; font-size: 12px; line-height: 1.45; }
html[dir="rtl"] .builder-questions-asked ol { padding-left: 0; padding-right: 18px; }
.builder-note-error {
  padding: 9px 10px;
  border: 1px solid rgba(233,127,151,.20);
  border-radius: 9px;
  background: rgba(233,127,151,.055);
  color: #ef9eb1;
}

/* M7 — Agent tasks live directly under the chat tabs as persistent plan status. */
.builder-todos { display: none; }
body.builder-mode .builder-todos:not([hidden]) {
  display: grid;
  margin: 0;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
  border-radius: 0;
  background: rgba(15,13,18,.54);
  overflow: hidden;
}
.builder-todos-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 39px;
  padding: 6px 12px 5px;
  border: 0;
  background: transparent;
  color: #d6d1da;
  font: inherit;
  font-size: 11.75px;
  text-align: start;
  cursor: pointer;
}
.builder-todos-toggle:hover { background: rgba(255,255,255,.025); }
.builder-todos-toggle:focus-visible { outline: 2px solid var(--bh-action, #f04491); outline-offset: -2px; }
.builder-todos-label { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.builder-todos-count {
  flex: none;
  min-width: 32px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: #a49eaa;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.builder-todos-chevron { flex: none; color: #746e79; font-size: 10px; }
.builder-todos-progress {
  height: 2px;
  display: block;
  overflow: hidden;
  background: rgba(255,255,255,.045);
}
.builder-todos-progress i {
  display: block;
  height: 100%;
  max-width: 100%;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, rgba(240,68,145,.58), rgba(127,200,155,.72));
  transition: width .18s ease;
}
.builder-todo-icon { display: grid; place-items: center; flex: none; width: 14px; height: 14px; font-size: 11px; line-height: 1; }
.builder-todo-done { color: #7fc89b; }
.builder-todo-open { color: #6f6974; }
.builder-todo-active { box-sizing: border-box; width: 12px; height: 12px; border: 2px solid rgba(240,68,145,.24); border-top-color: var(--bh-action, #f04491); border-radius: 50%; animation: builderSpin .8s linear infinite; }
.builder-todo-list {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 7px 12px 10px;
  list-style: none;
  max-height: 190px;
  overflow-y: auto;
  border-top: 1px solid rgba(255,255,255,.035);
}
.builder-todo { display: flex; align-items: center; gap: 8px; min-height: 25px; color: #c6c0ca; font-size: 11.75px; line-height: 1.4; overflow-wrap: anywhere; }
.builder-todo-row-active { color: #eee7ee; }
.builder-todo-row-done { color: #77717c; }
.builder-todo-row-done span:last-child { text-decoration: line-through; text-decoration-color: rgba(255,255,255,.18); }

.builder-preview-frame { background: #fff; }
.builder-preview-status { display: grid; place-content: center; justify-items: center; gap: 10px; min-height: clamp(680px, 72vh, 980px); padding: 24px; background: radial-gradient(ellipse at 50% 40%, #26242a 0%, #16141a 68%); color: #aab4c2; font-size: 13px; line-height: 1.55; text-align: center; }
.editor-stage[data-editor-device="computer"] .builder-preview-status { min-height: 100%; height: 100%; }
.editor-stage[data-editor-device="tablet"] .builder-preview-status { min-height: 900px; }
.editor-stage[data-editor-device="mobile"] .builder-preview-status { min-height: 780px; }
.builder-preview-status strong { color: #eef2f7; font-size: 16px; }
.builder-preview-status span:not(.builder-spinner) { max-width: 380px; }
.builder-preview-status .builder-spinner { width: 22px; height: 22px; border-width: 3px; }
.builder-preview-status button { min-height: 38px; padding: 8px 16px; border: 1px solid rgba(255,255,255,.16); border-radius: 10px; background: rgba(255,255,255,.08); color: #f4f4ef; font: inherit; font-weight: 650; cursor: pointer; }
.builder-preview-status button:hover { background: rgba(240,68,145,.16); border-color: rgba(240,68,145,.45); }
.builder-preview-status button:focus-visible { outline: 2px solid #f04491; outline-offset: 2px; }

body.legacy-project .builder-legacy-note { display: grid; gap: 6px; padding: 12px; border: 1px solid rgba(214,178,120,.4); border-radius: 12px; background: rgba(214,178,120,.07); color: #d6d6d0; font-size: 12.5px; line-height: 1.5; }
.builder-legacy-note strong { color: #f4f4ef; }
.builder-legacy-note p { margin: 0; }

/* M8 — command center composer: prompt first, controls quiet, one primary action. */
body.builder-mode .editor-composer {
  margin: 10px 12px 6px;
  padding: 11px;
  border: 1px solid rgba(255,255,255,.105);
  border-radius: 16px;
  background: rgba(18,15,21,.94);
  box-shadow: 0 14px 36px rgba(0,0,0,.24), inset 0 1px rgba(255,255,255,.025);
}
body.builder-mode .editor-composer:focus-within {
  border-color: rgba(240,68,145,.42);
  box-shadow: 0 0 0 3px rgba(240,68,145,.07), 0 14px 36px rgba(0,0,0,.28);
}
body.builder-mode .editor-composer textarea {
  min-height: 88px;
  max-height: 230px;
  padding: 4px 3px 9px;
  color: #f4eff5;
  font-size: 13.5px;
  line-height: 1.55;
}
body.builder-mode .editor-composer-footer {
  min-height: 43px;
  padding: 6px;
  border: 1px solid rgba(255,255,255,.055);
  border-radius: 11px;
  background: rgba(6,5,8,.32);
}
body.builder-mode .editor-composer-footer > div { gap: 7px; flex-wrap: nowrap; }
body.builder-mode .editor-composer-footer #buildLevel {
  min-width: 138px;
  max-width: 180px;
  min-height: 34px;
  border-color: transparent;
  background: rgba(255,255,255,.035);
}
/* The balance next to the Agent level opens the Heart packs. */
.editor-heart-balance { min-height: 34px; padding: 0 6px; color: #ffd6df; font-size: 12.5px; font-weight: 750; white-space: nowrap; cursor: pointer; }
.editor-heart-balance:hover, .editor-heart-balance:focus-visible { color: #ffffff; }
/* The box with Heart packs when a message or the live preview runs out of Hearts (app.js). */
.out-of-hearts { display: grid; gap: 12px; }
.out-of-hearts-facts { display: flex; flex-wrap: wrap; gap: 8px; }
.out-of-hearts-fact { flex: 1 1 140px; display: grid; gap: 2px; padding: 9px 11px; border: 1px solid #393936; border-radius: 10px; background: #20201f; }
.out-of-hearts-fact span { color: #9a9a94; font-size: 12px; }
.out-of-hearts-fact strong { color: #f4f4ef; font-size: 16px; }
.out-of-hearts .heart-pack-actions { grid-template-columns: minmax(0,1fr); }
.editor-heart-estimate {
  min-width: 0;
  color: #8f8994;
  font-size: 10.75px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
body.builder-mode .editor-send-button {
  min-width: 82px;
  min-height: 36px;
  border: 1px solid rgba(255,122,180,.28);
  border-radius: 9px;
  background: var(--bh-action, #f04491);
  color: #fff;
  font-weight: 760;
  box-shadow: 0 8px 22px rgba(240,68,145,.18);
}
body.builder-mode .editor-send-button:hover:not(:disabled) { background: var(--bh-action-strong, #ff63ad); transform: translateY(-1px); }
body.builder-mode .editor-send-button:disabled { border-color: transparent; background: rgba(255,255,255,.045); color: #68626d; box-shadow: none; }
.builder-agent-header-meta { display: inline-flex; align-items: center; gap: 6px; }
.builder-agent-elapsed {
  color: #8f8994;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
body.builder-agent-working .builder-agent-elapsed { color: #d79ab7; }

/* M9 — responsive Agent workspace: useful split on tablet, focused chat on phone. */
@media (min-width: 761px) and (max-width: 1100px) {
  body.builder-mode .editor-workspace { grid-template-columns: minmax(340px,42vw) 1px minmax(0,1fr); }
  body.builder-mode.editor-chat-collapsed .editor-workspace { grid-template-columns: 0 0 minmax(0,1fr); }
}
@media (max-width: 760px) {
  body.builder-mode .editor-workspace,
  body.builder-mode.editor-chat-collapsed .editor-workspace { grid-template-columns: minmax(0,1fr); }
  body.builder-mode .editor-chat-resizer { display: none; }
  body.builder-mode .builder-agent-header { min-height: 58px; padding: 8px 10px; }
  body.builder-mode .editor-composer { margin: 7px 8px 4px; padding: 9px; border-radius: 14px; }
  body.builder-mode .editor-composer textarea { min-height: 60px; max-height: 120px; }
  body.builder-mode .editor-composer-footer { gap: 6px; }
  body.builder-mode .editor-composer-footer #buildLevel { min-width: 0; max-width: 150px; }
  .editor-heart-estimate { overflow: hidden; text-overflow: ellipsis; }
  .builder-file-action { display: none; }
}
html[dir="rtl"] body.builder-mode .editor-workspace,
html[dir="rtl"] body.builder-mode .editor-chat-panel,
html[dir="rtl"] body.builder-mode .editor-stage-column { direction: ltr; }
html[dir="rtl"] body.builder-mode .editor-chat-panel {
  border-right: 0;
  border-left: 1px solid rgba(255,255,255,.075);
}
html[dir="rtl"] body.builder-mode .builder-message-user { justify-self: end; }
html[dir="rtl"] body.builder-mode .builder-message-text,
html[dir="rtl"] body.builder-mode .builder-md,
html[dir="rtl"] body.builder-mode .builder-question legend,
html[dir="rtl"] body.builder-mode .builder-choice,
html[dir="rtl"] body.builder-mode .builder-questions-title,
html[dir="rtl"] body.builder-mode .builder-todos-label,
html[dir="rtl"] body.builder-mode .builder-work-copy strong,
html[dir="rtl"] body.builder-mode .builder-note { text-align: right; unicode-bidi: plaintext; }
html[dir="rtl"] body.builder-mode .editor-composer textarea { text-align: right; unicode-bidi: plaintext; }

@media (prefers-reduced-motion: reduce) {
  .builder-spinner, .builder-tool-running .builder-tool-icon, .builder-todo-active, body.builder-agent-working .builder-agent-core::before { animation: none; }
  body.builder-mode .editor-send-button { transition: none; }
  body.builder-mode .editor-send-button:hover:not(:disabled) { transform: none; }
}
.builder-message > button { justify-self: start; }
body.legacy-project #editorChatEmpty { display: none !important; }

/* M10–M11: one restrained, keyboard-accessible control over the real Builder preview. */
.builder-canvas { position: relative; }
.builder-visual-picker-button {
  position: absolute; z-index: 25; inset-block-start: 14px; inset-inline-end: 14px;
  min-height: 42px; padding: 9px 14px; border: 1px solid rgba(240,68,145,.55);
  border-radius: 11px; background: #211723; color: #fff5fb;
  font: inherit; font-size: 13px; font-weight: 650;
  box-shadow: 0 8px 25px rgba(0,0,0,.18); cursor: pointer;
}
.builder-visual-picker-button[aria-pressed="true"] { background: #7e254e; }
.builder-visual-picker-button:focus-visible,
.builder-visual-picker-panel :is(button,select,textarea):focus-visible {
  outline: 3px solid #f04491; outline-offset: 2px;
}
.builder-visual-picker-hint {
  position: absolute; z-index: 25; inset-block-start: 62px; inset-inline-end: 14px;
  max-width: min(360px,calc(100% - 28px)); margin: 0; padding: 9px 12px;
  border: 1px solid rgba(240,68,145,.3); border-radius: 10px;
  background: #211923; color: #eee0ed; font-size: 12px; line-height: 1.4;
  box-shadow: 0 8px 25px rgba(0,0,0,.2);
}
.builder-visual-picker-panel {
  position: absolute; z-index: 26; inset-block-start: 108px; inset-inline-end: 14px;
  width: min(352px, calc(100% - 28px)); max-height: min(520px,calc(100% - 120px));
  overflow-y: auto; display: grid; gap: 12px; padding: 17px;
  border: 1px solid rgba(240,68,145,.48); border-radius: 15px;
  background: #211923; color: #f7f0f5;
  box-shadow: 0 14px 45px rgba(0,0,0,.35); text-align: start;
}
.builder-visual-picker-panel strong { font-size: 15px; font-weight: 700; }
.builder-visual-selected {
  margin: 0; padding: 10px 12px; border-inline-start: 3px solid #f04491;
  border-radius: 5px; background: rgba(255,255,255,.07);
  line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
}
.builder-visual-field { display: grid; gap: 6px; font-size: 12px; font-weight: 600; }
.builder-visual-input {
  width: 100%; min-height: 42px; box-sizing: border-box; padding: 9px 10px;
  border: 1px solid rgba(255,255,255,.22); border-radius: 8px;
  background: #141219; color: #f7f0f5; font: inherit; font-size: 13px;
}
textarea.builder-visual-input { min-height: 85px; resize: vertical; }
.builder-visual-note { margin: 0; font-size: 12px; line-height: 1.5; color: #d8c0cf; }
.builder-visual-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.builder-visual-actions button { min-height: 42px; padding: 8px 12px; cursor: pointer; }
.builder-visual-actions [hidden] { display: none !important; }
@media (max-width: 600px) {
  .builder-visual-picker-panel { inset-block-start: 104px; max-height: min(450px,calc(100% - 116px)); }
}

.builder-visual-style-fields {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px;
  padding-block: 10px; border-block: 1px solid rgba(255,255,255,.1);
}
.builder-visual-style-fields .builder-visual-field { min-width: 0; align-content: start; }
.builder-visual-color-toggle { display: flex; gap: 8px; align-items: center; font-size: 12px; font-weight: 500; }
.builder-visual-color-toggle input { width: 18px; height: 18px; accent-color: #f04491; }
.builder-visual-color-picker {
  width: 100%; height: 42px; min-height: 42px; padding: 4px 6px;
  border: 1px solid rgba(255,255,255,.22); border-radius: 8px;
  background: #141219; cursor: pointer;
}
.builder-visual-color-picker:disabled { opacity: .35; cursor: not-allowed; }
@media (max-width: 440px) { .builder-visual-style-fields { grid-template-columns: 1fr; } }

/* M16 — a local design desk over the already-open preview; no extra runtime. */
.builder-style-lab-button {
  position: absolute; z-index: 25; inset-block-start: 14px; inset-inline-end: 190px;
  min-height: 42px; padding: 9px 14px; border: 1px solid rgba(240,68,145,.55);
  border-radius: 11px; background: #211723; color: #fff5fb;
  font: inherit; font-size: 13px; font-weight: 650;
  box-shadow: 0 8px 25px rgba(0,0,0,.18); cursor: pointer;
}
.builder-style-lab-button[aria-pressed="true"] { background: #7e254e; }
.builder-style-lab-button:focus-visible,
.builder-style-lab-panel :is(button,select,input):focus-visible {
  outline: 3px solid #f04491; outline-offset: 2px;
}
.builder-style-lab-panel {
  position: absolute; z-index: 27; inset-block-start: 64px; inset-inline-end: 14px;
  display: grid; gap: 13px; width: min(356px,calc(100% - 28px));
  max-height: min(650px,calc(100% - 88px)); overflow-y: auto;
  padding: 18px; border: 1px solid rgba(240,68,145,.48);
  border-radius: 15px; background: #211923; color: #f7f0f5;
  box-shadow: 0 15px 48px rgba(0,0,0,.35); text-align: start;
}
.builder-style-lab-panel strong { font-size: 16px; font-weight: 700; }
.builder-style-lab-panel .builder-visual-field { min-width: 0; }
.builder-style-lab-panel input[type="color"] { padding: 4px; height: 42px; }
.builder-style-lab-panel input[type="range"] { min-height: 42px; accent-color: #f04491; }
.builder-style-lab-panel .builder-style-lab-sample {
  --lab-primary: #833a81; --lab-accent: #e8599a;
  padding: 15px; background: rgba(255,255,255,.06); color: var(--lab-primary);
  border: 1px solid rgba(255,255,255,.16); border-inline-start: 5px solid var(--lab-accent);
  font-weight: 750; line-height: 1.4; overflow-wrap: anywhere;
}
.builder-style-lab-panel .builder-visual-actions button { min-height: 42px; }
@media (max-width: 480px) {
  .builder-style-lab-button { inset-inline-end: 180px; padding-inline: 9px; font-size: 12px; }
  .builder-style-lab-panel { inset-block-start: 62px; max-height: min(540px,calc(100% - 82px)); }
}

/* M19–M21: free rule-based suggestions live beside the Agent composer. */
body:not(.builder-mode) .editor-prompt-doctor-toolbar,
body:not(.builder-mode) .editor-prompt-doctor-panel { display: none !important; }
.editor-prompt-doctor-toolbar {
  display: flex; justify-content: flex-end; margin-block: 1px 7px;
}
.editor-prompt-doctor-button {
  min-height: 38px; padding: 7px 11px; border: 1px solid rgba(240,68,145,.38);
  border-radius: 9px; background: rgba(240,68,145,.065); color: #f3dbe9;
  font: inherit; font-size: 12px; font-weight: 650; cursor: pointer;
}
.editor-prompt-doctor-button:hover,
.editor-prompt-doctor-button[aria-expanded="true"] {
  background: rgba(240,68,145,.17); border-color: rgba(240,68,145,.68);
}
.editor-prompt-doctor-button:focus-visible,
.editor-prompt-doctor-panel :is(input,button):focus-visible {
  outline: 3px solid #f04491; outline-offset: 2px;
}
.editor-prompt-doctor-panel {
  display: grid; gap: 9px; margin: 7px 0 10px; padding: 12px;
  border: 1px solid rgba(240,68,145,.31); border-radius: 12px;
  background: #211923; color: #f5edf2;
  text-align: start; max-height: min(340px,42vh); overflow-y: auto;
}
.editor-prompt-doctor-panel[hidden] { display: none !important; }
.editor-prompt-doctor-heading { font-size: 13px; font-weight: 750; }
.editor-prompt-doctor-help,
.editor-prompt-doctor-empty,
.editor-prompt-doctor-status {
  margin: 0; color: #e0ccd9; font-size: 12px; line-height: 1.5;
}
.editor-prompt-doctor-list { display: grid; gap: 6px; }
.editor-prompt-doctor-item {
  display: flex; align-items: flex-start; gap: 9px; min-height: 42px;
  padding: 9px 10px; border: 1px solid rgba(255,255,255,.085);
  border-radius: 8px; background: rgba(255,255,255,.03);
  font-size: 12px; line-height: 1.45; cursor: pointer;
}
.editor-prompt-doctor-item:hover { background: rgba(255,255,255,.075); }
.editor-prompt-doctor-item input {
  flex: none; width: 17px; height: 17px; margin: 1px 0 0; accent-color: #f04491;
}
.editor-prompt-doctor-add {
  justify-self: start; min-height: 42px; padding: 8px 13px;
  border: 1px solid rgba(240,68,145,.42); border-radius: 9px;
  color: #faf4f8; background: #6d294a; font-size: 12px; font-weight: 700;
  cursor: pointer;
}
.editor-prompt-doctor-add:hover { background: #823259; }
@media (max-width: 600px) {
  .editor-prompt-doctor-panel { padding: 10px; max-height: min(300px, 42vh); }
  .editor-prompt-doctor-toolbar { justify-content: stretch; }
  .editor-prompt-doctor-button { width: 100%; }
}

/* M22–M24 — focused planning desk; never touches the running Agent/preview. */
.editor-milestone-trigger {
  min-height: 38px; padding: 7px 12px; font: inherit; font-size: 12px;
  border: 1px solid rgba(240,68,145,.4); border-radius: 9px;
  background: #2d1e2c; color: #f7edf4; cursor: pointer;
}
.editor-prompt-doctor-toolbar { flex-wrap: wrap; gap: 8px; }
.editor-milestone-trigger:hover { background: #532b46; }
.editor-milestone-trigger:focus-visible,
.editor-milestone-dialog :is(button,input,textarea,select,summary):focus-visible {
  outline: 3px solid #f04491; outline-offset: 2px;
}
body:not(.builder-mode) .editor-milestone-trigger { display: none !important; }
.editor-milestone-dialog {
  position: fixed; box-sizing: border-box;
  width: min(940px, calc(100vw - 28px)); max-width: 940px;
  max-height: min(840px, calc(100dvh - 36px)); margin: auto;
  padding: 22px; overflow: auto;
  border: 1px solid rgba(240,68,145,.35); border-radius: 18px;
  background: #1d1724; color: #f7edf5;
  box-shadow: 0 28px 90px rgba(0,0,0,.5);
  font: inherit; text-align: start; color-scheme: dark;
}
.editor-milestone-dialog:not([open]) { display: none !important; }
.editor-milestone-dialog::backdrop { background: rgba(12,8,17,.78); backdrop-filter: blur(4px); }
.editor-milestone-head { display: flex; align-items: flex-start; gap: 20px; justify-content: space-between; }
.editor-milestone-heading { display: grid; gap: 6px; }
.editor-milestone-eyebrow {
  color: #f091be; font-size: 11px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase;
}
.editor-milestone-heading h2 { margin: 0; font-size: clamp(21px,2.5vw,27px); line-height: 1.2; }
.editor-milestone-heading p { margin: 0; color: #cfc0d4; font-size: 13px; line-height: 1.5; }
.editor-milestone-action {
  min-height: 42px; padding: 8px 13px; cursor: pointer;
  border: 1px solid rgba(240,68,145,.35); border-radius: 9px;
  color: #f6ecf4; background: #362438; font: inherit; font-size: 12px; font-weight: 700;
}
.editor-milestone-action:hover { background: #562e49; border-color: rgba(240,68,145,.7); }
.editor-milestone-close { flex: none; min-width: 74px; }
.editor-milestone-field { display: grid; gap: 6px; margin-block: 12px; min-width: 0; }
.editor-milestone-field-name { color: #e5d5e3; font-size: 12px; font-weight: 700; }
.editor-milestone-input {
  box-sizing: border-box; min-height: 43px; width: 100%;
  border-radius: 9px; padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.22); background: #141219;
  color: #f9f0f6; font: inherit; font-size: 13px; line-height: 1.4;
}
textarea.editor-milestone-input { min-height: 70px; resize: vertical; }
.editor-milestone-presets { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.editor-milestone-presets .editor-milestone-field { flex: 1; min-width: 155px; }
.editor-milestone-presets .editor-milestone-action { margin-block-end: 12px; }
.editor-milestone-progress {
  margin: 6px 0 16px; color: #f2a4c8; font-size: 12px; font-weight: 700;
}
.editor-milestone-tasks { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.editor-milestone-card {
  min-width: 0; padding: 16px; border: 1px solid rgba(255,255,255,.13);
  border-radius: 13px; background: rgba(255,255,255,.035);
}
.editor-milestone-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.editor-milestone-number {
  font-size: 20px; font-weight: 850; font-variant-numeric: tabular-nums;
  letter-spacing: -.04em; color: #ee90b7;
}
.editor-milestone-state {
  padding: 5px 8px; border-radius: 7px; border: 1px solid rgba(255,255,255,.16);
  color: #decedc; font-size: 11px; font-weight: 700;
}
.editor-milestone-state[data-state="done"] { color: #b9f1c8; border-color: #448a65; }
.editor-milestone-state[data-state="ready"] { color: #f9c3da; border-color: rgba(240,68,145,.55); }
.editor-milestone-dependencies { margin: 8px 0; }
.editor-milestone-dependencies summary {
  padding: 10px 8px; border-radius: 7px; font-size: 12px; cursor: pointer;
  background: rgba(255,255,255,.05);
}
.editor-milestone-dependency-item {
  display: flex; gap: 8px; align-items: center; min-height: 35px;
  padding: 7px 8px; font-size: 12px; line-height: 1.4; cursor: pointer;
}
.editor-milestone-dependency-item input,
.editor-milestone-done input { width: 17px; height: 17px; flex: none; accent-color: #ef619b; }
.editor-milestone-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.editor-milestone-done { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-size: 12px; font-weight: 700; }
.editor-milestone-bottom { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 20px; align-items: center; }
.editor-milestone-download { background: #87335d; border-color: rgba(255,140,190,.4); }
.editor-milestone-feedback { flex-basis: 100%; min-height: 20px; margin: 0; color: #ebafcb; font-size: 12px; }
@media (max-width: 700px) {
  .editor-milestone-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); padding: 14px; border-radius: 13px; }
  .editor-milestone-tasks { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .editor-milestone-head { gap: 10px; }
  .editor-milestone-card { padding: 13px; }
}
@media (max-width: 480px) {
  .editor-milestone-trigger, .editor-prompt-doctor-button { width: auto; flex: 1; }
  .editor-milestone-action { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .editor-milestone-dialog::backdrop { backdrop-filter: none; }
}
/* Milestones as a metro map (milestone-metro.mjs). The stage color is also
   the label halo and the check mark, so all three turn light together. */
.editor-milestone-metro { margin: 0 0 18px; }
.editor-milestone-metro-stage {
  position: relative; overflow: hidden; padding: 10px;
  border: 1px solid rgba(255,255,255,.12); border-radius: 13px;
  background-color: #211a29;
  background-image: radial-gradient(rgba(255,255,255,.055) 1px, transparent 1.5px);
  background-size: 18px 18px;
}
.editor-milestone-metro svg { display: block; width: 100%; height: auto; margin: 0 auto; overflow: visible; }
.editor-milestone-metro-base { fill: none; stroke: #463a4f; stroke-width: 7; stroke-linecap: round; }
.editor-milestone-metro-lit {
  fill: none; stroke: #f04491; stroke-width: 7; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
}
.editor-milestone-metro-lit.is-lit { stroke-dashoffset: 0; }
.editor-milestone-metro-train { fill: #211a29; stroke: #ff80b9; stroke-width: 3; }
.editor-milestone-metro-heart { fill: #ff80b9; }
.editor-milestone-station { cursor: pointer; outline: none; }
.editor-milestone-station-hit { fill: transparent; stroke: transparent; stroke-width: 2; }
.editor-milestone-station:focus-visible .editor-milestone-station-hit { stroke: #f04491; }
.editor-milestone-station-dot {
  fill: #211a29; stroke: #7d6c86; stroke-width: 2.5; stroke-dasharray: 4 3;
  transform-box: fill-box; transform-origin: center; transition: fill .3s, stroke .3s;
}
.editor-milestone-station.is-end .editor-milestone-station-dot { stroke-width: 4; }
.editor-milestone-station.is-open .editor-milestone-station-dot { fill: rgba(240,68,145,.16); stroke: #f04491; stroke-dasharray: none; }
.editor-milestone-station.is-open:hover .editor-milestone-station-dot { fill: rgba(240,68,145,.34); }
.editor-milestone-station.is-done .editor-milestone-station-dot { fill: #f04491; stroke: #f04491; stroke-dasharray: none; }
.editor-milestone-station-ring {
  fill: none; stroke: #f04491; stroke-width: 2; opacity: 0;
  transform-box: fill-box; transform-origin: center;
  animation: editor-milestone-metro-ring 1.8s ease-out infinite;
}
.editor-milestone-station-check {
  fill: none; stroke: #211a29; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 0; transition: stroke-dashoffset .35s ease .12s;
}
.editor-milestone-station-lock { fill: none; stroke: #a594ab; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
/* Done, but the train has not arrived yet. */
.editor-milestone-station.is-arriving .editor-milestone-station-dot { fill: #211a29; stroke: #f04491; }
.editor-milestone-station.is-arriving .editor-milestone-station-check { stroke-dashoffset: 1; }
.editor-milestone-station.is-popping .editor-milestone-station-dot { animation: editor-milestone-metro-pop .45s cubic-bezier(.3,1.6,.5,1); }
.editor-milestone-station.is-shaking { animation: editor-milestone-metro-shake .35s; }
.editor-milestone-station-name {
  fill: #e3d3e0; paint-order: stroke; stroke: #211a29; stroke-width: 4px; stroke-linejoin: round;
}
.editor-milestone-station.is-open .editor-milestone-station-name { fill: #fff3f9; font-weight: 700; }
.editor-milestone-station.is-locked .editor-milestone-station-name { fill: #a594ab; }
.editor-milestone-station.is-end .editor-milestone-station-name { font-weight: 750; }
@keyframes editor-milestone-metro-ring { 0% { opacity: .75; transform: scale(1); } 100% { opacity: 0; transform: scale(2.1); } }
@keyframes editor-milestone-metro-pop { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.35); } }
@keyframes editor-milestone-metro-shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.editor-milestone-metro-bar { height: 5px; margin-top: 10px; border-radius: 3px; background: #3a2f42; overflow: hidden; }
.editor-milestone-metro-bar i {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg,#f04491,#ff80b9); transition: width .6s cubic-bezier(.3,1.2,.5,1);
}
.editor-milestone-metro-status { margin: 8px 0 0; color: #cfc0d4; font-size: 12.5px; line-height: 1.45; }
.editor-milestone-metro-status b { color: #f7edf5; }
.editor-milestone-card.is-located { animation: editor-milestone-located 1.4s ease-out; }
@keyframes editor-milestone-located { 0%, 35% { border-color: #f04491; box-shadow: 0 0 0 3px rgba(240,68,145,.3); } }
@media (prefers-reduced-motion: reduce) {
  .editor-milestone-metro *, .editor-milestone-card.is-located { animation: none !important; transition: none !important; }
}

/* M25-M27: an opt-in read-only diff desk, never an automated preview. */
.editor-radar-trigger {
  min-height: 38px; padding: 7px 12px; border-radius: 9px;
  border: 1px solid rgba(240,68,145,.35); background: #2d1e2c;
  color: #f6e6f1; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
body:not(.builder-mode) .editor-radar-trigger { display: none !important; }
.editor-radar-trigger:hover { background: #532b46; }
.editor-radar-trigger:focus-visible,
.editor-radar-dialog :is(button,summary):focus-visible { outline: 3px solid #f04491; outline-offset: 2px; }
.editor-radar-dialog {
  position: fixed; box-sizing: border-box; width: min(950px,calc(100vw - 28px));
  max-width: 950px; max-height: min(830px,calc(100dvh - 36px));
  margin: auto; padding: 22px; overflow-y: auto;
  border: 1px solid rgba(240,68,145,.34); border-radius: 17px;
  background: #1d1724; color: #f7edf5; box-shadow: 0 26px 84px rgba(0,0,0,.48);
  font: inherit; text-align: start; color-scheme: dark;
}
.editor-radar-dialog:not([open]) { display: none !important; }
.editor-radar-dialog::backdrop { background: rgba(12,8,17,.78); backdrop-filter: blur(3px); }
.editor-radar-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.editor-radar-heading { display: grid; gap: 6px; }
.editor-radar-eyebrow { color: #f091be; font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.editor-radar-heading h2 { margin: 0; font-size: clamp(21px,2.5vw,27px); line-height: 1.2; }
.editor-radar-heading p { margin: 0; color: #d4c0d1; font-size: 13px; line-height: 1.5; }
.editor-radar-action {
  min-height: 42px; padding: 8px 13px; border-radius: 9px;
  border: 1px solid rgba(240,68,145,.4); color: #f5e7f1;
  background: #382339; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.editor-radar-action:hover { background: #652c4d; }
.editor-radar-close { flex: none; }
.editor-radar-actions { display: flex; flex-wrap: wrap; gap: 9px; padding: 18px 0 9px; }
.editor-radar-status { margin: 5px 0 12px; color: #dfc9d8; font-size: 12px; line-height: 1.5; }
.editor-radar-counts { margin: 0 0 15px; color: #efa3c7; font-size: 13px; font-weight: 750; }
.editor-radar-warning,.editor-radar-empty {
  padding: 9px 12px; margin: 5px 0 10px; border-radius: 8px;
  color: #d8c1d3; background: rgba(255,255,255,.055); font-size: 12px;
}
.editor-radar-files { display: grid; gap: 11px; }
.editor-radar-file {
  min-width: 0; border: 1px solid rgba(255,255,255,.12); border-radius: 11px;
  overflow: hidden; background: rgba(255,255,255,.025);
}
.editor-radar-file-title {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  align-items: center; padding: 11px 13px; cursor: pointer; overflow-wrap: anywhere;
}
.editor-radar-file-title strong { font-size: 12px; font-family: ui-monospace,Menlo,Consolas,monospace; }
.editor-radar-file-title span { color: #d8bfd0; font-size: 11px; }
.editor-radar-lines { padding: 0 11px 11px; display: grid; gap: 2px; }
.editor-radar-line { min-width: 0; }
.editor-radar-line pre {
  box-sizing: border-box; margin: 0; padding: 6px 10px; white-space: pre-wrap;
  overflow-wrap: anywhere; font-size: 12px; line-height: 1.5;
  font-family: ui-monospace,Menlo,Consolas,monospace;
}
.editor-radar-old { color: #f6b9c6; background: rgba(205,48,75,.13); }
.editor-radar-new { color: #b3e7c8; background: rgba(40,160,91,.12); }
@media (max-width: 700px) {
  .editor-radar-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); padding: 14px; border-radius: 13px; }
  .editor-radar-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .editor-radar-action { min-height: 44px; }
}
@media (max-width: 480px) {
  .editor-radar-trigger { width: auto; flex: 1; }
  .editor-radar-file-title { display: grid; }
}
@media (prefers-reduced-motion: reduce) {
  .editor-radar-dialog::backdrop { backdrop-filter: none; }
}

/* M29–M30: native editor keeps its own text undo; these are saved-file controls. */
.builder-manual-history-controls {
  display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding-inline: 8px; border-inline-start: 1px solid rgba(255,255,255,.12);
}
body:not(.builder-mode) .builder-manual-history-controls,
body:not(.editor-code-open) .builder-manual-history-controls,
.builder-manual-history-controls[hidden] { display: none !important; }
.builder-manual-history-button {
  min-height: 42px; padding: 8px 12px; border-radius: 9px;
  border: 1px solid rgba(240,68,145,.38); background: #332238;
  color: #f5edf4; font: inherit; font-size: 12px; font-weight: 650;
  cursor: pointer;
}
.builder-manual-history-button:hover:not(:disabled) { background: #69314d; }
.builder-manual-history-button:disabled { opacity: .42; cursor: not-allowed; }
.builder-manual-history-button:focus-visible { outline: 3px solid #f04491; outline-offset: 2px; }
@media (max-width: 650px) {
  .builder-manual-history-controls { padding-inline: 4px; gap: 4px; }
  .builder-manual-history-button { min-height: 44px; padding-inline: 8px; }
}


/* M31-M34: responsive checks are a quiet, deliberate tool over the existing
   paid preview. This panel never triggers a new preview or a background job. */
.builder-responsive-button {
  position:absolute; z-index:25; inset-block-start:62px; inset-inline-end:14px;
  min-height:44px; padding:9px 14px; border:1px solid rgba(240,68,145,.55);
  border-radius:11px; background:#211723; color:#fff5fb; font:inherit;
  font-size:12px; font-weight:700; cursor:pointer;
}
.builder-responsive-button:hover,.builder-responsive-button[aria-pressed="true"] { background:#6f2f50; }
.builder-responsive-button:focus-visible,
.builder-responsive-dialog :is(button):focus-visible { outline:3px solid #f04491; outline-offset:2px; }
.builder-responsive-dialog {
  position:fixed; inset:0; margin:auto; box-sizing:border-box;
  width:min(600px,calc(100vw - 24px)); max-height:min(780px,calc(100dvh - 24px));
  padding:24px; border:1px solid #61334e; border-radius:18px;
  background:#211923; color:#fff3fb; box-shadow:0 24px 75px rgba(0,0,0,.5);
  overflow-y:auto; overscroll-behavior:contain; z-index:100;
}
.builder-responsive-dialog:not([open]) { display:none !important; }
.builder-responsive-dialog::backdrop { background:rgba(13,9,18,.75); }
.builder-responsive-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.builder-responsive-head h2 { margin:0; font-size:clamp(19px,3vw,25px); line-height:1.25; }
.builder-responsive-close,.builder-responsive-device {
  font:inherit; font-size:12px; font-weight:700; min-height:44px; border-radius:10px;
  color:inherit; border:1px solid #75506c; background:#342436; cursor:pointer;
}
.builder-responsive-close { flex:none; padding:8px 14px; }
.builder-responsive-description,.builder-responsive-limitation {
  font-size:13px; line-height:1.5; color:#d8c1d0;
}
.builder-responsive-description { margin:10px 0 16px; }
.builder-responsive-limitation { margin:14px 0 0; }
.builder-responsive-devices { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.builder-responsive-device { min-width:0; padding:8px; }
.builder-responsive-device[aria-pressed="true"] { background:#743456; border-color:#f08ebf; }
.builder-responsive-scan { margin-top:15px; min-height:44px; width:100%; }
.builder-responsive-scan:disabled { opacity:.5; cursor:wait; }
.builder-responsive-note { min-height:20px; margin:12px 0 0; color:#e8bfdb; font-size:12px; }
.builder-responsive-meta { margin:12px 0 16px; color:#d4b5cb; font-size:12px; }
.builder-responsive-results h3 { font-size:16px; margin:10px 0; }
.builder-responsive-issues { display:grid; gap:8px; list-style:none; margin:0; padding:0; }
.builder-responsive-issue {
  display:flex; justify-content:space-between; flex-wrap:wrap; gap:7px;
  border:1px solid #55394c; background:#2c202f; border-radius:10px;
  padding:11px 13px; font-size:13px;
}
.builder-responsive-issue span { color:#e3bad5; font-size:12px; font-family:ui-monospace,Menlo,Consolas,monospace; }
.builder-responsive-success { border:1px solid #467e67; border-radius:10px; padding:12px; color:#bcf4d5; }
html[data-theme="light"] .builder-responsive-dialog {
  background:#fffafd; color:#29212a; border-color:#e6c9db; box-shadow:0 24px 75px rgba(37,20,35,.24);
}
html[data-theme="light"] .builder-responsive-button { background:#fffafd; color:#642447; }
html[data-theme="light"] .builder-responsive-close,
html[data-theme="light"] .builder-responsive-device { background:#f5eaf2; color:#50243e; border-color:#dfbbd2; }
html[data-theme="light"] .builder-responsive-device[aria-pressed="true"] { background:#f1c9e1; border-color:#af5689; }
html[data-theme="light"] .builder-responsive-description,
html[data-theme="light"] .builder-responsive-limitation,
html[data-theme="light"] .builder-responsive-meta { color:#625260; }
html[data-theme="light"] .builder-responsive-note { color:#854466; }
html[data-theme="light"] .builder-responsive-issue { background:#faf2f8; border-color:#ead4e3; }
html[data-theme="light"] .builder-responsive-issue span { color:#865676; }
html[data-theme="light"] .builder-responsive-success { color:#176c47; border-color:#a6d4bc; }
@media (max-width:480px) {
  .builder-responsive-dialog { width:calc(100vw - 16px); max-height:calc(100dvh - 16px); padding:16px; border-radius:14px; }
  .builder-responsive-button { inset-block-start:66px; inset-inline-end:12px; font-size:11px; }
  .builder-responsive-devices { gap:5px; }
  .builder-responsive-device { font-size:11px; }
}
@media (prefers-reduced-motion:reduce) {
  .builder-responsive-dialog::backdrop { backdrop-filter:none; }
}


/* M35–M37: compact coverage matrix; source strings never become HTML. */
.editor-translations-trigger {
  min-height:44px; padding:9px 12px; border-radius:10px;
  border:1px solid rgba(240,68,145,.4); background:#37213a;
  color:#fff4fc; font:inherit; font-size:12px; font-weight:700; cursor:pointer;
}
body:not(.builder-mode) .editor-translations-trigger { display:none !important; }
.editor-translations-trigger:hover { background:#562e4a; }
.editor-translations-trigger:focus-visible,
.editor-translations-dialog :is(button):focus-visible { outline:3px solid #f04491; outline-offset:3px; }
.editor-translations-dialog {
  position:fixed; inset:0; margin:auto; box-sizing:border-box; z-index:100;
  width:min(740px,calc(100vw - 24px)); max-height:calc(100dvh - 24px);
  padding:22px; overflow-y:auto; overscroll-behavior:contain;
  border:1px solid #73425e; border-radius:18px; background:#221922; color:#f9f0f7;
  box-shadow:0 24px 80px rgba(0,0,0,.55);
}
.editor-translations-dialog:not([open]) { display:none !important; }
.editor-translations-dialog::backdrop { background:rgba(14,9,19,.77); }
.editor-translations-head { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; }
.editor-translations-heading { min-width:0; display:grid; gap:7px; }
.editor-translations-eyebrow { color:#efa2c9; font-size:11px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; }
.editor-translations-heading h2 { margin:0; font-size:clamp(21px,3vw,27px); line-height:1.2; }
.editor-translations-heading p { margin:0; color:#d8c4d2; font-size:13px; line-height:1.5; }
.editor-translations-action {
  min-height:44px; border:1px solid #77536b; border-radius:10px;
  padding:9px 13px; background:#39273b; color:#fff1f8;
  font:inherit; font-size:12px; font-weight:750; cursor:pointer;
}
.editor-translations-action:hover { background:#663451; }
.editor-translations-close { flex:none; }
.editor-translations-actions { display:flex; gap:8px; flex-wrap:wrap; margin:18px 0 12px; }
.editor-translations-scan { background:#aa356e; border-color:#d66a9c; }
.editor-translations-status { margin:6px 0; min-height:16px; font-size:12px; color:#d9b6ce; }
.editor-translations-totals { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; margin:20px 0 16px; }
.editor-translations-total {
  display:grid; align-content:center; gap:7px; padding:12px; min-width:0;
  background:#2e2130; border:1px solid #4e3a4c; border-radius:10px;
}
.editor-translations-total span { font-size:11px; color:#d7bfd0; }
.editor-translations-total strong { font-size:20px; line-height:1.15; font-variant-numeric:tabular-nums; }
.editor-translations-section { margin:18px 0 12px; font-size:15px; }
.editor-translations-languages { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.editor-translations-language {
  min-width:0; border:1px solid #554052; border-radius:10px; padding:10px;
  background:#2c202e; display:grid; gap:8px;
}
.editor-translations-language[data-coverage="complete"] { border-inline-start:3px solid #67c79a; }
.editor-translations-language[data-coverage="partial"] { border-inline-start:3px solid #efb36b; }
.editor-translations-language[data-coverage="not-provided"] { border-inline-start:3px solid #807180; opacity:.84; }
.editor-translations-language-head { display:flex; align-items:flex-start; justify-content:space-between; gap:8px; }
.editor-translations-language-name { font-weight:700; font-size:12px; overflow-wrap:anywhere; }
.editor-translations-language-code { font:600 11px ui-monospace,Consolas,monospace; color:#f7b2d4; }
.editor-translations-language-status { color:#dfc7d8; font-size:11px; }
.editor-translations-issues { margin:0; padding:0; list-style:none; display:grid; gap:7px; }
.editor-translations-issue {
  min-width:0; padding:11px; border:1px solid #594052; border-radius:10px;
  display:flex; flex-wrap:wrap; align-items:center; gap:9px; background:#302232;
}
.editor-translations-issue-language { color:#f5b1d3; font:750 12px ui-monospace,Consolas,monospace; }
.editor-translations-issue-key { font:12px ui-monospace,Consolas,monospace; overflow-wrap:anywhere; unicode-bidi:embed; }
.editor-translations-issue-reason { margin-inline-start:auto; color:#f4c4b6; font-size:11px; }
.editor-translations-help,.editor-translations-warning,.editor-translations-ok {
  margin:12px 0; font-size:12px; line-height:1.5; color:#d2bacb;
}
.editor-translations-warning { border-inline-start:3px solid #e7ae78; padding-inline-start:10px; }
.editor-translations-ok { color:#b7eacb; }
html[dir="rtl"] .editor-translations-dialog { direction:rtl; }
html[dir="rtl"] .editor-translations-issue-key { direction:ltr; unicode-bidi:embed; }
html[data-theme="light"] .editor-translations-dialog {
  background:#fffafd; color:#2d2330; border-color:#dfbdd1; box-shadow:0 24px 70px rgba(36,18,33,.24);
}
html[data-theme="light"] .editor-translations-trigger { background:#f9edf5; color:#722f52; }
html[data-theme="light"] .editor-translations-eyebrow,
html[data-theme="light"] .editor-translations-language-code,
html[data-theme="light"] .editor-translations-issue-language { color:#94476e; }
html[data-theme="light"] .editor-translations-heading p,
html[data-theme="light"] .editor-translations-status,
html[data-theme="light"] .editor-translations-total span,
html[data-theme="light"] .editor-translations-language-status,
html[data-theme="light"] .editor-translations-help { color:#635261; }
html[data-theme="light"] .editor-translations-total,
html[data-theme="light"] .editor-translations-language,
html[data-theme="light"] .editor-translations-issue { background:#faf3f8; border-color:#e7d3e1; }
html[data-theme="light"] .editor-translations-action { background:#f2e4ee; color:#552d45; border-color:#d9abc8; }
html[data-theme="light"] .editor-translations-scan { background:#a43b71; color:white; }
html[data-theme="light"] .editor-translations-issue-reason { color:#9e4b49; }
html[data-theme="light"] .editor-translations-warning { color:#79552f; }
html[data-theme="light"] .editor-translations-ok { color:#22704b; }
@media (max-width:680px) {
  .editor-translations-languages { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:480px) {
  .editor-translations-dialog { padding:14px; width:calc(100vw - 12px); max-height:calc(100dvh - 12px); border-radius:12px; }
  .editor-translations-head { gap:8px; }
  .editor-translations-actions { display:grid; }
  .editor-translations-totals { gap:5px; }
  .editor-translations-total { padding:8px; }
  .editor-translations-total strong { font-size:16px; }
  .editor-translations-languages { grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
  .editor-translations-issue-reason { margin-inline-start:0; }
}
@media (prefers-reduced-motion:reduce) {
  .editor-translations-dialog::backdrop { backdrop-filter:none; }
}

/* Keep all browser-only tools reachable on narrow editor toolbars. */
.editor-prompt-doctor-toolbar { flex-wrap:wrap; gap:7px; align-items:center; min-width:0; }
.editor-prompt-doctor-toolbar > button { max-width:100%; white-space:normal; }
@media (max-width:520px) {
  .editor-prompt-doctor-toolbar { justify-content:flex-start; }
  .editor-prompt-doctor-toolbar > button { flex:1 1 145px; }
}


/* M38-M40: compact, read-only SEO hint list in the existing Builder editor. */
.editor-seo-trigger {
  min-height:44px; padding:9px 12px; border-radius:10px;
  border:1px solid rgba(240,68,145,.4); background:#37213a;
  color:#fff3fb; font:inherit; font-size:12px; font-weight:700; cursor:pointer;
}
body:not(.builder-mode) .editor-seo-trigger { display:none !important; }
.editor-seo-trigger:hover { background:#572d49; }
.editor-seo-trigger:focus-visible,
.editor-seo-dialog :is(button):focus-visible { outline:3px solid #f04491; outline-offset:3px; }
.editor-seo-dialog {
  position:fixed; inset:0; margin:auto; box-sizing:border-box; z-index:100;
  width:min(680px,calc(100vw - 24px)); max-height:calc(100dvh - 24px);
  padding:22px; overflow-y:auto; overscroll-behavior:contain;
  border:1px solid #75415e; border-radius:18px; background:#221922; color:#faf1f7;
  box-shadow:0 24px 80px rgba(0,0,0,.55);
}
.editor-seo-dialog:not([open]) { display:none !important; }
.editor-seo-dialog::backdrop { background:rgba(14,9,19,.78); }
.editor-seo-head { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; }
.editor-seo-intro { display:grid; gap:7px; min-width:0; }
.editor-seo-eyebrow { color:#efa6c7; text-transform:uppercase; font-size:11px; font-weight:800; letter-spacing:.06em; }
.editor-seo-intro h2 { font-size:clamp(21px,3vw,26px); line-height:1.2; margin:0; }
.editor-seo-intro p { font-size:13px; line-height:1.5; margin:0; color:#d8c1d0; }
.editor-seo-action {
  min-height:44px; border:1px solid #704961; border-radius:10px; padding:9px 13px;
  background:#3e2a40; color:#fff1f8; font:inherit; font-size:12px; font-weight:750; cursor:pointer;
}
.editor-seo-action:hover { background:#653551; }
.editor-seo-close { flex:none; }
.editor-seo-actions { display:flex; flex-wrap:wrap; gap:9px; margin:18px 0 12px; }
.editor-seo-scan { background:#ab366e; border-color:#e574a6; }
.editor-seo-status { min-height:20px; font-size:12px; color:#e0c1d5; margin:8px 0 10px; }
.editor-seo-counts { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin:16px 0; }
.editor-seo-count { display:grid; gap:7px; background:#302234; border:1px solid #55364f; border-radius:10px; padding:12px; min-width:0; }
.editor-seo-count span { font-size:11px; color:#e1c7d5; }
.editor-seo-count strong { font-size:20px; line-height:1.15; font-variant-numeric:tabular-nums; }
.editor-seo-section { margin:22px 0 10px; font-size:15px; }
.editor-seo-list { list-style:none; display:grid; gap:9px; padding:0; margin:0; }
.editor-seo-item {
  min-width:0; display:grid; grid-template-columns:1fr auto; column-gap:12px; row-gap:6px;
  border:1px solid #603d55; border-inline-start:3px solid #e9b56d;
  background:#2e222f; border-radius:10px; padding:13px;
}
.editor-seo-item[data-severity="info"] { border-inline-start-color:#ab93ca; }
.editor-seo-issue-title { font-size:13px; }
.editor-seo-issue-path { color:#e8b4d1; font:11px ui-monospace,Consolas,monospace; overflow-wrap:anywhere; unicode-bidi:embed; text-align:end; }
.editor-seo-suggestion { grid-column:1/-1; margin:0; color:#decad8; font-size:12px; line-height:1.5; }
.editor-seo-help,.editor-seo-warning,.editor-seo-success { font-size:12px; line-height:1.5; margin:13px 0; color:#d9c4d3; }
.editor-seo-warning { border-inline-start:3px solid #edb36a; padding-inline-start:10px; }
.editor-seo-success { color:#abe8c3; }
html[dir="rtl"] .editor-seo-dialog { direction:rtl; }
html[dir="rtl"] .editor-seo-issue-path { direction:ltr; unicode-bidi:embed; }
html[data-theme="light"] .editor-seo-dialog {
  background:#fffafd; color:#322535; border-color:#e4bbd5;
  box-shadow:0 24px 70px rgba(36,18,33,.23);
}
html[data-theme="light"] .editor-seo-trigger { background:#f9edf5; color:#722f52; }
html[data-theme="light"] .editor-seo-eyebrow,
html[data-theme="light"] .editor-seo-issue-path { color:#985071; }
html[data-theme="light"] .editor-seo-intro p,
html[data-theme="light"] .editor-seo-status,
html[data-theme="light"] .editor-seo-count span,
html[data-theme="light"] .editor-seo-suggestion,
html[data-theme="light"] .editor-seo-help { color:#625261; }
html[data-theme="light"] .editor-seo-count,
html[data-theme="light"] .editor-seo-item { background:#fbf3f8; border-color:#e4cfe0; }
html[data-theme="light"] .editor-seo-action { background:#f4e8f0; color:#60334e; border-color:#dcb3ca; }
html[data-theme="light"] .editor-seo-scan { background:#a53b71; color:white; }
html[data-theme="light"] .editor-seo-warning { color:#865a25; }
html[data-theme="light"] .editor-seo-success { color:#26764e; }
@media (max-width:480px) {
  .editor-seo-dialog { padding:14px; width:calc(100vw - 12px); max-height:calc(100dvh - 12px); border-radius:12px; }
  .editor-seo-head { gap:8px; }
  .editor-seo-count { padding:9px; }
  .editor-seo-count strong { font-size:17px; }
  .editor-seo-actions { display:grid; }
  .editor-seo-item { grid-template-columns:1fr; }
  .editor-seo-suggestion { grid-column:1; }
  .editor-seo-issue-path { text-align:start; }
}
@media (prefers-reduced-motion:reduce) {
  .editor-seo-dialog::backdrop { backdrop-filter:none; }
}


/* M41-M43: pasted logs never enter output HTML, only sanitized catalog keys. */
.editor-error-trigger {
  min-height:44px; padding:9px 12px; border-radius:10px;
  border:1px solid rgba(240,68,145,.4); background:#37213a;
  color:#fff3fb; font:inherit; font-size:12px; font-weight:700; cursor:pointer;
}
body:not(.builder-mode) .editor-error-trigger { display:none !important; }
.editor-error-trigger:hover { background:#572d49; }
.editor-error-trigger:focus-visible,
.editor-error-dialog :is(button,textarea):focus-visible { outline:3px solid #f04491; outline-offset:3px; }
.editor-error-dialog {
  position:fixed; inset:0; margin:auto; box-sizing:border-box; z-index:100;
  width:min(610px,calc(100vw - 24px)); max-height:calc(100dvh - 24px);
  padding:22px; overflow-y:auto; overscroll-behavior:contain;
  border:1px solid #75415e; border-radius:18px; background:#221922; color:#faf1f7;
  box-shadow:0 24px 80px rgba(0,0,0,.55);
}
.editor-error-dialog:not([open]) { display:none !important; }
.editor-error-dialog::backdrop { background:rgba(14,9,19,.78); }
.editor-error-head { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; }
.editor-error-intro { display:grid; gap:7px; min-width:0; }
.editor-error-eyebrow { color:#efa6c7; text-transform:uppercase; font-size:11px; font-weight:800; letter-spacing:.06em; }
.editor-error-intro h2 { margin:0; font-size:clamp(21px,3vw,26px); line-height:1.2; }
.editor-error-intro p { margin:0; color:#d8c1d0; font-size:13px; line-height:1.5; }
.editor-error-action {
  min-height:44px; border:1px solid #724b64; border-radius:10px; padding:9px 13px;
  background:#3e2a40; color:#fff2f8; font:inherit; font-size:12px; font-weight:750; cursor:pointer;
}
.editor-error-action:hover { background:#673652; }
.editor-error-close { flex:none; }
.editor-error-form { margin-top:18px; }
.editor-error-input-label { display:grid; gap:8px; font-size:12px; font-weight:750; }
.editor-error-input {
  box-sizing:border-box; width:100%; min-height:130px; max-height:280px;
  padding:12px; border:1px solid #76536a; border-radius:10px;
  background:#160f1c; color:#fff4f9; resize:vertical; font:12px/1.55 ui-monospace,Consolas,monospace;
  direction:ltr; unicode-bidi:plaintext;
}
.editor-error-input::placeholder { color:#bea5b8; }
.editor-error-actions { display:flex; flex-wrap:wrap; gap:9px; margin:13px 0; }
.editor-error-decode { background:#ad366f; border-color:#e674a5; }
.editor-error-status,.editor-error-help { font-size:12px; line-height:1.5; color:#dfc6d5; margin:12px 0; }
.editor-error-result { display:grid; gap:13px; margin-top:14px; }
.editor-error-category { display:flex; gap:10px; justify-content:space-between; align-items:center; border:1px solid #634359; border-radius:10px; background:#322336; padding:11px 13px; }
.editor-error-category span { font-size:12px; color:#e4cad8; }
.editor-error-category strong { font-size:13px; color:#ffc3df; }
.editor-error-card { display:grid; gap:8px; border:1px solid #62445a; border-radius:12px; padding:15px; background:#2f2131; }
.editor-error-card strong { font-size:13px; color:#f6c6df; }
.editor-error-card p { margin:0 0 9px; color:#e5d0df; font-size:13px; line-height:1.5; }
.editor-error-warning { border-inline-start:3px solid #eab470; padding-inline-start:10px; color:#f4cba1; font-size:12px; }
html[dir="rtl"] .editor-error-dialog { direction:rtl; }
html[dir="rtl"] .editor-error-input { direction:ltr; unicode-bidi:plaintext; }
html[data-theme="light"] .editor-error-dialog {
  background:#fffafd; color:#302432; border-color:#e4bbd5; box-shadow:0 24px 70px rgba(36,18,33,.23);
}
html[data-theme="light"] .editor-error-trigger { background:#f9edf5; color:#722f52; }
html[data-theme="light"] .editor-error-eyebrow,
html[data-theme="light"] .editor-error-category strong,
html[data-theme="light"] .editor-error-card strong { color:#99466e; }
html[data-theme="light"] .editor-error-intro p,
html[data-theme="light"] .editor-error-status,
html[data-theme="light"] .editor-error-help,
html[data-theme="light"] .editor-error-category span,
html[data-theme="light"] .editor-error-card p { color:#635260; }
html[data-theme="light"] .editor-error-category,
html[data-theme="light"] .editor-error-card { background:#fbf3f8; border-color:#e4d0df; }
html[data-theme="light"] .editor-error-input { background:#fff; color:#29202d; border-color:#b992aa; }
html[data-theme="light"] .editor-error-input::placeholder { color:#736671; }
html[data-theme="light"] .editor-error-action { background:#f3e7f0; color:#62334c; border-color:#dfb6cc; }
html[data-theme="light"] .editor-error-decode { background:#a53b71; color:white; }
html[data-theme="light"] .editor-error-warning { color:#8e5b26; }
@media (max-width:480px) {
  .editor-error-dialog { padding:14px; width:calc(100vw - 12px); max-height:calc(100dvh - 12px); border-radius:12px; }
  .editor-error-head { gap:8px; }
  .editor-error-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (prefers-reduced-motion:reduce) {
  .editor-error-dialog::backdrop { backdrop-filter:none; }
}


/* M44-M46: quiet, safe source-derived documentation preview. */
.editor-doc-trigger {
  min-height:44px; padding:9px 12px; border-radius:10px;
  border:1px solid rgba(240,68,145,.4); background:#37213a;
  color:#fff3fb; font:inherit; font-size:12px; font-weight:700; cursor:pointer;
}
body:not(.builder-mode) .editor-doc-trigger { display:none !important; }
.editor-doc-trigger:hover { background:#572d49; }
.editor-doc-trigger:focus-visible,
.editor-doc-dialog :is(button,.editor-doc-preview):focus-visible { outline:3px solid #f04491; outline-offset:3px; }
.editor-doc-dialog {
  position:fixed; inset:0; margin:auto; box-sizing:border-box; z-index:100;
  width:min(720px,calc(100vw - 24px)); max-height:calc(100dvh - 24px);
  padding:22px; overflow-y:auto; overscroll-behavior:contain;
  border:1px solid #75415e; border-radius:18px; background:#221922; color:#faf1f7;
  box-shadow:0 24px 80px rgba(0,0,0,.55);
}
.editor-doc-dialog:not([open]) { display:none !important; }
.editor-doc-dialog::backdrop { background:rgba(14,9,19,.78); }
.editor-doc-head { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; }
.editor-doc-intro { display:grid; gap:7px; min-width:0; }
.editor-doc-eyebrow { color:#efa6c7; text-transform:uppercase; font-size:11px; font-weight:800; letter-spacing:.06em; }
.editor-doc-intro h2 { margin:0; font-size:clamp(21px,3vw,26px); line-height:1.2; }
.editor-doc-intro p { margin:0; color:#d9c3d1; font-size:13px; line-height:1.5; }
.editor-doc-action {
  min-height:44px; border:1px solid #734c65; border-radius:10px; padding:9px 13px;
  background:#3e2a40; color:#fff2f8; font:inherit; font-size:12px; font-weight:750; cursor:pointer;
}
.editor-doc-action:hover { background:#653651; }
.editor-doc-close { flex:none; }
.editor-doc-actions { display:flex; flex-wrap:wrap; gap:9px; margin:18px 0 12px; }
.editor-doc-generate { background:#ae3872; border-color:#e678a7; }
.editor-doc-download { background:#305a4d; border-color:#78b19a; }
.editor-doc-status,.editor-doc-help,.editor-doc-warning,.editor-doc-count {
  font-size:12px; line-height:1.5; margin:10px 0; color:#ddc8d8;
}
.editor-doc-count { color:#f0b7d5; font-weight:750; }
.editor-doc-preview {
  box-sizing:border-box; width:100%; max-height:400px; overflow:auto;
  margin:12px 0; padding:16px; border:1px solid #654357; border-radius:11px;
  background:#150f1b; color:#f6eaf2; white-space:pre-wrap; overflow-wrap:anywhere;
  font:12px/1.7 ui-monospace,Menlo,Consolas,monospace;
  direction:auto; unicode-bidi:plaintext;
}
.editor-doc-warning { border-inline-start:3px solid #e5b272; padding-inline-start:10px; }
html[dir="rtl"] .editor-doc-dialog { direction:rtl; }
html[dir="rtl"] .editor-doc-preview { direction:auto; unicode-bidi:plaintext; }
html[data-theme="light"] .editor-doc-dialog {
  background:#fffafd; color:#312433; border-color:#e4bbd5; box-shadow:0 24px 70px rgba(36,18,33,.23);
}
html[data-theme="light"] .editor-doc-trigger { background:#f9edf5; color:#722f52; }
html[data-theme="light"] .editor-doc-eyebrow,
html[data-theme="light"] .editor-doc-count { color:#96496f; }
html[data-theme="light"] .editor-doc-intro p,
html[data-theme="light"] .editor-doc-status,
html[data-theme="light"] .editor-doc-help { color:#655363; }
html[data-theme="light"] .editor-doc-preview { background:#fff; color:#302534; border-color:#e0bcd1; }
html[data-theme="light"] .editor-doc-action { background:#f3e7f0; color:#60344d; border-color:#dfb6cc; }
html[data-theme="light"] .editor-doc-generate { background:#a43c71; color:white; }
html[data-theme="light"] .editor-doc-download { background:#39705d; color:white; }
html[data-theme="light"] .editor-doc-warning { color:#82592a; }
@media (max-width:480px) {
  .editor-doc-dialog { padding:14px; width:calc(100vw - 12px); max-height:calc(100dvh - 12px); border-radius:12px; }
  .editor-doc-head { gap:8px; }
  .editor-doc-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .editor-doc-preview { padding:10px; max-height:330px; }
}
@media (prefers-reduced-motion:reduce) {
  .editor-doc-dialog::backdrop { backdrop-filter:none; }
}


/* M47-M49: public deployment QR. Canvas keeps four bright quiet-zone modules. */
.editor-qr-trigger {
  min-height:44px; padding:9px 12px; border-radius:10px;
  border:1px solid rgba(240,68,145,.4); background:#37213a;
  color:#fff3fb; font:inherit; font-size:12px; font-weight:700; cursor:pointer;
}
body:not(.builder-mode) .editor-qr-trigger {display:none !important;}
.editor-qr-trigger:hover {background:#572d49;}
.editor-qr-trigger:focus-visible,.editor-qr-dialog button:focus-visible {
  outline:3px solid #f04491; outline-offset:3px;
}
.editor-qr-dialog {
  position:fixed; inset:0; margin:auto; box-sizing:border-box; z-index:100;
  width:min(560px,calc(100vw - 24px)); max-height:calc(100dvh - 24px);
  padding:24px; overflow-y:auto; overscroll-behavior:contain;
  border:1px solid #75415e; border-radius:18px; background:#221922; color:#faf1f7;
  box-shadow:0 24px 80px rgba(0,0,0,.55);
}
.editor-qr-dialog:not([open]) {display:none !important;}
.editor-qr-dialog::backdrop {background:rgba(14,9,19,.78);}
.editor-qr-head {display:flex; justify-content:space-between; align-items:flex-start; gap:16px;}
.editor-qr-intro {display:grid; gap:7px; min-width:0;}
.editor-qr-eyebrow {color:#efa6c7; font-size:11px; font-weight:800; letter-spacing:.06em; text-transform:uppercase;}
.editor-qr-intro h2 {margin:0; font-size:clamp(21px,3vw,27px); line-height:1.2;}
.editor-qr-intro p {margin:0; color:#dcc5d4; font-size:13px; line-height:1.5;}
.editor-qr-action {
  min-height:44px; border:1px solid #734c65; border-radius:10px;
  padding:9px 13px; background:#3e2a40; color:#fff2f8;
  font:inherit; font-size:12px; font-weight:750; cursor:pointer;
}
.editor-qr-action:hover {background:#653651;}
.editor-qr-close {flex:none;}
.editor-qr-generate {background:#aa3570; border-color:#d96a9a;}
.editor-qr-actions {display:flex; flex-wrap:wrap; gap:9px; margin:18px 0 12px;}
.editor-qr-share-actions {justify-content:center; margin:14px 0 18px;}
.editor-qr-status,.editor-qr-help,.editor-qr-warning {
  font-size:12px; line-height:1.55; color:#dec7d7; margin:12px 0;
}
.editor-qr-image {display:grid; justify-items:center; padding:20px; background:#fff;
  border-radius:16px; border:1px solid #d7cccf; margin:16px auto 0; max-width:max-content;}
.editor-qr-canvas {display:block; max-width:100%; height:auto; image-rendering:pixelated;}
.editor-qr-url {margin:14px auto 0; max-width:100%; font:12px/1.55 ui-monospace,Consolas,monospace;
  overflow-wrap:anywhere; text-align:center; direction:ltr; unicode-bidi:plaintext; color:#f6c4df;}
.editor-qr-warning {border-inline-start:3px solid #e5b272; padding-inline-start:10px;}
html[dir="rtl"] .editor-qr-dialog {direction:rtl;}
html[data-theme="light"] .editor-qr-dialog {
  background:#fffafd; color:#312433; border-color:#e4bbd5;
  box-shadow:0 24px 70px rgba(36,18,33,.23);
}
html[data-theme="light"] .editor-qr-trigger {background:#f9edf5; color:#722f52;}
html[data-theme="light"] .editor-qr-eyebrow {color:#98486f;}
html[data-theme="light"] .editor-qr-intro p,
html[data-theme="light"] .editor-qr-status,
html[data-theme="light"] .editor-qr-help {color:#655363;}
html[data-theme="light"] .editor-qr-url {color:#7f335a;}
html[data-theme="light"] .editor-qr-action {background:#f3e7f0; color:#60344d; border-color:#dfb6cc;}
html[data-theme="light"] .editor-qr-generate {background:#a43c71; color:#fff;}
html[data-theme="light"] .editor-qr-warning {color:#82592a;}
@media(max-width:480px) {
  .editor-qr-dialog {padding:14px; width:calc(100vw - 12px);
    max-height:calc(100dvh - 12px); border-radius:12px;}
  .editor-qr-head {gap:8px;}
  .editor-qr-actions {display:grid; grid-template-columns:repeat(2,minmax(0,1fr));}
  .editor-qr-share-actions .editor-qr-action:last-child {grid-column:1/-1;}
  .editor-qr-image {padding:12px;}
}
@media(prefers-reduced-motion:reduce) {
  .editor-qr-dialog::backdrop {backdrop-filter:none;}
}


/* M50-M52: scope-aware, view-only progress cards, no claims or payouts. */
.editor-badges-trigger {
  min-height:44px; padding:9px 12px; border-radius:10px;
  border:1px solid rgba(240,68,145,.4); background:#37213a;
  color:#fff3fb; font:inherit; font-size:12px; font-weight:700; cursor:pointer;
}
body:not(.builder-mode) .editor-badges-trigger {display:none !important;}
.editor-badges-trigger:hover {background:#572d49;}
.editor-badges-trigger:focus-visible,.editor-badges-dialog button:focus-visible {
  outline:3px solid #f04491; outline-offset:3px;
}
.editor-badges-dialog {
  position:fixed; inset:0; margin:auto; box-sizing:border-box; z-index:100;
  width:min(760px,calc(100vw - 24px)); max-height:calc(100dvh - 24px);
  padding:24px; overflow-y:auto; overscroll-behavior:contain;
  border:1px solid #75415e; border-radius:18px; background:#221922; color:#faf1f7;
  box-shadow:0 24px 80px rgba(0,0,0,.55);
}
.editor-badges-dialog:not([open]) {display:none !important;}
.editor-badges-dialog::backdrop {background:rgba(14,9,19,.78);}
.editor-badges-head {display:flex; justify-content:space-between; align-items:flex-start; gap:16px;}
.editor-badges-intro {display:grid; gap:7px; min-width:0;}
.editor-badges-eyebrow {color:#efa6c7; font-size:11px; font-weight:800; letter-spacing:.06em; text-transform:uppercase;}
.editor-badges-intro h2 {margin:0; font-size:clamp(21px,3vw,27px); line-height:1.2;}
.editor-badges-intro p {margin:0; color:#dcc5d4; font-size:13px; line-height:1.5;}
.editor-badges-action {
  min-height:44px; border:1px solid #734c65; border-radius:10px;
  padding:9px 13px; background:#3e2a40; color:#fff2f8;
  font:inherit; font-size:12px; font-weight:750; cursor:pointer;
}
.editor-badges-action:hover {background:#653651;}
.editor-badges-close {flex:none;}
.editor-badges-scan {background:#aa3570; border-color:#d96a9a;}
.editor-badges-actions {display:flex; flex-wrap:wrap; gap:9px; margin:18px 0 12px;}
.editor-badges-status,.editor-badges-help,.editor-badges-warning {
  font-size:12px; line-height:1.55; color:#dec7d7; margin:12px 0;
}
.editor-badges-warning {border-inline-start:3px solid #e5b272; padding-inline-start:10px;}
.editor-badges-totals {display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin:18px 0;}
.editor-badges-total {display:grid; gap:6px; border:1px solid #644359; border-radius:11px; padding:13px; background:#312234;}
.editor-badges-total span {color:#ddc4d4; font-size:11px;}
.editor-badges-total strong {color:#fbc7df; font-size:22px; font-variant-numeric:tabular-nums;}
.editor-badges-list {display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px;}
.editor-badges-card {display:grid; gap:9px; border:1px solid #644359; border-radius:12px; padding:14px; background:#322535;}
.editor-badges-card[data-earned="true"] {border-color:#528973; background:#25362f;}
.editor-badges-card-head {display:flex; flex-wrap:wrap; gap:9px; align-items:center;}
.editor-badges-card-head strong {flex:1; min-width:0; font-size:13px;}
.editor-badges-icon {font-size:17px; color:#d8a3c3;}
.editor-badges-state {font-size:11px; color:#d2b9cc;}
.editor-badges-card[data-earned="true"] .editor-badges-state {color:#a3e9c5;}
.editor-badges-progress {width:100%; height:8px; border:0; border-radius:8px; accent-color:#da6aa0;}
.editor-badges-progress::-webkit-progress-bar {background:#5e4055; border-radius:8px;}
.editor-badges-progress::-webkit-progress-value {background:#da6aa0; border-radius:8px;}
.editor-badges-ratio {font:11px ui-monospace,Consolas,monospace; color:#d4bdce;}
html[dir="rtl"] .editor-badges-dialog {direction:rtl;}
html[data-theme="light"] .editor-badges-dialog {
  background:#fffafd; color:#312433; border-color:#e4bbd5;
  box-shadow:0 24px 70px rgba(36,18,33,.23);
}
html[data-theme="light"] .editor-badges-trigger {background:#f9edf5; color:#722f52;}
html[data-theme="light"] .editor-badges-eyebrow {color:#98486f;}
html[data-theme="light"] .editor-badges-intro p,
html[data-theme="light"] .editor-badges-status,
html[data-theme="light"] .editor-badges-help {color:#655363;}
html[data-theme="light"] .editor-badges-action {background:#f3e7f0; color:#60344d; border-color:#dfb6cc;}
html[data-theme="light"] .editor-badges-scan {background:#a43c71; color:#fff;}
html[data-theme="light"] .editor-badges-total,
html[data-theme="light"] .editor-badges-card {background:#faf2f8; border-color:#e2c5d7;}
html[data-theme="light"] .editor-badges-card[data-earned="true"] {background:#f0f8f3; border-color:#98c7aa;}
html[data-theme="light"] .editor-badges-total span,
html[data-theme="light"] .editor-badges-state,
html[data-theme="light"] .editor-badges-ratio {color:#6a5463;}
html[data-theme="light"] .editor-badges-total strong {color:#9a3c69;}
html[data-theme="light"] .editor-badges-card[data-earned="true"] .editor-badges-state {color:#286c48;}
@media(max-width:550px) {
  .editor-badges-dialog {padding:14px; width:calc(100vw - 12px);
    max-height:calc(100dvh - 12px); border-radius:12px;}
  .editor-badges-totals {grid-template-columns:1fr 1fr;}
  .editor-badges-list {grid-template-columns:1fr;}
}
@media(prefers-reduced-motion:reduce) {
  .editor-badges-dialog::backdrop {backdrop-filter:none;}
}


/* M53-M55: local estimator anchored in approved Agent budget caps. */
.editor-simulator-trigger {min-height:44px;padding:9px 12px;border-radius:10px;
  border:1px solid rgba(240,68,145,.4);background:#37213a;
  color:#fff3fb;font:inherit;font-size:12px;font-weight:700;cursor:pointer;}
body:not(.builder-mode) .editor-simulator-trigger {display:none !important;}
.editor-simulator-trigger:hover {background:#572d49;}
.editor-simulator-trigger:focus-visible,.editor-simulator-dialog :is(button,input):focus-visible {
  outline:3px solid #f04491;outline-offset:3px;}
.editor-simulator-dialog {position:fixed;inset:0;margin:auto;box-sizing:border-box;z-index:100;
  width:min(680px,calc(100vw - 24px));max-height:calc(100dvh - 24px);
  padding:24px;overflow-y:auto;overscroll-behavior:contain;
  border:1px solid #75415e;border-radius:18px;background:#221922;color:#faf1f7;
  box-shadow:0 24px 80px rgba(0,0,0,.55);}
.editor-simulator-dialog:not([open]) {display:none !important;}
.editor-simulator-dialog::backdrop {background:rgba(14,9,19,.78);}
.editor-simulator-head {display:flex;justify-content:space-between;align-items:flex-start;gap:16px;}
.editor-simulator-intro {display:grid;gap:7px;min-width:0;}
.editor-simulator-eyebrow {color:#efa6c7;font-size:11px;font-weight:800;
  letter-spacing:.06em;text-transform:uppercase;}
.editor-simulator-intro h2 {margin:0;font-size:clamp(21px,3vw,27px);line-height:1.2;}
.editor-simulator-intro p {margin:0;color:#dcc5d4;font-size:13px;line-height:1.5;}
.editor-simulator-action {min-height:44px;border:1px solid #734c65;border-radius:10px;
  padding:9px 13px;background:#3e2a40;color:#fff2f8;font:inherit;
  font-size:12px;font-weight:750;cursor:pointer;}
.editor-simulator-action:hover {background:#653651;}
.editor-simulator-close {flex:none;}
.editor-simulator-controls {display:grid;grid-template-columns:1fr 1fr;gap:15px;margin:20px 0;}
.editor-simulator-label {display:grid;gap:9px;font-size:12px;font-weight:650;}
.editor-simulator-label input {min-height:44px;min-width:0;box-sizing:border-box;
  padding:8px 12px;border-radius:9px;border:1px solid #734c65;background:#180f1d;color:#fff1f8;}
.editor-simulator-label input[type=range] {padding:0;accent-color:#e66fa6;}
.editor-simulator-percent {color:#f0bbd4;font-weight:700;}
.editor-simulator-results {display:grid;gap:10px;}
.editor-simulator-card {display:grid;gap:11px;padding:15px;border-radius:12px;
  border:1px solid #65435a;background:#322535;}
.editor-simulator-card-head,.editor-simulator-total {display:flex;align-items:center;
  flex-wrap:wrap;justify-content:space-between;gap:8px;}
.editor-simulator-card-head strong {font-size:14px;}
.editor-simulator-card-head span {font-size:12px;color:#ddc7d8;}
.editor-simulator-total span,.editor-simulator-ceiling {color:#e1cbdc;font-size:12px;}
.editor-simulator-total strong {color:#ffbfdc;font-size:21px;font-variant-numeric:tabular-nums;}
.editor-simulator-meter {width:100%;height:8px;border:0;accent-color:#dd699f;}
.editor-simulator-meter::-webkit-progress-bar {background:#5d4157;border-radius:8px;}
.editor-simulator-meter::-webkit-progress-value {background:#dd699f;border-radius:8px;}
.editor-simulator-ceiling {margin:0;}
.editor-simulator-help,.editor-simulator-warning {font-size:12px;line-height:1.55;color:#dfc6d8;margin:12px 0;}
.editor-simulator-warning {border-inline-start:3px solid #e5b272;padding-inline-start:10px;}
html[dir=rtl] .editor-simulator-dialog {direction:rtl;}
html[data-theme=light] .editor-simulator-dialog {background:#fffafd;color:#312433;
  border-color:#e4bbd5;box-shadow:0 24px 70px rgba(36,18,33,.23);}
html[data-theme=light] .editor-simulator-trigger {background:#f9edf5;color:#722f52;}
html[data-theme=light] .editor-simulator-eyebrow {color:#98486f;}
html[data-theme=light] .editor-simulator-intro p,html[data-theme=light] .editor-simulator-help,
html[data-theme=light] .editor-simulator-card-head span,html[data-theme=light] .editor-simulator-total span,
html[data-theme=light] .editor-simulator-ceiling {color:#655363;}
html[data-theme=light] .editor-simulator-label input {background:#fff;color:#302534;border-color:#d9b9ce;}
html[data-theme=light] .editor-simulator-percent,
html[data-theme=light] .editor-simulator-total strong {color:#97476d;}
html[data-theme=light] .editor-simulator-action {background:#f3e7f0;color:#60344d;border-color:#dfb6cc;}
html[data-theme=light] .editor-simulator-card {background:#faf2f8;border-color:#e2c5d7;}
html[data-theme=light] .editor-simulator-warning {color:#82592a;}
@media(max-width:550px) {
  .editor-simulator-dialog {padding:14px;width:calc(100vw - 12px);
    max-height:calc(100dvh - 12px);border-radius:12px;}
  .editor-simulator-controls {grid-template-columns:1fr;}
}
@media(prefers-reduced-motion:reduce) {
  .editor-simulator-dialog::backdrop {backdrop-filter:none;}
}


/* M56-M59: local-only security findings with clear severity but no source text. */
.editor-security-trigger {min-height:44px; padding:9px 12px; border-radius:10px;
  border:1px solid rgba(240,68,145,.4); background:#37213a;
  color:#fff3fb; font:inherit; font-size:12px; font-weight:700; cursor:pointer}
body:not(.builder-mode) .editor-security-trigger {display:none!important}
.editor-security-trigger:hover {background:#572d49}
.editor-security-trigger:focus-visible,.editor-security-dialog button:focus-visible {
  outline:3px solid #f04491; outline-offset:3px}
.editor-security-dialog {position:fixed; inset:0; margin:auto; box-sizing:border-box; z-index:100;
  width:min(760px,calc(100vw - 24px)); max-height:calc(100dvh - 24px);
  padding:24px; overflow-y:auto; overscroll-behavior:contain;
  border:1px solid #75415e; border-radius:18px; background:#221922; color:#faf1f7;
  box-shadow:0 24px 80px rgba(0,0,0,.55)}
.editor-security-dialog:not([open]) {display:none!important}
.editor-security-dialog::backdrop {background:rgba(14,9,19,.78)}
.editor-security-head {display:flex; justify-content:space-between; align-items:flex-start; gap:16px}
.editor-security-intro {display:grid; gap:7px; min-width:0}
.editor-security-eyebrow {color:#efa6c7; font-size:11px; font-weight:800; letter-spacing:.06em; text-transform:uppercase}
.editor-security-intro h2 {margin:0; font-size:clamp(21px,3vw,27px); line-height:1.2}
.editor-security-intro p {margin:0; color:#dcc5d4; font-size:13px; line-height:1.5}
.editor-security-action {min-height:44px; border:1px solid #734c65; border-radius:10px;
  padding:9px 13px; background:#3e2a40; color:#fff2f8; font:inherit; font-size:12px; font-weight:750;
  cursor:pointer}
.editor-security-action:hover {background:#653651}
.editor-security-close {flex:none}
.editor-security-scan {background:#aa3570; border-color:#d96a9a}
.editor-security-actions {display:flex; flex-wrap:wrap; gap:9px; margin:18px 0 12px}
.editor-security-status,.editor-security-help,.editor-security-warning {font-size:12px; line-height:1.55;
  color:#dec7d7; margin:12px 0}
.editor-security-totals {display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin:18px 0}
.editor-security-total {display:grid; gap:6px; border:1px solid #644359;
  border-radius:11px; padding:13px; background:#312234}
.editor-security-total span {color:#ddc4d4; font-size:11px}
.editor-security-total strong {color:#fbc7df; font-size:22px; font-variant-numeric:tabular-nums}
.editor-security-list {display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); list-style:none; gap:10px; padding:0}
.editor-security-finding {display:grid; gap:9px; border:1px solid #644359;
  border-inline-start:4px solid #bf935a; border-radius:12px; padding:14px; background:#322535}
.editor-security-finding[data-severity="critical"] {border-inline-start-color:#f28ea9}
.editor-security-finding[data-severity="high"] {border-inline-start-color:#eda975}
.editor-security-finding-head {display:flex; align-items:center; flex-wrap:wrap; justify-content:space-between; gap:8px}
.editor-security-finding-head strong {font-size:13px}
.editor-security-severity {font-size:11px; color:#f0c19d}
.editor-security-path {font:11px/1.6 ui-monospace,Consolas,monospace; color:#e8cadb; overflow-wrap:anywhere}
.editor-security-suggestion {color:#dec9d6; font-size:12px; line-height:1.5; margin:0}
.editor-security-ok {border:1px solid #528973; background:#25362f;
  border-radius:12px; padding:14px; color:#b4efd0}
.editor-security-warning {border-inline-start:3px solid #e5b272; padding-inline-start:10px}
html[dir="rtl"] .editor-security-dialog {direction:rtl}
html[data-theme="light"] .editor-security-dialog {background:#fffafd; color:#312433; border-color:#e4bbd5;
  box-shadow:0 24px 70px rgba(36,18,33,.23)}
html[data-theme="light"] .editor-security-trigger {background:#f9edf5; color:#722f52}
html[data-theme="light"] .editor-security-eyebrow {color:#98486f}
html[data-theme="light"] .editor-security-intro p,html[data-theme="light"] .editor-security-status,
html[data-theme="light"] .editor-security-help,html[data-theme="light"] .editor-security-total span,
html[data-theme="light"] .editor-security-path,html[data-theme="light"] .editor-security-suggestion {color:#655363}
html[data-theme="light"] .editor-security-action {background:#f3e7f0; color:#60344d; border-color:#dfb6cc}
html[data-theme="light"] .editor-security-scan {background:#a43c71; color:#fff}
html[data-theme="light"] .editor-security-total,html[data-theme="light"] .editor-security-finding {
  background:#faf2f8; border-color:#e2c5d7}
html[data-theme="light"] .editor-security-total strong {color:#9a3c69}
html[data-theme="light"] .editor-security-warning {color:#845d35}
html[data-theme="light"] .editor-security-ok {background:#f0f8f3; border-color:#98c7aa; color:#216748}
@media(max-width:550px){
  .editor-security-dialog {padding:14px; width:calc(100vw - 12px);
    max-height:calc(100dvh - 12px); border-radius:12px}
  .editor-security-totals {grid-template-columns:repeat(2,minmax(0,1fr))}
  .editor-security-list {grid-template-columns:1fr}
}
@media(prefers-reduced-motion:reduce){
  .editor-security-dialog::backdrop {backdrop-filter:none}
}

/* M61: maintain 44px minimum targets on the original free-tool composer actions. */
.editor-prompt-doctor-button,.editor-prompt-doctor-add,.editor-milestone-trigger {min-height:44px;}
.editor-prompt-doctor-toolbar {max-width:100%; box-sizing:border-box;}

/* Mouse Lock / FPS test mode: a discreet Preview toolbar button, shown only for games. */
.editor-icon-button.preview-mouse-lock-button {width:auto; min-width:34px; padding:0 10px; display:inline-flex; align-items:center; gap:7px; white-space:nowrap; font-size:12px; font-weight:650}
.preview-mouse-lock-button[hidden] {display:none}
.preview-mouse-lock-button[aria-pressed="true"] {border-color:#8e3f55; background:#3a2229; color:#ffd9e2}
.preview-mouse-lock-button:focus-visible {outline:2px solid #f25074; outline-offset:2px}
.preview-mouse-lock-icon {position:relative; flex:0 0 auto; width:10px; height:15px; border:1.6px solid currentColor; border-radius:6px 6px 7px 7px; box-sizing:border-box}
.preview-mouse-lock-icon::after {content:""; position:absolute; top:2px; left:50%; width:1.6px; height:4px; border-radius:2px; background:currentColor; transform:translateX(-50%)}
.preview-mouse-lock-button[aria-pressed="true"] .preview-mouse-lock-icon {color:#f25074}
.editor-stage {position:relative}
.preview-mouse-lock-hint {position:absolute; z-index:6; inset-block-start:14px; inset-inline-start:50%; transform:translateX(-50%); width:max-content; max-width:min(440px,calc(100% - 28px));
  display:grid; justify-items:center; gap:4px; padding:10px 16px 11px; border:1px solid rgba(242,80,116,.42); border-radius:14px;
  background:rgba(17,16,20,.86); color:#f4f1f5; box-shadow:0 14px 40px rgba(0,0,0,.35); backdrop-filter:blur(10px); pointer-events:none; text-align:center}
html[dir="rtl"] .preview-mouse-lock-hint {transform:translateX(50%)}
.preview-mouse-lock-hint[hidden] {display:none}
.preview-mouse-lock-head {display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:8px}
.preview-mouse-lock-badge {font-size:10.5px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; color:#ff8fab}
.preview-mouse-lock-chip {padding:2px 8px; border-radius:999px; font-size:10.5px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; background:rgba(242,80,116,.16); color:#ffc2d0}
.preview-mouse-lock-hint[data-mouse-lock-state="locked"] .preview-mouse-lock-chip {background:rgba(70,179,126,.2); color:#9be3bd}
.preview-mouse-lock-hint[data-mouse-lock-state="free"] .preview-mouse-lock-chip {background:rgba(255,255,255,.1); color:#e4e1e7}
.preview-mouse-lock-hint:is([data-mouse-lock-state="refused"],[data-mouse-lock-state="blocked"],[data-mouse-lock-state="unsupported"]) {border-color:rgba(229,178,114,.55)}
.preview-mouse-lock-hint:is([data-mouse-lock-state="refused"],[data-mouse-lock-state="blocked"],[data-mouse-lock-state="unsupported"]) .preview-mouse-lock-chip {background:rgba(229,178,114,.18); color:#f3cf9f}
.preview-mouse-lock-keys[hidden] {display:none}
.preview-mouse-lock-look {max-width:36ch; font-size:11.5px; line-height:1.4; color:#f3cf9f}
.preview-mouse-lock-look[data-mouse-look="ok"] {color:#9be3bd}
.preview-mouse-lock-look[hidden],.preview-mouse-lock-action[hidden] {display:none}
.preview-mouse-lock-action {pointer-events:auto; margin-top:4px; min-height:32px; padding:5px 12px; border:1px solid #8e3f55; border-radius:9px; background:#3a2229; color:#ffd9e2; font-size:12px; font-weight:650; cursor:pointer}
.preview-mouse-lock-action:hover {background:#4a2a33}
.preview-mouse-lock-action:focus-visible {outline:2px solid #f25074; outline-offset:2px}
/* Locked: a small chip in the corner that fades, so it never covers the game. */
.preview-mouse-lock-hint[data-mouse-lock-state="locked"] {inset-inline-start:auto; inset-inline-end:14px; transform:none; padding:7px 12px; gap:2px; opacity:.92; animation:preview-mouse-lock-settle 2.6s ease 1.4s forwards}
html[dir="rtl"] .preview-mouse-lock-hint[data-mouse-lock-state="locked"] {transform:none}
.preview-mouse-lock-hint[data-mouse-lock-state="locked"] .preview-mouse-lock-title {font-size:12px}
@keyframes preview-mouse-lock-settle {to {opacity:.5}}
.preview-mouse-lock-button[data-mouse-lock-state="locked"] .preview-mouse-lock-icon {color:#91c8a3}
.preview-mouse-lock-title {font-size:13px; line-height:1.35}
.preview-mouse-lock-keys {font-size:11.5px; color:#bdb8c2; direction:ltr; unicode-bidi:isolate}
/* P9: the preview container in fullscreen, with the game filling it and the hint on top. */
.preview-mouse-lock-fullscreen[hidden] {display:none}
.preview-mouse-lock-fullscreen-icon {font-size:15px; line-height:1}
.preview-mouse-lock-fullscreen[aria-pressed="true"] {border-color:#8e3f55; background:#3a2229; color:#ffd9e2}
.preview-mouse-lock-fullscreen:focus-visible {outline:2px solid #f25074; outline-offset:2px}
.preview-mouse-lock-fullscreen-host:fullscreen {position:relative; transition:none !important; width:100vw !important; height:100vh !important; max-width:none !important; min-height:0 !important; margin:0 !important; border:0 !important; border-radius:0 !important; background:#000 !important}
.preview-mouse-lock-fullscreen-host:fullscreen > iframe {display:block; width:100% !important; height:100% !important; max-width:none !important; transform:none !important; border:0 !important}
.preview-mouse-lock-fullscreen-host::backdrop {background:#000}
@media (max-width:760px) {
  .preview-mouse-lock-label {position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap}
  .editor-icon-button.preview-mouse-lock-button {padding:0; width:34px; justify-content:center}
}
/* P11: touch screens get 44 px targets; Windows high contrast keeps every outline. */
@media (pointer:coarse) {
  .editor-icon-button.preview-mouse-lock-button,.preview-mouse-lock-fullscreen {min-width:44px; min-height:44px}
  .preview-mouse-lock-action {min-height:44px}
}
@media (forced-colors:active) {
  .preview-mouse-lock-hint {border:1px solid CanvasText; background:Canvas; color:CanvasText; forced-color-adjust:auto}
  .preview-mouse-lock-chip {border:1px solid CanvasText}
  .preview-mouse-lock-button[aria-pressed="true"],.preview-mouse-lock-fullscreen[aria-pressed="true"] {outline:2px solid Highlight}
}
@media (prefers-reduced-motion:reduce) {
  .preview-mouse-lock-hint {backdrop-filter:none}
  .preview-mouse-lock-hint[data-mouse-lock-state="locked"] {animation:none; opacity:.7}
}

/* Drag an image in (builder-image-drop.mjs): a glowing zone over the preview
   while an image is dragged, and the dropped image as a chip in the composer. */
.builder-drop-zone {position:absolute; inset:12px; z-index:60; display:grid; place-items:center; padding:18px; border:2px dashed rgba(255,122,180,.55); border-radius:18px;
  background:rgba(14,11,17,.66); -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px); color:#f6dbe8; text-align:center; animation:builder-drop-in .18s ease-out;
  transition:border-color .18s ease, background-color .18s ease, box-shadow .22s ease}
.builder-drop-zone[hidden] {display:none}
.builder-drop-zone-inner {display:grid; justify-items:center; gap:8px; max-width:320px; pointer-events:none}
.builder-drop-zone-icon {width:58px; height:58px; display:grid; place-items:center; border-radius:18px; background:rgba(240,68,145,.14); color:#ff8fc2; box-shadow:inset 0 0 0 1px rgba(255,122,180,.3)}
.builder-drop-zone-icon svg {width:28px; height:28px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round}
.builder-drop-zone-title {color:#fff5fa; font-size:17px; font-weight:780; letter-spacing:-.01em}
.builder-drop-zone-note {color:#c9b6c3; font-size:12px; line-height:1.45}
.builder-drop-zone.is-over {border-style:solid; border-color:#ff63ad; background:linear-gradient(rgba(240,68,145,.2), rgba(240,68,145,.2)), rgba(14,11,17,.72);
  box-shadow:0 0 0 4px rgba(240,68,145,.18), 0 0 46px rgba(240,68,145,.38), inset 0 0 64px rgba(240,68,145,.26)}
.builder-drop-zone.is-over .builder-drop-zone-icon {background:#f04491; color:#fff; box-shadow:0 10px 26px rgba(240,68,145,.45); animation:builder-drop-bob .9s ease-in-out infinite}
.builder-drop-zone.is-over .builder-drop-zone-title {color:#ffffff}
body.builder-mode .editor-composer.builder-drop-ready {border-style:dashed; border-color:rgba(255,122,180,.5)}
body.builder-mode .editor-composer.builder-drop-over {border-style:solid; border-color:#ff63ad; box-shadow:0 0 0 3px rgba(240,68,145,.18), 0 0 30px rgba(240,68,145,.28)}
body.builder-mode .editor-composer.builder-drop-landed {border-color:rgba(255,122,180,.6); box-shadow:0 0 0 3px rgba(240,68,145,.14), 0 14px 36px rgba(0,0,0,.28)}
.builder-drop-tray {display:grid; gap:6px; margin:0 0 8px; min-width:0}
.builder-drop-tray[hidden] {display:none}
.builder-drop-chips {display:flex; flex-wrap:wrap; gap:6px; min-width:0; margin:0; padding:0; list-style:none}
.builder-drop-chips:empty {display:none}
.builder-drop-chip {flex:1 1 220px; min-width:0; max-width:100%; box-sizing:border-box; display:grid; grid-template-columns:36px minmax(0,1fr) 28px; align-items:center; gap:4px 9px;
  padding:5px; border:1px solid rgba(255,122,180,.3); border-radius:12px; background:rgba(240,68,145,.08)}
.builder-drop-chip:is([data-state="studio"],[data-state="device"]) {border-color:rgba(233,184,113,.38); background:rgba(233,184,113,.07)}
.builder-drop-thumb {width:36px; height:36px; overflow:hidden; display:grid; place-items:center; border-radius:8px; background:#2a2230; box-shadow:inset 0 0 0 1px rgba(255,255,255,.08)}
.builder-drop-thumb img {display:block; width:100%; height:100%; object-fit:cover}
.builder-drop-glyph {color:#ea77b5; font-size:19px; line-height:1}
.builder-drop-chip.is-landing .builder-drop-thumb > * {visibility:hidden}
.builder-drop-copy {display:grid; min-width:0; line-height:1.3}
.builder-drop-name {overflow:hidden; color:#fbeef6; font-size:12px; font-weight:720; text-overflow:ellipsis; white-space:nowrap}
.builder-drop-state {overflow:hidden; color:#bfaab8; font-size:10.5px; text-overflow:ellipsis; white-space:nowrap}
.builder-drop-chip[data-state="ready"] .builder-drop-state {color:#8fe0b4}
.builder-drop-chip:is([data-state="studio"],[data-state="device"]) .builder-drop-state {color:#f0c98f}
body.builder-mode .editor-composer button.builder-drop-remove {width:28px; height:28px; min-height:0; display:grid; place-items:center; padding:0; border-radius:8px;
  background:rgba(255,255,255,.06) !important; color:#d8c4d1; font-size:17px; line-height:1; cursor:pointer}
body.builder-mode .editor-composer button.builder-drop-remove:hover {background:rgba(240,68,145,.2) !important; color:#ffffff !important}
.builder-drop-more {grid-column:1 / -1; display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; min-width:0; padding:1px 2px 2px}
.builder-drop-hint {flex:1 1 190px; min-width:0; color:#dccab6; font-size:11px; line-height:1.4}
body.builder-mode .editor-composer button.builder-drop-action {min-height:30px; padding:0 11px; border-radius:8px; background:rgba(240,68,145,.18) !important;
  box-shadow:inset 0 0 0 1px rgba(255,122,180,.4) !important; color:#ffe3ef; font-size:11.5px; font-weight:740; white-space:nowrap; cursor:pointer}
body.builder-mode .editor-composer button.builder-drop-action:hover {background:rgba(240,68,145,.3) !important; color:#ffffff !important}
body.builder-mode .editor-composer :is(button.builder-drop-remove,button.builder-drop-action):focus-visible {outline:2px solid #f387c0 !important; outline-offset:2px}
.builder-drop-note {margin:0; color:#c9b6c3; font-size:11.5px; line-height:1.4}
.builder-drop-note[hidden] {display:none}
.builder-drop-note.is-error {color:#ffb3c0}
.builder-drop-ghost {position:fixed; z-index:2000; display:grid; place-items:center; overflow:hidden; border-radius:14px; background:#2a2230; pointer-events:none;
  box-shadow:0 22px 40px -12px rgba(0,0,0,.55), 0 0 0 2px rgba(255,255,255,.72)}
.builder-drop-ghost img {display:block; width:100%; height:100%; object-fit:cover}
.builder-drop-ghost .builder-drop-glyph {font-size:30px}
body.builder-mode .asset-bridge-card[draggable="true"] {cursor:grab}
body.builder-mode .asset-bridge-card[draggable="true"]:active {cursor:grabbing}
html[dir="rtl"] body.builder-mode .builder-drop-tray {direction:rtl}
@keyframes builder-drop-in {from {opacity:0}}
@keyframes builder-drop-bob {0%, 100% {transform:none} 50% {transform:translateY(-4px)}}
@media (max-width:760px) {
  .builder-drop-zone {inset:8px}
  .builder-drop-chip {flex-basis:100%}
}
@media (prefers-reduced-motion:reduce) {
  .builder-drop-zone, .builder-drop-zone.is-over .builder-drop-zone-icon {animation:none; transition:none}
}

/* Room for a separate Premium toggle and a fully readable Heart quote. */
body.builder-mode .editor-composer-footer>div{flex-wrap:wrap;gap:5px 8px}
body.builder-mode .editor-composer-footer .agent-premium-switch{flex:0 0 auto;min-height:32px}
body.builder-mode .editor-composer-footer .editor-heart-estimate{flex:1 0 100%;overflow:visible;text-overflow:clip;white-space:normal;text-align:start;padding-inline:5px}
body.builder-mode .editor-composer .agent-premium-note{margin:6px 8px 0}

/* Before/after over the live preview (builder-compare.mjs): the picture from
   before the message, cut off at the line; the live new version shows past it. */
.builder-compare {
  position: absolute; inset: 0; z-index: 30; overflow: hidden;
  cursor: ew-resize; touch-action: none; user-select: none;
}
.builder-compare-before {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: top center; pointer-events: none;
  clip-path: inset(0 calc(100% - var(--compare-at, 50%)) 0 0);
}
.builder-compare-line {
  position: absolute; top: 0; bottom: 0; left: var(--compare-at, 50%); width: 2px; margin-left: -1px;
  background: #fff; box-shadow: 0 0 0 1px rgba(23,21,27,.35), 0 0 18px rgba(240,68,145,.55);
}
.builder-compare-knob {
  position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px;
  display: grid; place-items: center; padding: 0; border: 2px solid #fff; border-radius: 50%;
  background: #f04491; color: #fff; font: inherit; font-size: 15px; font-weight: 800; letter-spacing: -1px;
  box-shadow: 0 6px 22px rgba(0,0,0,.35); cursor: ew-resize;
}
.builder-compare-knob:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.builder-compare-tag, .builder-compare-note {
  position: absolute; padding: 5px 11px; border-radius: 999px;
  background: rgba(23,21,27,.82); color: #fff5fb; font-size: 12px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,.22); pointer-events: none; transition: opacity .2s ease;
}
.builder-compare-tag { top: 14px; }
.builder-compare-tag-before { left: 14px; }
.builder-compare-tag-after { right: 56px; background: #f04491; }
.builder-compare-hide-before .builder-compare-tag-before,
.builder-compare-hide-after .builder-compare-tag-after { opacity: 0; }
.builder-compare-note { bottom: 14px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-weight: 600; }
.builder-compare-close {
  position: absolute; top: 12px; right: 14px;
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(23,21,27,.82); color: #fff; font: inherit; font-size: 18px; line-height: 1; cursor: pointer;
}
.builder-compare-close:focus-visible { outline: 3px solid #f04491; outline-offset: 2px; }

/* A broken preview (builder-crash.mjs): a short glitch over the app, then it
   greys out under a card that says in plain words what happened. */
.builder-canvas.builder-crash-glitch .builder-preview-frame {
  animation: builder-crash-jitter .09s steps(2) infinite;
  filter: drop-shadow(4px 0 0 rgba(255,46,99,.78)) drop-shadow(-4px 0 0 rgba(0,214,255,.72)) saturate(1.7);
}
.builder-canvas.builder-crash-glitch::before, .builder-canvas.builder-crash-glitch::after {
  content: ""; position: absolute; left: 0; right: 0; z-index: 31; pointer-events: none;
  background: rgba(255,46,99,.14);
  -webkit-backdrop-filter: hue-rotate(170deg) saturate(4) contrast(1.35); backdrop-filter: hue-rotate(170deg) saturate(4) contrast(1.35);
}
.builder-crash-fx {
  position: absolute; inset: 0; z-index: 31; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.1) 0 1px, rgba(0,0,0,.08) 1px 2px, transparent 2px 4px);
  mix-blend-mode: difference; animation: builder-crash-flicker .12s steps(2) infinite;
}
@keyframes builder-crash-flicker { 0% { opacity: .9; transform: translateY(0); } 100% { opacity: .45; transform: translateY(2px); } }
.builder-canvas.builder-crash-glitch::before { top: 22%; height: 9%; animation: builder-crash-slice .18s steps(3) infinite; }
.builder-canvas.builder-crash-glitch::after { top: 61%; height: 6%; animation: builder-crash-slice .23s steps(3) infinite reverse; }
@keyframes builder-crash-jitter {
  0% { transform: translate(0,0); }
  25% { transform: translate(-6px,2px) skewX(4deg); }
  50% { transform: translate(5px,-2px); }
  75% { transform: translate(-3px,1px) skewX(-6deg); }
  100% { transform: translate(2px,0); }
}
@keyframes builder-crash-slice {
  0% { transform: translateX(-30%); }
  50% { transform: translateX(25%); }
  100% { transform: translateX(-10%); }
}
.builder-canvas.builder-crash-broken .builder-preview-frame { filter: grayscale(1) blur(1.5px); opacity: .4; transition: opacity .3s ease, filter .3s ease; }
.builder-crash-card {
  position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 32; max-width: 460px; margin: 0 auto;
  padding: 16px 16px 14px; border: 1px solid rgba(242,80,116,.38); border-radius: 14px;
  background: rgba(23,21,27,.96); color: #fff5fb; box-shadow: 0 18px 44px rgba(0,0,0,.42);
  max-height: calc(100% - 32px); overflow: auto;
  transform: translateY(calc(100% + 24px)); opacity: 0;
  transition: transform .45s cubic-bezier(.2,.9,.3,1.15), opacity .25s ease;
}
.builder-crash-card.is-open { transform: none; opacity: 1; }
.builder-crash-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.builder-crash-icon { width: 20px; height: 20px; flex: none; fill: #ff6788; }
.builder-crash-title { margin: 0; font-size: 15px; font-weight: 800; color: #ff8fab; }
.builder-crash-text { margin: 0 0 10px; font-size: 13px; line-height: 1.45; color: #f3e7ee; }
.builder-crash-details { margin: 0 0 12px; font-size: 12px; color: #bfb3ba; }
.builder-crash-details summary { cursor: pointer; }
.builder-crash-code {
  margin: 6px 0 0; max-height: 120px; overflow: auto; padding: 8px 10px; border-radius: 8px;
  background: rgba(0,0,0,.35); color: #f3e7ee; font: 11.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap; overflow-wrap: anywhere; text-align: left;
}
.builder-crash-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.builder-crash-note {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 32;
  padding: 6px 12px; border-radius: 999px; background: rgba(23,21,27,.86); color: #fff5fb;
  font-size: 12px; font-weight: 700; white-space: nowrap; pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.22); animation: builder-crash-note-in .3s ease-out both;
}
.builder-crash-note.is-fixed { color: #7ef0b0; }
.builder-crash-note.is-working::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-inline-end: 7px; border-radius: 50%;
  background: #f04491; vertical-align: 1px; animation: builder-crash-pulse 1s ease-in-out infinite;
}
@keyframes builder-crash-note-in { from { opacity: 0; transform: translate(-50%,-6px); } to { opacity: 1; transform: translate(-50%,0); } }
@keyframes builder-crash-pulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .builder-canvas.builder-crash-glitch .builder-preview-frame,
  .builder-canvas.builder-crash-glitch::before, .builder-canvas.builder-crash-glitch::after,
  .builder-crash-note, .builder-crash-note.is-working::before { animation: none; }
  .builder-crash-fx { display: none; }
  .builder-crash-card { transition: none; }
}
/* The Agent repairs it: the preview stays grey while a scan passes over it,
   then the colour sweeps back in behind a green edge when the repaired
   version loads, and the check in "Your app works again" pops. */
.builder-canvas.builder-crash-repairing .builder-preview-frame { filter: grayscale(.85) blur(1px); opacity: .55; transition: opacity .3s ease, filter .3s ease; }
.builder-crash-scan {
  position: absolute; inset: 0; z-index: 30; pointer-events: none;
  background: linear-gradient(180deg, transparent 0 40%, rgba(240,68,145,.1) 50%, rgba(255,154,198,.42) 59.4%, rgba(255,214,232,.75) 59.8%, transparent 60% 100%);
  background-size: 100% 250%; background-position: 0 100%;
  animation: builder-crash-scan 1.9s cubic-bezier(.45,0,.55,1) infinite;
}
@keyframes builder-crash-scan { from { background-position: 0 100%; } to { background-position: 0 0; } }
.builder-crash-heal {
  position: absolute; inset: 0; z-index: 31; pointer-events: none;
  -webkit-backdrop-filter: grayscale(1) brightness(.8); backdrop-filter: grayscale(1) brightness(.8);
  animation: builder-crash-heal 1.1s cubic-bezier(.6,0,.25,1) both;
}
.builder-crash-heal.builder-crash-heal-edge {
  inset: 0 auto 0 0; width: 3px; -webkit-backdrop-filter: none; backdrop-filter: none;
  background: #7ef0b0; box-shadow: 0 0 18px 5px rgba(126,240,176,.55);
  animation: builder-crash-heal-edge 1.1s cubic-bezier(.6,0,.25,1) both;
}
@keyframes builder-crash-heal { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 0 0 100%); } }
@keyframes builder-crash-heal-edge { 0% { left: 0; opacity: 1; } 88% { opacity: 1; } 100% { left: calc(100% - 3px); opacity: 0; } }
.builder-crash-note.is-fixed { box-shadow: 0 0 0 1px rgba(126,240,176,.42), 0 6px 18px rgba(0,0,0,.24); }
.builder-crash-check { display: inline-block; animation: builder-crash-check .55s cubic-bezier(.25,1.6,.45,1) .12s both; }
@keyframes builder-crash-check { from { opacity: 0; transform: scale(.2) rotate(-45deg); } }
@media (prefers-reduced-motion: reduce) {
  .builder-crash-scan, .builder-crash-check { animation: none; }
  .builder-crash-scan { background: rgba(240,68,145,.06); }
  .builder-crash-heal { display: none; }
}

/* Mission Control: a quiet operational rail, not a competing chat card. */
.mission-control{margin:8px 0 12px;border:1px solid var(--line,#474353);border-radius:14px;background:color-mix(in srgb,var(--surface,#201d2b) 92%,transparent);color:var(--text,#f6f2ff);overflow:hidden;max-width:100%}
.mission-control[hidden]{display:none!important}
.mission-control-toggle{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:10px 14px;border:0;background:transparent;color:inherit;text-align:start;cursor:pointer}
.mission-control-toggle:focus-visible,.mission-control-content button:focus-visible{outline:2px solid #bb89e9;outline-offset:-3px}
.mission-control-mark{font-size:21px;color:#ea7eaa}.mission-control-stat{margin-inline-start:auto;font-variant-numeric:tabular-nums;color:var(--muted,#baaec8)}.mission-control-chevron{opacity:.7}
.mission-control-content{display:grid;gap:12px;padding:0 14px 14px;font-size:13px;max-height:310px;overflow:auto}
.mission-control-content[hidden]{display:none!important}
.mission-control-state{margin:0;color:var(--muted,#baaec8)}
.mission-control-meter{height:5px;border-radius:99px;background:color-mix(in srgb,currentColor 13%,transparent);overflow:hidden}.mission-control-meter>span{display:block;height:100%;background:#b678d5;border-radius:inherit;transition:width .2s ease}
.mission-control-tasks,.mission-control-steps{margin:0;padding:0;list-style:none;display:grid;gap:7px}.mission-control-tasks li,.mission-control-steps li{display:flex;align-items:start;gap:8px;min-width:0}.mission-control-tasks li>span:last-child,.mission-control-steps li>span:nth-child(2){overflow-wrap:anywhere}.mission-control-steps code{margin-inline-start:auto;max-width:40%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted,#baaec8)}.mission-control-tasks .is-done,.mission-control-steps .is-done{opacity:.7}.mission-control-steps .is-error{color:#ef9a98}
.mission-control-caption{font-size:12px}.mission-control-files{display:flex;flex-wrap:wrap;gap:7px}
.mission-control-file{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border:1px solid color-mix(in srgb,currentColor 24%,transparent);border-radius:8px;padding:6px 9px;background:transparent;color:inherit;font:inherit;font-size:12px;cursor:default}
/* M5: chronological source records use the editor's existing theme colors. */
.mission-control-history{list-style:none;display:grid;gap:9px;margin:0;padding:0}
.mission-control-history-item{min-width:0;display:grid;gap:6px;padding:9px 10px;border:1px solid color-mix(in srgb,currentColor 13%,transparent);border-radius:10px}
.mission-control-history-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;color:var(--muted,#baaec8);font-size:11px}
.mission-control-current{font-weight:700;color:var(--text,#f6f2ff)}
.mission-control-history-paths{display:flex;gap:5px 10px;flex-wrap:wrap;min-width:0}
.mission-control-history-path{display:inline-flex;gap:3px;align-items:center;max-width:100%;min-width:0;font-size:12px}
.mission-control-history-path code{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mission-control-operation{font-weight:700;color:var(--muted,#baaec8)}
.mission-control-continue{justify-self:start;border:1px solid #ba80d5;border-radius:10px;padding:9px 12px;background:color-mix(in srgb,#9f5ac8 22%,transparent);color:inherit;cursor:pointer}.mission-control-footnote{font-size:11px;color:var(--muted,#baaec8);margin:0}
/* M6: resilient operational rail; semantic state, touch target and bidi-safe file paths. */
.mission-control-continue{min-height:44px;max-width:100%;overflow-wrap:anywhere}
.mission-control-sr-only{position:absolute!important;width:1px!important;height:1px!important;margin:-1px!important;padding:0!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.mission-control :is(.mission-control-file,.mission-control-steps code,.mission-control-history-path code){direction:ltr;unicode-bidi:isolate;text-align:left}
.mission-control-history-item,.mission-control-history-paths,.mission-control-steps li{min-width:0}
.mission-control[data-connection="lost"] .mission-control-state{color:#ffb8c6;font-weight:650}
html[data-theme="light"] .mission-control[data-connection="lost"] .mission-control-state{color:#922047}
@media(max-width:520px){.mission-control-toggle{gap:7px}.mission-control-history-head{justify-content:flex-start}.mission-control-continue{width:100%;text-align:center}.mission-control-content{overscroll-behavior:contain}}

@media(max-width:520px){.mission-control{margin:6px 0 9px}.mission-control-content{max-height:240px}.mission-control-steps code{max-width:28%}}
@media(prefers-reduced-motion:reduce){.mission-control-meter>span{transition:none}}


/* M8-M16: source-scoped collaboration and selective simulation corrections.
   One continuous operator panel with the project's existing BaseHeart signal. */
.sim-comparison{display:grid;gap:6px;border:1px solid rgba(166,133,205,.25);border-radius:14px;padding:12px 14px;background:rgba(165,115,198,.055)}
/* M10: keep the explicit retest price and the coverage caveat in the same flow. */
.sim-retest-notice{margin:0;padding:9px 12px;border-inline-start:3px solid #ba80d5;border-radius:7px;background:color-mix(in srgb,currentColor 5%,transparent);font-size:12px;line-height:1.5;color:var(--bh-ink-2,#c9c0d6)}
.sim-comparison[data-comparable="false"]{border-style:dashed}
.sim-comparison-warning{font-size:12px;line-height:1.5;font-weight:650;color:var(--bh-ink-2,#c9c0d6)}
.sim-comparison-coverage{font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
html[data-theme="light"] .sim-retest-notice{background:rgba(125,70,160,.055);color:#554566}
@media(max-width:520px){.sim-retest-notice{padding:9px}.sim-comparison{padding:10px 12px}}

.sim-comparison strong{font-size:12px;line-height:1.4}
.sim-comparison p{color:var(--bh-ink-2,#bdb8c9);font-size:13px;font-variant-numeric:tabular-nums}
.sim-comparison small{color:var(--bh-ink-3,#8a8497);font-size:11.5px;line-height:1.45}
.sim-issue-head .sim-issue-select{grid-column:1 / -1;display:inline-flex;align-items:center;gap:8px;justify-self:start;min-height:32px;padding:3px 7px;border-radius:8px;background:rgba(240,68,145,.08);color:var(--bh-ink-2,#c4bdd0);font-size:11.5px;font-weight:680;cursor:pointer}
.sim-issue-select input{width:16px;height:16px;accent-color:#f04491;cursor:pointer}
.sim-issue-select:focus-within{outline:2px solid #f48ebd;outline-offset:2px}
.sim-selection-guide{margin:10px 0 2px;font-size:12px;line-height:1.5;color:var(--bh-ink-2,#c6bece);overflow-wrap:anywhere}
.sim-fix-count{font-variant-numeric:tabular-nums;min-width:1.5ch}
.sim-issue-occurrences{margin:6px 0 0;font-size:12px;font-weight:650;color:var(--bh-ink-2,#c6bece)}
.sim-missing-steps{margin:6px 0 0;font-size:12px;line-height:1.5;color:var(--bh-ink-2,#c6bece)}
.sim-issue-select input:focus-visible{outline:2px solid #f48ebd;outline-offset:3px}

.sim-fix-button:disabled{opacity:.43;cursor:not-allowed;box-shadow:none!important}
/* M9: a read-only review of the exact Agent draft and its existing Heart cap. */
.sim-fix-review{display:grid;gap:12px;min-width:0}
.sim-fix-review-pricing{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin:0}
.sim-fix-review-price{display:grid;gap:4px;min-width:0;border:1px solid color-mix(in srgb,currentColor 14%,transparent);border-radius:11px;padding:10px 12px;background:color-mix(in srgb,currentColor 3%,transparent)}
.sim-fix-review-price dt{font-size:11px;color:var(--bh-ink-2,var(--muted,#b8b0c3));font-weight:650}
.sim-fix-review-price dd{margin:0;min-width:0;color:var(--bh-ink,var(--text,#f7f4fa));font-size:13px;font-weight:740;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.sim-fix-review-note,.sim-fix-review-warning{font-size:12px;line-height:1.5;color:var(--bh-ink-2,var(--muted,#b8b0c3));margin:0}
.sim-fix-review-warning{color:#ffb6c8;font-weight:660}
.sim-fix-review-heading{font-size:13px;line-height:1.4;margin:0;color:var(--bh-ink,var(--text,#f7f4fa))}
.sim-fix-review-prompt{margin:0;max-width:100%;max-height:min(32vh,240px);overflow:auto;overscroll-behavior:contain;white-space:pre-wrap;overflow-wrap:anywhere;unicode-bidi:plaintext;border:1px solid color-mix(in srgb,currentColor 20%,transparent);border-radius:12px;padding:12px;font:12px/1.58 ui-monospace,SFMono-Regular,Consolas,monospace;color:var(--bh-ink,var(--text,#f7f4fa));background:color-mix(in srgb,currentColor 3%,transparent)}
.sim-fix-review-prompt:focus-visible{outline:2px solid #bb89e9;outline-offset:2px}
html[data-theme="light"] .sim-fix-review-warning{color:#9c204a}
@media(max-width:520px){.sim-fix-review-pricing{grid-template-columns:1fr 1fr;gap:6px}.sim-fix-review-price{padding:8px}.sim-fix-review-prompt{max-height:200px}}

.workspace-live{--work-line:color-mix(in srgb,currentColor 15%,transparent);--work-muted:var(--bh-ink-2,#bcb6c7);display:grid;gap:12px;min-width:0;margin-top:14px;border-top:1px solid var(--work-line);padding-top:16px;color:var(--bh-ink,#f3eff6)}
.workspace-live h3,.workspace-live p{margin:0}
.workspace-live-title{display:flex;gap:8px;align-items:center;font-size:14px;font-weight:750;letter-spacing:-.012em}
.workspace-live-title::before{content:"";width:8px;height:8px;border-radius:50%;background:#ea598c;box-shadow:0 0 0 3px rgba(234,89,140,.13)}
.workspace-live-hint{color:var(--work-muted);line-height:1.55;font-size:12px}
.workspace-live-lease-hint,.workspace-live-lease-expiry{margin:0;font-size:12px;line-height:1.5;color:var(--work-muted)}
.workspace-live-lease-expiry{font-variant-numeric:tabular-nums}
.workspace-live-locked code,.workspace-live-lease-expiry{unicode-bidi:isolate}
.workspace-live-locked code{direction:ltr;text-align:left}
.workspace-live-editor,.workspace-live-reviews,.workspace-live-locked{display:grid;gap:11px;min-width:0;padding:12px;border:1px solid var(--work-line);border-radius:14px;background:color-mix(in srgb,currentColor 3%,transparent)}
.workspace-live-editor>strong,.workspace-live-reviews>strong,.workspace-live-locked>strong{font-size:12px;letter-spacing:.008em}
.workspace-live-select{width:100%;min-height:41px;padding:8px;border:1px solid var(--work-line);border-radius:9px;color:inherit;background:var(--bh-surface,#272330);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}
.workspace-live-label{display:grid;gap:7px;font-size:12px;font-weight:650}
.workspace-live-review-note{min-height:72px;max-height:180px;width:100%;resize:vertical;border:1px solid var(--work-line);border-radius:10px;background:var(--bh-surface,#1b1921);color:inherit;padding:10px;font:12px/1.5 inherit}
.workspace-live-review-note::placeholder{color:var(--work-muted);opacity:1}
.workspace-live-review-note-text,.workspace-live-review-hash{font-size:12px;line-height:1.55;color:var(--work-muted);overflow-wrap:anywhere}
.workspace-live-review-hash{font-variant-numeric:tabular-nums;unicode-bidi:isolate}
html[data-theme="light"] .workspace-live-review-note{background:#fff;color:#292034}
html[data-theme="light"] .workspace-live-status[data-error="true"]{color:#962045}
@media(max-width:520px){.workspace-live-review-note{min-height:86px}}

.workspace-live-code{width:100%;min-width:0;resize:vertical;min-height:156px;max-height:340px;padding:12px;border:1px solid var(--work-line);border-radius:10px;background:var(--bh-surface,#1b1921);color:inherit;font:12px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace;tab-size:2;direction:ltr;text-align:left}
.workspace-live-actions{display:flex;gap:8px;flex-wrap:wrap}
.workspace-live button{min-height:44px;padding:8px 12px;border-radius:10px;border:1px solid var(--work-line);background:color-mix(in srgb,currentColor 5%,transparent);color:inherit;font-size:12px;font-weight:700;cursor:pointer}
.workspace-live button.workspace-live-primary{background:#e84991;border-color:#e84991;color:#fff}
.workspace-live button:disabled{opacity:.55;cursor:not-allowed}
.workspace-live button:focus-visible,.workspace-live :is(select,textarea,summary):focus-visible{outline:2px solid #e96a9c;outline-offset:2px}
.workspace-live-review{border:1px solid var(--work-line);border-radius:10px;padding:0;overflow:hidden;min-width:0}
.workspace-live-review summary{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:43px;padding:10px;cursor:pointer;font-size:12px;font-weight:700}
.workspace-live-review summary>*{min-width:0;overflow-wrap:anywhere}
.workspace-live-review summary small{flex-shrink:0;color:var(--work-muted);font-size:12px}
.workspace-live-review> :not(summary){margin:8px 10px}
.workspace-live-filename{display:block;font-size:11px;word-break:break-all;color:var(--work-muted)}
.workspace-live-patch{font-size:11px;line-height:1.5;padding:10px;border-radius:9px;border:1px solid var(--work-line);background:color-mix(in srgb,currentColor 4%,transparent);direction:ltr;white-space:pre-wrap;overflow-wrap:anywhere;max-height:190px;overflow:auto}
.workspace-live-reservation{display:flex;gap:8px;align-items:center;justify-content:space-between;flex-wrap:wrap;font-size:12px;min-width:0}
.workspace-live-reservation code{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;max-width:100%;direction:ltr;unicode-bidi:isolate;text-align:left;flex:1 1 150px}
.workspace-live-reservation span{color:var(--work-muted);white-space:normal;min-width:0;max-width:100%;overflow-wrap:anywhere}
.workspace-live-status{font-size:12px;font-weight:600;color:var(--work-muted)}
.workspace-live-status[data-error="true"]{color:#f2a4b8}
.dialog-card:has(.workspace-live){max-height:calc(100dvh - 40px);overflow-y:auto;overscroll-behavior:contain}
html[data-theme="light"] .workspace-live{--work-muted:#5c5367;color:#292034}
html[data-theme="light"] .workspace-live :is(.workspace-live-editor,.workspace-live-reviews,.workspace-live-locked){background:rgba(139,92,175,.035)}
html[data-theme="light"] .workspace-live-select,html[data-theme="light"] .workspace-live-code{background:#fff;color:#292034}
html[data-theme="light"] .sim-comparison{background:rgba(150,72,155,.045)}
@media(max-width:520px){
  .workspace-live{gap:10px;padding-top:12px}
  .workspace-live-editor,.workspace-live-reviews,.workspace-live-locked{padding:10px;border-radius:12px}
  .workspace-live-review summary{flex-wrap:wrap}
  .workspace-live-actions button{flex:1 1 auto}
  .sim-issue-head .sim-issue-select{font-size:11px}
}
@media(prefers-reduced-motion:reduce){
  .workspace-live :is(button,textarea,select),.sim-issue-select input{animation:none!important;transition:none!important}
}

/* The Agent thinks and writes. Three hearts beat in turn while it thinks and
   faster while it works; the status shimmers while it thinks; new steps slide
   in; a file it saved flashes once; new reply text rises in; and the changed
   files come in one after another when the reply lands. Only real events. */
.builder-think { display: inline-flex; align-items: center; gap: 1px; }
.builder-think i { font-style: normal; font-size: 7.5px; line-height: 1; color: var(--heart-strong, #f25074); opacity: .35; animation: builder-think-beat 1.1s ease-in-out infinite; }
.builder-think i:nth-child(2) { animation-delay: .16s; }
.builder-think i:nth-child(3) { animation-delay: .32s; }
.builder-working[data-agent-phase="working"] .builder-think i,
.builder-working[data-agent-phase="writing"] .builder-think i { animation-duration: .7s; }
.builder-working[data-agent-phase="writing"] .builder-work-signal { border-color: rgba(240,68,145,.42); box-shadow: 0 0 14px rgba(240,68,145,.22); }
.builder-working[data-agent-phase="thinking"] .builder-status-text {
  background: linear-gradient(90deg, #f0eaf2 0 38%, #ff9ac6 50%, #f0eaf2 62% 100%);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: builder-think-shimmer 2.4s linear infinite;
}
.builder-work-steps .builder-tool-enter { animation: builder-step-in .32s cubic-bezier(.2,.7,.2,1) both; }
.builder-work-steps .builder-tool-written { animation: builder-step-written 1.2s cubic-bezier(.2,.7,.2,1); }
.builder-working .builder-work-steps .builder-tool-written .builder-tool-icon { animation: builder-step-check .45s cubic-bezier(.25,1.45,.45,1), bh-code-done .56s ease-out both; }
.builder-work-steps .builder-tool-written .builder-tool-detail { animation: builder-step-path 1.2s ease-out; }
.builder-live-text .builder-live-chunk { animation: builder-chunk-in .5s cubic-bezier(.2,.7,.2,1) both; }
.builder-just-done .builder-file-row { animation: builder-file-in .5s cubic-bezier(.2,.7,.2,1) both; }
.builder-just-done .builder-file-row:nth-child(2) { animation-delay: .06s; }
.builder-just-done .builder-file-row:nth-child(3) { animation-delay: .12s; }
.builder-just-done .builder-file-row:nth-child(4) { animation-delay: .18s; }
.builder-just-done .builder-file-row:nth-child(5) { animation-delay: .24s; }
.builder-just-done .builder-file-row:nth-child(n+6) { animation-delay: .3s; }
@keyframes builder-think-beat { 0%, 60%, 100% { transform: scale(.8); opacity: .35; } 30% { transform: scale(1.35); opacity: 1; } }
@keyframes builder-think-shimmer { from { background-position: 100% 0; } to { background-position: -160% 0; } }
@keyframes builder-step-in { from { opacity: 0; transform: translateX(-6px); } }
@keyframes builder-step-written { 0% { background: rgba(240,68,145,.17); box-shadow: inset 2px 0 #f04491; } 100% { background: transparent; box-shadow: inset 2px 0 transparent; } }
@keyframes builder-step-check { from { transform: scale(.3); opacity: 0; } }
@keyframes builder-step-path { 0% { color: #ff9ac6; background: rgba(240,68,145,.16); } }
@keyframes builder-chunk-in { from { opacity: 0; transform: translateY(4px); } }
@keyframes builder-file-in { 0% { opacity: 0; transform: translateY(5px); box-shadow: inset 2px 0 #f04491; } 60% { opacity: 1; transform: none; } 100% { box-shadow: inset 2px 0 transparent; } }
/* A failed check flashes red and the hearts turn amber while the Agent repairs;
   when the same check passes again its row sweeps green and the failed rows
   now say "problems fixed". */
.builder-working[data-agent-repair="on"] .builder-think i { color: #f5a524; }
.builder-working[data-agent-repair="on"] .builder-work-signal { border-color: rgba(245,165,36,.45); box-shadow: 0 0 14px rgba(245,165,36,.2); }
.builder-work-steps .builder-tool-problem { animation: builder-step-problem 1s ease-out; }
.builder-working .builder-work-steps .builder-tool-problem .builder-tool-icon { display: inline-block; animation: builder-step-shake .42s ease-in-out, bh-code-done .56s ease-out both; }
.builder-tool-resolved .builder-tool-icon { color: #8f8f89; }
.builder-tool-resolved .builder-tool-result { color: #7ef0b0; }
.builder-work-steps .builder-tool-resolved .builder-tool-result { animation: builder-step-resolved .5s cubic-bezier(.2,.7,.2,1) both; }
.builder-work-steps .builder-tool-fixed { animation: builder-step-fixed 1.4s cubic-bezier(.2,.7,.2,1); }
.builder-working .builder-work-steps .builder-tool-fixed .builder-tool-icon { display: inline-block; animation: builder-step-check .45s cubic-bezier(.25,1.45,.45,1), bh-code-done .56s ease-out both; }
@keyframes builder-step-problem { 0% { background: rgba(240,90,90,.2); box-shadow: inset 2px 0 #f05a5a; } 100% { background: transparent; box-shadow: inset 2px 0 transparent; } }
@keyframes builder-step-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
@keyframes builder-step-resolved { from { opacity: 0; transform: translateY(3px); } }
@keyframes builder-step-fixed { 0% { background: rgba(87,209,151,.22); box-shadow: inset 2px 0 #57d197; } 100% { background: transparent; box-shadow: inset 2px 0 transparent; } }
@media (prefers-reduced-motion: reduce) {
  .builder-think i, .builder-working[data-agent-phase="thinking"] .builder-status-text, .builder-work-steps .builder-tool-enter,
  .builder-work-steps .builder-tool-written, .builder-working .builder-work-steps .builder-tool-written .builder-tool-icon,
  .builder-work-steps .builder-tool-written .builder-tool-detail, .builder-live-text .builder-live-chunk, .builder-just-done .builder-file-row,
  .builder-work-steps .builder-tool-problem, .builder-working .builder-work-steps .builder-tool-problem .builder-tool-icon, .builder-work-steps .builder-tool-resolved .builder-tool-result,
  .builder-work-steps .builder-tool-fixed, .builder-working .builder-work-steps .builder-tool-fixed .builder-tool-icon { animation: none; }
  .builder-think i { opacity: .8; }
}
