:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #111827;
  --surface: #1f2937;
  --surface-muted: #273548;
  --border: #475569;
  --border-strong: #91a0b5;
  --ink: #f3f4f6;
  --muted: #c0cad6;
  --accent: #60a5fa;
  --accent-strong: #93c5fd;
  --accent-soft: #243f5f;
  --accent-ink: #0b1220;
  --error: #ff8a80;
  --error-soft: #4a2426;
  --focus: #7dd3fc;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --sans: "Segoe UI", "Helvetica Neue", "Arial Nova", Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --operations-width: 280px;
  --recipe-width: 520px;
  --input-height: calc((100% - var(--splitter-size)) / 2);
  --splitter-size: 10px;
  background: var(--background);
  color: var(--ink);
  font: 14px/1.45 var(--sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root[data-theme="light"] {
  color-scheme: light;
  --background: #edf1f4;
  --surface: #ffffff;
  --surface-muted: #f8fafb;
  --border: #cfd8df;
  --border-strong: #7c8d99;
  --ink: #1f2933;
  --muted: #657582;
  --accent: #1976d2;
  --accent-strong: #125ea7;
  --accent-soft: #e6f0fb;
  --accent-ink: #ffffff;
  --error: #b23a2a;
  --error-soft: #fde9e5;
  --focus: #005fcc;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

:root[data-theme="warm"] {
  color-scheme: light;
  color-scheme: light;
  --background: #f3eee4;
  --surface: #fffdf8;
  --surface-muted: #faf4ea;
  --border: #d7c8b4;
  --border-strong: #826d58;
  --ink: #2c241c;
  --muted: #6d5b4b;
  --accent: #99510f;
  --accent-strong: #713806;
  --accent-soft: #f4e3d2;
  --accent-ink: #ffffff;
  --error: #a83228;
  --error-soft: #fbe5df;
  --focus: #005fcc;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--background);
  overscroll-behavior: none;
}

.boot-splash {
  align-items: center;
  background:
    linear-gradient(135deg, var(--background), var(--surface-muted));
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 100;
}

.boot-splash-card {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 260px;
  padding: 24px 30px;
}

.boot-mark {
  fill: var(--surface-muted);
  height: 72px;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3px;
  width: 120px;
}

.boot-mark text {
  fill: var(--accent-strong);
  font: 700 16px var(--mono);
  stroke: none;
  text-anchor: middle;
}

.boot-product {
  color: var(--accent-strong);
  font-size: 16px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.boot-stage {
  color: var(--muted);
  font-size: 12px;
  min-height: 1.5em;
  text-align: center;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
h4,
h5,
p,
pre {
  margin: 0;
}

label {
  font-weight: 650;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.workbench-shell {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.workspace-layout {
  display: flex;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}

.pane {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.operations-pane {
  flex: 0 0 var(--operations-width);
  min-width: 280px;
}

.recipe-pane {
  flex: 0 0 var(--recipe-width);
  min-width: 320px;
}

.io-stack {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  min-width: 360px;
  overflow: hidden;
}

.input-pane {
  flex: 0 0 var(--input-height);
  min-height: 180px;
}

.output-pane {
  flex: 1 1 auto;
  min-height: 180px;
}

.pane-header,
.pane-toolbar,
.action-strip {
  align-items: center;
  background: var(--surface-muted);
  display: flex;
  flex: 0 0 auto;
  gap: 8px 12px;
  justify-content: space-between;
  padding: 8px 10px;
}

.pane-header,
.pane-toolbar {
  border-bottom: 1px solid var(--border);
}

.pane-header {
  min-height: 45px;
}

.pane-header h1,
.pane-header h2 {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.pane-header h1 {
  align-items: baseline;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.product-name {
  color: var(--accent-strong);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.hub-link {
  align-items: center;
  color: var(--accent-strong);
  display: inline-flex;
  flex: 0 0 auto;
  height: 26px;
  justify-content: center;
  width: 26px;
}

.hub-link svg {
  fill: none;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2px;
  width: 18px;
}

.hub-link:hover {
  background: var(--accent-soft);
}

.pane-header-status {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  min-width: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pane-actions {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
}

.output-header-actions {
  align-items: center;
  display: flex;
  flex: 1 1 auto;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
}

.recipe-header-actions {
  align-items: center;
  display: flex;
  flex: 1 1 auto;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
}

.recipe-header-state {
  display: grid;
  flex: 1 1 160px;
  gap: 1px;
  line-height: 1.1;
  min-width: 0;
}

.recipe-header-state .pane-header-status {
  line-height: 1.1;
}

.output-header-state {
  display: grid;
  flex: 1 1 120px;
  gap: 1px;
  line-height: 1.1;
  min-width: 0;
}

.output-header-state .pane-header-status {
  line-height: 1.1;
}

.output-header-controls {
  align-items: center;
  display: flex;
  flex: 0 1 280px;
  gap: 6px;
  min-width: 0;
}

.output-header-controls select,
.output-header-controls input {
  min-width: 0;
  padding-block: 4px;
}

.output-header-controls select {
  flex: 1 1 92px;
}

.output-header-controls input {
  flex: 1 1 108px;
}

.output-header-controls #download {
  flex: 0 0 auto;
}

.instrumentation-badge {
  align-items: center;
  background: var(--error);
  border-radius: 50%;
  color: var(--surface);
  display: inline-flex;
  font-size: 10px;
  height: 16px;
  justify-content: center;
  line-height: 1;
  width: 16px;
}

#toggle-instrumentation.has-run-error {
  background: var(--error-soft);
  border-color: var(--error);
  color: var(--error);
}

.instrumentation-drawer {
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: -8px 0 24px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 100%;
  position: fixed;
  right: 0;
  top: 0;
  width: min(440px, 92vw);
  z-index: 20;
}

#settings-dialog {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
  color: var(--ink);
  margin: auto;
  max-height: calc(100dvh - 32px);
  padding: 0;
  width: min(360px, calc(100vw - 32px));
}

#settings-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.settings-header {
  align-items: center;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 52px;
  padding: 9px 12px;
}

.settings-header h2 {
  font-size: 15px;
}

.settings-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.settings-group {
  border: 1px solid var(--border);
  display: grid;
  gap: 8px;
  padding: 10px;
}

.settings-group h3 {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.settings-group select {
  width: 100%;
}

.settings-group button {
  justify-self: start;
}

#settings-status {
  color: var(--muted);
  min-height: 1.45em;
}

.instrumentation-header {
  align-items: center;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex: 0 0 auto;
  gap: 12px;
  justify-content: space-between;
  min-height: 52px;
  padding: 9px 12px;
}

.instrumentation-header h2 {
  font-size: 15px;
}

.instrumentation-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px;
}

.instrumentation-section {
  border: 1px solid var(--border);
  min-width: 0;
}

.instrumentation-section + .instrumentation-section {
  margin-top: 10px;
}

.instrumentation-section h3 {
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 7px 9px;
  text-transform: uppercase;
}

.instrumentation-section > ol,
.instrumentation-section > pre {
  margin: 0;
  max-height: 240px;
  overflow: auto;
  padding: 9px;
}

#cache-report {
  font: 12px/1.5 var(--mono);
  max-height: none;
  overflow: visible;
  overflow-wrap: anywhere;
  padding-inline-start: 32px;
  white-space: normal;
}

#cache-report > li + li {
  margin-top: 4px;
}

.pane-toolbar {
  background: var(--surface);
  justify-content: flex-start;
  min-height: 43px;
}

.pane-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.palette-body,
.recipe-body,
.output-body {
  padding: 10px;
}

.output-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-input,
input,
select,
textarea {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--ink);
  max-width: 100%;
  min-height: 34px;
  padding: 7px 9px;
}

.search-input {
  width: 100%;
}

.source-file-chip,
.source-file-facts {
  align-items: center;
  display: flex;
}

.source-editor {
  background: transparent;
  border-radius: 0;
  flex: 1 1 auto;
  font: 13px/1.55 var(--mono);
  margin: 8px 10px 10px;
  min-height: 0;
  padding: 10px;
  resize: none;
  width: calc(100% - 20px);
}

.source-file-card {
  flex: 1 1 auto;
  margin: 10px 10px 0;
  min-height: 0;
  overflow: auto;
}

.source-file-chip {
  background: var(--surface-muted);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  gap: 10px;
  justify-content: space-between;
  padding: 9px;
}

.source-file-facts {
  flex-wrap: wrap;
  gap: 5px 10px;
  min-width: 0;
}

.source-file-facts strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-file-facts span {
  color: var(--muted);
  font-size: 11px;
}

.source-file-preview {
  margin-top: 10px;
  text-align: center;
}

.source-file-preview img {
  image-orientation: from-image;
  max-height: 100%;
  max-width: 100%;
}

.input-status,
.output-status {
  align-items: center;
  background: var(--surface-muted);
  border-top: 1px solid var(--border);
  color: var(--muted);
  display: flex;
  flex: 0 0 auto;
  font-size: 11px;
  gap: 10px;
  justify-content: space-between;
  min-height: 34px;
  padding: 4px 10px;
}

.input-measures,
.output-measures,
.input-status-actions,
.output-status-actions,
.input-wrap-control,
.output-wrap-control,
.output-view-switch {
  align-items: center;
  display: flex;
}

.input-measures,
.output-measures {
  flex-wrap: wrap;
  gap: 4px 12px;
  min-width: 0;
}

.input-status-actions,
.output-status-actions {
  flex: 0 0 auto;
  gap: 8px;
}

.input-wrap-control,
.output-wrap-control {
  font-weight: 650;
  gap: 5px;
}

.input-wrap-control input,
.output-wrap-control input {
  min-height: 16px;
  padding: 0;
  width: auto;
}

.input-status button,
.output-status button {
  min-height: 26px;
  padding: 3px 7px;
}

.output-status {
  align-items: flex-start;
  flex-wrap: wrap;
}

.output-measures {
  min-height: 26px;
}

.output-status-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.output-view-switch {
  gap: 2px;
}

.output-view-switch button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.copy-output-status {
  min-width: 0;
}

.input-pane.is-file-drop-target {
  box-shadow:
    inset 0 0 0 3px var(--accent),
    var(--shadow);
}

.download-name-error {
  color: var(--error);
  flex: 0 0 auto;
  font-size: 12px;
}

.download-name-error:empty {
  display: none;
}

.splitter {
  background: transparent;
  flex: 0 0 var(--splitter-size);
  position: relative;
  touch-action: none;
}

.splitter::before,
.splitter::after {
  background: var(--border);
  border-radius: 999px;
  content: "";
  pointer-events: none;
  position: absolute;
  transition:
    background-color 140ms ease,
    opacity 140ms ease;
}

.splitter::before {
  inset: 8px 3px;
  opacity: 0.35;
}

.splitter::after {
  background: var(--border-strong);
  inset: 12px 4px;
}

.splitter-vertical {
  cursor: col-resize;
}

.splitter-horizontal {
  cursor: row-resize;
}

.splitter-horizontal::before {
  inset: 3px 8px;
}

.splitter-horizontal::after {
  inset: 4px 12px;
}

.splitter:hover::after,
.splitter.is-active::after,
.splitter:focus-visible::after {
  background: var(--accent);
}

body.is-resizing {
  user-select: none;
}

body.is-resizing-columns,
body.is-resizing-columns * {
  cursor: col-resize !important;
}

body.is-resizing-rows,
body.is-resizing-rows * {
  cursor: row-resize !important;
}

.palette-group + .palette-group {
  margin-top: 14px;
}

.palette-group h2,
.sharing h3 {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 7px;
  text-transform: uppercase;
}

.block-palette {
  list-style: none;
  margin: 0;
  padding: 0;
}

.control-list,
.block-palette {
  display: grid;
  gap: 5px;
}

.block-palette > li:not(.preset-category),
.preset-category-list > li {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  gap: 5px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 7px;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    opacity 140ms ease;
}

.block-palette > li:not(.preset-category):has(button + button),
.preset-category-list > li:has(button + button) {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.block-palette > li:not(.preset-category):hover,
.preset-category-list > li:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.preset-category {
  border: 1px solid var(--border);
  list-style: none;
}

.preset-category + .preset-category {
  margin-top: -1px;
}

.preset-category-toggle {
  background: var(--surface-muted);
  border: 0;
  border-radius: 0;
  justify-content: space-between;
  min-height: 34px;
  text-align: left;
  width: 100%;
}

.preset-category-toggle::after {
  color: var(--muted);
  content: "▾";
}

.preset-category-toggle[aria-expanded="false"]::after {
  content: "▸";
}

.preset-category-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.preset-category-list > li {
  border-width: 1px 0 0;
}

[data-drag-preset],
[data-drag-flow],
[data-drag-template],
[data-drag-node],
[data-drag-preset] *,
[data-drag-flow] *,
[data-drag-template] *,
[data-drag-node] * {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  cursor: grab;
  user-select: none;
}

[data-drag-preset][data-armed],
[data-drag-flow][data-armed],
[data-drag-template][data-armed],
[data-drag-node][data-armed] {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}

html[data-dragging="pointer"] [data-drag-preset],
html[data-dragging="pointer"] [data-drag-flow],
html[data-dragging="pointer"] [data-drag-template],
html[data-dragging="pointer"] [data-drag-node],
html[data-dragging="pointer"] [data-drag-preset] *,
html[data-dragging="pointer"] [data-drag-flow] *,
html[data-dragging="pointer"] [data-drag-template] *,
html[data-dragging="pointer"] [data-drag-node] * {
  cursor: grabbing;
}

.pipeline {
  min-width: 0;
}

.pipeline-drag-hint {
  background: var(--surface-muted);
  border: 1px dashed var(--border-strong);
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 8px;
  padding: 7px 9px;
}

.pipeline-root-label,
.cache-evidence {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.pipeline-root-label {
  margin-bottom: 6px;
}

.pipeline-surface {
  border-inline-start: 2px solid var(--border);
  display: grid;
  gap: 4px;
  min-width: 0;
  padding-inline-start: 7px;
}

.drop-target {
  background: var(--surface-muted);
  border: 1px dashed var(--border-strong);
  color: var(--ink);
  min-height: 30px;
  overflow: hidden;
  padding: 4px 6px;
  position: relative;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.drop-target[data-active-drop="true"] {
  background: var(--accent-soft);
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 2px var(--surface);
  min-height: 36px;
}

.pipeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--accent);
  min-width: 0;
  padding: 8px;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    opacity 140ms ease;
}

.pipeline-card:hover {
  border-color: var(--border-strong);
}

.pipeline-card[aria-current="true"] {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent-soft);
}

.pipeline-card > header,
.fork-branch > header {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.step-title {
  flex: 1 1 150px;
  min-width: 0;
  overflow: hidden;
  padding: 4px 2px;
  text-align: left;
  text-overflow: ellipsis;
}

.step-title[role="button"] {
  border-radius: 3px;
}

.icon-button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px;
  width: 28px;
}

.control-icon {
  fill: none;
  height: 16px;
  pointer-events: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 16px;
}

.disclosure-control .control-icon {
  transition: transform 140ms ease;
}

.disclosure-control[aria-expanded="true"] .control-icon {
  transform: rotate(90deg);
}

.pipeline-card-body {
  border-top: 1px solid var(--border);
  margin-block: 8px;
  padding-top: 8px;
}

.argument-form {
  display: grid;
  gap: 8px;
}

.custom-binding-editor {
  border-top: 1px solid var(--border);
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding-top: 9px;
}

.custom-binding-editor h4 {
  font-size: 12px;
  margin: 0;
}

.custom-binding-list {
  display: grid;
  gap: 5px;
}

.custom-binding-row {
  align-items: center;
  display: grid;
  gap: 5px;
  grid-template-columns:
    minmax(82px, 0.8fr)
    minmax(90px, 1.2fr)
    auto
    auto;
}

.custom-binding-row code {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}

.custom-binding-add {
  grid-template-columns:
    minmax(82px, 0.8fr)
    minmax(90px, 1.2fr)
    auto;
}

.custom-binding-add [data-custom-binding-name] {
  grid-column: 1 / -1;
}

#saved-palette .custom-binding-editor {
  grid-column: 1 / -1;
}

.argument-row {
  display: grid;
  gap: 4px;
}

.argument-row[data-argument-row-type="boolean"] {
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr);
}

.argument-row[data-argument-row-type="boolean"] small {
  grid-column: 1 / -1;
}

.argument-row small,
.section-copy {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.argument-row input[type="checkbox"] {
  justify-self: start;
  min-height: 16px;
  width: auto;
}

.argument-row textarea,
[data-code-node] {
  font: 13px/1.55 var(--mono);
  min-height: 160px;
  resize: vertical;
  width: 100%;
}

.fork-branches {
  display: grid;
  gap: 9px;
  margin-top: 8px;
}

.fork-branch {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  min-width: 0;
  padding: 7px;
}

.fork-branch > header {
  margin-bottom: 6px;
}

.inline-control {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.step-actions {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding: 8px;
}

.step-actions h4 {
  font-size: 12px;
}

#recipe-document,
#variables,
#registers {
  font: 12px/1.5 var(--mono);
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  width: 100%;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.action-strip {
  border-top: 1px solid var(--border);
  justify-content: center;
}

.recipe-action-strip {
  flex-wrap: wrap;
}

.recipe-action-strip > * {
  flex: 0 0 auto;
  white-space: nowrap;
}

.auto-run-control,
.share-option-control {
  align-items: center;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  gap: 6px;
}

.auto-run-control input,
.share-option-control input {
  min-height: 16px;
  padding: 0;
  width: auto;
}

.share-options {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.share-input-description {
  font-weight: 400;
}

.auto-run-state {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

button,
#download {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--ink);
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  justify-content: center;
  min-height: 30px;
  padding: 4px 9px;
  text-decoration: none;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

button:hover,
#download:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.primary-action {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  min-width: 90px;
}

.primary-action:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

#authoring-error,
#render-error {
  min-height: 1.5em;
}

#authoring-error,
#render-error {
  color: var(--error);
}

#result-state,
#status,
#summary {
  color: var(--muted);
  font-weight: 650;
}

#summary {
  margin: 0;
}

#preview {
  border: 1px solid var(--border-strong);
  flex: 1 1 auto;
  margin-top: 8px;
  min-height: 80px;
  overflow: auto;
  padding: 10px;
}

#preview img {
  display: block;
  image-rendering: pixelated;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

#preview pre {
  font: 13px/1.55 var(--mono);
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

#preview.output-nowrap pre {
  overflow-wrap: normal;
  white-space: pre;
}

#download:not([href]) {
  color: var(--muted);
  pointer-events: none;
}

ol {
  overflow-wrap: anywhere;
  padding-inline-start: 22px;
}

@media (max-width: 1195px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body {
    overscroll-behavior-y: auto;
  }

  .workbench-shell {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }

  .workspace-layout {
    flex-direction: column;
    gap: 8px;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }

  .splitter {
    display: none;
  }

  .operations-pane,
  .recipe-pane,
  .io-stack {
    flex: 0 0 auto;
    min-width: 0;
    width: 100%;
  }

  .operations-pane {
    height: clamp(18rem, 42vh, 30rem);
    height: clamp(18rem, 42dvh, 30rem);
  }

  .recipe-pane {
    height: clamp(24rem, 58vh, 42rem);
    height: clamp(24rem, 58dvh, 42rem);
  }

  .io-stack {
    gap: 8px;
    min-height: auto;
    overflow: visible;
  }

  .input-pane,
  .output-pane {
    flex: 0 0 auto;
    min-height: 0;
    width: 100%;
  }

  .input-pane {
    height: clamp(16rem, 38vh, 26rem);
    height: clamp(16rem, 38dvh, 26rem);
  }

  .output-pane {
    height: clamp(22rem, 55vh, 40rem);
    height: clamp(22rem, 55dvh, 40rem);
  }
}

@media (max-width: 520px) {
  .pane-header,
  .pane-toolbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .pane-header-status {
    flex: 1 1 100%;
    max-width: none;
    text-align: left;
  }

  .output-header-state {
    flex: 1 1 100%;
  }

  .output-header-actions {
    flex: 1 1 100%;
    flex-wrap: wrap;
  }

  .output-header-controls {
    flex: 1 1 100%;
  }

  .action-strip {
    justify-content: flex-start;
  }

  .inline-control {
    grid-template-columns: minmax(0, 1fr);
  }

  .custom-binding-row,
  .custom-binding-add {
    align-items: stretch;
    grid-template-columns: minmax(0, 1fr);
  }

  .inline-control button {
    justify-self: start;
  }

  .block-palette > li:not(.preset-category):has(button + button),
  .preset-category-list > li:has(button + button) {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .block-palette > li:not(.preset-category):has(button + button) button:last-child,
  .preset-category-list > li:has(button + button) button:last-child {
    grid-column: 2;
  }
}
