-- Defold doesn't have built-in tweens
-- We create our own simple tween system

function tween_position(self, node, target, duration, callback)
    local start = gui.get_position(node)
    local elapsed = 0

    self.tween_update = function(self, dt)
        elapsed = elapsed + dt
        local t = math.min(elapsed / duration, 1)
        -- Ease-out curve
        t = 1 - (1 - t) * (1 - t)
        local pos = start + (target - start) * t
        gui.set_position(node, pos)
        if t >= 1 then
            self.tween_update = nil
            if callback then callback() end
        end
    end
end