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);
}

.mg {
  --cx: 212px;
  --cy: 88px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 424px;
}

.mg__hint {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-weight: 700;
  font-size: clamp(10px, 2.8vw, 12px);
  color: #17141a;
}

.mg__ico {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: #2f6df6;
}

.mg__field {
  position: relative;
  height: 176px;
  border-radius: 16px;
  background: rgba(47, 109, 246, 0.06);
  box-shadow: inset 0 0 0 1px rgba(23, 20, 26, 0.14);
  overflow: hidden;
  touch-action: none;
}

.mg__field:focus-visible {
  outline: 2px solid #2f6df6;
  outline-offset: 2px;
}

.mg__dot {
  position: absolute;
  left: 0;
  top: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #17141a;
  transform: translate(var(--hx), var(--hy));
}

.mg__magnet {
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #2f6df6;
  color: #ffffff;
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
  transform: translate(212px, 88px);
}

.mg__magnetIco {
  width: 14px;
  height: 14px;
}

.mg__bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.mg__mode, .mg__reset {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(10px, 2.6vw, 11px);
  line-height: 1;
}

.mg__mode {
  background: #2f6df6;
  color: #ffffff;
}

.mg__mode .mg__ico {
  color: #ffffff;
}

.mg__reset {
  background: #17141a;
  color: #ffffff;
}

.mg__reset .mg__ico {
  color: #ffffff;
}

.mg.is-demo .mg__dot {
  animation-name: mgSwoop;
  animation-duration: 2s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
  animation-delay: calc(var(--i) * -62.5ms);
}

@keyframes mgSwoop {
  0% {
    transform: translate(var(--hx), var(--hy)) scale(1);
  }
  10% {
    transform: translate(calc(var(--hx) + (var(--cx) - var(--hx)) * 0.2), calc(var(--hy) + (var(--cy) - var(--hy)) * 0.2)) scale(1.14);
  }
  22% {
    transform: translate(calc(var(--hx) + (var(--cx) - var(--hx)) * 0.38), calc(var(--hy) + (var(--cy) - var(--hy)) * 0.38)) scale(1.32);
  }
  36% {
    transform: translate(calc(var(--hx) + (var(--cx) - var(--hx)) * 0.12), calc(var(--hy) + (var(--cy) - var(--hy)) * 0.12)) scale(1.06);
  }
  46% {
    transform: translate(var(--hx), var(--hy)) scale(1);
  }
  58% {
    transform: translate(var(--hx), var(--hy)) scale(1);
  }
  70% {
    transform: translate(calc(var(--hx) + (var(--hx) - var(--cx)) * 0.26), calc(var(--hy) + (var(--hy) - var(--cy)) * 0.26)) scale(0.94);
  }
  84% {
    transform: translate(calc(var(--hx) + (var(--hx) - var(--cx)) * 0.1), calc(var(--hy) + (var(--hy) - var(--cy)) * 0.1)) scale(1);
  }
  94% {
    transform: translate(var(--hx), var(--hy)) scale(1);
  }
  100% {
    transform: translate(var(--hx), var(--hy)) scale(1);
  }
}
.mg.is-demo .mg__magnet {
  animation-name: mgBreath;
  animation-duration: 2s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  transform: translate(var(--cx), var(--cy));
}

@keyframes mgBreath {
  0%, 46%, 58%, 100% {
    transform: translate(var(--cx), var(--cy)) scale(1);
  }
  22% {
    transform: translate(var(--cx), var(--cy)) scale(1.16);
  }
  70% {
    transform: translate(var(--cx), var(--cy)) scale(0.9);
  }
}
@media (max-width: 340px) {
  .mg {
    gap: 8px;
    --cx: 147px;
    --cy: 52px;
  }
  .mg__field {
    height: 104px;
  }
  .mg__dot {
    width: 8px;
    height: 8px;
  }
  .mg__magnet {
    width: 20px;
    height: 20px;
  }
  .mg__magnetIco {
    width: 12px;
    height: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .mg.is-demo .mg__dot,
  .mg.is-demo .mg__magnet {
    animation: none !important;
  }
  .mg.is-demo .mg__dot {
    transform: translate(var(--hx), var(--hy)) !important;
  }
  .mg.is-demo .mg__magnet {
    transform: translate(var(--cx), var(--cy)) !important;
  }
}
