/* Edit these variables to change the figure fonts without touching the SVG. */
:root {
  --diagram-font-family: "IBM Plex Sans", "Helvetica Neue", sans-serif;
  --diagram-ui-font-family: "IBM Plex Sans", "Helvetica Neue", sans-serif;
  --diagram-ui-font-size: 14px;
}

/* Base controls and diagram styles. */
:root {
  color-scheme: light dark;
  background-color: var(
    --background,
    var(--color-background-primary, light-dark(rgb(255 255 255), rgb(24 24 24)))
  ) !important;

  /* Agent-facing contract; keep in sync with SKILL.md. */
  --background: var(
    --color-background-primary,
    light-dark(rgb(255 255 255), rgb(24 24 24))
  );
  --foreground: var(
    --color-text-primary,
    light-dark(rgb(26 28 31), rgb(255 255 255))
  );
  --card: color-mix(in oklab, var(--foreground) 5%, var(--background));
  --card-foreground: var(
    --color-text-primary,
    light-dark(rgb(26 28 31), rgb(255 255 255))
  );
  --popover: var(
    --color-background-secondary,
    light-dark(rgb(255 255 255), rgb(45 45 45))
  );
  --popover-foreground: var(
    --color-text-primary,
    light-dark(rgb(26 28 31), rgb(255 255 255))
  );
  --primary: var(
    --color-text-info,
    light-dark(rgb(51 156 255), rgb(131 195 255))
  );
  --primary-foreground: var(
    --color-text-inverse,
    light-dark(rgb(255 255 255), rgb(13 13 13))
  );
  --secondary: var(
    --color-background-secondary,
    light-dark(rgb(255 255 255 / 96%), rgb(54 54 54 / 96%))
  );
  --secondary-foreground: var(
    --color-text-primary,
    light-dark(rgb(26 28 31), rgb(255 255 255))
  );
  --muted: color-mix(in srgb, var(--foreground) 10%, transparent);
  --muted-foreground: var(
    --color-text-secondary,
    light-dark(rgb(26 28 31 / 49.4%), rgb(255 255 255 / 49.8%))
  );
  --accent: var(
    --color-background-info,
    light-dark(rgb(229 242 255), rgb(13 39 63))
  );
  --accent-foreground: var(
    --color-text-info,
    light-dark(rgb(51 156 255), rgb(131 195 255))
  );
  --destructive: var(
    --color-text-warning,
    light-dark(rgb(226 85 7), rgb(255 133 73))
  );
  --border: var(
    --color-border-secondary,
    light-dark(rgb(26 28 31 / 8%), rgb(255 255 255 / 8.2%))
  );
  --input: var(
    --color-border-primary,
    light-dark(
      rgb(26 28 31 / 11.8%),
      color-mix(in oklab, rgb(0 0 0) 10%, transparent)
    )
  );
  --ring: var(
    --color-ring-primary,
    light-dark(rgb(51 156 255), rgb(131 195 255 / 76%))
  );
  --font-size-base: var(--font-text-md-size, 14px);
  --blue: light-dark(rgb(51 156 255), rgb(51 156 255));
  --orange: light-dark(rgb(226 85 7), rgb(251 106 34));
  --green: light-dark(rgb(0 162 64), rgb(64 201 119));
  --red: light-dark(rgb(224 46 42), rgb(255 103 100));
  --purple: light-dark(rgb(146 79 247), rgb(173 123 249));
  --yellow: light-dark(rgb(255 195 0), rgb(255 210 64));
  --viz-series-1: var(--primary);
  --viz-series-2: light-dark(rgb(243 136 59), rgb(245 154 86));
  --viz-series-3: light-dark(rgb(93 201 119), rgb(116 213 139));
  --viz-series-4: light-dark(rgb(235 119 177), rgb(240 143 192));
  --viz-series-5: light-dark(rgb(155 121 236), rgb(170 145 239));
  --viz-series-6: light-dark(rgb(58 185 177), rgb(90 203 194));

  /* Internal implementation variables; not part of the agent contract. */
  --font-sans: -apple-system, system-ui, "Segoe UI", sans-serif;
  --font-mono:
    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono",
    monospace;
  --font-size-normal: max(11px, var(--font-size-base));
  --font-size-tooltip: calc(var(--font-size-base) - 1px);
  --font-size-small: max(11px, calc(var(--font-size-base) - 2px));
  --font-size-h1: calc(var(--font-size-normal) * 1.7142857143);
  --font-size-h2: calc(var(--font-size-normal) * 1.4285714286);
  --font-size-h3: calc(var(--font-size-normal) * 1.2857142857);
  --font-weight-normal: 430;
  --font-weight-medium: 500;
  --icon-size: 16px;
  --line-height-normal: calc(var(--font-size-normal) * 1.5);
  --line-height-tooltip: calc(var(--font-size-tooltip) * 1.4285714286);
  --line-height-small: calc(var(--font-size-small) + 4px);
  --corner-shape: round;
  --radius: var(--border-radius-lg, 10px);
  --radius-sm: calc(var(--radius) * 0.6);
  --radius-md: calc(var(--radius) * 0.8);
  --radius-lg: var(--radius);
  --radius-2xl: calc(var(--radius) * 1.6);
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px -1px rgb(0 0 0 / 8%);
  --checkmark-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17 17'%3E%3Cpath d='M12.8961 3.64101C13.1297 3.41418 13.4984 3.37523 13.7779 3.56581C14.0571 3.75635 14.1554 4.11331 14.0299 4.41347L13.9615 4.53847L7.71151 13.7045C7.59411 13.8767 7.4063 13.9877 7.19881 14.0072C6.99136 14.0267 6.78564 13.9533 6.63826 13.806L2.88826 10.056L2.79842 9.9457C2.6192 9.67407 2.64927 9.30496 2.88826 9.06581C3.12738 8.82669 3.49647 8.79676 3.76815 8.97597L3.8785 9.06581L7.03084 12.2182L12.8053 3.74941L12.8961 3.64101Z'/%3E%3C/svg%3E");

  /* Legacy aliases; not part of the current agent contract. */
  --viz-bg: transparent;
  --viz-panel: var(--card);
  --viz-border: var(--border);
  --viz-text: var(--foreground);
  --viz-muted: var(--muted-foreground);
  --viz-accent: var(--primary);
  --viz-accent-text: var(--primary-foreground);
  --viz-accent-bg: var(--accent);
  --viz-font-size: var(--font-size-base);
  --viz-warning: var(--destructive);
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html > body {
  /* Preserve MCP aliases for older inline renderers without creating :root cycles. */
  --color-background-primary: var(
    --background,
    light-dark(rgb(255 255 255), rgb(24 24 24))
  );
  --color-text-primary: var(
    --foreground,
    light-dark(rgb(26 28 31), rgb(255 255 255))
  );
  --color-border-secondary: var(
    --border,
    light-dark(rgb(26 28 31 / 8%), rgb(255 255 255 / 8.2%))
  );

  margin: 0;
  padding: var(--visualize-paint-gutter, 0px);
  color: var(--foreground);
  background: transparent !important;
  font-family: var(--font-sans) !important;
  font-size: var(--font-size-normal);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
}

.cursor-interaction {
  cursor: var(--cursor-interaction, pointer);
}

a {
  color: color-mix(in srgb, var(--viz-accent) 80%, var(--viz-text) 20%);
  cursor: var(--cursor-interaction, pointer);
  font-weight: var(--font-weight-medium, 500);
  text-decoration: none;
  text-underline-offset: 2px;
}

a:is(:hover, :focus-visible) {
  text-decoration-line: underline;
  text-decoration-style: dashed;
  text-decoration-thickness: 0.5px;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
  margin-block: 0;
}

h1 {
  font-size: var(--font-size-h1);
  font-weight: var(--font-weight-medium);
  line-height: 1.25;
}

h2 {
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-medium);
  line-height: 1.25;
}

h3,
h4,
h5,
h6 {
  font-size: var(--font-size-h3);
  font-weight: var(--font-weight-medium);
  line-height: 1.3;
}

b,
strong,
th {
  font-weight: var(--font-weight-medium);
}

code:not(pre code) {
  display: inline;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  corner-shape: var(--corner-shape);
  background: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.92em;
  overflow-wrap: anywhere;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  word-break: break-word;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.table {
  width: 100%;
  border-collapse: collapse;
  color: var(--foreground);
  font: inherit;
  text-align: start;
}

.table :is(th, td) {
  padding-block: 10px;
  padding-inline: 0 24px;
  overflow-wrap: anywhere;
  border-bottom: 1px solid var(--border);
  text-align: start;
  vertical-align: top;
}

.table-responsive > .table :is(th, td) {
  overflow-wrap: break-word;
}

.table :is(th, td):last-child {
  padding-inline-end: 0;
}

.table :is(caption, thead th) {
  font-weight: 600;
}

.table thead th {
  padding-block: 8px;
  border-bottom-color: color-mix(in srgb, var(--foreground) 16%, transparent);
}

.table tbody tr:last-child :is(th, td) {
  border-bottom: 0;
}

.table.table-sm :is(th, td) {
  padding-block: 6px;
}

.table.table-sm :is(th, td):not(:last-child) {
  padding-inline-end: 16px;
}

.table :is(.text-end, [align="right"]) {
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.table :is(.text-center, [align="center"]) {
  text-align: center;
}

.table .text-nowrap {
  white-space: nowrap;
}

#widget {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  padding: 0;
  background: transparent !important;
}

.card {
  min-width: 0;
  padding: 12px;
  overflow: hidden;
  overflow-wrap: break-word;
  border-radius: var(--radius-2xl);
  corner-shape: var(--corner-shape);
  color: var(--card-foreground);
  background: var(--card);
}

.widget {
  min-width: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-lg);
  corner-shape: var(--corner-shape);
  box-shadow: 0 0 0 0.5px var(--border-strong, var(--border));
  color: var(--foreground);
  background: var(--background);
}

#widget > :not(.card, .widget, .progress) {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.tooltip {
  position: fixed;
  z-index: 50;
  top: 0;
  left: 0;
  width: max-content;
  max-width: min(
    20rem,
    var(--tooltip-available-width, calc(100vw - 10px)),
    calc(100vw - 10px)
  );
  max-height: min(
    var(--tooltip-available-height, calc(100vh - 10px)),
    calc(100vh - 10px)
  );
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  corner-shape: var(--corner-shape);
  color: var(--popover-foreground);
  background: var(--popover);
  box-shadow: none;
  font-size: var(--font-size-tooltip);
  line-height: var(--line-height-tooltip);
  overflow-wrap: break-word;
  white-space: normal;
  pointer-events: none;
  user-select: none;
}

.viz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(max(180px, 24%), 1fr));
  gap: 10px;
}

.viz-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.viz-stat-value {
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-medium);
  line-height: 1.25;
}

.viz-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

hr {
  width: 100%;
  height: 1px;
  margin-block: 6px;
  border: 0;
  background: var(--border);
}

.nav {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
}

.progress {
  display: flex;
  height: 8px;
  margin-block: calc((var(--line-height-normal, 1.5em) - 8px) / 2);
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--muted);
}

.progress-bar:only-child {
  border-radius: var(--radius-full);
}

.progress-bar {
  height: 100%;
  flex-shrink: 0;
  border: 0;
  background: var(--viz-series-1);
}

.viz-badge {
  padding: 3px 8px;
  border-radius: var(--radius-full);
  color: var(--accent-foreground);
  background: var(--accent);
  font-weight: var(--font-weight-medium);
}

small,
.text-small,
.viz-badge {
  font-size: var(--font-size-small);
  line-height: var(--line-height-small);
}

.text-muted {
  color: var(--muted-foreground);
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.viz-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.viz-controls > .form-label {
  display: grid;
  min-width: min(100%, 260px);
  flex: 1 1 280px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 2px 12px;
  margin-bottom: 0;
}

.viz-controls > .form-label > :is(.form-control, .form-range, .form-select) {
  grid-column: 1 / -1;
}

.btn,
.nav-link,
.form-check-input,
.form-control,
.form-range,
.form-select {
  font: inherit;
}

.btn,
.nav-link {
  appearance: button;
  display: inline-flex;
  inline-size: fit-content;
  max-inline-size: 100%;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0;
  padding: 0 8px;
  -webkit-app-region: no-drag;
  border: 1px solid var(--input);
  border-radius: var(--radius-lg);
  corner-shape: var(--corner-shape);
  color: var(--secondary-foreground);
  background: var(--secondary);
  cursor: var(--cursor-interaction, pointer);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

.btn:is(.btn-block, .viz-tile) {
  inline-size: 100%;
}

.btn.viz-tile {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

a.btn {
  cursor: var(--cursor-interaction, pointer);
  text-decoration: none;
}

.btn:not(:disabled):hover,
.nav-link:not(:disabled):not([aria-disabled="true"]):hover {
  background: color-mix(in srgb, var(--foreground) 6%, var(--secondary));
}

.btn-primary {
  border-color: transparent;
  color: var(--primary-foreground);
  background: var(--foreground);
  background-clip: padding-box;
}

.btn-primary .text-muted {
  color: color-mix(in srgb, var(--primary-foreground) 50%, transparent);
}

.btn-primary:not(:disabled):hover {
  background: color-mix(in srgb, var(--foreground) 80%, transparent);
  background-clip: padding-box;
}

.btn-ghost {
  border-color: transparent;
  color: var(--muted-foreground);
  background: transparent;
}

.btn-ghost:not(:disabled):hover {
  color: var(--foreground);
  background: color-mix(in srgb, var(--foreground) 6%, var(--secondary));
}

.nav-pills .nav-link {
  min-width: 0;
  border-color: transparent;
  color: var(--muted-foreground);
  background: transparent;
}

.nav-justified .nav-link {
  flex: 1 1 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.nav-pills .nav-link.active {
  color: var(--foreground);
  background: var(--muted);
}

/* Shared preview chrome; product styles stay inside each variant. */
.viz-dotted-background {
  background-image: radial-gradient(
    circle,
    color-mix(in srgb, var(--foreground) 14%, transparent) 0.8px,
    transparent 0.8px
  );
  background-position: center;
  background-size: 16px 16px;
}

.viz-carousel {
  position: relative;
  min-width: 0;
}

.viz-carousel:has(> .viz-carousel-controls) {
  min-height: calc(60px + var(--viz-carousel-picker-height, 0px));
  padding-bottom: 60px;
}

.viz-carousel > [data-variant][hidden] {
  display: none !important;
}

.viz-carousel > [data-variant] {
  isolation: isolate;
}

.viz-carousel-controls {
  --viz-carousel-hover: light-dark(
    color-mix(in srgb, var(--foreground) 5.4%, transparent),
    color-mix(in srgb, var(--foreground) 7.8%, transparent)
  );
  position: absolute;
  z-index: 2;
  bottom: 8px;
  left: 50%;
  display: flex;
  width: max-content;
  /* Leave room for the host's design-controls launcher at the trailing edge. */
  max-width: calc(100% - 96px);
  align-items: center;
  gap: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--foreground);
  background: var(--background);
  font-family: var(--font-sans);
  /* Match the settings dropdown chrome independently of the content font size. */
  font-size: 13px;
  font-weight: var(--font-weight-normal);
  line-height: 18px;
  transform: translateX(-50%);
  user-select: none;
}

.viz-carousel-controls button,
.viz-carousel-picker > summary {
  display: flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 6px;
  -webkit-app-region: no-drag;
  border: 0;
  border-radius: 14px;
  color: inherit;
  background: transparent;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.viz-carousel-controls > button,
.viz-carousel-picker > summary {
  position: relative;
  isolation: isolate;
}

.viz-carousel-controls > button {
  --icon-size: 16px;
  width: 30px;
  padding: 0;
}

.viz-carousel-picker > summary {
  padding-inline: 12px;
}

.viz-carousel-controls .viz-carousel-caret {
  width: 14px;
  height: 14px;
  flex: none;
  margin: 0;
  color: inherit;
  transform: rotate(180deg);
}

.viz-carousel-controls > button > svg,
.viz-carousel-controls .viz-carousel-caret,
.viz-carousel-count {
  opacity: 0.5;
}

.viz-carousel-controls > button::before,
.viz-carousel-picker > summary::before {
  position: absolute;
  z-index: -1;
  inset: 3px;
  border-radius: 12px;
  content: "";
  pointer-events: none;
}

.viz-carousel-controls > button:hover::before,
.viz-carousel-picker > summary:hover::before {
  background: var(--viz-carousel-hover);
}

.viz-carousel-controls > button,
.viz-carousel-controls [data-lucide],
.viz-carousel-controls .lucide {
  flex-shrink: 0;
}

.viz-carousel-picker {
  min-width: 0;
}

.viz-carousel-picker > summary {
  min-width: 0;
  list-style: none;
}

.viz-carousel-picker > summary::-webkit-details-marker {
  display: none;
}

.viz-carousel-count {
  flex-shrink: 0;
  white-space: nowrap;
}

.viz-carousel-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viz-carousel-options {
  position: absolute;
  right: 0;
  bottom: calc(100% + 4px);
  left: 0;
  display: flex;
  max-height: 240px;
  flex-direction: column;
  gap: 2px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--background);
  box-shadow: 0 4px 12px light-dark(rgb(0 0 0 / 6%), rgb(0 0 0 / 25%));
}

.viz-carousel-options > button {
  width: 100%;
  min-height: 28px;
  justify-content: flex-start;
  padding: 4px 8px;
  font-size: var(--font-size-small);
  text-align: start;
  white-space: normal;
  overflow-wrap: anywhere;
}

.viz-carousel-options > [aria-current="true"],
.viz-carousel-options > button:hover {
  background: var(--viz-carousel-hover);
}

.btn:disabled,
.nav-link:disabled,
.nav-link[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.4;
}

[data-lucide] {
  stroke-width: 1.6;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  color: var(--foreground);
}

.form-control {
  display: block;
  width: 100%;
  min-height: 28px;
  padding: 0 8px;
  outline: none;
  border: 1px solid var(--input);
  border-radius: var(--radius-lg);
  corner-shape: var(--corner-shape);
  color: var(--foreground);
  background: var(--secondary);
}

.form-control::placeholder {
  color: var(--muted-foreground);
}

.form-control[type="file"] {
  padding: 0;
  overflow: hidden;
  cursor: var(--cursor-interaction, pointer);
}

.form-control[type="file"]::file-selector-button {
  min-height: 26px;
  margin-right: 8px;
  padding: 0 8px;
  border: 0;
  border-right: 1px solid var(--input);
  color: var(--secondary-foreground);
  background: var(--secondary);
  cursor: inherit;
  font: inherit;
}

.form-control[type="file"]:not(:disabled):hover::file-selector-button {
  background: color-mix(in srgb, var(--foreground) 6%, var(--secondary));
}

.form-control-color[type="color"] {
  width: 40px;
  height: 28px;
  padding: 3px;
  cursor: var(--cursor-interaction, pointer);
}

.form-control-color[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.form-control-color[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: calc(var(--radius-lg) - 4px);
  corner-shape: var(--corner-shape);
}

textarea.form-control {
  height: auto;
  min-height: 72px;
  padding: 8px 10px;
  resize: vertical;
}

.form-control:focus-visible {
  border-color: var(--ring);
  box-shadow: inset 0 0 0 1px var(--ring);
}

.form-control:disabled,
.form-select:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.form-select {
  appearance: none;
  display: block;
  width: 100%;
  min-height: 28px;
  margin: 0;
  padding: 0 32px 0 8px;
  outline: none;
  border: 1px solid var(--input);
  border-radius: var(--radius-lg);
  corner-shape: var(--corner-shape);
  color: var(--foreground);
  background-color: var(--secondary);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted-foreground) 50%),
    linear-gradient(135deg, var(--muted-foreground) 50%, transparent 50%);
  background-position:
    calc(100% - 14px) 50%,
    calc(100% - 10px) 50%;
  background-repeat: no-repeat;
  background-size: 4px 4px;
  cursor: var(--cursor-interaction, default);
}

.form-select:not(:disabled):hover {
  background-color: color-mix(in srgb, var(--foreground) 6%, var(--secondary));
}

.form-select:focus-visible {
  border-color: var(--ring);
  box-shadow: inset 0 0 0 1px var(--ring);
}

.form-check {
  display: flex;
  min-height: 20px;
  align-items: center;
  gap: 6px;
}

.form-check-input {
  appearance: none;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin: 0;
  border: 1px solid var(--input);
  color: var(--primary-foreground);
  background-color: transparent;
  cursor: var(--cursor-interaction, default);
  transition:
    background-color 150ms,
    border-color 150ms,
    box-shadow 150ms;
}

.form-check:not(.form-switch) .form-check-input[type="checkbox"] {
  border-color: var(--input);
  border-radius: var(--radius-sm);
  corner-shape: var(--corner-shape);
  background-color: var(--secondary);
  box-shadow: var(--shadow-sm);
}

.form-check:not(.form-switch)
  .form-check-input:not(:disabled):not(:checked):hover {
  background-color: var(--card);
}

.form-check:not(.form-switch) .form-check-input[type="checkbox"]:checked {
  border-color: var(--primary);
  background-color: var(--primary);
}

.form-check:not(.form-switch)
  .form-check-input[type="checkbox"]:checked::before {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--primary-foreground);
  content: "";
  mask: var(--checkmark-image) center / 12px 12px no-repeat;
}

.form-check-input[type="radio"] {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
}

.form-check-input[type="radio"]:checked {
  border: 2px solid var(--primary);
  background:
    radial-gradient(circle, var(--primary-foreground) 0 2.5px, transparent 3px),
    var(--primary);
}

.form-check:not(.form-switch) .form-check-input:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.form-check:not(.form-switch) .form-check-input:disabled {
  cursor: not-allowed;
  pointer-events: none;
}

.form-check:not(.form-switch) .form-check-input:disabled + .form-check-label {
  cursor: not-allowed;
}

.form-switch .form-check-input:disabled,
.form-switch .form-check-input:disabled + .form-check-label {
  cursor: not-allowed;
  opacity: 0.6;
}

.form-check-label {
  color: var(--foreground);
  cursor: var(--cursor-interaction, default);
}

.form-switch .form-check-input {
  position: relative;
  width: 32px;
  height: 20px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--muted);
  box-shadow: none;
  transition: background-color 200ms cubic-bezier(0, 0, 0.2, 1);
}

.form-switch .form-check-input::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 16px;
  height: 16px;
  box-sizing: border-box;
  border: 1px solid light-dark(var(--primary-foreground), var(--foreground));
  border-radius: var(--radius-full);
  background: light-dark(var(--primary-foreground), var(--foreground));
  box-shadow: var(--shadow-sm);
  content: "";
  transform: translate(2px, -50%);
  transition: transform 200ms cubic-bezier(0, 0, 0.2, 1);
}

.form-switch .form-check-input:checked {
  background: var(--primary);
}

.form-switch .form-check-input:checked::before {
  transform: translate(14px, -50%);
}

.form-switch .form-check-input:focus-visible {
  box-shadow: 0 0 0 2px var(--ring);
}

.form-range {
  appearance: none;
  display: block;
  width: 100%;
  height: 28px;
  flex: 1;
  margin: 0;
  padding: 0;
  outline: none;
  border: 0;
  accent-color: var(--primary);
  background: linear-gradient(
      color-mix(in srgb, var(--foreground) 7%, transparent),
      color-mix(in srgb, var(--foreground) 7%, transparent)
    )
    center / 100% 2px no-repeat;
}

.form-range::-webkit-slider-runnable-track {
  height: 28px;
  background: transparent;
}

.form-range::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: light-dark(var(--primary-foreground), var(--foreground));
}

.form-range:focus-visible::-webkit-slider-thumb {
  border-color: var(--ring);
  box-shadow: inset 0 0 0 1px var(--ring);
}

.form-range::-moz-range-track {
  height: 28px;
  background: transparent;
}

.form-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: light-dark(var(--primary-foreground), var(--foreground));
}

.form-range:focus-visible::-moz-range-thumb {
  border-color: var(--ring);
  box-shadow: inset 0 0 0 1px var(--ring);
}

.form-range:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.btn:not(.btn-primary, .viz-tile):is(
  [aria-pressed="true"],
  [aria-selected="true"],
  .is-selected
) {
  border-color: var(--primary);
  color: var(--primary-foreground);
  background: var(--primary);
}

.btn.viz-tile:is([aria-pressed="true"], [aria-selected="true"], .is-selected) {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.btn:focus-visible,
.nav-link:focus-visible,
.viz-carousel-controls :is(button, summary):focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

@media (pointer: coarse) {
  .viz-carousel:has(> .viz-carousel-controls) {
    min-height: calc(76px + var(--viz-carousel-picker-height, 0px));
    padding-bottom: 76px;
  }

  .btn,
  .nav-link,
  .viz-carousel-controls button,
  .viz-carousel-picker > summary,
  .form-control,
  .form-select {
    min-width: 44px;
    min-height: 44px;
  }

  /* Keep small-screen WebKit from zooming when a text field receives focus. */
  .form-control,
  .form-select {
    font-size: max(16px, var(--font-size-normal));
  }

  .form-control[type="file"]::file-selector-button {
    min-width: 44px;
    min-height: 44px;
  }

  .form-control-color[type="color"] {
    width: 44px;
    height: 44px;
  }

  .form-control:is(
    [type="date"],
    [type="datetime-local"],
    [type="month"],
    [type="time"],
    [type="week"]
  ) {
    min-width: 0;
    max-width: 100%;
    padding-block: 8px;
  }

  .form-check {
    min-height: 44px;
    padding-inline: 15px;
  }

  .form-check-input {
    position: relative;
  }

  .form-check-input::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    content: "";
    transform: translate(-50%, -50%);
  }

  .form-check-label {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
  }

  .form-range {
    height: 44px;
    touch-action: pan-y;
  }

  .form-range::-webkit-slider-runnable-track {
    height: 44px;
  }

  .form-range::-moz-range-track {
    height: 44px;
  }

  .form-range::-webkit-slider-thumb {
    margin-top: 12px;
  }
}

svg {
  display: block;
  max-width: 100%;
  height: auto;
}

#widget > svg {
  width: 100%;
}

/* Model-authored chart rules can otherwise stretch icons after these styles load. */
svg.lucide {
  display: block;
  width: var(--icon-size) !important;
  height: var(--icon-size) !important;
  flex: none;
  margin: 0 !important;
  stroke-width: 1.6;
}

.text-warning,
.text-destructive {
  color: var(--destructive);
}

html>body{padding:0}


#brain-controller-flow-preview{width:100%;color:var(--foreground)}
#brain-controller-flow-preview .flow-toolbar{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
#brain-controller-flow-preview .flow-toolbar-group{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-width:0}
#brain-controller-flow-preview .flow-mode-picker{padding-left:8px;border-left:1px solid var(--blog-line,#dedede)}
#brain-controller-flow-preview .flow-mode-picker[hidden]{display:none}
#brain-controller-flow-preview .flow-caption{display:flex;justify-content:space-between;align-items:center;gap:8px;margin:10px 0 6px;color:var(--muted-foreground);flex-wrap:wrap}
#brain-controller-flow-preview .flow-live{display:inline-flex;gap:7px;align-items:center}
#brain-controller-flow-preview .flow-live>span:first-child{width:6px;height:6px;border-radius:50%;background:var(--green)}
#brain-controller-flow-preview[data-paused="true"] .flow-live>span:first-child{background:var(--muted-foreground)}
#brain-controller-flow-preview .flow-figure{position:relative;width:100%;isolation:isolate;color-scheme:light;overflow:hidden;aspect-ratio:1836 / 804;border-radius:12px}
#brain-controller-flow-preview [data-ppt-id]{transition:opacity .2s}
#brain-controller-flow-preview [data-action-input-token],#brain-controller-flow-preview [data-action-input-ellipsis]{transition:opacity .2s}
#brain-controller-flow-preview[data-action-tone="noisy"] [data-action-token]{fill:url(#cf-action-noise);stroke-dasharray:3 2.2}
#brain-controller-flow-preview [data-token-row]{transition:none}
#brain-controller-flow-preview [data-input-image]{transition:none}
#brain-controller-flow-preview[data-encoder-layout="training"] [data-encoder-layout="inference"],#brain-controller-flow-preview[data-encoder-layout="inference"] [data-encoder-layout="training"]{display:none}
#brain-controller-flow-preview #ppt-shape-201{transition:none}
#brain-controller-flow-preview .cf-inactive{filter:grayscale(1) opacity(.5);transition:none}
#brain-controller-flow-preview .flow-overlay{display:block;width:100%;height:auto;overflow:hidden;pointer-events:none}
#brain-controller-flow-preview .cf-wash{fill:var(--background)}
#brain-controller-flow-preview .cf-label-bg{fill:var(--card);stroke:var(--border);stroke-width:1}
#brain-controller-flow-preview .cf-label{fill:var(--foreground);font-size:var(--cf-label-size);font-weight:500;font-family:inherit}
#brain-controller-flow-preview .cf-loss-guide{fill:none;stroke-width:1.5;stroke-dasharray:3 5;opacity:.55}
#brain-controller-flow-preview .condition{color:var(--flow-vlm);stroke:var(--flow-vlm)}
#brain-controller-flow-preview .latent{color:var(--flow-latent);stroke:var(--flow-latent)}
#brain-controller-flow-preview .action{color:var(--flow-action);stroke:var(--flow-action)}
#brain-controller-flow-preview .execution{color:var(--flow-execution);stroke:var(--flow-execution)}
#brain-controller-flow-preview .cf-latent-fill{fill:var(--orange)}
#brain-controller-flow-preview .cf-action-fill{fill:var(--purple)}
#brain-controller-flow-preview .cf-hardware{fill:none;stroke:#414443;stroke-width:2}
#brain-controller-flow-preview .flow-training{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:10px 24px;margin-top:6px}
#brain-controller-flow-preview .flow-training-steps{display:flex;align-items:center;gap:10px;color:var(--muted-foreground)}
#brain-controller-flow-preview .flow-training-steps .is-active{color:var(--foreground);font-weight:500}
#brain-controller-flow-preview .flow-task{min-width:0;padding-top:12px;border-top:1px solid var(--border)}
#brain-controller-flow-preview .flow-task-title{display:flex;gap:7px;align-items:center;flex-wrap:wrap}
#brain-controller-flow-preview strong{font-weight:500}
#brain-controller-flow-preview .task-symbol{display:inline-block;width:8px;height:8px;background:var(--foreground);flex-shrink:0}
#brain-controller-flow-preview .circle{border-radius:50%}
#brain-controller-flow-preview .square{border-radius:1px}
#brain-controller-flow-preview .diamond{transform:rotate(45deg);border-radius:1px}
#brain-controller-flow-preview .capsule{width:13px;border-radius:5px}
#brain-controller-flow-preview .flow-task-input{margin-top:10px;min-height:34px;color:var(--muted-foreground)}
#brain-controller-flow-preview .input-dot{display:inline-block;width:5px;height:5px;background:var(--blue);border-radius:50%;margin-right:5px;vertical-align:middle}
#brain-controller-flow-preview .latent-label{color:var(--foreground);text-decoration:underline;text-decoration-color:var(--orange);text-underline-offset:4px}
#brain-controller-flow-preview .action-label{color:var(--foreground);text-decoration:underline;text-decoration-color:var(--purple);text-underline-offset:4px}
#brain-controller-flow-preview .flow-task-track{position:relative;height:25px;margin:4px 2px}
#brain-controller-flow-preview .track-line{position:absolute;top:12px;left:0;right:0;height:1px;background:var(--border)}
#brain-controller-flow-preview .track-packet{position:absolute;width:8px;height:8px;top:8px;background:var(--blue);left:0}
#brain-controller-flow-preview .track-attention{position:absolute;left:48%;top:4px;width:18px;height:18px;border-radius:50%;background:var(--muted)}
#brain-controller-flow-preview .track-output{position:absolute;right:0;top:8px;width:8px;height:8px;border-radius:2px;background:currentColor}
#brain-controller-flow-preview .flow-task-target{display:flex;justify-content:space-between;gap:6px;flex-wrap:wrap}
#brain-controller-flow-preview .task-step{opacity:.85}
#brain-controller-flow-preview .flow-inference{margin-top:8px}
#brain-controller-flow-preview .flow-steps{display:grid;grid-template-columns:minmax(0,.8fr) minmax(0,1fr) minmax(0,1.1fr) minmax(0,1.3fr) minmax(0,.8fr);gap:10px}
#brain-controller-flow-preview .flow-steps>div{position:relative;display:flex;align-items:center;gap:5px;flex-wrap:nowrap;white-space:nowrap;min-width:0;padding:12px 0;border-top:1px solid var(--border);color:var(--muted-foreground)}
#brain-controller-flow-preview .flow-steps>div.is-active{color:var(--foreground)}
#brain-controller-flow-preview .step-number{color:var(--muted-foreground);font-variant-numeric:tabular-nums}
#brain-controller-flow-preview .step-progress{position:absolute;top:-1px;left:0;width:0;height:2px;background:var(--viz-series-6)}
#brain-controller-flow-preview [hidden]{display:none!important}
@media(max-width:680px){#brain-controller-flow-preview .flow-training{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}#brain-controller-flow-preview .flow-task-input{min-height:0}#brain-controller-flow-preview .flow-steps{grid-template-columns:repeat(3,minmax(0,1fr))}#brain-controller-flow-preview .flow-caption{margin-top:12px}}
@media(max-width:390px){#brain-controller-flow-preview .flow-training{gap:12px}#brain-controller-flow-preview .flow-task-title .text-muted{flex-basis:100%;margin-left:15px}#brain-controller-flow-preview .flow-steps{grid-template-columns:repeat(2,minmax(0,1fr))}}


/* Match the article's paper background and keep the figure theme stable. */
:root {
  color-scheme: light;
  --background: #ffffff;
  --foreground: #1a1a1a;
  --muted-foreground: #666666;
  --border: #dedede;
  --font-sans: var(--diagram-ui-font-family);
  --font-size-base: var(--diagram-ui-font-size);
}

/* The SVG labels are part of the drawing; mobile text inflation moves them out of their nodes.
   This applies only to the embedded figure, and keeps ordinary page/pinch zoom available. */
html { -webkit-text-size-adjust: none; text-size-adjust: none; overflow-x: hidden; }
html > body { padding: 12px 14px; }
#brain-controller-flow-preview svg text {
  font-family: var(--diagram-font-family);
  font-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}
#brain-controller-flow-preview svg text[font-weight="700"] { font-weight: 600; }
#brain-controller-flow-preview #ppt-shape-62 text { font-size: 18px; }
#brain-controller-flow-preview [data-action-input-token] text,
#brain-controller-flow-preview [data-ppt-name^="Proprioception token"] text { font-size: 14px; }

/* Blog-matched controls: square outlines, accent selection, Plex type (see preview/styles.css). */
#brain-controller-flow-preview{--blog-ink:#1a1a1a;--blog-muted:#666666;--blog-line:#dedede;--blog-accent:#b54a1a;--blog-paper:#ffffff;--blog-bg:#ffffff}
#brain-controller-flow-preview .btn{min-height:28px;padding:0 10px;border:1px solid var(--blog-line);border-radius:0;background:transparent;color:var(--blog-muted);font-size:12px;box-shadow:none;transition:border-color 180ms,background 180ms,color 180ms}
#brain-controller-flow-preview .btn:not(:disabled):hover{background:var(--blog-bg);color:var(--blog-ink)}
#brain-controller-flow-preview .btn[aria-pressed="true"],#brain-controller-flow-preview .btn[aria-pressed="true"]:not(:disabled):hover{border-color:var(--blog-accent);background:#f5f5f5;color:var(--blog-ink)}
#brain-controller-flow-preview .btn-ghost,#brain-controller-flow-preview .btn-ghost[aria-pressed]{border-color:transparent;background:transparent;color:var(--blog-muted)}
#brain-controller-flow-preview .btn-ghost:not(:disabled):hover,#brain-controller-flow-preview .btn-ghost[aria-pressed="true"]:not(:disabled):hover{border-color:transparent;background:transparent;color:var(--blog-accent)}
#brain-controller-flow-preview .btn:focus-visible{outline:1px solid var(--blog-accent);outline-offset:3px}
#brain-controller-flow-preview .flow-caption{color:var(--blog-muted);font-size:13px}
#brain-controller-flow-preview .flow-live>span:first-child{background:var(--blog-accent)}
#brain-controller-flow-preview .flow-steps>div{border-top-color:var(--blog-line);color:var(--blog-muted)}
#brain-controller-flow-preview .flow-steps>div.is-active{color:var(--blog-ink)}
#brain-controller-flow-preview .step-number{font-family:"IBM Plex Mono",ui-monospace,monospace;font-size:11px;letter-spacing:.04em;color:inherit}
#brain-controller-flow-preview .step-progress{background:var(--blog-accent)}
@media (pointer:coarse){#brain-controller-flow-preview .btn{min-height:44px}}
/* The SVG contains real first-frame posters. Only paint over them once an inference video
   has presented a frame; preload/autoplay restrictions must never erase the illustrations. */
#brain-controller-flow-preview .scene-overlay{position:absolute;overflow:hidden;pointer-events:none;z-index:1;opacity:0}
#brain-controller-flow-preview[data-stage="inference"] .scene-overlay[data-ready="true"]{opacity:1}

/* Start with the entire diagram; opt in to a larger canvas for reading details. */
#brain-controller-flow-preview .flow-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--blog-muted) var(--blog-bg);
}
#brain-controller-flow-preview .flow-scroll:focus-visible {
  outline: 1px solid var(--blog-accent);
  outline-offset: -1px;
}
#brain-controller-flow-preview .flow-view-controls,
#brain-controller-flow-preview .flow-scroll-hint { display: none; }
@media (max-width: 680px) {
  html > body { padding: 12px; }
  #brain-controller-flow-preview .flow-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }
  #brain-controller-flow-preview .flow-toolbar-group { display: contents; }
  #brain-controller-flow-preview .flow-mode-picker {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0;
    border: 0;
  }
  #brain-controller-flow-preview [data-pause] { grid-column: 2; grid-row: 1; }
  #brain-controller-flow-preview .btn {
    min-height: 44px;
    white-space: normal;
    line-height: 1.3;
  }
  #brain-controller-flow-preview .flow-mode-picker .btn { width: 100%; }
  #brain-controller-flow-preview .flow-view-controls {
    display: flex;
    justify-content: flex-end;
    margin: 4px 0 8px;
  }
  #brain-controller-flow-preview[data-diagram-zoom="true"] .flow-figure { width: 960px; }
  #brain-controller-flow-preview[data-diagram-zoom="true"] .flow-scroll-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0 14px;
    color: var(--blog-muted);
    font-size: 12px;
    line-height: 1.5;
  }
  #brain-controller-flow-preview .flow-scroll-hint span { font-size: 18px; }
  #brain-controller-flow-preview .flow-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #brain-controller-flow-preview .flow-steps > div { white-space: normal; align-items: baseline; }
  #brain-controller-flow-preview .step-number { flex: 0 0 auto; }
}
