/* fresh slate — moonpond visual language
   deep space glass · cyan accent · everything lowercase */

:root {
  --bg: #040a14;
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-strong: rgba(4, 10, 20, 0.72);
  --accent-1: #22d3ee;
  --accent-2: #8a9ef5;
  --accent-3: #6ee7b7;
  --accent-4: #c4d4e8;
  --gold: #c9a45c;
  --text: rgba(240, 246, 255, 0.92);
  --text-secondary: rgba(200, 212, 235, 0.62);
  --border: rgba(255, 255, 255, 0.05);
  --border-strong: rgba(255, 255, 255, 0.12);
  --font: "Avenir Next", "Avenir", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --rail-w: 250px;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 300;
  text-transform: lowercase;
}

/* ── background field ─────────────────────────────────────── */

.veil {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 50% 45%, transparent 0%, rgba(4, 10, 22, 0.58) 100%),
    radial-gradient(ellipse 70% 45% at 85% -5%, rgba(34, 211, 238, 0.1) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 10% 110%, rgba(138, 158, 245, 0.08) 0%, transparent 55%);
}

/* ── masthead ─────────────────────────────────────────────── */

.masthead {
  position: fixed;
  top: 22px;
  left: calc(var(--rail-w) + 44px);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: none;
}

.masthead-mark {
  font-size: 26px;
  color: var(--accent-1);
  filter: drop-shadow(0 0 10px rgba(138, 158, 245, 0.28));
}

.masthead-title {
  margin: 0;
  font-size: 26px;
  font-weight: 200;
  letter-spacing: 6px;
  color: var(--text);
}

.masthead-sub {
  margin: 3px 0 0;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 3px;
  color: var(--text-secondary);
}

/* ── rail ─────────────────────────────────────────────────── */

.rail {
  position: fixed;
  top: 18px;
  left: 18px;
  bottom: 56px;
  width: var(--rail-w);
  z-index: 40;
  display: flex;
  flex-direction: column;
  padding: 20px 18px;
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow-y: auto;
}

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.rail-head-spaced { margin-top: 26px; }

.rail-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 3px;
  color: var(--text-secondary);
}

.workspace-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.workspace-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.workspace-item:hover { background: rgba(255, 255, 255, 0.04); }

.workspace-item.active {
  background: rgba(34, 211, 238, 0.08);
  border-color: rgba(34, 211, 238, 0.35);
}

.workspace-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  outline: none;
}

.workspace-name[contenteditable="true"] {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 1px 6px;
  margin: -1px -6px;
  cursor: text;
}

.workspace-count {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.workspace-remove {
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.workspace-item:hover .workspace-remove { opacity: 1; }
.workspace-remove:hover { color: var(--accent-1); }

.rail-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.rail-note {
  margin: auto 0 0;
  padding-top: 22px;
  font-size: 10px;
  line-height: 1.7;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

/* ── buttons ──────────────────────────────────────────────── */

button {
  font-family: var(--font);
  text-transform: lowercase;
  cursor: pointer;
}

.primary {
  padding: 11px 18px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #04121c;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 2.5px;
  transition: letter-spacing 0.3s ease, filter 0.3s ease;
}

.primary:hover { letter-spacing: 4px; filter: brightness(1.08); }

.ghost {
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2px;
  transition: color 0.3s ease, border-color 0.3s ease, letter-spacing 0.3s ease;
}

.ghost:hover {
  color: var(--accent-1);
  border-color: rgba(34, 211, 238, 0.4);
  letter-spacing: 3px;
}

.ghost.round {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
}

.ghost.wide { width: 100%; }

.ghost.danger:hover {
  color: #f0a8b8;
  border-color: rgba(240, 168, 184, 0.35);
}

/* ── stage / world ────────────────────────────────────────── */

.stage {
  position: absolute;
  inset: 0 0 44px 0;
  z-index: 10;
  outline: none;
  overflow: hidden;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.07) 1px, transparent 1.4px);
  background-size: 28px 28px;
  cursor: grab;
}

.stage.panning { cursor: grabbing; }

.world {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
}

.edges {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
}

.edge-line {
  fill: none;
  stroke: rgba(138, 158, 245, 0.5);
  stroke-width: 1.6;
  transition: stroke 0.2s ease;
}

.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  cursor: pointer;
}

.edge-group:hover .edge-line { stroke: var(--accent-1); }
.edge-group.selected .edge-line { stroke: var(--gold); stroke-width: 2.4; }

.edge-temp {
  fill: none;
  stroke: var(--accent-1);
  stroke-width: 1.8;
  stroke-dasharray: 6 5;
  pointer-events: none;
}

.nodes { position: absolute; top: 0; left: 0; }

/* ── nodes ────────────────────────────────────────────────── */

.node {
  position: absolute;
  width: 240px;
  padding: 14px 16px 15px;
  background: rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid var(--border);
  border-radius: 18px;
  cursor: grab;
  user-select: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.node:hover { border-color: var(--border-strong); }

.node.selected {
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.25), 0 18px 44px -22px rgba(34, 211, 238, 0.35);
}

.node.dragging { cursor: grabbing; }

.node-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.node-accent {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-1);
  box-shadow: 0 0 8px currentColor;
  flex: none;
}

.node-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 1.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  outline: none;
}

.node-body {
  font-size: 11px;
  font-weight: 300;
  line-height: 1.65;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  outline: none;
  min-height: 16px;
}

.node-title[contenteditable="true"],
.node-body[contenteditable="true"] {
  cursor: text;
  user-select: text;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 3px 7px;
  margin: -3px -7px;
  overflow: visible;
  white-space: pre-wrap;
}

.node-port {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  margin-top: -6.5px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--glass-strong);
  cursor: crosshair;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.node-port:hover,
.node-port.armed {
  background: var(--accent-1);
  border-color: var(--accent-1);
  transform: scale(1.25);
}

.node-port.in { left: -7px; }
.node-port.out { right: -7px; }

/* ── empty hint ───────────────────────────────────────────── */

.empty-hint {
  position: absolute;
  top: 50%;
  left: calc(50% + var(--rail-w) / 2);
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 0.4s ease;
}

.empty-hint.hidden { opacity: 0; }

.empty-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 200;
  letter-spacing: 5px;
  color: var(--text-secondary);
}

.empty-sub {
  margin: 0;
  font-size: 11px;
  letter-spacing: 2.5px;
  color: rgba(200, 212, 235, 0.4);
}

/* ── statusbar ────────────────────────────────────────────── */

.statusbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 26px;
  background: var(--glass-strong);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  border-top: 1px solid var(--border);
  font-size: 11px;
  letter-spacing: 1.6px;
  color: var(--text-secondary);
}

.statusbar .dot { opacity: 0.45; }

.signature {
  margin-left: auto;
  font-size: 9px;
  letter-spacing: 2.5px;
  color: rgba(200, 212, 235, 0.4);
}

/* ── narrow screens ───────────────────────────────────────── */

@media (max-width: 860px) {
  :root { --rail-w: 200px; }
  .masthead { left: calc(var(--rail-w) + 26px); }
  .masthead-title { font-size: 20px; letter-spacing: 4px; }
  .signature { display: none; }
}
