html, body {
  margin: 0;
  overflow: hidden;
}

.stage {
  box-sizing: border-box;
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0;
  background: #ffffff;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  padding: clamp(8px, 4vw, 24px);
}

.ng {
  box-sizing: border-box;
  width: min(100%, 432px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ng__canvas {
  position: relative;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 16px;
  border: 1px solid rgba(23, 20, 26, 0.14);
  border-radius: 16px;
  background-color: #ffffff;
  background-image: linear-gradient(to right, rgba(23, 20, 26, 0.09) 1px, transparent 1px), linear-gradient(to bottom, rgba(23, 20, 26, 0.09) 1px, transparent 1px);
  background-size: 16px 16px;
}

.ng__node {
  position: relative;
  box-sizing: border-box;
  width: clamp(104px, 36vw, 168px);
  padding: 12px;
  background: #fff7e6;
  border: 1px solid rgba(23, 20, 26, 0.22);
  border-radius: 16px;
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
}

.ng__head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
}

.ng__ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: #2f6df6;
  color: #fff7e6;
  flex: 0 0 auto;
}

.ng__ico svg {
  width: 64%;
  height: 64%;
}

.ng__name {
  font-weight: 800;
  font-size: clamp(10px, 3vw, 12px);
  line-height: 1.2;
  color: #17141a;
}

.ng__body {
  margin: 8px 0 0;
  font-weight: 500;
  font-size: clamp(8px, 2.4vw, 10px);
  line-height: 1.35;
  color: rgba(23, 20, 26, 0.74);
}

.ng__port {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 2px solid #ffffff;
  border-radius: 50%;
  cursor: pointer;
  transform-origin: 50% 50%;
  transform: translateY(-50%) scale(1);
  transition: transform 220ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.ng__port--in {
  left: -7px;
  background: #2f6df6;
}

.ng__port--out {
  right: -7px;
  background: #ff4d1f;
}

.ng__port:hover,
.ng__port:focus-visible {
  transform: translateY(-50%) scale(1.5);
}

.ng__legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.ng__hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: clamp(8px, 2.4vw, 10px);
  line-height: 1.3;
  color: rgba(23, 20, 26, 0.78);
}

.ng__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.ng__dot--in {
  background: #2f6df6;
}

.ng__dot--out {
  background: #ff4d1f;
}

.ng.is-demo .ng__port {
  animation-name: ngPortPulse;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

.ng.is-demo .ng__node:nth-child(1) .ng__port--in {
  animation-delay: 0ms;
}

.ng.is-demo .ng__node:nth-child(1) .ng__port--out {
  animation-delay: 200ms;
}

.ng.is-demo .ng__node:nth-child(2) .ng__port--in {
  animation-delay: 400ms;
}

.ng.is-demo .ng__node:nth-child(2) .ng__port--out {
  animation-delay: 600ms;
}

@keyframes ngPortPulse {
  0% {
    transform: translateY(-50%) scale(1);
  }
  12% {
    transform: translateY(-50%) scale(1.55);
  }
  26% {
    transform: translateY(-50%) scale(1);
  }
  100% {
    transform: translateY(-50%) scale(1);
  }
}
@media (max-width: 340px), (max-height: 220px) {
  .ng {
    gap: 8px;
  }
  .ng__canvas {
    gap: 8px;
    padding: 8px;
  }
  .ng__node {
    padding: 8px;
  }
  .ng__ico {
    width: 18px;
    height: 18px;
  }
  .ng__body {
    margin-top: 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ng.is-demo .ng__port {
    animation-name: none !important;
    transform: translateY(-50%) scale(1) !important;
  }
  .ng__port {
    transition: none !important;
  }
}
