html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #111;
  color: white;
  font-family: sans-serif;
}

#viewport {
  position: relative;
  width: 100%;
  height: 100%;
  background-image: linear-gradient(#222 1px, transparent 1px), linear-gradient(90deg, #222 1px, transparent 1px);
  background-size: 50px 50px;
}

#world {
  position: absolute;
  left: -50000px;
  top: -50000px;
  width: 100000px;
  height: 100000px;
  transform-origin: 0 0;

  background-image:
    linear-gradient(#222 1px, transparent 1px),
    linear-gradient(90deg, #222 1px, transparent 1px);
  background-size: 50px 50px;
}


#connections {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  z-index: auto;
}

#nodes {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: auto;
}

.node {
  position: absolute;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  font-size: 14px;
  text-align: center;
  overflow: hidden;
}

.node:active {
  cursor: grabbing;
}

line {
  stroke-linecap: round;
}

#node-editor {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 220px;
  background: #1e1e1e;
  border: 1px solid #333;
  padding: 12px;
  border-radius: 8px;
  z-index: 999;
}

#node-editor.hidden {
  display: none;
}

#node-editor h3 {
  margin: 0 0 10px;
}

#node-editor label {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
}

#node-editor input {
  width: 100%;
}

#node-editor button {
  width: 100%;
  padding: 6px;
  background: #444;
  color: white;
  border: none;
  cursor: pointer;
}

.node-icon {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.node-title {
  position: relative;
  z-index: 1;
  text-shadow: 0 0 4px black;
  pointer-events: none;
  padding: 6px;
}

/* Shapes */
.node.circle {
  border-radius: 50%;
}

.node.square {
  border-radius: 8px;
}

.node.hex {
  border-radius: 0;
  clip-path: polygon(
    25% 0%,
    75% 0%,
    100% 50%,
    75% 100%,
    25% 100%,
    0% 50%
  );
}

.node:hover {
  outline: 2px solid rgba(255,255,255,0.2);
}
