:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --ink: #1d2430;
  --muted: #697386;
  --line: #d8dee8;
  --accent: #4aaee8;
  --accent-strong: #07547d;
  --accent-soft: #e7f5fd;
  --edit-accent: #008cff;
  --event-fill: transparent;
  --shape-stroke: #111827;
  --danger: #b42318;
  --tooltip-orange: #f97316;
  --tooltip-orange-border: #fb923c;
  --shadow: 0 18px 45px rgba(33, 43, 54, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

body.dragging-document::after {
  content: "Drop .o2des to open";
  position: fixed;
  inset: 10px;
  z-index: 80;
  display: grid;
  place-items: center;
  border: 2px dashed var(--edit-accent);
  border-radius: 8px;
  background: rgba(231, 245, 253, 0.52);
  color: var(--accent-strong);
  font-size: 18px;
  font-weight: 700;
  pointer-events: none;
}

button,
input,
textarea {
  font: inherit;
}

input[type="range"] {
  accent-color: var(--accent);
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.2;
}

.brand p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

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

.view-tabs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafc;
}

.view-tab {
  min-width: 82px;
  height: 32px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.view-tab:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.view-tab.active {
  color: var(--accent-strong);
  background: #dff1fb;
  border-color: rgba(74, 174, 232, 0.32);
}

button {
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

button:active {
  transform: translateY(1px);
}

.primary-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border-radius: 8px;
  color: #fff;
}

.primary-button {
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #eef2f6;
  color: var(--ink);
  font-size: 20px;
}

.icon-button:hover {
  border-color: #b8c2cf;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 84px 1fr;
}

.workspace.document-mode {
  grid-template-columns: 1fr;
}

.workspace.document-mode .tool-rail,
.workspace.document-mode .canvas-wrap {
  display: none;
}

.workspace:not(.document-mode) .document-wrap {
  display: none;
}

.tool-rail {
  padding: 14px 10px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tool-button {
  width: 62px;
  min-height: 62px;
  display: grid;
  place-items: center;
  gap: 4px;
  border-radius: 8px;
  background: #eef2f6;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
}

.tool-button span:first-child {
  font-size: 24px;
  line-height: 1;
}

.tool-button:hover,
.tool-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tool-divider {
  width: 44px;
  height: 1px;
  margin: 2px auto;
  background: var(--line);
}

.tool-icon-button {
  width: 62px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef2f6;
  color: var(--ink);
}

.tool-icon-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tool-icon-button:disabled,
.tool-icon-button.disabled {
  cursor: default;
  opacity: 0.38;
  color: #8b95a5;
  border-color: transparent;
  background: #eef2f6;
}

.tool-icon-button:disabled:hover,
.tool-icon-button.disabled:hover {
  border-color: transparent;
  background: #eef2f6;
  color: #8b95a5;
}

.tool-icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.canvas-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.document-wrap {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  padding: 14px;
  background: #fbfcfe;
  overflow: hidden;
}

.document-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.document-toolbar h2 {
  font-size: 16px;
  line-height: 1.25;
}

.document-toolbar p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.document-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.document-button {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border-color: #cdd6e2;
  background: rgba(231, 245, 253, 0.78);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.document-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.document-file-input {
  display: none;
}

.document-editor {
  width: 100%;
  min-width: 0;
  min-height: 0;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  color: #172033;
  box-shadow: inset 0 1px 0 rgba(20, 36, 56, 0.04);
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
  outline: none;
}

.document-editor:focus {
  border-color: var(--edit-accent);
  box-shadow: 0 0 0 3px rgba(0, 140, 255, 0.12);
}

.document-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.document-status.error {
  color: var(--danger);
}

.document-import-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(245, 247, 250, 0.54);
}

.document-import-overlay[hidden] {
  display: none;
}

.document-import-dialog {
  width: min(520px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.document-notice-dialog {
  width: min(360px, 100%);
}

.document-import-dialog h2 {
  font-size: 17px;
  line-height: 1.25;
}

.document-import-dialog p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.document-import-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.document-button.secondary {
  background: rgba(238, 242, 246, 0.78);
}

.canvas {
  width: 100%;
  height: 100%;
  display: block;
  background-color: #fbfcfe;
  user-select: none;
  touch-action: none;
  cursor: grab;
}

.canvas.panning {
  cursor: grabbing;
}

.canvas.placing,
.canvas.scheduling {
  cursor: crosshair;
}

.node-shape {
  cursor: pointer;
}

.node-shape.selected {
  cursor: move;
}

.node-shape.editing {
  cursor: pointer;
}

.node-shape.schedule-source .event-ellipse,
.node-shape.schedule-source .initial-assignment-rect {
  stroke: var(--edit-accent);
}

.schedule-path {
  fill: none;
  stroke: var(--shape-stroke);
  stroke-width: 2.5;
  stroke-linecap: butt;
  stroke-linejoin: round;
  pointer-events: stroke;
  cursor: pointer;
}

.schedule-hit-path {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: stroke;
  cursor: pointer;
}

.schedule-group.selected .schedule-path,
.schedule-group.selected .schedule-hit-path {
  cursor: inherit;
  pointer-events: none;
}

.schedule-path.selected {
  stroke: var(--edit-accent);
}

.node-generated-id {
  pointer-events: auto;
  overflow: visible;
  cursor: pointer;
}

.schedule-generated-id {
  overflow: visible;
  pointer-events: auto;
  cursor: pointer;
}

.schedule-generated-id-group {
  pointer-events: auto;
}

.node-generated-id-group {
  pointer-events: auto;
}

.generated-symbol-label {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #7a8494;
  font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", "STIXGeneral", "Times New Roman", serif;
  font-size: 14px;
  font-style: italic;
  font-weight: 650;
  line-height: 1;
  opacity: 0.92;
  pointer-events: none;
}

.schedule-generated-id .generated-symbol-label {
  pointer-events: auto;
}

.schedule-generated-id:hover .generated-symbol-label {
  color: var(--edit-accent);
}

.schedule-generated-id:hover .generated-symbol-label .katex,
.schedule-generated-id:hover .generated-symbol-label .katex * {
  color: var(--edit-accent);
}

.schedule-id-tooltip,
.event-id-tooltip {
  opacity: 0;
  pointer-events: none;
}

.schedule-generated-id-group:hover .schedule-id-tooltip,
.node-generated-id-group:hover .event-id-tooltip {
  opacity: 1;
}

.schedule-id-tooltip-bg,
.event-id-tooltip-bg {
  fill: #fff;
  opacity: 0.68;
}

.schedule-id-tooltip-label,
.event-id-tooltip-label {
  fill: var(--tooltip-orange);
  font-size: 10px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
}

.schedule-id-menu,
.event-id-menu {
  overflow: visible;
  pointer-events: auto;
}

.schedule-id-menu-overlay,
.event-id-menu-overlay {
  pointer-events: auto;
}

.schedule-id-menu-body {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(33, 43, 54, 0.14);
}

.schedule-id-menu-title {
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}

.schedule-id-options {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 4px;
  width: 100%;
}

.schedule-id-option {
  flex: 0 0 28px;
  min-width: 0;
  width: 28px;
  height: 22px;
  padding: 0;
  border-radius: 6px;
  border-color: #cfd8e6;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
}

.schedule-id-option .katex {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  font-size: 0.86em;
  line-height: 1;
}

.schedule-id-option .katex-html {
  min-width: 0;
}

.schedule-id-option:hover,
.schedule-id-option.active {
  border-color: var(--edit-accent);
  background: rgba(0, 140, 255, 0.12);
  color: var(--edit-accent);
}

.generated-symbol-label .katex {
  font-size: 1em;
  line-height: 1;
  color: #7a8494;
}

.generated-symbol-label .katex * {
  color: #7a8494;
}

.schedule-preview {
  fill: none;
  stroke: var(--edit-accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 7 5;
  marker-end: url(#scheduleArrowPreview);
  pointer-events: none;
}

.schedule-handle {
  fill: #fff;
  stroke: var(--edit-accent);
  stroke-width: 2.5;
  cursor: move;
}

.schedule-handle:active {
  cursor: move;
}

.schedule-handle.curve {
  fill: #fff4f4;
}

.schedule-curve-slider {
  cursor: move;
}

.schedule-curve-slider-hit {
  fill: transparent;
  stroke: none;
  pointer-events: all;
}

.schedule-curve-slider-thumb {
  fill: #fff;
  stroke: var(--edit-accent);
  stroke-width: 2.5;
  stroke-linejoin: round;
  pointer-events: none;
}

.schedule-curve-slider-tooltip {
  opacity: 0;
  pointer-events: none;
}

.schedule-curve-slider:hover .schedule-curve-slider-tooltip {
  opacity: 1;
}

.schedule-curve-slider-tooltip-bg {
  fill: #fff;
  opacity: 0.68;
}

.schedule-curve-slider-tooltip-label {
  fill: var(--ink);
  font-size: 10px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.curve-guide {
  pointer-events: none;
}

.curve-guide-body,
.curve-guide-head {
  fill: var(--edit-accent);
  opacity: 0.34;
}

.schedule-delay-add {
  cursor: pointer;
}

.schedule-parameter-add {
  cursor: pointer;
}

.schedule-condition-add {
  cursor: pointer;
}

.schedule-delay-add-bg {
  fill: var(--edit-accent);
  opacity: 0.18;
  stroke: var(--edit-accent);
  stroke-width: 2;
}

.schedule-delay-plus-line {
  stroke: var(--edit-accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  pointer-events: none;
}

.schedule-delay-preview-bar {
  stroke: var(--edit-accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  opacity: 0.22;
  pointer-events: none;
}

.schedule-delay-add:hover .schedule-delay-preview-bar {
  opacity: 0.46;
}

.schedule-delay-add-tooltip {
  opacity: 0;
  pointer-events: none;
}

.schedule-delay-add:hover .schedule-delay-add-tooltip {
  opacity: 1;
}

.schedule-parameter-add-tooltip {
  opacity: 0;
  pointer-events: none;
}

.schedule-parameter-add:hover .schedule-parameter-add-tooltip {
  opacity: 1;
}

.schedule-condition-add-tooltip {
  opacity: 0;
  pointer-events: none;
}

.schedule-condition-add:hover .schedule-condition-add-tooltip {
  opacity: 1;
}

.schedule-delay-add-tooltip-bg {
  fill: #fff;
  opacity: 0.68;
}

.schedule-delay-add-tooltip-label {
  fill: var(--ink);
  font-size: 10px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.schedule-parameter-tooltip-bg {
  fill: #fff;
  opacity: 0.68;
}

.schedule-parameter-tooltip-label {
  fill: var(--ink);
  font-size: 10px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.schedule-condition-tooltip-bg {
  fill: #fff;
  opacity: 0.68;
}

.schedule-condition-tooltip-label {
  fill: var(--ink);
  font-size: 10px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.schedule-condition-mark,
.schedule-condition-preview {
  pointer-events: none;
}

.schedule-condition-preview {
  opacity: 0.34;
}

.schedule-condition-tilde {
  fill: var(--shape-stroke);
  font-size: 34px;
  font-weight: 520;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.schedule-condition-preview .schedule-condition-tilde,
.schedule-condition-mark.selected .schedule-condition-tilde {
  fill: var(--edit-accent);
}

.schedule-parameter-preview {
  pointer-events: none;
}

.schedule-parameter-mark {
  pointer-events: auto;
}

.schedule-parameter-mark.faded {
  opacity: 0.28;
}

.schedule-parameter-box-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 12;
  cursor: pointer;
  pointer-events: stroke;
}

.schedule-parameter-box {
  fill: #fff;
  stroke: var(--shape-stroke);
  stroke-width: 2.5;
  cursor: pointer;
  pointer-events: stroke;
}

.schedule-parameter-mark.selected .schedule-parameter-box {
  cursor: move;
}

.schedule-parameter-mark.selected .schedule-parameter-box-hit {
  cursor: move;
}

.schedule-parameter-mark.faded .schedule-parameter-box {
  cursor: inherit;
}

.schedule-parameter-mark.faded .schedule-parameter-box-hit {
  cursor: inherit;
}

.schedule-parameter-position-tooltip {
  opacity: 0;
  pointer-events: none;
}

.schedule-parameter-box-hit:hover ~ .schedule-parameter-position-tooltip,
.schedule-parameter-box:hover ~ .schedule-parameter-position-tooltip {
  opacity: 1;
}

.schedule-parameter-preview {
  opacity: 0.34;
}

.schedule-parameter-preview .schedule-parameter-box,
.schedule-parameter-mark.selected .schedule-parameter-box,
.schedule-parameter-mark.faded .schedule-parameter-box {
  stroke: var(--edit-accent);
}

.schedule-parameter-label-object {
  pointer-events: auto;
}

.schedule-parameter-label {
  fill: var(--ink);
  font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", "STIXGeneral", "Times New Roman", serif;
  font-size: 16px;
  font-style: italic;
  font-weight: 650;
  width: 100%;
  height: 100%;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1;
  font-weight: 700;
}

.schedule-parameter-symbol {
  position: relative;
  cursor: pointer;
  pointer-events: auto;
  color: var(--ink);
}

.schedule-parameter-symbol.editing {
  color: var(--edit-accent);
}

.schedule-parameter-value-tooltip {
  pointer-events: none;
}

.schedule-parameter-separator {
  font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", "STIXGeneral", "Times New Roman", serif;
  font-style: normal;
  font-weight: 700;
  margin-right: 0.18em;
  pointer-events: none;
}

.schedule-parameter-label .katex {
  font-size: 1em;
  line-height: 1;
  font-weight: 700;
}

.schedule-parameter-label .katex * {
  font-weight: 700;
}

.schedule-assignment-editor,
.schedule-assignment-reset-prompt {
  pointer-events: all;
}

.schedule-assignment-editor-bg {
  fill: #fff;
  opacity: 1;
  stroke: var(--line);
  stroke-width: 1;
  pointer-events: all;
}

.schedule-assignment-editor-title {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 650;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  line-height: 1;
  pointer-events: none;
}

.schedule-assignment-editor-title-prefix {
  font-family: inherit;
  font-style: normal;
}

.schedule-assignment-editor-title-symbol {
  fill: var(--ink);
  color: var(--ink);
  font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", "STIXGeneral", "Times New Roman", serif;
  font-style: italic;
  font-size: 15px;
  font-weight: 800;
}

.schedule-assignment-editor-title-symbol .katex {
  font-size: 1em;
  line-height: 1;
  font-weight: 800;
}

.schedule-assignment-editor-title-symbol .katex * {
  font-weight: 800;
}

.schedule-assignment-input {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  padding: 2px 7px;
  color: var(--ink);
  background: #fff;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
  line-height: 18px;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
}

.schedule-assignment-input:focus {
  border-color: var(--edit-accent);
  box-shadow: 0 0 0 2px rgba(0, 140, 255, 0.14);
}

.schedule-assignment-action {
  cursor: pointer;
}

.schedule-assignment-action.disabled {
  cursor: default;
  pointer-events: none;
}

.schedule-assignment-action-bg {
  fill: var(--edit-accent);
  opacity: 0.16;
  stroke: var(--edit-accent);
  stroke-width: 1;
}

.schedule-assignment-action:hover .schedule-assignment-action-bg {
  opacity: 0.24;
}

.schedule-assignment-action.disabled .schedule-assignment-action-bg {
  fill: #edf0f5;
  opacity: 0.78;
  stroke: var(--line);
}

.schedule-assignment-action-label {
  fill: var(--ink);
  font-size: 10px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.schedule-assignment-action.disabled .schedule-assignment-action-label {
  fill: var(--muted);
  opacity: 0.75;
}

.schedule-assignment-reset-prompt-bg {
  fill: #fff;
  opacity: 1;
  stroke: var(--line);
  stroke-width: 1;
  pointer-events: all;
}

.schedule-assignment-reset-prompt-label {
  fill: var(--muted);
  font-size: 8px;
  font-weight: 650;
  dominant-baseline: middle;
  pointer-events: none;
}

.schedule-delay-mark {
  pointer-events: none;
}

.schedule-delay-bar {
  stroke: var(--shape-stroke);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.schedule-delay-mark.selected .schedule-delay-bar {
  stroke: var(--edit-accent);
}

.schedule-delay-delete-control {
  cursor: pointer;
}

.schedule-parameter-delete-control {
  cursor: pointer;
}

.schedule-condition-delete-control {
  cursor: pointer;
}

.schedule-delay-delete-bg {
  fill: var(--edit-accent);
  opacity: 0.18;
  stroke: var(--edit-accent);
  stroke-width: 2;
}

.schedule-delay-delete-line {
  stroke: var(--edit-accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  pointer-events: none;
}

.schedule-delay-delete-tooltip {
  opacity: 0;
  pointer-events: none;
}

.schedule-delay-delete-control:hover .schedule-delay-delete-tooltip {
  opacity: 1;
}

.schedule-parameter-delete-tooltip {
  opacity: 0;
  pointer-events: none;
}

.schedule-parameter-delete-control:hover .schedule-parameter-delete-tooltip {
  opacity: 1;
}

.schedule-condition-delete-tooltip {
  opacity: 0;
  pointer-events: none;
}

.schedule-condition-delete-control:hover .schedule-condition-delete-tooltip {
  opacity: 1;
}

.schedule-delay-delete-tooltip-bg {
  fill: #fff;
  opacity: 0.68;
}

.schedule-delay-delete-tooltip-label {
  fill: var(--ink);
  font-size: 10px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.delay-delete-menu {
  pointer-events: all;
}

.delay-delete-menu-bg {
  fill: #fff;
  stroke: var(--line);
  stroke-width: 1;
  opacity: 1;
  pointer-events: all;
}

.delay-delete-prompt-label {
  fill: var(--ink);
  font-size: 10px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.delay-delete-action {
  cursor: pointer;
}

.delay-delete-action-bg {
  fill: var(--edit-accent);
  opacity: 0.14;
  stroke: var(--edit-accent);
  stroke-width: 1.5;
}

.delay-delete-action-bg.secondary {
  fill: #fff;
  opacity: 0.92;
  stroke: var(--line);
}

.delay-delete-action-label {
  fill: var(--edit-accent);
  font-size: 10px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.delay-delete-action-label.secondary {
  fill: var(--muted);
}

.draft-anchor {
  fill: #fff;
  stroke: var(--edit-accent);
  stroke-width: 2.5;
  pointer-events: none;
}

.draft-anchor.source {
  fill: #fff4f4;
}

.draft-anchor.target {
  fill: #fff4f4;
  stroke: var(--edit-accent);
}

.event-ellipse,
.initial-assignment-rect {
  fill: var(--event-fill);
  stroke: var(--shape-stroke);
  stroke-width: 2.5;
}

.event-ellipse {
  pointer-events: stroke;
}

.event-ellipse-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  pointer-events: stroke;
}

.node-shape.selected .event-ellipse,
.node-shape.selected .initial-assignment-rect {
  stroke: var(--edit-accent);
}

.node-label {
  fill: var(--ink);
  font-size: 16px;
  font-weight: 650;
  white-space: pre;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: visiblePainted;
  cursor: text;
}

.node-label.initial-title {
  fill: var(--muted);
  font-size: 12px;
  text-anchor: start;
  cursor: default;
}

.node-label.initial-title tspan {
  dominant-baseline: auto;
}

.node-label.editing {
  fill: var(--edit-accent);
}

.initial-state-content {
  pointer-events: auto;
}

.initial-state-expression-object {
  pointer-events: auto;
  cursor: pointer;
}

.initial-state-variable-tooltip {
  opacity: 0;
  pointer-events: none;
}

.initial-state-variable:hover .initial-state-variable-tooltip {
  opacity: 1;
}

.initial-state-variable:hover .initial-state-expression {
  color: var(--edit-accent);
}

.initial-state-variable:hover .initial-state-expression .katex,
.initial-state-variable:hover .initial-state-expression .katex *,
.initial-state-variable:hover .initial-state-semicolon {
  color: var(--edit-accent);
}

.initial-state-variable-tooltip-bg {
  fill: #fff;
  opacity: 1;
}

.initial-state-empty {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.initial-state-expression {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
  color: var(--ink);
  font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", "STIXGeneral", "Times New Roman", serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.initial-state-expression .katex,
.initial-state-expression .katex * {
  font-weight: 700;
  white-space: nowrap;
}

.initial-state-expression .katex {
  flex: 0 0 auto;
}

.initial-state-semicolon {
  font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", "STIXGeneral", "Times New Roman", serif;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
  flex: 0 0 auto;
}

.initial-state-add,
.initial-state-editor {
  pointer-events: auto;
}

.initial-state-add {
  cursor: pointer;
}

.initial-state-add-tooltip {
  opacity: 0;
  pointer-events: none;
}

.initial-state-add:hover .initial-state-add-tooltip {
  opacity: 1;
}

.initial-state-value-input {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border: 1px solid #d3dbe8;
  border-radius: 7px;
  padding: 0 9px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-style: normal;
  font-weight: 500;
  line-height: 18px;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
}

.initial-state-value-input:focus {
  border-color: var(--edit-accent);
  box-shadow: 0 0 0 3px rgba(0, 140, 255, 0.12);
}

.node-label-tooltip {
  opacity: 0;
  pointer-events: none;
}

.node-label-group:hover .node-label-tooltip {
  opacity: 1;
}

.node-label-edit-bg {
  fill: var(--edit-accent);
  opacity: 0.22;
  pointer-events: none;
}

.node-label-selection-bg {
  fill: var(--edit-accent);
  opacity: 0.45;
  pointer-events: none;
}

.node-label-caret {
  stroke: var(--ink);
  stroke-width: 1.4;
  stroke-linecap: round;
  pointer-events: none;
  animation: caret-blink 1.05s steps(1, end) infinite;
}

.node-parameter-add,
.node-parameter-menu-option,
.node-parameter-letter,
.node-parameter-action,
.node-delete-control,
.node-delete-prompt-action,
.node-parameter-delete-prompt-action {
  cursor: pointer;
}

.node-delete-prompt {
  pointer-events: all;
}

.node-delete-control-bg {
  fill: #dc2626;
  opacity: 0.16;
  stroke: #dc2626;
  stroke-width: 1;
}

.node-delete-control:hover .node-delete-control-bg {
  opacity: 0.26;
}

.node-delete-control-label {
  fill: #dc2626;
  font-size: 9px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.node-delete-tooltip {
  opacity: 0;
  pointer-events: none;
}

.node-delete-control:hover .node-delete-tooltip {
  opacity: 1;
}

.node-delete-prompt-bg {
  fill: #fff;
  opacity: 1;
  stroke: var(--line);
  stroke-width: 1;
  pointer-events: all;
}

.node-delete-prompt-label {
  fill: var(--ink);
  font-size: 10px;
  font-weight: 650;
  text-anchor: start;
  dominant-baseline: middle;
  pointer-events: none;
}

.node-delete-prompt-title {
  fill: var(--ink);
  font-size: 10px;
  font-weight: 700;
  text-anchor: start;
  dominant-baseline: middle;
  pointer-events: none;
}

.node-delete-prompt-action-bg {
  fill: var(--edit-accent);
  opacity: 0.16;
  stroke: var(--edit-accent);
  stroke-width: 1;
}

.node-delete-prompt-action:hover .node-delete-prompt-action-bg {
  opacity: 0.24;
}

.node-delete-prompt-action-label {
  fill: var(--ink);
  font-size: 10px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.node-parameter-add-bg {
  fill: var(--edit-accent);
  opacity: 0.18;
  stroke: none;
}

.node-parameter-plus-line {
  stroke: var(--edit-accent);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

.node-parameter-add-tooltip,
.node-parameter-letter-tooltip {
  opacity: 0;
  pointer-events: none;
}

.node-parameter-add:hover .node-parameter-add-tooltip,
.node-parameter-letter:hover .node-parameter-letter-tooltip {
  opacity: 1;
}

.schedule-curve-slider-tooltip-bg,
.schedule-delay-add-tooltip-bg,
.schedule-parameter-tooltip-bg,
.schedule-condition-tooltip-bg,
.schedule-delay-delete-tooltip-bg,
.node-label-tooltip-bg,
.node-parameter-tooltip-bg {
  fill: #fff;
  opacity: 0.68;
}

.schedule-curve-slider-tooltip-label,
.schedule-delay-add-tooltip-label,
.schedule-parameter-tooltip-label,
.schedule-condition-tooltip-label,
.schedule-delay-delete-tooltip-label,
.node-label-tooltip-label,
.node-parameter-tooltip-label {
  fill: var(--tooltip-orange);
  font-size: 10px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.node-parameter-letter-tooltip .node-parameter-tooltip-bg {
  fill: #fff;
  opacity: 1;
  stroke: var(--tooltip-orange-border);
  stroke-width: 1;
}

.node-parameter-list-object {
  pointer-events: auto;
  cursor: grab;
}

.node-parameter-list {
  color: var(--ink);
  fill: var(--ink);
  font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", "STIXGeneral", "Times New Roman", serif;
  font-size: 16px;
  font-weight: 700;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  white-space: nowrap;
  pointer-events: auto;
  cursor: grab;
}

.canvas.panning .node-parameter-list-object,
.canvas.panning .node-parameter-list {
  cursor: grabbing;
}

.node-parameter-punctuation {
  font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", "STIXGeneral", "Times New Roman", serif;
  font-style: normal;
  font-weight: 700;
  pointer-events: none;
}

.node-parameter-separator {
  font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", "STIXGeneral", "Times New Roman", serif;
  font-style: normal;
  font-weight: 700;
  margin-right: 0.18em;
  pointer-events: none;
}

.node-parameter-symbol {
  font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", "STIXGeneral", "Times New Roman", serif;
  font-style: italic;
  font-weight: 700;
  color: var(--ink);
}

.node-parameter-symbol.roman {
  font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", "STIXGeneral", "Times New Roman", serif;
  font-style: normal;
}

.node-parameter-symbol {
  cursor: pointer;
}

.node-parameter-symbol.editing {
  fill: var(--edit-accent);
  color: var(--edit-accent);
}

.node-parameter-list .katex {
  font-size: 1em;
  line-height: 1;
  font-weight: 700;
}

.node-parameter-list .katex * {
  font-weight: 700;
}

.node-parameter-name-tooltip {
  opacity: 0;
  pointer-events: none;
}

.node-parameter-name-tooltip .node-parameter-tooltip-bg {
  fill: #fff;
  opacity: 1;
  stroke: var(--tooltip-orange-border);
  stroke-width: 1;
}

.node-parameter-name-tooltip.visible {
  opacity: 1;
}

.node-parameter-menu {
  pointer-events: all;
}

.node-parameter-menu-bg {
  fill: #fff;
  stroke: var(--line);
  stroke-width: 1;
  opacity: 1;
  pointer-events: all;
}

.node-parameter-menu-section-label {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0;
  text-anchor: start;
  dominant-baseline: middle;
  pointer-events: none;
}

.node-parameter-name-input,
.initial-state-name-input {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  padding: 2px 7px;
  color: var(--ink);
  background: #fff;
  font-size: 11px;
  font-weight: 400;
  font-family: inherit;
  line-height: 18px;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
}

.node-parameter-name-input:focus,
.initial-state-name-input:focus {
  border-color: var(--edit-accent);
  box-shadow: 0 0 0 2px rgba(0, 140, 255, 0.14);
}

.node-parameter-menu-option-bg,
.node-parameter-letter-bg {
  fill: #fff;
  stroke: var(--line);
  stroke-width: 1;
}

.node-parameter-menu-option:hover .node-parameter-menu-option-bg,
.node-parameter-letter:hover .node-parameter-letter-bg,
.node-parameter-letter.selected .node-parameter-letter-bg {
  fill: var(--edit-accent);
  opacity: 0.16;
  stroke: var(--edit-accent);
}

.node-parameter-letter.selected .node-parameter-letter-bg {
  stroke: var(--edit-accent);
  stroke-width: 1.5;
}

.node-parameter-action-bg {
  fill: var(--edit-accent);
  opacity: 0.16;
  stroke: var(--edit-accent);
  stroke-width: 1;
}

.node-parameter-action:hover .node-parameter-action-bg {
  opacity: 0.24;
}

.node-parameter-action.danger .node-parameter-action-bg {
  fill: #dc2626;
  stroke: #dc2626;
  opacity: 0.16;
}

.node-parameter-action.danger:hover .node-parameter-action-bg {
  opacity: 0.26;
}

.node-parameter-action.danger .node-parameter-action-label {
  fill: #dc2626;
}

.node-parameter-action.disabled {
  cursor: default;
}

.node-parameter-action.disabled .node-parameter-action-bg {
  fill: #edf0f5;
  opacity: 0.72;
  stroke: var(--line);
}

.node-parameter-action-label {
  fill: var(--ink);
  font-size: 10px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.node-parameter-action.disabled .node-parameter-action-label {
  fill: var(--muted);
  opacity: 0.7;
}

.node-parameter-delete-prompt-bg {
  fill: #fff;
  opacity: 1;
  stroke: var(--line);
  stroke-width: 1;
}

.node-parameter-delete-prompt-label {
  fill: var(--ink);
  font-size: 10px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.node-parameter-menu-option-label {
  fill: var(--ink);
  font-size: 10px;
  font-weight: 500;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.node-parameter-letter-label-object {
  pointer-events: none;
}

.node-parameter-letter-label {
  color: var(--ink);
  font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", "STIXGeneral", "Times New Roman", serif;
  font-size: 13px;
  font-weight: 700;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
}

.node-parameter-letter-label.roman {
  font-style: normal;
}

.node-parameter-letter-label .katex {
  font-size: 1em;
  line-height: 1;
  font-weight: 700;
}

.node-parameter-letter-label .katex * {
  font-weight: 700;
}

@keyframes caret-blink {
  0%,
  52% {
    opacity: 1;
  }

  53%,
  100% {
    opacity: 0;
  }
}

.resize-handle {
  fill: #fff;
  stroke: var(--edit-accent);
  stroke-width: 2.5;
  cursor: nwse-resize;
}

.placement-preview .event-ellipse,
.placement-preview .initial-assignment-rect {
  fill: transparent;
  stroke: var(--edit-accent);
  stroke-dasharray: 7 5;
}

.placement-preview .node-label {
  fill: var(--edit-accent);
}

.inline-editor {
  position: fixed;
  z-index: 5;
  display: none;
  width: 1px;
  height: 1px;
  min-width: 1px;
  min-height: 1px;
  appearance: none;
  border: 0;
  outline: none;
  padding: 0;
  background: transparent;
  color: transparent;
  font-size: 16px;
  font-weight: 650;
  text-align: center;
  line-height: 20px;
  overflow: hidden;
  caret-color: transparent;
  box-shadow: none;
  opacity: 0;
}

.inline-editor.active {
  display: block;
}

.zoom-panel {
  position: absolute;
  z-index: 4;
  border: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.shortcut-hint {
  position: absolute;
  z-index: 4;
  left: 14px;
  bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 9px;
  max-width: 440px;
  color: #8a94a6;
  font-size: 12px;
  line-height: 1.2;
  pointer-events: none;
}

.scale-ruler {
  position: absolute;
  z-index: 4;
  right: 14px;
  bottom: 62px;
  width: 180px;
  color: var(--muted);
  pointer-events: none;
}

.scale-line {
  position: relative;
  height: 24px;
  width: 100%;
  border-bottom: 1px solid var(--ink);
}

.scale-line::before,
.scale-line::after {
  content: "";
  position: absolute;
  bottom: -1px;
  width: 1px;
  height: 11px;
  background: var(--ink);
}

.scale-line::before {
  left: 0;
}

.scale-line::after {
  right: 0;
}

.scale-tick {
  position: absolute;
  bottom: -1px;
  width: 1px;
  height: 8px;
  background: var(--ink);
}

.scale-tick.major {
  width: 1px;
  height: 11px;
}

.scale-label {
  position: absolute;
  top: -14px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.scale-label.start {
  transform: translateX(0);
}

.scale-label.end {
  transform: translateX(-100%);
}

.zoom-panel {
  right: 14px;
  bottom: 14px;
  width: 220px;
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 12px;
}

#zoomValue {
  color: var(--ink);
  font-weight: 650;
}

#zoomSlider {
  width: 100%;
  height: 14px;
  appearance: none;
  background: transparent;
}

#zoomSlider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(74, 174, 232, 0.32);
}

#zoomSlider::-webkit-slider-thumb {
  appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: var(--accent);
}

#zoomSlider::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(74, 174, 232, 0.32);
}

#zoomSlider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 68px 1fr;
  }

  .tool-rail {
    padding: 10px 6px;
  }

  .tool-button {
    width: 54px;
    min-height: 56px;
  }

  .canvas-wrap {
    padding: 0;
  }
}
