* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-canvas: #fafafa;
  --bg-panel: #f5f5f5;
  --bg-node: #ffffff;
  --bg-input: #ffffff;
  --text-primary: #171717;
  --text-secondary: #737373;
  --text-muted: #a3a3a3;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --border: #e5e5e5;
  --dot-color: #e0e0e0;
  --slider-track: #d4d4d4;
  --slider-thumb: #737373;
  --shadow-node: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-node-hover: 0 4px 12px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-selected: 0 0 0 2px rgba(37,99,235,0.5);
  --nav-bg: rgba(255,255,255,0.8);
  --modal-bg: rgba(0,0,0,0.5);
  --toast-bg: #171717;
  --toast-text: #ededed;
}

[data-theme="dark"] {
  --bg-canvas: #0a0a0a;
  --bg-panel: #111111;
  --bg-node: #1c1c1c;
  --bg-input: #1a1a1a;
  --text-primary: #ededed;
  --text-secondary: #888888;
  --text-muted: #555555;
  --accent: #3b82f6;
  --accent-light: #1e3a5a;
  --border: #2a2a2a;
  --dot-color: #1a1a1a;
  --slider-track: #333333;
  --slider-thumb: #666666;
  --shadow-node: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-node-hover: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-selected: 0 0 0 2px rgba(59,130,246,0.6);
  --nav-bg: rgba(17,17,17,0.85);
  --toast-bg: #ededed;
  --toast-text: #171717;
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg-canvas);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

.mono {
  font-family: 'Geist Mono', monospace;
}

/* Canvas dot pattern */
.canvas-dots {
  background-image: radial-gradient(circle, var(--dot-color) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--slider-track);
  border-radius: 3px;
}

/* Slider styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--slider-track);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--slider-thumb);
  cursor: pointer;
  border: 2px solid var(--bg-panel);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--slider-thumb);
  cursor: pointer;
  border: 2px solid var(--bg-panel);
}

/* Edge animation */
@keyframes dashFlow {
  to { stroke-dashoffset: -20; }
}
.edge-animated {
  animation: dashFlow 1s linear infinite;
}

/* Slide in animation */
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.slide-in {
  animation: slideIn 0.2s ease-out;
}

/* Fade in */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in {
  animation: fadeIn 0.2s ease-out;
}

/* Toast animation */
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%) translateY(0); }
  to { opacity: 1; transform: translateX(0) translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}
.toast-in { animation: toastIn 0.3s ease-out; }
.toast-out { animation: toastOut 0.3s ease-in forwards; }

/* Context menu */
@keyframes menuIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.menu-in { animation: menuIn 0.15s ease-out; }

/* Glass morphism */
.glass {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Prevent text selection during drag */
.no-select {
  user-select: none;
  -webkit-user-select: none;
}

/* Node type colors */
.node-stripe-input { background: #3b82f6; }
.node-stripe-output { background: #22c55e; }
.node-stripe-process { background: #64748b; }
.node-stripe-decision { background: #f59e0b; }
.node-stripe-webhook { background: #a855f7; }

/* Code block styling */
.code-block {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  padding: 16px;
  border-radius: 8px;
  background: #0a0a0a;
  color: #e5e5e5;
  max-height: 400px;
  overflow: auto;
}

/* Color input */
input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}