@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700&family=Crimson+Text:ital,wght@0,400;0,600;1,400&family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400;1,600&display=swap');

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

:root {
  --sidebar-bg: #1a1816;
  --sidebar-bg-light: #252220;
  --sidebar-border: rgba(196, 160, 74, 0.12);
  --sidebar-text: #d8d0c4;
  --sidebar-text-muted: #8a8078;
  --accent: #c4a04a;
  --accent-hover: #b08e3a;
  --accent-glow: rgba(196, 160, 74, 0.18);
  --gold: #c4a04a;
  --bright-gold: #dbc070;
  --dark-gold: #7a6020;
  --node-bg: rgba(28, 26, 24, 0.92);
  --node-border: rgba(196, 160, 74, 0.3);
  --node-text: #d8d0c4;
  --node-text-muted: #8a8078;
  --canvas-bg: #141210;
  --header-bg: #0e0d0c;
  --header-border: rgba(196, 160, 74, 0.08);
  --toolbar-bg: #1a1816;
  --btn-bg: rgba(196, 160, 74, 0.06);
  --btn-border: rgba(196, 160, 74, 0.15);
  --btn-text: #c4b890;
  --btn-hover-bg: rgba(196, 160, 74, 0.12);
  --input-bg: rgba(0, 0, 0, 0.3);
  --input-border: rgba(196, 160, 74, 0.12);
  --input-focus: var(--accent);
  --modal-overlay: rgba(0, 0, 0, 0.75);
  --modal-bg: #252220;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
}

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

body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--header-bg);
  color: var(--sidebar-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}

.app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.sidebar {
  width: 320px;
  min-width: 320px;
  max-width: 320px;
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand .logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.brand .logo img {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  object-fit: cover;
}

.brand .title {
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.2;
}

.brand .subtitle {
  font-size: 11px;
  color: var(--sidebar-text-muted);
  line-height: 1.3;
}

.panel {
  border-bottom: 1px solid var(--sidebar-border);
  padding: 0;
}

.panel h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gold);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.panel h3:hover {
  background: rgba(255, 255, 255, 0.03);
}

.panel h3::before {
  content: '\25BE';
  font-size: 10px;
  color: var(--sidebar-text-muted);
  transition: transform var(--transition);
}

.panel.collapsed h3::before {
  transform: rotate(-90deg);
}

.panel > *:not(h3) {
  padding-left: 18px;
  padding-right: 18px;
}

.panel > *:last-child {
  padding-bottom: 14px;
}

.premium-panel {
  background: linear-gradient(135deg, rgba(196, 160, 74, 0.04), rgba(120, 95, 30, 0.02));
}

.premium-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #1a1a2e;
  background: linear-gradient(135deg, var(--bright-gold), var(--gold));
  padding: 2px 8px;
  border-radius: 4px;
  vertical-align: middle;
}

.premium-btn {
  background: linear-gradient(135deg, var(--bright-gold), var(--gold), var(--dark-gold)) !important;
  color: #1a1a2e !important;
  border-color: transparent !important;
  box-shadow: 0 4px 16px rgba(196, 160, 74, 0.2) !important;
  font-weight: 600 !important;
}

.premium-btn:hover {
  box-shadow: 0 6px 24px rgba(196, 160, 74, 0.35) !important;
  transform: translateY(-1px);
}

.sparkle {
  font-size: 1.1em;
}

.palette {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.palette-item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  background: var(--btn-bg);
  border: 1px dashed var(--btn-border);
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: 12px;
  font-weight: 500;
  cursor: grab;
  transition: all var(--transition);
  user-select: none;
  text-align: center;
}

.palette-item:hover {
  background: var(--btn-hover-bg);
  border-color: var(--accent);
  color: #fff;
}

.palette-item:active {
  cursor: grabbing;
  transform: scale(0.96);
}

.row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.row button {
  flex: 1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--sidebar-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.sidebar input[type="text"],
.sidebar input[type="email"],
.sidebar input[type="color"],
.sidebar input[type="file"],
.sidebar select,
.sidebar textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.sidebar input[type="text"]:focus,
.sidebar input[type="email"]:focus,
.sidebar select:focus,
.sidebar textarea:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.sidebar input[type="color"] {
  height: 34px;
  padding: 2px 4px;
  cursor: pointer;
}

.sidebar input[type="file"] {
  font-size: 11px;
  padding: 6px 8px;
}

.sidebar select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%2394a3b8' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.sidebar textarea {
  min-height: 80px;
  resize: vertical;
}

.sidebar input::placeholder,
.sidebar textarea::placeholder {
  color: var(--sidebar-text-muted);
  opacity: 0.6;
}

.backgrounds,
.compact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}

.compact-grid button {
  padding: 5px 4px;
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--sidebar-text-muted);
  margin-bottom: 8px;
  margin-top: 4px;
}

.section-title.spaced {
  margin-top: 16px;
}

.icon-btn {
  width: 32px !important;
  height: 32px;
  min-width: 32px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex: 0 0 auto !important;
}

#text-bold, #text-bold-float {
  font-weight: 800;
}

#text-italic, #text-italic-float {
  font-style: italic;
}

#text-underline, #text-underline-float {
  text-decoration: underline;
}

.hint {
  font-size: 12px;
  color: var(--sidebar-text-muted);
  line-height: 1.5;
  margin-bottom: 8px;
}

.hint-small {
  font-size: 11px;
  opacity: 0.7;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 18px;
  font-size: 11px;
  color: var(--sidebar-text-muted);
  text-align: center;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-footer a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
  transition: opacity var(--transition);
}

.sidebar-footer a:hover {
  opacity: 0.8;
}

.template-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  max-height: 200px;
  overflow-y: auto;
}

.template-list button {
  text-align: left;
  font-size: 12px;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-text);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.3;
}

button:hover {
  background: var(--btn-hover-bg);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

button:active {
  transform: scale(0.97);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

button.primary {
  background: linear-gradient(135deg, var(--gold), var(--bright-gold));
  border-color: var(--dark-gold);
  color: #1a0f28;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(196, 160, 74, 0.3);
}

button.primary:hover {
  background: linear-gradient(135deg, var(--bright-gold), var(--gold));
  border-color: var(--gold);
  box-shadow: 0 4px 16px rgba(196, 160, 74, 0.45);
}

button.secondary {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-text-muted);
}

button.ghost {
  background: transparent;
  border: 1px solid rgba(196, 160, 74, 0.2);
  color: var(--sidebar-text-muted);
  padding: 4px 12px;
  width: 100%;
}

button.ghost:hover {
  background: rgba(196, 160, 74, 0.08);
  color: var(--sidebar-text);
  border-color: rgba(196, 160, 74, 0.35);
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-text);
}

.editor-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  min-height: 52px;
  flex-shrink: 0;
}

.editor-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.editor-brand .logo {
  width: 32px;
  height: 32px;
}

.editor-brand .logo img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
}

.editor-brand .title {
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.2;
}

.editor-brand .subtitle {
  font-size: 10px;
  color: var(--sidebar-text-muted);
  line-height: 1.2;
}

.editor-links {
  display: flex;
  gap: 20px;
  margin-left: auto;
  align-items: center;
}

.editor-links a {
  font-size: 13px;
  color: var(--sidebar-text-muted);
  text-decoration: none;
  transition: color var(--transition);
  white-space: nowrap;
}

.editor-links a:hover,
.editor-links a.active {
  color: var(--gold);
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 16px;
  flex-shrink: 0;
}

.editor-nav {
  display: flex;
  gap: 4px;
}

.editor-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  color: var(--sidebar-text-muted);
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition);
}

.editor-icon:hover {
  background: var(--btn-hover-bg);
  color: #fff;
}

.editor-save {
  padding: 6px 18px;
  background: linear-gradient(135deg, var(--gold), var(--bright-gold));
  border: 1px solid var(--dark-gold);
  border-radius: var(--radius);
  color: #1a0f28;
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(196, 160, 74, 0.3);
}

.editor-save:hover {
  background: linear-gradient(135deg, var(--bright-gold), var(--gold));
  border-color: var(--gold);
  box-shadow: 0 4px 16px rgba(196, 160, 74, 0.45);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 20px;
  background: var(--toolbar-bg);
  border-bottom: 1px solid var(--header-border);
  min-height: 38px;
  flex-shrink: 0;
}

.toolbar .hint {
  margin: 0;
  font-size: 12px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.zoom-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: 6px;
  color: var(--sidebar-text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.zoom-btn:hover {
  background: var(--btn-hover-bg);
  color: #fff;
}

#zoom-fit, #zoom-reset {
  width: auto;
  padding: 0 8px;
  font-size: 11px;
}

.zoom-range {
  width: 100px;
  height: 4px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.zoom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--bright-gold);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.zoom-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--bright-gold);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--canvas-bg);
}

.zoom-indicator {
  position: absolute;
  bottom: 16px;
  right: 16px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  pointer-events: none;
  z-index: 20;
  backdrop-filter: blur(4px);
}

.text-toolbar {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(15, 18, 37, 0.95);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  z-index: 30;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.text-toolbar .compact {
  padding: 4px 6px;
  font-size: 11px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 4px;
  color: var(--sidebar-text);
  outline: none;
  max-width: 120px;
}

.text-toolbar .compact-color {
  width: 28px;
  height: 28px;
  padding: 1px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background: var(--input-bg);
  cursor: pointer;
}

.text-toolbar .icon-btn {
  width: 28px !important;
  height: 28px;
  min-width: 28px;
  font-size: 12px;
}

.canvas-zoom {
  width: 100%;
  height: 100%;
  overflow: auto;
  position: relative;
}

.canvas-stage {
  position: relative;
  min-width: 3000px;
  min-height: 3000px;
  transform-origin: 0 0;
}

.canvas {
  position: relative;
  min-width: 3000px;
  min-height: 3000px;
}

#connection-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

#connection-layer line,
#connection-layer path {
  stroke: var(--gold);
  stroke-width: 2;
  fill: none;
  pointer-events: stroke;
  cursor: pointer;
  filter: drop-shadow(0 0 3px rgba(196, 160, 74, 0.4));
}

#connection-layer line:hover,
#connection-layer path:hover {
  stroke-width: 4;
  stroke: var(--bright-gold);
}

#connection-layer .dashed {
  stroke-dasharray: 8 4;
}

#connection-layer .selected {
  stroke: var(--danger);
  stroke-width: 3;
}

.node {
  position: absolute;
  cursor: move;
  z-index: 2;
  user-select: none;
  transition: box-shadow 0.15s ease;
}

.node.selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--accent-glow), 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

.person-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--node-bg);
  border: 2px solid var(--node-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 0 6px rgba(196, 160, 74, 0.15);
  min-width: 180px;
}

.person-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 10px rgba(196, 160, 74, 0.25);
  border-color: var(--gold);
}

.avatar {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a1a3e, #3d2660);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--gold);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(196, 160, 74, 0.3);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.person-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.person-info .name {
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
}

.person-info .relation {
  font-size: 12px;
  color: var(--node-text-muted);
}

.person-info .age {
  font-size: 11px;
  color: var(--node-text-muted);
  opacity: 0.8;
}

.frame {
  padding: 20px;
  background: var(--node-bg);
  border: 2px solid var(--node-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 0 6px rgba(196, 160, 74, 0.15);
  min-width: 160px;
  min-height: 80px;
}

.frame:hover {
  border-color: var(--gold);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 10px rgba(196, 160, 74, 0.25);
}

.frame.classic {
  border-radius: 4px;
  border: 3px double var(--gold);
  box-shadow: 0 2px 12px rgba(0,0,0,0.3), inset 0 0 20px rgba(196,160,74,0.08), 0 0 8px rgba(196,160,74,0.15);
}

.frame.rounded {
  border-radius: 50%;
  border: 3px solid var(--gold);
  aspect-ratio: 1;
  min-width: 120px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.frame.modern {
  border-radius: 2px;
  border: 2px solid var(--node-border);
  border-left: 4px solid var(--gold);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.frame.ornate {
  border-radius: 8px;
  border: 4px solid var(--gold);
  box-shadow: 0 0 12px rgba(212,175,55,0.3), 0 2px 16px rgba(0,0,0,0.4), inset 0 0 30px rgba(196,160,74,0.06);
  background: linear-gradient(145deg, var(--node-bg), rgba(42,36,30,1));
}

.frame.shield {
  border-radius: 8px 8px 50% 50%;
  border: 3px solid var(--gold);
  min-height: 140px;
  clip-path: polygon(0 0, 100% 0, 100% 75%, 50% 100%, 0 75%);
  padding-bottom: 30px;
}

.frame.scroll {
  border-radius: 24px;
  border: 3px solid var(--gold);
  min-height: 80px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3), 0 0 6px rgba(196,160,74,0.15);
}

.frame .frame-title {
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--gold);
  text-align: center;
}

.text-box {
  padding: 12px 16px;
  background: rgba(28, 26, 24, 0.7);
  border: 1px solid rgba(196, 160, 74, 0.15);
  border-radius: var(--radius);
  min-width: 100px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
}

.text-box:hover {
  border-color: var(--gold);
}

.text-box .editable {
  color: var(--node-text);
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 14px;
}

.flip-card {
  width: 180px;
  height: 120px;
  perspective: 800px;
}

.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flip-card.flipped .flip-inner {
  transform: rotateY(180deg);
}

.flip-front,
.flip-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  background: var(--node-bg);
  border: 2px solid var(--node-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 0 6px rgba(196, 160, 74, 0.15);
}

.flip-back {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, #2a1a3e, #3d2660);
}

.flip-front .editable,
.flip-back .editable {
  font-size: 13px;
  color: var(--node-text);
  text-align: center;
}

.editable {
  outline: none;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 1px 3px;
  transition: border-color var(--transition), background var(--transition);
  min-width: 20px;
}

.editable:hover {
  border-color: rgba(0, 0, 0, 0.12);
}

.editable:focus {
  border-color: var(--gold);
  background: rgba(196, 160, 74, 0.08);
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--modal-overlay);
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--modal-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--sidebar-border);
}

.modal-header h2 {
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--sidebar-text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: all var(--transition);
}

.close-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.modal-body {
  padding: 24px;
}

.modal-description {
  font-size: 14px;
  color: var(--sidebar-text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

.ai-examples {
  margin-bottom: 20px;
}

.examples-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--sidebar-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.example-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  margin-bottom: 6px;
  background: rgba(196, 160, 74, 0.06);
  border: 1px solid rgba(196, 160, 74, 0.15);
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.example-btn:hover {
  background: rgba(196, 160, 74, 0.12);
  border-color: var(--gold);
}

.ai-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--sidebar-text);
  cursor: pointer;
}

.checkbox-field input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.ai-progress {
  margin-bottom: 16px;
}

.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--dark-gold), var(--gold), var(--bright-gold));
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s ease;
}

.progress-text {
  font-size: 12px;
  color: var(--sidebar-text-muted);
  text-align: center;
}

.share-list {
  font-size: 13px;
  color: var(--sidebar-text-muted);
  padding: 12px 0;
}

.modal-body .field {
  font-size: 12px;
  color: var(--sidebar-text-muted);
  text-transform: none;
  letter-spacing: normal;
}

.modal-body input[type="text"],
.modal-body textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.modal-body input[type="text"]:focus,
.modal-body textarea:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.modal-body textarea {
  min-height: 100px;
  resize: vertical;
}

.modal-body input::placeholder,
.modal-body textarea::placeholder {
  color: var(--sidebar-text-muted);
  opacity: 0.5;
}

.bg-tapestry { background: #141210; background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M40 0L40 80M0 40L80 40' stroke='%23c4a04a' stroke-opacity='0.05' stroke-width='0.5'/%3E%3Ccircle cx='40' cy='40' r='12' fill='none' stroke='%23c4a04a' stroke-opacity='0.03' stroke-width='0.5'/%3E%3Ccircle cx='40' cy='40' r='24' fill='none' stroke='%23c4a04a' stroke-opacity='0.02' stroke-width='0.5'/%3E%3C/svg%3E"); }
.bg-linen { background: #faf0e6; }
.bg-garden { background: linear-gradient(135deg, #e8f5e9, #c8e6c9); }
.bg-sky { background: linear-gradient(180deg, #e3f2fd, #bbdefb); }
.bg-parchment { background: #f5e6c8; background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h40v40H0z' fill='none'/%3E%3Cpath d='M0 20h40M20 0v40' stroke='%23d4a574' stroke-opacity='0.06' stroke-width='1'/%3E%3C/svg%3E"); }
.bg-ocean { background: linear-gradient(180deg, #0077b6, #023e8a); }
.bg-sunset { background: linear-gradient(135deg, #ff6b6b, #ffa500, #ffd93d); }
.bg-stone { background: #9e9e9e; background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='2' cy='2' r='1' fill='%23888' fill-opacity='0.2'/%3E%3C/svg%3E"); }
.bg-orchard { background: linear-gradient(135deg, #a8d5a2, #6dbf67, #4a9e44); }
.bg-midnight { background: linear-gradient(180deg, #0d1b2a, #1b2838, #2c3e50); }
.bg-sand { background: #f4e4c1; }
.bg-mist { background: linear-gradient(180deg, #eceff1, #cfd8dc, #b0bec5); }
.bg-blueprint { background: #1565c0; background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h40v40H0z' fill='none'/%3E%3Cpath d='M0 20h40M20 0v40' stroke='%23fff' stroke-opacity='0.08' stroke-width='0.5'/%3E%3C/svg%3E"); }
.bg-vintage { background: #f5e6d3; background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0L30 60M0 30L60 30' stroke='%238B7355' stroke-opacity='0.06' stroke-width='1'/%3E%3C/svg%3E"); }
.bg-marble { background: #f5f5f5; background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E"); }
.bg-wood { background: #8d6e63; background-image: repeating-linear-gradient(90deg, transparent, transparent 20px, rgba(0,0,0,0.05) 20px, rgba(0,0,0,0.05) 21px); }
.bg-clouds { background: linear-gradient(180deg, #87ceeb, #b0d4f1 40%, #e0e8f0 70%, #f0f0f0); }
.bg-forest-dark { background: linear-gradient(180deg, #1b3a2d, #2d5a3f, #1b3a2d); }
.bg-lavender { background: linear-gradient(135deg, #e8daef, #d2b4de); }
.bg-cherry { background: linear-gradient(135deg, #fce4ec, #f8bbd0, #f48fb1); }
.bg-slate-dark { background: linear-gradient(180deg, #1e293b, #334155); }
.bg-cream { background: #fffdd0; }
.bg-glacier { background: linear-gradient(180deg, #e0f7fa, #b2ebf2, #80deea); }
.bg-charcoal { background: #36454f; }
.bg-navy { background: linear-gradient(180deg, #0a1628, #1a2744, #2a3a5c); }
.bg-burgundy { background: linear-gradient(135deg, #4a0020, #6d0030, #4a0020); }
.bg-deep-purple { background: linear-gradient(180deg, #1a0033, #2d0052, #1a0033); }
.bg-ink { background: #0a0a0a; }
.bg-polka { background-color: #fafafa; background-image: radial-gradient(circle, #ccc 1px, transparent 1px); background-size: 20px 20px; }
.bg-stripes { background-color: #f5f5f5; background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,0.03) 10px, rgba(0,0,0,0.03) 20px); }
.bg-chevron { background-color: #f0f0f0; background-image: linear-gradient(135deg, rgba(0,0,0,0.03) 25%, transparent 25%), linear-gradient(225deg, rgba(0,0,0,0.03) 25%, transparent 25%), linear-gradient(315deg, rgba(0,0,0,0.03) 25%, transparent 25%), linear-gradient(45deg, rgba(0,0,0,0.03) 25%, transparent 25%); background-size: 40px 40px; background-position: 0 0, 0 20px, 20px -20px, 20px 0px; }
.bg-geometric { background-color: #f8f8f8; background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='30,5 55,20 55,50 30,65 5,50 5,20' fill='none' stroke='%23ddd' stroke-width='0.5'/%3E%3C/svg%3E"); }
.bg-hexagon { background-color: #f0f4f8; background-image: url("data:image/svg+xml,%3Csvg width='56' height='100' viewBox='0 0 56 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66ZM28 100L0 84L0 50L28 34L56 50L56 84L28 100Z' fill='none' stroke='%23cbd5e1' stroke-width='0.5'/%3E%3C/svg%3E"); }
.bg-damask { background-color: #f5f0e8; background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='20' cy='20' r='8' fill='none' stroke='%23c9b896' stroke-opacity='0.2' stroke-width='0.5'/%3E%3Ccircle cx='20' cy='20' r='16' fill='none' stroke='%23c9b896' stroke-opacity='0.1' stroke-width='0.5'/%3E%3C/svg%3E"); }
.bg-watercolor { background: linear-gradient(135deg, #e8f0fe 0%, #fce4ec 25%, #e8f5e9 50%, #fff3e0 75%, #ede7f6 100%); }
.bg-sketch { background-color: #fffef5; background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 20h40M20 0v40' stroke='%2390caf9' stroke-opacity='0.15' stroke-width='0.5'/%3E%3C/svg%3E"); }
.bg-chalkboard { background: #2d3436; background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='1' cy='1' r='0.5' fill='%23fff' fill-opacity='0.03'/%3E%3C/svg%3E"); }
.bg-crayon { background: linear-gradient(135deg, #fff9c4, #ffccbc, #f8bbd0, #e1bee7, #c5cae9, #b2dfdb); }
.bg-pastel { background: linear-gradient(180deg, #fce4ec, #e8eaf6, #e0f7fa); }
.bg-comic { background-color: #fffde7; background-image: radial-gradient(circle, #e0e0e0 1px, transparent 1px); background-size: 8px 8px; }
.bg-sunrise { background: linear-gradient(180deg, #1a237e 0%, #e65100 40%, #ff8f00 60%, #ffd54f 80%, #fff9c4 100%); }
.bg-meadow { background: linear-gradient(180deg, #81d4fa, #aed581 50%, #8bc34a 70%, #689f38); }
.bg-ice { background: linear-gradient(135deg, #e3f2fd, #e1f5fe, #f3e5f5, #e8eaf6); }
.bg-constellation { background: #0d1b2a; background-image: radial-gradient(circle, rgba(255,255,255,0.15) 1px, transparent 1px); background-size: 30px 30px; }
.bg-emerald { background: linear-gradient(135deg, #004d40, #00695c, #00897b); }
.bg-terra { background: linear-gradient(180deg, #bf360c, #8d6e63, #a1887f); }
.bg-confetti { background-color: #fafafa; background-image: radial-gradient(circle, #f44336 1px, transparent 1px), radial-gradient(circle, #2196f3 1px, transparent 1px), radial-gradient(circle, #4caf50 1px, transparent 1px), radial-gradient(circle, #ff9800 1px, transparent 1px); background-size: 40px 40px, 60px 60px, 50px 50px, 70px 70px; background-position: 0 0, 15px 30px, 35px 10px, 5px 45px; }
.bg-sandstone { background: linear-gradient(180deg, #d7ccc8, #bcaaa4, #a1887f); }

body.theme-slate {
  --sidebar-bg: #16192b;
  --sidebar-bg-light: #1e2240;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.25);
  --header-bg: #0f1225;
  --toolbar-bg: #1a1d35;
  --modal-bg: #1e2240;
  --node-bg: #ffffff;
  --node-border: #cbd5e1;
  --node-text: #1e293b;
  --node-text-muted: #64748b;
}

body.theme-heritage {
  --sidebar-bg: #1a1816;
  --sidebar-bg-light: #252220;
  --sidebar-border: rgba(196, 160, 74, 0.12);
  --accent: #c4a04a;
  --accent-hover: #b08e3a;
  --accent-glow: rgba(196, 160, 74, 0.18);
  --header-bg: #0e0d0c;
  --header-border: rgba(196, 160, 74, 0.08);
  --toolbar-bg: #1a1816;
  --modal-bg: #252220;
  --btn-bg: rgba(196, 160, 74, 0.06);
  --btn-border: rgba(196, 160, 74, 0.15);
  --input-bg: rgba(0, 0, 0, 0.3);
  --input-border: rgba(196, 160, 74, 0.12);
  --input-focus: #c4a04a;
  --node-bg: rgba(28, 26, 24, 0.92);
  --node-border: rgba(196, 160, 74, 0.3);
  --node-text: #d8d0c4;
  --node-text-muted: #8a8078;
}

body.theme-breeze {
  --sidebar-bg: #0c2d48;
  --sidebar-bg-light: #145374;
  --sidebar-border: rgba(100, 200, 255, 0.1);
  --accent: #00b4d8;
  --accent-hover: #0096c7;
  --accent-glow: rgba(0, 180, 216, 0.2);
  --header-bg: #062033;
  --header-border: rgba(100, 200, 255, 0.08);
  --toolbar-bg: #0c2d48;
  --modal-bg: #145374;
  --btn-bg: rgba(0, 180, 216, 0.08);
  --btn-border: rgba(0, 180, 216, 0.2);
  --input-bg: rgba(0, 0, 0, 0.3);
  --input-border: rgba(0, 180, 216, 0.15);
  --input-focus: #00b4d8;
  --node-bg: #f0f9ff;
  --node-border: #7dd3fc;
  --node-text: #0c4a6e;
  --node-text-muted: #38bdf8;
}

body.theme-forest {
  --sidebar-bg: #1a2e1a;
  --sidebar-bg-light: #2d4a2d;
  --sidebar-border: rgba(76, 175, 80, 0.12);
  --accent: #4caf50;
  --accent-hover: #388e3c;
  --accent-glow: rgba(76, 175, 80, 0.2);
  --header-bg: #0f1f0f;
  --header-border: rgba(76, 175, 80, 0.08);
  --toolbar-bg: #1a2e1a;
  --modal-bg: #2d4a2d;
  --btn-bg: rgba(76, 175, 80, 0.08);
  --btn-border: rgba(76, 175, 80, 0.2);
  --input-bg: rgba(0, 0, 0, 0.3);
  --input-border: rgba(76, 175, 80, 0.15);
  --input-focus: #4caf50;
  --node-bg: #f1f8e9;
  --node-border: #a5d6a7;
  --node-text: #1b5e20;
  --node-text-muted: #4caf50;
}

body.theme-neon {
  --sidebar-bg: #0a0a1a;
  --sidebar-bg-light: #14142a;
  --sidebar-border: rgba(0, 255, 136, 0.1);
  --sidebar-text: #e0ffe0;
  --sidebar-text-muted: #66ff99;
  --accent: #00ff88;
  --accent-hover: #00cc6a;
  --accent-glow: rgba(0, 255, 136, 0.25);
  --header-bg: #050510;
  --header-border: rgba(0, 255, 136, 0.08);
  --toolbar-bg: #0a0a1a;
  --modal-bg: #14142a;
  --btn-bg: rgba(0, 255, 136, 0.06);
  --btn-border: rgba(0, 255, 136, 0.2);
  --btn-text: #88ffbb;
  --input-bg: rgba(0, 0, 0, 0.4);
  --input-border: rgba(0, 255, 136, 0.15);
  --input-focus: #00ff88;
  --node-bg: #0f0f2a;
  --node-border: rgba(0, 255, 136, 0.3);
  --node-text: #e0ffe0;
  --node-text-muted: #66ff99;
}

body.theme-cosmic {
  --sidebar-bg: #0f0028;
  --sidebar-bg-light: #1a0040;
  --sidebar-border: rgba(168, 85, 247, 0.12);
  --sidebar-text: #e8d5ff;
  --sidebar-text-muted: #a78bfa;
  --accent: #a855f7;
  --accent-hover: #9333ea;
  --accent-glow: rgba(168, 85, 247, 0.25);
  --header-bg: #08001a;
  --header-border: rgba(168, 85, 247, 0.08);
  --toolbar-bg: #0f0028;
  --modal-bg: #1a0040;
  --btn-bg: rgba(168, 85, 247, 0.08);
  --btn-border: rgba(168, 85, 247, 0.2);
  --btn-text: #c4b5fd;
  --input-bg: rgba(0, 0, 0, 0.3);
  --input-border: rgba(168, 85, 247, 0.15);
  --input-focus: #a855f7;
  --node-bg: #faf5ff;
  --node-border: #c4b5fd;
  --node-text: #3b0764;
  --node-text-muted: #7c3aed;
}

body.theme-sunset-glow {
  --sidebar-bg: #2d1b0e;
  --sidebar-bg-light: #3d2515;
  --sidebar-border: rgba(251, 146, 60, 0.12);
  --sidebar-text: #fff1e6;
  --sidebar-text-muted: #fb923c;
  --accent: #f97316;
  --accent-hover: #ea580c;
  --accent-glow: rgba(249, 115, 22, 0.25);
  --header-bg: #1a0f06;
  --header-border: rgba(251, 146, 60, 0.08);
  --toolbar-bg: #2d1b0e;
  --modal-bg: #3d2515;
  --btn-bg: rgba(249, 115, 22, 0.08);
  --btn-border: rgba(249, 115, 22, 0.2);
  --btn-text: #fdba74;
  --input-bg: rgba(0, 0, 0, 0.3);
  --input-border: rgba(249, 115, 22, 0.15);
  --input-focus: #f97316;
  --node-bg: #fff7ed;
  --node-border: #fdba74;
  --node-text: #7c2d12;
  --node-text-muted: #ea580c;
}

body.theme-ocean-deep {
  --sidebar-bg: #001220;
  --sidebar-bg-light: #002040;
  --sidebar-border: rgba(34, 211, 238, 0.1);
  --sidebar-text: #e0f7fa;
  --sidebar-text-muted: #67e8f9;
  --accent: #06b6d4;
  --accent-hover: #0891b2;
  --accent-glow: rgba(6, 182, 212, 0.25);
  --header-bg: #000a14;
  --header-border: rgba(34, 211, 238, 0.08);
  --toolbar-bg: #001220;
  --modal-bg: #002040;
  --btn-bg: rgba(6, 182, 212, 0.08);
  --btn-border: rgba(6, 182, 212, 0.2);
  --btn-text: #67e8f9;
  --input-bg: rgba(0, 0, 0, 0.3);
  --input-border: rgba(6, 182, 212, 0.15);
  --input-focus: #06b6d4;
  --node-bg: #ecfeff;
  --node-border: #67e8f9;
  --node-text: #164e63;
  --node-text-muted: #0891b2;
}

body.theme-rose-gold {
  --sidebar-bg: #2a1520;
  --sidebar-bg-light: #3d2030;
  --sidebar-border: rgba(244, 114, 182, 0.12);
  --sidebar-text: #fce7f3;
  --sidebar-text-muted: #f9a8d4;
  --accent: #ec4899;
  --accent-hover: #db2777;
  --accent-glow: rgba(236, 72, 153, 0.25);
  --header-bg: #1a0a14;
  --header-border: rgba(244, 114, 182, 0.08);
  --toolbar-bg: #2a1520;
  --modal-bg: #3d2030;
  --btn-bg: rgba(236, 72, 153, 0.08);
  --btn-border: rgba(236, 72, 153, 0.2);
  --btn-text: #f9a8d4;
  --input-bg: rgba(0, 0, 0, 0.3);
  --input-border: rgba(236, 72, 153, 0.15);
  --input-focus: #ec4899;
  --node-bg: #fdf2f8;
  --node-border: #f9a8d4;
  --node-text: #831843;
  --node-text-muted: #db2777;
}

body.theme-cyberpunk {
  --sidebar-bg: #0a0a14;
  --sidebar-bg-light: #151525;
  --sidebar-border: rgba(236, 72, 153, 0.1);
  --sidebar-text: #f0e6ff;
  --sidebar-text-muted: #c084fc;
  --accent: #ec4899;
  --accent-hover: #db2777;
  --accent-glow: rgba(236, 72, 153, 0.3);
  --header-bg: #050508;
  --header-border: rgba(168, 85, 247, 0.1);
  --toolbar-bg: #0a0a14;
  --modal-bg: #151525;
  --btn-bg: rgba(236, 72, 153, 0.06);
  --btn-border: rgba(236, 72, 153, 0.2);
  --btn-text: #f0abfc;
  --input-bg: rgba(0, 0, 0, 0.4);
  --input-border: rgba(168, 85, 247, 0.2);
  --input-focus: #ec4899;
  --node-bg: #1a1a2e;
  --node-border: rgba(236, 72, 153, 0.3);
  --node-text: #f0e6ff;
  --node-text-muted: #c084fc;
}

body.theme-botanical {
  --sidebar-bg: #0f1f14;
  --sidebar-bg-light: #1a3320;
  --sidebar-border: rgba(132, 204, 22, 0.1);
  --sidebar-text: #ecfccb;
  --sidebar-text-muted: #a3e635;
  --accent: #84cc16;
  --accent-hover: #65a30d;
  --accent-glow: rgba(132, 204, 22, 0.2);
  --header-bg: #081408;
  --header-border: rgba(132, 204, 22, 0.06);
  --toolbar-bg: #0f1f14;
  --modal-bg: #1a3320;
  --btn-bg: rgba(132, 204, 22, 0.06);
  --btn-border: rgba(132, 204, 22, 0.18);
  --btn-text: #bef264;
  --input-bg: rgba(0, 0, 0, 0.3);
  --input-border: rgba(132, 204, 22, 0.15);
  --input-focus: #84cc16;
  --node-bg: #f7fee7;
  --node-border: #bef264;
  --node-text: #365314;
  --node-text-muted: #65a30d;
}

body.theme-aurora {
  --sidebar-bg: #0a1628;
  --sidebar-bg-light: #122240;
  --sidebar-border: rgba(52, 211, 153, 0.1);
  --sidebar-text: #d1fae5;
  --sidebar-text-muted: #6ee7b7;
  --accent: #10b981;
  --accent-hover: #059669;
  --accent-glow: rgba(16, 185, 129, 0.25);
  --header-bg: #040e1a;
  --header-border: rgba(52, 211, 153, 0.06);
  --toolbar-bg: #0a1628;
  --modal-bg: #122240;
  --btn-bg: rgba(16, 185, 129, 0.06);
  --btn-border: rgba(16, 185, 129, 0.2);
  --btn-text: #6ee7b7;
  --input-bg: rgba(0, 0, 0, 0.3);
  --input-border: rgba(16, 185, 129, 0.15);
  --input-focus: #10b981;
  --node-bg: #ecfdf5;
  --node-border: #6ee7b7;
  --node-text: #064e3b;
  --node-text-muted: #059669;
}

body.theme-coral {
  --sidebar-bg: #2a1215;
  --sidebar-bg-light: #401a1e;
  --sidebar-border: rgba(251, 113, 133, 0.12);
  --sidebar-text: #ffe4e6;
  --sidebar-text-muted: #fda4af;
  --accent: #f43f5e;
  --accent-hover: #e11d48;
  --accent-glow: rgba(244, 63, 94, 0.25);
  --header-bg: #1a0a0c;
  --header-border: rgba(251, 113, 133, 0.08);
  --toolbar-bg: #2a1215;
  --modal-bg: #401a1e;
  --btn-bg: rgba(244, 63, 94, 0.08);
  --btn-border: rgba(244, 63, 94, 0.2);
  --btn-text: #fda4af;
  --input-bg: rgba(0, 0, 0, 0.3);
  --input-border: rgba(244, 63, 94, 0.15);
  --input-focus: #f43f5e;
  --node-bg: #fff1f2;
  --node-border: #fda4af;
  --node-text: #881337;
  --node-text-muted: #e11d48;
}

body.theme-minimal-dark {
  --sidebar-bg: #111111;
  --sidebar-bg-light: #1a1a1a;
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --sidebar-text: #e5e5e5;
  --sidebar-text-muted: #737373;
  --accent: #a3a3a3;
  --accent-hover: #d4d4d4;
  --accent-glow: rgba(163, 163, 163, 0.15);
  --header-bg: #0a0a0a;
  --header-border: rgba(255, 255, 255, 0.04);
  --toolbar-bg: #111111;
  --modal-bg: #1a1a1a;
  --btn-bg: rgba(255, 255, 255, 0.04);
  --btn-border: rgba(255, 255, 255, 0.08);
  --btn-text: #a3a3a3;
  --input-bg: rgba(0, 0, 0, 0.3);
  --input-border: rgba(255, 255, 255, 0.08);
  --input-focus: #a3a3a3;
  --node-bg: #1a1a1a;
  --node-border: rgba(255, 255, 255, 0.1);
  --node-text: #e5e5e5;
  --node-text-muted: #737373;
}

@media (max-width: 768px) {
  .app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 50vh;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
  }

  .workspace {
    height: 50vh;
    flex: 1;
  }

  .editor-header {
    padding: 8px 12px;
    gap: 8px;
  }

  .editor-brand {
    display: none;
  }

  .editor-links {
    gap: 12px;
    margin-left: 0;
  }

  .editor-links a {
    font-size: 12px;
  }

  .toolbar {
    padding: 4px 12px;
    flex-wrap: wrap;
  }

  .zoom-range {
    width: 60px;
  }
}

@media (max-width: 480px) {
  .editor-links {
    display: none;
  }

  .compact-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .palette {
    grid-template-columns: 1fr;
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-content {
  animation: fadeIn 0.2s ease-out;
}

@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.progress-text {
  animation: progressPulse 2s ease-in-out infinite;
}

@media print {
  .sidebar,
  .editor-header,
  .toolbar,
  .text-toolbar,
  .zoom-indicator {
    display: none !important;
  }

  .app {
    display: block;
  }

  .workspace {
    height: auto;
  }

  .canvas-container {
    overflow: visible;
    height: auto;
  }
}
