html,
body {
  height: 100%;
  margin: 0;
  background: rgb(var(--ws-bg));
  color: rgb(var(--ws-text));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgb(var(--ws-border-strong)) transparent;
}

::selection {
  background: rgb(var(--ws-primary) / 0.2);
}

.ws-icon {
  flex: none;
  display: inline-block;
}

.hidden {
  display: none !important;
}

:focus-visible {
  outline: 2px solid rgb(var(--ws-primary) / 0.6);
  outline-offset: 1px;
}

.ws-app {
  display: grid;
  grid-template-rows: 52px 1fr;
  height: 100vh;
  height: 100dvh;
}

.ws-topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  background: rgb(var(--ws-surface));
  border-bottom: 1px solid rgb(var(--ws-border));
  position: relative;
  z-index: 30;
  min-width: 0;
}

.ws-topbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.ws-divider {
  width: 1px;
  height: 22px;
  background: rgb(var(--ws-border));
  margin: 0 6px;
  flex: none;
}

.ws-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  min-height: 0;
  position: relative;
}

.ws-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgb(var(--ws-border));
  background: rgb(var(--ws-surface));
  color: rgb(var(--ws-text));
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
  user-select: none;
}

.ws-btn:hover:not(:disabled) {
  background: rgb(var(--ws-surface-2));
  border-color: rgb(var(--ws-border-strong));
}

.ws-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ws-btn-primary {
  background: rgb(var(--ws-primary));
  border-color: rgb(var(--ws-primary));
  color: #fff;
  box-shadow: 0 1px 2px rgb(var(--ws-primary) / 0.3);
}

[data-theme='dark'] .ws-btn-primary {
  color: rgb(15 23 42);
}

.ws-btn-primary:hover:not(:disabled) {
  background: rgb(var(--ws-primary-hover));
  border-color: rgb(var(--ws-primary-hover));
}

.ws-btn-danger {
  background: rgb(var(--ws-danger));
  border-color: rgb(var(--ws-danger));
  color: #fff;
}

.ws-btn-danger:hover:not(:disabled) {
  filter: brightness(0.95);
  background: rgb(var(--ws-danger));
}

.ws-btn-ghost {
  border-color: transparent;
  background: transparent;
}

.ws-btn-ghost:hover:not(:disabled) {
  background: rgb(var(--ws-surface-2));
  border-color: transparent;
}

.ws-btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 7px;
}

.ws-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: rgb(var(--ws-text-2));
  cursor: pointer;
  flex: none;
  transition: background 0.12s, color 0.12s;
}

.ws-icon-btn:hover:not(:disabled) {
  background: rgb(var(--ws-surface-2));
  color: rgb(var(--ws-text));
}

.ws-icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.ws-icon-btn.is-active {
  background: rgb(var(--ws-primary-soft));
  color: rgb(var(--ws-primary));
}

.ws-icon-btn-sm {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.ws-badge {
  position: absolute;
  top: 2px;
  right: 1px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  color: #fff;
  background: rgb(var(--ws-danger));
  box-shadow: 0 0 0 2px rgb(var(--ws-surface));
  pointer-events: none;
}

.ws-badge.is-warning {
  background: rgb(var(--ws-warning));
}

.ws-input,
.ws-textarea,
.ws-select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgb(var(--ws-border));
  background: rgb(var(--ws-surface));
  color: rgb(var(--ws-text));
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.ws-input,
.ws-select {
  height: 32px;
  padding-top: 0;
  padding-bottom: 0;
}

.ws-textarea {
  resize: vertical;
  min-height: 64px;
  line-height: 1.45;
}

.ws-input::placeholder,
.ws-textarea::placeholder {
  color: rgb(var(--ws-subtle));
}

.ws-input:hover,
.ws-textarea:hover,
.ws-select:hover {
  border-color: rgb(var(--ws-border-strong));
}

.ws-input:focus,
.ws-textarea:focus,
.ws-select:focus {
  outline: none;
  border-color: rgb(var(--ws-primary));
  box-shadow: 0 0 0 3px rgb(var(--ws-primary) / 0.15);
}

.ws-input.is-invalid,
.ws-textarea.is-invalid {
  border-color: rgb(var(--ws-danger));
  box-shadow: 0 0 0 3px rgb(var(--ws-danger) / 0.12);
}

.ws-input[readonly] {
  background: rgb(var(--ws-surface-2));
  color: rgb(var(--ws-muted));
}

.ws-mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.ws-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: rgb(var(--ws-text-2));
  margin-bottom: 5px;
}

.ws-help {
  font-size: 11.5px;
  color: rgb(var(--ws-muted));
  margin-top: 4px;
}

.ws-error-text {
  font-size: 11.5px;
  color: rgb(var(--ws-danger));
  margin-top: 4px;
}

.ws-kbd {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  border: 1px solid rgb(var(--ws-border));
  border-bottom-width: 2px;
  background: rgb(var(--ws-surface-2));
  color: rgb(var(--ws-muted));
  font-size: 10.5px;
  font-family: inherit;
  font-weight: 500;
  white-space: nowrap;
}

.ws-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  background: rgb(var(--ws-surface-2));
  color: rgb(var(--ws-text-2));
  border: 1px solid rgb(var(--ws-border));
  white-space: nowrap;
}

.ws-switch {
  position: relative;
  width: 32px;
  height: 18px;
  flex: none;
  appearance: none;
  border-radius: 999px;
  background: rgb(var(--ws-surface-3));
  cursor: pointer;
  transition: background 0.15s;
  margin: 0;
}

.ws-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
  transition: transform 0.15s;
}

.ws-switch:checked {
  background: rgb(var(--ws-primary));
}

.ws-switch:checked::after {
  transform: translateX(14px);
}

.ws-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: rgb(var(--ws-text));
  font: inherit;
  font-weight: 650;
  font-size: 14px;
  letter-spacing: -0.01em;
  cursor: pointer;
  flex: none;
}

.ws-logo:hover {
  background: rgb(var(--ws-surface-2));
}

.ws-name-input {
  height: 30px;
  min-width: 80px;
  max-width: 320px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: rgb(var(--ws-text));
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 0 8px;
  text-overflow: ellipsis;
}

.ws-name-input:hover {
  border-color: rgb(var(--ws-border));
}

.ws-name-input:focus {
  outline: none;
  border-color: rgb(var(--ws-primary));
  background: rgb(var(--ws-surface));
  box-shadow: 0 0 0 3px rgb(var(--ws-primary) / 0.15);
}

.ws-save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: rgb(var(--ws-muted));
  white-space: nowrap;
  padding: 0 4px;
}

.ws-save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgb(var(--ws-success));
  flex: none;
}

.ws-save-status[data-state='unsaved'] .ws-save-dot {
  background: rgb(var(--ws-warning));
}

.ws-save-status[data-state='saving'] .ws-save-dot {
  background: rgb(var(--ws-info));
  animation: ws-pulse 1s infinite;
}

.ws-save-status[data-state='error'] .ws-save-dot {
  background: rgb(var(--ws-danger));
}

@keyframes ws-pulse {
  50% {
    opacity: 0.3;
  }
}

.ws-explorer {
  width: 272px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgb(var(--ws-surface));
  border-right: 1px solid rgb(var(--ws-border));
  z-index: 20;
  transition: margin 0.2s ease, transform 0.2s ease;
}

.ws-explorer.is-collapsed {
  margin-left: -272px;
}

.ws-explorer-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 16px;
}

.ws-cat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 6px;
  border: 0;
  background: transparent;
  color: rgb(var(--ws-muted));
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 6px;
}

.ws-cat-header:hover {
  color: rgb(var(--ws-text));
}

.ws-cat-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  flex: none;
}

.ws-component {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: grab;
  position: relative;
  transition: background 0.1s, border-color 0.1s;
}

.ws-component:hover {
  background: rgb(var(--ws-surface-2));
}

.ws-component:active {
  cursor: grabbing;
}

.ws-component-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.ws-component-title {
  font-weight: 550;
  font-size: 12.5px;
  color: rgb(var(--ws-text));
  line-height: 1.25;
}

.ws-component-desc {
  font-size: 11.5px;
  color: rgb(var(--ws-muted));
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ws-fav {
  opacity: 0;
  color: rgb(var(--ws-subtle));
}

.ws-component:hover .ws-fav,
.ws-fav.is-on,
.ws-component:focus-visible .ws-fav {
  opacity: 1;
}

.ws-fav.is-on {
  color: #f59e0b;
}

.ws-fav.is-on svg {
  fill: currentColor;
}

.ws-canvas-area {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: rgb(var(--ws-canvas));
}

.ws-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
  cursor: default;
}

.ws-canvas.is-panning,
.ws-canvas.mode-pan {
  cursor: grab;
}

.ws-canvas.is-panning {
  cursor: grabbing;
}

.ws-canvas.is-connecting {
  cursor: crosshair;
}

.ws-canvas.is-drop-target {
  outline: 2px dashed rgb(var(--ws-primary) / 0.5);
  outline-offset: -8px;
}

.ws-node {
  cursor: pointer;
}

.ws-node text,
.ws-lanes text,
.ws-group text {
  pointer-events: none;
}

.ws-node:hover .ws-node-body {
  stroke: rgb(var(--ws-border-strong));
}

.ws-port {
  cursor: crosshair;
  transition: r 0.1s;
}

.ws-port-hit {
  cursor: crosshair;
}

.ws-port-group:hover .ws-port,
.ws-port-group.is-hover .ws-port {
  r: 6.5;
  stroke: rgb(var(--ws-primary));
  stroke-width: 2;
}

.ws-port-group.is-valid .ws-port {
  r: 7;
  stroke: rgb(var(--ws-success));
  fill: rgb(var(--ws-success));
  stroke-width: 2;
}

.ws-port-group.is-invalid .ws-port {
  stroke: rgb(var(--ws-danger));
  stroke-width: 2;
}

.ws-canvas[data-connect-dir='out'][data-connect-kind='flow'] .ws-port-group[data-dir='in'][data-kind='flow'] .ws-port,
.ws-canvas[data-connect-dir='out'][data-connect-kind='reference'] .ws-port-group[data-dir='in'][data-kind='reference'] .ws-port,
.ws-canvas[data-connect-dir='in'][data-connect-kind='flow'] .ws-port-group[data-dir='out'][data-kind='flow'] .ws-port,
.ws-canvas[data-connect-dir='in'][data-connect-kind='reference'] .ws-port-group[data-dir='out'][data-kind='reference'] .ws-port {
  stroke: rgb(var(--ws-primary));
  stroke-width: 2;
}

.ws-connection {
  cursor: pointer;
}

.ws-port-group.is-connected-ref {
  opacity: 0;
  transition: opacity 0.12s ease;
}

.ws-node:hover .ws-port-group.is-connected-ref,
.ws-canvas.is-connecting .ws-port-group.is-connected-ref {
  opacity: 1;
}

.ws-canvas.refs-on-focus .ws-connection.is-reference:not(.is-focus),
.ws-canvas.is-far .ws-connection.is-reference:not(.is-focus) {
  display: none;
}

.ws-legend {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 15;
  width: 236px;
  max-height: calc(100% - 180px);
  overflow-y: auto;
  padding: 12px 14px;
  background: rgb(var(--ws-surface) / 0.96);
  border: 1px solid rgb(var(--ws-border));
  border-radius: 12px;
  box-shadow: var(--ws-shadow-md);
  font-size: 12px;
}

.ws-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  color: rgb(var(--ws-text-2));
}

.ws-connection {
  transition: opacity 0.12s ease;
}

.ws-connection:hover .ws-connection-path {
  stroke-width: 3;
}

.ws-connection.is-dim {
  opacity: 0.16;
}

.ws-connection.is-focus {
  opacity: 1;
}

.ws-connection.is-focus .ws-connection-path {
  stroke-width: 2.75;
}

.ws-resize-handle {
  cursor: nwse-resize;
}

.ws-group-header {
  cursor: move;
}

.ws-lane-header {
  cursor: pointer;
}

.ws-lane-resize {
  cursor: ns-resize;
}

.ws-floating {
  position: absolute;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: rgb(var(--ws-surface));
  border: 1px solid rgb(var(--ws-border));
  border-radius: 10px;
  box-shadow: var(--ws-shadow-md);
}

.ws-zoom-label {
  min-width: 48px;
  height: 26px;
  border: 0;
  background: transparent;
  color: rgb(var(--ws-text-2));
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  border-radius: 6px;
  cursor: pointer;
}

.ws-zoom-label:hover {
  background: rgb(var(--ws-surface-2));
}

.ws-minimap {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 15;
  width: 200px;
  height: 132px;
  background: rgb(var(--ws-surface) / 0.92);
  border: 1px solid rgb(var(--ws-border));
  border-radius: 10px;
  box-shadow: var(--ws-shadow-md);
  overflow: hidden;
  cursor: pointer;
  touch-action: none;
}

.ws-minimap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.ws-breadcrumb {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 15;
}

.ws-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
}

.ws-empty-card {
  pointer-events: auto;
  max-width: 420px;
  text-align: center;
  padding: 28px;
  border-radius: 16px;
  background: rgb(var(--ws-surface) / 0.9);
  border: 1px solid rgb(var(--ws-border));
  box-shadow: var(--ws-shadow-md);
  backdrop-filter: blur(6px);
}

.ws-inspector {
  width: 320px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgb(var(--ws-surface));
  border-left: 1px solid rgb(var(--ws-border));
  z-index: 20;
  transition: margin 0.2s ease;
}

.ws-inspector.is-hidden {
  margin-right: -320px;
  visibility: hidden;
}

.ws-inspector-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 24px;
}

.ws-section {
  padding: 14px 16px;
  border-bottom: 1px solid rgb(var(--ws-border));
}

.ws-section:last-child {
  border-bottom: 0;
}

.ws-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgb(var(--ws-muted));
  margin-bottom: 10px;
}

.ws-field + .ws-field {
  margin-top: 12px;
}

.ws-details > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgb(var(--ws-muted));
}

.ws-details > summary::-webkit-details-marker {
  display: none;
}

.ws-details > summary .ws-icon {
  transition: transform 0.15s;
}

.ws-details[open] > summary .ws-icon {
  transform: rotate(90deg);
}

.ws-swatch {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 2px solid rgb(var(--ws-surface));
  box-shadow: 0 0 0 1px rgb(var(--ws-border));
  cursor: pointer;
  padding: 0;
}

.ws-swatch.is-active {
  box-shadow: 0 0 0 2px rgb(var(--ws-primary));
}

.ws-ref-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 8px;
  border-radius: 8px;
  border: 1px solid rgb(var(--ws-border));
  background: rgb(var(--ws-surface-2) / 0.5);
  font-size: 12.5px;
}

.ws-ref-chip + .ws-ref-chip {
  margin-top: 4px;
}

.ws-validation {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 18;
  max-height: 42%;
  display: flex;
  flex-direction: column;
  background: rgb(var(--ws-surface));
  border-top: 1px solid rgb(var(--ws-border));
  box-shadow: 0 -8px 24px -12px rgb(15 23 42 / 0.2);
  transform: translateY(100%);
  transition: transform 0.2s ease;
}

.ws-validation.is-open {
  transform: translateY(0);
}

.ws-issue {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 8px 16px;
  border: 0;
  border-bottom: 1px solid rgb(var(--ws-border) / 0.6);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ws-issue:hover {
  background: rgb(var(--ws-surface-2));
}

.ws-sev-error {
  color: rgb(var(--ws-danger));
}

.ws-sev-warning {
  color: rgb(var(--ws-warning));
}

.ws-sev-info {
  color: rgb(var(--ws-info));
}

.ws-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid rgb(var(--ws-border));
  background: transparent;
  color: rgb(var(--ws-text-2));
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.ws-filter.is-off {
  opacity: 0.45;
}

.ws-menu {
  position: fixed;
  z-index: 1000;
  min-width: 200px;
  max-width: 320px;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 5px;
  background: rgb(var(--ws-surface));
  border: 1px solid rgb(var(--ws-border));
  border-radius: 11px;
  box-shadow: var(--ws-shadow-lg);
  animation: ws-pop 0.12s ease-out;
}

@keyframes ws-pop {
  from {
    opacity: 0;
    transform: translateY(-3px) scale(0.98);
  }
}

.ws-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgb(var(--ws-text));
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.ws-menu-item .ws-icon {
  color: rgb(var(--ws-muted));
}

.ws-menu-item:hover:not(:disabled),
.ws-menu-item.is-focused {
  background: rgb(var(--ws-surface-2));
}

.ws-menu-item:disabled {
  opacity: 0.4;
  cursor: default;
}

.ws-menu-item.is-danger {
  color: rgb(var(--ws-danger));
}

.ws-menu-item.is-danger .ws-icon {
  color: rgb(var(--ws-danger));
}

.ws-menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: rgb(var(--ws-border));
}

.ws-menu-header {
  padding: 6px 9px 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgb(var(--ws-subtle));
}

.ws-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgb(var(--ws-backdrop) / 0.45);
  backdrop-filter: blur(2px);
  animation: ws-fade 0.15s ease-out;
}

@keyframes ws-fade {
  from {
    opacity: 0;
  }
}

.ws-modal {
  width: 100%;
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  background: rgb(var(--ws-surface));
  border: 1px solid rgb(var(--ws-border));
  border-radius: 16px;
  box-shadow: var(--ws-shadow-lg);
  animation: ws-rise 0.18s ease-out;
  overflow: hidden;
}

@keyframes ws-rise {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}

.ws-modal-sm {
  max-width: 420px;
}

.ws-modal-md {
  max-width: 560px;
}

.ws-modal-lg {
  max-width: 760px;
}

.ws-modal-xl {
  max-width: 980px;
}

.ws-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 10px;
}

.ws-modal-title {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0;
}

.ws-modal-body {
  padding: 6px 20px 18px;
  overflow-y: auto;
}

.ws-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid rgb(var(--ws-border));
  background: rgb(var(--ws-surface-2) / 0.5);
}

.ws-card-option {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgb(var(--ws-border));
  background: rgb(var(--ws-surface));
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}

.ws-card-option:hover {
  border-color: rgb(var(--ws-primary) / 0.6);
  box-shadow: 0 0 0 3px rgb(var(--ws-primary) / 0.1);
}

.ws-card-option.is-selected {
  border-color: rgb(var(--ws-primary));
  box-shadow: 0 0 0 3px rgb(var(--ws-primary) / 0.15);
}

.ws-dropzone {
  border: 1.5px dashed rgb(var(--ws-border-strong));
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  color: rgb(var(--ws-muted));
  transition: border-color 0.12s, background 0.12s;
}

.ws-dropzone.is-over {
  border-color: rgb(var(--ws-primary));
  background: rgb(var(--ws-primary-soft));
}

.ws-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  background: rgb(var(--ws-surface-2));
}

.ws-tab {
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgb(var(--ws-muted));
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.ws-tab.is-active {
  background: rgb(var(--ws-surface));
  color: rgb(var(--ws-text));
  box-shadow: var(--ws-shadow-sm);
}

.ws-toasts {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.ws-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 8px 10px 8px 12px;
  border-radius: 10px;
  background: rgb(15 23 42);
  color: rgb(241 245 249);
  font-size: 13px;
  box-shadow: var(--ws-shadow-lg);
  pointer-events: auto;
  animation: ws-rise 0.18s ease-out;
}

[data-theme='dark'] .ws-toast {
  background: rgb(226 232 240);
  color: rgb(15 23 42);
}

.ws-toast-action {
  border: 0;
  background: transparent;
  color: rgb(165 180 252);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

[data-theme='dark'] .ws-toast-action {
  color: rgb(79 70 229);
}

.ws-tooltip {
  position: fixed;
  z-index: 1200;
  pointer-events: none;
  padding: 5px 8px;
  border-radius: 7px;
  background: rgb(15 23 42);
  color: rgb(241 245 249);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--ws-shadow-md);
  display: flex;
  align-items: center;
  gap: 6px;
  animation: ws-fade 0.1s ease-out;
}

[data-theme='dark'] .ws-tooltip {
  background: rgb(51 65 85);
}

.ws-tooltip .ws-kbd {
  background: rgb(255 255 255 / 0.12);
  border-color: rgb(255 255 255 / 0.15);
  color: rgb(226 232 240);
}

.ws-palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ws-palette-item.is-focused {
  background: rgb(var(--ws-primary-soft));
}

.ws-template-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgb(var(--ws-border));
  background: rgb(var(--ws-surface));
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.ws-template-card:hover {
  border-color: rgb(var(--ws-primary) / 0.6);
  box-shadow: 0 0 0 3px rgb(var(--ws-primary) / 0.1);
}

.ws-template-preview {
  height: 96px;
  border-radius: 8px;
  background: rgb(var(--ws-canvas));
  border: 1px solid rgb(var(--ws-border));
  overflow: hidden;
}

.ws-template-preview svg {
  width: 100%;
  height: 100%;
  display: block;
}

.ws-demo {
  position: relative;
  height: 150px;
  border-radius: 12px;
  border: 1px solid rgb(var(--ws-border));
  background-color: rgb(var(--ws-canvas));
  background-image: radial-gradient(rgb(var(--ws-grid)) 1px, transparent 1px);
  background-size: 16px 16px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.ws-list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.ws-list-row:hover {
  background: rgb(var(--ws-surface-2));
}

.ws-list-row.is-current {
  border-color: rgb(var(--ws-primary) / 0.4);
  background: rgb(var(--ws-primary-soft) / 0.6);
}

.ws-boot-error {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 2000;
  background: rgb(var(--ws-bg));
}

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

.ws-mobile-only {
  display: none;
}

@media (max-width: 1100px) {
  .ws-hide-md {
    display: none !important;
  }
}

@media (max-width: 860px) {
  .ws-hide-sm {
    display: none !important;
  }

  .ws-mobile-only {
    display: inline-flex;
  }

  .ws-main {
    grid-template-columns: 1fr;
  }

  .ws-explorer {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(300px, 86vw);
    margin-left: 0;
    box-shadow: var(--ws-shadow-lg);
    transform: translateX(0);
  }

  .ws-explorer.is-collapsed {
    margin-left: 0;
    transform: translateX(-105%);
  }

  .ws-inspector {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 60%;
    border-left: 0;
    border-top: 1px solid rgb(var(--ws-border));
    border-radius: 16px 16px 0 0;
    box-shadow: var(--ws-shadow-lg);
    margin-right: 0;
    transform: translateY(0);
    transition: transform 0.2s ease;
  }

  .ws-inspector.is-hidden {
    margin-right: 0;
    transform: translateY(105%);
  }

  .ws-minimap {
    display: none;
  }

  .ws-name-input {
    max-width: 40vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
